@@ -72,6 +72,20 @@ ProcTableGLES::Resolver WrappedResolver(
7272 };
7373}
7474
75+ // Resolves `gl_name` and installs it as `proc`'s implementation. Used to alias
76+ // extension entry points that share a core proc's signature under a different
77+ // name (e.g. the *NV-suffixed GL_NV_texture_array procs).
78+ template <typename Proc, typename Resolver, typename ErrorFn>
79+ static void BindProcAlias (Proc& proc,
80+ const Resolver& resolver,
81+ const ErrorFn& error_fn,
82+ const char * gl_name) {
83+ if (auto fn_ptr = resolver (gl_name)) {
84+ proc.function = reinterpret_cast <decltype (proc.function )>(fn_ptr);
85+ proc.error_fn = error_fn;
86+ }
87+ }
88+
7589ProcTableGLES::ProcTableGLES ( // NOLINT(google-readability-function-size)
7690 Resolver resolver) {
7791 // The reason this constructor has anywhere near enough code to tip off
@@ -136,17 +150,12 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size)
136150 if (supports_gl3 || description_->HasExtension (" GL_EXT_texture_array" )) {
137151 FOR_EACH_IMPELLER_TEXTURE_ARRAY_PROC (IMPELLER_PROC );
138152 } else if (description_->HasExtension (" GL_NV_texture_array" )) {
139- #define IMPELLER_PROC_ALIAS (proc_ivar, gl_name ) \
140- if (auto fn_ptr = resolver (gl_name)) { \
141- proc_ivar.function = \
142- reinterpret_cast <decltype (proc_ivar.function )>(fn_ptr); \
143- proc_ivar.error_fn = error_fn; \
144- }
145- IMPELLER_PROC_ALIAS (TexImage3D, " glTexImage3DNV" );
146- IMPELLER_PROC_ALIAS (TexSubImage3D, " glTexSubImage3DNV" );
147- IMPELLER_PROC_ALIAS (CompressedTexImage3D, " glCompressedTexImage3DNV" );
148- IMPELLER_PROC_ALIAS (CompressedTexSubImage3D, " glCompressedTexSubImage3DNV" );
149- #undef IMPELLER_PROC_ALIAS
153+ BindProcAlias (TexImage3D, resolver, error_fn, " glTexImage3DNV" );
154+ BindProcAlias (TexSubImage3D, resolver, error_fn, " glTexSubImage3DNV" );
155+ BindProcAlias (CompressedTexImage3D, resolver, error_fn,
156+ " glCompressedTexImage3DNV" );
157+ BindProcAlias (CompressedTexSubImage3D, resolver, error_fn,
158+ " glCompressedTexSubImage3DNV" );
150159 }
151160
152161 FOR_EACH_IMPELLER_EXT_PROC (IMPELLER_PROC );
0 commit comments