27template <
typename T,
typename U>
30template <
typename Ret,
typename... Args>
45struct function_traits;
47template <
typename C,
typename Ret,
typename... Args>
48struct function_traits<Ret (C::*)(Args...)> {
49 using return_type = Ret;
52template <
typename Func,
typename... Args>
53auto CallMockMethod(Func func, Args&&...
args) {
55 if (mock_gles->GetImpl()) {
56 return (mock_gles->GetImpl()->*func)(std::forward<Args>(
args)...);
59 return typename function_traits<Func>::return_type();
66 return reinterpret_cast<const unsigned char*
>(
kMockVendor);
68 return reinterpret_cast<const unsigned char*
>(
g_version);
70 return reinterpret_cast<const unsigned char*
>(
72 case GL_SHADING_LANGUAGE_VERSION:
73 return reinterpret_cast<const unsigned char*
>(
76 return reinterpret_cast<const unsigned char*
>(
"");
81 decltype(glGetString)>::value);
86 return reinterpret_cast<const unsigned char*
>(
g_extensions[index]);
88 return reinterpret_cast<const unsigned char*
>(
"");
93 decltype(glGetStringi)>::value);
97 case GL_NUM_EXTENSIONS: {
100 case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
103 case GL_MAX_LABEL_LENGTH_KHR:
106 case GL_MAX_TEXTURE_SIZE:
116 decltype(glGetIntegerv)>::value);
123 decltype(glGetError)>::value);
128 decltype(glPopDebugGroupKHR)>::value);
136 decltype(glPushDebugGroupKHR)>::value);
143 decltype(glGenQueriesEXT)>::value);
150 decltype(glBeginQueryEXT)>::value);
157 decltype(glEndQueryEXT)>::value);
164 decltype(glGetQueryObjectuivEXT)>::value);
171 decltype(glGetQueryObjectui64vEXT)>::value);
182 decltype(glDeleteQueriesEXT)>::value);
192 decltype(glUniform2fv)>::value);
198 decltype(glUniform3fv)>::value);
204 decltype(glUniform4fv)>::value);
209 const GLfloat* value) {
214 decltype(glUniformMatrix2fv)>::value);
219 const GLfloat* value) {
224 decltype(glUniformMatrix3fv)>::value);
229 const GLfloat* value) {
234 decltype(glUniformMatrix4fv)>::value);
241 decltype(glGenTextures)>::value);
248 decltype(glGenTextures)>::value);
253 const GLchar* label) {
258 decltype(glObjectLabelKHR)>::value);
268 const void* pixels) {
273 decltype(glTexSubImage2D)>::value);
277 GLint internalformat,
283 const void* pixels) {
288 decltype(glTexImage2D)>::value);
294 decltype(glBindTexture)>::value);
301 decltype(glIsTexture)>::value);
308 decltype(glCheckFramebufferStatus)>::value);
315 decltype(glGenFramebuffers)>::value);
322 decltype(glBindFramebuffer)>::value);
336 GLsizei numAttachments,
337 const GLenum* attachments) {
339 numAttachments, attachments);
347 decltype(glDiscardFramebufferEXT)>::value);
350 GLsizei numAttachments,
351 const GLenum* attachments) {
353 numAttachments, attachments);
357 decltype(glInvalidateFramebuffer)>::value);
361 std::unique_ptr<MockGLESImpl> impl,
362 const std::optional<std::vector<const char*>>& extensions,
363 const char* version_string) {
365 <<
"MockGLES is already being used by another test.";
375 auto mock_gles = std::shared_ptr<MockGLES>(
new MockGLES());
376 mock_gles->impl_ = std::move(impl);
382 const std::optional<std::vector<const char*>>& extensions,
383 const char* version_string,
387 <<
"MockGLES is already being used by another test.";
397 auto mock_gles = std::shared_ptr<MockGLES>(
new MockGLES(std::move(resolver)));
403 if (strcmp(
name,
"glPopDebugGroupKHR") == 0) {
405 }
else if (strcmp(
name,
"glPushDebugGroupKHR") == 0) {
407 }
else if (strcmp(
name,
"glGetString") == 0) {
409 }
else if (strcmp(
name,
"glGetStringi") == 0) {
411 }
else if (strcmp(
name,
"glGetIntegerv") == 0) {
413 }
else if (strcmp(
name,
"glGetError") == 0) {
415 }
else if (strcmp(
name,
"glGenQueriesEXT") == 0) {
417 }
else if (strcmp(
name,
"glBeginQueryEXT") == 0) {
419 }
else if (strcmp(
name,
"glEndQueryEXT") == 0) {
421 }
else if (strcmp(
name,
"glDeleteQueriesEXT") == 0) {
423 }
else if (strcmp(
name,
"glDeleteTextures") == 0) {
425 }
else if (strcmp(
name,
"glGetQueryObjectui64vEXT") == 0) {
427 }
else if (strcmp(
name,
"glGetQueryObjectuivEXT") == 0) {
429 }
else if (strcmp(
name,
"glUniform1fv") == 0) {
431 }
else if (strcmp(
name,
"glUniform2fv") == 0) {
433 }
else if (strcmp(
name,
"glUniform3fv") == 0) {
435 }
else if (strcmp(
name,
"glUniform4fv") == 0) {
437 }
else if (strcmp(
name,
"glUniformMatrix2fv") == 0) {
439 }
else if (strcmp(
name,
"glUniformMatrix3fv") == 0) {
441 }
else if (strcmp(
name,
"glUniformMatrix4fv") == 0) {
443 }
else if (strcmp(
name,
"glGenTextures") == 0) {
445 }
else if (strcmp(
name,
"glTexSubImage2D") == 0) {
447 }
else if (strcmp(
name,
"glTexImage2D") == 0) {
449 }
else if (strcmp(
name,
"glBindTexture") == 0) {
451 }
else if (strcmp(
name,
"glObjectLabelKHR") == 0) {
453 }
else if (strcmp(
name,
"glGenBuffers") == 0) {
455 }
else if (strcmp(
name,
"glIsTexture") == 0) {
457 }
else if (strcmp(
name,
"glCheckFramebufferStatus") == 0) {
459 }
else if (strcmp(
name,
"glReadPixels") == 0) {
461 }
else if (strcmp(
name,
"glGenFramebuffers") == 0) {
463 }
else if (strcmp(
name,
"glBindFramebuffer") == 0) {
465 }
else if (strcmp(
name,
"glDiscardFramebufferEXT") == 0) {
467 }
else if (strcmp(
name,
"glInvalidateFramebuffer") == 0) {
469 }
else if (strcmp(
name,
"glViewport") == 0) {
472 return reinterpret_cast<void*
>(&
doNothing);
477 : proc_table_(
std::move(resolver)) {}
479MockGLES::~MockGLES() {
std::function< void *(const char *function_name)> Resolver
virtual void GenFramebuffers(GLsizei n, GLuint *framebuffers)
virtual void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
virtual void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
virtual void Uniform2fv(GLint location, GLsizei count, const GLfloat *value)
virtual void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
virtual void GenBuffers(GLsizei n, GLuint *buffers)
virtual void GetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
virtual void GetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
virtual void DeleteQueriesEXT(GLsizei size, const GLuint *queries)
virtual void ObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
virtual void BindTexture(GLenum target, GLuint texture)
virtual void EndQueryEXT(GLuint id)
virtual void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
virtual void DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
virtual void DeleteTextures(GLsizei size, const GLuint *queries)
virtual void GenQueriesEXT(GLsizei n, GLuint *ids)
virtual void Uniform4fv(GLint location, GLsizei count, const GLfloat *value)
virtual void BeginQueryEXT(GLenum target, GLuint id)
virtual void BindFramebuffer(GLenum target, GLuint framebuffer)
virtual void GetIntegerv(GLenum name, GLint *attachments)
virtual void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
virtual GLboolean IsTexture(GLuint texture)
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
virtual void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
virtual void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
virtual void Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
virtual void Uniform3fv(GLint location, GLsizei count, const GLfloat *value)
virtual void GenTextures(GLsizei n, GLuint *textures)
virtual GLenum CheckFramebufferStatus(GLenum target)
Provides a mocked version of the |ProcTableGLES| class.
static std::shared_ptr< MockGLES > Init(std::unique_ptr< MockGLESImpl > impl, const std::optional< std::vector< const char * > > &extensions=std::nullopt, const char *version_string="OpenGL ES 3.0")
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
#define FML_CHECK(condition)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
void mockDeleteQueriesEXT(GLsizei size, const GLuint *queries)
void mockGetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
static std::mutex g_test_lock
void mockDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
const auto kMockShadingLanguageVersion
void mockPopDebugGroupKHR()
const unsigned char * mockGetStringi(GLenum name, GLuint index)
void mockUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
void mockGetIntegerv(GLenum name, int *value)
static std::vector< const char * > g_extensions
void mockGetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
GLboolean mockIsTexture(GLuint texture)
static std::string g_extensions_string
void mockReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data)
void mockUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
void mockTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
static std::weak_ptr< MockGLES > g_mock_gles
void mockUniform4fv(GLint location, GLsizei count, const GLfloat *value)
void mockTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
void mockDeleteTextures(GLsizei size, const GLuint *queries)
void mockUniform2fv(GLint location, GLsizei count, const GLfloat *value)
GLenum mockCheckFramebufferStatus(GLenum target)
void mockUniform1fv(GLint location, GLsizei count, const GLfloat *value)
void mockObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
void mockBindTexture(GLenum target, GLuint texture)
static const char * g_version
const ProcTableGLES::Resolver kMockResolverGLES
void mockUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
void mockPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message)
void mockUniform3fv(GLint location, GLsizei count, const GLfloat *value)
void mockBindFramebuffer(GLenum target, GLuint framebuffer)
void mockEndQueryEXT(GLuint id)
void mockGenBuffers(GLsizei n, GLuint *buffers)
void mockInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
void mockGenFramebuffers(GLsizei n, GLuint *ids)
void mockGenQueriesEXT(GLsizei n, GLuint *ids)
const unsigned char * mockGetString(GLenum name)
void mockBeginQueryEXT(GLenum target, GLuint id)
void mockViewport(GLint x, GLint y, GLsizei width, GLsizei height)
void mockGenTextures(GLsizei n, GLuint *textures)
impeller::ShaderType type