2
0

BsVulkanPrerequisites.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. /** @addtogroup Plugins
  21. * @{
  22. */
  23. /** @defgroup Vulkan BansheeVulkanRenderAPI
  24. * Wrapper around the Vulkan render API.
  25. */
  26. /** @} */
  27. namespace bs { namespace ct
  28. {
  29. class VulkanRenderAPI;
  30. class Win32RenderWindow;
  31. class VulkanTexture;
  32. class Win32VideoMode;
  33. class VulkanVertexDeclaration;
  34. class VulkanHardwareBuffer;
  35. class VulkanDevice;
  36. class VulkanGLSLProgramFactory;
  37. class VulkanSwapChain;
  38. class VulkanFramebuffer;
  39. class VulkanDescriptorLayout;
  40. class VulkanDescriptorSet;
  41. class VulkanDescriptorManager;
  42. class VulkanCmdBufferPool;
  43. class VulkanCmdBuffer;
  44. class VulkanCommandBuffer;
  45. class VulkanQueue;
  46. class VulkanResourceManager;
  47. class VulkanGpuParamBlockBuffer;
  48. class VulkanBuffer;
  49. class VulkanImage;
  50. class VulkanDescriptorPool;
  51. class VulkanGpuParams;
  52. class VulkanTransferBuffer;
  53. class VulkanEvent;
  54. class VulkanQuery;
  55. class VulkanQueryPool;
  56. class VulkanVertexInput;
  57. class VulkanSemaphore;
  58. extern VkAllocationCallbacks* gVulkanAllocator;
  59. /** Vulkan specific types to track resource statistics for. */
  60. enum VulkanRenderStatResourceType
  61. {
  62. RenderStatObject_PipelineState = 100
  63. };
  64. /** Contains lists of images and buffers that require pipeline barrier transitions. */
  65. struct TransitionInfo
  66. {
  67. Vector<VkImageMemoryBarrier> imageBarriers;
  68. Vector<VkBufferMemoryBarrier> bufferBarriers;
  69. };
  70. /** Bits that map to a specific part of a render target and signify whether it should be cleared or not. */
  71. enum ClearMaskBits
  72. {
  73. CLEAR_NONE = 0,
  74. CLEAR_COLOR0 = 1 << 0,
  75. CLEAR_COLOR1 = 1 << 1,
  76. CLEAR_COLOR2 = 1 << 2,
  77. CLEAR_COLOR3 = 1 << 3,
  78. CLEAR_COLOR4 = 1 << 4,
  79. CLEAR_COLOR5 = 1 << 5,
  80. CLEAR_COLOR6 = 1 << 6,
  81. CLEAR_COLOR7 = 1 << 7,
  82. CLEAR_STENCIL = 1 << 30,
  83. CLEAR_DEPTH = 1 << 31,
  84. CLEAR_ALL = 0xFF
  85. };
  86. typedef Flags<ClearMaskBits> ClearMask;
  87. BS_FLAGS_OPERATORS(ClearMaskBits);
  88. }}
  89. /** Macro to get a procedure address based on a Vulkan instance. */
  90. #define GET_INSTANCE_PROC_ADDR(instance, name) \
  91. vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
  92. /** Macro to get a procedure address based on a Vulkan device. */
  93. #define GET_DEVICE_PROC_ADDR(device, name) \
  94. vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));