mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +01:00
[dxgi] Moved private storage out of DXGI library
This commit is contained in:
parent
e7addc140b
commit
7e4e7dd395
@ -3,7 +3,6 @@ dxgi_src = [
|
||||
'dxgi_factory.cpp',
|
||||
'dxgi_main.cpp',
|
||||
'dxgi_output.cpp',
|
||||
'dxgi_private_data.cpp',
|
||||
'dxgi_swapchain.cpp',
|
||||
]
|
||||
|
||||
|
@ -6,3 +6,4 @@
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <unknwn.h>
|
@ -2,12 +2,12 @@
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "dxgi_private_data.h"
|
||||
#include "com_private_data.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxgiPrivateDataEntry::DxgiPrivateDataEntry() { }
|
||||
DxgiPrivateDataEntry::DxgiPrivateDataEntry(
|
||||
ComPrivateDataEntry::ComPrivateDataEntry() { }
|
||||
ComPrivateDataEntry::ComPrivateDataEntry(
|
||||
REFGUID guid,
|
||||
UINT size,
|
||||
const void* data)
|
||||
@ -18,7 +18,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxgiPrivateDataEntry::DxgiPrivateDataEntry(
|
||||
ComPrivateDataEntry::ComPrivateDataEntry(
|
||||
REFGUID guid,
|
||||
const IUnknown* iface)
|
||||
: m_guid (guid),
|
||||
@ -27,12 +27,12 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxgiPrivateDataEntry::~DxgiPrivateDataEntry() {
|
||||
ComPrivateDataEntry::~ComPrivateDataEntry() {
|
||||
this->destroy();
|
||||
}
|
||||
|
||||
|
||||
DxgiPrivateDataEntry::DxgiPrivateDataEntry(DxgiPrivateDataEntry&& other)
|
||||
ComPrivateDataEntry::ComPrivateDataEntry(ComPrivateDataEntry&& other)
|
||||
: m_guid (other.m_guid),
|
||||
m_size (other.m_size),
|
||||
m_data (other.m_data),
|
||||
@ -44,7 +44,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxgiPrivateDataEntry& DxgiPrivateDataEntry::operator = (DxgiPrivateDataEntry&& other) {
|
||||
ComPrivateDataEntry& ComPrivateDataEntry::operator = (ComPrivateDataEntry&& other) {
|
||||
this->destroy();
|
||||
this->m_guid = other.m_guid;
|
||||
this->m_size = other.m_size;
|
||||
@ -59,7 +59,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiPrivateDataEntry::get(UINT& size, void* data) const {
|
||||
HRESULT ComPrivateDataEntry::get(UINT& size, void* data) const {
|
||||
if (size != 0 && data == nullptr)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
@ -85,7 +85,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxgiPrivateDataEntry::destroy() {
|
||||
void ComPrivateDataEntry::destroy() {
|
||||
if (m_data != nullptr)
|
||||
std::free(m_data);
|
||||
if (m_iface != nullptr)
|
||||
@ -93,24 +93,24 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiPrivateData::setData(
|
||||
HRESULT ComPrivateData::setData(
|
||||
REFGUID guid,
|
||||
UINT size,
|
||||
const void* data) {
|
||||
this->insertEntry(DxgiPrivateDataEntry(guid, size, data));
|
||||
this->insertEntry(ComPrivateDataEntry(guid, size, data));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiPrivateData::setInterface(
|
||||
HRESULT ComPrivateData::setInterface(
|
||||
REFGUID guid,
|
||||
const IUnknown* iface) {
|
||||
this->insertEntry(DxgiPrivateDataEntry(guid, iface));
|
||||
this->insertEntry(ComPrivateDataEntry(guid, iface));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT DxgiPrivateData::getData(
|
||||
HRESULT ComPrivateData::getData(
|
||||
REFGUID guid,
|
||||
UINT* size,
|
||||
void* data) {
|
||||
@ -126,8 +126,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxgiPrivateDataEntry* DxgiPrivateData::findEntry(REFGUID guid) {
|
||||
for (DxgiPrivateDataEntry& e : m_entries) {
|
||||
ComPrivateDataEntry* ComPrivateData::findEntry(REFGUID guid) {
|
||||
for (ComPrivateDataEntry& e : m_entries) {
|
||||
if (e.hasGuid(guid))
|
||||
return &e;
|
||||
}
|
||||
@ -136,9 +136,9 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxgiPrivateData::insertEntry(DxgiPrivateDataEntry&& entry) {
|
||||
DxgiPrivateDataEntry srcEntry = std::move(entry);
|
||||
DxgiPrivateDataEntry* dstEntry = this->findEntry(srcEntry.guid());
|
||||
void ComPrivateData::insertEntry(ComPrivateDataEntry&& entry) {
|
||||
ComPrivateDataEntry srcEntry = std::move(entry);
|
||||
ComPrivateDataEntry* dstEntry = this->findEntry(srcEntry.guid());
|
||||
|
||||
if (dstEntry != nullptr)
|
||||
*dstEntry = std::move(srcEntry);
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "dxgi_include.h"
|
||||
#include "com_include.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
@ -10,22 +10,22 @@ namespace dxvk {
|
||||
* \brief Data entry for private storage
|
||||
* Stores a single private storage item.
|
||||
*/
|
||||
class DxgiPrivateDataEntry {
|
||||
class ComPrivateDataEntry {
|
||||
|
||||
public:
|
||||
|
||||
DxgiPrivateDataEntry();
|
||||
DxgiPrivateDataEntry(
|
||||
ComPrivateDataEntry();
|
||||
ComPrivateDataEntry(
|
||||
REFGUID guid,
|
||||
UINT size,
|
||||
const void* data);
|
||||
DxgiPrivateDataEntry(
|
||||
ComPrivateDataEntry(
|
||||
REFGUID guid,
|
||||
const IUnknown* iface);
|
||||
~DxgiPrivateDataEntry();
|
||||
~ComPrivateDataEntry();
|
||||
|
||||
DxgiPrivateDataEntry (DxgiPrivateDataEntry&& other);
|
||||
DxgiPrivateDataEntry& operator = (DxgiPrivateDataEntry&& other);
|
||||
ComPrivateDataEntry (ComPrivateDataEntry&& other);
|
||||
ComPrivateDataEntry& operator = (ComPrivateDataEntry&& other);
|
||||
|
||||
/**
|
||||
* \brief The entry's GUID
|
||||
@ -75,7 +75,7 @@ namespace dxvk {
|
||||
* byte arrays or COM interfaces that can be
|
||||
* retrieved using GUIDs.
|
||||
*/
|
||||
class DxgiPrivateData {
|
||||
class ComPrivateData {
|
||||
|
||||
public:
|
||||
|
||||
@ -95,10 +95,10 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
std::vector<DxgiPrivateDataEntry> m_entries;
|
||||
std::vector<ComPrivateDataEntry> m_entries;
|
||||
|
||||
DxgiPrivateDataEntry* findEntry(REFGUID guid);
|
||||
void insertEntry(DxgiPrivateDataEntry&& entry);
|
||||
ComPrivateDataEntry* findEntry(REFGUID guid);
|
||||
void insertEntry(ComPrivateDataEntry&& entry);
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
util_src = files([
|
||||
'com/com_guid.cpp',
|
||||
'com/com_private_data.cpp',
|
||||
|
||||
'log/log.cpp',
|
||||
'log/log_debug.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user