Flutter Engine
 
Loading...
Searching...
No Matches
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" // IWYU pragma: keep
6#include "gtest/gtest.h"
9
10namespace impeller {
11namespace testing {
12
13TEST(CapabilitiesGLES, CanInitializeWithDefaults) {
14 auto mock_gles = MockGLES::Init();
15
16 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
17
18 EXPECT_FALSE(capabilities->SupportsOffscreenMSAA());
19 EXPECT_FALSE(capabilities->SupportsSSBO());
20 EXPECT_TRUE(capabilities->SupportsTextureToTextureBlits());
21 EXPECT_FALSE(capabilities->SupportsFramebufferFetch());
22 EXPECT_FALSE(capabilities->SupportsCompute());
23 EXPECT_FALSE(capabilities->SupportsComputeSubgroups());
24 EXPECT_FALSE(capabilities->SupportsReadFromResolve());
25 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
26 EXPECT_FALSE(capabilities->SupportsDeviceTransientTextures());
27
28 EXPECT_EQ(capabilities->GetDefaultColorFormat(),
30 EXPECT_EQ(capabilities->GetDefaultStencilFormat(), PixelFormat::kS8UInt);
31 EXPECT_EQ(capabilities->GetDefaultDepthStencilFormat(),
33}
34
35TEST(CapabilitiesGLES, SupportsDecalSamplerAddressMode) {
36 auto const extensions = std::vector<const char*>{
37 "GL_KHR_debug", //
38 "GL_EXT_texture_border_clamp", //
39 };
40 auto mock_gles = MockGLES::Init(extensions);
41 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
42 EXPECT_TRUE(capabilities->SupportsDecalSamplerAddressMode());
43}
44
45TEST(CapabilitiesGLES, SupportsDecalSamplerAddressModeNotOES) {
46 auto const extensions = std::vector<const char*>{
47 "GL_KHR_debug", //
48 "GL_OES_texture_border_clamp", //
49 };
50 auto mock_gles = MockGLES::Init(extensions);
51 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
52 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
53}
54
55TEST(CapabilitiesGLES, SupportsFramebufferFetch) {
56 auto const extensions = std::vector<const char*>{
57 "GL_KHR_debug", //
58 "GL_EXT_shader_framebuffer_fetch", //
59 };
60 auto mock_gles = MockGLES::Init(extensions);
61 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
62 EXPECT_TRUE(capabilities->SupportsFramebufferFetch());
63}
64
65TEST(CapabilitiesGLES, SupportsMSAA) {
66 auto const extensions = std::vector<const char*>{
67 "GL_EXT_multisampled_render_to_texture",
68 };
69 auto mock_gles = MockGLES::Init(extensions);
70 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
71 EXPECT_TRUE(capabilities->SupportsImplicitResolvingMSAA());
72 EXPECT_FALSE(capabilities->SupportsOffscreenMSAA());
73}
74
75} // namespace testing
76} // namespace impeller
The Vulkan layers and extensions wrangler.
static std::shared_ptr< MockGLES > Init(std::unique_ptr< MockGLESImpl > impl, const std::optional< std::vector< const char * > > &extensions=std::nullopt)
Definition mock_gles.cc:260
TEST(FrameTimingsRecorderTest, RecordVsync)