From 880876b8b244a7f7d2315f013be5f8ee5080d58a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 11 Jun 2020 19:23:51 +0800 Subject: [PATCH] VKCommandBuffer add a new function SetRenderArea(const VkExtent2D &) --- inc/hgl/graph/vulkan/VKCommandBuffer.h | 2 ++ src/RenderDevice/Vulkan/VKCommandBuffer.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/inc/hgl/graph/vulkan/VKCommandBuffer.h b/inc/hgl/graph/vulkan/VKCommandBuffer.h index 849cdae9..85f1679d 100644 --- a/inc/hgl/graph/vulkan/VKCommandBuffer.h +++ b/inc/hgl/graph/vulkan/VKCommandBuffer.h @@ -30,7 +30,9 @@ public: operator const VkCommandBuffer *()const{return &cmd_buf;} void SetRenderArea(const VkRect2D &ra){render_area=ra;} + void SetRenderArea(const VkExtent2D &); void SetViewport(const VkViewport &vp){viewport=vp;} + void SetClearColor(uint32_t index,float r,float g,float b,float a=1.0f) { if(index>=cv_count)return; diff --git a/src/RenderDevice/Vulkan/VKCommandBuffer.cpp b/src/RenderDevice/Vulkan/VKCommandBuffer.cpp index 71c24f18..fdfb69a4 100644 --- a/src/RenderDevice/Vulkan/VKCommandBuffer.cpp +++ b/src/RenderDevice/Vulkan/VKCommandBuffer.cpp @@ -43,6 +43,13 @@ CommandBuffer::~CommandBuffer() vkFreeCommandBuffers(device,pool,1,&cmd_buf); } +void CommandBuffer::SetRenderArea(const VkExtent2D &ext2d) +{ + render_area.offset.x=0; + render_area.offset.y=0; + render_area.extent=ext2d; +} + bool CommandBuffer::Begin() { VkCommandBufferBeginInfo cmd_buf_info;