BsVulkanPrerequisites.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. #endif
  12. /** Maximum number of GPU queues that may exist at once. */
  13. #define BS_MAX_UNIQUE_QUEUES BS_MAX_QUEUES_PER_TYPE * bs::GQT_COUNT // Must fit within 4 bytes
  14. #if (BS_PLATFORM == BS_PLATFORM_WIN32) && !defined(__MINGW32__) && !defined(BS_STATIC_LIB)
  15. # ifdef BS_VULKAN_EXPORTS
  16. # define BS_VULKAN_EXPORT __declspec(dllexport)
  17. # else
  18. # if defined( __MINGW32__ )
  19. # define BS_VULKAN_EXPORT
  20. # else
  21. # define BS_VULKAN_EXPORT __declspec(dllimport)
  22. # endif
  23. # endif
  24. #elif defined (BS_GCC_VISIBILITY)
  25. # define BS_VULKAN_EXPORT __attribute__ ((visibility("default")))
  26. #else
  27. # define BS_VULKAN_EXPORT
  28. #endif
  29. #include "vulkan/vulkan.h"
  30. /** @addtogroup Plugins
  31. * @{
  32. */
  33. /** @defgroup Vulkan BansheeVulkanRenderAPI
  34. * Wrapper around the Vulkan render API.
  35. */
  36. /** @} */
  37. namespace bs { namespace ct
  38. {
  39. class VulkanRenderAPI;
  40. class Win32RenderWindow;
  41. class VulkanTexture;
  42. class Win32VideoMode;
  43. class VulkanVertexDeclaration;
  44. class VulkanHardwareBuffer;
  45. class VulkanDevice;
  46. class VulkanGLSLProgramFactory;
  47. class VulkanSwapChain;
  48. class VulkanFramebuffer;
  49. class VulkanDescriptorLayout;
  50. class VulkanDescriptorSet;
  51. class VulkanDescriptorManager;
  52. class VulkanCmdBufferPool;
  53. class VulkanCmdBuffer;
  54. class VulkanCommandBuffer;
  55. class VulkanQueue;
  56. class VulkanResourceManager;
  57. class VulkanGpuParamBlockBuffer;
  58. class VulkanBuffer;
  59. class VulkanImage;
  60. class VulkanDescriptorPool;
  61. class VulkanGpuParams;
  62. class VulkanTransferBuffer;
  63. class VulkanEvent;
  64. class VulkanQuery;
  65. class VulkanQueryPool;
  66. class VulkanVertexInput;
  67. class VulkanSemaphore;
  68. extern VkAllocationCallbacks* gVulkanAllocator;
  69. /** Vulkan specific types to track resource statistics for. */
  70. enum VulkanRenderStatResourceType
  71. {
  72. RenderStatObject_PipelineState = 100
  73. };
  74. /** Contains lists of images and buffers that require pipeline barrier transitions. */
  75. struct TransitionInfo
  76. {
  77. Vector<VkImageMemoryBarrier> imageBarriers;
  78. Vector<VkBufferMemoryBarrier> bufferBarriers;
  79. };
  80. /** Bits that map to a specific part of a render target and signify whether it should be cleared or not. */
  81. enum ClearMaskBits
  82. {
  83. CLEAR_NONE = 0,
  84. CLEAR_COLOR0 = 1 << 0,
  85. CLEAR_COLOR1 = 1 << 1,
  86. CLEAR_COLOR2 = 1 << 2,
  87. CLEAR_COLOR3 = 1 << 3,
  88. CLEAR_COLOR4 = 1 << 4,
  89. CLEAR_COLOR5 = 1 << 5,
  90. CLEAR_COLOR6 = 1 << 6,
  91. CLEAR_COLOR7 = 1 << 7,
  92. CLEAR_STENCIL = 1 << 30,
  93. CLEAR_DEPTH = 1 << 31,
  94. CLEAR_ALL = 0xFF
  95. };
  96. typedef Flags<ClearMaskBits> ClearMask;
  97. BS_FLAGS_OPERATORS(ClearMaskBits);
  98. }}
  99. /** Macro to get a procedure address based on a Vulkan instance. */
  100. #define GET_INSTANCE_PROC_ADDR(instance, name) \
  101. vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
  102. /** Macro to get a procedure address based on a Vulkan device. */
  103. #define GET_DEVICE_PROC_ADDR(device, name) \
  104. vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));