Skip to content

Commit a42ae5e

Browse files
committed
shaders: Fix shader compilation errors in GLSL ports.
1 parent 4fe8459 commit a42ae5e

File tree

9 files changed

+30
-13
lines changed

9 files changed

+30
-13
lines changed

res/gamedata/shaders/gl/common_functions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ float3 calc_model_lq_lighting( float3 norm_w )
6464
}
6565

6666
float3 unpack_normal( float3 v ) { return 2*v-1; }
67+
float3 unpack_normal( float4 v ) { return 2*v.xyz-1; }
6768
float3 unpack_bx2( float3 v ) { return 2*v-1; }
69+
float3 unpack_bx2( float4 v ) { return 2*v.xyz-1; }
6870
float3 unpack_bx4( float3 v ) { return 4*v-2; } //!reduce the amount of stretching from 4*v-2 and increase precision
71+
float3 unpack_bx4( float4 v ) { return 4*v.xyz-2; }
6972
float2 unpack_tc_lmap( float2 tc ) { return tc*(1.f/32768.f); } // [-1 .. +1 ]
7073
float4 unpack_color( float4 c ) { return c.bgra; }
7174
float4 unpack_D3DCOLOR( float4 c ) { return c.bgra; }

res/gamedata/shaders/gl/deffer_base_bump.vs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "common.h"
2-
#include "iostructs\v_static_bumped.h"
3-
2+
#include "iostructs\v_static_bump.h"
3+
#line 4 1
44
v2p_bumped _main( v_in I )
55
{
66
// I.color.rgb = I.color.bgr; // Swizzle to compensate DX9/DX10 format mismatch
@@ -12,7 +12,11 @@ v2p_bumped _main( v_in I )
1212
v2p_bumped O;
1313
float3 Pe = mul (m_WV, w_pos );
1414
O.hpos = mul (m_WVP, w_pos );
15+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
1516
O.tcdh = float4 (tc.xyyy );
17+
#else
18+
O.tcdh = float2 (tc.xyyy );
19+
#endif
1620
O.position = float4 (Pe, hemi );
1721
// O.position = float4 (O.hpos.xyz, hemi );
1822

res/gamedata/shaders/gl/deffer_base_flat.vs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "common.h"
22
#include "iostructs\v_static_flat.h"
3-
3+
#line 4 1
44
v2p_flat _main ( v_in I )
55
{
66
I.Nh = unpack_D3DCOLOR(I.Nh);
@@ -15,7 +15,11 @@ v2p_flat _main ( v_in I )
1515
float3 Pe = mul( m_WV, I.P );
1616

1717
float2 tc = unpack_tc_base( I.tc, I.T.w, I.B.w); // copy tc
18-
O.tcdh = float4( tc.xyyy );
18+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
19+
O.tcdh = float4( tc.xyyy );
20+
#else
21+
O.tcdh = float2( tc.xyyy );
22+
#endif
1923
O.position = float4( Pe, I.Nh.w );
2024

2125
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)

res/gamedata/shaders/gl/deffer_tree_bump.vs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ v2p_bumped _main (v_tree I)
3535
v2p_bumped O;
3636
float3 Pe = mul (m_V, w_pos );
3737
O.tcdh = float4 (tc.xyyy );
38+
#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI)
39+
O.tcdh = float4 (tc.xyyy );
40+
#else
41+
O.tcdh = float2 (tc.xyyy );
42+
#endif
3843
O.hpos = mul (m_VP, w_pos );
3944
O.position = float4 (Pe, hemi );
4045

res/gamedata/shaders/gl/hud_crosshair.vs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "common_iostructs.h"
2-
//#include "common.h"
3-
#include "iostructs\v2p_TL0uv.h"
2+
//include "common.h"
3+
#include "iostructs\v_TL0uv.h"
44

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

res/gamedata/shaders/gl/iostructs/v_shadow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ void main()
1818

1919
v2p_shadow_direct O = _main (I);
2020

21-
gl_Position = O.HPos;
21+
gl_Position = O.hpos;
2222
}

res/gamedata/shaders/gl/iostructs/v_shadow_aref.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ void main()
3535
v2p_shadow_direct_aref O = _main (I);
3636

3737
v2p_shadow_tc0 = O.tc0;
38-
gl_Position = O.HPos;
38+
gl_Position = O.hpos;
3939
}

res/gamedata/shaders/gl/iostructs/v_volume.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ void main()
1717
#ifdef USE_SJITTER
1818
v2p_volume_tcJ = O.tcJ;
1919
#endif
20+
gl_Position = O.hpos;
2021
}

res/gamedata/shaders/gl/sload.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
#ifdef MSAA_ALPHATEST_DX10_1
77
#if MSAA_SAMPLES == 2
8-
static const float2 MSAAOffsets[2] = { float2(4,4), float2(-4,-4) };
8+
const float2 MSAAOffsets[2] = { float2(4,4), float2(-4,-4) };
99
#endif
1010
#if MSAA_SAMPLES == 4
11-
static const float2 MSAAOffsets[4] = { float2(-2,-6), float2(6,-2), float2(-6,2), float2(2,6) };
11+
const float2 MSAAOffsets[4] = { float2(-2,-6), float2(6,-2), float2(-6,2), float2(2,6) };
1212
#endif
1313
#if MSAA_SAMPLES == 8
14-
static const float2 MSAAOffsets[8] = { float2(1,-3), float2(-1,3), float2(5,1), float2(-3,-5),
14+
const float2 MSAAOffsets[8] = { float2(1,-3), float2(-1,3), float2(5,1), float2(-3,-5),
1515
float2(-5,5), float2(-7,-1), float2(3,7), float2(7,-7) };
1616
#endif
1717
#endif // MSAA_ALPHATEST_DX10_1
@@ -35,8 +35,8 @@ float4 tbase( float2 tc )
3535

3636
#if defined(ALLOW_STEEPPARALLAX) && defined(USE_STEEPPARALLAX)
3737

38-
static const float fParallaxStartFade = 8.0f;
39-
static const float fParallaxStopFade = 12.0f;
38+
const float fParallaxStartFade = 8.0f;
39+
const float fParallaxStopFade = 12.0f;
4040

4141
void UpdateTC( inout p_bumped I )
4242
{

0 commit comments

Comments
 (0)