mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +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
|
||||
HMONITOR monitor = ::MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);
|
||||
*ppOutput = ref(new DxgiOutput(this, monitor));
|
||||
*ppOutput = ref(new DxgiOutput(m_factory, this, monitor));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -116,6 +116,10 @@ namespace dxvk {
|
||||
const DxgiOptions* GetOptions() const {
|
||||
return &m_options;
|
||||
}
|
||||
|
||||
DxgiMonitorInfo* GetMonitorInfo() {
|
||||
return &m_monitorInfo;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "dxgi_adapter.h"
|
||||
#include "dxgi_factory.h"
|
||||
#include "dxgi_output.h"
|
||||
#include "dxgi_swapchain.h"
|
||||
|
||||
@ -15,9 +16,11 @@
|
||||
namespace dxvk {
|
||||
|
||||
DxgiOutput::DxgiOutput(
|
||||
const Com<DxgiFactory>& factory,
|
||||
const Com<DxgiAdapter>& adapter,
|
||||
HMONITOR monitor)
|
||||
: m_adapter(adapter),
|
||||
: m_monitorInfo(factory->GetMonitorInfo()),
|
||||
m_adapter(adapter),
|
||||
m_monitor(monitor) {
|
||||
// Init monitor info if necessary
|
||||
DXGI_VK_MONITOR_DATA monitorData;
|
||||
@ -31,7 +34,7 @@ namespace dxvk {
|
||||
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) {
|
||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
*pStats = monitorInfo->FrameStats;
|
||||
ReleaseMonitorData();
|
||||
m_monitorInfo->ReleaseMonitorData();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiOutput::GetGammaControl(DXGI_GAMMA_CONTROL* pArray) {
|
||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
*pArray = monitorInfo->GammaCurve;
|
||||
ReleaseMonitorData();
|
||||
m_monitorInfo->ReleaseMonitorData();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -388,7 +391,7 @@ namespace dxvk {
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiOutput::SetGammaControl(const DXGI_GAMMA_CONTROL* pArray) {
|
||||
DXGI_VK_MONITOR_DATA* monitorInfo = nullptr;
|
||||
HRESULT hr = AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
HRESULT hr = m_monitorInfo->AcquireMonitorData(m_monitor, &monitorInfo);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
@ -400,7 +403,7 @@ namespace dxvk {
|
||||
DXGI_VK_GAMMA_CP_COUNT, pArray->GammaCurve);
|
||||
}
|
||||
|
||||
ReleaseMonitorData();
|
||||
m_monitorInfo->ReleaseMonitorData();
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
namespace dxvk {
|
||||
|
||||
class DxgiAdapter;
|
||||
class DxgiFactory;
|
||||
|
||||
/**
|
||||
* \brief Number of gamma control points
|
||||
@ -22,24 +23,13 @@ namespace dxvk {
|
||||
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> {
|
||||
|
||||
public:
|
||||
|
||||
DxgiOutput(
|
||||
const Com<DxgiFactory>& factory,
|
||||
const Com<DxgiAdapter>& adapter,
|
||||
HMONITOR monitor);
|
||||
|
||||
@ -126,6 +116,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
DxgiMonitorInfo* m_monitorInfo = nullptr;
|
||||
Com<DxgiAdapter> m_adapter = nullptr;
|
||||
HMONITOR m_monitor = nullptr;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user