mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-11 00:29:11 +01:00
a2f4fafe86
Since we are calling this off the UI thread, we can't use anything which accesses the underlying NSView object. We create and set the Metal layer on the UI thread before the video backend is initialized. This extension is both compatible with MoltenVK and gfx-portability for accepting a layer at surface creation.
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
// Copyright 2016 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#if defined(WIN32)
|
|
#define VK_USE_PLATFORM_WIN32_KHR
|
|
#endif
|
|
|
|
#if defined(HAVE_X11)
|
|
#define VK_USE_PLATFORM_XLIB_KHR
|
|
#endif
|
|
|
|
#if defined(ANDROID)
|
|
#define VK_USE_PLATFORM_ANDROID_KHR
|
|
#endif
|
|
|
|
#if defined(__APPLE__)
|
|
#define VK_USE_PLATFORM_METAL_EXT
|
|
#endif
|
|
|
|
#include "vulkan/vulkan.h"
|
|
|
|
// Currently, exclusive fullscreen is only supported on Windows.
|
|
#if defined(WIN32)
|
|
#define SUPPORTS_VULKAN_EXCLUSIVE_FULLSCREEN 1
|
|
#endif
|
|
|
|
// We abuse the preprocessor here to only need to specify function names once.
|
|
#define VULKAN_MODULE_ENTRY_POINT(name, required) extern PFN_##name name;
|
|
#define VULKAN_INSTANCE_ENTRY_POINT(name, required) extern PFN_##name name;
|
|
#define VULKAN_DEVICE_ENTRY_POINT(name, required) extern PFN_##name name;
|
|
#include "VideoBackends/Vulkan/VulkanEntryPoints.inl"
|
|
#undef VULKAN_DEVICE_ENTRY_POINT
|
|
#undef VULKAN_INSTANCE_ENTRY_POINT
|
|
#undef VULKAN_MODULE_ENTRY_POINT
|
|
|
|
namespace Vulkan
|
|
{
|
|
bool LoadVulkanLibrary();
|
|
bool LoadVulkanInstanceFunctions(VkInstance instance);
|
|
bool LoadVulkanDeviceFunctions(VkDevice device);
|
|
void UnloadVulkanLibrary();
|
|
|
|
const char* VkResultToString(VkResult res);
|
|
void LogVulkanResult(int level, const char* func_name, VkResult res, const char* msg, ...);
|
|
|
|
#define LOG_VULKAN_ERROR(res, ...) LogVulkanResult(2, __func__, res, __VA_ARGS__)
|
|
|
|
} // namespace Vulkan
|