From 0639244d856f403cc9bdec5ca927df7a61edd1d8 Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 4 Mar 2021 14:14:19 -0500 Subject: renderer_opengl: Swizzle BGR textures on copy OpenGL does not natively support BGR internal formats, which causes many BGR textures to render incorrectly, with Red and Blue channels swapped. This commit aims to address this by swizzling the blue and red channels on texture copies when a BGR format is encountered. --- src/video_core/host_shaders/opengl_copy_bgra.comp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/video_core/host_shaders/opengl_copy_bgra.comp (limited to 'src/video_core/host_shaders/opengl_copy_bgra.comp') diff --git a/src/video_core/host_shaders/opengl_copy_bgra.comp b/src/video_core/host_shaders/opengl_copy_bgra.comp new file mode 100644 index 000000000..2571a4abf --- /dev/null +++ b/src/video_core/host_shaders/opengl_copy_bgra.comp @@ -0,0 +1,15 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#version 430 core + +layout (local_size_x = 4, local_size_y = 4) in; + +layout(binding = 0, rgba8) readonly uniform image2DArray bgr_input; +layout(binding = 1, rgba8) writeonly uniform image2DArray bgr_output; + +void main() { + vec4 color = imageLoad(bgr_input, ivec3(gl_GlobalInvocationID)); + imageStore(bgr_output, ivec3(gl_GlobalInvocationID), color.bgra); +} -- cgit v1.2.3