mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
|
#pragma once
|
||
|
|
||
|
#include <unordered_set>
|
||
|
|
||
|
#include "dxvk_lifetime.h"
|
||
|
|
||
|
namespace dxvk {
|
||
|
|
||
|
/**
|
||
|
* \brief DXVK command list
|
||
|
*
|
||
|
* Stores a command buffer that a context can use to record Vulkan
|
||
|
* commands. The command list shall also reference the resources
|
||
|
* used by the recorded commands for automatic lifetime tracking.
|
||
|
* When the command list has completed execution, resources that
|
||
|
* are no longer used may get destroyed.
|
||
|
*/
|
||
|
class DxvkCommandList : public RcObject {
|
||
|
|
||
|
public:
|
||
|
|
||
|
DxvkCommandList(
|
||
|
const Rc<vk::DeviceFn>& vkd,
|
||
|
uint32_t queueFamily);
|
||
|
~DxvkCommandList();
|
||
|
|
||
|
/**
|
||
|
* \brief Command buffer handle
|
||
|
* \returns Command buffer handle
|
||
|
*/
|
||
|
VkCommandBuffer handle() const {
|
||
|
return m_buffer;
|
||
|
}
|
||
|
|
||
|
void beginRecording();
|
||
|
void endRecording();
|
||
|
|
||
|
/**
|
||
|
* \brief Adds a resource to track
|
||
|
*
|
||
|
* Adds a resource to the internal resource tracker.
|
||
|
* Resources will be kept alive and "in use" until
|
||
|
* the device can guarantee that the submission has
|
||
|
* completed.
|
||
|
*/
|
||
|
void trackResource(
|
||
|
const Rc<DxvkResource>& rc);
|
||
|
|
||
|
/**
|
||
|
* \brief Resets the command list
|
||
|
*
|
||
|
* Resets the internal command buffer of the command list and
|
||
|
* marks all tracked resources as unused. When submitting the
|
||
|
* command list to the device, this method will be called once
|
||
|
* the command list completes execution.
|
||
|
*/
|
||
|
void reset();
|
||
|
|
||
|
private:
|
||
|
|
||
|
Rc<vk::DeviceFn> m_vkd;
|
||
|
|
||
|
VkCommandPool m_pool;
|
||
|
VkCommandBuffer m_buffer;
|
||
|
|
||
|
DxvkLifetimeTracker m_resources;
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|