5#include "flutter/testing/testing.h"
6#include "gtest/gtest.h"
11#include "vulkan/vulkan_enums.hpp"
16TEST(AllocatorVKTest, ToVKImageUsageFlags) {
22 vk::ImageUsageFlagBits::eInputAttachment |
23 vk::ImageUsageFlagBits::eColorAttachment |
24 vk::ImageUsageFlagBits::eTransientAttachment);
31 vk::ImageUsageFlagBits::eDepthStencilAttachment |
32 vk::ImageUsageFlagBits::eTransientAttachment);
35TEST(AllocatorVKTest, MemoryTypeSelectionSingleHeap) {
36 vk::PhysicalDeviceMemoryProperties properties;
37 properties.memoryTypeCount = 1;
38 properties.memoryHeapCount = 1;
39 properties.memoryTypes[0].heapIndex = 0;
40 properties.memoryTypes[0].propertyFlags =
41 vk::MemoryPropertyFlagBits::eDeviceLocal;
42 properties.memoryHeaps[0].size = 1024 * 1024 * 1024;
43 properties.memoryHeaps[0].flags = vk::MemoryHeapFlagBits::eDeviceLocal;
50TEST(AllocatorVKTest, MemoryTypeSelectionTwoHeap) {
51 vk::PhysicalDeviceMemoryProperties properties;
52 properties.memoryTypeCount = 2;
53 properties.memoryHeapCount = 2;
54 properties.memoryTypes[0].heapIndex = 0;
55 properties.memoryTypes[0].propertyFlags =
56 vk::MemoryPropertyFlagBits::eHostVisible;
57 properties.memoryHeaps[0].size = 1024 * 1024 * 1024;
58 properties.memoryHeaps[0].flags = vk::MemoryHeapFlagBits::eDeviceLocal;
60 properties.memoryTypes[1].heapIndex = 1;
61 properties.memoryTypes[1].propertyFlags =
62 vk::MemoryPropertyFlagBits::eDeviceLocal;
63 properties.memoryHeaps[1].size = 1024 * 1024 * 1024;
64 properties.memoryHeaps[1].flags = vk::MemoryHeapFlagBits::eDeviceLocal;
75TEST(AllocatorVKTest, RecreateSwapchainWhenSizeChanges) {
76 auto const context = MockVulkanContextBuilder().Build();
77 auto allocator = context->GetResourceAllocator();
91 reinterpret_cast<AllocatorVK*
>(allocator.get())->DebugGetHeapUsage(),
static int32_t FindMemoryTypeIndex(uint32_t memory_type_bits_requirement, vk::PhysicalDeviceMemoryProperties &memory_properties)
Select a matching memory type for the given [memory_type_bits_requirement], or -1 if none is found.
static vk::ImageUsageFlags ToVKImageUsageFlags(PixelFormat format, TextureUsageMask usage, StorageMode mode, bool supports_memoryless_textures)
size_t DebugGetHeapUsage() const
TEST(AiksCanvasTest, EmptyCullRect)