summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/renderer_opengl/gl_arb_decompiler.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
index 6a23221bb..1e96b0310 100644
--- a/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_arb_decompiler.cpp
@@ -786,6 +786,8 @@ ARBDecompiler::ARBDecompiler(const Device& device, const ShaderIR& ir, const Reg
786 ShaderType stage, std::string_view identifier) 786 ShaderType stage, std::string_view identifier)
787 : device{device}, ir{ir}, registry{registry}, stage{stage} { 787 : device{device}, ir{ir}, registry{registry}, stage{stage} {
788 AddLine("TEMP RC;"); 788 AddLine("TEMP RC;");
789 AddLine("TEMP FSWZA[4];");
790 AddLine("TEMP FSWZB[4];");
789 if (ir.IsDecompiled()) { 791 if (ir.IsDecompiled()) {
790 DecompileAST(); 792 DecompileAST();
791 } else { 793 } else {
@@ -991,6 +993,15 @@ void ARBDecompiler::DeclareInternalFlags() {
991} 993}
992 994
993void ARBDecompiler::InitializeVariables() { 995void ARBDecompiler::InitializeVariables() {
996 AddLine("MOV.F32 FSWZA[0], -1;");
997 AddLine("MOV.F32 FSWZA[1], 1;");
998 AddLine("MOV.F32 FSWZA[2], -1;");
999 AddLine("MOV.F32 FSWZA[3], 0;");
1000 AddLine("MOV.F32 FSWZB[0], -1;");
1001 AddLine("MOV.F32 FSWZB[1], -1;");
1002 AddLine("MOV.F32 FSWZB[2], 1;");
1003 AddLine("MOV.F32 FSWZB[3], -1;");
1004
994 if (stage == ShaderType::Vertex || stage == ShaderType::Geometry) { 1005 if (stage == ShaderType::Vertex || stage == ShaderType::Geometry) {
995 AddLine("MOV.F result.position, {{0, 0, 0, 1}};"); 1006 AddLine("MOV.F result.position, {{0, 0, 0, 1}};");
996 } 1007 }
@@ -1570,10 +1581,22 @@ std::string ARBDecompiler::FSqrt(Operation operation) {
1570} 1581}
1571 1582
1572std::string ARBDecompiler::FSwizzleAdd(Operation operation) { 1583std::string ARBDecompiler::FSwizzleAdd(Operation operation) {
1573 LOG_WARNING(Render_OpenGL, "(STUBBED)"); 1584 const std::string temporary = AllocVectorTemporary();
1574 const std::string temporary = AllocTemporary(); 1585 if (!device.HasWarpIntrinsics()) {
1575 AddLine("ADD.F {}, {}, {};", temporary, Visit(operation[0]), Visit(operation[1])); 1586 LOG_ERROR(Render_OpenGL,
1576 return temporary; 1587 "NV_shader_thread_shuffle is missing. Kepler or better is required.");
1588 AddLine("ADD.F {}.x, {}, {};", temporary, Visit(operation[0]), Visit(operation[1]));
1589 return fmt::format("{}.x", temporary);
1590 }
1591 const std::string lut = AllocVectorTemporary();
1592 AddLine("AND.U {}.z, {}.threadid, 3;", temporary, StageInputName(stage));
1593 AddLine("SHL.U {}.z, {}.z, 1;", temporary, temporary);
1594 AddLine("SHR.U {}.z, {}, {}.z;", temporary, Visit(operation[2]), temporary);
1595 AddLine("AND.U {}.z, {}.z, 3;", temporary, temporary);
1596 AddLine("MUL.F32 {}.x, {}, FSWZA[{}.z];", temporary, Visit(operation[0]), temporary);
1597 AddLine("MUL.F32 {}.y, {}, FSWZB[{}.z];", temporary, Visit(operation[1]), temporary);
1598 AddLine("ADD.F32 {}.x, {}.x, {}.y;", temporary, temporary, temporary);
1599 return fmt::format("{}.x", temporary);
1577} 1600}
1578 1601
1579std::string ARBDecompiler::HAdd2(Operation operation) { 1602std::string ARBDecompiler::HAdd2(Operation operation) {