...
 
Commits (3)
......@@ -762,23 +762,40 @@ static void print_mask(uint32_t mask)
static void print_varying_parameters(midgard_load_store_word* word)
{
if (word->is_varying) {
midgard_varying_parameter param;
unsigned v = word->varying_parameters;
memcpy(&param, &v, sizeof(param));
if (param.is_varying) {
/* If a varying, there are qualifiers */
if (word->flat)
if (param.flat)
printf(".flat");
if (word->interpolation != midgard_interp_default) {
if (word->interpolation == midgard_interp_centroid)
if (param.interpolation != midgard_interp_default) {
if (param.interpolation == midgard_interp_centroid)
printf(".centroid");
else
printf(".interp%d", word->interpolation);
printf(".interp%d", param.interpolation);
}
} else if (word->flat || word->interpolation) {
} else if (param.flat || param.interpolation) {
printf(" /* is_varying not set but varying metadata attached */");
}
if (word->unknown0_1 || word->unknown0_2)
printf(" /* zero tripped, %d %d */ ", word->unknown0_1, word->unknown0_2);
if (param.zero1 || param.zero2)
printf(" /* zero tripped, %d %d */ ", param.zero1, param.zero2);
}
static bool is_op_varying(unsigned op)
{
switch (op) {
case midgard_op_store_vary_16:
case midgard_op_store_vary_32:
case midgard_op_load_vary_16:
case midgard_op_load_vary_32:
return true;
}
return false;
}
static void print_load_store_instr(uint64_t data,
......@@ -788,12 +805,27 @@ static void print_load_store_instr(uint64_t data,
ogt_asm_print_tabs(tabs);
print_ld_st_opcode(word->op);
print_varying_parameters(word);
if (is_op_varying(word->op))
print_varying_parameters(word);
printf(" r%d", word->reg);
print_mask(word->mask);
int address = word->address;
if (word->op == midgard_op_load_uniform_32) {
/* Uniforms use their own addressing scheme */
int lo = word->varying_parameters >> 7;
int hi = word->address;
/* TODO: Combine fields logically */
address = (hi << 3) | lo;
}
printf(", %d", address);
printf(", %d", word->address);
print_swizzle(word->swizzle);
printf(", 0x%X\n", word->unknown);
......@@ -948,6 +980,8 @@ static void print_texture_word(uint32_t* word, unsigned tabs)
* largely unknown still. */
if (texture->offset_unknown1 ||
texture->offset_reg_select ||
texture->offset_reg_upper ||
texture->offset_unknown4 ||
texture->offset_unknown5 ||
texture->offset_unknown6 ||
......@@ -955,6 +989,8 @@ static void print_texture_word(uint32_t* word, unsigned tabs)
texture->offset_unknown8 ||
texture->offset_unknown9) {
printf("// offset_unknown1 = 0x%x\n", texture->offset_unknown1);
printf("// offset_reg_select = 0x%x\n", texture->offset_reg_select);
printf("// offset_reg_upper = 0x%x\n", texture->offset_reg_upper);
printf("// offset_unknown4 = 0x%x\n", texture->offset_unknown4);
printf("// offset_unknown5 = 0x%x\n", texture->offset_unknown5);
printf("// offset_unknown6 = 0x%x\n", texture->offset_unknown6);
......
......@@ -249,20 +249,26 @@ typedef enum
typedef struct
__attribute__((__packed__))
{
midgard_load_store_op op : 8;
unsigned reg : 5;
unsigned mask : 4;
unsigned swizzle : 8;
unsigned unknown : 16;
unsigned unknown0_1 : 4; /* Always zero */
unsigned zero1 : 4; /* Always zero */
/* Varying qualifiers, zero if not a varying */
unsigned flat : 1;
unsigned is_varying : 1; /* Always one for varying, but maybe something else? */
midgard_interpolation interpolation : 2;
unsigned unknown0_2 : 2; /* Always zero */
unsigned zero2 : 2; /* Always zero */
} midgard_varying_parameter;
typedef struct
__attribute__((__packed__))
{
midgard_load_store_op op : 8;
unsigned reg : 5;
unsigned mask : 4;
unsigned swizzle : 8;
unsigned unknown : 16;
unsigned varying_parameters : 10;
unsigned address : 9;
} midgard_load_store_word;
......