zink: use VK_EXT_depth_clip_control when available
this saves a few ALUs in vertex stages Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15174>
This commit is contained in:
parent
95708c13ee
commit
b7b494299d
|
@ -1121,7 +1121,7 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shad
|
|||
if (zs->sinfo.have_xfb)
|
||||
sinfo->last_vertex = true;
|
||||
|
||||
if (!zink_vs_key_base(key)->clip_halfz) {
|
||||
if (!zink_vs_key_base(key)->clip_halfz && !screen->info.have_EXT_depth_clip_control) {
|
||||
NIR_PASS_V(nir, nir_lower_clip_halfz);
|
||||
}
|
||||
if (zink_vs_key_base(key)->push_drawid) {
|
||||
|
|
|
@ -76,6 +76,7 @@ EXTENSIONS = [
|
|||
Extension("VK_EXT_shader_viewport_index_layer"),
|
||||
Extension("VK_KHR_get_memory_requirements2"),
|
||||
Extension("VK_EXT_post_depth_coverage"),
|
||||
Extension("VK_EXT_depth_clip_control", alias="clip_control", features=True),
|
||||
Extension("VK_EXT_shader_subgroup_ballot"),
|
||||
Extension("VK_EXT_shader_atomic_float", alias="atomic_float", features=True),
|
||||
Extension("VK_KHR_8bit_storage",
|
||||
|
|
|
@ -145,11 +145,18 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
|||
}
|
||||
|
||||
VkPipelineViewportStateCreateInfo viewport_state = {0};
|
||||
VkPipelineViewportDepthClipControlCreateInfoEXT clip = {
|
||||
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT,
|
||||
NULL,
|
||||
VK_TRUE
|
||||
};
|
||||
viewport_state.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||
viewport_state.viewportCount = screen->info.have_EXT_extended_dynamic_state ? 0 : state->dyn_state1.num_viewports;
|
||||
viewport_state.pViewports = NULL;
|
||||
viewport_state.scissorCount = screen->info.have_EXT_extended_dynamic_state ? 0 : state->dyn_state1.num_viewports;
|
||||
viewport_state.pScissors = NULL;
|
||||
if (screen->info.have_EXT_depth_clip_control && !hw_rast_state->clip_halfz)
|
||||
viewport_state.pNext = &clip;
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo rast_state = {0};
|
||||
rast_state.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
|
|
|
@ -681,6 +681,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
|||
bool scissor = ctx->rast_state ? ctx->rast_state->base.scissor : false;
|
||||
bool pv_last = ctx->rast_state ? ctx->rast_state->hw_state.pv_last : false;
|
||||
bool force_persample_interp = ctx->rast_state ? ctx->rast_state->hw_state.force_persample_interp : false;
|
||||
bool clip_halfz = ctx->rast_state ? ctx->rast_state->hw_state.clip_halfz : false;
|
||||
ctx->rast_state = cso;
|
||||
|
||||
if (ctx->rast_state) {
|
||||
|
@ -696,8 +697,11 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
|||
ctx->gfx_pipeline_state.dirty = true;
|
||||
ctx->rast_state_changed = true;
|
||||
|
||||
if (zink_get_last_vertex_key(ctx)->clip_halfz != ctx->rast_state->base.clip_halfz) {
|
||||
zink_set_last_vertex_key(ctx)->clip_halfz = ctx->rast_state->base.clip_halfz;
|
||||
if (clip_halfz != ctx->rast_state->base.clip_halfz) {
|
||||
if (screen->info.have_EXT_depth_clip_control)
|
||||
ctx->gfx_pipeline_state.dirty = true;
|
||||
else
|
||||
zink_set_last_vertex_key(ctx)->clip_halfz = ctx->rast_state->base.clip_halfz;
|
||||
ctx->vp_state_changed = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue