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

[Fix] Fix additional shaders getting processed on WebGPU #5952

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Jan 18, 2024

On WPU in the LightsBaked example (and others using primitives) we create more shaders compared to WebGL. The reason is that we process the shader for WebGPU, and the hash value used to avoid this by getting a cached shader used VertexFormat.element.offset. This offset depends on the number of vertices of a mesh when non-interleaved vertex format is used. But as the offset does not affect the shader processing, there is no real reason to process the shader again - the result is the same.

Solution - use a newly added processing hash string which contains only data relevant to the shader processing.

Note: The actual difference in vertex format is already handled by the rendering pipeline, which is created per unique vertex format (similarly to how VertexArrayObject is used on WebGL).

@mvaligursky mvaligursky self-assigned this Jan 18, 2024
@mvaligursky mvaligursky added bug area: graphics Graphics related issue labels Jan 18, 2024
@mvaligursky mvaligursky requested a review from a team January 18, 2024 12:24
@mvaligursky mvaligursky merged commit c566c15 into main Jan 18, 2024
7 checks passed
@mvaligursky mvaligursky deleted the mv-webgpu-shaders-processing branch January 18, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants