12 changed files with 136 additions and 14 deletions
-
2src/video_core/host_shaders/CMakeLists.txt
-
30src/video_core/host_shaders/convert_msaa_to_non_msaa.comp
-
29src/video_core/host_shaders/convert_non_msaa_to_msaa.comp
-
8src/video_core/renderer_opengl/gl_texture_cache.cpp
-
9src/video_core/renderer_opengl/gl_texture_cache.h
-
33src/video_core/renderer_opengl/util_shaders.cpp
-
5src/video_core/renderer_opengl/util_shaders.h
-
5src/video_core/renderer_vulkan/vk_texture_cache.cpp
-
7src/video_core/renderer_vulkan/vk_texture_cache.h
-
3src/video_core/texture_cache/formatter.cpp
-
14src/video_core/texture_cache/texture_cache.h
-
5src/video_core/texture_cache/util.cpp
@ -0,0 +1,30 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
|
||||
|
#version 450 core |
||||
|
layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; |
||||
|
|
||||
|
layout (binding = 0, rgba8) uniform readonly restrict image2DMSArray msaa_in; |
||||
|
layout (binding = 1, rgba8) uniform writeonly restrict image2DArray output_img; |
||||
|
|
||||
|
void main() { |
||||
|
const ivec3 coords = ivec3(gl_GlobalInvocationID); |
||||
|
if (any(greaterThanEqual(coords, imageSize(msaa_in)))) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// TODO: Specialization constants for num_samples? |
||||
|
const int num_samples = imageSamples(msaa_in); |
||||
|
for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { |
||||
|
const vec4 pixel = imageLoad(msaa_in, coords, curr_sample); |
||||
|
|
||||
|
const int single_sample_x = 2 * coords.x + (curr_sample & 1); |
||||
|
const int single_sample_y = 2 * coords.y + ((curr_sample / 2) & 1); |
||||
|
const ivec3 dest_coords = ivec3(single_sample_x, single_sample_y, coords.z); |
||||
|
|
||||
|
if (any(greaterThanEqual(dest_coords, imageSize(output_img)))) { |
||||
|
continue; |
||||
|
} |
||||
|
imageStore(output_img, dest_coords, pixel); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
|
||||
|
#version 450 core |
||||
|
layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; |
||||
|
|
||||
|
layout (binding = 0, rgba8) uniform readonly restrict image2DArray img_in; |
||||
|
layout (binding = 1, rgba8) uniform writeonly restrict image2DMSArray output_msaa; |
||||
|
|
||||
|
void main() { |
||||
|
const ivec3 coords = ivec3(gl_GlobalInvocationID); |
||||
|
if (any(greaterThanEqual(coords, imageSize(output_msaa)))) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
// TODO: Specialization constants for num_samples? |
||||
|
const int num_samples = imageSamples(output_msaa); |
||||
|
for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { |
||||
|
const int single_sample_x = 2 * coords.x + (curr_sample & 1); |
||||
|
const int single_sample_y = 2 * coords.y + ((curr_sample / 2) & 1); |
||||
|
const ivec3 single_coords = ivec3(single_sample_x, single_sample_y, coords.z); |
||||
|
|
||||
|
if (any(greaterThanEqual(single_coords, imageSize(img_in)))) { |
||||
|
continue; |
||||
|
} |
||||
|
const vec4 pixel = imageLoad(img_in, single_coords); |
||||
|
imageStore(output_msaa, coords, curr_sample, pixel); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue