remove recursive dot macro

This commit is contained in:
hunterk 2019-01-20 22:36:53 -06:00
parent 983375531b
commit f5317ee1a3
2 changed files with 8 additions and 8 deletions

View file

@ -26,7 +26,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
mat4 MVP; mat4 MVP;
} global; } global;
#define dot(x,y) clamp(dot(x,y), 0.0, 1.0) // NVIDIA Fix #define dotfix(x,y) clamp(dot(x,y), 0.0, 1.0) // NVIDIA Fix
#define TEX(dx,dy) texture(Source, vTexCoord+vec2((dx),(dy))*t1).xyz #define TEX(dx,dy) texture(Source, vTexCoord+vec2((dx),(dy))*t1).xyz
// Reference: http://www.compuphase.com/cmetric.htm // Reference: http://www.compuphase.com/cmetric.htm
@ -71,8 +71,8 @@ void main()
tag = ((L == R) && (C != L)) ? 1.0 : 0.0; tag = ((L == R) && (C != L)) ? 1.0 : 0.0;
} }
else{ else{
tag = dot(normalize(C-L), normalize(C-R)) * eq(L,R); tag = dotfix(normalize(C-L), normalize(C-R)) * eq(L,R);
} }
FragColor = vec4(C, tag); FragColor = vec4(C, tag);
} }

View file

@ -26,7 +26,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
mat4 MVP; mat4 MVP;
} global; } global;
#define dot(x,y) clamp(dot(x,y), 0.0, 1.0) // NVIDIA Fix #define dotfix(x,y) clamp(dot(x,y), 0.0, 1.0) // NVIDIA Fix
#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)
// Reference: http://www.compuphase.com/cmetric.htm // Reference: http://www.compuphase.com/cmetric.htm
@ -85,10 +85,10 @@ void main()
else{ else{
vec3 dCL = normalize(C-L), dCR = normalize(C-R), dCD = normalize(C-D), dCU = normalize(C-U); vec3 dCL = normalize(C-L), dCR = normalize(C-R), dCD = normalize(C-D), dCU = normalize(C-U);
res.x = dot(dCL, dCR) * eq(L,R); res.x = dotfix(dCL, dCR) * eq(L,R);
res.y = dot(dCU, dCD) * eq(U,D); res.y = dotfix(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, dotfix(dCL, dCU) * eq(L,U), dotfix(dCL, dCD) * eq(L,D), dotfix(dCR, dCU) * eq(R,U), dotfix(dCR, dCD) * eq(R,D));
} }
FragColor = vec4(res, 1.0); FragColor = vec4(res, 1.0);
} }