PerfGraphVS.hlsl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s
  2. // CHECK: Saturate
  3. //
  4. // Copyright (c) Microsoft. All rights reserved.
  5. // This code is licensed under the MIT License (MIT).
  6. // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  8. // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  9. // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  10. //
  11. // Developed by Minigraph
  12. //
  13. // Author: Julia Careaga
  14. //
  15. #include "PerfGraphRS.hlsli"
  16. cbuffer CBGraphColor : register(b0)
  17. {
  18. float3 Color;
  19. float RcpXScale;
  20. uint NodeCount;
  21. uint FrameID;
  22. };
  23. cbuffer constants : register(b1)
  24. {
  25. uint Instance;
  26. float RcpYScale;
  27. }
  28. struct VSOutput
  29. {
  30. float4 pos : SV_POSITION;
  31. float3 col : COLOR;
  32. };
  33. StructuredBuffer<float> PerfTimes : register(t0);
  34. [RootSignature(PerfGraph_RootSig)]
  35. VSOutput main( uint VertexID : SV_VertexID )
  36. {
  37. // Assume NodeCount is a power of 2
  38. uint offset = (FrameID + VertexID) & (NodeCount - 1);
  39. // TODO: Stop interleaving data
  40. float perfTime = saturate(PerfTimes[offset] * RcpYScale) * 2.0 - 1.0;
  41. float frame = VertexID * RcpXScale - 1.0;
  42. VSOutput output;
  43. output.pos = float4(frame, perfTime, 1, 1);
  44. output.col = Color;
  45. return output;
  46. }