Lugdunum  0.1.0
Pipeline.inl
Go to the documentation of this file.
2  struct MemoryBarrier {
3  VkAccessFlags srcAccessMask;
4  VkAccessFlags dstAccessMask;
5  };
6 
8  VkAccessFlags srcAccessMask;
9  VkAccessFlags dstAccessMask;
10  uint32_t srcQueueFamilyIndex{VK_QUEUE_FAMILY_IGNORED};
11  uint32_t dstQueueFamilyIndex{VK_QUEUE_FAMILY_IGNORED};
12  const API::Buffer* buffer{nullptr};
13  VkDeviceSize offset{0};
14  VkDeviceSize size{VK_WHOLE_SIZE};
15  };
16 
17  // We define an abstraction of VkImageSubresourceRange
18  // because we will rarely use more than 1 field (and want others to be defaulted)
20  // Move in API::Image ?
22  VkImageAspectFlags aspectMask{VK_IMAGE_ASPECT_COLOR_BIT};
23  uint32_t baseMipLevel{0};
24  uint32_t levelCount{1};
25  uint32_t baseArrayLayer{0};
26  uint32_t layerCount{1};
27  };
28 
29  // The image src/access masks can be guessed with the new old/new layouts
30  // We can either set manually the src/access masks or let it be chosen automatically
31  //
32  // We use 0xFFFFFFFF to know if no flag is set
33  // 0x0 cannot be used because it's allowed for some commands
34  VkAccessFlags srcAccessMask{0xFFFFFFFF};
35  VkAccessFlags dstAccessMask{0xFFFFFFFF};
36  VkImageLayout oldLayout{VK_IMAGE_LAYOUT_UNDEFINED};
37  VkImageLayout newLayout{VK_IMAGE_LAYOUT_UNDEFINED};
38  uint32_t srcQueueFamilyIndex{VK_QUEUE_FAMILY_IGNORED};
39  uint32_t dstQueueFamilyIndex{VK_QUEUE_FAMILY_IGNORED};
40  const API::Image* image{nullptr};
42  };
43 
44  std::vector<MemoryBarrier> memoryBarriers;
45  std::vector<ImageMemoryBarrier> imageMemoryBarriers;
46  std::vector<BufferMemoryBarrier> bufferMemoryBarriers;
47 };
48 
50  VkPipelineLayout layout = VK_NULL_HANDLE;
51  VkShaderStageFlags stageFlags = VK_SHADER_STAGE_ALL;
52  uint32_t offset = 0;
53  uint32_t size = 0;
54  const void* values = nullptr;
55 };
56 
57 void pipelineBarrier(
58  const CmdPipelineBarrier& parameters,
59  VkDependencyFlags dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT,
60  VkPipelineStageFlags srcStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
61  VkPipelineStageFlags dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
62 ) const;
63 
64 void bindPipeline(const API::GraphicsPipeline& pipeline, VkPipelineBindPoint pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS) const;
66  const std::vector<const API::Buffer*>& buffers,
67  const std::vector<VkDeviceSize>& offsets,
68  uint32_t firstBinding = 0
69 ) const;
70 void bindIndexBuffer(const API::Buffer& buffer, VkIndexType indexType, VkDeviceSize offset = 0) const;
71 
72 void setViewport(const std::vector<VkViewport>& viewports, uint32_t firstViewport = 0) const;
73 void setScissor(const std::vector<VkRect2D>& scissors, uint32_t firstScissor = 0) const;
74 void setBlendConstants(const float blendConstants[4]) const;
75 
76 void pushConstants(const CmdPushConstants& parameters) const;
std::vector< ImageMemoryBarrier > imageMemoryBarriers
Definition: Pipeline.inl:45
std::vector< MemoryBarrier > memoryBarriers
Definition: Pipeline.inl:44
void setBlendConstants(const float blendConstants[4]) const
void pipelineBarrier(const CmdPipelineBarrier &parameters, VkDependencyFlags dependencyFlags=VK_DEPENDENCY_BY_REGION_BIT, VkPipelineStageFlags srcStageMask=VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VkPipelineStageFlags dstStageMask=VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) const
ImageSubresourceRange subresourceRange
Definition: Pipeline.inl:41
void bindPipeline(const API::GraphicsPipeline &pipeline, VkPipelineBindPoint pipelineBindPoint=VK_PIPELINE_BIND_POINT_GRAPHICS) const
void bindIndexBuffer(const API::Buffer &buffer, VkIndexType indexType, VkDeviceSize offset=0) const
std::vector< BufferMemoryBarrier > bufferMemoryBarriers
Definition: Pipeline.inl:46
void setScissor(const std::vector< VkRect2D > &scissors, uint32_t firstScissor=0) const
void setViewport(const std::vector< VkViewport > &viewports, uint32_t firstViewport=0) const
void bindVertexBuffers(const std::vector< const API::Buffer *> &buffers, const std::vector< VkDeviceSize > &offsets, uint32_t firstBinding=0) const
void pushConstants(const CmdPushConstants &parameters) const