1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/dxvk/dxvk_lifetime.h
Philip Rebohle 70e5314cc6 [dxvk] Optimized resource tracking
Putting all resources that are used by a command list
into a vector instead of a hash set is more efficient.
2017-12-20 02:45:57 +01:00

47 lines
925 B
C++

#pragma once
#include <vector>
#include "dxvk_resource.h"
namespace dxvk {
/**
* \brief DXVK lifetime tracker
*
* Maintains references to a set of resources. This is
* used to guarantee that resources are not destroyed
* or otherwise accessed in an unsafe manner until the
* device has finished using them.
*/
class DxvkLifetimeTracker {
public:
DxvkLifetimeTracker();
~DxvkLifetimeTracker();
/**
* \brief Adds a resource to track
* \param [in] rc The resource to track
*/
void trackResource(const Rc<DxvkResource>& rc) {
m_resources.push_back(rc);
rc->acquire();
}
/**
* \brief Resets the command list
*
* Called automatically by the device when
* the command list has completed execution.
*/
void reset();
private:
std::vector<Rc<DxvkResource>> m_resources;
};
}