From ef9af8f3d22b150d8676c9da25f9c0b3cde1943e Mon Sep 17 00:00:00 2001 From: K Lubick Date: Fri, 22 Mar 2024 11:09:38 -0400 Subject: [PATCH] Update one more use of deprecated GrDirectContext::MakeMetal (flutter/engine#51619) In #51537 I missed one call to `GrDirectContext::MakeMetal` which is going away. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat --- .../darwin/graphics/FlutterDarwinContextMetalSkia.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm index 9457437918..1f78745585 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm @@ -8,6 +8,9 @@ #include "flutter/fml/logging.h" #include "flutter/shell/common/context_options.h" #import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h" +#include "third_party/skia/include/gpu/GrDirectContext.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h" FLUTTER_ASSERT_ARC @@ -79,10 +82,12 @@ FLUTTER_ASSERT_ARC commandQueue:(id)commandQueue { const auto contextOptions = flutter::MakeDefaultContextOptions(flutter::ContextType::kRender, GrBackendApi::kMetal); + GrMtlBackendContext backendContext = {}; // Skia expect arguments to `MakeMetal` transfer ownership of the reference in for release later // when the GrDirectContext is collected. - return GrDirectContext::MakeMetal((__bridge_retained void*)device, - (__bridge_retained void*)commandQueue, contextOptions); + backendContext.fDevice.reset((__bridge_retained void*)device); + backendContext.fQueue.reset((__bridge_retained void*)commandQueue); + return GrDirectContexts::MakeMetal(backendContext, contextOptions); } - (void)dealloc {