Skip to content

[d3d12] add a shader cache to avoid calling into DXC/FXC #7729

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

teoxoy
Copy link
Member

@teoxoy teoxoy commented May 26, 2025

Connections
Closes #7716.

Description
Adds a shader cache to the D3D12 backend so that we don't have to recompile shaders via DXC/FXC.
Note that the cache is per device and so will get cleared when the device is dropped. I think this is fine for now.

Testing
Tested manually.

Squash or Rebase?
n/a

@teoxoy teoxoy requested a review from a team as a code owner May 26, 2025 17:09
Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

Teo and I discussed this, and we agreed we should put a cap on the number of entries in the cache.

@teoxoy
Copy link
Member Author

teoxoy commented May 28, 2025

I updated the PR with the implementation that we talked about but it's not actually a static cap since we will "retain all entries that have been used since we compiled the last 100 shaders". Even though it's not a static cap it sounds like the right approach since the cache will contain the the latest used shaders in it. Let me know what you think!

@teoxoy teoxoy requested a review from jimblandy May 28, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wgpu should cache pipelines
2 participants