asahi: Add sysval tables for each shader stage
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 11 Aug 2023 19:24:55 +0000 (15:24 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Aug 2023 15:06:55 +0000 (15:06 +0000)
So we can model the descriptors of each shader stage independently, as required
for merged shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>

src/gallium/drivers/asahi/agx_state.h

index fb5efed..3bdff57 100644 (file)
@@ -92,9 +92,30 @@ struct agx_streamout {
 enum agx_sysval_table {
    AGX_SYSVAL_TABLE_ROOT,
    AGX_SYSVAL_TABLE_GRID,
+   AGX_SYSVAL_TABLE_VS,
+   AGX_SYSVAL_TABLE_TCS,
+   AGX_SYSVAL_TABLE_TES,
+   AGX_SYSVAL_TABLE_GS,
+   AGX_SYSVAL_TABLE_FS,
+   AGX_SYSVAL_TABLE_CS,
    AGX_NUM_SYSVAL_TABLES
 };
 
+#define AGX_SYSVAL_STAGE(stage) (AGX_SYSVAL_TABLE_VS + (stage))
+
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_VERTEX) == AGX_SYSVAL_TABLE_VS,
+              "fixed enum orderings");
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_TESS_CTRL) == AGX_SYSVAL_TABLE_TCS,
+              "fixed enum orderings");
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_TESS_EVAL) == AGX_SYSVAL_TABLE_TES,
+              "fixed enum orderings");
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_GEOMETRY) == AGX_SYSVAL_TABLE_GS,
+              "fixed enum orderings");
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_FRAGMENT) == AGX_SYSVAL_TABLE_FS,
+              "fixed enum orderings");
+static_assert(AGX_SYSVAL_STAGE(PIPE_SHADER_COMPUTE) == AGX_SYSVAL_TABLE_CS,
+              "fixed enum orderings");
+
 /* Root system value table */
 struct PACKED agx_draw_uniforms {
    /* Pointer to binding table for texture descriptor, or 0 if none. This must