mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-15 16:17:49 +00:00
gl_shader_decompiler: Properly emulate NaN behaviour on NE
"Not equal" operators on GLSL seem to behave as unordered when we expect an ordered comparison. Manually emulate this checking for LGE values (numbers, not-NaNs).
This commit is contained in:
parent
d8598a8717
commit
f39591b20a
1 changed files with 9 additions and 0 deletions
|
@ -1845,6 +1845,15 @@ private:
|
|||
static_assert(!unordered || type == Type::Float);
|
||||
|
||||
const Expression expr = GenerateBinaryInfix(operation, op, Type::Bool, type, type);
|
||||
|
||||
if constexpr (op.compare("!=") == 0 && type == Type::Float && !unordered) {
|
||||
// GLSL's operator!=(float, float) doesn't seem be ordered. This happens on both AMD's
|
||||
// and Nvidia's proprietary stacks. Manually force an ordered comparison.
|
||||
return {fmt::format("({} && !isnan({}) && !isnan({}))", expr.AsBool(),
|
||||
VisitOperand(operation, 0).AsFloat(),
|
||||
VisitOperand(operation, 1).AsFloat()),
|
||||
Type::Bool};
|
||||
}
|
||||
if constexpr (!unordered) {
|
||||
return expr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue