diff options
| author | 2014-08-14 23:23:55 +0200 | |
|---|---|---|
| committer | 2014-08-25 22:03:18 +0200 | |
| commit | 0465adf206255fc114130cc7fcca1e295bcffca2 (patch) | |
| tree | 08b96652a1295987b32bdabe87da13015c7938e0 /src | |
| parent | Pica: Add debug utilities for dumping shaders. (diff) | |
| download | yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.gz yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.xz yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.zip | |
Pica/CommandProcessor: Implement parameter masking.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/command_processor.cpp | 18 | ||||
| -rw-r--r-- | src/video_core/command_processor.h | 13 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 2027e58d9..f7a412bc1 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -24,9 +24,14 @@ static u32 uniform_write_buffer[4]; | |||
| 24 | static u32 vs_binary_write_offset = 0; | 24 | static u32 vs_binary_write_offset = 0; |
| 25 | static u32 vs_swizzle_write_offset = 0; | 25 | static u32 vs_swizzle_write_offset = 0; |
| 26 | 26 | ||
| 27 | static inline void WritePicaReg(u32 id, u32 value) { | 27 | static inline void WritePicaReg(u32 id, u32 value, u32 mask) { |
| 28 | |||
| 29 | if (id >= registers.NumIds()) | ||
| 30 | return; | ||
| 31 | |||
| 32 | // TODO: Figure out how register masking acts on e.g. vs_uniform_setup.set_value | ||
| 28 | u32 old_value = registers[id]; | 33 | u32 old_value = registers[id]; |
| 29 | registers[id] = value; | 34 | registers[id] = (old_value & ~mask) | (value & mask); |
| 30 | 35 | ||
| 31 | switch(id) { | 36 | switch(id) { |
| 32 | // It seems like these trigger vertex rendering | 37 | // It seems like these trigger vertex rendering |
| @@ -215,14 +220,17 @@ static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) { | |||
| 215 | 220 | ||
| 216 | u32* read_pointer = (u32*)first_command_word; | 221 | u32* read_pointer = (u32*)first_command_word; |
| 217 | 222 | ||
| 218 | // TODO: Take parameter mask into consideration! | 223 | const u32 write_mask = ((header.parameter_mask & 0x1) ? (0xFFu << 0) : 0u) | |
| 224 | ((header.parameter_mask & 0x2) ? (0xFFu << 8) : 0u) | | ||
| 225 | ((header.parameter_mask & 0x4) ? (0xFFu << 16) : 0u) | | ||
| 226 | ((header.parameter_mask & 0x8) ? (0xFFu << 24) : 0u); | ||
| 219 | 227 | ||
| 220 | WritePicaReg(header.cmd_id, *read_pointer); | 228 | WritePicaReg(header.cmd_id, *read_pointer, write_mask); |
| 221 | read_pointer += 2; | 229 | read_pointer += 2; |
| 222 | 230 | ||
| 223 | for (int i = 1; i < 1+header.extra_data_length; ++i) { | 231 | for (int i = 1; i < 1+header.extra_data_length; ++i) { |
| 224 | u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0); | 232 | u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0); |
| 225 | WritePicaReg(cmd, *read_pointer); | 233 | WritePicaReg(cmd, *read_pointer, write_mask); |
| 226 | ++read_pointer; | 234 | ++read_pointer; |
| 227 | } | 235 | } |
| 228 | 236 | ||
diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h index 6b6241a25..955f9daec 100644 --- a/src/video_core/command_processor.h +++ b/src/video_core/command_processor.h | |||
| @@ -17,11 +17,22 @@ union CommandHeader { | |||
| 17 | u32 hex; | 17 | u32 hex; |
| 18 | 18 | ||
| 19 | BitField< 0, 16, u32> cmd_id; | 19 | BitField< 0, 16, u32> cmd_id; |
| 20 | |||
| 21 | // parameter_mask: | ||
| 22 | // Mask applied to the input value to make it possible to update | ||
| 23 | // parts of a register without overwriting its other fields. | ||
| 24 | // first bit: 0x000000FF | ||
| 25 | // second bit: 0x0000FF00 | ||
| 26 | // third bit: 0x00FF0000 | ||
| 27 | // fourth bit: 0xFF000000 | ||
| 20 | BitField<16, 4, u32> parameter_mask; | 28 | BitField<16, 4, u32> parameter_mask; |
| 29 | |||
| 21 | BitField<20, 11, u32> extra_data_length; | 30 | BitField<20, 11, u32> extra_data_length; |
| 31 | |||
| 22 | BitField<31, 1, u32> group_commands; | 32 | BitField<31, 1, u32> group_commands; |
| 23 | }; | 33 | }; |
| 24 | static_assert(std::is_standard_layout<CommandHeader>::value == true, "CommandHeader does not use standard layout"); | 34 | static_assert(std::is_standard_layout<CommandHeader>::value == true, |
| 35 | "CommandHeader does not use standard layout"); | ||
| 25 | static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); | 36 | static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!"); |
| 26 | 37 | ||
| 27 | void ProcessCommandList(const u32* list, u32 size); | 38 | void ProcessCommandList(const u32* list, u32 size); |