diff --git a/res/gamedata/shaders/gl/accum_emissive.ps b/res/gamedata/shaders/gl/accum_emissive.ps index 8eab64c734f..19905ba2080 100644 Binary files a/res/gamedata/shaders/gl/accum_emissive.ps and b/res/gamedata/shaders/gl/accum_emissive.ps differ diff --git a/res/gamedata/shaders/gl/accum_emissivel.ps b/res/gamedata/shaders/gl/accum_emissivel.ps index cb676e36955..ab9fb8ec808 100644 Binary files a/res/gamedata/shaders/gl/accum_emissivel.ps and b/res/gamedata/shaders/gl/accum_emissivel.ps differ diff --git a/res/gamedata/shaders/gl/accum_indirect.ps b/res/gamedata/shaders/gl/accum_indirect.ps index b76b228080b..657313b11fe 100644 Binary files a/res/gamedata/shaders/gl/accum_indirect.ps and b/res/gamedata/shaders/gl/accum_indirect.ps differ diff --git a/res/gamedata/shaders/gl/accum_omni_unshadowed.ps b/res/gamedata/shaders/gl/accum_omni_unshadowed.ps index 790330d193b..cb7644dd6f7 100644 Binary files a/res/gamedata/shaders/gl/accum_omni_unshadowed.ps and b/res/gamedata/shaders/gl/accum_omni_unshadowed.ps differ diff --git a/res/gamedata/shaders/gl/accum_sun.ps b/res/gamedata/shaders/gl/accum_sun.ps index 6a1af3b9ed4..0046efe9e73 100644 Binary files a/res/gamedata/shaders/gl/accum_sun.ps and b/res/gamedata/shaders/gl/accum_sun.ps differ diff --git a/res/gamedata/shaders/gl/combine_2_naa.ps b/res/gamedata/shaders/gl/combine_2_naa.ps index 931c58262ba..2fe106ca4bb 100644 Binary files a/res/gamedata/shaders/gl/combine_2_naa.ps and b/res/gamedata/shaders/gl/combine_2_naa.ps differ diff --git a/res/gamedata/shaders/gl/common_functions.h b/res/gamedata/shaders/gl/common_functions.h index 77a315a0c5b..df8582cd7d7 100644 --- a/res/gamedata/shaders/gl/common_functions.h +++ b/res/gamedata/shaders/gl/common_functions.h @@ -95,7 +95,7 @@ float get_sun( float4 lmh) float3 v_hemi(float3 n) { - return L_hemi_color.rgb*(.5f + .5f*n.y); + return L_hemi_color.rgb*(0.5 + 0.5*n.y); } float3 v_sun(float3 n) @@ -155,8 +155,8 @@ float2 gbuf_pack_normal( float3 norm ) float2 res; res.x = norm.z; - res.y = 0.5f * ( norm.x + 1.0f ) ; - res.y *= ( norm.y < 0.0f ? -1.0f : 1.0f ); + res.y = 0.5 * ( norm.x + 1.0 ) ; + res.y *= ( norm.y < 0.0 ? -1.0 : 1.0 ); return res; } @@ -166,7 +166,7 @@ float3 gbuf_unpack_normal( float2 norm ) float3 res; res.z = norm.x; - res.x = ( 2.0f * abs( norm.y ) ) - 1.0f; + res.x = ( 2.0 * abs( norm.y ) ) - 1.0; res.y = ( norm.y < 0 ? -1.0 : 1.0 ) * sqrt( abs( 1 - res.x * res.x - res.z * res.z ) ); return res; diff --git a/res/gamedata/shaders/gl/deffer_detail_s_flat.vs b/res/gamedata/shaders/gl/deffer_detail_s_flat.vs index c0c38e4b367..59adaa0a086 100644 --- a/res/gamedata/shaders/gl/deffer_detail_s_flat.vs +++ b/res/gamedata/shaders/gl/deffer_detail_s_flat.vs @@ -28,7 +28,7 @@ v2p_flat _main (v_detail v) // Normal in world coords float3 norm; norm.x = pos.x - m0.w ; - norm.y = pos.y - m1.w + .75f; // avoid zero + norm.y = pos.y - m1.w + 0.75; // avoid zero norm.z = pos.z - m2.w ; // Final out diff --git a/res/gamedata/shaders/gl/deffer_detail_w_flat.vs b/res/gamedata/shaders/gl/deffer_detail_w_flat.vs index dfd18cad95a..fab5e99eb8a 100644 --- a/res/gamedata/shaders/gl/deffer_detail_w_flat.vs +++ b/res/gamedata/shaders/gl/deffer_detail_w_flat.vs @@ -39,7 +39,7 @@ v2p_flat _main (v_detail v) // Normal in world coords float3 norm; // = float3(0,1,0); norm.x = pos.x - m0.w ; - norm.y = pos.y - m1.w + .75f; // avoid zero + norm.y = pos.y - m1.w + 0.75; // avoid zero norm.z = pos.z - m2.w ; // Final out diff --git a/res/gamedata/shaders/gl/distort.ps b/res/gamedata/shaders/gl/distort.ps index b76a37def07..0c3cf43120f 100644 Binary files a/res/gamedata/shaders/gl/distort.ps and b/res/gamedata/shaders/gl/distort.ps differ diff --git a/res/gamedata/shaders/gl/fxaa_main.ps b/res/gamedata/shaders/gl/fxaa_main.ps index 78d5283d5de..cd2f6567276 100644 Binary files a/res/gamedata/shaders/gl/fxaa_main.ps and b/res/gamedata/shaders/gl/fxaa_main.ps differ diff --git a/res/gamedata/shaders/gl/gather.ps b/res/gamedata/shaders/gl/gather.ps index e808ee4d620..bb8e06e4fd9 100644 Binary files a/res/gamedata/shaders/gl/gather.ps and b/res/gamedata/shaders/gl/gather.ps differ diff --git a/res/gamedata/shaders/gl/hud_crosshair.vs b/res/gamedata/shaders/gl/hud_crosshair.vs index 56b4cb5cfcb..4d478216ba5 100644 --- a/res/gamedata/shaders/gl/hud_crosshair.vs +++ b/res/gamedata/shaders/gl/hud_crosshair.vs @@ -11,11 +11,11 @@ v2p_TL0uv _main ( v_TL0uv I ) v2p_TL0uv O; { - I.P.xy += 0.5f; -// O.HPos.x = I.P.x/1024 * 2 - 1; -// O.HPos.y = (I.P.y/768 * 2 - 1)*-1; - O.HPos.x = I.P.x * screen_res.z * 2 - 1; - O.HPos.y = (I.P.y * screen_res.w * 2 - 1)*-1; + I.P.xy += 0.5; +// O.HPos.x = I.P.x/1024.0 * 2.0 - 1.0; +// O.HPos.y = (I.P.y/768.0 * 2.0 - 1.0) * -1.0; + O.HPos.x = I.P.x * screen_res.z * 2.0 - 1.0; + O.HPos.y = (I.P.y * screen_res.w * 2.0 - 1.0) * -1.0; O.HPos.zw = I.P.zw; } diff --git a/res/gamedata/shaders/gl/lod.ps b/res/gamedata/shaders/gl/lod.ps index ac7888aad7b..34deb1ce2b1 100644 Binary files a/res/gamedata/shaders/gl/lod.ps and b/res/gamedata/shaders/gl/lod.ps differ diff --git a/res/gamedata/shaders/gl/lod.vs b/res/gamedata/shaders/gl/lod.vs index 0109be86448..43c16249c36 100644 --- a/res/gamedata/shaders/gl/lod.vs +++ b/res/gamedata/shaders/gl/lod.vs @@ -1,7 +1,7 @@ #include "common.h" #include "iostructs\v_lod.h" -#define L_SCALE (2.0f*1.55f) +#define L_SCALE (2.0*1.55) v2p _main ( v_lod I ) { v2p o; @@ -12,7 +12,7 @@ v2p _main ( v_lod I ) // lerp pos float factor = I.sun_af.w; - float4 pos = float4 (lerp(I.pos0,I.pos1,factor), 1.f); + float4 pos = float4 (lerp(I.pos0,I.pos1,factor), 1.0); float h = lerp (I.rgbh0.w,I.rgbh1.w,factor)*L_SCALE; @@ -24,7 +24,7 @@ v2p _main ( v_lod I ) o.tc1 = I.tc1; // calc normal & lighting - o.af = float4 (h,h,I.sun_af.z,factor); + o.af = float4 (h, h, I.sun_af.z, factor); return o; } diff --git a/res/gamedata/shaders/gl/model_distort4glass.vs b/res/gamedata/shaders/gl/model_distort4glass.vs index 84856055452..2f81223a205 100644 --- a/res/gamedata/shaders/gl/model_distort4glass.vs +++ b/res/gamedata/shaders/gl/model_distort4glass.vs @@ -12,7 +12,7 @@ vf _main (v_model v) // calculate fade float3 dir_v = normalize (mul(m_WV,v.P)); float3 norm_v = normalize (mul(m_WV,v.N)); - float fade = 0.9f*abs (dot(dir_v,norm_v)); + float fade = 0.9*abs (dot(dir_v,norm_v)); o.c0 = float4 (fade); return o; diff --git a/res/gamedata/shaders/gl/particle.ps b/res/gamedata/shaders/gl/particle.ps index 5330d992fbb..c8adae970ec 100644 Binary files a/res/gamedata/shaders/gl/particle.ps and b/res/gamedata/shaders/gl/particle.ps differ diff --git a/res/gamedata/shaders/gl/postprocess.ps b/res/gamedata/shaders/gl/postprocess.ps index b81e42607dd..8164bd1e4ad 100644 Binary files a/res/gamedata/shaders/gl/postprocess.ps and b/res/gamedata/shaders/gl/postprocess.ps differ diff --git a/res/gamedata/shaders/gl/shadow.h b/res/gamedata/shaders/gl/shadow.h index 75271fce61d..8eec580cd0a 100644 --- a/res/gamedata/shaders/gl/shadow.h +++ b/res/gamedata/shaders/gl/shadow.h @@ -24,9 +24,9 @@ Texture2D jitter1; Texture2D jitterMipped; #ifndef USE_ULTRA_SHADOWS -#define KERNEL 0.6f +#define KERNEL 0.6 #else -#define KERNEL 1.0f +#define KERNEL 1.0 #endif float modify_light( float light ) @@ -105,9 +105,9 @@ const float W0[11][11] = float Fw( int r, int c, float fL ) { return (1.0-fL) * (1.0-fL) * (1.0-fL) * W0[r][c] + - 3.0f * (1.0-fL) * (1.0-fL) * fL * W1[r][c] + - 3.0f * fL * fL * (1.0-fL) * W2[r][c] + - fL * fL * fL * 1.0f; + 3.0 * (1.0-fL) * (1.0-fL) * fL * W1[r][c] + + 3.0 * fL * fL * (1.0-fL) * W2[r][c] + + fL * fL * fL * 1.0; } #define BLOCKER_FILTER_SIZE 11 @@ -119,8 +119,8 @@ float Fw( int r, int c, float fL ) // uses gather for DX11/10.1 and visibilty encoding for DX10.0 float shadow_extreme_quality( float3 tc ) { - float s = 0.0f; - float2 stc = ( SMAP_size * tc.xy ) + float2( 0.5, 0.5 ); + float s = 0.0; + float2 stc = ( float( SMAP_size ) * tc.xy ) + float2( 0.5, 0.5 ); float2 tcs = floor( stc ); float2 fc; int row; @@ -134,8 +134,8 @@ float shadow_extreme_quality( float3 tc ) float2 off; fc = stc - tcs; - tc.xy = tc.xy - ( (1.0f/SMAP_size) * fc ); - tc.z -= 0.0001f; + tc.xy = tc.xy - ( 1.0 / float( SMAP_size ) * fc ); + tc.z -= 0.0001; #if defined(SM_4_1) || defined( SM_5) // find number of blockers and sum up blocker depth @@ -144,9 +144,9 @@ float shadow_extreme_quality( float3 tc ) for( col = -BFS2; col <= BFS2; col += 2 ) { float4 d4 = textureGatherOffset( s_smap, tc.xy, int2( col, row ) ); - float4 b4 = ( tc.zzzz <= d4 ) ? (0.0f).xxxx : (1.0f).xxxx; + float4 b4 = ( tc.zzzz <= d4 ) ? (0.0).xxxx : (1.0).xxxx; - blockerCount += dot( b4, (1.0f).xxxx ); + blockerCount += dot( b4, (1.0).xxxx ); avgBlockerDepth += dot( d4, b4 ); } } @@ -164,26 +164,26 @@ float shadow_extreme_quality( float3 tc ) float b; d4.w = textureLodOffset (s_dmap, tc.xy, 0, int2( col, row ) ).x; - b = ( tc.z <= d4.w ) ? (0.0f) : (1.0f); + b = ( tc.z <= d4.w ) ? (0.0) : (1.0); vmask[ col + FS2 + 0 ] += ( ( tc.z <= d4.w ) ? ( uint(1) << uint( row + FS2 + 0 ) ) : uint(0) ); blockerCount += b; avgBlockerDepth += d4.w * b; d4.z = textureLodOffset (s_dmap, tc.xy, 0, int2( col+1, row ) ).x; - b = ( tc.z <= d4.z ) ? (0.0f) : (1.0f); + b = ( tc.z <= d4.z ) ? (0.0) : (1.0); vmask[ col + FS2 + 1 ] += ( ( tc.z <= d4.z ) ? ( uint(1) << uint( row + FS2 + 0 ) ) : uint(0) ); blockerCount += b; avgBlockerDepth += d4.z * b; d4.x = textureLodOffset (s_dmap, tc.xy, 0, int2( col, row+1 ) ).x; vmask[ col + FS2 + 0 ] += ( ( tc.z <= d4.x ) ? ( uint(1) << uint( row + FS2 + 1 ) ) : uint(0) ); - b = ( tc.z <= d4.x ) ? (0.0f) : (1.0f); + b = ( tc.z <= d4.x ) ? (0.0) : (1.0); blockerCount += b; avgBlockerDepth += d4.x * b; d4.y = textureLodOffset (s_dmap, tc.xy, 0, int2( col+1, row+1 ) ).x; vmask[ col + FS2 + 1 ] += ( ( tc.z <= d4.y ) ? ( uint(1) << uint( row + FS2 + 1 ) ) : uint(0) ); - b = ( tc.z <= d4.y ) ? (0.0f) : (1.0f); + b = ( tc.z <= d4.y ) ? (0.0) : (1.0); blockerCount += b; avgBlockerDepth += d4.y * b; } @@ -217,10 +217,10 @@ float shadow_extreme_quality( float3 tc ) v1[(col+FS2)/2] = textureGatherOffset (s_smap, tc.xy, tc.z, int2( col, row ) ); #else - v1[(col+FS2)/2].w = ( ( vmask[ col + FS2 + 0 ] & ( uint(1) << uint( row + FS2 + 0 ) ) ) ? 1.0f : 0.0f ); - v1[(col+FS2)/2].z = ( ( vmask[ col + FS2 + 1 ] & ( uint(1) << uint( row + FS2 + 0 ) ) ) ? 1.0f : 0.0f ); - v1[(col+FS2)/2].x = ( ( vmask[ col + FS2 + 0 ] & ( uint(1) << uint( row + FS2 + 1 ) ) ) ? 1.0f : 0.0f ); - v1[(col+FS2)/2].y = ( ( vmask[ col + FS2 + 1 ] & ( uint(1) << uint( row + FS2 + 1 ) ) ) ? 1.0f : 0.0f ); + v1[(col+FS2)/2].w = ( ( vmask[ col + FS2 + 0 ] & ( uint(1) << uint( row + FS2 + 0 ) ) ) ? 1.0 : 0.0 ); + v1[(col+FS2)/2].z = ( ( vmask[ col + FS2 + 1 ] & ( uint(1) << uint( row + FS2 + 0 ) ) ) ? 1.0 : 0.0 ); + v1[(col+FS2)/2].x = ( ( vmask[ col + FS2 + 0 ] & ( uint(1) << uint( row + FS2 + 1 ) ) ) ? 1.0 : 0.0 ); + v1[(col+FS2)/2].y = ( ( vmask[ col + FS2 + 1 ] & ( uint(1) << uint( row + FS2 + 1 ) ) ) ? 1.0 : 0.0 ); #endif if( col == -FS2 ) { @@ -266,7 +266,7 @@ float shadow_extreme_quality( float3 tc ) float4 Fw( int r, int c ) { - return float4( W0[r][c], W1[r][c], W2[r][c], 1.0f ); + return float4( W0[r][c], W1[r][c], W2[r][c], 1.0 ); } //====================================================================================== @@ -274,8 +274,8 @@ float4 Fw( int r, int c ) //====================================================================================== float shadow_extreme_quality_fused( float3 tc ) { - float4 s = (0.0f).xxxx; - float2 stc = ( SMAP_size * tc.xy ) + float2( 0.5, 0.5 ); + float4 s = (0.0).xxxx; + float2 stc = ( float(SMAP_size) * tc.xy ) + float2( 0.5, 0.5 ); float2 tcs = floor( stc ); float2 fc; int row; @@ -289,7 +289,7 @@ float shadow_extreme_quality_fused( float3 tc ) float2 off; fc = stc - tcs; - tc.xy = tc.xy - ( fc * (1.0f/SMAP_size) ); + tc.xy = tc.xy - ( fc * (1.0/float(SMAP_size)) ); // filter shadow map samples using the dynamic weights for( row = -FS2; row <= FS2; row += 2 ) @@ -299,16 +299,16 @@ float shadow_extreme_quality_fused( float3 tc ) float4 d4; #ifndef PS_4 - d4 = textureGather( s_dmap, tc.xy + (1.0f/SMAP_size) * float2( col, row ) ); + d4 = textureGather( s_dmap, tc.xy + (1.0/float(SMAP_size)) * float2( col, row ) ); #else - d4.w = textureLod( s_dmap, tc.xy + (1.0f/SMAP_size) * float2( col, row ), 0 ).x; - d4.z = textureLod( s_dmap, tc.xy + (1.0f/SMAP_size) * float2( col+1, row ) , 0 ).x; - d4.y = textureLod( s_dmap, tc.xy + (1.0f/SMAP_size) * float2( col+1, row+1 ), 0 ).x; - d4.x = textureLod( s_dmap, tc.xy + (1.0f/SMAP_size) * float2( col, row+1 ), 0 ).x; + d4.w = textureLod( s_dmap, tc.xy + (1.0/float(SMAP_size)) * float2( col, row ), 0 ).x; + d4.z = textureLod( s_dmap, tc.xy + (1.0/float(SMAP_size)) * float2( col+1, row ) , 0 ).x; + d4.y = textureLod( s_dmap, tc.xy + (1.0/float(SMAP_size)) * float2( col+1, row+1 ), 0 ).x; + d4.x = textureLod( s_dmap, tc.xy + (1.0/float(SMAP_size)) * float2( col, row+1 ), 0 ).x; #endif - float4 b4 = ( tc.zzzz <= d4 ) ? (0.0f).xxxx : (1.0f).xxxx; + float4 b4 = ( tc.zzzz <= d4 ) ? (0.0).xxxx : (1.0).xxxx; - v1[(col+FS2)/2] = ( tc.zzzz <= d4 ) ? (1.0f).xxxx : (0.0f).xxxx; + v1[(col+FS2)/2] = ( tc.zzzz <= d4 ) ? (1.0).xxxx : (0.0).xxxx; blockerCount += dot( b4, (1.0).xxxx ); avgBlockerDepth += dot( d4, b4 ); @@ -429,9 +429,9 @@ float shadow_extreme_quality_fused( float3 tc ) } } - return dot(s, float4((1.0f-fRatio)*(1.0f-fRatio)*(1.0f-fRatio), - 3.0f * (1.0-fRatio)*(1.0-fRatio)*fRatio, - 3.0f * fRatio*fRatio*(1.0-fRatio), + return dot(s, float4((1.0-fRatio)*(1.0-fRatio)*(1.0-fRatio), + 3.0 * (1.0-fRatio)*(1.0-fRatio)*fRatio, + 3.0 * fRatio*fRatio*(1.0-fRatio), fRatio*fRatio*fRatio ) )/w; } #endif @@ -440,15 +440,15 @@ float shadow_extreme_quality_fused( float3 tc ) float dx10_1_hw_hq_7x7( float3 tc ) { - float s = 0.0f; - float2 stc = ( SMAP_size * tc.xy ) + float2( 0.5, 0.5 ); + float s = 0.0; + float2 stc = ( float(SMAP_size) * tc.xy ) + float2( 0.5, 0.5 ); float2 tcs = floor( stc ); float2 fc; int row; int col; fc.xy = stc - tcs; - tc.xy = tcs * ( 1.0 / SMAP_size ); + tc.xy = tcs * ( 1.0 / float(SMAP_size) ); // loop over the rows for( row = -GS2; row <= GS2; row += 2 ) @@ -462,7 +462,7 @@ float dx10_1_hw_hq_7x7( float3 tc ) if( col == -GS2 ) // left s += dot( float4( 1.0-fc.x, 1.0, 1.0-fc.y, (1.0-fc.x)*(1.0-fc.y) ), v ); else if( col == GS2 ) // right - s += dot( float4( 1.0f, fc.x, fc.x*(1.0-fc.y), 1.0-fc.y ), v ); + s += dot( float4( 1.0, fc.x, fc.x*(1.0-fc.y), 1.0-fc.y ), v ); else // center s += dot( float4( 1.0, 1.0, 1.0-fc.y, 1.0-fc.y ), v ); } @@ -502,13 +502,13 @@ float dx10_0_hw_hq_7x7( float4 tc ) float2 fc; fc = stc - tcs; - tc.xy = tc.xy - ( fc * ( 1.0/SMAP_size ) ); + tc.xy = tc.xy - ( fc * ( 1.0/float(SMAP_size) ) ); float2 pwAB = ( float2( 2.0 ) - fc ); - float2 tcAB = float2( 1.0/SMAP_size ) / pwAB; - float2 tcM = float2(0.5/SMAP_size ); + float2 tcAB = float2( 1.0/float(SMAP_size) ) / pwAB; + float2 tcM = float2(0.5/float(SMAP_size) ); float2 pwGH = ( float2( 1.0 ) + fc ); - float2 tcGH = (1.0/SMAP_size) * ( fc / pwGH ); + float2 tcGH = (1.0/float(SMAP_size)) * ( fc / pwGH ); // top row s += ( pwAB.x * pwAB.y ) * textureOffset( s_smap, float3(tc.xy + tcAB, tc.z), int2( -3, -3 ) ); // left @@ -542,11 +542,11 @@ bool cheap_reject( float3 tc, inout bool full_light ) float4 plane1 = sm_minmax_gather( tc.xy, int2( 1,-1 ) ); float4 plane2 = sm_minmax_gather( tc.xy, int2( -1, 1 ) ); float4 plane3 = sm_minmax_gather( tc.xy, int2( 1, 1 ) ); - bool plane = all( greaterThanEqual( plane0, float4(0) )) && all(greaterThanEqual( plane1, float4(0) )) && all(greaterThanEqual( plane2, float4(0) )) && all(greaterThanEqual( plane3, float4(0) ) ); + bool plane = all( greaterThanEqual( plane0, float4(0.0) )) && all(greaterThanEqual( plane1, float4(0.0) )) && all(greaterThanEqual( plane2, float4(0.0) )) && all(greaterThanEqual( plane3, float4(0.0) ) ); if( !plane ) // if there are no proper plane equations in the support region { - bool no_plane = all(lessThan( plane0, float4(0) )) && all(lessThan( plane1, float4(0) )) && all(lessThan( plane2, float4(0) )) && all(lessThan( plane3, float4(0) ) ); + bool no_plane = all(lessThan( plane0, float4(0.0) )) && all(lessThan( plane1, float4(0.0) )) && all(lessThan( plane2, float4(0.0) )) && all(lessThan( plane3, float4(0.0) ) ); float4 z = float4( tc.z - 0.0005 ); bool reject = all( greaterThan( z, -plane0 )) && all(greaterThan( z, -plane1 )) && all(greaterThan( z, -plane2 )) && all(greaterThan( z, -plane3 ) ); if( no_plane && reject ) @@ -562,7 +562,7 @@ bool cheap_reject( float3 tc, inout bool full_light ) else // plane equation detected { // compute corrected z for texel pos - const float scale = float( SMAP_size / 4 ); + const float scale = float( SMAP_size ) / 4.0; float2 fc = frac( tc.xy * scale ); float z = lerp( lerp( plane0.y, plane1.x, fc.x ), lerp( plane2.z, plane3.w, fc.x ), fc.y ); @@ -586,7 +586,7 @@ float shadow_hw_hq( float4 tc ) if( full_light == true ) return 1.0; else - return sample_hw_pcf( tc, float4(0) ); + return sample_hw_pcf( tc, float4(0.0) ); } else { @@ -628,18 +628,18 @@ float4 test (float4 tc, float2 offset) { half4 r; - const float scale = (0.5f/float(SMAP_size)); + const float scale = (0.5/float(SMAP_size)); - float texsize = 2*SMAP_size; - float2 tc_J = tc.xy/tc.w*texsize/8.0f; - float2 fr = frac(tc_J)*.5f; + float texsize = 2.0*SMAP_size; + float2 tc_J = tc.xy/tc.w*texsize/8.0; + float2 fr = frac(tc_J)*0.5; // half4 J0 = tex2D (jitter0,fr)*scale; // half4 J1 = tex2D (jitter1,fr)*scale*2; float4 J0 = jitter0.Sample( smp_jitter, fr )*scale; // float4 J1 = jitter1.Sample( smp_jitter, fr )*scale; - float k = 0.99f/float(SMAP_size); + float k = 0.99/float(SMAP_size); r.x = test (tc,J0.xy+float2(-k,-k)).x; r.y = test (tc,J0.wz+float2( k,-k)).y; @@ -647,7 +647,7 @@ float4 test (float4 tc, float2 offset) r.w = test (tc,J0.wz+float2( k, k)).x; half4 f; - float k1 = 1.5f/float(SMAP_size); + float k1 = 1.5/float(SMAP_size); f.x = test (tc,-J0.xy+float2(-k1,0)).x; f.y = test (tc,-J0.wz+float2( 0,-k1)).y; @@ -661,15 +661,15 @@ half shadowtest_sun (float4 tc, float4 tcJ) // jittered sampling { half4 r; - // const float scale = (2.0f/float(SMAP_size)); - const float scale = (0.7f/float(SMAP_size)); + // const float scale = (2.0/float(SMAP_size)); + const float scale = (0.7/float(SMAP_size)); - float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0f )*.5f; + float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0 )*0.5; float4 J0 = tex2D (jitter0,tc_J)*scale; //half4 J1 = tex2D (jitter1,tc_J)*scale; - const float k = .5f/float(SMAP_size); + const float k = 0.5/float(SMAP_size); r.x = test (tc, J0.xy+half2(-k,-k)).x; r.y = test (tc, J0.wz+half2( k,-k)).y; r.z = test (tc,-J0.xy+half2(-k, k)).z; @@ -681,9 +681,9 @@ half shadowtest_sun (float4 tc, float4 tcJ) // jittered sampling half shadow_high (float4 tc) // jittered sampling { - const float scale = (0.5f/float(SMAP_size)); + const float scale = (0.5/float(SMAP_size)); - float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0f )*.5f; + float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0 )*0.5; float4 J0 = tex2D (jitter0,tc_J)*scale; const float k = 1.0/float(SMAP_size); @@ -695,7 +695,7 @@ half shadow_high (float4 tc) // jittered sampling r.w = test (tc,J0.wz+half2( k, k)).x; - const float k1 = 1.3f/float(SMAP_size); + const float k1 = 1.3/float(SMAP_size); half4 r1; r1.x = test (tc,-J0.xy+half2(-k1,0)).x; r1.y = test (tc,-J0.wz+half2( 0,-k1)).y; @@ -769,7 +769,7 @@ float shadowtest (float4 tc, float4 tcJ) // jittered sampling { float4 r; - const float scale = (2.7f/float(SMAP_size)); + const float scale = (2.7/float(SMAP_size)); float4 J0 = tex2Dproj (jitter0,tcJ)*scale; float4 J1 = tex2Dproj (jitter1,tcJ)*scale; @@ -786,7 +786,7 @@ float shadow_rain (float4 tc, float2 tcJ) // jittered sampling { float4 r; - const float scale = (4.0f/float(SMAP_size)); + const float scale = (4.0/float(SMAP_size)); // float4 J0 = jitter0.Sample( smp_jitter, tcJ )*scale; // float4 J1 = jitter1.Sample( smp_jitter, tcJ )*scale; float4 J0 = tex2D( jitter0, tcJ )*scale; diff --git a/res/gamedata/shaders/gl/shared/cloudconfig.h b/res/gamedata/shaders/gl/shared/cloudconfig.h index e2e3b43ee92..22d69e94a48 100644 --- a/res/gamedata/shaders/gl/shared/cloudconfig.h +++ b/res/gamedata/shaders/gl/shared/cloudconfig.h @@ -2,10 +2,10 @@ #define _CLOUDCONFIG_H // note: timers has resolution (sec), where x=1, y=10, z=1/10, -#define CLOUD_TILE0 (0.7f) -#define CLOUD_SPEED0 (2*0.05)//(0.033f) -#define CLOUD_TILE1 (2.8)//(2.5f) -#define CLOUD_SPEED1 (2*0.025)//(0.033f) -#define CLOUD_FADE (0.5) +#define CLOUD_TILE0 (0.7) +#define CLOUD_SPEED0 (2*0.05) //(0.033) +#define CLOUD_TILE1 (2.8) //(2.5) +#define CLOUD_SPEED1 (2*0.025) //(0.033) +#define CLOUD_FADE (0.5) #endif diff --git a/res/gamedata/shaders/gl/shared/waterconfig.h b/res/gamedata/shaders/gl/shared/waterconfig.h index 2b6aa0cdf2b..5f83a17d0aa 100644 --- a/res/gamedata/shaders/gl/shared/waterconfig.h +++ b/res/gamedata/shaders/gl/shared/waterconfig.h @@ -5,13 +5,13 @@ //waterdistortion //waterdistortion2 -#define W_POSITION_SHIFT_HEIGHT (1.0/60.0) //(1.f/100.f) //amplitude /50 - small, /10 - large -#define W_POSITION_SHIFT_SPEED (25.0) //(25.0f) -#define W_DISTORT_BASE_TILE_0 (1.0) //(1.0f) -#define W_DISTORT_BASE_TILE_1 (1.1) //(1.1f) -#define W_DISTORT_AMP_0 (+0.15) //(+0.15f) -#define W_DISTORT_AMP_1 (+0.55) //(-0.30f) -#define W_DISTORT_POWER (1.0) //(1.0f) +#define W_POSITION_SHIFT_HEIGHT (1.0/60.0) //(1.0/100.0) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (25.0) //(25.0) +#define W_DISTORT_BASE_TILE_0 (1.0) //(1.0) +#define W_DISTORT_BASE_TILE_1 (1.1) //(1.1) +#define W_DISTORT_AMP_0 (+0.15) //(+0.15) +#define W_DISTORT_AMP_1 (+0.55) //(-0.30) +#define W_DISTORT_POWER (1.0) //(1.0) #endif @@ -24,33 +24,33 @@ waterdistortion waterdistortion2 //////////////////////////////////////////////////////////////////////////////// -#define W_POSITION_SHIFT_HEIGHT (1.0/50.0) //(1.f/100.f) //amplitude /50 - small, /10 - large -#define W_POSITION_SHIFT_SPEED (15.0) //(25.0f) -#define W_DISTORT_BASE_TILE_0 (1.3) //(1.6f) -#define W_DISTORT_BASE_TILE_1 (2.3) //(1.1f) -#define W_DISTORT_AMP_0 (+0.35) //(+0.15f) -#define W_DISTORT_AMP_1 (-1.75) //(-0.30f) -#define W_DISTORT_POWER (1.0) //(1.0f) +#define W_POSITION_SHIFT_HEIGHT (1.0/50.0) //(1.0/100.0) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (15.0) //(25.0) +#define W_DISTORT_BASE_TILE_0 (1.3) //(1.6) +#define W_DISTORT_BASE_TILE_1 (2.3) //(1.1) +#define W_DISTORT_AMP_0 (+0.35) //(+0.15) +#define W_DISTORT_AMP_1 (-1.75) //(-0.30) +#define W_DISTORT_POWER (1.0) //(1.0) //////////////////////////////////////////////////////////////////////////////// настройки для: waterdistortion waterdistortion //////////////////////////////////////////////////////////////////////////////// -#define W_POSITION_SHIFT_HEIGHT (1.0/80.0) //(1.f/100.f) //amplitude /50 - small, /10 - large -#define W_POSITION_SHIFT_SPEED (20.0) //(25.0f) -#define W_DISTORT_BASE_TILE_0 (1.6) //(1.6f) -#define W_DISTORT_BASE_TILE_1 (1.1) //(1.1f) -#define W_DISTORT_AMP_0 (+0.15) //(+0.15f) -#define W_DISTORT_AMP_1 (-0.30) //(-0.30f) -#define W_DISTORT_POWER (6.0) //(6.0f) +#define W_POSITION_SHIFT_HEIGHT (1.0/80.0) //(1.0/100.0) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (20.0) //(25.0) +#define W_DISTORT_BASE_TILE_0 (1.6) //(1.6) +#define W_DISTORT_BASE_TILE_1 (1.1) //(1.1) +#define W_DISTORT_AMP_0 (+0.15) //(+0.15) +#define W_DISTORT_AMP_1 (-0.30) //(-0.30) +#define W_DISTORT_POWER (6.0) //(6.0) //////////////////////////////////////////////////////////////////////////////// -- waters mulyaka //////////////////////////////////////////////////////////////////////////////// #define W_POSITION_SHIFT_HEIGHT (1.0/50.0) // amplitude /50 - small, /10 - large #define W_POSITION_SHIFT_SPEED (25.0) -#define W_DISTORT_BASE_TILE (0.1) //(1.0f) -#define W_DISTORT_AMP_0 (+0.58) //(-0.08f) -#define W_DISTORT_AMP_1 (+0.38) //(+0.18f) -#define W_DISTORT_POWER (3.0) //(2.0f) +#define W_DISTORT_BASE_TILE (0.1) //(1.0) +#define W_DISTORT_AMP_0 (+0.58) //(-0.08) +#define W_DISTORT_AMP_1 (+0.38) //(+0.18) +#define W_DISTORT_POWER (3.0) //(2.0) //////////////////////////////////////////////////////////////////////////////// */ diff --git a/res/gamedata/shaders/gl/shared/watermove.h b/res/gamedata/shaders/gl/shared/watermove.h index ff74528959f..8ce054db13d 100644 --- a/res/gamedata/shaders/gl/shared/watermove.h +++ b/res/gamedata/shaders/gl/shared/watermove.h @@ -2,13 +2,13 @@ #define _WATERMOVE_H float4 watermove (float4 P) { - float3 wave1 = float3(0.11f,0.13f,0.07f)*W_POSITION_SHIFT_SPEED ; + float3 wave1 = float3(0.11, 0.13, 0.07)*W_POSITION_SHIFT_SPEED ; float dh = sin (timers.x+dot(P.xyz,wave1)) ; P.y += dh * W_POSITION_SHIFT_HEIGHT ; return P ; } float2 watermove_tc (float2 base, float2 P, float amp) { - float2 wave1 = float2 (0.2111f,0.2333f)*amp ; + float2 wave1 = float2 (0.2111,0.2333)*amp ; float angle = timers.z + dot (P,wave1) ; float du = sin (angle); float dv = cos (angle); @@ -18,7 +18,7 @@ float2 watermove_tc (float2 base, float2 P, float amp) { float3 waterrefl (out float amount, float3 P, float3 N) { float3 v2point = normalize (P-eye_position); float3 vreflect= reflect (v2point, N); - float fresnel = (.5f + .5f*dot(vreflect,v2point)); + float fresnel = (0.5 + 0.5*dot(vreflect,v2point)); amount = 1 - fresnel*fresnel; // 0=full env, 1=no env return vreflect; } diff --git a/res/gamedata/shaders/gl/sload.h b/res/gamedata/shaders/gl/sload.h index 029f2ae06a6..adb4f53e9f4 100644 --- a/res/gamedata/shaders/gl/sload.h +++ b/res/gamedata/shaders/gl/sload.h @@ -35,8 +35,8 @@ float4 tbase( float2 tc ) #if defined(ALLOW_STEEPPARALLAX) && defined(USE_STEEPPARALLAX) -const float fParallaxStartFade = 8.0f; -const float fParallaxStopFade = 12.0f; +const float fParallaxStartFade = 8.0; +const float fParallaxStopFade = 12.0; void UpdateTC( inout p_bumped I ) { @@ -141,7 +141,7 @@ surface_bumped sload_i( p_bumped I) float4 NuE = tex2D( s_bumpX, I.tcdh); // IN: normal_error.height S.base = tbase(I.tcdh); // IN: rgb.a - S.normal = Nu.wzy + (NuE.xyz - 1.0f); // (Nu.wzyx - .5f) + (E-.5) + S.normal = Nu.wzy + (NuE.xyz - 1.0); // (Nu.wzyx - .5f) + (E-.5) S.gloss = Nu.x*Nu.x; // S.gloss = Nu.x*Nu.x; S.height = NuE.z; //S.height = 0; @@ -150,9 +150,9 @@ surface_bumped sload_i( p_bumped I) #ifdef USE_TDETAIL_BUMP float4 NDetail = tex2D( s_detailBump, I.tcdbump); float4 NDetailX = tex2D( s_detailBumpX, I.tcdbump); - S.gloss = S.gloss * NDetail.x * 2; - //S.normal += NDetail.wzy-.5; - S.normal += NDetail.wzy + NDetailX.xyz - 1.0f; // (Nu.wzyx - .5f) + (E-.5) + S.gloss = S.gloss * NDetail.x * 2.0; + //S.normal += NDetail.wzy-0.5; + S.normal += NDetail.wzy + NDetailX.xyz - 1.0; // (Nu.wzyx - 0.5) + (E-0.5) float4 detail = tex2D( s_detail, I.tcdbump); S.base.rgb = S.base.rgb * detail.rgb * 2; @@ -160,8 +160,8 @@ surface_bumped sload_i( p_bumped I) // S.base.rgb = float3(1,0,0); #else // USE_TDETAIL_BUMP float4 detail = tex2D( s_detail, I.tcdbump); - S.base.rgb = S.base.rgb * detail.rgb * 2; - S.gloss = S.gloss * detail.w * 2; + S.base.rgb = S.base.rgb * detail.rgb * 2.0; + S.gloss = S.gloss * detail.w * 2.0; #endif // USE_TDETAIL_BUMP #endif @@ -198,9 +198,9 @@ surface_bumped sload_i( p_bumped I, float2 pixeloffset ) float4 NDetail = tex2D( s_detailBump, I.tcdbump); float4 NDetailX = tex2D( s_detailBumpX, I.tcdbump); - S.gloss = S.gloss * NDetail.x * 2; - //S.normal += NDetail.wzy-.5; - S.normal += NDetail.wzy + NDetailX.xyz - 1.0f; // (Nu.wzyx - .5f) + (E-.5) + S.gloss = S.gloss * NDetail.x * 2.0; + //S.normal += NDetail.wzy-0.5; + S.normal += NDetail.wzy + NDetailX.xyz - 1.0; // (Nu.wzyx - 0.5) + (E-0.5) float4 detail = tex2D( s_detail, I.tcdbump); S.base.rgb = S.base.rgb * detail.rgb * 2; @@ -208,11 +208,11 @@ surface_bumped sload_i( p_bumped I, float2 pixeloffset ) // S.base.rgb = float3(1,0,0); #else // USE_TDETAIL_BUMP #ifdef MSAA_ALPHATEST_DX10_1 - I.tcdbump.xy += pixeloffset.x * ddx(I.tcdbump.xy) + pixeloffset.y * ddy(I.tcdbump.xy); + I.tcdbump.xy += pixeloffset.x * ddx(I.tcdbump.xy) + pixeloffset.y * ddy(I.tcdbump.xy); #endif float4 detail = tex2D( s_detail, I.tcdbump); - S.base.rgb = S.base.rgb * detail.rgb * 2; - S.gloss = S.gloss * detail.w * 2; + S.base.rgb = S.base.rgb * detail.rgb * 2.0; + S.gloss = S.gloss * detail.w * 2.0; #endif // USE_TDETAIL_BUMP #endif diff --git a/res/gamedata/shaders/gl/ssao_blur.ps b/res/gamedata/shaders/gl/ssao_blur.ps index e20c977d902..a5580094da5 100644 Binary files a/res/gamedata/shaders/gl/ssao_blur.ps and b/res/gamedata/shaders/gl/ssao_blur.ps differ diff --git a/res/gamedata/shaders/gl/ssao_calc.ps b/res/gamedata/shaders/gl/ssao_calc.ps index a02acc1146d..a7977328c5c 100644 Binary files a/res/gamedata/shaders/gl/ssao_calc.ps and b/res/gamedata/shaders/gl/ssao_calc.ps differ diff --git a/res/gamedata/shaders/gl/ssao_hbao.ps b/res/gamedata/shaders/gl/ssao_hbao.ps index 3a04c7191cc..26312cc5643 100644 Binary files a/res/gamedata/shaders/gl/ssao_hbao.ps and b/res/gamedata/shaders/gl/ssao_hbao.ps differ diff --git a/res/gamedata/shaders/gl/ssao_hdao.ps b/res/gamedata/shaders/gl/ssao_hdao.ps index cc616184343..c91b6b9e331 100644 Binary files a/res/gamedata/shaders/gl/ssao_hdao.ps and b/res/gamedata/shaders/gl/ssao_hdao.ps differ diff --git a/res/gamedata/shaders/gl/ssao_hdao_new.ps b/res/gamedata/shaders/gl/ssao_hdao_new.ps index 19b69746944..78621dbe15c 100644 Binary files a/res/gamedata/shaders/gl/ssao_hdao_new.ps and b/res/gamedata/shaders/gl/ssao_hdao_new.ps differ diff --git a/res/gamedata/shaders/gl/stub_notransform_t_m4.vs b/res/gamedata/shaders/gl/stub_notransform_t_m4.vs index 29464da6159..fae43ceb03b 100644 --- a/res/gamedata/shaders/gl/stub_notransform_t_m4.vs +++ b/res/gamedata/shaders/gl/stub_notransform_t_m4.vs @@ -12,7 +12,7 @@ v2p_TL _main ( v_TL I ) // O.HPos = P; { - I.P.xy += 0.5f; + I.P.xy += 0.5; // O.HPos.x = I.P.x/1024.0 * 2.0 - 1.0; // O.HPos.y = (I.P.y/768.0 * 2.0 - 1.0)*-1.0; O.HPos.x = I.P.x * screen_res.z * 2.0 - 1.0; diff --git a/res/gamedata/shaders/gl/yuv2rgb.ps b/res/gamedata/shaders/gl/yuv2rgb.ps index be657b76514..0d3f36dcafc 100644 Binary files a/res/gamedata/shaders/gl/yuv2rgb.ps and b/res/gamedata/shaders/gl/yuv2rgb.ps differ diff --git a/src/Layers/xrRenderGL/glHW.cpp b/src/Layers/xrRenderGL/glHW.cpp index 6967b0bad90..9bb317168ec 100644 --- a/src/Layers/xrRenderGL/glHW.cpp +++ b/src/Layers/xrRenderGL/glHW.cpp @@ -72,7 +72,8 @@ void CHW::CreateDevice(SDL_Window* hWnd) #endif // DEBUG Msg("* GPU vendor: [%s] device: [%s]", glGetString(GL_VENDOR), glGetString(GL_RENDERER)); - Msg("* GPU OpenGL version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); + Msg("* GPU OpenGL version: %s", glGetString(GL_VERSION)); + Msg("* GPU OpenGL shading language version: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); // Clip control ensures compatibility with D3D device coordinates. // TODO: OGL: Fix these differences in the blenders/shaders.