ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.8k stars 501 forks source link

Metal backend buffer namespace collision #129

Closed DeanoC closed 5 years ago

DeanoC commented 5 years ago

On Metal Vertex Buffers share the same namespace as other buffers. So a vertex buffer at slot 0 is the same as a uniform buffer at slot 0. However the API automatically assigns vertex buffers to low buffer slots.

The other apis and backends don't share a namespace and its common to allocate uniforms buffer to low slot numbers, this breaks the metal backend which is in the background consuming N buffer slots for vertex buffers. This is particularly relevant if used a transpiler like spirv-cross.

The usual solution is to simple allocate vertex buffers at higher slot numbers in the metal backend. I added 16 to the vertex buffer numbers which will work until I have more than 16 uniform buffers.