anv: dynamic state for polygon mode
Remove 'polygon_mode' from pipeline and read it from dynamic state instead. This affects following packets: 3DSTATE_CLIP 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:
@@ -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_logic_op)[];
|
||||||
|
|
||||||
|
extern const uint32_t genX(vk_to_intel_fillmode)[];
|
||||||
|
|
||||||
void genX(init_physical_device_state)(struct anv_physical_device *device);
|
void genX(init_physical_device_state)(struct anv_physical_device *device);
|
||||||
|
|
||||||
VkResult genX(init_device_state)(struct anv_device *device);
|
VkResult genX(init_device_state)(struct anv_device *device);
|
||||||
@@ -168,6 +170,7 @@ genX(rasterization_mode)(VkPolygonMode raster_mode,
|
|||||||
|
|
||||||
VkPolygonMode
|
VkPolygonMode
|
||||||
genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
||||||
|
VkPolygonMode polygon_mode,
|
||||||
VkPrimitiveTopology primitive_topology);
|
VkPrimitiveTopology primitive_topology);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -2300,10 +2300,9 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
|
|||||||
pipeline->negative_one_to_one =
|
pipeline->negative_one_to_one =
|
||||||
state->vp != NULL && state->vp->depth_clip_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.
|
* for dynamic primitive topology.
|
||||||
*/
|
*/
|
||||||
pipeline->polygon_mode = state->rs->polygon_mode;
|
|
||||||
pipeline->rasterization_samples =
|
pipeline->rasterization_samples =
|
||||||
state->ms != NULL ? state->ms->rasterization_samples : 1;
|
state->ms != NULL ? state->ms->rasterization_samples : 1;
|
||||||
pipeline->line_mode = state->rs->line.mode;
|
pipeline->line_mode = state->rs->line.mode;
|
||||||
|
@@ -2952,7 +2952,6 @@ struct anv_graphics_pipeline {
|
|||||||
* rasterization_samples used only with gen < 8.
|
* rasterization_samples used only with gen < 8.
|
||||||
*/
|
*/
|
||||||
VkLineRasterizationModeEXT line_mode;
|
VkLineRasterizationModeEXT line_mode;
|
||||||
VkPolygonMode polygon_mode;
|
|
||||||
uint32_t patch_control_points;
|
uint32_t patch_control_points;
|
||||||
uint32_t rasterization_samples;
|
uint32_t rasterization_samples;
|
||||||
|
|
||||||
|
@@ -3142,7 +3142,8 @@ cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
if (!(cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) &&
|
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_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;
|
return;
|
||||||
|
|
||||||
/* Take dynamic primitive topology in to account with
|
/* 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 =
|
VkPolygonMode dynamic_raster_mode =
|
||||||
genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline,
|
genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline,
|
||||||
|
dyn->rs.polygon_mode,
|
||||||
dyn->ia.primitive_topology);
|
dyn->ia.primitive_topology);
|
||||||
bool xy_clip_test_enable = (dynamic_raster_mode == VK_POLYGON_MODE_FILL);
|
bool xy_clip_test_enable = (dynamic_raster_mode == VK_POLYGON_MODE_FILL);
|
||||||
|
|
||||||
|
@@ -529,6 +529,7 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
|
|||||||
*/
|
*/
|
||||||
VkPolygonMode
|
VkPolygonMode
|
||||||
genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
||||||
|
VkPolygonMode polygon_mode,
|
||||||
VkPrimitiveTopology primitive_topology)
|
VkPrimitiveTopology primitive_topology)
|
||||||
{
|
{
|
||||||
if (anv_pipeline_is_mesh(pipeline)) {
|
if (anv_pipeline_is_mesh(pipeline)) {
|
||||||
@@ -538,7 +539,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
|||||||
case SHADER_PRIM_LINES:
|
case SHADER_PRIM_LINES:
|
||||||
return VK_POLYGON_MODE_LINE;
|
return VK_POLYGON_MODE_LINE;
|
||||||
case SHADER_PRIM_TRIANGLES:
|
case SHADER_PRIM_TRIANGLES:
|
||||||
return pipeline->polygon_mode;
|
return polygon_mode;
|
||||||
default:
|
default:
|
||||||
unreachable("invalid primitive type for mesh");
|
unreachable("invalid primitive type for mesh");
|
||||||
}
|
}
|
||||||
@@ -559,7 +560,7 @@ genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
|||||||
case _3DPRIM_QUADLIST:
|
case _3DPRIM_QUADLIST:
|
||||||
case _3DPRIM_QUADSTRIP:
|
case _3DPRIM_QUADSTRIP:
|
||||||
case _3DPRIM_POLYGON:
|
case _3DPRIM_POLYGON:
|
||||||
return pipeline->polygon_mode;
|
return polygon_mode;
|
||||||
}
|
}
|
||||||
unreachable("Unsupported GS output topology");
|
unreachable("Unsupported GS output topology");
|
||||||
} else if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL)) {
|
} 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_CW:
|
||||||
case BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW:
|
case BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW:
|
||||||
return pipeline->polygon_mode;
|
return polygon_mode;
|
||||||
}
|
}
|
||||||
unreachable("Unsupported TCS output topology");
|
unreachable("Unsupported TCS output topology");
|
||||||
} else {
|
} 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_FAN:
|
||||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
|
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
|
||||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
|
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
|
||||||
return pipeline->polygon_mode;
|
return polygon_mode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Unsupported primitive topology");
|
unreachable("Unsupported primitive topology");
|
||||||
@@ -736,8 +737,6 @@ emit_rs_state(struct anv_graphics_pipeline *pipeline,
|
|||||||
raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0;
|
raster.ForcedSampleCount = FSC_NUMRASTSAMPLES_0;
|
||||||
raster.ForceMultisampling = false;
|
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.ScissorRectangleEnable = true;
|
||||||
|
|
||||||
raster.ViewportZFarClipTestEnable = pipeline->depth_clip_enable;
|
raster.ViewportZFarClipTestEnable = pipeline->depth_clip_enable;
|
||||||
|
@@ -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_CULL_MODE) ||
|
||||||
BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_FRONT_FACE) ||
|
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_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
|
/* Take dynamic primitive topology in to account with
|
||||||
* 3DSTATE_RASTER::APIMode
|
* 3DSTATE_RASTER::APIMode
|
||||||
* 3DSTATE_RASTER::DXMultisampleRasterizationEnable
|
* 3DSTATE_RASTER::DXMultisampleRasterizationEnable
|
||||||
@@ -250,6 +251,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
VkPolygonMode dynamic_raster_mode =
|
VkPolygonMode dynamic_raster_mode =
|
||||||
genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline,
|
genX(raster_polygon_mode)(cmd_buffer->state.gfx.pipeline,
|
||||||
|
dyn->rs.polygon_mode,
|
||||||
dyn->ia.primitive_topology);
|
dyn->ia.primitive_topology);
|
||||||
|
|
||||||
genX(rasterization_mode)(dynamic_raster_mode,
|
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,
|
.GlobalDepthOffsetConstant = dyn->rs.depth_bias.constant,
|
||||||
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope,
|
.GlobalDepthOffsetScale = dyn->rs.depth_bias.slope,
|
||||||
.GlobalDepthOffsetClamp = dyn->rs.depth_bias.clamp,
|
.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);
|
GENX(3DSTATE_RASTER_pack)(NULL, raster_dw, &raster);
|
||||||
anv_batch_emit_merge(&cmd_buffer->batch, raster_dw,
|
anv_batch_emit_merge(&cmd_buffer->batch, raster_dw,
|
||||||
|
Reference in New Issue
Block a user