committed by
crueter
12 changed files with 248 additions and 12 deletions
-
4src/video_core/host_shaders/CMakeLists.txt
-
33src/video_core/host_shaders/convert_abgr8_to_r8.frag
-
19src/video_core/host_shaders/convert_b10gr11f_to_abgr8.frag
-
17src/video_core/host_shaders/convert_bgra8_to_s8d24.frag
-
24src/video_core/host_shaders/convert_r8_to_abgr8.frag
-
72src/video_core/renderer_vulkan/blit_image.cpp
-
18src/video_core/renderer_vulkan/blit_image.h
-
8src/video_core/renderer_vulkan/vk_rasterizer.cpp
-
24src/video_core/renderer_vulkan/vk_texture_cache.cpp
-
32src/video_core/surface.cpp
-
2src/video_core/surface.h
-
7src/video_core/texture_cache/texture_cache.h
@ -0,0 +1,33 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#version 450 |
|||
|
|||
layout(binding = 0) uniform sampler2D tex; |
|||
|
|||
layout(location = 0) out float color; |
|||
|
|||
/* |
|||
The idea here is copy each byte of one texture to another independently of the format |
|||
because is an incompatible copy |
|||
*/ |
|||
void main() { |
|||
//Origin has 4 bytes per pixel |
|||
float xPixelCoord = gl_FragCoord.x / 4; |
|||
vec4 pixel = texelFetch(tex, ivec2(xPixelCoord, gl_FragCoord.y), 0); |
|||
//Yuzu calls it abgr8 but the the order is rgba, dunno if is LSB or MSB |
|||
switch(int(gl_FragCoord.x) % 4) { |
|||
case 0: |
|||
color = pixel.r; |
|||
break; |
|||
case 1: |
|||
color = pixel.g; |
|||
break; |
|||
case 2: |
|||
color = pixel.b; |
|||
break; |
|||
case 3: |
|||
color = pixel.a; |
|||
break; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#version 450 |
|||
|
|||
layout(binding = 0) uniform sampler2D tex; |
|||
|
|||
layout(push_constant) uniform PushConstants { |
|||
uniform vec2 tex_scale; |
|||
uniform vec2 tex_offset; |
|||
}; |
|||
|
|||
layout(location = 0) out vec4 color; |
|||
|
|||
void main() { |
|||
vec2 coord = gl_FragCoord.xy / tex_scale * textureSize(tex, 0); |
|||
vec4 fetch = texelFetch(tex, ivec2(coord), 0); |
|||
color = vec4(fetch.rgb, 1.0); |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#version 450 |
|||
#extension GL_ARB_shader_stencil_export : require |
|||
|
|||
layout(binding = 0) uniform sampler2D color_texture; |
|||
|
|||
void main() { |
|||
ivec2 coord = ivec2(gl_FragCoord.xy); |
|||
uvec4 color = uvec4(texelFetch(color_texture, coord, 0).bgra * (exp2(8) - 1.0f)); |
|||
uvec4 bytes = color << uvec4(24, 16, 8, 0); |
|||
uint depth_stencil_unorm = bytes.x | bytes.y | bytes.z | bytes.w; |
|||
|
|||
gl_FragDepth = float(depth_stencil_unorm >> 24) / (exp2(24.0) - 1.0f); |
|||
gl_FragStencilRefARB = int(depth_stencil_unorm & 0x00FFFFFFu); |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#version 450 |
|||
|
|||
layout(binding = 0) uniform sampler2D tex; |
|||
|
|||
layout(location = 0) out vec4 color; |
|||
|
|||
/* |
|||
The idea here is copy each byte of one texture to another independently of the format |
|||
because is an incompatible copy |
|||
*/ |
|||
void main() { |
|||
//Destination has 4 bytes per pixel so 4 pixel on origin makes 1 pixel in dest |
|||
float xPixelCoord = gl_FragCoord.x * 4; |
|||
//Yuzu calls it abgr8 but the the order is rgba, dunno if is LSB or MSB |
|||
color = vec4( |
|||
texelFetch(tex, ivec2(xPixelCoord, gl_FragCoord.y), 0).r, |
|||
texelFetch(tex, ivec2(xPixelCoord + 1, gl_FragCoord.y), 0).r, |
|||
texelFetch(tex, ivec2(xPixelCoord + 2, gl_FragCoord.y), 0).r, |
|||
texelFetch(tex, ivec2(xPixelCoord + 3, gl_FragCoord.y), 0).r |
|||
); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue