zink: Always enable depth clamping, make depth clipping independent.
Enabling depth clamping ensures that the Vulkan driver respects the depth range that zink sets on viewport objects in zink_draw. When depth clipping is required, use VK_EXT_depth_clip_enable to enable that independently of depth clamping. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16929>
This commit is contained in:
parent
82e08f6b1e
commit
21ea19d504
|
@ -109,14 +109,6 @@ dEQP-GLES3.functional.draw_buffers_indexed.overwrite_common.common_separate_blen
|
|||
dEQP-GLES3.functional.draw_buffers_indexed.overwrite_indexed.common_advanced_blend_eq_buffer_advanced_blend_eq,Fail
|
||||
dEQP-GLES3.functional.draw_buffers_indexed.overwrite_indexed.common_advanced_blend_eq_buffer_blend_eq,Fail
|
||||
dEQP-GLES3.functional.draw_buffers_indexed.overwrite_indexed.common_advanced_blend_eq_buffer_separate_blend_eq,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_test_clamp.depth24_stencil8,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_test_clamp.depth32f_stencil8,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_test_clamp.depth_component24,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_test_clamp.depth_component32f,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth24_stencil8,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth32f_stencil8,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth_component24,Fail
|
||||
dEQP-GLES3.functional.fbo.depth.depth_write_clamp.depth_component32f,Fail
|
||||
dEQP-GLES3.functional.rasterization.primitives.line_loop_wide,Fail
|
||||
dEQP-GLES3.functional.rasterization.primitives.line_strip_wide,Fail
|
||||
dEQP-GLES3.functional.shaders.metamorphic.bubblesort_flag.variant_1,Fail
|
||||
|
|
|
@ -170,7 +170,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
|||
VkPipelineRasterizationStateCreateInfo rast_state = {0};
|
||||
rast_state.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
|
||||
rast_state.depthClampEnable = hw_rast_state->depth_clamp;
|
||||
rast_state.depthClampEnable = true;
|
||||
rast_state.rasterizerDiscardEnable = state->dyn_state2.rasterizer_discard;
|
||||
rast_state.polygonMode = hw_rast_state->polygon_mode;
|
||||
rast_state.cullMode = state->dyn_state1.cull_mode;
|
||||
|
@ -182,6 +182,17 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
|||
rast_state.depthBiasSlopeFactor = 0.0;
|
||||
rast_state.lineWidth = 1.0f;
|
||||
|
||||
VkPipelineRasterizationDepthClipStateCreateInfoEXT depth_clip_state = {0};
|
||||
depth_clip_state.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT;
|
||||
depth_clip_state.depthClipEnable = hw_rast_state->depth_clip;
|
||||
if (screen->info.have_EXT_depth_clip_enable) {
|
||||
depth_clip_state.pNext = rast_state.pNext;
|
||||
rast_state.pNext = &depth_clip_state;
|
||||
} else {
|
||||
static bool warned = false;
|
||||
warn_missing_feature(warned, "VK_EXT_depth_clip_enable");
|
||||
}
|
||||
|
||||
VkPipelineRasterizationProvokingVertexStateCreateInfoEXT pv_state;
|
||||
pv_state.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT;
|
||||
pv_state.provokingVertexMode = hw_rast_state->pv_last ?
|
||||
|
|
|
@ -578,7 +578,7 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
|
|||
state->hw_state.line_stipple_enable = rs_state->line_stipple_enable;
|
||||
|
||||
assert(rs_state->depth_clip_far == rs_state->depth_clip_near);
|
||||
state->hw_state.depth_clamp = rs_state->depth_clip_near == 0;
|
||||
state->hw_state.depth_clip = rs_state->depth_clip_near;
|
||||
state->hw_state.force_persample_interp = rs_state->force_persample_interp;
|
||||
state->hw_state.pv_last = !rs_state->flatshade_first;
|
||||
state->hw_state.clip_halfz = rs_state->clip_halfz;
|
||||
|
|
|
@ -70,7 +70,7 @@ struct zink_vertex_state {
|
|||
struct zink_rasterizer_hw_state {
|
||||
unsigned polygon_mode : 2; //VkPolygonMode
|
||||
unsigned line_mode : 2; //VkLineRasterizationModeEXT
|
||||
unsigned depth_clamp:1;
|
||||
unsigned depth_clip:1;
|
||||
unsigned pv_last:1;
|
||||
unsigned line_stipple_enable:1;
|
||||
unsigned force_persample_interp:1;
|
||||
|
|
Loading…
Reference in New Issue