VKCommandBuffer add a new function SetRenderArea(const VkExtent2D &)

This commit is contained in:
hyzboy 2020-06-11 19:23:51 +08:00
parent 532a8e3b56
commit 880876b8b2
2 changed files with 9 additions and 0 deletions

View File

@ -30,7 +30,9 @@ public:
operator const VkCommandBuffer *()const{return &cmd_buf;} operator const VkCommandBuffer *()const{return &cmd_buf;}
void SetRenderArea(const VkRect2D &ra){render_area=ra;} void SetRenderArea(const VkRect2D &ra){render_area=ra;}
void SetRenderArea(const VkExtent2D &);
void SetViewport(const VkViewport &vp){viewport=vp;} void SetViewport(const VkViewport &vp){viewport=vp;}
void SetClearColor(uint32_t index,float r,float g,float b,float a=1.0f) void SetClearColor(uint32_t index,float r,float g,float b,float a=1.0f)
{ {
if(index>=cv_count)return; if(index>=cv_count)return;

View File

@ -43,6 +43,13 @@ CommandBuffer::~CommandBuffer()
vkFreeCommandBuffers(device,pool,1,&cmd_buf); 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() bool CommandBuffer::Begin()
{ {
VkCommandBufferBeginInfo cmd_buf_info; VkCommandBufferBeginInfo cmd_buf_info;