ComputeDraw.azsl 874 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "Compute.azsli"
  9. struct VSInput
  10. {
  11. float3 m_position : POSITION;
  12. float2 m_uv : UV0;
  13. };
  14. struct VSOutput
  15. {
  16. float4 m_position : SV_Position;
  17. float2 m_uv : UV0;
  18. };
  19. VSOutput MainVS(VSInput vsInput)
  20. {
  21. VSOutput OUT;
  22. OUT.m_position = float4(vsInput.m_position, 1.0);
  23. OUT.m_uv = vsInput.m_uv;
  24. return OUT;
  25. }
  26. struct PSOutput
  27. {
  28. float4 m_color : SV_Target0;
  29. };
  30. PSOutput MainPS(VSOutput psInput)
  31. {
  32. PSOutput OUT;
  33. int index = int(floor(psInput.m_position.y) * ConstantSrg::dimension.x + floor(psInput.m_position.x));
  34. OUT.m_color = float4(BufferSrg::m_computeBuffer[index].m_data.xyz, 1.0);
  35. return OUT;
  36. }