mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
GLSL: implement inf, nan.
Use uintBitsToFloat. Bug: tint:1306 Change-Id: Ie9a5e14c13c0d63b57c126f16c4e2a5c7a77e3f7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69740 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
d018d2e5bc
commit
1704fe53f5
@@ -2081,9 +2081,10 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out,
|
||||
out << (l->value ? "true" : "false");
|
||||
} else if (auto* fl = lit->As<ast::FloatLiteralExpression>()) {
|
||||
if (std::isinf(fl->value)) {
|
||||
out << (fl->value >= 0 ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)");
|
||||
out << (fl->value >= 0 ? "uintBitsToFloat(0x7f800000u)"
|
||||
: "uintBitsToFloat(0xff800000u)");
|
||||
} else if (std::isnan(fl->value)) {
|
||||
out << "asfloat(0x7fc00000u)";
|
||||
out << "uintBitsToFloat(0x7fc00000u)";
|
||||
} else {
|
||||
out << FloatToString(fl->value) << "f";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user