zink: Fix validation failure for maxLod < minLod.
authorEmma Anholt <emma@anholt.net>
Tue, 17 Jan 2023 21:33:32 +0000 (13:33 -0800)
committerEric Engestrom <eric@engestrom.ch>
Thu, 26 Jan 2023 15:40:35 +0000 (15:40 +0000)
GL lets you set a silly state, so do something plausible instead of
undefined.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20756>
(cherry picked from commit adf81044d4cb929733ca64ed1fd30725577b0c66)

.pick_status.json
src/gallium/drivers/zink/zink_context.c

index f164b9f..6f5cc02 100644 (file)
         "description": "zink: Fix validation failure for maxLod < minLod.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
index 650717c..0cbb0cc 100644 (file)
@@ -369,7 +369,7 @@ zink_create_sampler_state(struct pipe_context *pctx,
    } else if (state->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) {
       sci.mipmapMode = sampler_mipmap_mode(state->min_mip_filter);
       sci.minLod = state->min_lod;
-      sci.maxLod = state->max_lod;
+      sci.maxLod = MAX2(state->max_lod, state->min_lod);
    } else {
       sci.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;
       sci.minLod = 0;