From c56827a3487ba88252e79d79bff6fe562d6a58e9 Mon Sep 17 00:00:00 2001 From: HuYingzhuo Date: Thu, 25 Apr 2019 11:38:57 +0800 Subject: [PATCH] =?UTF-8?q?CommandBuffer=E5=A2=9E=E5=8A=A0=E5=87=A0?= =?UTF-8?q?=E4=B8=AASet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/VKCommandBuffer.cpp | 34 ++++++++++++++++++++++++++++++ example/Vulkan/VKCommandBuffer.h | 19 +++++++++++++---- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/example/Vulkan/VKCommandBuffer.cpp b/example/Vulkan/VKCommandBuffer.cpp index a7e87657..ef87aff3 100644 --- a/example/Vulkan/VKCommandBuffer.cpp +++ b/example/Vulkan/VKCommandBuffer.cpp @@ -96,7 +96,41 @@ bool CommandBuffer::Bind(VertexInput *vi) vkCmdBindVertexBuffers(cmd_buf,0,count,vi->GetBuffer(),vi->GetOffset()); return(true); } +void CommandBuffer::SetDepthBias(float constant_factor,float clamp,float slope_factor) +{ + vkCmdSetDepthBias(cmd_buf,constant_factor,clamp,slope_factor); +} +void CommandBuffer::SetDepthBounds(float min_db,float max_db) +{ + vkCmdSetDepthBounds(cmd_buf,min_db,max_db); +} + +void CommandBuffer::SetStencilCompareMask(VkStencilFaceFlags faceMask,uint32_t compareMask) +{ + vkCmdSetStencilCompareMask(cmd_buf,faceMask,compareMask); +} + +void CommandBuffer::SetStencilWriteMask(VkStencilFaceFlags faceMask,uint32_t compareMask) +{ + vkCmdSetStencilWriteMask(cmd_buf,faceMask,compareMask); +} + +void CommandBuffer::SetStencilReference(VkStencilFaceFlags faceMask,uint32_t compareMask) +{ + vkCmdSetStencilReference(cmd_buf,faceMask,compareMask); +} + +void CommandBuffer::SetBlendConstants(const float constants[4]) +{ + vkCmdSetBlendConstants(cmd_buf,constants); +} + +void CommandBuffer::SetLineWidth(float line_width) +{ + vkCmdSetLineWidth(cmd_buf,line_width); +} + void CommandBuffer::Draw(const uint32_t vertex_count) { vkCmdDraw(cmd_buf,vertex_count,1,0,0); diff --git a/example/Vulkan/VKCommandBuffer.h b/example/Vulkan/VKCommandBuffer.h index 307e4100..6b9a8cdb 100644 --- a/example/Vulkan/VKCommandBuffer.h +++ b/example/Vulkan/VKCommandBuffer.h @@ -26,6 +26,11 @@ public: operator VkCommandBuffer(){return cmd_buf;} + bool Begin(RenderPass *rp,Framebuffer *fb); + bool Bind(Pipeline *p); + bool Bind(PipelineLayout *pl); + bool Bind(VertexInput *vi); + void SetRenderArea(const VkRect2D &ra){render_area=ra;} void SetClearColor(float r,float g,float b,float a=1.0f) { @@ -40,11 +45,17 @@ public: clear_values[1].depthStencil.depth=d; clear_values[1].depthStencil.stencil=s; } + + void SetDepthBias(float constant_factor,float clamp,float slope_factor); + void SetDepthBounds(float min_db,float max_db); + void SetStencilCompareMask(VkStencilFaceFlags faceMask,uint32_t compareMask); + void SetStencilWriteMask(VkStencilFaceFlags faceMask,uint32_t compareMask); + void SetStencilReference(VkStencilFaceFlags faceMask,uint32_t compareMask); + + void SetBlendConstants(const float constants[4]); + + void SetLineWidth(float); - bool Begin(RenderPass *rp,Framebuffer *fb); - bool Bind(Pipeline *p); - bool Bind(PipelineLayout *pl); - bool Bind(VertexInput *vi); void Draw(const uint32_t vertex_count); void Draw(const uint32_t vertex_count,const uint32_t instance_count,const uint32_t first_vertex=0,const uint32_t first_instance=0); bool End();