Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPU support for int and uint vertex attributes #5050

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Feb 8, 2023

Shaders are now processed for WebGPU not only to handle uniform buffers, but additionally to handle different vertex formats. Specifically - till now only float based attributes were supported, but this PR adds support for int and uint attributes.

Shader attribute declaration like this:

attribute vec4 vertex_position;

gets translated to this format, if the vertex format specifies position as TYPE_INT32 for example:

attribute ivec4 _vertex_position;
vec4 vertex_position = vec4(_vertex_position);
  • additionally, removed some manual workaround to handle this specifically for the skinning.
  • also, uniform arrays of 1 are handled now correctly - before they were assumed to not be arrays, so this now works:
    uniform float data[1]

This makes our bitmoji characters work, as they provide positions in int16 format.
(Note that there is still some morphing issue with them, for a separate PR)

skinning.mov

@mvaligursky mvaligursky mentioned this pull request Feb 8, 2023
@mvaligursky mvaligursky self-assigned this Feb 8, 2023
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Feb 8, 2023
Copy link
Member

@slimbuck slimbuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving with a few tiny comments

src/platform/graphics/shader-processor.js Show resolved Hide resolved
src/platform/graphics/shader-processor.js Outdated Show resolved Hide resolved
@mvaligursky mvaligursky merged commit a04c311 into main Feb 9, 2023
@mvaligursky mvaligursky deleted the mv-non-float-attributes-webgpu branch February 9, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants