![]() |
FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
|
Vulkan command buffer wrapper. More...
#include <C_commandBuffer.hpp>
Public Member Functions | |
CommandBuffer (Context const &context) | |
CommandBuffer (Context const &context, VkCommandBufferLevel level, VkCommandPool commandPool) | |
CommandBuffer (Context const &context, VkCommandBufferLevel level, VkCommandBuffer commandBuffer, VkCommandPool commandPool) | |
CommandBuffer (CommandBuffer const &r)=delete | |
CommandBuffer (CommandBuffer &&r) noexcept | |
CommandBuffer & | operator= (CommandBuffer const &r)=delete |
CommandBuffer & | operator= (CommandBuffer &&r) noexcept |
void | create (VkCommandBufferLevel level, VkCommandPool commandPool) |
void | create (VkCommandBufferLevel level, VkCommandBuffer commandBuffer, VkCommandPool commandPool) |
void | destroy () final |
std::pair< VkCommandBuffer, VkCommandPool > | release () |
void | reset () |
void | begin (VkCommandBufferUsageFlags flags, VkCommandBufferInheritanceInfo const *inheritanceInfo=nullptr) |
void | end () |
VkCommandBuffer | get () const |
VkCommandBuffer const * | getPtr () const |
VkCommandPool | getPool () const |
VkCommandBufferLevel | getLevel () const |
RenderPassScopes | getRenderPassScope () const |
SupportedQueueTypes_t | getSupportedQueues () const |
uint32_t | getRecordedCommandsCount () const |
bool | isEnded () const |
void | forceEnd () |
void | forceRenderPassScope (RenderPassScopes scope) |
void | forceSupportedQueues (SupportedQueueTypes_t queues) |
void | forceRecordedCommandsCount (uint32_t count) |
void | copyBuffer (VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size) |
Copy a buffer to another. | |
void | transitionImageLayout (VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels) |
Transition an image layout. | |
void | copyBufferToImage (VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, int32_t offsetX=0, int32_t offsetY=0) |
Copy a buffer to an image. | |
void | copyImageToBuffer (VkImage image, VkBuffer buffer, uint32_t width, uint32_t height) |
Copy an image to a buffer. | |
void | copyImageToImage (VkImage srcImage, VkImage dstImage, uint32_t width, uint32_t height, int32_t offsetX=0, int32_t offsetY=0) |
Copy an image to another image. | |
void | pushConstants (VkPipelineLayout pipelineLayout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, void const *pValues) |
Push constants to the pipeline. | |
void | beginRenderPass (VkRenderPass renderPass, VkFramebuffer framebuffer, VkExtent2D extent, VkClearValue clearColor, VkSubpassContents contents) |
Begin a render pass. | |
void | endRenderPass () |
End a render pass. | |
void | bindDescriptorSets (VkPipelineLayout pipelineLayout, VkPipelineBindPoint pipelineBindPoint, VkDescriptorSet const *descriptorSet, uint32_t descriptorCount, uint32_t firstSet) |
Bind descriptor sets without dynamic parameters. | |
void | bindDescriptorSets (VkPipelineLayout pipelineLayout, VkPipelineBindPoint pipelineBindPoint, VkDescriptorSet const *descriptorSet, uint32_t descriptorCount, uint32_t dynamicOffsetCount, uint32_t const *pDynamicOffsets, uint32_t firstSet) |
Bind descriptor sets with dynamic parameters. | |
void | bindPipeline (VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) |
Bind a pipeline. | |
void | setViewport (uint32_t firstViewport, uint32_t viewportCount, VkViewport const *pViewports) |
Set the viewport dynamically. | |
void | setScissor (uint32_t firstScissor, uint32_t scissorCount, VkRect2D const *pScissors) |
Set the scissor dynamically. | |
void | bindVertexBuffers (uint32_t firstBinding, uint32_t bindingCount, VkBuffer const *pBuffers, VkDeviceSize const *pOffsets) |
Bind vertex buffers. | |
void | bindIndexBuffer (VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) |
Bind an index buffer. | |
void | draw (uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) |
Draw. | |
void | drawIndexed (uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) |
Draw indexed. | |
void | drawIndirect (VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) |
Draw indirect. | |
constexpr Context const & | getContext () const |
void | swapContext (Context const &context) |
Protected Member Functions | |
void | verifyContext (ContextAware const &r) const |
Vulkan command buffer wrapper.
void fge::vulkan::CommandBuffer::beginRenderPass | ( | VkRenderPass | renderPass, |
VkFramebuffer | framebuffer, | ||
VkExtent2D | extent, | ||
VkClearValue | clearColor, | ||
VkSubpassContents | contents ) |
Begin a render pass.
renderPass | The render pass |
framebuffer | The framebuffer |
extent | The extent |
clearColor | The clear color |
contents | The subpass contents |
void fge::vulkan::CommandBuffer::bindDescriptorSets | ( | VkPipelineLayout | pipelineLayout, |
VkPipelineBindPoint | pipelineBindPoint, | ||
VkDescriptorSet const * | descriptorSet, | ||
uint32_t | descriptorCount, | ||
uint32_t | dynamicOffsetCount, | ||
uint32_t const * | pDynamicOffsets, | ||
uint32_t | firstSet ) |
Bind descriptor sets with dynamic parameters.
pipelineLayout | The pipeline layout |
pipelineBindPoint | The pipeline bind point |
descriptorSet | The descriptor set |
descriptorCount | The descriptor count |
dynamicOffsetCount | The dynamic offset count |
pDynamicOffsets | The dynamic offsets |
firstSet | The first set |
void fge::vulkan::CommandBuffer::bindDescriptorSets | ( | VkPipelineLayout | pipelineLayout, |
VkPipelineBindPoint | pipelineBindPoint, | ||
VkDescriptorSet const * | descriptorSet, | ||
uint32_t | descriptorCount, | ||
uint32_t | firstSet ) |
Bind descriptor sets without dynamic parameters.
pipelineLayout | The pipeline layout |
pipelineBindPoint | The pipeline bind point |
descriptorSet | The descriptor set |
descriptorCount | The descriptor count |
firstSet | The first set |
void fge::vulkan::CommandBuffer::bindIndexBuffer | ( | VkBuffer | buffer, |
VkDeviceSize | offset, | ||
VkIndexType | indexType ) |
Bind an index buffer.
buffer | The buffer |
offset | The offset |
indexType | The index type |
void fge::vulkan::CommandBuffer::bindPipeline | ( | VkPipelineBindPoint | pipelineBindPoint, |
VkPipeline | pipeline ) |
Bind a pipeline.
pipelineBindPoint | The pipeline bind point |
pipeline | The pipeline |
void fge::vulkan::CommandBuffer::bindVertexBuffers | ( | uint32_t | firstBinding, |
uint32_t | bindingCount, | ||
VkBuffer const * | pBuffers, | ||
VkDeviceSize const * | pOffsets ) |
Bind vertex buffers.
firstBinding | The first binding |
bindingCount | The binding count |
pBuffers | The buffers |
pOffsets | The offsets |
void fge::vulkan::CommandBuffer::copyBuffer | ( | VkBuffer | srcBuffer, |
VkBuffer | dstBuffer, | ||
VkDeviceSize | size ) |
Copy a buffer to another.
Fill a command buffer with a copy command in order to copy a buffer to another.
srcBuffer | The source buffer |
dstBuffer | The destination buffer |
size | The size of the buffer to copy |
void fge::vulkan::CommandBuffer::copyBufferToImage | ( | VkBuffer | buffer, |
VkImage | image, | ||
uint32_t | width, | ||
uint32_t | height, | ||
int32_t | offsetX = 0, | ||
int32_t | offsetY = 0 ) |
Copy a buffer to an image.
Fill a command buffer with a copy command in order to copy a buffer to an image.
buffer | The buffer |
image | The image |
width | Width of the image |
height | Height of the image |
offsetX | An offset on the X axis |
offsetY | An offset on the Y axis |
void fge::vulkan::CommandBuffer::copyImageToBuffer | ( | VkImage | image, |
VkBuffer | buffer, | ||
uint32_t | width, | ||
uint32_t | height ) |
Copy an image to a buffer.
Fill a command buffer with a copy command in order to copy an image to a buffer.
image | The image |
buffer | The buffer |
width | The width of the image |
height | The height of the image |
void fge::vulkan::CommandBuffer::copyImageToImage | ( | VkImage | srcImage, |
VkImage | dstImage, | ||
uint32_t | width, | ||
uint32_t | height, | ||
int32_t | offsetX = 0, | ||
int32_t | offsetY = 0 ) |
Copy an image to another image.
Fill a command buffer with a copy command in order to copy an image to another image.
srcImage | The source image |
dstImage | The destination image |
width | The width of the image |
height | The height of the image |
offsetX | An offset on the X axis |
offsetY | An offset on the Y axis |
|
finalvirtual |
Implements fge::vulkan::ContextAware.
void fge::vulkan::CommandBuffer::draw | ( | uint32_t | vertexCount, |
uint32_t | instanceCount, | ||
uint32_t | firstVertex, | ||
uint32_t | firstInstance ) |
Draw.
vertexCount | The vertex count |
instanceCount | The instance count |
firstVertex | The first vertex |
firstInstance | The first instance |
void fge::vulkan::CommandBuffer::drawIndexed | ( | uint32_t | indexCount, |
uint32_t | instanceCount, | ||
uint32_t | firstIndex, | ||
int32_t | vertexOffset, | ||
uint32_t | firstInstance ) |
Draw indexed.
indexCount | The index count |
instanceCount | The instance count |
firstIndex | The first index |
vertexOffset | The vertex offset |
firstInstance | The first instance |
void fge::vulkan::CommandBuffer::drawIndirect | ( | VkBuffer | buffer, |
VkDeviceSize | offset, | ||
uint32_t | drawCount, | ||
uint32_t | stride ) |
Draw indirect.
buffer | The buffer |
offset | The offset |
drawCount | The draw count |
stride | The stride |
void fge::vulkan::CommandBuffer::endRenderPass | ( | ) |
End a render pass.
void fge::vulkan::CommandBuffer::pushConstants | ( | VkPipelineLayout | pipelineLayout, |
VkShaderStageFlags | stageFlags, | ||
uint32_t | offset, | ||
uint32_t | size, | ||
void const * | pValues ) |
Push constants to the pipeline.
pipelineLayout | The pipeline layout |
stageFlags | The stage flags |
offset | The offset |
size | The size |
pValues | The values |
void fge::vulkan::CommandBuffer::setScissor | ( | uint32_t | firstScissor, |
uint32_t | scissorCount, | ||
VkRect2D const * | pScissors ) |
Set the scissor dynamically.
firstScissor | The first scissor |
scissorCount | The scissor count |
pScissors | The scissors |
void fge::vulkan::CommandBuffer::setViewport | ( | uint32_t | firstViewport, |
uint32_t | viewportCount, | ||
VkViewport const * | pViewports ) |
Set the viewport dynamically.
firstViewport | The first viewport |
viewportCount | The viewport count |
pViewports | The viewports |
void fge::vulkan::CommandBuffer::transitionImageLayout | ( | VkImage | image, |
VkFormat | format, | ||
VkImageLayout | oldLayout, | ||
VkImageLayout | newLayout, | ||
uint32_t | mipLevels ) |
Transition an image layout.
Fill a command buffer with a transition command in order to transition an image layout.
image | The image |
format | The format of the image |
oldLayout | The old layout |
newLayout | The new layout |
mipLevels | The number of mip the image have |