pan/midgard: Treat cubemaps "stores" as loads

It's always been ambiguous which they are, but their primary register is
their output, not their input; therefore, they are loads.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-08-16 07:50:12 -07:00
parent 20dd482668
commit 9ae4d3653e
5 changed files with 15 additions and 19 deletions

View file

@ -47,8 +47,7 @@
)
#define OP_IS_STORE(op) (\
OP_IS_STORE_R26(op) || \
op == midgard_op_st_cubemap_coords \
OP_IS_STORE_R26(op) \
)
#define OP_IS_PROJECTION(op) ( \
@ -58,7 +57,7 @@
#define OP_IS_VEC4_ONLY(op) ( \
OP_IS_PROJECTION(op) || \
op == midgard_op_st_cubemap_coords \
op == midgard_op_ld_cubemap_coords \
)
#define OP_IS_MOVE(op) ( \

View file

@ -391,12 +391,11 @@ midgard_writeout;
typedef enum {
midgard_op_ld_st_noop = 0x03,
/* Unclear why this is on the L/S unit, but (with an address of 0,
* appropriate swizzle, magic constant 0x24, and xy mask?) moves fp32 cube
* map coordinates in r27 to its cube map texture coordinate
* destination (e.g r29). 0x4 magic for lding from fp16 instead */
/* Unclear why this is on the L/S unit, but moves fp32 cube map
* coordinates in r27 to its cube map texture coordinate destination
* (e.g r29). */
midgard_op_st_cubemap_coords = 0x0E,
midgard_op_ld_cubemap_coords = 0x0E,
/* Loads a global/local/group ID, depending on arguments */
midgard_op_ld_compute_id = 0x10,

View file

@ -190,7 +190,7 @@ M_STORE(st_int4);
M_LOAD(ld_color_buffer_8);
//M_STORE(st_vary_16);
M_STORE(st_vary_32);
M_LOAD(st_cubemap_coords);
M_LOAD(ld_cubemap_coords);
M_LOAD(ld_compute_id);
static midgard_instruction
@ -1792,12 +1792,12 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
* texture register */
unsigned temp = make_compiler_temp(ctx);
midgard_instruction st = m_st_cubemap_coords(temp, 0);
st.ssa_args.src[0] = index;
st.mask = 0x3; /* xy */
st.load_store.arg_1 = 0x20;
st.load_store.swizzle = alu_src.swizzle;
emit_mir_instruction(ctx, st);
midgard_instruction ld = m_ld_cubemap_coords(temp, 0);
ld.ssa_args.src[0] = index;
ld.mask = 0x3; /* xy */
ld.load_store.arg_1 = 0x20;
ld.load_store.swizzle = alu_src.swizzle;
emit_mir_instruction(ctx, ld);
ins.ssa_args.src[0] = temp;
ins.texture.in_reg_swizzle = SWIZZLE_XYXX;

View file

@ -170,7 +170,7 @@ struct mir_op_props alu_opcode_props[256] = {
};
const char *load_store_opcode_names[256] = {
[midgard_op_st_cubemap_coords] = "st_cubemap_coords",
[midgard_op_ld_cubemap_coords] = "ld_cubemap_coords",
[midgard_op_ld_compute_id] = "ld_compute_id",
[midgard_op_ldst_perspective_division_z] = "ldst_perspective_division_z",
[midgard_op_ldst_perspective_division_w] = "ldst_perspective_division_w",

View file

@ -752,9 +752,7 @@ install_registers_instr(
* whether we are loading or storing -- think about the
* logical dataflow */
bool encodes_src =
OP_IS_STORE(ins->load_store.op) &&
ins->load_store.op != midgard_op_st_cubemap_coords;
bool encodes_src = OP_IS_STORE(ins->load_store.op);
if (encodes_src) {
struct phys_reg src = index_to_reg(ctx, g, args.src[0]);