semantic.inside-tess-factor.hs.array1.hlsl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Run: %dxc -T hs_6_0 -E main
  2. #define NumOutPoints 2
  3. // CHECK: %gl_TessLevelInner = OpVariable %_ptr_Output__arr_float_uint_2 Output
  4. struct HsPcfOut
  5. {
  6. float tessOuter[3] : SV_TessFactor;
  7. // According to HLSL doc, this should actually be a scalar float.
  8. // But developers sometimes use float[1].
  9. float tessInner[1] : SV_InsideTessFactor;
  10. };
  11. struct HsCpOut
  12. {
  13. float4 pos : SV_Position;
  14. };
  15. // Patch Constant Function
  16. HsPcfOut pcf() {
  17. HsPcfOut output;
  18. output = (HsPcfOut)0;
  19. return output;
  20. }
  21. [domain("tri")]
  22. [partitioning("fractional_odd")]
  23. [outputtopology("triangle_ccw")]
  24. [outputcontrolpoints(NumOutPoints)]
  25. [patchconstantfunc("pcf")]
  26. HsCpOut main(uint cpId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) {
  27. // CHECK: [[ret:%\d+]] = OpFunctionCall %HsPcfOut %pcf
  28. // CHECK: [[itf:%\d+]] = OpCompositeExtract %_arr_float_uint_1 [[ret]] 1
  29. // CHECK-NEXT: [[ptr:%\d+]] = OpAccessChain %_ptr_Output_float %gl_TessLevelInner %uint_0
  30. // CHECK-NEXT: [[e0:%\d+]] = OpCompositeExtract %float [[itf]] 0
  31. // CHECK-NEXT: OpStore [[ptr]] [[e0]]
  32. HsCpOut output;
  33. output = (HsCpOut)0;
  34. return output;
  35. }