Fix Vulkan queue creation on macOS
This commit is contained in:
parent
4680579899
commit
f6df3d23b3
2 changed files with 27 additions and 28 deletions
|
@ -1,12 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#define NOMINMAX // donut define max in windows.h
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#else
|
||||
#define VK_USE_PLATFORM_XCB_KHR
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include <map>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <limits>
|
||||
#include <cstddef>
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
|
||||
#include "gfx_vulkan_buffer.hpp"
|
||||
#include "gfx_vulkan_pipeline.hpp"
|
||||
|
@ -20,11 +19,6 @@
|
|||
|
||||
#include <platform.hpp>
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#endif
|
||||
|
||||
VkFormat toVkFormat(GFXPixelFormat format) {
|
||||
switch (format) {
|
||||
case GFXPixelFormat::R_32F:
|
||||
|
@ -1789,6 +1783,32 @@ void GFXVulkan::createLogicalDevice(std::vector<const char*> extensions) {
|
|||
queueCreateInfo.pQueuePriorities = &queuePriority;
|
||||
|
||||
queueCreateInfos.push_back(queueCreateInfo);
|
||||
} else {
|
||||
// graphics
|
||||
{
|
||||
VkDeviceQueueCreateInfo queueCreateInfo = {};
|
||||
queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
queueCreateInfo.queueFamilyIndex = graphicsFamilyIndex;
|
||||
queueCreateInfo.queueCount = 1;
|
||||
|
||||
float queuePriority = 1.0f;
|
||||
queueCreateInfo.pQueuePriorities = &queuePriority;
|
||||
|
||||
queueCreateInfos.push_back(queueCreateInfo);
|
||||
}
|
||||
|
||||
// present
|
||||
{
|
||||
VkDeviceQueueCreateInfo queueCreateInfo = {};
|
||||
queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
queueCreateInfo.queueFamilyIndex = presentFamilyIndex;
|
||||
queueCreateInfo.queueCount = 1;
|
||||
|
||||
float queuePriority = 1.0f;
|
||||
queueCreateInfo.pQueuePriorities = &queuePriority;
|
||||
|
||||
queueCreateInfos.push_back(queueCreateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
VkDeviceCreateInfo createInfo = {};
|
||||
|
@ -1823,23 +1843,9 @@ void GFXVulkan::createLogicalDevice(std::vector<const char*> extensions) {
|
|||
}
|
||||
|
||||
void GFXVulkan::createSwapchain(NativeSurface* native_surface, VkSwapchainKHR oldSwapchain) {
|
||||
|
||||
#ifdef PLATFORM_WINDOWS_OLD
|
||||
// create win32 surface
|
||||
if(native_surface->surface == VK_NULL_HANDLE)
|
||||
{
|
||||
VkWin32SurfaceCreateInfoKHR createInfo = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
createInfo.hwnd = (HWND)native_surface->windowNativeHandle;
|
||||
createInfo.hinstance = GetModuleHandle(nullptr);
|
||||
|
||||
vkCreateWin32SurfaceKHR(instance, &createInfo, nullptr, &native_surface->surface);
|
||||
}
|
||||
#else
|
||||
if(native_surface->surface == VK_NULL_HANDLE) {
|
||||
native_surface->surface = (VkSurfaceKHR)platform::create_native_surface(native_surface->identifier, (void*)instance);
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: fix this pls
|
||||
VkBool32 supported;
|
||||
|
|
Reference in a new issue