diff options
author | Francisco Jerez <[email protected]> | 2015-01-21 16:47:02 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2015-05-04 17:44:16 +0300 |
commit | b5854ee72b25078616f04b49004011036fef5a87 (patch) | |
tree | 07e1debb3229aa3f5926730df14f7cc7ee8bdb98 /src/mesa/main/shaderimage.c | |
parent | b663d6bc6f4de9439107fc6444e436d14e21ee79 (diff) |
mesa: Update image unit state when glBindImageTexture is called with texture=0.
There's no indication in the spec that the image unit state other than the
bound texture object shouldn't be updated when glBindImageTexture() is called
passing the zero texture as argument. It's very unlikely that any application
would ever have relied on this, but it's easy to get right, and it fixes the
"state" ARB_shader_image_load_store piglit test.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderimage.c')
-rw-r--r-- | src/mesa/main/shaderimage.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c index efe439c6dfd..80b77275f93 100644 --- a/src/mesa/main/shaderimage.c +++ b/src/mesa/main/shaderimage.c @@ -456,7 +456,6 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level, GLenum format) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_object *t = NULL; struct gl_image_unit *u; if (!validate_bind_image_texture(ctx, unit, texture, level, @@ -469,34 +468,34 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level, ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits; if (texture) { - t = _mesa_lookup_texture(ctx, texture); + struct gl_texture_object *t = _mesa_lookup_texture(ctx, texture); + if (!t) { _mesa_error(ctx, GL_INVALID_VALUE, "glBindImageTexture(texture)"); return; } _mesa_reference_texobj(&u->TexObj, t); - u->Level = level; - u->Access = access; - u->Format = format; - u->_ActualFormat = _mesa_get_shader_image_format(format); - - if (_mesa_tex_target_is_layered(t->Target)) { - u->Layered = layered; - u->Layer = (layered ? 0 : layer); - } else { - u->Layered = GL_FALSE; - u->Layer = 0; - } - } else { _mesa_reference_texobj(&u->TexObj, NULL); } + u->Level = level; + u->Access = access; + u->Format = format; + u->_ActualFormat = _mesa_get_shader_image_format(format); u->_Valid = validate_image_unit(ctx, u); + if (u->TexObj && _mesa_tex_target_is_layered(u->TexObj->Target)) { + u->Layered = layered; + u->Layer = (layered ? 0 : layer); + } else { + u->Layered = GL_FALSE; + u->Layer = 0; + } + if (ctx->Driver.BindImageTexture) - ctx->Driver.BindImageTexture(ctx, u, t, level, layered, + ctx->Driver.BindImageTexture(ctx, u, u->TexObj, level, layered, layer, access, format); } |