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.

34 lines
1.2 KiB

  1. //======= Copyright � 1996-2006, Valve Corporation, All rights reserved. ======
  2. #include "common_ps_fxc.h"
  3. sampler TexSampler : register( s0 );
  4. sampler TexRed : register( s1 );
  5. sampler TexGreen : register( s2 );
  6. sampler TexBlue : register( s3 );
  7. float2 g_vPixelSize : register( c4 );
  8. struct PS_INPUT
  9. {
  10. float2 baseTexCoord : TEXCOORD0; // Base texture coordinate
  11. };
  12. float4 main( PS_INPUT i ) : COLOR
  13. {
  14. // Make outline 2 pixels wide $C0_X in a vmt doesn't seem to work in staging so I can't parameterize this right now
  15. float2 vOffset = 2.0f * g_vPixelSize.xy;
  16. // Take the max of 4 offset texture samples
  17. float4 result;
  18. result.rgba = tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, vOffset.y ) );
  19. result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, -vOffset.y ) ) );
  20. result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, vOffset.y ) ) );
  21. result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, -vOffset.y ) ) );
  22. // Store max color component in alpha for alpha blend of one/invSrcAlpha
  23. float flLuminance = max( result.r, max( result.g, result.b ) );
  24. result.a = flLuminance;
  25. return result.rgba;
  26. }