mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
Unreference sampler object when it's currently bound to texture unit.
This change specifically unbinds a sampler object from the texture unit if it's bound to a unit. The spec calls for default object when deleting sampler objects which are currently bound. Note: this is a candidate for the stable branches Signed-off-by: Alan Hourihane <alanh@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
b21f8e364b
commit
cf0b4a30fc
1 changed files with 10 additions and 0 deletions
|
|
@ -206,9 +206,19 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
|
|||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (samplers[i]) {
|
||||
GLuint j;
|
||||
struct gl_sampler_object *sampObj =
|
||||
_mesa_lookup_samplerobj(ctx, samplers[i]);
|
||||
|
||||
if (sampObj) {
|
||||
/* If the sampler is currently bound, unbind it. */
|
||||
for (j = 0; j < ctx->Const.MaxCombinedTextureImageUnits; j++) {
|
||||
if (ctx->Texture.Unit[j].Sampler == sampObj) {
|
||||
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
|
||||
_mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[j].Sampler, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* The ID is immediately freed for re-use */
|
||||
_mesa_HashRemove(ctx->Shared->SamplerObjects, samplers[i]);
|
||||
/* But the object exists until its reference count goes to zero */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue