diff options
author | Hyunjun Ko <[email protected]> | 2019-02-26 08:33:34 +0000 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-06-03 12:44:03 -0700 |
commit | 6fb8ef3da6cfaad2040f694f8cfde4f7c9ad6a38 (patch) | |
tree | 6f853a4d5548ab01b5a51a4be2237de39b789a27 /src/freedreno | |
parent | 689c3c7d40ddee6a7c48a3885b241871d6302fe7 (diff) |
freedreno/ir3: set proper dst type for uniform according to the type of nir dest.
eg. uniform mediump vec4 f;
This patch means nothing since there's no mediump lowering pass for now,
but will be meaningful when the pass land in the near future.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/ir3/ir3.h | 18 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_compiler_nir.c | 3 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index ccd102b8e44..161e78e0feb 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -1061,21 +1061,27 @@ create_immed(struct ir3_block *block, uint32_t val) } static inline struct ir3_instruction * -create_uniform(struct ir3_block *block, unsigned n) +create_uniform_typed(struct ir3_block *block, unsigned n, type_t type) { struct ir3_instruction *mov; + unsigned flags = (type_size(type) < 32) ? IR3_REG_HALF : 0; mov = ir3_instr_create(block, OPC_MOV); - /* TODO get types right? */ - mov->cat1.src_type = TYPE_F32; - mov->cat1.dst_type = TYPE_F32; - ir3_reg_create(mov, 0, 0); - ir3_reg_create(mov, n, IR3_REG_CONST); + mov->cat1.src_type = type; + mov->cat1.dst_type = type; + ir3_reg_create(mov, 0, flags); + ir3_reg_create(mov, n, IR3_REG_CONST | flags); return mov; } static inline struct ir3_instruction * +create_uniform(struct ir3_block *block, unsigned n) +{ + return create_uniform_typed(block, n, TYPE_F32); +} + +static inline struct ir3_instruction * create_uniform_indirect(struct ir3_block *block, int n, struct ir3_instruction *address) { diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 0a97c42159f..8fbb45c489c 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -1250,7 +1250,8 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr) if (nir_src_is_const(intr->src[0])) { idx += nir_src_as_uint(intr->src[0]); for (int i = 0; i < intr->num_components; i++) { - dst[i] = create_uniform(b, idx + i); + dst[i] = create_uniform_typed(b, idx + i, + nir_dest_bit_size(intr->dest) < 32 ? TYPE_F16 : TYPE_F32); } } else { src = ir3_get_src(ctx, &intr->src[0]); |