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

max_sampled_texture_limit on metal is too low #2898

Closed
Darksecond opened this issue Jul 20, 2022 · 3 comments
Closed

max_sampled_texture_limit on metal is too low #2898

Darksecond opened this issue Jul 20, 2022 · 3 comments
Labels
api: metal Issues with Metal area: performance How fast things go type: enhancement New feature or request

Comments

@Darksecond
Copy link

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

@Darksecond
Copy link
Author

Darksecond commented Jul 20, 2022

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.

@yzsolt
Copy link
Contributor

yzsolt commented Jul 31, 2022

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.

@jinleili
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: metal Issues with Metal area: performance How fast things go type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants