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>
This commit is contained in:
Erik Faye-Lund
2022-08-29 15:50:54 +02:00
committed by Marge Bot
parent 9194952e70
commit c551bb32d1
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -369,7 +369,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);