mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[d3d11] Query prep work
This commit is contained in:
parent
298eeedcc4
commit
c38f3c69ad
@ -6,6 +6,7 @@
|
|||||||
#include "d3d11_device.h"
|
#include "d3d11_device.h"
|
||||||
#include "d3d11_input_layout.h"
|
#include "d3d11_input_layout.h"
|
||||||
#include "d3d11_present.h"
|
#include "d3d11_present.h"
|
||||||
|
#include "d3d11_query.h"
|
||||||
#include "d3d11_sampler.h"
|
#include "d3d11_sampler.h"
|
||||||
#include "d3d11_shader.h"
|
#include "d3d11_shader.h"
|
||||||
#include "d3d11_texture.h"
|
#include "d3d11_texture.h"
|
||||||
@ -965,8 +966,23 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D11Device::CreateQuery(
|
HRESULT STDMETHODCALLTYPE D3D11Device::CreateQuery(
|
||||||
const D3D11_QUERY_DESC* pQueryDesc,
|
const D3D11_QUERY_DESC* pQueryDesc,
|
||||||
ID3D11Query** ppQuery) {
|
ID3D11Query** ppQuery) {
|
||||||
Logger::err("D3D11Device::CreateQuery: Not implemented");
|
// Other query types are currently unsupported
|
||||||
return E_NOTIMPL;
|
if (pQueryDesc->Query != D3D11_QUERY_OCCLUSION
|
||||||
|
&& pQueryDesc->Query != D3D11_QUERY_OCCLUSION_PREDICATE) {
|
||||||
|
Logger::err(str::format("D3D11Device: Unsupported query type: ", pQueryDesc->Query));
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ppQuery == nullptr)
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
try {
|
||||||
|
*ppQuery = new D3D11Query(this, *pQueryDesc);
|
||||||
|
return S_OK;
|
||||||
|
} catch (const DxvkError& e) {
|
||||||
|
Logger::err(e.message());
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,8 +12,11 @@ namespace dxvk {
|
|||||||
class DxgiAdapter;
|
class DxgiAdapter;
|
||||||
|
|
||||||
class D3D11Buffer;
|
class D3D11Buffer;
|
||||||
|
class D3D11Counter;
|
||||||
class D3D11DeviceContext;
|
class D3D11DeviceContext;
|
||||||
|
class D3D11Predicate;
|
||||||
class D3D11PresentDevice;
|
class D3D11PresentDevice;
|
||||||
|
class D3D11Query;
|
||||||
class D3D11ShaderModule;
|
class D3D11ShaderModule;
|
||||||
class D3D11Texture1D;
|
class D3D11Texture1D;
|
||||||
class D3D11Texture2D;
|
class D3D11Texture2D;
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
#define D3D11_1_UAV_SLOT_COUNT 64
|
#define D3D11_1_UAV_SLOT_COUNT 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// These were copied from d3d11.h
|
// Most of these were copied from d3d11.h
|
||||||
// For some strange reason, we cannot use the structures
|
// For some strange reason, we cannot use the structures
|
||||||
// directly, although others from the same header work.
|
// directly, although others from the same header work.
|
||||||
|
// Some structures are missing from the mingw headers.
|
||||||
typedef struct D3D11_FEATURE_DATA_THREADING {
|
typedef struct D3D11_FEATURE_DATA_THREADING {
|
||||||
BOOL DriverConcurrentCreates;
|
BOOL DriverConcurrentCreates;
|
||||||
BOOL DriverCommandLists;
|
BOOL DriverCommandLists;
|
||||||
@ -29,3 +30,16 @@ typedef struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS {
|
|||||||
typedef enum D3D11_BUFFEREX_SRV_FLAG {
|
typedef enum D3D11_BUFFEREX_SRV_FLAG {
|
||||||
D3D11_BUFFEREX_SRV_FLAG_RAW = 1
|
D3D11_BUFFEREX_SRV_FLAG_RAW = 1
|
||||||
} D3D11_BUFFEREX_SRV_FLAG;
|
} D3D11_BUFFEREX_SRV_FLAG;
|
||||||
|
typedef struct D3D11_QUERY_DATA_PIPELINE_STATISTICS {
|
||||||
|
UINT64 IAVertices;
|
||||||
|
UINT64 IAPrimitives;
|
||||||
|
UINT64 VSInvocations;
|
||||||
|
UINT64 GSInvocations;
|
||||||
|
UINT64 GSPrimitives;
|
||||||
|
UINT64 CInvocations;
|
||||||
|
UINT64 CPrimitives;
|
||||||
|
UINT64 PSInvocations;
|
||||||
|
UINT64 HSInvocations;
|
||||||
|
UINT64 DSInvocations;
|
||||||
|
UINT64 CSInvocations;
|
||||||
|
} D3D11_QUERY_DATA_PIPELINE_STATISTICS;
|
79
src/d3d11/d3d11_query.cpp
Normal file
79
src/d3d11/d3d11_query.cpp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#include "d3d11_device.h"
|
||||||
|
#include "d3d11_query.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
D3D11Query::D3D11Query(
|
||||||
|
D3D11Device* device,
|
||||||
|
const D3D11_QUERY_DESC& desc)
|
||||||
|
: m_device(device), m_desc(desc) {
|
||||||
|
Logger::warn("D3D11Query: Stub");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
D3D11Query::~D3D11Query() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D11Query::QueryInterface(REFIID riid, void** ppvObject) {
|
||||||
|
COM_QUERY_IFACE(riid, ppvObject, IUnknown);
|
||||||
|
COM_QUERY_IFACE(riid, ppvObject, ID3D11DeviceChild);
|
||||||
|
COM_QUERY_IFACE(riid, ppvObject, ID3D11Asynchronous);
|
||||||
|
COM_QUERY_IFACE(riid, ppvObject, ID3D11Query);
|
||||||
|
|
||||||
|
Logger::warn("D3D11Query: Unknown interface query");
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D11Query::GetDevice(ID3D11Device **ppDevice) {
|
||||||
|
*ppDevice = ref(m_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT STDMETHODCALLTYPE D3D11Query::GetDataSize() {
|
||||||
|
switch (m_desc.Query) {
|
||||||
|
case D3D11_QUERY_EVENT:
|
||||||
|
return sizeof(BOOL);
|
||||||
|
|
||||||
|
case D3D11_QUERY_OCCLUSION:
|
||||||
|
return sizeof(UINT64);
|
||||||
|
|
||||||
|
case D3D11_QUERY_TIMESTAMP:
|
||||||
|
return sizeof(UINT64);
|
||||||
|
|
||||||
|
case D3D11_QUERY_TIMESTAMP_DISJOINT:
|
||||||
|
return sizeof(D3D11_QUERY_DATA_TIMESTAMP_DISJOINT);
|
||||||
|
|
||||||
|
case D3D11_QUERY_PIPELINE_STATISTICS:
|
||||||
|
return sizeof(D3D11_QUERY_DATA_PIPELINE_STATISTICS);
|
||||||
|
|
||||||
|
case D3D11_QUERY_OCCLUSION_PREDICATE:
|
||||||
|
return sizeof(BOOL);
|
||||||
|
|
||||||
|
case D3D11_QUERY_SO_STATISTICS:
|
||||||
|
case D3D11_QUERY_SO_STATISTICS_STREAM0:
|
||||||
|
case D3D11_QUERY_SO_STATISTICS_STREAM1:
|
||||||
|
case D3D11_QUERY_SO_STATISTICS_STREAM2:
|
||||||
|
case D3D11_QUERY_SO_STATISTICS_STREAM3:
|
||||||
|
return sizeof(D3D11_QUERY_DATA_SO_STATISTICS);
|
||||||
|
|
||||||
|
case D3D11_QUERY_SO_OVERFLOW_PREDICATE:
|
||||||
|
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0:
|
||||||
|
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1:
|
||||||
|
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2:
|
||||||
|
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3:
|
||||||
|
return sizeof(BOOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::err("D3D11Query: Failed to query data size");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D11Query::GetDesc(D3D11_QUERY_DESC *pDesc) {
|
||||||
|
*pDesc = m_desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
src/d3d11/d3d11_query.h
Normal file
36
src/d3d11/d3d11_query.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "d3d11_device_child.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
class D3D11Query : public D3D11DeviceChild<ID3D11Query> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
D3D11Query(
|
||||||
|
D3D11Device* device,
|
||||||
|
const D3D11_QUERY_DESC& desc);
|
||||||
|
|
||||||
|
~D3D11Query();
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||||
|
REFIID riid,
|
||||||
|
void** ppvObject) final;
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE GetDevice(
|
||||||
|
ID3D11Device **ppDevice) final;
|
||||||
|
|
||||||
|
UINT STDMETHODCALLTYPE GetDataSize();
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE GetDesc(
|
||||||
|
D3D11_QUERY_DESC *pDesc) final;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
D3D11Device* const m_device;
|
||||||
|
D3D11_QUERY_DESC m_desc;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -9,6 +9,7 @@ d3d11_src = [
|
|||||||
'd3d11_input_layout.cpp',
|
'd3d11_input_layout.cpp',
|
||||||
'd3d11_main.cpp',
|
'd3d11_main.cpp',
|
||||||
'd3d11_present.cpp',
|
'd3d11_present.cpp',
|
||||||
|
'd3d11_query.cpp',
|
||||||
'd3d11_rasterizer.cpp',
|
'd3d11_rasterizer.cpp',
|
||||||
'd3d11_sampler.cpp',
|
'd3d11_sampler.cpp',
|
||||||
'd3d11_shader.cpp',
|
'd3d11_shader.cpp',
|
||||||
|
Loading…
Reference in New Issue
Block a user