summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2015-11-11 11:01:46 -0800
committerIan Romanick <[email protected]>2016-01-11 15:38:04 -0800
commitb03ee127d8b064af13ab8874548ed39885c14094 (patch)
treec7377c8fe6fb5a5a2e1021d40193290c99a15352 /src/mesa
parentd4094f64c1c1d94125931c95a2dad04ab1261ff2 (diff)
meta/decompress: Save and restore the sampler using gl_sampler_object instead of GL API object handle
Some meta operations can be called recursively. Future changes (the "Don't pollute the ... namespace" changes) will cause objects with invalid names to be used. If a nested meta operation tries to restore an object named 0xDEADBEEF, it will fail. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 3fc966c8f40..385ea6449b8 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3017,7 +3017,7 @@ decompress_texture_image(struct gl_context *ctx,
GLenum rbFormat;
GLenum faceTarget;
struct vertex verts[4];
- GLuint samplerSave;
+ struct gl_sampler_object *samp_obj_save = NULL;
GLenum status;
const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader;
@@ -3067,8 +3067,8 @@ decompress_texture_image(struct gl_context *ctx,
_mesa_meta_begin(ctx, MESA_META_ALL & ~(MESA_META_PIXEL_STORE |
MESA_META_DRAW_BUFFERS));
- samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ?
- ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler->Name : 0;
+ _mesa_reference_sampler_object(ctx, &samp_obj_save,
+ ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler);
/* Create/bind FBO/renderbuffer */
if (decompress_fbo->FBO == 0) {
@@ -3223,7 +3223,8 @@ decompress_texture_image(struct gl_context *ctx,
if (!use_glsl_version)
_mesa_set_enable(ctx, target, GL_FALSE);
- _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave);
+ _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, samp_obj_save);
+ _mesa_reference_sampler_object(ctx, &samp_obj_save, NULL);
_mesa_meta_end(ctx);