diff --git a/src/mbgl/mtl/render_pass.cpp b/src/mbgl/mtl/render_pass.cpp index 6bc28a4ab..f08ee6cd9 100644 --- a/src/mbgl/mtl/render_pass.cpp +++ b/src/mbgl/mtl/render_pass.cpp @@ -55,7 +55,7 @@ RenderPass::RenderPass(CommandEncoder& commandEncoder_, const char* name, const if (const auto& original = resource.getRenderPassDescriptor()) { auto rpd = NS::TransferPtr(original->copy()); if (!rpd) throw std::runtime_error("Metal render pass descriptor copy failed"); - detail::applyRenderPassClears(*rpd, descriptor.clearColor, descriptor.clearDepth, descriptor.clearStencil); + detail::applyRenderPassClears(*rpd.get(), descriptor.clearColor, descriptor.clearDepth, descriptor.clearStencil); encoder = NS::RetainPtr(buffer->renderCommandEncoder(rpd.get())); if (!encoder) throw std::runtime_error("Metal render command encoder unavailable"); diff --git a/test/renderer/mtl_retained_attachments.test.cpp b/test/renderer/mtl_retained_attachments.test.cpp index 4de698d1c..15b32c4c9 100644 --- a/test/renderer/mtl_retained_attachments.test.cpp +++ b/test/renderer/mtl_retained_attachments.test.cpp @@ -50,7 +50,7 @@ TEST(MetalRetainedAttachments, ClearActionsApplyToCombinedDepthStencil) { descriptor->stencilAttachment()->setTexture(combinedTexture.get()); const auto applied = mtl::detail::applyRenderPassClears( - *descriptor, Color{0.2f, 0.3f, 0.4f, 0.5f}, 1.0f, 0); + *descriptor.get(), Color{0.2f, 0.3f, 0.4f, 0.5f}, 1.0f, 0); EXPECT_TRUE(applied.color); EXPECT_TRUE(applied.depth); EXPECT_TRUE(applied.stencil); @@ -67,6 +67,8 @@ TEST(MetalRetainedAttachments, ClearActionsApplyToCombinedDepthStencil) { TEST(MetalRetainedAttachments, OffscreenBindsRequestedAttachmentsAndSkipsAbsentOnes) { auto pool = NS::TransferPtr(NS::AutoreleasePool::alloc()->init()); + auto device = NS::TransferPtr(MTL::CreateSystemDefaultDevice()); + if (!device) GTEST_SKIP() << "Metal device unavailable"; TestMetalBackend backend; mtl::Context context{backend}; @@ -93,7 +95,7 @@ TEST(MetalRetainedAttachments, OffscreenBindsRequestedAttachmentsAndSkipsAbsentO ASSERT_TRUE(colorDescriptor); EXPECT_EQ(colorDescriptor->depthAttachment()->texture(), nullptr); EXPECT_EQ(colorDescriptor->stencilAttachment()->texture(), nullptr); - const auto applied = mtl::detail::applyRenderPassClears(*colorDescriptor, std::nullopt, 1.0f, 0); + const auto applied = mtl::detail::applyRenderPassClears(*colorDescriptor.get(), std::nullopt, 1.0f, 0); EXPECT_FALSE(applied.depth); EXPECT_FALSE(applied.stencil); }