[Mesa-dev] [PATCH] meta: rebind the array object to prevent corruption of current one in setup_glsl_blit_framebuffer
Brian Paul
brianp at vmware.com
Mon Nov 11 08:30:25 PST 2013
On 11/10/2013 06: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.
>
> 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) ||
>
I think another way to fix this would be to move the two calls to
_mesa_EnableVertexAttribArray() up into the if blit->ArrayObj == 0
section where we setup the vertex pointers. Then it would be consistent
with the setup_ff_blit_framebuffer() function.
Can you try that change?
-Brian
More information about the mesa-dev
mailing list