 |
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 return function(std::forward<Args>(args)...);
91 constexpr
bool IsAvailable()
const {
return function !=
nullptr; }
99 #define FOR_EACH_IMPELLER_PROC(PROC) \
100 PROC(ActiveTexture); \
101 PROC(AttachShader); \
102 PROC(BindAttribLocation); \
104 PROC(BindFramebuffer); \
105 PROC(BindRenderbuffer); \
107 PROC(BlendEquationSeparate); \
108 PROC(BlendFuncSeparate); \
110 PROC(CheckFramebufferStatus); \
113 PROC(ClearStencil); \
115 PROC(CompileShader); \
116 PROC(CreateProgram); \
117 PROC(CreateShader); \
119 PROC(DeleteBuffers); \
120 PROC(DeleteFramebuffers); \
121 PROC(DeleteProgram); \
122 PROC(DeleteRenderbuffers); \
123 PROC(DeleteShader); \
124 PROC(DeleteTextures); \
127 PROC(DetachShader); \
129 PROC(DisableVertexAttribArray); \
131 PROC(DrawElements); \
133 PROC(EnableVertexAttribArray); \
135 PROC(FramebufferRenderbuffer); \
136 PROC(FramebufferTexture2D); \
139 PROC(GenerateMipmap); \
140 PROC(GenFramebuffers); \
141 PROC(GenRenderbuffers); \
143 PROC(GetActiveUniform); \
146 PROC(GetFramebufferAttachmentParameteriv); \
148 PROC(GetProgramInfoLog); \
149 PROC(GetProgramiv); \
150 PROC(GetShaderInfoLog); \
154 PROC(GetUniformLocation); \
156 PROC(IsFramebuffer); \
158 PROC(IsRenderbuffer); \
163 PROC(RenderbufferStorage); \
165 PROC(ShaderBinary); \
166 PROC(ShaderSource); \
167 PROC(StencilFuncSeparate); \
168 PROC(StencilMaskSeparate); \
169 PROC(StencilOpSeparate); \
171 PROC(TexSubImage2D); \
172 PROC(TexParameteri); \
173 PROC(TexParameterfv); \
179 PROC(UniformMatrix4fv); \
181 PROC(VertexAttribPointer); \
183 PROC(GetShaderSource); \
190 #define FOR_EACH_IMPELLER_ES_ONLY_PROC(PROC) \
198 #define FOR_EACH_IMPELLER_DESKTOP_ONLY_PROC(PROC) \
202 #define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer);
204 #define FOR_EACH_IMPELLER_EXT_PROC(PROC) \
205 PROC(DebugMessageControlKHR); \
206 PROC(DiscardFramebufferEXT); \
207 PROC(FramebufferTexture2DMultisampleEXT); \
208 PROC(PushDebugGroupKHR); \
209 PROC(PopDebugGroupKHR); \
210 PROC(ObjectLabelKHR); \
211 PROC(RenderbufferStorageMultisampleEXT); \
212 PROC(GenQueriesEXT); \
213 PROC(DeleteQueriesEXT); \
214 PROC(GetQueryObjectui64vEXT); \
215 PROC(BeginQueryEXT); \
217 PROC(GetQueryObjectuivEXT);
230 using Resolver = std::function<
void*(
const char* function_name)>;
236 #define IMPELLER_PROC(name) \
237 GLProc<decltype(gl##name)> name = {"gl" #name, nullptr};
255 const fml::Mapping& mapping,
256 const std::vector<Scalar>& defines = {})
const;
260 const std::shared_ptr<const CapabilitiesGLES>&
GetCapabilities()
const;
270 const std::string& label)
const;
278 const fml::Mapping& mapping,
279 const std::vector<Scalar>& defines)
const;
282 bool is_valid_ =
false;
283 std::unique_ptr<DescriptionGLES> description_;
284 std::shared_ptr<const CapabilitiesGLES> capabilities_;
285 GLint debug_label_max_length_ = 0;
294 #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