<div dir="ltr">Pushed.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 15, 2018 at 8:15 PM Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks. I'm going to push it once it gets done running through CI.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 15, 2018 at 4:03 AM Danylo Piliaiev <<a href="mailto:danylo.piliaiev@gmail.com" target="_blank">danylo.piliaiev@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Handle all cases in calculation of layers count for isl_view<br>
taking into account texture view and image unit.<br>
st_convert_image was taken as a reference.<br>
<br>
When u->Layered is true the whole level is taken with respect to<br>
image view. In other case only one layer is taken.<br>
<br>
v3: (Józef Kucia and Ilia Mirkin)<br>
- Rewrote patch by taking st_convert_image as a reference<br>
- Removed now unused get_image_num_layers function<br>
- Changed commit message<br>
<br>
v4: (Jason Ekstrand)<br>
- Added assert<br>
<br>
Fixes: 5a8c8903<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=107856" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=107856</a><br>
<br>
Signed-off-by: Danylo Piliaiev <<a href="mailto:danylo.piliaiev@globallogic.com" target="_blank">danylo.piliaiev@globallogic.com</a>><br>
Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br>
---<br>
.../drivers/dri/i965/brw_wm_surface_state.c | 33 ++++++++++---------<br>
1 file changed, 18 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c<br>
index 8d21cf5fa7..3286c222e5 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c<br>
@@ -1499,18 +1499,6 @@ update_buffer_image_param(struct brw_context *brw,<br>
param->stride[0] = _mesa_get_format_bytes(u->_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>
- return target == GL_TEXTURE_3D ?<br>
- minify(mt->surf.logical_level0_px.depth, level) :<br>
- mt->surf.logical_level0_px.array_len;<br>
-}<br>
-<br>
static void<br>
update_image_surface(struct brw_context *brw,<br>
struct gl_image_unit *u,<br>
@@ -1541,14 +1529,29 @@ 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 ?<br>
- get_image_num_layers(mt, obj->Target, u->Level) : 1;<br>
+<br>
+ unsigned base_layer, num_layers;<br>
+ if (u->Layered) {<br>
+ if (obj->Target == GL_TEXTURE_3D) {<br>
+ base_layer = 0;<br>
+ num_layers = minify(mt->surf.logical_level0_px.depth, u->Level);<br>
+ } else {<br>
+ assert(obj->Immutable || obj->MinLayer == 0);<br>
+ base_layer = obj->MinLayer;<br>
+ num_layers = obj->Immutable ?<br>
+ obj->NumLayers :<br>
+ mt->surf.logical_level0_px.array_len;<br>
+ }<br>
+ } else {<br>
+ base_layer = obj->MinLayer + u->_Layer;<br>
+ num_layers = 1;<br>
+ }<br>
<br>
struct isl_view view = {<br>
.format = format,<br>
.base_level = obj->MinLevel + u->Level,<br>
.levels = 1,<br>
- .base_array_layer = obj->MinLayer + u->_Layer,<br>
+ .base_array_layer = base_layer,<br>
.array_len = num_layers,<br>
.swizzle = ISL_SWIZZLE_IDENTITY,<br>
.usage = ISL_SURF_USAGE_STORAGE_BIT,<br>
-- <br>
2.18.0<br>
<br>
</blockquote></div>
</blockquote></div>