Flutter Impeller
impeller::testing::RenderPassGLESCommandTest Class Reference
Inheritance diagram for impeller::testing::RenderPassGLESCommandTest:

Static Protected Member Functions

static RenderPassGLESContext CreateRenderPassGLESContext (ProcTableGLES::Resolver resolver=kMockResolverGLES)
 

Detailed Description

Definition at line 234 of file render_pass_gles_unittests.cc.

Member Function Documentation

◆ CreateRenderPassGLESContext()

static RenderPassGLESContext impeller::testing::RenderPassGLESCommandTest::CreateRenderPassGLESContext ( ProcTableGLES::Resolver  resolver = kMockResolverGLES)
inlinestaticprotected

Definition at line 240 of file render_pass_gles_unittests.cc.

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

References command_buffer, context, dummy_worker, impeller::ColorAttachmentDescriptor::format, impeller::TextureDescriptor::format, impeller::kClear, impeller::kDontCare, impeller::kProgram, impeller::kR8G8B8A8UNormInt, impeller::Attachment::load_action, mock_gl, mock_gl_impl_ref, pipeline, reactor, render_pass, impeller::RenderTarget::SetColorAttachment(), impeller::PipelineDescriptor::SetColorAttachmentDescriptor(), impeller::TextureDescriptor::size, impeller::Attachment::store_action, and impeller::Attachment::texture.


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