mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Remove D3D11 counter buffer class
This commit is contained in:
parent
e967c52ff7
commit
0683f4f2c0
@ -1,52 +0,0 @@
|
|||||||
#include "d3d11_counter_buffer.h"
|
|
||||||
#include "d3d11_device.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
D3D11CounterBuffer::D3D11CounterBuffer(
|
|
||||||
const Rc<DxvkDevice>& Device,
|
|
||||||
const DxvkBufferCreateInfo& BufferInfo,
|
|
||||||
VkDeviceSize SliceLength)
|
|
||||||
: m_device (Device),
|
|
||||||
m_bufferInfo (BufferInfo),
|
|
||||||
m_sliceLength (SliceLength) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
D3D11CounterBuffer::~D3D11CounterBuffer() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkBufferSlice D3D11CounterBuffer::AllocSlice() {
|
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
|
||||||
|
|
||||||
if (m_freeSlices.size() == 0)
|
|
||||||
CreateBuffer();
|
|
||||||
|
|
||||||
DxvkBufferSlice slice = m_freeSlices.back();
|
|
||||||
m_freeSlices.pop_back();
|
|
||||||
return slice;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11CounterBuffer::FreeSlice(const DxvkBufferSlice& Slice) {
|
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
|
||||||
m_freeSlices.push_back(Slice);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void D3D11CounterBuffer::CreateBuffer() {
|
|
||||||
Rc<DxvkBuffer> buffer = m_device->createBuffer(m_bufferInfo,
|
|
||||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
|
||||||
|
|
||||||
VkDeviceSize sliceCount = m_bufferInfo.size / m_sliceLength;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < sliceCount; i++) {
|
|
||||||
m_freeSlices.push_back(DxvkBufferSlice(
|
|
||||||
buffer, m_sliceLength * i, m_sliceLength));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "d3d11_include.h"
|
|
||||||
|
|
||||||
#include "../dxvk/dxvk_buffer.h"
|
|
||||||
#include "../dxvk/dxvk_device.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
|
||||||
|
|
||||||
class D3D11Device;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief D3D11 UAV counter slice allocator
|
|
||||||
*
|
|
||||||
* Thread safe allocator for buffer slices of
|
|
||||||
* the same size, which are typically used to
|
|
||||||
* store counters (such as UAV counters).
|
|
||||||
*/
|
|
||||||
class D3D11CounterBuffer : public RcObject {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
D3D11CounterBuffer(
|
|
||||||
const Rc<DxvkDevice>& Device,
|
|
||||||
const DxvkBufferCreateInfo& BufferInfo,
|
|
||||||
VkDeviceSize SliceLength);
|
|
||||||
|
|
||||||
~D3D11CounterBuffer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allocates a counter slice
|
|
||||||
*
|
|
||||||
* Picks a slice from the free list or
|
|
||||||
* creates a new buffer if necessary.
|
|
||||||
* \returns The counter slice
|
|
||||||
*/
|
|
||||||
DxvkBufferSlice AllocSlice();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Frees a counter slice
|
|
||||||
*
|
|
||||||
* Adds the given slice back to the
|
|
||||||
* free list so that it can be reused.
|
|
||||||
* \param [in] Slice the slice to free
|
|
||||||
*/
|
|
||||||
void FreeSlice(
|
|
||||||
const DxvkBufferSlice& Slice);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Rc<DxvkDevice> m_device;
|
|
||||||
|
|
||||||
DxvkBufferCreateInfo m_bufferInfo;
|
|
||||||
VkDeviceSize m_sliceLength;
|
|
||||||
|
|
||||||
std::mutex m_mutex;
|
|
||||||
std::vector<DxvkBufferSlice> m_freeSlices;
|
|
||||||
|
|
||||||
void CreateBuffer();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -15,7 +15,6 @@
|
|||||||
#include "../util/com/com_private_data.h"
|
#include "../util/com/com_private_data.h"
|
||||||
|
|
||||||
#include "d3d11_cmdlist.h"
|
#include "d3d11_cmdlist.h"
|
||||||
#include "d3d11_counter_buffer.h"
|
|
||||||
#include "d3d11_initializer.h"
|
#include "d3d11_initializer.h"
|
||||||
#include "d3d11_interfaces.h"
|
#include "d3d11_interfaces.h"
|
||||||
#include "d3d11_interop.h"
|
#include "d3d11_interop.h"
|
||||||
|
@ -38,7 +38,6 @@ d3d11_src = [
|
|||||||
'd3d11_context_def.cpp',
|
'd3d11_context_def.cpp',
|
||||||
'd3d11_context_ext.cpp',
|
'd3d11_context_ext.cpp',
|
||||||
'd3d11_context_imm.cpp',
|
'd3d11_context_imm.cpp',
|
||||||
'd3d11_counter_buffer.cpp',
|
|
||||||
'd3d11_depth_stencil.cpp',
|
'd3d11_depth_stencil.cpp',
|
||||||
'd3d11_device.cpp',
|
'd3d11_device.cpp',
|
||||||
'd3d11_enums.cpp',
|
'd3d11_enums.cpp',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user