mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 07:00:12 +01:00
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 <mattst88@gmail.com>
This commit is contained in:
parent
b663d6bc6f
commit
b5854ee72b
1 changed files with 15 additions and 16 deletions
|
|
@ -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,19 +468,25 @@ _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);
|
||||
} 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 (_mesa_tex_target_is_layered(t->Target)) {
|
||||
if (u->TexObj && _mesa_tex_target_is_layered(u->TexObj->Target)) {
|
||||
u->Layered = layered;
|
||||
u->Layer = (layered ? 0 : layer);
|
||||
} else {
|
||||
|
|
@ -489,14 +494,8 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
|
|||
u->Layer = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
_mesa_reference_texobj(&u->TexObj, NULL);
|
||||
}
|
||||
|
||||
u->_Valid = validate_image_unit(ctx, u);
|
||||
|
||||
if (ctx->Driver.BindImageTexture)
|
||||
ctx->Driver.BindImageTexture(ctx, u, t, level, layered,
|
||||
ctx->Driver.BindImageTexture(ctx, u, u->TexObj, level, layered,
|
||||
layer, access, format);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue