BsVulkanPrerequisites.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #include "vulkan/vulkan.h"
  13. /** @addtogroup Plugins
  14. * @{
  15. */
  16. /** @defgroup Vulkan BansheeVulkanRenderAPI
  17. * Wrapper around the Vulkan render API.
  18. */
  19. /** @} */
  20. namespace BansheeEngine
  21. {
  22. class VulkanRenderAPI;
  23. class Win32RenderWindow;
  24. class VulkanTexture;
  25. class Win32VideoMode;
  26. class VulkanIndexBuffer;
  27. class VulkanVertexDeclaration;
  28. class VulkanHardwareBuffer;
  29. class VulkanDevice;
  30. class VulkanGLSLProgramFactory;
  31. class VulkanSwapChain;
  32. class VulkanDescriptorLayout;
  33. class VulkanDescriptorManager;
  34. class VulkanCmdBufferPool;
  35. VkAllocationCallbacks* gVulkanAllocator = nullptr;
  36. /** Vulkan specific types to track resource statistics for. */
  37. enum VulkanRenderStatResourceType
  38. {
  39. RenderStatObject_PipelineState = 100
  40. };
  41. /** Types of GPU queues. */
  42. enum VulkanQueueType
  43. {
  44. /**
  45. * Queue used for rendering. Allows the use of draw commands, but also all commands supported by compute
  46. * or upload buffers.
  47. */
  48. VQT_GRAPHICS,
  49. /** Discrete queue used for compute operations. Allows the use of dispatch and upload commands. */
  50. VQT_COMPUTE,
  51. /** Queue used for memory transfer operations only. No rendering or compute dispatch allowed. */
  52. VQT_UPLOAD,
  53. VQT_COUNT // Keep at end
  54. };
  55. }
  56. /** Macro to get a procedure address based on a Vulkan instance. */
  57. #define GET_INSTANCE_PROC_ADDR(instance, name) \
  58. vk##name = reinterpret_cast<PFN_vk##name>(vkGetInstanceProcAddr(instance, "vk"#name));
  59. /** Macro to get a procedure address based on a Vulkan device. */
  60. #define GET_DEVICE_PROC_ADDR(device, name) \
  61. vk##name = reinterpret_cast<PFN_vk##name>(vkGetDeviceProcAddr(device, "vk"#name));
  62. /** Maximum number of hardware devices usable at once. */
  63. #define BS_MAX_VULKAN_DEVICES 5U
  64. /** Maximum number of devices one resource can exist at the same time. */
  65. #define BS_MAX_LINKED_DEVICES 4U