summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Sebor <[email protected]>2013-11-11 16:19:00 -0700
committerBrian Paul <[email protected]>2013-11-12 11:56:30 -0700
commitf2b844f59d86c5971118bfccb00ddc5a1b69797a (patch)
tree97b6ed810e32fb772a44ac1ac1dd6c90c5bda0d0
parent76317355bd8adca1fb5ef33b021962413db0c69d (diff)
meta: enable vertex attributes in the context of the newly created array object
Otherwise, the function would enable generic vertex attributes 0 and 1 of the array object it does not own. This was causing crashes in Euro Truck Simulator 2, since the incorrectly enabled generic attribute 0 in the foreign context got precedence before vertex position attribute at later time, leading to NULL pointer dereference. Cc: "9.2" <[email protected]> Cc: "10.0" <[email protected]> Signed-off-by: Petr Sebor <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/mesa/drivers/common/meta.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index aa50dde734b..99b02baadc5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1515,6 +1515,9 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
sizeof(struct vertex), OFFSET(x));
_mesa_VertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,
sizeof(struct vertex), OFFSET(s));
+
+ _mesa_EnableVertexAttribArray(0);
+ _mesa_EnableVertexAttribArray(1);
}
/* Generate a relevant fragment shader program for the texture target */
@@ -1591,8 +1594,6 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
_mesa_DeleteObjectARB(vs);
_mesa_BindAttribLocation(ShaderProg, 0, "position");
_mesa_BindAttribLocation(ShaderProg, 1, "texcoords");
- _mesa_EnableVertexAttribArray(0);
- _mesa_EnableVertexAttribArray(1);
link_program_with_debug(ctx, ShaderProg);
ralloc_free(mem_ctx);
if (texture_2d)