BsVulkanUtility.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 bs
  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. /** Converts between Banshee and Vulkan texture filtering modes. */
  41. static VkFilter getFilter(FilterOptions filter);
  42. /** Converts between Banshee and Vulkan texture filtering modes. */
  43. static VkSamplerMipmapMode getMipFilter(FilterOptions filter);
  44. /** Gets Vulkan flags representing the number of samples in an image. Sample count must be a power of 2. */
  45. static VkSampleCountFlagBits getSampleFlags(UINT32 numSamples);
  46. /**
  47. * Populates the provided array with Vulkan devices that correspond to provided flags. Sets null in unused slots.
  48. * Each device is placed at its own index in the output array.
  49. */
  50. static void getDevices(const VulkanRenderAPI& rapi, GpuDeviceFlags flags, VulkanDevice* (&devices)[BS_MAX_DEVICES]);
  51. /** Checks is a flag for a particular device enabled. */
  52. static bool isDeviceIdxSet(const VulkanRenderAPI& rapi, UINT32 idx, GpuDeviceFlags flags);
  53. };
  54. /** @} */
  55. }