From 71e089571568bd6f6ced249e332dd621833086ca Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Sat, 11 Oct 2025 15:48:34 +0800 Subject: [PATCH] mesa,radeonsi: add comments about vertex and mesh pipeline shader states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are exclusive in mesa state tracker currently, so add some comments and assertions for developers. Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_state_draw.cpp | 8 ++++++++ src/mesa/state_tracker/st_atom.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index a0cd954d720..8cc3d42e57a 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -2333,6 +2333,14 @@ static void si_draw(struct pipe_context *ctx, } } + /* Make sure that the MS is not set when vertex pipeline is used. + * + * This is ensured by mesa state tracker to always update all graphics shader + * stages in any pipeline's draw call, and set the other pipeline's shader stages + * to be NULL when internal draw operations. + */ + assert(!sctx->ms_shader_state.cso); + if (unlikely(sctx->dirty_shaders_mask)) { if (unlikely(!(si_update_shaders(sctx)))) { DRAW_CLEANUP; diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 951803e8a90..1def5b83a00 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -134,6 +134,13 @@ typedef BITSET_DECLARE(st_state_bitset, ST_NUM_ATOMS); ST_SET_STATE4(bitset, ST_NEW_##shader##_UBOS, ST_NEW_##shader##_ATOMICS, \ ST_NEW_##shader##_SSBOS, ST_NEW_##shader##_IMAGES); +/* This is in fact states for vertex pipeline (as opposite to mesh pipeline). + * But we still include mesh shader states to ensure mesh shader is not set + * when using vertex pipeline (so does the mesh pipeline) to simplify driver + * implementation. + * + * TODO: remove mesh shader states from this macro once driver is ready. + */ #define ST_PIPELINE_RENDER_STATE_MASK(bitset) \ st_state_bitset bitset = {0}; \ ST_SHADER_STATE_MASK(bitset, CS); \