 |
Flutter Impeller
|
|
Go to the documentation of this file.
5 #ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_
6 #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_
11 #include "flutter/fml/logging.h"
12 #include "flutter/fml/mapping.h"
35 if (error == GL_NO_ERROR) {
41 <<
" encountered on call to " <<
name;
45 <<
" encountered on call to " <<
name;
61 const char*
name =
nullptr;
80 template <
class... Args>
87 FML_CHECK(
IsAvailable()) <<
"GL function " <<
name <<
" is not available. "
88 <<
"This is likely due to a missing extension.";
89 #endif // IMPELLER_DEBUG
90 #ifdef IMPELLER_TRACE_ALL_GL_CALLS
91 TRACE_EVENT0(
"impeller",
name);
92 #endif // IMPELLER_TRACE_ALL_GL_CALLS
93 return function(std::forward<Args>(args)...);
96 constexpr
bool IsAvailable()
const {
return function !=
nullptr; }
104 #define FOR_EACH_IMPELLER_PROC(PROC) \
105 PROC(ActiveTexture); \
106 PROC(AttachShader); \
107 PROC(BindAttribLocation); \
109 PROC(BindFramebuffer); \
110 PROC(BindRenderbuffer); \
112 PROC(BlendEquationSeparate); \
113 PROC(BlendFuncSeparate); \
115 PROC(CheckFramebufferStatus); \
119 PROC(ClearStencil); \
121 PROC(CompileShader); \
122 PROC(CreateProgram); \
123 PROC(CreateShader); \
125 PROC(DeleteBuffers); \
126 PROC(DeleteFramebuffers); \
127 PROC(DeleteProgram); \
128 PROC(DeleteRenderbuffers); \
129 PROC(DeleteShader); \
130 PROC(DeleteTextures); \
134 PROC(DetachShader); \
136 PROC(DisableVertexAttribArray); \
138 PROC(DrawElements); \
140 PROC(EnableVertexAttribArray); \
142 PROC(FramebufferRenderbuffer); \
143 PROC(FramebufferTexture2D); \
146 PROC(GenerateMipmap); \
147 PROC(GenFramebuffers); \
148 PROC(GenRenderbuffers); \
150 PROC(GetActiveUniform); \
153 PROC(GetFramebufferAttachmentParameteriv); \
155 PROC(GetProgramInfoLog); \
156 PROC(GetProgramiv); \
157 PROC(GetShaderInfoLog); \
161 PROC(GetUniformLocation); \
163 PROC(IsFramebuffer); \
165 PROC(IsRenderbuffer); \
169 PROC(RenderbufferStorage); \
171 PROC(ShaderBinary); \
172 PROC(ShaderSource); \
173 PROC(StencilFuncSeparate); \
174 PROC(StencilMaskSeparate); \
175 PROC(StencilOpSeparate); \
177 PROC(TexParameteri); \
178 PROC(TexParameterfv); \
184 PROC(UniformMatrix4fv); \
186 PROC(VertexAttribPointer); \
188 PROC(GetShaderSource); \
191 #define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer);
193 #define FOR_EACH_IMPELLER_EXT_PROC(PROC) \
194 PROC(DebugMessageControlKHR); \
195 PROC(DiscardFramebufferEXT); \
196 PROC(FramebufferTexture2DMultisampleEXT); \
197 PROC(PushDebugGroupKHR); \
198 PROC(PopDebugGroupKHR); \
199 PROC(ObjectLabelKHR); \
200 PROC(RenderbufferStorageMultisampleEXT); \
201 PROC(GenQueriesEXT); \
202 PROC(DeleteQueriesEXT); \
203 PROC(GetQueryObjectui64vEXT); \
204 PROC(BeginQueryEXT); \
206 PROC(GetQueryObjectuivEXT);
219 using Resolver = std::function<
void*(
const char* function_name)>;
225 #define IMPELLER_PROC(name) \
226 GLProc<decltype(gl##name)> name = {"gl" #name, nullptr};
242 const fml::Mapping& mapping,
243 const std::vector<Scalar>& defines = {})
const;
247 const std::shared_ptr<const CapabilitiesGLES>&
GetCapabilities()
const;
257 const std::string& label)
const;
265 const fml::Mapping& mapping,
266 const std::vector<Scalar>& defines)
const;
269 bool is_valid_ =
false;
270 std::unique_ptr<DescriptionGLES> description_;
271 std::shared_ptr<const CapabilitiesGLES> capabilities_;
272 GLint debug_label_max_length_ = 0;
281 #endif // FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_
void ShaderSourceMapping(GLuint shader, const fml::Mapping &mapping, const std::vector< Scalar > &defines={}) const
Set the source for the attached [shader].
FOR_EACH_IMPELLER_PROC(IMPELLER_PROC)
ProcTableGLES(Resolver resolver)
#define IMPELLER_PROC(name)
FOR_EACH_IMPELLER_GLES3_PROC(IMPELLER_PROC)
void PushDebugGroup(const std::string &string) const
AutoErrorCheck(PFNGLGETERRORPROC error, const char *name)
constexpr bool IsAvailable() const
bool SetDebugLabel(DebugResourceType type, GLint name, const std::string &label) const
FOR_EACH_IMPELLER_EXT_PROC(IMPELLER_PROC)
std::function< void *(const char *function_name)> Resolver
const std::shared_ptr< const CapabilitiesGLES > & GetCapabilities() const
std::optional< std::string > ComputeShaderWithDefines(const fml::Mapping &mapping, const std::vector< Scalar > &defines) const
PFNGLGETERRORPROC error_fn
std::string GetProgramInfoLogString(GLuint program) const
std::string DescribeCurrentFramebuffer() const
auto operator()(Args &&... args) const
Call the GL function with the appropriate parameters. Lookup the documentation for the GL function be...
bool IsCurrentFramebufferComplete() const
const char * GLErrorToString(GLenum value)
const PFNGLGETERRORPROC error_fn
void PopDebugGroup() const
bool GLErrorIsFatal(GLenum value)
const DescriptionGLES * GetDescription() const