Commit 947bc3a7 authored by Connor Abbott's avatar Connor Abbott

bifrost: More complete decoding of uniform/const field

parent b69a9129
......@@ -183,6 +183,44 @@ static uint64_t GetConst(uint64_t *consts, Regs srcs)
return imm | low_bits;
}
static void DumpUniformConstSrc(Regs srcs, uint64_t *consts, bool high32)
{
if (srcs.uniformConst & 0x80) {
unsigned uniform = (srcs.uniformConst & 0x7f) * 2;
printf("U%d", uniform + (high32 ? 1 : 0));
} else if (srcs.uniformConst >= 0x20) {
uint64_t imm = GetConst(consts, srcs);
if (high32)
DumpConstImm(imm >> 32);
else
DumpConstImm(imm);
} else {
switch (srcs.uniformConst) {
case 0: printf("0"); break;
case 5: printf("atest-data"); break;
case 6: printf("sample-ptr"); break;
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
printf("blend-descriptor%u", (unsigned) srcs.uniformConst - 8);
break;
default:
printf("unkConst%u", (unsigned) srcs.uniformConst);
break;
}
if (high32)
printf(".y");
else
printf(".x");
}
}
static void DumpSrc(unsigned src, Regs srcs, uint64_t *consts, bool isFMA)
{
switch (src) {
......@@ -195,53 +233,12 @@ static void DumpSrc(unsigned src, Regs srcs, uint64_t *consts, bool isFMA)
else
printf("T"); // i.e. the output of FMA this cycle
break;
case 4: {
if (srcs.uniformConst & 0x80) {
printf("U%d", (srcs.uniformConst & 0x7f) * 2);
} else {
unsigned low_bits = srcs.uniformConst & 0xf;
uint32_t imm;
bool valid = true;
switch (srcs.uniformConst >> 4) {
case 4: imm = ((uint32_t) consts[0]) | low_bits; break;
case 5: imm = ((uint32_t) consts[1]) | low_bits; break;
case 6: imm = ((uint32_t) consts[2]) | low_bits; break;
case 7: imm = ((uint32_t) consts[3]) | low_bits; break;
case 2: imm = ((uint32_t) consts[4]) | low_bits; break;
case 3: imm = ((uint32_t) consts[5]) | low_bits; break;
case 0: imm = 0; break;
default: valid = false; break;
}
if (valid)
DumpConstImm(imm);
else
printf("unkConstSrc");
}
case 4:
DumpUniformConstSrc(srcs, consts, false);
break;
}
case 5: {
if (srcs.uniformConst & 0x80) {
printf("U%d", (srcs.uniformConst & 0x7f) * 2 + 1);
} else {
uint32_t imm;
bool valid = true;
switch (srcs.uniformConst >> 4) {
case 4: imm = (uint32_t)(consts[0] >> 32); break;
case 5: imm = (uint32_t)(consts[1] >> 32); break;
case 6: imm = (uint32_t)(consts[2] >> 32); break;
case 7: imm = (uint32_t)(consts[3] >> 32); break;
case 2: imm = (uint32_t)(consts[4] >> 32); break;
case 3: imm = (uint32_t)(consts[5] >> 32); break;
case 0: imm = 0; break;
default: valid = false; break;
}
if (valid)
DumpConstImm(imm);
else
printf("unkConstSrc");
}
case 5:
DumpUniformConstSrc(srcs, consts, true);
break;
}
case 6: printf("T0"); break;
case 7: printf("T1"); break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment