diff options
| author | 2015-07-25 22:00:40 +0200 | |
|---|---|---|
| committer | 2015-07-26 16:23:12 +0200 | |
| commit | e663751f8b6cc6fd469d3974b3e68e434ebee9db (patch) | |
| tree | c48b19af6f1e95671839cf4b6153c5e155b3494c /src/video_core | |
| parent | citra-qt/command list: monospace font on windows (diff) | |
| download | yuzu-e663751f8b6cc6fd469d3974b3e68e434ebee9db.tar.gz yuzu-e663751f8b6cc6fd469d3974b3e68e434ebee9db.tar.xz yuzu-e663751f8b6cc6fd469d3974b3e68e434ebee9db.zip | |
citra-qt/command list: Add mask column
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/command_processor.cpp | 31 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 14 |
3 files changed, 24 insertions, 25 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 43ae06181..deed24412 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -35,7 +35,15 @@ static u32 default_attr_write_buffer[3]; | |||
| 35 | 35 | ||
| 36 | Common::Profiling::TimingCategory category_drawing("Drawing"); | 36 | Common::Profiling::TimingCategory category_drawing("Drawing"); |
| 37 | 37 | ||
| 38 | static inline void WritePicaReg(u32 id, u32 value, u32 mask) { | 38 | // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF |
| 39 | static const u32 expand_bits_to_bytes[] = { | ||
| 40 | 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, | ||
| 41 | 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, | ||
| 42 | 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, | ||
| 43 | 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff | ||
| 44 | }; | ||
| 45 | |||
| 46 | static void WritePicaReg(u32 id, u32 value, u32 mask) { | ||
| 39 | auto& regs = g_state.regs; | 47 | auto& regs = g_state.regs; |
| 40 | 48 | ||
| 41 | if (id >= regs.NumIds()) | 49 | if (id >= regs.NumIds()) |
| @@ -47,13 +55,16 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 47 | 55 | ||
| 48 | // TODO: Figure out how register masking acts on e.g. vs.uniform_setup.set_value | 56 | // TODO: Figure out how register masking acts on e.g. vs.uniform_setup.set_value |
| 49 | u32 old_value = regs[id]; | 57 | u32 old_value = regs[id]; |
| 50 | regs[id] = (old_value & ~mask) | (value & mask); | 58 | |
| 59 | const u32 write_mask = expand_bits_to_bytes[mask]; | ||
| 60 | |||
| 61 | regs[id] = (old_value & ~write_mask) | (value & write_mask); | ||
| 62 | |||
| 63 | DebugUtils::OnPicaRegWrite({ (u16)id, (u16)mask, regs[id] }); | ||
| 51 | 64 | ||
| 52 | if (g_debug_context) | 65 | if (g_debug_context) |
| 53 | g_debug_context->OnEvent(DebugContext::Event::PicaCommandLoaded, reinterpret_cast<void*>(&id)); | 66 | g_debug_context->OnEvent(DebugContext::Event::PicaCommandLoaded, reinterpret_cast<void*>(&id)); |
| 54 | 67 | ||
| 55 | DebugUtils::OnPicaRegWrite(id, regs[id]); | ||
| 56 | |||
| 57 | switch(id) { | 68 | switch(id) { |
| 58 | // Trigger IRQ | 69 | // Trigger IRQ |
| 59 | case PICA_REG_INDEX(trigger_irq): | 70 | case PICA_REG_INDEX(trigger_irq): |
| @@ -436,13 +447,6 @@ void ProcessCommandList(const u32* list, u32 size) { | |||
| 436 | g_state.cmd_list.length = size / sizeof(u32); | 447 | g_state.cmd_list.length = size / sizeof(u32); |
| 437 | 448 | ||
| 438 | while (g_state.cmd_list.current_ptr < g_state.cmd_list.head_ptr + g_state.cmd_list.length) { | 449 | while (g_state.cmd_list.current_ptr < g_state.cmd_list.head_ptr + g_state.cmd_list.length) { |
| 439 | // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF | ||
| 440 | static const u32 expand_bits_to_bytes[] = { | ||
| 441 | 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, | ||
| 442 | 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, | ||
| 443 | 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, | ||
| 444 | 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff | ||
| 445 | }; | ||
| 446 | 450 | ||
| 447 | // Align read pointer to 8 bytes | 451 | // Align read pointer to 8 bytes |
| 448 | if ((g_state.cmd_list.head_ptr - g_state.cmd_list.current_ptr) % 2 != 0) | 452 | if ((g_state.cmd_list.head_ptr - g_state.cmd_list.current_ptr) % 2 != 0) |
| @@ -450,14 +454,13 @@ void ProcessCommandList(const u32* list, u32 size) { | |||
| 450 | 454 | ||
| 451 | u32 value = *g_state.cmd_list.current_ptr++; | 455 | u32 value = *g_state.cmd_list.current_ptr++; |
| 452 | const CommandHeader header = { *g_state.cmd_list.current_ptr++ }; | 456 | const CommandHeader header = { *g_state.cmd_list.current_ptr++ }; |
| 453 | const u32 write_mask = expand_bits_to_bytes[header.parameter_mask]; | ||
| 454 | u32 cmd = header.cmd_id; | 457 | u32 cmd = header.cmd_id; |
| 455 | 458 | ||
| 456 | WritePicaReg(cmd, value, write_mask); | 459 | WritePicaReg(cmd, value, header.parameter_mask); |
| 457 | 460 | ||
| 458 | for (unsigned i = 0; i < header.extra_data_length; ++i) { | 461 | for (unsigned i = 0; i < header.extra_data_length; ++i) { |
| 459 | u32 cmd = header.cmd_id + (header.group_commands ? i + 1 : 0); | 462 | u32 cmd = header.cmd_id + (header.group_commands ? i + 1 : 0); |
| 460 | WritePicaReg(cmd, *g_state.cmd_list.current_ptr++, write_mask); | 463 | WritePicaReg(cmd, *g_state.cmd_list.current_ptr++, header.parameter_mask); |
| 461 | } | 464 | } |
| 462 | } | 465 | } |
| 463 | } | 466 | } |
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index c3f8321c6..827b09dff 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -280,7 +280,7 @@ bool IsPicaTracing() | |||
| 280 | return is_pica_tracing != 0; | 280 | return is_pica_tracing != 0; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | void OnPicaRegWrite(u32 id, u32 value) | 283 | void OnPicaRegWrite(PicaTrace::Write write) |
| 284 | { | 284 | { |
| 285 | // Double check for is_pica_tracing to avoid pointless locking overhead | 285 | // Double check for is_pica_tracing to avoid pointless locking overhead |
| 286 | if (!is_pica_tracing) | 286 | if (!is_pica_tracing) |
| @@ -291,7 +291,7 @@ void OnPicaRegWrite(u32 id, u32 value) | |||
| 291 | if (!is_pica_tracing) | 291 | if (!is_pica_tracing) |
| 292 | return; | 292 | return; |
| 293 | 293 | ||
| 294 | pica_trace->writes.emplace_back(id, value); | 294 | pica_trace->writes.push_back(write); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | std::unique_ptr<PicaTrace> FinishPicaTracing() | 297 | std::unique_ptr<PicaTrace> FinishPicaTracing() |
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 3f109dcb7..acb75a4b2 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -183,21 +183,17 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data | |||
| 183 | 183 | ||
| 184 | // Utility class to log Pica commands. | 184 | // Utility class to log Pica commands. |
| 185 | struct PicaTrace { | 185 | struct PicaTrace { |
| 186 | struct Write : public std::pair<u32,u32> { | 186 | struct Write { |
| 187 | Write(u32 id, u32 value) : std::pair<u32,u32>(id, value) {} | 187 | u16 cmd_id; |
| 188 | 188 | u16 mask; | |
| 189 | u32& Id() { return first; } | 189 | u32 value; |
| 190 | const u32& Id() const { return first; } | ||
| 191 | |||
| 192 | u32& Value() { return second; } | ||
| 193 | const u32& Value() const { return second; } | ||
| 194 | }; | 190 | }; |
| 195 | std::vector<Write> writes; | 191 | std::vector<Write> writes; |
| 196 | }; | 192 | }; |
| 197 | 193 | ||
| 198 | void StartPicaTracing(); | 194 | void StartPicaTracing(); |
| 199 | bool IsPicaTracing(); | 195 | bool IsPicaTracing(); |
| 200 | void OnPicaRegWrite(u32 id, u32 value); | 196 | void OnPicaRegWrite(PicaTrace::Write write); |
| 201 | std::unique_ptr<PicaTrace> FinishPicaTracing(); | 197 | std::unique_ptr<PicaTrace> FinishPicaTracing(); |
| 202 | 198 | ||
| 203 | struct TextureInfo { | 199 | struct TextureInfo { |