From 3a587c51167934f46bcf8c73d5f3f16a49eab303 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 17 Oct 2024 16:17:54 +0200 Subject: [PATCH] [dxvk] Remove old lifetime tracking code --- src/dxvk/dxvk_lifetime.cpp | 17 ---- src/dxvk/dxvk_lifetime.h | 171 ------------------------------------- src/dxvk/meson.build | 1 - 3 files changed, 189 deletions(-) delete mode 100644 src/dxvk/dxvk_lifetime.cpp delete mode 100644 src/dxvk/dxvk_lifetime.h diff --git a/src/dxvk/dxvk_lifetime.cpp b/src/dxvk/dxvk_lifetime.cpp deleted file mode 100644 index 1d34ac0a4..000000000 --- a/src/dxvk/dxvk_lifetime.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "dxvk_lifetime.h" - -namespace dxvk { - - DxvkLifetimeTracker:: DxvkLifetimeTracker() { } - DxvkLifetimeTracker::~DxvkLifetimeTracker() { } - - - void DxvkLifetimeTracker::reset() { - m_resources.clear(); - m_allocations.clear(); - m_samplers.clear(); - m_events.clear(); - m_queries.clear(); - } - -} \ No newline at end of file diff --git a/src/dxvk/dxvk_lifetime.h b/src/dxvk/dxvk_lifetime.h deleted file mode 100644 index b4bb9900c..000000000 --- a/src/dxvk/dxvk_lifetime.h +++ /dev/null @@ -1,171 +0,0 @@ -#pragma once - -#include - -#include "dxvk_gpu_event.h" -#include "dxvk_gpu_query.h" -#include "dxvk_resource.h" -#include "dxvk_sampler.h" - -namespace dxvk { - - /** - * \brief Resource pointer - * - * Keeps a resource alive and stores access information. - */ - template - class DxvkLifetime { - static constexpr uintptr_t AccessMask = 0x3u; - static constexpr uintptr_t PointerMask = ~AccessMask; - - static_assert(alignof(T) > AccessMask); - public: - - DxvkLifetime() = default; - - template - DxvkLifetime( - Rc&& resource, - DxvkAccess access) - : m_ptr(reinterpret_cast(static_cast(resource.ptr())) | uintptr_t(access)) { - resource.unsafeExtract()->convertRef(DxvkAccess::None, access); - } - - DxvkLifetime( - const T* resource, - DxvkAccess access) - : m_ptr(reinterpret_cast(static_cast(resource)) | uintptr_t(access)) { - acquire(); - } - - DxvkLifetime(DxvkLifetime&& other) - : m_ptr(other.m_ptr) { - other.m_ptr = 0u; - } - - DxvkLifetime(const DxvkLifetime& other) - : m_ptr(other.m_ptr) { - acquire(); - } - - DxvkLifetime& operator = (DxvkLifetime&& other) { - release(); - - m_ptr = other.m_ptr; - other.m_ptr = 0u; - return *this; - } - - DxvkLifetime& operator = (const DxvkLifetime& other) { - other.acquire(); - release(); - - m_ptr = other.m_ptr; - return *this; - } - - ~DxvkLifetime() { - release(); - } - - private: - - uintptr_t m_ptr = 0u; - - T* ptr() const { - return reinterpret_cast(m_ptr & PointerMask); - } - - DxvkAccess access() const { - return DxvkAccess(m_ptr & AccessMask); - } - - void acquire() const { - if (m_ptr) - ptr()->acquire(access()); - } - - void release() const { - if (m_ptr) - ptr()->release(access()); - } - - }; - - - /** - * \brief 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 sampler to track - * \param [in] res The sampler to track - */ - void trackSampler(const Rc& res) { - m_samplers.push_back(res); - } - - /** - * \brief Adds an event to track - * \param [in] res The event to track - */ - void trackEvent(Rc&& event) { - m_events.push_back(std::move(event)); - } - - /** - * \brief Adds a query to track - * \param [in] query The query to track - */ - void trackQuery(Rc&& query) { - m_queries.push_back(std::move(query)); - } - - /** - * \brief Adds a resource to track - * \param [in] res The resource to track - */ - void trackResource(DxvkLifetime&& res) { - m_resources.push_back(std::move(res)); - } - - /** - * \brief Adds a resource allocation to track - * \param [in] res The allocation to track - */ - void trackResource(Rc&& res) { - m_allocations.push_back(std::move(res)); - } - - /** - * \brief Resets the command list - * - * Called automatically by the device when - * the command list has completed execution. - */ - void reset(); - - private: - - std::vector> m_samplers; - std::vector> m_events; - std::vector> m_queries; - - std::vector> m_resources; - std::vector> m_allocations; - - }; - -} \ No newline at end of file diff --git a/src/dxvk/meson.build b/src/dxvk/meson.build index 016a0d92c..f954a7c03 100644 --- a/src/dxvk/meson.build +++ b/src/dxvk/meson.build @@ -87,7 +87,6 @@ dxvk_src = [ 'dxvk_graphics.cpp', 'dxvk_image.cpp', 'dxvk_instance.cpp', - 'dxvk_lifetime.cpp', 'dxvk_memory.cpp', 'dxvk_meta_blit.cpp', 'dxvk_meta_clear.cpp',