mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 19:24:12 +01:00
[d3d11] Allocate predicate buffer for predicates
This commit is contained in:
parent
7e16c4cda1
commit
d81146e3d2
@ -45,6 +45,7 @@ namespace dxvk {
|
||||
|
||||
m_uavCounters = CreateUAVCounterBuffer();
|
||||
m_xfbCounters = CreateXFBCounterBuffer();
|
||||
m_predicates = CreatePredicateBuffer();
|
||||
}
|
||||
|
||||
|
||||
@ -986,7 +987,7 @@ namespace dxvk {
|
||||
return S_FALSE;
|
||||
|
||||
try {
|
||||
*ppPredicate = ref(new D3D11Query(this, *pPredicateDesc));
|
||||
*ppPredicate = ref(new D3D11Query(this, *pPredicateDesc, AllocPredicateSlice()));
|
||||
return S_OK;
|
||||
} catch (const DxvkError& e) {
|
||||
Logger::err(e.message());
|
||||
@ -1475,6 +1476,21 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<D3D11CounterBuffer> D3D11Device::CreatePredicateBuffer() {
|
||||
DxvkBufferCreateInfo predCounterInfo;
|
||||
predCounterInfo.size = 4096 * sizeof(uint32_t);
|
||||
predCounterInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT
|
||||
| VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT;
|
||||
predCounterInfo.stages = VK_PIPELINE_STAGE_TRANSFER_BIT
|
||||
| VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT;
|
||||
predCounterInfo.access = VK_ACCESS_TRANSFER_WRITE_BIT
|
||||
| VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT;
|
||||
|
||||
return new D3D11CounterBuffer(m_dxvkDevice,
|
||||
predCounterInfo, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11Device::CreateShaderModule(
|
||||
D3D11CommonShader* pShaderModule,
|
||||
DxvkShaderKey ShaderKey,
|
||||
|
@ -326,9 +326,11 @@ namespace dxvk {
|
||||
|
||||
DxvkBufferSlice AllocUavCounterSlice() { return m_uavCounters->AllocSlice(); }
|
||||
DxvkBufferSlice AllocXfbCounterSlice() { return m_xfbCounters->AllocSlice(); }
|
||||
DxvkBufferSlice AllocPredicateSlice () { return m_predicates ->AllocSlice(); }
|
||||
|
||||
void FreeUavCounterSlice(const DxvkBufferSlice& Slice) { m_uavCounters->FreeSlice(Slice); }
|
||||
void FreeXfbCounterSlice(const DxvkBufferSlice& Slice) { m_xfbCounters->FreeSlice(Slice); }
|
||||
void FreePredicateSlice (const DxvkBufferSlice& Slice) { m_predicates ->FreeSlice(Slice); }
|
||||
|
||||
static bool CheckFeatureLevelSupport(
|
||||
const Rc<DxvkAdapter>& adapter,
|
||||
@ -360,6 +362,7 @@ namespace dxvk {
|
||||
|
||||
Rc<D3D11CounterBuffer> m_uavCounters;
|
||||
Rc<D3D11CounterBuffer> m_xfbCounters;
|
||||
Rc<D3D11CounterBuffer> m_predicates;
|
||||
|
||||
D3D11StateObjectSet<D3D11BlendState> m_bsStateObjects;
|
||||
D3D11StateObjectSet<D3D11DepthStencilState> m_dsStateObjects;
|
||||
@ -369,6 +372,7 @@ namespace dxvk {
|
||||
|
||||
Rc<D3D11CounterBuffer> CreateUAVCounterBuffer();
|
||||
Rc<D3D11CounterBuffer> CreateXFBCounterBuffer();
|
||||
Rc<D3D11CounterBuffer> CreatePredicateBuffer();
|
||||
|
||||
HRESULT CreateShaderModule(
|
||||
D3D11CommonShader* pShaderModule,
|
||||
|
@ -6,7 +6,16 @@ namespace dxvk {
|
||||
D3D11Query::D3D11Query(
|
||||
D3D11Device* device,
|
||||
const D3D11_QUERY_DESC& desc)
|
||||
: m_device(device), m_desc(desc),
|
||||
: D3D11Query(device, desc, DxvkBufferSlice()) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
D3D11Query::D3D11Query(
|
||||
D3D11Device* device,
|
||||
const D3D11_QUERY_DESC& desc,
|
||||
const DxvkBufferSlice& predicate)
|
||||
: m_device(device), m_desc(desc), m_predicate(predicate),
|
||||
m_d3d10(this, device->GetD3D10Interface()) {
|
||||
Rc<DxvkDevice> dxvkDevice = m_device->GetDXVKDevice();
|
||||
|
||||
@ -75,7 +84,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
D3D11Query::~D3D11Query() {
|
||||
|
||||
if (m_predicate.defined())
|
||||
m_device->FreePredicateSlice(m_predicate);
|
||||
}
|
||||
|
||||
|
||||
@ -198,6 +208,9 @@ namespace dxvk {
|
||||
default:
|
||||
ctx->endQuery(m_query);
|
||||
}
|
||||
|
||||
if (m_predicate.defined())
|
||||
ctx->writePredicate(m_predicate, m_query);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,11 @@ namespace dxvk {
|
||||
D3D11Device* device,
|
||||
const D3D11_QUERY_DESC& desc);
|
||||
|
||||
D3D11Query(
|
||||
D3D11Device* device,
|
||||
const D3D11_QUERY_DESC& desc,
|
||||
const DxvkBufferSlice& predicate);
|
||||
|
||||
~D3D11Query();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
@ -51,6 +56,8 @@ namespace dxvk {
|
||||
Rc<DxvkGpuQuery> m_query = nullptr;
|
||||
Rc<DxvkGpuEvent> m_event = nullptr;
|
||||
|
||||
DxvkBufferSlice m_predicate;
|
||||
|
||||
D3D10Query m_d3d10;
|
||||
|
||||
UINT64 GetTimestampQueryFrequency() const;
|
||||
|
Loading…
Reference in New Issue
Block a user