summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-04-26 05:10:41 +0200
committerbunnei <bunneidev@gmail.com>2018-04-26 20:38:41 +0200
commit37fa9a15cdb99510748df39f2a823f766c4b0049 (patch)
treed8da515a4fd768efb94adbf02518dc183e1b9486 /src
parentMerge pull request #401 from lioncash/gdbstub (diff)
downloadyuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar.gz
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar.bz2
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar.lz
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar.xz
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.tar.zst
yuzu-37fa9a15cdb99510748df39f2a823f766c4b0049.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 3dffb205d..82fd7a0de 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -221,14 +221,11 @@ private:
/// Generates code representing a temporary (GPR) register.
std::string GetRegister(const Register& reg, unsigned elem = 0) {
- if (reg == Register::ZeroIndex)
+ if (reg == Register::ZeroIndex) {
return "0";
- if (stage == Maxwell3D::Regs::ShaderStage::Fragment && reg < 4) {
- // GPRs 0-3 are output color for the fragment shader
- return std::string{"color."} + "rgba"[(reg + elem) & 3];
}
-
- return *declr_register.insert("register_" + std::to_string(reg + elem)).first;
+ return *declr_register.insert("register_" + std::to_string(reg.GetSwizzledIndex(elem)))
+ .first;
}
/// Generates code representing a uniform (C buffer) register.
@@ -628,6 +625,15 @@ private:
case OpCode::Id::EXIT: {
ASSERT_MSG(instr.pred.pred_index == static_cast<u64>(Pred::UnusedIndex),
"Predicated exits not implemented");
+
+ // Final color output is currently hardcoded to GPR0-3 for fragment shaders
+ if (stage == Maxwell3D::Regs::ShaderStage::Fragment) {
+ shader.AddLine("color.r = " + GetRegister(0) + ";");
+ shader.AddLine("color.g = " + GetRegister(1) + ";");
+ shader.AddLine("color.b = " + GetRegister(2) + ";");
+ shader.AddLine("color.a = " + GetRegister(3) + ";");
+ }
+
shader.AddLine("return true;");
offset = PROGRAM_END - 1;
break;