diff options
author | bunnei <bunneidev@gmail.com> | 2023-02-12 09:18:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-12 09:18:52 +0100 |
commit | f70fcdb873f768403af37622fbc195433b3605ef (patch) | |
tree | b1fbe289c78b39bde41e7a895d8e172d4f3a1927 /src/video_core/host_shaders/convert_msaa_to_non_msaa.comp | |
parent | Merge pull request #9781 from ColinKinloch/info_id_typo (diff) | |
parent | texture_cache: OpenGL: Implement MSAA uploads and copies (diff) | |
download | yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar.gz yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar.bz2 yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar.lz yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar.xz yuzu-f70fcdb873f768403af37622fbc195433b3605ef.tar.zst yuzu-f70fcdb873f768403af37622fbc195433b3605ef.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/host_shaders/convert_msaa_to_non_msaa.comp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/convert_msaa_to_non_msaa.comp b/src/video_core/host_shaders/convert_msaa_to_non_msaa.comp new file mode 100644 index 000000000..fc3854d18 --- /dev/null +++ b/src/video_core/host_shaders/convert_msaa_to_non_msaa.comp @@ -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); + } +} |