From e282e243ad79f438c82ba4310eff7a1ea1732db3 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Sat, 27 Jun 2026 10:05:04 +0200 Subject: [PATCH] fix: Unset HDR enabled property entirely When the HDR enabled property is set, LSFG will assume the source buffer is in the Windows HDR colorspace (scRGB?). Prior to this change lsfg-vk would enabled this property whenever a 10-bit or 16-bit framebuffer is used, without respecting the swapchains actual colorspace. According to some reports, HDR games don't work anyways, so there's some other bug in here as well. This change will remove HDR entirely, which fixes SDR applications using a 10-bit or 16-bit framebuffer (such as mpv or ffplay when playing movies, etc.), but in turn this might also break some HDR games. A proper HDR implementation will be released once I find the time to. --- lsfg-vk-backend/src/helpers/utils.cpp | 5 +---- lsfg-vk-backend/src/helpers/utils.hpp | 4 +--- lsfg-vk-backend/src/lsfgvk.cpp | 5 ++--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lsfg-vk-backend/src/helpers/utils.cpp b/lsfg-vk-backend/src/helpers/utils.cpp index 3c310cd..1a8fab8 100644 --- a/lsfg-vk-backend/src/helpers/utils.cpp +++ b/lsfg-vk-backend/src/helpers/utils.cpp @@ -13,11 +13,8 @@ using namespace lsfgvk; using namespace lsfgvk::backend; ConstantBuffer backend::getDefaultConstantBuffer( - size_t index, size_t total, - bool hdr, float invFlow) { + size_t index, size_t total, float invFlow) { return ConstantBuffer { - .advancedColorKind = hdr ? 2U : 0U, - .hdrSupport = hdr ? 1U : 0U, .resolutionInvScale = invFlow, .timestamp = static_cast(index + 1) / static_cast(total + 1), .uiThreshold = 0.5F diff --git a/lsfg-vk-backend/src/helpers/utils.hpp b/lsfg-vk-backend/src/helpers/utils.hpp index 202ac0c..0944714 100644 --- a/lsfg-vk-backend/src/helpers/utils.hpp +++ b/lsfg-vk-backend/src/helpers/utils.hpp @@ -56,12 +56,10 @@ namespace lsfgvk::backend { /// get a prefilled constant buffer /// @param index timestamp index /// @param total total amount of images - /// @param hdr whether HDR is enabled /// @param invFlow inverted flow scale value /// @return prefilled constant buffer ConstantBuffer getDefaultConstantBuffer( - size_t index, size_t total, - bool hdr, float invFlow + size_t index, size_t total, float invFlow ); /// round down a VkExtent2D diff --git a/lsfg-vk-backend/src/lsfgvk.cpp b/lsfg-vk-backend/src/lsfgvk.cpp index c94cfe1..e55730f 100644 --- a/lsfg-vk-backend/src/lsfgvk.cpp +++ b/lsfg-vk-backend/src/lsfgvk.cpp @@ -369,8 +369,7 @@ namespace { for (size_t i = 0; i < count; ++i) constantBuffers.emplace_back(vk, backend::getDefaultConstantBuffer( - i, count, - hdr, flow + i, count, hdr ) ); @@ -378,7 +377,7 @@ namespace { .vk = std::ref(vk), .shaders = std::ref(shaders), .pool{vk, backend::calculateDescriptorPoolLimits(count, perf)}, - .constantBuffer{vk, backend::getDefaultConstantBuffer(0, 1, hdr, flow)}, + .constantBuffer{vk, backend::getDefaultConstantBuffer(0, 1, flow)}, .constantBuffers{std::move(constantBuffers)}, .bnbSampler{vk, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, VK_COMPARE_OP_NEVER, false}, .bnwSampler{vk, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, VK_COMPARE_OP_NEVER, true},