diff options
author | Marek Olšák <[email protected]> | 2017-01-06 00:07:21 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-01-16 18:07:08 +0100 |
commit | 44e9b67229c91d6741e4284cff4ea23cc350ed18 (patch) | |
tree | c143f7ef2e4650c4b7983053778251feed38709f /src | |
parent | 8daf6de3deddef8f71f8b1af61b12cd8cb783433 (diff) |
radeonsi: make fix_fetch 64-bit
v2: add u_bit_consecutive64
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 2 | ||||
-rw-r--r-- | src/util/bitscan.h | 9 |
6 files changed, 18 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index d45c0e8649c..ddb6ca1ae17 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -433,7 +433,7 @@ static void declare_input_vs( input, llvm_chan, ""); } - fix_fetch = (ctx->shader->key.mono.vs.fix_fetch >> (2 * input_index)) & 3; + fix_fetch = (ctx->shader->key.mono.vs.fix_fetch >> (4 * input_index)) & 0xf; if (fix_fetch) { /* The hardware returns an unsigned value; convert it to a * signed one. @@ -6583,7 +6583,7 @@ static void si_dump_shader_key(unsigned shader, struct si_shader_key *key, fprintf(f, " part.vs.epilog.export_prim_id = %u\n", key->part.vs.epilog.export_prim_id); fprintf(f, " as_es = %u\n", key->as_es); fprintf(f, " as_ls = %u\n", key->as_ls); - fprintf(f, " mono.vs.fix_fetch = 0x%x\n", key->mono.vs.fix_fetch); + fprintf(f, " mono.vs.fix_fetch = 0x%"PRIx64"\n", key->mono.vs.fix_fetch); break; case PIPE_SHADER_TESS_CTRL: diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 1b5dec21e31..89f9628a1f6 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -425,8 +425,8 @@ struct si_shader_key { /* Flags for monolithic compilation only. */ union { struct { - /* One pair of bits for every input: SI_FIX_FETCH_* enums. */ - uint32_t fix_fetch; + /* One nibble for every input: SI_FIX_FETCH_* enums. */ + uint64_t fix_fetch; } vs; struct { uint64_t inputs_to_copy; /* for fixed-func TCS */ diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 6e7d8daceb0..fa78a56f73e 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3363,12 +3363,12 @@ static void *si_create_vertex_elements(struct pipe_context *ctx, */ if (data_format == V_008F0C_BUF_DATA_FORMAT_2_10_10_10) { if (num_format == V_008F0C_BUF_NUM_FORMAT_SNORM) { - v->fix_fetch |= SI_FIX_FETCH_A2_SNORM << (2 * i); + v->fix_fetch |= (uint64_t)SI_FIX_FETCH_A2_SNORM << (4 * i); } else if (num_format == V_008F0C_BUF_NUM_FORMAT_SSCALED) { - v->fix_fetch |= SI_FIX_FETCH_A2_SSCALED << (2 * i); + v->fix_fetch |= (uint64_t)SI_FIX_FETCH_A2_SSCALED << (4 * i); } else if (num_format == V_008F0C_BUF_NUM_FORMAT_SINT) { /* This isn't actually used in OpenGL. */ - v->fix_fetch |= SI_FIX_FETCH_A2_SINT << (2 * i); + v->fix_fetch |= (uint64_t)SI_FIX_FETCH_A2_SINT << (4 * i); } } diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index a17dbc73102..edc5b933781 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -99,12 +99,12 @@ struct si_stencil_ref { struct si_vertex_element { unsigned count; - uint32_t fix_fetch; /* Two bits per attribute indicating the size of each vector component * in bytes if the size 3-workaround must be applied. */ uint32_t fix_size3; + uint64_t fix_fetch; uint32_t rsrc_word3[SI_MAX_ATTRIBS]; uint32_t format_size[SI_MAX_ATTRIBS]; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 99678377c8d..d2f04bc8328 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -934,7 +934,7 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, key->mono.vs.fix_fetch = sctx->vertex_elements->fix_fetch & - u_bit_consecutive(0, 2 * count); + u_bit_consecutive64(0, 4 * count); } if (sctx->tes_shader.cso) key->as_ls = 1; diff --git a/src/util/bitscan.h b/src/util/bitscan.h index a5dfa1f9e3b..32e027165cc 100644 --- a/src/util/bitscan.h +++ b/src/util/bitscan.h @@ -226,6 +226,15 @@ u_bit_consecutive(unsigned start, unsigned count) return ((1u << count) - 1) << start; } +static inline uint64_t +u_bit_consecutive64(unsigned start, unsigned count) +{ + assert(start + count <= 64); + if (count == 64) + return ~(uint64_t)0; + return (((uint64_t)1 << count) - 1) << start; +} + #ifdef __cplusplus } |