Skip to content

Commit

Permalink
gl_shader_decompiler: Fix min/max NaN edge case (#6935)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelthegreat authored Aug 31, 2023
1 parent 5ad58e0 commit cab0ad5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/video_core/renderer_opengl/gl_shader_decompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,22 @@ class GLSLGenerator {
}

case OpCode::Id::MAX: {
SetDest(swizzle, dest_reg, fmt::format("max({}, {})", src1, src2), 4, 4);
if (sanitize_mul) {
SetDest(swizzle, dest_reg,
fmt::format("mix({1}, {0}, greaterThan({0}, {1}))", src1, src2), 4, 4);
} else {
SetDest(swizzle, dest_reg, fmt::format("max({}, {})", src1, src2), 4, 4);
}
break;
}

case OpCode::Id::MIN: {
SetDest(swizzle, dest_reg, fmt::format("min({}, {})", src1, src2), 4, 4);
if (sanitize_mul) {
SetDest(swizzle, dest_reg,
fmt::format("mix({1}, {0}, lessThan({0}, {1}))", src1, src2), 4, 4);
} else {
SetDest(swizzle, dest_reg, fmt::format("min({}, {})", src1, src2), 4, 4);
}
break;
}

Expand Down

0 comments on commit cab0ad5

Please sign in to comment.