From 3ccb83a82348b5e5836c36b184c3065204d5d685 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 14 May 2026 07:41:11 +1000 Subject: [PATCH] st: fix get tex subimage fallback for 1D ARRAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn't fix a known problem, but I spotted it in passing. If copy_to_staging_dest fails then we end up using the transformed 1D_ARRAY coords when we want the originals in the other two paths. Reviewed-by: Marek Olšák Part-of: --- src/mesa/state_tracker/st_cb_texture.c | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8c3a364254d..10511768fd5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -2753,17 +2753,22 @@ st_GetTexSubImage(struct gl_context * ctx, if (!dst) goto non_blit_transfer; + GLint zoffset_g = zoffset; + GLint yoffset_g = yoffset; + GLint depth_g = depth; + GLsizei height_g = height; + /* From now on, we need the gallium representation of dimensions. */ if (gl_target == GL_TEXTURE_1D_ARRAY) { - zoffset = yoffset; - yoffset = 0; - depth = height; - height = 1; + zoffset_g = yoffset_g; + yoffset_g = 0; + depth_g = height_g; + height_g = 1; } assert(texImage->Face == 0 || texImage->TexObject->Attrib.MinLayer == 0 || - zoffset == 0); + zoffset_g == 0); memset(&blit, 0, sizeof(blit)); blit.src.resource = src; @@ -2774,13 +2779,13 @@ st_GetTexSubImage(struct gl_context * ctx, blit.dst.format = dst->format; blit.src.box.x = xoffset; blit.dst.box.x = 0; - blit.src.box.y = yoffset; + blit.src.box.y = yoffset_g; blit.dst.box.y = 0; - blit.src.box.z = texImage->Face + texImage->TexObject->Attrib.MinLayer + zoffset; + blit.src.box.z = texImage->Face + texImage->TexObject->Attrib.MinLayer + zoffset_g; blit.dst.box.z = 0; blit.src.box.width = blit.dst.box.width = width; - blit.src.box.height = blit.dst.box.height = height; - blit.src.box.depth = blit.dst.box.depth = depth; + blit.src.box.height = blit.dst.box.height = height_g; + blit.src.box.depth = blit.dst.box.depth = depth_g; blit.mask = st_get_blit_mask(texImage->_BaseFormat, format); blit.filter = PIPE_TEX_FILTER_NEAREST; blit.scissor_enable = false; @@ -2788,8 +2793,8 @@ st_GetTexSubImage(struct gl_context * ctx, /* blit/render/decompress */ st->pipe->blit(st->pipe, &blit); - done = copy_to_staging_dest(ctx, dst, xoffset, yoffset, zoffset, width, height, - depth, format, type, pixels, texImage); + done = copy_to_staging_dest(ctx, dst, xoffset, yoffset_g, zoffset_g, width, height_g, + depth_g, format, type, pixels, texImage); pipe_resource_reference(&dst, NULL); non_blit_transfer: