mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
fix(mdapt): Rename and + or functions for SPIRV-Cross compatibility
This commit is contained in:
parent
5ad108c3fc
commit
56e41a5383
|
@ -40,7 +40,7 @@ float eq(vec3 A, vec3 B)
|
||||||
return pow( smoothstep(3.0, 0.0, sqrt(diff.x + diff.y + diff.z)), params.PWR );
|
return pow( smoothstep(3.0, 0.0, sqrt(diff.x + diff.y + diff.z)), params.PWR );
|
||||||
}
|
}
|
||||||
|
|
||||||
float and(float a, float b, float c, float d, float e, float f){
|
float and_(float a, float b, float c, float d, float e, float f){
|
||||||
return min(a, min(b, min(c, min(d, min(e,f)))));
|
return min(a, min(b, min(c, min(d, min(e,f)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void main()
|
||||||
|
|
||||||
res.x = dot(dCL, dCR) * eq(L,R);
|
res.x = dot(dCL, dCR) * eq(L,R);
|
||||||
res.y = dot(dCU, dCD) * eq(U,D);
|
res.y = dot(dCU, dCD) * eq(U,D);
|
||||||
res.z = and(res.x, res.y, dot(dCL, dCU) * eq(L,U), dot(dCL, dCD) * eq(L,D), dot(dCR, dCU) * eq(R,U), dot(dCR, dCD) * eq(R,D));
|
res.z = and_(res.x, res.y, dot(dCL, dCU) * eq(L,U), dot(dCL, dCD) * eq(L,D), dot(dCR, dCU) * eq(R,U), dot(dCR, dCD) * eq(R,D));
|
||||||
}
|
}
|
||||||
|
|
||||||
FragColor = vec4(res, 1.0);
|
FragColor = vec4(res, 1.0);
|
||||||
|
|
|
@ -19,19 +19,19 @@ layout(push_constant) uniform Push
|
||||||
#define TEX(dx,dy) texture(Source, vTexCoord+vec2((dx),(dy))*params.SourceSize.zw)
|
#define TEX(dx,dy) texture(Source, vTexCoord+vec2((dx),(dy))*params.SourceSize.zw)
|
||||||
|
|
||||||
|
|
||||||
float and(float a, float b){
|
float and_(float a, float b){
|
||||||
return min(a,b);
|
return min(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float and(float a, float b, float c){
|
float and_(float a, float b, float c){
|
||||||
return min(a, min(b,c));
|
return min(a, min(b,c));
|
||||||
}
|
}
|
||||||
|
|
||||||
float or(float a, float b){
|
float or_(float a, float b){
|
||||||
return max(a,b);
|
return max(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float or(float a, float b, float c, float d, float e){
|
float or_(float a, float b, float c, float d, float e){
|
||||||
return max(a, max(b, max(c, max(d,e))));
|
return max(a, max(b, max(c, max(d,e))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ void main()
|
||||||
float DR = TEX( 1., 1.).z;
|
float DR = TEX( 1., 1.).z;
|
||||||
|
|
||||||
// Checkerboard Pattern Completion
|
// Checkerboard Pattern Completion
|
||||||
float prCB = or(C.z,
|
float prCB = or_(C.z,
|
||||||
and(L.z, R.z, or(U.x, D.x)),
|
and_(L.z, R.z, or_(U.x, D.x)),
|
||||||
and(U.z, D.z, or(L.y, R.y)),
|
and_(U.z, D.z, or_(L.y, R.y)),
|
||||||
and(C.x, or(and(UL, UR), and(DL, DR))),
|
and_(C.x, or_(and_(UL, UR), and_(DL, DR))),
|
||||||
and(C.y, or(and(UL, DL), and(UR, DR))));
|
and_(C.y, or_(and_(UL, DL), and_(UR, DR))));
|
||||||
FragColor = vec4(C.x, prCB, 0.0, 0.0);
|
FragColor = vec4(C.x, prCB, 0.0, 0.0);
|
||||||
}
|
}
|
|
@ -28,23 +28,23 @@ bool eq(vec3 A, vec3 B){
|
||||||
return (A == B);
|
return (A == B);
|
||||||
}
|
}
|
||||||
|
|
||||||
float and(float a, float b){
|
float and_(float a, float b){
|
||||||
return min(a,b);
|
return min(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float or(float a, float b, float c, float d, float e, float f, float g, float h, float i){
|
float or_(float a, float b, float c, float d, float e, float f, float g, float h, float i){
|
||||||
return max(a, max(b, max(c, max(d, max(e, max(f, max(g, max(h,i))))))));
|
return max(a, max(b, max(c, max(d, max(e, max(f, max(g, max(h,i))))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 and(vec2 a, vec2 b){
|
vec2 and_(vec2 a, vec2 b){
|
||||||
return min(a,b);
|
return min(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 or(vec2 a, vec2 b){
|
vec2 or_(vec2 a, vec2 b){
|
||||||
return max(a,b);
|
return max(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 or(vec2 a, vec2 b, vec2 c, vec2 d){
|
vec2 or_(vec2 a, vec2 b, vec2 c, vec2 d){
|
||||||
return max(a, max(b, max(c,d)));
|
return max(a, max(b, max(c,d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,10 +84,10 @@ void main()
|
||||||
float DR = TEX( 1., 1.).y; vec3 dr = TEXt0( 1., 1.).xyz;
|
float DR = TEX( 1., 1.).y; vec3 dr = TEXt0( 1., 1.).xyz;
|
||||||
|
|
||||||
// Backpropagation
|
// Backpropagation
|
||||||
C.xy = or(C.xy, and(C.zw, or(L, R, U, D)));
|
C.xy = or_(C.xy, and_(C.zw, or_(L, R, U, D)));
|
||||||
|
|
||||||
// Checkerboard Smoothing
|
// Checkerboard Smoothing
|
||||||
C.y = or(C.y, min(U.y, float(eq(c,u))), min(D.y, float(eq(c,d))), min(L.y, float(eq(c,l))), min(R.y, float(eq(c,r))), min(UL, float(eq(c,ul))), min(UR, float(eq(c,ur))), min(DL, float(eq(c,dl))), min(DR, float(eq(c,dr))));
|
C.y = or_(C.y, min(U.y, float(eq(c,u))), min(D.y, float(eq(c,d))), min(L.y, float(eq(c,l))), min(R.y, float(eq(c,r))), min(UL, float(eq(c,ul))), min(UR, float(eq(c,ur))), min(DL, float(eq(c,dl))), min(DR, float(eq(c,dr))));
|
||||||
|
|
||||||
FragColor = vec4(C);
|
FragColor = vec4(C);
|
||||||
}
|
}
|
|
@ -64,27 +64,27 @@ bool eq(vec3 A, vec3 B){
|
||||||
return (A == B);
|
return (A == B);
|
||||||
}
|
}
|
||||||
|
|
||||||
float and(float a, float b){
|
float and_(float a, float b){
|
||||||
return min(a,b);
|
return min(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float or(float a, float b){
|
float or_(float a, float b){
|
||||||
return max(a,b);
|
return max(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float or(float a, float b, float c, float d, float e, float f, float g, float h, float i){
|
float or_(float a, float b, float c, float d, float e, float f, float g, float h, float i){
|
||||||
return max(a, max(b, max(c, max(d, max(e, max(f, max(g, max(h,i))))))));
|
return max(a, max(b, max(c, max(d, max(e, max(f, max(g, max(h,i))))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 and(vec2 a, vec2 b){
|
vec2 and_(vec2 a, vec2 b){
|
||||||
return min(a,b);
|
return min(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 or(vec2 a, vec2 b){
|
vec2 or_(vec2 a, vec2 b){
|
||||||
return max(a,b);
|
return max(a,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 or(vec2 a, vec2 b, vec2 c, vec2 d){
|
vec2 or_(vec2 a, vec2 b, vec2 c, vec2 d){
|
||||||
return max(a, max(b, max(c,d)));
|
return max(a, max(b, max(c,d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void main()
|
||||||
|
|
||||||
|
|
||||||
// Backpropagation
|
// Backpropagation
|
||||||
C.xy = or(C.xy, and(C.zw, or(L.xy, R.xy, U.xy, D.xy)));
|
C.xy = or_(C.xy, and_(C.zw, or_(L.xy, R.xy, U.xy, D.xy)));
|
||||||
|
|
||||||
|
|
||||||
if(params.VL > 0.5){
|
if(params.VL > 0.5){
|
||||||
|
@ -130,10 +130,10 @@ void main()
|
||||||
float eqCU = float(eq(c,u));
|
float eqCU = float(eq(c,u));
|
||||||
float eqCD = float(eq(c,d));
|
float eqCD = float(eq(c,d));
|
||||||
|
|
||||||
float prU = or(U.y, eqCU);
|
float prU = or_(U.y, eqCU);
|
||||||
float prD = or(D.y, eqCD);
|
float prD = or_(D.y, eqCD);
|
||||||
float prL = or(L.y, eqCL);
|
float prL = or_(L.y, eqCL);
|
||||||
float prR = or(R.y, eqCR);
|
float prR = or_(R.y, eqCR);
|
||||||
|
|
||||||
|
|
||||||
float prSum = prU + prD + prL + prR;
|
float prSum = prU + prD + prL + prR;
|
||||||
|
@ -151,7 +151,7 @@ void main()
|
||||||
float DR = TEX( 1., 1.).y; vec3 dr = TEXt0( 1., 1.).xyz;
|
float DR = TEX( 1., 1.).y; vec3 dr = TEXt0( 1., 1.).xyz;
|
||||||
|
|
||||||
// Checkerboard Smoothing
|
// Checkerboard Smoothing
|
||||||
prCB = or(C.y, and(L.y, eqCL), and(R.y, eqCR), and(U.y, eqCU), and(D.y, eqCD), and(UL, float(eq(c,ul))), and(UR, float(eq(c,ur))), and(DL, float(eq(c,dl))), and(DR, float(eq(c,dr))));
|
prCB = or_(C.y, and_(L.y, eqCL), and_(R.y, eqCR), and_(U.y, eqCU), and_(D.y, eqCD), and_(UL, float(eq(c,ul))), and_(UR, float(eq(c,ur))), and_(DL, float(eq(c,dl))), and_(DR, float(eq(c,dr))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params.DEBUG > 0.5)
|
if(params.DEBUG > 0.5)
|
||||||
|
|
Loading…
Reference in a new issue