InputAssemblyCompute.azsl 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. ShaderResourceGroupSemantic SRG_Frequency0
  9. {
  10. FrequencyId = 0;
  11. };
  12. ShaderResourceGroup DispatchSRG : SRG_Frequency0
  13. {
  14. float m_time;
  15. struct BufferData
  16. {
  17. float4 m_data;
  18. };
  19. RWStructuredBuffer<BufferData> m_IABuffer;
  20. };
  21. [numthreads(1,1,1)]
  22. void MainCS(uint3 thread_id: SV_DispatchThreadID)
  23. {
  24. float lerpValue = (sin(DispatchSRG::m_time) + 1) * 0.5;
  25. float yCoord = 0.5 * sqrt(3);
  26. DispatchSRG::m_IABuffer[0].m_data = float4(lerp(-1.0, -0.5, lerpValue), 0, 0, 1.0);
  27. DispatchSRG::m_IABuffer[1].m_data = float4(-0.5, yCoord, 0, 1.0);
  28. DispatchSRG::m_IABuffer[2].m_data = float4(-0.5, -yCoord, 0, 1.0);
  29. DispatchSRG::m_IABuffer[3].m_data = float4(0.5, yCoord, 0, 1.0);
  30. DispatchSRG::m_IABuffer[4].m_data = float4(0.5, -yCoord, 0, 1.0);
  31. DispatchSRG::m_IABuffer[5].m_data = float4(lerp(1.0, 0.5, lerpValue), 0, 0, 1.0);
  32. }