diff --git a/language.version b/language.version index 5e92f87cd..ff0d1c2d7 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r164 \cu(Wed 6 Jul 14:08:38 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r164 \cu(2022-07-06 14:08:38)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r165 \cu(Fri 8 Jul 22:22:35 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r165 \cu(2022-07-08 22:22:35)\c-"; diff --git a/shaders/glsl/Bilinear.fp b/shaders/glsl/Bilinear.fp index 9ac7390ec..a4c7e8637 100644 --- a/shaders/glsl/Bilinear.fp +++ b/shaders/glsl/Bilinear.fp @@ -3,14 +3,14 @@ void SetupMaterial( inout Material mat ) { - vec2 size = textureSize(tex,0); + vec2 size = vec2(textureSize(tex,0)); vec2 pxsize = vec2(1./size.x,1./size.y); vec2 pos = vTexCoord.st; vec2 f = fract(pos*size); pos += (.5-f)*pxsize; vec4 p0q0 = texture(tex,pos); - vec4 p1q0 = texture(tex,pos+vec2(pxsize.x,0)); - vec4 p0q1 = texture(tex,pos+vec2(0,pxsize.y)); + vec4 p1q0 = texture(tex,pos+vec2(pxsize.x,0.)); + vec4 p0q1 = texture(tex,pos+vec2(0.,pxsize.y)); vec4 p1q1 = texture(tex,pos+vec2(pxsize.x,pxsize.y)); vec4 pInterp_q0 = mix(p0q0,p1q0,f.x); vec4 pInterp_q1 = mix(p0q1,p1q1,f.x); diff --git a/shaders/glsl/Envmap.fp b/shaders/glsl/Envmap.fp index 26a90d4d5..59910a064 100644 --- a/shaders/glsl/Envmap.fp +++ b/shaders/glsl/Envmap.fp @@ -35,7 +35,7 @@ void SetupMaterial( inout Material mat ) vec4 ProcessLight( Material mat, vec4 color ) { #ifdef AMBIENT_GLOW - float glow = .75+.25*sin(timer*8); + float glow = .75+.25*sin(timer*8.); return vec4(vec3(glow),color.a); #else return color; diff --git a/shaders/glsl/Fuzz.fp b/shaders/glsl/Fuzz.fp index 34bbf7828..e497a5ff4 100644 --- a/shaders/glsl/Fuzz.fp +++ b/shaders/glsl/Fuzz.fp @@ -6,7 +6,7 @@ float rnd( in vec2 sd ) { //return cos(sd.y*3874.8674+sd.x*6783.5325)*2737.8474; // use noise tex instead of trig-based PRNG, much better and doesn't break on intel - return texelFetch(noisetex,ivec2(mod(sd.x,256.),mod(sd.y,256.)),0).x; + return texelFetch(noisetex,ivec2(int(mod(sd.x,256.)),int(mod(sd.y,256.))),0).x; } // haha are you telling me I can't declare arrays like in C? diff --git a/shaders/glsl/NewLogoAnimated.fp b/shaders/glsl/NewLogoAnimated.fp index b5644ef29..5ea8ed602 100644 --- a/shaders/glsl/NewLogoAnimated.fp +++ b/shaders/glsl/NewLogoAnimated.fp @@ -33,7 +33,10 @@ vec4 blacktoalpha( in vec4 src ) return dst; } #ifdef NO_BILINEAR -#define BilinearSample(x,y,z,w) texture(x,y) +vec4 BilinearSample( in sampler2D tex, in vec2 pos, in vec2 size, in vec2 pxsize ) +{ + return texture(tex,pos); +} #else vec4 BilinearSample( in sampler2D tex, in vec2 pos, in vec2 size, in vec2 pxsize ) { @@ -54,7 +57,7 @@ vec3 GradientMap( in vec3 color ) float gray = dot(color,vec3(.333333)); vec2 size = vec2(512.,8.); vec2 pxsize = 1./size; - return BilinearSample(gradtex,vec2(gray/2.+.25,0),size,pxsize).rgb; + return BilinearSample(gradtex,vec2(gray/2.+.25,0.),size,pxsize).rgb; } void SetupMaterial( inout Material mat ) @@ -81,8 +84,8 @@ void SetupMaterial( inout Material mat ) // second layer, alpha blend vec4 tmp = BilinearSample(Layer2,uv,size,pxsize); vec4 tmp2; - tmp2.a = tmp.a+base.a*(1-tmp.a); - tmp2.rgb = (tmp.rgb*tmp.a+base.rgb*base.a*(1-tmp.a))/tmp2.a; + tmp2.a = tmp.a+base.a*(1.-tmp.a); + tmp2.rgb = (tmp.rgb*tmp.a+base.rgb*base.a*(1.-tmp.a))/tmp2.a; base = tmp2; // third layer, hard light with two multiplied masks tmp.xy = BilinearSample(Layer3,uv,size,pxsize).xy; diff --git a/shaders/glsl/Oversample.fp b/shaders/glsl/Oversample.fp index 2aab18c66..059f64168 100644 --- a/shaders/glsl/Oversample.fp +++ b/shaders/glsl/Oversample.fp @@ -2,7 +2,7 @@ void SetupMaterial( inout Material mat ) { - vec2 size = textureSize(tex,0); + vec2 size = vec2(textureSize(tex,0)); vec2 pxsize = vec2(1./size.x,1./size.y); vec2 pos = vTexCoord.st-vec2(.5)*pxsize; vec2 fcoord = fract(pos*size-vec2(.5)); diff --git a/shaders/pp/Barrier.fp b/shaders/pp/Barrier.fp index 998e373c6..a8fb7525b 100644 --- a/shaders/pp/Barrier.fp +++ b/shaders/pp/Barrier.fp @@ -3,8 +3,8 @@ void main() { vec2 uv = TexCoord; - vec2 bresl = textureSize(InputTexture,0); - vec2 sr = vec2(1.0,bresl.y/bresl.x); + vec2 bresl = vec2(textureSize(InputTexture,0)); + vec2 sr = vec2(1.,bresl.y/bresl.x); vec2 flood = texture(WarpTex,uv*sr+vec2(timer*.02,-timer*.04)).xy; flood += texture(WarpTex,uv*sr*2.+vec2(-timer*.07,-timer*.13)).xy; flood += texture(WarpTex,uv*sr*.5+vec2(0.,-timer*.06)).xy; diff --git a/shaders/pp/Devascreen.fp b/shaders/pp/Devascreen.fp index ec078f3e6..6cef34a30 100644 --- a/shaders/pp/Devascreen.fp +++ b/shaders/pp/Devascreen.fp @@ -12,7 +12,7 @@ vec2 heatdist( in vec2 uv ) void main() { vec2 uv = TexCoord; - vec2 bresl = textureSize(InputTexture,0); + vec2 bresl = vec2(textureSize(InputTexture,0)); vec2 sr = vec2(1.,bresl.y/bresl.x); // vignette fade, will be needed later vec2 vuv = uv.xy*(1.-uv.yx)*4.; diff --git a/shaders/pp/Diviscreen.fp b/shaders/pp/Diviscreen.fp index 371b880df..0ecdf84e9 100644 --- a/shaders/pp/Diviscreen.fp +++ b/shaders/pp/Diviscreen.fp @@ -12,7 +12,7 @@ void main() float distfct = clamp(pow(dist,1.2)*.85-(.75+.5*(1.-str)),0.,1.); ofs *= distfct; vec3 col = texture(InputTexture,uv+ofs).rgb; - col += pow(max(0,ice.z),1.45)*.65*str*distfct; + col += pow(max(0.,ice.z),1.45)*.65*str*distfct; float str2 = str*(.9+texture(NoiseTex,vec2(timer*.05)).x*.2); float ang = timer*.05; uv *= sr; diff --git a/shaders/pp/Glitch.fp b/shaders/pp/Glitch.fp index 4ca1bdcc0..d82a47c19 100644 --- a/shaders/pp/Glitch.fp +++ b/shaders/pp/Glitch.fp @@ -6,30 +6,30 @@ const float thr3 = 19.3; float rnd2( in vec2 sd ) { - return fract(cos(dot(sd*floor(Timer*15.0),vec2(145.34,142.55)))*2745.84); + return fract(cos(dot(sd*floor(Timer*15.),vec2(145.34,142.55)))*2745.84); } float rnd( in float sd ) { - return rnd2(vec2(sd,1.0)); + return rnd2(vec2(sd,1.)); } void main() { vec2 coord = TexCoord; vec2 uv_c[3] = vec2[3](coord,coord,coord); - vec2 blka = floor(coord*vec2(22.0,12.0)); - vec2 blkb = floor(coord*vec2(6.0,9.0)); + vec2 blka = floor(coord*vec2(22.,12.)); + vec2 blkb = floor(coord*vec2(6.,9.)); float noiz = pow(rnd2(blka),thr1)*pow(rnd2(blkb),thr2)-pow(rnd(4.53),thr3)*str2; - uv_c[0].x += str1*noiz*(rnd(3.35)-0.5); - uv_c[1].x += str1*noiz*(rnd(4.63)-0.5); - uv_c[2].x += str1*noiz*(rnd(5.62)-0.5); - uv_c[0].y += str1*noiz*(rnd(4.55)-0.5); - uv_c[1].y += str1*noiz*(rnd(3.67)-0.5); - uv_c[2].y += str1*noiz*(rnd(5.54)-0.5); + uv_c[0].x += str1*noiz*(rnd(3.35)-.5); + uv_c[1].x += str1*noiz*(rnd(4.63)-.5); + uv_c[2].x += str1*noiz*(rnd(5.62)-.5); + uv_c[0].y += str1*noiz*(rnd(4.55)-.5); + uv_c[1].y += str1*noiz*(rnd(3.67)-.5); + uv_c[2].y += str1*noiz*(rnd(5.54)-.5); vec4 res; res.r = texture(InputTexture,uv_c[0]).r; res.g = texture(InputTexture,uv_c[1]).g; res.b = texture(InputTexture,uv_c[2]).b; - res.a = 1.0; + res.a = 1.; FragColor = res; } diff --git a/shaders/pp/Grain.fp b/shaders/pp/Grain.fp index 020ea3273..2320b7208 100644 --- a/shaders/pp/Grain.fp +++ b/shaders/pp/Grain.fp @@ -10,7 +10,11 @@ const float ns = -.08; const float np = 3.95; const float bnp = 1.7; -#define darkmask(a,b) (a>.5)?(2.*a*(.5+b)):(1.-2.*(1.-a)*(1.-((.5+b)))) +float darkmask( in float a, in float b ) +{ + if ( a > .5 ) return 2.*a*(.5+b); + return 1.-2.*(1.-a)*(1.-((.5+b))); +} vec3 grain( in vec3 res, in vec2 coord ) { @@ -19,7 +23,7 @@ vec3 grain( in vec3 res, in vec2 coord ) vec2 s2 = coord+vec2(ts,0.); vec2 s3 = coord+vec2(ts,ts); float n1, n2, n3; - vec2 nr = textureSize(NoiseTexture,0); + vec2 nr = vec2(textureSize(NoiseTexture,0)); s1 = mod(s1*nm1.x*nr,1.); s2 = mod(s2*nm1.y*nr,1.); s3 = mod(s3*nm1.z*nr,1.); @@ -35,7 +39,7 @@ vec3 grain( in vec3 res, in vec2 coord ) n1 = texture(NoiseTexture,s1).r; n2 = texture(NoiseTexture,s2).g; n3 = texture(NoiseTexture,s3).b; - float n4 = (n1+n2+n3)/3.0; + float n4 = (n1+n2+n3)/3.; vec3 ng = vec3(n4); vec3 nc = vec3(n1,n2,n3); vec3 nt = pow(clamp(mix(ng,nc,ns),0.,1.),vec3(np)); @@ -52,7 +56,7 @@ void main() { vec2 coord = TexCoord; vec4 res = texture(InputTexture,coord); - vec2 sfact = max(vec2(640.,400.),textureSize(InputTexture,0)*.5); + vec2 sfact = max(vec2(640.,400.),vec2(textureSize(InputTexture,0))*.5); coord = floor(coord*sfact)/sfact; res.rgb = grain(res.rgb,coord); FragColor = res; diff --git a/shaders/pp/Invinciscreen.fp b/shaders/pp/Invinciscreen.fp index aefc5f068..2320006ce 100644 --- a/shaders/pp/Invinciscreen.fp +++ b/shaders/pp/Invinciscreen.fp @@ -5,14 +5,14 @@ vec3 sharpened( vec2 uv ) vec3 col = texture(InputTexture,uv).rgb*9.; vec2 bresl = vec2(textureSize(InputTexture,0)); vec2 bof = vec2(1./bresl.x,1./bresl.y); - col -= texture(InputTexture,uv+vec2(bof.x,0)).rgb; - col -= texture(InputTexture,uv+vec2(2.*bof.x,0)).rgb; - col -= texture(InputTexture,uv+vec2(-bof.x,0)).rgb; - col -= texture(InputTexture,uv+vec2(-2.*bof.x,0)).rgb; - col -= texture(InputTexture,uv+vec2(0,bof.y)).rgb; - col -= texture(InputTexture,uv+vec2(0,2.*bof.y)).rgb; - col -= texture(InputTexture,uv+vec2(0,-bof.y)).rgb; - col -= texture(InputTexture,uv+vec2(0,-2.*bof.y)).rgb; + col -= texture(InputTexture,uv+vec2(bof.x,0.)).rgb; + col -= texture(InputTexture,uv+vec2(2.*bof.x,0.)).rgb; + col -= texture(InputTexture,uv+vec2(-bof.x,0.)).rgb; + col -= texture(InputTexture,uv+vec2(-2.*bof.x,0.)).rgb; + col -= texture(InputTexture,uv+vec2(0.,bof.y)).rgb; + col -= texture(InputTexture,uv+vec2(0.,2.*bof.y)).rgb; + col -= texture(InputTexture,uv+vec2(0.,-bof.y)).rgb; + col -= texture(InputTexture,uv+vec2(0.,-2.*bof.y)).rgb; return col; } @@ -26,5 +26,5 @@ void main() vec2 suv = fract((uv-.5)*(1.-.01*i*(.3+str*4.))+.5); col += sharpened(suv)*pow(p,2.4)*vec3(1.2,.7,.2)*(.4+str); } - FragColor = vec4(col,1.0); + FragColor = vec4(col,1.); } diff --git a/shaders/pp/LavaWarp.fp b/shaders/pp/LavaWarp.fp index 7482097e8..8e3c29d99 100644 --- a/shaders/pp/LavaWarp.fp +++ b/shaders/pp/LavaWarp.fp @@ -5,10 +5,10 @@ vec2 calcdist( vec2 duv ) { vec2 uv = vec2(0.); vec2 dist = 2.*texture(warptex,duv*.2).xy-1.; - dist.x *= abs(mod(dist.y+timer*0.34536,4.)-2.)-1.; + dist.x *= abs(mod(dist.y+timer*.34536,4.)-2.)-1.; uv.x += dist.x*.02*dfact; dist = 2.*texture(warptex,(duv+uv)*.3).xy-1.; - dist.y *= abs(mod(dist.x+timer*0.25363,4.)-2.)-1.; + dist.y *= abs(mod(dist.x+timer*.25363,4.)-2.)-1.; uv.y -= dist.y*.03*dfact; return uv; } @@ -16,7 +16,7 @@ vec2 calcdist( vec2 duv ) void main() { vec2 uv = TexCoord+calcdist(TexCoord-vec2(0.,timer*.02)); - vec2 bresl = textureSize(InputTexture,0); + vec2 bresl = vec2(textureSize(InputTexture,0)); vec2 sr = vec2(1.,bresl.y/bresl.x); float p = distance(uv,vec2(.5)); uv = (uv-.5)*(1.-dfact*.07)+.5; diff --git a/shaders/pp/Ragescreen.fp b/shaders/pp/Ragescreen.fp index 0caa7be56..8638ce04d 100644 --- a/shaders/pp/Ragescreen.fp +++ b/shaders/pp/Ragescreen.fp @@ -18,5 +18,5 @@ void main() } col /= 5.; col *= vec3(1.2,.9,.7); - FragColor = vec4(col,1.0); + FragColor = vec4(col,1.); } diff --git a/shaders/pp/SilverScope.fp b/shaders/pp/SilverScope.fp index 48c4915e5..b00f53421 100644 --- a/shaders/pp/SilverScope.fp +++ b/shaders/pp/SilverScope.fp @@ -6,9 +6,9 @@ void main() { vec2 uv = TexCoord.st; vec3 base = texture(InputTexture,uv).rgb; - vec2 bof = 1.0/textureSize(InputTexture,0); + vec2 bof = 1./vec2(textureSize(InputTexture,0)); int rsamples, tstep = 1; - vec2 bstr = bof*4.0; + vec2 bstr = bof*4.; float bstep; vec2 rcoord; for ( int i=1; i<=5; i++ ) @@ -16,7 +16,7 @@ void main() rsamples = i*3; for ( int j=0; j sz.y ) p.x *= sz.x/sz.y; else p.y *= sz.y/sz.x; vec3 col = texture(InputTexture,uv+p*pow(length(p),8.)*20.).rgb; diff --git a/shaders/pp/SlimeWarp.fp b/shaders/pp/SlimeWarp.fp index 220b8fdcd..082dc5971 100644 --- a/shaders/pp/SlimeWarp.fp +++ b/shaders/pp/SlimeWarp.fp @@ -5,10 +5,10 @@ vec2 calcdist( vec2 duv ) { vec2 uv = vec2(0.); vec2 dist = 2.*texture(warptex,duv*.4).xy-1.; - dist.x *= abs(mod(dist.y+timer*0.24536,4.)-2.)-1.; + dist.x *= abs(mod(dist.y+timer*.24536,4.)-2.)-1.; uv.x += dist.x*.02*dfact; dist = 2.*texture(warptex,(duv+uv)*.3).xy-1.; - dist.y *= abs(mod(dist.x+timer*0.15363,4.)-2.)-1.; + dist.y *= abs(mod(dist.x+timer*.15363,4.)-2.)-1.; uv.y -= dist.y*.03*dfact; return uv; } @@ -16,7 +16,7 @@ vec2 calcdist( vec2 duv ) void main() { vec2 uv = TexCoord+calcdist(TexCoord-vec2(0.,timer*.08)); - vec2 bresl = textureSize(InputTexture,0); + vec2 bresl = vec2(textureSize(InputTexture,0)); vec2 sr = vec2(1.,bresl.y/bresl.x); float p = distance(uv,vec2(.5)); uv = (uv-.5)*(1.-dfact*.11)+.5; diff --git a/shaders/pp/WaterWarp.fp b/shaders/pp/WaterWarp.fp index 76deeee8c..d42189465 100644 --- a/shaders/pp/WaterWarp.fp +++ b/shaders/pp/WaterWarp.fp @@ -5,10 +5,10 @@ vec2 calcdist( vec2 duv ) { vec2 uv = vec2(0.); vec2 dist = 2.*texture(warptex,duv*.2).xy-1.; - dist.x *= abs(mod(dist.y+timer*0.34536,4.)-2.)-1.; + dist.x *= abs(mod(dist.y+timer*.34536,4.)-2.)-1.; uv.x += dist.x*.03*dfact; dist = 2.*texture(warptex,(duv+uv)*.3).xy-1.; - dist.y *= abs(mod(dist.x+timer*0.45363,4.)-2.)-1.; + dist.y *= abs(mod(dist.x+timer*.45363,4.)-2.)-1.; uv.y -= dist.y*.02*dfact; return uv; } @@ -16,7 +16,7 @@ vec2 calcdist( vec2 duv ) void main() { vec2 uv = TexCoord+calcdist(TexCoord-vec2(0.,timer*.2)); - vec2 bresl = textureSize(InputTexture,0); + vec2 bresl = vec2(textureSize(InputTexture,0)); vec2 sr = vec2(1.,bresl.y/bresl.x); float p = distance(uv,vec2(.5)); uv = (uv-.5)*(1.-dfact*.12)+.5;