diff options
author | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2022-08-29 15:50:54 +0200 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2022-09-15 09:25:34 -0700 |
commit | cbcf1bb4d815314290c56d0b27a7afe8a30cf15c (patch) | |
tree | 2873ae60cf7c55059a1b2c2a21f77b72b6b73691 | |
parent | c916ec76ee4da3e4df852f41e80bbf506eb67dab (diff) |
zink: clamp miplodbias when creating sampler
The Vulkan spec states that it's illegal to pass a mipLodBias larger
than maxSamplerLodBias, but the gallium value here hasn't been clamped.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7140
Cc: mesa-stable
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18295>
(cherry picked from commit c551bb32d16c7abe27a5c2ee65c441c27fac9821)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt | 1 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index b0fcc474973..6d2e97852a6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4252,7 +4252,7 @@ "description": "zink: clamp miplodbias when creating sampler", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt index 70654ce212d..7e0d984e138 100644 --- a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt @@ -1,4 +1,3 @@ -GTF-GL46.gtf21.GL3Tests.texture_lod_bias.texture_lod_bias_all,Fail GTF-GL46.gtf30.GL3Tests.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singlesampled_blit,Fail GTF-GL46.gtf30.GL3Tests.sgis_texture_lod.sgis_texture_lod_basic_lod_selection,Fail GTF-GL46.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_invalid_mode,Fail diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 7ebfbaa2d26..1bb8a4dd6b7 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -384,7 +384,10 @@ zink_create_sampler_state(struct pipe_context *pctx, } else { sci.addressModeU = sci.addressModeV = sci.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; } - sci.mipLodBias = state->lod_bias; + + sci.mipLodBias = CLAMP(state->lod_bias, + -screen->info.props.limits.maxSamplerLodBias, + screen->info.props.limits.maxSamplerLodBias); need_custom |= wrap_needs_border_color(state->wrap_s); need_custom |= wrap_needs_border_color(state->wrap_t); |