From: Ian Romanick Date: Wed, 11 Nov 2015 00:26:38 +0000 (-0800) Subject: meta/decompress: Track sampler using gl_sampler_object instead of GL API object handle X-Git-Tag: upstream/17.1.0~13256 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4094f64c1c1d94125931c95a2dad04ab1261ff2;p=platform%2Fupstream%2Fmesa.git meta/decompress: Track sampler using gl_sampler_object instead of GL API object handle Signed-off-by: Ian Romanick Reviewed-by: Jason Ekstrand --- diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 66a7132..3fc966c 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2986,8 +2986,8 @@ meta_decompress_cleanup(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, &decompress->buf_obj, NULL); } - if (decompress->Sampler != 0) - _mesa_DeleteSamplers(1, &decompress->Sampler); + if (decompress->samp_obj != NULL) + _mesa_DeleteSamplers(1, &decompress->samp_obj->Name); memset(decompress, 0, sizeof(*decompress)); } @@ -3113,25 +3113,25 @@ decompress_texture_image(struct gl_context *ctx, &decompress->buf_obj, 3); } - if (!decompress->Sampler) { - struct gl_sampler_object *samp_obj; + if (decompress->samp_obj == NULL) { + GLuint sampler; - _mesa_GenSamplers(1, &decompress->Sampler); + _mesa_GenSamplers(1, &sampler); - samp_obj = _mesa_lookup_samplerobj(ctx, decompress->Sampler); - assert(samp_obj != NULL && samp_obj->Name == decompress->Sampler); + decompress->samp_obj = _mesa_lookup_samplerobj(ctx, sampler); + assert(decompress->samp_obj != NULL && decompress->samp_obj->Name == sampler); - _mesa_BindSampler(ctx->Texture.CurrentUnit, decompress->Sampler); + _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, decompress->samp_obj); /* nearest filtering */ - _mesa_set_sampler_filters(ctx, samp_obj, GL_NEAREST, GL_NEAREST); + _mesa_set_sampler_filters(ctx, decompress->samp_obj, GL_NEAREST, GL_NEAREST); /* No sRGB decode or encode.*/ if (ctx->Extensions.EXT_texture_sRGB_decode) { - _mesa_set_sampler_srgb_decode(ctx, samp_obj, GL_SKIP_DECODE_EXT); + _mesa_set_sampler_srgb_decode(ctx, decompress->samp_obj, GL_SKIP_DECODE_EXT); } } else { - _mesa_BindSampler(ctx->Texture.CurrentUnit, decompress->Sampler); + _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, decompress->samp_obj); } /* Silence valgrind warnings about reading uninitialized stack. */ diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index f0ac818..d7d8fd3 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -392,7 +392,7 @@ struct decompress_state GLuint VAO; struct decompress_fbo_state byteFBO, floatFBO; struct gl_buffer_object *buf_obj; - GLuint Sampler; + struct gl_sampler_object *samp_obj; struct blit_shader_table shaders; };