diff options
| author | 2018-06-08 23:24:10 -0400 | |
|---|---|---|
| committer | 2018-06-08 23:24:10 -0400 | |
| commit | 79e9c2e23798b62fc68dae8db69b2c502230d0e2 (patch) | |
| tree | cd566db9c1deed3aa46eed722ad8f2e8ea97af5d /src | |
| parent | Merge pull request #505 from janisozaur/ccache-travis (diff) | |
| download | yuzu-79e9c2e23798b62fc68dae8db69b2c502230d0e2.tar.gz yuzu-79e9c2e23798b62fc68dae8db69b2c502230d0e2.tar.xz yuzu-79e9c2e23798b62fc68dae8db69b2c502230d0e2.zip | |
gl_shader_decompiler: Add missing asserts for saturate_a instructions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/shader_bytecode.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 32800392b..bf254ef33 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h | |||
| @@ -213,6 +213,7 @@ union Instruction { | |||
| 213 | BitField<28, 8, Register> gpr28; | 213 | BitField<28, 8, Register> gpr28; |
| 214 | BitField<39, 8, Register> gpr39; | 214 | BitField<39, 8, Register> gpr39; |
| 215 | BitField<48, 16, u64> opcode; | 215 | BitField<48, 16, u64> opcode; |
| 216 | BitField<50, 1, u64> saturate_a; | ||
| 216 | 217 | ||
| 217 | union { | 218 | union { |
| 218 | BitField<20, 19, u64> imm20_19; | 219 | BitField<20, 19, u64> imm20_19; |
| @@ -331,7 +332,6 @@ union Instruction { | |||
| 331 | BitField<41, 2, u64> selector; | 332 | BitField<41, 2, u64> selector; |
| 332 | BitField<45, 1, u64> negate_a; | 333 | BitField<45, 1, u64> negate_a; |
| 333 | BitField<49, 1, u64> abs_a; | 334 | BitField<49, 1, u64> abs_a; |
| 334 | BitField<50, 1, u64> saturate_a; | ||
| 335 | 335 | ||
| 336 | union { | 336 | union { |
| 337 | BitField<39, 2, F2iRoundingOp> rounding; | 337 | BitField<39, 2, F2iRoundingOp> rounding; |
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 94c6bc4b2..3abdd7fdb 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -808,6 +808,8 @@ private: | |||
| 808 | case OpCode::Id::FMUL_C: | 808 | case OpCode::Id::FMUL_C: |
| 809 | case OpCode::Id::FMUL_R: | 809 | case OpCode::Id::FMUL_R: |
| 810 | case OpCode::Id::FMUL_IMM: { | 810 | case OpCode::Id::FMUL_IMM: { |
| 811 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); | ||
| 812 | |||
| 811 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, instr.alu.abs_d); | 813 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " * " + op_b, 1, 1, instr.alu.abs_d); |
| 812 | break; | 814 | break; |
| 813 | } | 815 | } |
| @@ -821,10 +823,14 @@ private: | |||
| 821 | case OpCode::Id::FADD_C: | 823 | case OpCode::Id::FADD_C: |
| 822 | case OpCode::Id::FADD_R: | 824 | case OpCode::Id::FADD_R: |
| 823 | case OpCode::Id::FADD_IMM: { | 825 | case OpCode::Id::FADD_IMM: { |
| 826 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); | ||
| 827 | |||
| 824 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, instr.alu.abs_d); | 828 | regs.SetRegisterToFloat(instr.gpr0, 0, op_a + " + " + op_b, 1, 1, instr.alu.abs_d); |
| 825 | break; | 829 | break; |
| 826 | } | 830 | } |
| 827 | case OpCode::Id::MUFU: { | 831 | case OpCode::Id::MUFU: { |
| 832 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); | ||
| 833 | |||
| 828 | switch (instr.sub_op) { | 834 | switch (instr.sub_op) { |
| 829 | case SubOp::Cos: | 835 | case SubOp::Cos: |
| 830 | regs.SetRegisterToFloat(instr.gpr0, 0, "cos(" + op_a + ')', 1, 1, | 836 | regs.SetRegisterToFloat(instr.gpr0, 0, "cos(" + op_a + ')', 1, 1, |
| @@ -1012,6 +1018,8 @@ private: | |||
| 1012 | break; | 1018 | break; |
| 1013 | } | 1019 | } |
| 1014 | case OpCode::Type::Ffma: { | 1020 | case OpCode::Type::Ffma: { |
| 1021 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); | ||
| 1022 | |||
| 1015 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); | 1023 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); |
| 1016 | std::string op_b = instr.ffma.negate_b ? "-" : ""; | 1024 | std::string op_b = instr.ffma.negate_b ? "-" : ""; |
| 1017 | std::string op_c = instr.ffma.negate_c ? "-" : ""; | 1025 | std::string op_c = instr.ffma.negate_c ? "-" : ""; |
| @@ -1051,7 +1059,7 @@ private: | |||
| 1051 | case OpCode::Type::Conversion: { | 1059 | case OpCode::Type::Conversion: { |
| 1052 | ASSERT_MSG(instr.conversion.size == Register::Size::Word, "Unimplemented"); | 1060 | ASSERT_MSG(instr.conversion.size == Register::Size::Word, "Unimplemented"); |
| 1053 | ASSERT_MSG(!instr.conversion.negate_a, "Unimplemented"); | 1061 | ASSERT_MSG(!instr.conversion.negate_a, "Unimplemented"); |
| 1054 | ASSERT_MSG(!instr.conversion.saturate_a, "Unimplemented"); | 1062 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); |
| 1055 | 1063 | ||
| 1056 | switch (opcode->GetId()) { | 1064 | switch (opcode->GetId()) { |
| 1057 | case OpCode::Id::I2I_R: { | 1065 | case OpCode::Id::I2I_R: { |
| @@ -1081,6 +1089,8 @@ private: | |||
| 1081 | break; | 1089 | break; |
| 1082 | } | 1090 | } |
| 1083 | case OpCode::Id::F2F_R: { | 1091 | case OpCode::Id::F2F_R: { |
| 1092 | ASSERT_MSG(!instr.saturate_a, "Unimplemented"); | ||
| 1093 | |||
| 1084 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr20); | 1094 | std::string op_a = regs.GetRegisterAsFloat(instr.gpr20); |
| 1085 | 1095 | ||
| 1086 | switch (instr.conversion.f2f.rounding) { | 1096 | switch (instr.conversion.f2f.rounding) { |
| @@ -1198,8 +1208,8 @@ private: | |||
| 1198 | const std::string op_b = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1); | 1208 | const std::string op_b = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1); |
| 1199 | const std::string sampler = GetSampler(instr.sampler); | 1209 | const std::string sampler = GetSampler(instr.sampler); |
| 1200 | const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");"; | 1210 | const std::string coord = "vec2 coords = vec2(" + op_a + ", " + op_b + ");"; |
| 1201 | // Add an extra scope and declare the texture coords inside to prevent overwriting | 1211 | // Add an extra scope and declare the texture coords inside to prevent |
| 1202 | // them in case they are used as outputs of the texs instruction. | 1212 | // overwriting them in case they are used as outputs of the texs instruction. |
| 1203 | shader.AddLine("{"); | 1213 | shader.AddLine("{"); |
| 1204 | ++shader.scope; | 1214 | ++shader.scope; |
| 1205 | shader.AddLine(coord); | 1215 | shader.AddLine(coord); |
| @@ -1230,8 +1240,8 @@ private: | |||
| 1230 | shader.AddLine(coord); | 1240 | shader.AddLine(coord); |
| 1231 | const std::string texture = "texture(" + sampler + ", coords)"; | 1241 | const std::string texture = "texture(" + sampler + ", coords)"; |
| 1232 | 1242 | ||
| 1233 | // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA goes | 1243 | // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA |
| 1234 | // into gpr28+0 and gpr28+1 | 1244 | // goes into gpr28+0 and gpr28+1 |
| 1235 | size_t offset{}; | 1245 | size_t offset{}; |
| 1236 | 1246 | ||
| 1237 | for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { | 1247 | for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) { |
| @@ -1412,8 +1422,8 @@ private: | |||
| 1412 | 1422 | ||
| 1413 | shader.AddLine("return true;"); | 1423 | shader.AddLine("return true;"); |
| 1414 | if (instr.pred.pred_index == static_cast<u64>(Pred::UnusedIndex)) { | 1424 | if (instr.pred.pred_index == static_cast<u64>(Pred::UnusedIndex)) { |
| 1415 | // If this is an unconditional exit then just end processing here, otherwise we | 1425 | // If this is an unconditional exit then just end processing here, otherwise |
| 1416 | // have to account for the possibility of the condition not being met, so | 1426 | // we have to account for the possibility of the condition not being met, so |
| 1417 | // continue processing the next instruction. | 1427 | // continue processing the next instruction. |
| 1418 | offset = PROGRAM_END - 1; | 1428 | offset = PROGRAM_END - 1; |
| 1419 | } | 1429 | } |