SplashScreenPass.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/PostProcessing/FullscreenVertexUtil.azsli>
  9. #include <Atom/Features/SrgSemantics.azsli>
  10. ShaderResourceGroup PassSrg : SRG_PerPass_WithFallback
  11. {
  12. Sampler m_imageSampler
  13. {
  14. AddressU = Clamp;
  15. AddressV = Clamp;
  16. AddressW = Clamp;
  17. };
  18. Texture2D<float4> m_splashScreenImage;
  19. struct SplashScreenParams
  20. {
  21. float m_fadingFactor;
  22. } m_splashScreenParams;
  23. }
  24. struct VSInput
  25. {
  26. uint m_vertexIndex : SV_VertexID;
  27. };
  28. struct VSOutput
  29. {
  30. float4 m_position : SV_Position;
  31. float2 m_uv : UV0;
  32. };
  33. struct PSOutput
  34. {
  35. float4 m_color : SV_Target0;
  36. };
  37. VSOutput MainVS(VSInput vsInput)
  38. {
  39. VSOutput OUT;
  40. float4 posTex = GetVertexPositionAndTexCoords(vsInput.m_vertexIndex);
  41. OUT.m_position = float4(posTex.x, posTex.y, 0.0, 1.0);
  42. OUT.m_uv = float2(posTex.z, posTex.w);
  43. return OUT;
  44. }
  45. PSOutput MainPS(VSOutput psInput)
  46. {
  47. PSOutput OUT;
  48. float4 color = PassSrg::m_splashScreenImage.Sample(PassSrg::m_imageSampler, psInput.m_uv);
  49. OUT.m_color = float4(color.rgb * PassSrg::m_splashScreenParams.m_fadingFactor, color.a);
  50. return OUT;
  51. }