diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index 845295dac..1504f6a28 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -1390,6 +1390,11 @@ QWidget. )"); virtual void SetHistory(const rdcarray &history) = 0; + DOCUMENT(R"(Indicates that the pixel history was launched as a result of failing to debug a shader, +so a message will be displayed to explain. +)"); + virtual void SetFailedDebug() = 0; + protected: IPixelHistoryView() = default; ~IPixelHistoryView() = default; diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp index c8ab8d73a..4b848813c 100644 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ b/qrenderdoc/Windows/PixelHistoryView.cpp @@ -666,12 +666,13 @@ PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint p channelStr = lit("Alpha"); QString text; - text = tr("Preview colours displayed in visible range %1 - %2 with %3 visible.\n\n") - .arg(Formatter::Format(display.rangeMin)) - .arg(Formatter::Format(display.rangeMax)) - .arg(channelStr); + + text += tr("Preview colours displayed in visible range %1 - %2 with %3 visible.

") + .arg(Formatter::Format(display.rangeMin)) + .arg(Formatter::Format(display.rangeMax)) + .arg(channelStr); text += - tr("Double click to jump to an event.\n" + tr("Double click to jump to an event.
" "Right click to debug an event, or hide failed events."); ui->label->setText(text); @@ -717,6 +718,16 @@ PixelHistoryView::~PixelHistoryView() delete ui; } +void PixelHistoryView::SetFailedDebug() +{ + QString text = ui->label->text(); + text = tr("Pixel shader debug failed - most likely this is caused by no write to the " + "pixel at the current event.
" + "Displaying pixel history to find the event which did write.

") + + text; + ui->label->setText(text); +} + void PixelHistoryView::enableTimelineHighlight() { if(m_Ctx.HasTimelineBar()) diff --git a/qrenderdoc/Windows/PixelHistoryView.h b/qrenderdoc/Windows/PixelHistoryView.h index 45b27487a..7ad0cc8a0 100644 --- a/qrenderdoc/Windows/PixelHistoryView.h +++ b/qrenderdoc/Windows/PixelHistoryView.h @@ -47,6 +47,7 @@ public: // IPixelHistoryView QWidget *Widget() override { return this; } void SetHistory(const rdcarray &history) override; + void SetFailedDebug() override; // ICaptureViewer void OnCaptureLoaded() override; diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index b2e6895be..7f2fb63b1 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -4145,7 +4145,7 @@ void TextureViewer::on_debugPixelContext_clicked() if(!trace) { if(m_Ctx.APIProps().pixelHistory) - on_pixelHistory_clicked(); + ShowPixelHistory(true); else RDDialog::critical(this, tr("Debug Error"), tr("Error debugging pixel.")); return; @@ -4162,6 +4162,11 @@ void TextureViewer::on_debugPixelContext_clicked() } void TextureViewer::on_pixelHistory_clicked() +{ + ShowPixelHistory(false); +} + +void TextureViewer::ShowPixelHistory(bool failedDebug) { TextureDescription *texptr = GetCurrentTexture(); @@ -4181,6 +4186,9 @@ void TextureViewer::on_pixelHistory_clicked() uint32_t view = m_TexDisplay.subresource.slice - m_Following.GetFirstArraySlice(m_Ctx); IPixelHistoryView *hist = m_Ctx.ViewPixelHistory(texptr->resourceId, x, y, view, m_TexDisplay); + if(failedDebug) + hist->SetFailedDebug(); + m_Ctx.AddDockWindow(hist->Widget(), DockReference::TransientPopupArea, this, 0.3f); // we use this pointer to ensure that the history viewer is still visible (and hasn't been closed) diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h index 2e4882c04..1aaf772f1 100644 --- a/qrenderdoc/Windows/TextureViewer.h +++ b/qrenderdoc/Windows/TextureViewer.h @@ -256,6 +256,8 @@ private: void SelectPreview(ResourcePreview *prev); + void ShowPixelHistory(bool failedDebug); + void SetupTextureTabs(); void RemoveTextureTabs(int firstIndex);