Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::testing::RenderPassGLESViewportTest Class Reference
Inheritance diagram for impeller::testing::RenderPassGLESViewportTest:

Classes

struct  RenderPassGLESContext
 

Protected Member Functions

RenderPassGLESContext CreateRenderPassGLESContext ()
 

Detailed Description

Definition at line 221 of file render_pass_gles_unittests.cc.

Member Function Documentation

◆ CreateRenderPassGLESContext()

RenderPassGLESContext impeller::testing::RenderPassGLESViewportTest::CreateRenderPassGLESContext ( )
inlineprotected

Definition at line 234 of file render_pass_gles_unittests.cc.

234 {
235 std::unique_ptr<NiceMock<MockGLESImpl>> mock_gl_impl =
236 std::make_unique<NiceMock<MockGLESImpl>>();
237 testing::NiceMock<MockGLESImpl>& mock_gl_impl_ref = *mock_gl_impl;
238 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gl_impl));
239
240 std::shared_ptr<ContextGLES> context = CreateFakeGLESContext();
241 std::shared_ptr<MockWorker> dummy_worker = std::make_shared<MockWorker>();
242 context->AddReactorWorker(dummy_worker);
243 std::shared_ptr<ReactorGLES> reactor = context->GetReactor();
244
245 TextureDescriptor tex_desc;
246 tex_desc.size = {100, 100};
247 tex_desc.format = PixelFormat::kR8G8B8A8UNormInt;
248 auto texture = std::make_shared<TextureGLES>(reactor, tex_desc, false);
249
250 RenderTarget target;
251 ColorAttachment color0;
252 color0.texture = texture;
253 color0.store_action = StoreAction::kDontCare;
254 color0.load_action = LoadAction::kClear;
255 target.SetColorAttachment(color0, 0);
256
257 std::shared_ptr<CommandBuffer> command_buffer =
258 std::static_pointer_cast<Context>(context)->CreateCommandBuffer();
259 std::shared_ptr<RenderPass> render_pass =
260 command_buffer->CreateRenderPass(target);
261
262 EXPECT_CALL(mock_gl_impl_ref, CheckFramebufferStatus(_))
263 .WillRepeatedly(Return(GL_FRAMEBUFFER_COMPLETE));
264
265 PipelineDescriptor desc;
266 ColorAttachmentDescriptor color0_desc;
267 color0_desc.format = PixelFormat::kR8G8B8A8UNormInt;
268 desc.SetColorAttachmentDescriptor(0, color0_desc);
269
270 HandleGLES pipeline_handle = reactor->CreateHandle(HandleType::kProgram);
271 std::shared_ptr<PipelineGLES> pipeline =
272 std::shared_ptr<PipelineGLES>(new PipelineGLES(
273 reactor, std::weak_ptr<PipelineLibrary>(), desc,
274 std::make_shared<UniqueHandleGLES>(reactor, pipeline_handle)));
275 pipeline->buffer_bindings_ = std::make_unique<BufferBindingsGLES>();
276
277 return {std::move(mock_gl), mock_gl_impl_ref,
278 std::move(context), std::move(dummy_worker),
279 std::move(reactor), std::move(command_buffer),
280 std::move(render_pass), std::move(pipeline)};
281 }
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
uint32_t * target
FlTexture * texture

References impeller::ColorAttachmentDescriptor::format, impeller::TextureDescriptor::format, impeller::testing::MockGLES::Init(), impeller::kClear, impeller::kDontCare, impeller::kProgram, impeller::kR8G8B8A8UNormInt, impeller::Attachment::load_action, impeller::PipelineDescriptor::SetColorAttachmentDescriptor(), impeller::TextureDescriptor::size, impeller::Attachment::store_action, target, impeller::Attachment::texture, and texture.


The documentation for this class was generated from the following file: