From cf88690a76c494f1cea8ba7afc35d912a2536c8a Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 28 Oct 2018 20:21:18 +0100 Subject: [PATCH] shaders: attribute/varying -> in/out --- config/glsl/aa.cfg | 47 +++++---------- config/glsl/ao.cfg | 28 ++++----- config/glsl/blur.cfg | 12 ++-- config/glsl/decal.cfg | 42 ++++++------- config/glsl/deferred.cfg | 9 +-- config/glsl/edit.cfg | 24 ++++---- config/glsl/fxaa.cfg | 8 +-- config/glsl/gi.cfg | 68 ++++++++++----------- config/glsl/grass.cfg | 16 ++--- config/glsl/hud.cfg | 92 ++++++++++++++--------------- config/glsl/material.cfg | 108 ++++++++++++++++----------------- config/glsl/misc.cfg | 68 ++++++++++----------- config/glsl/model.cfg | 46 +++++++-------- config/glsl/movie.cfg | 40 ++++++------- config/glsl/particle.cfg | 62 +++++++++---------- config/glsl/postfx.cfg | 36 +++++------ config/glsl/scale.cfg | 24 ++++---- config/glsl/shared.cfg | 16 ++--- config/glsl/sky.cfg | 44 +++++++------- config/glsl/smaa.cfg | 32 +++++----- config/glsl/stain.cfg | 16 ++--- config/glsl/tonemap.cfg | 118 ++++++++++++++++++------------------- config/glsl/ui.cfg | 10 ++-- config/glsl/volumetric.cfg | 12 ++-- config/glsl/world.cfg | 90 ++++++++++++++-------------- src/engine/shader.cpp | 93 +++++++---------------------- 26 files changed, 547 insertions(+), 614 deletions(-) diff --git a/config/glsl/aa.cfg b/config/glsl/aa.cfg index c6bc12c..900e2fd 100644 --- a/config/glsl/aa.cfg +++ b/config/glsl/aa.cfg @@ -5,19 +5,15 @@ //////////////////////////////////////////////// lazyshader 0 "tqaaresolve" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; - @(? $tqaaresolvegather [ - varying vec2 texcoord1; - ]) + out vec2 texcoord0; + out vec2 texcoord1; void main(void) { gl_Position = vvertex; texcoord0 = vtexcoord0; - @(? $tqaaresolvegather [ - texcoord1 = vtexcoord0 - 0.5; - ]) + texcoord1 = vtexcoord0 - 0.5; } ] [ @(gfetchdefs tex2) @@ -26,11 +22,9 @@ lazyshader 0 "tqaaresolve" [ uniform mat4 reprojectmatrix; uniform vec2 maxvelocity; uniform vec2 colorweight; - varying vec2 texcoord0; - @(? $tqaaresolvegather [ - varying vec2 texcoord1; - ]) - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec2 texcoord1; + layout(location = 0) out vec4 fragcolor; void main(void) { @(gdepthunpack depth [gfetch(tex2, texcoord0)] [ @@ -46,24 +40,15 @@ lazyshader 0 "tqaaresolve" [ vec4 color = texture2DRect(tex0, texcoord0 + mask*quincunx.xy); vec4 prevcolor = texture2DRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale)); - @(? $tqaaresolvegather [ - vec4 l0 = textureGather(tex0, texcoord1, 1); - vec4 l1 = textureGatherOffset(tex0, texcoord1, ivec2(1, 1), 1); - float l2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).g; - float l3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).g; - vec4 l01min = min(l0, l1), l01max = max(l0, l1); - l01min.xy = min(l01min.xy, l01min.zw); - l01max.xy = max(l01max.xy, l01max.zw); - float lmin = min(min(l01min.x, l01min.y), min(l2, l3)); - float lmax = max(max(l01max.x, l01max.y), max(l2, l3)); - ] [ - float l0 = texture2DRect(tex0, texcoord0 + vec2(-1.0, -0.5)).g; - float l1 = texture2DRect(tex0, texcoord0 + vec2( 0.5, -1.0)).g; - float l2 = texture2DRect(tex0, texcoord0 + vec2( 1.0, 0.5)).g; - float l3 = texture2DRect(tex0, texcoord0 + vec2(-0.5, 1.0)).g; - float lmin = min(color.g, min(min(l0, l1), min(l2, l3))); - float lmax = max(color.g, max(max(l0, l1), max(l2, l3))); - ]) + vec4 l0 = textureGather(tex0, texcoord1, 1); + vec4 l1 = textureGatherOffset(tex0, texcoord1, ivec2(1, 1), 1); + float l2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).g; + float l3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).g; + vec4 l01min = min(l0, l1), l01max = max(l0, l1); + l01min.xy = min(l01min.xy, l01min.zw); + l01max.xy = max(l01max.xy, l01max.zw); + float lmin = min(min(l01min.x, l01min.y), min(l2, l3)); + float lmax = max(max(l01max.x, l01max.y), max(l2, l3)); float weight = 0.5 - 0.5*clamp((colorweight.x*max(prevcolor.g - lmax, lmin - prevcolor.g) + colorweight.y) / (lmax - lmin + 1e-4), 0.0, 1.0); weight *= clamp(1.0 - 2.0*(prevcolor.a - color.a), 0.0, 1.0); diff --git a/config/glsl/ao.cfg b/config/glsl/ao.cfg index a8f17e4..edafcf8 100644 --- a/config/glsl/ao.cfg +++ b/config/glsl/ao.cfg @@ -25,10 +25,10 @@ ambientobscurancevariantshader = [ derivnormal = (>= (strstr $arg2 "d") 0) maxaotaps = $arg3 shader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) @(screentexcoord 1) - varying vec2 texcoord0, texcoord1; + out vec2 texcoord0, texcoord1; void main(void) { gl_Position = vvertex; @@ -53,8 +53,8 @@ ambientobscurancevariantshader = [ #define depthtc texcoord0 ]) uniform vec3 gdepthpackparams; - varying vec2 texcoord0, texcoord1; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0, texcoord1; + layout(location = 0) out vec4 fragcolor; void main(void) { @(if (&& $derivnormal [= $aodepthformat 1]) [result [ @@ -127,9 +127,9 @@ ambientobscuranceshader = [ ] shader 0 "linearizedepth" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -138,8 +138,8 @@ shader 0 "linearizedepth" [ ] [ @(gfetchdefs tex0 $msaasamples) uniform vec3 gdepthpackparams; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @(if (! $aodepthformat) [ @@ -165,14 +165,14 @@ bilateralvariantshader = [ reduced = $arg4 filterdir = $arg5 shader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(if $reduced [result [ @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; ]]) @(if $upscaled [result [ @(screentexcoord 1) - varying vec2 texcoord1; + out vec2 texcoord1; ]]) void main(void) { @@ -185,9 +185,9 @@ bilateralvariantshader = [ uniform sampler2DRect tex0; uniform vec2 bilateralparams; uniform vec3 gdepthpackparams; - @(? $reduced [varying vec2 texcoord0;]) - @(? $upscaled [varying vec2 texcoord1;]) - fragdata(0) vec4 fragcolor; + @(? $reduced [in vec2 texcoord0;]) + @(? $upscaled [in vec2 texcoord1;]) + layout(location = 0) out vec4 fragcolor; void main(void) { #define tc @(? $upscaled [texcoord1] [gl_FragCoord.xy]) diff --git a/config/glsl/blur.cfg b/config/glsl/blur.cfg index bf9c68a..5bf019a 100644 --- a/config/glsl/blur.cfg +++ b/config/glsl/blur.cfg @@ -6,12 +6,12 @@ blurshader = [ shader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) uniform float offsets[8]; - varying vec2 texcoord0, texcoordp1, texcoordn1; + out vec2 texcoord0, texcoordp1, texcoordn1; @(loopconcat+ i 2 (min (- $arg2 1) 2) [result [ - varying vec2 texcoordp@i, texcoordn@i; + out vec2 texcoordp@i, texcoordn@i; ]]) void main(void) { @@ -33,11 +33,11 @@ blurshader = [ uniform float weights[8]; uniform float offsets[8]; uniform sampler@[arg4] tex0; - varying vec2 texcoord0, texcoordp1, texcoordn1; + in vec2 texcoord0, texcoordp1, texcoordn1; @(loopconcat+ i 2 (min (- $arg2 1) 2) [result [ - varying vec2 texcoordp@i, texcoordn@i; + in vec2 texcoordp@i, texcoordn@i; ]]) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { #define texval(coords) texture@[arg4](tex0, (coords)) diff --git a/config/glsl/decal.cfg b/config/glsl/decal.cfg index 28c1da2..bd2bc07 100644 --- a/config/glsl/decal.cfg +++ b/config/glsl/decal.cfg @@ -51,22 +51,22 @@ decalvariantshader = [ defuniformparam "bumpblend" 1 // alpha-blend strength for normals ] variantshader $stype $arg1 $srow [ - attribute vec4 vvertex; + in vec4 vvertex; @(? (dtopt "n") [ - attribute vec4 vtangent; - varying mat3 world; + in vec4 vtangent; + out mat3 world; ] [ - varying vec3 nvec; + out vec3 nvec; ]) - attribute vec4 vnormal; - attribute vec3 vtexcoord0; + in vec4 vnormal; + in vec3 vtexcoord0; uniform mat4 camprojmatrix; - varying vec4 texcoord0; + out vec4 texcoord0; @(? (|| (dtopt "p") (dtopt "r")) [ uniform vec3 camera; - varying vec3 camvec; + out vec3 camvec; ]) - @(? (dtopt "G") [uniform float millis; flat varying float pulse;]) + @(? (dtopt "G") [uniform float millis; flat out float pulse;]) void main(void) { gl_Position = camprojmatrix * vvertex; @@ -91,31 +91,31 @@ decalvariantshader = [ } ] [ @(cond [dtopt "0"] [result [ - fragdata(0) vec4 gcolor; - fragblend(0) vec4 gcolorblend; + layout(location = 0) out vec4 gcolor; + layout(location = 0, index = 1) out vec4 gcolorblend; ]] [dtopt "1"] [ ? $usepacknorm [ - fragdata(0) vec4 gnormal; + layout(location = 0) out vec4 gnormal; ] [ - fragdata(0) vec4 gnormal; - fragblend(0) vec4 gnormalblend; + layout(location = 0) out vec4 gnormal; + layout(location = 0, index = 1) out vec4 gnormalblend; ] ] [result [ - fragdata(0) vec4 gcolor; - fragdata(1) vec4 gnormal; + layout(location = 0) out vec4 gcolor; + layout(location = 1) out vec4 gnormal; ]]) uniform sampler2D diffusemap; uniform vec4 colorparams; - varying vec4 texcoord0; + in vec4 texcoord0; @(? (dtopt "n") [ uniform sampler2D normalmap; - varying mat3 world; + in mat3 world; ] [ - varying vec3 nvec; + in vec3 nvec; ]) - @(? (|| (dtopt "p") (dtopt "r")) [varying vec3 camvec;]) + @(? (|| (dtopt "p") (dtopt "r")) [in vec3 camvec;]) @(? (|| (dtopt "g") (dtopt "S")) [uniform sampler2D glowmap;]) - @(? (dtopt "G") [flat varying float pulse;]) + @(? (dtopt "G") [flat in float pulse;]) @(? (dtopt "r") [uniform samplerCube envmap;]) void main(void) { diff --git a/config/glsl/deferred.cfg b/config/glsl/deferred.cfg index b1d432e..ca8cd78 100644 --- a/config/glsl/deferred.cfg +++ b/config/glsl/deferred.cfg @@ -36,7 +36,7 @@ msaadetectedges = [ ] lazyshader 0 msaaedgedetect [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; @@ -119,16 +119,13 @@ deferredlightvariantshader = [ transparent = (<= 8 $arg2 16) avatar = (<= 17 $arg2 31) variantshader 0 $arg1 $arg2 (? (< $arg2 0) [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 lightmatrix; void main(void) { gl_Position = lightmatrix * vvertex; } ]) [ - @(? (&& (dlopt "S") [< $glslversion 400]) [ - #extension GL_ARB_sample_shading : enable - ]) @(? (&& (dlopt "T") [glext "GL_EXT_shader_samples_identical"]) [ #extension GL_EXT_shader_samples_identical : enable ]) @@ -183,7 +180,7 @@ deferredlightvariantshader = [ uniform vec4 lightscale; @(? (&& (dlopt "a") [! $avatar] [! $transparent]) [uniform sampler2DRect tex5; uniform vec2 aoscale; uniform vec4 aoparams;]) @(gdepthunpackparams) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; @(if (dlopt "p") [ ? $spotlight [ diff --git a/config/glsl/edit.cfg b/config/glsl/edit.cfg index 1278e1b..61b775f 100644 --- a/config/glsl/edit.cfg +++ b/config/glsl/edit.cfg @@ -5,12 +5,12 @@ //////////////////////////////////////////////// shader 0 "blendbrush" [ - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 camprojmatrix; uniform vec4 texgenS, texgenT; uniform float ldrscale; - varying vec4 color; - varying vec2 texcoord0; + out vec4 color; + out vec2 texcoord0; void main(void) { gl_Position = camprojmatrix * vvertex; @@ -19,9 +19,9 @@ shader 0 "blendbrush" [ } ] [ uniform sampler2D tex0; - varying vec4 color; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 color; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = texture2D(tex0, texcoord0).r * color; @@ -29,12 +29,12 @@ shader 0 "blendbrush" [ ] lazyshader 0 "prefab" [ - attribute vec4 vvertex, vcolor; - attribute vec3 vnormal; + in vec4 vvertex, vcolor; + in vec3 vnormal; uniform mat4 prefabmatrix; uniform mat3 prefabworld; - varying vec3 nvec; - varying vec4 color; + out vec3 nvec; + out vec4 color; @(msaainterpvert) void main(void) @@ -45,8 +45,8 @@ lazyshader 0 "prefab" [ @(msaapackvert) } ] [ - varying vec3 nvec; - varying vec4 color; + in vec3 nvec; + in vec4 color; @(msaainterpfrag) void main(void) diff --git a/config/glsl/fxaa.cfg b/config/glsl/fxaa.cfg index 62b3b72..1471cb5 100644 --- a/config/glsl/fxaa.cfg +++ b/config/glsl/fxaa.cfg @@ -216,9 +216,9 @@ fxaadefs = [ ] shader 0 [fxaa@fxaapreset@fxaaopts] [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -226,9 +226,9 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ } ] [ @fxaadefs - varying vec2 texcoord0; + in vec2 texcoord0; uniform sampler2DRect tex0; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { #define posM texcoord0 diff --git a/config/glsl/gi.cfg b/config/glsl/gi.cfg index ddb722b..51938d6 100644 --- a/config/glsl/gi.cfg +++ b/config/glsl/gi.cfg @@ -5,15 +5,15 @@ //////////////////////////////////////////////// lazyshader 0 "rsmsky" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 rsmmatrix; void main(void) { gl_Position = rsmmatrix * vvertex; } ] [ - fragdata(0) vec4 gcolor; - fragdata(1) vec4 gnormal; + layout(location = 0) out vec4 gcolor; + layout(location = 1) out vec4 gnormal; void main(void) { gcolor = vec4(0.0, 0.0, 0.0, 1.0); @@ -170,11 +170,11 @@ rsmtapoffsets32 = [ radiancehintsshader = [ numtaps = (cond [> $arg1 20] 32 [> $arg1 12] 20 12) shader 0 [radiancehints@arg1] [ - attribute vec4 vvertex; - attribute vec3 vtexcoord0; + in vec4 vvertex; + in vec3 vtexcoord0; uniform mat4 rsmtcmatrix; - varying vec3 rhcenter; - varying vec2 rsmcenter; + out vec3 rhcenter; + out vec2 rsmcenter; void main(void) { gl_Position = vvertex; @@ -187,12 +187,12 @@ radiancehintsshader = [ uniform vec2 rsmspread; uniform float rhatten, rhspread, rhaothreshold, rhaoatten, rhaoheight; uniform vec3 rsmdir; - varying vec3 rhcenter; - varying vec2 rsmcenter; - fragdata(0) vec4 rhr; - fragdata(1) vec4 rhg; - fragdata(2) vec4 rhb; - fragdata(3) vec4 rha; + in vec3 rhcenter; + in vec2 rsmcenter; + layout(location = 0) out vec4 rhr; + layout(location = 1) out vec4 rhg; + layout(location = 2) out vec4 rhb; + layout(location = 3) out vec4 rha; void calcrhsample(vec3 rhtap, vec2 rsmtap, inout vec4 shr, inout vec4 shg, inout vec4 shb, inout vec4 sha) { @@ -234,9 +234,9 @@ radiancehintsshader = [ ] lazyshader 0 radiancehintsborder [ - attribute vec4 vvertex; - attribute vec3 vtexcoord0; - varying vec3 texcoord0; + in vec4 vvertex; + in vec3 vtexcoord0; + out vec3 texcoord0; void main(void) { gl_Position = vvertex; @@ -245,11 +245,11 @@ lazyshader 0 radiancehintsborder [ ] [ uniform sampler3D tex3, tex4, tex5, tex6; uniform vec3 bordercenter, borderrange, borderscale; - varying vec3 texcoord0; - fragdata(0) vec4 rhr; - fragdata(1) vec4 rhg; - fragdata(2) vec4 rhb; - fragdata(3) vec4 rha; + in vec3 texcoord0; + layout(location = 0) out vec4 rhr; + layout(location = 1) out vec4 rhg; + layout(location = 2) out vec4 rhb; + layout(location = 3) out vec4 rha; void main(void) { @@ -263,9 +263,9 @@ lazyshader 0 radiancehintsborder [ ] lazyshader 0 radiancehintscached [ - attribute vec4 vvertex; - attribute vec3 vtexcoord0; - varying vec3 texcoord0; + in vec4 vvertex; + in vec3 vtexcoord0; + out vec3 texcoord0; void main(void) { gl_Position = vvertex; @@ -273,11 +273,11 @@ lazyshader 0 radiancehintscached [ } ] [ uniform sampler3D tex7, tex8, tex9, tex10; - varying vec3 texcoord0; - fragdata(0) vec4 rhr; - fragdata(1) vec4 rhg; - fragdata(2) vec4 rhb; - fragdata(3) vec4 rha; + in vec3 texcoord0; + layout(location = 0) out vec4 rhr; + layout(location = 1) out vec4 rhg; + layout(location = 2) out vec4 rhb; + layout(location = 3) out vec4 rha; void main(void) { @@ -289,7 +289,7 @@ lazyshader 0 radiancehintscached [ ] lazyshader 0 radiancehintsdisable [ - attribute vec4 vvertex; + in vec4 vvertex; uniform vec3 rhcenter; uniform float rhbounds; void main(void) @@ -297,10 +297,10 @@ lazyshader 0 radiancehintsdisable [ gl_Position = vec4((vvertex.xy - rhcenter.xy)/rhbounds, vvertex.zw); } ] [ - fragdata(0) vec4 rhr; - fragdata(1) vec4 rhg; - fragdata(2) vec4 rhb; - fragdata(3) vec4 rha; + layout(location = 0) out vec4 rhr; + layout(location = 1) out vec4 rhg; + layout(location = 2) out vec4 rhb; + layout(location = 3) out vec4 rha; void main(void) { diff --git a/config/glsl/grass.cfg b/config/glsl/grass.cfg index 1a56b71..4bc694e 100644 --- a/config/glsl/grass.cfg +++ b/config/glsl/grass.cfg @@ -13,13 +13,13 @@ grassvariantshader = [ local grasstype grasstype = $arg2 variantshader 0 $arg1 (? (grassopt "b") 0 -1) [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; @(ginterpvert) - varying vec2 texcoord0; - varying vec4 colorscale; - @(? (grassopt "b") [uniform vec4 blendmapparams; varying vec2 texcoord1;]) + out vec2 texcoord0; + out vec4 colorscale; + @(? (grassopt "b") [uniform vec4 blendmapparams; out vec2 texcoord1;]) void main(void) { gl_Position = camprojmatrix * vvertex; @@ -34,9 +34,9 @@ grassvariantshader = [ uniform sampler2D tex0; uniform float grasstest; @(ginterpfrag) - varying vec2 texcoord0; - varying vec4 colorscale; - @(? (grassopt "b") [uniform sampler2D tex1; varying vec2 texcoord1;]) + in vec2 texcoord0; + in vec4 colorscale; + @(? (grassopt "b") [uniform sampler2D tex1; in vec2 texcoord1;]) void main(void) { vec4 color = texture2D(tex0, texcoord0) * colorscale; diff --git a/config/glsl/hud.cfg b/config/glsl/hud.cfg index 8b920e6..83b72de 100644 --- a/config/glsl/hud.cfg +++ b/config/glsl/hud.cfg @@ -5,11 +5,11 @@ /////////////////////////////////////////////////// shader 0 "hud" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 hudmatrix; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = hudmatrix * vvertex; @@ -18,9 +18,9 @@ shader 0 "hud" [ } ] [ uniform sampler2D tex0; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -29,11 +29,11 @@ shader 0 "hud" [ ] shader 0 "hudtext" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 hudmatrix; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = hudmatrix * vvertex; @@ -43,9 +43,9 @@ shader 0 "hudtext" [ ] [ uniform sampler2D tex0; uniform vec4 textparams; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { float dist = texture2D(tex0, texcoord0).r; @@ -56,11 +56,11 @@ shader 0 "hudtext" [ ] shader 0 "hudrgb" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 hudmatrix; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = hudmatrix * vvertex; @@ -69,9 +69,9 @@ shader 0 "hudrgb" [ } ] [ uniform sampler2D tex0; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -81,17 +81,17 @@ shader 0 "hudrgb" [ ] shader 0 "hudnotexture" [ - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 hudmatrix; - varying vec4 color; + out vec4 color; void main(void) { gl_Position = hudmatrix * vvertex; color = vcolor; } ] [ - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; @@ -99,11 +99,11 @@ shader 0 "hudnotexture" [ ] shader 0 "hudrect" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 hudmatrix; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = hudmatrix * vvertex; @@ -112,9 +112,9 @@ shader 0 "hudrect" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = colorscale * texture2DRect(tex0, texcoord0); @@ -122,11 +122,11 @@ shader 0 "hudrect" [ ] shader 0 "hud3d" [ - attribute vec4 vvertex, vcolor; - attribute vec3 vtexcoord0; + in vec4 vvertex, vcolor; + in vec3 vtexcoord0; uniform mat4 hudmatrix; - varying vec3 texcoord0; - varying vec4 color; + out vec3 texcoord0; + out vec4 color; void main(void) { gl_Position = hudmatrix * vvertex; @@ -135,9 +135,9 @@ shader 0 "hud3d" [ } ] [ uniform sampler3D tex0; - varying vec3 texcoord0; - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec3 texcoord0; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color * texture3D(tex0, texcoord0); @@ -145,11 +145,11 @@ shader 0 "hud3d" [ ] shader 0 "hudcubemap" [ - attribute vec4 vvertex, vcolor; - attribute vec3 vtexcoord0; + in vec4 vvertex, vcolor; + in vec3 vtexcoord0; uniform mat4 hudmatrix; - varying vec3 texcoord0; - varying vec4 colorscale; + out vec3 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = hudmatrix * vvertex; @@ -158,9 +158,9 @@ shader 0 "hudcubemap" [ } ] [ uniform samplerCube tex0; - varying vec3 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec3 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = colorscale * textureCube(tex0, texcoord0); diff --git a/config/glsl/material.cfg b/config/glsl/material.cfg index f1ced84..24fdc6b 100644 --- a/config/glsl/material.cfg +++ b/config/glsl/material.cfg @@ -5,7 +5,7 @@ /////////////////////////////////////////////////// shader 0 "refractmask" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 camprojmatrix; void main(void) { @@ -14,7 +14,7 @@ shader 0 "refractmask" [ ] [ @(gfetchdefs tex0) uniform vec3 gdepthpackparams; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { @(if (= $gdepthformat 1) [result [ @@ -28,7 +28,7 @@ shader 0 "refractmask" [ ] lazyshader 0 "waterminimap" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 camprojmatrix; @(ginterpvert) void main(void) @@ -50,15 +50,15 @@ lazyshader 0 "waterminimap" [ watershader = [ lazyshader 0 $arg1 [ - attribute vec4 vvertex; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec3 camera; - varying vec2 texcoord0, texcoord1; - varying vec3 surface; + out vec2 texcoord0, texcoord1; + out vec3 surface; @(? (>= (strstr $arg1 "reflect") 0) [ uniform mat4 raymatrix; - varying vec3 esurface; + out vec3 esurface; ]) @(ginterpvert 1) void main(void) @@ -77,8 +77,8 @@ watershader = [ uniform float millis; uniform vec3 camera; uniform mat4 linearworldmatrix; - varying vec2 texcoord0, texcoord1; - varying vec3 surface; + in vec2 texcoord0, texcoord1; + in vec3 surface; uniform sampler2D tex0, tex1; uniform vec4 viewsize; uniform vec3 watercolor, waterdeepcolor, waterdeepfade; @@ -95,7 +95,7 @@ watershader = [ ]) @(? (>= (strstr $arg1 "reflect") 0) [ uniform mat4 raymatrix; - varying vec3 esurface; + in vec3 esurface; ]) @(ginterpfrag 1) @@ -181,7 +181,7 @@ watershader "underwater" causticshader = [ lazyshader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; @@ -192,7 +192,7 @@ causticshader = [ uniform vec3 causticsblend; uniform sampler2D tex0, tex1; uniform vec4 waterdeepfade; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { @(gdepthunpack depth [gfetch(tex9, gl_FragCoord.xy)] [ @@ -211,7 +211,7 @@ causticshader caustics waterfogshader = [ lazyshader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; @@ -224,7 +224,7 @@ waterfogshader = [ uniform vec2 fogdensity; uniform vec3 waterdeepcolor, waterdeepfade; uniform float waterheight; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { @(gdepthunpack depth [gfetch(tex9, gl_FragCoord.xy)] [ @@ -246,12 +246,12 @@ waterfogshader = [ waterfogshader waterfog lazyshader 0 "lava" [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; - varying mat3 world; - varying vec2 texcoord0; + out mat3 world; + out vec2 texcoord0; @(ginterpvert) void main(void) { @@ -265,8 +265,8 @@ lazyshader 0 "lava" [ ] [ uniform sampler2D tex0, tex1; uniform float lavaglow, lavaspec; - varying mat3 world; - varying vec2 texcoord0; + in mat3 world; + in vec2 texcoord0; @(ginterpfrag) void main(void) @@ -283,14 +283,14 @@ lazyshader 0 "lava" [ ] lazyshader 0 "waterfallenv" [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec4 camera; - varying vec3 camdir; - varying mat3 world; - varying vec2 texcoord0; + out vec3 camdir; + out mat3 world; + out vec2 texcoord0; @(ginterpvert 1) void main(void) { @@ -310,9 +310,9 @@ lazyshader 0 "waterfallenv" [ uniform float waterfallspec; uniform vec4 waterfallrefract; uniform float refractdepth; - varying vec3 camdir; - varying mat3 world; - varying vec2 texcoord0; + in vec3 camdir; + in mat3 world; + in vec2 texcoord0; @(ginterpfrag 1) void main(void) @@ -340,12 +340,12 @@ lazyshader 0 "waterfallenv" [ ] lazyshader 0 "waterfall" [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; - varying mat3 world; - varying vec2 texcoord0; + out mat3 world; + out vec2 texcoord0; @(ginterpvert 1) void main(void) { @@ -363,8 +363,8 @@ lazyshader 0 "waterfall" [ uniform float waterfallspec; uniform vec4 waterfallrefract; uniform float refractdepth; - varying mat3 world; - varying vec2 texcoord0; + in mat3 world; + in vec2 texcoord0; @(ginterpfrag 1) void main(void) @@ -387,14 +387,14 @@ lazyshader 0 "waterfall" [ ] lazyshader 0 "glassenv" [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec4 camera; - varying vec3 camdir; - varying mat3 world; - varying vec2 texcoord0; + out vec3 camdir; + out mat3 world; + out vec2 texcoord0; @(ginterpvert 1) void main(void) { @@ -413,9 +413,9 @@ lazyshader 0 "glassenv" [ uniform float glassspec; uniform vec4 glassrefract; uniform float refractdepth; - varying vec3 camdir; - varying mat3 world; - varying vec2 texcoord0; + in vec3 camdir; + in mat3 world; + in vec2 texcoord0; @(ginterpfrag 1) void main(void) @@ -443,12 +443,12 @@ lazyshader 0 "glassenv" [ ] lazyshader 0 "glass" [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; - varying mat3 world; - varying vec2 texcoord0; + out mat3 world; + out vec2 texcoord0; @(ginterpvert 1) void main(void) { @@ -465,8 +465,8 @@ lazyshader 0 "glass" [ uniform float glassspec; uniform vec4 glassrefract; uniform float refractdepth; - varying mat3 world; - varying vec2 texcoord0; + in mat3 world; + in vec2 texcoord0; @(ginterpfrag 1) void main(void) diff --git a/config/glsl/misc.cfg b/config/glsl/misc.cfg index 0199eeb..dc60d26 100644 --- a/config/glsl/misc.cfg +++ b/config/glsl/misc.cfg @@ -1,11 +1,11 @@ shader 0 "null" [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; } ] [ - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = vec4(1.0, 0.0, 1.0, 1.0); @@ -19,7 +19,7 @@ shader 0 "null" [ ////////////////////////////////////////////////////////////////////// shader 0 "nocolor" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 camprojmatrix; void main() { gl_Position = camprojmatrix * vvertex; } ] [ @@ -27,7 +27,7 @@ shader 0 "nocolor" [ ] shader 0 "bbquery" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 camprojmatrix; uniform vec3 bborigin, bbsize; void main() { gl_Position = camprojmatrix * vec4(bborigin + vvertex.xyz*bbsize, vvertex.w); } @@ -36,9 +36,9 @@ shader 0 "bbquery" [ ] shader 0 "depth" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 camprojmatrix; - @(ginterpdepth) + @(ginterpdepth out) void main() { gl_Position = camprojmatrix * vvertex; @@ -46,9 +46,9 @@ shader 0 "depth" [ } ] [ @(? $gdepthformat [ - fragdata(0) vec4 gdepth; + layout(location = 0) out vec4 gdepth; ]) - @(ginterpdepth) + @(ginterpdepth in) void main() { @(if (= $gdepthformat 1) [result [ @@ -68,12 +68,12 @@ shader 0 "depth" [ ////////////////////////////////////////////////////////////////////// shader 0 "ldr" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform float ldrscale; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = camprojmatrix * vvertex; @@ -82,9 +82,9 @@ shader 0 "ldr" [ } ] [ uniform sampler2D tex0; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -93,18 +93,18 @@ shader 0 "ldr" [ ] shader 0 "ldrnotexture" [ - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 camprojmatrix; uniform float ldrscale; - varying vec4 color; + out vec4 color; void main(void) { gl_Position = camprojmatrix * vvertex; color = vec4(ldrscale * vcolor.rgb, vcolor.a); } ] [ - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; @@ -119,11 +119,11 @@ shader 0 "ldrnotexture" [ shader 0 "fogged" [ //:fog - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; - varying vec2 texcoord0; - varying vec4 colorscale; + out vec2 texcoord0; + out vec4 colorscale; void main(void) { gl_Position = camprojmatrix * vvertex; @@ -132,9 +132,9 @@ shader 0 "fogged" [ } ] [ uniform sampler2D tex0; - varying vec2 texcoord0; - varying vec4 colorscale; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + in vec4 colorscale; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -144,17 +144,17 @@ shader 0 "fogged" [ shader 0 "foggednotexture" [ //:fog - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 camprojmatrix; - varying vec4 color; + out vec4 color; void main(void) { gl_Position = camprojmatrix * vvertex; color = vcolor; } ] [ - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; @@ -162,16 +162,16 @@ shader 0 "foggednotexture" [ ] shader 0 "fogoverlay" [ - attribute vec4 vvertex, vcolor; - varying vec4 color; + in vec4 vvertex, vcolor; + out vec4 color; void main(void) { gl_Position = vvertex; color = vcolor; } ] [ - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; diff --git a/config/glsl/model.cfg b/config/glsl/model.cfg index 1c9748d..7fc9c16 100644 --- a/config/glsl/model.cfg +++ b/config/glsl/model.cfg @@ -20,7 +20,7 @@ qtangentdecode = [ skelanimdefs = [ result [ - attribute vec4 vboneweight, vboneindex; + in vec4 vboneweight, vboneindex; //:uniform animdata uniform vec4 animdata[@@(min $maxvsuniforms $maxskelanimdata)]; ] @@ -72,13 +72,13 @@ shadowmodelvertexshader = [ local modeltype modeltype = $arg1 result [ - attribute vec4 vvertex; + in vec4 vvertex; @(if (mdlopt "b") [skelanimdefs $arg2]) uniform mat4 modelmatrix; @(? (mdlopt "a") [ - attribute vec2 vtexcoord0; + in vec2 vtexcoord0; uniform vec2 texscroll; - varying vec2 texcoord0; + out vec2 texcoord0; ]) void main(void) { @@ -104,7 +104,7 @@ shadowmodelfragmentshader = [ @(? (mdlopt "a") [ uniform sampler2D tex0; uniform float alphatest; - varying vec2 texcoord0; + in vec2 texcoord0; ]) void main(void) { @@ -144,23 +144,23 @@ modelvertexshader = [ local modeltype modeltype = $arg1 result [ - attribute vec4 vvertex, vtangent; - attribute vec2 vtexcoord0; + in vec4 vvertex, vtangent; + in vec2 vtexcoord0; @(if (mdlopt "b") [skelanimdefs $arg2 (mdlopt "n")]) uniform mat4 modelmatrix; uniform mat3 modelworld; uniform vec3 modelcamera; uniform vec2 texscroll; @(? (mdlopt "n") [ - varying mat3 world; + out mat3 world; ] [ - varying vec3 nvec; + out vec3 nvec; ]) @(? (mdlopt "e") [ - varying vec3 camvec; + out vec3 camvec; ]) @(msaainterpvert) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -201,13 +201,13 @@ modelfragmentshader = [ modeltype = $arg1 result [ @(? (mdlopt "n") [ - varying mat3 world; + in mat3 world; ] [ - varying vec3 nvec; + in vec3 nvec; ]) @(? (mdlopt "e") [ uniform vec2 envmapscale; - varying vec3 camvec; + in vec3 camvec; ]) uniform vec4 colorscale; uniform vec2 fullbright; @@ -219,7 +219,7 @@ modelfragmentshader = [ @(? (mdlopt "n") [uniform sampler2D tex3;]) @(? (|| (mdlopt "d") [mdlopt "D"]) [uniform sampler2D tex4;]) @(msaainterpfrag) - varying vec2 texcoord0; + in vec2 texcoord0; uniform float aamask; void main(void) @@ -308,14 +308,14 @@ rsmmodelvertexshader = [ local modeltype modeltype = $arg1 result [ - attribute vec4 vvertex, vtangent; - attribute vec2 vtexcoord0; + in vec4 vvertex, vtangent; + in vec2 vtexcoord0; @(if (mdlopt "b") [skelanimdefs $arg2 (mdlopt "n")]) uniform mat4 modelmatrix; uniform mat3 modelworld; uniform vec2 texscroll; - varying vec2 texcoord0; - varying vec3 nvec; + out vec2 texcoord0; + out vec3 nvec; void main(void) { @(if (mdlopt "b") [ @@ -339,14 +339,14 @@ rsmmodelfragmentshader = [ local modeltype modeltype = $arg1 result [ - varying vec2 texcoord0; - varying vec3 nvec; + in vec2 texcoord0; + in vec3 nvec; uniform vec4 colorscale; @(? (mdlopt "a") [uniform float alphatest;]) uniform vec3 rsmdir; uniform sampler2D tex0; - fragdata(0) vec4 gcolor; - fragdata(1) vec4 gnormal; + layout(location = 0) out vec4 gcolor; + layout(location = 1) out vec4 gnormal; void main(void) { vec4 diffuse = texture2D(tex0, texcoord0); diff --git a/config/glsl/movie.cfg b/config/glsl/movie.cfg index f1069ff..d2cec13 100644 --- a/config/glsl/movie.cfg +++ b/config/glsl/movie.cfg @@ -5,9 +5,9 @@ //////////////////////////////////////////////// lazyshader 0 "moviergb" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -15,8 +15,8 @@ lazyshader 0 "moviergb" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = texture2DRect(tex0, texcoord0); @@ -24,9 +24,9 @@ lazyshader 0 "moviergb" [ ] lazyshader 0 "movieyuv" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -34,8 +34,8 @@ lazyshader 0 "movieyuv" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color = texture2DRect(tex0, texcoord0).rgb; @@ -47,9 +47,9 @@ lazyshader 0 "movieyuv" [ ] lazyshader 0 "moviey" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -57,8 +57,8 @@ lazyshader 0 "moviey" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb; @@ -73,9 +73,9 @@ lazyshader 0 "moviey" [ ] lazyshader 0 "movieu" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -83,8 +83,8 @@ lazyshader 0 "movieu" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; @@ -99,9 +99,9 @@ lazyshader 0 "movieu" [ ] lazyshader 0 "moviev" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -109,8 +109,8 @@ lazyshader 0 "moviev" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; diff --git a/config/glsl/particle.cfg b/config/glsl/particle.cfg index 2345e2d..eec118c 100644 --- a/config/glsl/particle.cfg +++ b/config/glsl/particle.cfg @@ -11,18 +11,18 @@ explosionshader = [ shader 0 $arg1 [ //:fog - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 explosionmatrix; uniform vec3 center; uniform float millis; - attribute vec2 vtexcoord0; + in vec2 vtexcoord0; uniform vec4 texgenS, texgenT; @(? (>= (strstr $arg1 "soft") 0) [ uniform vec2 lineardepthscale; - varying float lineardepth; + out float lineardepth; ]) - varying vec4 color; - varying vec2 texcoord0, texcoord1, texcoord2; + out vec4 color; + out vec2 texcoord0, texcoord1, texcoord2; void main(void) { vec4 wobble = vec4(vvertex.xyz*(1.0 + 0.5*abs(fract(dot(vvertex.xyz, center) + millis*2.0) - 0.5)), vvertex.w); @@ -42,13 +42,13 @@ explosionshader = [ @(if (>= (strstr $arg1 "soft") 0) [result [ @(gfetchdefs tex2) uniform vec3 softparams; - varying float lineardepth; + in float lineardepth; ]]) - varying vec4 color; - varying vec2 texcoord0, texcoord1, texcoord2; + in vec4 color; + in vec2 texcoord0, texcoord1, texcoord2; uniform sampler2D tex0; uniform vec2 blendparams; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { vec2 dtc = texcoord0 + texture2D(tex0, texcoord2).xy*0.1; // use color texture as noise to distort texcoords @@ -74,18 +74,18 @@ explosionshader "explosionsoft" shader 0 "particlenotexture" [ //:fog - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 camprojmatrix; uniform vec4 colorscale; - varying vec4 color; + out vec4 color; void main(void) { gl_Position = camprojmatrix * vvertex; color = vcolor * colorscale; } ] [ - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; @@ -94,12 +94,12 @@ shader 0 "particlenotexture" [ shader 0 "particletext" [ //:fog - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform float ldrscale; - varying vec4 color; - varying vec2 texcoord0; + out vec4 color; + out vec2 texcoord0; void main(void) { gl_Position = camprojmatrix * vvertex; @@ -109,9 +109,9 @@ shader 0 "particletext" [ ] [ uniform vec4 textparams; uniform sampler2D tex0; - varying vec4 color; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 color; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { float dist = texture2D(tex0, texcoord0).r; @@ -124,16 +124,16 @@ shader 0 "particletext" [ particleshader = [ shader 0 $arg1 [ //:fog - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec4 colorscale; - varying vec4 color; - varying vec2 texcoord0; + out vec4 color; + out vec2 texcoord0; @(? (>= (strstr $arg1 "soft") 0) [ uniform vec2 lineardepthscale; - varying float lineardepth; - varying vec2 surface; + out float lineardepth; + out vec2 surface; ]) void main(void) { @@ -150,13 +150,13 @@ particleshader = [ @(if (>= (strstr $arg1 "soft") 0) [result [ @(gfetchdefs tex2) uniform vec3 softparams; - varying float lineardepth; - varying vec2 surface; + in float lineardepth; + in vec2 surface; ]]) uniform sampler2D tex0; - varying vec4 color; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 color; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 diffuse = texture2D(tex0, texcoord0); diff --git a/config/glsl/postfx.cfg b/config/glsl/postfx.cfg index 18d61a4..cd3c017 100644 --- a/config/glsl/postfx.cfg +++ b/config/glsl/postfx.cfg @@ -5,9 +5,9 @@ //////////////////////////////////////////////// fsvs = [result [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; @arg2 void main(void) { @@ -19,8 +19,8 @@ fsvs = [result [ fsps = [result [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; @arg2 void main(void) { @@ -37,7 +37,7 @@ fsvs4 = [ texcoord4 = vtexcoord0 + vec2( 1.5, 1.5); @arg1 ] [ - varying vec2 texcoord1, texcoord2, texcoord3, texcoord4; + out vec2 texcoord1, texcoord2, texcoord3, texcoord4; ] ] @@ -49,7 +49,7 @@ fsps4 = [ vec4 s22 = texture2DRect(tex0, texcoord4); @arg1 ] [ - varying vec2 texcoord1, texcoord2, texcoord3, texcoord4; + in vec2 texcoord1, texcoord2, texcoord3, texcoord4; ] ] @@ -70,10 +70,10 @@ lazyshader 0 "sobel" (fsvs4) (fsps4 [ // rotoscope lazyshader 0 "rotoscope" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) uniform vec4 params; - varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22; + out vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22; void main(void) { gl_Position = vvertex; @@ -89,8 +89,8 @@ lazyshader 0 "rotoscope" [ } ] [ uniform sampler2DRect tex0; - varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22; - fragdata(0) vec4 fragcolor; + in vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 c00 = texture2DRect(tex0, t00); @@ -125,9 +125,9 @@ lazyshader 0 "rotoscope" [ blur3shader = [ lazyshader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0, texcoord1; + out vec2 texcoord0, texcoord1; void main(void) { gl_Position = vvertex; @@ -136,8 +136,8 @@ blur3shader = [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0, texcoord1; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0, texcoord1; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = 0.5*(texture2DRect(tex0, texcoord0) + texture2DRect(tex0, texcoord1)); @@ -149,9 +149,9 @@ blur3shader vblur3 0 1 blur5shader = [ lazyshader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0, texcoord1, texcoord2; + out vec2 texcoord0, texcoord1, texcoord2; void main(void) { gl_Position = vvertex; @@ -161,8 +161,8 @@ blur5shader = [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0, texcoord1, texcoord2; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0, texcoord1, texcoord2; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = 0.4*texture2DRect(tex0, texcoord0) + 0.3*(texture2DRect(tex0, texcoord1) + texture2DRect(tex0, texcoord2)); diff --git a/config/glsl/scale.cfg b/config/glsl/scale.cfg index 8add196..4750672 100644 --- a/config/glsl/scale.cfg +++ b/config/glsl/scale.cfg @@ -5,9 +5,9 @@ ////////////////////////////////////////////////////////////////////// shader 0 "scalelinear" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -16,8 +16,8 @@ shader 0 "scalelinear" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @@ -27,9 +27,9 @@ shader 0 "scalelinear" [ loop i 2 [ lazyshader 0 (? $i "scalecubicy" "scalecubicx") [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -38,8 +38,8 @@ loop i 2 [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; vec4 cubic(float s) { @@ -74,9 +74,9 @@ loop i 2 [ ] shader 0 "reorient" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform vec3 reorientx, reorienty; - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -86,8 +86,8 @@ shader 0 "reorient" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { diff --git a/config/glsl/shared.cfg b/config/glsl/shared.cfg index a8cb610..4c0d188 100644 --- a/config/glsl/shared.cfg +++ b/config/glsl/shared.cfg @@ -8,26 +8,26 @@ ginterpdepth = [ result [ uniform vec2 lineardepthscale; uniform vec3 gdepthpackparams; - varying float lineardepth; + @arg1 float lineardepth; ] ] ginterpvert = [ - if (|| $gdepthformat $arg1) [ginterpdepth] + if (|| $gdepthformat $arg1) [ginterpdepth out] ] msaainterpvert = [ginterpvert $msaasamples] ginterpfrag = [ result [ - fragdata(0) vec4 gcolor; - fragdata(1) vec4 gnormal; + layout(location = 0) out vec4 gcolor; + layout(location = 1) out vec4 gnormal; @(? $gdepthformat [ - fragdata(2) vec4 gdepth; - fragdata(3) vec4 gglow; + layout(location = 2) out vec4 gdepth; + layout(location = 3) out vec4 gglow; ] [ - fragdata(2) vec4 gglow; + layout(location = 2) out vec4 gglow; ]) - @(if (|| $gdepthformat $arg1) [ginterpdepth]) + @(if (|| $gdepthformat $arg1) [ginterpdepth in]) ] ] msaainterpfrag = [ginterpfrag $msaasamples] diff --git a/config/glsl/sky.cfg b/config/glsl/sky.cfg index b66a09b..4fe0c45 100644 --- a/config/glsl/sky.cfg +++ b/config/glsl/sky.cfg @@ -5,12 +5,12 @@ //////////////////////////////////////////////// shader 0 "skybox" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 skymatrix; uniform float ldrscale; - varying vec4 colorscale; - varying vec2 texcoord0; + out vec4 colorscale; + out vec2 texcoord0; void main(void) { gl_Position = skymatrix * vvertex; @@ -19,9 +19,9 @@ shader 0 "skybox" [ } ] [ uniform sampler2D tex0; - varying vec4 colorscale; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 colorscale; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -30,12 +30,12 @@ shader 0 "skybox" [ ] shader 0 "skyboxoverbright" [ - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 skymatrix; uniform float ldrscale; - varying vec4 colorscale; - varying vec2 texcoord0; + out vec4 colorscale; + out vec2 texcoord0; void main(void) { gl_Position = skymatrix * vvertex; @@ -46,9 +46,9 @@ shader 0 "skyboxoverbright" [ uniform sampler2D tex0; uniform vec3 overbrightparams; uniform float ldrscale; - varying vec4 colorscale; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 colorscale; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec4 color = texture2D(tex0, texcoord0); @@ -60,9 +60,9 @@ shader 0 "skyboxoverbright" [ ] shader 0 "atmosphere" [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 sunmatrix; - varying vec3 camvec; + out vec3 camvec; void main(void) { gl_Position = vvertex; @@ -80,8 +80,8 @@ shader 0 "atmosphere" [ uniform vec3 betar, betam, betarm; uniform vec2 hdrgamma; uniform float atmoalpha; - varying vec3 camvec; - fragdata(0) vec4 fragcolor; + in vec3 camvec; + layout(location = 0) out vec4 fragcolor; vec3 calcextinction(float dist) { @@ -142,10 +142,10 @@ shader 0 "atmosphere" [ ] shader 0 "skyfog" [ - attribute vec4 vvertex, vcolor; + in vec4 vvertex, vcolor; uniform mat4 skymatrix; uniform float ldrscale; - varying vec4 color; + out vec4 color; void main(void) { gl_Position = skymatrix * vvertex; @@ -153,8 +153,8 @@ shader 0 "skyfog" [ } ] [ uniform sampler2D tex0; - varying vec4 color; - fragdata(0) vec4 fragcolor; + in vec4 color; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = color; diff --git a/config/glsl/smaa.cfg b/config/glsl/smaa.cfg index 22ede18..df1d9f2 100644 --- a/config/glsl/smaa.cfg +++ b/config/glsl/smaa.cfg @@ -93,9 +93,9 @@ smaadefs = [ ] shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -105,8 +105,8 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [ ] [ @smaadefs uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @@ -157,9 +157,9 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [ ] shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -169,8 +169,8 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [ ] [ @smaadefs uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @@ -214,9 +214,9 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ @smaadefs - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0, texcoord1, texcoord2, texcoord3, texcoord4, texcoord5; + out vec2 texcoord0, texcoord1, texcoord2, texcoord3, texcoord4, texcoord5; void main(void) { @@ -232,10 +232,10 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ } ] [ @smaadefs - varying vec2 texcoord0, texcoord1, texcoord2, texcoord3, texcoord4, texcoord5; + in vec2 texcoord0, texcoord1, texcoord2, texcoord3, texcoord4, texcoord5; uniform sampler2DRect tex0, tex1, tex2; uniform vec4 subsamples; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; #if __VERSION__ >= 130 || defined(GL_EXT_gpu_shader4) #define SMAARound(e) round(e) @@ -563,9 +563,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ ] shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { @@ -574,10 +574,10 @@ shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [ } ] [ @smaadefs - varying vec2 texcoord0; + in vec2 texcoord0; uniform sampler2DRect tex0, tex1; @(? (smaaopt "s") [uniform sampler2DRect tex2, tex3;]) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; // Neighborhood Blending Pixel Shader (Third Pass) diff --git a/config/glsl/stain.cfg b/config/glsl/stain.cfg index 253c88b..7e0a04d 100644 --- a/config/glsl/stain.cfg +++ b/config/glsl/stain.cfg @@ -18,12 +18,12 @@ stainvariantshader = [ @(? (stainopt "f") [ //:fog ]) - attribute vec4 vvertex, vcolor; - attribute vec2 vtexcoord0; + in vec4 vvertex, vcolor; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec4 colorscale; - varying vec4 color; - varying vec2 texcoord0; + out vec4 color; + out vec2 texcoord0; void main(void) { gl_Position = camprojmatrix * vvertex; @@ -32,11 +32,11 @@ stainvariantshader = [ } ]]) [ uniform sampler2D tex0; - varying vec4 color; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec4 color; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; @(? (stainopt "t") [ - fragdata(1) vec4 gglow; + layout(location = 1) out vec4 gglow; ]) void main(void) { diff --git a/config/glsl/tonemap.cfg b/config/glsl/tonemap.cfg index 96c21c5..da87d25 100644 --- a/config/glsl/tonemap.cfg +++ b/config/glsl/tonemap.cfg @@ -5,9 +5,9 @@ //////////////////////////////////////////////// shader 0 "hdrreduce" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -15,8 +15,8 @@ shader 0 "hdrreduce" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor.rgb = texture2DRect(tex0, texcoord0).rgb; @@ -24,9 +24,9 @@ shader 0 "hdrreduce" [ ] shader 0 "hdrreduce2w" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -34,8 +34,8 @@ shader 0 "hdrreduce2w" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor.rgb = 0.5*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb); @@ -43,9 +43,9 @@ shader 0 "hdrreduce2w" [ ] shader 0 "hdrreduce2" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -53,8 +53,8 @@ shader 0 "hdrreduce2" [ } ] [ uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor.rgb = 0.25*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb + @@ -63,14 +63,14 @@ shader 0 "hdrreduce2" [ ] lazyshader 0 msaaresolve [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; } ] [ uniform sampler2DMS tex0; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = texelFetch(tex0, ivec2(gl_FragCoord.xy), 0); @@ -78,7 +78,7 @@ lazyshader 0 msaaresolve [ ] lazyshader 0 msaaresolvedepth [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; @@ -88,7 +88,7 @@ lazyshader 0 msaaresolvedepth [ @(if $gdepthformat [result [ @(gdepthunpackparams) uniform vec2 gdepthinvscale; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; ]]) void main(void) { @@ -104,9 +104,9 @@ lazyshader 0 msaaresolvedepth [ ] lazyshader 0 msaareducew [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 tap0, tap1; + out vec2 tap0, tap1; void main(void) { gl_Position = vvertex; @@ -115,8 +115,8 @@ lazyshader 0 msaareducew [ } ] [ uniform sampler2DMS tex0; - varying vec2 tap0, tap1; - fragdata(0) vec4 fragcolor; + in vec2 tap0, tap1; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = 0.5*(texelFetch(tex0, ivec2(tap0), 0) + texelFetch(tex0, ivec2(tap1), 0)); @@ -124,9 +124,9 @@ lazyshader 0 msaareducew [ ] lazyshader 0 msaareduce [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 tap0, tap1, tap2, tap3; + out vec2 tap0, tap1, tap2, tap3; void main(void) { gl_Position = vvertex; @@ -137,8 +137,8 @@ lazyshader 0 msaareduce [ } ] [ uniform sampler2DMS tex0; - varying vec2 tap0, tap1, tap2, tap3; - fragdata(0) vec4 fragcolor; + in vec2 tap0, tap1, tap2, tap3; + layout(location = 0) out vec4 fragcolor; void main(void) { fragcolor = 0.25*(texelFetch(tex0, ivec2(tap0), 0) + texelFetch(tex0, ivec2(tap1), 0) + @@ -166,9 +166,9 @@ hdrgammaencode = [ ] shader 0 "hdrluminance" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -177,8 +177,8 @@ shader 0 "hdrluminance" [ ] [ uniform sampler2DRect tex0; uniform vec2 hdrgamma; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; @@ -190,9 +190,9 @@ shader 0 "hdrluminance" [ ] shader 0 "hdrluminance2w" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -201,8 +201,8 @@ shader 0 "hdrluminance2w" [ ] [ uniform sampler2DRect tex0; uniform vec2 hdrgamma; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @(loopconcat i 2 [result [ @@ -216,9 +216,9 @@ shader 0 "hdrluminance2w" [ ] shader 0 "hdrluminance2" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -227,8 +227,8 @@ shader 0 "hdrluminance2" [ ] [ uniform sampler2DRect tex0; uniform vec2 hdrgamma; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { @(loopconcat i 4 [result [ @@ -242,7 +242,7 @@ shader 0 "hdrluminance2" [ ] shader 0 "hdraccum" [ - attribute vec4 vvertex; + in vec4 vvertex; void main(void) { gl_Position = vvertex; @@ -250,7 +250,7 @@ shader 0 "hdraccum" [ ] [ uniform sampler2DRect tex0; uniform float accumscale; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { float lum = texture2DRect(tex0, vec2(0.5, 0.5)).r * 2.0; @@ -260,16 +260,16 @@ shader 0 "hdraccum" [ ] shader 0 "hdrbloom" [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) @(? (>= $hwvtexunits 4) [ uniform sampler2D tex2; ] [ - attribute float vcolor; + in float vcolor; ]) uniform vec4 hdrparams; - varying vec2 texcoord0; - flat varying float lumscale, lumthreshold; + out vec2 texcoord0; + flat out float lumscale, lumthreshold; void main(void) { gl_Position = vvertex; @@ -281,9 +281,9 @@ shader 0 "hdrbloom" [ ] [ uniform sampler2DRect tex0; uniform vec2 hdrgamma; - varying vec2 texcoord0; - flat varying float lumscale, lumthreshold; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + flat in float lumscale, lumthreshold; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; @@ -297,17 +297,17 @@ shader 0 "hdrbloom" [ hdrtonemapvertexshader = [ result [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) @(screentexcoord 1) @(? (>= $hwvtexunits 4) [ uniform sampler2D tex2; ] [ - attribute float vcolor; + in float vcolor; ]) uniform vec4 hdrparams; - varying vec2 texcoord0, texcoord1; - flat varying float lumscale, lumsaturate; + out vec2 texcoord0, texcoord1; + flat out float lumscale, lumsaturate; void main(void) { gl_Position = vvertex; @@ -333,16 +333,16 @@ hdrtonemapdefs = [ result [ uniform vec4 hdrparams; uniform vec2 hdrgamma; - varying vec2 texcoord0, texcoord1; - flat varying float lumscale, lumsaturate; + in vec2 texcoord0, texcoord1; + flat in float lumscale, lumsaturate; ] ] hdrtonemapshaders = [ (? $arg1 lazyshader shader) 0 [hdrnop@arg1] [ - attribute vec4 vvertex; + in vec4 vvertex; @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; void main(void) { gl_Position = vvertex; @@ -351,8 +351,8 @@ hdrtonemapshaders = [ ] [ @arg2 uniform sampler2DRect tex0; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 color = texture2DRect(tex0, texcoord0).rgb; @@ -366,7 +366,7 @@ hdrtonemapshaders = [ @arg2 uniform sampler2DRect tex0, tex1; @(hdrtonemapdefs) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; @@ -391,7 +391,7 @@ msaatonemapshaders = [ uniform sampler2DRect tex1; uniform sampler2DMS tex0; @(hdrtonemapdefs) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; @@ -409,7 +409,7 @@ msaatonemapshaders = [ uniform sampler2DRect tex1; uniform sampler2DMS tex0; @(hdrtonemapdefs) - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; void main(void) { vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; @@ -437,7 +437,7 @@ msaasplitshaders = [ uniform sampler2DMS tex0; @(hdrtonemapdefs) @(loopconcat i $msaasamples [result [ - fragdata(@i) vec4 fragcolor@i; + layout(location = @i) out vec4 fragcolor@i; ]]) void main(void) { diff --git a/config/glsl/ui.cfg b/config/glsl/ui.cfg index 4ead341..84a8672 100644 --- a/config/glsl/ui.cfg +++ b/config/glsl/ui.cfg @@ -5,9 +5,9 @@ //////////////////////////////////////////////// lazyshader 0 "modelpreview" [ - attribute vec4 vvertex; - attribute vec2 vtexcoord0; - varying vec2 texcoord0; + in vec4 vvertex; + in vec2 vtexcoord0; + out vec2 texcoord0; void main(void) { @@ -22,8 +22,8 @@ lazyshader 0 "modelpreview" [ uniform vec3 sunlightdir; uniform vec3 sunlightcolor; uniform float cutout; - varying vec2 texcoord0; - fragdata(0) vec4 fragcolor; + in vec2 texcoord0; + layout(location = 0) out vec4 fragcolor; void main(void) { diff --git a/config/glsl/volumetric.cfg b/config/glsl/volumetric.cfg index 10ec443..8876c29 100644 --- a/config/glsl/volumetric.cfg +++ b/config/glsl/volumetric.cfg @@ -6,7 +6,7 @@ volumetricvariantshader = [ maxsteps = $arg4 spotlight = (>= $arg2 1) variantshader 0 $arg1 $arg2 (? (< $arg2 0) [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 lightmatrix; void main(void) { @@ -43,7 +43,7 @@ volumetricvariantshader = [ uniform float volminstep; uniform float voldistclamp; uniform float volprefilter; - fragdata(0) vec4 fragcolor; + layout(location = 0) out vec4 fragcolor; @(if (volopt "p") [ ? $spotlight [ @@ -183,10 +183,10 @@ volumetricbilateralvariantshader = [ reduced = $arg3 filterdir = $arg4 shader 0 $arg1 [ - attribute vec4 vvertex; + in vec4 vvertex; @(if $reduced [result [ @(screentexcoord 0) - varying vec2 texcoord0; + out vec2 texcoord0; ]]) void main(void) { @@ -197,8 +197,8 @@ volumetricbilateralvariantshader = [ @(gfetchdefs tex3) uniform sampler2DRect tex0; uniform vec2 bilateralparams; - @(? $reduced [varying vec2 texcoord0;]) - fragdata(0) vec4 fragcolor; + @(? $reduced [in vec2 texcoord0;]) + layout(location = 0) out vec4 fragcolor; void main(void) { #define tc gl_FragCoord.xy diff --git a/config/glsl/world.cfg b/config/glsl/world.cfg index 1ddcad6..edef80b 100644 --- a/config/glsl/world.cfg +++ b/config/glsl/world.cfg @@ -58,25 +58,25 @@ worldvariantshader = [ srow = 1 ] variantshader $stype $arg1 $srow [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec2 texgenscroll; - varying vec3 nvec; + out vec3 nvec; @(ginterpvert (|| $msaalight [&& $msaasamples [! (wtopt "a")]])) @(if (wtopt "T") [result [ uniform vec2 texgenscale; - varying vec2 texcoordx, texcoordy, texcoordz; + out vec2 texcoordx, texcoordy, texcoordz; @(? (wtopt "d") [uniform vec2 detailscale;]) ]] [result [ - varying vec2 texcoord0; + out vec2 texcoord0; ]]) - @(? (wtopt "r") [uniform vec3 camera; varying vec3 camvec;]) - @(? (wtopt "G") [uniform float millis; flat varying float pulse;]) + @(? (wtopt "r") [uniform vec3 camera; out vec3 camvec;]) + @(? (wtopt "G") [uniform float millis; flat out float pulse;]) @(? (wtopt "b") [ uniform vec4 blendmapparams; - varying vec2 texcoord1; + out vec2 texcoord1; ]) void main(void) @@ -110,21 +110,21 @@ worldvariantshader = [ uniform vec4 colorparams; uniform sampler2D diffusemap; @(? (|| $msaalight [&& $msaasamples [! (wtopt "a")]]) [uniform float hashid;]) - varying vec3 nvec; + in vec3 nvec; @(ginterpfrag (|| $msaalight [&& $msaasamples [! (wtopt "a")]])) @(if (wtopt "T") [result [ - varying vec2 texcoordx, texcoordy, texcoordz; + in vec2 texcoordx, texcoordy, texcoordz; @(? (wtopt "d") [uniform sampler2D detaildiffusemap;]) ]] [result [ - varying vec2 texcoord0; + in vec2 texcoord0; ]]) @(? (wtopt "g") [uniform sampler2D glowmap;]) - @(? (wtopt "G") [flat varying float pulse;]) - @(? (wtopt "r") [uniform samplerCube envmap; varying vec3 camvec;]) + @(? (wtopt "G") [flat in float pulse;]) + @(? (wtopt "r") [uniform samplerCube envmap; in vec3 camvec;]) @(? (wtopt "b") [ uniform float blendlayer; uniform sampler2D blendmap; - varying vec2 texcoord1; + in vec2 texcoord1; ]) void main(void) @@ -291,30 +291,30 @@ bumpvariantshader = [ srow = 1 ] variantshader $stype $arg1 $srow [ - attribute vec4 vvertex, vtangent; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex, vtangent; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 camprojmatrix; uniform vec2 texgenscroll; @(ginterpvert (|| $msaalight [&& $msaasamples [! (btopt "a")]] [btopt "A"])) @(if (btopt "T") [result [ uniform vec2 texgenscale; - varying vec2 texcoordx, texcoordy, texcoordz; - varying vec3 normal; - varying vec3 tangentx, tangenty, tangentz; + out vec2 texcoordx, texcoordy, texcoordz; + out vec3 normal; + out vec3 tangentx, tangenty, tangentz; @(? (btopt "d") [uniform vec2 detailscale;]) ]] [result [ - varying vec2 texcoord0; - varying mat3 world; + out vec2 texcoord0; + out mat3 world; ]]) @(? (|| (btopt "p") (btopt "r") (btopt "T")) [ uniform vec3 camera; - varying vec3 camvec; + out vec3 camvec; ]) - @(? (btopt "G") [uniform float millis; flat varying float pulse;]) + @(? (btopt "G") [uniform float millis; flat out float pulse;]) @(? (btopt "b") [ uniform vec4 blendmapparams; - varying vec2 texcoord1; + out vec2 texcoord1; ]) void main(void) @@ -361,23 +361,23 @@ bumpvariantshader = [ uniform vec4 colorparams; uniform sampler2D diffusemap, normalmap; @(? (|| $msaalight [&& $msaasamples [! (btopt "a")]]) [uniform float hashid;]) - varying mat3 world; + in mat3 world; @(ginterpfrag (|| $msaalight [&& $msaasamples [! (btopt "a")]] [btopt "A"])) @(if (btopt "T") [result [ - varying vec2 texcoordx, texcoordy, texcoordz; - varying vec3 normal, tangentx, tangenty, tangentz; + in vec2 texcoordx, texcoordy, texcoordz; + in vec3 normal, tangentx, tangenty, tangentz; @(? (btopt "d") [uniform sampler2D detaildiffusemap, detailnormalmap;]) ]] [result [ - varying vec2 texcoord0; + in vec2 texcoord0; ]]) - @(? (|| (btopt "p") (btopt "r") (btopt "T")) [varying vec3 camvec;]) + @(? (|| (btopt "p") (btopt "r") (btopt "T")) [in vec3 camvec;]) @(? (btopt "g") [uniform sampler2D glowmap;]) - @(? (btopt "G") [flat varying float pulse;]) + @(? (btopt "G") [flat in float pulse;]) @(? (btopt "r") [uniform samplerCube envmap;]) @(? (btopt "b") [ uniform float blendlayer; uniform sampler2D blendmap; - varying vec2 texcoord1; + in vec2 texcoord1; ]) void main(void) @@ -574,7 +574,7 @@ bumpshader "triplanardetailbumpspecparallaxworld" "Tdps" bumpshader "triplanardetailbumpspecmapparallaxworld" "TdpsS" shader 0 shadowmapworld [ - attribute vec4 vvertex; + in vec4 vvertex; uniform mat4 shadowmatrix; void main(void) { @@ -589,18 +589,18 @@ shader 0 shadowmapworld [ defershader 1 "rsmworld" [ loop i 2 [ variantshader 1 "rsmworld" (- $i 1) [ - attribute vec4 vvertex; - attribute vec3 vnormal; - attribute vec2 vtexcoord0; + in vec4 vvertex; + in vec3 vnormal; + in vec2 vtexcoord0; uniform mat4 rsmmatrix; uniform vec2 texgenscroll; uniform vec4 colorparams; uniform vec3 rsmdir; - varying vec4 normal; - varying vec2 texcoord0; + out vec4 normal; + out vec2 texcoord0; @(? (= $i 1) [ uniform vec4 blendmapparams; - varying vec2 texcoord1; + out vec2 texcoord1; ]) void main(void) { @@ -614,15 +614,15 @@ defershader 1 "rsmworld" [ ] [ uniform vec4 colorparams; uniform sampler2D diffusemap; - varying vec4 normal; - varying vec2 texcoord0; + in vec4 normal; + in vec2 texcoord0; @(? (= $i 1) [ uniform float blendlayer; uniform sampler2D blendmap; - varying vec2 texcoord1; + in vec2 texcoord1; ]) - fragdata(0) vec4 gcolor; - fragdata(1) vec4 gnormal; + layout(location = 0) out vec4 gcolor; + layout(location = 1) out vec4 gnormal; void main(void) { vec4 diffuse = texture2D(diffusemap, texcoord0); diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp index c5a45cf..b3ebd90 100644 --- a/src/engine/shader.cpp +++ b/src/engine/shader.cpp @@ -109,45 +109,6 @@ static void showglslinfo(GLenum type, GLuint obj, const char *name, const char * } } -static const char *finddecls(const char *line) -{ - for(;;) - { - const char *start = line + strspn(line, " \t\r"); - switch(*start) - { - case '\n': - line = start + 1; - continue; - case '#': - do - { - start = strchr(start + 1, '\n'); - if(!start) return NULL; - } while(start[-1] == '\\'); - line = start + 1; - continue; - case '/': - switch(start[1]) - { - case '/': - start = strchr(start + 2, '\n'); - if(!start) return NULL; - line = start + 1; - continue; - case '*': - start = strstr(start + 2, "*/"); - if(!start) return NULL; - line = start + 2; - continue; - } - // fall-through - default: - return line; - } - } -} - static void compileglslshader(Shader &s, GLenum type, GLuint &obj, const char *def, const char *name, bool msg = true) { const char *source = def + strspn(def, " \t\r\n"); @@ -155,16 +116,6 @@ static void compileglslshader(Shader &s, GLenum type, GLuint &obj, const char *d int numparts = 0; parts[numparts++] = "#version 400\n"; - if(type == GL_VERTEX_SHADER) parts[numparts++] = - "#define attribute in\n" - "#define varying out\n"; - else if(type == GL_FRAGMENT_SHADER) - { - parts[numparts++] = "#define varying in\n"; - parts[numparts++] = - "#define fragdata(loc) layout(location = loc) out\n" - "#define fragblend(loc) layout(location = loc, index = 1) out\n"; - } parts[numparts++] = "#define texture1D(sampler, coords) texture(sampler, coords)\n" "#define texture2D(sampler, coords) texture(sampler, coords)\n" @@ -724,7 +675,7 @@ static void genfogshader(vector &vsbuf, vector &psbuf, const char *v if(!strstr(vs, "lineardepth")) { vsbuf.put(vs, vsmain - vs); - const char *fogparams = "\nuniform vec2 lineardepthscale;\nvarying float lineardepth;\n"; + const char *fogparams = "\nuniform vec2 lineardepthscale;\nout float lineardepth;\n"; vsbuf.put(fogparams, strlen(fogparams)); vsbuf.put(vsmain, vsend - vsmain); const char *vsfog = "\nlineardepth = dot(lineardepthscale, gl_Position.zw);\n"; @@ -738,7 +689,7 @@ static void genfogshader(vector &vsbuf, vector &psbuf, const char *v psbuf.put(ps, psmain - ps); if(!strstr(ps, "lineardepth")) { - const char *foginterp = "\nvarying float lineardepth;\n"; + const char *foginterp = "\nin float lineardepth;\n"; psbuf.put(foginterp, strlen(foginterp)); } const char *fogparams = @@ -811,39 +762,39 @@ void setupshaders() standardshaders = true; nullshader = newshader(0, "null", - "attribute vec4 vvertex;\n" + "in vec4 vvertex;\n" "void main(void) {\n" " gl_Position = vvertex;\n" "}\n", - "fragdata(0) vec4 fragcolor;\n" + "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" " fragcolor = vec4(1.0, 0.0, 1.0, 1.0);\n" "}\n"); hudshader = newshader(0, "hud", - "attribute vec4 vvertex, vcolor;\n" - "attribute vec2 vtexcoord0;\n" + "in vec4 vvertex, vcolor;\n" + "in vec2 vtexcoord0;\n" "uniform mat4 hudmatrix;\n" - "varying vec2 texcoord0;\n" - "varying vec4 colorscale;\n" + "out vec2 texcoord0;\n" + "out vec4 colorscale;\n" "void main(void) {\n" " gl_Position = hudmatrix * vvertex;\n" " texcoord0 = vtexcoord0;\n" " colorscale = vcolor;\n" "}\n", "uniform sampler2D tex0;\n" - "varying vec2 texcoord0;\n" - "varying vec4 colorscale;\n" - "fragdata(0) vec4 fragcolor;\n" + "in vec2 texcoord0;\n" + "in vec4 colorscale;\n" + "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" " vec4 color = texture2D(tex0, texcoord0);\n" " fragcolor = colorscale * color;\n" "}\n"); hudtextshader = newshader(0, "hudtext", - "attribute vec4 vvertex, vcolor;\n" - "attribute vec2 vtexcoord0;\n" + "in vec4 vvertex, vcolor;\n" + "in vec2 vtexcoord0;\n" "uniform mat4 hudmatrix;\n" - "varying vec2 texcoord0;\n" - "varying vec4 colorscale;\n" + "out vec2 texcoord0;\n" + "out vec4 colorscale;\n" "void main(void) {\n" " gl_Position = hudmatrix * vvertex;\n" " texcoord0 = vtexcoord0;\n" @@ -851,9 +802,9 @@ void setupshaders() "}\n", "uniform sampler2D tex0;\n" "uniform vec4 textparams;\n" - "varying vec2 texcoord0;\n" - "varying vec4 colorscale;\n" - "fragdata(0) vec4 fragcolor;\n" + "in vec2 texcoord0;\n" + "in vec4 colorscale;\n" + "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" " float dist = texture2D(tex0, texcoord0).r;\n" " float border = smoothstep(textparams.x, textparams.y, dist);\n" @@ -861,15 +812,15 @@ void setupshaders() " fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border);\n" "}\n"); hudnotextureshader = newshader(0, "hudnotexture", - "attribute vec4 vvertex, vcolor;\n" + "in vec4 vvertex, vcolor;\n" "uniform mat4 hudmatrix;" - "varying vec4 color;\n" + "out vec4 color;\n" "void main(void) {\n" " gl_Position = hudmatrix * vvertex;\n" " color = vcolor;\n" "}\n", - "varying vec4 color;\n" - "fragdata(0) vec4 fragcolor;\n" + "in vec4 color;\n" + "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" " fragcolor = color;\n" "}\n");