Flutter Impeller
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
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
28
29
TextureDescriptor
dst_format;
30
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
31
dst_format.
size
= {100, 100};
32
auto
dst = context->GetResourceAllocator()->CreateTexture(dst_format);
33
34
EXPECT_FALSE(blit_pass->AddCopy(src, dst));
35
}
36
37
TEST_P
(
BlitPassTest
, BlitAcrossDifferentSampleCountsFails) {
38
ScopedValidationDisable
scope;
// avoid noise in output.
39
auto
context = GetContext();
40
auto
cmd_buffer = context->CreateCommandBuffer();
41
auto
blit_pass = cmd_buffer->CreateBlitPass();
42
43
TextureDescriptor
src_desc;
44
src_desc.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
45
src_desc.
sample_count
=
SampleCount::kCount4
;
46
src_desc.
size
= {100, 100};
47
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
48
49
TextureDescriptor
dst_format;
50
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
51
dst_format.
size
= {100, 100};
52
auto
dst = context->GetResourceAllocator()->CreateTexture(dst_format);
53
54
EXPECT_FALSE(blit_pass->AddCopy(src, dst));
55
}
56
57
TEST_P
(
BlitPassTest
, BlitPassesForMatchingFormats) {
58
ScopedValidationDisable
scope;
// avoid noise in output.
59
auto
context = GetContext();
60
auto
cmd_buffer = context->CreateCommandBuffer();
61
auto
blit_pass = cmd_buffer->CreateBlitPass();
62
63
TextureDescriptor
src_desc;
64
src_desc.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
65
src_desc.
size
= {100, 100};
66
auto
src = context->GetResourceAllocator()->CreateTexture(src_desc);
67
68
TextureDescriptor
dst_format;
69
dst_format.
format
=
PixelFormat::kR8G8B8A8UNormInt
;
70
dst_format.
size
= {100, 100};
71
auto
dst = context->GetResourceAllocator()->CreateTexture(dst_format);
72
73
EXPECT_TRUE(blit_pass->AddCopy(src, dst));
74
}
75
76
}
// namespace testing
77
}
// namespace impeller
impeller::PixelFormat::kA8UNormInt
@ kA8UNormInt
impeller::TextureDescriptor::format
PixelFormat format
Definition:
texture_descriptor.h:40
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
texture_descriptor.h
formats.h
impeller::TextureDescriptor::sample_count
SampleCount sample_count
Definition:
texture_descriptor.h:45
validation.h
impeller::testing::INSTANTIATE_PLAYGROUND_SUITE
INSTANTIATE_PLAYGROUND_SUITE(AiksTest)
impeller::TextureDescriptor::size
ISize size
Definition:
texture_descriptor.h:41
command_buffer.h
impeller::SampleCount::kCount4
@ kCount4
impeller::PlaygroundTest
Definition:
playground_test.h:23
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::testing::TEST_P
TEST_P(AiksTest, CanRenderLinearGradientClamp)
Definition:
aiks_gradient_unittests.cc:48
impeller::ScopedValidationDisable
Definition:
validation.h:42
impeller
Definition:
aiks_context.cc:10
playground_test.h
impeller
renderer
blit_pass_unittests.cc
Generated by
1.8.17