Mesa (9.2): meta: enable vertex attributes in the context of the newly created array object

Carl Worth cworth at kemper.freedesktop.org
Wed Nov 13 01:01:17 UTC 2013


Module: Mesa
Branch: 9.2
Commit: cf33e6d85d21a1b628c8477b4bd1435e386007cb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf33e6d85d21a1b628c8477b4bd1435e386007cb

Author: Petr Sebor <petr at scssoft.com>
Date:   Mon Nov 11 16:19:00 2013 -0700

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" <mesa-stable at lists.freedesktop.org>
Cc: "10.0" <mesa-stable at lists.freedesktop.org>

Signed-off-by: Petr Sebor <petr at scssoft.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit f2b844f59d86c5971118bfccb00ddc5a1b69797a)

---

 src/mesa/drivers/common/meta.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index f818416..3b5555e 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)




More information about the mesa-commit mailing list