From 744aea4918c0aa6c67e1633665de95e4dce965db Mon Sep 17 00:00:00 2001 From: hunterk Date: Tue, 9 Aug 2016 09:14:03 -0500 Subject: [PATCH] fix hqx shaders --- hqx/shader-files/pass1.slang | 8 ++++---- hqx/shader-files/pass2.inc | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/hqx/shader-files/pass1.slang b/hqx/shader-files/pass1.slang index 261ed47..5786f69 100644 --- a/hqx/shader-files/pass1.slang +++ b/hqx/shader-files/pass1.slang @@ -99,10 +99,10 @@ void main() vec3 w8 = yuv * texture(Source, t3.yw).rgb; vec3 w9 = yuv * texture(Source, t3.zw).rgb; - vec3 pattern_1 = vec3(diff(w5, w1), diff(w5, w4), diff(w5, w7)); - vec3 pattern_2 = vec3(diff(w5, w2), false, diff(w5, w8)); - vec3 pattern_3 = vec3(diff(w5, w3), diff(w5, w6), diff(w5, w9)); - vec4 cross = vec4(diff(w4, w2), diff(w2, w6), diff(w8, w4), diff(w6, w8)); + vec3 pattern_1 = vec3(diff(w5, w1), diff(w5, w2), diff(w5, w3)); + vec3 pattern_2 = vec3(diff(w5, w4), false, diff(w5, w6)); + vec3 pattern_3 = vec3(diff(w5, w7), diff(w5, w8), diff(w5, w9)); + vec4 cross = vec4(diff(w4, w2), diff(w2, w6), diff(w8, w4), diff(w6, w8)); vec2 index; index.x = dot(pattern_1, vec3(1, 2, 4)) + diff --git a/hqx/shader-files/pass2.inc b/hqx/shader-files/pass2.inc index 7523f61..9b51eec 100644 --- a/hqx/shader-files/pass2.inc +++ b/hqx/shader-files/pass2.inc @@ -36,7 +36,7 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D LUT; -layout(set = 0, binding = 4) uniform samlper2D Original; +layout(set = 0, binding = 4) uniform sampler2D Original; void main() { @@ -50,7 +50,11 @@ void main() vec3 p2 = texture(Original, vTexCoord + vec2(dx, dy) * quad).rgb; vec3 p3 = texture(Original, vTexCoord + vec2(dx, 0.0) * quad).rgb; vec3 p4 = texture(Original, vTexCoord + vec2(0.0, dy) * quad).rgb; - mat3x4 pixels = mat3x4(p1, p2, p3, p4); + vec3 pixels[4]; + pixels[0] = p1.xyz; + pixels[1] = p2.xyz; + pixels[2] = p3.xyz; + pixels[3] = p4.xyz; vec2 index = texture(Source, vTexCoord).xy * vec2(255.0, 15.0 * (SCALE * SCALE)); index.y += dot(floor(fp * SCALE), vec2(1.0, SCALE)); @@ -59,7 +63,11 @@ void main() vec2 offset = step / 2.0; vec4 weights = texture(LUT, index * step + offset); float sum = dot(weights, vec4(1.0)); - vec3 res = transpose(pixels) * (weights / sum); + vec4 tmp = vec4(float((weights/sum).x), float((weights/sum).y), float((weights/sum).z), float((weights/sum).w)); + vec3 res = tmp.x * pixels[0]; + res = res + tmp.y * pixels[1]; + res = res + tmp.z * pixels[2]; + res = res + tmp.w * pixels[3]; - FragColor = vec4(res, 1.0); + FragColor = vec4(res.xyz, 1.0); }