diff options
| author | 2023-09-23 11:25:24 +0300 | |
|---|---|---|
| committer | 2023-09-25 09:20:32 -0400 | |
| commit | b60013b27764c4aa75125a5d8159f27a58bedf6c (patch) | |
| tree | df3e2dadd6fee709483da4dc7cb30b83a4403e7e | |
| parent | renderer_vulkan: Implement MSAA copies (diff) | |
| download | yuzu-b60013b27764c4aa75125a5d8159f27a58bedf6c.tar.gz yuzu-b60013b27764c4aa75125a5d8159f27a58bedf6c.tar.xz yuzu-b60013b27764c4aa75125a5d8159f27a58bedf6c.zip | |
host_shaders: More proper handling of x2 MSAA copies
| -rw-r--r-- | src/video_core/host_shaders/convert_msaa_to_non_msaa.comp | 7 | ||||
| -rw-r--r-- | src/video_core/host_shaders/convert_non_msaa_to_msaa.comp | 7 |
2 files changed, 10 insertions, 4 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 index fc3854d18..66f2ad483 100644 --- a/src/video_core/host_shaders/convert_msaa_to_non_msaa.comp +++ b/src/video_core/host_shaders/convert_msaa_to_non_msaa.comp | |||
| @@ -15,11 +15,14 @@ void main() { | |||
| 15 | 15 | ||
| 16 | // TODO: Specialization constants for num_samples? | 16 | // TODO: Specialization constants for num_samples? |
| 17 | const int num_samples = imageSamples(msaa_in); | 17 | const int num_samples = imageSamples(msaa_in); |
| 18 | const ivec3 msaa_size = imageSize(msaa_in); | ||
| 19 | const ivec3 out_size = imageSize(output_img); | ||
| 20 | const ivec3 scale = out_size / msaa_size; | ||
| 18 | for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { | 21 | for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { |
| 19 | const vec4 pixel = imageLoad(msaa_in, coords, curr_sample); | 22 | const vec4 pixel = imageLoad(msaa_in, coords, curr_sample); |
| 20 | 23 | ||
| 21 | const int single_sample_x = 2 * coords.x + (curr_sample & 1); | 24 | const int single_sample_x = scale.x * coords.x + (curr_sample & 1); |
| 22 | const int single_sample_y = 2 * coords.y + ((curr_sample / 2) & 1); | 25 | const int single_sample_y = scale.y * coords.y + ((curr_sample / 2) & 1); |
| 23 | const ivec3 dest_coords = ivec3(single_sample_x, single_sample_y, coords.z); | 26 | const ivec3 dest_coords = ivec3(single_sample_x, single_sample_y, coords.z); |
| 24 | 27 | ||
| 25 | if (any(greaterThanEqual(dest_coords, imageSize(output_img)))) { | 28 | if (any(greaterThanEqual(dest_coords, imageSize(output_img)))) { |
diff --git a/src/video_core/host_shaders/convert_non_msaa_to_msaa.comp b/src/video_core/host_shaders/convert_non_msaa_to_msaa.comp index dedd962f1..c7ce38efa 100644 --- a/src/video_core/host_shaders/convert_non_msaa_to_msaa.comp +++ b/src/video_core/host_shaders/convert_non_msaa_to_msaa.comp | |||
| @@ -15,9 +15,12 @@ void main() { | |||
| 15 | 15 | ||
| 16 | // TODO: Specialization constants for num_samples? | 16 | // TODO: Specialization constants for num_samples? |
| 17 | const int num_samples = imageSamples(output_msaa); | 17 | const int num_samples = imageSamples(output_msaa); |
| 18 | const ivec3 msaa_size = imageSize(output_msaa); | ||
| 19 | const ivec3 out_size = imageSize(img_in); | ||
| 20 | const ivec3 scale = out_size / msaa_size; | ||
| 18 | for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { | 21 | for (int curr_sample = 0; curr_sample < num_samples; ++curr_sample) { |
| 19 | const int single_sample_x = 2 * coords.x + (curr_sample & 1); | 22 | const int single_sample_x = scale.x * coords.x + (curr_sample & 1); |
| 20 | const int single_sample_y = 2 * coords.y + ((curr_sample / 2) & 1); | 23 | const int single_sample_y = scale.y * coords.y + ((curr_sample / 2) & 1); |
| 21 | const ivec3 single_coords = ivec3(single_sample_x, single_sample_y, coords.z); | 24 | const ivec3 single_coords = ivec3(single_sample_x, single_sample_y, coords.z); |
| 22 | 25 | ||
| 23 | if (any(greaterThanEqual(single_coords, imageSize(img_in)))) { | 26 | if (any(greaterThanEqual(single_coords, imageSize(img_in)))) { |