BsVulkanUtility.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsVulkanPrerequisites.h"
  5. #include "BsPixelUtil.h"
  6. #include "BsVertexDeclaration.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Contains various helper methods for dealing with Vulkan. */
  13. class VulkanUtility
  14. {
  15. public:
  16. /** Converts between Banshee and Vulkan pixel format. */
  17. static VkFormat getPixelFormat(PixelFormat format, bool sRGB = false);
  18. /** Converts between Banshee and Vulkan buffer element format. */
  19. static VkFormat getBufferFormat(GpuBufferFormat format);
  20. /** Converts between Banshee and Vulkan vertex element types. */
  21. static VkFormat getVertexType(VertexElementType type);
  22. /** Converts between Banshee and Vulkan texture addressing mode. */
  23. static VkSamplerAddressMode getAddressingMode(TextureAddressingMode mode);
  24. /** Converts between Banshee and Vulkan blend factor. */
  25. static VkBlendFactor getBlendFactor(BlendFactor factor);
  26. /** Converts between Banshee and Vulkan blend operation. */
  27. static VkBlendOp getBlendOp(BlendOperation op);
  28. /** Converts between Banshee and Vulkan comparison operation. */
  29. static VkCompareOp getCompareOp(CompareFunction op);
  30. /** Converts between Banshee and Vulkan cull mode. */
  31. static VkCullModeFlagBits getCullMode(CullingMode mode);
  32. /** Converts between Banshee and Vulkan polygon mode. */
  33. static VkPolygonMode getPolygonMode(PolygonMode mode);
  34. /** Converts between Banshee and Vulkan stencil op. */
  35. static VkStencilOp getStencilOp(StencilOperation op);
  36. /** Converts between Banshee and Vulkan index type. */
  37. static VkIndexType getIndexType(IndexType op);
  38. /** Converts between Banshee and Vulkan draw operation (i.e. primitive topology). */
  39. static VkPrimitiveTopology getDrawOp(DrawOperationType op);
  40. /** Gets Vulkan flags representing the number of samples in an image. Sample count must be a power of 2. */
  41. static VkSampleCountFlagBits getSampleFlags(UINT32 numSamples);
  42. /** Converts between a command buffer type and a Vulkan queue type. */
  43. static VulkanQueueType getQueueType(CommandBufferType type);
  44. /**
  45. * Populates the provided array with Vulkan devices that correspond to provided flags. Sets null in unused slots.
  46. */
  47. static void getDevices(const VulkanRenderAPI& rapi, GpuDeviceFlags flags, VulkanDevice* (&devices)[BS_MAX_LINKED_DEVICES]);
  48. };
  49. /** @} */
  50. }