MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / AllocCommandBuffer

Method AllocCommandBuffer

deps/LLGL/sources/Renderer/Vulkan/VKDevice.cpp:124–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124VkCommandBuffer VKDevice::AllocCommandBuffer(bool begin)
125{
126 VkCommandBuffer cmdBuffer = VK_NULL_HANDLE;
127
128 /* Allocate new primary level command buffer via staging command pool */
129 VkCommandBufferAllocateInfo allocInfo;
130 {
131 allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
132 allocInfo.pNext = nullptr;
133 allocInfo.commandPool = commandPool_;
134 allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
135 allocInfo.commandBufferCount = 1;
136 }
137 auto result = vkAllocateCommandBuffers(device_, &allocInfo, &cmdBuffer);
138 VKThrowIfFailed(result, "failed to allocate Vulkan command buffer");
139
140 /* Begin command buffer recording (if enabled) */
141 if (begin)
142 {
143 VkCommandBufferBeginInfo beginInfo;
144 {
145 beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
146 beginInfo.pNext = nullptr;
147 beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
148 beginInfo.pInheritanceInfo = nullptr;
149 }
150 result = vkBeginCommandBuffer(cmdBuffer, &beginInfo);
151 VKThrowIfFailed(result, "failed to begin recording Vulkan command buffer");
152 }
153
154 return cmdBuffer;
155}
156
157void VKDevice::FlushCommandBuffer(VkCommandBuffer cmdBuffer, bool release)
158{

Callers 3

CreateTextureMethod · 0.80
WriteTextureMethod · 0.80
ReadTextureMethod · 0.80

Calls 1

VKThrowIfFailedFunction · 0.85

Tested by

no test coverage detected