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

wgpu: Cache Program3D bind group layout #11526

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

Aaron1011
Copy link
Member

The bind group layout only depends on the texture registers (and 2D/cubemap type) accessed by the fragment shader, not on the runtime texture bound with Context3D. This means that we can build and cache it when we compile the AGAL program to a Naga module.

Since the bind group layout is used for the overall pipeline, I've refactored the shader caching code into ShaderPairAgal, which holds both the vertex and fragment shader bytecode, and compiles both in the compile function.

@adrian17
Copy link
Collaborator

What content does this affect / which swfs are the best for observing the improvement?

@Aaron1011
Copy link
Member Author

I haven't been able to observe a noticeable improvement on desktop yet. However, in Sniper Team, the wgpu function deduplicate_bind_group_layout no longer shows up in a perf record profile with this PR.

The bind group layout only depends on the texture registers
(and 2D/cubemap type) accessed by the fragment shader, not on
the runtime texture bound with Context3D. This means that we can
build and cache it when we compile the AGAL program to a Naga
module.

Since the bind group layout is used for the overall pipeline, I've
refactored the shader caching code into `ShaderPairAgal`, which
holds both the vertex and fragment shader bytecode, and compiles
both in the `compile` function.
@Aaron1011 Aaron1011 force-pushed the bind-layout-caching branch from bd957a1 to 55fe7ac Compare July 9, 2023 15:52
@Aaron1011 Aaron1011 merged commit b6fae8e into ruffle-rs:master Jul 9, 2023
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.

3 participants