mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Display a message when we can't debug a pixel shader and show a history
This commit is contained in:
@@ -1390,6 +1390,11 @@ QWidget.
|
||||
)");
|
||||
virtual void SetHistory(const rdcarray<PixelModification> &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;
|
||||
|
||||
@@ -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.<br><br>")
|
||||
.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.<br>"
|
||||
"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("<b>Pixel shader debug failed</b> - most likely this is caused by no write to the "
|
||||
"pixel at the current event.<br>"
|
||||
"Displaying pixel history to find the event which did write.<br><br>") +
|
||||
text;
|
||||
ui->label->setText(text);
|
||||
}
|
||||
|
||||
void PixelHistoryView::enableTimelineHighlight()
|
||||
{
|
||||
if(m_Ctx.HasTimelineBar())
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
// IPixelHistoryView
|
||||
QWidget *Widget() override { return this; }
|
||||
void SetHistory(const rdcarray<PixelModification> &history) override;
|
||||
void SetFailedDebug() override;
|
||||
|
||||
// ICaptureViewer
|
||||
void OnCaptureLoaded() override;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -256,6 +256,8 @@ private:
|
||||
|
||||
void SelectPreview(ResourcePreview *prev);
|
||||
|
||||
void ShowPixelHistory(bool failedDebug);
|
||||
|
||||
void SetupTextureTabs();
|
||||
void RemoveTextureTabs(int firstIndex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user