void operator()(const command_buffer &command_buffer, command_recorder &) && override final { vkCmdDrawIndexedIndirect(command_buffer, buffer, static_cast<std::size_t>(offset), draw_count, static_cast<std::uint32_t>(stride)); }
void VkeDrawCall::initDrawCommands(const uint32_t inCount, const uint32_t inCommandIndex){ VkPipelineLayout layout = m_renderer->getPipelineLayout(); VkPipeline pipeline = m_renderer->getPipeline(); VkDescriptorSet sceneDescriptor = m_renderer->getSceneDescriptorSet(); VkDescriptorSet *textureDescriptors = m_renderer->getTextureDescriptorSets(); VkBuffer sceneIndirectBuffer = m_renderer->getSceneIndirectBuffer(); VulkanDC *dc = VulkanDC::Get(); VulkanDC::Device *device = dc->getDefaultDevice(); VulkanDC::Device::Queue *queue = dc->getDefaultQueue(); VulkanAppContext *ctxt = VulkanAppContext::GetInstance(); vkResetCommandBuffer(m_draw_command[inCommandIndex], 0); VkCommandBufferBeginInfo cmdBeginInfo = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; cmdBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; VKA_CHECK_ERROR(vkBeginCommandBuffer(m_draw_command[inCommandIndex], &cmdBeginInfo), "Could not begin command buffer.\n"); vkCmdBindPipeline(m_draw_command[inCommandIndex], VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); VkeVBO *theVBO = ctxt->getVBO(); VkeIBO *theIBO = ctxt->getIBO(); theVBO->bind(&m_draw_command[inCommandIndex]); theIBO->bind(&m_draw_command[inCommandIndex]); VkDescriptorSet sets[3] = { sceneDescriptor, textureDescriptors[0], m_transform_descriptor_set }; vkCmdBindDescriptorSets(m_draw_command[inCommandIndex], VK_PIPELINE_BIND_POINT_GRAPHICS, layout, 0, 3, sets, 0, NULL); vkCmdDrawIndexedIndirect(m_draw_command[inCommandIndex], sceneIndirectBuffer, 0, inCount, sizeof(VkDrawIndexedIndirectCommand)); vkCmdDraw(m_draw_command[inCommandIndex], 1, 1, 0, 0); vkEndCommandBuffer(m_draw_command[inCommandIndex]); /* Lock mutex to update generated call count. */ //std::lock_guard<std::mutex> lk(m_renderer->getSecondaryCmdBufferMutex()); /* Increment the generated call count */ m_renderer->incrementDrawCallsGenerated(); }