Commit dd8e4fa8 authored by hunterk's avatar hunterk
Browse files

remove potentially recursive texture macro

parent 48cfce7c
......@@ -109,7 +109,7 @@ COMPAT_VARYING vec4 TEX0;
#define float4x4 mat4x4
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -103,7 +103,7 @@ COMPAT_VARYING vec4 TEX0;
#define float4x4 mat4x4
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -101,7 +101,7 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -95,7 +95,7 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......@@ -117,19 +117,19 @@ void main()
vec4 xh = yx*vec4(4.0,1.5,4.0,1.5);
vec4 yv = yx*vec4(1.5,4.0,1.5,4.0);
vec3 c11 = texture(Source, tex ).xyz;
vec3 s00 = texture(Source, tex + yx.zw).xyz;
vec3 s20 = texture(Source, tex + yx.xw).xyz;
vec3 s22 = texture(Source, tex + yx.xy).xyz;
vec3 s02 = texture(Source, tex + yx.zy).xyz;
vec3 h00 = texture(Source, tex + xh.zw).xyz;
vec3 h20 = texture(Source, tex + xh.xw).xyz;
vec3 h22 = texture(Source, tex + xh.xy).xyz;
vec3 h02 = texture(Source, tex + xh.zy).xyz;
vec3 v00 = texture(Source, tex + yv.zw).xyz;
vec3 v20 = texture(Source, tex + yv.xw).xyz;
vec3 v22 = texture(Source, tex + yv.xy).xyz;
vec3 v02 = texture(Source, tex + yv.zy).xyz;
vec3 c11 = COMPAT_TEXTURE(Source, tex ).xyz;
vec3 s00 = COMPAT_TEXTURE(Source, tex + yx.zw).xyz;
vec3 s20 = COMPAT_TEXTURE(Source, tex + yx.xw).xyz;
vec3 s22 = COMPAT_TEXTURE(Source, tex + yx.xy).xyz;
vec3 s02 = COMPAT_TEXTURE(Source, tex + yx.zy).xyz;
vec3 h00 = COMPAT_TEXTURE(Source, tex + xh.zw).xyz;
vec3 h20 = COMPAT_TEXTURE(Source, tex + xh.xw).xyz;
vec3 h22 = COMPAT_TEXTURE(Source, tex + xh.xy).xyz;
vec3 h02 = COMPAT_TEXTURE(Source, tex + xh.zy).xyz;
vec3 v00 = COMPAT_TEXTURE(Source, tex + yv.zw).xyz;
vec3 v20 = COMPAT_TEXTURE(Source, tex + yv.xw).xyz;
vec3 v22 = COMPAT_TEXTURE(Source, tex + yv.xy).xyz;
vec3 v02 = COMPAT_TEXTURE(Source, tex + yv.zy).xyz;
float m1=1.0/(dot(abs(s00-s22),dt)+0.00001);
float m2=1.0/(dot(abs(s02-s20),dt)+0.00001);
......
......@@ -95,7 +95,7 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......@@ -117,10 +117,10 @@ void main()
vec2 DL = vTexCoord.xy + vec2(-dx, dy);
vec2 DR = vTexCoord.xy + vec2(dx, dy);
vec3 c00 = texture(Source, UL).xyz;
vec3 c20 = texture(Source, UR).xyz;
vec3 c02 = texture(Source, DL).xyz;
vec3 c22 = texture(Source, DR).xyz;
vec3 c00 = COMPAT_TEXTURE(Source, UL).xyz;
vec3 c20 = COMPAT_TEXTURE(Source, UR).xyz;
vec3 c02 = COMPAT_TEXTURE(Source, DL).xyz;
vec3 c22 = COMPAT_TEXTURE(Source, DR).xyz;
float m1=dot(abs(c00-c22),dt)+0.001;
float m2=dot(abs(c02-c20),dt)+0.001;
......
......@@ -10,7 +10,7 @@
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#if defined(VERTEX)
......
......@@ -136,22 +136,22 @@ COMPAT_VARYING vec4 t4;
// compatibility #defines
#define Source Texture
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define vTexCoord TEX0.xy
vec3 dt = vec3(1.,1.,1.);
void main()
{
vec3 c00 = texture(Source, t1.zw).xyz;
vec3 c10 = texture(Source, t3.xy).xyz;
vec3 c20 = texture(Source, t3.zw).xyz;
vec3 c01 = texture(Source, t1.xy).xyz;
vec3 c11 = texture(Source, vTexCoord).xyz;
vec3 c21 = texture(Source, t2.xy).xyz;
vec3 c02 = texture(Source, t2.zw).xyz;
vec3 c12 = texture(Source, t4.xy).xyz;
vec3 c22 = texture(Source, t4.zw).xyz;
vec3 c00 = COMPAT_TEXTURE(Source, t1.zw).xyz;
vec3 c10 = COMPAT_TEXTURE(Source, t3.xy).xyz;
vec3 c20 = COMPAT_TEXTURE(Source, t3.zw).xyz;
vec3 c01 = COMPAT_TEXTURE(Source, t1.xy).xyz;
vec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz;
vec3 c21 = COMPAT_TEXTURE(Source, t2.xy).xyz;
vec3 c02 = COMPAT_TEXTURE(Source, t2.zw).xyz;
vec3 c12 = COMPAT_TEXTURE(Source, t4.xy).xyz;
vec3 c22 = COMPAT_TEXTURE(Source, t4.zw).xyz;
float d1=dot(abs(c00-c22),dt)+0.0001;
float d2=dot(abs(c20-c02),dt)+0.0001;
......
......@@ -89,7 +89,7 @@ COMPAT_VARYING vec4 TEX0;
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
#define texture(c, d) COMPAT_TEXTURE(c, d)
/*
FXAA_PRESET - Choose compile-in knob preset 0-5.
......
......@@ -15,7 +15,7 @@ Increasing the radius leads to more pixel lookups and therefore to a lower shade
#pragma parameter CLR "Bilateral Color Thresh" 0.15 0.01 1.0 0.01
#pragma parameter CWGHT "Bilateral Central Wght" 0.25 0.0 2.0 0.05
#define TEX(dx,dy) texture(Source, vTexCoord + vec2((dx),(dy)) * t1)
#define TEX(dx,dy) COMPAT_TEXTURE(Source, vTexCoord + vec2((dx),(dy)) * t1)
#define mul(a,b) (b*a)
#define saturate(c) clamp(c, 0.0, 1.0)
......@@ -99,7 +99,7 @@ COMPAT_VARYING vec2 t1;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -81,7 +81,7 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
......@@ -102,29 +102,29 @@ void main()
float sampleWeights4 = 0.024067905;
float sampleWeights5 = 0.0021112196;
vec4 color = texture(Source, texcoord) * sampleWeights1;
vec4 color = COMPAT_TEXTURE(Source, texcoord) * sampleWeights1;
// unroll the loop
color += texture(Source, texcoord + vec2(sampleOffsets2* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights2;
color += texture(Source, texcoord - vec2(sampleOffsets2* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights2;
color += COMPAT_TEXTURE(Source, texcoord + vec2(sampleOffsets2* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights2;
color += COMPAT_TEXTURE(Source, texcoord - vec2(sampleOffsets2* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights2;
color += texture(Source, texcoord + vec2(sampleOffsets3* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights3;
color += texture(Source, texcoord - vec2(sampleOffsets3* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights3;
color += COMPAT_TEXTURE(Source, texcoord + vec2(sampleOffsets3* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights3;
color += COMPAT_TEXTURE(Source, texcoord - vec2(sampleOffsets3* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights3;
color += texture(Source, texcoord + vec2(sampleOffsets4* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights4;
color += texture(Source, texcoord - vec2(sampleOffsets4* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights4;
color += COMPAT_TEXTURE(Source, texcoord + vec2(sampleOffsets4* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights4;
color += COMPAT_TEXTURE(Source, texcoord - vec2(sampleOffsets4* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights4;
color += texture(Source, texcoord + vec2(sampleOffsets5* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights5;
color += texture(Source, texcoord - vec2(sampleOffsets5* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights5;
color += COMPAT_TEXTURE(Source, texcoord + vec2(sampleOffsets5* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights5;
color += COMPAT_TEXTURE(Source, texcoord - vec2(sampleOffsets5* HW * PIXEL_SIZE.x, 0.0)) * sampleWeights5;
#else
float sampleOffsets[5] = { 0.0, 1.4347826, 3.3478260, 5.2608695, 7.1739130 };
float sampleWeights[5] = { 0.16818994, 0.27276957, 0.11690125, 0.024067905, 0.0021112196 };
vec4 color = texture(Source, texcoord) * sampleWeights[0];
vec4 color = COMPAT_TEXTURE(Source, texcoord) * sampleWeights[0];
for(int i = 1; i < 5; ++i) {
color += texture(Source, texcoord + vec2(sampleOffsets[i]*HW * PIXEL_SIZE.x, 0.0)) * sampleWeights[i];
color += texture(Source, texcoord - vec2(sampleOffsets[i]*HW * PIXEL_SIZE.x, 0.0)) * sampleWeights[i];
color += COMPAT_TEXTURE(Source, texcoord + vec2(sampleOffsets[i]*HW * PIXEL_SIZE.x, 0.0)) * sampleWeights[i];
color += COMPAT_TEXTURE(Source, texcoord - vec2(sampleOffsets[i]*HW * PIXEL_SIZE.x, 0.0)) * sampleWeights[i];
}
#endif
......
......@@ -82,7 +82,7 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
......@@ -103,29 +103,29 @@ void main()
float sampleWeights4 = 0.024067905;
float sampleWeights5 = 0.0021112196;
vec4 color = texture(Source, texcoord) * sampleWeights1;
vec4 color = COMPAT_TEXTURE(Source, texcoord) * sampleWeights1;
// unroll the loop
color += texture(Source, texcoord + vec2(0.0, sampleOffsets2* VW * PIXEL_SIZE.y)) * sampleWeights2;
color += texture(Source, texcoord - vec2(0.0, sampleOffsets2* VW * PIXEL_SIZE.y)) * sampleWeights2;
color += COMPAT_TEXTURE(Source, texcoord + vec2(0.0, sampleOffsets2* VW * PIXEL_SIZE.y)) * sampleWeights2;
color += COMPAT_TEXTURE(Source, texcoord - vec2(0.0, sampleOffsets2* VW * PIXEL_SIZE.y)) * sampleWeights2;
color += texture(Source, texcoord + vec2(0.0, sampleOffsets3* VW * PIXEL_SIZE.y)) * sampleWeights3;
color += texture(Source, texcoord - vec2(0.0, sampleOffsets3* VW * PIXEL_SIZE.y)) * sampleWeights3;
color += COMPAT_TEXTURE(Source, texcoord + vec2(0.0, sampleOffsets3* VW * PIXEL_SIZE.y)) * sampleWeights3;
color += COMPAT_TEXTURE(Source, texcoord - vec2(0.0, sampleOffsets3* VW * PIXEL_SIZE.y)) * sampleWeights3;
color += texture(Source, texcoord + vec2(0.0, sampleOffsets4* VW * PIXEL_SIZE.y)) * sampleWeights4;
color += texture(Source, texcoord - vec2(0.0, sampleOffsets4* VW * PIXEL_SIZE.y)) * sampleWeights4;
color += COMPAT_TEXTURE(Source, texcoord + vec2(0.0, sampleOffsets4* VW * PIXEL_SIZE.y)) * sampleWeights4;
color += COMPAT_TEXTURE(Source, texcoord - vec2(0.0, sampleOffsets4* VW * PIXEL_SIZE.y)) * sampleWeights4;
color += texture(Source, texcoord + vec2(0.0, sampleOffsets5* VW * PIXEL_SIZE.y)) * sampleWeights5;
color += texture(Source, texcoord - vec2(0.0, sampleOffsets5* VW * PIXEL_SIZE.y)) * sampleWeights5;
color += COMPAT_TEXTURE(Source, texcoord + vec2(0.0, sampleOffsets5* VW * PIXEL_SIZE.y)) * sampleWeights5;
color += COMPAT_TEXTURE(Source, texcoord - vec2(0.0, sampleOffsets5* VW * PIXEL_SIZE.y)) * sampleWeights5;
#else
float sampleOffsets[5] = { 0.0, 1.4347826, 3.3478260, 5.2608695, 7.1739130 };
float sampleWeights[5] = { 0.16818994, 0.27276957, 0.11690125, 0.024067905, 0.0021112196 };
vec4 color = texture(Source, texcoord) * sampleWeights[0];
vec4 color = COMPAT_TEXTURE(Source, texcoord) * sampleWeights[0];
for(int i = 1; i < 5; ++i) {
color += texture(Source, texcoord + vec2(0.0, sampleOffsets[i]*VW * PIXEL_SIZE.y)) * sampleWeights[i];
color += texture(Source, texcoord - vec2(0.0, sampleOffsets[i]*VW * PIXEL_SIZE.y)) * sampleWeights[i];
color += COMPAT_TEXTURE(Source, texcoord + vec2(0.0, sampleOffsets[i]*VW * PIXEL_SIZE.y)) * sampleWeights[i];
color += COMPAT_TEXTURE(Source, texcoord - vec2(0.0, sampleOffsets[i]*VW * PIXEL_SIZE.y)) * sampleWeights[i];
}
#endif
......
......@@ -2074,7 +2074,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -2073,7 +2073,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -2074,7 +2074,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -2073,7 +2073,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -2074,7 +2074,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -2073,7 +2073,7 @@ COMPAT_VARYING vec2 blur_dxdy;
// compatibility #defines
#define Source Texture
#define tex_uv TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -120,7 +120,7 @@ COMPAT_VARYING vec4 t4;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......@@ -148,15 +148,15 @@ float wt(vec3 A, vec3 B)
void main()
{
vec3 c00 = texture(Source, t1.xy).xyz;
vec3 c10 = texture(Source, t1.zw).xyz;
vec3 c20 = texture(Source, t2.xy).xyz;
vec3 c01 = texture(Source, t4.zw).xyz;
vec3 c11 = texture(Source, vTexCoord.xy).xyz;
vec3 c21 = texture(Source, t2.zw).xyz;
vec3 c02 = texture(Source, t4.xy).xyz;
vec3 c12 = texture(Source, t3.zw).xyz;
vec3 c22 = texture(Source, t3.xy).xyz;
vec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz;
vec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz;
vec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz;
vec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz;
vec3 c11 = COMPAT_TEXTURE(Source, vTexCoord.xy).xyz;
vec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz;
vec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz;
vec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz;
vec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz;
float w10 = wt(c11,c10);
float w21 = wt(c11,c21);
......
......@@ -140,7 +140,7 @@ COMPAT_VARYING vec2 tex_border;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
......@@ -138,7 +138,7 @@ COMPAT_VARYING vec2 tex_border;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment