mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +01:00
[d3d11] Use new GPU events for D3D11 Event queries
This commit is contained in:
parent
3dbd755075
commit
8c3900c533
@ -89,6 +89,10 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that all query commands actually get
|
||||||
|
// executed before trying to access the query
|
||||||
|
SynchronizeCsThread();
|
||||||
|
|
||||||
// Get query status directly from the query object
|
// Get query status directly from the query object
|
||||||
HRESULT hr = static_cast<D3D11Query*>(pAsync)->GetData(pData, GetDataFlags);
|
HRESULT hr = static_cast<D3D11Query*>(pAsync)->GetData(pData, GetDataFlags);
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@ namespace dxvk {
|
|||||||
const D3D11_QUERY_DESC& desc)
|
const D3D11_QUERY_DESC& desc)
|
||||||
: m_device(device), m_desc(desc),
|
: m_device(device), m_desc(desc),
|
||||||
m_d3d10(this, device->GetD3D10Interface()) {
|
m_d3d10(this, device->GetD3D10Interface()) {
|
||||||
|
Rc<DxvkDevice> dxvkDevice = m_device->GetDXVKDevice();
|
||||||
|
|
||||||
switch (m_desc.Query) {
|
switch (m_desc.Query) {
|
||||||
case D3D11_QUERY_EVENT:
|
case D3D11_QUERY_EVENT:
|
||||||
m_event = new DxvkEvent();
|
m_event = dxvkDevice->createGpuEvent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case D3D11_QUERY_OCCLUSION:
|
case D3D11_QUERY_OCCLUSION:
|
||||||
@ -171,9 +173,6 @@ namespace dxvk {
|
|||||||
if (m_query != nullptr)
|
if (m_query != nullptr)
|
||||||
return m_query->reset();
|
return m_query->reset();
|
||||||
|
|
||||||
if (m_event != nullptr)
|
|
||||||
return m_event->reset();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +204,7 @@ namespace dxvk {
|
|||||||
void D3D11Query::Signal(DxvkContext* ctx, uint32_t revision) {
|
void D3D11Query::Signal(DxvkContext* ctx, uint32_t revision) {
|
||||||
switch (m_desc.Query) {
|
switch (m_desc.Query) {
|
||||||
case D3D11_QUERY_EVENT: {
|
case D3D11_QUERY_EVENT: {
|
||||||
DxvkEventRevision rev = { m_event, revision };
|
ctx->signalGpuEvent(m_event);
|
||||||
ctx->signalEvent(rev);
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case D3D11_QUERY_TIMESTAMP: {
|
case D3D11_QUERY_TIMESTAMP: {
|
||||||
@ -224,7 +222,16 @@ namespace dxvk {
|
|||||||
void* pData,
|
void* pData,
|
||||||
UINT GetDataFlags) {
|
UINT GetDataFlags) {
|
||||||
if (m_desc.Query == D3D11_QUERY_EVENT) {
|
if (m_desc.Query == D3D11_QUERY_EVENT) {
|
||||||
const bool signaled = m_event->getStatus() == DxvkEventStatus::Signaled;
|
DxvkGpuEventStatus status = m_event->test();
|
||||||
|
|
||||||
|
if (status == DxvkGpuEventStatus::Invalid)
|
||||||
|
return DXGI_ERROR_INVALID_CALL;
|
||||||
|
|
||||||
|
bool signaled = status == DxvkGpuEventStatus::Signaled;
|
||||||
|
|
||||||
|
// FIXME remove once query refactor is done
|
||||||
|
if (m_event->isInUse())
|
||||||
|
signaled = false;
|
||||||
|
|
||||||
if (pData != nullptr)
|
if (pData != nullptr)
|
||||||
*static_cast<BOOL*>(pData) = signaled;
|
*static_cast<BOOL*>(pData) = signaled;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../dxvk/dxvk_event.h"
|
#include "../dxvk/dxvk_gpu_event.h"
|
||||||
#include "../dxvk/dxvk_query.h"
|
#include "../dxvk/dxvk_query.h"
|
||||||
|
|
||||||
#include "../d3d10/d3d10_query.h"
|
#include "../d3d10/d3d10_query.h"
|
||||||
@ -55,7 +55,7 @@ namespace dxvk {
|
|||||||
D3D11_QUERY_DESC m_desc;
|
D3D11_QUERY_DESC m_desc;
|
||||||
|
|
||||||
Rc<DxvkQuery> m_query = nullptr;
|
Rc<DxvkQuery> m_query = nullptr;
|
||||||
Rc<DxvkEvent> m_event = nullptr;
|
Rc<DxvkGpuEvent> m_event = nullptr;
|
||||||
|
|
||||||
uint32_t m_revision = 0;
|
uint32_t m_revision = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user