multipleSetMeshOutputCounts.hlsl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // RUN: %dxc -E main -T ms_6_5 %s | FileCheck %s
  2. // CHECK: SetMeshOUtputCounts cannot be called multiple times.
  3. #define MAX_VERT 32
  4. #define MAX_PRIM 16
  5. #define NUM_THREADS 32
  6. struct MeshPerVertex {
  7. float4 position : SV_Position;
  8. float color[4] : COLOR;
  9. };
  10. struct MeshPerPrimitive {
  11. float normal : NORMAL;
  12. float malnor : MALNOR;
  13. int layer[4] : LAYER;
  14. };
  15. struct MeshPayload {
  16. float normal;
  17. float malnor;
  18. int layer[4];
  19. };
  20. [numthreads(NUM_THREADS, 1, 1)]
  21. [outputtopology("triangle")]
  22. void main(
  23. out indices uint3 primIndices[MAX_PRIM],
  24. out vertices MeshPerVertex verts[MAX_VERT],
  25. out primitives MeshPerPrimitive prims[MAX_PRIM],
  26. in payload MeshPayload mpl,
  27. in uint tig : SV_GroupIndex,
  28. in uint vid : SV_ViewID
  29. )
  30. {
  31. SetMeshOutputCounts(MAX_VERT, MAX_PRIM);
  32. MeshPerVertex ov;
  33. if (vid % 2) {
  34. SetMeshOutputCounts(MAX_VERT, MAX_PRIM);
  35. ov.position = float4(4.0,5.0,6.0,7.0);
  36. ov.color[0] = 4.0;
  37. ov.color[1] = 5.0;
  38. ov.color[2] = 6.0;
  39. ov.color[3] = 7.0;
  40. } else {
  41. ov.position = float4(14.0,15.0,16.0,17.0);
  42. ov.color[0] = 14.0;
  43. ov.color[1] = 15.0;
  44. ov.color[2] = 16.0;
  45. ov.color[3] = 17.0;
  46. }
  47. if (tig % 3) {
  48. primIndices[tig / 3] = uint3(tig, tig + 1, tig + 2);
  49. MeshPerPrimitive op;
  50. op.normal = mpl.normal;
  51. op.malnor = mpl.malnor;
  52. op.layer[0] = mpl.layer[0];
  53. op.layer[1] = mpl.layer[1];
  54. op.layer[2] = mpl.layer[2];
  55. op.layer[3] = mpl.layer[3];
  56. prims[tig / 3] = op;
  57. }
  58. verts[tig] = ov;
  59. }