anv: move 3DSTATE_SF dynamic emission path

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36665>
This commit is contained in:
Lionel Landwerlin
2025-03-27 14:32:44 +02:00
committed by Marge Bot
parent 20721419e5
commit 7b8a6af222
4 changed files with 23 additions and 28 deletions
-1
View File
@@ -565,7 +565,6 @@ anv_cmd_buffer_flush_pipeline_hw_state(struct anv_cmd_buffer *cmd_buffer,
diff_fix_state(DS, final.ds);
diff_fix_state(CLIP, partial.clip);
diff_fix_state(SF, partial.sf);
diff_fix_state(WM, partial.wm);
diff_fix_state(STREAMOUT, partial.so);
diff_fix_state(GS, partial.gs);
+2 -2
View File
@@ -1794,6 +1794,7 @@ struct anv_gfx_dynamic_state {
/* 3DSTATE_SF */
struct {
uint32_t DerefBlockSize;
uint32_t PointWidthSource;
float LineWidth;
uint32_t TriangleStripListProvokingVertexSelect;
uint32_t LineStripListProvokingVertexSelect;
@@ -5172,7 +5173,6 @@ struct anv_graphics_pipeline {
*/
struct {
struct anv_gfx_state_ptr clip;
struct anv_gfx_state_ptr sf;
struct anv_gfx_state_ptr ps_extra;
struct anv_gfx_state_ptr wm;
struct anv_gfx_state_ptr so;
@@ -5399,7 +5399,7 @@ get_gfx_last_vue_map(const struct anv_cmd_graphics_state *gfx)
return &((const struct brw_vs_prog_data *)
gfx->shaders[MESA_SHADER_VERTEX]->prog_data)->base.vue_map;
}
return NULL;
UNREACHABLE("Invalid bound shaders");
}
static inline const struct brw_cs_prog_data *
+21 -2
View File
@@ -1176,6 +1176,15 @@ update_line_width(struct anv_gfx_dynamic_state *hw_state,
SET(SF, sf.LineWidth, dyn->rs.line.width);
}
ALWAYS_INLINE static void
update_sf_point_width_source(struct anv_gfx_dynamic_state *hw_state,
const struct anv_cmd_graphics_state *gfx)
{
SET(SF, sf.PointWidthSource,
(get_gfx_last_vue_map(gfx)->slots_valid & VARYING_BIT_PSIZ) ?
Vertex : State);
}
ALWAYS_INLINE static void
update_sf_global_depth_bias(struct anv_gfx_dynamic_state *hw_state,
const struct vk_dynamic_graphics_state *dyn)
@@ -2050,6 +2059,9 @@ cmd_buffer_flush_gfx_runtime_state(struct anv_gfx_dynamic_state *hw_state,
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_LINE_WIDTH))
update_line_width(hw_state, dyn);
if (gfx->dirty & ANV_CMD_DIRTY_PRERASTER_SHADERS)
update_sf_point_width_source(hw_state, gfx);
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_BIAS_FACTORS))
update_sf_global_depth_bias(hw_state, dyn);
@@ -2833,11 +2845,18 @@ cmd_buffer_gfx_state_emission(struct anv_cmd_buffer *cmd_buffer)
#endif /* GFX_VER >= 30 */
if (BITSET_TEST(hw_state->dirty, ANV_GFX_STATE_SF)) {
anv_batch_emit_merge(&cmd_buffer->batch, GENX(3DSTATE_SF),
pipeline, partial.sf, sf) {
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_SF), sf) {
/* Fixed values */
sf.ViewportTransformEnable = true;
sf.StatisticsEnable = true;
sf.VertexSubPixelPrecisionSelect = _8Bit;
sf.AALineDistanceMode = true;
sf.PointWidth = 1.0;
#if GFX_VER >= 12
SET(sf, sf, DerefBlockSize);
#endif
SET(sf, sf, PointWidthSource);
SET(sf, sf, LineWidth);
SET(sf, sf, TriangleStripListProvokingVertexSelect);
SET(sf, sf, LineStripListProvokingVertexSelect);
-23
View File
@@ -612,28 +612,6 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline)
}
}
static void
emit_rs_state(struct anv_graphics_pipeline *pipeline)
{
anv_pipeline_emit(pipeline, partial.sf, GENX(3DSTATE_SF), sf) {
sf.ViewportTransformEnable = true;
sf.StatisticsEnable = true;
sf.VertexSubPixelPrecisionSelect = _8Bit;
sf.AALineDistanceMode = true;
const struct intel_vue_map *vue_map =
anv_pipeline_is_primitive(pipeline) ?
&anv_pipeline_get_last_vue_prog_data(pipeline)->vue_map :
&get_pipeline_mesh_prog_data(pipeline)->map.vue_map;
if (vue_map->slots_valid & VARYING_BIT_PSIZ) {
sf.PointWidthSource = Vertex;
} else {
sf.PointWidthSource = State;
sf.PointWidth = 1.0;
}
}
}
static void
emit_3dstate_clip(struct anv_graphics_pipeline *pipeline,
const struct vk_input_assembly_state *ia,
@@ -1697,7 +1675,6 @@ void
genX(graphics_pipeline_emit)(struct anv_graphics_pipeline *pipeline,
const struct vk_graphics_pipeline_state *state)
{
emit_rs_state(pipeline);
compute_kill_pixel(pipeline, state->ms, state);
emit_3dstate_clip(pipeline, state->ia, state->vp, state->rs);