Skip to content

Conversation

@kainino0x
Copy link
Contributor

I noticed the formula for maxStorageBuffersPerShaderStage was outdated. I also wanted to add the formula for the new limits, but I'm not sure what they all are.

@kainino0x kainino0x requested a review from greggman December 19, 2024 23:14
@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2024

Previews, as seen when this build job started (42219e5):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

@kainino0x kainino0x marked this pull request as ready for review December 21, 2024 00:11
@kainino0x
Copy link
Contributor Author

Revised!

@kainino0x
Copy link
Contributor Author

@greggman review bump now that I'm back

Copy link
Contributor

@greggman greggman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh.... I can't remember what we look at before. Re-checking.

min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_COMPUTE_SHADER_STORAGE_BLOCKS)
min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_FRAGMENT_SHADER_STORAGE_BLOCKS)
min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_VERTEX_SHADER_STORAGE_BLOCKS)

is okay but it's not complete.

There's the issue of MAX_COMBINED_SHADER_STORAGE_BLOCKS and there are devices for which would affect any render pipeline and there are several devices that support less than vertex+fragment limits.

GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS vs
    GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS
  GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS
total valid entries: 3365
num entries where GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS+
                  GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS > COMBINED: 403


Combos where COMBINED < GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS +
                        GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS
MAX      MAX     total  MAX      count
FRAGMENT VERTEX  of     COMBINED of
SHADER   SHADER  limits SHADER   opengles.gpuinfo.org
STORAGE  STORAGE <---   STORAGE  entries
BLOCKS   BLOCKS         BLOCKS
-------  ------  -----  -------  -------------------
8        8       16     8        359
64       64      128    64       21
35       35      70     35       15
60       60      120    60       4
32       32      64     32       2
16       16      32     16       1
8192     2048    10240  8192     1

Those include

Adreno (TM) 510
Adreno (TM) 540
Adreno (TM) 640
PowerVR Rogue G6200
PowerVR Rogue GE8320
...etc...

Do you want those details here? To include these devices, it seems like the best a implementation can do this this.

min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_COMPUTE_SHADER_STORAGE_BLOCKS, MAX_COMBINED_SHADER_STORAGE_BLOCKS)
min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_FRAGMENT_SHADER_STORAGE_BLOCKS, MAX_COMBINED_SHADER_STORAGE_BLOCKS / 2)
min(MAX_SHADER_STORAGE_BUFFER_BINDINGS, MAX_VERTEX_SHADER_STORAGE_BLOCKS, MAX_COMBINED_SHADER_STORAGE_BLOCKS / 2)

On the majority of devices, MAX_COMBINED_SHADER_STORAGE_BLOCKS will be > the sum of both

@kainino0x kainino0x added the compat WebGPU Compatibility Mode label Jan 13, 2025
@kainino0x kainino0x added the api WebGPU API label Apr 25, 2025
@kainino0x kainino0x added the needs correspondence reference Items (open or closed) that need to be added to the correspondence reference label Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api WebGPU API compat WebGPU Compatibility Mode needs correspondence reference Items (open or closed) that need to be added to the correspondence reference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants