BsVulkanPrerequisites.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #define WIN32_LEAN_AND_MEAN
  6. #if !defined(NOMINMAX) && defined(_MSC_VER)
  7. # define NOMINMAX // Required to stop windows.h messing up std::min
  8. #endif
  9. #if BS_PLATFORM == BS_PLATFORM_WIN32
  10. #define VK_USE_PLATFORM_WIN32_KHR
  11. #elif BS_PLATFORM == BS_PLATFORM_LINUX
  12. #define VK_USE_PLATFORM_XLIB_KHR
  13. #elif BS_PLATFORM == BS_PLATFORM_ANDROID
  14. #define VK_USE_PLATFORM_ANDROID_KHR
  15. #endif
  16. /** Maximum number of GPU queues that may exist at once. */
  17. #define BS_MAX_UNIQUE_QUEUES BS_MAX_QUEUES_PER_TYPE * bs::GQT_COUNT // Must fit within 4 bytes
  18. #include "vulkan/vulkan.h"
  19. #undef None // Conflicting define from Xlib
  20. #include "ThirdParty/vk_mem_alloc.h"
  21. /** @addtogroup Plugins
  22. * @{
  23. */
  24. /** @defgroup Vulkan BansheeVulkanRenderAPI
  25. * Wrapper around the Vulkan render API.
  26. */
  27. /** @} */
  28. namespace bs { namespace ct
  29. {
  30. class VulkanRenderAPI;
  31. class Win32RenderWindow;
  32. class VulkanTexture;
  33. class Win32VideoMode;
  34. class VulkanVertexDeclaration;
  35. class VulkanHardwareBuffer;
  36. class VulkanDevice;
  37. class VulkanGLSLProgramFactory;
  38. class VulkanSwapChain;
  39. class VulkanFramebuffer;
  40. class VulkanDescriptorLayout;
  41. class VulkanDescriptorSet;
  42. class VulkanDescriptorManager;
  43. class VulkanCmdBufferPool;
  44. class VulkanCmdBuffer;
  45. class VulkanCommandBuffer;
  46. class VulkanQueue;
  47. class VulkanResourceManager;
  48. class VulkanGpuParamBlockBuffer;
  49. class VulkanBuffer;
  50. class VulkanImage;
  51. class VulkanDescriptorPool;
  52. class VulkanGpuParams;
  53. class VulkanTransferBuffer;
  54. class VulkanEvent;
  55. class VulkanQuery;
  56. class VulkanQueryPool;
  57. class VulkanVertexInput;
  58. class VulkanSemaphore;
  59. extern VkAllocationCallbacks* gVulkanAllocator;
  60. /** Vulkan specific types to track resource statistics for. */
  61. enum VulkanRenderStatResourceType
  62. {
  63. RenderStatObject_PipelineState = 100
  64. };
  65. /** Contains lists of images and buffers that require pipeline barrier transitions. */
  66. struct TransitionInfo
  67. {
  68. Vector<VkImageMemoryBarrier> imageBarriers;
  69. Vector<VkBufferMemoryBarrier> bufferBarriers;
  70. };
  71. /** Bits that map to a specific part of a render target and signify whether it should be cleared or not. */
  72. enum ClearMaskBits
  73. {
  74. CLEAR_NONE = 0,
  75. CLEAR_COLOR0 = 1 << 0,
  76. CLEAR_COLOR1 = 1 << 1,
  77. CLEAR_COLOR2 = 1 << 2,
  78. CLEAR_COLOR3 = 1 << 3,
  79. CLEAR_COLOR4 = 1 << 4,
  80. CLEAR_COLOR5 = 1 << 5,
  81. CLEAR_COLOR6 = 1 << 6,
  82. CLEAR_COLOR7 = 1 << 7,
  83. CLEAR_STENCIL = 1 << 30,
  84. CLEAR_DEPTH = 1 << 31,
  85. CLEAR_ALL = 0xFF
  86. };
  87. typedef Flags<ClearMaskBits> ClearMask;
  88. BS_FLAGS_OPERATORS(ClearMaskBits);
  89. }}
  90. /** Macro to get a procedure address based on a Vulkan instance. */
  91. #define GET_INSTANCE_PROC_ADDR(instance, name) \
  92. vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
  93. /** Macro to get a procedure address based on a Vulkan device. */
  94. #define GET_DEVICE_PROC_ADDR(device, name) \
  95. vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));