diff options
author | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2019-10-28 17:34:38 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-07-09 13:18:47 +0000 |
commit | f589159db9cbab5ef80bde27a3851939ace1a31b (patch) | |
tree | 1c08ea52eaddbb33d8f51f75d591539d88746ce1 | |
parent | 1fc9e94d12dd7bb432de4c7950f6b02e5972c118 (diff) |
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>
-rw-r--r-- | src/gallium/drivers/zink/zink_pipeline.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_state.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_state.h | 2 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index c9a01b215fa..611eebb992f 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -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; } diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c index bc9fd3e8e09..dc1cdcef0da 100644 --- a/src/gallium/drivers/zink/zink_state.c +++ b/src/gallium/drivers/zink/zink_state.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_state.h b/src/gallium/drivers/zink/zink_state.h index f27a975c445..96962ef6222 100644 --- a/src/gallium/drivers/zink/zink_state.h +++ b/src/gallium/drivers/zink/zink_state.h @@ -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 { |