upgrade VKPipeline.cpp/.h
This commit is contained in:
parent
5eb81f0abb
commit
07894d73e4
2
CMCore
2
CMCore
@ -1 +1 @@
|
|||||||
Subproject commit 2aadf9005ca099d8c72f745c547d610022a79d0b
|
Subproject commit 3e9b703ebcdf4167707d76b6bbdb752eb63de437
|
@ -1 +1 @@
|
|||||||
Subproject commit 86b124547d03bc221c3f87f7af66794da42fec15
|
Subproject commit 51d8086c98b5efeacdf07b3e2f1b5097bc401150
|
@ -86,7 +86,7 @@ private:
|
|||||||
|
|
||||||
bool InitPipeline()
|
bool InitPipeline()
|
||||||
{
|
{
|
||||||
vulkan::VKPipelineData pd;
|
vulkan::PipelineData pd;
|
||||||
|
|
||||||
if(!vulkan::LoadFromFile(OS_TEXT("res/pipeline/sky.pipeline"),&pd))
|
if(!vulkan::LoadFromFile(OS_TEXT("res/pipeline/sky.pipeline"),&pd))
|
||||||
return(false);
|
return(false);
|
||||||
|
@ -9,21 +9,24 @@ class Pipeline
|
|||||||
{
|
{
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkPipeline pipeline;
|
VkPipeline pipeline;
|
||||||
|
PipelineData *data;
|
||||||
|
|
||||||
bool alpha_test;
|
bool alpha_test;
|
||||||
bool alpha_blend;
|
bool alpha_blend;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Pipeline(VkDevice dev,VkPipeline p,bool at,bool ab):device(dev),pipeline(p),alpha_test(at),alpha_blend(ab){}
|
Pipeline(VkDevice dev,VkPipeline p,PipelineData *pd):device(dev),pipeline(p),data(pd){}
|
||||||
virtual ~Pipeline();
|
virtual ~Pipeline();
|
||||||
|
|
||||||
operator VkPipeline(){return pipeline;}
|
operator VkPipeline(){return pipeline;}
|
||||||
|
|
||||||
const bool IsAlphaTest()const{return alpha_test;}
|
const PipelineData *GetData()const{return data;}
|
||||||
const bool IsAlphaBlend()const{return alpha_blend;}
|
|
||||||
|
const bool IsAlphaTest()const{return data->alpha_test>0;}
|
||||||
|
const bool IsAlphaBlend()const{return data->alpha_blend;}
|
||||||
};//class GraphicsPipeline
|
};//class GraphicsPipeline
|
||||||
|
|
||||||
Pipeline *CreatePipeline(Device *dev,VKPipelineData *,const Material *material,const RenderTarget *);
|
Pipeline *CreatePipeline(Device *dev,PipelineData *,const Material *material,const RenderTarget *);
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
#endif//HGL_GRAPH_VULKAN_PIPELINE_INCLUDE
|
#endif//HGL_GRAPH_VULKAN_PIPELINE_INCLUDE
|
||||||
|
@ -11,7 +11,7 @@ Pipeline::~Pipeline()
|
|||||||
vkDestroyPipeline(device,pipeline,nullptr);
|
vkDestroyPipeline(device,pipeline,nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipeline *CreatePipeline(Device *dev,VKPipelineData *data,const Material *material,const RenderTarget *rt)
|
Pipeline *CreatePipeline(Device *dev,PipelineData *data,const Material *material,const RenderTarget *rt)
|
||||||
{
|
{
|
||||||
VkPipeline graphicsPipeline;
|
VkPipeline graphicsPipeline;
|
||||||
|
|
||||||
@ -21,20 +21,20 @@ Pipeline *CreatePipeline(Device *dev,VKPipelineData *data,const Material *materi
|
|||||||
|
|
||||||
data->InitViewportState(rt->GetExtent());
|
data->InitViewportState(rt->GetExtent());
|
||||||
|
|
||||||
data->pipelineInfo.layout = material->GetPipelineLayout();
|
data->pipeline_info.layout = material->GetPipelineLayout();
|
||||||
|
|
||||||
{
|
{
|
||||||
data->pipelineInfo.renderPass = rt->GetRenderPass();
|
data->pipeline_info.renderPass = rt->GetRenderPass();
|
||||||
data->pipelineInfo.subpass = 0; //subpass由于还不知道有什么用,所以暂时写0,待知道功用后,需改进
|
data->pipeline_info.subpass = 0; //subpass由于还不知道有什么用,所以暂时写0,待知道功用后,需改进
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vkCreateGraphicsPipelines( dev->GetDevice(),
|
if (vkCreateGraphicsPipelines( dev->GetDevice(),
|
||||||
dev->GetPipelineCache(),
|
dev->GetPipelineCache(),
|
||||||
1,&data->pipelineInfo,
|
1,&data->pipeline_info,
|
||||||
nullptr,
|
nullptr,
|
||||||
&graphicsPipeline) != VK_SUCCESS)
|
&graphicsPipeline) != VK_SUCCESS)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
return(new Pipeline(dev->GetDevice(),graphicsPipeline,data->alpha_test>0,data->alpha_blend));
|
return(new Pipeline(dev->GetDevice(),graphicsPipeline,data));
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user