Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
impeller
renderer
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"
6
#include "
impeller/base/validation.h
"
7
#include "
impeller/core/formats.h
"
8
#include "
impeller/core/texture_descriptor.h
"
9
#include "
impeller/playground/playground_test.h
"
10
#include "
impeller/renderer/command_buffer.h
"
11
12
namespace
impeller
{
13
namespace
testing {
14
15
using
BlitPassTest
=
PlaygroundTest
;
16
INSTANTIATE_PLAYGROUND_SUITE
(
BlitPassTest
);
17
18
TEST_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;
25
src_desc.
format
=
PixelFormat::kA8UNormInt
;
26
src_desc.
size
= {100, 100};
27
src_desc.
storage_mode
=
StorageMode::kHostVisible
;
28
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
29
30
TextureDescriptor
dst_format;
31
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
32
dst_format.
size
= {100, 100};
33
dst_format.
storage_mode
=
StorageMode::kHostVisible
;
34
auto
dst = context->GetResourceAllocator()->CreateTexture(dst_format);
35
36
EXPECT_FALSE(blit_pass->AddCopy(src, dst));
37
}
38
39
TEST_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;
46
src_desc.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
47
src_desc.
sample_count
=
SampleCount::kCount4
;
48
src_desc.
size
= {100, 100};
49
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
50
51
TextureDescriptor
dst_format;
52
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
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
59
TEST_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;
66
src_desc.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
67
src_desc.
size
= {100, 100};
68
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
69
70
TextureDescriptor
dst_format;
71
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
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
impeller::PlaygroundTest
Definition
playground_test.h:24
formats.h
command_buffer.h
impeller::testing::TEST_P
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)
Definition
aiks_blend_unittests.cc:21
impeller
Definition
texture.h:18
impeller::StorageMode::kHostVisible
@ kHostVisible
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::SampleCount::kCount4
@ kCount4
playground_test.h
INSTANTIATE_PLAYGROUND_SUITE
#define INSTANTIATE_PLAYGROUND_SUITE(playground)
Definition
playground_test.h:58
impeller::ScopedValidationDisable
Definition
validation.h:38
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition
texture_descriptor.h:37
impeller::TextureDescriptor::size
ISize size
Definition
texture_descriptor.h:41
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition
texture_descriptor.h:38
impeller::TextureDescriptor::sample_count
SampleCount sample_count
Definition
texture_descriptor.h:44
impeller::TextureDescriptor::format
PixelFormat format
Definition
texture_descriptor.h:40
texture_descriptor.h
EXPECT_TRUE
#define EXPECT_TRUE(handle)
Definition
unit_test.h:685
validation.h
Generated on Fri Apr 26 2024 06:14:13 for Flutter Engine by
1.9.8