MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / commitAndNextCommandBuffer

Method commitAndNextCommandBuffer

RenderSystems/Vulkan/src/OgreVulkanQueue.cpp:1186–1300  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1184 }
1185 //-------------------------------------------------------------------------
1186 void VulkanQueue::commitAndNextCommandBuffer( SubmissionType::SubmissionType submissionType )
1187 {
1188 endCommandBuffer();
1189
1190 mRenderSystem->flushPendingNonCoherentFlushes( submissionType );
1191
1192 // We must reset all bindings or else after 3 (mDynamicBufferCurrentFrame) frames
1193 // there could be dangling API handles left hanging around indefinitely that
1194 // may be collected by RootLayouts that use more slots than they need
1195 if( submissionType >= SubmissionType::NewFrameIdx )
1196 mRenderSystem->resetAllBindings();
1197
1198 if( mPendingCmds.empty() )
1199 return;
1200
1201 VkSubmitInfo submitInfo;
1202 makeVkStruct( submitInfo, VK_STRUCTURE_TYPE_SUBMIT_INFO );
1203
1204 if( !mGpuWaitSemaphForCurrCmdBuff.empty() )
1205 {
1206 // We need to wait on these semaphores so that rendering can
1207 // only happen start the swapchain is done presenting
1208 submitInfo.waitSemaphoreCount = static_cast<uint32>( mGpuWaitSemaphForCurrCmdBuff.size() );
1209 submitInfo.pWaitSemaphores = mGpuWaitSemaphForCurrCmdBuff.begin();
1210 submitInfo.pWaitDstStageMask = mGpuWaitFlags.begin();
1211 }
1212
1213 const size_t windowsSemaphStart = mGpuSignalSemaphForCurrCmdBuff.size();
1214 size_t numWindowsPendingSwap = 0u;
1215
1216 if( submissionType >= SubmissionType::NewFrameIdx )
1217 {
1218 if( submissionType >= SubmissionType::EndFrameAndSwap )
1219 {
1220 // Get some semaphores so that presentation can wait for this job to finish rendering
1221 // (one for each window that will be swapped)
1222 numWindowsPendingSwap = mWindowsPendingSwap.size();
1223 mVaoManager->getAvailableSemaphores( mGpuSignalSemaphForCurrCmdBuff,
1224 numWindowsPendingSwap );
1225 }
1226
1227 if( !mGpuSignalSemaphForCurrCmdBuff.empty() )
1228 {
1229 // We need to signal these semaphores so that presentation
1230 // can only happen after we're done rendering (presentation may not be the
1231 // only thing waiting for us though; thus we must set this with NewFrameIdx
1232 // and not just with EndFrameAndSwap)
1233 submitInfo.signalSemaphoreCount =
1234 static_cast<uint32>( mGpuSignalSemaphForCurrCmdBuff.size() );
1235 submitInfo.pSignalSemaphores = mGpuSignalSemaphForCurrCmdBuff.begin();
1236 }
1237 }
1238
1239 if( submissionType >= SubmissionType::NewFrameIdx )
1240 {
1241 // Ensure mCurrentFence is not nullptr.
1242 // We *must* have a fence if we're advancing the frameIdx
1243 getCurrentFence();

Callers 11

downloadFromGpuMethod · 0.45
queryIsTransferDoneMethod · 0.45
_endFrameOnceMethod · 0.45
flushCommandsMethod · 0.45
addFenceMethod · 0.45
VulkanAsyncTicketMethod · 0.45
_updateMethod · 0.45
waitForMethod · 0.45

Calls 15

makeVkStructFunction · 0.85
RefCountedFenceClass · 0.85
resetAllBindingsMethod · 0.80
_swapBuffersMethod · 0.80
acquireNextSwapchainMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected