From f5317ee1a3801c47bd3613567fc1f4c4b4103034 Mon Sep 17 00:00:00 2001 From: hunterk Date: Sun, 20 Jan 2019 22:36:53 -0600 Subject: [PATCH] remove recursive dot macro --- dithering/shaders/gdapt/gdapt-pass0.slang | 6 +++--- dithering/shaders/mdapt/passes/mdapt-pass0.slang | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dithering/shaders/gdapt/gdapt-pass0.slang b/dithering/shaders/gdapt/gdapt-pass0.slang index 8e70145..f452f32 100644 --- a/dithering/shaders/gdapt/gdapt-pass0.slang +++ b/dithering/shaders/gdapt/gdapt-pass0.slang @@ -26,7 +26,7 @@ layout(std140, set = 0, binding = 0) uniform UBO mat4 MVP; } 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 // Reference: http://www.compuphase.com/cmetric.htm @@ -71,8 +71,8 @@ void main() tag = ((L == R) && (C != L)) ? 1.0 : 0.0; } 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); -} \ No newline at end of file +} diff --git a/dithering/shaders/mdapt/passes/mdapt-pass0.slang b/dithering/shaders/mdapt/passes/mdapt-pass0.slang index 6b0f43b..2c40cc2 100644 --- a/dithering/shaders/mdapt/passes/mdapt-pass0.slang +++ b/dithering/shaders/mdapt/passes/mdapt-pass0.slang @@ -26,7 +26,7 @@ layout(std140, set = 0, binding = 0) uniform UBO mat4 MVP; } 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) // Reference: http://www.compuphase.com/cmetric.htm @@ -85,10 +85,10 @@ void main() else{ 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.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.x = dotfix(dCL, dCR) * eq(L,R); + res.y = dotfix(dCU, dCD) * eq(U,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); -} \ No newline at end of file +}