lib_hs_export1.hlsl 2.3 KB

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