From b8e332a109c92c417e9c871ede6599544756d680 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sun, 18 Oct 2020 18:35:03 +0800 Subject: [PATCH] RenderTarget doesn't set extent, it's a bug. --- inc/hgl/graph/vulkan/VKRenderTarget.h | 1 + src/RenderDevice/Vulkan/VKRenderTarget.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/inc/hgl/graph/vulkan/VKRenderTarget.h b/inc/hgl/graph/vulkan/VKRenderTarget.h index 22f82271..3c92ecc2 100644 --- a/inc/hgl/graph/vulkan/VKRenderTarget.h +++ b/inc/hgl/graph/vulkan/VKRenderTarget.h @@ -105,6 +105,7 @@ public: bool PresentBackbuffer(); bool Submit(VkCommandBuffer); + bool Submit(VkCommandBuffer,GPUSemaphore *); };//class SwapchainRenderTarget:public RenderTarget VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_RENDER_TARGET_INCLUDE diff --git a/src/RenderDevice/Vulkan/VKRenderTarget.cpp b/src/RenderDevice/Vulkan/VKRenderTarget.cpp index f84cc7f3..78ef4024 100644 --- a/src/RenderDevice/Vulkan/VKRenderTarget.cpp +++ b/src/RenderDevice/Vulkan/VKRenderTarget.cpp @@ -26,19 +26,29 @@ RenderTarget::RenderTarget(Device *dev,RenderPass *_rp,Framebuffer *_fb,CommandB rp=_rp; fb=_fb; command_buffer=_cb; + + depth_texture=dt; color_count=cc; if(color_count>0) { color_textures=new Texture2D *[color_count]; hgl_cpy(color_textures,ctl,color_count); + + extent.width=color_textures[0]->GetWidth(); + extent.height=color_textures[0]->GetHeight(); } else { color_textures=nullptr; + + if(depth_texture) + { + extent.width=depth_texture->GetWidth(); + extent.height=depth_texture->GetHeight(); + } } - depth_texture=dt; render_complete_semaphore=dev->CreateSemaphore(); } @@ -138,4 +148,9 @@ bool SwapchainRenderTarget::Submit(VkCommandBuffer cb) { return SubmitQueue::Submit(cb,present_complete_semaphore,render_complete_semaphore); } + +bool SwapchainRenderTarget::Submit(VkCommandBuffer cb,GPUSemaphore *pce) +{ + return SubmitQueue::Submit(cb,pce,render_complete_semaphore); +} VK_NAMESPACE_END \ No newline at end of file