webgpu / webgpu-samples

WebGPU Samples

Home Page:https://webgpu.github.io/webgpu-samples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A-Buffer sample fails on some Android devices

toji opened this issue · comments

On both a Pixel 4 and Pixel 6 (but not a Pixel 7) the A buffer sample fails with the following error:

Binding size (171606624) of [Buffer "linkedListBuffer"] is larger than the maximum binding size (134217728).
 - While validating entries[2] as a Buffer.
Expected entry layout: { binding: 2, visibility: ShaderStage::Fragment, buffer: { type: BufferBindingType::Storage, hasDynamicOffset: 0, minBindingSize: 32 } }
 - While validating [BindGroupDescriptor "translucentBindGroup"] against [BindGroupLayout]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor "translucentBindGroup"]).

Given that the size of the linkedListBuffer only differs between devices based on the canvas size, I went searching as was surprised to find that the Pixel 4 and 6 had a devicePixelRatio of 3.5, but the Pixel 7 I was testing only had a devicePixelRatio of 2.5.

The buffer size/canvas resolution for this sample should be capped to stay under the binding limit.

I think another option here is scissor the scene and keep each section under the limit. I’ll work on a PR to do that so we can match the native resolution.

I think the option to scissor the scene is great! But it's also one that comes with performance tradeoffs and increased code complexity. It would be nice if it could be implemented in such a way that helps developers understand that it's not a required aspect of the technique, but instead a workaround to enable higher quality within the base limits.

Would it be feasible to make the scissor-for-full-res technique toggleable with a checkbox?

Totally feasible - i'll look into it.