[Mesa-dev] [PATCH] meta: rebind the array object to prevent corruption of current one in setup_glsl_blit_framebuffer

Petr Sebor petr at scssoft.com
Sun Nov 10 05:16:04 PST 2013


Without the rebind, the function enables 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 enabled generic attribute 0 got precedence before vertex position attribute
at later time, leading to NULL pointer dereference.

Signed-off-by: Petr Sebor <petr at scssoft.com>
---
 src/mesa/drivers/common/meta.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index aa50dde..06e3e3c 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1516,6 +1516,11 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
       _mesa_VertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,
                                    sizeof(struct vertex), OFFSET(s));
    }
+   else {
+      /* Rebind the existing ArrayObj so that _mesa_EnableVertexAttribArray */
+      /* calls do not corrupt the current one. */
+      _mesa_BindVertexArray(blit->ArrayObj);
+   }
 
    /* Generate a relevant fragment shader program for the texture target */
    if ((target == GL_TEXTURE_2D && blit->ShaderProg != 0) ||
-- 
1.8.3.2



More information about the mesa-dev mailing list