st/mesa: fix clearing of 1D array textures
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 29 Apr 2021 16:22:14 +0000 (18:22 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Thu, 27 May 2021 12:32:01 +0000 (14:32 +0200)
st_gl_texture_dims_to_pipe_dims isn't usable in this case since its
API doesn't match the usage so fix up the dimensions manually.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3646

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10523>

src/mesa/state_tracker/st_cb_texture.c

index 36cf9a7..1925e6f 100644 (file)
@@ -3290,6 +3290,14 @@ st_ClearTexSubImage(struct gl_context *ctx,
 
    u_box_3d(xoffset, yoffset, zoffset + texImage->Face,
             width, height, depth, &box);
+
+   if (pt->target == PIPE_TEXTURE_1D_ARRAY) {
+      box.z = box.y;
+      box.depth = box.height;
+      box.y = 0;
+      box.height = 1;
+   }
+
    if (texObj->Immutable) {
       /* The texture object has to be consistent (no "loose", per-image
        * gallium resources).  If this texture is a view into another