FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::vulkan::Context::SubmitableCommandBuffer Class Reference
Inheritance diagram for fge::vulkan::Context::SubmitableCommandBuffer:
fge::vulkan::CommandBuffer fge::vulkan::ContextAware

Public Types

enum class  RenderPassScopes { INSIDE , OUTSIDE , BOTH }
 
enum  SupportedQueueTypes : uint32_t { SUPPORTED_QUEUE_GRAPHICS = 1 << 0 , SUPPORTED_QUEUE_COMPUTE = 1 << 1 , SUPPORTED_QUEUE_TRANSFER = 1 << 2 , SUPPORTED_QUEUE_ALL = SUPPORTED_QUEUE_GRAPHICS | SUPPORTED_QUEUE_COMPUTE | SUPPORTED_QUEUE_TRANSFER }
 
using SupportedQueueTypes_t = std::underlying_type_t<SupportedQueueTypes>
 

Public Member Functions

SubmitTypes getSubmitType () const
 
 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
 
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
 

Friends

class Context
 

Member Function Documentation

◆ beginRenderPass()

void fge::vulkan::CommandBuffer::beginRenderPass ( VkRenderPass renderPass,
VkFramebuffer framebuffer,
VkExtent2D extent,
VkClearValue clearColor,
VkSubpassContents contents )
inherited

Begin a render pass.

Parameters
renderPassThe render pass
framebufferThe framebuffer
extentThe extent
clearColorThe clear color
contentsThe subpass contents

◆ bindDescriptorSets() [1/2]

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 )
inherited

Bind descriptor sets with dynamic parameters.

Parameters
pipelineLayoutThe pipeline layout
pipelineBindPointThe pipeline bind point
descriptorSetThe descriptor set
descriptorCountThe descriptor count
dynamicOffsetCountThe dynamic offset count
pDynamicOffsetsThe dynamic offsets
firstSetThe first set

◆ bindDescriptorSets() [2/2]

void fge::vulkan::CommandBuffer::bindDescriptorSets ( VkPipelineLayout pipelineLayout,
VkPipelineBindPoint pipelineBindPoint,
VkDescriptorSet const * descriptorSet,
uint32_t descriptorCount,
uint32_t firstSet )
inherited

Bind descriptor sets without dynamic parameters.

Parameters
pipelineLayoutThe pipeline layout
pipelineBindPointThe pipeline bind point
descriptorSetThe descriptor set
descriptorCountThe descriptor count
firstSetThe first set

◆ bindIndexBuffer()

void fge::vulkan::CommandBuffer::bindIndexBuffer ( VkBuffer buffer,
VkDeviceSize offset,
VkIndexType indexType )
inherited

Bind an index buffer.

Parameters
bufferThe buffer
offsetThe offset
indexTypeThe index type

◆ bindPipeline()

void fge::vulkan::CommandBuffer::bindPipeline ( VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline )
inherited

Bind a pipeline.

Parameters
pipelineBindPointThe pipeline bind point
pipelineThe pipeline

◆ bindVertexBuffers()

void fge::vulkan::CommandBuffer::bindVertexBuffers ( uint32_t firstBinding,
uint32_t bindingCount,
VkBuffer const * pBuffers,
VkDeviceSize const * pOffsets )
inherited

Bind vertex buffers.

Parameters
firstBindingThe first binding
bindingCountThe binding count
pBuffersThe buffers
pOffsetsThe offsets

◆ copyBuffer()

void fge::vulkan::CommandBuffer::copyBuffer ( VkBuffer srcBuffer,
VkBuffer dstBuffer,
VkDeviceSize size )
inherited

Copy a buffer to another.

Fill a command buffer with a copy command in order to copy a buffer to another.

Parameters
srcBufferThe source buffer
dstBufferThe destination buffer
sizeThe size of the buffer to copy

◆ copyBufferToImage()

void fge::vulkan::CommandBuffer::copyBufferToImage ( VkBuffer buffer,
VkImage image,
uint32_t width,
uint32_t height,
int32_t offsetX = 0,
int32_t offsetY = 0 )
inherited

Copy a buffer to an image.

Fill a command buffer with a copy command in order to copy a buffer to an image.

Parameters
bufferThe buffer
imageThe image
widthWidth of the image
heightHeight of the image
offsetXAn offset on the X axis
offsetYAn offset on the Y axis

◆ copyImageToBuffer()

void fge::vulkan::CommandBuffer::copyImageToBuffer ( VkImage image,
VkBuffer buffer,
uint32_t width,
uint32_t height )
inherited

Copy an image to a buffer.

Fill a command buffer with a copy command in order to copy an image to a buffer.

Parameters
imageThe image
bufferThe buffer
widthThe width of the image
heightThe height of the image

◆ copyImageToImage()

void fge::vulkan::CommandBuffer::copyImageToImage ( VkImage srcImage,
VkImage dstImage,
uint32_t width,
uint32_t height,
int32_t offsetX = 0,
int32_t offsetY = 0 )
inherited

Copy an image to another image.

Fill a command buffer with a copy command in order to copy an image to another image.

Parameters
srcImageThe source image
dstImageThe destination image
widthThe width of the image
heightThe height of the image
offsetXAn offset on the X axis
offsetYAn offset on the Y axis

◆ destroy()

void fge::vulkan::CommandBuffer::destroy ( )
finalvirtualinherited

◆ draw()

void fge::vulkan::CommandBuffer::draw ( uint32_t vertexCount,
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance )
inherited

Draw.

Parameters
vertexCountThe vertex count
instanceCountThe instance count
firstVertexThe first vertex
firstInstanceThe first instance

◆ drawIndexed()

void fge::vulkan::CommandBuffer::drawIndexed ( uint32_t indexCount,
uint32_t instanceCount,
uint32_t firstIndex,
int32_t vertexOffset,
uint32_t firstInstance )
inherited

Draw indexed.

Parameters
indexCountThe index count
instanceCountThe instance count
firstIndexThe first index
vertexOffsetThe vertex offset
firstInstanceThe first instance

◆ drawIndirect()

void fge::vulkan::CommandBuffer::drawIndirect ( VkBuffer buffer,
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride )
inherited

Draw indirect.

Parameters
bufferThe buffer
offsetThe offset
drawCountThe draw count
strideThe stride

◆ endRenderPass()

void fge::vulkan::CommandBuffer::endRenderPass ( )
inherited

End a render pass.

Warning
You should call this function only if you have called beginRenderPass before

◆ pushConstants()

void fge::vulkan::CommandBuffer::pushConstants ( VkPipelineLayout pipelineLayout,
VkShaderStageFlags stageFlags,
uint32_t offset,
uint32_t size,
void const * pValues )
inherited

Push constants to the pipeline.

Parameters
pipelineLayoutThe pipeline layout
stageFlagsThe stage flags
offsetThe offset
sizeThe size
pValuesThe values

◆ setScissor()

void fge::vulkan::CommandBuffer::setScissor ( uint32_t firstScissor,
uint32_t scissorCount,
VkRect2D const * pScissors )
inherited

Set the scissor dynamically.

Warning
You should use this function only if the graphic pipeline has the dynamic scissor state
Parameters
firstScissorThe first scissor
scissorCountThe scissor count
pScissorsThe scissors

◆ setViewport()

void fge::vulkan::CommandBuffer::setViewport ( uint32_t firstViewport,
uint32_t viewportCount,
VkViewport const * pViewports )
inherited

Set the viewport dynamically.

Warning
You should use this function only if the graphic pipeline has the dynamic viewport state
Parameters
firstViewportThe first viewport
viewportCountThe viewport count
pViewportsThe viewports

◆ transitionImageLayout()

void fge::vulkan::CommandBuffer::transitionImageLayout ( VkImage image,
VkFormat format,
VkImageLayout oldLayout,
VkImageLayout newLayout,
uint32_t mipLevels )
inherited

Transition an image layout.

Fill a command buffer with a transition command in order to transition an image layout.

Parameters
imageThe image
formatThe format of the image
oldLayoutThe old layout
newLayoutThe new layout
mipLevelsThe number of mip the image have

The documentation for this class was generated from the following file: