Mesa (staging/21.2): iris: fix layer calculation for TEXTURE_3D ReadPixels() on mip-level>0
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 17:23:31 UTC 2021
Module: Mesa
Branch: staging/21.2
Commit: dc1431d3671d999f9298544f46d0a73709b93ed9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc1431d3671d999f9298544f46d0a73709b93ed9
Author: Yevhenii Kharchenko <yevhenii.kharchenko at globallogic.com>
Date: Tue Feb 23 00:15:15 2021 +0200
iris: fix layer calculation for TEXTURE_3D ReadPixels() on mip-level>0
Fixes assert when ReadPixels() called to read from FBO to
GL_PIXEL_PACK_BUFFER, on mip-level > 0, since num_layers
wasn't properly calculated with mip-level.
v2: patched 'iris_create_sampler_view' function instead of
'resolve_sampler_views'. Just like it was suggested in this
function's comment.
The logic of fix is similar to one in 'update_image_surface' function
of i965 driver, which is introduced in commit
f9fd0cf4790cb2a530e75d1a2206dbb9d8af7cb2.
With a slight change: setting array_len=1, like it was done in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5808 ,
since minifying depth fails KHR-GLES2.texture_3d.filtering tests.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4145
Fixes: 3c979b0e ('iris: add some draw resolve hooks')
Signed-off-by: Yevhenii Kharchenko <yevhenii.kharchenko at globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9253>
(cherry picked from commit b9452627730066872af6cf11a3fc390ca29ca242)
---
.pick_status.json | 2 +-
src/gallium/drivers/iris/iris_state.c | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index d046eb75cf9..f9400b406f5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -184,7 +184,7 @@
"description": "iris: fix layer calculation for TEXTURE_3D ReadPixels() on mip-level>0",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "3c979b0e6d9e4d7a880cebcee514238ecb6baf61"
},
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 2f0831a1078..de04c11f093 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2415,10 +2415,15 @@ iris_create_sampler_view(struct pipe_context *ctx,
if (tmpl->target != PIPE_BUFFER) {
isv->view.base_level = tmpl->u.tex.first_level;
isv->view.levels = tmpl->u.tex.last_level - tmpl->u.tex.first_level + 1;
- // XXX: do I need to port f9fd0cf4790cb2a530e75d1a2206dbb9d8af7cb2?
- isv->view.base_array_layer = tmpl->u.tex.first_layer;
- isv->view.array_len =
- tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1;
+
+ if (tmpl->target == PIPE_TEXTURE_3D) {
+ isv->view.base_array_layer = 0;
+ isv->view.array_len = 1;
+ } else {
+ isv->view.base_array_layer = tmpl->u.tex.first_layer;
+ isv->view.array_len =
+ tmpl->u.tex.last_layer - tmpl->u.tex.first_layer + 1;
+ }
if (iris_resource_unfinished_aux_import(isv->res))
iris_resource_finish_aux_import(&screen->base, isv->res);
More information about the mesa-commit
mailing list