mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 04:08:32 +09:00
[Feat] (MG_Backend/DirectVulkan): get swapchain images
This commit is contained in:
@@ -64,6 +64,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
PickPhysicalDevice();
|
||||
CreateLogicalDeviceAndQueues();
|
||||
CreateSwapchain();
|
||||
CreateSwapchainImageViews();
|
||||
MGLOG_D("VulkanRenderer initialized");
|
||||
}
|
||||
|
||||
@@ -802,7 +803,21 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
sci.clipped = VK_TRUE;
|
||||
sci.oldSwapchain = VK_NULL_HANDLE;
|
||||
VK_VERIFY(vkCreateSwapchainKHR(m_device, &sci, nullptr, &m_swapchain));
|
||||
MGLOG_I("Swapchain created.");
|
||||
|
||||
Uint32 gotImageCount = 0;
|
||||
VK_VERIFY(vkGetSwapchainImagesKHR(m_device, m_swapchain, &gotImageCount, nullptr));
|
||||
m_swapchainImages.resize(gotImageCount);
|
||||
VK_VERIFY(vkGetSwapchainImagesKHR(m_device, m_swapchain, &gotImageCount, m_swapchainImages.data()));
|
||||
m_swapChainExtent = swapchainCaps.currentExtent;
|
||||
|
||||
MGLOG_I("Swapchain created, extent = %dx%d", m_swapChainExtent.width, m_swapChainExtent.height);
|
||||
}
|
||||
|
||||
void VulkanRenderer::CreateSwapchainImageViews() {
|
||||
m_swapChainImageViews.resize(m_swapchainImages.size());
|
||||
for (size_t i = 0; i < m_swapChainImageViews.size(); i++) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanRenderer::CreateSurface() {
|
||||
|
||||
@@ -87,6 +87,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
VkDevice m_device = VK_NULL_HANDLE;
|
||||
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
|
||||
VkSwapchainKHR m_swapchain = VK_NULL_HANDLE;
|
||||
Vector<VkImage> m_swapchainImages;
|
||||
VkExtent2D m_swapChainExtent;
|
||||
Vector<VkImageView> m_swapChainImageViews;
|
||||
|
||||
// Vector<VkQueueFamilyProperties> m_queueFamilies;
|
||||
// QueueFamilyIndices m_queueFamilyIndices;
|
||||
@@ -102,6 +105,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
void PickPhysicalDevice();
|
||||
void CreateLogicalDeviceAndQueues();
|
||||
void CreateSwapchain();
|
||||
void CreateSwapchainImageViews();
|
||||
|
||||
static Int GetPresentQueueFamilyIndex(
|
||||
const PhysicalDevice& physicalDevice, VkSurfaceKHR surface,
|
||||
|
||||
Reference in New Issue
Block a user