summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2015-08-17 01:53:48 +0300
committerFrancisco Jerez <[email protected]>2015-08-20 12:26:53 +0300
commitb97d8c95a91773dc002e3ba42bd02e84a00eada3 (patch)
tree59bca617dba2a9a513b5d9827338813d8c5ad1bb /src
parent47e0d5b9b28b0753adda70cbfb3ad111ba6169a8 (diff)
mesa: Don't lose track of the shader image layer originally specified by the user.
The spec requires that all layers of the image starting from the 0-th are bound to the image unit regardless of the Layer parameter when Layered is true, so I was setting gl_image_unit::Layer to zero in that case for the convenience of the driver back-end. However the ES31-CTS.shader_image_load_store.basic-api-bind conformance test checks that the layer value returned by glGetInteger is the same that was originally specified, regardless of the value of layered. Rename Layer to _Layer as is usual for other derived state and keep track of the original layer value as gl_image_unit::Layer. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c4
-rw-r--r--src/mesa/main/mtypes.h8
-rw-r--r--src/mesa/main/shaderimage.c11
3 files changed, 15 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 7e9a52c643c..8213f4ea2fb 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1117,7 +1117,7 @@ update_texture_image_param(struct brw_context *brw,
minify(mt->logical_depth0, u->Level) :
mt->logical_depth0);
- intel_miptree_get_image_offset(mt, u->Level, u->Layer,
+ intel_miptree_get_image_offset(mt, u->Level, u->_Layer,
&param->offset[0],
&param->offset[1]);
@@ -1202,7 +1202,7 @@ update_image_surface(struct brw_context *brw,
access != GL_READ_ONLY);
} else {
- const unsigned min_layer = obj->MinLayer + u->Layer;
+ const unsigned min_layer = obj->MinLayer + u->_Layer;
const unsigned min_level = obj->MinLevel + u->Level;
const unsigned num_layers = (!u->Layered ? 1 :
obj->Target == GL_TEXTURE_CUBE_MAP ? 6 :
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6dd624fabb5..23afdbde290 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4177,10 +4177,16 @@ struct gl_image_unit
GLboolean _Valid;
/**
+ * Layer of the texture object bound to this unit as specified by the
+ * application.
+ */
+ GLuint Layer;
+
+ /**
* Layer of the texture object bound to this unit, or zero if the
* whole level is bound.
*/
- GLuint Layer;
+ GLuint _Layer;
/**
* Access allowed to this texture image. Either \c GL_READ_ONLY,
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index 7337f2255c4..67f17163d98 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -362,7 +362,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
return GL_FALSE;
if (_mesa_tex_target_is_layered(t->Target) &&
- u->Layer >= _mesa_get_texture_layers(t, u->Level))
+ u->_Layer >= _mesa_get_texture_layers(t, u->Level))
return GL_FALSE;
if (t->Target == GL_TEXTURE_BUFFER) {
@@ -370,7 +370,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
} else {
struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
- t->Image[u->Layer][u->Level] :
+ t->Image[u->_Layer][u->Level] :
t->Image[0][u->Level]);
if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
@@ -488,7 +488,8 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
if (u->TexObj && _mesa_tex_target_is_layered(u->TexObj->Target)) {
u->Layered = layered;
- u->Layer = (layered ? 0 : layer);
+ u->Layer = layer;
+ u->_Layer = (u->Layered ? 0 : u->Layer);
} else {
u->Layered = GL_FALSE;
u->Layer = 0;
@@ -619,7 +620,7 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
_mesa_reference_texobj(&u->TexObj, texObj);
u->Level = 0;
u->Layered = _mesa_tex_target_is_layered(texObj->Target);
- u->Layer = 0;
+ u->_Layer = u->Layer = 0;
u->Access = GL_READ_WRITE;
u->Format = tex_format;
u->_ActualFormat = _mesa_get_shader_image_format(tex_format);
@@ -629,7 +630,7 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
_mesa_reference_texobj(&u->TexObj, NULL);
u->Level = 0;
u->Layered = GL_FALSE;
- u->Layer = 0;
+ u->_Layer = u->Layer = 0;
u->Access = GL_READ_ONLY;
u->Format = GL_R8;
u->_ActualFormat = MESA_FORMAT_R_UNORM8;