Tapani Pälli <tapani.pa...@intel.com> writes: > On 08/17/2015 07:45 PM, Francisco Jerez wrote: >> 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 -- In any case it shouldn't make > > FWIW this seems to be specified in the desktop GL (and ES 3.1) spec in > section "Automatic Unbinding of Deleted Objects". >
You're right, I'll add a reference to the right section of the spec, thanks for pointing me to it. > Reviewed-by: Tapani Pälli <tapani.pa...@intel.com> > >> any practical difference because one cannot sensibly use an image unit >> not bound to any texture object without re-specifying its state, so >> just make the test happy. >> --- >> src/mesa/main/shaderimage.c | 19 +++++++++++++------ >> src/mesa/main/shaderimage.h | 6 ++++++ >> src/mesa/main/texobj.c | 5 ++++- >> 3 files changed, 23 insertions(+), 7 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 >> diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h >> index d08ece8..bbe088a 100644 >> --- a/src/mesa/main/shaderimage.h >> +++ b/src/mesa/main/shaderimage.h >> @@ -43,6 +43,12 @@ mesa_format >> _mesa_get_shader_image_format(GLenum format); >> >> /** >> + * Get a single image unit struct with the default state. >> + */ >> +struct gl_image_unit >> +_mesa_default_image_unit(struct gl_context *ctx); >> + >> +/** >> * Initialize a context's shader image units to the default state. >> */ >> void >> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c >> index cd7cfd6..395e4d3 100644 >> --- a/src/mesa/main/texobj.c >> +++ b/src/mesa/main/texobj.c >> @@ -37,6 +37,7 @@ >> #include "hash.h" >> #include "imports.h" >> #include "macros.h" >> +#include "shaderimage.h" >> #include "teximage.h" >> #include "texobj.h" >> #include "texstate.h" >> @@ -1411,8 +1412,10 @@ unbind_texobj_from_image_units(struct gl_context *ctx, >> for (i = 0; i < ctx->Const.MaxImageUnits; i++) { >> struct gl_image_unit *unit = &ctx->ImageUnits[i]; >> >> - if (texObj == unit->TexObj) >> + if (texObj == unit->TexObj) { >> _mesa_reference_texobj(&unit->TexObj, NULL); >> + *unit = _mesa_default_image_unit(ctx); >> + } >> } >> } >> >>
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev