summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2026-01-04 15:47:20 -0800
committerDentomologist <dentomologist@gmail.com>2026-01-04 17:56:25 -0800
commitaf585e0bd03f2d083fa1ee1620ebbfca9617f031 (patch)
treef9880f44be1eb4efffe7b9c57663af70d3d4c014
parentb1c9c13ca36e80f5109c9c5b30dfed5820a5daf9 (diff)
Metal: Move ObjectCache constructor and destructor
Move the constructor and destructor after the definition of the class `Internal`. This fixes an error generated by Clang from the destructor of `std::unique_ptr<Internal>` when setting the standard version to c++23: `invalid application of 'sizeof' to an incomplete type 'Metal::ObjectCache::Internal'`.
-rw-r--r--Source/Core/VideoBackends/Metal/MTLObjectCache.mm21
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
index c4ecfc0713..7dce7a0f34 100644
--- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
+++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm
@@ -27,16 +27,6 @@ std::unique_ptr<Metal::ObjectCache> Metal::g_object_cache;
static void SetupDepthStencil(
MRCOwned<id<MTLDepthStencilState>> (&dss)[Metal::DepthStencilSelector::N_VALUES]);
-Metal::ObjectCache::ObjectCache()
-{
- m_internal = std::make_unique<Internal>();
- SetupDepthStencil(m_dss);
-}
-
-Metal::ObjectCache::~ObjectCache()
-{
-}
-
void Metal::ObjectCache::Initialize(MRCOwned<id<MTLDevice>> device)
{
g_device = std::move(device);
@@ -554,6 +544,17 @@ public:
}
};
+Metal::ObjectCache::ObjectCache()
+{
+ m_internal = std::make_unique<Internal>();
+ SetupDepthStencil(m_dss);
+}
+
+// This is defined here instead of the header so that the definition of Internal is visible when
+// m_internal is destroyed, preventing a compile error caused by calling unique_ptr's destructor
+// with an incomplete type.
+Metal::ObjectCache::~ObjectCache() = default;
+
std::unique_ptr<AbstractPipeline>
Metal::ObjectCache::CreatePipeline(const AbstractPipelineConfig& config)
{