VulkanRenderer: Fix unitybuild causing #define issue because of Windows.h

This commit is contained in:
SirLynix 2023-04-12 14:13:34 +02:00
parent f034e71ba4
commit d717335bca
31 changed files with 652 additions and 739 deletions

View File

@ -14,9 +14,7 @@
#include <Nazara/VulkanRenderer/Wrapper/CommandPool.hpp>
#include <vulkan/vulkan_core.h>
namespace Nz
{
namespace Vk
namespace Nz::Vk
{
class CommandBuffer
{
@ -25,7 +23,7 @@ namespace Nz
public:
inline CommandBuffer();
CommandBuffer(const CommandBuffer&) = delete;
inline CommandBuffer(CommandBuffer&& commandBuffer);
inline CommandBuffer(CommandBuffer&& commandBuffer) noexcept;
~CommandBuffer() = default;
inline bool Begin(const VkCommandBufferBeginInfo& info);
@ -128,7 +126,6 @@ namespace Nz
operator VkCommandBuffer() const { return Get(); }
};
}
}
#include <Nazara/VulkanRenderer/Wrapper/CommandBuffer.inl>

View File

@ -23,7 +23,7 @@ namespace Nz
{
}
inline CommandBuffer::CommandBuffer(CommandBuffer&& commandBuffer) :
inline CommandBuffer::CommandBuffer(CommandBuffer&& commandBuffer) noexcept :
m_pool(commandBuffer.m_pool),
m_handle(commandBuffer.m_handle),
m_lastErrorCode(commandBuffer.m_lastErrorCode)

View File

@ -7,9 +7,7 @@
#include <cassert>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
namespace Nz::Vk
{
inline DescriptorSet::DescriptorSet() :
m_pool(nullptr),
@ -160,6 +158,5 @@ namespace Nz
return m_handle;
}
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@ -21,17 +21,24 @@
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#include <vulkan/vulkan_wayland.h>
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <windows.h>
typedef struct HINSTANCE__* HINSTANCE;
typedef struct HWND__* HWND;
typedef struct HMONITOR__* HMONITOR;
typedef void* HANDLE;
typedef /*_Null_terminated_*/ const wchar_t* LPCWSTR;
typedef unsigned long DWORD;
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
#include <vulkan/vulkan_win32.h>
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
struct xcb_connection_t;
typedef uint32_t xcb_window_t;
typedef uint32_t xcb_visualid_t;
#include <vulkan/vulkan_xcb.h>
#endif
@ -48,9 +55,7 @@ typedef unsigned long VisualID;
#include <vulkan/vulkan_xlib.h>
#endif
namespace Nz
{
namespace Vk
namespace Nz::Vk
{
class NAZARA_VULKANRENDERER_API Instance
{
@ -114,7 +119,6 @@ namespace Nz
UInt32 m_apiVersion;
};
}
}
#include <Nazara/VulkanRenderer/Wrapper/Instance.inl>

View File

@ -7,9 +7,7 @@
#include <cassert>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
namespace Nz::Vk
{
inline bool Instance::Create(RenderAPIValidationLevel validationLevel, const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, UInt32 apiVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator)
{
@ -145,6 +143,5 @@ namespace Nz
return properties;
}
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@ -17,7 +17,3 @@ extern "C"
}
#endif
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -625,7 +625,3 @@ namespace Nz
Vk::Instance Vulkan::s_instance;
ParameterList Vulkan::s_initializationParameters;
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -143,6 +143,7 @@ namespace Nz
}
}
// vma includes vulkan.h which includes system headers
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#elif defined(NAZARA_PLATFORM_LINUX)

View File

@ -18,6 +18,3 @@ namespace Nz
m_owner.Release(*this);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -290,7 +290,3 @@ namespace Nz
m_commandBuffer.ImageBarrier(ToVulkan(srcStageMask), ToVulkan(dstStageMask), VkDependencyFlags(0), ToVulkan(srcAccessMask), ToVulkan(dstAccessMask), ToVulkan(oldLayout), ToVulkan(newLayout), vkTexture.GetImage(), vkTexture.GetSubresourceRange());
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -76,7 +76,3 @@ namespace Nz
TryToShrink();
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -54,7 +54,3 @@ namespace Nz
m_pipeline.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -140,7 +140,3 @@ namespace Nz
return formatProperties.optimalTilingFeatures & flags; //< Assume optimal tiling
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -12,7 +12,3 @@ namespace Nz
GetFramebuffer().SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -91,7 +91,3 @@ namespace Nz
}
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -139,7 +139,3 @@ namespace Nz
return m_renderPass.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -328,7 +328,3 @@ namespace Nz
m_pipelineCreateInfo.stateData->colorBlendState = BuildColorBlendInfo(m_pipelineInfo, m_pipelineCreateInfo.colorBlendAttachmentState);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -159,7 +159,3 @@ namespace Nz
TryToShrink();
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -64,7 +64,3 @@ namespace Nz
return m_deviceInfos;
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -147,7 +147,3 @@ namespace Nz
m_owner.Release(*this);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -147,7 +147,3 @@ namespace Nz
m_shaderModule.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -15,6 +15,11 @@
#include <array>
#include <stdexcept>
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <Windows.h>
#include <vulkan/vulkan_win32.h>
#endif
#ifdef VK_USE_PLATFORM_METAL_EXT
#include <objc/runtime.h>
#include <vulkan/vulkan_metal.h>

View File

@ -501,6 +501,7 @@ namespace Nz
}
}
// vma includes vulkan.h which includes system headers
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#elif defined(NAZARA_PLATFORM_LINUX)

View File

@ -42,7 +42,3 @@ namespace Nz
throw std::runtime_error("failed to instantiate Vulkan framebuffer: " + TranslateVulkanError(m_framebuffer.GetLastErrorCode()));
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -40,7 +40,3 @@ namespace Nz
return m_sampler.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -103,7 +103,3 @@ namespace Nz
m_nextAllocationIndex = 0;
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -8,7 +8,3 @@
namespace Nz
{
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -51,7 +51,3 @@ namespace Nz
}
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -49,7 +49,3 @@ namespace Nz
}
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif

View File

@ -300,6 +300,7 @@ namespace Nz
}
}
// vma includes vulkan.h which includes system headers
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#elif defined(NAZARA_PLATFORM_LINUX)

View File

@ -12,9 +12,7 @@
#include <sstream>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
namespace Vk
namespace Nz::Vk
{
namespace
{
@ -335,8 +333,3 @@ namespace Nz
#include <Nazara/VulkanRenderer/Wrapper/InstanceFunctions.hpp>
}
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)
#include <Nazara/Core/AntiWindows.hpp>
#endif