SpiecsEngine
 
Loading...
Searching...
No Matches

◆ VulkanCommandBuffer()

Spices::VulkanCommandBuffer::VulkanCommandBuffer ( VulkanState & vulkanState)

Constructor Function. Create VkCommandBuffer.

Parameters
[in]vulkanStateThe global VulkanState.

Create VkCommandBufferAllocateInfo struct.

Create commandbuffer and set it global.

Create VkCommandBufferAllocateInfo struct.

Create commandbuffer and set it global.

Definition at line 177 of file VulkanCommandBuffer.cpp.

178 : VulkanObject(vulkanState)
179 {
181
185 VkCommandBufferAllocateInfo allocInfo{};
186 allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
187 allocInfo.commandPool = vulkanState.m_GraphicCommandPool;
188 allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
189 allocInfo.commandBufferCount = MaxFrameInFlight;
190
194 VK_CHECK(vkAllocateCommandBuffers(vulkanState.m_Device, &allocInfo, vulkanState.m_GraphicCommandBuffer.data()))
195
196 allocInfo.commandPool = vulkanState.m_ComputeCommandPool;
197 VK_CHECK(vkAllocateCommandBuffers(vulkanState.m_Device, &allocInfo, vulkanState.m_ComputeCommandBuffer.data()))
198
199 for (int i = 0; i < MaxFrameInFlight; i++)
200 {
201 DEBUGUTILS_SETOBJECTNAME(VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast<uint64_t>(vulkanState.m_GraphicCommandBuffer[i]), vulkanState.m_Device, "GraphicCommandBuffer")
202 DEBUGUTILS_SETOBJECTNAME(VK_OBJECT_TYPE_COMMAND_BUFFER, reinterpret_cast<uint64_t>(vulkanState.m_ComputeCommandBuffer[i]), vulkanState.m_Device, "ComputeCommandBuffer")
203
204 SPICES_PROFILE_VK_COLLECT(vulkanState.m_GraphicCommandBuffer[i])
205 SPICES_PROFILE_VK_COLLECT(vulkanState.m_ComputeCommandBuffer[i])
206 }
207 }
#define SPICES_PROFILE_ZONE
#define SPICES_PROFILE_VK_COLLECT(cmdbuf)
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
VulkanObject(VulkanState &vulkanState)
Constructor Function. Init member variables.
constexpr uint32_t MaxFrameInFlight
Max In Flight Frame. 2 buffers are enough in this program.
Definition VulkanUtils.h:22

References Spices::MaxFrameInFlight, and Spices::VulkanObject::VulkanObject().