1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[general] More wine test suite fixes (#220)

* [dxgi] Implement freeing private data

Done by passing null as data.
Fixes wine private data test crash and passes them.

* [dxgi] Improve private data argument handling

Fixes 7 more wine tests.
This commit is contained in:
notaz 2018-03-29 08:11:21 +03:00 committed by Philip Rebohle
parent ae88f83b86
commit 5eefb8530d

View File

@ -61,13 +61,15 @@ namespace dxvk {
HRESULT ComPrivateDataEntry::get(UINT& size, void* data) const {
if (size != 0 && data == nullptr)
return DXGI_ERROR_INVALID_CALL;
const UINT minSize = m_iface != nullptr
? sizeof(IUnknown*)
: m_size;
if (data == nullptr) {
size = minSize;
return S_OK;
}
const HRESULT result = size < minSize
? DXGI_ERROR_MORE_DATA
: S_OK;
@ -98,6 +100,15 @@ namespace dxvk {
REFGUID guid,
UINT size,
const void* data) {
if (data == nullptr) {
for (auto it = m_entries.begin(); it != m_entries.end(); ++it) {
if (it->hasGuid(guid)) {
m_entries.erase(it);
return S_OK;
}
}
return S_FALSE;
}
this->insertEntry(ComPrivateDataEntry(guid, size, data));
return S_OK;
}
@ -116,12 +127,14 @@ namespace dxvk {
UINT* size,
void* data) {
if (size == nullptr)
return DXGI_ERROR_INVALID_CALL;
return E_INVALIDARG;
auto entry = this->findEntry(guid);
if (entry == nullptr)
if (entry == nullptr) {
*size = 0;
return DXGI_ERROR_NOT_FOUND;
}
return entry->get(*size, data);
}