Browse Source
[vk, ogl] VK_QCOM ZTC, Bspline, Mitchell filter weights
[vk, ogl] VK_QCOM ZTC, Bspline, Mitchell filter weights
Signed-off-by: lizzie <lizzie@eden-emu.dev>pull/2577/head
No known key found for this signature in database
GPG Key ID: 287378CADCAB13
18 changed files with 226 additions and 58 deletions
-
6src/android/app/src/main/res/values/arrays.xml
-
3src/android/app/src/main/res/values/strings.xml
-
2src/common/settings_enums.h
-
3src/qt_common/shared_translation.cpp
-
3src/qt_common/shared_translation.h
-
3src/video_core/host_shaders/CMakeLists.txt
-
69src/video_core/host_shaders/present_bicubic.frag
-
35src/video_core/host_shaders/present_bspline.frag
-
35src/video_core/host_shaders/present_mitchell.frag
-
35src/video_core/host_shaders/present_zero_tangent.frag
-
10src/video_core/renderer_opengl/gl_blit_screen.cpp
-
18src/video_core/renderer_opengl/present/filters.cpp
-
3src/video_core/renderer_opengl/present/filters.h
-
30src/video_core/renderer_vulkan/present/filters.cpp
-
2src/video_core/renderer_vulkan/present/filters.h
-
13src/video_core/renderer_vulkan/present/util.cpp
-
2src/video_core/renderer_vulkan/present/util.h
-
12src/video_core/renderer_vulkan/vk_blit_screen.cpp
@ -1,56 +1,35 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#version 460 core |
|||
|
|||
|
|||
layout (location = 0) in vec2 frag_tex_coord; |
|||
|
|||
layout (location = 0) out vec4 color; |
|||
|
|||
layout (binding = 0) uniform sampler2D color_texture; |
|||
|
|||
vec4 cubic(float v) { |
|||
vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; |
|||
vec4 s = n * n * n; |
|||
float x = s.x; |
|||
float y = s.y - 4.0 * s.x; |
|||
float z = s.z - 4.0 * s.y + 6.0 * s.x; |
|||
float w = 6.0 - x - y - z; |
|||
return vec4(x, y, z, w) * (1.0 / 6.0); |
|||
vec4 cubic(float x) { |
|||
float x2 = x * x; |
|||
float x3 = x2 * x; |
|||
return vec4(1.0, x, x2, x3) * transpose(mat4x4( |
|||
0.0, 2.0, 0.0, 0.0, |
|||
-1.0, 0.0, 1.0, 0.0, |
|||
2.0, -5.0, 4.0, -1.0, |
|||
-1.0, 3.0, -3.0, 1.0 |
|||
) * (1.0 / 2.0)); |
|||
} |
|||
|
|||
vec4 textureBicubic( sampler2D textureSampler, vec2 texCoords ) { |
|||
|
|||
vec2 texSize = textureSize(textureSampler, 0); |
|||
vec2 invTexSize = 1.0 / texSize; |
|||
|
|||
texCoords = texCoords * texSize - 0.5; |
|||
|
|||
vec2 fxy = fract(texCoords); |
|||
texCoords -= fxy; |
|||
|
|||
vec4 xcubic = cubic(fxy.x); |
|||
vec4 ycubic = cubic(fxy.y); |
|||
|
|||
vec4 c = texCoords.xxyy + vec2(-0.5, +1.5).xyxy; |
|||
|
|||
vec4 s = vec4(xcubic.xz + xcubic.yw, ycubic.xz + ycubic.yw); |
|||
vec4 offset = c + vec4(xcubic.yw, ycubic.yw) / s; |
|||
|
|||
offset *= invTexSize.xxyy; |
|||
|
|||
vec4 sample0 = texture(textureSampler, offset.xz); |
|||
vec4 sample1 = texture(textureSampler, offset.yz); |
|||
vec4 sample2 = texture(textureSampler, offset.xw); |
|||
vec4 sample3 = texture(textureSampler, offset.yw); |
|||
|
|||
float sx = s.x / (s.x + s.y); |
|||
float sy = s.z / (s.z + s.w); |
|||
|
|||
return mix(mix(sample3, sample2, sx), mix(sample1, sample0, sx), sy); |
|||
vec4 textureBicubic(sampler2D samp, vec2 uv) { |
|||
vec2 tex_size = vec2(textureSize(samp, 0)); |
|||
vec2 cc_tex = uv * tex_size - 0.5f; |
|||
vec2 fex = cc_tex - floor(cc_tex); |
|||
vec4 xcubic = cubic(fex.x); |
|||
vec4 ycubic = cubic(fex.y); |
|||
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy; |
|||
vec4 z = vec4(xcubic.yw, ycubic.yw); |
|||
vec4 s = vec4(xcubic.xz, ycubic.xz) + z; |
|||
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy; |
|||
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w)); |
|||
return mix( |
|||
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x), |
|||
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x), |
|||
n.y); |
|||
} |
|||
|
|||
void main() { |
|||
color = textureBicubic(color_texture, frag_tex_coord); |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
#version 460 core |
|||
layout (location = 0) in vec2 frag_tex_coord; |
|||
layout (location = 0) out vec4 color; |
|||
layout (binding = 0) uniform sampler2D color_texture; |
|||
vec4 cubic(float x) { |
|||
float x2 = x * x; |
|||
float x3 = x2 * x; |
|||
return vec4(1.0, x, x2, x3) * transpose(mat4x4( |
|||
1.0, 4.0, 1.0, 0.0, |
|||
-3.0, 0.0, 3.0, 0.0, |
|||
3.0, -6.0, 3.0, 0.0, |
|||
-1.0, 3.0, -3.0, 1.0 |
|||
) * (1.0 / 6.0)); |
|||
} |
|||
vec4 textureBicubic(sampler2D samp, vec2 uv) { |
|||
vec2 tex_size = vec2(textureSize(samp, 0)); |
|||
vec2 cc_tex = uv * tex_size - 0.5f; |
|||
vec2 fex = cc_tex - floor(cc_tex); |
|||
vec4 xcubic = cubic(fex.x); |
|||
vec4 ycubic = cubic(fex.y); |
|||
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy; |
|||
vec4 z = vec4(xcubic.yw, ycubic.yw); |
|||
vec4 s = vec4(xcubic.xz, ycubic.xz) + z; |
|||
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy; |
|||
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w)); |
|||
return mix( |
|||
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x), |
|||
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x), |
|||
n.y); |
|||
} |
|||
void main() { |
|||
color = textureBicubic(color_texture, frag_tex_coord); |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
#version 460 core |
|||
layout (location = 0) in vec2 frag_tex_coord; |
|||
layout (location = 0) out vec4 color; |
|||
layout (binding = 0) uniform sampler2D color_texture; |
|||
vec4 cubic(float x) { |
|||
float x2 = x * x; |
|||
float x3 = x2 * x; |
|||
return vec4(1.0, x, x2, x3) * transpose(mat4x4( |
|||
1.0, 16.0, 1.0, 0.0, |
|||
-9.0, 0.0, 9.0, 0.0, |
|||
15.0, -36.0, 27.0, -6.0, |
|||
-7.0, 21.0, -21.0, 7.0 |
|||
) * (1.0 / 18.0)); |
|||
} |
|||
vec4 textureBicubic(sampler2D samp, vec2 uv) { |
|||
vec2 tex_size = vec2(textureSize(samp, 0)); |
|||
vec2 cc_tex = uv * tex_size - 0.5f; |
|||
vec2 fex = cc_tex - floor(cc_tex); |
|||
vec4 xcubic = cubic(fex.x); |
|||
vec4 ycubic = cubic(fex.y); |
|||
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy; |
|||
vec4 z = vec4(xcubic.yw, ycubic.yw); |
|||
vec4 s = vec4(xcubic.xz, ycubic.xz) + z; |
|||
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy; |
|||
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w)); |
|||
return mix( |
|||
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x), |
|||
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x), |
|||
n.y); |
|||
} |
|||
void main() { |
|||
color = textureBicubic(color_texture, frag_tex_coord); |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
#version 460 core |
|||
layout (location = 0) in vec2 frag_tex_coord; |
|||
layout (location = 0) out vec4 color; |
|||
layout (binding = 0) uniform sampler2D color_texture; |
|||
vec4 cubic(float x) { |
|||
float x2 = x * x; |
|||
float x3 = x2 * x; |
|||
return vec4(1.0, x, x2, x3) * transpose(mat4x4( |
|||
0.0, 2.0, 0.0, 0.0, |
|||
-2.0, 0.0, 2.0, 0.0, |
|||
4.0, -4.0, 2.0, -2.0, |
|||
-2.0, 2.0, -2.0, 1.0 |
|||
) * (1.0 / 2.0)); |
|||
} |
|||
vec4 textureBicubic(sampler2D samp, vec2 uv) { |
|||
vec2 tex_size = vec2(textureSize(samp, 0)); |
|||
vec2 cc_tex = uv * tex_size - 0.5f; |
|||
vec2 fex = cc_tex - floor(cc_tex); |
|||
vec4 xcubic = cubic(fex.x); |
|||
vec4 ycubic = cubic(fex.y); |
|||
vec4 c = floor(cc_tex).xxyy + vec2(-0.5f, 1.5f).xyxy; |
|||
vec4 z = vec4(xcubic.yw, ycubic.yw); |
|||
vec4 s = vec4(xcubic.xz, ycubic.xz) + z; |
|||
vec4 offset = (c + z / s) * (1.0f / tex_size).xxyy; |
|||
vec2 n = vec2(s.x / (s.x + s.y), s.z / (s.z + s.w)); |
|||
return mix( |
|||
mix(texture(samp, offset.yw), texture(samp, offset.xw), n.x), |
|||
mix(texture(samp, offset.yz), texture(samp, offset.xz), n.x), |
|||
n.y); |
|||
} |
|||
void main() { |
|||
color = textureBicubic(color_texture, frag_tex_coord); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue