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 {
17
17
uint32_t texture_id;
18
18
};
19
19
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
+
20
33
} // namespace
21
34
22
35
CompositorOpenGL::CompositorOpenGL (FlutterWindowsEngine* engine,
@@ -133,18 +146,7 @@ bool CompositorOpenGL::Initialize() {
133
146
return false ;
134
147
}
135
148
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 ());
148
150
is_initialized_ = true ;
149
151
return true ;
150
152
}
You can’t perform that action at this time.
0 commit comments