From c422fb7e82e2ebc89c06aef1d3fbe964657fffb4 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 5 Oct 2016 22:02:04 +1000 Subject: [PATCH] Vulkan: Set alpha channel of swap chain buffers to 1.0. Copying the alpha channel from the game causes issues with frame dumping, since we're using a buffer directly from the GPU as a source for AVIDump. --- Source/Core/VideoBackends/Vulkan/Renderer.cpp | 2 +- Source/Core/VideoBackends/Vulkan/Renderer.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 7bb15aacdf..36be733b39 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -1521,7 +1521,7 @@ bool Renderer::CompileShaders() void main() { - ocol0 = texture(samp0, uv0); + ocol0 = float4(texture(samp0, uv0).xyz, 1.0); } )"; diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.h b/Source/Core/VideoBackends/Vulkan/Renderer.h index 18fa5cc0c4..f292d722a0 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.h +++ b/Source/Core/VideoBackends/Vulkan/Renderer.h @@ -118,6 +118,10 @@ private: // Shaders used for clear/blit. VkShaderModule m_clear_fragment_shader = VK_NULL_HANDLE; + + // NOTE: The blit shader here is used for the final copy from the source buffer(s) to the swap + // chain buffer for presentation. It ignores the alpha channel of the input image and sets the + // alpha channel to 1.0 to avoid issues with frame dumping and screenshots. VkShaderModule m_blit_fragment_shader = VK_NULL_HANDLE; // Texture used for screenshot/frame dumping