gfx-rs / wgpu-native

Native WebGPU implementation based on wgpu-core
Apache License 2.0
875 stars 105 forks source link

dynamic offset buffer alignment limits apparently need to be 256? #408

Closed rcoreilly closed 2 months ago

rcoreilly commented 2 months ago

I am using dynamic offset buffers in wgpu-native, and was getting the dreaded pipeline validation error without any further information as to what the exact error was (would be awesome to get more detailed info when such errors occur!). By random experimentation I found that if instead of using the reported alignment factor (which was 64 in the specific nvidia GPU I have on my thinkpad laptop), I used 256 (which is the value that works on my macbook pro laptop), everything worked.

This also allowed things to work on android, and the same issue happened on the thinkpad laptop under linux and windows.

Without diving into the actual code, this behavior suggests perhaps that the validation step is using a different alignment factor than the one reported in the limits.

here's the relevant limit factor for uniform -- there is a similar one for storage -- I didn't test that one:

https://web3dsurvey.com/webgpu/limits/minUniformBufferOffsetAlignment

rcoreilly commented 2 months ago

ps. we built using f2b3f0f9153d1e4d1009ed53a1e181ea70d65a71 -- btw @rajveermalviya this was all using our update of your go-webgpu package :)

rcoreilly commented 2 months ago

This is undoubtedly due to the fact that you actually have to request the limits shown for your device -- by default it is all just some basic standard, which must be 256.