| 308 | } |
| 309 | |
| 310 | void drawFrame() |
| 311 | { |
| 312 | static chrono_tp startTime = std::chrono::high_resolution_clock::now(); |
| 313 | |
| 314 | chrono_tp currentTime = std::chrono::high_resolution_clock::now(); |
| 315 | float time = std::chrono::duration<float, std::chrono::seconds::period>(currentTime - startTime).count(); |
| 316 | |
| 317 | if (m_currentFrame == 0) { |
| 318 | m_lastTime = startTime; |
| 319 | } |
| 320 | |
| 321 | cudaExternalSemaphoreWaitParams waitParams = {}; |
| 322 | waitParams.flags = 0; |
| 323 | waitParams.params.fence.value = 0; |
| 324 | |
| 325 | cudaExternalSemaphoreSignalParams signalParams = {}; |
| 326 | signalParams.flags = 0; |
| 327 | signalParams.params.fence.value = 0; |
| 328 | |
| 329 | // Have vulkan draw the current frame... |
| 330 | VulkanBaseApp::drawFrame(); |
| 331 | // Wait for vulkan to complete it's work |
| 332 | checkCudaErrors(cudaWaitExternalSemaphoresAsync(&m_cudaWaitSemaphore, &waitParams, 1, m_stream)); |
| 333 | // Now step the simulation |
| 334 | m_sim.stepSimulation(time, m_stream); |
| 335 | |
| 336 | // Signal vulkan to continue with the updated buffers |
| 337 | checkCudaErrors(cudaSignalExternalSemaphoresAsync(&m_cudaSignalSemaphore, &signalParams, 1, m_stream)); |
| 338 | } |
| 339 | }; |
| 340 | |
| 341 | int main(int argc, char **argv) |
nothing calls this directly
no test coverage detected