-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This works but is probably the wrong fix. I don't know three.js that well so I thought I'd post this as an example of a fix and it might lead to the correct fix. The issue is WebGPU does not support itemSize = 1 or itemSize = 3 for 8bit or 16bit values. When using KHR_mesh_quantization some attributes are like Int16x3. But, according to the KHR_mesh_quantization spec they are actually padded to Int16x4 In WebGL it's fine to set the attribute to ``` size = 3, type = gl.SHORT, normalize = true, stride = 8. ``` But in WebGPU there is no such thing as `size = 3, type = gl.SHORT` If it existed it would be called `sint16x3` or `uint16x3` or `snorm16x3` or `unorm16x3` but none of those exist. Instead you have to set the attribute to `???x4` for these situations. You then need to be careful the shader doesn't actually use Z. The shader can still declare its attribute has vec3f/vec3<f32> but if it declares it as vec4/vec4<f32> the z value would be undefined (whatever happens to be in the file in the padding) My guess is the correct fix, rather than this hack which expands the type, it should look at the stride. The stride to figure out when to expand the type from x3 to x4 or from x1 to x2 or x1 to x4
- Loading branch information
Showing
1 changed file
with
41 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters