mirror of https://github.com/stenzek/duckstation
GPU/TextureCache: Add texture scaling feature
parent
c21ea3c85b
commit
de77b764a7
@ -0,0 +1,124 @@
|
||||
#version 460 core
|
||||
|
||||
// EPX.glc
|
||||
// Copyright 2020 Morgan McGuire & Mara Gagiu,
|
||||
// provided under the Open Source MIT license https://opensource.org/licenses/MIT
|
||||
|
||||
// Implementation of Eric Johnston and Andrea Mazzoleni's
|
||||
// EPX aka Scale2X algorithm based on https://www.scale2x.it/algorithm
|
||||
|
||||
#define ABGR8 uint
|
||||
|
||||
UNIFORM_BLOCK_LAYOUT uniform UBOBlock {
|
||||
ivec2 src_size;
|
||||
ivec2 dst_size;
|
||||
};
|
||||
|
||||
TEXTURE_LAYOUT(0) uniform sampler2D samp0;
|
||||
IMAGE_LAYOUT(0, rgba8) uniform restrict writeonly image2D dst_image;
|
||||
|
||||
ABGR8 src(int x, int y) {
|
||||
return packUnorm4x8(texelFetch(samp0, ivec2(x, y), 0));
|
||||
}
|
||||
|
||||
void dst(int x, int y, ABGR8 value) {
|
||||
imageStore(dst_image, ivec2(x, y), unpackUnorm4x8(value));
|
||||
}
|
||||
|
||||
uint luma(ABGR8 C) {
|
||||
uint alpha = (C & 0xFF000000u) >> 24;
|
||||
return (((C & 0x00FF0000u) >> 16) + ((C & 0x0000FF00u) >> 8) + (C & 0x000000FFu) + 1u) * (256u - alpha);
|
||||
}
|
||||
|
||||
bool all_eq2(ABGR8 B, ABGR8 A0, ABGR8 A1) {
|
||||
return ((B ^ A0) | (B ^ A1)) == 0u;
|
||||
}
|
||||
|
||||
bool all_eq3(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2) {
|
||||
return ((B ^ A0) | (B ^ A1) | (B ^ A2)) == 0u;
|
||||
}
|
||||
|
||||
bool all_eq4(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2, ABGR8 A3) {
|
||||
return ((B ^ A0) | (B ^ A1) | (B ^ A2) | (B ^ A3)) == 0u;
|
||||
}
|
||||
|
||||
bool any_eq3(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2) {
|
||||
return B == A0 || B == A1 || B == A2;
|
||||
}
|
||||
|
||||
bool none_eq2(ABGR8 B, ABGR8 A0, ABGR8 A1) {
|
||||
return (B != A0) && (B != A1);
|
||||
}
|
||||
|
||||
bool none_eq4(ABGR8 B, ABGR8 A0, ABGR8 A1, ABGR8 A2, ABGR8 A3) {
|
||||
return B != A0 && B != A1 && B != A2 && B != A3;
|
||||
}
|
||||
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
void main () {
|
||||
// EPX first falls back to Nearest Neighbour
|
||||
int srcX = int(gl_GlobalInvocationID.x);
|
||||
int srcY = int(gl_GlobalInvocationID.y);
|
||||
if (srcX >= src_size.x || srcY >= src_size.y)
|
||||
return;
|
||||
|
||||
ABGR8 A = src(srcX - 1, srcY - 1), B = src(srcX, srcY - 1), C = src(srcX + 1, srcY - 1);
|
||||
ABGR8 D = src(srcX - 1, srcY + 0), E = src(srcX, srcY + 0), F = src(srcX + 1, srcY + 0);
|
||||
ABGR8 G = src(srcX - 1, srcY + 1), H = src(srcX, srcY + 1), I = src(srcX + 1, srcY + 1);
|
||||
|
||||
ABGR8 J = E, K = E, L = E, M = E;
|
||||
|
||||
if (((A ^ E) | (B ^ E) | (C ^ E) | (D ^ E) | (F ^ E) | (G ^ E) | (H ^ E) | (I ^ E)) != 0u) {
|
||||
ABGR8 P = src(srcX, srcY - 2), S = src(srcX, srcY + 2);
|
||||
ABGR8 Q = src(srcX - 2, srcY), R = src(srcX + 2, srcY);
|
||||
ABGR8 Bl = luma(B), Dl = luma(D), El = luma(E), Fl = luma(F), Hl = luma(H);
|
||||
|
||||
// 1:1 slope rules
|
||||
if ((D == B && D != H && D != F) && (El >= Dl || E == A) && any_eq3(E, A, C, G) && ((El < Dl) || A != D || E != P || E != Q)) J = D;
|
||||
if ((B == F && B != D && B != H) && (El >= Bl || E == C) && any_eq3(E, A, C, I) && ((El < Bl) || C != B || E != P || E != R)) K = B;
|
||||
if ((H == D && H != F && H != B) && (El >= Hl || E == G) && any_eq3(E, A, G, I) && ((El < Hl) || G != H || E != S || E != Q)) L = H;
|
||||
if ((F == H && F != B && F != D) && (El >= Fl || E == I) && any_eq3(E, C, G, I) && ((El < Fl) || I != H || E != R || E != S)) M = F;
|
||||
|
||||
// Intersection rules
|
||||
if ((E != F && all_eq4(E, C, I, D, Q) && all_eq2(F, B, H)) && (F != src(srcX + 3, srcY))) K = M = F;
|
||||
if ((E != D && all_eq4(E, A, G, F, R) && all_eq2(D, B, H)) && (D != src(srcX - 3, srcY))) J = L = D;
|
||||
if ((E != H && all_eq4(E, G, I, B, P) && all_eq2(H, D, F)) && (H != src(srcX, srcY + 3))) L = M = H;
|
||||
if ((E != B && all_eq4(E, A, C, H, S) && all_eq2(B, D, F)) && (B != src(srcX, srcY - 3))) J = K = B;
|
||||
if (Bl < El && all_eq4(E, G, H, I, S) && none_eq4(E, A, D, C, F)) J = K = B;
|
||||
if (Hl < El && all_eq4(E, A, B, C, P) && none_eq4(E, D, G, I, F)) L = M = H;
|
||||
if (Fl < El && all_eq4(E, A, D, G, Q) && none_eq4(E, B, C, I, H)) K = M = F;
|
||||
if (Dl < El && all_eq4(E, C, F, I, R) && none_eq4(E, B, A, G, H)) J = L = D;
|
||||
|
||||
// 2:1 slope rules
|
||||
if (H != B) {
|
||||
if (H != A && H != E && H != C) {
|
||||
if (all_eq3(H, G, F, R) && none_eq2(H, D, src(srcX + 2, srcY - 1))) L = M;
|
||||
if (all_eq3(H, I, D, Q) && none_eq2(H, F, src(srcX - 2, srcY - 1))) M = L;
|
||||
}
|
||||
|
||||
if (B != I && B != G && B != E) {
|
||||
if (all_eq3(B, A, F, R) && none_eq2(B, D, src(srcX + 2, srcY + 1))) J = K;
|
||||
if (all_eq3(B, C, D, Q) && none_eq2(B, F, src(srcX - 2, srcY + 1))) K = J;
|
||||
}
|
||||
} // H !== B
|
||||
|
||||
if (F != D) {
|
||||
if (D != I && D != E && D != C) {
|
||||
if (all_eq3(D, A, H, S) && none_eq2(D, B, src(srcX + 1, srcY + 2))) J = L;
|
||||
if (all_eq3(D, G, B, P) && none_eq2(D, H, src(srcX + 1, srcY - 2))) L = J;
|
||||
}
|
||||
|
||||
if (F != E && F != A && F != G) {
|
||||
if (all_eq3(F, C, H, S) && none_eq2(F, B, src(srcX - 1, srcY + 2))) K = M;
|
||||
if (all_eq3(F, I, B, P) && none_eq2(F, H, src(srcX - 1, srcY - 2))) M = K;
|
||||
}
|
||||
} // F !== D
|
||||
} // not constant
|
||||
|
||||
// Write four pixels at once
|
||||
dst(srcX * 2, srcY * 2, J);
|
||||
dst(srcX * 2 + 1, srcY * 2, K);
|
||||
dst(srcX * 2, srcY * 2 + 1, L);
|
||||
dst(srcX * 2 + 1, srcY * 2 + 1, M);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
#version 460 core
|
||||
|
||||
// EPX.glc
|
||||
// Copyright 2020 Morgan McGuire & Mara Gagiu,
|
||||
// provided under the Open Source MIT license https://opensource.org/licenses/MIT
|
||||
|
||||
// Implementation of Eric Johnston and Andrea Mazzoleni's
|
||||
// EPX aka Scale2X algorithm based on https://www.scale2x.it/algorithm
|
||||
|
||||
#define ABGR8 uint
|
||||
|
||||
UNIFORM_BLOCK_LAYOUT uniform UBOBlock {
|
||||
ivec2 src_size;
|
||||
ivec2 dst_size;
|
||||
};
|
||||
|
||||
TEXTURE_LAYOUT(0) uniform sampler2D samp0;
|
||||
IMAGE_LAYOUT(0, rgba8) uniform restrict writeonly image2D dst_image;
|
||||
|
||||
ABGR8 src(int x, int y) {
|
||||
return packUnorm4x8(texelFetch(samp0, ivec2(x, y), 0));
|
||||
}
|
||||
|
||||
void dst(int x, int y, ABGR8 value) {
|
||||
imageStore(dst_image, ivec2(x, y), unpackUnorm4x8(value));
|
||||
}
|
||||
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
void main () {
|
||||
// EPX first falls back to Nearest Neighbour
|
||||
int srcX = int(gl_GlobalInvocationID.x);
|
||||
int srcY = int(gl_GlobalInvocationID.y);
|
||||
if (srcX >= src_size.x || srcY >= src_size.y)
|
||||
return;
|
||||
|
||||
ABGR8 E = src(srcX, srcY);
|
||||
ABGR8 J = E, K = E, L = E, M = E;
|
||||
|
||||
ABGR8 B = src(srcX + 0, srcY - 1);
|
||||
ABGR8 D = src(srcX - 1, srcY + 0);
|
||||
ABGR8 F = src(srcX + 1, srcY + 0);
|
||||
ABGR8 H = src(srcX + 0, srcY + 1);
|
||||
|
||||
if (D == B && B != F && D != H) J = D;
|
||||
if (B == F && D != F && H != F) K = F;
|
||||
if (H == D && F != D && B != D) L = D;
|
||||
if (H == F && D != H && B != F) M = F;
|
||||
|
||||
// Write four pixels at once
|
||||
dst(srcX * 2, srcY * 2, J);
|
||||
dst(srcX * 2 + 1, srcY * 2, K);
|
||||
dst(srcX * 2, srcY * 2 + 1, L);
|
||||
dst(srcX * 2 + 1, srcY * 2 + 1, M);
|
||||
}
|
@ -0,0 +1,248 @@
|
||||
#version 460 core
|
||||
|
||||
layout(location = 0) in VertexData {
|
||||
vec2 v_tex0;
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 dest;
|
||||
|
||||
TEXTURE_LAYOUT(0) uniform sampler2D samp0;
|
||||
|
||||
vec4 SrcGet(vec2 uv)
|
||||
{
|
||||
return texelFetch(samp0, ivec2(uv), 0);
|
||||
}
|
||||
|
||||
// XBR.pix
|
||||
// Copyright 2020 Morgan McGuire & Mara Gagiu,
|
||||
// provided under the Open Source MIT license https://opensource.org/licenses/MIT
|
||||
|
||||
#define XBR_Y_WEIGHT 48.0
|
||||
#define XBR_EQ_THRESHOLD 15.0
|
||||
#define XBR_LV1_COEFFICIENT 0.5
|
||||
#define XBR_LV2_COEFFICIENT 2.0
|
||||
// END PARAMETERS //
|
||||
|
||||
|
||||
// XBR GLSL implementation source:
|
||||
// https://github.com/libretro/glsl-shaders/blob/master/xbr/shaders/xbr-lv2.glsl
|
||||
/*
|
||||
Hyllian's xBR-lv2 Shader
|
||||
Copyright (C) 2011-2015 Hyllian - sergiogdb@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Incorporates some of the ideas from SABR shader. Thanks to Joshua Street.
|
||||
|
||||
*/
|
||||
|
||||
// Uncomment just one of the three params below to choose the corner detection
|
||||
#define CORNER_A
|
||||
//#define CORNER_B
|
||||
//#define CORNER_C
|
||||
//#define CORNER_D
|
||||
|
||||
#ifndef CORNER_A
|
||||
#define SMOOTH_TIPS
|
||||
#endif
|
||||
|
||||
#define XBR_SCALE 2.0
|
||||
#define lv2_cf XBR_LV2_COEFFICIENT
|
||||
//=================================================================================
|
||||
// XBR Helper Functions
|
||||
//=================================================================================
|
||||
const float coef = 2.0;
|
||||
const vec3 rgbw = vec3(14.352, 28.176, 5.472);
|
||||
const vec4 eq_threshold = vec4(15.0, 15.0, 15.0, 15.0);
|
||||
|
||||
const vec4 delta = vec4(1.0/XBR_SCALE, 1.0/XBR_SCALE, 1.0/XBR_SCALE, 1.0/XBR_SCALE);
|
||||
const vec4 delta_l = vec4(0.5/XBR_SCALE, 1.0/XBR_SCALE, 0.5/XBR_SCALE, 1.0/XBR_SCALE);
|
||||
const vec4 delta_u = delta_l.yxwz;
|
||||
|
||||
const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 );
|
||||
const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 );
|
||||
const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 );
|
||||
const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 );
|
||||
const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 );
|
||||
const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 );
|
||||
const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 );
|
||||
const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 );
|
||||
const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 );
|
||||
const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25);
|
||||
|
||||
// Difference between vector components.
|
||||
vec4 df(vec4 A, vec4 B)
|
||||
{
|
||||
return vec4(abs(A-B));
|
||||
}
|
||||
|
||||
// Compare two vectors and return their components are different.
|
||||
vec4 diff(vec4 A, vec4 B)
|
||||
{
|
||||
return vec4(notEqual(A, B));
|
||||
}
|
||||
|
||||
// Determine if two vector components are equal based on a threshold.
|
||||
vec4 eq(vec4 A, vec4 B)
|
||||
{
|
||||
return (step(df(A, B), vec4(XBR_EQ_THRESHOLD)));
|
||||
}
|
||||
|
||||
// Determine if two vector components are NOT equal based on a threshold.
|
||||
vec4 neq(vec4 A, vec4 B)
|
||||
{
|
||||
return (vec4(1.0, 1.0, 1.0, 1.0) - eq(A, B));
|
||||
}
|
||||
|
||||
// Weighted distance.
|
||||
vec4 wd(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h)
|
||||
{
|
||||
return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h));
|
||||
}
|
||||
|
||||
float c_df(vec3 c1, vec3 c2)
|
||||
{
|
||||
vec3 df = abs(c1 - c2);
|
||||
return df.r + df.g + df.b;
|
||||
}
|
||||
|
||||
vec4 XBR()
|
||||
{
|
||||
vec4 proxy_dest = vec4(0, 0, 0, 1);
|
||||
ivec2 tex_fetch_coords = ivec2(gl_FragCoord.xy / 2.0);
|
||||
ivec2 tex_coords = ivec2(gl_FragCoord.xy);
|
||||
|
||||
|
||||
|
||||
vec4 edri, edr, edr_l, edr_u, px; // px = pixel, edr = edge detection rule
|
||||
vec4 irlv0, irlv1, irlv2l, irlv2u, block_3d;
|
||||
vec4 fx, fx_l, fx_u; // inequations of straight lines.
|
||||
|
||||
vec2 fp = fract(gl_FragCoord.xy / 2.0);
|
||||
|
||||
vec3 A1 = SrcGet(tex_fetch_coords + ivec2(-1, -2)).xyz;
|
||||
vec3 B1 = SrcGet(tex_fetch_coords + ivec2( 0, -2)).xyz;
|
||||
vec3 C1 = SrcGet(tex_fetch_coords + ivec2(+1, -2)).xyz;
|
||||
vec3 A = SrcGet(tex_fetch_coords + ivec2(-1, -1)).xyz;
|
||||
vec3 B = SrcGet(tex_fetch_coords + ivec2( 0, -1)).xyz;
|
||||
vec3 C = SrcGet(tex_fetch_coords + ivec2(+1, -1)).xyz;
|
||||
vec3 D = SrcGet(tex_fetch_coords + ivec2(-1, 0)).xyz;
|
||||
vec4 Eo = SrcGet(tex_fetch_coords);
|
||||
vec3 E = Eo.xyz;
|
||||
vec3 F = SrcGet(tex_fetch_coords + ivec2(+1, 0)).xyz;
|
||||
vec3 G = SrcGet(tex_fetch_coords + ivec2(-1, +1)).xyz;
|
||||
vec3 H = SrcGet(tex_fetch_coords + ivec2( 0, +1)).xyz;
|
||||
vec3 I = SrcGet(tex_fetch_coords + ivec2(+1, +1)).xyz;
|
||||
vec3 G5 = SrcGet(tex_fetch_coords + ivec2(-1, +2)).xyz;
|
||||
vec3 H5 = SrcGet(tex_fetch_coords + ivec2( 0, +2) ).xyz;
|
||||
vec3 I5 = SrcGet(tex_fetch_coords + ivec2(+1, +2)).xyz;
|
||||
vec3 A0 = SrcGet(tex_fetch_coords + ivec2(-2, -1)).xyz;
|
||||
vec3 D0 = SrcGet(tex_fetch_coords + ivec2(-2, 0)).xyz;
|
||||
vec3 G0 = SrcGet(tex_fetch_coords + ivec2(-2, +1)).xyz;
|
||||
vec3 C4 = SrcGet(tex_fetch_coords + ivec2(+2, -1)).xyz;
|
||||
vec3 F4 = SrcGet(tex_fetch_coords + ivec2(+2, 0)).xyz;
|
||||
vec3 I4 = SrcGet(tex_fetch_coords + ivec2(+2, +1)).xyz;
|
||||
|
||||
vec4 b = vec4(dot(B ,rgbw), dot(D ,rgbw), dot(H ,rgbw), dot(F ,rgbw));
|
||||
vec4 c = vec4(dot(C ,rgbw), dot(A ,rgbw), dot(G ,rgbw), dot(I ,rgbw));
|
||||
vec4 d = b.yzwx;
|
||||
vec4 e = vec4(dot(E,rgbw));
|
||||
vec4 f = b.wxyz;
|
||||
vec4 g = c.zwxy;
|
||||
vec4 h = b.zwxy;
|
||||
vec4 i = c.wxyz;
|
||||
vec4 i4 = vec4(dot(I4,rgbw), dot(C1,rgbw), dot(A0,rgbw), dot(G5,rgbw));
|
||||
vec4 i5 = vec4(dot(I5,rgbw), dot(C4,rgbw), dot(A1,rgbw), dot(G0,rgbw));
|
||||
vec4 h5 = vec4(dot(H5,rgbw), dot(F4,rgbw), dot(B1,rgbw), dot(D0,rgbw));
|
||||
vec4 f4 = h5.yzwx;
|
||||
|
||||
// These inequations define the line below which interpolation occurs.
|
||||
fx = (Ao*fp.y+Bo*fp.x);
|
||||
fx_l = (Ax*fp.y+Bx*fp.x);
|
||||
fx_u = (Ay*fp.y+By*fp.x);
|
||||
|
||||
irlv1 = irlv0 = diff(e,f) * diff(e,h);
|
||||
|
||||
#ifdef CORNER_B
|
||||
|
||||
// E1/K case (X odd, Y even)
|
||||
irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) );
|
||||
|
||||
#endif
|
||||
#ifdef CORNER_D
|
||||
|
||||
// E3/M case (X odd, Y odd)
|
||||
vec4 c1 = i4.yzwx;
|
||||
vec4 g0 = i5.wxyz;
|
||||
irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) * (diff(f,f4) * diff(f,i) + diff(h,h5) * diff(h,i) + diff(h,g) + diff(f,c) + eq(b,c1) * eq(d,g0)));
|
||||
|
||||
#endif
|
||||
#ifdef CORNER_C
|
||||
|
||||
irlv1 = (irlv0 * ( neq(f,b) * neq(f,c) + neq(h,d) * neq(h,g) + eq(e,i) * (neq(f,f4) * neq(f,i4) + neq(h,h5) * neq(h,i5)) + eq(e,g) + eq(e,c)) );
|
||||
|
||||
#endif
|
||||
|
||||
irlv2l = diff(e,g) * diff(d,g);
|
||||
irlv2u = diff(e,c) * diff(b,c);
|
||||
|
||||
vec4 fx45i = clamp((fx + delta -Co - Ci)/(2.0*delta ), 0.0, 1.0);
|
||||
vec4 fx45 = clamp((fx + delta -Co )/(2.0*delta ), 0.0, 1.0);
|
||||
vec4 fx30 = clamp((fx_l + delta_l -Cx )/(2.0*delta_l), 0.0, 1.0);
|
||||
vec4 fx60 = clamp((fx_u + delta_u -Cy )/(2.0*delta_u), 0.0, 1.0);
|
||||
|
||||
vec4 wd1 = wd( e, c, g, i, h5, f4, h, f);
|
||||
vec4 wd2 = wd( h, d, i5, f, i4, b, e, i);
|
||||
|
||||
edri = step(wd1, wd2) * irlv0;
|
||||
edr = step(wd1 + vec4(0.1, 0.1, 0.1, 0.1), wd2) * step(vec4(0.5, 0.5, 0.5, 0.5), irlv1);
|
||||
edr_l = step( lv2_cf*df(f,g), df(h,c) ) * irlv2l * edr;
|
||||
edr_u = step( lv2_cf*df(h,c), df(f,g) ) * irlv2u * edr;
|
||||
|
||||
fx45 = edr * fx45;
|
||||
fx30 = edr_l * fx30;
|
||||
fx60 = edr_u * fx60;
|
||||
fx45i = edri * fx45i;
|
||||
|
||||
px = step(df(e,f), df(e,h));
|
||||
|
||||
#ifdef SMOOTH_TIPS
|
||||
//vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i));
|
||||
#endif
|
||||
#ifndef SMOOTH_TIPS
|
||||
vec4 maximos = max(max(fx30, fx60), fx45);
|
||||
#endif
|
||||
|
||||
vec3 res1 = E;
|
||||
res1 = mix(res1, mix(H, F, px.x), maximos.x);
|
||||
res1 = mix(res1, mix(B, D, px.z), maximos.z);
|
||||
|
||||
vec3 res2 = E;
|
||||
res2 = mix(res2, mix(F, B, px.y), maximos.y);
|
||||
res2 = mix(res2, mix(D, H, px.w), maximos.w);
|
||||
|
||||
vec3 res = mix(res1, res2, step(c_df(E, res1), c_df(E, res2)));
|
||||
|
||||
proxy_dest.rgb = res;
|
||||
proxy_dest.a = Eo.a;
|
||||
return proxy_dest;
|
||||
}
|
||||
|
||||
void main () {
|
||||
dest = XBR();
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#version 460 core
|
||||
|
||||
layout(location = 0) out VertexData {
|
||||
vec2 v_tex0;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
v_tex0 = vec2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2u));
|
||||
gl_Position = vec4(v_tex0 * vec2(2.0f, -2.0f) + vec2(-1.0f, 1.0f), 0.0f, 1.0f);
|
||||
#if API_OPENGL || API_OPENGL_ES || API_VULKAN
|
||||
gl_Position.y = -gl_Position.y;
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue