mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 22:29:16 +01:00
[dxgi] Use IDXGIVkMonitorInfo in DxgiOutput
This commit is contained in:
parent
7d5b5f288c
commit
50347e1256
@ -89,7 +89,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
// TODO support multiple monitors
|
// TODO support multiple monitors
|
||||||
HMONITOR monitor = ::MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);
|
HMONITOR monitor = ::MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);
|
||||||
*ppOutput = ref(new DxgiOutput(this, monitor));
|
*ppOutput = ref(new DxgiOutput(m_factory, this, monitor));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +116,10 @@ namespace dxvk {
|
|||||||
const DxgiOptions* GetOptions() const {
|
const DxgiOptions* GetOptions() const {
|
||||||
return &m_options;
|
return &m_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DxgiMonitorInfo* GetMonitorInfo() {
|
||||||
|
return &m_monitorInfo;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "dxgi_adapter.h"
|
#include "dxgi_adapter.h"
|
||||||
|
#include "dxgi_factory.h"
|
||||||
#include "dxgi_output.h"
|
#include "dxgi_output.h"
|
||||||
#include "dxgi_swapchain.h"
|
#include "dxgi_swapchain.h"
|
||||||
|
|
||||||
@ -15,9 +16,11 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxgiOutput::DxgiOutput(
|
DxgiOutput::DxgiOutput(
|
||||||
|
const Com<DxgiFactory>& factory,
|
||||||
const Com<DxgiAdapter>& adapter,
|
const Com<DxgiAdapter>& adapter,
|
||||||
HMONITOR monitor)
|
HMONITOR monitor)
|
||||||
: m_adapter(adapter),
|
: m_monitorInfo(factory->GetMonitorInfo()),
|
||||||
|
m_adapter(adapter),
|
||||||
m_monitor(monitor) {
|
m_monitor(monitor) {
|
||||||
// Init monitor info if necessary
|
// Init monitor info if necessary
|
||||||
DXGI_VK_MONITOR_DATA monitorData;
|
DXGI_VK_MONITOR_DATA monitorData;
|
||||||
@ -31,7 +34,7 @@ namespace dxvk {
|
|||||||
monitorData.GammaCurve.GammaCurve[i] = { value, value, value };
|
monitorData.GammaCurve.GammaCurve[i] = { value, value, value };
|
||||||
}
|
}
|
||||||
|
|
||||||
InitMonitorData(monitor, &monitorData);
|
m_monitorInfo->InitMonitorData(monitor, &monitorData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -333,26 +336,26 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DxgiOutput::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats) {
|
HRESULT STDMETHODCALLTYPE DxgiOutput::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats) {
|
||||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
*pStats = monitorInfo->FrameStats;
|
*pStats = monitorInfo->FrameStats;
|
||||||
ReleaseMonitorData();
|
m_monitorInfo->ReleaseMonitorData();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DxgiOutput::GetGammaControl(DXGI_GAMMA_CONTROL* pArray) {
|
HRESULT STDMETHODCALLTYPE DxgiOutput::GetGammaControl(DXGI_GAMMA_CONTROL* pArray) {
|
||||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
*pArray = monitorInfo->GammaCurve;
|
*pArray = monitorInfo->GammaCurve;
|
||||||
ReleaseMonitorData();
|
m_monitorInfo->ReleaseMonitorData();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +391,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE DxgiOutput::SetGammaControl(const DXGI_GAMMA_CONTROL* pArray) {
|
HRESULT STDMETHODCALLTYPE DxgiOutput::SetGammaControl(const DXGI_GAMMA_CONTROL* pArray) {
|
||||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
@ -400,7 +403,7 @@ namespace dxvk {
|
|||||||
DXGI_VK_GAMMA_CP_COUNT, pArray->GammaCurve);
|
DXGI_VK_GAMMA_CP_COUNT, pArray->GammaCurve);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseMonitorData();
|
m_monitorInfo->ReleaseMonitorData();
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
class DxgiAdapter;
|
class DxgiAdapter;
|
||||||
|
class DxgiFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Number of gamma control points
|
* \brief Number of gamma control points
|
||||||
@ -22,24 +23,13 @@ namespace dxvk {
|
|||||||
return float(CpIndex) / float(DXGI_VK_GAMMA_CP_COUNT - 1);
|
return float(CpIndex) / float(DXGI_VK_GAMMA_CP_COUNT - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Per-output data
|
|
||||||
*
|
|
||||||
* Persistent data for a single output, which
|
|
||||||
* is addressed using the \c HMONITOR handle.
|
|
||||||
*/
|
|
||||||
struct DXGI_VK_OUTPUT_DATA {
|
|
||||||
DXGI_FRAME_STATISTICS FrameStats;
|
|
||||||
DXGI_GAMMA_CONTROL GammaCurve;
|
|
||||||
BOOL GammaDirty;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class DxgiOutput : public DxgiObject<IDXGIOutput4> {
|
class DxgiOutput : public DxgiObject<IDXGIOutput4> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxgiOutput(
|
DxgiOutput(
|
||||||
|
const Com<DxgiFactory>& factory,
|
||||||
const Com<DxgiAdapter>& adapter,
|
const Com<DxgiAdapter>& adapter,
|
||||||
HMONITOR monitor);
|
HMONITOR monitor);
|
||||||
|
|
||||||
@ -126,6 +116,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
DxgiMonitorInfo* m_monitorInfo = nullptr;
|
||||||
Com<DxgiAdapter> m_adapter = nullptr;
|
Com<DxgiAdapter> m_adapter = nullptr;
|
||||||
HMONITOR m_monitor = nullptr;
|
HMONITOR m_monitor = nullptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user