| 772 | } |
| 773 | |
| 774 | void PixelHistoryView::startDebug(EventTag tag) |
| 775 | { |
| 776 | m_Ctx.SetEventID({this}, tag.eventId, tag.eventId); |
| 777 | |
| 778 | const ShaderReflection *shaderDetails = |
| 779 | m_Ctx.CurPipelineState().GetShaderReflection(ShaderStage::Pixel); |
| 780 | |
| 781 | if(!m_Ctx.APIProps().shaderDebugging) |
| 782 | { |
| 783 | RDDialog::critical(this, tr("Can't debug pixel"), |
| 784 | tr("This API does not support shader debugging")); |
| 785 | return; |
| 786 | } |
| 787 | else if(!shaderDetails) |
| 788 | { |
| 789 | RDDialog::critical(this, tr("Can't debug pixel"), |
| 790 | tr("No pixel shader bound at event %1").arg(tag.eventId)); |
| 791 | return; |
| 792 | } |
| 793 | else if(!shaderDetails->debugInfo.debuggable) |
| 794 | { |
| 795 | RDDialog::critical( |
| 796 | this, tr("Can't debug pixel"), |
| 797 | tr("This shader doesn't support debugging: %1").arg(shaderDetails->debugInfo.debugStatus)); |
| 798 | return; |
| 799 | } |
| 800 | |
| 801 | bool done = false; |
| 802 | ShaderDebugTrace *trace = NULL; |
| 803 | |
| 804 | m_Ctx.Replay().AsyncInvoke([this, &trace, &done, tag](IReplayController *r) { |
| 805 | DebugPixelInputs inputs; |
| 806 | inputs.sample = m_Display.subresource.sample; |
| 807 | inputs.primitive = tag.primitive; |
| 808 | inputs.view = m_View; |
| 809 | trace = r->DebugPixel((uint32_t)m_Pixel.x(), (uint32_t)m_Pixel.y(), inputs); |
| 810 | |
| 811 | if(trace->debugger == NULL) |
| 812 | { |
| 813 | r->FreeTrace(trace); |
| 814 | trace = NULL; |
| 815 | } |
| 816 | |
| 817 | done = true; |
| 818 | }); |
| 819 | |
| 820 | QString debugContext = |
| 821 | QFormatStr("Pixel %1,%2 @ %3").arg(m_Pixel.x()).arg(m_Pixel.y()).arg(tag.eventId); |
| 822 | |
| 823 | // wait a short while before displaying the progress dialog (which won't show if we're already |
| 824 | // done by the time we reach it) |
| 825 | for(int i = 0; !done && i < 100; i++) |
| 826 | QThread::msleep(5); |
| 827 | |
| 828 | ShowProgressDialog(this, tr("Debugging %1").arg(debugContext), [&done]() { return done; }); |
| 829 | |
| 830 | if(!trace) |
| 831 | { |
nothing calls this directly
no test coverage detected