mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[Feat] (MG_Backend/DirectVulkan): get swapchain images
This commit is contained in:
@@ -64,6 +64,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
PickPhysicalDevice();
|
PickPhysicalDevice();
|
||||||
CreateLogicalDeviceAndQueues();
|
CreateLogicalDeviceAndQueues();
|
||||||
CreateSwapchain();
|
CreateSwapchain();
|
||||||
|
CreateSwapchainImageViews();
|
||||||
MGLOG_D("VulkanRenderer initialized");
|
MGLOG_D("VulkanRenderer initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +803,21 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
sci.clipped = VK_TRUE;
|
sci.clipped = VK_TRUE;
|
||||||
sci.oldSwapchain = VK_NULL_HANDLE;
|
sci.oldSwapchain = VK_NULL_HANDLE;
|
||||||
VK_VERIFY(vkCreateSwapchainKHR(m_device, &sci, nullptr, &m_swapchain));
|
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() {
|
void VulkanRenderer::CreateSurface() {
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
VkDevice m_device = VK_NULL_HANDLE;
|
VkDevice m_device = VK_NULL_HANDLE;
|
||||||
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
|
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
|
||||||
VkSwapchainKHR m_swapchain = VK_NULL_HANDLE;
|
VkSwapchainKHR m_swapchain = VK_NULL_HANDLE;
|
||||||
|
Vector<VkImage> m_swapchainImages;
|
||||||
|
VkExtent2D m_swapChainExtent;
|
||||||
|
Vector<VkImageView> m_swapChainImageViews;
|
||||||
|
|
||||||
// Vector<VkQueueFamilyProperties> m_queueFamilies;
|
// Vector<VkQueueFamilyProperties> m_queueFamilies;
|
||||||
// QueueFamilyIndices m_queueFamilyIndices;
|
// QueueFamilyIndices m_queueFamilyIndices;
|
||||||
@@ -102,6 +105,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
|||||||
void PickPhysicalDevice();
|
void PickPhysicalDevice();
|
||||||
void CreateLogicalDeviceAndQueues();
|
void CreateLogicalDeviceAndQueues();
|
||||||
void CreateSwapchain();
|
void CreateSwapchain();
|
||||||
|
void CreateSwapchainImageViews();
|
||||||
|
|
||||||
static Int GetPresentQueueFamilyIndex(
|
static Int GetPresentQueueFamilyIndex(
|
||||||
const PhysicalDevice& physicalDevice, VkSurfaceKHR surface,
|
const PhysicalDevice& physicalDevice, VkSurfaceKHR surface,
|
||||||
|
|||||||
Reference in New Issue
Block a user