hs.pcf.input-patch.hlsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Run: %dxc -T hs_6_0 -E main
  2. #include "bezier_common_hull.hlsl"
  3. // Test: PCF takes the input control points (InputPatch)
  4. // CHECK: [[fType:%\d+]] = OpTypeFunction %HS_CONSTANT_DATA_OUTPUT %_ptr_Function__arr_VS_CONTROL_POINT_OUTPUT_uint_16
  5. // CHECK: %main = OpFunction %void None {{%\d+}}
  6. // CHECK: %param_var_ip = OpVariable %_ptr_Function__arr_VS_CONTROL_POINT_OUTPUT_uint_16 Function
  7. // CHECK: {{%\d+}} = OpFunctionCall %HS_CONSTANT_DATA_OUTPUT %PCF %param_var_ip
  8. // CHECK: %PCF = OpFunction %HS_CONSTANT_DATA_OUTPUT None [[fType]]
  9. // CHECK-NEXT: %ip = OpFunctionParameter %_ptr_Function__arr_VS_CONTROL_POINT_OUTPUT_uint_16
  10. HS_CONSTANT_DATA_OUTPUT PCF(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip) {
  11. HS_CONSTANT_DATA_OUTPUT Output;
  12. // Must initialize Edges and Inside; otherwise HLSL validation will fail.
  13. Output.Edges[0] = 1.0;
  14. Output.Edges[1] = 2.0;
  15. Output.Edges[2] = 3.0;
  16. Output.Edges[3] = 4.0;
  17. Output.Inside[0] = 5.0;
  18. Output.Inside[1] = 6.0;
  19. return Output;
  20. }
  21. [domain("isoline")]
  22. [partitioning("fractional_odd")]
  23. [outputtopology("line")]
  24. [outputcontrolpoints(16)]
  25. [patchconstantfunc("PCF")]
  26. BEZIER_CONTROL_POINT main(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID) {
  27. VS_CONTROL_POINT_OUTPUT vsOutput;
  28. BEZIER_CONTROL_POINT result;
  29. result.vPosition = vsOutput.vPosition;
  30. return result;
  31. }