You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating Uniform Nodes for WebGPU, the default uniform type in the shader is float. If you want to use integer values in the shader, fp32 is capable of every integer value up to 2^24=16777216, after which fp32 precision breaks down. For better precision, you can set the nodetype of the uniform nodes to create, for example, uniforms of type uint. However, when setting the value of the integer uniform node, the value still gets uploaded to the GPU as a float, but is interpreted by the shader as an uint, which causes nonsense values. Right now you can only use integer uniforms with a little hack to interpret the value as float before uploading to the GPU (see attached jsfiddle)
Reproduction steps
Create a uniform with type uint: uniform(value, "uint")
Use a compute shader to write the value to an output buffer of type uint
Description
When creating Uniform Nodes for WebGPU, the default uniform type in the shader is float. If you want to use integer values in the shader, fp32 is capable of every integer value up to 2^24=16777216, after which fp32 precision breaks down. For better precision, you can set the nodetype of the uniform nodes to create, for example, uniforms of type uint. However, when setting the value of the integer uniform node, the value still gets uploaded to the GPU as a float, but is interpreted by the shader as an uint, which causes nonsense values. Right now you can only use integer uniforms with a little hack to interpret the value as float before uploading to the GPU (see attached jsfiddle)
Reproduction steps
Code
Live example
jsfiddle
Screenshots
Version
r171-dev
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: