Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
mock_gles.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <memory>
6
7#include "GLES3/gl3.h"
8#include "fml/logging.h"
11
12namespace impeller {
13namespace testing {
14
15// OpenGLES is not thread safe.
16//
17// This mutex is used to ensure that only one test is using the mock at a time.
18static std::mutex g_test_lock;
19
20static std::weak_ptr<MockGLES> g_mock_gles;
21
22static std::vector<const char*> g_extensions;
23
24static const char* g_version;
25static std::string g_extensions_string;
26
27template <typename T, typename U>
28struct CheckSameSignature : std::false_type {};
29
30template <typename Ret, typename... Args>
31struct CheckSameSignature<Ret(Args...), Ret(Args...)> : std::true_type {};
32
33// This is a stub function that does nothing/records nothing.
34void doNothing() {}
35
36auto const kMockVendor = "MockGLES";
37const auto kMockShadingLanguageVersion = "GLSL ES 1.0";
38auto const kExtensions = std::vector<const char*>{
39 "GL_KHR_debug" //
40};
41
42namespace {
43
44template <typename T>
45struct function_traits;
46
47template <typename C, typename Ret, typename... Args>
48struct function_traits<Ret (C::*)(Args...)> {
49 using return_type = Ret;
50};
51
52template <typename Func, typename... Args>
53auto CallMockMethod(Func func, Args&&... args) {
54 if (auto mock_gles = g_mock_gles.lock()) {
55 if (mock_gles->GetImpl()) {
56 return (mock_gles->GetImpl()->*func)(std::forward<Args>(args)...);
57 }
58 }
59 return typename function_traits<Func>::return_type();
60}
61} // namespace
62
63const unsigned char* mockGetString(GLenum name) {
64 switch (name) {
65 case GL_VENDOR:
66 return reinterpret_cast<const unsigned char*>(kMockVendor);
67 case GL_VERSION:
68 return reinterpret_cast<const unsigned char*>(g_version);
69 case GL_EXTENSIONS:
70 return reinterpret_cast<const unsigned char*>(
71 g_extensions_string.c_str());
72 case GL_SHADING_LANGUAGE_VERSION:
73 return reinterpret_cast<const unsigned char*>(
75 default:
76 return reinterpret_cast<const unsigned char*>("");
77 }
78}
79
80static_assert(CheckSameSignature<decltype(mockGetString), //
81 decltype(glGetString)>::value);
82
83const unsigned char* mockGetStringi(GLenum name, GLuint index) {
84 switch (name) {
85 case GL_EXTENSIONS:
86 return reinterpret_cast<const unsigned char*>(g_extensions[index]);
87 default:
88 return reinterpret_cast<const unsigned char*>("");
89 }
90}
91
92static_assert(CheckSameSignature<decltype(mockGetStringi), //
93 decltype(glGetStringi)>::value);
94
95void mockGetIntegerv(GLenum name, int* value) {
96 switch (name) {
97 case GL_NUM_EXTENSIONS: {
98 *value = g_extensions.size();
99 } break;
100 case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
101 *value = 8;
102 break;
103 case GL_MAX_LABEL_LENGTH_KHR:
104 *value = 64;
105 break;
106 case GL_MAX_TEXTURE_SIZE:
107 *value = 4096;
108 break;
109 default:
110 CallMockMethod(&IMockGLESImpl::GetIntegerv, name, value);
111 break;
112 }
113}
114
115static_assert(CheckSameSignature<decltype(mockGetIntegerv), //
116 decltype(glGetIntegerv)>::value);
117
118GLenum mockGetError() {
119 return GL_NO_ERROR;
120}
121
122static_assert(CheckSameSignature<decltype(mockGetError), //
123 decltype(glGetError)>::value);
124
126
127static_assert(CheckSameSignature<decltype(mockPopDebugGroupKHR), //
128 decltype(glPopDebugGroupKHR)>::value);
129
130void mockPushDebugGroupKHR(GLenum source,
131 GLuint id,
132 GLsizei length,
133 const GLchar* message) {}
134
135static_assert(CheckSameSignature<decltype(mockPushDebugGroupKHR), //
136 decltype(glPushDebugGroupKHR)>::value);
137
138void mockGenQueriesEXT(GLsizei n, GLuint* ids) {
139 CallMockMethod(&IMockGLESImpl::GenQueriesEXT, n, ids);
140}
141
142static_assert(CheckSameSignature<decltype(mockGenQueriesEXT), //
143 decltype(glGenQueriesEXT)>::value);
144
145void mockBeginQueryEXT(GLenum target, GLuint id) {
146 CallMockMethod(&IMockGLESImpl::BeginQueryEXT, target, id);
147}
148
149static_assert(CheckSameSignature<decltype(mockBeginQueryEXT), //
150 decltype(glBeginQueryEXT)>::value);
151
152void mockEndQueryEXT(GLuint id) {
153 CallMockMethod(&IMockGLESImpl::EndQueryEXT, id);
154}
155
156static_assert(CheckSameSignature<decltype(mockEndQueryEXT), //
157 decltype(glEndQueryEXT)>::value);
158
159void mockGetQueryObjectuivEXT(GLuint id, GLenum target, GLuint* result) {
160 CallMockMethod(&IMockGLESImpl::GetQueryObjectuivEXT, id, target, result);
161}
162
163static_assert(CheckSameSignature<decltype(mockGetQueryObjectuivEXT), //
164 decltype(glGetQueryObjectuivEXT)>::value);
165
166void mockGetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64* result) {
167 CallMockMethod(&IMockGLESImpl::GetQueryObjectui64vEXT, id, target, result);
168}
169
170static_assert(CheckSameSignature<decltype(mockGetQueryObjectui64vEXT), //
171 decltype(glGetQueryObjectui64vEXT)>::value);
172
173void mockDeleteQueriesEXT(GLsizei size, const GLuint* queries) {
174 CallMockMethod(&IMockGLESImpl::DeleteQueriesEXT, size, queries);
175}
176
177void mockDeleteTextures(GLsizei size, const GLuint* queries) {
178 CallMockMethod(&IMockGLESImpl::DeleteTextures, size, queries);
179}
180
181static_assert(CheckSameSignature<decltype(mockDeleteQueriesEXT), //
182 decltype(glDeleteQueriesEXT)>::value);
183
184void mockUniform1fv(GLint location, GLsizei count, const GLfloat* value) {
185 CallMockMethod(&IMockGLESImpl::Uniform1fv, location, count, value);
186}
187// Uniform1fv is already here, adding others
188void mockUniform2fv(GLint location, GLsizei count, const GLfloat* value) {
189 CallMockMethod(&IMockGLESImpl::Uniform2fv, location, count, value);
190}
191static_assert(CheckSameSignature<decltype(mockUniform2fv), //
192 decltype(glUniform2fv)>::value);
193
194void mockUniform3fv(GLint location, GLsizei count, const GLfloat* value) {
195 CallMockMethod(&IMockGLESImpl::Uniform3fv, location, count, value);
196}
197static_assert(CheckSameSignature<decltype(mockUniform3fv), //
198 decltype(glUniform3fv)>::value);
199
200void mockUniform4fv(GLint location, GLsizei count, const GLfloat* value) {
201 CallMockMethod(&IMockGLESImpl::Uniform4fv, location, count, value);
202}
203static_assert(CheckSameSignature<decltype(mockUniform4fv), //
204 decltype(glUniform4fv)>::value);
205
207 GLsizei count,
208 GLboolean transpose,
209 const GLfloat* value) {
210 CallMockMethod(&IMockGLESImpl::UniformMatrix2fv, location, count, transpose,
211 value);
212}
213static_assert(CheckSameSignature<decltype(mockUniformMatrix2fv), //
214 decltype(glUniformMatrix2fv)>::value);
215
217 GLsizei count,
218 GLboolean transpose,
219 const GLfloat* value) {
220 CallMockMethod(&IMockGLESImpl::UniformMatrix3fv, location, count, transpose,
221 value);
222}
223static_assert(CheckSameSignature<decltype(mockUniformMatrix3fv), //
224 decltype(glUniformMatrix3fv)>::value);
225
227 GLsizei count,
228 GLboolean transpose,
229 const GLfloat* value) {
230 CallMockMethod(&IMockGLESImpl::UniformMatrix4fv, location, count, transpose,
231 value);
232}
233static_assert(CheckSameSignature<decltype(mockUniformMatrix4fv), //
234 decltype(glUniformMatrix4fv)>::value);
235
236void mockGenTextures(GLsizei n, GLuint* textures) {
237 CallMockMethod(&IMockGLESImpl::GenTextures, n, textures);
238}
239
240static_assert(CheckSameSignature<decltype(mockGenTextures), //
241 decltype(glGenTextures)>::value);
242
243void mockGenBuffers(GLsizei n, GLuint* buffers) {
244 CallMockMethod(&IMockGLESImpl::GenBuffers, n, buffers);
245}
246
248 GLintptr offset,
249 GLsizeiptr size,
250 const void* data) {
251 CallMockMethod(&IMockGLESImpl::BufferSubData, target, offset, size, data);
252}
253
254static_assert(CheckSameSignature<decltype(mockBufferSubData), //
255 decltype(glBufferSubData)>::value);
256
257static_assert(CheckSameSignature<decltype(mockGenTextures), //
258 decltype(glGenTextures)>::value);
259
260void mockObjectLabelKHR(GLenum identifier,
261 GLuint name,
262 GLsizei length,
263 const GLchar* label) {
264 CallMockMethod(&IMockGLESImpl::ObjectLabelKHR, identifier, name, length,
265 label);
266}
267static_assert(CheckSameSignature<decltype(mockObjectLabelKHR), //
268 decltype(glObjectLabelKHR)>::value);
269
271 GLint level,
272 GLint xoffset,
273 GLint yoffset,
274 GLsizei width,
275 GLsizei height,
276 GLenum format,
277 GLenum type,
278 const void* pixels) {
279 CallMockMethod(&IMockGLESImpl::TexSubImage2D, target, level, xoffset, yoffset,
280 width, height, format, type, pixels);
281}
282static_assert(CheckSameSignature<decltype(mockTexSubImage2D), //
283 decltype(glTexSubImage2D)>::value);
284
286 GLint level,
287 GLint internalformat,
288 GLsizei width,
289 GLsizei height,
290 GLint border,
291 GLenum format,
292 GLenum type,
293 const void* pixels) {
294 CallMockMethod(&IMockGLESImpl::TexImage2D, target, level, internalformat,
295 width, height, border, format, type, pixels);
296}
297static_assert(CheckSameSignature<decltype(mockTexImage2D), //
298 decltype(glTexImage2D)>::value);
299
300void mockBindTexture(GLenum target, GLuint texture) {
301 CallMockMethod(&IMockGLESImpl::BindTexture, target, texture);
302}
303static_assert(CheckSameSignature<decltype(mockBindTexture), //
304 decltype(glBindTexture)>::value);
305
306GLboolean mockIsTexture(GLuint texture) {
307 return CallMockMethod(&IMockGLESImpl::IsTexture, texture);
308}
309
310static_assert(CheckSameSignature<decltype(mockIsTexture), //
311 decltype(glIsTexture)>::value);
312
314 return CallMockMethod(&IMockGLESImpl::CheckFramebufferStatus, target);
315}
316
317static_assert(CheckSameSignature<decltype(mockCheckFramebufferStatus), //
318 decltype(glCheckFramebufferStatus)>::value);
319
320void mockGenFramebuffers(GLsizei n, GLuint* ids) {
321 return CallMockMethod(&IMockGLESImpl::GenFramebuffers, n, ids);
322}
323
324static_assert(CheckSameSignature<decltype(mockGenFramebuffers), //
325 decltype(glGenFramebuffers)>::value);
326
327void mockBindFramebuffer(GLenum target, GLuint framebuffer) {
328 return CallMockMethod(&IMockGLESImpl::BindFramebuffer, target, framebuffer);
329}
330
331static_assert(CheckSameSignature<decltype(mockBindFramebuffer), //
332 decltype(glBindFramebuffer)>::value);
333
334void mockReadPixels(GLint x,
335 GLint y,
336 GLsizei width,
337 GLsizei height,
338 GLenum format,
339 GLenum type,
340 void* data) {
341 return CallMockMethod(&IMockGLESImpl::ReadPixels, x, y, width, height, format,
342 type, data);
343}
344
346 GLsizei numAttachments,
347 const GLenum* attachments) {
348 return CallMockMethod(&IMockGLESImpl::DiscardFramebufferEXT, target,
349 numAttachments, attachments);
350}
351
352void mockViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
353 return CallMockMethod(&IMockGLESImpl::Viewport, x, y, width, height);
354}
355
356static_assert(CheckSameSignature<decltype(mockDiscardFramebufferEXT), //
357 decltype(glDiscardFramebufferEXT)>::value);
358
360 GLsizei numAttachments,
361 const GLenum* attachments) {
362 return CallMockMethod(&IMockGLESImpl::InvalidateFramebuffer, target,
363 numAttachments, attachments);
364}
365
366static_assert(CheckSameSignature<decltype(mockInvalidateFramebuffer), //
367 decltype(glInvalidateFramebuffer)>::value);
368
369void mockDrawArrays(GLenum mode, GLint first, GLsizei count) {
370 CallMockMethod(&IMockGLESImpl::DrawArrays, mode, first, count);
371}
372
373static_assert(CheckSameSignature<decltype(mockDrawArrays), //
374 decltype(glDrawArrays)>::value);
375
376void mockDrawElements(GLenum mode,
377 GLsizei count,
378 GLenum type,
379 const void* indices) {
380 CallMockMethod(&IMockGLESImpl::DrawElements, mode, count, type, indices);
381}
382
383static_assert(CheckSameSignature<decltype(mockDrawElements), //
384 decltype(glDrawElements)>::value);
385
386void mockDrawArraysInstanced(GLenum mode,
387 GLint first,
388 GLsizei count,
389 GLsizei instancecount) {
390 CallMockMethod(&IMockGLESImpl::DrawArraysInstanced, mode, first, count,
391 instancecount);
392}
393
394static_assert(CheckSameSignature<decltype(mockDrawArraysInstanced), //
395 decltype(glDrawArraysInstanced)>::value);
396
398 GLsizei count,
399 GLenum type,
400 const void* indices,
401 GLsizei instancecount) {
402 CallMockMethod(&IMockGLESImpl::DrawElementsInstanced, mode, count, type,
403 indices, instancecount);
404}
405
406static_assert(CheckSameSignature<decltype(mockDrawElementsInstanced), //
407 decltype(glDrawElementsInstanced)>::value);
408
409void mockVertexAttribDivisor(GLuint index, GLuint divisor) {
410 CallMockMethod(&IMockGLESImpl::VertexAttribDivisor, index, divisor);
411}
412
413static_assert(CheckSameSignature<decltype(mockVertexAttribDivisor), //
414 decltype(glVertexAttribDivisor)>::value);
415
416// static
417std::shared_ptr<MockGLES> MockGLES::Init(
418 std::unique_ptr<MockGLESImpl> impl,
419 const std::optional<std::vector<const char*>>& extensions,
420 const char* version_string) {
421 FML_CHECK(g_test_lock.try_lock())
422 << "MockGLES is already being used by another test.";
423 g_extensions = extensions.value_or(kExtensions);
424 g_extensions_string.clear();
425 for (const auto& ext : g_extensions) {
426 if (!g_extensions_string.empty()) {
427 g_extensions_string += " ";
428 }
429 g_extensions_string += ext;
430 }
431 g_version = version_string;
432 auto mock_gles = std::shared_ptr<MockGLES>(new MockGLES());
433 mock_gles->impl_ = std::move(impl);
434 g_mock_gles = mock_gles;
435 return mock_gles;
436}
437
438std::shared_ptr<MockGLES> MockGLES::Init(
439 const std::optional<std::vector<const char*>>& extensions,
440 const char* version_string,
441 ProcTableGLES::Resolver resolver) {
442 // If we cannot obtain a lock, MockGLES is already being used elsewhere.
443 FML_CHECK(g_test_lock.try_lock())
444 << "MockGLES is already being used by another test.";
445 g_extensions = extensions.value_or(kExtensions);
446 g_extensions_string.clear();
447 for (const auto& ext : g_extensions) {
448 if (!g_extensions_string.empty()) {
449 g_extensions_string += " ";
450 }
451 g_extensions_string += ext;
452 }
453 g_version = version_string;
454 auto mock_gles = std::shared_ptr<MockGLES>(new MockGLES(std::move(resolver)));
455 g_mock_gles = mock_gles;
456 return mock_gles;
457}
458
460 if (strcmp(name, "glPopDebugGroupKHR") == 0) {
461 return reinterpret_cast<void*>(&mockPopDebugGroupKHR);
462 } else if (strcmp(name, "glPushDebugGroupKHR") == 0) {
463 return reinterpret_cast<void*>(&mockPushDebugGroupKHR);
464 } else if (strcmp(name, "glGetString") == 0) {
465 return reinterpret_cast<void*>(&mockGetString);
466 } else if (strcmp(name, "glGetStringi") == 0) {
467 return reinterpret_cast<void*>(&mockGetStringi);
468 } else if (strcmp(name, "glGetIntegerv") == 0) {
469 return reinterpret_cast<void*>(&mockGetIntegerv);
470 } else if (strcmp(name, "glGetError") == 0) {
471 return reinterpret_cast<void*>(&mockGetError);
472 } else if (strcmp(name, "glGenQueriesEXT") == 0) {
473 return reinterpret_cast<void*>(&mockGenQueriesEXT);
474 } else if (strcmp(name, "glBeginQueryEXT") == 0) {
475 return reinterpret_cast<void*>(&mockBeginQueryEXT);
476 } else if (strcmp(name, "glEndQueryEXT") == 0) {
477 return reinterpret_cast<void*>(&mockEndQueryEXT);
478 } else if (strcmp(name, "glDeleteQueriesEXT") == 0) {
479 return reinterpret_cast<void*>(&mockDeleteQueriesEXT);
480 } else if (strcmp(name, "glDeleteTextures") == 0) {
481 return reinterpret_cast<void*>(&mockDeleteTextures);
482 } else if (strcmp(name, "glGetQueryObjectui64vEXT") == 0) {
483 return reinterpret_cast<void*>(mockGetQueryObjectui64vEXT);
484 } else if (strcmp(name, "glGetQueryObjectuivEXT") == 0) {
485 return reinterpret_cast<void*>(mockGetQueryObjectuivEXT);
486 } else if (strcmp(name, "glUniform1fv") == 0) {
487 return reinterpret_cast<void*>(mockUniform1fv);
488 } else if (strcmp(name, "glUniform2fv") == 0) {
489 return reinterpret_cast<void*>(mockUniform2fv);
490 } else if (strcmp(name, "glUniform3fv") == 0) {
491 return reinterpret_cast<void*>(mockUniform3fv);
492 } else if (strcmp(name, "glUniform4fv") == 0) {
493 return reinterpret_cast<void*>(mockUniform4fv);
494 } else if (strcmp(name, "glUniformMatrix2fv") == 0) {
495 return reinterpret_cast<void*>(mockUniformMatrix2fv);
496 } else if (strcmp(name, "glUniformMatrix3fv") == 0) {
497 return reinterpret_cast<void*>(mockUniformMatrix3fv);
498 } else if (strcmp(name, "glUniformMatrix4fv") == 0) {
499 return reinterpret_cast<void*>(mockUniformMatrix4fv);
500 } else if (strcmp(name, "glGenTextures") == 0) {
501 return reinterpret_cast<void*>(mockGenTextures);
502 } else if (strcmp(name, "glTexSubImage2D") == 0) {
503 return reinterpret_cast<void*>(mockTexSubImage2D);
504 } else if (strcmp(name, "glTexImage2D") == 0) {
505 return reinterpret_cast<void*>(mockTexImage2D);
506 } else if (strcmp(name, "glBindTexture") == 0) {
507 return reinterpret_cast<void*>(mockBindTexture);
508 } else if (strcmp(name, "glObjectLabelKHR") == 0) {
509 return reinterpret_cast<void*>(mockObjectLabelKHR);
510 } else if (strcmp(name, "glGenBuffers") == 0) {
511 return reinterpret_cast<void*>(mockGenBuffers);
512 } else if (strcmp(name, "glBufferSubData") == 0) {
513 return reinterpret_cast<void*>(mockBufferSubData);
514 } else if (strcmp(name, "glIsTexture") == 0) {
515 return reinterpret_cast<void*>(mockIsTexture);
516 } else if (strcmp(name, "glCheckFramebufferStatus") == 0) {
517 return reinterpret_cast<void*>(mockCheckFramebufferStatus);
518 } else if (strcmp(name, "glReadPixels") == 0) {
519 return reinterpret_cast<void*>(mockReadPixels);
520 } else if (strcmp(name, "glGenFramebuffers") == 0) {
521 return reinterpret_cast<void*>(mockGenFramebuffers);
522 } else if (strcmp(name, "glBindFramebuffer") == 0) {
523 return reinterpret_cast<void*>(mockBindFramebuffer);
524 } else if (strcmp(name, "glDiscardFramebufferEXT") == 0) {
525 return reinterpret_cast<void*>(mockDiscardFramebufferEXT);
526 } else if (strcmp(name, "glInvalidateFramebuffer") == 0) {
527 return reinterpret_cast<void*>(mockInvalidateFramebuffer);
528 } else if (strcmp(name, "glViewport") == 0) {
529 return reinterpret_cast<void*>(mockViewport);
530 } else if (strcmp(name, "glDrawArrays") == 0) {
531 return reinterpret_cast<void*>(mockDrawArrays);
532 } else if (strcmp(name, "glDrawElements") == 0) {
533 return reinterpret_cast<void*>(mockDrawElements);
534 } else if (strcmp(name, "glDrawArraysInstanced") == 0) {
535 return reinterpret_cast<void*>(mockDrawArraysInstanced);
536 } else if (strcmp(name, "glDrawElementsInstanced") == 0) {
537 return reinterpret_cast<void*>(mockDrawElementsInstanced);
538 } else if (strcmp(name, "glVertexAttribDivisor") == 0) {
539 return reinterpret_cast<void*>(mockVertexAttribDivisor);
540 } else {
541 return reinterpret_cast<void*>(&doNothing);
542 }
543};
544
546 [](const char* name) -> void* {
547 // Hide the hardware instancing entry points so the OpenGL ES backend takes
548 // its emulation path. The proc table retries these names with the "EXT"
549 // suffix stripped, so both spellings are rejected here.
550 if (strcmp(name, "glDrawArraysInstancedEXT") == 0 ||
551 strcmp(name, "glDrawArraysInstanced") == 0 ||
552 strcmp(name, "glDrawElementsInstancedEXT") == 0 ||
553 strcmp(name, "glDrawElementsInstanced") == 0 ||
554 strcmp(name, "glVertexAttribDivisorEXT") == 0 ||
555 strcmp(name, "glVertexAttribDivisor") == 0) {
556 return nullptr;
557 }
558 return kMockResolverGLES(name);
559};
560
561MockGLES::MockGLES(ProcTableGLES::Resolver resolver)
562 : proc_table_(std::move(resolver)) {}
563
564MockGLES::~MockGLES() {
565 g_test_lock.unlock();
566}
567
568} // namespace testing
569} // namespace impeller
std::function< void *(const char *function_name)> Resolver
virtual void GenFramebuffers(GLsizei n, GLuint *framebuffers)
Definition mock_gles.h:48
virtual void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
Definition mock_gles.h:39
virtual void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
Definition mock_gles.h:108
virtual void Uniform2fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.h:72
virtual void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
Definition mock_gles.h:100
virtual void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.h:86
virtual void GenBuffers(GLsizei n, GLuint *buffers)
Definition mock_gles.h:98
virtual void GetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
Definition mock_gles.h:94
virtual void GetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
Definition mock_gles.h:93
virtual void DeleteQueriesEXT(GLsizei size, const GLuint *queries)
Definition mock_gles.h:97
virtual void DrawArrays(GLenum mode, GLint first, GLsizei count)
Definition mock_gles.h:113
virtual void ObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
Definition mock_gles.h:66
virtual void BindTexture(GLenum target, GLuint texture)
Definition mock_gles.h:29
virtual void EndQueryEXT(GLuint id)
Definition mock_gles.h:92
virtual void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.h:82
virtual void DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
Definition mock_gles.h:105
virtual void DeleteTextures(GLsizei size, const GLuint *queries)
Definition mock_gles.h:27
virtual void GenQueriesEXT(GLsizei n, GLuint *ids)
Definition mock_gles.h:90
virtual void VertexAttribDivisor(GLuint index, GLuint divisor)
Definition mock_gles.h:127
virtual void DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
Definition mock_gles.h:114
virtual void Uniform4fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.h:76
virtual void BeginQueryEXT(GLenum target, GLuint id)
Definition mock_gles.h:91
virtual void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
Definition mock_gles.h:118
virtual void BindFramebuffer(GLenum target, GLuint framebuffer)
Definition mock_gles.h:49
virtual void GetIntegerv(GLenum name, GLint *attachments)
Definition mock_gles.h:111
virtual void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
Definition mock_gles.h:30
virtual GLboolean IsTexture(GLuint texture)
Definition mock_gles.h:104
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
Definition mock_gles.h:112
virtual void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
Definition mock_gles.h:122
virtual void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
Definition mock_gles.h:58
virtual void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.h:78
virtual void Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.h:70
virtual void Uniform3fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.h:74
virtual void GenTextures(GLsizei n, GLuint *textures)
Definition mock_gles.h:28
virtual GLenum CheckFramebufferStatus(GLenum target)
Definition mock_gles.h:55
Provides a mocked version of the |ProcTableGLES| class.
Definition mock_gles.h:312
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")
Definition mock_gles.cc:417
uint32_t location
int32_t value
int32_t x
const char * message
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format
uint32_t * target
#define FML_CHECK(condition)
Definition logging.h:104
size_t length
FlTexture * texture
double y
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
Definition switch_defs.h:27
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switch_defs.h:36
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 mode
void mockDeleteQueriesEXT(GLsizei size, const GLuint *queries)
Definition mock_gles.cc:173
void mockGetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
Definition mock_gles.cc:159
static std::mutex g_test_lock
Definition mock_gles.cc:18
GLenum mockGetError()
Definition mock_gles.cc:118
const ProcTableGLES::Resolver kMockResolverGLESWithoutInstancing
Definition mock_gles.cc:545
void mockDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
Definition mock_gles.cc:345
const auto kMockShadingLanguageVersion
Definition mock_gles.cc:37
void mockPopDebugGroupKHR()
Definition mock_gles.cc:125
const unsigned char * mockGetStringi(GLenum name, GLuint index)
Definition mock_gles.cc:83
void mockUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.cc:216
void mockGetIntegerv(GLenum name, int *value)
Definition mock_gles.cc:95
static std::vector< const char * > g_extensions
Definition mock_gles.cc:22
void mockGetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
Definition mock_gles.cc:166
GLboolean mockIsTexture(GLuint texture)
Definition mock_gles.cc:306
void mockDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount)
Definition mock_gles.cc:386
auto const kExtensions
Definition mock_gles.cc:38
static std::string g_extensions_string
Definition mock_gles.cc:25
void mockReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data)
Definition mock_gles.cc:334
void mockUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.cc:226
void mockTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
Definition mock_gles.cc:285
void mockDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
Definition mock_gles.cc:376
static std::weak_ptr< MockGLES > g_mock_gles
Definition mock_gles.cc:20
void mockUniform4fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.cc:200
void mockTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
Definition mock_gles.cc:270
void mockDeleteTextures(GLsizei size, const GLuint *queries)
Definition mock_gles.cc:177
void mockUniform2fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.cc:188
GLenum mockCheckFramebufferStatus(GLenum target)
Definition mock_gles.cc:313
void mockUniform1fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.cc:184
void mockObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
Definition mock_gles.cc:260
auto const kMockVendor
Definition mock_gles.cc:36
void mockBindTexture(GLenum target, GLuint texture)
Definition mock_gles.cc:300
static const char * g_version
Definition mock_gles.cc:24
void mockDrawArrays(GLenum mode, GLint first, GLsizei count)
Definition mock_gles.cc:369
const ProcTableGLES::Resolver kMockResolverGLES
Definition mock_gles.cc:459
void mockUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
Definition mock_gles.cc:206
void mockPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message)
Definition mock_gles.cc:130
void mockUniform3fv(GLint location, GLsizei count, const GLfloat *value)
Definition mock_gles.cc:194
void mockBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
Definition mock_gles.cc:247
void mockBindFramebuffer(GLenum target, GLuint framebuffer)
Definition mock_gles.cc:327
void mockEndQueryEXT(GLuint id)
Definition mock_gles.cc:152
void mockDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount)
Definition mock_gles.cc:397
void mockGenBuffers(GLsizei n, GLuint *buffers)
Definition mock_gles.cc:243
void mockInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
Definition mock_gles.cc:359
void mockGenFramebuffers(GLsizei n, GLuint *ids)
Definition mock_gles.cc:320
void mockGenQueriesEXT(GLsizei n, GLuint *ids)
Definition mock_gles.cc:138
const unsigned char * mockGetString(GLenum name)
Definition mock_gles.cc:63
void mockBeginQueryEXT(GLenum target, GLuint id)
Definition mock_gles.cc:145
void mockViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Definition mock_gles.cc:352
void mockGenTextures(GLsizei n, GLuint *textures)
Definition mock_gles.cc:236
void mockVertexAttribDivisor(GLuint index, GLuint divisor)
Definition mock_gles.cc:409
Definition ref_ptr.h:261
impeller::ShaderType type
int32_t height
int32_t width