summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-08-19 14:00:12 -0500
committerGravatar Subv2018-08-19 17:09:40 -0500
commit6cf719a4ab86a9ca49cf5b669e74eb7b5243b6da (patch)
treedbb88cf5e671414082f07d20b78f1be497a09949 /src
parentMerge pull request #1089 from Subv/neg_bits (diff)
downloadyuzu-6cf719a4ab86a9ca49cf5b669e74eb7b5243b6da.tar.gz
yuzu-6cf719a4ab86a9ca49cf5b669e74eb7b5243b6da.tar.xz
yuzu-6cf719a4ab86a9ca49cf5b669e74eb7b5243b6da.zip
Shaders/TEXS: Fixed the component mask in the TEXS instruction.
Previously we could end up with a TEXS that didn't write any outputs, this was wrong.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 57cf9f213..89eb2ddb0 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -839,29 +839,29 @@ private:
839 ++shader.scope; 839 ++shader.scope;
840 shader.AddLine(coord); 840 shader.AddLine(coord);
841 841
842 // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA 842 // TEXS has two destination registers and a swizzle. The first two elements in the swizzle
843 // goes into gpr28+0 and gpr28+1 843 // go into gpr0+0 and gpr0+1, and the rest goes into gpr28+0 and gpr28+1
844 size_t texs_offset{}; 844
845 845 size_t written_components = 0;
846 size_t src_elem{}; 846 for (u32 component = 0; component < 4; ++component) {
847 for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { 847 if (!instr.texs.IsComponentEnabled(component)) {
848 size_t dest_elem{}; 848 continue;
849 for (unsigned elem = 0; elem < 2; ++elem) {
850 if (!instr.texs.IsComponentEnabled(src_elem++)) {
851 // Skip disabled components
852 continue;
853 }
854 regs.SetRegisterToFloat(dest, elem + texs_offset, texture, 1, 4, false,
855 dest_elem++);
856 } 849 }
857 850
858 if (!instr.texs.HasTwoDestinations()) { 851 if (written_components < 2) {
859 // Skip the second destination 852 // Write the first two swizzle components to gpr0 and gpr0+1
860 break; 853 regs.SetRegisterToFloat(instr.gpr0, component, texture, 1, 4, false,
854 written_components % 2);
855 } else {
856 ASSERT(instr.texs.HasTwoDestinations());
857 // Write the rest of the swizzle components to gpr28 and gpr28+1
858 regs.SetRegisterToFloat(instr.gpr28, component, texture, 1, 4, false,
859 written_components % 2);
861 } 860 }
862 861
863 texs_offset += 2; 862 ++written_components;
864 } 863 }
864
865 --shader.scope; 865 --shader.scope;
866 shader.AddLine('}'); 866 shader.AddLine('}');
867 } 867 }