 |
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) {
40 << error <<
")" <<
" encountered on call to " <<
name;
43 <<
")" <<
" encountered on call to " <<
name;
59 const char*
name =
nullptr;
78 template <
class... Args>
85 FML_CHECK(
IsAvailable()) <<
"GL function " <<
name <<
" is not available. "
86 <<
"This is likely due to a missing extension.";
87 #endif // IMPELLER_DEBUG
88 #ifdef IMPELLER_TRACE_ALL_GL_CALLS
89 TRACE_EVENT0(
"impeller",
name);
90 #endif // IMPELLER_TRACE_ALL_GL_CALLS
91 return function(std::forward<Args>(args)...);
94 constexpr
bool IsAvailable()
const {
return function !=
nullptr; }
102 #define FOR_EACH_IMPELLER_PROC(PROC) \
103 PROC(ActiveTexture); \
104 PROC(AttachShader); \
105 PROC(BindAttribLocation); \
107 PROC(BindFramebuffer); \
108 PROC(BindRenderbuffer); \
110 PROC(BlendEquationSeparate); \
111 PROC(BlendFuncSeparate); \
113 PROC(CheckFramebufferStatus); \
116 PROC(ClearStencil); \
118 PROC(CompileShader); \
119 PROC(CreateProgram); \
120 PROC(CreateShader); \
122 PROC(DeleteBuffers); \
123 PROC(DeleteFramebuffers); \
124 PROC(DeleteProgram); \
125 PROC(DeleteRenderbuffers); \
126 PROC(DeleteShader); \
127 PROC(DeleteTextures); \
130 PROC(DetachShader); \
132 PROC(DisableVertexAttribArray); \
134 PROC(DrawElements); \
136 PROC(EnableVertexAttribArray); \
138 PROC(FramebufferRenderbuffer); \
139 PROC(FramebufferTexture2D); \
142 PROC(GenerateMipmap); \
143 PROC(GenFramebuffers); \
144 PROC(GenRenderbuffers); \
146 PROC(GetActiveUniform); \
149 PROC(GetFramebufferAttachmentParameteriv); \
151 PROC(GetProgramInfoLog); \
152 PROC(GetProgramiv); \
153 PROC(GetShaderInfoLog); \
157 PROC(GetUniformLocation); \
159 PROC(IsFramebuffer); \
161 PROC(IsRenderbuffer); \
165 PROC(RenderbufferStorage); \
167 PROC(ShaderBinary); \
168 PROC(ShaderSource); \
169 PROC(StencilFuncSeparate); \
170 PROC(StencilMaskSeparate); \
171 PROC(StencilOpSeparate); \
173 PROC(TexParameteri); \
174 PROC(TexParameterfv); \
180 PROC(UniformMatrix4fv); \
182 PROC(VertexAttribPointer); \
184 PROC(GetShaderSource); \
191 #define FOR_EACH_IMPELLER_ES_ONLY_PROC(PROC) \
199 #define FOR_EACH_IMPELLER_DESKTOP_ONLY_PROC(PROC) \
203 #define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer);
205 #define FOR_EACH_IMPELLER_EXT_PROC(PROC) \
206 PROC(DebugMessageControlKHR); \
207 PROC(DiscardFramebufferEXT); \
208 PROC(FramebufferTexture2DMultisampleEXT); \
209 PROC(PushDebugGroupKHR); \
210 PROC(PopDebugGroupKHR); \
211 PROC(ObjectLabelKHR); \
212 PROC(RenderbufferStorageMultisampleEXT); \
213 PROC(GenQueriesEXT); \
214 PROC(DeleteQueriesEXT); \
215 PROC(GetQueryObjectui64vEXT); \
216 PROC(BeginQueryEXT); \
218 PROC(GetQueryObjectuivEXT);
231 using Resolver = std::function<
void*(
const char* function_name)>;
237 #define IMPELLER_PROC(name) \
238 GLProc<decltype(gl##name)> name = {"gl" #name, nullptr};
256 const fml::Mapping& mapping,
257 const std::vector<Scalar>& defines = {})
const;
261 const std::shared_ptr<const CapabilitiesGLES>&
GetCapabilities()
const;
271 const std::string& label)
const;
279 const fml::Mapping& mapping,
280 const std::vector<Scalar>& defines)
const;
283 bool is_valid_ =
false;
284 std::unique_ptr<DescriptionGLES> description_;
285 std::shared_ptr<const CapabilitiesGLES> capabilities_;
286 GLint debug_label_max_length_ = 0;
295 #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].
void() glDepthRangef(GLfloat n, GLfloat f)
void() glClearDepthf(GLfloat depth)
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)
void() glClearDepth(GLdouble depth)
constexpr bool IsAvailable() const
bool SetDebugLabel(DebugResourceType type, GLint name, const std::string &label) const
FOR_EACH_IMPELLER_EXT_PROC(IMPELLER_PROC)
FOR_EACH_IMPELLER_ES_ONLY_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
FOR_EACH_IMPELLER_DESKTOP_ONLY_PROC(IMPELLER_PROC)
auto operator()(Args &&... args) const
Call the GL function with the appropriate parameters. Lookup the documentation for the GL function be...
void() glDepthRange(GLdouble n, GLdouble f)
bool IsCurrentFramebufferComplete() const
const char * GLErrorToString(GLenum value)
const PFNGLGETERRORPROC error_fn
void PopDebugGroup() const
bool GLErrorIsFatal(GLenum value)
const DescriptionGLES * GetDescription() const