Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_vs_fxc.h"
  3. float4 uvTransform : register ( SHADER_SPECIFIC_CONST_0 );
  4. float4 uvTransform_UpperLeftLowerRight : register ( SHADER_SPECIFIC_CONST_1 );
  5. struct VS_INPUT
  6. {
  7. float3 vPos : POSITION;
  8. float2 vBaseTexCoord : TEXCOORD0;
  9. };
  10. struct VS_OUTPUT
  11. {
  12. float4 projPos : POSITION;
  13. float4 bloombaseCoords : TEXCOORD0;
  14. float4 fxaaCoords : TEXCOORD1;
  15. };
  16. float2 PerformUVTransform( float2 uv )
  17. {
  18. return uv * uvTransform.zw + uvTransform.xy;
  19. }
  20. float4 PerformUVTransform_UpperLeftLowerRight( float2 uv )
  21. {
  22. return uv.xyxy + uvTransform_UpperLeftLowerRight.xyzw;
  23. }
  24. VS_OUTPUT main( const VS_INPUT v )
  25. {
  26. VS_OUTPUT o;
  27. o.projPos = float4( v.vPos, 1.0f );
  28. #ifdef _PS3
  29. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  30. o.projPos.y = -o.projPos.y;
  31. o.projPos.z = 2.0f * o.projPos.z - o.projPos.w;
  32. #endif // _PS3
  33. // o.baseCoords.xy = v.vBaseTexCoord.xy;
  34. // o.bloomCoords.xy = PerformUVTransform( v.vBaseTexCoord.xy ); // Compute bloom tex coords
  35. o.bloombaseCoords.zw = v.vBaseTexCoord.xy;
  36. o.bloombaseCoords.xy = PerformUVTransform( v.vBaseTexCoord.xy ); // Compute bloom tex coords
  37. // extra fxaa coords
  38. // {xy__} = upper left of pixel
  39. // {__zw} = lower right of pixel
  40. o.fxaaCoords.xyzw = PerformUVTransform_UpperLeftLowerRight( o.bloombaseCoords.xy ); // Compute upper left, lower right tex coords
  41. return o;
  42. }