Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/dxgi/dxgi_swapchain.cpp')
-rw-r--r--src/dxgi/dxgi_swapchain.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp
index fee7cf7b..ba65a86a 100644
--- a/src/dxgi/dxgi_swapchain.cpp
+++ b/src/dxgi/dxgi_swapchain.cpp
@@ -312,6 +312,8 @@ namespace dxvk {
if (SyncInterval > 4)
return DXGI_ERROR_INVALID_CALL;
+ UpdateGlobalHDRState();
+
std::lock_guard<dxvk::recursive_mutex> lockWin(m_lockWindow);
HRESULT hr = S_OK;
@@ -862,4 +864,28 @@ namespace dxvk {
m_monitorInfo->ReleaseMonitorData();
}
+ void DxgiSwapChain::UpdateGlobalHDRState() {
+ // Update the global HDR state if called from the legacy NVAPI
+ // interfaces, etc.
+
+ auto state = m_factory->GlobalHDRState();
+ if (m_globalHDRStateSerial != state.Serial) {
+ SetColorSpace1(state.ColorSpace);
+
+ switch (state.Metadata.Type) {
+ case DXGI_HDR_METADATA_TYPE_NONE:
+ SetHDRMetaData(DXGI_HDR_METADATA_TYPE_NONE, 0, nullptr);
+ break;
+ case DXGI_HDR_METADATA_TYPE_HDR10:
+ SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(state.Metadata.HDR10), reinterpret_cast<void*>(&state.Metadata.HDR10));
+ break;
+ default:
+ Logger::err(str::format("DXGI: Unsupported HDR metadata type (global): ", state.Metadata.Type));
+ break;
+ }
+
+ m_globalHDRStateSerial = state.Serial;
+ }
+ }
+
}