zink: start using dynamic front face state
this doesn't actually do anything other than test the codepath since the hashed pipeline state will still change on every frontface change, but it's a start Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10508>
This commit is contained in:
parent
27d1ecd54b
commit
cca9201922
|
@ -502,6 +502,7 @@ zink_draw_vbo(struct pipe_context *pctx,
|
|||
vkCmdSetStencilCompareMask(batch->state->cmdbuf, VK_STENCIL_FACE_FRONT_AND_BACK, dsa_state->hw_state.stencil_front.compareMask);
|
||||
}
|
||||
}
|
||||
screen->vk_CmdSetFrontFaceEXT(batch->state->cmdbuf, ctx->gfx_pipeline_state.front_face);
|
||||
}
|
||||
|
||||
if (depth_bias)
|
||||
|
|
|
@ -106,7 +106,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
|||
rast_state.rasterizerDiscardEnable = state->rast_state->rasterizer_discard;
|
||||
rast_state.polygonMode = state->rast_state->polygon_mode;
|
||||
rast_state.cullMode = state->rast_state->cull_mode;
|
||||
rast_state.frontFace = state->rast_state->front_face;
|
||||
rast_state.frontFace = state->front_face;
|
||||
|
||||
rast_state.depthBiasEnable = VK_TRUE;
|
||||
rast_state.depthBiasConstantFactor = 0.0;
|
||||
|
@ -155,6 +155,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
|||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_OP_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_FRONT_FACE_EXT;
|
||||
} else {
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VIEWPORT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SCISSOR;
|
||||
|
|
|
@ -59,6 +59,7 @@ struct zink_gfx_pipeline_state {
|
|||
bool dirty;
|
||||
|
||||
struct zink_depth_stencil_alpha_hw_state *depth_stencil_alpha_state; //non-dynamic state
|
||||
VkFrontFace front_face;
|
||||
|
||||
VkShaderModule modules[PIPE_SHADER_TYPES - 1];
|
||||
uint32_t module_hash;
|
||||
|
|
|
@ -395,6 +395,8 @@ equals_gfx_pipeline_state(const void *a, const void *b)
|
|||
if (sa->vertex_strides[idx_a] != sb->vertex_strides[idx_b])
|
||||
return false;
|
||||
}
|
||||
if (sa->front_face != sb->front_face)
|
||||
return false;
|
||||
if (!!sa->depth_stencil_alpha_state != !!sb->depth_stencil_alpha_state ||
|
||||
(sa && sb && memcmp(sa->depth_stencil_alpha_state, sb->depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state))))
|
||||
return false;
|
||||
|
|
|
@ -1213,6 +1213,7 @@ load_device_extensions(struct zink_screen *screen)
|
|||
GET_PROC_ADDR(CmdSetStencilOpEXT);
|
||||
GET_PROC_ADDR(CmdSetStencilTestEnableEXT);
|
||||
GET_PROC_ADDR(CmdBindVertexBuffers2EXT);
|
||||
GET_PROC_ADDR(CmdSetFrontFaceEXT);
|
||||
}
|
||||
|
||||
if (screen->info.have_EXT_image_drm_format_modifier)
|
||||
|
|
|
@ -141,6 +141,7 @@ struct zink_screen {
|
|||
PFN_vkCmdSetStencilTestEnableEXT vk_CmdSetStencilTestEnableEXT;
|
||||
PFN_vkCmdSetStencilOpEXT vk_CmdSetStencilOpEXT;
|
||||
PFN_vkCmdBindVertexBuffers2EXT vk_CmdBindVertexBuffers2EXT;
|
||||
PFN_vkCmdSetFrontFaceEXT vk_CmdSetFrontFaceEXT;
|
||||
|
||||
PFN_vkCreateDebugUtilsMessengerEXT vk_CreateDebugUtilsMessengerEXT;
|
||||
PFN_vkDestroyDebugUtilsMessengerEXT vk_DestroyDebugUtilsMessengerEXT;
|
||||
|
|
|
@ -445,9 +445,9 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
|
|||
state->hw_state.polygon_mode = (VkPolygonMode)rs_state->fill_front; // same values
|
||||
state->hw_state.cull_mode = (VkCullModeFlags)rs_state->cull_face; // same bits
|
||||
|
||||
state->hw_state.front_face = rs_state->front_ccw ?
|
||||
VK_FRONT_FACE_COUNTER_CLOCKWISE :
|
||||
VK_FRONT_FACE_CLOCKWISE;
|
||||
state->front_face = rs_state->front_ccw ?
|
||||
VK_FRONT_FACE_COUNTER_CLOCKWISE :
|
||||
VK_FRONT_FACE_CLOCKWISE;
|
||||
|
||||
state->offset_point = rs_state->offset_point;
|
||||
state->offset_line = rs_state->offset_line;
|
||||
|
@ -487,6 +487,10 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
|||
if (clip_halfz != ctx->rast_state->base.clip_halfz)
|
||||
ctx->last_vertex_stage_dirty = true;
|
||||
|
||||
if (ctx->gfx_pipeline_state.front_face != ctx->rast_state->front_face) {
|
||||
ctx->gfx_pipeline_state.front_face = ctx->rast_state->front_face;
|
||||
ctx->gfx_pipeline_state.dirty |= !zink_screen(pctx->screen)->info.have_EXT_extended_dynamic_state;
|
||||
}
|
||||
if (ctx->line_width != ctx->rast_state->line_width) {
|
||||
ctx->line_width = ctx->rast_state->line_width;
|
||||
ctx->gfx_pipeline_state.dirty = true;
|
||||
|
|
|
@ -49,7 +49,6 @@ struct zink_vertex_elements_state {
|
|||
struct zink_rasterizer_hw_state {
|
||||
VkBool32 depth_clamp;
|
||||
VkBool32 rasterizer_discard;
|
||||
VkFrontFace front_face;
|
||||
VkPolygonMode polygon_mode;
|
||||
VkCullModeFlags cull_mode;
|
||||
VkProvokingVertexModeEXT pv_mode;
|
||||
|
@ -61,6 +60,7 @@ struct zink_rasterizer_state {
|
|||
bool offset_point, offset_line, offset_tri;
|
||||
float offset_units, offset_clamp, offset_scale;
|
||||
float line_width;
|
||||
VkFrontFace front_face;
|
||||
struct zink_rasterizer_hw_state hw_state;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue