Feeds IRC Links About Help Search Sections

 Who's Online 37 user(s) are online (21 user(s) are browsing Forums) Members: 1 Guests: 36 billyfish, more...

 Headlines amiarcadia.lha - emulation/gamesystem Aug 3, 2021 arabic_console_devicepro2.lha - driver/input Jul 31, 2021 mce.lha - game/utility Jul 29, 2021 cookiemaster.lha - network/browser Jul 28, 2021 The Amigans website Forum Index AmigaOS4 Warp3DNova shader bugs thread

« 1 (2) 3 4 5 6 »

@Daniel
Quote:

Then it works.

Yeah indeed !

Quote:

Return values not being even near reliable is a show-stopper. This should have the top priority on the Nova fix list!

As far as i can see Hans already fix some of return values errors already : http://www.amiga.org/developer/bugreports/view.php?id=481. So maybe it fits in already, need to check once beta versions will avail.

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e
Very well, crossing fingers @All

Code:

``` #define T iTime #define R iResolution #define M iMouse // magic stuff #define A(i)(6.283*fract(3.7*sin(i))+.7*mix(-1.,1.,fract(3.7*sin(i)))*T) #define P(i)vec2(-(step(.5,fract(3.7*sin(i)))-.5)*sin(A(i)),(step(.5,fract(3.7*sin(i)))-.5)*cos(A(i))) void mainImage( out vec4 _FragColor, in vec2 _FragCoord ) {     // standard uv fixup     vec2 p = (2.0*_FragCoord.xy-R.xy)/R.y + 0.5*vec2(sin(0.2*T),sin(0.3*T));          // get the recursion values     float i = floor(T-length(p)),         m = T - i-length(p),          z = pow(2.718, -log(3.333)*m) * .08,         v = 0.;          // get the zoom position     p = p*z+ P(i);     for (float r = 0.; r < 9.; ++r)         p += (P(i+r+1.) / 3.333) * pow(1. / 3.333, r);          // recursion     for (float r = 0.; r<9.; ++r)     {         // rotate         m = -A(i);         p=vec2(p.x*cos(m) - p.y*sin(m), p.x*sin(m) + p.y*cos(m));         // yin yang function         float b = 5.*z/min(R.y, R.x),         c = 1.0,         l = length(2.0*p + vec2(0, 1)),         d = l;         if (p.x < 0.0)             c = mix(c, 0.0, smoothstep(1.0-b, 1.0+b, l));         l = length(2.0*p - vec2(0, 1));         if (p.x > 0.0)             c = mix(0.0, c, smoothstep(1.0-b, 1.0+b, l));         if (p.y > 0.0)             d = l;         v = mix(c, v, smoothstep(1.0-b, 1.0, length(p)));         if (d > .6)         {             // stop if outside             v = mix(step(0.0, p.y), v, smoothstep(.6+.12,.6+.12+b,d));             // fix color around the edges             if (d < .72+b && p.y > 0.0) ++i;             break;         }         // which side are we on?         p.y += mix(0.5, -0.5,  v = step(0.0,p.y));         // update zoom and position         z *= 2./.6;         p *= 2./.6;                       // unrotate         m = A(i);         p=vec2(p.x*cos(m) - p.y*sin(m), p.x*sin(m) + p.y*cos(m));            ++i;     }          // final coloring     _FragColor = vec4(v*vec3(1.+sin(i+T+i),1.+sin(i+T+1.),1.+sin(i+T+2.)),1.); } ```

Win32 look (open in new tab for fullsize): Aos4 look (open in new tab for fullsize): In os4 version we can see some distortion (see green quads and squares), and that one not related to the other issues we reported. That kind of bug i can see also in some other shaders (through happen to be very rare), but worth to invistigate for sure.

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e
That's some new severe bug introduced in Warp3D Nova 1.70. Check it out, with 1.68 it still renders fine.
Apparently the reason now is an "if" not working correctly anymore. In case of this shader it's this one:

``` // stop if outside ... if (d < .72+b && p.y > 0.0) ++i; ```

I checked d, b and p.y, they seem to be valid.

Quote:
and that one not related to the other issues we reported.

I'd not be so sure about that. Looking at all those recent bugs the main broken component of Nova seems to be the register allocator which can result in all kinds of funny stuff. I mean, maybe the above "if" is simply comparing the wrong register.

Edited by Daytona675x on 2020/5/30 8:07:54
Edited by Daytona675x on 2020/5/30 13:28:34

@Daniel
Thanks ! Created BZ with your findings: http://www.amiga.org/developer/bugreports/view.php?id=492

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@All
Another rendering issue which i find in some shaders, can be called as "colors swapped or reverted". I think (i hope) it can be roots of one single issue, so maybe worth to check them all at the same time. For all images press open in new tab for fullsize. So:

``` #define S(a, b, t) smoothstep(a, b, t) float createTaperBox(vec2 point, float bottomWidth, float topWidth, float yBottom, float yTop, float blur) {     // Bottom edge         float m = S(-blur, blur, point.y - yBottom);     // Top edge     m *= S(blur, -blur, point.y - yTop);     // Sides, mirrored     point.x = abs(point.x);          float w = mix(bottomWidth, topWidth, (point.y - yBottom) / (yTop - yBottom));     m *= S(blur, -blur, point.x - w);          return m; } vec4 createTree(vec2 uv, vec3 color, float blur) {          // --- Trunk ---     float m = createTaperBox(uv, 0.03, 0.03, -0.05, 0.25, blur);     // --- Canopy 1 ---     m += createTaperBox(uv, 0.2, 0.1, 0.25, 0.5, blur);     // --- Canopy 2 ---     m += createTaperBox(uv, 0.15, 0.05, 0.5, 0.75, blur);     // --- Top ---     m += createTaperBox(uv, 0.1, 0.0, 0.75, 1.0, blur);          float shadow = createTaperBox(uv - vec2(0.2, 0.0), 0.1, 0.5, 0.15, 0.25, blur);     shadow += createTaperBox(uv + vec2(0.25, 0.0), 0.1, 0.5, 0.45, 0.5, blur);     shadow += createTaperBox(uv - vec2(0.2, 0.0), 0.1, 0.5, 0.7, 0.75, blur);     color -= shadow * 0.8;     //m = 1.0;          return vec4(color, m); } float GetHeight(float x) {     return sin(x * 0.435) + sin(x) * 0.3; } vec4 createLayer(vec2 uv, float blur) {     vec4 color = vec4(0.0);          float id = floor(uv.x);     float n = fract(sin(id * 256.12) * 6854.3) * 2.0 - 1.0;     float x = n * 0.3;     float y = GetHeight(uv.x);          // Ground     float ground = S(blur, -blur, uv.y + y);     color += ground;          y = GetHeight(id + 0.5 + x);          uv.x = fract(uv.x) - 0.5;     vec4 tree = createTree((uv - vec2(x, -y)) * vec2(1.0, 1.0 + n * 0.25), vec3(1.0), blur);          color = mix(color, tree, tree.a);     color.a = max(ground, tree.a);     return color; } float Hash21(vec2 point) {     point = fract(point * vec2(1462.34, 1026.75));     point += dot(point, point + 864.23);          return fract(point.x * point.y); } void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     // Normalized pixel coordinates (from 0 to 1)     // Move origin to the center     vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;     vec2 mouse = (iMouse.xy / iResolution.xy) * 2.0 - 1.0;     float time = iTime * 0.3;               //uv.x += iTime * 0.1;     //uv.y += 0.5;     //uv *= 5.0;          float blur = 0.005;          // Initialize color     vec4 color = vec4(0.0);     vec4 layer;          color *= 0.0;     float twinkle = dot(length(sin(uv + time)), length(cos(uv * vec2(22.0, 6.7) - time * 3.0)));     twinkle = sin(twinkle * 10.0) * 0.5 + 0.5 * 4.5;          float dawn = S(-0.75, 0.4, -uv.y);          float stars = pow(Hash21(uv), 60.0 * twinkle);     color += stars;     color.rgb -= vec3(0.5, 0.9, 0.1);     color += dawn;          //float moon = S(0.01, -0.01, length(uv + vec2(-0.65, -0.275)) - 0.1);     float moon = S(0.0075, -0.0035, length(uv - vec2(0.47, 0.29)) - 0.1);     moon *= S(-0.075, 0.005, length(uv - vec2(0.43, 0.325)) - 0.175);     color.rgb += vec3(0.6);     color += moon;          for (float i = 0.0; i < 1.0; i += 1.0 / 7.0) {         float scale = mix(10.0, 1.0, i);         blur = mix(0.02, 0.005, i);         layer = createLayer(uv * scale + vec2(time + i * 50.0, i) - mouse, blur);         layer.rgb *= (1.0 - i) * vec3(0.3, 0.5, 1.0) * 1.2;         color = mix(color, layer, layer.a);     }          layer = createLayer(uv + vec2(time , 1.0) - mouse, blur * 3.0);     color = mix(color, layer * 0.002, layer.a);          float thickness = 1.0 / iResolution.y;                    // See axes     //if (abs(uv.x) < thickness) { color.g = 1.0; }     //if (abs(uv.y) < thickness) { color.r = 1.0; }     // Output to screen     fragColor = color; } ```

WIN version: AOS4 version: ``` // Ether by nimitz 2014 (twitter: @stormoid) // https://www.shadertoy.com/view/MsjSW3 // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License // Contact the author for other licensing options #define t iTime mat2 m(float a){float c=cos(a), s=sin(a);return mat2(c,-s,s,c);} float map(vec3 p){     p.xz*= m(t*0.4);p.xy*= m(t*0.3);     vec3 q = p*2.+t;     return length(p+vec3(sin(t*0.7)))*log(length(p)+1.) + sin(q.x+sin(q.z+sin(q.y)))*0.5 - 1.; } void mainImage( out vec4 fragColor, in vec2 fragCoord ){         vec2 p = fragCoord.xy/iResolution.y - vec2(.9,.5);     vec3 cl = vec3(0.);     float d = 2.5;     for(int i=0; i<=5; i++)    {         vec3 p = vec3(0,0,5.) + normalize(vec3(p, -1.))*d;         float rz = map(p);         float f =  clamp((rz - map(p+.1))*0.5, -.1, 1. );         vec3 l = vec3(0.1,0.3,.4) + vec3(5., 2.5, 3.)*f;         cl = cl*l + smoothstep(2.5, .0, rz)*.7*l;         d += min(rz, 1.);     }     fragColor = vec4(cl, 1.); } ```

WIN version: AOS4 version: ``` vec4 rainbowDisk(vec2 o) {     // the underlying image     // source: https://www.shadertoy.com/view/XsSfW1 by Flyguy     o *= max(iResolution.x, iResolution.y);     o += .5 * iResolution.xy;     vec4 c;     vec2 r = iResolution.xy;     o = vec2(length(o -= r/2.) / r.y - .3, atan(o.y,o.x));         vec4 s = c.yzwx = .1*cos(1.6*vec4(0,1,2,3) + iTime + o.y + sin(o.y) * sin(iTime)*2.),     f = min(o.x-s, c-o.x);     return dot(40.*(s-c), clamp(f*r.y, 0., 1.)) * (s-.1) - f; } void mainImage( out vec4 fragColor, in vec2 fragCoord) {     float t = iTime;     t = mod(t, 30.);     float res = max(iResolution.x, iResolution.y);     float maxScale = res / 9.;     // zoom in and out     float scale = mix(         4.,  maxScale,         smoothstep(2., 15., t) - smoothstep(20., 30., t)     );     vec2 off = vec2(-.2, .1);     vec2 uv = scale * ((fragCoord - .5 * iResolution.xy) / res - off);     float pixel = scale / res;     vec2 pixeluv = fract(uv);     vec2 imguv = (floor(uv)) / maxScale + off;          vec3 colImg = rainbowDisk(imguv).rgb;     // make the loop seemless     colImg = mix(         // just something to pseudo random         fract(vec3(             sin(300.123 * imguv.x + 300.123 * imguv.y),             sin(100.521 * imguv.y - 250.2 * imguv.x),             0.4)),         colImg, smoothstep(0., .1, t) - smoothstep(29.9, 30., t));     colImg = clamp(colImg, .1, .9);     vec3 col = vec3(0.);     col.r = smoothstep(         pixel, 0.,         max(             pixeluv.y - colImg.r,             pixeluv.x - 0.3333333 + pixel         )     );     col.g = smoothstep(         pixel, 0.,         max(             pixeluv.y - colImg.g,             max(pixeluv.x - 0.666666 + pixel,                 0.333333 - pixeluv.x + pixel)         )     );     col.b = smoothstep(         pixel, 0.,         max(             pixeluv.y - colImg.b,             0.666 - pixeluv.x + pixel         )     );     col *= smoothstep(         0., 4. * pixel * smoothstep(10., 1., scale),         min(             min(pixeluv.y, 1. - pixeluv.y),             min(pixeluv.x, 1. - pixeluv.x)         )     );     fragColor = vec4(col, 1.0); } ```

WIN version: AOS4 version: ``` // Fork of "Menger2D" by EvilRyu. https://shadertoy.com/view/MldXz4 // 2020-05-23 02:26:38 // Created by evilryu // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. float s=0.95,a=0.006,scale=3.; float d_box(vec2 q){float d=max(abs(q.x+sin(iTime)*0.01),abs(q.y));return smoothstep(s,s+a,d)+smoothstep(s-a,s-a-a,d);} float d_sph(vec2 q,float s){float d=pow(pow(abs(q.x),3.0)+pow(abs(q.y),3.5),1./3.);return smoothstep(s,s+a,d)+smoothstep(s-a,s-a-a,d);} void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     vec2 q = (-iResolution.xy + 2.0*fragCoord)/iResolution.y;     vec3 col=vec3(1.0);//*d_box(q);     float iter = mod(floor(iTime),7.0);     for(int i=0;i<4;++i)     {         if(i<int(iter+0.5))         {             q=abs(q);             if(q.x>q.y)q.xy=q.yx;             s*=1.0/scale;             col*=d_sph(q,s*(1.+tan(iTime)));             q-=s*(scale-(1.+cos(iTime)));             if(q.x<-0.5*s*(scale-1.0))q.x+=s*(scale-(1.+sin(iTime)));         }         else         {             col*=d_sph(q,fract(iTime)*s/scale);         }     }     fragColor.xyz=col; } ```

WIN version: AOS4 version: ``` // based on https://www.shadertoy.com/view/lsf3RH by // trisomie21 (THANKS!) // My apologies for the ugly code. float snoise(vec3 uv, float res)    // by trisomie21 {     const vec3 s = vec3(1e0, 1e2, 1e4);          uv *= res;          vec3 uv0 = floor(mod(uv, res))*s;     vec3 uv1 = floor(mod(uv+vec3(1.), res))*s;          vec3 f = fract(uv); f = f*f*(3.0-2.0*f);          vec4 v = vec4(uv0.x+uv0.y+uv0.z, uv1.x+uv0.y+uv0.z,                     uv0.x+uv1.y+uv0.z, uv1.x+uv1.y+uv0.z);          vec4 r = fract(sin(v*1e-3)*1e5);     float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);          r = fract(sin((v + uv1.z - uv0.z)*1e-3)*1e5);     float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);          return mix(r0, r1, f.z)*2.-1.; } float freqs; void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     freqs = texture( iChannel1, vec2( 0.01, 0.25 ) ).x;     freqs = texture( iChannel1, vec2( 0.07, 0.25 ) ).x;     freqs = texture( iChannel1, vec2( 0.15, 0.25 ) ).x;     freqs = texture( iChannel1, vec2( 0.30, 0.25 ) ).x;     float brightness    = freqs * 0.25 + freqs * 0.25;     float radius        = 0.24 + brightness * 0.2;     float invRadius     = 1.0/radius;          vec3 orange            = vec3( 0.8, 0.65, 0.3 );     vec3 orangeRed        = vec3( 0.8, 0.35, 0.1 );     float time        = iTime * 0.1;     float aspect    = iResolution.x/iResolution.y;     vec2 uv            = fragCoord.xy / iResolution.xy;     vec2 p             = -0.5 + uv;     p.x *= aspect;     float fade        = pow( length( 2.0 * p ), 0.5 );     float fVal1        = 1.0 - fade;     float fVal2        = 1.0 - fade;          float angle        = atan( p.x, p.y )/6.2832;     float dist        = length(p);     vec3 coord        = vec3( angle, dist, time * 0.1 );          float newTime1    = abs( snoise( coord + vec3( 0.0, -time * ( 0.35 + brightness * 0.001 ), time * 0.015 ), 15.0 ) );     float newTime2    = abs( snoise( coord + vec3( 0.0, -time * ( 0.15 + brightness * 0.001 ), time * 0.015 ), 45.0 ) );         for( int i=1; i<=7; i++ ){         float power = pow( 2.0, float(i + 1) );         fVal1 += ( 0.5 / power ) * snoise( coord + vec3( 0.0, -time, time * 0.2 ), ( power * ( 10.0 ) * ( newTime1 + 1.0 ) ) );         fVal2 += ( 0.5 / power ) * snoise( coord + vec3( 0.0, -time, time * 0.2 ), ( power * ( 25.0 ) * ( newTime2 + 1.0 ) ) );     }          float corona        = pow( fVal1 * max( 1.1 - fade, 0.0 ), 2.0 ) * 50.0;     corona                += pow( fVal2 * max( 1.1 - fade, 0.0 ), 2.0 ) * 50.0;     corona                *= 1.2 - newTime1;     vec3 sphereNormal     = vec3( 0.0, 0.0, 1.0 );     vec3 dir             = vec3( 0.0 );     vec3 center            = vec3( 0.5, 0.5, 1.0 );     vec3 starSphere        = vec3( 0.0 );          vec2 sp = -1.0 + 2.0 * uv;     sp.x *= aspect;     sp *= ( 2.0 - brightness );       float r = dot(sp,sp);     float f = (1.0-sqrt(abs(1.0-r)))/(r) + brightness * 0.5;     if( dist < radius ){         corona            *= pow( dist * invRadius, 24.0 );           vec2 newUv;          newUv.x = sp.x*f;           newUv.y = sp.y*f;         newUv += vec2( time, 0.0 );                  vec3 texSample     = texture( iChannel0, newUv ).rgb;         float uOff        = ( texSample.g * brightness * 4.5 + time );         vec2 starUV        = newUv + vec2( uOff, 0.0 );         starSphere        = texture( iChannel0, starUV ).rgb;     }          float starGlow    = min( max( 1.0 - dist * ( 1.0 - brightness ), 0.0 ), 1.0 );     //fragColor.rgb    = vec3( r );     fragColor.rgb    = vec3( f * ( 0.75 + brightness * 0.3 ) * orange ) + starSphere + corona * orange + starGlow * orangeRed;     fragColor.a        = 1.0; } ```

WIN version: AOS4 version: As far as i can see, in all shaders background and color of some objects like swapped. At moment not sure wtf, but probably will be good idea to start from the smallest ones and trying to reduce it, like shader #2 and shader #4

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e
to me this looks like similar issues, I bet it's some register mess up in each case.
Btw.: I played a bit with the previous one.

``` // original statement which produces pixel garbage here if (d < .72+b && p.y > 0.0) ++i; // same semantic variants which work here if (d < .72+b) if(p.y > 0.0) ++i; if (d < .72+b) i+=(p.y > 0.0) ? 1 : 0; if (p.y > 0.0) i+=(d < .72+b) ? 1 : 0; i+=(d < .72+b) ? (p.y > 0.0) ? 1 : 0 : 0; ```

Edited by Daytona675x on 2020/5/30 18:40:24

@Daniel
Can be "&&" thing maybe ?

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e
I guess it's not a general "and" doesn't work but simply depends on situation, which register used when etc. After all an && in this case here will certainly result in two conditional branches, just like at least the 1st working variant. It's worthless to speculate more, if register allocation is messed up everything is possible.

@all
Found 4 more shaders , which we can hope share the same issue. At least i hope its the same issue, because it better to create one bug report with 8 shaders, than 8 bug reprots :)

So, there they are:

``` //width of lines #define _Width 0.05     //width of the borders of the lines #define _Border 0.003     //frequency of the noise #define _NoiseFreq 50.0 //strength of the noise #define _NoiseStr 0.01     //speed of the "simulation" #define _Speed 5.0 //portion of the time(from 0 to 1), that will be spent on "growing" the line //rest of the time will be spent "widening" the line #define _GT 0.5     float hash( float n ) {     n = mod(n, 691.564);     return fract(sin(n)*43758.5453); } float perlin(float x) {     float f = fract(x);     float i = floor(x);     return mix(hash(i), hash(i+1.0), smoothstep(0.0, 1.0, f)); } vec2 hash2( vec2 p ) {     p = mod(p, 132.5);     return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453); } float saturate(float x) {     return clamp(x, 0.0, 1.0); } float drawLine(inout vec2 uv, inout float draw, float i, float f) {     float grow = saturate(f/_GT);     float widen = saturate((f-_GT)/(1.0-_GT))*_Width;     vec2 norm = hash2(vec2(i, i*1.1))-0.5;     vec2 nnorm = normalize(norm);     uv -= norm;     uv = mat2x2(nnorm.x, nnorm.y, -nnorm.y, nnorm.x) * uv;     float per = (perlin((uv.y+i)*_NoiseFreq)-0.5)*_NoiseStr;     uv.x += per;     float tx = uv.x - (step(0.0, uv.x)-0.5)*widen;     float ans = draw*smoothstep(_Border+0.003, _Border, abs(tx))*step(uv.y, mix(-2.0, 2.0, grow));     draw = saturate(draw - step(2.0*abs(uv.x), widen));     uv.x = tx - per;     uv = mat2x2(nnorm.x, -nnorm.y, nnorm.y, nnorm.x) * uv;     uv += norm;     return ans; } void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     vec2 uv = fragCoord/iResolution.xy;     uv -= 0.5;     uv.x *= iResolution.x/iResolution.y;          float tim = (iTime)*_Speed;     float timei = floor(tim);     float timef = fract(tim);     float bord = 0.0;     float draw = 1.0;     bord += drawLine(uv, draw, timei, timef);     timei -= 1.0;     for(float i = 0.0; i < 500.0; i++) {         bord += drawLine(uv, draw, timei-i, 1.0);         if(draw < 0.5) break;     }          fragColor = vec4(bord, bord, bord, 1.0); } ```

WIN version: AOS4 version: ``` const float PI = 3.14159265358979; //Probably enough precision? const float TAU = 2.0 * PI; //Returns how much coord is within a circle centered at circle_pos. [0, 1] float circle(vec2 circle_pos, vec2 coord) {     float circ_rad = 70.0;     float circ_blur = 1.0;     float dist = distance(circle_pos, coord);     return smoothstep(circ_rad + circ_blur, circ_rad - circ_blur, dist);  } void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     vec4 black = vec4(0.0, 0.0, 0.0, 1.0);     vec4 white = vec4(1.0, 1.0, 1.0, 1.0);          vec2 center = iResolution.xy * vec2(0.5);     float t = iTime;     float d = 70.0*sin(t/PI); //Distance of each circle from the center. (Can be pos/neg)          const float MAX_CIRCLES = 9.0; //Max number of circles.     float num_circles = MAX_CIRCLES/2.0 + MAX_CIRCLES/2.0*cos(t/PI) + 0.01; //Current number of circles.     float circles = 0.0; //The total number of circles this pixel is in.          for (float f = 0.0; f < MAX_CIRCLES; f++) {         if (f < num_circles) { //Wish I could have non-const number of loop iterations :(             float ap = t + f/num_circles * TAU; //Angular position of each circle, [0, tau]             vec2 newCirclePos = center + d*vec2(cos(ap), sin(ap));             circles += circle(newCirclePos, fragCoord); //If this pixel is in the new circle, circles increases.         }     }          circles = (cos(circles*PI)+1.0)/2.0; //Smoothly interpolate between odd and even values.     fragColor = mix(black, white, circles); } ```

WIN version: AOS4 version: ``` void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     vec2 uv = fragCoord/iResolution.xy;     uv.x *= iResolution.x/iResolution.y;          vec3 col;     vec2 zuu;     float prof = 20.;          for(float i=prof; i>0. ;i--){         zuu.x = .5+cos(uv.x*(5.*i)+sin(iTime*1.2)*4.);         zuu.y = .5+cos(uv.y*(5.*i)+cos(iTime*1.6)*4.);         if (zuu.x >.5 ^^  zuu.y >.5){             col = vec3(1./i,1./i,1./i);         }     }     fragColor = vec4(col,1.0); } ```

WIN version: AOS4 version: ``` #define ANTI_ALIAS #define NUM_FACES 4 #define IN_RADIUS 0.25 #define OUT_RADIUS 0.70 #define SCROLL_SPEED -0.9 #define COLOR_1 0.50, 0.90, 0.95 #define COLOR_2 0.95, 0.60, 0.10 float tau = atan(1.0) * 8.0; float pi = atan(1.0) * 4.0; float aaSize = 0.0; vec4 slice(float x0, float x1, vec2 uv) {     float u = (uv.x - x0)/(x1 - x0);     float w = (x1 - x0);     vec3 col = vec3(0);          //Gradient     col = mix(vec3(COLOR_1), vec3(COLOR_2), u);          //Lighting      col *= w / sqrt(2.0 * IN_RADIUS*IN_RADIUS * (1.0 - cos(tau / float(NUM_FACES))));          //Edges     col *= smoothstep(0.05, 0.10, u) * smoothstep(0.95, 0.90, u) + 0.5;          //Checker board     uv.y += iTime * SCROLL_SPEED; //Scrolling          #ifdef ANTI_ALIAS         col *= (-1.0 + 2.0 * smoothstep(-0.03, 0.03, sin(u*pi*4.0) * cos(uv.y*16.0))) * (1.0/16.0) + 0.7;     #else         col *= sign(sin(u * pi * 4.0) * cos(uv.y * 16.0)) * (1.0/16.0) + 0.7;     #endif          float clip = 0.0;          #ifdef ANTI_ALIAS         clip = (1.0-smoothstep(0.5 - aaSize/w, 0.5 + aaSize/w, abs(u - 0.5))) * step(x0, x1);     #else         clip = float((u >= 0.0 && u <= 1.0) && (x0 < x1));     #endif          return vec4(col, clip); } void mainImage( out vec4 fragColor, in vec2 fragCoord ) {     aaSize = 2.0 / iResolution.y; //Scale anti aliasing with resolution     vec2 res = iResolution.xy / iResolution.y;     vec2 uv = fragCoord.xy / iResolution.y;     uv -= res / 2.0;     uv *= 2.0;          //Polar coordinates     vec2 uvr = vec2(length(uv), atan(uv.y, uv.x) + pi);     uvr.x -= OUT_RADIUS;          vec3 col = vec3(0.05);          //Twisting angle     float angle = uvr.y + 2.0*iTime + sin(uvr.y) * sin(iTime) * pi;          for(int i = 0;i < NUM_FACES;i++)     {         float x0 = IN_RADIUS * sin(angle + tau * (float(i) / float(NUM_FACES)));         float x1 = IN_RADIUS * sin(angle + tau * (float(i + 1) / float(NUM_FACES)));                  vec4 face = slice(x0, x1, uvr);                  col = mix(col, face.rgb, face.a);      }          //col = (abs(uv.x) > 1.0) ? vec3(1) : col;          fragColor = vec4(col, 1.0); } ```

WIN version: AOS4 version: Question is : is that the same issue everywhere, or they different ones ? Did anyone can see in code of whose 8 shaders something common maybe ? Just the more info we find, the faster/easy it will be to fix for Hans.

At least shaders 4,6 and 7 (those black and white swapped colors) looks very much the same issue at least visually, but it can be of course different issues, just by some luck it looks like swapped.

Edited by kas1e on 2020/6/2 11:23:50
_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e

Nova 1.68 notes:

Quote:

Bap: initializing vec3 col = vec3(0.0) seems to make it work. By default there are no layers at all.

@Capehill
Quote:

Bap: initializing vec3 col = vec3(0.0) seems to make it work. By default there are no layers at all.

Yeah, same on 1.71.

Is it mean that Nova need to deal with unitialized variables again ? Like, "vec3 col;" is unitialized, and optimizer fail to see that it used in the "if" later? But then, if should't work at all then, but it works. Just live vec3 have different value ?

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e

Quote:
Is it mean that Nova need to deal with unitialized variables again ? Like, "vec3 col;" is unitialized, and optimizer fail to see that it used in the "if" later? But then, if should't work at all then, but it works. Just live vec3 have different value ?

Not in the case of that shader. Try setting col = vec3(1.0) on Windows, and see what happens.

The shader is taking advantage of GLSL implementations zeroing uninitialized variables. section 5.9 of the GLSL spec (using version 4.50) says: Reading a variable before writing (or initializing) it is legal, however the value is undefined.

At present, I have no intention of setting uninitialized variables to 0. I'll consider it if too many programs need it.

Hans

_________________
http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more.
https://keasigmadelta.com/ - more of my work

@Hans

Oh, I missed the "if" totally.

It would be nice to get a warning from compiler about potentially uninitialized variables in cases like this.

@Hans
Quote:

Not in the case of that shader. Try setting col = vec3(1.0) on Windows, and see what happens.

With vec3(1.0) it the same on os4 and on win32 then : the same effect, with "white" color in. With vec3(0.0), all fine on both win32 and aos4, and with how it originally, we have that difference on os4.

I not sure what is it mean : that unitialized variables on win32 are always set to 0.0 but on os4 random values ?

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@All

``` // --- Fractal noise simulating heterogeneous density in galactic clouds // ---   -> help from Fabrice Neyret, https://www.shadertoy.com/user/FabriceNeyret2 // ---   -> noise functions from Inigo Quilez, https://www.shadertoy.com/view/XslGRr // Number of computed scales #define NbScales 22. // Id of the lowest displayed scale (debug) #define FirstScale 0. // Anti aliasing #define LimitDetails 2.5 #define SmoothZone 99. // Manual Zoom / Auto Zoom #define Anim 1 // Colormap #define ClampLevel 1. #define ZoomDistance 10. // Size of the first Perlin Noise grid (debug) #define FirstDivision 8. // 0 : multiplicative // 1 : additive #define Mode 0 #define GazConcentration 0. // Caracteristic ratio of the frequencies (0.5 for octaves) #define fRatio 0.0314 bool keyToggle(int ascii) {     return !(texture(iChannel2,vec2((.5+float(ascii))/128.,0.3751)).x > 0.); } // --- noise functions from https://www.shadertoy.com/view/XslGRr // Created by inigo quilez - iq/2013 // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. vec2 hash( vec2 p ) {                          // rand in [-1,1]     p = vec2( dot(p,vec2(128.1,311.7)),               dot(p,vec2(269.5,183.3)) );     return -1. + 2.*fract(sin(p+20.)*53758.5453123); } float noise( in vec2 p ) {     vec2 i = floor(p), f = fract(p);     vec2 u = f*f*(3.-2.*f);     return mix( mix( dot( hash( i + vec2(0.,0.) ), f - vec2(0.,0.) ),                       dot( hash( i + vec2(1.,0.) ), f - vec2(1.,0.) ), u.x),                 mix( dot( hash( i + vec2(0.,1.) ), f - vec2(0.,1.) ),                       dot( hash( i + vec2(1.,1.) ), f - vec2(1.,1.) ), u.x), u.y); } // ----------------------------------------------- vec3 colormap(float value) {     float maxv = ClampLevel;     vec3 c1,c2;     float t;     if (value < maxv / 3.) {         c1 = vec3(1.);          c2 = vec3(1., 1., .5);         t =  1./3.;     } else if (value < maxv * 2. / 3.) {         c1 = vec3(1., 1., .5); c2 = vec3(1., 0,  0.);         t =  2./3. ;     } else {         c1 = vec3(1., 0., 0.); c2 = vec3(0.);         t =  1.;     }     t = (t*maxv-value)/(maxv/3.);     return t*c1 + (1.-t)*c2; } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { // --------------------------------------          float t = iTime;          vec2 uv = fragCoord.xx/ iResolution.x;     float d = 1.; // initial density       #if Anim     float cycle = cos(mod(-t,100.)/100.*2.*3.14);     float n_tiles_level_1 = exp(cycle*cycle*ZoomDistance)*pow(2.,FirstDivision); #else     float n_tiles_level_1 = exp(iMouse.x/iResolution.x*ZoomDistance)*pow(2.,FirstDivision); #endif          // zoom and centering     uv = (uv - vec2(.9,.5))*n_tiles_level_1 + vec2(.9,.5);          float theta = 4.+.008*t; // some rotations, not necessary     mat2 m = fRatio*mat2( cos(theta),sin(theta),                       -sin(theta),cos(theta) );              // computation of the multiplicative noise     float q = 1.;     for (float i = 0.; i < NbScales; i++) {         if (d<1e-2) continue;                  // multiply the amplitude to maintain the total density         float c = (i+1.< NbScales) ? 2. : 1.;                  float nn = noise(uv + 10.7*i*i);         for (float j = 0.; j < GazConcentration; j++) {             nn = sin(nn*3.14159265359/2.);         }              #if Mode == 0         float n = c* 0.5*(1.+nn); #else         float n = nn; #endif                      // compute only the visible scales         float crit = n_tiles_level_1 *q - iResolution.x/LimitDetails;         if (crit < SmoothZone && i >= FirstScale) {             if (crit>0.) {  // avoid aliasing                 float t = crit/SmoothZone;                                 n = n*(1.-t); #if Mode == 0                 n += t; #endif             }              #if Mode == 0             d *= n; #else             d += n*(0.5); #endif                                               }              uv = m*uv; q*= fRatio; // go to the next octave     }          d = clamp(d,0.0,d);     fragColor.xyz = (keyToggle(67)) ? vec3(exp(-d)) :colormap(exp(-d)); } ```

WIN version: AOS4 version: I start to think, that it's all different bugs all the time. I.e. bug the same : wrong content in registers, and their wrong compare/use , and it didn't looks like some single particular issue. Just visually it looks pretty much the same like colors swapped, but it all can be different..

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@kas1e

Try:

fragColor.xyz = vec3(exp(-d));

Then try:

fragColor.xyz = colormap(exp(-d));

On Windows I get red colors when in colormap branch. I guess keyToggle function return different result on AmigaOS but didnt' really debug it yet.

keyToggle() is sampling iChannel2.

@Capehill
Quote:

keyToggle() is sampling iChannel2.

How interesting .. On the the page of that shader i didn't see that iChannel2 is used at all, but, if i start to set there different textures, then i also may have or white, or red colors , depends on texture.

Can it be that implementation of iChannel on our side, somehow different when it come to "iChannel used in the code, but not actually set". Maybe it again some sort of unitialized default values ?

_________________
zerohero's mirror of os4/os3 crosscompiler suites

@Capehill
Quote:
It would be nice to get a warning from compiler about potentially uninitialized variables in cases like this.

This behaviour is not just allowed but also not considered to be worth a warning. Nova is not buggy here, so I have to second Hans that there is no action to be taken. Yes, it would be nice but on the other hand it also will result in unnecessary warnings. And such a analysis is not trivial and not for free. After all there are very valid reasons - unlike in those broken shaders - not to initialize a variable right upon declaration.

@kas1e
Quote:
I not sure what is it mean : that unitialized variables on win32 are always set to 0.0 but on os4 random values ?

No, it's just that some (maybe even most, or even all, doesn't matter) Windows OpenGL drivers apparently set uninitialized variables to 0 even though the standard explicitly does not require it. Or to put it simple: the respective shaders are buggy, not Nova. Those shaders rely on something they simply must not rely on.
However, since real-life shaders often seem to falsely rely on this behaviour, maybe a Nova feature request for an init-vars-to-zero-toggle (default off like now) is a good compromise.

Quote:
Question is : is that the same issue everywhere, or they different ones ?

Novas register handling is still broken and therefore all sorts of fun can happen. You or I cannot say for sure which exact issue it is. We cannot even say for sure if it has to do with the register allocator, it's likely but we cannot be sure. Maybe it's a different bug with familiar looking symptoms. The thing is: with those Shaderjoy shaders it is natural that whatever is the problem results in pixels being falsely colored, simply because Shadertoy is all about pixel colors and nothing else ;)
Anyway, either create one bug-report named "All sorts of pixel garbage" and then extend it with more and more links to shadertoy-shaders - or create one report for each buggy shader, maybe with a not that you somewhat guess that it may be related to bug or report xyz. But don't try to be smart and to categorize further After all you are a reporter. It's Hans job to fix that stuff and it's also his job to analyse and eventually merge or split your bug reports.

Quote:
I start to think, that it's all different bugs all the time. I.e. bug the same : wrong content in registers, and their wrong compare/use , and it didn't looks like some single particular issue. Just visually it looks pretty much the same like colors swapped, but it all can be different.

IMHO a rewrite of the register allocator is due. From what I see things get fixed in lib release A only to reappear in a slightly different form or the fixes cause other problems as sideeffects. And then there is also the missing register spilling etc.
For the upcoming ogles2 lib version I threw away and rewrote the whole program introspection system Yes, certainly no fun but sometimes you have to admit to yourself that what you did before was no good and that a rewrite with a fresh head is the far better choice, instead of putting even more patchs on that old rag rug.
In my experience this always pays off.

@Daniel
Quote:

However, since real-life shaders often seem to falsely rely on this behaviour, maybe a Nova feature request for an init-vars-to-zero-toggle (default off like now) is a good compromise.

Imho also not worth , because it mean take manual actions. But then in just case, shader can be changed and that all. From another side, question is : can be unitialized variable set to 0 cause any issues in compare with being random as it now ? I mean, of course, shaders can be buggy and rely on undifened behaviours, but will setting unitialized value to 0 , cause any problems for any other possible shaders ? Imho no ? Then if no, why not have it the same just to cope with some buggy shaders ?:)

Quote:

But don't try to be smart and to categorize further After all you are a reporter. It's Hans job to fix that stuff and it's also his job to analyse and eventually merge or split your bug reports.

Indeed, just tring to help Hans to make less work :) But in end you (and Hans as well answer the same) seems right, it better to made reports for each shader differently. Just there currently :

30 shaders with wrong rendering (some with very little issues, some with major ones).

So in summ it mean about 50 bug-reports will be :)

Quote:

IMHO a rewrite of the register allocator is due. From what I see things get fixed in lib release A only to reappear in a slightly different form or the fixes cause other problems as sideeffects. And then there is also the missing register spilling etc.

There were some regression since 1.68 yes, and all probabaly indeed related to registers stuff which need rewriting with having in mind spiling as well.

Quote:

For the upcoming ogles2 lib version I threw away and rewrote the whole program introspection system

Is it that beta of 3.0 version which i had ? Because in that one remaining bugs of 2.11 were fixied, so if it just "proper rewrite" made it better in end, then yeah, that way to go.

_________________