home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Riza / source / displaydx9_ps14.fxh < prev    next >
Encoding:
Text File  |  2009-09-14  |  3.9 KB  |  140 lines

  1. //    VirtualDub - Video processing and capture application
  2. //    A/V interface library
  3. //    Copyright (C) 1998-2008 Avery Lee
  4. //
  5. //    This program is free software; you can redistribute it and/or modify
  6. //    it under the terms of the GNU General Public License as published by
  7. //    the Free Software Foundation; either version 2 of the License, or
  8. //    (at your option) any later version.
  9. //
  10. //    This program is distributed in the hope that it will be useful,
  11. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. //    GNU General Public License for more details.
  14. //
  15. //    You should have received a copy of the GNU General Public License
  16. //    along with this program; if not, write to the Free Software
  17. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #ifndef DISPLAYDX9_PS14_FXH
  20. #define DISPLAYDX9_PS14_FXH
  21.  
  22. ////////////////////////////////////////////////////////////////////////////////////////////////////
  23. //
  24. //    Pixel shader 1.4 bicubic path - 5 texture stages, 2 passes (NVIDIA GeForceFX+, ATI RADEON 8500+)
  25. //
  26. ////////////////////////////////////////////////////////////////////////////////////////////////////
  27.  
  28. struct VertexOutputBicubic1_4 {
  29.     float4    pos        : POSITION;
  30.     float2    uvfilt    : TEXCOORD0;
  31.     float2    uvsrc0    : TEXCOORD1;
  32.     float2    uvsrc1    : TEXCOORD2;
  33.     float2    uvsrc2    : TEXCOORD3;
  34.     float2    uvsrc3    : TEXCOORD4;
  35. };
  36.  
  37. VertexOutputBicubic1_4 VertexShaderBicubic1_4A(VertexInput IN) {
  38.     VertexOutputBicubic1_4 OUT;
  39.     
  40.     OUT.pos = IN.pos;
  41.     OUT.uvfilt.x = IN.uv2.x * vd_vpsize.x * vd_interphtexsize.w;
  42.     OUT.uvfilt.y = 0;
  43.  
  44.     OUT.uvsrc0 = IN.uv + float2(-1.5f, vd_fieldinfo.y)*vd_texsize.wz;
  45.     OUT.uvsrc1 = IN.uv + float2( 0.0f, vd_fieldinfo.y)*vd_texsize.wz;
  46.     OUT.uvsrc2 = IN.uv + float2( 0.0f, vd_fieldinfo.y)*vd_texsize.wz;
  47.     OUT.uvsrc3 = IN.uv + float2(+1.5f, vd_fieldinfo.y)*vd_texsize.wz;
  48.     
  49.     return OUT;
  50. }
  51.  
  52. VertexOutputBicubic1_4 VertexShaderBicubic1_4B(VertexInput IN) {
  53.     VertexOutputBicubic1_4 OUT;
  54.     
  55.     OUT.pos = IN.pos;
  56.     OUT.uvfilt.x = IN.uv2.y * vd_vpsize.y * vd_interpvtexsize.w;
  57.     OUT.uvfilt.y = 0;
  58.     
  59.     float2 uv = IN.uv2 * float2(vd_vpsize.x, vd_srcsize.y) * vd_tempsize.wz;
  60.     OUT.uvsrc0 = uv + float2(0, -1.5f)*vd_tempsize.wz;
  61.     OUT.uvsrc1 = uv + float2(0,  0.0f)*vd_tempsize.wz;
  62.     OUT.uvsrc2 = uv + float2(0,  0.0f)*vd_tempsize.wz;
  63.     OUT.uvsrc3 = uv + float2(0, +1.5f)*vd_tempsize.wz;
  64.     
  65.     return OUT;
  66. }
  67.  
  68. pixelshader bicubic1_4_ps = asm {
  69.     ps_1_4
  70.     texld r0, t0
  71.     texld r1, t1
  72.     texld r2, t2
  73.     texld r3, t3
  74.     texld r4, t4
  75.     mad_x4 r2, r2, r0_bias.g, r2
  76.     mad r2, r1, -r0.b, r2
  77.     mad_d2 r2, r4, -r0.a, r2
  78.     mad_d2 r0, r3, r0.r, r2
  79. };
  80.  
  81. technique bicubic1_4 {
  82.     pass horiz <
  83.         string vd_target="temp";
  84.         string vd_viewport="out, src";
  85.     > {
  86.         VertexShader = compile vs_1_1 VertexShaderBicubic1_4A();
  87.         PixelShader = <bicubic1_4_ps>;
  88.         
  89.         Texture[0] = <vd_interphtexture>;
  90.         AddressU[0] = Wrap;
  91.         AddressV[0] = Clamp;
  92.         MipFilter[0] = None;
  93.         MinFilter[0] = Point;
  94.         MagFilter[0] = Point;
  95.  
  96.         Texture[1] = <vd_srctexture>;
  97.         AddressU[1] = Clamp;
  98.         AddressV[1] = Clamp;
  99.         MipFilter[1] = None;
  100.         MinFilter[1] = Point;
  101.         MagFilter[1] = Point;
  102.         
  103.         Texture[2] = <vd_srctexture>;
  104.         AddressU[2] = Clamp;
  105.         AddressV[2] = Clamp;
  106.         MipFilter[2] = None;
  107.         MinFilter[2] = Linear;
  108.         MagFilter[2] = Linear;
  109.         
  110.         Texture[3] = <vd_srctexture>;
  111.         AddressU[3] = Clamp;
  112.         AddressV[3] = Clamp;        
  113.         MipFilter[3] = None;
  114.         MinFilter[3] = Point;
  115.         MagFilter[3] = Point;
  116.         
  117.         Texture[4] = <vd_srctexture>;
  118.         AddressU[4] = Clamp;
  119.         AddressV[4] = Clamp;        
  120.         MipFilter[4] = None;
  121.         MinFilter[4] = Point;
  122.         MagFilter[4] = Point;
  123.     }
  124.     
  125.     pass vert <
  126.         string vd_target="";
  127.         string vd_viewport="out,out";
  128.     > {
  129.         VertexShader = compile vs_1_1 VertexShaderBicubic1_4B();
  130.         PixelShader = <bicubic1_4_ps>;
  131.         Texture[0] = <vd_interpvtexture>;
  132.         Texture[1] = <vd_temptexture>;
  133.         Texture[2] = <vd_temptexture>;
  134.         Texture[3] = <vd_temptexture>;
  135.         Texture[4] = <vd_temptexture>;
  136.     }
  137. }
  138.  
  139. #endif
  140.