mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 06:42:12 +00:00
Fix linux compile errors from the zvulkan switch
This commit is contained in:
parent
6a005e3a2a
commit
03ab65ab1e
7 changed files with 19 additions and 64 deletions
|
@ -26,28 +26,23 @@ private:
|
|||
bool debugLayer = false;
|
||||
};
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
class VulkanSurfaceBuilder
|
||||
{
|
||||
public:
|
||||
VulkanSurfaceBuilder();
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
VulkanSurfaceBuilder& Win32Window(HWND handle);
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
VulkanSurfaceBuilder& X11Window(Display* disp, Window wind);
|
||||
#endif
|
||||
|
||||
std::shared_ptr<VulkanSurface> Create(std::shared_ptr<VulkanInstance> instance);
|
||||
|
||||
private:
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
HWND hwnd = {};
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
Display* disp = nullptr;
|
||||
Window wind = {};
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
class VulkanDeviceBuilder
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#elif defined(__APPLE__)
|
||||
#define VK_USE_PLATFORM_MACOS_MVK
|
||||
#define VK_USE_PLATFORM_METAL_EXT
|
||||
#else
|
||||
#define VK_USE_PLATFORM_XLIB_KHR
|
||||
#endif
|
||||
|
||||
#include "volk/volk.h"
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
#include "vulkaninstance.h"
|
||||
|
||||
#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
class VulkanSurface
|
||||
{
|
||||
public:
|
||||
|
@ -20,11 +16,5 @@ public:
|
|||
VulkanSurface(std::shared_ptr<VulkanInstance> instance, HWND window);
|
||||
HWND Window = 0;
|
||||
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
|
||||
VulkanSurface(std::shared_ptr<VulkanInstance> instance, Display* disp, Window wind);
|
||||
Display* disp = nullptr;
|
||||
Window wind;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -1543,39 +1543,25 @@ std::shared_ptr<VulkanInstance> VulkanInstanceBuilder::Create()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
VulkanSurfaceBuilder::VulkanSurfaceBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
VulkanSurfaceBuilder& VulkanSurfaceBuilder::Win32Window(HWND hwnd)
|
||||
{
|
||||
this->hwnd = hwnd;
|
||||
return *this;
|
||||
}
|
||||
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
|
||||
VulkanSurfaceBuilder& VulkanSurfaceBuilder::X11Window(Display* disp, Window wind)
|
||||
{
|
||||
this->disp = disp;
|
||||
this->wind = wind;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::shared_ptr<VulkanSurface> VulkanSurfaceBuilder::Create(std::shared_ptr<VulkanInstance> instance)
|
||||
{
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
return std::make_shared<VulkanSurface>(std::move(instance), hwnd);
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
return std::make_shared<VulkanSurface>(std::move(instance), disp, wind);
|
||||
#else
|
||||
return std::make_shared<VulkanSurface>(std::move(instance));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
VulkanDeviceBuilder::VulkanDeviceBuilder()
|
||||
|
|
|
@ -24,24 +24,4 @@ VulkanSurface::VulkanSurface(std::shared_ptr<VulkanInstance> instance, HWND wind
|
|||
VulkanError("Could not create vulkan surface");
|
||||
}
|
||||
|
||||
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
|
||||
VulkanSurface::VulkanSurface(std::shared_ptr<VulkanInstance> instance, Display* disp, Window wind) : Instance(std::move(instance)), disp(disp), wind(wind)
|
||||
{
|
||||
VkXlibSurfaceCreateInfoKHR createInfo = { VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR };
|
||||
createInfo.dpy = disp;
|
||||
createInfo.window = wind;
|
||||
|
||||
VkResult result = vkCreateXlibSurfaceKHR(Instance->Instance, &createInfo, nullptr, &Surface);
|
||||
if (result != VK_SUCCESS)
|
||||
VulkanError("Could not create vulkan surface");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
VulkanSurface::VulkanSurface(std::shared_ptr<VulkanInstance> instance) : Instance(std::move(instance))
|
||||
{
|
||||
VulkanError("VulkanSurface not implemented on this platform");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -135,6 +135,7 @@ bool VulkanSwapChain::CreateSwapchain(int width, int height, int imageCount, boo
|
|||
{
|
||||
lost = false;
|
||||
|
||||
VkResult result;
|
||||
VkSurfaceCapabilitiesKHR surfaceCapabilities;
|
||||
#ifdef WIN32
|
||||
if (exclusivefullscreen && device->SupportsDeviceExtension(VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME))
|
||||
|
@ -152,7 +153,7 @@ bool VulkanSwapChain::CreateSwapchain(int width, int height, int imageCount, boo
|
|||
VkSurfaceCapabilitiesFullScreenExclusiveEXT exclusiveCapabilities = { VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT };
|
||||
capabilites.pNext = &exclusiveCapabilities;
|
||||
|
||||
VkResult result = vkGetPhysicalDeviceSurfaceCapabilities2KHR(device->PhysicalDevice.Device, &info, &capabilites);
|
||||
result = vkGetPhysicalDeviceSurfaceCapabilities2KHR(device->PhysicalDevice.Device, &info, &capabilites);
|
||||
if (result != VK_SUCCESS)
|
||||
throw std::runtime_error("vkGetPhysicalDeviceSurfaceCapabilities2EXT failed");
|
||||
|
||||
|
@ -161,11 +162,16 @@ bool VulkanSwapChain::CreateSwapchain(int width, int height, int imageCount, boo
|
|||
}
|
||||
else
|
||||
{
|
||||
VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device->PhysicalDevice.Device, device->Surface->Surface, &surfaceCapabilities);
|
||||
result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device->PhysicalDevice.Device, device->Surface->Surface, &surfaceCapabilities);
|
||||
if (result != VK_SUCCESS)
|
||||
throw std::runtime_error("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed");
|
||||
exclusivefullscreen = false;
|
||||
}
|
||||
#else
|
||||
result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device->PhysicalDevice.Device, device->Surface->Surface, &surfaceCapabilities);
|
||||
if (result != VK_SUCCESS)
|
||||
throw std::runtime_error("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed");
|
||||
exclusivefullscreen = false;
|
||||
#endif
|
||||
|
||||
actualExtent = { static_cast<uint32_t>(width), static_cast<uint32_t>(height) };
|
||||
|
@ -221,7 +227,7 @@ bool VulkanSwapChain::CreateSwapchain(int width, int height, int imageCount, boo
|
|||
}
|
||||
#endif
|
||||
|
||||
VkResult result = vkCreateSwapchainKHR(device->device, &swapChainCreateInfo, nullptr, &swapchain);
|
||||
result = vkCreateSwapchainKHR(device->device, &swapChainCreateInfo, nullptr, &swapchain);
|
||||
if (result != VK_SUCCESS)
|
||||
{
|
||||
swapchain = VK_NULL_HANDLE;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <zvulkan/vulkaninstance.h>
|
||||
#include <zvulkan/vulkansurface.h>
|
||||
#include <zvulkan/vulkandevice.h>
|
||||
#include <zvulkan/vulkanbuilders.h>
|
||||
#endif
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
@ -81,6 +82,7 @@ EXTERN_CVAR (Int, vid_displaybits)
|
|||
EXTERN_CVAR (Int, vid_defwidth)
|
||||
EXTERN_CVAR (Int, vid_defheight)
|
||||
EXTERN_CVAR (Bool, cl_capfps)
|
||||
EXTERN_CVAR(Bool, vk_debug)
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
|
@ -278,8 +280,6 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
|
|||
{
|
||||
try
|
||||
{
|
||||
assert(device == nullptr);
|
||||
|
||||
unsigned int count = 64;
|
||||
const char* names[64];
|
||||
if (!I_GetVulkanPlatformExtensions(&count, names))
|
||||
|
|
Loading…
Reference in a new issue