ソースを参照

Added some Banshee -> Vulkan enum mappings

BearishSun 9 年 前
コミット
fa2ddc24d5

+ 0 - 2
Source/BansheeCore/CMakeSources.cmake

@@ -143,7 +143,6 @@ set(BS_BANSHEECORE_INC_RENDERAPI
 	"Include/BsGpuBufferView.h"
 	"Include/BsGpuBufferView.h"
 	"Include/BsGpuBuffer.h"
 	"Include/BsGpuBuffer.h"
 	"Include/BsEventQuery.h"
 	"Include/BsEventQuery.h"
-	"Include/BsDrawOps.h"
 	"Include/BsDepthStencilState.h"
 	"Include/BsDepthStencilState.h"
 	"Include/BsBlendState.h"
 	"Include/BsBlendState.h"
 	"Include/BsRenderAPI.h"
 	"Include/BsRenderAPI.h"
@@ -218,7 +217,6 @@ set(BS_BANSHEECORE_SRC_UTILITY
 	"Source/BsUtility.cpp"
 	"Source/BsUtility.cpp"
 	"Source/BsMeshUtility.cpp"
 	"Source/BsMeshUtility.cpp"
 	"Source/BsDeferredCallManager.cpp"
 	"Source/BsDeferredCallManager.cpp"
-	"Source/BsDrawOps.cpp"
 	"Source/BsIconUtility.cpp"
 	"Source/BsIconUtility.cpp"
 	"Source/BsUUID.cpp"
 	"Source/BsUUID.cpp"
 	"Source/BsPixelUtil.cpp"
 	"Source/BsPixelUtil.cpp"

+ 18 - 0
Source/BansheeCore/Include/BsCommonTypes.h

@@ -115,6 +115,24 @@ namespace BansheeEngine
 		SOP_INVERT /**< Invert the bits of the stencil buffer. */
 		SOP_INVERT /**< Invert the bits of the stencil buffer. */
 	};
 	};
 
 
+	/** Describes operation that will be used for rendering a certain set of vertices. */
+	enum DrawOperationType
+	{
+		DOT_POINT_LIST = 1, /**< Each vertex represents a point. */
+		DOT_LINE_LIST = 2, /**< Each sequential pair of vertices represent a line. */
+		DOT_LINE_STRIP = 3, /**< Each vertex (except the first) forms a line with the previous vertex. */
+		DOT_TRIANGLE_LIST = 4, /**< Each sequential 3-tuple of vertices represent a triangle. */
+		DOT_TRIANGLE_STRIP = 5, /**< Each vertex (except the first two) form a triangle with the previous two vertices. */
+		DOT_TRIANGLE_FAN = 6 /**< Each vertex (except the first two) form a triangle with the first vertex and previous vertex. */
+	};
+
+	/**	Type of the indices used, used for determining size. */
+	enum IndexType
+	{
+		IT_16BIT, /**< 16-bit indices. */
+		IT_32BIT /**< 32-bit indices. */
+	};
+
 	/** These values represent a hint to the driver when locking a hardware buffer. */
 	/** These values represent a hint to the driver when locking a hardware buffer. */
 	enum GpuLockOptions
 	enum GpuLockOptions
 	{
 	{

+ 0 - 28
Source/BansheeCore/Include/BsDrawOps.h

@@ -1,28 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#pragma once
-
-#include "BsCorePrerequisites.h"
-
-namespace BansheeEngine
-{
-	/** @addtogroup RenderAPI
-	 *  @{
-	 */
-
-	/** Describes operation that will be used for rendering a certain set of vertices. */
-	enum DrawOperationType 
-	{
-		DOT_POINT_LIST = 1, /**< Each vertex represents a point. */
-		DOT_LINE_LIST = 2, /**< Each sequential pair of vertices represent a line. */
-		DOT_LINE_STRIP = 3, /**< Each vertex (except the first) forms a line with the previous vertex. */
-		DOT_TRIANGLE_LIST = 4, /**< Each sequential 3-tuple of vertices represent a triangle. */
-		DOT_TRIANGLE_STRIP = 5, /**< Each vertex (except the first two) form a triangle with the previous two vertices. */
-		DOT_TRIANGLE_FAN = 6 /**< Each vertex (except the first two) form a triangle with the first vertex and previous vertex. */
-	};
-
-	/** Converts the number of vertices to number of primitives based on the specified draw operation. */
-	UINT32 BS_CORE_EXPORT vertexCountToPrimCount(DrawOperationType type, UINT32 elementCount);
-
-	/** @} */
-}

+ 0 - 7
Source/BansheeCore/Include/BsIndexBuffer.h

@@ -12,13 +12,6 @@ namespace BansheeEngine
 	 *  @{
 	 *  @{
 	 */
 	 */
 
 
-	/**	Type of the indices used, used for determining size. */
-	enum IndexType 
-	{
-		IT_16BIT, /**< 16-bit indices. */
-		IT_32BIT /**< 32-bit indices. */
-	};
-
 	/** Descriptor structure used for initialization of an IndexBuffer. */
 	/** Descriptor structure used for initialization of an IndexBuffer. */
 	struct INDEX_BUFFER_DESC
 	struct INDEX_BUFFER_DESC
 	{
 	{

+ 0 - 1
Source/BansheeCore/Include/BsMesh.h

@@ -6,7 +6,6 @@
 #include "BsMeshBase.h"
 #include "BsMeshBase.h"
 #include "BsMeshData.h"
 #include "BsMeshData.h"
 #include "BsVertexData.h"
 #include "BsVertexData.h"
-#include "BsDrawOps.h"
 #include "BsSubMesh.h"
 #include "BsSubMesh.h"
 #include "BsBounds.h"
 #include "BsBounds.h"
 
 

+ 0 - 1
Source/BansheeCore/Include/BsMeshBase.h

@@ -5,7 +5,6 @@
 #include "BsCorePrerequisites.h"
 #include "BsCorePrerequisites.h"
 #include "BsResource.h"
 #include "BsResource.h"
 #include "BsBounds.h"
 #include "BsBounds.h"
-#include "BsDrawOps.h"
 #include "BsSubMesh.h"
 #include "BsSubMesh.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine

+ 0 - 1
Source/BansheeCore/Include/BsMeshData.h

@@ -7,7 +7,6 @@
 #include "BsVertexBuffer.h"
 #include "BsVertexBuffer.h"
 #include "BsIndexBuffer.h"
 #include "BsIndexBuffer.h"
 #include "BsVertexDeclaration.h"
 #include "BsVertexDeclaration.h"
-#include "BsDrawOps.h"
 #include "BsSubMesh.h"
 #include "BsSubMesh.h"
 #include "BsBounds.h"
 #include "BsBounds.h"
 
 

+ 0 - 1
Source/BansheeCore/Include/BsMeshHeap.h

@@ -4,7 +4,6 @@
 
 
 #include "BsCorePrerequisites.h"
 #include "BsCorePrerequisites.h"
 #include "BsCoreObject.h"
 #include "BsCoreObject.h"
-#include "BsDrawOps.h"
 #include "BsIndexBuffer.h"
 #include "BsIndexBuffer.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine

+ 3 - 1
Source/BansheeCore/Include/BsRenderAPI.h

@@ -4,7 +4,6 @@
 #include "BsCorePrerequisites.h"
 #include "BsCorePrerequisites.h"
 #include "BsSamplerState.h"
 #include "BsSamplerState.h"
 #include "BsCommandQueue.h"
 #include "BsCommandQueue.h"
-#include "BsDrawOps.h"
 #include "BsRenderAPICapabilities.h"
 #include "BsRenderAPICapabilities.h"
 #include "BsRenderTarget.h"
 #include "BsRenderTarget.h"
 #include "BsRenderTexture.h"
 #include "BsRenderTexture.h"
@@ -529,6 +528,9 @@ namespace BansheeEngine
 		/** Performs render API system shutdown on the core thread. */
 		/** Performs render API system shutdown on the core thread. */
 		virtual void destroyCore();
 		virtual void destroyCore();
 
 
+		/** Converts the number of vertices to number of primitives based on the specified draw operation. */
+		UINT32 vertexCountToPrimCount(DrawOperationType type, UINT32 elementCount);
+
 		/************************************************************************/
 		/************************************************************************/
 		/* 								INTERNAL DATA					       	*/
 		/* 								INTERNAL DATA					       	*/
 		/************************************************************************/
 		/************************************************************************/

+ 0 - 1
Source/BansheeCore/Include/BsSubMesh.h

@@ -3,7 +3,6 @@
 #pragma once
 #pragma once
 
 
 #include "BsCorePrerequisites.h"
 #include "BsCorePrerequisites.h"
-#include "BsDrawOps.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {

+ 1 - 0
Source/BansheeCore/Include/BsVertexDeclaration.h

@@ -53,6 +53,7 @@ namespace BansheeEngine
 		VET_UINT2 = 22,  /**< 2D 32-bit signed integer value */
 		VET_UINT2 = 22,  /**< 2D 32-bit signed integer value */
 		VET_UINT3 = 23,  /**< 3D 32-bit signed integer value */
 		VET_UINT3 = 23,  /**< 3D 32-bit signed integer value */
 		VET_UBYTE4_NORM = 24, /**< 4D 8-bit unsigned integer interpreted as a normalized value in [0, 1] range. */
 		VET_UBYTE4_NORM = 24, /**< 4D 8-bit unsigned integer interpreted as a normalized value in [0, 1] range. */
+		VET_COUNT // Keep at end
     };
     };
 
 
 	/**	Describes a single vertex element in a vertex declaration. */
 	/**	Describes a single vertex element in a vertex declaration. */

+ 0 - 39
Source/BansheeCore/Source/BsDrawOps.cpp

@@ -1,39 +0,0 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsDrawOps.h"
-
-namespace BansheeEngine
-{
-	UINT32 vertexCountToPrimCount(DrawOperationType type, UINT32 elementCount)
-	{
-		UINT32 primCount = 0;
-		switch (type)
-		{
-		case DOT_POINT_LIST:
-			primCount = elementCount;
-			break;
-
-		case DOT_LINE_LIST:
-			primCount = elementCount / 2;
-			break;
-
-		case DOT_LINE_STRIP:
-			primCount = elementCount - 1;
-			break;
-
-		case DOT_TRIANGLE_LIST:
-			primCount = elementCount / 3;
-			break;
-
-		case DOT_TRIANGLE_STRIP:
-			primCount = elementCount - 2;
-			break;
-
-		case DOT_TRIANGLE_FAN:
-			primCount = elementCount - 2;
-			break;
-		}
-
-		return primCount;
-	}
-}

+ 34 - 1
Source/BansheeCore/Source/BsRenderAPI.cpp

@@ -200,10 +200,43 @@ namespace BansheeEngine
 		mActiveRenderTarget = nullptr;
 		mActiveRenderTarget = nullptr;
 	}
 	}
 
 
-	const DriverVersion& RenderAPICore::getDriverVersion(void) const 
+	const DriverVersion& RenderAPICore::getDriverVersion() const 
 	{ 
 	{ 
 		THROW_IF_NOT_CORE_THREAD;
 		THROW_IF_NOT_CORE_THREAD;
 
 
 		return mDriverVersion; 
 		return mDriverVersion; 
 	}
 	}
+
+	UINT32 RenderAPICore::vertexCountToPrimCount(DrawOperationType type, UINT32 elementCount)
+	{
+		UINT32 primCount = 0;
+		switch (type)
+		{
+		case DOT_POINT_LIST:
+			primCount = elementCount;
+			break;
+
+		case DOT_LINE_LIST:
+			primCount = elementCount / 2;
+			break;
+
+		case DOT_LINE_STRIP:
+			primCount = elementCount - 1;
+			break;
+
+		case DOT_TRIANGLE_LIST:
+			primCount = elementCount / 3;
+			break;
+
+		case DOT_TRIANGLE_STRIP:
+			primCount = elementCount - 2;
+			break;
+
+		case DOT_TRIANGLE_FAN:
+			primCount = elementCount - 2;
+			break;
+		}
+
+		return primCount;
+	}
 }
 }

+ 0 - 1
Source/BansheeD3D11RenderAPI/Include/BsD3D11CommandBuffer.h

@@ -4,7 +4,6 @@
 
 
 #include "BsD3D11Prerequisites.h"
 #include "BsD3D11Prerequisites.h"
 #include "BsCommandBuffer.h"
 #include "BsCommandBuffer.h"
-#include "BsDrawOps.h"
 #include "BsD3D11RenderAPI.h"
 #include "BsD3D11RenderAPI.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine

+ 0 - 1
Source/BansheeD3D11RenderAPI/Include/BsD3D11Mappings.h

@@ -8,7 +8,6 @@
 #include "BsIndexBuffer.h"
 #include "BsIndexBuffer.h"
 #include "BsVertexData.h"
 #include "BsVertexData.h"
 #include "BsSamplerState.h"
 #include "BsSamplerState.h"
-#include "BsDrawOps.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {

+ 35 - 1
Source/BansheeVulkanRenderAPI/Include/BsVulkanUtility.h

@@ -4,6 +4,7 @@
 
 
 #include "BsVulkanPrerequisites.h"
 #include "BsVulkanPrerequisites.h"
 #include "BsPixelUtil.h"
 #include "BsPixelUtil.h"
+#include "BsVertexDeclaration.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -18,9 +19,42 @@ namespace BansheeEngine
 		/** Converts between Banshee and Vulkan pixel format. */
 		/** Converts between Banshee and Vulkan pixel format. */
 		static VkFormat getPixelFormat(PixelFormat format, bool sRGB = false);
 		static VkFormat getPixelFormat(PixelFormat format, bool sRGB = false);
 
 
+		/** Converts between Banshee and Vulkan buffer element format. */
+		static VkFormat getBufferFormat(GpuBufferFormat format);
+
+		/** Converts between Banshee and Vulkan vertex element types. */
+		static VkFormat getVertexType(VertexElementType type);
+
+		/**	Converts between Banshee and Vulkan texture addressing mode. */
+		static VkSamplerAddressMode getAddressingMode(TextureAddressingMode mode);
+
+		/**	Converts between Banshee and Vulkan blend factor. */
+		static VkBlendFactor getBlendFactor(BlendFactor factor);
+
+		/**	Converts between Banshee and Vulkan blend operation. */
+		static VkBlendOp getBlendOp(BlendOperation op);
+
+		/**	Converts between Banshee and Vulkan comparison operation. */
+		static VkCompareOp getCompareOp(CompareFunction op);
+
+		/**	Converts between Banshee and Vulkan cull mode. */
+		static VkCullModeFlagBits getCullMode(CullingMode mode);
+
+		/**	Converts between Banshee and Vulkan polygon mode. */
+		static VkPolygonMode getPolygonMode(PolygonMode mode);
+
+		/**	Converts between Banshee and Vulkan stencil op. */
+		static VkStencilOp getStencilOp(StencilOperation op);
+
+		/**	Converts between Banshee and Vulkan index type. */
+		static VkIndexType getIndexType(IndexType op);
+
+		/**	Converts between Banshee and Vulkan draw operation (i.e. primitive topology). */
+		static VkPrimitiveTopology getDrawOp(DrawOperationType op);
+
 		/** Gets Vulkan flags representing the number of samples in an image. Sample count must be a power of 2. */
 		/** Gets Vulkan flags representing the number of samples in an image. Sample count must be a power of 2. */
 		static VkSampleCountFlagBits getSampleFlags(UINT32 numSamples);
 		static VkSampleCountFlagBits getSampleFlags(UINT32 numSamples);
 	};
 	};
 
 
 	/** @} */
 	/** @} */
-}
+}

+ 274 - 0
Source/BansheeVulkanRenderAPI/Source/BsVulkanUtility.cpp

@@ -104,6 +104,96 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
+	VkFormat VulkanUtility::getBufferFormat(GpuBufferFormat format)
+	{
+		static bool lookupInitialized = false;
+
+		static VkFormat lookup[BF_COUNT];
+		if (!lookupInitialized)
+		{
+			lookup[BF_16X1F] = VK_FORMAT_R16_SFLOAT;
+			lookup[BF_16X2F] = VK_FORMAT_R16G16_SFLOAT;
+			lookup[BF_16X4F] = VK_FORMAT_R16G16B16A16_SFLOAT;
+			lookup[BF_32X1F] = VK_FORMAT_R32_SFLOAT;
+			lookup[BF_32X2F] = VK_FORMAT_R32G32_SFLOAT;
+			lookup[BF_32X3F] = VK_FORMAT_R32G32B32_SFLOAT;
+			lookup[BF_32X4F] = VK_FORMAT_R32G32B32A32_SFLOAT;
+			lookup[BF_8X1] = VK_FORMAT_R8_UNORM;
+			lookup[BF_8X2] = VK_FORMAT_R8G8_UNORM;
+			lookup[BF_8X4] = VK_FORMAT_R8G8B8A8_UNORM;
+			lookup[BF_16X1] = VK_FORMAT_R16_UNORM;
+			lookup[BF_16X2] = VK_FORMAT_R16G16_UNORM;
+			lookup[BF_16X4] = VK_FORMAT_R16G16B16A16_UNORM;
+			lookup[BF_8X1S] = VK_FORMAT_R8_SINT;
+			lookup[BF_8X2S] = VK_FORMAT_R8G8_SINT;
+			lookup[BF_8X4S] = VK_FORMAT_R8G8B8A8_SINT;
+			lookup[BF_16X1S] = VK_FORMAT_R16_SINT;
+			lookup[BF_16X2S] = VK_FORMAT_R16G16_SINT;
+			lookup[BF_16X4S] = VK_FORMAT_R16G16B16A16_SINT;
+			lookup[BF_32X1S] = VK_FORMAT_R32_SINT;
+			lookup[BF_32X2S] = VK_FORMAT_R32G32_SINT;
+			lookup[BF_32X3S] = VK_FORMAT_R32G32B32_SINT;
+			lookup[BF_32X4S] = VK_FORMAT_R32G32B32A32_SINT;
+			lookup[BF_8X1U] = VK_FORMAT_R8_UINT;
+			lookup[BF_8X2U] = VK_FORMAT_R8G8_UINT;
+			lookup[BF_8X4U] = VK_FORMAT_R8G8B8A8_UINT;
+			lookup[BF_16X1U] = VK_FORMAT_R16_UINT;
+			lookup[BF_16X2U] = VK_FORMAT_R16G16_UINT;
+			lookup[BF_16X4U] = VK_FORMAT_R16G16B16A16_UINT;
+			lookup[BF_32X1U] = VK_FORMAT_R32_UINT;
+			lookup[BF_32X2U] = VK_FORMAT_R32G32_UINT;
+			lookup[BF_32X3U] = VK_FORMAT_R32G32B32_UINT;
+			lookup[BF_32X4U] = VK_FORMAT_R32G32B32A32_UINT;
+
+			lookupInitialized = true;
+		}
+
+		if (format >= BF_COUNT)
+			return VK_FORMAT_UNDEFINED;
+
+		return lookup[(UINT32)format];
+	}
+
+	VkFormat VulkanUtility::getVertexType(VertexElementType type)
+	{
+		static bool lookupInitialized = false;
+
+		static VkFormat lookup[VET_COUNT];
+		if (!lookupInitialized)
+		{
+			lookup[VET_COLOR] = VK_FORMAT_R8G8B8A8_UNORM;
+			lookup[VET_COLOR_ABGR] = VK_FORMAT_R8G8B8A8_UNORM;
+			lookup[VET_COLOR_ARGB] = VK_FORMAT_R8G8B8A8_UNORM;
+			lookup[VET_UBYTE4_NORM] = VK_FORMAT_R8G8B8A8_UNORM;
+			lookup[VET_FLOAT1] = VK_FORMAT_R32_SFLOAT;
+			lookup[VET_FLOAT2] = VK_FORMAT_R32G32_SFLOAT;
+			lookup[VET_FLOAT3] = VK_FORMAT_R32G32B32_SFLOAT;
+			lookup[VET_FLOAT4] = VK_FORMAT_R32G32B32A32_SFLOAT;
+			lookup[VET_USHORT1] = VK_FORMAT_R16_UINT;
+			lookup[VET_USHORT2] = VK_FORMAT_R16G16_UINT;
+			lookup[VET_USHORT4] = VK_FORMAT_R16G16B16A16_UINT;
+			lookup[VET_SHORT1] = VK_FORMAT_R16_SINT;
+			lookup[VET_SHORT2] = VK_FORMAT_R16G16_SINT;
+			lookup[VET_SHORT4] = VK_FORMAT_R16G16B16A16_SINT;
+			lookup[VET_UINT1] = VK_FORMAT_R32_UINT;
+			lookup[VET_UINT2] = VK_FORMAT_R32G32_UINT;
+			lookup[VET_UINT3] = VK_FORMAT_R32G32B32_UINT;
+			lookup[VET_UINT4] = VK_FORMAT_R32G32B32A32_UINT;
+			lookup[VET_INT1] = VK_FORMAT_R32_SINT;
+			lookup[VET_INT2] = VK_FORMAT_R32G32_SINT;
+			lookup[VET_INT3] = VK_FORMAT_R32G32B32_SINT;
+			lookup[VET_INT4] = VK_FORMAT_R32G32B32A32_SINT;
+			lookup[VET_UBYTE4] = VK_FORMAT_R8G8B8A8_UINT;
+
+			lookupInitialized = true;
+		}
+
+		if (type >= VET_COUNT)
+			return VK_FORMAT_UNDEFINED;
+
+		return lookup[(UINT32)type];
+	}
+
 	VkSampleCountFlagBits VulkanUtility::getSampleFlags(UINT32 numSamples)
 	VkSampleCountFlagBits VulkanUtility::getSampleFlags(UINT32 numSamples)
 	{
 	{
 		switch(numSamples)
 		switch(numSamples)
@@ -127,4 +217,188 @@ namespace BansheeEngine
 		BS_EXCEPT(RenderingAPIException, "Unsupported sample count: " + toString(numSamples));
 		BS_EXCEPT(RenderingAPIException, "Unsupported sample count: " + toString(numSamples));
 		return VK_SAMPLE_COUNT_1_BIT;
 		return VK_SAMPLE_COUNT_1_BIT;
 	}
 	}
+
+	VkSamplerAddressMode VulkanUtility::getAddressingMode(TextureAddressingMode mode)
+	{
+		switch (mode)
+		{
+		case TAM_WRAP:
+			return VK_SAMPLER_ADDRESS_MODE_REPEAT;
+		case TAM_MIRROR:
+			return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
+		case TAM_CLAMP:
+			return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
+		case TAM_BORDER:
+			return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
+		}
+
+		return VK_SAMPLER_ADDRESS_MODE_REPEAT;
+	}
+
+	VkBlendFactor VulkanUtility::getBlendFactor(BlendFactor factor)
+	{
+		switch (factor)
+		{
+		case BF_ONE:
+			return VK_BLEND_FACTOR_ONE;
+		case BF_ZERO:
+			return VK_BLEND_FACTOR_ZERO;
+		case BF_DEST_COLOR:
+			return VK_BLEND_FACTOR_DST_COLOR;
+		case BF_SOURCE_COLOR:
+			return VK_BLEND_FACTOR_SRC_COLOR;
+		case BF_INV_DEST_COLOR:
+			return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
+		case BF_INV_SOURCE_COLOR:
+			return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
+		case BF_DEST_ALPHA:
+			return VK_BLEND_FACTOR_DST_ALPHA;
+		case BF_SOURCE_ALPHA:
+			return VK_BLEND_FACTOR_SRC_ALPHA;
+		case BF_INV_DEST_ALPHA:
+			return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
+		case BF_INV_SOURCE_ALPHA:
+			return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
+		}
+
+		// Unsupported type
+		return VK_BLEND_FACTOR_ZERO;
+	}
+
+	VkBlendOp VulkanUtility::getBlendOp(BlendOperation op)
+	{
+		switch (op)
+		{
+		case BO_ADD:
+			return VK_BLEND_OP_ADD;
+		case BO_SUBTRACT:
+			return VK_BLEND_OP_SUBTRACT;
+		case BO_REVERSE_SUBTRACT:
+			return VK_BLEND_OP_REVERSE_SUBTRACT;
+		case BO_MIN:
+			return VK_BLEND_OP_MIN;
+		case BO_MAX:
+			return VK_BLEND_OP_MAX;
+		}
+
+		// Unsupported type
+		return VK_BLEND_OP_ADD;
+	}
+
+	VkCompareOp VulkanUtility::getCompareOp(CompareFunction op)
+	{
+		switch (op)
+		{
+		case CMPF_ALWAYS_FAIL:
+			return VK_COMPARE_OP_NEVER;
+		case CMPF_ALWAYS_PASS:
+			return VK_COMPARE_OP_ALWAYS;
+		case CMPF_LESS:
+			return VK_COMPARE_OP_LESS;
+		case CMPF_LESS_EQUAL:
+			return VK_COMPARE_OP_LESS_OR_EQUAL;
+		case CMPF_EQUAL:
+			return VK_COMPARE_OP_EQUAL;
+		case CMPF_NOT_EQUAL:
+			return VK_COMPARE_OP_NOT_EQUAL;
+		case CMPF_GREATER_EQUAL:
+			return VK_COMPARE_OP_GREATER_OR_EQUAL;
+		case CMPF_GREATER:
+			return VK_COMPARE_OP_GREATER;
+		};
+
+		// Unsupported type
+		return VK_COMPARE_OP_ALWAYS;
+	}
+
+	VkCullModeFlagBits VulkanUtility::getCullMode(CullingMode mode)
+	{
+		switch (mode)
+		{
+		case CULL_NONE:
+			return VK_CULL_MODE_NONE;
+		case CULL_CLOCKWISE:
+			return VK_CULL_MODE_BACK_BIT;
+		case CULL_COUNTERCLOCKWISE:
+			return VK_CULL_MODE_FRONT_BIT;
+		}
+
+		// Unsupported type
+		return VK_CULL_MODE_NONE;
+	}
+
+	VkPolygonMode VulkanUtility::getPolygonMode(PolygonMode mode)
+	{
+		switch (mode)
+		{
+		case PM_WIREFRAME:
+			return VK_POLYGON_MODE_LINE;
+		case PM_SOLID:
+			return VK_POLYGON_MODE_FILL;
+		}
+
+		return VK_POLYGON_MODE_FILL;
+	}
+
+	VkStencilOp VulkanUtility::getStencilOp(StencilOperation op)
+	{
+		switch (op)
+		{
+		case SOP_KEEP:
+			return VK_STENCIL_OP_KEEP;
+		case SOP_ZERO:
+			return VK_STENCIL_OP_ZERO;
+		case SOP_REPLACE:
+			return VK_STENCIL_OP_REPLACE;
+		case SOP_INCREMENT:
+			return VK_STENCIL_OP_INCREMENT_AND_CLAMP;
+		case SOP_DECREMENT:
+			return VK_STENCIL_OP_DECREMENT_AND_CLAMP;
+		case SOP_INCREMENT_WRAP:
+			return VK_STENCIL_OP_INCREMENT_AND_WRAP;
+		case SOP_DECREMENT_WRAP:
+			return VK_STENCIL_OP_DECREMENT_AND_WRAP;
+		case SOP_INVERT:
+			return VK_STENCIL_OP_INVERT;
+		}
+
+		// Unsupported type
+		return VK_STENCIL_OP_KEEP;
+	}
+
+	VkIndexType VulkanUtility::getIndexType(IndexType op)
+	{
+		switch(op)
+		{
+		case IT_16BIT:
+			return VK_INDEX_TYPE_UINT16;
+		case IT_32BIT:
+			return VK_INDEX_TYPE_UINT32;
+		}
+
+		// Unsupported type
+		return VK_INDEX_TYPE_UINT32;
+	}
+
+	VkPrimitiveTopology VulkanUtility::getDrawOp(DrawOperationType op)
+	{
+		switch (op)
+		{
+		case DOT_POINT_LIST:
+			return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
+		case DOT_LINE_LIST:
+			return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
+		case DOT_LINE_STRIP:
+			return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
+		case DOT_TRIANGLE_LIST:
+			return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+		case DOT_TRIANGLE_STRIP:
+			return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
+		case DOT_TRIANGLE_FAN:
+			return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
+		}
+
+		// Unsupported type
+		return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+	}
 }
 }