Skip to content

Commit

Permalink
xrRenderGL Update:
Browse files Browse the repository at this point in the history
- Removed glClipControl, shading language version can be downgraded
- Removed useless pCFB buffer
- Invert many screen quads
- Invert matrices of viewport for lighting
- Fixed flickering frames near light sources (shadowmaps are still incorrect)
- Corrected TexelAdjust matrices
- Invert scissor box
- Removed flip from .tga screenshots
- Some changes in shaders for ATI video cards #3
- Added key '-no_hom'
  • Loading branch information
SkyLoaderr committed Dec 4, 2018
1 parent cf1329d commit fc3f077
Show file tree
Hide file tree
Showing 41 changed files with 416 additions and 371 deletions.
Binary file modified res/gamedata/shaders/gl/distort.ps
Binary file not shown.
2 changes: 1 addition & 1 deletion res/gamedata/shaders/gl/distort.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("stub_notransform_t","distort")
shader:begin ("stub_notransform_t_menu","distort")
: fog (false)
: zb (false,false)
shader:sampler ("s_base") :texture("$user$generic0") : clamp() : f_linear ()
Expand Down
6 changes: 4 additions & 2 deletions res/gamedata/shaders/gl/fxaa_main.vs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/reso
v2p_TL _main (v_TL I)
{
v2p_TL O;
O.HPos = float4 (I.P.x * screen_res.z * 2.0f - 1.0f, (I.P.y * screen_res.w * 2.0f - 1.0f) * -1.0f, 0.0f, 1.0f);
O.Tex0 = I.Tex0;
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;
O.HPos.zw = float2(0.0, 1.0);
O.Tex0 = I.Tex0;

return O;
}
17 changes: 6 additions & 11 deletions res/gamedata/shaders/gl/hud_crosshair.vs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "common_iostructs.h"
//include "common.h"
#include "common.h"
#include "iostructs\v_TL0uv.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -10,16 +9,12 @@ v2p_TL0uv _main ( v_TL0uv I )
{
v2p_TL0uv O;

{
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;
}
I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Color = I.Color.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
8 changes: 4 additions & 4 deletions res/gamedata/shaders/gl/shadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ float dx10_0_hw_hq_7x7( float4 tc )
tc.xyz /= tc.w;

float s = 0.0;
float2 stc = ( SMAP_size * tc.xy ) + float2( 0.5, 0.5 );
float2 stc = ( float(SMAP_size) * tc.xy ) + float2( 0.5, 0.5 );
float2 tcs = floor( stc );
float2 fc;

Expand Down Expand Up @@ -630,7 +630,7 @@ float4 test (float4 tc, float2 offset)
const float scale = (0.5/float(SMAP_size));
float texsize = 2.0*SMAP_size;
float texsize = 2.0*float(SMAP_size);
float2 tc_J = tc.xy/tc.w*texsize/8.0;
float2 fr = frac(tc_J)*0.5;
Expand Down Expand Up @@ -665,7 +665,7 @@ half shadowtest_sun (float4 tc, float4 tcJ) // jittered sampling
const float scale = (0.7/float(SMAP_size));


float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0 )*0.5;
float2 tc_J = frac(tc.xy/tc.w*float(SMAP_size)/4.0 )*0.5;
float4 J0 = tex2D (jitter0,tc_J)*scale;
//half4 J1 = tex2D (jitter1,tc_J)*scale;

Expand All @@ -683,7 +683,7 @@ half shadow_high (float4 tc) // jittered sampling

const float scale = (0.5/float(SMAP_size));

float2 tc_J = frac(tc.xy/tc.w*SMAP_size/4.0 )*0.5;
float2 tc_J = frac(tc.xy/tc.w*float(SMAP_size)/4.0 )*0.5;
float4 J0 = tex2D (jitter0,tc_J)*scale;

const float k = 1.0/float(SMAP_size);
Expand Down
2 changes: 1 addition & 1 deletion res/gamedata/shaders/gl/stub_default.vs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ v2p_TL _main ( v_TL I)

O.HPos = mul( m_WVP, I.P);
O.Tex0 = I.Tex0;
O.Color = I.Color.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
4 changes: 2 additions & 2 deletions res/gamedata/shaders/gl/stub_notransform.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_TL.h"

//////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -10,7 +10,7 @@ v2p_TL _main ( v_TL I )
O.HPos = I.P;
O.Tex0 = I.Tex0;
// Some shaders that use this stub don't need Color at all
O.Color = I.Color.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
4 changes: 2 additions & 2 deletions res/gamedata/shaders/gl/stub_notransform_2uv.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_TL2uv.h"

//////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -11,7 +11,7 @@ v2p_TL2uv _main ( v_TL2uv I )
O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
// Some shaders that use this stub don't need Color at all
O.Color = I.Color.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
15 changes: 4 additions & 11 deletions res/gamedata/shaders/gl/stub_notransform_aa_aa.vs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ v2p_aa_AA _main ( v_aa_AA I )
{
v2p_aa_AA O;

// O.HPos = I.P;

{
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;
}

I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
Expand Down
17 changes: 6 additions & 11 deletions res/gamedata/shaders/gl/stub_notransform_build.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_build.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -9,16 +9,11 @@ v2p_build _main ( v_build I )
{
v2p_build O;

{

I.P.xy += 0.5; // Bugs with rasterizer??? Possible float-pixel shift.
// 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;
}

I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
O.Tex2 = I.Tex2;
Expand Down
14 changes: 5 additions & 9 deletions res/gamedata/shaders/gl/stub_notransform_filter.vs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ v2p_filter _main ( v_filter I )
{
v2p_filter O;

// O.HPos = I.P;
{
I.P.xy += 0.5; // Bugs with rasterizer??? Possible float-pixel shift.
// 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;
}
I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
O.Tex2 = I.Tex2;
Expand Down
27 changes: 10 additions & 17 deletions res/gamedata/shaders/gl/stub_notransform_postpr.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_postpr.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -9,24 +9,17 @@ v2p_postpr _main ( v_postpr I )
{
v2p_postpr O;

// O.HPos = I.P;
I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

{
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;
}


O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
O.Tex2 = I.Tex2;
O.Tex0 = I.Tex0;
O.Tex1 = I.Tex1;
O.Tex2 = I.Tex2;

O.Color = I.Color.bgra; // swizzle vertex colour
O.Gray = I.Gray.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);
O.Gray = unpack_D3DCOLOR(I.Gray);

return O;
}
18 changes: 6 additions & 12 deletions res/gamedata/shaders/gl/stub_notransform_t.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_TL.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -9,19 +9,13 @@ v2p_TL _main ( v_TL I )
{
v2p_TL O;

// O.HPos = P;

{
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;
}
I.P.xy += 0.5;
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;

O.Tex0 = I.Tex0;
O.Color = I.Color.bgra; // swizzle vertex colour
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
16 changes: 5 additions & 11 deletions res/gamedata/shaders/gl/stub_notransform_t_m2.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_TL.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -9,16 +9,10 @@ v2p_TL _main ( v_TL I )
{
v2p_TL O;

// O.HPos = P;

{
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;
}
I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Color = float4(I.Color.bgr*2.0, 1.0); // swizzle vertex colour
Expand Down
16 changes: 5 additions & 11 deletions res/gamedata/shaders/gl/stub_notransform_t_m4.vs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common_iostructs.h"
#include "common.h"
#include "iostructs\v_TL.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
Expand All @@ -9,16 +9,10 @@ v2p_TL _main ( v_TL I )
{
v2p_TL O;

// O.HPos = P;

{
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;
}
I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Color = float4(I.Color.bgr*4.0, 1.0); // swizzle vertex colour
Expand Down
12 changes: 4 additions & 8 deletions res/gamedata/shaders/gl/stub_notransform_t_ma.vs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ v2p_TL _main ( v_TL I )
{
v2p_TL O;

// O.HPos = P;

{
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.zw = I.P.zw;
}
I.P.xy += 0.5;
O.HPos.x = I.P.x/1024.0 * 2.0 - 1.0; // SkyLoader: is it correct? Maybe need to use screen_res?
O.HPos.y = I.P.y/768.0 * 2.0 - 1.0;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Color = I.Color.aaaa; // swizzle vertex colour
Expand Down
21 changes: 21 additions & 0 deletions res/gamedata/shaders/gl/stub_notransform_t_menu.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "common.h"
#include "iostructs\v_TL.h"

uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)

//////////////////////////////////////////////////////////////////////////////////////////
// Vertex
v2p_TL _main ( v_TL I )
{
v2p_TL O;

I.P.xy += 0.5;
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;
O.HPos.zw = I.P.zw;

O.Tex0 = I.Tex0;
O.Color = unpack_D3DCOLOR(I.Color);

return O;
}
Loading

0 comments on commit fc3f077

Please sign in to comment.