You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that scene [[buffer(1)]] and objects [[buffer(0)]] should be flipped, as per SDL_gpu documentation:
/* * For MSL/metallib, use the following order: * * - [[texture]]: Sampled textures, followed by storage textures * - [[sampler]]: Samplers with indices corresponding to the sampled textures * - [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0 * is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on. * Rather than manually authoring vertex buffer indices, use the * [[stage_in]] attribute which will automatically use the vertex input * information from the SDL_GPUGraphicsPipeline. */
And when I swap 1s and 0s for the buffer indices, my shader works correctly.
The text was updated successfully, but these errors were encountered:
Hit the same issue where I have 3 structured buffers and 1 uniform in the vertex shader and 2 structured buffers and 1 uniform in the fragment shader.
The uniform is declared as buffer(3) in MSL instead of buffer(0) and as a result the bindings are shifted down by one: should be uniform (0) followed by 3 buffers.
SDL itself sets the uniform in slot 0 as expected (the unnamed buffer is the uniform):
Exactly the same happens in the fragment shader:
When I manually go to the MSL transpiled file and up-shift the structured buffers by 1 and put the uniform as buffer(0) everything starts working.
My game has a storage buffer for model matrices and a uniform buffer for global scene data. Given this sample
glsl
file:Then running these commands:
I get this output:
I believe that
scene [[buffer(1)]]
andobjects [[buffer(0)]]
should be flipped, as per SDL_gpu documentation:And when I swap 1s and 0s for the buffer indices, my shader works correctly.
The text was updated successfully, but these errors were encountered: