Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
blit_command_gles_unittests.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 <initializer_list>
6#include <tuple>
7
8#include "flutter/testing/testing.h" // IWYU pragma: keep
9#include "gtest/gtest.h"
15
16namespace impeller {
17namespace testing {
18
19using ::testing::_;
20using ::testing::Return;
21
23 public:
26
27 ~TestReactorGLES() = default;
28};
29
30class MockWorker final : public ReactorGLES::Worker {
31 public:
32 MockWorker() = default;
33
34 // |ReactorGLES::Worker|
36 const ReactorGLES& reactor) const override {
37 return true;
38 }
39};
40
41namespace {
42
43std::shared_ptr<TextureGLES> CreateTexture(
44 const std::shared_ptr<ReactorGLES>& reactor,
45 PixelFormat format) {
46 TextureDescriptor tex_desc;
47 tex_desc.format = format;
48 tex_desc.size = {10, 10};
49 tex_desc.usage = static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
50 auto texture = std::make_shared<TextureGLES>(reactor, tex_desc);
51 // Avoids the flip which would crash.
53 return texture;
54}
55
56std::shared_ptr<DeviceBufferGLES> CreateBuffer(
57 const std::shared_ptr<ReactorGLES>& reactor) {
58 DeviceBufferDescriptor buffer_desc;
59 buffer_desc.size = 10 * 10 * 4;
60 buffer_desc.storage_mode = StorageMode::kHostVisible;
61 auto allocation = std::make_unique<Allocation>();
62 FML_CHECK(allocation->Truncate(Bytes(buffer_desc.size)));
63 auto buffer = std::make_shared<DeviceBufferGLES>(buffer_desc, reactor,
64 std::move(allocation));
65 return buffer;
66}
67
68BlitCopyBufferToTextureCommandGLES CreateCopyBufferToTextureCommand(
69 const std::shared_ptr<DeviceBufferGLES>& source,
70 const std::shared_ptr<TextureGLES>& dest) {
71 BlitCopyBufferToTextureCommandGLES command;
72 command.source = DeviceBuffer::AsBufferView(source);
73 command.destination = dest;
74 command.destination_region =
75 IRect::MakeSize(dest->GetTextureDescriptor().size);
76 command.mip_level = 0;
77 command.slice = 0;
78 command.label = "TestBlit";
79 return command;
80}
81
82BlitCopyTextureToBufferCommandGLES CreateCopyTextureToBufferCommand(
83 const std::shared_ptr<TextureGLES>& source,
84 const std::shared_ptr<DeviceBufferGLES>& dest) {
85 BlitCopyTextureToBufferCommandGLES command;
86 command.source = source;
87 command.destination = dest;
88 command.source_region = IRect::MakeSize(source->GetTextureDescriptor().size);
89 command.label = "TestBlit";
90 return command;
91}
92
93} // namespace
94
95TEST(BlitCommandGLESTest, BlitCopyBufferToTextureCommandGLESRGBA) {
96 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
97 auto& mock_gles_impl_ref = *mock_gles_impl;
98
99 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
100 auto reactor = std::make_shared<TestReactorGLES>();
101 auto worker = std::make_shared<MockWorker>();
102 reactor->AddWorker(worker);
103
104 // Dest texture with RGBA format.
105 std::shared_ptr<TextureGLES> dest_texture =
107 std::shared_ptr<DeviceBufferGLES> source_buffer = CreateBuffer(reactor);
109 CreateCopyBufferToTextureCommand(source_buffer, dest_texture);
110
111 // Expect gl TexSubImage2D with GL_RGBA.
112 EXPECT_CALL(mock_gles_impl_ref,
113 TexSubImage2D(GL_TEXTURE_2D, _, _, _, _, _, GL_RGBA, _, _))
114 .Times(1);
115
116 EXPECT_TRUE(command.Encode(*reactor));
117}
118
119TEST(BlitCommandGLESTest, BlitCopyBufferToTextureCommandGLESBGRA) {
120 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
121 auto& mock_gles_impl_ref = *mock_gles_impl;
122
123 // Mock gl to support BGRA.
124 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(
125 std::move(mock_gles_impl),
126 std::vector<const char*>{"GL_EXT_texture_format_BGRA8888"});
127 auto reactor = std::make_shared<TestReactorGLES>();
128 auto worker = std::make_shared<MockWorker>();
129 reactor->AddWorker(worker);
130
131 // Dest texture with BGRA format.
132 std::shared_ptr<TextureGLES> dest_texture =
134 std::shared_ptr<DeviceBufferGLES> source_buffer = CreateBuffer(reactor);
136 CreateCopyBufferToTextureCommand(source_buffer, dest_texture);
137
138 // Expect gl TexSubImage2D with GL_BGRA_EXT.
139 EXPECT_CALL(mock_gles_impl_ref,
140 TexSubImage2D(GL_TEXTURE_2D, _, _, _, _, _, GL_BGRA_EXT, _, _))
141 .Times(1);
142
143 EXPECT_TRUE(command.Encode(*reactor));
144}
145
146// This test makes sure we bind to GL_FRAMEBUFFER so that it's compatible for
147// OpenGLES 2 and OpenGLES 3.
148TEST(BlitCommandGLESTest, BlitCopyTextureToBufferCommandGLESBindsFramebuffer) {
149 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
150 auto& mock_gles_impl_ref = *mock_gles_impl;
151
152 EXPECT_CALL(mock_gles_impl_ref, GenFramebuffers(1, _))
153 .WillOnce(::testing::SetArgPointee<1>(3));
154 EXPECT_CALL(mock_gles_impl_ref, GenTextures(1, _))
155 .WillOnce(::testing::SetArgPointee<1>(1));
156 EXPECT_CALL(mock_gles_impl_ref, BindFramebuffer(GL_FRAMEBUFFER, 3)).Times(1);
157 EXPECT_CALL(mock_gles_impl_ref, CheckFramebufferStatus(GL_FRAMEBUFFER))
158 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE));
159 EXPECT_CALL(mock_gles_impl_ref, ReadPixels(_, _, _, _, _, _, _)).Times(1);
160 EXPECT_CALL(mock_gles_impl_ref, BindFramebuffer(GL_FRAMEBUFFER, 0)).Times(1);
161
162 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
163 auto reactor = std::make_shared<TestReactorGLES>();
164 auto worker = std::make_shared<MockWorker>();
165 reactor->AddWorker(worker);
166
167 std::shared_ptr<TextureGLES> source_texture =
169 std::shared_ptr<DeviceBufferGLES> dest_buffer = CreateBuffer(reactor);
170
171 ASSERT_TRUE(reactor->React());
172
174 CreateCopyTextureToBufferCommand(source_texture, dest_buffer);
175
176 EXPECT_TRUE(command.Encode(*reactor));
177
178 source_texture.reset();
179 dest_buffer.reset();
180
181 ASSERT_TRUE(reactor->React());
182}
183
184TEST(BlitCommandGLESTest, BlitCopyTextureToBufferCommandGLESRGBA) {
185 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
186 auto& mock_gles_impl_ref = *mock_gles_impl;
187
188 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
189 auto reactor = std::make_shared<TestReactorGLES>();
190 auto worker = std::make_shared<MockWorker>();
191 reactor->AddWorker(worker);
192
193 // Source texture with RGBA format.
194 std::shared_ptr<TextureGLES> source_texture =
196 std::shared_ptr<DeviceBufferGLES> dest_buffer = CreateBuffer(reactor);
198 CreateCopyTextureToBufferCommand(source_texture, dest_buffer);
199
200 EXPECT_CALL(mock_gles_impl_ref, CheckFramebufferStatus(_))
201 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE));
202 // Expect gl ReadPixels with GL_RGBA.
203 EXPECT_CALL(mock_gles_impl_ref, ReadPixels(_, _, _, _, GL_RGBA, _, _))
204 .Times(1);
205
206 EXPECT_TRUE(command.Encode(*reactor));
207}
208
209TEST(BlitCommandGLESTest, BlitCopyTextureToBufferCommandGLESBGRA) {
210 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
211 auto& mock_gles_impl_ref = *mock_gles_impl;
212
213 // Mock gl to support BGRA.
214 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(
215 std::move(mock_gles_impl),
216 std::vector<const char*>{"GL_EXT_texture_format_BGRA8888"});
217 auto reactor = std::make_shared<TestReactorGLES>();
218 auto worker = std::make_shared<MockWorker>();
219 reactor->AddWorker(worker);
220
221 // Source texture with BGRA format.
222 std::shared_ptr<TextureGLES> source_texture =
224 std::shared_ptr<DeviceBufferGLES> dest_buffer = CreateBuffer(reactor);
226 CreateCopyTextureToBufferCommand(source_texture, dest_buffer);
227
228 EXPECT_CALL(mock_gles_impl_ref, CheckFramebufferStatus(_))
229 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE));
230 // Expect gl ReadPixels with GL_BGRA_EXT.
231 EXPECT_CALL(mock_gles_impl_ref, ReadPixels(_, _, _, _, GL_BGRA_EXT, _, _))
232 .Times(1);
233
234 EXPECT_TRUE(command.Encode(*reactor));
235}
236
237TEST(BlitCommandGLESTest,
238 BlitCopyTextureToBufferCommandGLESUnsupportedPixelFormats) {
239 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
240 auto& mock_gles_impl_ref = *mock_gles_impl;
241
242 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
243 auto reactor = std::make_shared<TestReactorGLES>();
244 auto worker = std::make_shared<MockWorker>();
245 reactor->AddWorker(worker);
246
247 std::shared_ptr<DeviceBufferGLES> dest_buffer = CreateBuffer(reactor);
248
249 std::shared_ptr<TextureGLES> source_texture_D32FloatS8Uint =
251 BlitCopyTextureToBufferCommandGLES command_for_D32FloatS8Uint =
252 CreateCopyTextureToBufferCommand(source_texture_D32FloatS8Uint,
253 dest_buffer);
254
255 std::shared_ptr<TextureGLES> source_texture_R8G8UNormInt =
257 BlitCopyTextureToBufferCommandGLES command_for_R8G8UNormInt =
258 CreateCopyTextureToBufferCommand(source_texture_R8G8UNormInt,
259 dest_buffer);
260
261 EXPECT_CALL(mock_gles_impl_ref, CheckFramebufferStatus(_)).Times(0);
262
263 // GL does not support texture with an unsupported pixel format.
264 EXPECT_FALSE(command_for_D32FloatS8Uint.Encode(*reactor));
265
266 // GL does not support texture with another unsupported pixel format.
267 EXPECT_FALSE(command_for_R8G8UNormInt.Encode(*reactor));
268}
269
270namespace {
271
272std::shared_ptr<TextureGLES> CreateMipTexture(
273 const std::shared_ptr<ReactorGLES>& reactor,
274 PixelFormat format,
275 ISize size,
276 size_t mip_count,
278 TextureDescriptor tex_desc;
279 tex_desc.format = format;
280 tex_desc.size = size;
281 tex_desc.mip_count = mip_count;
282 tex_desc.type = type;
283 tex_desc.usage = static_cast<TextureUsageMask>(TextureUsage::kRenderTarget);
284 auto texture = std::make_shared<TextureGLES>(reactor, tex_desc);
285 // Avoids the flip which would crash.
287 return texture;
288}
289
290std::shared_ptr<DeviceBufferGLES> CreateMipBuffer(
291 const std::shared_ptr<ReactorGLES>& reactor,
292 size_t size_bytes) {
293 DeviceBufferDescriptor buffer_desc;
294 buffer_desc.size = size_bytes;
295 buffer_desc.storage_mode = StorageMode::kHostVisible;
296 auto allocation = std::make_unique<Allocation>();
297 FML_CHECK(allocation->Truncate(Bytes(buffer_desc.size)));
298 return std::make_shared<DeviceBufferGLES>(buffer_desc, reactor,
299 std::move(allocation));
300}
301
302} // namespace
303
304// An upload to mip 0 of a multi-mip texture should allocate ONLY level 0,
305// preserving Impeller's snapshot path (which renders into level 0 and then
306// uses glGenerateMipmap to fill the rest).
307TEST(BlitCommandGLESTest,
308 BlitCopyBufferToTextureCommandAllocatesOnlyTheRequestedBaseMip) {
309 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
310 auto& mock_gles_impl_ref = *mock_gles_impl;
311 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
312 auto reactor = std::make_shared<TestReactorGLES>();
313 auto worker = std::make_shared<MockWorker>();
314 reactor->AddWorker(worker);
315
316 auto dest = CreateMipTexture(reactor, PixelFormat::kR8G8B8A8UNormInt,
317 ISize{8, 8}, /*mip_count=*/3);
318 auto source = CreateMipBuffer(reactor, 8 * 8 * 4);
319
321 command.source = DeviceBuffer::AsBufferView(source);
322 command.destination = dest;
324 command.mip_level = 0;
325 command.slice = 0;
326 command.label = "TestBlit";
327
328 EXPECT_CALL(mock_gles_impl_ref,
329 TexImage2D(GL_TEXTURE_2D, 0, _, 8, 8, _, _, _, nullptr))
330 .Times(1);
331 // Higher mip levels must NOT be allocated by a level-0 upload.
332 EXPECT_CALL(mock_gles_impl_ref,
333 TexImage2D(GL_TEXTURE_2D, 1, _, _, _, _, _, _, nullptr))
334 .Times(0);
335 EXPECT_CALL(mock_gles_impl_ref,
336 TexImage2D(GL_TEXTURE_2D, 2, _, _, _, _, _, _, nullptr))
337 .Times(0);
338 EXPECT_CALL(mock_gles_impl_ref,
339 TexSubImage2D(GL_TEXTURE_2D, 0, _, _, 8, 8, _, _, _))
340 .Times(1);
341
342 EXPECT_TRUE(command.Encode(*reactor));
343}
344
345// Regression test for the Flutter GPU multi-mip case: when the very first
346// upload targets a non-zero mip, that level must be allocated by a
347// glTexImage2D call before glTexSubImage2D, otherwise GLES raises
348// GL_INVALID_OPERATION. Only the requested level should be allocated; lower
349// or higher levels stay untouched until they're written themselves.
350TEST(BlitCommandGLESTest,
351 BlitCopyBufferToTextureCommandAllocatesNonZeroMipLevelOnFirstUpload) {
352 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
353 auto& mock_gles_impl_ref = *mock_gles_impl;
354 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
355 auto reactor = std::make_shared<TestReactorGLES>();
356 auto worker = std::make_shared<MockWorker>();
357 reactor->AddWorker(worker);
358
359 auto dest = CreateMipTexture(reactor, PixelFormat::kR8G8B8A8UNormInt,
360 ISize{8, 8}, /*mip_count=*/3);
361 auto source = CreateMipBuffer(reactor, 4 * 4 * 4);
362
364 command.source = DeviceBuffer::AsBufferView(source);
365 command.destination = dest;
366 command.destination_region = IRect::MakeXYWH(0, 0, 4, 4);
367 command.mip_level = 1;
368 command.slice = 0;
369 command.label = "TestBlit";
370
371 // Only level 1 is allocated, and at the halved 4x4 size.
372 EXPECT_CALL(mock_gles_impl_ref,
373 TexImage2D(GL_TEXTURE_2D, 1, _, 4, 4, _, _, _, nullptr))
374 .Times(1);
375 EXPECT_CALL(mock_gles_impl_ref,
376 TexImage2D(GL_TEXTURE_2D, 0, _, _, _, _, _, _, nullptr))
377 .Times(0);
378 EXPECT_CALL(mock_gles_impl_ref,
379 TexImage2D(GL_TEXTURE_2D, 2, _, _, _, _, _, _, nullptr))
380 .Times(0);
381 EXPECT_CALL(mock_gles_impl_ref,
382 TexSubImage2D(GL_TEXTURE_2D, 1, _, _, 4, 4, _, _, _))
383 .Times(1);
384
385 EXPECT_TRUE(command.Encode(*reactor));
386}
387
388// Three uploads to mips 0/1/2 of a multi-mip texture each allocate exactly
389// their own level. This is the same total GL work as the eager approach, but
390// split across the per-level encodes instead of batched on the first one,
391// and is the path the new Flutter GPU `Texture.overwrite(mipLevel: ...)` API
392// exercises.
393TEST(BlitCommandGLESTest,
394 BlitCopyBufferToTextureCommandAllocatesEachMipLevelOnFirstWrite) {
395 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
396 auto& mock_gles_impl_ref = *mock_gles_impl;
397 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
398 auto reactor = std::make_shared<TestReactorGLES>();
399 auto worker = std::make_shared<MockWorker>();
400 reactor->AddWorker(worker);
401
402 auto dest = CreateMipTexture(reactor, PixelFormat::kR8G8B8A8UNormInt,
403 ISize{8, 8}, /*mip_count=*/3);
404
405 // Each level needs its own correctly-sized source buffer.
406 auto source0 = CreateMipBuffer(reactor, 8 * 8 * 4);
407 auto source1 = CreateMipBuffer(reactor, 4 * 4 * 4);
408 auto source2 = CreateMipBuffer(reactor, 2 * 2 * 4);
409
410 EXPECT_CALL(mock_gles_impl_ref,
411 TexImage2D(GL_TEXTURE_2D, 0, _, 8, 8, _, _, _, nullptr))
412 .Times(1);
413 EXPECT_CALL(mock_gles_impl_ref,
414 TexImage2D(GL_TEXTURE_2D, 1, _, 4, 4, _, _, _, nullptr))
415 .Times(1);
416 EXPECT_CALL(mock_gles_impl_ref,
417 TexImage2D(GL_TEXTURE_2D, 2, _, 2, 2, _, _, _, nullptr))
418 .Times(1);
419 EXPECT_CALL(mock_gles_impl_ref,
420 TexSubImage2D(GL_TEXTURE_2D, 0, _, _, 8, 8, _, _, _))
421 .Times(1);
422 EXPECT_CALL(mock_gles_impl_ref,
423 TexSubImage2D(GL_TEXTURE_2D, 1, _, _, 4, 4, _, _, _))
424 .Times(1);
425 EXPECT_CALL(mock_gles_impl_ref,
426 TexSubImage2D(GL_TEXTURE_2D, 2, _, _, 2, 2, _, _, _))
427 .Times(1);
428
429 for (const auto& [level, w, source] : std::initializer_list<
430 std::tuple<uint32_t, int32_t, std::shared_ptr<DeviceBufferGLES>>>{
431 {0, 8, source0}, {1, 4, source1}, {2, 2, source2}}) {
433 command.source = DeviceBuffer::AsBufferView(source);
434 command.destination = dest;
435 command.destination_region = IRect::MakeXYWH(0, 0, w, w);
436 command.mip_level = level;
437 command.slice = 0;
438 command.label = "TestBlit";
439 EXPECT_TRUE(command.Encode(*reactor));
440 }
441}
442
443// A second upload to the same `(slice, mip_level)` must not re-issue
444// glTexImage2D; the per-(slice, mip) bit in TextureGLES guards it.
445TEST(BlitCommandGLESTest,
446 BlitCopyBufferToTextureCommandDoesNotReallocateOnSubsequentUpload) {
447 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
448 auto& mock_gles_impl_ref = *mock_gles_impl;
449 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
450 auto reactor = std::make_shared<TestReactorGLES>();
451 auto worker = std::make_shared<MockWorker>();
452 reactor->AddWorker(worker);
453
454 auto dest = CreateMipTexture(reactor, PixelFormat::kR8G8B8A8UNormInt,
455 ISize{4, 4}, /*mip_count=*/2);
456 auto source = CreateMipBuffer(reactor, 4 * 4 * 4);
457
459 command.source = DeviceBuffer::AsBufferView(source);
460 command.destination = dest;
462 command.mip_level = 0;
463 command.slice = 0;
464 command.label = "TestBlit";
465
466 // Across both encodes, only the first allocates level 0.
467 EXPECT_CALL(mock_gles_impl_ref,
468 TexImage2D(GL_TEXTURE_2D, 0, _, 4, 4, _, _, _, nullptr))
469 .Times(1);
470 EXPECT_CALL(mock_gles_impl_ref,
471 TexImage2D(GL_TEXTURE_2D, 1, _, _, _, _, _, _, nullptr))
472 .Times(0);
473 EXPECT_CALL(mock_gles_impl_ref,
474 TexSubImage2D(GL_TEXTURE_2D, 0, _, _, _, _, _, _, _))
475 .Times(2);
476
477 EXPECT_TRUE(command.Encode(*reactor));
478 EXPECT_TRUE(command.Encode(*reactor));
479}
480
481// For a cubemap, allocation must target the per-face cubemap target
482// (`GL_TEXTURE_CUBE_MAP_POSITIVE_X + slice`) rather than `GL_TEXTURE_2D`,
483// and only the requested `(face, mip_level)` is allocated by a single
484// upload.
485TEST(BlitCommandGLESTest,
486 BlitCopyBufferToTextureCommandUsesCubemapFaceTargetForCubemap) {
487 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
488 auto& mock_gles_impl_ref = *mock_gles_impl;
489 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
490 auto reactor = std::make_shared<TestReactorGLES>();
491 auto worker = std::make_shared<MockWorker>();
492 reactor->AddWorker(worker);
493
494 auto dest =
495 CreateMipTexture(reactor, PixelFormat::kR8G8B8A8UNormInt, ISize{4, 4},
496 /*mip_count=*/2, TextureType::kTextureCube);
497 auto source = CreateMipBuffer(reactor, 4 * 4 * 4);
498
500 command.source = DeviceBuffer::AsBufferView(source);
501 command.destination = dest;
503 command.mip_level = 0;
504 command.slice = 2; // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
505 command.label = "TestBlit";
506
507 const GLenum face_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + 2;
508
509 // The bind target is the cubemap parent, even though allocation/upload
510 // calls use the per-face target.
511 EXPECT_CALL(mock_gles_impl_ref, BindTexture(GL_TEXTURE_CUBE_MAP, _)).Times(1);
512 EXPECT_CALL(mock_gles_impl_ref,
513 TexImage2D(face_target, 0, _, 4, 4, _, _, _, nullptr))
514 .Times(1);
515 // Higher mips for this face are not allocated by a level-0 upload.
516 EXPECT_CALL(mock_gles_impl_ref,
517 TexImage2D(face_target, 1, _, _, _, _, _, _, nullptr))
518 .Times(0);
519 // No other face is touched.
520 EXPECT_CALL(mock_gles_impl_ref, TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, _,
521 _, _, _, _, _, _, nullptr))
522 .Times(0);
523 EXPECT_CALL(mock_gles_impl_ref,
524 TexImage2D(GL_TEXTURE_2D, _, _, _, _, _, _, _, nullptr))
525 .Times(0);
526 EXPECT_CALL(mock_gles_impl_ref,
527 TexSubImage2D(face_target, 0, _, _, 4, 4, _, _, _))
528 .Times(1);
529
530 EXPECT_TRUE(command.Encode(*reactor));
531}
532
533} // namespace testing
534} // namespace impeller
static BufferView AsBufferView(std::shared_ptr< DeviceBuffer > buffer)
Create a buffer view of this entire buffer.
A delegate implemented by a thread on which an OpenGL context is current. There may be multiple worke...
The reactor attempts to make thread-safe usage of OpenGL ES easier to reason about.
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:360
bool CanReactorReactOnCurrentThreadNow(const ReactorGLES &reactor) const override
Determines the ability of the worker to service a reaction on the current thread. The OpenGL context ...
uint32_t uint32_t * format
#define FML_CHECK(condition)
Definition logging.h:104
FlTexture * texture
TEST(FrameTimingsRecorderTest, RecordVsync)
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 of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98
const ProcTableGLES::Resolver kMockResolverGLES
Definition mock_gles.cc:402
AllocationSize< 1u > Bytes
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition formats.h:99
Mask< TextureUsage > TextureUsageMask
Definition formats.h:311
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &texture_descriptor, const std::vector< uint8_t > &data, const std::shared_ptr< impeller::Context > &context, std::string_view debug_label)
Definition ref_ptr.h:261
impeller::ShaderType type
bool Encode(const ReactorGLES &reactor) const override
std::shared_ptr< Texture > destination
bool Encode(const ReactorGLES &reactor) const override
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition rect.h:136
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...