radv: fix setting MIN_LOD for texture descriptors on GFX11
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 3 Nov 2022 02:56:00 +0000 (02:56 +0000)
committerEric Engestrom <eric@engestrom.ch>
Wed, 9 Nov 2022 21:22:05 +0000 (21:22 +0000)
Found by inspection because the MIN_LOD bits were moved.

Cc: 22.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19496>
(cherry picked from commit e891e84f4be6271cf34f62768b085ee99b6db86c)

.pick_status.json
src/amd/vulkan/radv_image.c

index 5208044..2c1e1a7 100644 (file)
         "description": "radv: fix setting MIN_LOD for texture descriptors on GFX11",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
index 5144dd0..5cf9c6b 100644 (file)
@@ -1000,8 +1000,7 @@ gfx10_make_texture_descriptor(struct radv_device *device, struct radv_image *ima
       depth = image->info.array_size / 6;
 
    state[0] = 0;
-   state[1] = S_00A004_MIN_LOD(radv_float_to_ufixed(CLAMP(min_lod, 0, 15), 8)) |
-              S_00A004_FORMAT(img_format) |
+   state[1] = S_00A004_FORMAT(img_format) |
               S_00A004_WIDTH_LO(width - 1);
    state[2] = S_00A008_WIDTH_HI((width - 1) >> 2) | S_00A008_HEIGHT(height - 1) |
               S_00A008_RESOURCE_LEVEL(device->physical_device->rad_info.gfx_level < GFX11);
@@ -1040,9 +1039,13 @@ gfx10_make_texture_descriptor(struct radv_device *device, struct radv_image *ima
    if (nbc_view && nbc_view->valid)
       max_mip = nbc_view->max_mip;
 
+   unsigned min_lod_clamped = radv_float_to_ufixed(CLAMP(min_lod, 0, 15), 8);
    if (device->physical_device->rad_info.gfx_level >= GFX11) {
       state[1] |= S_00A004_MAX_MIP(max_mip);
+      state[5] |= S_00A014_MIN_LOD_LO(min_lod_clamped);
+      state[6] |= S_00A018_MIN_LOD_HI(min_lod_clamped >> 5);
    } else {
+      state[1] |= S_00A004_MIN_LOD(min_lod_clamped);
       state[5] |= S_00A014_MAX_MIP(max_mip);
    }