mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
7926a0c814
This replaces usages of the non-standard __FUNCTION__ macro with the standard mandated __func__ identifier. __FUNCTION__ is a preprocessor definition that is provided as an extension by compilers. This was the only convenient option to rely on pre-C++11. However, C++11 and greater mandate the predefined identifier __func__, which lets us accomplish the same thing. The difference between the two, however, is that __func__ isn't a preprocessor macro, it's an actual identifier that exists at function scope. The C++17 draft standard (N4659) at section [dcl.fct.def.general] paragraph 8 states: " The function-local predefined variable __func__ is defined as if a definition of the form static const char __func__[] = "function-name "; had been provided, where function-name is an implementation-defined string. It is unspecified whether such a variable has an address distinct from that of any other object in the program. " Thankfully, we don't do any macro or string concatenation with __FUNCTION__ that can't be modified to use __func__.
46 lines
1.4 KiB
C++
46 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
|
|
#elif defined(HAVE_X11)
|
|
// Currently we're getting xlib handles passed to the backend.
|
|
// If this ever changes to xcb, it's a simple change here.
|
|
#define VK_USE_PLATFORM_XLIB_KHR
|
|
//#define VK_USE_PLATFORM_XCB_KHR
|
|
#elif defined(ANDROID)
|
|
#define VK_USE_PLATFORM_ANDROID_KHR
|
|
#else
|
|
//#warning Unknown platform
|
|
#endif
|
|
|
|
#include "vulkan/vulkan.h"
|
|
|
|
// 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
|