summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderimage.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-08-17 02:00:48 +0300
committerFrancisco Jerez <currojerez@riseup.net>2015-08-20 12:26:53 +0300
commit3b70f7900ba14e83081d8ebcd1b827ba605a8e8b (patch)
tree4f0ac4adfb679d6e60e1c86f3b0382e7935804dd /src/mesa/main/shaderimage.c
parent10b7cf1a01cf0467f5c8d1cea08d8f93e401a454 (diff)
downloadexternal_mesa3d-3b70f7900ba14e83081d8ebcd1b827ba605a8e8b.zip
external_mesa3d-3b70f7900ba14e83081d8ebcd1b827ba605a8e8b.tar.gz
external_mesa3d-3b70f7900ba14e83081d8ebcd1b827ba605a8e8b.tar.bz2
mesa: Reset image unit state to the default values when a bound image is deleted.
The ES31-CTS.shader_image_load_store.basic-api-bind conformance test expects the whole image unit state to be reset when the bound texture object is deleted. The ARB_shader_image_load_store extension is rather vague regarding what should happen with image unit state other than the texture object in that case, but the GL 4.2 and GLES 3.1 specifications (section "Automatic Unbinding of Deleted Objects") explicitly require it to be reset to the default values. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/main/shaderimage.c')
-rw-r--r--src/mesa/main/shaderimage.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 2d86931..48e3e09 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -394,17 +394,24 @@ is_image_format_supported(const struct gl_context *ctx, GLenum format)
}
}
+struct gl_image_unit
+_mesa_default_image_unit(struct gl_context *ctx)
+{
+ const struct gl_image_unit u = {
+ .Access = GL_READ_ONLY,
+ .Format = GL_R8,
+ ._ActualFormat = _mesa_get_shader_image_format(GL_R8)
+ };
+ return u;
+}
+
void
_mesa_init_image_units(struct gl_context *ctx)
{
unsigned i;
- for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i) {
- struct gl_image_unit *u = &ctx->ImageUnits[i];
- u->Access = GL_READ_ONLY;
- u->Format = GL_R8;
- u->_ActualFormat = _mesa_get_shader_image_format(u->Format);
- }
+ for (i = 0; i < ARRAY_SIZE(ctx->ImageUnits); ++i)
+ ctx->ImageUnits[i] = _mesa_default_image_unit(ctx);
}
static GLboolean