diff --git a/example/Vulkan/Atomsphere.cpp b/example/Vulkan/Atomsphere.cpp index b5c2af2f..c2de3f9b 100644 --- a/example/Vulkan/Atomsphere.cpp +++ b/example/Vulkan/Atomsphere.cpp @@ -87,7 +87,7 @@ private: bool InitPipeline() { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->SetCullMode(VK_CULL_MODE_NONE); diff --git a/example/Vulkan/Deferred.cpp b/example/Vulkan/Deferred.cpp index 9f6ea5fc..9b97bf9d 100644 --- a/example/Vulkan/Deferred.cpp +++ b/example/Vulkan/Deferred.cpp @@ -58,7 +58,7 @@ private: bool InitGBufferPipeline(SubpassParam *sp) { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->SetCullMode(VK_CULL_MODE_BACK_BIT); @@ -76,13 +76,13 @@ private: bool InitCompositionPipeline(SubpassParam *sp) { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,sp->material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->SetCullMode(VK_CULL_MODE_NONE); pipeline_creater->Set(PRIM_TRIANGLES); sp->pipeline=pipeline_creater->Create(); - + if(!sp->pipeline) return(false); @@ -94,11 +94,13 @@ private: bool InitMaterial() { - InitSubpass(&sp_gbuffer, OS_TEXT("gbuffer_opaque.vert.spv"),OS_TEXT("gbuffer_opaque.frag.spv")); - InitSubpass(&sp_composition, OS_TEXT("ds_composition.vert.spv"),OS_TEXT("ds_composition.frag.spv")); + if(!InitSubpass(&sp_gbuffer, OS_TEXT("gbuffer_opaque.vert.spv"),OS_TEXT("gbuffer_opaque.frag.spv")))return(false); + if(!InitSubpass(&sp_composition, OS_TEXT("ds_composition.vert.spv"),OS_TEXT("ds_composition.frag.spv")))return(false); - InitGBufferPipeline(&sp_gbuffer); - InitCompositionPipeline(&sp_composition); + if(!InitGBufferPipeline(&sp_gbuffer))return(false); + if(!InitCompositionPipeline(&sp_composition))return(false); + + return(true); } void CreateRenderObject(vulkan::Material *mtl) diff --git a/example/Vulkan/Geometry2D.cpp b/example/Vulkan/Geometry2D.cpp index 1b894bd7..448a0e43 100644 --- a/example/Vulkan/Geometry2D.cpp +++ b/example/Vulkan/Geometry2D.cpp @@ -117,7 +117,7 @@ private: constexpr os_char PIPELINE_FILENAME[]=OS_TEXT("2DSolid.pipeline"); { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->CloseCullFace(); diff --git a/example/Vulkan/Geometry3D.cpp b/example/Vulkan/Geometry3D.cpp index 34af30f1..7588116c 100644 --- a/example/Vulkan/Geometry3D.cpp +++ b/example/Vulkan/Geometry3D.cpp @@ -85,7 +85,7 @@ private: bool InitPipeline() { { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->CloseCullFace(); diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index e139a748..8111ade8 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -137,7 +137,7 @@ private: bool InitPipeline() { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->Set(PRIM_LINES); diff --git a/example/Vulkan/LoadModel.cpp b/example/Vulkan/LoadModel.cpp index dadefae8..0e650c1e 100644 --- a/example/Vulkan/LoadModel.cpp +++ b/example/Vulkan/LoadModel.cpp @@ -165,7 +165,7 @@ private: constexpr os_char PIPELINE_FILENAME[]=OS_TEXT("2DSolid.pipeline"); { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->SetPolygonMode(VK_POLYGON_MODE_LINE); diff --git a/example/Vulkan/SceneTree.cpp b/example/Vulkan/SceneTree.cpp index 1c014e52..57d91c95 100644 --- a/example/Vulkan/SceneTree.cpp +++ b/example/Vulkan/SceneTree.cpp @@ -75,7 +75,7 @@ private: bool InitPipeline() { { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->CloseCullFace(); diff --git a/example/Vulkan/VulkanAppFramework.h b/example/Vulkan/VulkanAppFramework.h index 34424409..8b041b39 100644 --- a/example/Vulkan/VulkanAppFramework.h +++ b/example/Vulkan/VulkanAppFramework.h @@ -154,7 +154,7 @@ public: vulkan::CommandBuffer *cb=cmd_buf[index]; cb->Begin(); - cb->BeginRenderPass(device->GetRenderPass(),device->GetFramebuffer(index)); + cb->BeginRenderPass(device->GetMainRenderPass(),device->GetFramebuffer(index)); cb->Bind(p); cb->Bind(ds); cb->Bind(r); @@ -186,7 +186,7 @@ public: vulkan::CommandBuffer *cb=cmd_buf[index]; cb->Begin(); - cb->BeginRenderPass(device->GetRenderPass(),device->GetFramebuffer(index)); + cb->BeginRenderPass(device->GetMainRenderPass(),device->GetFramebuffer(index)); rl->Render(cb); cb->EndRenderPass(); cb->End(); @@ -226,7 +226,7 @@ public: { int index=AcquireNextImage(); - if(index<0||index>swap_chain_count)return; + if(index<0||index>=swap_chain_count)return; SubmitDraw(index); } diff --git a/example/Vulkan/indices_rect.cpp b/example/Vulkan/indices_rect.cpp index cd2f88db..86092956 100644 --- a/example/Vulkan/indices_rect.cpp +++ b/example/Vulkan/indices_rect.cpp @@ -104,7 +104,7 @@ private: bool InitPipeline() { vulkan::PipelineCreater * - pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->CloseCullFace(); diff --git a/example/Vulkan/main.cpp b/example/Vulkan/main.cpp index 2be4adb2..dbed2526 100644 --- a/example/Vulkan/main.cpp +++ b/example/Vulkan/main.cpp @@ -107,7 +107,7 @@ private: constexpr os_char PIPELINE_FILENAME[]=OS_TEXT("2DSolid.pipeline"); { - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->CloseCullFace(); @@ -122,7 +122,7 @@ private: void *data; uint size=filesystem::LoadFileToMemory(PIPELINE_FILENAME,(void **)&data); - vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent(),(uchar *)data,size); + vulkan::PipelineCreater *pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent(),(uchar *)data,size); pipeline=pipeline_creater->Create(); diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index 4e2ab82c..73f45d84 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -141,7 +141,7 @@ private: bool InitPipeline() { vulkan::PipelineCreater * - pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetRenderPass(),device->GetExtent()); + pipeline_creater=new vulkan::PipelineCreater(device,material,device->GetMainRenderPass(),device->GetExtent()); pipeline_creater->SetDepthTest(false); pipeline_creater->SetDepthWrite(false); pipeline_creater->CloseCullFace(); diff --git a/inc/hgl/graph/vulkan/VKDevice.h b/inc/hgl/graph/vulkan/VKDevice.h index 7af3ce9f..e9036fab 100644 --- a/inc/hgl/graph/vulkan/VKDevice.h +++ b/inc/hgl/graph/vulkan/VKDevice.h @@ -68,7 +68,7 @@ public: const uint32_t GetSwapChainImageCount ()const {return attr->sc_texture.GetCount();} - RenderPass * GetRenderPass () {return main_rp;} + RenderPass * GetMainRenderPass () {return main_rp;} Framebuffer * GetFramebuffer (int index) {return render_frame[index];} const uint32_t GetCurrentFrameIndices () {return current_frame;} Framebuffer * GetCurrentFramebuffer () {return render_frame[current_frame];}