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

Cap InnerBuffer::global_ubo size #349

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

metiulekm
Copy link

@metiulekm metiulekm commented Feb 28, 2025

The value of glow::MAX_UNIFORM_BLOCK_SIZE can be arbitrarily large. For instance on Firefox on Linux with AMD GPUs tends to generate quite large values: 2**29 on RX 550, and 2**31 on RX 7600 XT, which will result in this function trying to create a 0.5 GB and a 2 GB buffer respectively. Creating buffers this large will either cause a quick OOM, or at least make the application unusably slow.

This commit caps the returned size to 2**16, which is the value returned by Chromium in the same combination as above and results in this function creating 64 kB buffers.

The value of glow::MAX_UNIFORM_BLOCK_SIZE can be arbitrarily large. For
instance on Firefox on Linux with AMD GPUs tends to generate quite large
values: 2**29 on RX 550, and 2**31 on RX 7600 XT, which will result in
this function trying to create a 0.5 GB and a 2 GB buffer respectively.
Creating buffers this large will either cause a quick OOM, or at least
make the application unusably slow.

This commit caps the returned size to 2**16, which is the value returned
by Chromium in the same combination as above and results in this
function creating 64 kB buffers.
@metiulekm
Copy link
Author

Fixes #332. Finally got time to figure this out 😀

Tested this by running the bunnymark example on WASM/FF/Linux on both mentioned GPUs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant