#include "common.h" #include "mblur.h" #include "dof.h" /* struct v2p { float4 tc0: TEXCOORD0; // Center float4 tc1: TEXCOORD1; // LT float4 tc2: TEXCOORD2; // RB float4 tc3: TEXCOORD3; // RT float4 tc4: TEXCOORD4; // LB float4 tc5: TEXCOORD5; // Left / Right float4 tc6: TEXCOORD6; // Top / Bottom }; */ ////////////////////////////////////////////////////////////////////////////////////////// #ifndef USE_MSAA Texture2D s_distort; #define EPSDEPTH 0.001 #else Texture2DMS s_distort; #define EPSDEPTH 0.001 #endif uniform float4 e_barrier; // x=norm(.8f), y=depth(.1f), z=clr uniform float4 e_weights; // x=norm, y=depth, z=clr uniform float4 e_kernel; // x=norm, y=depth, z=clr ////////////////////////////////////////////////////////////////////////////////////////// // Pixel struct c2_out { float4 Color : SV_Target; #ifdef USE_MSAA float Depth : SV_Depth; #endif }; c2_out main( v2p_aa_AA I ) { c2_out res; res.Color = float4(0,0,0,0); /* #ifdef USE_MSAA [unroll] for( int iSample = 0; iSample < MSAA_SAMPLES; ++iSample ) { #else // USE_MSAA int iSample = 0; #endif */ int iSample = 0; #ifdef GBUFFER_OPTIMIZATION gbuffer_data gbd = gbuffer_load_data(I.Tex0, I.HPos, iSample ); #else gbuffer_data gbd = gbuffer_load_data(I.Tex0, iSample ); #endif #ifdef USE_DISTORT // float depth = tex2D (s_position, I.tc0).z; // float4 distort = tex2D (s_distort, I.tc0); float depth = gbd.P.z; #ifndef USE_MSAA float4 distort = s_distort.Sample(smp_nofilter, I.Tex0); #else // USE_MSAA float4 distort = s_distort.Load( int3( I.Tex0 * pos_decompression_params2.xy, 0 ), iSample ); #endif // USE_MSAA float2 offset = (distort.xy-(127.0h/255.0h))*def_distort; // fix newtral offset float2 center = I.Tex0 + offset; #ifdef GBUFFER_OPTIMIZATION gbuffer_data gbdx = gbuffer_load_data_offset(I.Tex0, center, I.HPos, iSample ); #else gbuffer_data gbdx = gbuffer_load_data_offset(I.Tex0, center, iSample); #endif // float depth_x = tex2D (s_position, center).z ; float depth_x = gbdx.P.z; if ((depth_x+EPSDEPTH)