diff --git a/config/glsl/aa.cfg b/config/glsl/aa.cfg index 900e2fd..58306bf 100644 --- a/config/glsl/aa.cfg +++ b/config/glsl/aa.cfg @@ -36,14 +36,14 @@ lazyshader 0 "tqaaresolve" [ vec2 vel = prevtc.xy/prevtc.w - texcoord0; float scale = clamp(maxvelocity.x*inversesqrt(dot(vel, vel) + 1e-6), 0.0, 1.0); - float mask = 1.0 - texture2DRect(tex0, texcoord0 + quincunx.xy).a; - vec4 color = texture2DRect(tex0, texcoord0 + mask*quincunx.xy); - vec4 prevcolor = texture2DRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale)); + float mask = 1.0 - textureRect(tex0, texcoord0 + quincunx.xy).a; + vec4 color = textureRect(tex0, texcoord0 + mask*quincunx.xy); + vec4 prevcolor = textureRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale)); 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; + float l2 = textureRectOffset(tex0, texcoord0, ivec2(1, -1)).g; + float l3 = textureRectOffset(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); diff --git a/config/glsl/ao.cfg b/config/glsl/ao.cfg index edafcf8..fb1e498 100644 --- a/config/glsl/ao.cfg +++ b/config/glsl/ao.cfg @@ -90,7 +90,7 @@ ambientobscurancevariantshader = [ normal *= normscale > 0.75 ? normscale : 0.0; normal = normalmatrix * normal; ]]) - vec2 noise = texture2D(tex2, texcoord1).rg*2.0-1.0; + vec2 noise = texture(tex2, texcoord1).rg*2.0-1.0; float obscure = 0.0; @(loopconcat i $maxaotaps [result [ vec2 offset@[i] = reflect(vec2(@(at $aotapoffsets $i)), noise); @@ -193,19 +193,19 @@ bilateralvariantshader = [ #define tc @(? $upscaled [texcoord1] [gl_FragCoord.xy]) #define depthtc @(? $reduced [texcoord0] [gl_FragCoord.xy]) #define tapvec(type, i) @(? (=s $filterdir "x") [type(i, 0.0)] [type(0.0, i)]) - #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i)) - #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i)) + #define texval(i) textureRect(tex0, tc + tapvec(vec2, i)) + #define texvaloffset(i) textureRectOffset(tex0, tc, tapvec(ivec2, i)) #define depthval(i) gfetch(tex1, depthtc + tapvec(vec2, i)) #define depthvaloffset(i) gfetchoffset(tex1, depthtc, tapvec(ivec2, i)) @(cond [$packed] [ if $aodepthformat [result [ - vec2 vals = texture2DRect(tex0, tc).rg; + vec2 vals = textureRect(tex0, tc).rg; #define color vals.x @(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [ #define depth vals.y ]]) ]] [result [ - vec4 vals = texture2DRect(tex0, tc); + vec4 vals = textureRect(tex0, tc); #define color vals.a @(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [ float depth = dot(vals.rgb, gdepthunpackparams); @@ -219,7 +219,7 @@ bilateralvariantshader = [ float depth = dot(gfetch(tex1, depthtc).rgb, gdepthunpackparams); ]]) ]] [result [ - float color = texture2DRect(tex0, tc).r; + float color = textureRect(tex0, tc).r; @(gdepthunpack depth [gfetch(tex1, depthtc)]) ]]) float weights = 1.0; diff --git a/config/glsl/decal.cfg b/config/glsl/decal.cfg index bd2bc07..91145e8 100644 --- a/config/glsl/decal.cfg +++ b/config/glsl/decal.cfg @@ -121,7 +121,7 @@ decalvariantshader = [ { @(if (dtopt "n") [result [ @(? (dtopt "p") [ - float height = texture2D(normalmap, texcoord0.xy).a; + float height = texture(normalmap, texcoord0.xy).a; vec3 camvecn = normalize(camvec); vec2 dtc = texcoord0.xy + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y); ] [ @@ -129,7 +129,7 @@ decalvariantshader = [ ]) @(? (|| (! (dtopt "0")) (dtopt "r")) [ - vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bump = texture(normalmap, dtc).rgb*2.0 - 1.0; vec3 bumpw = world * bump; #define nvec bumpw ]) @@ -137,10 +137,10 @@ decalvariantshader = [ #define dtc texcoord0.xy ]]) - vec4 diffuse = texture2D(diffusemap, dtc); + vec4 diffuse = texture(diffusemap, dtc); @(if (dtopt "g") [result [ - vec4 glowspec = texture2D(glowmap, dtc); + vec4 glowspec = texture(glowmap, dtc); #define glow glowspec.rgb #define spec glowspec.a glow *= @(? (dtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]); @@ -149,7 +149,7 @@ decalvariantshader = [ @(if (dtopt "0") [result [ @(if (&& (dtopt "S") [! (dtopt "g")]) [result [ - float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture2D(glowmap, dtc).r] [texture2D(normalmap, dtc).a]); + float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture(glowmap, dtc).r] [texture(normalmap, dtc).a]); ]]) @(gspecpack [gloss.x] (if (dtopt "s") [? (dtopt "S") [spec * specscale.x] [specscale.x]])) ]]) @@ -167,7 +167,7 @@ decalvariantshader = [ ]) float invfresnel = dot(camvecn, nvec); vec3 rvec = 2.0*nvec*invfresnel - camvecn; - vec3 reflect = textureCube(envmap, rvec).rgb * diffuse.a; + vec3 reflect = texture(envmap, rvec).rgb * diffuse.a; @(? (dtopt "R") [ vec3 rmod = envscale.xyz*spec; ] [ diff --git a/config/glsl/deferred.cfg b/config/glsl/deferred.cfg index ca8cd78..e845e5f 100644 --- a/config/glsl/deferred.cfg +++ b/config/glsl/deferred.cfg @@ -250,7 +250,7 @@ deferredlightvariantshader = [ return dot(mix(cols.xyz, cols.yzw, offset.x), vec3(1.0/9.0)); } ]] [dlopt "E"] [result [ - #define shadowval(xy, xoff, yoff) float(shadow2DRect(tex4, vec3(xy + vec2(xoff, yoff), shadowtc.z))) + #define shadowval(xy, xoff, yoff) float(textureRect(tex4, vec3(xy + vec2(xoff, yoff), shadowtc.z))) float filtershadow(vec3 shadowtc) { vec2 offset = fract(shadowtc.xy - 0.5); @@ -269,7 +269,7 @@ deferredlightvariantshader = [ (4.0/25.0)*shadowval(center.xy, 0.0, 0.0); } ]] [dlopt "F"] [result [ - #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + #define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0))) float filtershadow(vec3 shadowtc) { vec2 offset = fract(shadowtc.xy - 0.5); @@ -290,7 +290,7 @@ deferredlightvariantshader = [ shadowval(center, 1.0, 1.0))); } ]] [dlopt "f"] [result [ - #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0))) + #define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0))) float filtershadow(vec3 shadowtc) { return dot(vec4(0.25), @@ -300,7 +300,7 @@ deferredlightvariantshader = [ shadowval(shadowtc, 1.0, 0.4))); } ]] [result [ - #define filtershadow(shadowtc) float(shadow2DRect(tex4, shadowtc)) + #define filtershadow(shadowtc) float(textureRect(tex4, shadowtc)) ]] ]) @@ -342,7 +342,7 @@ deferredlightvariantshader = [ ]]) tc.xy += 0.5; tc.z = tc.z * @(divf 1 $numrh) + offset; - vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc); + vec4 shr = texture(tex6, tc), shg = texture(tex7, tc), shb = texture(tex8, tc), sha = texture(tex9, tc); shr.rgb -= 0.5; shg.rgb -= 0.5; shb.rgb -= 0.5; @@ -369,7 +369,7 @@ deferredlightvariantshader = [ #define accumalpha(alpha) resolved.a += alpha @(if (&& [dlopt "a"] [! $avatar] [! $transparent]) [result [ - float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r; + float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r; ]]) for(int sampleidx = 0; sampleidx < @msaasamples; sampleidx++) @@ -383,7 +383,7 @@ deferredlightvariantshader = [ #define accumalpha(alpha) fragcolor.a = alpha ]] ] [result [ - #define gfetch(sampler, coords) texture2DRect(sampler, coords) + #define gfetch(sampler, coords) textureRect(sampler, coords) #define accumlight(light) fragcolor.rgb = light #define accumalpha(alpha) fragcolor.a = alpha @@ -466,7 +466,7 @@ deferredlightvariantshader = [ @(if (&& (dlopt "a") [! $avatar] [! $transparent]) [result [ @(? (! (&& (dlopt "M") [dlopt "R"])) [ - float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r; + float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r; ]) @(if (dlopt "d") [result [ #define aomask ao diff --git a/config/glsl/edit.cfg b/config/glsl/edit.cfg index 61b775f..d48acea 100644 --- a/config/glsl/edit.cfg +++ b/config/glsl/edit.cfg @@ -24,7 +24,7 @@ shader 0 "blendbrush" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = texture2D(tex0, texcoord0).r * color; + fragcolor = texture(tex0, texcoord0).r * color; } ] diff --git a/config/glsl/fxaa.cfg b/config/glsl/fxaa.cfg index 1471cb5..e8e3239 100644 --- a/config/glsl/fxaa.cfg +++ b/config/glsl/fxaa.cfg @@ -232,11 +232,11 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ void main(void) { #define posM texcoord0 - vec4 rgbyM = texture2DRect(tex0, posM); - float lumaS = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0, 1))); - float lumaE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, 0))); - float lumaN = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0, -1))); - float lumaW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, 0))); + vec4 rgbyM = textureRect(tex0, posM); + float lumaS = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0, 1))); + float lumaE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, 0))); + float lumaN = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0, -1))); + float lumaW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, 0))); #define lumaM FXAA_LUMA(rgbyM) float maxSM = max(lumaS, lumaM); @@ -258,10 +258,10 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ return; } - float lumaNW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, -1))); - float lumaSE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, 1))); - float lumaNE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, -1))); - float lumaSW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, 1))); + float lumaNW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, -1))); + float lumaSE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, 1))); + float lumaNE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, -1))); + float lumaSW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, 1))); float lumaNS = lumaN + lumaS; float lumaWE = lumaW + lumaE; @@ -311,9 +311,9 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ vec2 posN = posB - offNP * FXAA_QUALITY_P0; vec2 posP = posB + offNP * FXAA_QUALITY_P0; float subpixD = ((-2.0)*subpixC) + 3.0; - float lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN)); + float lumaEndN = FXAA_LUMA(textureRect(tex0, posN)); float subpixE = subpixC * subpixC; - float lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP)); + float lumaEndP = FXAA_LUMA(textureRect(tex0, posP)); if(!pairN) lumaNN = lumaSS; float gradientScaled = gradient * 1.0/4.0; @@ -332,8 +332,8 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ #if (FXAA_QUALITY_PS > @i) if(contN || contP) { - if(contN) lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN)); - if(contP) lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP)); + if(contN) lumaEndN = FXAA_LUMA(textureRect(tex0, posN)); + if(contP) lumaEndP = FXAA_LUMA(textureRect(tex0, posP)); if(contN) lumaEndN = lumaEndN - lumaNN * 0.5; if(contP) lumaEndP = lumaEndP - lumaNN * 0.5; contN = abs(lumaEndN) < gradientScaled; @@ -369,7 +369,7 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [ if(!horzSpan) posS.x += pixelOffsetSubpix * lengthSign; if( horzSpan) posS.y += pixelOffsetSubpix * lengthSign; - fragcolor = texture2DRect(tex0, posS); + fragcolor = textureRect(tex0, posS); } ] diff --git a/config/glsl/gi.cfg b/config/glsl/gi.cfg index 51938d6..aad7a67 100644 --- a/config/glsl/gi.cfg +++ b/config/glsl/gi.cfg @@ -198,9 +198,9 @@ radiancehintsshader = [ { vec3 rhpos = rhcenter + rhtap*rhspread; vec2 rsmtc = rsmcenter + rsmtap*rsmspread; - float rsmdepth = texture2DRect(tex0, rsmtc).x; - vec3 rsmcolor = texture2DRect(tex1, rsmtc).rgb; - vec3 rsmnormal = texture2DRect(tex2, rsmtc).xyz*2.0 - 1.0; + float rsmdepth = textureRect(tex0, rsmtc).x; + vec3 rsmcolor = textureRect(tex1, rsmtc).rgb; + vec3 rsmnormal = textureRect(tex2, rsmtc).xyz*2.0 - 1.0; vec3 rsmpos = (rsmworldmatrix * vec4(rsmtc, rsmdepth, 1.0)).xyz; vec3 dir = rhpos - rsmpos; @@ -255,10 +255,10 @@ lazyshader 0 radiancehintsborder [ { float outside = clamp(borderscale.z*(abs(texcoord0.z - bordercenter.z) - borderrange.z), 0.0, 1.0); vec3 tc = vec3(texcoord0.xy, clamp(texcoord0.z, bordercenter.z - borderrange.z, bordercenter.z + borderrange.z)); - rhr = mix(texture3D(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); - rhg = mix(texture3D(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); - rhb = mix(texture3D(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); - rha = mix(texture3D(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rhr = mix(texture(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rhg = mix(texture(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rhb = mix(texture(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); + rha = mix(texture(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside); } ] @@ -281,10 +281,10 @@ lazyshader 0 radiancehintscached [ void main(void) { - rhr = texture3D(tex7, texcoord0); - rhg = texture3D(tex8, texcoord0); - rhb = texture3D(tex9, texcoord0); - rha = texture3D(tex10, texcoord0); + rhr = texture(tex7, texcoord0); + rhg = texture(tex8, texcoord0); + rhb = texture(tex9, texcoord0); + rha = texture(tex10, texcoord0); } ] diff --git a/config/glsl/grass.cfg b/config/glsl/grass.cfg index 4bc694e..3c0965f 100644 --- a/config/glsl/grass.cfg +++ b/config/glsl/grass.cfg @@ -39,9 +39,9 @@ grassvariantshader = [ @(? (grassopt "b") [uniform sampler2D tex1; in vec2 texcoord1;]) void main(void) { - vec4 color = texture2D(tex0, texcoord0) * colorscale; + vec4 color = texture(tex0, texcoord0) * colorscale; @(? (grassopt "b") [ - color.a *= texture2D(tex1, texcoord1).r; + color.a *= texture(tex1, texcoord1).r; ]) if(color.a <= grasstest) discard; diff --git a/config/glsl/hud.cfg b/config/glsl/hud.cfg index 83b72de..d2d46d9 100644 --- a/config/glsl/hud.cfg +++ b/config/glsl/hud.cfg @@ -23,7 +23,7 @@ shader 0 "hud" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); fragcolor = colorscale * color; } ] @@ -48,7 +48,7 @@ shader 0 "hudtext" [ layout(location = 0) out vec4 fragcolor; void main(void) { - float dist = texture2D(tex0, texcoord0).r; + float dist = texture(tex0, texcoord0).r; float border = smoothstep(textparams.x, textparams.y, dist); float outline = smoothstep(textparams.z, textparams.w, dist); fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border); @@ -74,7 +74,7 @@ shader 0 "hudrgb" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); fragcolor.rgb = colorscale.rgb * color.rgb; fragcolor.a = colorscale.a; } @@ -117,7 +117,7 @@ shader 0 "hudrect" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = colorscale * texture2DRect(tex0, texcoord0); + fragcolor = colorscale * textureRect(tex0, texcoord0); } ] @@ -140,7 +140,7 @@ shader 0 "hud3d" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = color * texture3D(tex0, texcoord0); + fragcolor = color * texture(tex0, texcoord0); } ] @@ -163,7 +163,7 @@ shader 0 "hudcubemap" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = colorscale * textureCube(tex0, texcoord0); + fragcolor = colorscale * texture(tex0, texcoord0); } ] diff --git a/config/glsl/material.cfg b/config/glsl/material.cfg index 24fdc6b..8ad09ff 100644 --- a/config/glsl/material.cfg +++ b/config/glsl/material.cfg @@ -102,10 +102,10 @@ watershader = [ void main(void) { vec3 camdir = camera - surface, camvec = normalize(camdir); - vec3 bump = texture2D(tex1, texcoord0 + millis*vec2( 0.25, 0.75)*0.1250).rgb; - vec3 bump2 = texture2D(tex1, texcoord0 + millis*vec2(-0.75, -0.25)*0.1450).rgb; - vec3 bump3 = texture2D(tex1, texcoord1 + millis*vec2(-0.50, 0.50)*0.0805).rgb; - vec3 bump4 = texture2D(tex1, texcoord1 + millis*vec2( 0.25, -0.75)*0.0825).rgb; + vec3 bump = texture(tex1, texcoord0 + millis*vec2( 0.25, 0.75)*0.1250).rgb; + vec3 bump2 = texture(tex1, texcoord0 + millis*vec2(-0.75, -0.25)*0.1450).rgb; + vec3 bump3 = texture(tex1, texcoord1 + millis*vec2(-0.50, 0.50)*0.0805).rgb; + vec3 bump4 = texture(tex1, texcoord1 + millis*vec2( 0.25, -0.75)*0.0825).rgb; bump = normalize(bump + bump2 + bump3 + bump4 - 2.0); vec2 rtc = bump.xy * waterrefract.w; @@ -126,7 +126,7 @@ watershader = [ @(? (>= (strstr $arg1 "caustics") 0) [ vec2 ctc = vec2(dot(causticsS, rpos.xyz), dot(causticsT, rpos.xyz)); - float caustics = causticsblend.x*texture2D(tex2, ctc).r + causticsblend.y*texture2D(tex3, ctc).r + causticsblend.z; + float caustics = causticsblend.x*texture(tex2, ctc).r + causticsblend.y*texture(tex3, ctc).r + causticsblend.z; rcolor *= caustics; ]) @@ -157,7 +157,7 @@ watershader = [ float fresnel = 0.25 + 0.75*pow(clamp(1.0 - dot(camvec, bump), 0.0, 1.0), 4.0); rcolor = mix(rcolor, reflect, fresnel*edgefade); ]] [if (>= (strstr $arg1 "env") 0) [result [ - vec3 reflect = textureCube(tex4, reflectdir).rgb*0.5; + vec3 reflect = texture(tex4, reflectdir).rgb*0.5; float fresnel = 0.5*pow(clamp(1.0 - dot(camvec, bump), 0.0, 1.0), 4.0); rcolor = mix(rcolor, reflect, fresnel); ]]]) @@ -201,7 +201,7 @@ causticshader = [ vec4 ctc = causticsmatrix * vec4(gl_FragCoord.xy, depth, 1.0); ctc.xyz /= ctc.w; ]) - float caustics = causticsblend.x*texture2D(tex0, ctc.xy).r + causticsblend.y*texture2D(tex1, ctc.xy).r + causticsblend.z; + float caustics = causticsblend.x*texture(tex0, ctc.xy).r + causticsblend.y*texture(tex1, ctc.xy).r + causticsblend.z; caustics *= clamp(ctc.z, 0.0, 1.0) * clamp(exp2(ctc.z*waterdeepfade.w), 0.0, 1.0); fragcolor.rgb = vec3(0.5 + caustics); } @@ -271,8 +271,8 @@ lazyshader 0 "lava" [ void main(void) { - vec3 diffuse = texture2D(tex0, texcoord0).rgb; - vec3 bump = texture2D(tex1, texcoord0).rgb*2.0-1.0; + vec3 diffuse = texture(tex0, texcoord0).rgb; + vec3 bump = texture(tex1, texcoord0).rgb*2.0-1.0; vec3 bumpw = normalize(world * bump); gcolor.rgb = diffuse; @(gspecpack 0.0 lavaspec) @@ -318,8 +318,8 @@ lazyshader 0 "waterfallenv" [ void main(void) { vec3 camvec = normalize(camdir); - vec3 diffuse = texture2D(tex0, texcoord0).rgb; - vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0; + vec3 diffuse = texture(tex0, texcoord0).rgb; + vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0; vec3 bumpw = normalize(world * bump); vec2 rtc = bump.xy * waterfallrefract.w; @@ -328,7 +328,7 @@ lazyshader 0 "waterfallenv" [ vec3 rcolor = gfetch(tex8, rtc).rgb * waterfallrefract.xyz; float invfresnel = dot(camvec, bumpw); - vec3 env = textureCube(tex3, 2.0*bumpw*invfresnel - camvec).rgb; + vec3 env = texture(tex3, 2.0*bumpw*invfresnel - camvec).rgb; env *= 0.1 + 0.4*pow(clamp(1.0 - invfresnel, 0.0, 1.0), 2.0); gcolor.rgb = vec3(0.0); @@ -369,8 +369,8 @@ lazyshader 0 "waterfall" [ void main(void) { - vec3 diffuse = texture2D(tex0, texcoord0).rgb; - vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0; + vec3 diffuse = texture(tex0, texcoord0).rgb; + vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0; vec3 bumpw = normalize(world * bump); vec2 rtc = bump.xy * waterfallrefract.w; @@ -421,7 +421,7 @@ lazyshader 0 "glassenv" [ void main(void) { vec3 camvec = normalize(camdir); - vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0; + vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0; vec3 bumpw = normalize(world * bump); vec2 rtc = bump.xy * glassrefract.w; @@ -431,7 +431,7 @@ lazyshader 0 "glassenv" [ rcolor *= glassrefract.xyz; float invfresnel = dot(camvec, bumpw); - vec3 env = textureCube(tex0, 2.0*bumpw*invfresnel - camvec).rgb; + vec3 env = texture(tex0, 2.0*bumpw*invfresnel - camvec).rgb; env *= 0.1 + 0.4*pow(clamp(1.0 - invfresnel, 0.0, 1.0), 2.0); gcolor.rgb = vec3(0.0); @@ -471,7 +471,7 @@ lazyshader 0 "glass" [ void main(void) { - vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0; + vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0; vec3 bumpw = normalize(world * bump); vec2 rtc = bump.xy * glassrefract.w; diff --git a/config/glsl/misc.cfg b/config/glsl/misc.cfg index dc60d26..25dc415 100644 --- a/config/glsl/misc.cfg +++ b/config/glsl/misc.cfg @@ -87,7 +87,7 @@ shader 0 "ldr" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); fragcolor = colorscale * color; } ] @@ -137,7 +137,7 @@ shader 0 "fogged" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); fragcolor = colorscale * color; } ] diff --git a/config/glsl/model.cfg b/config/glsl/model.cfg index 7fc9c16..2460fc4 100644 --- a/config/glsl/model.cfg +++ b/config/glsl/model.cfg @@ -109,7 +109,7 @@ shadowmodelfragmentshader = [ void main(void) { @(? (mdlopt "a") [ - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); if(color.a <= alphatest) discard; ]) @@ -224,7 +224,7 @@ modelfragmentshader = [ void main(void) { - vec4 diffuse = texture2D(tex0, texcoord0); + vec4 diffuse = texture(tex0, texcoord0); @(? (mdlopt "a") [ if(diffuse.a <= alphatest) @@ -234,7 +234,7 @@ modelfragmentshader = [ gcolor.rgb = diffuse.rgb*colorscale.rgb; @(? (|| (mdlopt "d") [mdlopt "D"]) [ - vec4 decal = texture2D(tex4, texcoord0); + vec4 decal = texture(tex4, texcoord0); @(? (mdlopt "D") [ gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a); ] [ @@ -243,7 +243,7 @@ modelfragmentshader = [ ]) @(if (mdlopt "n") [result [ - vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5; + vec3 normal = texture(tex3, texcoord0).rgb - 0.5; @(? (mdlopt "c") [ if(!gl_FrontFacing) normal.z = -normal.z; ]) @@ -257,7 +257,7 @@ modelfragmentshader = [ float spec = maskscale.x; @(if (mdlopt "m") [result [ - vec3 masks = texture2D(tex1, texcoord0).rgb; + vec3 masks = texture(tex1, texcoord0).rgb; spec *= masks.r; // specmap in red channel @(? (mdlopt "e") [ @@ -265,7 +265,7 @@ modelfragmentshader = [ float invfresnel = dot(camn, normal); vec3 rvec = 2.0*invfresnel*normal - camn; float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y; - vec3 reflect = textureCube(tex2, rvec).rgb; + vec3 reflect = texture(tex2, rvec).rgb; gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); // envmap mask in blue channel ]) @@ -349,7 +349,7 @@ rsmmodelfragmentshader = [ layout(location = 1) out vec4 gnormal; void main(void) { - vec4 diffuse = texture2D(tex0, texcoord0); + vec4 diffuse = texture(tex0, texcoord0); @(? (mdlopt "a") [ if(diffuse.a <= alphatest) discard; diff --git a/config/glsl/movie.cfg b/config/glsl/movie.cfg index d2cec13..a7bedd1 100644 --- a/config/glsl/movie.cfg +++ b/config/glsl/movie.cfg @@ -19,7 +19,7 @@ lazyshader 0 "moviergb" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = texture2DRect(tex0, texcoord0); + fragcolor = textureRect(tex0, texcoord0); } ] @@ -38,7 +38,7 @@ lazyshader 0 "movieyuv" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color = texture2DRect(tex0, texcoord0).rgb; + vec3 color = textureRect(tex0, texcoord0).rgb; fragcolor = vec4(dot(color, vec3(0.439216, -0.367788, -0.071427)) + 0.501961, dot(color, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961, dot(color, vec3(0.256788, 0.504125, 0.097905)) + 0.062745, @@ -61,10 +61,10 @@ lazyshader 0 "moviey" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb; - vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2( -1, 0)).rgb; - vec3 color3 = texture2DRect(tex0, texcoord0).rgb; - vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; + vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb; + vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2( -1, 0)).rgb; + vec3 color3 = textureRect(tex0, texcoord0).rgb; + vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; fragcolor = vec4(dot(color3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745, dot(color2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745, dot(color1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745, @@ -87,10 +87,10 @@ lazyshader 0 "movieu" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; - vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb; - vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; - vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb; + vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; + vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb; + vec3 color3 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; + vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb; fragcolor = vec4(dot(color3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961, dot(color2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961, dot(color1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961, @@ -113,10 +113,10 @@ lazyshader 0 "moviev" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; - vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb; - vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; - vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb; + vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb; + vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb; + vec3 color3 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb; + vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb; fragcolor = vec4(dot(color3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961, dot(color2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961, dot(color1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961, diff --git a/config/glsl/particle.cfg b/config/glsl/particle.cfg index eec118c..e231875 100644 --- a/config/glsl/particle.cfg +++ b/config/glsl/particle.cfg @@ -51,8 +51,8 @@ explosionshader = [ 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 - vec4 diffuse = texture2D(tex0, dtc); + vec2 dtc = texcoord0 + texture(tex0, texcoord2).xy*0.1; // use color texture as noise to distort texcoords + vec4 diffuse = texture(tex0, dtc); float blend = max(pow(clamp(1.0 - dot(texcoord1, texcoord1), 0.0, 1.0), blendparams.x), blendparams.y); diffuse *= blend*4.0; // dup alpha into RGB channels + intensify and over saturate diffuse.b += 0.5 - blend*0.5; // blue tint @@ -114,7 +114,7 @@ shader 0 "particletext" [ layout(location = 0) out vec4 fragcolor; void main(void) { - float dist = texture2D(tex0, texcoord0).r; + float dist = texture(tex0, texcoord0).r; float border = smoothstep(textparams.x, textparams.y, dist); float outline = smoothstep(textparams.z, textparams.w, dist); fragcolor = vec4(color.rgb * outline, color.a * border); @@ -159,7 +159,7 @@ particleshader = [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 diffuse = texture2D(tex0, texcoord0); + vec4 diffuse = texture(tex0, texcoord0); @(if (>= (strstr $arg1 "soft") 0) [result [ @(gdepthunpack depth [gfetch(tex2, gl_FragCoord.xy)]) diff --git a/config/glsl/postfx.cfg b/config/glsl/postfx.cfg index cd3c017..a0e589a 100644 --- a/config/glsl/postfx.cfg +++ b/config/glsl/postfx.cfg @@ -24,7 +24,7 @@ fsps = [result [ @arg2 void main(void) { - vec4 color = texture2DRect(tex0, texcoord0); + vec4 color = textureRect(tex0, texcoord0); @arg1 } ]] @@ -43,10 +43,10 @@ fsvs4 = [ fsps4 = [ fsps [ - vec4 s00 = texture2DRect(tex0, texcoord1); - vec4 s02 = texture2DRect(tex0, texcoord2); - vec4 s20 = texture2DRect(tex0, texcoord3); - vec4 s22 = texture2DRect(tex0, texcoord4); + vec4 s00 = textureRect(tex0, texcoord1); + vec4 s02 = textureRect(tex0, texcoord2); + vec4 s20 = textureRect(tex0, texcoord3); + vec4 s22 = textureRect(tex0, texcoord4); @arg1 ] [ in vec2 texcoord1, texcoord2, texcoord3, texcoord4; @@ -93,15 +93,15 @@ lazyshader 0 "rotoscope" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 c00 = texture2DRect(tex0, t00); - vec4 c01 = texture2DRect(tex0, t01); - vec4 c02 = texture2DRect(tex0, t02); - vec4 c10 = texture2DRect(tex0, t10); - vec4 c11 = texture2DRect(tex0, t11); - vec4 c12 = texture2DRect(tex0, t12); - vec4 c20 = texture2DRect(tex0, t20); - vec4 c21 = texture2DRect(tex0, t21); - vec4 c22 = texture2DRect(tex0, t22); + vec4 c00 = textureRect(tex0, t00); + vec4 c01 = textureRect(tex0, t01); + vec4 c02 = textureRect(tex0, t02); + vec4 c10 = textureRect(tex0, t10); + vec4 c11 = textureRect(tex0, t11); + vec4 c12 = textureRect(tex0, t12); + vec4 c20 = textureRect(tex0, t20); + vec4 c21 = textureRect(tex0, t21); + vec4 c22 = textureRect(tex0, t22); vec4 diag1 = c00 - c22; vec4 diag2 = c02 - c20; @@ -140,7 +140,7 @@ blur3shader = [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = 0.5*(texture2DRect(tex0, texcoord0) + texture2DRect(tex0, texcoord1)); + fragcolor = 0.5*(textureRect(tex0, texcoord0) + textureRect(tex0, texcoord1)); } ] ] @@ -165,7 +165,7 @@ blur5shader = [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor = 0.4*texture2DRect(tex0, texcoord0) + 0.3*(texture2DRect(tex0, texcoord1) + texture2DRect(tex0, texcoord2)); + fragcolor = 0.4*textureRect(tex0, texcoord0) + 0.3*(textureRect(tex0, texcoord1) + textureRect(tex0, texcoord2)); } ] ] diff --git a/config/glsl/scale.cfg b/config/glsl/scale.cfg index 4750672..761fc4a 100644 --- a/config/glsl/scale.cfg +++ b/config/glsl/scale.cfg @@ -21,7 +21,7 @@ shader 0 "scalelinear" [ void main(void) { - fragcolor = texture2DRect(tex0, texcoord0); + fragcolor = textureRect(tex0, texcoord0); } ] @@ -57,13 +57,13 @@ loop i 2 [ @(if $i [result [ float offset = fract(texcoord0.y-0.5); center.y -= offset; - #define texval(tap) texture2DRect(tex0, center + vec2(0.0, tap)) - #define texvaloffset(tap) texture2DRectOffset(tex0, center, ivec2(0, tap)) + #define texval(tap) textureRect(tex0, center + vec2(0.0, tap)) + #define texvaloffset(tap) textureRectOffset(tex0, center, ivec2(0, tap)) ]] [result [ float offset = fract(texcoord0.x-0.5); center.x -= offset; - #define texval(tap) texture2DRect(tex0, center + vec2(tap, 0.0)) - #define texvaloffset(tap) texture2DRectOffset(tex0, center, ivec2(tap, 0)) + #define texval(tap) textureRect(tex0, center + vec2(tap, 0.0)) + #define texvaloffset(tap) textureRectOffset(tex0, center, ivec2(tap, 0)) ]]) vec4 weight = cubic(offset); weight.y += weight.z; @@ -91,7 +91,7 @@ shader 0 "reorient" [ void main(void) { - fragcolor = texture2DRect(tex0, texcoord0); + fragcolor = textureRect(tex0, texcoord0); } ] diff --git a/config/glsl/shared.cfg b/config/glsl/shared.cfg index 4c0d188..7d835de 100644 --- a/config/glsl/shared.cfg +++ b/config/glsl/shared.cfg @@ -161,9 +161,9 @@ gfetchdefs = [ @(if (! $arg3) [gdepthunpackparams]) ]] [result [ uniform sampler2DRect @(prettylist $arg1); - #define @[gfetchprefix](sampler, coords) texture2DRect(sampler, coords) - #define @[gfetchprefix]offset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset) - #define @[gfetchprefix]proj(sampler, coords) texture2DRectProj(sampler, coords) + #define @[gfetchprefix](sampler, coords) textureRect(sampler, coords) + #define @[gfetchprefix]offset(sampler, coords, offset) textureRectOffset(sampler, coords, offset) + #define @[gfetchprefix]proj(sampler, coords) textureRectProj(sampler, coords) @(if (! $arg3) [gdepthunpackparams]) ]] ] diff --git a/config/glsl/sky.cfg b/config/glsl/sky.cfg index 4fe0c45..e115c61 100644 --- a/config/glsl/sky.cfg +++ b/config/glsl/sky.cfg @@ -24,7 +24,7 @@ shader 0 "skybox" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); fragcolor = colorscale * color; } ] @@ -51,7 +51,7 @@ shader 0 "skyboxoverbright" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec4 color = texture2D(tex0, texcoord0); + vec4 color = texture(tex0, texcoord0); float lum = dot(vec3(@lumweights), color.rgb); float overbright = mix(overbrightparams.x, overbrightparams.y, clamp(lum - overbrightparams.z, 0.0, 1.0)); color.rgb *= overbright; diff --git a/config/glsl/smaa.cfg b/config/glsl/smaa.cfg index df1d9f2..2e91235 100644 --- a/config/glsl/smaa.cfg +++ b/config/glsl/smaa.cfg @@ -111,9 +111,9 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [ void main(void) { // Calculate lumas: - float L = SMAA_LUMA(texture2DRect(tex0, texcoord0)); - float Lleft = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0))); - float Ltop = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, -1))); + float L = SMAA_LUMA(textureRect(tex0, texcoord0)); + float Lleft = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(-1, 0))); + float Ltop = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, -1))); // We do the usual threshold: vec2 delta = abs(L - vec2(Lleft, Ltop)); @@ -128,14 +128,14 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [ ]) { // Calculate right and bottom deltas: - float Lright = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(1, 0))); - float Lbottom = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, 1))); + float Lright = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(1, 0))); + float Lbottom = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, 1))); // Calculate the maximum delta in the direct neighborhood: vec2 maxDelta = max(delta, abs(L - vec2(Lright, Lbottom))); // Calculate left-left and top-top deltas: - float Lleftleft = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(-2, 0))); - float Ltoptop = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, -2))); + float Lleftleft = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(-2, 0))); + float Ltoptop = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, -2))); // Calculate the final maximum delta: maxDelta = max(maxDelta, abs(vec2(Lleft, Ltop) - vec2(Lleftleft, Ltoptop))); @@ -175,9 +175,9 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [ void main(void) { // Calculate color deltas: - vec3 C = texture2DRect(tex0, texcoord0).rgb; - vec3 Cleft = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb); - vec3 Ctop = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, -1)).rgb); + vec3 C = textureRect(tex0, texcoord0).rgb; + vec3 Cleft = abs(C - textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb); + vec3 Ctop = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, -1)).rgb); vec2 delta; delta.x = max(max(Cleft.r, Cleft.g), Cleft.b); delta.y = max(max(Ctop.r, Ctop.g), Ctop.b); @@ -194,11 +194,11 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [ ]) { // Calculate right and bottom deltas: - vec3 Cright = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb); - vec3 Cbottom = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, 1)).rgb); + vec3 Cright = abs(C - textureRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb); + vec3 Cbottom = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, 1)).rgb); // Calculate left-left and top-top deltas: - vec3 Cleftleft = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(-2, 0)).rgb); - vec3 Ctoptop = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, -2)).rgb); + vec3 Cleftleft = abs(C - textureRectOffset(tex0, texcoord0, ivec2(-2, 0)).rgb); + vec3 Ctoptop = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, -2)).rgb); // Calculate the maximum delta in the direct neighborhood: vec3 t = max(max(Cright, Cbottom), max(Cleftleft, Ctoptop)); // Calculate the final maximum delta: @@ -257,45 +257,45 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ * These functions allows to perform diagonal pattern searches. */ float SMAASearchDiagRightUp(void) { - vec2 e = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rg; + vec2 e = textureRectOffset(tex0, texcoord0, ivec2(1, -1)).rg; vec2 texcoord = texcoord0 + vec2(1.0, -1.0); for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) { if (e.x + e.y < 1.5) break; texcoord += vec2(1.0, -1.0); - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return (texcoord.x - texcoord0.x) - 1.0; } float SMAASearchDiagLeftDown(void) { - vec2 e = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rg; + vec2 e = textureRectOffset(tex0, texcoord0, ivec2(-1, 1)).rg; vec2 texcoord = texcoord0 + vec2(-1.0, 1.0); for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) { if (e.x + e.y < 1.5) break; texcoord += vec2(-1.0, 1.0); - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return (texcoord0.x - texcoord.x) - 1.0 + SMAARound(e.y); } float SMAASearchDiagLeftUp(void) { - vec2 e = texture2DRectOffset(tex0, texcoord5, ivec2(-1, -1)).rg; + vec2 e = textureRectOffset(tex0, texcoord5, ivec2(-1, -1)).rg; vec2 texcoord = texcoord5 + vec2(-1.0, -1.0); for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) { if (SMAADecodeDiagBilinearAccess(e.x) + e.y < 1.5) break; texcoord += vec2(-1.0, -1.0); - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return (texcoord5.x - texcoord.x) - 1.0; } float SMAASearchDiagRightDown(void) { - vec2 e = texture2DRectOffset(tex0, texcoord5, ivec2(1, 1)).rg; + vec2 e = textureRectOffset(tex0, texcoord5, ivec2(1, 1)).rg; vec2 texcoord = texcoord5 + vec2(1.0, 1.0); for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) { if (SMAADecodeDiagBilinearAccess(e.x) + e.y < 1.5) break; texcoord += vec2(1.0, 1.0); - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return (texcoord.x - texcoord5.x) - 1.0 + SMAARound(e.y); } @@ -316,7 +316,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ // Move to proper place, according to the subpixel offset: SMAA_AREA_OFFSET(texcoord, offset); - return SMAA_AREA(texture2DRect(tex1, texcoord)); + return SMAA_AREA(textureRect(tex1, texcoord)); } /** @@ -332,8 +332,8 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3 vec4 coords = vec4(0.25 - d.x, d.x, d.y, -0.25 - d.y) + texcoord0.xyxy; vec4 c; - c.xy = texture2DRectOffset(tex0, coords.xy, ivec2(-1, 0)).rg; - c.zw = texture2DRectOffset(tex0, coords.zw, ivec2( 1, 0)).rg; + c.xy = textureRectOffset(tex0, coords.xy, ivec2(-1, 0)).rg; + c.zw = textureRectOffset(tex0, coords.zw, ivec2( 1, 0)).rg; c.xz = SMAADecodeDiagBilinearAccess(c.xz); c = SMAARound(c); @@ -349,9 +349,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3 vec4 coords = vec4(-d.xx, d.yy) + texcoord0.xyxy; vec4 c; - c.x = texture2DRectOffset(tex0, coords.xy, ivec2(-1, 0)).g; - c.y = texture2DRectOffset(tex0, coords.xy, ivec2( 0, -1)).r; - c.zw = texture2DRectOffset(tex0, coords.zw, ivec2( 1, 0)).gr; + c.x = textureRectOffset(tex0, coords.xy, ivec2(-1, 0)).g; + c.y = textureRectOffset(tex0, coords.xy, ivec2( 0, -1)).r; + c.zw = textureRectOffset(tex0, coords.zw, ivec2( 1, 0)).gr; vec2 e = 2.0 * c.xz + c.yw; e *= step(d, vec2(float(SMAA_MAX_SEARCH_STEPS_DIAG) - 0.5)); @@ -374,7 +374,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ */ float SMAASearchLength(vec2 e, float bias, float scale) { e.r = bias + e.r * scale; - return 255.0 * texture2DRect(tex2, e*vec2(float(SMAA_SEARCHTEX_WIDTH), float(SMAA_SEARCHTEX_HEIGHT))).r; + return 255.0 * textureRect(tex2, e*vec2(float(SMAA_SEARCHTEX_WIDTH), float(SMAA_SEARCHTEX_HEIGHT))).r; } /** @@ -388,12 +388,12 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ * Sampling with different offsets in each direction allows to disambiguate * which edges are active from the four fetched ones. */ - vec2 e = texture2DRect(tex0, texcoord1).rg; + vec2 e = textureRect(tex0, texcoord1).rg; vec2 texcoord = texcoord1; for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) { if(e.g <= 0.8281 || e.r > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line? texcoord.x -= 2.0; - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } // We correct the previous (-0.25, -0.125) offset we applied: // The searches are bias by 1, so adjust the coords accordingly: @@ -402,34 +402,34 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ } float SMAASearchXRight(void) { - vec2 e = texture2DRect(tex0, texcoord2).rg; + vec2 e = textureRect(tex0, texcoord2).rg; vec2 texcoord = texcoord2; for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) { if(e.g <= 0.8281 || e.r > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line? texcoord.x += 2.0; - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return texcoord.x - (0.25 + 1.0) + SMAASearchLength(e, 0.5, 0.5); } float SMAASearchYUp(void) { - vec2 e = texture2DRect(tex0, texcoord3).rg; + vec2 e = textureRect(tex0, texcoord3).rg; vec2 texcoord = texcoord3; for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) { if(e.r <= 0.8281 || e.g > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line? texcoord.y -= 2.0; - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return texcoord.y + (0.25 + 1.0) - SMAASearchLength(e.gr, 0.0, 0.5); } float SMAASearchYDown(void) { - vec2 e = texture2DRect(tex0, texcoord4).rg; + vec2 e = textureRect(tex0, texcoord4).rg; vec2 texcoord = texcoord4; for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) { if(e.r <= 0.8281 || e.g > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line? texcoord.y += 2.0; - e = texture2DRect(tex0, texcoord).rg; + e = textureRect(tex0, texcoord).rg; } return texcoord.y - (0.25 + 1.0) + SMAASearchLength(e.gr, 0.5, 0.5); } @@ -450,7 +450,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ // Move to proper place, according to the subpixel offset: SMAA_AREA_OFFSET(texcoord, offset); - return SMAA_AREA(texture2DRect(tex1, texcoord)); + return SMAA_AREA(textureRect(tex1, texcoord)); } //----------------------------------------------------------------------------- @@ -461,16 +461,16 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ vec2 SMAADetectHorizontalCornerPattern(vec3 coords, vec2 d) { vec2 e; if(d.x >= d.y) coords.x = coords.z + 1.0 - 0.5*step(d.x, d.y); - e.r = texture2DRectOffset(tex0, coords.xy, ivec2(0, 1)).r; - e.g = texture2DRectOffset(tex0, coords.xy, ivec2(0, -2)).r; + e.r = textureRectOffset(tex0, coords.xy, ivec2(0, 1)).r; + e.g = textureRectOffset(tex0, coords.xy, ivec2(0, -2)).r; return clamp(1.0 - (1.0 - SMAA_CORNER_ROUNDING_NORM) * e, 0.0, 1.0); } vec2 SMAADetectVerticalCornerPattern(vec3 coords, vec2 d) { vec2 e; if(d.x >= d.y) coords.y = coords.z + 1.0 - 0.5*step(d.x, d.y); - e.r = texture2DRectOffset(tex0, coords.xy, ivec2( 1, 0)).g; - e.g = texture2DRectOffset(tex0, coords.xy, ivec2(-2, 0)).g; + e.r = textureRectOffset(tex0, coords.xy, ivec2( 1, 0)).g; + e.g = textureRectOffset(tex0, coords.xy, ivec2(-2, 0)).g; return clamp(1.0 - (1.0 - SMAA_CORNER_ROUNDING_NORM) * e, 0.0, 1.0); } @@ -483,7 +483,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ { vec4 weights = vec4(0.0); - vec2 e = texture2DRect(tex0, texcoord5).rg; + vec2 e = textureRect(tex0, texcoord5).rg; if (e.g > 0.5) { // Edge at north #if SMAA_MAX_SEARCH_STEPS_DIAG > 0 @@ -511,9 +511,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ // filtering. Sampling at -0.25 (see CROSSING_OFFSET) enables to // discern what value each edge has: vec2 e; - e.x = texture2DRect(tex0, coords.xy).r; + e.x = textureRect(tex0, coords.xy).r; // Fetch the right crossing edges: - e.y = texture2DRectOffset(tex0, coords.zy, ivec2(1, 0)).r; + e.y = textureRectOffset(tex0, coords.zy, ivec2(1, 0)).r; // Ok, we know how this pattern looks like, now it is time for getting // the actual area: @@ -544,9 +544,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [ // Fetch the top crossing edges: vec2 e; - e.x = texture2DRect(tex0, coords.xy).g; + e.x = textureRect(tex0, coords.xy).g; // Fetch the bottom crossing edges: - e.y = texture2DRectOffset(tex0, coords.xz, ivec2(0, 1)).g; + e.y = textureRectOffset(tex0, coords.xz, ivec2(0, 1)).g; // Get the area for this direction: weights.ba = SMAAArea(d, e, subsamples.x); @@ -585,9 +585,9 @@ shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [ { // Fetch the blending weights for current pixel: vec4 a; - a.xz = texture2DRect(tex1, texcoord0).rb; - a.y = texture2DRectOffset(tex1, texcoord0, ivec2(0, 1)).g; - a.w = texture2DRectOffset(tex1, texcoord0, ivec2(1, 0)).a; + a.xz = textureRect(tex1, texcoord0).rb; + a.y = textureRectOffset(tex1, texcoord0, ivec2(0, 1)).g; + a.w = textureRectOffset(tex1, texcoord0, ivec2(1, 0)).a; // Up to 4 lines can be crossing a pixel (one through each edge). We // favor blending by choosing the line with the maximum weight for each @@ -604,19 +604,19 @@ shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [ // We exploit bilinear filtering to mix current pixel with the chosen // neighbor: - fragcolor = texture2DRect(tex0, texcoord0 + offset); + fragcolor = textureRect(tex0, texcoord0 + offset); @(? (smaaopt "s") [ - a.xz = texture2DRect(tex3, texcoord0).rb; - a.y = texture2DRectOffset(tex3, texcoord0, ivec2(0, 1)).g; - a.w = texture2DRectOffset(tex3, texcoord0, ivec2(1, 0)).a; + a.xz = textureRect(tex3, texcoord0).rb; + a.y = textureRectOffset(tex3, texcoord0, ivec2(0, 1)).g; + a.w = textureRectOffset(tex3, texcoord0, ivec2(1, 0)).a; offset.x = a.w > a.z ? a.w : -a.z; offset.y = a.y > a.x ? a.y : -a.x; if (abs(offset.x) > abs(offset.y)) offset.y = 0.0; else offset.x = 0.0; - fragcolor = 0.5*(fragcolor + texture2DRect(tex2, texcoord0 + offset)); + fragcolor = 0.5*(fragcolor + textureRect(tex2, texcoord0 + offset)); ]) } ] diff --git a/config/glsl/stain.cfg b/config/glsl/stain.cfg index 7e0a04d..e1a5b2a 100644 --- a/config/glsl/stain.cfg +++ b/config/glsl/stain.cfg @@ -40,7 +40,7 @@ stainvariantshader = [ ]) void main(void) { - vec4 diffuse = texture2D(tex0, texcoord0); + vec4 diffuse = texture(tex0, texcoord0); @(if (stainopt "o") [result [ diffuse.rgb = mix(vec3(0.5), diffuse.rgb, color.rgb); fragcolor.rgb = diffuse.rgb; diff --git a/config/glsl/tonemap.cfg b/config/glsl/tonemap.cfg index da87d25..10364fb 100644 --- a/config/glsl/tonemap.cfg +++ b/config/glsl/tonemap.cfg @@ -19,7 +19,7 @@ shader 0 "hdrreduce" [ layout(location = 0) out vec4 fragcolor; void main(void) { - fragcolor.rgb = texture2DRect(tex0, texcoord0).rgb; + fragcolor.rgb = textureRect(tex0, texcoord0).rgb; } ] @@ -38,7 +38,7 @@ shader 0 "hdrreduce2w" [ 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); + fragcolor.rgb = 0.5*(textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb + textureRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb); } ] @@ -57,8 +57,8 @@ shader 0 "hdrreduce2" [ 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 + - texture2DRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb); + fragcolor.rgb = 0.25*(textureRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb + textureRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb + + textureRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb + textureRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb); } ] @@ -181,7 +181,7 @@ shader 0 "hdrluminance" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + vec3 color = textureRect(tex0, texcoord0).rgb*2.0; @(hdrgammadecode color) float lum = dot(color, vec3(@lumweights)); float loglum = sqrt(clamp(lum, 0.015625, 4.0)) * (1.0/2.0); // allow values as low as 2^-6, and as high 2^2 @@ -206,7 +206,7 @@ shader 0 "hdrluminance2w" [ void main(void) { @(loopconcat i 2 [result [ - vec3 color@[i] = texture2DRectOffset(tex0, texcoord0, ivec2(@(at ["-1, 0" "1, 0"] $i))).rgb*2.0; + vec3 color@[i] = textureRectOffset(tex0, texcoord0, ivec2(@(at ["-1, 0" "1, 0"] $i))).rgb*2.0; @(hdrgammadecode [color@[i]]) float lum@[i] = dot(color@[i], vec3(@lumweights)); float loglum@[i] = sqrt(clamp(lum@[i], 0.015625, 4.0)) * (1.0/2.0); @@ -232,7 +232,7 @@ shader 0 "hdrluminance2" [ void main(void) { @(loopconcat i 4 [result [ - vec3 color@[i] = texture2DRectOffset(tex0, texcoord0, ivec2(@(at ["-1, -1" "1, -1" "1, 1" "-1, 1"] $i))).rgb*2.0; + vec3 color@[i] = textureRectOffset(tex0, texcoord0, ivec2(@(at ["-1, -1" "1, -1" "1, 1" "-1, 1"] $i))).rgb*2.0; @(hdrgammadecode [color@[i]]) float lum@[i] = dot(color@[i], vec3(@lumweights)); float loglum@[i] = sqrt(clamp(lum@[i], 0.015625, 4.0)) * (1.0/2.0); @@ -253,7 +253,7 @@ shader 0 "hdraccum" [ layout(location = 0) out vec4 fragcolor; void main(void) { - float lum = texture2DRect(tex0, vec2(0.5, 0.5)).r * 2.0; + float lum = textureRect(tex0, vec2(0.5, 0.5)).r * 2.0; lum *= lum; fragcolor = vec4(vec3(lum*0.25), accumscale); } @@ -274,7 +274,7 @@ shader 0 "hdrbloom" [ { gl_Position = vvertex; texcoord0 = vtexcoord0; - float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture2D(tex2, vec2(0.5, 0.5)).r] [vcolor]); + float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture(tex2, vec2(0.5, 0.5)).r] [vcolor]); lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4); lumthreshold = -log2(1.0 - hdrparams.z); } @@ -286,7 +286,7 @@ shader 0 "hdrbloom" [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + vec3 color = textureRect(tex0, texcoord0).rgb*2.0; @(hdrgammadecode color) float lum = dot(color, vec3(@lumweights)); color *= max(lum*lumscale - lumthreshold, 0.0) / (lum + 1e-4); @@ -313,7 +313,7 @@ hdrtonemapvertexshader = [ gl_Position = vvertex; texcoord0 = vtexcoord0; texcoord1 = vtexcoord1; - float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture2D(tex2, vec2(0.5, 0.5)).r] [vcolor]); + float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture(tex2, vec2(0.5, 0.5)).r] [vcolor]); lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4); lumsaturate = -log2(1.0 - hdrparams.y) / lumscale; } @@ -355,7 +355,7 @@ hdrtonemapshaders = [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 color = texture2DRect(tex0, texcoord0).rgb; + vec3 color = textureRect(tex0, texcoord0).rgb; fragcolor.rgb = color; @arg4 @(? $arg3 $arg3 [fragcolor.a = 0.0;]) @@ -369,8 +369,8 @@ hdrtonemapshaders = [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; - vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0; + vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w; + vec3 color = textureRect(tex0, texcoord0).rgb*2.0; color += bloom; @(hdrgammadecode color) @(hdrtonemapfrag color) @@ -394,7 +394,7 @@ msaatonemapshaders = [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; + vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w; vec3 color = texelFetch(tex0, ivec2(texcoord0), gl_SampleID).rgb*2.0; color += bloom; @(hdrgammadecode color) @@ -412,7 +412,7 @@ msaatonemapshaders = [ layout(location = 0) out vec4 fragcolor; void main(void) { - vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; + vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w; vec3 resolved = vec3(0.0); for(int sampleidx = 0; sampleidx < @msaasamples; sampleidx++) { @@ -441,7 +441,7 @@ msaasplitshaders = [ ]]) void main(void) { - vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w; + vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w; @arg4 @(loopconcat i $msaasamples [result [ vec3 color@i = texelFetch(tex0, ivec2(texcoord0), @i).rgb*2.0 + bloom; diff --git a/config/glsl/volumetric.cfg b/config/glsl/volumetric.cfg index 8876c29..acc962e 100644 --- a/config/glsl/volumetric.cfg +++ b/config/glsl/volumetric.cfg @@ -69,12 +69,12 @@ volumetricvariantshader = [ @(if (volopt "p") [ if (|| (volopt "g") (volopt "G")) [ ? (> $usetexgather 1) [ - #define filtershadow(shadowtc) float(shadow2D(tex4, vec3(shadowtc.xy*shadowatlasscale, shadowtc.z))) + #define filtershadow(shadowtc) float(shadow(tex4, vec3(shadowtc.xy*shadowatlasscale, shadowtc.z))) ] [ - #define filtershadow(shadowtc) step(shadowtc.z, float(texture2D(tex4, shadowtc.xy*shadowatlasscale))) + #define filtershadow(shadowtc) step(shadowtc.z, float(texture(tex4, shadowtc.xy*shadowatlasscale))) ] ] [result [ - #define filtershadow(shadowtc) float(shadow2DRect(tex4, shadowtc)) + #define filtershadow(shadowtc) float(textureRect(tex4, shadowtc)) ]] ]) @@ -204,11 +204,11 @@ volumetricbilateralvariantshader = [ #define tc gl_FragCoord.xy #define depthtc @(? $reduced [texcoord0] [gl_FragCoord.xy]) #define tapvec(type, i) @(? (=s $filterdir "x") [type(i, 0.0)] [type(0.0, i)]) - #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i)) - #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i)) + #define texval(i) textureRect(tex0, tc + tapvec(vec2, i)) + #define texvaloffset(i) textureRectOffset(tex0, tc, tapvec(ivec2, i)) #define depthval(i) gfetch(tex3, depthtc + tapvec(vec2, i)) #define depthvaloffset(i) gfetchoffset(tex3, depthtc, tapvec(ivec2, i)) - vec3 color = texture2DRect(tex0, tc).rgb; + vec3 color = textureRect(tex0, tc).rgb; @(gdepthunpack depth [gfetch(tex3, depthtc)]) float weights = 1.0; @(loopconcat i (* 2 $numtaps) [ diff --git a/config/glsl/world.cfg b/config/glsl/world.cfg index edef80b..fe4df6b 100644 --- a/config/glsl/world.cfg +++ b/config/glsl/world.cfg @@ -136,12 +136,12 @@ worldvariantshader = [ triblend *= triblend; triblend /= triblend.x + triblend.y + triblend.z; - vec4 diffusex = texture2D(diffusemap, texcoordx); - vec4 diffusey = texture2D(diffusemap, texcoordy); - vec4 diffusez = texture2D(@(? (wtopt "d") "detaildiffusemap" "diffusemap"), texcoordz); + vec4 diffusex = texture(diffusemap, texcoordx); + vec4 diffusey = texture(diffusemap, texcoordy); + vec4 diffusez = texture(@(? (wtopt "d") "detaildiffusemap" "diffusemap"), texcoordz); vec4 diffuse = diffusex*triblend.x + diffusey*triblend.y + diffusez*triblend.z; ]] [result [ - vec4 diffuse = texture2D(diffusemap, texcoord0); + vec4 diffuse = texture(diffusemap, texcoord0); ]]) gcolor.rgb = diffuse.rgb*colorparams.rgb; @@ -150,7 +150,7 @@ worldvariantshader = [ vec3 camvecn = normalize(camvec); float invfresnel = dot(camvecn, normal); vec3 rvec = 2.0*normal*invfresnel - camvecn; - vec3 reflect = textureCube(envmap, rvec).rgb; + vec3 reflect = texture(envmap, rvec).rgb; @(? (wtopt "R") [ vec3 rmod = envscale.xyz*diffuse.a; ] [ @@ -161,12 +161,12 @@ worldvariantshader = [ @(if (wtopt "g") [result [ @(? (wtopt "T") [ - vec3 glowx = texture2D(glowmap, texcoordx).rgb; - vec3 glowy = texture2D(glowmap, texcoordy).rgb; - vec3 glowz = texture2D(glowmap, texcoordz).rgb; + vec3 glowx = texture(glowmap, texcoordx).rgb; + vec3 glowy = texture(glowmap, texcoordy).rgb; + vec3 glowz = texture(glowmap, texcoordz).rgb; vec3 glow = glowx*triblend.x + glowy*triblend.y + glowz*triblend.z; ] [ - vec3 glow = texture2D(glowmap, texcoord0).rgb; + vec3 glow = texture(glowmap, texcoord0).rgb; ]) glow *= @(? (wtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]); @(if (wtopt "a") [result [ @@ -190,7 +190,7 @@ worldvariantshader = [ @(gdepthpackfrag (|| $msaalight [&& $msaasamples [! (wtopt "a")]]) "" hashid) @(? (wtopt "b") [ - float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + float blend = abs(texture(blendmap, texcoord1).r - blendlayer); gcolor.rgb *= blend; gnormal.rgb *= blend; gnormal.a *= blendlayer; @@ -396,9 +396,9 @@ bumpvariantshader = [ #define worldz mat3(tangentx, tangenty, normal) @(if (btopt "p") [result [ - float heightx = texture2D(normalmap, texcoordx).a; - float heighty = texture2D(normalmap, texcoordy).a; - float heightz = texture2D(@(? (btopt "d") "detailnormalmap" "normalmap"), texcoordz).a; + float heightx = texture(normalmap, texcoordx).a; + float heighty = texture(normalmap, texcoordy).a; + float heightz = texture(@(? (btopt "d") "detailnormalmap" "normalmap"), texcoordz).a; vec3 camvect = camvecn * mat3(tangentx, tangenty, tangentz); vec2 dtcx = texcoordx + camvect.yz*(heightx*parallaxscale.x + parallaxscale.y); @@ -410,14 +410,14 @@ bumpvariantshader = [ #define dtcz texcoordz ]]) - vec4 diffusex = texture2D(diffusemap, dtcx); - vec4 diffusey = texture2D(diffusemap, dtcy); - vec4 diffusez = texture2D(@(? (btopt "d") "detaildiffusemap" "diffusemap"), dtcz); + vec4 diffusex = texture(diffusemap, dtcx); + vec4 diffusey = texture(diffusemap, dtcy); + vec4 diffusez = texture(@(? (btopt "d") "detaildiffusemap" "diffusemap"), dtcz); vec4 diffuse = diffusex*triblend.x + diffusey*triblend.y + diffusez*triblend.z; - vec3 bumpx = (texture2D(normalmap, dtcx).rgb*2.0 - 1.0)*triblend.x; - vec3 bumpy = (texture2D(normalmap, dtcy).rgb*2.0 - 1.0)*triblend.y; - vec3 bumpz = (texture2D(@(? (btopt "d") "detailnormalmap" "normalmap"), dtcz).rgb*2.0 - 1.0)*triblend.z; + vec3 bumpx = (texture(normalmap, dtcx).rgb*2.0 - 1.0)*triblend.x; + vec3 bumpy = (texture(normalmap, dtcy).rgb*2.0 - 1.0)*triblend.y; + vec3 bumpz = (texture(@(? (btopt "d") "detailnormalmap" "normalmap"), dtcz).rgb*2.0 - 1.0)*triblend.z; vec3 bumpw = normalize(worldx*bumpx + worldy*bumpy + worldz*bumpz); @(? (btopt "A") [ @@ -425,15 +425,15 @@ bumpvariantshader = [ ]) ]] [result [ @(? (btopt "p") [ - float height = texture2D(normalmap, texcoord0).a; + float height = texture(normalmap, texcoord0).a; vec2 dtc = texcoord0 + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y); ] [ #define dtc texcoord0 ]) - vec4 diffuse = texture2D(diffusemap, dtc); + vec4 diffuse = texture(diffusemap, dtc); - vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0; + vec3 bump = texture(normalmap, dtc).rgb*2.0 - 1.0; vec3 bumpw = normalize(world * bump); ]]) @@ -442,7 +442,7 @@ bumpvariantshader = [ @(if (btopt "r") [result [ float invfresnel = dot(camvecn, bumpw); vec3 rvec = 2.0*bumpw*invfresnel - camvecn; - vec3 reflect = textureCube(envmap, rvec).rgb; + vec3 reflect = texture(envmap, rvec).rgb; @(? (btopt "R") [ vec3 rmod = envscale.xyz*diffuse.a; ] [ @@ -453,12 +453,12 @@ bumpvariantshader = [ @(if (btopt "g") [result [ @(? (btopt "T") [ - vec3 glowx = texture2D(glowmap, dtcx).rgb; - vec3 glowy = texture2D(glowmap, dtcy).rgb; - vec3 glowz = texture2D(glowmap, dtcz).rgb; + vec3 glowx = texture(glowmap, dtcx).rgb; + vec3 glowy = texture(glowmap, dtcy).rgb; + vec3 glowz = texture(glowmap, dtcz).rgb; vec3 glow = glowx*triblend.x + glowy*triblend.y + glowz*triblend.z; ] [ - vec3 glow = texture2D(glowmap, dtc).rgb; + vec3 glow = texture(glowmap, dtc).rgb; ]) glow *= @(? (btopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]); @(if (btopt "a") [result [ @@ -484,7 +484,7 @@ bumpvariantshader = [ @(gdepthpackfrag (|| $msaalight [&& $msaasamples [! (btopt "a")]]) "" hashid) @(? (btopt "b") [ - float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + float blend = abs(texture(blendmap, texcoord1).r - blendlayer); gcolor.rgb *= blend; gnormal.rgb *= blend; gnormal.a *= blendlayer; @@ -625,7 +625,7 @@ defershader 1 "rsmworld" [ layout(location = 1) out vec4 gnormal; void main(void) { - vec4 diffuse = texture2D(diffusemap, texcoord0); + vec4 diffuse = texture(diffusemap, texcoord0); @(if (= $i 2) [result [ #define alpha 1.0 @@ -637,7 +637,7 @@ defershader 1 "rsmworld" [ gnormal = vec4(normal.xyz*0.5+0.5, 0.0); @(if (= $i 1) [result [ - float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer); + float blend = abs(texture(blendmap, texcoord1).r - blendlayer); gcolor.rgb *= blend; gcolor.a = blendlayer; gnormal *= blend; diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp index b3ebd90..61964c7 100644 --- a/src/engine/shader.cpp +++ b/src/engine/shader.cpp @@ -112,29 +112,14 @@ static void showglslinfo(GLenum type, GLuint obj, const char *name, const char * 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"); - const char *parts[16]; - int numparts = 0; - parts[numparts++] = "#version 400\n"; - - parts[numparts++] = - "#define texture1D(sampler, coords) texture(sampler, coords)\n" - "#define texture2D(sampler, coords) texture(sampler, coords)\n" - "#define texture2DOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n" - "#define texture2DProj(sampler, coords) textureProj(sampler, coords)\n" - "#define shadow2D(sampler, coords) texture(sampler, coords)\n" - "#define shadow2DOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n" - "#define texture3D(sampler, coords) texture(sampler, coords)\n" - "#define textureCube(sampler, coords) texture(sampler, coords)\n"; - parts[numparts++] = - "#define texture2DRect(sampler, coords) texture(sampler, coords)\n" - "#define texture2DRectProj(sampler, coords) textureProj(sampler, coords)\n" - "#define shadow2DRect(sampler, coords) texture(sampler, coords)\n"; - parts[numparts++] = - "#define texture2DRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n" - "#define shadow2DRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n"; - - parts[numparts++] = source; - + const char *parts[] = { + "#version 400\n", + "#define textureRect(sampler, coords) texture(sampler, coords)\n" + "#define textureRectProj(sampler, coords) textureProj(sampler, coords)\n" + "#define textureRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n", + source + }; + GLsizei numparts = sizeof(parts) / sizeof(void *); obj = glCreateShader_(type); glShaderSource_(obj, numparts, (const GLchar **)parts, NULL); glCompileShader_(obj); @@ -786,7 +771,7 @@ void setupshaders() "in vec4 colorscale;\n" "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" - " vec4 color = texture2D(tex0, texcoord0);\n" + " vec4 color = texture(tex0, texcoord0);\n" " fragcolor = colorscale * color;\n" "}\n"); hudtextshader = newshader(0, "hudtext", @@ -806,7 +791,7 @@ void setupshaders() "in vec4 colorscale;\n" "layout(location = 0) out vec4 fragcolor;\n" "void main(void) {\n" - " float dist = texture2D(tex0, texcoord0).r;\n" + " float dist = texture(tex0, texcoord0).r;\n" " float border = smoothstep(textparams.x, textparams.y, dist);\n" " float outline = smoothstep(textparams.z, textparams.w, dist);\n" " fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border);\n"