Lugdunum  0.1.0
RenderPass.cpp
Go to the documentation of this file.
2 
5 
6 namespace lug {
7 namespace Graphics {
8 namespace Vulkan {
9 namespace API {
10 
12  const API::RenderPass& renderPass,
13  const CommandBuffer::CmdBeginRenderPass& parameters,
14  VkSubpassContents contents
15 ) const {
16  const VkRenderPassBeginInfo beginInfo{
17  /* beginInfo.sType */ VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
18  /* beginInfo.pNext */ nullptr,
19  /* beginInfo.renderPass */ static_cast<VkRenderPass>(renderPass),
20  /* beginInfo.framebuffer */ static_cast<VkFramebuffer>(parameters.framebuffer),
21  /* beginInfo.renderArea */ parameters.renderArea,
22  /* beginInfo.clearValueCount */ static_cast<uint32_t>(parameters.clearValues.size()),
23  /* beginInfo.pClearValues */ parameters.clearValues.data()
24  };
25 
26  vkCmdBeginRenderPass(static_cast<VkCommandBuffer>(_commandBuffer), &beginInfo, contents);
27 }
28 
29 void CommandBuffer::endRenderPass() const {
30  vkCmdEndRenderPass(static_cast<VkCommandBuffer>(_commandBuffer));
31 }
32 
33 void CommandBuffer::draw(const CmdDraw& params) const {
34  vkCmdDraw(
35  static_cast<VkCommandBuffer>(_commandBuffer),
36  params.vertexCount,
37  params.instanceCount,
38  params.firstVertex,
39  params.firstInstance
40  );
41 }
42 
43 void CommandBuffer::drawIndexed(const CmdDrawIndexed& params) const {
44  vkCmdDrawIndexed(
45  static_cast<VkCommandBuffer>(_commandBuffer),
46  params.indexCount,
47  params.instanceCount,
48  params.firstIndex,
49  params.vertexOffset,
50  params.firstInstance
51  );
52 }
53 
54 } // API
55 } // Vulkan
56 } // Graphics
57 } // lug
uint32_t instanceCount
Definition: RenderPass.inl:16
uint32_t firstIndex
Definition: RenderPass.inl:17
void draw(const CmdDraw &params) const
uint32_t instanceCount
Definition: RenderPass.inl:9
uint32_t firstInstance
Definition: RenderPass.inl:19
uint32_t firstInstance
Definition: RenderPass.inl:11
uint32_t indexCount
Definition: RenderPass.inl:15
void beginRenderPass(const API::RenderPass &renderPass, const CmdBeginRenderPass &parameters, VkSubpassContents contents=VK_SUBPASS_CONTENTS_INLINE) const
uint32_t firstVertex
Definition: RenderPass.inl:10
void drawIndexed(const CmdDrawIndexed &params) const
uint32_t vertexOffset
Definition: RenderPass.inl:18
void endRenderPass() const
uint32_t vertexCount
Definition: RenderPass.inl:8