Files
love/src/modules/graphics/vulkan/Vulkan.h
T
2022-09-17 20:32:34 +02:00

72 lines
2.3 KiB
C++

#pragma once
#include "graphics/Graphics.h"
#include "VulkanWrapper.h"
namespace love
{
namespace graphics
{
namespace vulkan
{
enum InternalFormatRepresentation
{
FORMATREPRESENTATION_FLOAT,
FORMATREPRESENTATION_UINT,
FORMATREPRESENTATION_SINT,
FORMATREPRESENTATION_MAX_ENUM
};
struct TextureFormat
{
InternalFormatRepresentation internalFormatRepresentation = FORMATREPRESENTATION_FLOAT;
VkFormat internalFormat = VK_FORMAT_UNDEFINED;
VkComponentSwizzle swizzleR = VK_COMPONENT_SWIZZLE_IDENTITY;
VkComponentSwizzle swizzleG = VK_COMPONENT_SWIZZLE_IDENTITY;
VkComponentSwizzle swizzleB = VK_COMPONENT_SWIZZLE_IDENTITY;
VkComponentSwizzle swizzleA = VK_COMPONENT_SWIZZLE_IDENTITY;
};
class Vulkan
{
public:
static void shaderSwitch();
static uint32_t getNumShaderSwitches();
static void resetShaderSwitches();
static void setVsync(int vsync);
static int getVsync();
static VkFormat getVulkanVertexFormat(DataFormat format);
static TextureFormat getTextureFormat(PixelFormat);
static std::string getVendorName(uint32_t vendorId);
static std::string getVulkanApiVersion(uint32_t apiVersion);
static VkPrimitiveTopology getPrimitiveTypeTopology(graphics::PrimitiveType);
static VkBlendFactor getBlendFactor(BlendFactor);
static VkBlendOp getBlendOp(BlendOperation);
static VkBool32 getBool(bool);
static VkColorComponentFlags getColorMask(ColorChannelMask);
static VkFrontFace getFrontFace(Winding);
static VkCullModeFlags getCullMode(CullMode);
static VkImageType getImageType(TextureType);
static VkImageViewType getImageViewType(TextureType);
static VkPolygonMode getPolygonMode(bool wireframe);
static VkFilter getFilter(SamplerState::FilterMode);
static VkSamplerAddressMode getWrapMode(SamplerState::WrapMode);
static VkCompareOp getCompareOp(CompareMode);
static VkSamplerMipmapMode getMipMapMode(SamplerState::MipmapFilterMode);
static VkDescriptorType getDescriptorType(graphics::Shader::UniformType);
static VkStencilOp getStencilOp(StencilAction);
static VkIndexType getVulkanIndexBufferType(IndexDataType type);
static void cmdTransitionImageLayout(
VkCommandBuffer, VkImage, VkImageLayout oldLayout, VkImageLayout newLayout,
uint32_t baseLevel = 0, uint32_t levelCount = VK_REMAINING_MIP_LEVELS, uint32_t baseLayer = 0, uint32_t layerCount = VK_REMAINING_ARRAY_LAYERS);
};
} // vulkan
} // graphics
} // love