 |
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"
34 if (error == GL_NO_ERROR) {
39 << error <<
")" <<
" encountered on call to " <<
name;
42 <<
")" <<
" encountered on call to " <<
name;
56 const char*
name =
nullptr;
75 template <
class... Args>
77 #if defined(IMPELLER_DEBUG) && !defined(NDEBUG)
82 FML_CHECK(
IsAvailable()) <<
"GL function " <<
name <<
" is not available. "
83 <<
"This is likely due to a missing extension.";
84 #endif // defined(IMPELLER_DEBUG) && !defined(NDEBUG)
85 return function(std::forward<Args>(args)...);
88 constexpr
bool IsAvailable()
const {
return function !=
nullptr; }
96 #define FOR_EACH_IMPELLER_PROC(PROC) \
97 PROC(ActiveTexture); \
99 PROC(BindAttribLocation); \
101 PROC(BindFramebuffer); \
102 PROC(BindRenderbuffer); \
104 PROC(BlendEquationSeparate); \
105 PROC(BlendFuncSeparate); \
107 PROC(BufferSubData); \
108 PROC(CheckFramebufferStatus); \
111 PROC(ClearStencil); \
113 PROC(CompileShader); \
114 PROC(CreateProgram); \
115 PROC(CreateShader); \
117 PROC(DeleteBuffers); \
118 PROC(DeleteFramebuffers); \
119 PROC(DeleteProgram); \
120 PROC(DeleteRenderbuffers); \
121 PROC(DeleteShader); \
122 PROC(DeleteTextures); \
125 PROC(DetachShader); \
127 PROC(DisableVertexAttribArray); \
129 PROC(DrawElements); \
131 PROC(EnableVertexAttribArray); \
133 PROC(FramebufferRenderbuffer); \
134 PROC(FramebufferTexture2D); \
137 PROC(GenerateMipmap); \
138 PROC(GenFramebuffers); \
139 PROC(GenRenderbuffers); \
141 PROC(GetActiveUniform); \
144 PROC(GetFramebufferAttachmentParameteriv); \
146 PROC(GetProgramInfoLog); \
147 PROC(GetProgramiv); \
148 PROC(GetShaderInfoLog); \
152 PROC(GetUniformLocation); \
154 PROC(IsFramebuffer); \
156 PROC(IsRenderbuffer); \
161 PROC(RenderbufferStorage); \
163 PROC(ShaderBinary); \
164 PROC(ShaderSource); \
165 PROC(StencilFuncSeparate); \
166 PROC(StencilMaskSeparate); \
167 PROC(StencilOpSeparate); \
169 PROC(TexSubImage2D); \
170 PROC(TexParameteri); \
171 PROC(TexParameterfv); \
177 PROC(UniformMatrix4fv); \
179 PROC(VertexAttribPointer); \
181 PROC(GetShaderSource); \
188 #define FOR_EACH_IMPELLER_ES_ONLY_PROC(PROC) \
196 #define FOR_EACH_IMPELLER_DESKTOP_ONLY_PROC(PROC) \
200 #define FOR_EACH_IMPELLER_GLES3_PROC(PROC) PROC(BlitFramebuffer);
202 #define FOR_EACH_IMPELLER_EXT_PROC(PROC) \
203 PROC(DebugMessageControlKHR); \
204 PROC(DiscardFramebufferEXT); \
205 PROC(FramebufferTexture2DMultisampleEXT); \
206 PROC(PushDebugGroupKHR); \
207 PROC(PopDebugGroupKHR); \
208 PROC(ObjectLabelKHR); \
209 PROC(RenderbufferStorageMultisampleEXT); \
210 PROC(GenQueriesEXT); \
211 PROC(DeleteQueriesEXT); \
212 PROC(GetQueryObjectui64vEXT); \
213 PROC(BeginQueryEXT); \
215 PROC(GetQueryObjectuivEXT);
228 using Resolver = std::function<
void*(
const char* function_name)>;
234 #define IMPELLER_PROC(name) \
235 GLProc<decltype(gl##name)> name = {"gl" #name, nullptr};
253 const fml::Mapping& mapping,
254 const std::vector<Scalar>& defines = {})
const;
258 const std::shared_ptr<const CapabilitiesGLES>&
GetCapabilities()
const;
268 const std::string& label)
const;
276 const fml::Mapping& mapping,
277 const std::vector<Scalar>& defines)
const;
280 bool is_valid_ =
false;
281 std::unique_ptr<DescriptionGLES> description_;
282 std::shared_ptr<const CapabilitiesGLES> capabilities_;
283 GLint debug_label_max_length_ = 0;
292 #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