Begin work on RenderPipeline
This commit is contained in:
@@ -9,11 +9,16 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison);
|
||||
inline VkStencilOp ToVulkan(StencilOperation stencilOp);
|
||||
NAZARA_VULKANRENDERER_API String TranslateVulkanError(VkResult code);
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/Utils.inl>
|
||||
|
||||
#endif // NAZARA_UTILS_VULKAN_HPP
|
||||
|
||||
49
include/Nazara/VulkanRenderer/Utils.inl
Normal file
49
include/Nazara/VulkanRenderer/Utils.inl
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/Utils.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison)
|
||||
{
|
||||
switch (comparison)
|
||||
{
|
||||
case RendererComparison_Never: return VK_COMPARE_OP_NEVER;
|
||||
case RendererComparison_Less: return VK_COMPARE_OP_LESS;
|
||||
case RendererComparison_Equal: return VK_COMPARE_OP_EQUAL;
|
||||
case RendererComparison_LessOrEqual: return VK_COMPARE_OP_LESS_OR_EQUAL;
|
||||
case RendererComparison_Greater: return VK_COMPARE_OP_GREATER;
|
||||
case RendererComparison_NotEqual: return VK_COMPARE_OP_NOT_EQUAL;
|
||||
case RendererComparison_GreaterOrEqual: return VK_COMPARE_OP_GREATER_OR_EQUAL;
|
||||
case RendererComparison_Always: return VK_COMPARE_OP_ALWAYS;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled RendererComparison 0x" + String::Number(comparison, 16));
|
||||
return VK_COMPARE_OP_NEVER;
|
||||
}
|
||||
|
||||
VkStencilOp ToVulkan(StencilOperation stencilOp)
|
||||
{
|
||||
switch (stencilOp)
|
||||
{
|
||||
case StencilOperation_Decrement: return VK_STENCIL_OP_DECREMENT_AND_CLAMP;
|
||||
case StencilOperation_DecrementNoClamp: return VK_STENCIL_OP_DECREMENT_AND_WRAP;
|
||||
case StencilOperation_Increment: return VK_STENCIL_OP_INCREMENT_AND_CLAMP;
|
||||
case StencilOperation_IncrementNoClamp: return VK_STENCIL_OP_INCREMENT_AND_WRAP;
|
||||
case StencilOperation_Invert: return VK_STENCIL_OP_INVERT;
|
||||
case StencilOperation_Keep: return VK_STENCIL_OP_KEEP;
|
||||
case StencilOperation_Replace: return VK_STENCIL_OP_REPLACE;
|
||||
case StencilOperation_Zero: return VK_STENCIL_OP_ZERO;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled RendererComparison 0x" + String::Number(stencilOp, 16));
|
||||
return VK_STENCIL_OP_KEEP;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
@@ -51,6 +51,8 @@ namespace Nz
|
||||
inline UInt32 GetPresentableFamilyQueue() const;
|
||||
inline const Vk::Swapchain& GetSwapchain() const;
|
||||
|
||||
std::shared_ptr<RenderDevice> GetRenderDevice() override;
|
||||
|
||||
void Present(UInt32 imageIndex) override;
|
||||
|
||||
VkRenderWindow& operator=(const VkRenderWindow&) = delete;
|
||||
|
||||
@@ -37,6 +37,11 @@ namespace Nz
|
||||
return m_swapchain;
|
||||
}
|
||||
|
||||
inline std::shared_ptr<RenderDevice> Nz::VkRenderWindow::GetRenderDevice()
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
|
||||
inline void VkRenderWindow::Present(UInt32 imageIndex)
|
||||
{
|
||||
NazaraAssert(imageIndex < m_frameBuffers.size(), "Invalid image index");
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Nz
|
||||
~VulkanDevice();
|
||||
|
||||
std::unique_ptr<AbstractBuffer> InstantiateBuffer(Buffer* parent, BufferType type) override;
|
||||
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
||||
|
||||
VulkanDevice& operator=(const VulkanDevice&) = delete;
|
||||
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
||||
|
||||
34
include/Nazara/VulkanRenderer/VulkanRenderPipeline.hpp
Normal file
34
include/Nazara/VulkanRenderer/VulkanRenderPipeline.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_VULKANRENDERER_VULKANRENDERPIPELINE_HPP
|
||||
#define NAZARA_VULKANRENDERER_VULKANRENDERPIPELINE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/RenderPipeline.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_VULKANRENDERER_API VulkanRenderPipeline : public RenderPipeline
|
||||
{
|
||||
public:
|
||||
VulkanRenderPipeline(Vk::DeviceHandle device, RenderPipelineInfo pipelineInfo);
|
||||
~VulkanRenderPipeline() = default;
|
||||
|
||||
static VkPipelineDepthStencilStateCreateInfo BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkStencilOpState BuildStencilOp(const RenderPipelineInfo& pipelineInfo, bool front);
|
||||
|
||||
private:
|
||||
Vk::DeviceHandle m_device;
|
||||
RenderPipelineInfo m_pipelineInfo;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipeline.inl>
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_VULKANRENDERPIPELINE_HPP
|
||||
12
include/Nazara/VulkanRenderer/VulkanRenderPipeline.inl
Normal file
12
include/Nazara/VulkanRenderer/VulkanRenderPipeline.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipeline.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user