mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Use D3D11CounterBuffer for UAV counters
This commit is contained in:
parent
9992ba1a79
commit
5c45a50daf
@ -113,16 +113,16 @@ namespace dxvk {
|
||||
throw DxvkError("D3D11Device: Failed to query adapter");
|
||||
|
||||
m_initializer = new D3D11Initializer(m_dxvkDevice);
|
||||
m_uavCounters = new D3D11UavCounterAllocator(this);
|
||||
m_context = new D3D11ImmediateContext(this, m_dxvkDevice);
|
||||
m_d3d10Device = new D3D10Device(this, m_context);
|
||||
|
||||
m_uavCounters = CreateUAVCounterBuffer();
|
||||
}
|
||||
|
||||
|
||||
D3D11Device::~D3D11Device() {
|
||||
delete m_d3d10Device;
|
||||
delete m_context;
|
||||
delete m_uavCounters;
|
||||
delete m_initializer;
|
||||
}
|
||||
|
||||
@ -1368,6 +1368,31 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<D3D11CounterBuffer> D3D11Device::CreateUAVCounterBuffer() {
|
||||
// UAV counters are going to be used as raw storage buffers, so
|
||||
// we need to align them to the minimum SSBO offset alignment
|
||||
const auto& devInfo = m_dxvkAdapter->deviceProperties();
|
||||
|
||||
VkDeviceSize uavCounterSliceLength = align<VkDeviceSize>(
|
||||
sizeof(D3D11UavCounter), devInfo.limits.minStorageBufferOffsetAlignment);
|
||||
|
||||
DxvkBufferCreateInfo uavCounterInfo;
|
||||
uavCounterInfo.size = 4096 * uavCounterSliceLength;
|
||||
uavCounterInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT
|
||||
| VK_BUFFER_USAGE_TRANSFER_SRC_BIT
|
||||
| VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
|
||||
uavCounterInfo.stages = VK_PIPELINE_STAGE_TRANSFER_BIT
|
||||
| GetEnabledShaderStages();
|
||||
uavCounterInfo.access = VK_ACCESS_TRANSFER_READ_BIT
|
||||
| VK_ACCESS_TRANSFER_WRITE_BIT
|
||||
| VK_ACCESS_SHADER_READ_BIT
|
||||
| VK_ACCESS_SHADER_WRITE_BIT;
|
||||
|
||||
return new D3D11CounterBuffer(m_dxvkDevice,
|
||||
uavCounterInfo, uavCounterSliceLength);
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11Device::CreateShaderModule(
|
||||
D3D11CommonShader* pShaderModule,
|
||||
const void* pShaderBytecode,
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "../util/com/com_private_data.h"
|
||||
|
||||
#include "d3d11_counter_buffer.h"
|
||||
#include "d3d11_initializer.h"
|
||||
#include "d3d11_interfaces.h"
|
||||
#include "d3d11_options.h"
|
||||
@ -379,16 +380,19 @@ namespace dxvk {
|
||||
DxvkCsChunkPool m_csChunkPool;
|
||||
|
||||
D3D11Initializer* m_initializer = nullptr;
|
||||
D3D11UavCounterAllocator* m_uavCounters = nullptr;
|
||||
D3D11ImmediateContext* m_context = nullptr;
|
||||
D3D10Device* m_d3d10Device = nullptr;
|
||||
|
||||
Rc<D3D11CounterBuffer> m_uavCounters;
|
||||
|
||||
D3D11StateObjectSet<D3D11BlendState> m_bsStateObjects;
|
||||
D3D11StateObjectSet<D3D11DepthStencilState> m_dsStateObjects;
|
||||
D3D11StateObjectSet<D3D11RasterizerState> m_rsStateObjects;
|
||||
D3D11StateObjectSet<D3D11SamplerState> m_samplerObjects;
|
||||
D3D11ShaderModuleSet m_shaderModules;
|
||||
|
||||
Rc<D3D11CounterBuffer> CreateUAVCounterBuffer();
|
||||
|
||||
HRESULT CreateShaderModule(
|
||||
D3D11CommonShader* pShaderModule,
|
||||
const void* pShaderBytecode,
|
||||
|
Loading…
x
Reference in New Issue
Block a user