lib_hs_export2.hlsl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // RUN: %dxc -auto-binding-space 13 -T lib_6_3 -exports HSMain1;HSMain3 %s | %D3DReflect %s | FileCheck %s
  2. Buffer<float> T_unused;
  3. struct PSSceneIn
  4. {
  5. float4 pos : SV_Position;
  6. float2 tex : TEXCOORD0;
  7. float3 norm : NORMAL;
  8. };
  9. struct HSPerPatchData
  10. {
  11. float edges[3] : SV_TessFactor;
  12. float inside : SV_InsideTessFactor;
  13. };
  14. // Should not be selected, since later candidate function with same name exists.
  15. // If selected, it should fail, since patch size mismatches HS function.
  16. HSPerPatchData HSPerPatchFunc1(
  17. const InputPatch< PSSceneIn, 16 > points)
  18. {
  19. HSPerPatchData d;
  20. d.edges[0] = -5;
  21. d.edges[1] = -6;
  22. d.edges[2] = -7;
  23. d.inside = T_unused.Load(1).x;
  24. return d;
  25. }
  26. HSPerPatchData HSPerPatchFunc2(
  27. const InputPatch< PSSceneIn, 4 > points)
  28. {
  29. HSPerPatchData d;
  30. d.edges[0] = -5;
  31. d.edges[1] = -6;
  32. d.edges[2] = -7;
  33. d.inside = -8;
  34. return d;
  35. }
  36. [shader("hull")]
  37. [domain("tri")]
  38. [partitioning("fractional_odd")]
  39. [outputtopology("triangle_cw")]
  40. [patchconstantfunc("HSPerPatchFunc1")]
  41. [outputcontrolpoints(3)]
  42. void HSMain1( const uint id : SV_OutputControlPointID,
  43. const InputPatch< PSSceneIn, 3 > points )
  44. {
  45. }
  46. [shader("hull")]
  47. [domain("quad")]
  48. [partitioning("fractional_odd")]
  49. [outputtopology("triangle_cw")]
  50. [patchconstantfunc("HSPerPatchFunc2")]
  51. [outputcontrolpoints(4)]
  52. void HSMain2( const uint id : SV_OutputControlPointID,
  53. const InputPatch< PSSceneIn, 4 > points )
  54. {
  55. }
  56. [shader("hull")]
  57. [domain("tri")]
  58. [partitioning("fractional_odd")]
  59. [outputtopology("triangle_ccw")]
  60. [patchconstantfunc("HSPerPatchFunc1")]
  61. [outputcontrolpoints(3)]
  62. void HSMain3( const uint id : SV_OutputControlPointID,
  63. const InputPatch< PSSceneIn, 3 > points )
  64. {
  65. }
  66. // actual selected HSPerPatchFunc1 for HSMain1 and HSMain3
  67. HSPerPatchData HSPerPatchFunc1()
  68. {
  69. HSPerPatchData d;
  70. d.edges[0] = -5;
  71. d.edges[1] = -6;
  72. d.edges[2] = -7;
  73. d.inside = -8;
  74. return d;
  75. }
  76. // CHECK: ID3D12LibraryReflection:
  77. // CHECK: D3D12_LIBRARY_DESC:
  78. // CHECK: FunctionCount: 5
  79. // CHECK: ID3D12FunctionReflection:
  80. // CHECK: D3D12_FUNCTION_DESC: Name: \01?HSMain1@@YAXIV?$InputPatch@UPSSceneIn@@$02@@@Z
  81. // CHECK: Shader Version: Library 6.3
  82. // CHECK: BoundResources: 0
  83. // CHECK: ID3D12FunctionReflection:
  84. // CHECK-NOT: D3D12_FUNCTION_DESC: Name: \01?HSMain2@@YAXIV?$InputPatch@UPSSceneIn@@$03@@@Z
  85. // CHECK: D3D12_FUNCTION_DESC: Name: \01?HSMain3@@YAXIV?$InputPatch@UPSSceneIn@@$02@@@Z
  86. // CHECK: Shader Version: Library 6.3
  87. // CHECK: BoundResources: 0
  88. // CHECK: ID3D12FunctionReflection:
  89. // CHECK: D3D12_FUNCTION_DESC: Name: \01?HSPerPatchFunc1@@YA?AUHSPerPatchData@@XZ
  90. // CHECK: Shader Version: Library 6.3
  91. // CHECK: BoundResources: 0
  92. // CHECK: ID3D12FunctionReflection:
  93. // CHECK-NOT: D3D12_FUNCTION_DESC: Name: \01?HSPerPatchFunc2@@YA?AUHSPerPatchData@@V?$InputPatch@UPSSceneIn@@$03@@@Z
  94. // CHECK: D3D12_FUNCTION_DESC: Name: HSMain1
  95. // CHECK: Shader Version: Hull 6.3
  96. // CHECK: BoundResources: 0
  97. // CHECK: ID3D12FunctionReflection:
  98. // CHECK-NOT: D3D12_FUNCTION_DESC: Name: HSMain2
  99. // CHECK: D3D12_FUNCTION_DESC: Name: HSMain3
  100. // CHECK: Shader Version: Hull 6.3
  101. // CHECK: BoundResources: 0