<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 18, 2017 at 1:46 AM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There is a functional change: Before update_image_surface() didn't<br>
shift the number of layers for 3D, now it does like<br>
update_texture_image_param() did.<br></blockquote><div><br></div><div>I've got a patch in one of my trees to fix this same bug.<br><br></div><div>5-8 are Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>wm_surface_state.c | 22 +++++++++++++++++++---<br>
1 file changed, 19 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
index ab6b9cdd29..a8c40d54d8 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_wm_surface_state.c<br>
@@ -1632,6 +1632,23 @@ update_buffer_image_param(<wbr>struct brw_context *brw,<br>
param->stride[0] = _mesa_get_format_bytes(u->_<wbr>ActualFormat);<br>
}<br>
<br>
+static unsigned<br>
+get_image_num_layers(const struct intel_mipmap_tree *mt, GLenum target,<br>
+ unsigned level)<br>
+{<br>
+ if (target == GL_TEXTURE_CUBE_MAP)<br>
+ return 6;<br>
+<br>
+ if (mt->surf.size > 0) {<br>
+ return target == GL_TEXTURE_3D ?<br>
+ minify(mt->surf.logical_<wbr>level0_px.depth, level) :<br>
+ mt->surf.logical_level0_px.<wbr>array_len;<br>
+ }<br>
+<br>
+ return target == GL_TEXTURE_3D ?<br>
+ minify(mt->logical_depth0, level) : mt->logical_depth0;<br>
+}<br>
+<br>
static void<br>
update_image_surface(struct brw_context *brw,<br>
struct gl_image_unit *u,<br>
@@ -1660,9 +1677,8 @@ update_image_surface(struct brw_context *brw,<br>
} else {<br>
struct intel_texture_object *intel_obj = intel_texture_object(obj);<br>
struct intel_mipmap_tree *mt = intel_obj->mt;<br>
- const unsigned num_layers = (!u->Layered ? 1 :<br>
- obj->Target == GL_TEXTURE_CUBE_MAP ? 6 :<br>
- mt->logical_depth0);<br>
+ const unsigned num_layers = u->Layered ?<br>
+ get_image_num_layers(mt, obj->Target, u->Level) : 1;<br>
<br>
struct isl_view view = {<br>
.format = format,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>