void VulkanCommands::begin_buffer(VkRenderPass render_pass)
{
- if(!current_pool)
+ if(frame_index>=command_pools.size())
throw invalid_operation("VulkanCommands::begin_buffer");
const VulkanFunctions &vk = device.get_functions();
+ CommandPool *current_pool = &command_pools[frame_index];
if(!current_pool->in_use)
{
current_pool->fence.reset();
{
const VulkanFunctions &vk = device.get_functions();
- unsigned pool_index = index%device.get_n_frames_in_flight();
- if(pool_index>=command_pools.size())
+ frame_index = index%device.get_n_frames_in_flight();
+ if(frame_index>=command_pools.size())
{
- command_pools.reserve(pool_index+1);
- for(unsigned i=command_pools.size(); i<pool_index+1; ++i)
+ command_pools.reserve(frame_index+1);
+ for(unsigned i=command_pools.size(); i<frame_index+1; ++i)
command_pools.emplace_back(device);
}
- current_pool = &command_pools[pool_index];
+ CommandPool *current_pool = &command_pools[frame_index];
if(current_pool->in_use)
{
current_pool->fence.wait();
submit_info.signalSemaphoreCount = (signal_sem ? 1 : 0);
submit_info.pSignalSemaphores = &vk_signal_sem;
- vk.QueueSubmit(1, &submit_info, current_pool->fence.handle);
+ vk.QueueSubmit(1, &submit_info, command_pools[frame_index].fence.handle);
primary_buffer = 0;
}
begin_render_pass(false, 0);
pipeline_state->refresh();
- pipeline_state->apply(pass_buffer, fb_is_swapchain);
+ pipeline_state->apply(pass_buffer, frame_index, fb_is_swapchain);
unsigned first_index = batch.get_offset()/batch.get_index_size();
vk.CmdDrawIndexed(pass_buffer, batch.size(), count, first_index, 0, 0);
}