-
Notifications
You must be signed in to change notification settings - Fork 331
Description
Inspired by #406: we should spec the maximum and minimum number of any resources per bind group.
Metal
No verbiage about a minimum number of arguments, but attempting to create an empty MTLArgumentEncoder
crashes my Metal driver.
Our Metal implementation uses MTLArgumentEncoder
s to back GPUBindGroupLayouts
. One MTLArgumentEncoder
binds the resources corresponding to one stage of the programmable pipeline, so a GPUBindGroupLayout
that contains a resource visible to all three will create three MTLArgumentEncoders
.
The least-capable Metal device capable of using MTLArgumentEncoder
can encode:
31 buffers
31 textures
16 samplers
per shader stage. (This is equivalent to the normal resource limits per stage for this level of hardware.)
Here is my limited understanding of other frameworks.
D3D
"Each descriptor table stores descriptors of one or more types." though I am unsure what would happen if one attempted to create and set an empty one.
The minimum hardware support for DX12 Descriptor Tables is Tier 1; across all descriptor tables for a pipeline we can set:
14 constant (uniform) buffer views
128 shader resource views (textures et al)
16 samplers
per shader stage, in addition to
8 (for D3D Feature Level 11_0) or 64 (for 11_1+) unordered access (storage) views
across all shader stages.
Vulkan
"A descriptor set layout object is defined by an array of zero or more descriptor bindings."
From Table 46 in the spec, these are minimum supported numbers per descriptor set:
12 uniform buffers
4 storage buffers
16 sampled images (textures)
4 storage images
16 samplers
per shader stage.
Conclusion
It looks like Vulkan's minimum support is the most restrictive across the board other than D3D12's UAV restrictions for Feature Level 11_0, where we'd have to limit total storage-buffer
s to 8 per layout.
Due to D3D12's documentation and the Metal behavior I observed, it should also be illegal to create a GPUBindGroupLayout
or GPUBindGroup
with no bindings. WDYT?