diff --git a/src/intel/vulkan/anv_genX.h b/src/intel/vulkan/anv_genX.h index 73aa5ce7ca2..caddad7b7a8 100644 --- a/src/intel/vulkan/anv_genX.h +++ b/src/intel/vulkan/anv_genX.h @@ -52,6 +52,8 @@ extern const uint32_t genX(vk_to_intel_stencil_op)[]; extern const uint32_t genX(vk_to_intel_logic_op)[]; +extern const uint32_t genX(vk_to_intel_fillmode)[]; + void genX(init_physical_device_state)(struct anv_physical_device *device); VkResult genX(init_device_state)(struct anv_device *device); @@ -168,6 +170,7 @@ genX(rasterization_mode)(VkPolygonMode raster_mode, VkPolygonMode genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, + VkPolygonMode polygon_mode, VkPrimitiveTopology primitive_topology); void diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 4499a1961e5..02bc258e0f2 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -2300,10 +2300,9 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline, pipeline->negative_one_to_one = state->vp != NULL && state->vp->depth_clip_negative_one_to_one; - /* Store line mode, polygon mode and rasterization samples, these are used + /* Store line mode and rasterization samples, these are used * for dynamic primitive topology. */ - pipeline->polygon_mode = state->rs->polygon_mode; pipeline->rasterization_samples = state->ms != NULL ? state->ms->rasterization_samples : 1; pipeline->line_mode = state->rs->line.mode; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 9a3241da6e5..700d06c17e8 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2952,7 +2952,6 @@ struct anv_graphics_pipeline { * rasterization_samples used only with gen < 8. */ VkLineRasterizationModeEXT line_mode; - VkPolygonMode polygon_mode; uint32_t patch_control_points; uint32_t rasterization_samples; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 90dd68803a1..a809338520e 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3142,7 +3142,8 @@ cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer) if (!(cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) && !BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_IA_PRIMITIVE_TOPOLOGY) && - !BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORT_COUNT)) + !BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORT_COUNT) && + !BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_POLYGON_MODE)) return; /* Take dynamic primitive topology in to account with @@ -3150,6 +3151,7 @@ cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer) */ VkPolygonMode dynamic_raster_mode = genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline, + dyn->rs.polygon_mode, dyn->ia.primitive_topology); bool xy_clip_test_enable = (dynamic_raster_mode == VK_POLYGON_MODE_FILL); diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 44a9855e7c8..ba3a5aac92f 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -529,6 +529,7 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline) */ VkPolygonMode genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, + VkPolygonMode polygon_mode, VkPrimitiveTopology primitive_topology) { if (anv_pipeline_is_mesh(pipeline)) { @@ -538,7 +539,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, case SHADER_PRIM_LINES: return VK_POLYGON_MODE_LINE; case SHADER_PRIM_TRIANGLES: - return pipeline->polygon_mode; + return polygon_mode; default: unreachable("invalid primitive type for mesh"); } @@ -559,7 +560,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, case _3DPRIM_QUADLIST: case _3DPRIM_QUADSTRIP: case _3DPRIM_POLYGON: - return pipeline->polygon_mode; + return polygon_mode; } unreachable("Unsupported GS output topology"); } else if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL)) { @@ -572,7 +573,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, case BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW: case BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW: - return pipeline->polygon_mode; + return polygon_mode; } unreachable("Unsupported TCS output topology"); } else { @@ -591,7 +592,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline, case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: - return pipeline->polygon_mode; + return polygon_mode; default: unreachable("Unsupported primitive topology"); @@ -736,8 +737,6 @@ emit_rs_state(struct anv_graphics_pipeline *pipeline, raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0; raster.ForceMultisampling = false; - raster.FrontFaceFillMode = genX(vk_to_intel_fillmode)[rs->polygon_mode]; - raster.BackFaceFillMode = genX(vk_to_intel_fillmode)[rs->polygon_mode]; raster.ScissorRectangleEnable = true; raster.ViewportZFarClipTestEnable = pipeline->depth_clip_enable; diff --git a/src/intel/vulkan/gfx8_cmd_buffer.c b/src/intel/vulkan/gfx8_cmd_buffer.c index 92921ac7500..867a70e91be 100644 --- a/src/intel/vulkan/gfx8_cmd_buffer.c +++ b/src/intel/vulkan/gfx8_cmd_buffer.c @@ -239,7 +239,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_CULL_MODE) || 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_DEPTH_BIAS_FACTORS) || + BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_POLYGON_MODE)) { /* Take dynamic primitive topology in to account with * 3DSTATE_RASTER::APIMode * 3DSTATE_RASTER::DXMultisampleRasterizationEnable @@ -250,6 +251,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) 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, @@ -273,6 +275,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) .GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant, .GlobalDepthOffsetScale = dyn->rs.depth_bias.slope, .GlobalDepthOffsetClamp = dyn->rs.depth_bias.clamp, + .FrontFaceFillMode = genX(vk_to_intel_fillmode)[dyn->rs.polygon_mode], + .BackFaceFillMode = genX(vk_to_intel_fillmode)[dyn->rs.polygon_mode], }; GENX(3DSTATE_RASTER_pack)(NULL, raster_dw, &raster); anv_batch_emit_merge(&cmd_buffer->batch, raster_dw,