aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-25 07:09:40 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-26 08:37:08 -0700
commitbe56840d5ac3351eb8a650759c62bee6ee5cc1e9 (patch)
tree8da88e5894c9a9af434100f87bba83491916df60
parentd2de5b6ba2576bf87be805bf265e5aee1347e014 (diff)
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 <[email protected]>
-rw-r--r--src/panfrost/midgard/helpers.h3
-rw-r--r--src/panfrost/midgard/midgard_compile.c13
-rw-r--r--src/panfrost/midgard/midgard_ra.c2
3 files changed, 8 insertions, 10 deletions
diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h
index 76bda286f7e..92545cfc787 100644
--- a/src/panfrost/midgard/helpers.h
+++ b/src/panfrost/midgard/helpers.h
@@ -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) ( \
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 6f50e345baa..71625e8fd55 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -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;
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index 485ab789cd4..cca167c0ba7 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -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);