radeonsi: use SI_MAX_IO_GENERIC instead of magic values
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 10 May 2017 07:55:36 +0000 (09:55 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 12 May 2017 08:46:04 +0000 (10:46 +0200)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index b969376e9d2a7ad1ea0b332663be280f2eaa6626..bdc9cc10fab39630d329f1ae8978244e2b54b7b4 100644 (file)
@@ -142,7 +142,7 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index)
                assert(index <= 1);
                return 2 + index;
        case TGSI_SEMANTIC_GENERIC:
-               if (index <= 63-4)
+               if (index < SI_MAX_IO_GENERIC)
                        return 4 + index;
 
                assert(!"invalid generic index");
index b49dca4ef779a893cdb2d3ef909079a8f58c0740..cf97a719f2d0b6f5b2c3fb3aa1d25da477e45426 100644 (file)
@@ -145,6 +145,11 @@ struct ac_shader_binary;
 
 #define SI_MAX_VS_OUTPUTS      40
 
+/* Shader IO unique indices are supported for TGSI_SEMANTIC_GENERIC with an
+ * index smaller than this.
+ */
+#define SI_MAX_IO_GENERIC       60
+
 /* SGPR user data indices */
 enum {
        /* GFX9 merged shaders have RW_BUFFERS among the first 8 system SGPRs,
index 11e3dab2d7d6e30c6cf12331e92fb4b3d515dbdc..8193fe041dd1aaa54de827b8a34ec40239197659 100644 (file)
@@ -1843,7 +1843,7 @@ void si_init_shader_selector_async(void *job, int thread_index)
                                switch (name) {
                                case TGSI_SEMANTIC_GENERIC:
                                        /* don't process indices the function can't handle */
-                                       if (index >= 60)
+                                       if (index >= SI_MAX_IO_GENERIC)
                                                break;
                                        /* fall through */
                                case TGSI_SEMANTIC_CLIPDIST:
@@ -2000,7 +2000,7 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
 
                        case TGSI_SEMANTIC_GENERIC:
                                /* don't process indices the function can't handle */
-                               if (index >= 60)
+                               if (index >= SI_MAX_IO_GENERIC)
                                        break;
                                /* fall through */
                        case TGSI_SEMANTIC_POSITION: