mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[d3d11] Implemented GetData stub for queries
This commit is contained in:
parent
0866e1b4f2
commit
4dc2c9e92c
@ -2,6 +2,7 @@
|
||||
|
||||
#include "d3d11_context.h"
|
||||
#include "d3d11_device.h"
|
||||
#include "d3d11_query.h"
|
||||
#include "d3d11_texture.h"
|
||||
|
||||
#include "../dxbc/dxbc_util.h"
|
||||
@ -299,8 +300,21 @@ namespace dxvk {
|
||||
void* pData,
|
||||
UINT DataSize,
|
||||
UINT GetDataFlags) {
|
||||
Logger::err("D3D11DeviceContext::GetData: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
if (pAsync->GetDataSize() != DataSize) {
|
||||
Logger::err("D3D11DeviceContext: GetData: Data size mismatch");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// This method handles various different but incompatible interfaces,
|
||||
// so we have to find out what we are actually dealing with
|
||||
Com<ID3D11Query> query;
|
||||
|
||||
if (SUCCEEDED(pAsync->QueryInterface(__uuidof(ID3D11Query), reinterpret_cast<void**>(&query))))
|
||||
return static_cast<D3D11Query*>(query.ptr())->GetData(pData, GetDataFlags);
|
||||
|
||||
// The interface is not supported
|
||||
Logger::err("D3D11DeviceContext: GetData: Unsupported Async type");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ namespace dxvk {
|
||||
return S_FALSE;
|
||||
|
||||
try {
|
||||
*ppQuery = new D3D11Query(this, *pQueryDesc);
|
||||
*ppQuery = ref(new D3D11Query(this, *pQueryDesc));
|
||||
return S_OK;
|
||||
} catch (const DxvkError& e) {
|
||||
Logger::err(e.message());
|
||||
|
@ -76,4 +76,29 @@ namespace dxvk {
|
||||
*pDesc = m_desc;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11Query::GetData(
|
||||
void* pData,
|
||||
UINT GetDataFlags) {
|
||||
static bool errorShown = false;
|
||||
|
||||
if (!std::exchange(errorShown, true))
|
||||
Logger::warn("D3D11Query::GetData: Stub");
|
||||
|
||||
if (pData == nullptr)
|
||||
return S_OK;
|
||||
|
||||
switch (m_desc.Query) {
|
||||
case D3D11_QUERY_OCCLUSION:
|
||||
*static_cast<UINT64*>(pData) = 1;
|
||||
return S_OK;
|
||||
|
||||
case D3D11_QUERY_OCCLUSION_PREDICATE:
|
||||
*static_cast<BOOL*>(pData) = TRUE;
|
||||
return S_OK;
|
||||
|
||||
default: return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ namespace dxvk {
|
||||
void STDMETHODCALLTYPE GetDesc(
|
||||
D3D11_QUERY_DESC *pDesc) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetData(
|
||||
void* pData,
|
||||
UINT GetDataFlags);
|
||||
|
||||
private:
|
||||
|
||||
D3D11Device* const m_device;
|
||||
|
Loading…
Reference in New Issue
Block a user