From 4257d71344b8231b05fd0a95e7991c0abe62a6cd Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 19 Apr 2022 09:18:43 -0700 Subject: [PATCH] [Win32] Eliminate use of OpenGL ES 3.1 symbols 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 --- shell/platform/windows/external_texture_gl.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shell/platform/windows/external_texture_gl.cc b/shell/platform/windows/external_texture_gl.cc index f4292ac757036..b4dc9b1585bd8 100644 --- a/shell/platform/windows/external_texture_gl.cc +++ b/shell/platform/windows/external_texture_gl.cc @@ -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);