Browse Source

ditch 1D/2D/3D qualifiers on texture

Daniel Kolesa 7 months ago
parent
commit
5f3c618607

+ 5
- 5
config/glsl/aa.cfg View File

@@ -36,14 +36,14 @@ lazyshader 0 "tqaaresolve" [
36 36
         vec2 vel = prevtc.xy/prevtc.w - texcoord0;
37 37
         float scale = clamp(maxvelocity.x*inversesqrt(dot(vel, vel) + 1e-6), 0.0, 1.0);
38 38
 
39
-        float mask = 1.0 - texture2DRect(tex0, texcoord0 + quincunx.xy).a;
40
-        vec4 color = texture2DRect(tex0, texcoord0 + mask*quincunx.xy); 
41
-        vec4 prevcolor = texture2DRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale));
39
+        float mask = 1.0 - textureRect(tex0, texcoord0 + quincunx.xy).a;
40
+        vec4 color = textureRect(tex0, texcoord0 + mask*quincunx.xy); 
41
+        vec4 prevcolor = textureRect(tex1, texcoord0 + mask*(quincunx.zw + vel*scale));
42 42
 
43 43
         vec4 l0 = textureGather(tex0, texcoord1, 1);
44 44
         vec4 l1 = textureGatherOffset(tex0, texcoord1, ivec2(1, 1), 1);
45
-        float l2 = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).g;
46
-        float l3 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).g;
45
+        float l2 = textureRectOffset(tex0, texcoord0, ivec2(1, -1)).g;
46
+        float l3 = textureRectOffset(tex0, texcoord0, ivec2(-1, 1)).g;
47 47
         vec4 l01min = min(l0, l1), l01max = max(l0, l1);
48 48
         l01min.xy = min(l01min.xy, l01min.zw);
49 49
         l01max.xy = max(l01max.xy, l01max.zw);

+ 6
- 6
config/glsl/ao.cfg View File

@@ -90,7 +90,7 @@ ambientobscurancevariantshader = [
90 90
                 normal *= normscale > 0.75 ? normscale : 0.0;
91 91
                 normal = normalmatrix * normal;
92 92
             ]])
93
-            vec2 noise = texture2D(tex2, texcoord1).rg*2.0-1.0;
93
+            vec2 noise = texture(tex2, texcoord1).rg*2.0-1.0;
94 94
             float obscure = 0.0;
95 95
             @(loopconcat i $maxaotaps [result [
96 96
                 vec2 offset@[i] = reflect(vec2(@(at $aotapoffsets $i)), noise);
@@ -193,19 +193,19 @@ bilateralvariantshader = [
193 193
             #define tc @(? $upscaled [texcoord1] [gl_FragCoord.xy])
194 194
             #define depthtc @(? $reduced [texcoord0] [gl_FragCoord.xy])
195 195
             #define tapvec(type, i) @(? (=s $filterdir "x") [type(i, 0.0)] [type(0.0, i)])
196
-            #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i))
197
-            #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i))
196
+            #define texval(i) textureRect(tex0, tc + tapvec(vec2, i))
197
+            #define texvaloffset(i) textureRectOffset(tex0, tc, tapvec(ivec2, i))
198 198
             #define depthval(i) gfetch(tex1, depthtc + tapvec(vec2, i))
199 199
             #define depthvaloffset(i) gfetchoffset(tex1, depthtc, tapvec(ivec2, i))
200 200
             @(cond [$packed] [
201 201
                 if $aodepthformat [result [
202
-                    vec2 vals = texture2DRect(tex0, tc).rg;
202
+                    vec2 vals = textureRect(tex0, tc).rg;
203 203
                     #define color vals.x
204 204
                     @(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [
205 205
                         #define depth vals.y
206 206
                     ]])
207 207
                 ]] [result [
208
-                    vec4 vals = texture2DRect(tex0, tc);
208
+                    vec4 vals = textureRect(tex0, tc);
209 209
                     #define color vals.a
210 210
                     @(if $upscaled [gdepthunpack depth [gfetch(tex1, depthtc)]] [result [
211 211
                         float depth = dot(vals.rgb, gdepthunpackparams);
@@ -219,7 +219,7 @@ bilateralvariantshader = [
219 219
                     float depth = dot(gfetch(tex1, depthtc).rgb, gdepthunpackparams);
220 220
                 ]])
221 221
             ]] [result [
222
-                float color = texture2DRect(tex0, tc).r;
222
+                float color = textureRect(tex0, tc).r;
223 223
                 @(gdepthunpack depth [gfetch(tex1, depthtc)])
224 224
             ]])
225 225
             float weights = 1.0;

+ 6
- 6
config/glsl/decal.cfg View File

@@ -121,7 +121,7 @@ decalvariantshader = [
121 121
         {
122 122
             @(if (dtopt "n") [result [
123 123
                 @(? (dtopt "p") [
124
-                    float height = texture2D(normalmap, texcoord0.xy).a;
124
+                    float height = texture(normalmap, texcoord0.xy).a;
125 125
                     vec3 camvecn = normalize(camvec);
126 126
                     vec2 dtc = texcoord0.xy + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y);
127 127
                 ] [
@@ -129,7 +129,7 @@ decalvariantshader = [
129 129
                 ])
130 130
 
131 131
                 @(? (|| (! (dtopt "0")) (dtopt "r")) [
132
-                    vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0;
132
+                    vec3 bump = texture(normalmap, dtc).rgb*2.0 - 1.0;
133 133
                     vec3 bumpw = world * bump;
134 134
                     #define nvec bumpw
135 135
                 ])
@@ -137,10 +137,10 @@ decalvariantshader = [
137 137
                 #define dtc texcoord0.xy
138 138
             ]])
139 139
 
140
-            vec4 diffuse = texture2D(diffusemap, dtc);
140
+            vec4 diffuse = texture(diffusemap, dtc);
141 141
 
142 142
             @(if (dtopt "g") [result [
143
-                vec4 glowspec = texture2D(glowmap, dtc);
143
+                vec4 glowspec = texture(glowmap, dtc);
144 144
                 #define glow glowspec.rgb
145 145
                 #define spec glowspec.a
146 146
                 glow *= @(? (dtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]);
@@ -149,7 +149,7 @@ decalvariantshader = [
149 149
 
150 150
             @(if (dtopt "0") [result [
151 151
                 @(if (&& (dtopt "S") [! (dtopt "g")]) [result [
152
-                    float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture2D(glowmap, dtc).r] [texture2D(normalmap, dtc).a]);
152
+                    float spec = @(? (|| (! (dtopt "n")) (dtopt "p")) [texture(glowmap, dtc).r] [texture(normalmap, dtc).a]);
153 153
                 ]])
154 154
                 @(gspecpack [gloss.x] (if (dtopt "s") [? (dtopt "S") [spec * specscale.x] [specscale.x]]))
155 155
             ]])
@@ -167,7 +167,7 @@ decalvariantshader = [
167 167
                     ])
168 168
                     float invfresnel = dot(camvecn, nvec);
169 169
                     vec3 rvec = 2.0*nvec*invfresnel - camvecn;
170
-                    vec3 reflect = textureCube(envmap, rvec).rgb * diffuse.a;
170
+                    vec3 reflect = texture(envmap, rvec).rgb * diffuse.a;
171 171
                     @(? (dtopt "R") [
172 172
                         vec3 rmod = envscale.xyz*spec;
173 173
                     ] [

+ 8
- 8
config/glsl/deferred.cfg View File

@@ -250,7 +250,7 @@ deferredlightvariantshader = [
250 250
                     return dot(mix(cols.xyz, cols.yzw, offset.x), vec3(1.0/9.0));
251 251
                 }
252 252
             ]] [dlopt "E"] [result [
253
-                #define shadowval(xy, xoff, yoff) float(shadow2DRect(tex4, vec3(xy + vec2(xoff, yoff), shadowtc.z)))
253
+                #define shadowval(xy, xoff, yoff) float(textureRect(tex4, vec3(xy + vec2(xoff, yoff), shadowtc.z)))
254 254
                 float filtershadow(vec3 shadowtc)
255 255
                 {
256 256
                     vec2 offset = fract(shadowtc.xy - 0.5);
@@ -269,7 +269,7 @@ deferredlightvariantshader = [
269 269
                            (4.0/25.0)*shadowval(center.xy, 0.0, 0.0);
270 270
                 }
271 271
             ]] [dlopt "F"] [result [
272
-                #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0)))
272
+                #define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0)))
273 273
                 float filtershadow(vec3 shadowtc)
274 274
                 {
275 275
                     vec2 offset = fract(shadowtc.xy - 0.5);
@@ -290,7 +290,7 @@ deferredlightvariantshader = [
290 290
                              shadowval(center, 1.0, 1.0)));
291 291
                 }
292 292
             ]] [dlopt "f"] [result [
293
-                #define shadowval(center, xoff, yoff) float(shadow2DRect(tex4, center + vec3(xoff, yoff, 0.0)))
293
+                #define shadowval(center, xoff, yoff) float(textureRect(tex4, center + vec3(xoff, yoff, 0.0)))
294 294
                 float filtershadow(vec3 shadowtc)
295 295
                 {
296 296
                     return dot(vec4(0.25),
@@ -300,7 +300,7 @@ deferredlightvariantshader = [
300 300
                                     shadowval(shadowtc, 1.0, 0.4))); 
301 301
                 }
302 302
             ]] [result [
303
-                #define filtershadow(shadowtc) float(shadow2DRect(tex4, shadowtc))
303
+                #define filtershadow(shadowtc) float(textureRect(tex4, shadowtc))
304 304
             ]]
305 305
         ])
306 306
 
@@ -342,7 +342,7 @@ deferredlightvariantshader = [
342 342
                     ]])
343 343
                     tc.xy += 0.5;
344 344
                     tc.z = tc.z * @(divf 1 $numrh) + offset;
345
-                    vec4 shr = texture3D(tex6, tc), shg = texture3D(tex7, tc), shb = texture3D(tex8, tc), sha = texture3D(tex9, tc);
345
+                    vec4 shr = texture(tex6, tc), shg = texture(tex7, tc), shb = texture(tex8, tc), sha = texture(tex9, tc);
346 346
                     shr.rgb -= 0.5;
347 347
                     shg.rgb -= 0.5;
348 348
                     shb.rgb -= 0.5;
@@ -369,7 +369,7 @@ deferredlightvariantshader = [
369 369
                     #define accumalpha(alpha) resolved.a += alpha
370 370
 
371 371
                     @(if (&& [dlopt "a"] [! $avatar] [! $transparent]) [result [
372
-                        float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r;
372
+                        float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r;
373 373
                     ]])
374 374
 
375 375
                     for(int sampleidx = 0; sampleidx < @msaasamples; sampleidx++) 
@@ -383,7 +383,7 @@ deferredlightvariantshader = [
383 383
                     #define accumalpha(alpha) fragcolor.a = alpha
384 384
                 ]]
385 385
             ] [result [
386
-                #define gfetch(sampler, coords) texture2DRect(sampler, coords)
386
+                #define gfetch(sampler, coords) textureRect(sampler, coords)
387 387
 
388 388
                 #define accumlight(light) fragcolor.rgb = light
389 389
                 #define accumalpha(alpha) fragcolor.a = alpha
@@ -466,7 +466,7 @@ deferredlightvariantshader = [
466 466
 
467 467
                 @(if (&& (dlopt "a") [! $avatar] [! $transparent]) [result [
468 468
                     @(? (! (&& (dlopt "M") [dlopt "R"])) [
469
-                        float ao = texture2DRect(tex5, gl_FragCoord.xy*aoscale).r;
469
+                        float ao = textureRect(tex5, gl_FragCoord.xy*aoscale).r;
470 470
                     ])
471 471
                     @(if (dlopt "d") [result [
472 472
                         #define aomask ao

+ 1
- 1
config/glsl/edit.cfg View File

@@ -24,7 +24,7 @@ shader 0 "blendbrush" [
24 24
     layout(location = 0) out vec4 fragcolor;
25 25
     void main(void)
26 26
     {
27
-        fragcolor = texture2D(tex0, texcoord0).r * color;
27
+        fragcolor = texture(tex0, texcoord0).r * color;
28 28
     }
29 29
 ]
30 30
 

+ 14
- 14
config/glsl/fxaa.cfg View File

@@ -232,11 +232,11 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
232 232
     void main(void)
233 233
     {
234 234
         #define posM texcoord0
235
-        vec4 rgbyM = texture2DRect(tex0, posM);
236
-        float lumaS = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0,  1)));
237
-        float lumaE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1,  0)));
238
-        float lumaN = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 0, -1)));
239
-        float lumaW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1,  0)));
235
+        vec4 rgbyM = textureRect(tex0, posM);
236
+        float lumaS = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0,  1)));
237
+        float lumaE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1,  0)));
238
+        float lumaN = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 0, -1)));
239
+        float lumaW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1,  0)));
240 240
         #define lumaM FXAA_LUMA(rgbyM)
241 241
 
242 242
         float maxSM = max(lumaS, lumaM);
@@ -258,10 +258,10 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
258 258
             return;
259 259
         }
260 260
 
261
-        float lumaNW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1, -1)));
262
-        float lumaSE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1,  1)));
263
-        float lumaNE = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2( 1, -1))); 
264
-        float lumaSW = FXAA_LUMA(texture2DRectOffset(tex0, posM, ivec2(-1,  1)));
261
+        float lumaNW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1, -1)));
262
+        float lumaSE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1,  1)));
263
+        float lumaNE = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2( 1, -1))); 
264
+        float lumaSW = FXAA_LUMA(textureRectOffset(tex0, posM, ivec2(-1,  1)));
265 265
 
266 266
         float lumaNS = lumaN + lumaS;
267 267
         float lumaWE = lumaW + lumaE;
@@ -311,9 +311,9 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
311 311
         vec2 posN = posB - offNP * FXAA_QUALITY_P0;
312 312
         vec2 posP = posB + offNP * FXAA_QUALITY_P0;
313 313
         float subpixD = ((-2.0)*subpixC) + 3.0;
314
-        float lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN));
314
+        float lumaEndN = FXAA_LUMA(textureRect(tex0, posN));
315 315
         float subpixE = subpixC * subpixC;
316
-        float lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP));
316
+        float lumaEndP = FXAA_LUMA(textureRect(tex0, posP));
317 317
 
318 318
         if(!pairN) lumaNN = lumaSS;
319 319
         float gradientScaled = gradient * 1.0/4.0;
@@ -332,8 +332,8 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
332 332
             #if (FXAA_QUALITY_PS > @i)
333 333
             if(contN || contP) 
334 334
             {
335
-                if(contN) lumaEndN = FXAA_LUMA(texture2DRect(tex0, posN));
336
-                if(contP) lumaEndP = FXAA_LUMA(texture2DRect(tex0, posP));
335
+                if(contN) lumaEndN = FXAA_LUMA(textureRect(tex0, posN));
336
+                if(contP) lumaEndP = FXAA_LUMA(textureRect(tex0, posP));
337 337
                 if(contN) lumaEndN = lumaEndN - lumaNN * 0.5;
338 338
                 if(contP) lumaEndP = lumaEndP - lumaNN * 0.5;
339 339
                 contN = abs(lumaEndN) < gradientScaled;
@@ -369,7 +369,7 @@ shader 0 [fxaa@fxaapreset@fxaaopts] [
369 369
         if(!horzSpan) posS.x += pixelOffsetSubpix * lengthSign;
370 370
         if( horzSpan) posS.y += pixelOffsetSubpix * lengthSign;
371 371
 
372
-        fragcolor = texture2DRect(tex0, posS);
372
+        fragcolor = textureRect(tex0, posS);
373 373
     }
374 374
 ]
375 375
 

+ 11
- 11
config/glsl/gi.cfg View File

@@ -198,9 +198,9 @@ radiancehintsshader = [
198 198
     {
199 199
         vec3 rhpos = rhcenter + rhtap*rhspread;
200 200
         vec2 rsmtc = rsmcenter + rsmtap*rsmspread;
201
-        float rsmdepth = texture2DRect(tex0, rsmtc).x;
202
-        vec3 rsmcolor = texture2DRect(tex1, rsmtc).rgb;
203
-        vec3 rsmnormal = texture2DRect(tex2, rsmtc).xyz*2.0 - 1.0;
201
+        float rsmdepth = textureRect(tex0, rsmtc).x;
202
+        vec3 rsmcolor = textureRect(tex1, rsmtc).rgb;
203
+        vec3 rsmnormal = textureRect(tex2, rsmtc).xyz*2.0 - 1.0;
204 204
         vec3 rsmpos = (rsmworldmatrix * vec4(rsmtc, rsmdepth, 1.0)).xyz;
205 205
 
206 206
         vec3 dir = rhpos - rsmpos;
@@ -255,10 +255,10 @@ lazyshader 0 radiancehintsborder [
255 255
     {
256 256
         float outside = clamp(borderscale.z*(abs(texcoord0.z - bordercenter.z) - borderrange.z), 0.0, 1.0);
257 257
         vec3 tc = vec3(texcoord0.xy, clamp(texcoord0.z, bordercenter.z - borderrange.z, bordercenter.z + borderrange.z));
258
-        rhr = mix(texture3D(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
259
-        rhg = mix(texture3D(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
260
-        rhb = mix(texture3D(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
261
-        rha = mix(texture3D(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
258
+        rhr = mix(texture(tex3, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
259
+        rhg = mix(texture(tex4, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
260
+        rhb = mix(texture(tex5, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
261
+        rha = mix(texture(tex6, tc), vec4(0.5, 0.5, 0.5, 0.0), outside);
262 262
     }
263 263
 ]
264 264
 
@@ -281,10 +281,10 @@ lazyshader 0 radiancehintscached [
281 281
 
282 282
     void main(void)
283 283
     {
284
-        rhr = texture3D(tex7, texcoord0);
285
-        rhg = texture3D(tex8, texcoord0);
286
-        rhb = texture3D(tex9, texcoord0);
287
-        rha = texture3D(tex10, texcoord0);
284
+        rhr = texture(tex7, texcoord0);
285
+        rhg = texture(tex8, texcoord0);
286
+        rhb = texture(tex9, texcoord0);
287
+        rha = texture(tex10, texcoord0);
288 288
     }
289 289
 ]
290 290
 

+ 2
- 2
config/glsl/grass.cfg View File

@@ -39,9 +39,9 @@ grassvariantshader = [
39 39
         @(? (grassopt "b") [uniform sampler2D tex1; in vec2 texcoord1;])
40 40
         void main(void)
41 41
         {
42
-            vec4 color = texture2D(tex0, texcoord0) * colorscale;
42
+            vec4 color = texture(tex0, texcoord0) * colorscale;
43 43
             @(? (grassopt "b") [
44
-                color.a *= texture2D(tex1, texcoord1).r;
44
+                color.a *= texture(tex1, texcoord1).r;
45 45
             ])
46 46
             if(color.a <= grasstest)
47 47
                 discard;

+ 6
- 6
config/glsl/hud.cfg View File

@@ -23,7 +23,7 @@ shader 0 "hud" [
23 23
     layout(location = 0) out vec4 fragcolor;
24 24
     void main(void)
25 25
     {
26
-        vec4 color = texture2D(tex0, texcoord0);
26
+        vec4 color = texture(tex0, texcoord0);
27 27
         fragcolor = colorscale * color;
28 28
     }
29 29
 ]
@@ -48,7 +48,7 @@ shader 0 "hudtext" [
48 48
     layout(location = 0) out vec4 fragcolor;
49 49
     void main(void)
50 50
     {
51
-        float dist = texture2D(tex0, texcoord0).r;
51
+        float dist = texture(tex0, texcoord0).r;
52 52
         float border = smoothstep(textparams.x, textparams.y, dist);
53 53
         float outline = smoothstep(textparams.z, textparams.w, dist);
54 54
         fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border);
@@ -74,7 +74,7 @@ shader 0 "hudrgb" [
74 74
     layout(location = 0) out vec4 fragcolor;
75 75
     void main(void)
76 76
     {
77
-        vec4 color = texture2D(tex0, texcoord0);
77
+        vec4 color = texture(tex0, texcoord0);
78 78
         fragcolor.rgb = colorscale.rgb * color.rgb;
79 79
         fragcolor.a   = colorscale.a;
80 80
     }
@@ -117,7 +117,7 @@ shader 0 "hudrect" [
117 117
     layout(location = 0) out vec4 fragcolor;
118 118
     void main(void)
119 119
     {
120
-        fragcolor = colorscale * texture2DRect(tex0, texcoord0);
120
+        fragcolor = colorscale * textureRect(tex0, texcoord0);
121 121
     }
122 122
 ]
123 123
 
@@ -140,7 +140,7 @@ shader 0 "hud3d" [
140 140
     layout(location = 0) out vec4 fragcolor;
141 141
     void main(void)
142 142
     {
143
-        fragcolor = color * texture3D(tex0, texcoord0);
143
+        fragcolor = color * texture(tex0, texcoord0);
144 144
     }
145 145
 ]
146 146
 
@@ -163,7 +163,7 @@ shader 0 "hudcubemap" [
163 163
     layout(location = 0) out vec4 fragcolor;
164 164
     void main(void)
165 165
     {
166
-        fragcolor = colorscale * textureCube(tex0, texcoord0);
166
+        fragcolor = colorscale * texture(tex0, texcoord0);
167 167
     }
168 168
 ]
169 169
 

+ 17
- 17
config/glsl/material.cfg View File

@@ -102,10 +102,10 @@ watershader = [
102 102
     void main(void)
103 103
     {
104 104
         vec3 camdir = camera - surface, camvec = normalize(camdir);
105
-        vec3 bump  = texture2D(tex1, texcoord0 + millis*vec2( 0.25,  0.75)*0.1250).rgb;
106
-        vec3 bump2 = texture2D(tex1, texcoord0 + millis*vec2(-0.75, -0.25)*0.1450).rgb;
107
-        vec3 bump3 = texture2D(tex1, texcoord1 + millis*vec2(-0.50,  0.50)*0.0805).rgb;
108
-        vec3 bump4 = texture2D(tex1, texcoord1 + millis*vec2( 0.25, -0.75)*0.0825).rgb;
105
+        vec3 bump  = texture(tex1, texcoord0 + millis*vec2( 0.25,  0.75)*0.1250).rgb;
106
+        vec3 bump2 = texture(tex1, texcoord0 + millis*vec2(-0.75, -0.25)*0.1450).rgb;
107
+        vec3 bump3 = texture(tex1, texcoord1 + millis*vec2(-0.50,  0.50)*0.0805).rgb;
108
+        vec3 bump4 = texture(tex1, texcoord1 + millis*vec2( 0.25, -0.75)*0.0825).rgb;
109 109
         bump = normalize(bump + bump2 + bump3 + bump4 - 2.0);
110 110
         vec2 rtc = bump.xy * waterrefract.w;
111 111
 
@@ -126,7 +126,7 @@ watershader = [
126 126
 
127 127
             @(? (>= (strstr $arg1 "caustics") 0) [
128 128
                 vec2 ctc = vec2(dot(causticsS, rpos.xyz), dot(causticsT, rpos.xyz));
129
-                float caustics = causticsblend.x*texture2D(tex2, ctc).r + causticsblend.y*texture2D(tex3, ctc).r + causticsblend.z;
129
+                float caustics = causticsblend.x*texture(tex2, ctc).r + causticsblend.y*texture(tex3, ctc).r + causticsblend.z;
130 130
                 rcolor *= caustics;
131 131
             ])
132 132
 
@@ -157,7 +157,7 @@ watershader = [
157 157
             float fresnel = 0.25 + 0.75*pow(clamp(1.0 - dot(camvec, bump), 0.0, 1.0), 4.0);
158 158
             rcolor = mix(rcolor, reflect, fresnel*edgefade);
159 159
         ]] [if (>= (strstr $arg1 "env") 0) [result [
160
-            vec3 reflect = textureCube(tex4, reflectdir).rgb*0.5;
160
+            vec3 reflect = texture(tex4, reflectdir).rgb*0.5;
161 161
             float fresnel = 0.5*pow(clamp(1.0 - dot(camvec, bump), 0.0, 1.0), 4.0);
162 162
             rcolor = mix(rcolor, reflect, fresnel);
163 163
         ]]])
@@ -201,7 +201,7 @@ causticshader = [
201 201
                 vec4 ctc = causticsmatrix * vec4(gl_FragCoord.xy, depth, 1.0);
202 202
                 ctc.xyz /= ctc.w;
203 203
             ])
204
-            float caustics = causticsblend.x*texture2D(tex0, ctc.xy).r + causticsblend.y*texture2D(tex1, ctc.xy).r + causticsblend.z;
204
+            float caustics = causticsblend.x*texture(tex0, ctc.xy).r + causticsblend.y*texture(tex1, ctc.xy).r + causticsblend.z;
205 205
             caustics *= clamp(ctc.z, 0.0, 1.0) * clamp(exp2(ctc.z*waterdeepfade.w), 0.0, 1.0);
206 206
             fragcolor.rgb = vec3(0.5 + caustics);
207 207
         }
@@ -271,8 +271,8 @@ lazyshader 0 "lava" [
271 271
 
272 272
     void main(void)
273 273
     {
274
-        vec3 diffuse = texture2D(tex0, texcoord0).rgb;
275
-        vec3 bump = texture2D(tex1, texcoord0).rgb*2.0-1.0;
274
+        vec3 diffuse = texture(tex0, texcoord0).rgb;
275
+        vec3 bump = texture(tex1, texcoord0).rgb*2.0-1.0;
276 276
         vec3 bumpw = normalize(world * bump);
277 277
         gcolor.rgb = diffuse;
278 278
         @(gspecpack 0.0 lavaspec)
@@ -318,8 +318,8 @@ lazyshader 0 "waterfallenv" [
318 318
     void main(void)
319 319
     {
320 320
         vec3 camvec = normalize(camdir);
321
-        vec3 diffuse = texture2D(tex0, texcoord0).rgb;
322
-        vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0;
321
+        vec3 diffuse = texture(tex0, texcoord0).rgb;
322
+        vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0;
323 323
         vec3 bumpw = normalize(world * bump);
324 324
 
325 325
         vec2 rtc = bump.xy * waterfallrefract.w;
@@ -328,7 +328,7 @@ lazyshader 0 "waterfallenv" [
328 328
         vec3 rcolor = gfetch(tex8, rtc).rgb * waterfallrefract.xyz;
329 329
 
330 330
         float invfresnel = dot(camvec, bumpw);
331
-        vec3 env = textureCube(tex3, 2.0*bumpw*invfresnel - camvec).rgb;
331
+        vec3 env = texture(tex3, 2.0*bumpw*invfresnel - camvec).rgb;
332 332
         env *= 0.1 + 0.4*pow(clamp(1.0 - invfresnel, 0.0, 1.0), 2.0);
333 333
 
334 334
         gcolor.rgb = vec3(0.0);
@@ -369,8 +369,8 @@ lazyshader 0 "waterfall" [
369 369
 
370 370
     void main(void)
371 371
     {
372
-        vec3 diffuse = texture2D(tex0, texcoord0).rgb;
373
-        vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0;
372
+        vec3 diffuse = texture(tex0, texcoord0).rgb;
373
+        vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0;
374 374
         vec3 bumpw = normalize(world * bump);
375 375
 
376 376
         vec2 rtc = bump.xy * waterfallrefract.w;
@@ -421,7 +421,7 @@ lazyshader 0 "glassenv" [
421 421
     void main(void)
422 422
     {
423 423
         vec3 camvec = normalize(camdir);
424
-        vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0;
424
+        vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0;
425 425
         vec3 bumpw = normalize(world * bump);
426 426
 
427 427
         vec2 rtc = bump.xy * glassrefract.w;
@@ -431,7 +431,7 @@ lazyshader 0 "glassenv" [
431 431
         rcolor *= glassrefract.xyz;
432 432
 
433 433
         float invfresnel = dot(camvec, bumpw);
434
-        vec3 env = textureCube(tex0, 2.0*bumpw*invfresnel - camvec).rgb;
434
+        vec3 env = texture(tex0, 2.0*bumpw*invfresnel - camvec).rgb;
435 435
         env *= 0.1 + 0.4*pow(clamp(1.0 - invfresnel, 0.0, 1.0), 2.0);
436 436
 
437 437
         gcolor.rgb = vec3(0.0);
@@ -471,7 +471,7 @@ lazyshader 0 "glass" [
471 471
 
472 472
     void main(void)
473 473
     {
474
-        vec3 bump = texture2D(tex1, texcoord0).rgb*2.0 - 1.0;
474
+        vec3 bump = texture(tex1, texcoord0).rgb*2.0 - 1.0;
475 475
         vec3 bumpw = normalize(world * bump);
476 476
 
477 477
         vec2 rtc = bump.xy * glassrefract.w;

+ 2
- 2
config/glsl/misc.cfg View File

@@ -87,7 +87,7 @@ shader 0 "ldr" [
87 87
     layout(location = 0) out vec4 fragcolor;
88 88
     void main(void)
89 89
     {
90
-        vec4 color = texture2D(tex0, texcoord0);
90
+        vec4 color = texture(tex0, texcoord0);
91 91
         fragcolor = colorscale * color;
92 92
     }
93 93
 ]
@@ -137,7 +137,7 @@ shader 0 "fogged" [
137 137
     layout(location = 0) out vec4 fragcolor;
138 138
     void main(void)
139 139
     {
140
-        vec4 color = texture2D(tex0, texcoord0);
140
+        vec4 color = texture(tex0, texcoord0);
141 141
         fragcolor = colorscale * color;
142 142
     }
143 143
 ]

+ 7
- 7
config/glsl/model.cfg View File

@@ -109,7 +109,7 @@ shadowmodelfragmentshader = [
109 109
         void main(void)
110 110
         {
111 111
             @(? (mdlopt "a") [
112
-                vec4 color = texture2D(tex0, texcoord0);
112
+                vec4 color = texture(tex0, texcoord0);
113 113
                 if(color.a <= alphatest)    
114 114
                     discard;
115 115
             ])
@@ -224,7 +224,7 @@ modelfragmentshader = [
224 224
 
225 225
         void main(void)
226 226
         {
227
-            vec4 diffuse = texture2D(tex0, texcoord0);
227
+            vec4 diffuse = texture(tex0, texcoord0);
228 228
 
229 229
             @(? (mdlopt "a") [
230 230
                 if(diffuse.a <= alphatest)
@@ -234,7 +234,7 @@ modelfragmentshader = [
234 234
             gcolor.rgb = diffuse.rgb*colorscale.rgb;
235 235
 
236 236
             @(? (|| (mdlopt "d") [mdlopt "D"]) [
237
-                vec4 decal = texture2D(tex4, texcoord0);
237
+                vec4 decal = texture(tex4, texcoord0);
238 238
                 @(? (mdlopt "D") [
239 239
                     gcolor.rgb = mix(gcolor.rgb, decal.rgb, decal.a);
240 240
                 ] [
@@ -243,7 +243,7 @@ modelfragmentshader = [
243 243
             ])
244 244
 
245 245
             @(if (mdlopt "n") [result [
246
-                vec3 normal = texture2D(tex3, texcoord0).rgb - 0.5;
246
+                vec3 normal = texture(tex3, texcoord0).rgb - 0.5;
247 247
                 @(? (mdlopt "c") [
248 248
                     if(!gl_FrontFacing) normal.z = -normal.z;
249 249
                 ])
@@ -257,7 +257,7 @@ modelfragmentshader = [
257 257
 
258 258
             float spec = maskscale.x;
259 259
             @(if (mdlopt "m") [result [
260
-                vec3 masks = texture2D(tex1, texcoord0).rgb;
260
+                vec3 masks = texture(tex1, texcoord0).rgb;
261 261
                 spec *= masks.r; // specmap in red channel
262 262
 
263 263
                 @(? (mdlopt "e") [
@@ -265,7 +265,7 @@ modelfragmentshader = [
265 265
                     float invfresnel = dot(camn, normal);
266 266
                     vec3 rvec = 2.0*invfresnel*normal - camn;
267 267
                     float rmod = envmapscale.x*clamp(invfresnel, 0.0, 1.0) + envmapscale.y;
268
-                    vec3 reflect = textureCube(tex2, rvec).rgb;
268
+                    vec3 reflect = texture(tex2, rvec).rgb;
269 269
                     gcolor.rgb = mix(gcolor.rgb, reflect, rmod*masks.b); // envmap mask in blue channel
270 270
                 ])
271 271
 
@@ -349,7 +349,7 @@ rsmmodelfragmentshader = [
349 349
         layout(location = 1) out vec4 gnormal;
350 350
         void main(void)
351 351
         {
352
-            vec4 diffuse = texture2D(tex0, texcoord0);
352
+            vec4 diffuse = texture(tex0, texcoord0);
353 353
             @(? (mdlopt "a") [
354 354
                 if(diffuse.a <= alphatest)
355 355
                     discard;

+ 14
- 14
config/glsl/movie.cfg View File

@@ -19,7 +19,7 @@ lazyshader 0 "moviergb" [
19 19
     layout(location = 0) out vec4 fragcolor;
20 20
     void main(void)
21 21
     {
22
-        fragcolor = texture2DRect(tex0, texcoord0);
22
+        fragcolor = textureRect(tex0, texcoord0);
23 23
     }
24 24
 ]
25 25
 
@@ -38,7 +38,7 @@ lazyshader 0 "movieyuv" [
38 38
     layout(location = 0) out vec4 fragcolor;
39 39
     void main(void)
40 40
     {
41
-        vec3 color = texture2DRect(tex0, texcoord0).rgb;
41
+        vec3 color = textureRect(tex0, texcoord0).rgb;
42 42
         fragcolor = vec4(dot(color, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
43 43
                          dot(color, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961,
44 44
                          dot(color, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
@@ -61,10 +61,10 @@ lazyshader 0 "moviey" [
61 61
     layout(location = 0) out vec4 fragcolor;
62 62
     void main(void)
63 63
     {
64
-        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb;
65
-        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2( -1, 0)).rgb;
66
-        vec3 color3 = texture2DRect(tex0, texcoord0).rgb;
67
-        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
64
+        vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2( -2, 0)).rgb;
65
+        vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2( -1, 0)).rgb;
66
+        vec3 color3 = textureRect(tex0, texcoord0).rgb;
67
+        vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
68 68
         fragcolor = vec4(dot(color3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
69 69
                          dot(color2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
70 70
                          dot(color1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
@@ -87,10 +87,10 @@ lazyshader 0 "movieu" [
87 87
     layout(location = 0) out vec4 fragcolor;
88 88
     void main(void)
89 89
     {
90
-        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
91
-        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
92
-        vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
93
-        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
90
+        vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
91
+        vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
92
+        vec3 color3 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
93
+        vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
94 94
         fragcolor = vec4(dot(color3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
95 95
                          dot(color2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
96 96
                          dot(color1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
@@ -113,10 +113,10 @@ lazyshader 0 "moviev" [
113 113
     layout(location = 0) out vec4 fragcolor;
114 114
     void main(void)
115 115
     {
116
-        vec3 color1 = texture2DRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
117
-        vec3 color2 = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
118
-        vec3 color3 = texture2DRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
119
-        vec3 color4 = texture2DRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
116
+        vec3 color1 = textureRectOffset(tex0, texcoord0, ivec2(-3, 0)).rgb;
117
+        vec3 color2 = textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb;
118
+        vec3 color3 = textureRectOffset(tex0, texcoord0, ivec2( 1, 0)).rgb;
119
+        vec3 color4 = textureRectOffset(tex0, texcoord0, ivec2( 3, 0)).rgb;
120 120
         fragcolor = vec4(dot(color3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
121 121
                          dot(color2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
122 122
                          dot(color1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,

+ 4
- 4
config/glsl/particle.cfg View File

@@ -51,8 +51,8 @@ explosionshader = [
51 51
         layout(location = 0) out vec4 fragcolor;
52 52
         void main(void)
53 53
         {
54
-            vec2 dtc = texcoord0 + texture2D(tex0, texcoord2).xy*0.1; // use color texture as noise to distort texcoords
55
-            vec4 diffuse = texture2D(tex0, dtc);
54
+            vec2 dtc = texcoord0 + texture(tex0, texcoord2).xy*0.1; // use color texture as noise to distort texcoords
55
+            vec4 diffuse = texture(tex0, dtc);
56 56
             float blend = max(pow(clamp(1.0 - dot(texcoord1, texcoord1), 0.0, 1.0), blendparams.x), blendparams.y);
57 57
             diffuse *= blend*4.0; // dup alpha into RGB channels + intensify and over saturate
58 58
             diffuse.b += 0.5 - blend*0.5; // blue tint 
@@ -114,7 +114,7 @@ shader 0 "particletext" [
114 114
     layout(location = 0) out vec4 fragcolor;
115 115
     void main(void)
116 116
     {
117
-        float dist = texture2D(tex0, texcoord0).r;
117
+        float dist = texture(tex0, texcoord0).r;
118 118
         float border = smoothstep(textparams.x, textparams.y, dist);
119 119
         float outline = smoothstep(textparams.z, textparams.w, dist);
120 120
         fragcolor = vec4(color.rgb * outline, color.a * border);
@@ -159,7 +159,7 @@ particleshader = [
159 159
         layout(location = 0) out vec4 fragcolor;
160 160
         void main(void)
161 161
         {
162
-            vec4 diffuse = texture2D(tex0, texcoord0);
162
+            vec4 diffuse = texture(tex0, texcoord0);
163 163
 
164 164
             @(if (>= (strstr $arg1 "soft") 0) [result [
165 165
                 @(gdepthunpack depth [gfetch(tex2, gl_FragCoord.xy)])

+ 16
- 16
config/glsl/postfx.cfg View File

@@ -24,7 +24,7 @@ fsps = [result [
24 24
     @arg2
25 25
     void main(void)
26 26
     {
27
-        vec4 color = texture2DRect(tex0, texcoord0);
27
+        vec4 color = textureRect(tex0, texcoord0);
28 28
         @arg1
29 29
     }
30 30
 ]]
@@ -43,10 +43,10 @@ fsvs4 = [
43 43
 
44 44
 fsps4 = [
45 45
     fsps [
46
-        vec4 s00 = texture2DRect(tex0, texcoord1);
47
-        vec4 s02 = texture2DRect(tex0, texcoord2);
48
-        vec4 s20 = texture2DRect(tex0, texcoord3);
49
-        vec4 s22 = texture2DRect(tex0, texcoord4);
46
+        vec4 s00 = textureRect(tex0, texcoord1);
47
+        vec4 s02 = textureRect(tex0, texcoord2);
48
+        vec4 s20 = textureRect(tex0, texcoord3);
49
+        vec4 s22 = textureRect(tex0, texcoord4);
50 50
         @arg1
51 51
     ] [
52 52
         in vec2 texcoord1, texcoord2, texcoord3, texcoord4;
@@ -93,15 +93,15 @@ lazyshader 0 "rotoscope" [
93 93
     layout(location = 0) out vec4 fragcolor;
94 94
     void main(void)
95 95
     {
96
-        vec4 c00 = texture2DRect(tex0, t00);
97
-        vec4 c01 = texture2DRect(tex0, t01);
98
-        vec4 c02 = texture2DRect(tex0, t02);
99
-        vec4 c10 = texture2DRect(tex0, t10);
100
-        vec4 c11 = texture2DRect(tex0, t11);
101
-        vec4 c12 = texture2DRect(tex0, t12);
102
-        vec4 c20 = texture2DRect(tex0, t20);
103
-        vec4 c21 = texture2DRect(tex0, t21);
104
-        vec4 c22 = texture2DRect(tex0, t22);
96
+        vec4 c00 = textureRect(tex0, t00);
97
+        vec4 c01 = textureRect(tex0, t01);
98
+        vec4 c02 = textureRect(tex0, t02);
99
+        vec4 c10 = textureRect(tex0, t10);
100
+        vec4 c11 = textureRect(tex0, t11);
101
+        vec4 c12 = textureRect(tex0, t12);
102
+        vec4 c20 = textureRect(tex0, t20);
103
+        vec4 c21 = textureRect(tex0, t21);
104
+        vec4 c22 = textureRect(tex0, t22);
105 105
 
106 106
         vec4 diag1 = c00 - c22;
107 107
         vec4 diag2 = c02 - c20;
@@ -140,7 +140,7 @@ blur3shader = [
140 140
         layout(location = 0) out vec4 fragcolor;
141 141
         void main(void)
142 142
         {
143
-            fragcolor = 0.5*(texture2DRect(tex0, texcoord0) + texture2DRect(tex0, texcoord1));
143
+            fragcolor = 0.5*(textureRect(tex0, texcoord0) + textureRect(tex0, texcoord1));
144 144
         }
145 145
     ]
146 146
 ]
@@ -165,7 +165,7 @@ blur5shader = [
165 165
         layout(location = 0) out vec4 fragcolor;
166 166
         void main(void)
167 167
         {
168
-            fragcolor = 0.4*texture2DRect(tex0, texcoord0) + 0.3*(texture2DRect(tex0, texcoord1) + texture2DRect(tex0, texcoord2));
168
+            fragcolor = 0.4*textureRect(tex0, texcoord0) + 0.3*(textureRect(tex0, texcoord1) + textureRect(tex0, texcoord2));
169 169
         }
170 170
     ]
171 171
 ]

+ 6
- 6
config/glsl/scale.cfg View File

@@ -21,7 +21,7 @@ shader 0 "scalelinear" [
21 21
 
22 22
     void main(void)
23 23
     {
24
-        fragcolor = texture2DRect(tex0, texcoord0);
24
+        fragcolor = textureRect(tex0, texcoord0);
25 25
     }
26 26
 ]
27 27
 
@@ -57,13 +57,13 @@ loop i 2 [
57 57
         @(if $i [result [
58 58
             float offset = fract(texcoord0.y-0.5);
59 59
             center.y -= offset;
60
-            #define texval(tap) texture2DRect(tex0, center + vec2(0.0, tap))
61
-            #define texvaloffset(tap) texture2DRectOffset(tex0, center, ivec2(0, tap))
60
+            #define texval(tap) textureRect(tex0, center + vec2(0.0, tap))
61
+            #define texvaloffset(tap) textureRectOffset(tex0, center, ivec2(0, tap))
62 62
         ]] [result [
63 63
             float offset = fract(texcoord0.x-0.5);
64 64
             center.x -= offset;
65
-            #define texval(tap) texture2DRect(tex0, center + vec2(tap, 0.0))
66
-            #define texvaloffset(tap) texture2DRectOffset(tex0, center, ivec2(tap, 0))
65
+            #define texval(tap) textureRect(tex0, center + vec2(tap, 0.0))
66
+            #define texvaloffset(tap) textureRectOffset(tex0, center, ivec2(tap, 0))
67 67
         ]])
68 68
         vec4 weight = cubic(offset);
69 69
         weight.y += weight.z;
@@ -91,7 +91,7 @@ shader 0 "reorient" [
91 91
 
92 92
     void main(void)
93 93
     {
94
-        fragcolor = texture2DRect(tex0, texcoord0);
94
+        fragcolor = textureRect(tex0, texcoord0);
95 95
     }
96 96
 ]
97 97
 

+ 3
- 3
config/glsl/shared.cfg View File

@@ -161,9 +161,9 @@ gfetchdefs = [
161 161
         @(if (! $arg3) [gdepthunpackparams])
162 162
     ]] [result [
163 163
         uniform sampler2DRect @(prettylist $arg1);
164
-        #define @[gfetchprefix](sampler, coords) texture2DRect(sampler, coords)
165
-        #define @[gfetchprefix]offset(sampler, coords, offset) texture2DRectOffset(sampler, coords, offset)
166
-        #define @[gfetchprefix]proj(sampler, coords) texture2DRectProj(sampler, coords)
164
+        #define @[gfetchprefix](sampler, coords) textureRect(sampler, coords)
165
+        #define @[gfetchprefix]offset(sampler, coords, offset) textureRectOffset(sampler, coords, offset)
166
+        #define @[gfetchprefix]proj(sampler, coords) textureRectProj(sampler, coords)
167 167
         @(if (! $arg3) [gdepthunpackparams])
168 168
     ]]
169 169
 ]

+ 2
- 2
config/glsl/sky.cfg View File

@@ -24,7 +24,7 @@ shader 0 "skybox" [
24 24
     layout(location = 0) out vec4 fragcolor;
25 25
     void main(void)
26 26
     {
27
-        vec4 color = texture2D(tex0, texcoord0);
27
+        vec4 color = texture(tex0, texcoord0);
28 28
         fragcolor = colorscale * color;
29 29
     }
30 30
 ]
@@ -51,7 +51,7 @@ shader 0 "skyboxoverbright" [
51 51
     layout(location = 0) out vec4 fragcolor;
52 52
     void main(void)
53 53
     {
54
-        vec4 color = texture2D(tex0, texcoord0);
54
+        vec4 color = texture(tex0, texcoord0);
55 55
         float lum = dot(vec3(@lumweights), color.rgb);
56 56
         float overbright = mix(overbrightparams.x, overbrightparams.y, clamp(lum - overbrightparams.z, 0.0, 1.0));
57 57
         color.rgb *= overbright;

+ 55
- 55
config/glsl/smaa.cfg View File

@@ -111,9 +111,9 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [
111 111
     void main(void)
112 112
     {
113 113
         // Calculate lumas:
114
-        float L = SMAA_LUMA(texture2DRect(tex0, texcoord0));
115
-        float Lleft = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)));
116
-        float Ltop  = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, -1)));
114
+        float L = SMAA_LUMA(textureRect(tex0, texcoord0));
115
+        float Lleft = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(-1, 0)));
116
+        float Ltop  = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, -1)));
117 117
 
118 118
         // We do the usual threshold:
119 119
         vec2 delta = abs(L - vec2(Lleft, Ltop));
@@ -128,14 +128,14 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [
128 128
         ])
129 129
         {
130 130
             // Calculate right and bottom deltas:
131
-            float Lright = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)));
132
-            float Lbottom  = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, 1)));
131
+            float Lright = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(1, 0)));
132
+            float Lbottom  = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, 1)));
133 133
             // Calculate the maximum delta in the direct neighborhood:
134 134
             vec2 maxDelta = max(delta, abs(L - vec2(Lright, Lbottom)));
135 135
 
136 136
             // Calculate left-left and top-top deltas:
137
-            float Lleftleft = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(-2, 0)));
138
-            float Ltoptop = SMAA_LUMA(texture2DRectOffset(tex0, texcoord0, ivec2(0, -2)));
137
+            float Lleftleft = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(-2, 0)));
138
+            float Ltoptop = SMAA_LUMA(textureRectOffset(tex0, texcoord0, ivec2(0, -2)));
139 139
             // Calculate the final maximum delta:
140 140
             maxDelta = max(maxDelta, abs(vec2(Lleft, Ltop) - vec2(Lleftleft, Ltoptop)));
141 141
 
@@ -175,9 +175,9 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [
175 175
     void main(void)
176 176
     {
177 177
         // Calculate color deltas:
178
-        vec3 C = texture2DRect(tex0, texcoord0).rgb;
179
-        vec3 Cleft = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb);
180
-        vec3 Ctop = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, -1)).rgb);
178
+        vec3 C = textureRect(tex0, texcoord0).rgb;
179
+        vec3 Cleft = abs(C - textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb);
180
+        vec3 Ctop = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, -1)).rgb);
181 181
         vec2 delta;
182 182
         delta.x = max(max(Cleft.r, Cleft.g), Cleft.b);
183 183
         delta.y = max(max(Ctop.r, Ctop.g), Ctop.b);
@@ -194,11 +194,11 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [
194 194
         ])
195 195
         {
196 196
             // Calculate right and bottom deltas:
197
-            vec3 Cright = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb);
198
-            vec3 Cbottom = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, 1)).rgb);
197
+            vec3 Cright = abs(C - textureRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb);
198
+            vec3 Cbottom = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, 1)).rgb);
199 199
             // Calculate left-left and top-top deltas:
200
-            vec3 Cleftleft = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(-2, 0)).rgb);
201
-            vec3 Ctoptop = abs(C - texture2DRectOffset(tex0, texcoord0, ivec2(0, -2)).rgb);
200
+            vec3 Cleftleft = abs(C - textureRectOffset(tex0, texcoord0, ivec2(-2, 0)).rgb);
201
+            vec3 Ctoptop = abs(C - textureRectOffset(tex0, texcoord0, ivec2(0, -2)).rgb);
202 202
             // Calculate the maximum delta in the direct neighborhood:
203 203
             vec3 t = max(max(Cright, Cbottom), max(Cleftleft, Ctoptop));
204 204
             // Calculate the final maximum delta:
@@ -257,45 +257,45 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
257 257
      * These functions allows to perform diagonal pattern searches.
258 258
      */
259 259
     float SMAASearchDiagRightUp(void) {
260
-        vec2 e = texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rg;
260
+        vec2 e = textureRectOffset(tex0, texcoord0, ivec2(1, -1)).rg;
261 261
         vec2 texcoord = texcoord0 + vec2(1.0, -1.0);
262 262
         for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) {
263 263
             if (e.x + e.y < 1.5) break;
264 264
             texcoord += vec2(1.0, -1.0);
265
-            e = texture2DRect(tex0, texcoord).rg;
265
+            e = textureRect(tex0, texcoord).rg;
266 266
         }
267 267
         return (texcoord.x - texcoord0.x) - 1.0;
268 268
     }
269 269
 
270 270
     float SMAASearchDiagLeftDown(void) {
271
-        vec2 e = texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rg;
271
+        vec2 e = textureRectOffset(tex0, texcoord0, ivec2(-1, 1)).rg;
272 272
         vec2 texcoord = texcoord0 + vec2(-1.0, 1.0);
273 273
         for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) {
274 274
             if (e.x + e.y < 1.5) break;
275 275
             texcoord += vec2(-1.0, 1.0);
276
-            e = texture2DRect(tex0, texcoord).rg;
276
+            e = textureRect(tex0, texcoord).rg;
277 277
         }
278 278
         return (texcoord0.x - texcoord.x) - 1.0 + SMAARound(e.y);
279 279
     }
280 280
 
281 281
     float SMAASearchDiagLeftUp(void) {
282
-        vec2 e = texture2DRectOffset(tex0, texcoord5, ivec2(-1, -1)).rg;
282
+        vec2 e = textureRectOffset(tex0, texcoord5, ivec2(-1, -1)).rg;
283 283
         vec2 texcoord = texcoord5 + vec2(-1.0, -1.0);
284 284
         for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) {
285 285
             if (SMAADecodeDiagBilinearAccess(e.x) + e.y < 1.5) break;
286 286
             texcoord += vec2(-1.0, -1.0);
287
-            e = texture2DRect(tex0, texcoord).rg;
287
+            e = textureRect(tex0, texcoord).rg;
288 288
         }
289 289
         return (texcoord5.x - texcoord.x) - 1.0;
290 290
     }
291 291
 
292 292
     float SMAASearchDiagRightDown(void) {
293
-        vec2 e = texture2DRectOffset(tex0, texcoord5, ivec2(1, 1)).rg;
293
+        vec2 e = textureRectOffset(tex0, texcoord5, ivec2(1, 1)).rg;
294 294
         vec2 texcoord = texcoord5 + vec2(1.0, 1.0);
295 295
         for (int i = 1; i < SMAA_MAX_SEARCH_STEPS_DIAG; i++) {
296 296
             if (SMAADecodeDiagBilinearAccess(e.x) + e.y < 1.5) break;
297 297
             texcoord += vec2(1.0, 1.0);
298
-            e = texture2DRect(tex0, texcoord).rg;
298
+            e = textureRect(tex0, texcoord).rg;
299 299
         }
300 300
         return (texcoord.x - texcoord5.x) - 1.0 + SMAARound(e.y);
301 301
     }
@@ -316,7 +316,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
316 316
         // Move to proper place, according to the subpixel offset:
317 317
         SMAA_AREA_OFFSET(texcoord, offset);
318 318
         
319
-        return SMAA_AREA(texture2DRect(tex1, texcoord));
319
+        return SMAA_AREA(textureRect(tex1, texcoord));
320 320
     }
321 321
 
322 322
     /**
@@ -332,8 +332,8 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
332 332
         if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3
333 333
             vec4 coords = vec4(0.25 - d.x, d.x, d.y, -0.25 - d.y) + texcoord0.xyxy;
334 334
             vec4 c;
335
-            c.xy = texture2DRectOffset(tex0, coords.xy, ivec2(-1, 0)).rg;
336
-            c.zw = texture2DRectOffset(tex0, coords.zw, ivec2( 1, 0)).rg;
335
+            c.xy = textureRectOffset(tex0, coords.xy, ivec2(-1, 0)).rg;
336
+            c.zw = textureRectOffset(tex0, coords.zw, ivec2( 1, 0)).rg;
337 337
             c.xz = SMAADecodeDiagBilinearAccess(c.xz);
338 338
             c = SMAARound(c);
339 339
 
@@ -349,9 +349,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
349 349
         if (d.x + d.y > 2.0) { // d.x + d.y + 1 > 3
350 350
             vec4 coords = vec4(-d.xx, d.yy) + texcoord0.xyxy;
351 351
             vec4 c;
352
-            c.x  = texture2DRectOffset(tex0, coords.xy, ivec2(-1,  0)).g;
353
-            c.y  = texture2DRectOffset(tex0, coords.xy, ivec2( 0, -1)).r;
354
-            c.zw = texture2DRectOffset(tex0, coords.zw, ivec2( 1,  0)).gr;
352
+            c.x  = textureRectOffset(tex0, coords.xy, ivec2(-1,  0)).g;
353
+            c.y  = textureRectOffset(tex0, coords.xy, ivec2( 0, -1)).r;
354
+            c.zw = textureRectOffset(tex0, coords.zw, ivec2( 1,  0)).gr;
355 355
 
356 356
             vec2 e = 2.0 * c.xz + c.yw;
357 357
             e *= step(d, vec2(float(SMAA_MAX_SEARCH_STEPS_DIAG) - 0.5));
@@ -374,7 +374,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
374 374
      */
375 375
     float SMAASearchLength(vec2 e, float bias, float scale) {
376 376
         e.r = bias + e.r * scale;
377
-        return 255.0 * texture2DRect(tex2, e*vec2(float(SMAA_SEARCHTEX_WIDTH), float(SMAA_SEARCHTEX_HEIGHT))).r;
377
+        return 255.0 * textureRect(tex2, e*vec2(float(SMAA_SEARCHTEX_WIDTH), float(SMAA_SEARCHTEX_HEIGHT))).r;
378 378
     }
379 379
 
380 380
     /**
@@ -388,12 +388,12 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
388 388
          * Sampling with different offsets in each direction allows to disambiguate
389 389
          * which edges are active from the four fetched ones.
390 390
          */
391
-        vec2 e = texture2DRect(tex0, texcoord1).rg;
391
+        vec2 e = textureRect(tex0, texcoord1).rg;
392 392
         vec2 texcoord = texcoord1;
393 393
         for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) {
394 394
             if(e.g <= 0.8281 || e.r > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line?
395 395
             texcoord.x -= 2.0;
396
-            e = texture2DRect(tex0, texcoord).rg;
396
+            e = textureRect(tex0, texcoord).rg;
397 397
         }
398 398
         // We correct the previous (-0.25, -0.125) offset we applied:
399 399
         // The searches are bias by 1, so adjust the coords accordingly:
@@ -402,34 +402,34 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
402 402
     }
403 403
 
404 404
     float SMAASearchXRight(void) {
405
-        vec2 e = texture2DRect(tex0, texcoord2).rg;
405
+        vec2 e = textureRect(tex0, texcoord2).rg;
406 406
         vec2 texcoord = texcoord2;
407 407
         for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) {
408 408
             if(e.g <= 0.8281 || e.r > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line?
409 409
             texcoord.x += 2.0;
410
-            e = texture2DRect(tex0, texcoord).rg;
410
+            e = textureRect(tex0, texcoord).rg;
411 411
         }
412 412
         return texcoord.x - (0.25 + 1.0) + SMAASearchLength(e, 0.5, 0.5);
413 413
     }
414 414
 
415 415
     float SMAASearchYUp(void) {
416
-        vec2 e = texture2DRect(tex0, texcoord3).rg;
416
+        vec2 e = textureRect(tex0, texcoord3).rg;
417 417
         vec2 texcoord = texcoord3;
418 418
         for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) {
419 419
             if(e.r <= 0.8281 || e.g > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line?
420 420
             texcoord.y -= 2.0;
421
-            e = texture2DRect(tex0, texcoord).rg;
421
+            e = textureRect(tex0, texcoord).rg;
422 422
         }
423 423
         return texcoord.y + (0.25 + 1.0) - SMAASearchLength(e.gr, 0.0, 0.5);
424 424
     }
425 425
 
426 426
     float SMAASearchYDown(void) {
427
-        vec2 e = texture2DRect(tex0, texcoord4).rg;
427
+        vec2 e = textureRect(tex0, texcoord4).rg;
428 428
         vec2 texcoord = texcoord4;
429 429
         for(int i = 1; i < SMAA_MAX_SEARCH_STEPS; i++) {
430 430
             if(e.r <= 0.8281 || e.g > 0.0) break; // Is there some edge not activated or a crossing edge that breaks the line?
431 431
             texcoord.y += 2.0;
432
-            e = texture2DRect(tex0, texcoord).rg;
432
+            e = textureRect(tex0, texcoord).rg;
433 433
         }
434 434
         return texcoord.y - (0.25 + 1.0) + SMAASearchLength(e.gr, 0.5, 0.5);
435 435
     }
@@ -450,7 +450,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
450 450
         // Move to proper place, according to the subpixel offset:
451 451
         SMAA_AREA_OFFSET(texcoord, offset);
452 452
 
453
-        return SMAA_AREA(texture2DRect(tex1, texcoord));
453
+        return SMAA_AREA(textureRect(tex1, texcoord));
454 454
     }
455 455
    
456 456
     //-----------------------------------------------------------------------------
@@ -461,16 +461,16 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
461 461
     vec2 SMAADetectHorizontalCornerPattern(vec3 coords, vec2 d) {
462 462
         vec2 e;
463 463
         if(d.x >= d.y) coords.x = coords.z + 1.0 - 0.5*step(d.x, d.y);
464
-        e.r = texture2DRectOffset(tex0, coords.xy, ivec2(0,  1)).r;
465
-        e.g = texture2DRectOffset(tex0, coords.xy, ivec2(0, -2)).r;
464
+        e.r = textureRectOffset(tex0, coords.xy, ivec2(0,  1)).r;
465
+        e.g = textureRectOffset(tex0, coords.xy, ivec2(0, -2)).r;
466 466
         return clamp(1.0 - (1.0 - SMAA_CORNER_ROUNDING_NORM) * e, 0.0, 1.0);
467 467
     }
468 468
 
469 469
     vec2 SMAADetectVerticalCornerPattern(vec3 coords, vec2 d) {
470 470
         vec2 e;
471 471
         if(d.x >= d.y) coords.y = coords.z + 1.0 - 0.5*step(d.x, d.y);
472
-        e.r = texture2DRectOffset(tex0, coords.xy, ivec2( 1, 0)).g;
473
-        e.g = texture2DRectOffset(tex0, coords.xy, ivec2(-2, 0)).g;
472
+        e.r = textureRectOffset(tex0, coords.xy, ivec2( 1, 0)).g;
473
+        e.g = textureRectOffset(tex0, coords.xy, ivec2(-2, 0)).g;
474 474
         return clamp(1.0 - (1.0 - SMAA_CORNER_ROUNDING_NORM) * e, 0.0, 1.0);
475 475
     }
476 476
 
@@ -483,7 +483,7 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
483 483
     {
484 484
         vec4 weights = vec4(0.0);
485 485
 
486
-        vec2 e = texture2DRect(tex0, texcoord5).rg;
486
+        vec2 e = textureRect(tex0, texcoord5).rg;
487 487
 
488 488
         if (e.g > 0.5) { // Edge at north
489 489
             #if SMAA_MAX_SEARCH_STEPS_DIAG > 0
@@ -511,9 +511,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
511 511
             // filtering. Sampling at -0.25 (see CROSSING_OFFSET) enables to
512 512
             // discern what value each edge has:
513 513
             vec2 e;
514
-            e.x = texture2DRect(tex0, coords.xy).r;
514
+            e.x = textureRect(tex0, coords.xy).r;
515 515
             // Fetch the right crossing edges:
516
-            e.y = texture2DRectOffset(tex0, coords.zy, ivec2(1, 0)).r;
516
+            e.y = textureRectOffset(tex0, coords.zy, ivec2(1, 0)).r;
517 517
 
518 518
             // Ok, we know how this pattern looks like, now it is time for getting
519 519
             // the actual area:
@@ -544,9 +544,9 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
544 544
 
545 545
             // Fetch the top crossing edges:
546 546
             vec2 e;
547
-            e.x = texture2DRect(tex0, coords.xy).g;
547
+            e.x = textureRect(tex0, coords.xy).g;
548 548
             // Fetch the bottom crossing edges:
549
-            e.y = texture2DRectOffset(tex0, coords.xz, ivec2(0, 1)).g;
549
+            e.y = textureRectOffset(tex0, coords.xz, ivec2(0, 1)).g;
550 550
 
551 551
             // Get the area for this direction:
552 552
             weights.ba = SMAAArea(d, e, subsamples.x);
@@ -585,9 +585,9 @@ shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [
585 585
     {
586 586
         // Fetch the blending weights for current pixel:
587 587
         vec4 a;
588
-        a.xz = texture2DRect(tex1, texcoord0).rb;
589
-        a.y = texture2DRectOffset(tex1, texcoord0, ivec2(0, 1)).g;
590
-        a.w = texture2DRectOffset(tex1, texcoord0, ivec2(1, 0)).a;
588
+        a.xz = textureRect(tex1, texcoord0).rb;
589
+        a.y = textureRectOffset(tex1, texcoord0, ivec2(0, 1)).g;
590
+        a.w = textureRectOffset(tex1, texcoord0, ivec2(1, 0)).a;
591 591
 
592 592
         // Up to 4 lines can be crossing a pixel (one through each edge). We
593 593
         // favor blending by choosing the line with the maximum weight for each
@@ -604,19 +604,19 @@ shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [
604 604
 
605 605
         // We exploit bilinear filtering to mix current pixel with the chosen
606 606
         // neighbor:
607
-        fragcolor = texture2DRect(tex0, texcoord0 + offset);
607
+        fragcolor = textureRect(tex0, texcoord0 + offset);
608 608
 
609 609
         @(? (smaaopt "s") [
610
-            a.xz = texture2DRect(tex3, texcoord0).rb;
611
-            a.y = texture2DRectOffset(tex3, texcoord0, ivec2(0, 1)).g;
612
-            a.w = texture2DRectOffset(tex3, texcoord0, ivec2(1, 0)).a;
610
+            a.xz = textureRect(tex3, texcoord0).rb;
611
+            a.y = textureRectOffset(tex3, texcoord0, ivec2(0, 1)).g;
612
+            a.w = textureRectOffset(tex3, texcoord0, ivec2(1, 0)).a;
613 613
             offset.x = a.w > a.z ? a.w : -a.z;
614 614
             offset.y = a.y > a.x ? a.y : -a.x;
615 615
             if (abs(offset.x) > abs(offset.y))
616 616
                 offset.y = 0.0;
617 617
             else
618 618
                 offset.x = 0.0;
619
-            fragcolor = 0.5*(fragcolor + texture2DRect(tex2, texcoord0 + offset));
619
+            fragcolor = 0.5*(fragcolor + textureRect(tex2, texcoord0 + offset));
620 620
         ])
621 621
     }
622 622
 ]

+ 1
- 1
config/glsl/stain.cfg View File

@@ -40,7 +40,7 @@ stainvariantshader = [
40 40
     ])
41 41
     void main(void)
42 42
     {
43
-        vec4 diffuse = texture2D(tex0, texcoord0);
43
+        vec4 diffuse = texture(tex0, texcoord0);
44 44
         @(if (stainopt "o") [result [
45 45
             diffuse.rgb = mix(vec3(0.5), diffuse.rgb, color.rgb);
46 46
             fragcolor.rgb = diffuse.rgb;

+ 17
- 17
config/glsl/tonemap.cfg View File

@@ -19,7 +19,7 @@ shader 0 "hdrreduce" [
19 19
     layout(location = 0) out vec4 fragcolor;
20 20
     void main(void)
21 21
     {
22
-        fragcolor.rgb = texture2DRect(tex0, texcoord0).rgb;
22
+        fragcolor.rgb = textureRect(tex0, texcoord0).rgb;
23 23
     }
24 24
 ]
25 25
 
@@ -38,7 +38,7 @@ shader 0 "hdrreduce2w" [
38 38
     layout(location = 0) out vec4 fragcolor;
39 39
     void main(void)
40 40
     {
41
-        fragcolor.rgb = 0.5*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb);
41
+        fragcolor.rgb = 0.5*(textureRectOffset(tex0, texcoord0, ivec2(-1, 0)).rgb + textureRectOffset(tex0, texcoord0, ivec2(1, 0)).rgb);
42 42
     }
43 43
 ]
44 44
 
@@ -57,8 +57,8 @@ shader 0 "hdrreduce2" [
57 57
     layout(location = 0) out vec4 fragcolor;
58 58
     void main(void)
59 59
     {
60
-        fragcolor.rgb = 0.25*(texture2DRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb +
61
-                              texture2DRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb + texture2DRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb);
60
+        fragcolor.rgb = 0.25*(textureRectOffset(tex0, texcoord0, ivec2(-1, -1)).rgb + textureRectOffset(tex0, texcoord0, ivec2(1, -1)).rgb +
61
+                              textureRectOffset(tex0, texcoord0, ivec2(1, 1)).rgb + textureRectOffset(tex0, texcoord0, ivec2(-1, 1)).rgb);
62 62
     }
63 63
 ]
64 64
 
@@ -181,7 +181,7 @@ shader 0 "hdrluminance" [
181 181
     layout(location = 0) out vec4 fragcolor;
182 182
     void main(void)
183 183
     {
184
-        vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0;
184
+        vec3 color = textureRect(tex0, texcoord0).rgb*2.0;
185 185
         @(hdrgammadecode color)
186 186
         float lum = dot(color, vec3(@lumweights));
187 187
         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" [
206 206
     void main(void)
207 207
     {
208 208
         @(loopconcat i 2 [result [
209
-            vec3 color@[i] = texture2DRectOffset(tex0, texcoord0, ivec2(@(at ["-1, 0" "1, 0"] $i))).rgb*2.0;
209
+            vec3 color@[i] = textureRectOffset(tex0, texcoord0, ivec2(@(at ["-1, 0" "1, 0"] $i))).rgb*2.0;
210 210
             @(hdrgammadecode [color@[i]])
211 211
             float lum@[i] = dot(color@[i], vec3(@lumweights));
212 212
             float loglum@[i] = sqrt(clamp(lum@[i], 0.015625, 4.0)) * (1.0/2.0);
@@ -232,7 +232,7 @@ shader 0 "hdrluminance2" [
232 232
     void main(void)
233 233
     {
234 234
         @(loopconcat i 4 [result [
235
-            vec3 color@[i] = texture2DRectOffset(tex0, texcoord0, ivec2(@(at ["-1, -1" "1, -1" "1, 1" "-1, 1"] $i))).rgb*2.0;
235
+            vec3 color@[i] = textureRectOffset(tex0, texcoord0, ivec2(@(at ["-1, -1" "1, -1" "1, 1" "-1, 1"] $i))).rgb*2.0;
236 236
             @(hdrgammadecode [color@[i]])
237 237
             float lum@[i] = dot(color@[i], vec3(@lumweights));
238 238
             float loglum@[i] = sqrt(clamp(lum@[i], 0.015625, 4.0)) * (1.0/2.0);
@@ -253,7 +253,7 @@ shader 0 "hdraccum" [
253 253
     layout(location = 0) out vec4 fragcolor;
254 254
     void main(void)
255 255
     {
256
-        float lum = texture2DRect(tex0, vec2(0.5, 0.5)).r * 2.0;
256
+        float lum = textureRect(tex0, vec2(0.5, 0.5)).r * 2.0;
257 257
         lum *= lum;
258 258
         fragcolor = vec4(vec3(lum*0.25), accumscale);
259 259
     }
@@ -274,7 +274,7 @@ shader 0 "hdrbloom" [
274 274
     {
275 275
         gl_Position = vvertex;
276 276
         texcoord0 = vtexcoord0; 
277
-        float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture2D(tex2, vec2(0.5, 0.5)).r] [vcolor]);
277
+        float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture(tex2, vec2(0.5, 0.5)).r] [vcolor]);
278 278
         lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4);
279 279
         lumthreshold = -log2(1.0 - hdrparams.z);
280 280
     }
@@ -286,7 +286,7 @@ shader 0 "hdrbloom" [
286 286
     layout(location = 0) out vec4 fragcolor;
287 287
     void main(void)
288 288
     {
289
-        vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0;
289
+        vec3 color = textureRect(tex0, texcoord0).rgb*2.0;
290 290
         @(hdrgammadecode color)
291 291
         float lum = dot(color, vec3(@lumweights));
292 292
         color *= max(lum*lumscale - lumthreshold, 0.0) / (lum + 1e-4);
@@ -313,7 +313,7 @@ hdrtonemapvertexshader = [
313 313
         gl_Position = vvertex;
314 314
         texcoord0 = vtexcoord0; 
315 315
         texcoord1 = vtexcoord1;
316
-        float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture2D(tex2, vec2(0.5, 0.5)).r] [vcolor]);
316
+        float avglum = 4.0 * @(? (>= $hwvtexunits 4) [texture(tex2, vec2(0.5, 0.5)).r] [vcolor]);
317 317
         lumscale = hdrparams.x * -log2(1.0 - clamp(avglum, 0.03, 0.3))/(avglum + 1e-4);
318 318
         lumsaturate = -log2(1.0 - hdrparams.y) / lumscale;
319 319
     }
@@ -355,7 +355,7 @@ hdrtonemapshaders = [
355 355
     layout(location = 0) out vec4 fragcolor;
356 356
     void main(void)
357 357
     {
358
-        vec3 color = texture2DRect(tex0, texcoord0).rgb;
358
+        vec3 color = textureRect(tex0, texcoord0).rgb;
359 359
         fragcolor.rgb = color;
360 360
         @arg4
361 361
         @(? $arg3 $arg3 [fragcolor.a = 0.0;])
@@ -369,8 +369,8 @@ hdrtonemapshaders = [
369 369
     layout(location = 0) out vec4 fragcolor;
370 370
     void main(void)
371 371
     {
372
-        vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w;
373
-        vec3 color = texture2DRect(tex0, texcoord0).rgb*2.0;
372
+        vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w;
373
+        vec3 color = textureRect(tex0, texcoord0).rgb*2.0;
374 374
         color += bloom;
375 375
         @(hdrgammadecode color)
376 376
         @(hdrtonemapfrag color)
@@ -394,7 +394,7 @@ msaatonemapshaders = [
394 394
     layout(location = 0) out vec4 fragcolor;
395 395
     void main(void)
396 396
     {
397
-        vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w;
397
+        vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w;
398 398
         vec3 color = texelFetch(tex0, ivec2(texcoord0), gl_SampleID).rgb*2.0;
399 399
         color += bloom;
400 400
         @(hdrgammadecode color)
@@ -412,7 +412,7 @@ msaatonemapshaders = [
412 412
     layout(location = 0) out vec4 fragcolor;
413 413
     void main(void)
414 414
     {
415
-        vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w;
415
+        vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w;
416 416
         vec3 resolved = vec3(0.0);
417 417
         for(int sampleidx = 0; sampleidx < @msaasamples; sampleidx++)
418 418
         {
@@ -441,7 +441,7 @@ msaasplitshaders = [
441 441
     ]])
442 442
     void main(void)
443 443
     {
444
-        vec3 bloom = texture2DRect(tex1, texcoord1).rgb*hdrparams.w;
444
+        vec3 bloom = textureRect(tex1, texcoord1).rgb*hdrparams.w;
445 445
         @arg4
446 446
         @(loopconcat i $msaasamples [result [
447 447
             vec3 color@i = texelFetch(tex0, ivec2(texcoord0), @i).rgb*2.0 + bloom;

+ 6
- 6
config/glsl/volumetric.cfg View File

@@ -69,12 +69,12 @@ volumetricvariantshader = [
69 69
         @(if (volopt "p") [
70 70
             if (|| (volopt "g") (volopt "G")) [
71 71
                 ? (> $usetexgather 1) [
72
-                    #define filtershadow(shadowtc) float(shadow2D(tex4, vec3(shadowtc.xy*shadowatlasscale, shadowtc.z)))
72
+                    #define filtershadow(shadowtc) float(shadow(tex4, vec3(shadowtc.xy*shadowatlasscale, shadowtc.z)))
73 73
                 ] [
74
-                    #define filtershadow(shadowtc) step(shadowtc.z, float(texture2D(tex4, shadowtc.xy*shadowatlasscale)))
74
+                    #define filtershadow(shadowtc) step(shadowtc.z, float(texture(tex4, shadowtc.xy*shadowatlasscale)))
75 75
                 ]
76 76
             ] [result [
77
-                #define filtershadow(shadowtc) float(shadow2DRect(tex4, shadowtc))
77
+                #define filtershadow(shadowtc) float(textureRect(tex4, shadowtc))
78 78
             ]]
79 79
         ])
80 80
     
@@ -204,11 +204,11 @@ volumetricbilateralvariantshader = [
204 204
             #define tc gl_FragCoord.xy
205 205
             #define depthtc @(? $reduced [texcoord0] [gl_FragCoord.xy])
206 206
             #define tapvec(type, i) @(? (=s $filterdir "x") [type(i, 0.0)] [type(0.0, i)])
207
-            #define texval(i) texture2DRect(tex0, tc + tapvec(vec2, i))
208
-            #define texvaloffset(i) texture2DRectOffset(tex0, tc, tapvec(ivec2, i))
207
+            #define texval(i) textureRect(tex0, tc + tapvec(vec2, i))
208
+            #define texvaloffset(i) textureRectOffset(tex0, tc, tapvec(ivec2, i))
209 209
             #define depthval(i) gfetch(tex3, depthtc + tapvec(vec2, i))
210 210
             #define depthvaloffset(i) gfetchoffset(tex3, depthtc, tapvec(ivec2, i))
211
-            vec3 color = texture2DRect(tex0, tc).rgb;
211
+            vec3 color = textureRect(tex0, tc).rgb;
212 212
             @(gdepthunpack depth [gfetch(tex3, depthtc)])
213 213
             float weights = 1.0;
214 214
             @(loopconcat i (* 2 $numtaps) [

+ 30
- 30
config/glsl/world.cfg View File

@@ -136,12 +136,12 @@ worldvariantshader = [
136 136
                 triblend *= triblend;
137 137
                 triblend /= triblend.x + triblend.y + triblend.z;
138 138
 
139
-                vec4 diffusex = texture2D(diffusemap, texcoordx);   
140
-                vec4 diffusey = texture2D(diffusemap, texcoordy);   
141
-                vec4 diffusez = texture2D(@(? (wtopt "d") "detaildiffusemap" "diffusemap"), texcoordz);   
139
+                vec4 diffusex = texture(diffusemap, texcoordx);   
140
+                vec4 diffusey = texture(diffusemap, texcoordy);   
141
+                vec4 diffusez = texture(@(? (wtopt "d") "detaildiffusemap" "diffusemap"), texcoordz);   
142 142
                 vec4 diffuse = diffusex*triblend.x + diffusey*triblend.y + diffusez*triblend.z;
143 143
             ]] [result [
144
-                vec4 diffuse = texture2D(diffusemap, texcoord0);   
144
+                vec4 diffuse = texture(diffusemap, texcoord0);   
145 145
             ]])
146 146
 
147 147
             gcolor.rgb = diffuse.rgb*colorparams.rgb;
@@ -150,7 +150,7 @@ worldvariantshader = [
150 150
                 vec3 camvecn = normalize(camvec);
151 151
                 float invfresnel = dot(camvecn, normal);
152 152
                 vec3 rvec = 2.0*normal*invfresnel - camvecn;
153
-                vec3 reflect = textureCube(envmap, rvec).rgb;
153
+                vec3 reflect = texture(envmap, rvec).rgb;
154 154
                 @(? (wtopt "R") [
155 155
                     vec3 rmod = envscale.xyz*diffuse.a;
156 156
                 ] [
@@ -161,12 +161,12 @@ worldvariantshader = [
161 161
 
162 162
             @(if (wtopt "g") [result [
163 163
                 @(? (wtopt "T") [
164
-                    vec3 glowx = texture2D(glowmap, texcoordx).rgb;   
165
-                    vec3 glowy = texture2D(glowmap, texcoordy).rgb;   
166
-                    vec3 glowz = texture2D(glowmap, texcoordz).rgb;   
164
+                    vec3 glowx = texture(glowmap, texcoordx).rgb;   
165
+                    vec3 glowy = texture(glowmap, texcoordy).rgb;   
166
+                    vec3 glowz = texture(glowmap, texcoordz).rgb;   
167 167
                     vec3 glow = glowx*triblend.x + glowy*triblend.y + glowz*triblend.z;
168 168
                 ] [
169
-                    vec3 glow = texture2D(glowmap, texcoord0).rgb;
169
+                    vec3 glow = texture(glowmap, texcoord0).rgb;
170 170
                 ])
171 171
                 glow *= @(? (wtopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]); 
172 172
                 @(if (wtopt "a") [result [
@@ -190,7 +190,7 @@ worldvariantshader = [
190 190
             @(gdepthpackfrag (|| $msaalight [&& $msaasamples [! (wtopt "a")]]) "" hashid)
191 191
 
192 192
             @(? (wtopt "b") [
193
-                float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer);
193
+                float blend = abs(texture(blendmap, texcoord1).r - blendlayer);
194 194
                 gcolor.rgb *= blend;
195 195
                 gnormal.rgb *= blend;
196 196
                 gnormal.a *= blendlayer;
@@ -396,9 +396,9 @@ bumpvariantshader = [
396 396
                 #define worldz mat3(tangentx, tangenty, normal)
397 397
 
398 398
                 @(if (btopt "p") [result [
399
-                    float heightx = texture2D(normalmap, texcoordx).a;
400
-                    float heighty = texture2D(normalmap, texcoordy).a;
401
-                    float heightz = texture2D(@(? (btopt "d") "detailnormalmap" "normalmap"), texcoordz).a;
399
+                    float heightx = texture(normalmap, texcoordx).a;
400
+                    float heighty = texture(normalmap, texcoordy).a;
401
+                    float heightz = texture(@(? (btopt "d") "detailnormalmap" "normalmap"), texcoordz).a;
402 402
                     vec3 camvect = camvecn * mat3(tangentx, tangenty, tangentz);
403 403
 
404 404
                     vec2 dtcx = texcoordx + camvect.yz*(heightx*parallaxscale.x + parallaxscale.y);
@@ -410,14 +410,14 @@ bumpvariantshader = [
410 410
                     #define dtcz texcoordz
411 411
                 ]])
412 412
 
413
-                vec4 diffusex = texture2D(diffusemap, dtcx);
414
-                vec4 diffusey = texture2D(diffusemap, dtcy);
415
-                vec4 diffusez = texture2D(@(? (btopt "d") "detaildiffusemap" "diffusemap"), dtcz);
413
+                vec4 diffusex = texture(diffusemap, dtcx);
414
+                vec4 diffusey = texture(diffusemap, dtcy);
415
+                vec4 diffusez = texture(@(? (btopt "d") "detaildiffusemap" "diffusemap"), dtcz);
416 416
                 vec4 diffuse = diffusex*triblend.x + diffusey*triblend.y + diffusez*triblend.z;
417 417
 
418
-                vec3 bumpx = (texture2D(normalmap, dtcx).rgb*2.0 - 1.0)*triblend.x;
419
-                vec3 bumpy = (texture2D(normalmap, dtcy).rgb*2.0 - 1.0)*triblend.y;
420
-                vec3 bumpz = (texture2D(@(? (btopt "d") "detailnormalmap" "normalmap"), dtcz).rgb*2.0 - 1.0)*triblend.z;
418
+                vec3 bumpx = (texture(normalmap, dtcx).rgb*2.0 - 1.0)*triblend.x;
419
+                vec3 bumpy = (texture(normalmap, dtcy).rgb*2.0 - 1.0)*triblend.y;
420
+                vec3 bumpz = (texture(@(? (btopt "d") "detailnormalmap" "normalmap"), dtcz).rgb*2.0 - 1.0)*triblend.z;
421 421
                 vec3 bumpw = normalize(worldx*bumpx + worldy*bumpy + worldz*bumpz);
422 422
 
423 423
                 @(? (btopt "A") [
@@ -425,15 +425,15 @@ bumpvariantshader = [
425 425
                 ])
426 426
             ]] [result [
427 427
                 @(? (btopt "p") [
428
-                    float height = texture2D(normalmap, texcoord0).a;
428
+                    float height = texture(normalmap, texcoord0).a;
429 429
                     vec2 dtc = texcoord0 + (camvecn * world).xy*(height*parallaxscale.x + parallaxscale.y);
430 430
                 ] [
431 431
                     #define dtc texcoord0
432 432
                 ])
433 433
 
434
-                vec4 diffuse = texture2D(diffusemap, dtc);
434
+                vec4 diffuse = texture(diffusemap, dtc);
435 435
 
436
-                vec3 bump = texture2D(normalmap, dtc).rgb*2.0 - 1.0;
436
+                vec3 bump = texture(normalmap, dtc).rgb*2.0 - 1.0;
437 437
                 vec3 bumpw = normalize(world * bump);
438 438
             ]])
439 439
 
@@ -442,7 +442,7 @@ bumpvariantshader = [
442 442
             @(if (btopt "r") [result [
443 443
                 float invfresnel = dot(camvecn, bumpw);
444 444
                 vec3 rvec = 2.0*bumpw*invfresnel - camvecn;
445
-                vec3 reflect = textureCube(envmap, rvec).rgb;
445
+                vec3 reflect = texture(envmap, rvec).rgb;
446 446
                 @(? (btopt "R") [
447 447
                     vec3 rmod = envscale.xyz*diffuse.a;
448 448
                 ] [
@@ -453,12 +453,12 @@ bumpvariantshader = [
453 453
 
454 454
             @(if (btopt "g") [result [
455 455
                 @(? (btopt "T") [
456
-                    vec3 glowx = texture2D(glowmap, dtcx).rgb;   
457
-                    vec3 glowy = texture2D(glowmap, dtcy).rgb;   
458
-                    vec3 glowz = texture2D(glowmap, dtcz).rgb;   
456
+                    vec3 glowx = texture(glowmap, dtcx).rgb;   
457
+                    vec3 glowy = texture(glowmap, dtcy).rgb;   
458
+                    vec3 glowz = texture(glowmap, dtcz).rgb;   
459 459
                     vec3 glow = glowx*triblend.x + glowy*triblend.y + glowz*triblend.z;
460 460
                 ] [
461
-                    vec3 glow = texture2D(glowmap, dtc).rgb;
461
+                    vec3 glow = texture(glowmap, dtc).rgb;
462 462
                 ])
463 463
                 glow *= @(? (btopt "G") [mix(glowcolor.xyz, pulseglowcolor.xyz, pulse)] [glowcolor.xyz]); 
464 464
                 @(if (btopt "a") [result [
@@ -484,7 +484,7 @@ bumpvariantshader = [
484 484
             @(gdepthpackfrag (|| $msaalight [&& $msaasamples [! (btopt "a")]]) "" hashid)
485 485
 
486 486
             @(? (btopt "b") [
487
-                float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer);
487
+                float blend = abs(texture(blendmap, texcoord1).r - blendlayer);
488 488
                 gcolor.rgb *= blend;
489 489
                 gnormal.rgb *= blend;
490 490
                 gnormal.a *= blendlayer;
@@ -625,7 +625,7 @@ defershader 1 "rsmworld" [
625 625
         layout(location = 1) out vec4 gnormal;
626 626
         void main(void)
627 627
         {
628
-            vec4 diffuse = texture2D(diffusemap, texcoord0);   
628
+            vec4 diffuse = texture(diffusemap, texcoord0);   
629 629
 
630 630
             @(if (= $i 2) [result [
631 631
                 #define alpha 1.0
@@ -637,7 +637,7 @@ defershader 1 "rsmworld" [
637 637
             gnormal = vec4(normal.xyz*0.5+0.5, 0.0);
638 638
 
639 639
             @(if (= $i 1) [result [
640
-                float blend = abs(texture2D(blendmap, texcoord1).r - blendlayer);
640
+                float blend = abs(texture(blendmap, texcoord1).r - blendlayer);
641 641
                 gcolor.rgb *= blend;
642 642
                 gcolor.a = blendlayer;
643 643
                 gnormal *= blend;

+ 10
- 25
src/engine/shader.cpp View File

@@ -112,29 +112,14 @@ static void showglslinfo(GLenum type, GLuint obj, const char *name, const char *
112 112
 static void compileglslshader(Shader &s, GLenum type, GLuint &obj, const char *def, const char *name, bool msg = true)
113 113
 {
114 114
     const char *source = def + strspn(def, " \t\r\n");
115
-    const char *parts[16];
116
-    int numparts = 0;
117
-    parts[numparts++] = "#version 400\n";
118
-
119
-    parts[numparts++] =
120
-        "#define texture1D(sampler, coords) texture(sampler, coords)\n"
121
-        "#define texture2D(sampler, coords) texture(sampler, coords)\n"
122
-        "#define texture2DOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n"
123
-        "#define texture2DProj(sampler, coords) textureProj(sampler, coords)\n"
124
-        "#define shadow2D(sampler, coords) texture(sampler, coords)\n"
125
-        "#define shadow2DOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n"
126
-        "#define texture3D(sampler, coords) texture(sampler, coords)\n"
127
-        "#define textureCube(sampler, coords) texture(sampler, coords)\n";
128
-    parts[numparts++] =
129
-        "#define texture2DRect(sampler, coords) texture(sampler, coords)\n"
130
-        "#define texture2DRectProj(sampler, coords) textureProj(sampler, coords)\n"
131
-        "#define shadow2DRect(sampler, coords) texture(sampler, coords)\n";
132
-    parts[numparts++] =
133
-        "#define texture2DRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n"
134
-        "#define shadow2DRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n";
135
-
136
-    parts[numparts++] = source;
137
-
115
+    const char *parts[] = {
116
+        "#version 400\n",
117
+        "#define textureRect(sampler, coords) texture(sampler, coords)\n"
118
+        "#define textureRectProj(sampler, coords) textureProj(sampler, coords)\n"
119
+        "#define textureRectOffset(sampler, coords, offset) textureOffset(sampler, coords, offset)\n",
120
+        source
121
+    };
122
+    GLsizei numparts = sizeof(parts) / sizeof(void *);
138 123
     obj = glCreateShader_(type);
139 124
     glShaderSource_(obj, numparts, (const GLchar **)parts, NULL);
140 125
     glCompileShader_(obj);
@@ -786,7 +771,7 @@ void setupshaders()
786 771
         "in vec4 colorscale;\n"
787 772
         "layout(location = 0) out vec4 fragcolor;\n"
788 773
         "void main(void) {\n"
789
-        "    vec4 color = texture2D(tex0, texcoord0);\n"
774
+        "    vec4 color = texture(tex0, texcoord0);\n"
790 775
         "    fragcolor = colorscale * color;\n"
791 776
         "}\n");
792 777
     hudtextshader = newshader(0, "<init>hudtext",
@@ -806,7 +791,7 @@ void setupshaders()
806 791
         "in vec4 colorscale;\n"
807 792
         "layout(location = 0) out vec4 fragcolor;\n"
808 793
         "void main(void) {\n"
809
-        "    float dist = texture2D(tex0, texcoord0).r;\n"
794
+        "    float dist = texture(tex0, texcoord0).r;\n"
810 795
         "    float border = smoothstep(textparams.x, textparams.y, dist);\n"
811 796
         "    float outline = smoothstep(textparams.z, textparams.w, dist);\n"
812 797
         "    fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border);\n"

Loading…
Cancel
Save