radeonsi: make fix_fetch 64-bit

v2: add u_bit_consecutive64

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák 2017-01-06 00:07:21 +01:00
parent 8daf6de3de
commit 44e9b67229
6 changed files with 18 additions and 9 deletions

View file

@ -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:

View file

@ -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 */

View file

@ -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);
}
}

View file

@ -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];

View file

@ -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;

View file

@ -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
}