hs.pcf.input-patch.hlsl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. // Note: This second patch constant function is placed here, but should not be used
  22. // because the "patchconstantfunc" attribute does not point to this function.
  23. HS_CONSTANT_DATA_OUTPUT PCF_2(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip) {
  24. HS_CONSTANT_DATA_OUTPUT Output;
  25. // Must initialize Edges and Inside; otherwise HLSL validation will fail.
  26. Output.Edges[0] = 2.0;
  27. Output.Edges[1] = 3.0;
  28. Output.Edges[2] = 4.0;
  29. Output.Edges[3] = 5.0;
  30. Output.Inside[0] = 6.0;
  31. Output.Inside[1] = 7.0;
  32. return Output;
  33. }
  34. [domain("isoline")]
  35. [partitioning("fractional_odd")]
  36. [outputtopology("line")]
  37. [outputcontrolpoints(16)]
  38. [patchconstantfunc("PCF")]
  39. BEZIER_CONTROL_POINT main(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID) {
  40. VS_CONTROL_POINT_OUTPUT vsOutput;
  41. BEZIER_CONTROL_POINT result;
  42. result.vPosition = vsOutput.vPosition;
  43. return result;
  44. }