-
Notifications
You must be signed in to change notification settings - Fork 548
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
[0.5] Add Texture Descriptor Array Feature #3269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need these functions published, please bump the patch versions of the backends.
Also, please add a short note to CHANGELONG.
I'm surprised that this is supported on DX11, tbh. Do you know how this is resolved?
Spriv-cross happily spits out Texture2D<float4> u_Textures[2] : register(t0);
SamplerState u_Sampler : register(s1); for layout(set = 0, binding = 0) uniform texture2D u_Textures[2];
layout(set = 0, binding = 1) uniform sampler u_Sampler; all the way down to shader model 4.0. Tbh it's not really that surprising, as it has to be compile time indexed, so it's no different for hardware than having two textures in a row. |
I don't think we should be exposing this feature in backends that don't yet support it. I.e. DX11 may be calling spirv_cross correctly, but the binding side will likely break before it gets to the shader. Are you testing this on anything? |
I just finished my example, and it doesn't seem to work on DX11, though without errors, so I have no idea if that's an issue with the DX11 backend, or what. I'll disable it on DX11 as I have no personal need for that backend. |
09f8728
to
4ba8c57
Compare
Thank you!
|
4ba8c57
to
8f73dfc
Compare
Should be good to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you!
bors r+
Build succeeded: |
711: Implement Descriptor Array Extension r=kvark a=cwfitzgerald ## Connections Blocked on gfx-rs/gfx#3269 and does some funky git overrides to get CI to return meaningful results what will be removed once that PR lands and is published. ## Description This PR implements the `TEXTURE_BINDING_ARRAY` native extension. This allows users to specify a uniform sized array of textures for use in shaders. As a corollary, this PR rustifies the Bind Group and Bind Group Layout interface. Two main actions were taken when doing this: - Types that were able to be shared among wgt, wgc, and wgpu-rs were moved into wgt. - Types that had references to other wgpu-rs specific structures were duplicated into wgc with wgpu-rs structures replaced with the appropriate ID. Notes were added to the wgc types that they were duplicated directly from wgpu-rs. From what I can tell, this resulted in a significant reduction in code complexity when dealing with bind groups, favoring strong types over runtime assertions. Naga validation of arrays of textures was not implemented. Documentation was added to extensions to help users understand what underlying tech was being relied on as well as the platforms it should be expected to work on. I think this pattern should be implemented across the board for extensions as it makes them much more user friendly to use. ## Testing There is an example included in the wgpu-rs PR which was used for testing this feature. It worked on DX12, Vulkan, and Metal (MSL > 2.0), as was expected. Additionally the other examples were run and are still verified to run. Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This adds
Feature::TEXTURE_DESCRIPTOR_ARRAY
which is unconditionally present on DX12, DX11, and Vulkan, > MTL 2.0 on Metal, and unavailable on OpenGL. Strictly speaking that feature might be supported on opengl, but I'd want to make sure the backend supported it first.A slightly concerning discovery is that Limits can't be extended without a breaking change, so descriptor indexing might have some issues. Thankfully this feature doesn't change the available limits.
TODO: