Skip to content
Commit 64f17d66 authored by Gert Wollny's avatar Gert Wollny Committed by Juan A. Suarez Romero
Browse files

mesa: Reference count shaders that are used by transform feedback objects

Transform feedback objects may hold a pointer to a shader program, and
at least in Gallium, this must be a valid pointer until
ctx->Driver.EndTransformFeedback in glEndTransformFeedback has been called
- which is conform with the spec that any program that is part of a
current rendering state should only be flagged for deletion by glDeleteProgram.
This was not handled properly for the transform feedback objects so that
a call sequence

  glUseProgram(x)
  glBeginTransformFreedback(...)
  glPauseTransformFeedback(...)
  glDeleteProgram(x)
  glEndTransformFeedback(...)

would result in a use after free bug. With this patch the transform
feedback object also updates the reference count to the used program
thereby keeping the program valid as long as the transform feedback
objects links to it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108713


Fixes: 65458769
       mesa: add end_transform_feedback() helper

Signed-off-by: default avatarGert Wollny <gert.wollny@collabora.com>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
(cherry picked from commit caa964b4)
parent 94161eed
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment