[naga] Float literals do not round trip #7589
Labels
area: naga back-end
Outputs of naga shader conversion
naga
Shader Translator
type: enhancement
New feature or request
Description
When you have a float literal in a shader, the AST gets
Literal::F32(value)
orLiteral::F64(value)
. Thevalue
is a rust float, which leads to precision issues when one roundtrips between shader languages.Repro steps
This likely affects all inputs, but here is a repo:
And inspect the AST.
Expected vs observed behavior
Expected:
1.2
Observed:
1.2000000476837158
Possible Solution
Happy to put up a PR so the literals also have (or instead of?) a
String
representationLiteral::F64(num, s)
if that is an agreeable fix.Platform
naga
25.0.1
The text was updated successfully, but these errors were encountered: