diff options
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/get.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/main/glformats.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/samplerobj.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/main/samplerobj.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 2 |
5 files changed, 26 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 2399f9c9d..582ef3198 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -34,6 +34,7 @@ #include "state.h" #include "texcompress.h" #include "framebuffer.h" +#include "samplerobj.h" /* This is a table driven implemetation of the glGet*v() functions. * The basic idea is that most getters just look up an int somewhere @@ -827,7 +828,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu { struct gl_sampler_object *samp = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler; - v->value_int = samp ? samp->Name : 0; + + /* + * The sampler object may have been deleted on another context, + * so we try to lookup the sampler object before returning its Name. + */ + if (samp && _mesa_lookup_samplerobj(ctx, samp->Name)) { + v->value_int = samp->Name; + } else { + v->value_int = 0; + } } break; /* GL_ARB_uniform_buffer_object */ diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c index 8728540cf..c1e16587a 100644 --- a/mesalib/src/mesa/main/glformats.c +++ b/mesalib/src/mesa/main/glformats.c @@ -917,7 +917,7 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) case GL_COMPRESSED_SIGNED_RG11_EAC: case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - return _mesa_is_gles3(ctx); + return _mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility; case GL_PALETTE4_RGB8_OES: case GL_PALETTE4_RGBA8_OES: case GL_PALETTE4_R5_G6_B5_OES: diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index 319a444d7..5cff32936 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -40,7 +40,7 @@ #include "main/samplerobj.h" -static struct gl_sampler_object * +struct gl_sampler_object * _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name) { if (name == 0) @@ -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 */ diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h index 311425701..69e389949 100644 --- a/mesalib/src/mesa/main/samplerobj.h +++ b/mesalib/src/mesa/main/samplerobj.h @@ -62,6 +62,8 @@ _mesa_reference_sampler_object(struct gl_context *ctx, _mesa_reference_sampler_object_(ctx, ptr, samp); } +extern struct gl_sampler_object * +_mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name); extern struct gl_sampler_object * _mesa_new_sampler_object(struct gl_context *ctx, GLuint name); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 9d4a17052..7d996da47 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -520,7 +520,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } - if (_mesa_is_gles3(ctx)) { + if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compatibility) { switch (internalFormat) { case GL_COMPRESSED_RGB8_ETC2: case GL_COMPRESSED_SRGB8_ETC2: |