summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2015-01-02 20:59:23 +0100
committerGravatar Tony Wasserka2015-02-18 14:02:59 +0100
commit6c26ec72a5b299a5ceb3e4ca7ed0712d312da548 (patch)
treee31646f1707ff0369ec8b8053093348d476e8e2a /src
parentPica/CommandProcessor: Work around initialized vertex attributes some more. (diff)
downloadyuzu-6c26ec72a5b299a5ceb3e4ca7ed0712d312da548.tar.gz
yuzu-6c26ec72a5b299a5ceb3e4ca7ed0712d312da548.tar.xz
yuzu-6c26ec72a5b299a5ceb3e4ca7ed0712d312da548.zip
Pica/CommandProcessor: Properly implement shader load destination offset registers.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/command_processor.cpp22
-rw-r--r--src/video_core/pica.h8
2 files changed, 10 insertions, 20 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index b2cc0f027..586ad62b6 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -25,10 +25,6 @@ static int float_regs_counter = 0;
25 25
26static u32 uniform_write_buffer[4]; 26static u32 uniform_write_buffer[4];
27 27
28// Used for VSLoadProgramData and VSLoadSwizzleData
29static u32 vs_binary_write_offset = 0;
30static u32 vs_swizzle_write_offset = 0;
31
32static inline void WritePicaReg(u32 id, u32 value, u32 mask) { 28static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
33 29
34 if (id >= registers.NumIds()) 30 if (id >= registers.NumIds())
@@ -258,11 +254,6 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
258 break; 254 break;
259 } 255 }
260 256
261 // Seems to be used to reset the write pointer for VSLoadProgramData
262 case PICA_REG_INDEX(vs_program.begin_load):
263 vs_binary_write_offset = 0;
264 break;
265
266 // Load shader program code 257 // Load shader program code
267 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[0], 0x2cc): 258 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[0], 0x2cc):
268 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[1], 0x2cd): 259 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[1], 0x2cd):
@@ -273,16 +264,11 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
273 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[6], 0x2d2): 264 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[6], 0x2d2):
274 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[7], 0x2d3): 265 case PICA_REG_INDEX_WORKAROUND(vs_program.set_word[7], 0x2d3):
275 { 266 {
276 VertexShader::SubmitShaderMemoryChange(vs_binary_write_offset, value); 267 VertexShader::SubmitShaderMemoryChange(registers.vs_program.offset, value);
277 vs_binary_write_offset++; 268 registers.vs_program.offset++;
278 break; 269 break;
279 } 270 }
280 271
281 // Seems to be used to reset the write pointer for VSLoadSwizzleData
282 case PICA_REG_INDEX(vs_swizzle_patterns.begin_load):
283 vs_swizzle_write_offset = 0;
284 break;
285
286 // Load swizzle pattern data 272 // Load swizzle pattern data
287 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[0], 0x2d6): 273 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[0], 0x2d6):
288 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[1], 0x2d7): 274 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[1], 0x2d7):
@@ -293,8 +279,8 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
293 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[6], 0x2dc): 279 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[6], 0x2dc):
294 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[7], 0x2dd): 280 case PICA_REG_INDEX_WORKAROUND(vs_swizzle_patterns.set_word[7], 0x2dd):
295 { 281 {
296 VertexShader::SubmitSwizzleDataChange(vs_swizzle_write_offset, value); 282 VertexShader::SubmitSwizzleDataChange(registers.vs_swizzle_patterns.offset, value);
297 vs_swizzle_write_offset++; 283 registers.vs_swizzle_patterns.offset++;
298 break; 284 break;
299 } 285 }
300 286
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 9c1a12dc8..cf9dc4853 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -678,7 +678,9 @@ struct Regs {
678 INSERT_PADDING_WORDS(0x2); 678 INSERT_PADDING_WORDS(0x2);
679 679
680 struct { 680 struct {
681 u32 begin_load; 681 // Offset of the next instruction to write code to.
682 // Incremented with each instruction write.
683 u32 offset;
682 684
683 // Writing to these registers sets the "current" word in the shader program. 685 // Writing to these registers sets the "current" word in the shader program.
684 // TODO: It's not clear how the hardware stores what the "current" word is. 686 // TODO: It's not clear how the hardware stores what the "current" word is.
@@ -690,7 +692,9 @@ struct Regs {
690 // This register group is used to load an internal table of swizzling patterns, 692 // This register group is used to load an internal table of swizzling patterns,
691 // which are indexed by each shader instruction to specify vector component swizzling. 693 // which are indexed by each shader instruction to specify vector component swizzling.
692 struct { 694 struct {
693 u32 begin_load; 695 // Offset of the next swizzle pattern to write code to.
696 // Incremented with each instruction write.
697 u32 offset;
694 698
695 // Writing to these registers sets the "current" swizzle pattern in the table. 699 // Writing to these registers sets the "current" swizzle pattern in the table.
696 // TODO: It's not clear how the hardware stores what the "current" swizzle pattern is. 700 // TODO: It's not clear how the hardware stores what the "current" swizzle pattern is.