| Flutter Impeller |

capabilities_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 "flutter/testing/testing.h"
6 #include "impeller/renderer/capabilities.h"
7
8 #include "gtest/gtest.h"
9
10 namespace impeller {
11 namespace testing {
12
13 #define CAPABILITY_TEST(name, default_value) \
14 TEST(CapabilitiesTest, name) { \
15 auto defaults = CapabilitiesBuilder().Build(); \
16 ASSERT_EQ(defaults->name(), default_value); \
17 auto opposite = CapabilitiesBuilder().Set##name(!default_value).Build(); \
18 ASSERT_EQ(opposite->name(), !default_value); \
19 }
20
21 CAPABILITY_TEST(SupportsOffscreenMSAA, false);
22 CAPABILITY_TEST(SupportsSSBO, false);
23 CAPABILITY_TEST(SupportsBufferToTextureBlits, false);
24 CAPABILITY_TEST(SupportsTextureToTextureBlits, false);
25 CAPABILITY_TEST(SupportsFramebufferFetch, false);
26 CAPABILITY_TEST(SupportsCompute, false);
27 CAPABILITY_TEST(SupportsComputeSubgroups, false);
28 CAPABILITY_TEST(SupportsReadFromResolve, false);
29 CAPABILITY_TEST(SupportsDecalSamplerAddressMode, false);
30 CAPABILITY_TEST(SupportsDeviceTransientTextures, false);
31
32 TEST(CapabilitiesTest, DefaultColorFormat) {
33 auto defaults = CapabilitiesBuilder().Build();
34 ASSERT_EQ(defaults->GetDefaultColorFormat(), PixelFormat::kUnknown);
35 auto mutated = CapabilitiesBuilder()
36 .SetDefaultColorFormat(PixelFormat::kB10G10R10A10XR)
37 .Build();
38 ASSERT_EQ(mutated->GetDefaultColorFormat(), PixelFormat::kB10G10R10A10XR);
39 }
40
41 TEST(CapabilitiesTest, DefaultStencilFormat) {
42 auto defaults = CapabilitiesBuilder().Build();
43 ASSERT_EQ(defaults->GetDefaultStencilFormat(), PixelFormat::kUnknown);
44 auto mutated = CapabilitiesBuilder()
45 .SetDefaultStencilFormat(PixelFormat::kS8UInt)
46 .Build();
47 ASSERT_EQ(mutated->GetDefaultStencilFormat(), PixelFormat::kS8UInt);
48 }
49
50 TEST(CapabilitiesTest, DefaultDepthStencilFormat) {
51 auto defaults = CapabilitiesBuilder().Build();
52 ASSERT_EQ(defaults->GetDefaultDepthStencilFormat(), PixelFormat::kUnknown);
53 auto mutated = CapabilitiesBuilder()
54 .SetDefaultDepthStencilFormat(PixelFormat::kD32FloatS8UInt)
55 .Build();
56 ASSERT_EQ(mutated->GetDefaultDepthStencilFormat(),
57 PixelFormat::kD32FloatS8UInt);
58 }
59
60 } // namespace testing
61 } // namespace impeller
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::CapabilitiesBuilder::Build
std::unique_ptr< Capabilities > Build()
Definition: capabilities.cc:210
impeller::PixelFormat::kB10G10R10A10XR
@ kB10G10R10A10XR
impeller::CapabilitiesBuilder
Definition: capabilities.h:116
impeller::testing::CAPABILITY_TEST
CAPABILITY_TEST(SupportsOffscreenMSAA, false)
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::CapabilitiesBuilder::SetDefaultDepthStencilFormat
CapabilitiesBuilder & SetDefaultDepthStencilFormat(PixelFormat value)
Definition: capabilities.cc:186
impeller::testing::TEST
TEST(CanvasRecorder, Save)
Definition: canvas_recorder_unittests.cc:61
capabilities.h
impeller::PixelFormat::kUnknown
@ kUnknown
impeller::CapabilitiesBuilder::SetDefaultColorFormat
CapabilitiesBuilder & SetDefaultColorFormat(PixelFormat value)
Definition: capabilities.cc:174
impeller::CapabilitiesBuilder::SetDefaultStencilFormat
CapabilitiesBuilder & SetDefaultStencilFormat(PixelFormat value)
Definition: capabilities.cc:180
impeller
Definition: aiks_context.cc:10