Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 7b83cb8

Browse files
kjlubickharryterkelsen
authored andcommitted
Update to use GrDirectContexts::MakeGL (#46308)
This was added in https://skia-review.googlesource.com/c/skia/+/760017 and the old versions were deprecated. ## 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]. <!-- Links --> [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
1 parent 951c537 commit 7b83cb8

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

lib/web_ui/skwasm/surface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "third_party/skia/include/gpu/GrBackendSurface.h"
99
#include "third_party/skia/include/gpu/GrDirectContext.h"
1010
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
11+
#include "third_party/skia/include/gpu/ganesh/gl/GrGLDirectContext.h"
1112

1213
using namespace Skwasm;
1314

@@ -91,7 +92,7 @@ void Surface::_init() {
9192
makeCurrent(_glContext);
9293
emscripten_webgl_enable_extension(_glContext, "WEBGL_debug_renderer_info");
9394

94-
_grContext = GrDirectContext::MakeGL(GrGLMakeNativeInterface());
95+
_grContext = GrDirectContexts::MakeGL(GrGLMakeNativeInterface());
9596

9697
// WebGL should already be clearing the color and stencil buffers, but do it
9798
// again here to ensure Skia receives them in the expected state.

shell/common/shell_io_manager.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "flutter/fml/message_loop.h"
1010
#include "flutter/shell/common/context_options.h"
11+
#include "third_party/skia/include/gpu/ganesh/gl/GrGLDirectContext.h"
1112
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
1213

1314
namespace flutter {
@@ -22,7 +23,7 @@ sk_sp<GrDirectContext> ShellIOManager::CreateCompatibleResourceLoadingContext(
2223

2324
const auto options = MakeDefaultContextOptions(ContextType::kResource);
2425

25-
if (auto context = GrDirectContext::MakeGL(gl_interface, options)) {
26+
if (auto context = GrDirectContexts::MakeGL(gl_interface, options)) {
2627
// Do not cache textures created by the image decoder. These textures
2728
// should be deleted when they are no longer referenced by an SkImage.
2829
context->setResourceCacheLimit(0);

shell/gpu/gpu_surface_gl_skia.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "third_party/skia/include/gpu/GrContextOptions.h"
2121
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2222
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
23+
#include "third_party/skia/include/gpu/ganesh/gl/GrGLDirectContext.h"
2324
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
2425

2526
// These are common defines present on all OpenGL headers. However, we don't
@@ -51,7 +52,7 @@ sk_sp<GrDirectContext> GPUSurfaceGLSkia::MakeGLContext(
5152
const auto options =
5253
MakeDefaultContextOptions(ContextType::kRender, GrBackendApi::kOpenGL);
5354

54-
auto context = GrDirectContext::MakeGL(delegate->GetGLInterface(), options);
55+
auto context = GrDirectContexts::MakeGL(delegate->GetGLInterface(), options);
5556

5657
if (!context) {
5758
FML_LOG(ERROR) << "Failed to set up Skia Gr context.";

testing/test_gl_surface.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "third_party/skia/include/gpu/GrBackendSurface.h"
2121
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
2222
#include "third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h"
23+
#include "third_party/skia/include/gpu/ganesh/gl/GrGLDirectContext.h"
2324
#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h"
2425
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
2526

@@ -336,7 +337,7 @@ sk_sp<GrDirectContext> TestGLSurface::CreateGrContext() {
336337
return nullptr;
337338
}
338339

339-
context_ = GrDirectContext::MakeGL(interface);
340+
context_ = GrDirectContexts::MakeGL(interface);
340341
return context_;
341342
}
342343

0 commit comments

Comments
 (0)