fork_instanceid_with_modifiers.hlsl 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // RUN: %fxc /Ths_5_0 %s /Fo %t.dxbc
  2. // RUN: %dxbc2dxil %t.dxbc /emit-llvm | %FileCheck %s
  3. // RUN: %fxc /Ths_5_1 /DDX12 %s /Fo %t.dxbc
  4. // RUN: %dxbc2dxil %t.dxbc /emit-llvm | %FileCheck %s
  5. // CHECK: hullloop0:
  6. // CHECK: %[[InstanceID:.*]] = phi i32
  7. // CHECK: sub i32 0, %[[InstanceID:.*]]
  8. #ifndef DX12
  9. #define RS
  10. #else
  11. #define RS [RootSignature("CBV(b2)")]
  12. #endif
  13. struct Vertex
  14. {
  15. float4 pos : SV_POSITION;
  16. float4 c : COLOR;
  17. };
  18. struct HullShaderConstantData
  19. {
  20. float Edges[4] : SV_TessFactor;
  21. float Inside[2] : SV_InsideTessFactor;
  22. };
  23. cbuffer Buf0 : register(b2) {
  24. uint foo;
  25. }
  26. HullShaderConstantData ConstantFunction( InputPatch<Vertex, 5> In )
  27. {
  28. HullShaderConstantData Out = (HullShaderConstantData)0;
  29. for (int i = 0; i<4; ++i) {
  30. Out.Edges[i] += In[foo - i].c.w;
  31. }
  32. return Out;
  33. }
  34. RS
  35. [domain("quad")]
  36. [partitioning("integer")]
  37. [outputtopology("point")]
  38. [outputcontrolpoints(0)]
  39. [patchconstantfunc("ConstantFunction")]
  40. void main( InputPatch<Vertex, 5> In, uint i : SV_OutputControlPointID )
  41. {
  42. }