From ed52f586af759e55f3d15fe4bb31585b90333b37 Mon Sep 17 00:00:00 2001 From: "Pierre-Loup A. Griffais" Date: Wed, 11 Dec 2019 23:42:28 -0800 Subject: [PATCH] Add more float comparisons. Every project should have at least 4. --- src/composite.comp.hlsl | 10 +++++++++- src/rendervulkan.cpp | 5 +++++ src/rendervulkan.hpp | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/composite.comp.hlsl b/src/composite.comp.hlsl index 101f6c8..9da5d43 100644 --- a/src/composite.comp.hlsl +++ b/src/composite.comp.hlsl @@ -3,6 +3,7 @@ [[vk::binding(1, 0)]] cbuffer compositeDesc { float flLayerCount; + float flSwapChannels; float flScale0X; float flScale0Y; @@ -64,5 +65,12 @@ void main( outputValue = layerSample * layerAlpha + outputValue * ( 1.0 - layerAlpha ); } - outImage [index] = outputValue; + if ( flSwapChannels == 1.0 ) + { + outImage [index] = outputValue.bgra; + } + else + { + outImage [index] = outputValue; + } } diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp index a6f9015..a6801b3 100644 --- a/src/rendervulkan.cpp +++ b/src/rendervulkan.cpp @@ -1023,6 +1023,11 @@ void vulkan_update_descriptor( struct VulkanPipeline_t *pPipeline ) bool vulkan_composite( struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline ) { + if ( BIsNested() == false && DRMFormatNeedsSwizzle( g_nDRMFormat ) ) + { + pComposite->flSwapChannels = 1.0; + } + *g_pCompositeBuffer = *pComposite; // XXX maybe flush something? diff --git a/src/rendervulkan.hpp b/src/rendervulkan.hpp index 445907a..e1613c1 100644 --- a/src/rendervulkan.hpp +++ b/src/rendervulkan.hpp @@ -28,6 +28,7 @@ struct VulkanPipeline_t struct Composite_t { float flLayerCount; + float flSwapChannels; struct {