2017-10-15 19:23:10 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-07-27 14:48:10 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2017-10-15 19:23:10 +02:00
|
|
|
#include "dxvk_include.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
2018-11-27 11:07:23 +01:00
|
|
|
|
|
|
|
class DxvkDevice;
|
2017-10-15 19:23:10 +02:00
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
/**
|
|
|
|
* \brief Descriptor info
|
|
|
|
*
|
|
|
|
* Stores information that is required to
|
|
|
|
* update a single resource descriptor.
|
|
|
|
*/
|
2017-12-20 12:13:08 +01:00
|
|
|
union DxvkDescriptorInfo {
|
|
|
|
VkDescriptorImageInfo image;
|
|
|
|
VkDescriptorBufferInfo buffer;
|
|
|
|
VkBufferView texelBuffer;
|
2017-12-03 20:23:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-10-15 19:23:10 +02:00
|
|
|
/**
|
2018-11-27 11:07:23 +01:00
|
|
|
* \brief Descriptor pool
|
2017-10-15 19:23:10 +02:00
|
|
|
*
|
2018-11-27 11:07:23 +01:00
|
|
|
* Wrapper around a Vulkan descriptor pool that
|
|
|
|
* descriptor sets can be allocated from.
|
2017-10-15 19:23:10 +02:00
|
|
|
*/
|
2018-11-27 11:07:23 +01:00
|
|
|
class DxvkDescriptorPool : public RcObject {
|
2017-10-15 19:23:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2018-11-27 11:07:23 +01:00
|
|
|
DxvkDescriptorPool(
|
2017-10-15 19:23:10 +02:00
|
|
|
const Rc<vk::DeviceFn>& vkd);
|
2018-11-27 11:07:23 +01:00
|
|
|
~DxvkDescriptorPool();
|
2017-10-15 19:23:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Allocates a descriptor set
|
|
|
|
*
|
|
|
|
* \param [in] layout Descriptor set layout
|
|
|
|
* \returns The descriptor set
|
|
|
|
*/
|
|
|
|
VkDescriptorSet alloc(
|
|
|
|
VkDescriptorSetLayout layout);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Resets descriptor set allocator
|
|
|
|
*
|
|
|
|
* Destroys all descriptor sets and
|
|
|
|
* resets the Vulkan descriptor pools.
|
|
|
|
*/
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Rc<vk::DeviceFn> m_vkd;
|
2018-11-27 11:07:23 +01:00
|
|
|
VkDescriptorPool m_pool;
|
2017-10-15 19:23:10 +02:00
|
|
|
|
2018-11-27 11:07:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Descriptor pool tracker
|
|
|
|
*
|
|
|
|
* Tracks descriptor pools that are either full
|
|
|
|
* or no longer needed by the DXVK context. The
|
|
|
|
* command list will reset and recycle all pools
|
|
|
|
* once it has completed execution on the GPU.
|
|
|
|
*/
|
|
|
|
class DxvkDescriptorPoolTracker {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
DxvkDescriptorPoolTracker(DxvkDevice* device);
|
|
|
|
~DxvkDescriptorPoolTracker();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Adds a descriptor pool to track
|
|
|
|
* \param [in] pool The descriptor pool
|
|
|
|
*/
|
|
|
|
void trackDescriptorPool(Rc<DxvkDescriptorPool> pool);
|
2017-10-15 19:23:10 +02:00
|
|
|
|
2018-11-27 11:07:23 +01:00
|
|
|
/**
|
|
|
|
* \brief Resets event tracker
|
|
|
|
*
|
|
|
|
* Resets all tracked descriptor pools
|
|
|
|
* and returns them to the device.
|
|
|
|
*/
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
DxvkDevice* m_device;
|
|
|
|
|
|
|
|
std::vector<Rc<DxvkDescriptorPool>> m_pools;
|
|
|
|
|
2017-10-15 19:23:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|