Flutter Engine
The 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_FALSE(capabilities->SupportsBufferToTextureBlits());
21 EXPECT_FALSE(capabilities->SupportsTextureToTextureBlits());
22 EXPECT_FALSE(capabilities->SupportsFramebufferFetch());
23 EXPECT_FALSE(capabilities->SupportsCompute());
24 EXPECT_FALSE(capabilities->SupportsComputeSubgroups());
25 EXPECT_FALSE(capabilities->SupportsReadFromResolve());
26 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
27 EXPECT_FALSE(capabilities->SupportsDeviceTransientTextures());
28
29 EXPECT_EQ(capabilities->GetDefaultColorFormat(),
31 EXPECT_EQ(capabilities->GetDefaultStencilFormat(), PixelFormat::kS8UInt);
32 EXPECT_EQ(capabilities->GetDefaultDepthStencilFormat(),
34}
35
36TEST(CapabilitiesGLES, SupportsDecalSamplerAddressMode) {
37 auto const extensions = std::vector<const unsigned char*>{
38 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
39 reinterpret_cast<const unsigned char*>("GL_EXT_texture_border_clamp"), //
40 };
41 auto mock_gles = MockGLES::Init(extensions);
42 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
43 EXPECT_TRUE(capabilities->SupportsDecalSamplerAddressMode());
44}
45
46TEST(CapabilitiesGLES, SupportsDecalSamplerAddressModeNotOES) {
47 auto const extensions = std::vector<const unsigned char*>{
48 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
49 reinterpret_cast<const unsigned char*>("GL_OES_texture_border_clamp"), //
50 };
51 auto mock_gles = MockGLES::Init(extensions);
52 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
53 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
54}
55
56TEST(CapabilitiesGLES, SupportsFramebufferFetch) {
57 auto const extensions = std::vector<const unsigned char*>{
58 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
59 reinterpret_cast<const unsigned char*>(
60 "GL_EXT_shader_framebuffer_fetch"), //
61 };
62 auto mock_gles = MockGLES::Init(extensions);
63 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
64 EXPECT_TRUE(capabilities->SupportsFramebufferFetch());
65}
66
67} // namespace testing
68} // namespace impeller
#define TEST(S, s, D, expected)
The Vulkan layers and extensions wrangler.
static std::shared_ptr< MockGLES > Init(const std::optional< std::vector< const unsigned char * > > &extensions=std::nullopt, const char *version_string="OpenGL ES 3.0", ProcTableGLES::Resolver resolver=kMockResolverGLES)
Returns an initialized |MockGLES| instance.
Definition mock_gles.cc:166
#define EXPECT_TRUE(handle)
Definition unit_test.h:685