Add config option to determin if srgb frame buffer format should be used
This commit is contained in:
@@ -19,9 +19,10 @@ namespace openVulkanoCpp
|
|||||||
|
|
||||||
uint32_t numThreads = 1;
|
uint32_t numThreads = 1;
|
||||||
std::array<float, 4> frameBufferClearColor = { 0.39f, 0.58f, 0.93f, 1.0f };
|
std::array<float, 4> frameBufferClearColor = { 0.39f, 0.58f, 0.93f, 1.0f };
|
||||||
|
bool preferFramebufferFormatSRGB = true;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static EngineConfiguration* GetEngineConfiguration()
|
[[nodiscard]] static EngineConfiguration* GetEngineConfiguration()
|
||||||
{
|
{
|
||||||
static EngineConfiguration* config = new EngineConfiguration();
|
static EngineConfiguration* config = new EngineConfiguration();
|
||||||
return config;
|
return config;
|
||||||
@@ -32,7 +33,7 @@ namespace openVulkanoCpp
|
|||||||
this->numThreads = numThreads;
|
this->numThreads = numThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetNumThreads() const
|
[[nodiscard]] uint32_t GetNumThreads() const
|
||||||
{
|
{
|
||||||
return std::max(static_cast<uint32_t>(1), numThreads);
|
return std::max(static_cast<uint32_t>(1), numThreads);
|
||||||
}
|
}
|
||||||
@@ -42,9 +43,19 @@ namespace openVulkanoCpp
|
|||||||
this->frameBufferClearColor = frameBufferClearColor;
|
this->frameBufferClearColor = frameBufferClearColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<float, 4> GetFrameBufferClearColor() const
|
[[nodiscard]] std::array<float, 4> GetFrameBufferClearColor() const
|
||||||
{
|
{
|
||||||
return frameBufferClearColor;
|
return frameBufferClearColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool GetPreferFramebufferFormatSRGB() const
|
||||||
|
{
|
||||||
|
return preferFramebufferFormatSRGB;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetPreferFramebufferFormatSRGB(bool sRGB)
|
||||||
|
{
|
||||||
|
preferFramebufferFormatSRGB = sRGB;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "Base/Logger.hpp"
|
#include "Base/Logger.hpp"
|
||||||
#include "Base/Utils.hpp"
|
#include "Base/Utils.hpp"
|
||||||
#include "Base/UI/IVulkanWindow.hpp"
|
#include "Base/UI/IVulkanWindow.hpp"
|
||||||
|
#include "Base/EngineConfiguration.hpp"
|
||||||
#include "Scene/DataFormat.hpp"
|
#include "Scene/DataFormat.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -174,6 +175,13 @@ namespace openVulkanoCpp::Vulkan
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //TODO chose best fitting
|
{ //TODO chose best fitting
|
||||||
|
for (const auto& format : surfaceFormats)
|
||||||
|
{
|
||||||
|
if (DataFormat(static_cast<DataFormat::Format>(format.format)).IsSRGB() == EngineConfiguration::GetEngineConfiguration()->GetPreferFramebufferFormatSRGB())
|
||||||
|
{
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
}
|
||||||
return surfaceFormats[0];
|
return surfaceFormats[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,4 +196,4 @@ namespace openVulkanoCpp::Vulkan
|
|||||||
}
|
}
|
||||||
return imgs;
|
return imgs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user