hs.pcf.output-patch.hlsl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Run: %dxc -T hs_6_0 -E main
  2. #include "bezier_common_hull.hlsl"
  3. // Test: PCF takes the output (OutputPatch) of the main entry point function.
  4. // CHECK: %_arr_BEZIER_CONTROL_POINT_uint_16 = OpTypeArray %BEZIER_CONTROL_POINT %uint_16
  5. // CHECK: %_ptr_Function__arr_BEZIER_CONTROL_POINT_uint_16 = OpTypePointer Function %_arr_BEZIER_CONTROL_POINT_uint_16
  6. // CHECK: [[fType:%\d+]] = OpTypeFunction %HS_CONSTANT_DATA_OUTPUT %_ptr_Function__arr_BEZIER_CONTROL_POINT_uint_16
  7. // CHECK: %main = OpFunction %void None {{%\d+}}
  8. // CHECK: %temp_var_hullMainRetVal = OpVariable %_ptr_Function__arr_BEZIER_CONTROL_POINT_uint_16 Function
  9. // CHECK: [[id:%\d+]] = OpLoad %uint %gl_InvocationID
  10. // CHECK: [[mainResult:%\d+]] = OpFunctionCall %BEZIER_CONTROL_POINT %src_main %param_var_ip %param_var_i %param_var_PatchID
  11. // CHECK: [[loc:%\d+]] = OpAccessChain %_ptr_Function_BEZIER_CONTROL_POINT %temp_var_hullMainRetVal [[id]]
  12. // CHECK: OpStore [[loc]] [[mainResult]]
  13. // CHECK: {{%\d+}} = OpFunctionCall %HS_CONSTANT_DATA_OUTPUT %PCF %temp_var_hullMainRetVal
  14. // CHECK: %PCF = OpFunction %HS_CONSTANT_DATA_OUTPUT None [[fType]]
  15. // CHECK-NEXT: %op = OpFunctionParameter %_ptr_Function__arr_BEZIER_CONTROL_POINT_uint_16
  16. HS_CONSTANT_DATA_OUTPUT PCF(OutputPatch<BEZIER_CONTROL_POINT, MAX_POINTS> op) {
  17. HS_CONSTANT_DATA_OUTPUT Output;
  18. // Must initialize Edges and Inside; otherwise HLSL validation will fail.
  19. Output.Edges[0] = 1.0;
  20. Output.Edges[1] = 2.0;
  21. Output.Edges[2] = 3.0;
  22. Output.Edges[3] = 4.0;
  23. Output.Inside[0] = 5.0;
  24. Output.Inside[1] = 6.0;
  25. return Output;
  26. }
  27. [domain("isoline")]
  28. [partitioning("fractional_odd")]
  29. [outputtopology("line")]
  30. [outputcontrolpoints(16)]
  31. [patchconstantfunc("PCF")]
  32. BEZIER_CONTROL_POINT main(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POINTS> ip, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID) {
  33. VS_CONTROL_POINT_OUTPUT vsOutput;
  34. BEZIER_CONTROL_POINT result;
  35. result.vPosition = vsOutput.vPosition;
  36. return result;
  37. }