pan/midgard: Update RA for cubemap coords

Following the RA work, we apply the same technique to eliminate the move
to r27 when loading cubemaps.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-25 07:09:40 -07:00
parent d2de5b6ba2
commit be56840d5a
3 changed files with 8 additions and 10 deletions

View File

@ -57,7 +57,8 @@
)
#define OP_IS_R27_ONLY(op) ( \
OP_IS_PROJECTION(op) \
OP_IS_PROJECTION(op) || \
op == midgard_op_st_cubemap_coords \
)
#define OP_IS_MOVE(op) ( \

View File

@ -173,7 +173,7 @@ M_LOAD(ld_uniform_32);
M_LOAD(ld_color_buffer_8);
//M_STORE(st_vary_16);
M_STORE(st_vary_32);
M_STORE(st_cubemap_coords);
M_LOAD(st_cubemap_coords);
static midgard_instruction
v_alu_br_compact_cond(midgard_jmp_writeout_op op, unsigned tag, signed offset, unsigned cond)
@ -1578,17 +1578,12 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
/* texelFetch is undefined on samplerCube */
assert(midgard_texop != TEXTURE_OP_TEXEL_FETCH);
/* For cubemaps, we need to load coords into
* special r27, and then use a special ld/st op
* to select the face and copy the xy into the
/* For cubemaps, we use a special ld/st op to
* select the face and copy the xy into the
* texture register */
alu_src.swizzle = SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_Z, COMPONENT_X);
midgard_instruction move = v_mov(index, alu_src, SSA_FIXED_REGISTER(27));
emit_mir_instruction(ctx, move);
midgard_instruction st = m_st_cubemap_coords(reg, 0);
st.ssa_args.src0 = index;
st.load_store.unknown = 0x24; /* XXX: What is this? */
st.mask = 0x3; /* xy */
st.load_store.swizzle = alu_src.swizzle;

View File

@ -704,6 +704,8 @@ install_registers_instr(
if (OP_IS_STORE_R26(ins->load_store.op) && fixed) {
ins->load_store.reg = SSA_REG_FROM_FIXED(args.src0);
} else if (ins->load_store.op == midgard_op_st_cubemap_coords) {
ins->load_store.reg = SSA_REG_FROM_FIXED(args.dest);
} else if (OP_IS_STORE_VARY(ins->load_store.op)) {
struct phys_reg src = index_to_reg(ctx, g, args.src0);
assert(src.reg == 26 || src.reg == 27);