LOAD_ALU_CONSTANT also taking a target type.

This commit is contained in:
Ben Vanik 2015-03-15 02:05:26 -07:00
parent 64c8d7ab98
commit 86faacdb87
1 changed files with 29 additions and 25 deletions

View File

@ -1297,43 +1297,27 @@ bool CommandProcessor::ExecutePacketType3_SET_CONSTANT(RingbufferReader* reader,
switch (type) { switch (type) {
case 0: // ALU case 0: // ALU
index += 0x4000; index += 0x4000;
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
}
break; break;
case 1: // FETCH case 1: // FETCH
index += 0x4800; index += 0x4800;
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
}
break; break;
case 2: // BOOL case 2: // BOOL
index += 0x4900; index += 0x4900;
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
}
break; break;
case 3: // LOOP case 3: // LOOP
index += 0x4908; index += 0x4908;
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
}
break; break;
case 4: // REGISTER case 4: // REGISTERS
index += 0x2000; // registers index += 0x2000;
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
}
break; break;
default: default:
assert_always(); assert_always();
reader->Skip(count - 1); reader->Skip(count - 1);
break; return true;
}
for (uint32_t n = 0; n < count - 1; n++, index++) {
uint32_t data = reader->Read();
WriteRegister(index, data);
} }
return true; return true;
} }
@ -1347,8 +1331,28 @@ bool CommandProcessor::ExecutePacketType3_LOAD_ALU_CONSTANT(
uint32_t index = offset_type & 0x7FF; uint32_t index = offset_type & 0x7FF;
uint32_t size = reader->Read(); uint32_t size = reader->Read();
size &= 0xFFF; size &= 0xFFF;
index += 0x4000; // alu constants uint32_t type = (offset_type >> 16) & 0xFF;
trace_writer_.WriteMemoryRead(address, size * 4); switch (type) {
case 0: // ALU
index += 0x4000;
break;
case 1: // FETCH
index += 0x4800;
break;
case 2: // BOOL
index += 0x4900;
break;
case 3: // LOOP
index += 0x4908;
break;
case 4: // REGISTERS
index += 0x2000;
break;
default:
assert_always();
return true;
}
trace_writer_.WriteMemoryRead(address, size);
for (uint32_t n = 0; n < size; n++, index++) { for (uint32_t n = 0; n < size; n++, index++) {
uint32_t data = uint32_t data =
poly::load_and_swap<uint32_t>(membase_ + GpuToCpu(address + n * 4)); poly::load_and_swap<uint32_t>(membase_ + GpuToCpu(address + n * 4));