VolumeRenderBase.bslinc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. mixin VolumeRenderBase
  2. {
  3. depth
  4. {
  5. read = false;
  6. write = false;
  7. };
  8. code
  9. {
  10. struct VStoGS
  11. {
  12. float4 position : SV_POSITION;
  13. float2 uv0 : TEXCOORD0;
  14. uint layerIdx : TEXCOORD1;
  15. };
  16. struct GStoFS
  17. {
  18. float4 position : SV_POSITION;
  19. float2 uv0 : TEXCOORD0;
  20. uint layerIdx : SV_RenderTargetArrayIndex;
  21. };
  22. struct VertexInput
  23. {
  24. float2 screenPos : POSITION;
  25. float2 uv0 : TEXCOORD0;
  26. uint layerIdx : SV_InstanceID;
  27. };
  28. VStoGS vsmain(VertexInput input)
  29. {
  30. VStoGS output;
  31. output.position = float4(input.screenPos, 0, 1);
  32. output.uv0 = input.uv0;
  33. output.layerIdx = input.layerIdx;
  34. return output;
  35. }
  36. [maxvertexcount(3)]
  37. void gsmain(triangle VStoGS input[3], inout TriangleStream<GStoFS> outStream)
  38. {
  39. GStoFS vert0;
  40. vert0.position = input[0].position;
  41. vert0.uv0 = input[0].uv0;
  42. vert0.layerIdx = input[0].layerIdx;
  43. GStoFS vert1;
  44. vert1.position = input[1].position;
  45. vert1.uv0 = input[1].uv0;
  46. vert1.layerIdx = input[1].layerIdx;
  47. GStoFS vert2;
  48. vert2.position = input[2].position;
  49. vert2.uv0 = input[2].uv0;
  50. vert2.layerIdx = input[2].layerIdx;
  51. outStream.Append(vert0);
  52. outStream.Append(vert1);
  53. outStream.Append(vert2);
  54. }
  55. };
  56. };