SimpleHs7.hlsl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // RUN: %dxc -E main -T hs_6_0 %s | FileCheck %s
  2. // CHECK: InputPatch should not be out/inout parameter
  3. // CHECK: OutputPatch should not be out/inout parameter
  4. //--------------------------------------------------------------------------------------
  5. // SimpleTessellation.hlsl
  6. //
  7. // Advanced Technology Group (ATG)
  8. // Copyright (C) Microsoft Corporation. All rights reserved.
  9. //--------------------------------------------------------------------------------------
  10. struct PSSceneIn
  11. {
  12. float4 pos : SV_Position;
  13. float2 tex : TEXCOORD0;
  14. float3 norm : NORMAL;
  15. uint RTIndex : SV_RenderTargetArrayIndex;
  16. };
  17. //////////////////////////////////////////////////////////////////////////////////////////
  18. // Simple forwarding Tessellation shaders
  19. struct HSPerVertexData
  20. {
  21. // This is just the original vertex verbatim. In many real life cases this would be a
  22. // control point instead
  23. PSSceneIn v;
  24. };
  25. struct HSPerPatchData
  26. {
  27. // We at least have to specify tess factors per patch
  28. // As we're tesselating triangles, there will be 4 tess factors
  29. // In real life case this might contain face normal, for example
  30. float edges[ 3 ] : SV_TessFactor;
  31. float inside : SV_InsideTessFactor;
  32. };
  33. float4 HSPerPatchFunc()
  34. {
  35. return 1.8;
  36. }
  37. HSPerPatchData HSPerPatchFunc( const out InputPatch< PSSceneIn, 3 > points, out OutputPatch<HSPerVertexData, 5> outp)
  38. {
  39. HSPerPatchData d;
  40. d.edges[ 0 ] = 1;
  41. d.edges[ 1 ] = 1;
  42. d.edges[ 2 ] = 1;
  43. d.inside = 1;
  44. return d;
  45. }
  46. // hull per-control point shader
  47. [domain("tri")]
  48. [partitioning("fractional_odd")]
  49. [outputtopology("triangle_cw")]
  50. [patchconstantfunc("HSPerPatchFunc")]
  51. [outputcontrolpoints(3)]
  52. HSPerVertexData main( const uint id : SV_OutputControlPointID,
  53. const InputPatch< PSSceneIn, 3 > points, const InputPatch< PSSceneIn, 3 > points2 )
  54. {
  55. HSPerVertexData v;
  56. // Just forward the vertex
  57. v.v = points[ id ];
  58. return v;
  59. }