Created attachment 141470 [details]
get_image_num_layers() returns the number of layers for the original texture instead of the number of layers for the texture view. It leads to asserts in driver code:
../../../../../../mesa-git/src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1940: miptree_layer_range_length: Assertion `start_layer + num_layers <= total_num_layers' failed.
I forgot to write here when sent a patch to fix the issue, here is the patch:
And I wrote a Piglit test which reproduces the issue:
Author: Danylo Piliaiev <email@example.com>
Date: Thu Nov 15 12:03:31 2018 +0200
i965: Fix calculation of layers array length for isl_view
Handle all cases in calculation of layers count for isl_view
taking into account texture view and image unit.
st_convert_image was taken as a reference.
When u->Layered is true the whole level is taken with respect to
image view. In other case only one layer is taken.
v3: (Józef Kucia and Ilia Mirkin)
- Rewrote patch by taking st_convert_image as a reference
- Removed now unused get_image_num_layers function
- Changed commit message
v4: (Jason Ekstrand)
- Added assert
Signed-off-by: Danylo Piliaiev <firstname.lastname@example.org>
Reviewed-by: Jason Ekstrand <email@example.com>