radeonsi: get rid of secondary input/output word
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 2 May 2017 15:46:12 +0000 (17:46 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 12 May 2017 08:46:06 +0000 (10:46 +0200)
By keeping track of fewer generics, everything can fit into 64 bits.

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 c12c8ea39e79e91f8d4110a585a93d2834cce169..837cc1cfb7d35fab6bcb70d15c3a74d7861c9491 100644 (file)
@@ -148,29 +148,22 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index)
                assert(!"invalid generic index");
                return 0;
 
-       default:
-               assert(!"invalid semantic name");
-               return 0;
-       }
-}
-
-unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index)
-{
-       switch (name) {
        case TGSI_SEMANTIC_FOG:
-               return 0;
+               return SI_MAX_IO_GENERIC + 4;
        case TGSI_SEMANTIC_LAYER:
-               return 1;
+               return SI_MAX_IO_GENERIC + 5;
        case TGSI_SEMANTIC_VIEWPORT_INDEX:
-               return 2;
+               return SI_MAX_IO_GENERIC + 6;
        case TGSI_SEMANTIC_PRIMID:
-               return 3;
+               return SI_MAX_IO_GENERIC + 7;
        case TGSI_SEMANTIC_COLOR: /* these alias */
        case TGSI_SEMANTIC_BCOLOR:
-               return 4 + index;
+               assert(index < 2);
+               return SI_MAX_IO_GENERIC + 8 + index;
        case TGSI_SEMANTIC_TEXCOORD:
                assert(index < 8);
-               return 6 + index;
+               assert(SI_MAX_IO_GENERIC + 10 + index < 64);
+               return SI_MAX_IO_GENERIC + 10 + index;
        default:
                assert(!"invalid semantic name");
                return 0;
@@ -2298,16 +2291,10 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base,
                        if (semantic_index >= SI_MAX_IO_GENERIC)
                                break;
                        /* fall through */
-               case TGSI_SEMANTIC_CLIPDIST:
+               default:
                        if (shader->key.opt.hw_vs.kill_outputs &
                            (1ull << si_shader_io_get_unique_index(semantic_name, semantic_index)))
                                export_param = false;
-                       break;
-               default:
-                       if (shader->key.opt.hw_vs.kill_outputs2 &
-                           (1u << si_shader_io_get_unique_index2(semantic_name, semantic_index)))
-                               export_param = false;
-                       break;
                }
 
                if (outputs[i].vertex_stream[0] != 0 &&
@@ -7159,7 +7146,6 @@ static void si_dump_shader_key(unsigned processor, const struct si_shader *shade
             processor == PIPE_SHADER_VERTEX) &&
            !key->as_es && !key->as_ls) {
                fprintf(f, "  opt.hw_vs.kill_outputs = 0x%"PRIx64"\n", key->opt.hw_vs.kill_outputs);
-               fprintf(f, "  opt.hw_vs.kill_outputs2 = 0x%x\n", key->opt.hw_vs.kill_outputs2);
                fprintf(f, "  opt.hw_vs.clip_disable = %u\n", key->opt.hw_vs.clip_disable);
        }
 }
index 307590024f527ba3b3dea651e2cde273844a5157..1627de3980be85eb81a3c9d0aaa854172faec47d 100644 (file)
@@ -361,11 +361,9 @@ struct si_shader_selector {
        unsigned local_size;
 
        uint64_t        outputs_written;        /* "get_unique_index" bits */
-       uint32_t        patch_outputs_written;  /* "get_unique_index" bits */
-       uint32_t        outputs_written2;       /* "get_unique_index2" bits */
+       uint32_t        patch_outputs_written;  /* "get_unique_index_patch" bits */
 
        uint64_t        inputs_read;            /* "get_unique_index" bits */
-       uint32_t        inputs_read2;           /* "get_unique_index2" bits */
 };
 
 /* Valid shader configurations:
@@ -505,7 +503,6 @@ struct si_shader_key {
        struct {
                struct {
                        uint64_t        kill_outputs; /* "get_unique_index" bits */
-                       uint32_t        kill_outputs2; /* "get_unique_index2" bits */
                        unsigned        clip_disable:1;
                } hw_vs; /* HW VS (it can be VS, TES, GS) */
 
@@ -604,7 +601,6 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
 void si_shader_destroy(struct si_shader *shader);
 unsigned si_shader_io_get_unique_index_patch(unsigned semantic_name, unsigned index);
 unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index);
-unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index);
 int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
 void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
                    struct pipe_debug_callback *debug, unsigned processor,
index 6020bec9c0f26485304770945c0fbadbb9966449..5da60148af2a1d713de3e09c8b897116caccd252 100644 (file)
@@ -1231,22 +1231,17 @@ static void si_shader_selector_key_hw_vs(struct si_context *sctx,
 
        /* Find out which VS outputs aren't used by the PS. */
        uint64_t outputs_written = vs->outputs_written;
-       uint32_t outputs_written2 = vs->outputs_written2;
        uint64_t inputs_read = 0;
-       uint32_t inputs_read2 = 0;
 
        outputs_written &= ~0x3; /* ignore POSITION, PSIZE */
 
        if (!ps_disabled) {
                inputs_read = ps->inputs_read;
-               inputs_read2 = ps->inputs_read2;
        }
 
        uint64_t linked = outputs_written & inputs_read;
-       uint32_t linked2 = outputs_written2 & inputs_read2;
 
        key->opt.hw_vs.kill_outputs = ~linked & outputs_written;
-       key->opt.hw_vs.kill_outputs2 = ~linked2 & outputs_written2;
 }
 
 /* Compute the key for the hw shader variant */
@@ -1846,7 +1841,7 @@ void si_init_shader_selector_async(void *job, int thread_index)
                                        if (index >= SI_MAX_IO_GENERIC)
                                                break;
                                        /* fall through */
-                               case TGSI_SEMANTIC_CLIPDIST:
+                               default:
                                        id = si_shader_io_get_unique_index(name, index);
                                        sel->outputs_written &= ~(1ull << id);
                                        break;
@@ -1855,9 +1850,6 @@ void si_init_shader_selector_async(void *job, int thread_index)
                                case TGSI_SEMANTIC_CLIPVERTEX:
                                case TGSI_SEMANTIC_EDGEFLAG:
                                        break;
-                               default:
-                                       id = si_shader_io_get_unique_index2(name, index);
-                                       sel->outputs_written2 &= ~(1u << id);
                                }
                        }
                }
@@ -2003,18 +1995,13 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
                                if (index >= SI_MAX_IO_GENERIC)
                                        break;
                                /* fall through */
-                       case TGSI_SEMANTIC_POSITION:
-                       case TGSI_SEMANTIC_PSIZE:
-                       case TGSI_SEMANTIC_CLIPDIST:
+                       default:
                                sel->outputs_written |=
                                        1llu << si_shader_io_get_unique_index(name, index);
                                break;
                        case TGSI_SEMANTIC_CLIPVERTEX: /* ignore these */
                        case TGSI_SEMANTIC_EDGEFLAG:
                                break;
-                       default:
-                               sel->outputs_written2 |=
-                                       1u << si_shader_io_get_unique_index2(name, index);
                        }
                }
                sel->esgs_itemsize = util_last_bit64(sel->outputs_written) * 16;
@@ -2037,15 +2024,12 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
                                if (index >= SI_MAX_IO_GENERIC)
                                        break;
                                /* fall through */
-                       case TGSI_SEMANTIC_CLIPDIST:
+                       default:
                                sel->inputs_read |=
                                        1llu << si_shader_io_get_unique_index(name, index);
                                break;
                        case TGSI_SEMANTIC_PCOORD: /* ignore this */
                                break;
-                       default:
-                               sel->inputs_read2 |=
-                                       1u << si_shader_io_get_unique_index2(name, index);
                        }
                }