mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 04:49:14 +12:00
Allocate and present separate top/bottom screen framebuffer images
Instead of operating directly on the swapchain images, we have our own top/bottom framebuffer images that will be rendered to independent of having an available swapchain. The images are blitted into the swapchain images, allowing for resizing too!
This commit is contained in:
parent
d0832ca558
commit
e3699fe8f8
5 changed files with 354 additions and 15 deletions
36
include/renderer_vk/vk_memory.hpp
Normal file
36
include/renderer_vk/vk_memory.hpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <span>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "helpers.hpp"
|
||||
#include "vulkan_api.hpp"
|
||||
|
||||
namespace Vulkan {
|
||||
|
||||
// Will try to find a memory type that is suitable for the given requirements.
|
||||
// Returns -1 if no suitable memory type was found.
|
||||
s32 findMemoryTypeIndex(
|
||||
vk::PhysicalDevice physicalDevice, u32 memoryTypeMask, vk::MemoryPropertyFlags memoryProperties,
|
||||
vk::MemoryPropertyFlags memoryExcludeProperties = vk::MemoryPropertyFlagBits::eProtected
|
||||
);
|
||||
|
||||
// Given an array of valid Vulkan image-handles or buffer-handles, these
|
||||
// functions will allocate a single block of device-memory for all of them
|
||||
// and bind them consecutively.
|
||||
// There may be a case that all the buffers or images cannot be allocated
|
||||
// to the same device memory due to their required memory-type.
|
||||
std::tuple<vk::Result, vk::UniqueDeviceMemory> commitImageHeap(
|
||||
vk::Device device, vk::PhysicalDevice physicalDevice, const std::span<const vk::Image> images,
|
||||
vk::MemoryPropertyFlags memoryProperties = vk::MemoryPropertyFlagBits::eDeviceLocal,
|
||||
vk::MemoryPropertyFlags memoryExcludeProperties = vk::MemoryPropertyFlagBits::eProtected
|
||||
);
|
||||
|
||||
std::tuple<vk::Result, vk::UniqueDeviceMemory> commitBufferHeap(
|
||||
vk::Device device, vk::PhysicalDevice physicalDevice, const std::span<const vk::Buffer> buffers,
|
||||
vk::MemoryPropertyFlags memoryProperties = vk::MemoryPropertyFlagBits::eDeviceLocal,
|
||||
vk::MemoryPropertyFlags memoryExcludeProperties = vk::MemoryPropertyFlagBits::eProtected
|
||||
);
|
||||
|
||||
} // namespace Vulkan
|
Loading…
Add table
Add a link
Reference in a new issue