wgpu
wgpu copied to clipboard
max_sampled_texture_limit on metal is too low
Description According to https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf the limit for "Maximum number of textures you can access, per stage, from an argument buffer" is 1M on my device (M1 Pro, so Apple7 in the pdf). However wgpu has a hardcoded limit (on metal) of 16 max_sampled_textures_per_shader_stage. I would like to make a TextureViewArray binding with more than 16 items.
Expected vs observed behavior I get limits that are lower than possible according to the Apple's specs.
Platform wgpu master on metal on m1 pro
Actually, since it looks like wgpu and naga do not use argument buffers, the limit is 128 (which is still much higher than the 16 currently enforced).
self.max_textures_per_stage
already has the right value in it so it should be an easy change.
Ran into the same issue: I can create a texture array with 256 layers without any issues, but I can't use it because the BindGroupLayoutEntry
count must be set to texture layer count and then it runs into the aforementioned limit. Reproducable with a tweaked (count > 16) texture-arrays example.
I'm not sure if WGPU is checking the correct limit here... Isn't texture array binding counts as a single texture binding, regardless of how many layers it contains? Otherwise texture arrays wouldn't make much sense.
Edit: I'm confusing texture arrays with array textures, nevermind. Array textures work as expected after some fixing on my side.
Reproducable with a tweaked (count > 16) texture-arrays example.
The default limits used by wgpu examples are Limits::downlevel_webgl2_defaults()
, set limits: adapter.limits()
can use the actual hardware limits.