JolifantoBambla / webgpu-spd

A port of AMD's Single Pass Downsampler for WebGPU
https://jolifantobambla.github.io/webgpu-spd/
MIT License
13 stars 0 forks source link

More mips per pass #1

Open JolifantoBambla opened 6 months ago

JolifantoBambla commented 6 months ago

Native SPD supports up to 12 mips per pass. WebGPU doesn't support arrays of textures and read-write access for most formats yet but someday it will.

JolifantoBambla commented 6 months ago

Ok, so in v2, I'll just use a coherent buffer for the mid mip - according to this, buffers are coherent by default - so that would let me (personally) do at least 8 mips per pass (all adapters I've tested with allow only 8). For more, I guess I still have to wait for arrays of textures. Since wgpu buffers are not coherent by default yet (?), doing only up to 6 mips per pass should stay the default behavior for now though, I guess. So I'll let setPreferredLimit still set maxStorageTexturesPerShaderStage to 6 in v2.

JMS55 commented 6 months ago

Wgpu buffers are not currently coherent. I ran into this recently with my own SPD port to wgsl https://github.com/bevyengine/bevy/pull/13003. At the point where you switch to the last active workgroup processing the last 64x64 tile, the writes from the previous pass by other workgroups will not be visible to the last workgroup.

JolifantoBambla commented 6 months ago

Yeah, that's unfortunate :/ I just added some config params now, so that firefox users can fall back to 6 mips per pass, while still supporting more than 6 on chrome.