2
0

BsVulkanPrerequisites.h 2.9 KB

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