anv: dynamic line rasterization mode

This affects following packets:

  3DSTATE_RASTER

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18879>
This commit is contained in:
Tapani Pälli 2022-09-04 19:12:21 +03:00 committed by Marge Bot
parent fe5a259723
commit ad2e80ee53
3 changed files with 22 additions and 12 deletions

View file

@ -2305,14 +2305,6 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
*/
pipeline->rasterization_samples =
state->ms != NULL ? state->ms->rasterization_samples : 1;
pipeline->line_mode = state->rs->line.mode;
if (pipeline->line_mode == VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT) {
if (pipeline->rasterization_samples > 1) {
pipeline->line_mode = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} else {
pipeline->line_mode = VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
}
}
pipeline->patch_control_points =
state->ts != NULL ? state->ts->patch_control_points : 0;

View file

@ -2951,7 +2951,6 @@ struct anv_graphics_pipeline {
/* These fields are required with dynamic primitive topology,
* rasterization_samples used only with gen < 8.
*/
VkLineRasterizationModeEXT line_mode;
uint32_t patch_control_points;
uint32_t rasterization_samples;
@ -3853,6 +3852,20 @@ anv_rasterization_aa_mode(VkPolygonMode raster_mode,
return false;
}
static inline VkLineRasterizationModeEXT
anv_line_rasterization_mode(VkLineRasterizationModeEXT line_mode,
unsigned rasterization_samples)
{
if (line_mode == VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT) {
if (rasterization_samples > 1) {
return VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT;
} else {
return VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT;
}
}
return line_mode;
}
VkFormatFeatureFlags2
anv_get_image_format_features2(const struct intel_device_info *devinfo,
VkFormat vk_format,

View file

@ -290,7 +290,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_FRONT_FACE) ||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_ENABLE) ||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS) ||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_POLYGON_MODE)) {
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_POLYGON_MODE) ||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_LINE_MODE)) {
/* Take dynamic primitive topology in to account with
* 3DSTATE_RASTER::APIMode
* 3DSTATE_RASTER::DXMultisampleRasterizationEnable
@ -299,17 +300,21 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
uint32_t api_mode = 0;
bool msaa_raster_enable = false;
VkLineRasterizationModeEXT line_mode =
anv_line_rasterization_mode(dyn->rs.line.mode,
pipeline->rasterization_samples);
VkPolygonMode dynamic_raster_mode =
genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline,
dyn->rs.polygon_mode,
dyn->ia.primitive_topology);
genX(rasterization_mode)(dynamic_raster_mode,
pipeline->line_mode, dyn->rs.line.width,
line_mode, dyn->rs.line.width,
&api_mode, &msaa_raster_enable);
bool aa_enable = anv_rasterization_aa_mode(dynamic_raster_mode,
pipeline->line_mode);
line_mode);
uint32_t raster_dw[GENX(3DSTATE_RASTER_length)];
struct GENX(3DSTATE_RASTER) raster = {