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

Refactor shader caching to handle mesh instance on layers with different lights #5582

Merged
merged 4 commits into from Aug 23, 2023

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Aug 23, 2023

Cache of shaders on the mesh instance only supported a single set of lights, by storing _lightHash value. This does not work when the same mesh instance is used on multiple layers, with different sets of lights, causing shader cache miss each time.

This has been refactored now to be supported. Further refactoring has been done to storing bind groups that match the shaders.

Some deprecated functionality, in the past used by the Editor, has been removed now as well, as it's being removed from the Editor.

@mvaligursky mvaligursky self-assigned this Aug 23, 2023
@mvaligursky mvaligursky added the area: graphics Graphics related issue label Aug 23, 2023
mvaligursky and others added 2 commits August 23, 2023 14:39
Co-authored-by: Will Eastcott <will@playcanvas.com>
*
* @ignore
*/
class ShaderInstance {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this go in its own module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided against it for now, as it's just internal to mesh instance, not even exported.

@mvaligursky mvaligursky merged commit bbcfbb6 into main Aug 23, 2023
7 checks passed
@mvaligursky mvaligursky deleted the mv-shader-caching branch August 23, 2023 13:46
mvaligursky added a commit that referenced this pull request Aug 23, 2023
…ent lights (#5582)

* Refactor shader caching to handle mesh instance on layers with different lights

* lint

* Update src/scene/materials/material.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* removed

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
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.

None yet

2 participants