pp_d3d9.hlsl 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Texture size to calculate texel center
  2. float2 TextureSize;
  3. // Vertex shader output struct
  4. struct VS_OUTPUT
  5. {
  6. float4 Position : POSITION0;
  7. float2 TexCoords : TEXCOORD0;
  8. };
  9. VS_OUTPUT vertexMain(
  10. float4 Position : POSITION0,
  11. float2 TexCoords : TEXCOORD0
  12. )
  13. {
  14. VS_OUTPUT OUT;
  15. OUT.Position = Position;
  16. // In practice, instead of passing in TextureSize,
  17. // pass 1.0 / TextureSize for better performance
  18. // TexCoords is set to the texel center
  19. OUT.TexCoords = TexCoords + 1.0 / TextureSize / 2.0;
  20. return OUT;
  21. }
  22. // Texture sampler
  23. sampler2D TextureSampler;
  24. float4 pixelMain ( float2 Texcoords : TEXCOORD0 ) : COLOR0
  25. {
  26. // Texture is sampled at Texcoords using tex2D
  27. float4 Color = tex2D(TextureSampler, Texcoords);
  28. // Change Texcoords to sample pixels around
  29. // Inverse the color to produce negative image effect
  30. Color.rgb = 1.0 - Color.rgb;
  31. return Color;
  32. };