WIP (VertexDeclaration)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
|
||||
@@ -18,6 +19,7 @@ namespace Nz
|
||||
inline VkPolygonMode ToVulkan(FaceFilling faceFilling);
|
||||
inline VkPrimitiveTopology ToVulkan(PrimitiveMode primitiveMode);
|
||||
inline VkCompareOp ToVulkan(RendererComparison comparison);
|
||||
inline VkShaderStageFlagBits ToVulkan(ShaderStageType stageType);
|
||||
inline VkStencilOp ToVulkan(StencilOperation stencilOp);
|
||||
NAZARA_VULKANRENDERER_API String TranslateVulkanError(VkResult code);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,18 @@ namespace Nz
|
||||
return VK_COMPARE_OP_NEVER;
|
||||
}
|
||||
|
||||
VkShaderStageFlagBits ToVulkan(ShaderStageType stageType)
|
||||
{
|
||||
switch (stageType)
|
||||
{
|
||||
case ShaderStageType::Fragment: return VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
case ShaderStageType::Vertex: return VK_SHADER_STAGE_VERTEX_BIT;
|
||||
}
|
||||
|
||||
NazaraError("Unhandled ShaderStageType 0x" + String::Number(static_cast<std::size_t>(stageType), 16));
|
||||
return {};
|
||||
}
|
||||
|
||||
VkStencilOp ToVulkan(StencilOperation stencilOp)
|
||||
{
|
||||
switch (stencilOp)
|
||||
|
||||
@@ -23,19 +23,37 @@ namespace Nz
|
||||
VulkanRenderPipeline(Vk::DeviceHandle device, RenderPipelineInfo pipelineInfo);
|
||||
~VulkanRenderPipeline() = default;
|
||||
|
||||
static std::vector<VkPipelineColorBlendAttachmentState> BuildColorBlendAttachmentState(const RenderPipelineInfo& pipelineInfo);
|
||||
static std::vector<VkPipelineColorBlendAttachmentState> BuildColorBlendAttachmentStateList(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineColorBlendStateCreateInfo BuildColorBlendInfo(const RenderPipelineInfo& pipelineInfo, const std::vector<VkPipelineColorBlendAttachmentState>& attachmentState);
|
||||
static VkPipelineDepthStencilStateCreateInfo BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineDynamicStateCreateInfo BuildDynamicStateInfo(const RenderPipelineInfo& pipelineInfo, const std::vector<VkDynamicState>& dynamicStates);
|
||||
static std::vector<VkDynamicState> BuildDynamicStateList(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineInputAssemblyStateCreateInfo BuildInputAssemblyInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineRasterizationStateCreateInfo BuildRasterizationInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkPipelineViewportStateCreateInfo BuildViewportInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
static VkStencilOpState BuildStencilOp(const RenderPipelineInfo& pipelineInfo, bool front);
|
||||
static std::vector<VkPipelineShaderStageCreateInfo> BuildShaderStageInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
|
||||
static CreateInfo BuildCreateInfo(const RenderPipelineInfo& pipelineInfo);
|
||||
|
||||
struct CreateInfo
|
||||
{
|
||||
struct StateData
|
||||
{
|
||||
VkPipelineVertexInputStateCreateInfo vertexInputState;
|
||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyState;
|
||||
VkPipelineViewportStateCreateInfo viewportState;
|
||||
VkPipelineRasterizationStateCreateInfo rasterizationState;
|
||||
VkPipelineDepthStencilStateCreateInfo depthStencilState;
|
||||
VkPipelineColorBlendStateCreateInfo colorBlendState;
|
||||
VkPipelineDynamicStateCreateInfo dynamicState;
|
||||
};
|
||||
|
||||
std::vector<VkPipelineColorBlendAttachmentState> colorBlendAttachmentState;
|
||||
std::vector<VkDynamicState> dynamicStates;
|
||||
std::vector<VkPipelineShaderStageCreateInfo> shaderStages;
|
||||
VkGraphicsPipelineCreateInfo createInfo;
|
||||
std::unique_ptr<StateData> stateData;
|
||||
VkGraphicsPipelineCreateInfo pipelineInfo;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Nz
|
||||
bool Create(const Vk::DeviceHandle& device, ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize);
|
||||
|
||||
inline const Vk::ShaderModule& GetHandle() const;
|
||||
inline ShaderStageType GetStageType() const;
|
||||
|
||||
VulkanShaderStage& operator=(const VulkanShaderStage&) = delete;
|
||||
VulkanShaderStage& operator=(VulkanShaderStage&&) noexcept = default;
|
||||
|
||||
@@ -11,6 +11,11 @@ namespace Nz
|
||||
{
|
||||
return m_shaderModule;
|
||||
}
|
||||
|
||||
inline ShaderStageType VulkanShaderStage::GetStageType() const
|
||||
{
|
||||
return m_stage;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
|
||||
Reference in New Issue
Block a user