summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <[email protected]>2016-11-03 08:56:23 +0100
committerJuan A. Suarez Romero <[email protected]>2016-12-21 12:37:22 +0100
commitc32a9ec5f5bd74ae03b84be4c51d8d174ddf3e17 (patch)
tree91bd9ed850828f2f07db39a91a66ba93c21ee096 /src
parent8801734da701d95608e39d829e0a31a191ee68f2 (diff)
i965: allow unsourced enabled VAO
The GL 4.5 spec says: "If any enabled array’s buffer binding is zero when DrawArrays or one of the other drawing commands defined in section 10.4 is called, the result is undefined." This commits avoids crashing the code, which is not a very good "undefined result". This fixes spec/!opengl 3.1/vao-broken-attrib piglit test.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index b138cb7ef62..57815645924 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -423,13 +423,22 @@ copy_array_to_vbo_array(struct brw_context *brw,
uint8_t *dst = intel_upload_space(brw, size, dst_stride,
&buffer->bo, &buffer->offset);
- if (dst_stride == src_stride) {
- memcpy(dst, src, size);
- } else {
- while (count--) {
- memcpy(dst, src, dst_stride);
- src += src_stride;
- dst += dst_stride;
+ /* The GL 4.5 spec says:
+ * "If any enabled array’s buffer binding is zero when DrawArrays or
+ * one of the other drawing commands defined in section 10.4 is called,
+ * the result is undefined."
+ *
+ * In this case, let's the dst with undefined values
+ */
+ if (src != NULL) {
+ if (dst_stride == src_stride) {
+ memcpy(dst, src, size);
+ } else {
+ while (count--) {
+ memcpy(dst, src, dst_stride);
+ src += src_stride;
+ dst += dst_stride;
+ }
}
}
buffer->stride = dst_stride;