const_static_global.hlsl 746 B

123456789101112131415161718192021
  1. // RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
  2. // Make sure not split const static globals.
  3. // CHECK:[16 x float]
  4. static const float4 referenceColors[4] =
  5. {
  6. // Red Green
  7. float4(1, 0, 0, 1), float4(0, 1, 0, 1),
  8. // Blue Black
  9. float4(0, 0, 1, 1), float4(0, 0, 0, 1),
  10. };
  11. float4 main(float2 pos:P) : SV_TARGET0
  12. {
  13. uint referenceX = (uint)pos.x % 2;
  14. uint referenceY = (uint)pos.y % 2;
  15. uint referenceIndex = (referenceY * 2) + referenceX;
  16. return referenceColors[referenceIndex];
  17. }