shader-slang / slang

Making it easier to work with shaders
MIT License
1.78k stars 159 forks source link

Implementing `tbuffer` layout(s) #4436

Closed ArielG-NV closed 4 days ago

ArielG-NV commented 1 week ago

Fixes: #4428

This means tbuffer now works for hlsl and glsl targets. SPIR-V and Metal has yet to implement logic for TextureBufferType emitting/legalization, separate issue to track this (#4435).

Changes:

  1. Add resource layouts for 'TextureBuffer'.
  2. Add on to existing logic a way to allocate appropriate registers for TextureBufferType (this was made to work with parameter block logic).
  3. fix some emit logic of TextureBufferType for metal target so users get a useful error that points to #4435
ArielG-NV commented 1 week ago

Does HLSL allow trailing unsized arrays in a tbuffer?

no, tbuffer does not allow trailing unsized arrays.