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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 18 12:04:17 UTC 2020


Module: Mesa
Branch: master
Commit: 8ce8895b69a7523513eceed096233c3a348880a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ce8895b69a7523513eceed096233c3a348880a7

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>

---

 src/mesa/state_tracker/st_cb_copyimage.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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