From: Marek Olšák <[email protected]>

the next patch will benefit from this
---
 src/gallium/drivers/radeonsi/si_shader.c        | 8 +++++---
 src/gallium/drivers/radeonsi/si_shader.h        | 3 ++-
 src/gallium/drivers/radeonsi/si_state_shaders.c | 5 +++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index a6b7e5e..4ee4a64 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2269,35 +2269,36 @@ static void si_llvm_export_vs(struct 
lp_build_tgsi_context *bld_base,
        unsigned semantic_name, semantic_index;
        unsigned target;
        unsigned param_count = 0;
        unsigned pos_idx;
        int i;
 
        for (i = 0; i < noutput; i++) {
                semantic_name = outputs[i].semantic_name;
                semantic_index = outputs[i].semantic_index;
                bool export_param = true;
+               unsigned id;
 
                switch (semantic_name) {
                case TGSI_SEMANTIC_POSITION: /* ignore these */
                case TGSI_SEMANTIC_PSIZE:
                case TGSI_SEMANTIC_CLIPVERTEX:
                case TGSI_SEMANTIC_EDGEFLAG:
                        break;
                case TGSI_SEMANTIC_GENERIC:
                        /* don't process indices the function can't handle */
                        if (semantic_index >= SI_MAX_IO_GENERIC)
                                break;
                        /* fall through */
                default:
-                       if (shader->key.opt.kill_outputs &
-                           (1ull << 
si_shader_io_get_unique_index(semantic_name, semantic_index)))
+                       id = si_shader_io_get_unique_index(semantic_name, 
semantic_index);
+                       if (shader->key.opt.kill_outputs[id / 32] & (1u << (id 
% 32)))
                                export_param = false;
                }
 
                if (outputs[i].vertex_stream[0] != 0 &&
                    outputs[i].vertex_stream[1] != 0 &&
                    outputs[i].vertex_stream[2] != 0 &&
                    outputs[i].vertex_stream[3] != 0)
                        export_param = false;
 
 handle_semantic:
@@ -5328,21 +5329,22 @@ static void si_dump_shader_key(unsigned processor, 
const struct si_shader *shade
                break;
 
        default:
                assert(0);
        }
 
        if ((processor == PIPE_SHADER_GEOMETRY ||
             processor == PIPE_SHADER_TESS_EVAL ||
             processor == PIPE_SHADER_VERTEX) &&
            !key->as_es && !key->as_ls) {
-               fprintf(f, "  opt.kill_outputs = 0x%"PRIx64"\n", 
key->opt.kill_outputs);
+               fprintf(f, "  opt.kill_outputs[0] = 0x%x\n", 
key->opt.kill_outputs[0]);
+               fprintf(f, "  opt.kill_outputs[1] = 0x%x\n", 
key->opt.kill_outputs[1]);
                fprintf(f, "  opt.clip_disable = %u\n", key->opt.clip_disable);
        }
 }
 
 static void si_init_shader_ctx(struct si_shader_context *ctx,
                               struct si_screen *sscreen,
                               LLVMTargetMachineRef tm)
 {
        struct lp_build_tgsi_context *bld_base;
 
diff --git a/src/gallium/drivers/radeonsi/si_shader.h 
b/src/gallium/drivers/radeonsi/si_shader.h
index de520a2..76e09b2 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -494,21 +494,22 @@ struct si_shader_key {
                union {
                        uint64_t        ff_tcs_inputs_to_copy; /* for 
fixed-func TCS */
                        /* When PS needs PrimID and GS is disabled. */
                        unsigned        vs_export_prim_id:1;
                } u;
        } mono;
 
        /* Optimization flags for asynchronous compilation only. */
        struct {
                /* For HW VS (it can be VS, TES, GS) */
-               uint64_t        kill_outputs; /* "get_unique_index" bits */
+               /* Don't use "uint64_t" in order to get 32-bit alignment. */
+               uint32_t        kill_outputs[2]; /* "get_unique_index" bits */
                unsigned        clip_disable:1;
 
                /* For shaders where monolithic variants have better code.
                 *
                 * This is a flag that has no effect on code generation,
                 * but forces monolithic shaders to be used as soon as
                 * possible, because it's in the "opt" group.
                 */
                unsigned        prefer_mono:1;
        } opt;
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 07e6a42..15e46b5 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1234,23 +1234,24 @@ static void si_shader_selector_key_hw_vs(struct 
si_context *sctx,
        uint64_t inputs_read = 0;
 
        /* ignore POSITION, PSIZE */
        outputs_written &= ~((1ull << 
si_shader_io_get_unique_index(TGSI_SEMANTIC_POSITION, 0) |
                             (1ull << 
si_shader_io_get_unique_index(TGSI_SEMANTIC_PSIZE, 0))));
 
        if (!ps_disabled) {
                inputs_read = ps->inputs_read;
        }
 
-       uint64_t linked = outputs_written & inputs_read;
+       uint64_t kill_outputs = ~(outputs_written & inputs_read) & 
outputs_written;
 
-       key->opt.kill_outputs = ~linked & outputs_written;
+       key->opt.kill_outputs[0] = kill_outputs;
+       key->opt.kill_outputs[1] = kill_outputs >> 32;
 }
 
 /* Compute the key for the hw shader variant */
 static inline void si_shader_selector_key(struct pipe_context *ctx,
                                          struct si_shader_selector *sel,
                                          struct si_shader_key *key)
 {
        struct si_context *sctx = (struct si_context *)ctx;
 
        memset(key, 0, sizeof(*key));
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to