Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
blit_pass_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 "gtest/gtest.h"
11
12namespace impeller {
13namespace testing {
14
17
18TEST_P(BlitPassTest, BlitAcrossDifferentPixelFormatsFails) {
19 ScopedValidationDisable scope; // avoid noise in output.
20 auto context = GetContext();
21 auto cmd_buffer = context->CreateCommandBuffer();
22 auto blit_pass = cmd_buffer->CreateBlitPass();
23
24 TextureDescriptor src_desc;
26 src_desc.size = {100, 100};
28 auto src = context->GetResourceAllocator()->CreateTexture(src_desc);
29
30 TextureDescriptor dst_format;
32 dst_format.size = {100, 100};
34 auto dst = context->GetResourceAllocator()->CreateTexture(dst_format);
35
36 EXPECT_FALSE(blit_pass->AddCopy(src, dst));
37}
38
39TEST_P(BlitPassTest, BlitAcrossDifferentSampleCountsFails) {
40 ScopedValidationDisable scope; // avoid noise in output.
41 auto context = GetContext();
42 auto cmd_buffer = context->CreateCommandBuffer();
43 auto blit_pass = cmd_buffer->CreateBlitPass();
44
45 TextureDescriptor src_desc;
48 src_desc.size = {100, 100};
49 auto src = context->GetResourceAllocator()->CreateTexture(src_desc);
50
51 TextureDescriptor dst_format;
53 dst_format.size = {100, 100};
54 auto dst = context->GetResourceAllocator()->CreateTexture(dst_format);
55
56 EXPECT_FALSE(blit_pass->AddCopy(src, dst));
57}
58
59TEST_P(BlitPassTest, BlitPassesForMatchingFormats) {
60 ScopedValidationDisable scope; // avoid noise in output.
61 auto context = GetContext();
62 auto cmd_buffer = context->CreateCommandBuffer();
63 auto blit_pass = cmd_buffer->CreateBlitPass();
64
65 TextureDescriptor src_desc;
67 src_desc.size = {100, 100};
68 auto src = context->GetResourceAllocator()->CreateTexture(src_desc);
69
70 TextureDescriptor dst_format;
72 dst_format.size = {100, 100};
73 auto dst = context->GetResourceAllocator()->CreateTexture(dst_format);
74
75 EXPECT_TRUE(blit_pass->AddCopy(src, dst));
76}
77
78} // namespace testing
79} // namespace impeller
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)
#define INSTANTIATE_PLAYGROUND_SUITE(playground)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
#define EXPECT_TRUE(handle)
Definition unit_test.h:685