From d70bb4cdf9bd7a24c3b1a60eca472711999cf5f8 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Sat, 28 Nov 2015 17:25:20 +0100 Subject: [PATCH] shaders: Add OpenGL stub shaders. With a new SV_Target variable for color buffer output. --- .gitattributes | 4 + res/gamedata/shaders/gl/.s | 40 ++ res/gamedata/shaders/gl/common.h | 21 + res/gamedata/shaders/gl/common_iostructs.h | 469 ++++++++++++++++++ res/gamedata/shaders/gl/dumb.ps | Bin 0 -> 194 bytes res/gamedata/shaders/gl/dumb.vs | 13 + res/gamedata/shaders/gl/iostructs/p_TL.h | 16 + res/gamedata/shaders/gl/iostructs/p_TL0uv.h | 14 + res/gamedata/shaders/gl/iostructs/p_aa_AA.h | 26 + res/gamedata/shaders/gl/iostructs/p_build.h | 20 + res/gamedata/shaders/gl/iostructs/p_dumb.h | 9 + res/gamedata/shaders/gl/iostructs/p_filter.h | 28 ++ res/gamedata/shaders/gl/iostructs/p_postpr.h | 22 + res/gamedata/shaders/gl/iostructs/v_TL.h | 25 + res/gamedata/shaders/gl/iostructs/v_TL0uv.h | 21 + res/gamedata/shaders/gl/iostructs/v_TL2uv.h | 29 ++ res/gamedata/shaders/gl/iostructs/v_aa_AA.h | 45 ++ res/gamedata/shaders/gl/iostructs/v_build.h | 33 ++ res/gamedata/shaders/gl/iostructs/v_dumb.h | 16 + res/gamedata/shaders/gl/iostructs/v_filter.h | 49 ++ res/gamedata/shaders/gl/iostructs/v_postpr.h | 37 ++ res/gamedata/shaders/gl/shared/cloudconfig.h | 11 + res/gamedata/shaders/gl/shared/common.h | 107 ++++ res/gamedata/shaders/gl/shared/waterconfig.h | 56 +++ res/gamedata/shaders/gl/shared/watermove.h | 26 + res/gamedata/shaders/gl/shared/wmark.h | 24 + res/gamedata/shaders/gl/stub_default.ps | Bin 0 -> 339 bytes res/gamedata/shaders/gl/stub_default.s | 9 + res/gamedata/shaders/gl/stub_default.vs | 15 + res/gamedata/shaders/gl/stub_default_ma.ps | Bin 0 -> 483 bytes res/gamedata/shaders/gl/stub_notransform.vs | 16 + .../shaders/gl/stub_notransform_2uv.vs | 17 + .../shaders/gl/stub_notransform_aa_aa.vs | 33 ++ .../shaders/gl/stub_notransform_build.vs | 28 ++ .../shaders/gl/stub_notransform_filter.vs | 31 ++ .../shaders/gl/stub_notransform_postpr.vs | 32 ++ res/gamedata/shaders/gl/stub_notransform_t.vs | 27 + .../shaders/gl/stub_notransform_t_m2.vs | 27 + .../shaders/gl/stub_notransform_t_m4.vs | 27 + .../shaders/gl/stub_notransform_t_ma.vs | 23 + src/Layers/xrRenderPC_GL/rgl.cpp | 1 + 41 files changed, 1447 insertions(+) create mode 100644 res/gamedata/shaders/gl/.s create mode 100644 res/gamedata/shaders/gl/common.h create mode 100644 res/gamedata/shaders/gl/common_iostructs.h create mode 100644 res/gamedata/shaders/gl/dumb.ps create mode 100644 res/gamedata/shaders/gl/dumb.vs create mode 100644 res/gamedata/shaders/gl/iostructs/p_TL.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_TL0uv.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_aa_AA.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_build.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_dumb.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_filter.h create mode 100644 res/gamedata/shaders/gl/iostructs/p_postpr.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_TL.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_TL0uv.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_TL2uv.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_aa_AA.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_build.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_dumb.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_filter.h create mode 100644 res/gamedata/shaders/gl/iostructs/v_postpr.h create mode 100644 res/gamedata/shaders/gl/shared/cloudconfig.h create mode 100644 res/gamedata/shaders/gl/shared/common.h create mode 100644 res/gamedata/shaders/gl/shared/waterconfig.h create mode 100644 res/gamedata/shaders/gl/shared/watermove.h create mode 100644 res/gamedata/shaders/gl/shared/wmark.h create mode 100644 res/gamedata/shaders/gl/stub_default.ps create mode 100644 res/gamedata/shaders/gl/stub_default.s create mode 100644 res/gamedata/shaders/gl/stub_default.vs create mode 100644 res/gamedata/shaders/gl/stub_default_ma.ps create mode 100644 res/gamedata/shaders/gl/stub_notransform.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_2uv.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_aa_aa.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_build.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_filter.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_postpr.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_t.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_t_m2.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_t_m4.vs create mode 100644 res/gamedata/shaders/gl/stub_notransform_t_ma.vs diff --git a/.gitattributes b/.gitattributes index 412eeda78dc..513c687ba2d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,3 +20,7 @@ *.PDF diff=astextplain *.rtf diff=astextplain *.RTF diff=astextplain + +# Shaders are plain text +*.vs diff=astextplain +*.ps diff=astextplain diff --git a/res/gamedata/shaders/gl/.s b/res/gamedata/shaders/gl/.s new file mode 100644 index 00000000000..ac8498c9609 --- /dev/null +++ b/res/gamedata/shaders/gl/.s @@ -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 +]]-- \ No newline at end of file diff --git a/res/gamedata/shaders/gl/common.h b/res/gamedata/shaders/gl/common.h new file mode 100644 index 00000000000..344525625b4 --- /dev/null +++ b/res/gamedata/shaders/gl/common.h @@ -0,0 +1,21 @@ +#ifndef COMMON_H +#define COMMON_H + +#include "shared\common.h" + +//include "common_defines.h" +//include "common_policies.h" +#include "common_iostructs.h" +//include "common_samplers.h" +//include "common_cbuffers.h" +//include "common_functions.h" + +// #define USE_SUPER_SPECULAR + +#ifdef USE_R2_STATIC_SUN +# define xmaterial float(1.0f/4.fs) +#else +# define xmaterial float(L_material.w) +#endif + +#endif diff --git a/res/gamedata/shaders/gl/common_iostructs.h b/res/gamedata/shaders/gl/common_iostructs.h new file mode 100644 index 00000000000..6b8397b3c07 --- /dev/null +++ b/res/gamedata/shaders/gl/common_iostructs.h @@ -0,0 +1,469 @@ +#ifndef common_iostructs_h_included +#define common_iostructs_h_included + +//////////////////////////////////////////////////////////////// +// This file contains io structs: +// v_name : input for vertex shader. +// v2p_name: output for vertex shader. +// p_name : input for pixel shader. +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +// TL0uv +struct v_TL0uv_positiont +{ + float4 P ; // POSITIONT; + float4 Color ; // COLOR; +}; + +struct v_TL0uv +{ + float4 P ; // POSITION; + float4 Color ; // COLOR; +}; + +struct v2p_TL0uv +{ + float4 Color ; // COLOR; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_TL0uv +{ + float4 Color ; // COLOR; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +//////////////////////////////////////////////////////////////// +// TL +struct v_TL_positiont +{ + float4 P ; // POSITIONT; + float2 Tex0 ; // TEXCOORD0; + float4 Color ; // COLOR; +}; + +struct v_TL +{ + float4 P ; // POSITION; + float2 Tex0 ; // TEXCOORD0; + float4 Color ; // COLOR; +}; + +struct v2p_TL +{ + float2 Tex0 ; // TEXCOORD0; + float4 Color ; // COLOR; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_TL +{ + float2 Tex0 ; // TEXCOORD0; + float4 Color ; // COLOR; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +//////////////////////////////////////////////////////////////// +// TL2uv +struct v_TL2uv +{ + float4 P ; // POSITIONT; + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float4 Color ; // COLOR; +}; + +struct v2p_TL2uv +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float4 Color ; // COLOR; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_TL2uv +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float4 Color ; // COLOR; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; +//////////////////////////////////////////////////////////////// +// postpr +struct v_postpr +{ + float4 P ; // POSITIONT; + float2 Tex0 ; // TEXCOORD0; // base1 (duality) + float2 Tex1 ; // TEXCOORD1; // base2 (duality) + float2 Tex2 ; // TEXCOORD2; // base (noise) + float4 Color ; // COLOR0; // multiplier, color.w = noise_amount + float4 Gray ; // COLOR1; // (.3,.3,.3.,amount) +}; + +struct v2p_postpr +{ + float2 Tex0 ; // TEXCOORD0; // base1 (duality) + float2 Tex1 ; // TEXCOORD1; // base2 (duality) + float2 Tex2 ; // TEXCOORD2; // base (noise) + float4 Color ; // COLOR0; // multiplier, color.w = noise_amount + float4 Gray ; // COLOR1; // (.3,.3,.3.,amount) + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_postpr +{ + float2 Tex0 ; // TEXCOORD0; // base1 (duality) + float2 Tex1 ; // TEXCOORD1; // base2 (duality) + float2 Tex2 ; // TEXCOORD2; // base (noise) + float4 Color ; // COLOR0; // multiplier, color.w = noise_amount + float4 Gray ; // COLOR1; // (.3,.3,.3.,amount) +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; +//////////////////////////////////////////////////////////////// +// build (bloom_build) +struct v_build +{ + float4 P ; // POSITIONT; + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; +}; + +struct v2p_build +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_build +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; +//////////////////////////////////////////////////////////////// +// filter (bloom_filter) +struct v_filter +{ + float4 P ; // POSITIONT; + float4 Tex0 ; // TEXCOORD0; + float4 Tex1 ; // TEXCOORD1; + float4 Tex2 ; // TEXCOORD2; + float4 Tex3 ; // TEXCOORD3; + float4 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; + float4 Tex7 ; // TEXCOORD7; +}; + +struct v2p_filter +{ + float4 Tex0 ; // TEXCOORD0; + float4 Tex1 ; // TEXCOORD1; + float4 Tex2 ; // TEXCOORD2; + float4 Tex3 ; // TEXCOORD3; + float4 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; + float4 Tex7 ; // TEXCOORD7; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_filter +{ + float4 Tex0 ; // TEXCOORD0; + float4 Tex1 ; // TEXCOORD1; + float4 Tex2 ; // TEXCOORD2; + float4 Tex3 ; // TEXCOORD3; + float4 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; + float4 Tex7 ; // TEXCOORD7; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +//////////////////////////////////////////////////////////////// +// aa_AA +struct v_aa_AA +{ + float4 P ; // POSITIONT; + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; + float2 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; +}; + +struct v2p_aa_AA +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; + float2 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_aa_AA +{ + float2 Tex0 ; // TEXCOORD0; + float2 Tex1 ; // TEXCOORD1; + float2 Tex2 ; // TEXCOORD2; + float2 Tex3 ; // TEXCOORD3; + float2 Tex4 ; // TEXCOORD4; + float4 Tex5 ; // TEXCOORD5; + float4 Tex6 ; // TEXCOORD6; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_aa_AA_sun +{ + float2 tc ; // TEXCOORD0; + float2 unused ; // TEXCOORD1; + float2 LT ; // TEXCOORD2; + float2 RT ; // TEXCOORD3; + float2 LB ; // TEXCOORD4; + float2 RB ; // TEXCOORD5; +// float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +//////////////////////////////////////////////////////////////// +// dumb +struct v_dumb +{ + float4 P ; // POSITION; // Clip-space position (for rasterization) +}; + +struct v2p_dumb +{ + float4 HPos ; // SV_Position; // Clip-space position (for rasterization) +}; + +//////////////////////////////////////////////////////////////// +// Volume +struct v2p_volume +{ + float4 tc ; // TEXCOORD0; +#ifdef USE_SJITTER + float4 tcJ ; // TEXCOORD1; +#endif + float4 hpos ; // SV_Position; // Clip-space position (for rasterization) +}; +struct p_volume +{ + float4 tc ; // TEXCOORD0; +#ifdef USE_SJITTER + float4 tcJ ; // TEXCOORD1; +#endif +// float4 hpos ; // SV_Position; // Clip-space position (for rasterization) +}; +//////////////////////////////////////////////////////////////// +// Static +struct v_static +{ + float4 Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion) + float4 T ; // TANGENT; // tangent + float4 B ; // BINORMAL; // binormal + int2 tc ; // TEXCOORD0; // (u,v) +#ifdef USE_LM_HEMI + int2 lmh ; // TEXCOORD1; // (lmu,lmv) +#endif +// float4 color ; // COLOR0; // (r,g,b,dir-occlusion) // Swizzle before use!!! + float4 P ; // POSITION; // (float,float,float,1) +}; + +struct v_static_color +{ + float4 Nh ; // NORMAL; // (nx,ny,nz,hemi occlusion) + float4 T ; // TANGENT; // tangent + float4 B ; // BINORMAL; // binormal + int2 tc ; // TEXCOORD0; // (u,v) +#ifdef USE_LM_HEMI + int2 lmh ; // TEXCOORD1; // (lmu,lmv) +#endif + float4 color ; // COLOR0; // (r,g,b,dir-occlusion) // Swizzle before use!!! + float4 P ; // POSITION; // (float,float,float,1) +}; + +//////////////////////////////////////////////////////////////// +// defer +#ifndef GBUFFER_OPTIMIZATION +struct f_deffer +{ + float4 position; // SV_Target0; // px,py,pz, m-id + float4 Ne ; // SV_Target1; // nx,ny,nz, hemi + float4 C ; // SV_Target2; // r, g, b, gloss +#ifdef EXTEND_F_DEFFER + uint mask ; // SV_COVERAGE; +#endif +}; +#else +struct f_deffer +{ + float4 position; // SV_Target0; // xy=encoded normal, z = pz, w = encoded(m-id,hemi) + float4 C ; // SV_Target1; // r, g, b, gloss +#ifdef EXTEND_F_DEFFER + uint mask ; // SV_COVERAGE; +#endif +}; +#endif + +struct gbuffer_data +{ + float3 P; // position.( mtl or sun ) + float mtl; // material id + float3 N; // normal + float hemi; // AO + float3 C; + float gloss; +}; + +//////////////////////////////////////////////////////////////// +// Defer bumped +struct v2p_bumped +{ +#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI) + float4 tcdh ; // TEXCOORD0; // Texture coordinates, w=sun_occlusion +#else + float2 tcdh ; // TEXCOORD0; // Texture coordinates +#endif + float4 position; // TEXCOORD1; // position + hemi + float3 M1 ; // TEXCOORD2; // nmap 2 eye - 1 + float3 M2 ; // TEXCOORD3; // nmap 2 eye - 2 + float3 M3 ; // TEXCOORD4; // nmap 2 eye - 3 +#ifdef USE_TDETAIL + float2 tcdbump ; // TEXCOORD5; // d-bump +#endif +#ifdef USE_LM_HEMI + float2 lmh ; // TEXCOORD6; // lm-hemi +#endif + float4 hpos ; // SV_Position; +}; + +struct p_bumped +{ +#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI) + float4 tcdh ; // TEXCOORD0; // Texture coordinates, w=sun_occlusion +#else + float2 tcdh ; // TEXCOORD0; // Texture coordinates +#endif + float4 position; // TEXCOORD1; // position + hemi + float3 M1 ; // TEXCOORD2; // nmap 2 eye - 1 + float3 M2 ; // TEXCOORD3; // nmap 2 eye - 2 + float3 M3 ; // TEXCOORD4; // nmap 2 eye - 3 +#ifdef USE_TDETAIL + float2 tcdbump ; // TEXCOORD5; // d-bump +#endif +#ifdef USE_LM_HEMI + float2 lmh ; // TEXCOORD6; // lm-hemi +#endif +}; +//////////////////////////////////////////////////////////////// +// Defer flat +struct v2p_flat +{ +#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI) + float4 tcdh ; // TEXCOORD0; // Texture coordinates, w=sun_occlusion +#else + float2 tcdh ; // TEXCOORD0; // Texture coordinates +#endif + float4 position; // TEXCOORD1; // position + hemi + float3 N ; // TEXCOORD2; // Eye-space normal (for lighting) +#ifdef USE_TDETAIL + float2 tcdbump ; // TEXCOORD3; // d-bump +#endif +#ifdef USE_LM_HEMI + float2 lmh ; // TEXCOORD4; // lm-hemi +#endif + float4 hpos ; // SV_Position; +}; + +struct p_flat +{ +#if defined(USE_R2_STATIC_SUN) && !defined(USE_LM_HEMI) + float4 tcdh ; // TEXCOORD0; // Texture coordinates, w=sun_occlusion +#else + float2 tcdh ; // TEXCOORD0; // Texture coordinates +#endif + float4 position; // TEXCOORD1; // position + hemi + float3 N ; // TEXCOORD2; // Eye-space normal (for lighting) +#ifdef USE_TDETAIL + float2 tcdbump ; // TEXCOORD3; // d-bump +#endif +#ifdef USE_LM_HEMI + float2 lmh ; // TEXCOORD4; // lm-hemi +#endif +}; + +//////////////////////////////////////////////////////////////// +// Shadow +struct v_shadow_direct_aref +{ + float4 P ; // POSITION; // (float,float,float,1) + int4 tc ; // TEXCOORD0; // (u,v,frac,???) +}; + +struct v_shadow_direct +{ + float4 P ; // POSITION; // (float,float,float,1) +}; + + +struct v2p_shadow_direct_aref +{ + float2 tc0 ; // TEXCOORD1; // Diffuse map for aref + float4 hpos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct v2p_shadow_direct +{ + float4 hpos ; // SV_Position; // Clip-space position (for rasterization) +}; + +struct p_shadow_direct_aref +{ + float2 tc0 ; // TEXCOORD1; // Diffuse map for aref +}; + +//////////////////////////////////////////////////////////////// +// Model +struct v_model +{ + float4 P ; // POSITION; // (float,float,float,1) + float3 N ; // NORMAL; // (nx,ny,nz) + float3 T ; // TANGENT; // (nx,ny,nz) + float3 B ; // BINORMAL; // (nx,ny,nz) + float2 tc ; // TEXCOORD0; // (u,v) +}; + +//////////////////////////////////////////////////////////////// +// Tree +struct v_tree +{ + float4 P ; // POSITION; // (float,float,float,1) + float4 Nh ; // NORMAL; // (nx,ny,nz) + float3 T ; // TANGENT; // tangent + float3 B ; // BINORMAL; // binormal + int4 tc ; // TEXCOORD0; // (u,v,frac,???) +}; + +//////////////////////////////////////////////////////////////// +// Details +struct v_detail +{ + float4 pos ; // POSITION; // (float,float,float,1) + int4 misc ; // TEXCOORD0; // (u(Q),v(Q),frac,matrix-id) +}; + +#endif // common_iostructs_h_included \ No newline at end of file diff --git a/res/gamedata/shaders/gl/dumb.ps b/res/gamedata/shaders/gl/dumb.ps new file mode 100644 index 0000000000000000000000000000000000000000..b41cbf8b8bc36f3b21339560f9e1dd295fbab33c GIT binary patch literal 194 zcmY$+%uCKGO-WTyO3u&C&Ck=zP~uXCi)H2)mlTyImlVeo#HW7*LlTS9Q%kt2xj2hbOG=CKI1Q}1YPkT7MKO>7 literal 0 HcmV?d00001 diff --git a/res/gamedata/shaders/gl/dumb.vs b/res/gamedata/shaders/gl/dumb.vs new file mode 100644 index 00000000000..4595af1b41f --- /dev/null +++ b/res/gamedata/shaders/gl/dumb.vs @@ -0,0 +1,13 @@ +#include "common.h" +#include "iostructs\v_dumb.h" + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_dumb main ( v_dumb I ) +{ + v2p_dumb O; + + O.HPos = mul( m_WVP, I.P ); + + return O; +} diff --git a/res/gamedata/shaders/gl/iostructs/p_TL.h b/res/gamedata/shaders/gl/iostructs/p_TL.h new file mode 100644 index 00000000000..4be75e1f7bd --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_TL.h @@ -0,0 +1,16 @@ + +out vec4 SV_Target; + +layout(location = TEXCOORD0) in float2 p_TL_Tex0 ; // TEXCOORD0; +layout(location = COLOR) in float4 p_TL_Color ; // COLOR; + +float4 _main ( p_TL I ); + +void main() +{ + p_TL I; + I.Tex0 = p_TL_Tex0; + I.Color = p_TL_Color; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_TL0uv.h b/res/gamedata/shaders/gl/iostructs/p_TL0uv.h new file mode 100644 index 00000000000..24646eeffe3 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_TL0uv.h @@ -0,0 +1,14 @@ + +out vec4 SV_Target; + +layout(location = COLOR) in float4 p_TL0uv_Color ; // COLOR; + +float4 _main ( p_TL0uv I ); + +void main() +{ + p_TL0uv I; + I.Color = p_TL0uv_Color; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_aa_AA.h b/res/gamedata/shaders/gl/iostructs/p_aa_AA.h new file mode 100644 index 00000000000..872c02aa143 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_aa_AA.h @@ -0,0 +1,26 @@ + +out vec4 SV_Target; + +layout(location = TEXCOORD0) in float4 p_aa_AA_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float4 p_aa_AA_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float4 p_aa_AA_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float4 p_aa_AA_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) in float4 p_aa_AA_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) in float4 p_aa_AA_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) in float4 p_aa_AA_Tex6 ; // TEXCOORD6; + +float4 _main ( p_aa_AA I ); + +void main() +{ + p_aa_AA I; + I.Tex0 = p_aa_AA_Tex0; + I.Tex1 = p_aa_AA_Tex1; + I.Tex2 = p_aa_AA_Tex2; + I.Tex3 = p_aa_AA_Tex3; + I.Tex4 = p_aa_AA_Tex4; + I.Tex5 = p_aa_AA_Tex5; + I.Tex6 = p_aa_AA_Tex6; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_build.h b/res/gamedata/shaders/gl/iostructs/p_build.h new file mode 100644 index 00000000000..a475d4cdd92 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_build.h @@ -0,0 +1,20 @@ + +out vec4 SV_Target; + +layout(location = TEXCOORD0) in float2 p_build_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float2 p_build_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float2 p_build_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float2 p_build_Tex3 ; // TEXCOORD3; + +float4 _main ( p_build I ); + +void main() +{ + p_build I; + I.Tex0 = p_build_Tex0; + I.Tex1 = p_build_Tex1; + I.Tex2 = p_build_Tex2; + I.Tex3 = p_build_Tex3; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_dumb.h b/res/gamedata/shaders/gl/iostructs/p_dumb.h new file mode 100644 index 00000000000..ef0378ee272 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_dumb.h @@ -0,0 +1,9 @@ + +out vec4 SV_Target; + +float4 _main (); + +void main() +{ + SV_Target = _main (); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_filter.h b/res/gamedata/shaders/gl/iostructs/p_filter.h new file mode 100644 index 00000000000..d053acc1002 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_filter.h @@ -0,0 +1,28 @@ + +out vec4 SV_Target; + +layout(location = TEXCOORD0) in float4 p_filter_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float4 p_filter_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float4 p_filter_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float4 p_filter_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) in float4 p_filter_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) in float4 p_filter_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) in float4 p_filter_Tex6 ; // TEXCOORD6; +layout(location = TEXCOORD7) in float4 p_filter_Tex7 ; // TEXCOORD7; + +float4 _main ( p_filter I ); + +void main() +{ + p_filter I; + I.Tex0 = p_filter_Tex0; + I.Tex1 = p_filter_Tex1; + I.Tex2 = p_filter_Tex2; + I.Tex3 = p_filter_Tex3; + I.Tex4 = p_filter_Tex4; + I.Tex5 = p_filter_Tex5; + I.Tex6 = p_filter_Tex6; + I.Tex7 = p_filter_Tex7; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/p_postpr.h b/res/gamedata/shaders/gl/iostructs/p_postpr.h new file mode 100644 index 00000000000..73889ab539c --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/p_postpr.h @@ -0,0 +1,22 @@ + +out vec4 SV_Target; + +layout(location = TEXCOORD0) in float2 p_postpr_Tex0 ; // TEXCOORD0; // base1 (duality) +layout(location = TEXCOORD1) in float2 p_postpr_Tex1 ; // TEXCOORD1; // base2 (duality) +layout(location = TEXCOORD2) in float2 p_postpr_Tex2 ; // TEXCOORD2; // base (noise) +layout(location = COLOR0) in float4 p_postpr_Color ; // COLOR0; // multiplier, color.w = noise_amount +layout(location = COLOR1) in float4 p_postpr_Gray ; // COLOR1; // (.3,.3,.3.,amount) + +float4 _main ( p_postpr I ); + +void main() +{ + p_postpr I; + I.Tex0 = p_postpr_Tex0; + I.Tex1 = p_postpr_Tex1; + I.Tex2 = p_postpr_Tex2; + I.Color = p_postpr_Color; + I.Gray = p_postpr_Gray; + + SV_Target = _main (I); +} diff --git a/res/gamedata/shaders/gl/iostructs/v_TL.h b/res/gamedata/shaders/gl/iostructs/v_TL.h new file mode 100644 index 00000000000..d689420b6aa --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_TL.h @@ -0,0 +1,25 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITION) in float4 v_TL_P ; // POSITION; +layout(location = TEXCOORD0) in float2 v_TL_Tex0 ; // TEXCOORD0; +layout(location = COLOR) in float4 v_TL_Color ; // COLOR; + +layout(location = TEXCOORD0) out float2 v2p_TL_Tex0 ; // TEXCOORD0; +layout(location = COLOR) out float4 v2p_TL_Color; // COLOR; + +v2p_TL _main ( v_TL I ); + +void main() +{ + v_TL I; + I.P = v_TL_P; + I.Tex0 = v_TL_Tex0; + I.Color = v_TL_Color; + + v2p_TL O = _main (I); + + v2p_TL_Tex0 = O.Tex0; + v2p_TL_Color = O.Color; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_TL0uv.h b/res/gamedata/shaders/gl/iostructs/v_TL0uv.h new file mode 100644 index 00000000000..e165c51a7c3 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_TL0uv.h @@ -0,0 +1,21 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITION) in float4 v_TL0uv_P ; // POSITION; +layout(location = COLOR) in float4 v_TL0uv_Color ; // COLOR; + +layout(location = COLOR) out float4 v2p_TL0uv_Color ; // COLOR; + +v2p_TL0uv _main ( v_TL0uv I ); + +void main() +{ + v_TL0uv I; + I.P = v_TL0uv_P; + I.Color = v_TL0uv_Color; + + v2p_TL0uv O = _main (I); + + v2p_TL0uv_Color = O.Color; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_TL2uv.h b/res/gamedata/shaders/gl/iostructs/v_TL2uv.h new file mode 100644 index 00000000000..8b339df6b11 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_TL2uv.h @@ -0,0 +1,29 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITIONT) in float4 v_TL2uv_P ; // POSITIONT; +layout(location = TEXCOORD0) in float2 v_TL2uv_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float2 v_TL2uv_Tex1 ; // TEXCOORD1; +layout(location = COLOR) in float4 v_TL2uv_Color ; // COLOR; + +layout(location = TEXCOORD0) out float2 v2p_TL2uv_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) out float2 v2p_TL2uv_Tex1 ; // TEXCOORD1; +layout(location = COLOR) out float4 v2p_TL2uv_Color ; // COLOR; + +v2p_TL2uv _main ( v_TL2uv I ); + +void main() +{ + v_TL2uv I; + I.P = v_TL_P; + I.Tex0 = v_TL_Tex0; + I.Tex1 = v_TL_Tex1; + I.Color = v_TL2uv_Color; + + v2p_TL2uv O = _main (I); + + v2p_TL2uv_Tex0 = O.Tex0; + v2p_TL2uv_Tex1 = O.Tex1; + v2p_TL2uv_Color = O.Color; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_aa_AA.h b/res/gamedata/shaders/gl/iostructs/v_aa_AA.h new file mode 100644 index 00000000000..2483255d85a --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_aa_AA.h @@ -0,0 +1,45 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITIONT) in float4 v_aa_AA_P ; // POSITIONT; +layout(location = TEXCOORD0) in float2 v_aa_AA_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float2 v_aa_AA_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float2 v_aa_AA_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float2 v_aa_AA_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) in float2 v_aa_AA_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) in float4 v_aa_AA_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) in float4 v_aa_AA_Tex6 ; // TEXCOORD6; + +layout(location = TEXCOORD0) out float2 v2p_aa_AA_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) out float2 v2p_aa_AA_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) out float2 v2p_aa_AA_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) out float2 v2p_aa_AA_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) out float2 v2p_aa_AA_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) out float4 v2p_aa_AA_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) out float4 v2p_aa_AA_Tex6 ; // TEXCOORD6; + +v2p_aa_AA _main ( v_aa_AA I ); + +void main() +{ + v_aa_AA I; + I.P = v_aa_AA_P; + I.Tex0 = v_aa_AA_Tex0; + I.Tex1 = v_aa_AA_Tex1; + I.Tex2 = v_aa_AA_Tex2; + I.Tex3 = v_aa_AA_Tex3; + I.Tex4 = v_aa_AA_Tex4; + I.Tex5 = v_aa_AA_Tex5; + I.Tex6 = v_aa_AA_Tex6; + + v2p_aa_AA O = _main (I); + + v2p_aa_AA_Tex0 = O.Tex0; + v2p_aa_AA_Tex1 = O.Tex1; + v2p_aa_AA_Tex2 = O.Tex2; + v2p_aa_AA_Tex3 = O.Tex3; + v2p_aa_AA_Tex4 = O.Tex4; + v2p_aa_AA_Tex5 = O.Tex5; + v2p_aa_AA_Tex6 = O.Tex6; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_build.h b/res/gamedata/shaders/gl/iostructs/v_build.h new file mode 100644 index 00000000000..5c7926432b0 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_build.h @@ -0,0 +1,33 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITIONT) in float4 v_build_P ; // POSITIONT; +layout(location = TEXCOORD0) in float2 v_build_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float2 v_build_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float2 v_build_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float2 v_build_Tex3 ; // TEXCOORD3; + +layout(location = TEXCOORD0) out float2 v2p_build_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) out float2 v2p_build_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) out float2 v2p_build_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) out float2 v2p_build_Tex3 ; // TEXCOORD3; + +v2p_build _main ( v_build I ); + +void main() +{ + v_build I; + I.P = v_build_P; + I.Tex0 = v_build_Tex0; + I.Tex1 = v_build_Tex1; + I.Tex2 = v_build_Tex2; + I.Tex3 = v_build_Tex3; + + v2p_build O = _main (I); + + v2p_build_Tex0 = O.Tex0; + v2p_build_Tex1 = O.Tex1; + v2p_build_Tex2 = O.Tex2; + v2p_build_Tex3 = O.Tex2; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_dumb.h b/res/gamedata/shaders/gl/iostructs/v_dumb.h new file mode 100644 index 00000000000..fef0b166b95 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_dumb.h @@ -0,0 +1,16 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITION) in float4 v_dumb_P ; // POSITION; // Clip-space position (for rasterization) + +v2p_dumb _main ( v_dumb I ); + +void main() +{ + v_dumb I; + I.P = v_dumb_P; + + v2p_dumb O = _main (I); + + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_filter.h b/res/gamedata/shaders/gl/iostructs/v_filter.h new file mode 100644 index 00000000000..c2da1e72afb --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_filter.h @@ -0,0 +1,49 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITIONT) in float4 v_filter_P ; // POSITIONT; +layout(location = TEXCOORD0) in float4 v_filter_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) in float4 v_filter_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) in float4 v_filter_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) in float4 v_filter_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) in float4 v_filter_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) in float4 v_filter_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) in float4 v_filter_Tex6 ; // TEXCOORD6; +layout(location = TEXCOORD7) in float4 v_filter_Tex7 ; // TEXCOORD7; + +layout(location = TEXCOORD0) out float4 v2p_filter_Tex0 ; // TEXCOORD0; +layout(location = TEXCOORD1) out float4 v2p_filter_Tex1 ; // TEXCOORD1; +layout(location = TEXCOORD2) out float4 v2p_filter_Tex2 ; // TEXCOORD2; +layout(location = TEXCOORD3) out float4 v2p_filter_Tex3 ; // TEXCOORD3; +layout(location = TEXCOORD4) out float4 v2p_filter_Tex4 ; // TEXCOORD4; +layout(location = TEXCOORD5) out float4 v2p_filter_Tex5 ; // TEXCOORD5; +layout(location = TEXCOORD6) out float4 v2p_filter_Tex6 ; // TEXCOORD6; +layout(location = TEXCOORD7) out float4 v2p_filter_Tex7 ; // TEXCOORD7; + +v2p_filter _main ( v_filter I ); + +void main() +{ + v_filter I; + I.P = v_filter_P; + I.Tex0 = v_filter_Tex0; + I.Tex1 = v_filter_Tex1; + I.Tex2 = v_filter_Tex2; + I.Tex3 = v_filter_Tex3; + I.Tex4 = v_filter_Tex4; + I.Tex5 = v_filter_Tex5; + I.Tex6 = v_filter_Tex6; + I.Tex7 = v_filter_Tex7; + + v2p_filter O = _main (I); + + v2p_filter_Tex0 = O.Tex0; + v2p_filter_Tex1 = O.Tex1; + v2p_filter_Tex2 = O.Tex2; + v2p_filter_Tex3 = O.Tex3; + v2p_filter_Tex4 = O.Tex4; + v2p_filter_Tex5 = O.Tex5; + v2p_filter_Tex6 = O.Tex6; + v2p_filter_Tex7 = O.Tex7; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_postpr.h b/res/gamedata/shaders/gl/iostructs/v_postpr.h new file mode 100644 index 00000000000..9287e928c67 --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_postpr.h @@ -0,0 +1,37 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +layout(location = POSITIONT) in float4 v_postpr_P ; // POSITIONT; +layout(location = TEXCOORD0) in float2 v_postpr_Tex0 ; // TEXCOORD0; // base1 (duality) +layout(location = TEXCOORD1) in float2 v_postpr_Tex1 ; // TEXCOORD1; // base2 (duality) +layout(location = TEXCOORD2) in float2 v_postpr_Tex2 ; // TEXCOORD2; // base (noise) +layout(location = COLOR0) in float4 v_postpr_Color ; // COLOR0; // multiplier, color.w = noise_amount +layout(location = COLOR1) in float4 v_postpr_Gray ; // COLOR1; // (.3,.3,.3.,amount) + +layout(location = TEXCOORD0) out float2 v2p_postpr_Tex0 ; // TEXCOORD0; // base1 (duality) +layout(location = TEXCOORD1) out float2 v2p_postpr_Tex1 ; // TEXCOORD1; // base2 (duality) +layout(location = TEXCOORD2) out float2 v2p_postpr_Tex2 ; // TEXCOORD2; // base (noise) +layout(location = COLOR0) out float4 v2p_postpr_Color; // COLOR0; // multiplier, color.w = noise_amount +layout(location = COLOR1) out float4 v2p_postpr_Gray ; // COLOR1; // (.3,.3,.3.,amount) + +v2p_postpr _main ( v_postpr I ); + +void main() +{ + v_postpr I; + I.P = v_postpr_P; + I.Tex0 = v_postpr_Tex0; + I.Tex1 = v_postpr_Tex1; + I.Tex2 = v_postpr_Tex2; + I.Color = v_postpr_Color; + I.Gray = v_postpr_Gray; + + v2p_postpr O = _main (I); + + v2p_postpr_Tex0 = O.Tex0; + v2p_postpr_Tex1 = O.Tex1; + v2p_postpr_Tex2 = O.Tex2; + v2p_postpr_Color = O.Color; + v2p_postpr_Gray = O.Gray; + gl_Position = O.HPos; +} diff --git a/res/gamedata/shaders/gl/shared/cloudconfig.h b/res/gamedata/shaders/gl/shared/cloudconfig.h new file mode 100644 index 00000000000..e2e3b43ee92 --- /dev/null +++ b/res/gamedata/shaders/gl/shared/cloudconfig.h @@ -0,0 +1,11 @@ +#ifndef _CLOUDCONFIG_H +#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) + +#endif diff --git a/res/gamedata/shaders/gl/shared/common.h b/res/gamedata/shaders/gl/shared/common.h new file mode 100644 index 00000000000..d2736451e82 --- /dev/null +++ b/res/gamedata/shaders/gl/shared/common.h @@ -0,0 +1,107 @@ +////////////////////////////////////////////////// +// All comments by Nivenhbro are preceded by ! +///////////////////////////////////////////////// + + +#ifndef SHARED_COMMON_H +#define SHARED_COMMON_H + +#define half float +#define half2 vec2 +#define half3 vec3 +#define half4 vec4 +#define float2 vec2 +#define float3 vec3 +#define float4 vec4 +#define int2 ivec2 +#define int3 ivec3 +#define int4 ivec4 +#define half3x3 mat3 +#define half4x4 mat4 +#define half3x4 mat4x3 +#define float3x3 mat3 +#define float4x4 mat4 +#define float3x4 mat4x3 + +vec3 mul(mat3 a, vec3 b) { return a * b; } +vec3 mul(vec3 a, mat3 b) { return a * b; } +mat3 mul(mat3 a, mat3 b) { return a * b; } +vec4 mul(mat4 a, vec4 b) { return a * b; } +vec4 mul(vec4 a, mat4 b) { return a * b; } +mat4 mul(mat4 a, mat4 b) { return a * b; } +vec3 mul(mat4x3 a, vec4 b) { return a * b; } +vec3 mul(mat4x3 a, vec3 b) { return mat3(a) * b; } +void sincos(float x, out float s, out float c) { s = sin(x); c = cos(x); } + +#define lerp mix +#define frac fract +#define saturate(a) clamp(a, 0.0, 1.0) +#define clip(x) if (x < 0) discard +#define tex2D texture +#define tex2Dproj textureProj +#define tex2Dlod(s,t) textureLod(s,t.xy,t.w) +#define tex3D texture +#define texCUBE texture +#define samplerCUBE samplerCube + +// Semantics assignment, maximum 16 slots +#define COLOR 0 +#define COLOR0 0 +#define COLOR1 1 +#define COLOR2 2 +#define POSITION 3 +#define POSITIONT 3 +#define TANGENT 4 +#define NORMAL 5 +#define BINORMAL 6 +#define FOG 7 +#define TEXCOORD0 8 +#define TEXCOORD1 9 +#define TEXCOORD2 10 +#define TEXCOORD3 11 +#define TEXCOORD4 12 +#define TEXCOORD5 13 +#define TEXCOORD6 14 +#define TEXCOORD7 15 + +// +uniform half3x4 m_W; +uniform half3x4 m_V; +uniform half4x4 m_P; +uniform half3x4 m_WV; +uniform half4x4 m_VP; +uniform half4x4 m_WVP; +//uniform float4x4 m_texgen; +uniform float4x4 mVPTexgen; +uniform half4 timers; +uniform half4 fog_plane; +uniform float4 fog_params; // x=near*(1/(far-near)), ?,?, w = -1/(far-near) +uniform half4 fog_color; +uniform float3 L_sun_color; +uniform half3 L_sun_dir_w; +uniform half3 L_sun_dir_e; +uniform half4 L_hemi_color; +uniform half4 L_ambient; // L_ambient.w = skynbox-lerp-factor +uniform float3 eye_position; +uniform half3 eye_direction; +uniform half3 eye_normal; +uniform float4 dt_params; + +float calc_cyclic (float x) +{ + float phase = 1/(2*3.141592653589f); + float sqrt2 = 1.4142136f; + float sqrt2m2 = 2.8284271f; + float f = sqrt2m2*frac(x)-sqrt2; // [-sqrt2 .. +sqrt2] !No changes made, but this controls the grass wave (which is violent if I must say) + return f*f - 1.f; // [-1 .. +1] +} + +float2 calc_xz_wave (float2 dir2D, float frac) +{ + // Beizer + float2 ctrl_A = float2(0.f, 0.f ); + float2 ctrl_B = float2(dir2D.x, dir2D.y ); + return lerp (ctrl_A, ctrl_B, frac); //!This calculates tree wave. No changes made +} + +#endif diff --git a/res/gamedata/shaders/gl/shared/waterconfig.h b/res/gamedata/shaders/gl/shared/waterconfig.h new file mode 100644 index 00000000000..89d1e220053 --- /dev/null +++ b/res/gamedata/shaders/gl/shared/waterconfig.h @@ -0,0 +1,56 @@ +#ifndef _WATERCONFIG_H +#define _WATERCONFIG_H + +//настройки для: (1) +//waterdistortion +//waterdistortion2 + +#define W_POSITION_SHIFT_HEIGHT (1.f/60.f) //(1.f/100.f) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (25.f) //(25.0f) +#define W_DISTORT_BASE_TILE_0 (1.0f) //(1.0f) +#define W_DISTORT_BASE_TILE_1 (1.1f) //(1.1f) +#define W_DISTORT_AMP_0 (+0.15f) //(+0.15f) +#define W_DISTORT_AMP_1 (+0.55f) //(-0.30f) +#define W_DISTORT_POWER (1.0f) //(1.0f) + +#endif + + +/* +//////////////////////////////////////////////////////////////////////////////// +-- waters clear +//////////////////////////////////////////////////////////////////////////////// +настройки для: + waterdistortion + waterdistortion2 +//////////////////////////////////////////////////////////////////////////////// +#define W_POSITION_SHIFT_HEIGHT (1.f/50.f) //(1.f/100.f) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (15.f) //(25.0f) +#define W_DISTORT_BASE_TILE_0 (1.3f) //(1.6f) +#define W_DISTORT_BASE_TILE_1 (2.3f) //(1.1f) +#define W_DISTORT_AMP_0 (+0.35f) //(+0.15f) +#define W_DISTORT_AMP_1 (-1.75f) //(-0.30f) +#define W_DISTORT_POWER (1.0f) //(1.0f) +//////////////////////////////////////////////////////////////////////////////// +настройки для: + waterdistortion + waterdistortion +//////////////////////////////////////////////////////////////////////////////// +#define W_POSITION_SHIFT_HEIGHT (1.f/80.f) //(1.f/100.f) //amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (20.f) //(25.0f) +#define W_DISTORT_BASE_TILE_0 (1.6f) //(1.6f) +#define W_DISTORT_BASE_TILE_1 (1.1f) //(1.1f) +#define W_DISTORT_AMP_0 (+0.15f) //(+0.15f) +#define W_DISTORT_AMP_1 (-0.30f) //(-0.30f) +#define W_DISTORT_POWER (6.0f) //(6.0f) +//////////////////////////////////////////////////////////////////////////////// +-- waters mulyaka +//////////////////////////////////////////////////////////////////////////////// +#define W_POSITION_SHIFT_HEIGHT (1.f/50.f) // amplitude /50 - small, /10 - large +#define W_POSITION_SHIFT_SPEED (25.f) +#define W_DISTORT_BASE_TILE (0.1f) //(1.0f) +#define W_DISTORT_AMP_0 (+0.58f) //(-0.08f) +#define W_DISTORT_AMP_1 (+0.38f) //(+0.18f) +#define W_DISTORT_POWER (3.0f) //(2.0f) +//////////////////////////////////////////////////////////////////////////////// +*/ diff --git a/res/gamedata/shaders/gl/shared/watermove.h b/res/gamedata/shaders/gl/shared/watermove.h new file mode 100644 index 00000000000..ff74528959f --- /dev/null +++ b/res/gamedata/shaders/gl/shared/watermove.h @@ -0,0 +1,26 @@ +#ifndef _WATERMOVE_H +#define _WATERMOVE_H + +float4 watermove (float4 P) { + float3 wave1 = float3(0.11f,0.13f,0.07f)*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 ; + float angle = timers.z + dot (P,wave1) ; + float du = sin (angle); + float dv = cos (angle); + return (base + amp*float2(du,dv)); +} + +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)); + amount = 1 - fresnel*fresnel; // 0=full env, 1=no env + return vreflect; +} + +#endif diff --git a/res/gamedata/shaders/gl/shared/wmark.h b/res/gamedata/shaders/gl/shared/wmark.h new file mode 100644 index 00000000000..19756107e0b --- /dev/null +++ b/res/gamedata/shaders/gl/shared/wmark.h @@ -0,0 +1,24 @@ +#ifndef WMARK_H +#define WMARK_H +#include "common.h" + +#define NORMAL_SHIFT 0.007f +#define MIN_SHIFT 0.003f +#define MAX_SHIFT 0.011f +#define RANGE 100.f + +//uniform float3 eye_direction; + +float4 wmark_shift (float3 pos, float3 norm) +{ + float3 P = pos; + float3 N = norm; + float3 sd = eye_position-P; + float d = length(sd); + float w = min(d/RANGE,1.f); + float s = lerp(MIN_SHIFT,MAX_SHIFT,d); + P += N.xyz*NORMAL_SHIFT; + P -= normalize(eye_direction + normalize(P-eye_position)) * s; + return float4 (P,1.f); +} +#endif \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_default.ps b/res/gamedata/shaders/gl/stub_default.ps new file mode 100644 index 0000000000000000000000000000000000000000..257c7e6ab1b69b4312c6a19962d77cb721c11495 GIT binary patch literal 339 zcmcJJy$ZrG6ou#JDK72Oiq;}J6$jC!;2>I@gb?Gc4Wvy;QYeV;Zi1z&lXpBn-#w9N zx$GYZAy-YK+O!TyG-*N^t9x$Et)u19dt~{yb7(k;0VS!VVs;I*VWNc?{BI~A0T;Mj zY02~xEqReZqwRGI7Kha#21D=6;2esy#36%ZR-}6+mCpU>U}S1Eu>IX|1ujJwyZEA^ ZJK5Fjj8&3*(qv@m=Btc5TsS9h@&QR@Tkrq? literal 0 HcmV?d00001 diff --git a/res/gamedata/shaders/gl/stub_default.s b/res/gamedata/shaders/gl/stub_default.s new file mode 100644 index 00000000000..a40a95a86f1 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_default.s @@ -0,0 +1,9 @@ +function normal (shader, t_base, t_second, t_detail) + shader:begin ("stub_default","stub_default") + +-- Decouple sampler and texture +-- shader:sampler ("s_base") : texture(t_base) : clamp() : f_linear () +-- TODO: DX10: move stub_default to smp_rtlinear + shader:dx10texture ("s_base", t_base) + shader:dx10sampler ("smp_base") +end \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_default.vs b/res/gamedata/shaders/gl/stub_default.vs new file mode 100644 index 00000000000..be88493b2bc --- /dev/null +++ b/res/gamedata/shaders/gl/stub_default.vs @@ -0,0 +1,15 @@ +#include "common.h" +#include "iostructs\v_TL.h" + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_TL _main ( v_TL I) +{ + v2p_TL O; + + O.HPos = mul( m_WVP, I.P); + O.Tex0 = I.Tex0; + O.Color = I.Color.bgra; // swizzle vertex colour + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_default_ma.ps b/res/gamedata/shaders/gl/stub_default_ma.ps new file mode 100644 index 0000000000000000000000000000000000000000..31cb4955faf9319fa29b4d671fd6d1dd0eb0ec43 GIT binary patch literal 483 zcmcIhJ!``-5S^u8aU_dUTqh0b6g-q>33Mo}=~OU^dr1V6B_tUPrT@JrTcm^MN|WBl z={;$wx>omJ2#eMlW4rRY;L97PY>2*ZWB7DU{gODoUe`Fp-sAQFp*hKbd%}V=PNRol zT*e6euSKKbRSl>)KWi)F4vbVC2uLB}2rD4L`$tntf5FJVIm_%+LM?%uI^b1|el#`Fgsi}A<#!bQ>{tIxBhD-ne literal 0 HcmV?d00001 diff --git a/res/gamedata/shaders/gl/stub_notransform.vs b/res/gamedata/shaders/gl/stub_notransform.vs new file mode 100644 index 00000000000..e7b1b0e7b98 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform.vs @@ -0,0 +1,16 @@ +#include "common_iostructs.h" +#include "iostructs\v_TL.h" + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_TL _main ( v_TL I ) +{ + v2p_TL O; + + 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 + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_2uv.vs b/res/gamedata/shaders/gl/stub_notransform_2uv.vs new file mode 100644 index 00000000000..fd2c0610431 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_2uv.vs @@ -0,0 +1,17 @@ +#include "common_iostructs.h" +#include "iostructs\v_TL2uv.h" + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_TL2uv _main ( v_TL2uv I ) +{ + v2p_TL2uv O; + + O.HPos = I.P; + 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 + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_aa_aa.vs b/res/gamedata/shaders/gl/stub_notransform_aa_aa.vs new file mode 100644 index 00000000000..23dac10995c --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_aa_aa.vs @@ -0,0 +1,33 @@ +#include "common_iostructs.h" +#include "iostructs\v_aa_AA.h" + +uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution) + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_aa_AA _main ( v_aa_AA I ) +{ + v2p_aa_AA O; + +// O.HPos = I.P; + + { + 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; + O.HPos.zw = I.P.zw; + } + + + O.Tex0 = I.Tex0; + O.Tex1 = I.Tex1; + O.Tex2 = I.Tex2; + O.Tex3 = I.Tex3; + O.Tex4 = I.Tex4; + O.Tex5 = I.Tex5; + O.Tex6 = I.Tex6; + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_build.vs b/res/gamedata/shaders/gl/stub_notransform_build.vs new file mode 100644 index 00000000000..c0998ea0887 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_build.vs @@ -0,0 +1,28 @@ +#include "common_iostructs.h" +#include "iostructs\v_build.h" + +float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution) + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_build _main ( v_build I ) +{ + v2p_build O; + + { + + I.P.xy += 0.5f; // Bugs with rasterizer??? Possible float-pixel shift. +// 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; + O.HPos.zw = I.P.zw; + } + + O.Tex0 = I.Tex0; + O.Tex1 = I.Tex1; + O.Tex2 = I.Tex2; + O.Tex3 = I.Tex3; + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_filter.vs b/res/gamedata/shaders/gl/stub_notransform_filter.vs new file mode 100644 index 00000000000..7336c11c2f1 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_filter.vs @@ -0,0 +1,31 @@ +#include "common_iostructs.h" +#include "iostructs\v_filter.h" + +float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution) + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_filter _main ( v_filter I ) +{ + v2p_filter O; + +// O.HPos = I.P; + { + I.P.xy += 0.5f; // Bugs with rasterizer??? Possible float-pixel shift. +// 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; + O.HPos.zw = I.P.zw; + } + O.Tex0 = I.Tex0; + O.Tex1 = I.Tex1; + O.Tex2 = I.Tex2; + O.Tex3 = I.Tex3; + O.Tex4 = I.Tex4; + O.Tex5 = I.Tex5; + O.Tex6 = I.Tex6; + O.Tex7 = I.Tex7; + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_postpr.vs b/res/gamedata/shaders/gl/stub_notransform_postpr.vs new file mode 100644 index 00000000000..fabe299fae2 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_postpr.vs @@ -0,0 +1,32 @@ +#include "common_iostructs.h" +#include "iostructs\v_postpr.h" + +uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution) + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_postpr _main ( v_postpr I ) +{ + v2p_postpr O; + +// O.HPos = I.P; + + { + 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; + O.HPos.zw = I.P.zw; + } + + + 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 + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_t.vs b/res/gamedata/shaders/gl/stub_notransform_t.vs new file mode 100644 index 00000000000..0aec0ba5319 --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_t.vs @@ -0,0 +1,27 @@ +#include "common_iostructs.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; + +// O.HPos = P; + + { + 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; + O.HPos.zw = I.P.zw; + } + + O.Tex0 = I.Tex0; + O.Color = I.Color.bgra; // swizzle vertex colour + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_t_m2.vs b/res/gamedata/shaders/gl/stub_notransform_t_m2.vs new file mode 100644 index 00000000000..a21a9d7124f --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_t_m2.vs @@ -0,0 +1,27 @@ +#include "common_iostructs.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; + +// O.HPos = P; + + { + 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; + O.HPos.zw = I.P.zw; + } + + O.Tex0 = I.Tex0; + O.Color = float4(I.Color.bgr*2, 1.0f); // swizzle vertex colour + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_t_m4.vs b/res/gamedata/shaders/gl/stub_notransform_t_m4.vs new file mode 100644 index 00000000000..9db0832203f --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_t_m4.vs @@ -0,0 +1,27 @@ +#include "common_iostructs.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; + +// O.HPos = P; + + { + 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; + O.HPos.zw = I.P.zw; + } + + O.Tex0 = I.Tex0; + O.Color = float4(I.Color.bgr*4, 1.0f); // swizzle vertex colour + + return O; +} \ No newline at end of file diff --git a/res/gamedata/shaders/gl/stub_notransform_t_ma.vs b/res/gamedata/shaders/gl/stub_notransform_t_ma.vs new file mode 100644 index 00000000000..a4832a2dedf --- /dev/null +++ b/res/gamedata/shaders/gl/stub_notransform_t_ma.vs @@ -0,0 +1,23 @@ +#include "common_iostructs.h" +#include "iostructs\v_TL.h" + +////////////////////////////////////////////////////////////////////////////////////////// +// Vertex +v2p_TL _main ( v_TL I ) +{ + v2p_TL O; + +// O.HPos = P; + + { + 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.zw = I.P.zw; + } + + O.Tex0 = I.Tex0; + O.Color = I.Color.aaaa; // swizzle vertex colour + + return O; +} \ No newline at end of file diff --git a/src/Layers/xrRenderPC_GL/rgl.cpp b/src/Layers/xrRenderPC_GL/rgl.cpp index 4bbec9374cc..dea8c24a96a 100644 --- a/src/Layers/xrRenderPC_GL/rgl.cpp +++ b/src/Layers/xrRenderPC_GL/rgl.cpp @@ -914,6 +914,7 @@ HRESULT CRender::shader_compile( GLchar* _pErrorMsgs = NULL; if ((GLboolean)status == GL_TRUE) { CHK_GL(glAttachShader(program, shader)); + CHK_GL(glBindFragDataLocation(program, 0, "SV_Target")); CHK_GL(glLinkProgram(program)); CHK_GL(glDetachShader(program, shader)); CHK_GL(glGetProgramiv(program, GL_LINK_STATUS, &status));