Some work on render pipelines
This commit is contained in:
@@ -19,6 +19,7 @@ namespace Nz
|
||||
FaceFilling faceFilling = FaceFilling_Fill;
|
||||
FaceSide cullingSide = FaceSide_Back;
|
||||
RendererComparison depthCompare = RendererComparison_Less;
|
||||
PrimitiveMode primitiveMode = PrimitiveMode_TriangleList;
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -123,6 +123,8 @@ namespace Nz
|
||||
|
||||
enum FaceSide
|
||||
{
|
||||
FaceSide_None,
|
||||
|
||||
FaceSide_Back,
|
||||
FaceSide_Front,
|
||||
FaceSide_FrontAndBack,
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VkCullModeFlagBits ToVulkan(FaceSide faceSide);
|
||||
inline VkPolygonMode ToVulkan(FaceFilling faceFilling);
|
||||
inline VkPrimitiveTopology ToVulkan(PrimitiveMode primitiveMode);
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison);
|
||||
inline VkStencilOp ToVulkan(StencilOperation stencilOp);
|
||||
NAZARA_VULKANRENDERER_API String TranslateVulkanError(VkResult code);
|
||||
|
||||
@@ -9,6 +9,49 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
VkCullModeFlagBits ToVulkan(FaceSide faceSide)
|
||||
{
|
||||
switch (faceSide)
|
||||
{
|
||||
case FaceSide_None: return VK_CULL_MODE_NONE;
|
||||
case FaceSide_Back: return VK_CULL_MODE_BACK_BIT;
|
||||
case FaceSide_Front: return VK_CULL_MODE_FRONT_BIT;
|
||||
case FaceSide_FrontAndBack: return VK_CULL_MODE_FRONT_AND_BACK;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled FaceSide 0x" + String::Number(faceSide, 16));
|
||||
return VK_CULL_MODE_BACK_BIT;
|
||||
}
|
||||
|
||||
inline VkPolygonMode ToVulkan(FaceFilling faceFilling)
|
||||
{
|
||||
switch (faceFilling)
|
||||
{
|
||||
case FaceFilling_Fill: return VK_POLYGON_MODE_FILL;
|
||||
case FaceFilling_Line: return VK_POLYGON_MODE_LINE;
|
||||
case FaceFilling_Point: return VK_POLYGON_MODE_POINT;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled FaceFilling 0x" + String::Number(faceFilling, 16));
|
||||
return VK_POLYGON_MODE_FILL;
|
||||
}
|
||||
|
||||
VkPrimitiveTopology ToVulkan(PrimitiveMode primitiveMode)
|
||||
{
|
||||
switch (primitiveMode)
|
||||
{
|
||||
case PrimitiveMode_LineList: return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
case PrimitiveMode_LineStrip: return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
case PrimitiveMode_PointList: return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
||||
case PrimitiveMode_TriangleList: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
case PrimitiveMode_TriangleStrip: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
case PrimitiveMode_TriangleFan: return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled FaceFilling 0x" + String::Number(primitiveMode, 16));
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
}
|
||||
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison)
|
||||
{
|
||||
switch (comparison)
|
||||
|
||||
@@ -20,7 +20,10 @@ namespace Nz
|
||||
VulkanRenderPipeline(Vk::DeviceHandle device, RenderPipelineInfo pipelineInfo);
|
||||
~VulkanRenderPipeline() = default;
|
||||
|
||||
static VkPipelineColorBlendAttachmentState BuildColorBlendState(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineDepthStencilStateCreateInfo BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineInputAssemblyStateCreateInfo BuildInputAssemblyInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineRasterizationStateCreateInfo BuildRasterizationInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkStencilOpState BuildStencilOp(const RenderPipelineInfo& pipelineInfo, bool front);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user