unbounded-arrays5.azsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Makes sure unbounded arrays are supported across all register classes t,u,s,b.
  2. // This example demonstrates each SRG having a unique register space, allowing another implicit ConstantBuffer.
  3. ShaderResourceGroupSemantic slot1
  4. {
  5. FrequencyId = 1;
  6. };
  7. ShaderResourceGroupSemantic slot2
  8. {
  9. FrequencyId = 2;
  10. };
  11. struct MyStruct
  12. {
  13. float3 m_a;
  14. float3 m_b;
  15. };
  16. ShaderResourceGroup SRG1 : slot1
  17. {
  18. Texture2D<float4> m_texSRVa; // Takes t0
  19. Texture2D<float4> m_texSRVb; // Takes t1
  20. Texture2D<float4> m_texSRVc[]; // Takes t2+
  21. RWTexture2D<float4> m_texUAVa; // Takes u0
  22. RWTexture2D<float4> m_texUAVb; // Takes u1
  23. RWTexture2D<float4> m_texUAVc[]; // Takes u2+
  24. Sampler m_samplera; // Takes s0
  25. Sampler m_samplerb; // Takes s1
  26. Sampler m_samplerc[]; // Takes s2+
  27. ConstantBuffer<MyStruct> m_structArraya; // Takes b0
  28. ConstantBuffer<MyStruct> m_structArrayb; // Takes b1
  29. ConstantBuffer<MyStruct> m_structArrayc[]; // Takes b2+
  30. };
  31. ShaderResourceGroup SRG2 : slot2
  32. {
  33. // Having unique register spaces for each SRG allows this to SRG's implicit constant buffer to use space1 while SRG1 uses space0.
  34. int m_data;
  35. }