From: Erik Faye-Lund Date: Tue, 20 Apr 2021 16:28:24 +0000 (+0200) Subject: zink: fill in the right line-mode based on state X-Git-Tag: upstream/21.2.3~652 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3b0f439a78121812792e332e05851d7aa4a32ab;p=platform%2Fupstream%2Fmesa.git zink: fill in the right line-mode based on state We need to fill in the right line-mode here based on the state to get the correct rasterization; bresenham isn't always the right one. Reviewed-By: Mike Blumenkrantz Part-of: --- diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 611eebb..7f5763d 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -149,7 +149,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen, if (screen->info.have_EXT_line_rasterization) { 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.lineRasterizationMode = state->rast_state->line_mode; if (state->rast_state->line_stipple_pattern != UINT16_MAX) { rast_line_state.stippledLineEnable = VK_TRUE; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 88e0d72..f0796a6 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1706,7 +1706,14 @@ check_base_requirements(struct zink_screen *screen) !(screen->info.feats12.scalarBlockLayout || screen->info.have_EXT_scalar_block_layout) || !screen->info.have_KHR_maintenance1 || - !screen->info.have_EXT_custom_border_color) { + !screen->info.have_EXT_custom_border_color || + !screen->info.have_EXT_line_rasterization || + !screen->info.line_rast_feats.rectangularLines || + !screen->info.line_rast_feats.bresenhamLines || + !screen->info.line_rast_feats.smoothLines || + !screen->info.line_rast_feats.stippledRectangularLines || + !screen->info.line_rast_feats.stippledBresenhamLines || + !screen->info.line_rast_feats.stippledSmoothLines) { fprintf(stderr, "WARNING: Some incorrect rendering " "might occur because the selected Vulkan device (%s) doesn't support " "base Zink requirements: ", screen->info.props.deviceName); @@ -1723,6 +1730,15 @@ check_base_requirements(struct zink_screen *screen) printf("scalarBlockLayout OR EXT_scalar_block_layout "); CHECK_OR_PRINT(have_KHR_maintenance1); CHECK_OR_PRINT(have_EXT_custom_border_color); + CHECK_OR_PRINT(have_EXT_line_rasterization); + if (screen->info.have_EXT_line_rasterization) { + CHECK_OR_PRINT(line_rast_feats.rectangularLines); + CHECK_OR_PRINT(line_rast_feats.bresenhamLines); + CHECK_OR_PRINT(line_rast_feats.smoothLines); + CHECK_OR_PRINT(line_rast_feats.stippledRectangularLines); + CHECK_OR_PRINT(line_rast_feats.stippledBresenhamLines); + CHECK_OR_PRINT(line_rast_feats.stippledSmoothLines); + } fprintf(stderr, "\n"); } } diff --git a/src/gallium/drivers/zink/zink_state.c b/src/gallium/drivers/zink/zink_state.c index dc1cdce..ac6a591 100644 --- a/src/gallium/drivers/zink/zink_state.c +++ b/src/gallium/drivers/zink/zink_state.c @@ -459,10 +459,47 @@ zink_create_rasterizer_state(struct pipe_context *pctx, VK_FRONT_FACE_COUNTER_CLOCKWISE : VK_FRONT_FACE_CLOCKWISE; + VkPhysicalDeviceLineRasterizationFeaturesEXT *line_feats = + &screen->info.line_rast_feats; + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT; + 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; + + if (screen->info.have_EXT_line_rasterization) { + if (rs_state->multisample) { + if (line_feats->stippledRectangularLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; + } else if (rs_state->line_smooth) { + if (line_feats->stippledRectangularLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT; + } else if (line_feats->stippledBresenhamLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT; + else { + /* no suitable mode that supports line stippling */ + state->hw_state.line_stipple_factor = 0; + state->hw_state.line_stipple_pattern = UINT16_MAX; + } + } } else { + if (screen->info.have_EXT_line_rasterization) { + if (rs_state->multisample) { + if (line_feats->rectangularLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT; + } else if (rs_state->line_smooth) { + if (line_feats->rectangularLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT; + } else if (line_feats->bresenhamLines) + state->hw_state.line_mode = + VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT; + } state->hw_state.line_stipple_factor = 0; state->hw_state.line_stipple_pattern = UINT16_MAX; } diff --git a/src/gallium/drivers/zink/zink_state.h b/src/gallium/drivers/zink/zink_state.h index 96962ef..c333afc 100644 --- a/src/gallium/drivers/zink/zink_state.h +++ b/src/gallium/drivers/zink/zink_state.h @@ -50,6 +50,7 @@ struct zink_rasterizer_hw_state { VkPolygonMode polygon_mode; VkCullModeFlags cull_mode; VkProvokingVertexModeEXT pv_mode; + VkLineRasterizationModeEXT line_mode; unsigned depth_clamp : 1; unsigned rasterizer_discard : 1; unsigned force_persample_interp : 1;