summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2017-07-19 16:45:44 +0300
committerTopi Pohjolainen <[email protected]>2017-07-20 11:32:21 +0300
commit59bf765c363acccafd03cc7499046e593b88ab34 (patch)
tree2ea66b7d39ef03a52f5d4fd429676798133836b2 /src/mesa/drivers
parent07caa5932c64076acf8c8e82a1c12d6168984852 (diff)
i965/wm: Fix number of layers in 3D images
Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c16
1 files changed, 13 insertions, 3 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 ab6b9cdd290..bc069491161 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1632,6 +1632,17 @@ update_buffer_image_param(struct brw_context *brw,
param->stride[0] = _mesa_get_format_bytes(u->_ActualFormat);
}
+static unsigned
+get_image_num_layers(const struct intel_mipmap_tree *mt, GLenum target,
+ unsigned level)
+{
+ if (target == GL_TEXTURE_CUBE_MAP)
+ return 6;
+
+ return target == GL_TEXTURE_3D ?
+ minify(mt->logical_depth0, level) : mt->logical_depth0;
+}
+
static void
update_image_surface(struct brw_context *brw,
struct gl_image_unit *u,
@@ -1660,9 +1671,8 @@ update_image_surface(struct brw_context *brw,
} else {
struct intel_texture_object *intel_obj = intel_texture_object(obj);
struct intel_mipmap_tree *mt = intel_obj->mt;
- const unsigned num_layers = (!u->Layered ? 1 :
- obj->Target == GL_TEXTURE_CUBE_MAP ? 6 :
- mt->logical_depth0);
+ const unsigned num_layers = u->Layered ?
+ get_image_num_layers(mt, obj->Target, u->Level) : 1;
struct isl_view view = {
.format = format,