初步定义Pipeline
This commit is contained in:
parent
a9374f01e1
commit
330a4417d6
@ -21,6 +21,7 @@ SET(VULKAN_TEST_SOURCE_FILES main.cpp
|
|||||||
VKRenderPass.cpp
|
VKRenderPass.cpp
|
||||||
VKShader.cpp
|
VKShader.cpp
|
||||||
VKVertexInput.cpp
|
VKVertexInput.cpp
|
||||||
|
VKPipeline.cpp
|
||||||
VKSemaphore.cpp
|
VKSemaphore.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ SET(VULKAN_TEST_HEADER_FILES VK.h
|
|||||||
VKShader.h
|
VKShader.h
|
||||||
VKVertexInput.h
|
VKVertexInput.h
|
||||||
VKSemaphore.h
|
VKSemaphore.h
|
||||||
|
VKPipeline.h
|
||||||
Window.h)
|
Window.h)
|
||||||
|
|
||||||
SET(SHADER_FILES shader_compile.bat
|
SET(SHADER_FILES shader_compile.bat
|
||||||
|
52
example/Vulkan/VKPipeline.cpp
Normal file
52
example/Vulkan/VKPipeline.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include"VKPipeline.h"
|
||||||
|
#include"VKShader.h"
|
||||||
|
#include"VKVertexInput.h"
|
||||||
|
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
bool PipelineCreater::Set(const Shader *s)
|
||||||
|
{
|
||||||
|
if(!s)return(false);
|
||||||
|
|
||||||
|
//未来这里需要增加是否有vs/fs的检测
|
||||||
|
|
||||||
|
shader=s;
|
||||||
|
|
||||||
|
pipelineInfo.stageCount=shader->GetCount();
|
||||||
|
pipelineInfo.pStages=shader->GetStages();
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PipelineCreater::Set(const VertexInput *vi)
|
||||||
|
{
|
||||||
|
if(!vi)return(false);
|
||||||
|
|
||||||
|
vertex_input=vi;
|
||||||
|
|
||||||
|
vis_create_info=vertex_input->GetPipelineVertexInputStateCreateInfo();
|
||||||
|
|
||||||
|
pipelineInfo.pVertexInputState=&vis_create_info;
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pipeline *PipelineCreater::Create()
|
||||||
|
{
|
||||||
|
//pipelineInfo.pInputAssemblyState = &inputAssembly;
|
||||||
|
//pipelineInfo.pViewportState = &viewportState;
|
||||||
|
//pipelineInfo.pRasterizationState = &rasterizer;
|
||||||
|
//pipelineInfo.pMultisampleState = &multisampling;
|
||||||
|
//pipelineInfo.pColorBlendState = &colorBlending;
|
||||||
|
//pipelineInfo.layout = pipelineLayout;
|
||||||
|
//pipelineInfo.renderPass = renderPass;
|
||||||
|
//pipelineInfo.subpass = 0;
|
||||||
|
//pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
|
||||||
|
|
||||||
|
//VkPipeline graphicsPipeline;
|
||||||
|
|
||||||
|
//if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS) {
|
||||||
|
// throw std::runtime_error("failed to create graphics pipeline!");
|
||||||
|
//}
|
||||||
|
|
||||||
|
return(nullptr);
|
||||||
|
}
|
||||||
|
VK_NAMESPACE_END
|
45
example/Vulkan/VKPipeline.h
Normal file
45
example/Vulkan/VKPipeline.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef HGL_GRAPH_VULKAN_PIPELINE_INCLUDE
|
||||||
|
#define HGL_GRAPH_VULKAN_PIPELINE_INCLUDE
|
||||||
|
|
||||||
|
#include"VK.h"
|
||||||
|
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
class Pipeline
|
||||||
|
{
|
||||||
|
VkPipeline pipeline;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Pipeline(VkPipeline p){pipeline=p;}
|
||||||
|
virtual ~Pipeline();
|
||||||
|
};//class GraphicsPipeline
|
||||||
|
|
||||||
|
class Shader;
|
||||||
|
class VertexInput;
|
||||||
|
|
||||||
|
class PipelineCreater
|
||||||
|
{
|
||||||
|
VkGraphicsPipelineCreateInfo pipelineInfo;
|
||||||
|
|
||||||
|
VkPipelineVertexInputStateCreateInfo vis_create_info;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
const Shader * shader =nullptr;
|
||||||
|
const VertexInput * vertex_input=nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
PipelineCreater()
|
||||||
|
{
|
||||||
|
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
|
}
|
||||||
|
~PipelineCreater();
|
||||||
|
|
||||||
|
bool Set(const Shader *);
|
||||||
|
bool Set(const VertexInput *);
|
||||||
|
|
||||||
|
Pipeline *Create();
|
||||||
|
};//class PipelineCreater
|
||||||
|
VK_NAMESPACE_END
|
||||||
|
#endif//HGL_GRAPH_VULKAN_PIPELINE_INCLUDE
|
@ -44,6 +44,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t GetCount ()const{return shader_stage_list.GetCount();}
|
const uint32_t GetCount ()const{return shader_stage_list.GetCount();}
|
||||||
const VkPipelineShaderStageCreateInfo * GetShaderStages ()const{return shader_stage_list.GetData();}
|
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list.GetData();}
|
||||||
};//class ShaderCreater
|
};//class ShaderCreater
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user