summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Rodolfo Bogado2018-12-12 19:02:37 -0300
committerGravatar Rodolfo Bogado2018-12-26 18:16:31 -0300
commit33056dd8336b4e61d839408f71ba5a92f849dd77 (patch)
tree886508be69eaac4d5070f8a0d9132a07e04f80ee /src/video_core
parentIncludde saturation in the evaluation of the control code (diff)
downloadyuzu-33056dd8336b4e61d839408f71ba5a92f849dd77.tar.gz
yuzu-33056dd8336b4e61d839408f71ba5a92f849dd77.tar.xz
yuzu-33056dd8336b4e61d839408f71ba5a92f849dd77.zip
Apply CC test to the final value to be stored in the register
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index c7812d377..3640d2b89 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -410,16 +410,17 @@ public:
410 * @param dest_num_components Number of components in the destination. 410 * @param dest_num_components Number of components in the destination.
411 * @param value_num_components Number of components in the value. 411 * @param value_num_components Number of components in the value.
412 * @param is_saturated Optional, when True, saturates the provided value. 412 * @param is_saturated Optional, when True, saturates the provided value.
413 * @param sets_cc Optional, when True, sets the corresponding values to the implemented
414 * condition flags.
413 * @param dest_elem Optional, the destination element to use for the operation. 415 * @param dest_elem Optional, the destination element to use for the operation.
414 */ 416 */
415 void SetRegisterToFloat(const Register& reg, u64 elem, const std::string& value, 417 void SetRegisterToFloat(const Register& reg, u64 elem, const std::string& value,
416 u64 dest_num_components, u64 value_num_components, 418 u64 dest_num_components, u64 value_num_components,
417 bool is_saturated = false, bool sets_cc = false, u64 dest_elem = 0, 419 bool is_saturated = false, bool sets_cc = false, u64 dest_elem = 0,
418 bool precise = false) { 420 bool precise = false) {
419 const const std::string clamped_value = 421 const std::string clamped_value = is_saturated ? "clamp(" + value + ", 0.0, 1.0)" : value;
420 is_saturated ? "clamp(" + value + ", 0.0, 1.0)" : value; 422 SetRegister(reg, elem, clamped_value, dest_num_components, value_num_components, dest_elem,
421 SetRegister(reg, elem, clamped_value, 423 precise);
422 dest_num_components, value_num_components, dest_elem, precise);
423 if (sets_cc) { 424 if (sets_cc) {
424 if (reg == Register::ZeroIndex) { 425 if (reg == Register::ZeroIndex) {
425 SetConditionalCodesFromExpression(clamped_value); 426 SetConditionalCodesFromExpression(clamped_value);
@@ -437,6 +438,8 @@ public:
437 * @param dest_num_components Number of components in the destination. 438 * @param dest_num_components Number of components in the destination.
438 * @param value_num_components Number of components in the value. 439 * @param value_num_components Number of components in the value.
439 * @param is_saturated Optional, when True, saturates the provided value. 440 * @param is_saturated Optional, when True, saturates the provided value.
441 * @param sets_cc Optional, when True, sets the corresponding values to the implemented
442 * condition flags.
440 * @param dest_elem Optional, the destination element to use for the operation. 443 * @param dest_elem Optional, the destination element to use for the operation.
441 * @param size Register size to use for conversion instructions. 444 * @param size Register size to use for conversion instructions.
442 */ 445 */
@@ -446,15 +449,15 @@ public:
446 bool sets_cc = false, u64 dest_elem = 0, 449 bool sets_cc = false, u64 dest_elem = 0,
447 Register::Size size = Register::Size::Word) { 450 Register::Size size = Register::Size::Word) {
448 UNIMPLEMENTED_IF(is_saturated); 451 UNIMPLEMENTED_IF(is_saturated);
449 452 const std::string final_value = ConvertIntegerSize(value, size);
450 const std::string func{is_signed ? "intBitsToFloat" : "uintBitsToFloat"}; 453 const std::string func{is_signed ? "intBitsToFloat" : "uintBitsToFloat"};
451 454
452 SetRegister(reg, elem, func + '(' + ConvertIntegerSize(value, size) + ')', 455 SetRegister(reg, elem, func + '(' + final_value + ')', dest_num_components,
453 dest_num_components, value_num_components, dest_elem, false); 456 value_num_components, dest_elem, false);
454 457
455 if (sets_cc) { 458 if (sets_cc) {
456 if (reg == Register::ZeroIndex) { 459 if (reg == Register::ZeroIndex) {
457 SetConditionalCodesFromExpression(value); 460 SetConditionalCodesFromExpression(final_value);
458 } else { 461 } else {
459 SetConditionalCodesFromRegister(reg, dest_elem); 462 SetConditionalCodesFromRegister(reg, dest_elem);
460 } 463 }
@@ -1629,7 +1632,7 @@ private:
1629 if (process_mode != Tegra::Shader::TextureProcessMode::None && gl_lod_supported) { 1632 if (process_mode != Tegra::Shader::TextureProcessMode::None && gl_lod_supported) {
1630 if (process_mode == Tegra::Shader::TextureProcessMode::LZ) { 1633 if (process_mode == Tegra::Shader::TextureProcessMode::LZ) {
1631 texture += ", 0.0"; 1634 texture += ", 0.0";
1632 } else { 1635 } else {
1633 // If present, lod or bias are always stored in the register indexed by the 1636 // If present, lod or bias are always stored in the register indexed by the
1634 // gpr20 1637 // gpr20
1635 // field with an offset depending on the usage of the other registers 1638 // field with an offset depending on the usage of the other registers