1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[dxvk] Also add tracking ID to sampler objects

This commit is contained in:
Philip Rebohle 2024-10-30 09:41:00 +01:00
parent 0e14fff749
commit e41b1a11b2
3 changed files with 39 additions and 3 deletions

View File

@ -275,9 +275,28 @@ namespace dxvk {
*/
template<typename T>
void track(Rc<T> object) {
static_assert(!std::is_same_v<T, DxvkSampler>);
m_objectTracker.track<DxvkObjectRef<T>>(std::move(object));
}
/**
* \brief Tracks a sampler object
*
* Special code path that uses the tracking ID to ensure samplers
* only get tracked once per submission. This is useful since
* sampler objects are processed much the same way as resources.
* \param [in] sampler Sampler object
*/
void track(const Rc<DxvkSampler>& sampler) {
if (sampler->trackId(m_trackingId))
m_objectTracker.track<DxvkObjectRef<DxvkSampler>>(sampler.ptr());
}
void track(Rc<DxvkSampler>&& sampler) {
if (sampler->trackId(m_trackingId))
m_objectTracker.track<DxvkObjectRef<DxvkSampler>>(std::move(sampler));
}
/**
* \brief Tracks a resource with access mode
*

View File

@ -1358,7 +1358,7 @@ namespace dxvk {
}
m_cmd->track(imageView->image(), DxvkAccess::Write);
m_cmd->track(sampler);
m_cmd->track(std::move(sampler));
}
@ -2662,7 +2662,7 @@ namespace dxvk {
m_cmd->track(dstView->image(), DxvkAccess::Write);
m_cmd->track(srcView->image(), DxvkAccess::Read);
m_cmd->track(sampler);
m_cmd->track(std::move(sampler));
}

View File

@ -163,6 +163,22 @@ namespace dxvk {
release();
}
/**
* \brief Updates tracking ID for sampler object
*
* Used when tracking submissions.
* \param [in] trackingID Tracking ID
* \returns \c true if the tracking ID has been updated,
* \c false if the sampler was already tracked with this ID.
*/
bool trackId(uint64_t trackingId) {
if (trackingId <= m_trackingId)
return false;
m_trackingId = trackingId;
return true;
}
/**
* \brief Sampler handle
* \returns Sampler handle
@ -181,7 +197,8 @@ namespace dxvk {
private:
std::atomic<uint32_t> m_refCount = { 0u };
std::atomic<uint64_t> m_refCount = { 0u };
uint64_t m_trackingId = 0u;
DxvkSamplerPool* m_pool = nullptr;
DxvkSamplerKey m_key = { };