On 11/10/2013 05:16 AM, Petr Sebor wrote: > 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.
After setup_glsl_blit_framebuffer returns, the caller also calls _mesa_BindVertexArray(blit->ArrayObj). This is around line 1677. I think it may be better to just move the _mesa_EnableVertexAttribArray calls up into the if-statement that creates the vertex array object. That should result in fewer attempts at state changes. Does that also fix the problem? > Signed-off-by: Petr Sebor <p...@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) || > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev