diff options
| author | 2018-12-12 00:34:12 -0300 | |
|---|---|---|
| committer | 2018-12-22 19:19:18 -0300 | |
| commit | 946777601ba6d2ee2dafa7e27e10c30c0dea45c0 (patch) | |
| tree | 552e7fa557ad01541054977ccd31f4bb03b70a65 /src | |
| parent | complete emulation of ZeroFlag (diff) | |
| download | yuzu-946777601ba6d2ee2dafa7e27e10c30c0dea45c0.tar.gz yuzu-946777601ba6d2ee2dafa7e27e10c30c0dea45c0.tar.xz yuzu-946777601ba6d2ee2dafa7e27e10c30c0dea45c0.zip | |
Handle RZ cases evaluating the expression instead of the register value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 3828b8762..7a16dccc9 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -347,6 +347,15 @@ public: | |||
| 347 | BuildInputList(); | 347 | BuildInputList(); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | void SetConditionalCodesFromExpression(const std::string& expresion) { | ||
| 351 | SetInternalFlag(InternalFlag::ZeroFlag, "(" + expresion + ") == 0"); | ||
| 352 | LOG_WARNING(HW_GPU, "Condition codes implementation is incomplete."); | ||
| 353 | } | ||
| 354 | |||
| 355 | void SetConditionalCodesFromRegister(const Register& reg, u64 dest_elem = 0) { | ||
| 356 | SetConditionalCodesFromExpression(GetRegister(reg, static_cast<u32>(dest_elem))); | ||
| 357 | } | ||
| 358 | |||
| 350 | /** | 359 | /** |
| 351 | * Returns code that does an integer size conversion for the specified size. | 360 | * Returns code that does an integer size conversion for the specified size. |
| 352 | * @param value Value to perform integer size conversion on. | 361 | * @param value Value to perform integer size conversion on. |
| @@ -411,10 +420,11 @@ public: | |||
| 411 | SetRegister(reg, elem, is_saturated ? "clamp(" + value + ", 0.0, 1.0)" : value, | 420 | SetRegister(reg, elem, is_saturated ? "clamp(" + value + ", 0.0, 1.0)" : value, |
| 412 | dest_num_components, value_num_components, dest_elem, precise); | 421 | dest_num_components, value_num_components, dest_elem, precise); |
| 413 | if (sets_cc) { | 422 | if (sets_cc) { |
| 414 | const std::string zero_condition = | 423 | if (reg == Register::ZeroIndex) { |
| 415 | "( " + GetRegister(reg, static_cast<u32>(dest_elem)) + " == 0 )"; | 424 | SetConditionalCodesFromExpression(value); |
| 416 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); | 425 | } else { |
| 417 | LOG_WARNING(HW_GPU, "Condition codes implementation is incomplete."); | 426 | SetConditionalCodesFromRegister(reg, dest_elem); |
| 427 | } | ||
| 418 | } | 428 | } |
| 419 | } | 429 | } |
| 420 | 430 | ||
| @@ -442,10 +452,11 @@ public: | |||
| 442 | dest_num_components, value_num_components, dest_elem, false); | 452 | dest_num_components, value_num_components, dest_elem, false); |
| 443 | 453 | ||
| 444 | if (sets_cc) { | 454 | if (sets_cc) { |
| 445 | const std::string zero_condition = | 455 | if (reg == Register::ZeroIndex) { |
| 446 | "( " + GetRegister(reg, static_cast<u32>(dest_elem)) + " == 0 )"; | 456 | SetConditionalCodesFromExpression(value); |
| 447 | SetInternalFlag(InternalFlag::ZeroFlag, zero_condition); | 457 | } else { |
| 448 | LOG_WARNING(HW_GPU, "Condition codes implementation is incomplete."); | 458 | SetConditionalCodesFromRegister(reg, dest_elem); |
| 459 | } | ||
| 449 | } | 460 | } |
| 450 | } | 461 | } |
| 451 | 462 | ||
| @@ -3365,14 +3376,11 @@ private: | |||
| 3365 | ") " + combiner + " (" + second_pred + "))"; | 3376 | ") " + combiner + " (" + second_pred + "))"; |
| 3366 | 3377 | ||
| 3367 | if (instr.fset.bf) { | 3378 | if (instr.fset.bf) { |
| 3368 | regs.SetRegisterToFloat(instr.gpr0, 0, predicate + " ? 1.0 : 0.0", 1, 1); | 3379 | regs.SetRegisterToFloat(instr.gpr0, 0, predicate + " ? 1.0 : 0.0", 1, 1, false, |
| 3380 | instr.generates_cc); | ||
| 3369 | } else { | 3381 | } else { |
| 3370 | regs.SetRegisterToInteger(instr.gpr0, false, 0, predicate + " ? 0xFFFFFFFF : 0", 1, | 3382 | regs.SetRegisterToInteger(instr.gpr0, false, 0, predicate + " ? 0xFFFFFFFF : 0", 1, |
| 3371 | 1); | 3383 | 1, false, instr.generates_cc); |
| 3372 | } | ||
| 3373 | if (instr.generates_cc.Value() != 0) { | ||
| 3374 | regs.SetInternalFlag(InternalFlag::ZeroFlag, predicate); | ||
| 3375 | LOG_WARNING(HW_GPU, "FSET Condition Code is incomplete"); | ||
| 3376 | } | 3384 | } |
| 3377 | break; | 3385 | break; |
| 3378 | } | 3386 | } |