Flutter Engine
 
Loading...
Searching...
No Matches
sampler_library_vk_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 <memory>
6#include "flutter/testing/testing.h" // IWYU pragma: keep
7#include "gtest/gtest.h"
14
15namespace impeller {
16namespace testing {
17
18TEST(SamplerLibraryVK, WorkaroundsCanDisableReadingFromMipLevels) {
19 auto const context = MockVulkanContextBuilder().Build();
20
21 auto library_vk =
22 std::make_shared<SamplerLibraryVK>(context->GetDeviceHolder());
23 std::shared_ptr<SamplerLibrary> library = library_vk;
24
27
28 auto sampler = library->GetSampler(desc);
29 EXPECT_EQ(sampler->GetDescriptor().mip_filter, MipFilter::kLinear);
30
31 // Apply mips disabled workaround.
32 library_vk->ApplyWorkarounds(WorkaroundsVK{.broken_mipmap_generation = true});
33
34 sampler = library->GetSampler(desc);
35 EXPECT_EQ(sampler->GetDescriptor().mip_filter, MipFilter::kBase);
36}
37
38} // namespace testing
39} // namespace impeller
std::shared_ptr< ContextVK > Build()
Create a Vulkan context with Vulkan functions mocked. The caller is given a chance to tinker on the s...
TEST(FrameTimingsRecorderTest, RecordVsync)
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kBase
The texture is sampled as if it only had a single mipmap level.
A non-exhaustive set of driver specific workarounds.