zink: support line stippling

VK_EXT_line_rasterization allows us to specify a line-stilling pattern.
So let's do that.

While we're at it, use more bit-allocation here.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11795>
This commit is contained in:
Erik Faye-Lund
2019-10-28 17:34:38 +01:00
committed by Marge Bot
parent 1fc9e94d12
commit f589159db9
3 changed files with 20 additions and 3 deletions
+10 -3
View File
@@ -150,9 +150,16 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
rast_line_state.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT;
rast_line_state.pNext = rast_state.pNext;
rast_line_state.lineRasterizationMode = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
rast_line_state.stippledLineEnable = VK_FALSE;
rast_line_state.lineStippleFactor = 0;
rast_line_state.lineStipplePattern = 0;
if (state->rast_state->line_stipple_pattern != UINT16_MAX) {
rast_line_state.stippledLineEnable = VK_TRUE;
rast_line_state.lineStippleFactor = state->rast_state->line_stipple_factor + 1;
rast_line_state.lineStipplePattern = state->rast_state->line_stipple_pattern;
} else {
rast_line_state.stippledLineEnable = VK_FALSE;
rast_line_state.lineStippleFactor = 0;
rast_line_state.lineStipplePattern = 0;
}
rast_state.pNext = &rast_line_state;
}
+8
View File
@@ -459,6 +459,14 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
VK_FRONT_FACE_COUNTER_CLOCKWISE :
VK_FRONT_FACE_CLOCKWISE;
if (rs_state->line_stipple_enable) {
state->hw_state.line_stipple_factor = rs_state->line_stipple_factor;
state->hw_state.line_stipple_pattern = rs_state->line_stipple_pattern;
} else {
state->hw_state.line_stipple_factor = 0;
state->hw_state.line_stipple_pattern = UINT16_MAX;
}
state->offset_point = rs_state->offset_point;
state->offset_line = rs_state->offset_line;
state->offset_tri = rs_state->offset_tri;
+2
View File
@@ -53,6 +53,8 @@ struct zink_rasterizer_hw_state {
unsigned depth_clamp : 1;
unsigned rasterizer_discard : 1;
unsigned force_persample_interp : 1;
unsigned line_stipple_factor : 8;
unsigned line_stipple_pattern : 16;
};
struct zink_rasterizer_state {