QuadVert.hlsl 636 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Shaders/Common.hlsl>
  6. #if !defined(CUSTOM_DEPTH)
  7. # define CUSTOM_DEPTH 0.0
  8. #endif
  9. struct VertOut
  10. {
  11. Vec4 m_svPosition : SV_POSITION;
  12. Vec2 m_uv : TEXCOORD;
  13. };
  14. #if ANKI_VERTEX_SHADER
  15. VertOut main(U32 vertId : SV_VERTEXID)
  16. {
  17. const Vec2 coord = Vec2(vertId >> 1, vertId & 1);
  18. VertOut output;
  19. output.m_svPosition = Vec4(coord * Vec2(4.0, -4.0) + Vec2(-1.0, 1.0), CUSTOM_DEPTH, 1.0);
  20. output.m_uv = coord * 2.0f;
  21. return output;
  22. }
  23. #endif