MultiGPUComposite.azsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 <Atom/Features/SrgSemantics.azsli>
  9. ShaderResourceGroup CompositeSrg : SRG_PerObject
  10. {
  11. Texture2D m_inputTextureLeft;
  12. Texture2D m_inputTextureRight;
  13. Sampler m_sampler
  14. {
  15. MinFilter = Linear;
  16. MagFilter = Linear;
  17. MipFilter = Linear;
  18. AddressU = Clamp;
  19. AddressV = Clamp;
  20. AddressW = Clamp;
  21. };
  22. }
  23. struct VSInput
  24. {
  25. float3 m_position : POSITION;
  26. float2 m_uv : UV0;
  27. };
  28. struct VSOutput
  29. {
  30. float4 m_position : SV_Position;
  31. float2 m_uv : UV0;
  32. };
  33. VSOutput MainVS(VSInput vsInput)
  34. {
  35. VSOutput OUT;
  36. OUT.m_position = float4(vsInput.m_position, 1.0);
  37. OUT.m_uv = vsInput.m_uv;
  38. return OUT;
  39. }
  40. struct PSOutput
  41. {
  42. float4 m_color : SV_Target0;
  43. };
  44. PSOutput MainPS(VSOutput psInput)
  45. {
  46. PSOutput OUT;
  47. if(psInput.m_uv.x <= 0.5)
  48. {
  49. OUT.m_color = CompositeSrg::m_inputTextureLeft.Sample(CompositeSrg::m_sampler, psInput.m_uv);
  50. }
  51. else
  52. {
  53. OUT.m_color = CompositeSrg::m_inputTextureRight.Sample(CompositeSrg::m_sampler, psInput.m_uv);
  54. }
  55. return OUT;
  56. }