srg-layouts-spaces.azsl 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ShaderResourceGroupSemantic ExampleBinding0 { FrequencyId = 0; };
  2. ShaderResourceGroupSemantic ExampleBinding1 { FrequencyId = 1; };
  3. ShaderResourceGroupSemantic ExampleBinding2 { FrequencyId = 2; };
  4. struct S { float4 f; };
  5. struct Light { // 144 bytes Source : https://developer.nvidia.com/content/how-about-constant-buffers
  6. float3 Position;
  7. float Radius;
  8. float4 Color;
  9. float3 AttenuationParams;
  10. uint Type;
  11. float4 SpotDirectionAndAngle;
  12. float4 ShadowRect;
  13. float4x4 ShadowMatrix;
  14. };
  15. ShaderResourceGroup ExampleSRG0 : ExampleBinding0
  16. {
  17. ConstantBuffer<S> m_CB_a; // stride = 16
  18. ConstantBuffer<S> m_CB_b[2]; // stride = 16
  19. Buffer<float4> m_B_d; // stride = 16
  20. StructuredBuffer<S> m_SB_e; // stride = 16
  21. };
  22. ShaderResourceGroup ExampleSRG1 : ExampleBinding1
  23. {
  24. ConstantBuffer<Light> m_CB_c; // stride = 144
  25. Buffer<float3> m_B_f[2];
  26. StructuredBuffer<S> m_SB_g[2];
  27. };
  28. ShaderResourceGroup ExampleSRG2 : ExampleBinding2
  29. {
  30. TextureCube m_texCube1; // stride = 16 (default)
  31. Texture2D<float3> m_tex2d1; // stride = 12
  32. };