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

Argument Buffers on Metal #4219

Closed
wants to merge 2 commits into from
Closed

Conversation

kanerogers
Copy link

Overview

This PR attempts to close #3334

Progress

When used in concert with this naga PR, significantly simplifies wgpu's Metal backend by, in large part, replacing the existing resource binding model with argument buffers.

In many ways, a large part of the work done by the existing Metal backend is attempting to resolve the impedance mismatch between WebGPU (and, by extension, Vulkan's) descriptor set based binding model and Metal's pre-argument buffer binding model. This required very careful tracking and populating of a function argument table and passing knowledge of those bindings down to naga at shader generation time.

This PR instead tries to simplify that work by instead generating a Metal shader that uses argument buffers and employs a "reflection" style architecture that allows the generated shader to provide a simple 1:1 mapping between the members of a given bind group and the resources used in the shader.

Further work

While I believe the bulk of the work has been done, I have sadly run out of available time to fully test and resolve all the edge cases required to finish this issue.

In particular, there are, unfortunately, at least two wrinkles that prevent the wholesale adoption of argument buffers:

  • Writable textures on devices below tier 1
  • Buffers with dynamic offsets

These two use cases would require passing the resource by argument into the entry point, as per the existing binding model. It should be reasonably straightforward to check for the presence of these two cases, and any others that arise, and handle them accordingly.

I have also not yet integrated the new binding model with compute shaders as I had hoped to resolve the issues with fragment/vertex shaders first.

@cwfitzgerald
Copy link
Member

As this PR is likely not going to be merged in this form, and the design for bindless will be different in the future, I'm going to close this.

Really appreciate all the effort you put into this, however :)

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.

Use Argument Buffers on Metal
2 participants