Skip to content

Commit

Permalink
Add OpenGL shaders by Armada651
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 9, 2018
1 parent 17b5f8d commit 1bfc3d2
Show file tree
Hide file tree
Showing 394 changed files with 7,860 additions and 0 deletions.
40 changes: 40 additions & 0 deletions res/gamedata/shaders/gl/.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--[[
function printf(fmt,...)
log(string.format(fmt,unpack(arg)))
end
]]--

--[[
t_point_att = "internal\\internal_light_attpoint"

function r1_lspot (shader, t_base, vs, aref)
shader:begin (vs,"add_spot")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
: aref (true,aref or 0)
shader:sampler ("s_base") :texture (t_base)
shader:sampler ("s_lmap") :texture ("internal\\internal_light_att")
: clamp ()
: f_linear ()
: project (true)
shader:sampler ("s_att") :texture ("internal\\internal_light_attclip")
: clamp ()
: f_linear ()
end

function r1_lpoint (shader, t_base, vs, aref)
shader:begin (vs,"add_point")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
: aref (true,aref or 0)
shader:sampler ("s_base") :texture (t_base)
shader:sampler ("s_lmap") :texture (t_point_att)
: clamp ()
: f_linear ()
shader:sampler ("s_att") :texture (t_point_att)
: clamp ()
: f_linear ()
end
]]--
Binary file added res/gamedata/shaders/gl/accum_base.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_emissive.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_indirect.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_indirect_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_indirect_nomsaa.ps
Binary file not shown.
10 changes: 10 additions & 0 deletions res/gamedata/shaders/gl/accum_mask.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "common.h"

out gl_PerVertex { vec4 gl_Position; };

layout(location = POSITION) in float4 P;

void main ()
{
gl_Position = mul ( m_WVP, P );
}
Binary file added res/gamedata/shaders/gl/accum_omni_normal.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_omni_normal_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_omni_normal_nomsaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_omni_transluent.ps
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_omni_unshadowed.ps
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_fullsize.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_fullsize_msaa.ps
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_normal.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_normal_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_normal_nomsaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_spot_unshadowed.ps
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun.ps
Binary file not shown.
21 changes: 21 additions & 0 deletions res/gamedata/shaders/gl/accum_sun.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "common.h"
#include "iostructs\v_volume.h"

//////////////////////////////////////////////////////////////////////////////////////////
uniform float4x4 m_texgen;
#ifdef USE_SJITTER
uniform float4x4 m_texgen_J;
#endif

//////////////////////////////////////////////////////////////////////////////////////////
// Vertex
v2p_volume _main ( float4 P )
{
v2p_volume O;
O.hpos = mul( m_WVP, P );
O.tc = mul( m_texgen, P );
#ifdef USE_SJITTER
O.tcJ = mul( m_texgen_J, P );
#endif
return O;
}
Binary file added res/gamedata/shaders/gl/accum_sun_far.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_far_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_far_nomsaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_mask.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_mask_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_mask_nomsaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_near.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_near_msaa.ps
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_near_nomsaa.ps
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_sun_nomsaa.ps
Binary file not shown.
21 changes: 21 additions & 0 deletions res/gamedata/shaders/gl/accum_volume.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "common.h"
#include "iostructs\v_volume.h"

//////////////////////////////////////////////////////////////////////////////////////////
uniform float4x4 m_texgen;
#ifdef USE_SJITTER
uniform float4x4 m_texgen_J;
#endif

//////////////////////////////////////////////////////////////////////////////////////////
// Vertex
v2p_volume _main ( float4 P )
{
v2p_volume O;
O.hpos = mul( m_WVP, P );
O.tc = mul( m_texgen, P );
#ifdef USE_SJITTER
O.tcJ = mul( m_texgen_J, P );
#endif
return O;
}
Binary file added res/gamedata/shaders/gl/accum_volumetric.ps
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_volumetric", "accum_volumetric")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
-- : aref (true,0)
: sorting (2, false)
shader:sampler ("s_lmap") :texture (t_base): clamp()
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_noise") :texture ("fx\\fx_noise") : f_linear ()
end
34 changes: 34 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "common.h"
#include "iostructs\v_volumetric.h"

//cbuffer VolumetricLights
//{
uniform float3 vMinBounds;
uniform float3 vMaxBounds;
uniform float4 FrustumClipPlane[6];
//}

v2p _main ( float3 P )
{
v2p o;
float4 vPos;
vPos.xyz = lerp( vMinBounds, vMaxBounds, P); // Position in camera space
vPos.w = 1;
o.hpos = mul (m_P, vPos); // xform, input in camera coordinates

o.lightToPos = vPos.xyz - Ldynamic_pos.xyz;
o.vPos = vPos.xyz;

// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0f;
// o.fDensity = (vMaxBounds.z-vMinBounds.z)/2000.0f*2;
o.fDensity = 1.0f/40.0f;
// o.fDensity = 1.0f/20.0f;

for (int i=0; i<3; ++i)
{
o.clip0[i] = dot( o.hpos, FrustumClipPlane[i]);
o.clip1[i] = dot( o.hpos, FrustumClipPlane[i+3]);
}

return o;
}
Binary file added res/gamedata/shaders/gl/accum_volumetric_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/accum_volumetric_nomsaa.ps
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_nomsaa.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_volumetric", "accum_volumetric")
: fog (false)
: zb (true,false)
: blend (true,blend.one,blend.one)
-- : aref (true,0)
: sorting (2, false)
shader:sampler ("s_lmap") :texture (t_base): clamp()
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_noise") :texture ("fx\\fx_noise") : f_linear ()
end
1 change: 1 addition & 0 deletions res/gamedata/shaders/gl/accum_volumetric_nomsaa.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "accum_volumetric.vs"
Binary file added res/gamedata/shaders/gl/accum_volumetric_sun.ps
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("stub_notransform_2uv", "accum_volumetric_sun_normal")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_minmax.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_minmax")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa0.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa0")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa1.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa1")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa2.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa2")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa3.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa3")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa4.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa4")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa5.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa5")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa6.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa6")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_msaa7.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_msaa7")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
13 changes: 13 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_nomsaa.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_nomsaa")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_smap_minmax") :texture ("$user$smap_depth_minmax")
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
13 changes: 13 additions & 0 deletions res/gamedata/shaders/gl/accum_volumetric_sun_nomsaa_minmax.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("accum_sun", "accum_volumetric_sun_minmax")
: fog (false)
: zb (false,false)
: blend (true,blend.one,blend.one)
: sorting (2, false)
-- TODO: DX10: Implement for near and far phase.
shader:sampler ("s_dmap") :texture ("$user$smap_depth")
shader:sampler ("s_smap") :texture ("$user$smap_depth") : comp_less ()
shader:sampler ("s_smap_minmax") :texture ("$user$smap_depth_minmax")
shader:sampler ("s_position") :texture ("$user$position")
shader:sampler ("jitter0") :texture ("$user$jitter_0") : f_none ()
end
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_build.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_filter.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_filter_f.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_luminance_1.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_luminance_2.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/bloom_luminance_3.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/clouds.ps
Binary file not shown.
12 changes: 12 additions & 0 deletions res/gamedata/shaders/gl/clouds.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function normal (shader, t_base, t_second, t_detail)
shader:begin ("clouds","clouds")
: fog (false)
-- TODO: DX10: Check if this is ok.
-- : zb (true,false)
: zb (false,false)
: sorting (3, true)
: blend (true, blend.srcalpha,blend.invsrcalpha)
shader:sampler ("s_clouds0") :texture ("null") : wrap() : f_anisotropic()
shader:sampler ("s_clouds1") :texture ("null") : wrap() : f_anisotropic()
shader:sampler ("s_tonemap") :texture ("$user$tonemap")
end
31 changes: 31 additions & 0 deletions res/gamedata/shaders/gl/clouds.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "common.h"
#include "shared\cloudconfig.h"
#include "iostructs\v_clouds.h"

vf _main (vi v)
{
vf o;

o.hpos = mul (m_WVP, v.p); // xform, input in world coords

// if (length(float3(v.p.x,0,v.p.z))>CLOUD_FADE) o.color.w = 0 ;

// generate tcs
float2 d0 = v.dir.xy*2-1;
float2 d1 = v.dir.wz*2-1;
float2 _0 = v.p.xz * CLOUD_TILE0 + d0*timers.z*CLOUD_SPEED0;
float2 _1 = v.p.xz * CLOUD_TILE1 + d1*timers.z*CLOUD_SPEED1;
o.tc0 = _0; // copy tc
o.tc1 = _1; // copy tc

o.color = v.color ; // copy color, low precision, cannot prescale even by 2
o.color.w *= pow (v.p.y,25);

// float scale = tex2Dlod (s_tonemap,float4(.5,.5,.5,.5)).x ;
// float scale = s_tonemap.Load( int3(0,0,0) ).x;
// float scale = s_tonemap.Load( int3(1,1,0) ).x;
float scale = texelFetch( s_tonemap, int2(0,0), 0 ).x;
o.color.rgb *= scale ; // high precision

return o;
}
Binary file added res/gamedata/shaders/gl/combine_1.ps
Binary file not shown.
14 changes: 14 additions & 0 deletions res/gamedata/shaders/gl/combine_1.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "common.h"
#include "iostructs\v_combine.h"

//////////////////////////////////////////////////////////////////////////////////////////
// Vertex
v2p _main ( _in I )
{
v2p O;
O.hpos = float4 (I.P.x, -I.P.y, 0, 1);
float scale = texelFetch(s_tonemap,int2(0,0),0).x;
O.tc0 = float4 (I.P.zw, scale, scale);
O.tcJ = I.tcJ;
return O;
}
Binary file added res/gamedata/shaders/gl/combine_1_msaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_1_nomsaa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_2_aa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_2_aa_d.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_2_naa.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_2_naa_d.ps
Binary file not shown.
Binary file added res/gamedata/shaders/gl/combine_volumetric.ps
Binary file not shown.
Loading

0 comments on commit 1bfc3d2

Please sign in to comment.