This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,19 @@ struct FramebufferBackingStore {
1717 uint32_t texture_id;
1818};
1919
20+ // Based off Skia's logic:
21+ // https://github.com/google/skia/blob/4738ed711e03212aceec3cd502a4adb545f38e63/src/gpu/ganesh/gl/GrGLCaps.cpp#L1963-L2116
22+ int GetSupportedTextureFormat (const impeller::DescriptionGLES* description) {
23+ if (description->HasExtension (" GL_EXT_texture_format_BGRA8888" )) {
24+ return GL_BGRA8_EXT;
25+ } else if (description->HasExtension (" GL_APPLE_texture_format_BGRA8888" ) &&
26+ description->GetGlVersion ().IsAtLeast (impeller::Version (3 , 0 ))) {
27+ return GL_BGRA8_EXT;
28+ } else {
29+ return GL_RGBA8;
30+ }
31+ }
32+
2033} // namespace
2134
2235CompositorOpenGL::CompositorOpenGL (FlutterWindowsEngine* engine,
@@ -133,18 +146,7 @@ bool CompositorOpenGL::Initialize() {
133146 return false ;
134147 }
135148
136- // Based off Skia's logic:
137- // https://github.com/google/skia/blob/4738ed711e03212aceec3cd502a4adb545f38e63/src/gpu/ganesh/gl/GrGLCaps.cpp#L1963-L2116
138- auto description = gl_->GetDescription ();
139- if (description->HasExtension (" GL_EXT_texture_format_BGRA8888" )) {
140- format_ = GL_BGRA8_EXT;
141- } else if (description->HasExtension (" GL_APPLE_texture_format_BGRA8888" ) &&
142- description->GetGlVersion ().IsAtLeast (impeller::Version (3 , 0 ))) {
143- format_ = GL_BGRA8_EXT;
144- } else {
145- format_ = GL_RGBA8;
146- }
147-
149+ format_ = GetSupportedTextureFormat (gl_->GetDescription ());
148150 is_initialized_ = true ;
149151 return true ;
150152}
You can’t perform that action at this time.
0 commit comments