mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
zink: handle missing line rasterization modes with ds3
it's annoying to validate this at runtime since it has to happen during draw, but storing the "usable" ds3 mode separately from the pipeline state should be a reasonable enough compromise for perf here...hopefully Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21100>
This commit is contained in:
parent
813bb9e442
commit
e67bdf47d4
3 changed files with 26 additions and 1 deletions
|
|
@ -480,6 +480,14 @@ zink_draw(struct pipe_context *pctx,
|
|||
lines_changed =
|
||||
(ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES) !=
|
||||
(rast_prim == PIPE_PRIM_LINES);
|
||||
static bool rect_warned = false;
|
||||
if (DYNAMIC_STATE >= ZINK_DYNAMIC_STATE3 && rast_prim == PIPE_PRIM_LINES && !rect_warned &&
|
||||
(VkLineRasterizationModeEXT)rast_state->hw_state.line_mode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT) {
|
||||
if (screen->info.line_rast_feats.rectangularLines)
|
||||
rect_warned = true;
|
||||
else
|
||||
warn_missing_feature(rect_warned, "rectangularLines");
|
||||
}
|
||||
|
||||
ctx->gfx_pipeline_state.rast_prim = rast_prim;
|
||||
rast_prim_changed = true;
|
||||
|
|
@ -632,7 +640,7 @@ zink_draw(struct pipe_context *pctx,
|
|||
VKCTX(CmdSetProvokingVertexModeEXT)(batch->state->cmdbuf, rast_state->hw_state.pv_last ?
|
||||
VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT :
|
||||
VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT);
|
||||
VKCTX(CmdSetLineRasterizationModeEXT)(batch->state->cmdbuf, (VkLineRasterizationModeEXT)rast_state->hw_state.line_mode);
|
||||
VKCTX(CmdSetLineRasterizationModeEXT)(batch->state->cmdbuf, rast_state->dynamic_line_mode);
|
||||
if (screen->info.dynamic_state3_feats.extendedDynamicState3LineStippleEnable)
|
||||
VKCTX(CmdSetLineStippleEnableEXT)(batch->state->cmdbuf, rast_state->hw_state.line_stipple_enable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -603,6 +603,22 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
|
|||
} else {
|
||||
state->hw_state.line_mode = VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
|
||||
}
|
||||
state->dynamic_line_mode = state->hw_state.line_mode;
|
||||
switch (state->hw_state.line_mode) {
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT:
|
||||
if (!screen->info.line_rast_feats.rectangularLines)
|
||||
state->dynamic_line_mode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
|
||||
break;
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT:
|
||||
if (!screen->info.line_rast_feats.smoothLines)
|
||||
state->dynamic_line_mode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
|
||||
break;
|
||||
case VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT:
|
||||
if (!screen->info.line_rast_feats.bresenhamLines)
|
||||
state->dynamic_line_mode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (!rs_state->line_stipple_enable) {
|
||||
state->base.line_stipple_factor = 1;
|
||||
|
|
|
|||
|
|
@ -310,6 +310,7 @@ struct zink_rasterizer_state {
|
|||
float line_width;
|
||||
VkFrontFace front_face;
|
||||
VkCullModeFlags cull_mode;
|
||||
VkLineRasterizationModeEXT dynamic_line_mode;
|
||||
struct zink_rasterizer_hw_state hw_state;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue