summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wasserka <NeoBrainX@gmail.com>2014-08-14 23:23:55 +0200
committerTony Wasserka <NeoBrainX@gmail.com>2014-08-25 22:03:18 +0200
commit0465adf206255fc114130cc7fcca1e295bcffca2 (patch)
tree08b96652a1295987b32bdabe87da13015c7938e0
parentPica: Add debug utilities for dumping shaders. (diff)
downloadyuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.gz
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.bz2
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.lz
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.xz
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.tar.zst
yuzu-0465adf206255fc114130cc7fcca1e295bcffca2.zip
-rw-r--r--src/video_core/command_processor.cpp18
-rw-r--r--src/video_core/command_processor.h13
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];
static u32 vs_binary_write_offset = 0;
static u32 vs_swizzle_write_offset = 0;
-static inline void WritePicaReg(u32 id, u32 value) {
+static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
+
+ if (id >= registers.NumIds())
+ return;
+
+ // TODO: Figure out how register masking acts on e.g. vs_uniform_setup.set_value
u32 old_value = registers[id];
- registers[id] = value;
+ registers[id] = (old_value & ~mask) | (value & mask);
switch(id) {
// It seems like these trigger vertex rendering
@@ -215,14 +220,17 @@ static std::ptrdiff_t ExecuteCommandBlock(const u32* first_command_word) {
u32* read_pointer = (u32*)first_command_word;
- // TODO: Take parameter mask into consideration!
+ const u32 write_mask = ((header.parameter_mask & 0x1) ? (0xFFu << 0) : 0u) |
+ ((header.parameter_mask & 0x2) ? (0xFFu << 8) : 0u) |
+ ((header.parameter_mask & 0x4) ? (0xFFu << 16) : 0u) |
+ ((header.parameter_mask & 0x8) ? (0xFFu << 24) : 0u);
- WritePicaReg(header.cmd_id, *read_pointer);
+ WritePicaReg(header.cmd_id, *read_pointer, write_mask);
read_pointer += 2;
for (int i = 1; i < 1+header.extra_data_length; ++i) {
u32 cmd = header.cmd_id + ((header.group_commands) ? i : 0);
- WritePicaReg(cmd, *read_pointer);
+ WritePicaReg(cmd, *read_pointer, write_mask);
++read_pointer;
}
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 {
u32 hex;
BitField< 0, 16, u32> cmd_id;
+
+ // parameter_mask:
+ // Mask applied to the input value to make it possible to update
+ // parts of a register without overwriting its other fields.
+ // first bit: 0x000000FF
+ // second bit: 0x0000FF00
+ // third bit: 0x00FF0000
+ // fourth bit: 0xFF000000
BitField<16, 4, u32> parameter_mask;
+
BitField<20, 11, u32> extra_data_length;
+
BitField<31, 1, u32> group_commands;
};
-static_assert(std::is_standard_layout<CommandHeader>::value == true, "CommandHeader does not use standard layout");
+static_assert(std::is_standard_layout<CommandHeader>::value == true,
+ "CommandHeader does not use standard layout");
static_assert(sizeof(CommandHeader) == sizeof(u32), "CommandHeader has incorrect size!");
void ProcessCommandList(const u32* list, u32 size);