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 <robdclark@chromium.org>
This commit is contained in:
Hyunjun Ko 2019-02-26 08:33:34 +00:00 committed by Rob Clark
parent 689c3c7d40
commit 6fb8ef3da6
2 changed files with 14 additions and 7 deletions

View File

@ -1061,20 +1061,26 @@ 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)

View File

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