39TEST(BlitCommandGLESTest, BlitCopyTextureToBufferCommandGLESBindsFramebuffer) {
40 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
41 auto& mock_gles_impl_ref = *mock_gles_impl;
43 EXPECT_CALL(mock_gles_impl_ref, GenFramebuffers(1, _))
44 .WillOnce(::testing::SetArgPointee<1>(3));
45 EXPECT_CALL(mock_gles_impl_ref, GenTextures(1, _))
46 .WillOnce(::testing::SetArgPointee<1>(1));
47 EXPECT_CALL(mock_gles_impl_ref, BindFramebuffer(GL_FRAMEBUFFER, 3)).Times(1);
48 EXPECT_CALL(mock_gles_impl_ref, CheckFramebufferStatus(GL_FRAMEBUFFER))
49 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE));
50 EXPECT_CALL(mock_gles_impl_ref, ReadPixels(_, _, _, _, _, _, _)).Times(1);
51 EXPECT_CALL(mock_gles_impl_ref, BindFramebuffer(GL_FRAMEBUFFER, 0)).Times(1);
53 std::shared_ptr<MockGLES> mock_gl =
MockGLES::Init(std::move(mock_gles_impl));
54 auto reactor = std::make_shared<TestReactorGLES>();
55 auto worker = std::make_shared<MockWorker>();
56 reactor->AddWorker(worker);
61 src_tex_desc.
size = {10, 10};
64 auto source_texture = std::make_shared<TextureGLES>(reactor, src_tex_desc);
70 dest_buffer_desc.
size = 10 * 10 * 4;
72 auto allocation = std::make_shared<Allocation>();
73 ASSERT_TRUE(allocation->Truncate(
Bytes(dest_buffer_desc.
size)));
75 std::make_shared<DeviceBufferGLES>(dest_buffer_desc, reactor, allocation);
77 ASSERT_TRUE(reactor->React());
80 command.
source = source_texture;
84 command.
label =
"TestBlit";
86 EXPECT_TRUE(command.
Encode(*reactor));
88 source_texture.reset();
91 ASSERT_TRUE(reactor->React());
bool Encode(const ReactorGLES &reactor) const override
std::shared_ptr< DeviceBuffer > destination
std::shared_ptr< Texture > source
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...