Mesa (staging/20.1): st/mesa: account for "loose", per-mipmap level textures in CopyImageSubData

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 19 20:07:10 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 101fe52a5cbe2ff05ec687ae071d65e4c03036eb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=101fe52a5cbe2ff05ec687ae071d65e4c03036eb

Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date:   Fri Jun 12 16:04:44 2020 +0300

st/mesa: account for "loose", per-mipmap level textures in CopyImageSubData

We may have "loose", per-image gallium resources. The src_image->Level
may not match the gallium resource texture level. In such case it is
prescribed (in st_AllocTextureImageBuffer) to specify mipmap level
as zero.

Fixes: f04f13622f3e71bee057d60a6be9c53b92b56cc9
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5477>
(cherry picked from commit 8ce8895b69a7523513eceed096233c3a348880a7)

---

 .pick_status.json                        | 2 +-
 src/mesa/state_tracker/st_cb_copyimage.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 791ee589e62..e5384460aa5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -589,7 +589,7 @@
         "description": "st/mesa: account for \"loose\", per-mipmap level textures in CopyImageSubData",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "f04f13622f3e71bee057d60a6be9c53b92b56cc9"
     },
diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c
index a58cdf62703..5d9c77fdede 100644
--- a/src/mesa/state_tracker/st_cb_copyimage.c
+++ b/src/mesa/state_tracker/st_cb_copyimage.c
@@ -645,8 +645,9 @@ st_CopyImageSubData(struct gl_context *ctx,
 
    if (src_image) {
       struct st_texture_image *src = st_texture_image(src_image);
+      struct st_texture_object *stObj = st_texture_object(src_image->TexObject);
       src_res = src->pt;
-      src_level = src_image->Level;
+      src_level = stObj->pt != src_res ? 0 : src_image->Level;
       src_z += src_image->Face;
       if (src_image->TexObject->Immutable) {
          src_level += src_image->TexObject->MinLevel;
@@ -660,8 +661,9 @@ st_CopyImageSubData(struct gl_context *ctx,
 
    if (dst_image) {
       struct st_texture_image *dst = st_texture_image(dst_image);
+      struct st_texture_object *stObj = st_texture_object(dst_image->TexObject);
       dst_res = dst->pt;
-      dst_level = dst_image->Level;
+      dst_level = stObj->pt != dst_res ? 0 : dst_image->Level;
       dst_z += dst_image->Face;
       if (dst_image->TexObject->Immutable) {
          dst_level += dst_image->TexObject->MinLevel;



More information about the mesa-commit mailing list