| 438 | } |
| 439 | |
| 440 | void ReplayManager::run(int proxyRenderer, const QString &capturefile, const ReplayOptions &opts, |
| 441 | RENDERDOC_ProgressCallback progress) |
| 442 | { |
| 443 | m_Renderer = NULL; |
| 444 | |
| 445 | if(m_Remote) |
| 446 | { |
| 447 | rdctie(m_CreateResult, m_Renderer) = |
| 448 | m_Remote->OpenCapture(proxyRenderer, capturefile, opts, progress); |
| 449 | } |
| 450 | else |
| 451 | { |
| 452 | m_CaptureFile = RENDERDOC_OpenCaptureFile(); |
| 453 | |
| 454 | m_CreateResult = m_CaptureFile->OpenFile(capturefile, "rdc", NULL); |
| 455 | |
| 456 | if(m_CreateResult.OK()) |
| 457 | rdctie(m_CreateResult, m_Renderer) = m_CaptureFile->OpenCapture(opts, progress); |
| 458 | } |
| 459 | |
| 460 | if(m_Renderer == NULL) |
| 461 | { |
| 462 | if(m_CaptureFile) |
| 463 | m_CaptureFile->Shutdown(); |
| 464 | m_CaptureFile = NULL; |
| 465 | |
| 466 | return; |
| 467 | } |
| 468 | |
| 469 | qInfo() << "QRenderDoc - renderer created for" << capturefile; |
| 470 | |
| 471 | m_Running = true; |
| 472 | |
| 473 | // main render command loop |
| 474 | while(m_Running) |
| 475 | { |
| 476 | InvokeHandle *cmd = NULL; |
| 477 | |
| 478 | // wait for the condition to be woken, grab top of current queue, |
| 479 | // unlock again. |
| 480 | { |
| 481 | QMutexLocker autolock(&m_RenderLock); |
| 482 | if(m_RenderQueue.isEmpty()) |
| 483 | m_RenderCondition.wait(&m_RenderLock, 10); |
| 484 | |
| 485 | if(!m_RenderQueue.isEmpty()) |
| 486 | cmd = m_RenderQueue.dequeue(); |
| 487 | } |
| 488 | |
| 489 | if(cmd == NULL) |
| 490 | continue; |
| 491 | |
| 492 | if(cmd->method != NULL) |
| 493 | { |
| 494 | { |
| 495 | QMutexLocker lock(&m_TimerLock); |
| 496 | m_CommandTimer.start(); |
| 497 | m_CommandTag = cmd->tag; |
no test coverage detected