[Win32] Eliminate use of OpenGL ES 3.1 symbols (flutter/engine#32780)

In ANGLE commit 232e523656fccfacabeb8e5ce0cbc2e6dcc1ec4e, an Open GL
extension API was removed from ANGLE which included several symbols that
are not available until OpenGL ES 3.2. This was removed since it had no
known users, and cut the number of entrypoints ANGLE exports in half,
saving 130kB on Android.

Of the removed symbols, the Windows embedder used two:
* GL_RGBA8, which is not OpenGL ES, but rather OpenGL, and can be
  replaced with GL_RGBA which is lenient since it doesn't ask for a
  specific size.
* GL_CLAMP_TO_EDGE, which can be replaced with GL_CLAMP_TO_BORDER.
  https://open.gl/textures for details.

Issue: https://github.com/flutter/flutter/issues/102117
This commit is contained in:
Chris Bracken
2022-04-19 10:43:05 -07:00
committed by GitHub
parent 502bb07d18
commit 770b55538c

View File

@@ -36,7 +36,7 @@ bool ExternalTextureGL::PopulateTexture(size_t width,
// Populate the texture object used by the engine.
opengl_texture->target = GL_TEXTURE_2D;
opengl_texture->name = state_->gl_texture;
opengl_texture->format = GL_RGBA8;
opengl_texture->format = GL_RGBA;
opengl_texture->destruction_callback = nullptr;
opengl_texture->user_data = nullptr;
opengl_texture->width = width;
@@ -58,10 +58,8 @@ bool ExternalTextureGL::CopyPixelBuffer(size_t& width, size_t& height) {
gl_.glGenTextures(1, &state_->gl_texture);
gl_.glBindTexture(GL_TEXTURE_2D, state_->gl_texture);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
gl_.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);