mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxgi] Remove old DXGIDevice implementation and IDXGIVkDevice
Both have been moved to the D3D11 module and are no longer needed.
This commit is contained in:
parent
c5deedef2d
commit
1cc0455c8a
@ -4,7 +4,6 @@
|
||||
#include "d3d10_reflection.h"
|
||||
|
||||
#include "../dxgi/dxgi_adapter.h"
|
||||
#include "../dxgi/dxgi_device.h"
|
||||
|
||||
namespace dxvk {
|
||||
Logger Logger::s_instance("d3d10.log");
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <array>
|
||||
|
||||
#include "../dxgi/dxgi_adapter.h"
|
||||
#include "../dxgi/dxgi_device.h"
|
||||
|
||||
#include "d3d11_device.h"
|
||||
#include "d3d11_enums.h"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "../dxgi/dxgi_device.h"
|
||||
#include "../dxgi/dxgi_interfaces.h"
|
||||
|
||||
#include "d3d11_include.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <d3d10_1.h>
|
||||
|
||||
#include "dxgi_adapter.h"
|
||||
#include "dxgi_device.h"
|
||||
#include "dxgi_enums.h"
|
||||
#include "dxgi_factory.h"
|
||||
#include "dxgi_format.h"
|
||||
@ -311,23 +310,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiAdapter::CreateDevice(
|
||||
IDXGIObject* pContainer,
|
||||
const DxvkDeviceFeatures* pFeatures,
|
||||
IDXGIVkDevice** ppDevice) {
|
||||
InitReturnPtr(ppDevice);
|
||||
|
||||
try {
|
||||
*ppDevice = new dxvk::DxgiDevice(pContainer,
|
||||
this, m_factory->GetOptions(), pFeatures);
|
||||
return S_OK;
|
||||
} catch (const dxvk::DxvkError& e) {
|
||||
dxvk::Logger::err(e.message());
|
||||
return DXGI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE DxgiAdapter::LookupFormat(
|
||||
DXGI_FORMAT Format,
|
||||
DXGI_VK_FORMAT_MODE Mode) {
|
||||
|
@ -72,11 +72,6 @@ namespace dxvk {
|
||||
|
||||
Rc<DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDevice(
|
||||
IDXGIObject* pContainer,
|
||||
const DxvkDeviceFeatures* pFeatures,
|
||||
IDXGIVkDevice** ppDevice) final;
|
||||
|
||||
DXGI_VK_FORMAT_INFO STDMETHODCALLTYPE LookupFormat(
|
||||
DXGI_FORMAT Format,
|
||||
DXGI_VK_FORMAT_MODE Mode);
|
||||
|
@ -1,194 +0,0 @@
|
||||
#include "dxgi_device.h"
|
||||
#include "dxgi_factory.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
constexpr uint32_t DxgiDevice::DefaultFrameLatency;
|
||||
|
||||
DxgiDevice::DxgiDevice(
|
||||
IDXGIObject* pContainer,
|
||||
IDXGIVkAdapter* pAdapter,
|
||||
const DxgiOptions* pOptions,
|
||||
const DxvkDeviceFeatures* pFeatures)
|
||||
: m_container (pContainer),
|
||||
m_adapter (pAdapter),
|
||||
m_frameLatencyCap (pOptions->maxFrameLatency) {
|
||||
m_device = m_adapter->GetDXVKAdapter()->createDevice(*pFeatures);
|
||||
|
||||
for (uint32_t i = 0; i < m_frameEvents.size(); i++)
|
||||
m_frameEvents[i] = new DxvkEvent();
|
||||
}
|
||||
|
||||
|
||||
DxgiDevice::~DxgiDevice() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE DxgiDevice::AddRef() {
|
||||
return m_container->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE DxgiDevice::Release() {
|
||||
return m_container->Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::QueryInterface(REFIID riid, void** ppvObject) {
|
||||
return m_container->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::GetParent(REFIID riid, void** ppParent) {
|
||||
return m_adapter->QueryInterface(riid, ppParent);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::GetPrivateData(
|
||||
REFGUID Name, UINT* pDataSize, void* pData) {
|
||||
return m_container->GetPrivateData(Name, pDataSize, pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::SetPrivateData(
|
||||
REFGUID Name, UINT DataSize, const void* pData) {
|
||||
return m_container->SetPrivateData(Name, DataSize,pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::SetPrivateDataInterface(
|
||||
REFGUID Name, const IUnknown* pUnknown) {
|
||||
return m_container->SetPrivateDataInterface(Name, pUnknown);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::CreateSurface(
|
||||
const DXGI_SURFACE_DESC* pDesc,
|
||||
UINT NumSurfaces,
|
||||
DXGI_USAGE Usage,
|
||||
const DXGI_SHARED_RESOURCE* pSharedResource,
|
||||
IDXGISurface** ppSurface) {
|
||||
InitReturnPtr(ppSurface);
|
||||
|
||||
Logger::err("DxgiDevice::CreateSurface: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::GetAdapter(
|
||||
IDXGIAdapter** pAdapter) {
|
||||
if (pAdapter == nullptr)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
*pAdapter = static_cast<IDXGIAdapter*>(m_adapter.ref());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::GetGPUThreadPriority(
|
||||
INT* pPriority) {
|
||||
*pPriority = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::QueryResourceResidency(
|
||||
IUnknown* const* ppResources,
|
||||
DXGI_RESIDENCY* pResidencyStatus,
|
||||
UINT NumResources) {
|
||||
static bool s_errorShown = false;
|
||||
|
||||
if (!std::exchange(s_errorShown, true))
|
||||
Logger::err("DxgiDevice::QueryResourceResidency: Stub");
|
||||
|
||||
if (!ppResources || !pResidencyStatus)
|
||||
return E_INVALIDARG;
|
||||
|
||||
for (uint32_t i = 0; i < NumResources; i++)
|
||||
pResidencyStatus[i] = DXGI_RESIDENCY_FULLY_RESIDENT;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::SetGPUThreadPriority(
|
||||
INT Priority) {
|
||||
if (Priority < -7 || Priority > 7)
|
||||
return E_INVALIDARG;
|
||||
|
||||
Logger::err("DXGI: SetGPUThreadPriority: Ignoring");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::GetMaximumFrameLatency(
|
||||
UINT* pMaxLatency) {
|
||||
*pMaxLatency = m_frameLatency;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::SetMaximumFrameLatency(
|
||||
UINT MaxLatency) {
|
||||
if (MaxLatency == 0)
|
||||
MaxLatency = DefaultFrameLatency;
|
||||
|
||||
if (MaxLatency > m_frameEvents.size())
|
||||
MaxLatency = m_frameEvents.size();
|
||||
|
||||
m_frameLatency = MaxLatency;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::OfferResources(
|
||||
UINT NumResources,
|
||||
IDXGIResource* const* ppResources,
|
||||
DXGI_OFFER_RESOURCE_PRIORITY Priority) {
|
||||
|
||||
Logger::err("DxgiDevice::OfferResources: Not implemented");
|
||||
return DXGI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::ReclaimResources(
|
||||
UINT NumResources,
|
||||
IDXGIResource* const* ppResources,
|
||||
BOOL* pDiscarded) {
|
||||
Logger::err("DxgiDevice::ReclaimResources: Not implemented");
|
||||
return DXGI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DxgiDevice::EnqueueSetEvent(HANDLE hEvent) {
|
||||
Logger::err("DxgiDevice::EnqueueSetEvent: Not implemented");
|
||||
return DXGI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE DxgiDevice::Trim() {
|
||||
static bool s_errorShown = false;
|
||||
|
||||
if (!std::exchange(s_errorShown, true))
|
||||
Logger::warn("DxgiDevice::Trim: Stub");
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkDevice> STDMETHODCALLTYPE DxgiDevice::GetDXVKDevice() {
|
||||
return m_device;
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkEvent> STDMETHODCALLTYPE DxgiDevice::GetFrameSyncEvent() {
|
||||
uint32_t frameLatency = m_frameLatency;
|
||||
|
||||
if (m_frameLatencyCap != 0
|
||||
&& m_frameLatencyCap <= frameLatency)
|
||||
frameLatency = m_frameLatencyCap;
|
||||
|
||||
uint32_t frameId = m_frameId++ % frameLatency;
|
||||
return m_frameEvents[frameId];
|
||||
}
|
||||
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "dxgi_adapter.h"
|
||||
#include "dxgi_interfaces.h"
|
||||
#include "dxgi_options.h"
|
||||
|
||||
#include "../dxvk/dxvk_device.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
class DxgiFactory;
|
||||
|
||||
class DxgiDevice : public IDXGIVkDevice {
|
||||
constexpr static uint32_t DefaultFrameLatency = 3;
|
||||
public:
|
||||
|
||||
DxgiDevice(
|
||||
IDXGIObject* pContainer,
|
||||
IDXGIVkAdapter* pAdapter,
|
||||
const DxgiOptions* pOptions,
|
||||
const DxvkDeviceFeatures* pFeatures);
|
||||
~DxgiDevice();
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef() final;
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release() final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetParent(
|
||||
REFIID riid,
|
||||
void** ppParent) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT* pDataSize,
|
||||
void* pData) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT DataSize,
|
||||
const void* pData) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
||||
REFGUID Name,
|
||||
const IUnknown* pUnknown) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateSurface(
|
||||
const DXGI_SURFACE_DESC* pDesc,
|
||||
UINT NumSurfaces,
|
||||
DXGI_USAGE Usage,
|
||||
const DXGI_SHARED_RESOURCE* pSharedResource,
|
||||
IDXGISurface** ppSurface) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetAdapter(
|
||||
IDXGIAdapter** pAdapter) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
|
||||
INT* pPriority) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryResourceResidency(
|
||||
IUnknown* const* ppResources,
|
||||
DXGI_RESIDENCY* pResidencyStatus,
|
||||
UINT NumResources) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
|
||||
INT Priority) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency(
|
||||
UINT* pMaxLatency) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency(
|
||||
UINT MaxLatency) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OfferResources(
|
||||
UINT NumResources,
|
||||
IDXGIResource* const* ppResources,
|
||||
DXGI_OFFER_RESOURCE_PRIORITY Priority) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE ReclaimResources(
|
||||
UINT NumResources,
|
||||
IDXGIResource* const* ppResources,
|
||||
BOOL* pDiscarded) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE EnqueueSetEvent(
|
||||
HANDLE hEvent) final;
|
||||
|
||||
void STDMETHODCALLTYPE Trim() final;
|
||||
|
||||
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() final;
|
||||
|
||||
Rc<DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent() final;
|
||||
|
||||
private:
|
||||
|
||||
IDXGIObject* m_container;
|
||||
|
||||
Com<IDXGIVkAdapter> m_adapter;
|
||||
Rc<DxvkDevice> m_device;
|
||||
|
||||
uint32_t m_frameLatencyCap = 0;
|
||||
uint32_t m_frameLatency = DefaultFrameLatency;
|
||||
uint32_t m_frameId = 0;
|
||||
|
||||
std::array<Rc<DxvkEvent>, 16> m_frameEvents;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -62,25 +62,6 @@ IDXGIVkSwapChain : public IUnknown {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Private DXGI device interface
|
||||
*
|
||||
* The implementation of \c IDXGIDevice stores a
|
||||
* \ref DxvkDevice which can be retrieved using
|
||||
* this interface.
|
||||
*/
|
||||
MIDL_INTERFACE("7a622cf6-627a-46b2-b52f-360ef3da831c")
|
||||
IDXGIVkDevice : public IDXGIDevice3 {
|
||||
static const GUID guid;
|
||||
|
||||
virtual ~IDXGIVkDevice() { }
|
||||
|
||||
virtual dxvk::Rc<dxvk::DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() = 0;
|
||||
|
||||
virtual dxvk::Rc<dxvk::DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent() = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Private DXGI adapter interface
|
||||
*
|
||||
@ -94,18 +75,6 @@ IDXGIVkAdapter : public IDXGIAdapter3 {
|
||||
|
||||
virtual dxvk::Rc<dxvk::DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() = 0;
|
||||
|
||||
/**
|
||||
* \brief Creates a DXGI device object
|
||||
*
|
||||
* \param [in] pAdapter The adapter
|
||||
* \param [in] pFeatures Device features to enable
|
||||
* \param [out] ppDevice The DXGI device object
|
||||
* \returns \c S_OK on success, or an error code
|
||||
*/
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateDevice(
|
||||
IDXGIObject* pContainer,
|
||||
const dxvk::DxvkDeviceFeatures* pFeatures,
|
||||
IDXGIVkDevice** ppDevice) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -270,14 +239,12 @@ IDXGIVkInteropDevice : public IUnknown {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
struct __declspec(uuid("907bf281-ea3c-43b4-a8e4-9f231107b4ff")) IDXGIVkAdapter;
|
||||
struct __declspec(uuid("7a622cf6-627a-46b2-b52f-360ef3da831c")) IDXGIVkDevice;
|
||||
struct __declspec(uuid("79352328-16f2-4f81-9746-9c2e2ccd43cf")) IDXGIVkPresentDevice;
|
||||
struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice;
|
||||
struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSurface;
|
||||
struct __declspec(uuid("104001a6-7f36-4957-b932-86ade9567d91")) IDXGIVkSwapChain;
|
||||
#else
|
||||
DXVK_DEFINE_GUID(IDXGIVkAdapter);
|
||||
DXVK_DEFINE_GUID(IDXGIVkDevice);
|
||||
DXVK_DEFINE_GUID(IDXGIVkPresentDevice);
|
||||
DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
|
||||
DXVK_DEFINE_GUID(IDXGIVkInteropSurface);
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include "dxgi_device.h"
|
||||
#include "dxgi_factory.h"
|
||||
#include "dxgi_output.h"
|
||||
#include "dxgi_swapchain.h"
|
||||
|
@ -5,7 +5,6 @@ dxgi_shaders = files([
|
||||
|
||||
dxgi_src = [
|
||||
'dxgi_adapter.cpp',
|
||||
'dxgi_device.cpp',
|
||||
'dxgi_enums.cpp',
|
||||
'dxgi_factory.cpp',
|
||||
'dxgi_format.cpp',
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "../../dxgi/dxgi_interfaces.h"
|
||||
|
||||
const GUID IDXGIVkAdapter::guid = {0x907bf281,0xea3c,0x43b4,{0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff}};
|
||||
const GUID IDXGIVkDevice::guid = {0x7a622cf6,0x627a,0x46b2,{0xb5,0x2f,0x36,0x0e,0xf3,0xda,0x83,0x1c}};
|
||||
const GUID IDXGIVkPresentDevice::guid = {0x79352328,0x16f2,0x4f81,{0x97,0x46,0x9c,0x2e,0x2c,0xcd,0x43,0xcf}};
|
||||
const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
|
||||
const GUID IDXGIVkInteropSurface::guid = {0x5546cf8c,0x77e7,0x4341,{0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d}};
|
||||
|
Loading…
x
Reference in New Issue
Block a user