mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-10-25 00:03:42 +00:00
Access CaptureContext & RenderManager by reference, not pointer
* Neither of these can or should be NULL so enforce it explicitly.
This commit is contained in:
1 parent
0d141b6d7e
commit
2285b209c3
44 files changed
+762
-779
No files matched your search
@@ -85,35 +85,35 @@ bool Following::operator==(const Following &o)
|
||||
return Type == o.Type && Stage == o.Stage && index == o.index;
|
||||
}
|
||||
|
||||
void Following::GetDrawContext(CaptureContext *ctx, bool ©, bool &compute)
|
||||
void Following::GetDrawContext(CaptureContext &ctx, bool ©, bool &compute)
|
||||
{
|
||||
const FetchDrawcall *curDraw = ctx->CurDrawcall();
|
||||
const FetchDrawcall *curDraw = ctx.CurDrawcall();
|
||||
copy = curDraw != NULL && (curDraw->flags & (eDraw_Copy | eDraw_Resolve));
|
||||
compute = curDraw != NULL && (curDraw->flags & eDraw_Dispatch) &&
|
||||
ctx->CurPipelineState.GetShader(eShaderStage_Compute) != ResourceId();
|
||||
ctx.CurPipelineState.GetShader(eShaderStage_Compute) != ResourceId();
|
||||
}
|
||||
|
||||
int Following::GetHighestMip(CaptureContext *ctx)
|
||||
int Following::GetHighestMip(CaptureContext &ctx)
|
||||
{
|
||||
return GetBoundResource(ctx, arrayEl).HighestMip;
|
||||
}
|
||||
|
||||
int Following::GetFirstArraySlice(CaptureContext *ctx)
|
||||
int Following::GetFirstArraySlice(CaptureContext &ctx)
|
||||
{
|
||||
return GetBoundResource(ctx, arrayEl).FirstSlice;
|
||||
}
|
||||
|
||||
FormatComponentType Following::GetTypeHint(CaptureContext *ctx)
|
||||
FormatComponentType Following::GetTypeHint(CaptureContext &ctx)
|
||||
{
|
||||
return GetBoundResource(ctx, arrayEl).typeHint;
|
||||
}
|
||||
|
||||
ResourceId Following::GetResourceId(CaptureContext *ctx)
|
||||
ResourceId Following::GetResourceId(CaptureContext &ctx)
|
||||
{
|
||||
return GetBoundResource(ctx, arrayEl).Id;
|
||||
}
|
||||
|
||||
BoundResource Following::GetBoundResource(CaptureContext *ctx, int arrayIdx)
|
||||
BoundResource Following::GetBoundResource(CaptureContext &ctx, int arrayIdx)
|
||||
{
|
||||
BoundResource ret;
|
||||
|
||||
@@ -160,9 +160,9 @@ BoundResource Following::GetBoundResource(CaptureContext *ctx, int arrayIdx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVector<BoundResource> Following::GetOutputTargets(CaptureContext *ctx)
|
||||
QVector<BoundResource> Following::GetOutputTargets(CaptureContext &ctx)
|
||||
{
|
||||
const FetchDrawcall *curDraw = ctx->CurDrawcall();
|
||||
const FetchDrawcall *curDraw = ctx.CurDrawcall();
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
|
||||
@@ -176,14 +176,14 @@ QVector<BoundResource> Following::GetOutputTargets(CaptureContext *ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
QVector<BoundResource> ret = ctx->CurPipelineState.GetOutputTargets();
|
||||
QVector<BoundResource> ret = ctx.CurPipelineState.GetOutputTargets();
|
||||
|
||||
if(ret.isEmpty() && curDraw != NULL && (curDraw->flags & eDraw_Present))
|
||||
{
|
||||
if(curDraw->copyDestination != ResourceId())
|
||||
return {BoundResource(curDraw->copyDestination)};
|
||||
|
||||
for(const FetchTexture &tex : ctx->GetTextures())
|
||||
for(const FetchTexture &tex : ctx.GetTextures())
|
||||
{
|
||||
if(tex.creationFlags & eTextureCreate_SwapBuffer)
|
||||
return {BoundResource(tex.ID)};
|
||||
@@ -194,7 +194,7 @@ QVector<BoundResource> Following::GetOutputTargets(CaptureContext *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
BoundResource Following::GetDepthTarget(CaptureContext *ctx)
|
||||
BoundResource Following::GetDepthTarget(CaptureContext &ctx)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
@@ -202,10 +202,10 @@ BoundResource Following::GetDepthTarget(CaptureContext *ctx)
|
||||
if(copy || compute)
|
||||
return BoundResource(ResourceId());
|
||||
else
|
||||
return ctx->CurPipelineState.GetDepthTarget();
|
||||
return ctx.CurPipelineState.GetDepthTarget();
|
||||
}
|
||||
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadWriteResources(CaptureContext *ctx,
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadWriteResources(CaptureContext &ctx,
|
||||
ShaderStageType stage)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
@@ -219,25 +219,25 @@ QMap<BindpointMap, QVector<BoundResource>> Following::GetReadWriteResources(Capt
|
||||
{
|
||||
// only return compute resources for one stage
|
||||
if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute)
|
||||
return ctx->CurPipelineState.GetReadWriteResources(eShaderStage_Compute);
|
||||
return ctx.CurPipelineState.GetReadWriteResources(eShaderStage_Compute);
|
||||
else
|
||||
return QMap<BindpointMap, QVector<BoundResource>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return ctx->CurPipelineState.GetReadWriteResources(stage);
|
||||
return ctx.CurPipelineState.GetReadWriteResources(stage);
|
||||
}
|
||||
}
|
||||
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadWriteResources(CaptureContext *ctx)
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadWriteResources(CaptureContext &ctx)
|
||||
{
|
||||
return GetReadWriteResources(ctx, Stage);
|
||||
}
|
||||
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(CaptureContext *ctx,
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(CaptureContext &ctx,
|
||||
ShaderStageType stage)
|
||||
{
|
||||
const FetchDrawcall *curDraw = ctx->CurDrawcall();
|
||||
const FetchDrawcall *curDraw = ctx.CurDrawcall();
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
|
||||
@@ -255,22 +255,22 @@ QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(Captu
|
||||
{
|
||||
// only return compute resources for one stage
|
||||
if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute)
|
||||
return ctx->CurPipelineState.GetReadOnlyResources(eShaderStage_Compute);
|
||||
return ctx.CurPipelineState.GetReadOnlyResources(eShaderStage_Compute);
|
||||
else
|
||||
return QMap<BindpointMap, QVector<BoundResource>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return ctx->CurPipelineState.GetReadOnlyResources(stage);
|
||||
return ctx.CurPipelineState.GetReadOnlyResources(stage);
|
||||
}
|
||||
}
|
||||
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(CaptureContext *ctx)
|
||||
QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(CaptureContext &ctx)
|
||||
{
|
||||
return GetReadOnlyResources(ctx, Stage);
|
||||
}
|
||||
|
||||
ShaderReflection *Following::GetReflection(CaptureContext *ctx, ShaderStageType stage)
|
||||
ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType stage)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
@@ -278,17 +278,17 @@ ShaderReflection *Following::GetReflection(CaptureContext *ctx, ShaderStageType
|
||||
if(copy)
|
||||
return NULL;
|
||||
else if(compute)
|
||||
return ctx->CurPipelineState.GetShaderReflection(eShaderStage_Compute);
|
||||
return ctx.CurPipelineState.GetShaderReflection(eShaderStage_Compute);
|
||||
else
|
||||
return ctx->CurPipelineState.GetShaderReflection(stage);
|
||||
return ctx.CurPipelineState.GetShaderReflection(stage);
|
||||
}
|
||||
|
||||
ShaderReflection *Following::GetReflection(CaptureContext *ctx)
|
||||
ShaderReflection *Following::GetReflection(CaptureContext &ctx)
|
||||
{
|
||||
return GetReflection(ctx, Stage);
|
||||
}
|
||||
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx, ShaderStageType stage)
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx, ShaderStageType stage)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
@@ -305,15 +305,15 @@ ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx, ShaderStageTyp
|
||||
}
|
||||
else if(compute)
|
||||
{
|
||||
return ctx->CurPipelineState.GetBindpointMapping(eShaderStage_Compute);
|
||||
return ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Compute);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ctx->CurPipelineState.GetBindpointMapping(stage);
|
||||
return ctx.CurPipelineState.GetBindpointMapping(stage);
|
||||
}
|
||||
}
|
||||
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx)
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx)
|
||||
{
|
||||
return GetMapping(ctx, Stage);
|
||||
}
|
||||
@@ -329,9 +329,9 @@ public:
|
||||
};
|
||||
|
||||
TextureListItemModel(QObject *parent) : QAbstractItemModel(parent) {}
|
||||
void reset(FilterType type, const QString &filter, CaptureContext *ctx)
|
||||
void reset(FilterType type, const QString &filter, CaptureContext &ctx)
|
||||
{
|
||||
const rdctype::array<FetchTexture> src = ctx->GetTextures();
|
||||
const rdctype::array<FetchTexture> src = ctx.GetTextures();
|
||||
|
||||
texs.clear();
|
||||
texs.reserve(src.count);
|
||||
@@ -457,7 +457,7 @@ FetchTexture *TextureViewer::GetCurrentTexture()
|
||||
|
||||
void TextureViewer::UI_UpdateCachedTexture()
|
||||
{
|
||||
if(!m_Ctx->LogLoaded())
|
||||
if(!m_Ctx.LogLoaded())
|
||||
{
|
||||
m_CachedTexture = NULL;
|
||||
return;
|
||||
@@ -470,15 +470,15 @@ void TextureViewer::UI_UpdateCachedTexture()
|
||||
if(id == ResourceId())
|
||||
id = m_TexDisplay.texid;
|
||||
|
||||
m_CachedTexture = m_Ctx->GetTexture(id);
|
||||
m_CachedTexture = m_Ctx.GetTexture(id);
|
||||
}
|
||||
|
||||
TextureViewer::TextureViewer(CaptureContext *ctx, QWidget *parent)
|
||||
TextureViewer::TextureViewer(CaptureContext &ctx, QWidget *parent)
|
||||
: QFrame(parent), ui(new Ui::TextureViewer), m_Ctx(ctx)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_Ctx->AddLogViewer(this);
|
||||
m_Ctx.AddLogViewer(this);
|
||||
|
||||
Reset();
|
||||
|
||||
@@ -634,8 +634,8 @@ TextureViewer::TextureViewer(CaptureContext *ctx, QWidget *parent)
|
||||
|
||||
TextureViewer::~TextureViewer()
|
||||
{
|
||||
m_Ctx->windowClosed(this);
|
||||
m_Ctx->RemoveLogViewer(this);
|
||||
m_Ctx.windowClosed(this);
|
||||
m_Ctx.RemoveLogViewer(this);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -793,7 +793,7 @@ void TextureViewer::UI_UpdateStatusText()
|
||||
uint32_t mipWidth = qMax(1U, tex.width >> (int)m_TexDisplay.mip);
|
||||
uint32_t mipHeight = qMax(1U, tex.height >> (int)m_TexDisplay.mip);
|
||||
|
||||
if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
y = (int)(mipHeight - 1) - y;
|
||||
if(m_TexDisplay.FlipY)
|
||||
y = (int)(mipHeight - 1) - y;
|
||||
@@ -822,7 +822,7 @@ void TextureViewer::UI_UpdateStatusText()
|
||||
{
|
||||
x = m_PickedPoint.x() >> (int)m_TexDisplay.mip;
|
||||
y = m_PickedPoint.y() >> (int)m_TexDisplay.mip;
|
||||
if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
y = (int)(mipHeight - 1) - y;
|
||||
if(m_TexDisplay.FlipY)
|
||||
y = (int)(mipHeight - 1) - y;
|
||||
@@ -896,7 +896,7 @@ void TextureViewer::UI_UpdateStatusText()
|
||||
|
||||
if(m_Output != NULL)
|
||||
{
|
||||
m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *) { m_Output->DisablePixelContext(); });
|
||||
m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *) { m_Output->DisablePixelContext(); });
|
||||
}
|
||||
|
||||
// PixelPicked = false;
|
||||
@@ -933,8 +933,8 @@ void TextureViewer::UI_UpdateTextureDetails()
|
||||
ResourceId followID = m_Following.GetResourceId(m_Ctx);
|
||||
|
||||
{
|
||||
FetchTexture *followtex = m_Ctx->GetTexture(followID);
|
||||
FetchBuffer *followbuf = m_Ctx->GetBuffer(followID);
|
||||
FetchTexture *followtex = m_Ctx.GetTexture(followID);
|
||||
FetchBuffer *followbuf = m_Ctx.GetBuffer(followID);
|
||||
|
||||
QString title;
|
||||
|
||||
@@ -1027,7 +1027,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
bool newtex = (m_TexDisplay.texid != tex.ID);
|
||||
|
||||
// save settings for this current texture
|
||||
if(m_Ctx->Config.TextureViewer_PerTexSettings)
|
||||
if(m_Ctx.Config.TextureViewer_PerTexSettings)
|
||||
{
|
||||
m_TextureSettings[m_TexDisplay.texid].r = ui->channelRed->isChecked();
|
||||
m_TextureSettings[m_TexDisplay.texid].g = ui->channelGreen->isChecked();
|
||||
@@ -1220,7 +1220,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
// even if we don't switch to a new texture.
|
||||
// Note that if the slice or mip was changed because that slice or mip is the selected one
|
||||
// at the API level, we leave this alone.
|
||||
if(m_Ctx->Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID))
|
||||
if(m_Ctx.Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID))
|
||||
{
|
||||
if(usemipsettings)
|
||||
ui->mipLevel->setCurrentIndex(m_TextureSettings[tex.ID].mip);
|
||||
@@ -1233,7 +1233,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
if(newtex)
|
||||
{
|
||||
// if we save certain settings per-texture, restore them (if we have any)
|
||||
if(m_Ctx->Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID))
|
||||
if(m_Ctx.Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID))
|
||||
{
|
||||
ui->channels->setCurrentIndex(m_TextureSettings[tex.ID].displayType);
|
||||
|
||||
@@ -1252,7 +1252,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
m_TextureSettings[m_TexDisplay.texid].maxrange);
|
||||
m_NoRangePaint = false;
|
||||
}
|
||||
else if(m_Ctx->Config.TextureViewer_PerTexSettings)
|
||||
else if(m_Ctx.Config.TextureViewer_PerTexSettings)
|
||||
{
|
||||
// if we are using per-tex settings, reset back to RGB
|
||||
ui->channels->setCurrentIndex(0);
|
||||
@@ -1273,7 +1273,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
}
|
||||
|
||||
// reset the range if desired
|
||||
if(m_Ctx->Config.TextureViewer_ResetRange)
|
||||
if(m_Ctx.Config.TextureViewer_ResetRange)
|
||||
{
|
||||
UI_SetHistogramRange(texptr, m_TexDisplay.typeHint);
|
||||
}
|
||||
@@ -1286,7 +1286,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
|
||||
if(ui->autoFit->isChecked())
|
||||
AutoFitRange();
|
||||
|
||||
m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) {
|
||||
m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) {
|
||||
RT_UpdateVisualRange(r);
|
||||
|
||||
RT_UpdateAndDisplay(r);
|
||||
@@ -1383,7 +1383,7 @@ void TextureViewer::UI_UpdateChannels()
|
||||
}
|
||||
m_TexDisplay.CustomShader = ResourceId();
|
||||
}
|
||||
else if(ui->channels->currentIndex() == 0 || !m_Ctx->LogLoaded())
|
||||
else if(ui->channels->currentIndex() == 0 || !m_Ctx.LogLoaded())
|
||||
{
|
||||
// RGBA
|
||||
SHOW(ui->channelRed);
|
||||
@@ -1618,7 +1618,7 @@ void TextureViewer::UI_CreateThumbnails()
|
||||
|
||||
void TextureViewer::GotoLocation(int x, int y)
|
||||
{
|
||||
if(!m_Ctx->LogLoaded())
|
||||
if(!m_Ctx.LogLoaded())
|
||||
return;
|
||||
|
||||
FetchTexture *tex = GetCurrentTexture();
|
||||
@@ -1629,7 +1629,7 @@ void TextureViewer::GotoLocation(int x, int y)
|
||||
m_PickedPoint = QPoint(x, y);
|
||||
|
||||
uint32_t mipHeight = qMax(1U, tex->height >> (int)m_TexDisplay.mip);
|
||||
if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.y());
|
||||
if(m_TexDisplay.FlipY)
|
||||
m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.x());
|
||||
@@ -1666,7 +1666,7 @@ void TextureViewer::ViewTexture(ResourceId ID, bool focus)
|
||||
return;
|
||||
}
|
||||
|
||||
FetchTexture *tex = m_Ctx->GetTexture(ID);
|
||||
FetchTexture *tex = m_Ctx.GetTexture(ID);
|
||||
if(tex)
|
||||
{
|
||||
QWidget *lockedContainer = new QWidget(this);
|
||||
@@ -1703,14 +1703,14 @@ void TextureViewer::ViewTexture(ResourceId ID, bool focus)
|
||||
return;
|
||||
}
|
||||
|
||||
FetchBuffer *buf = m_Ctx->GetBuffer(ID);
|
||||
FetchBuffer *buf = m_Ctx.GetBuffer(ID);
|
||||
if(buf)
|
||||
{
|
||||
BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow());
|
||||
BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow());
|
||||
|
||||
viewer->ViewTexture(0, 0, ID);
|
||||
|
||||
m_Ctx->setupDockWindow(viewer);
|
||||
m_Ctx.setupDockWindow(viewer);
|
||||
|
||||
ToolWindowManager *manager = ToolWindowManager::managerOf(this);
|
||||
|
||||
@@ -1726,7 +1726,7 @@ void TextureViewer::texContextItem_triggered()
|
||||
QVariant eid = act->property("eid");
|
||||
if(eid.isValid())
|
||||
{
|
||||
m_Ctx->SetEventID({}, eid.toUInt(), eid.toUInt());
|
||||
m_Ctx.SetEventID({}, eid.toUInt(), eid.toUInt());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1742,16 +1742,16 @@ void TextureViewer::showDisabled_triggered()
|
||||
{
|
||||
m_ShowDisabled = !m_ShowDisabled;
|
||||
|
||||
if(m_Ctx->LogLoaded())
|
||||
m_Ctx->RefreshStatus();
|
||||
if(m_Ctx.LogLoaded())
|
||||
m_Ctx.RefreshStatus();
|
||||
}
|
||||
|
||||
void TextureViewer::showEmpty_triggered()
|
||||
{
|
||||
m_ShowEmpty = !m_ShowEmpty;
|
||||
|
||||
if(m_Ctx->LogLoaded())
|
||||
m_Ctx->RefreshStatus();
|
||||
if(m_Ctx.LogLoaded())
|
||||
m_Ctx.RefreshStatus();
|
||||
}
|
||||
|
||||
void TextureViewer::AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t end,
|
||||
@@ -1761,10 +1761,10 @@ void TextureViewer::AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t
|
||||
|
||||
if(start == end)
|
||||
item = new QAction(
|
||||
"EID " + QString::number(start) + ": " + ToQStr(usage, m_Ctx->APIProps().pipelineType), this);
|
||||
"EID " + QString::number(start) + ": " + ToQStr(usage, m_Ctx.APIProps().pipelineType), this);
|
||||
else
|
||||
item = new QAction("EID " + QString::number(start) + "-" + QString::number(end) + ": " +
|
||||
ToQStr(usage, m_Ctx->APIProps().pipelineType),
|
||||
ToQStr(usage, m_Ctx.APIProps().pipelineType),
|
||||
this);
|
||||
|
||||
QObject::connect(item, &QAction::triggered, this, &TextureViewer::texContextItem_triggered);
|
||||
@@ -1796,10 +1796,10 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array<
|
||||
QObject::connect(&showDisabled, &QAction::triggered, this, &TextureViewer::showDisabled_triggered);
|
||||
QObject::connect(&showEmpty, &QAction::triggered, this, &TextureViewer::showEmpty_triggered);
|
||||
|
||||
if(m_Ctx->CurPipelineState.SupportsBarriers())
|
||||
if(m_Ctx.CurPipelineState.SupportsBarriers())
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
imageLayout.setText(tr("Image is in layout ") + m_Ctx->CurPipelineState.GetImageLayout(id));
|
||||
imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState.GetImageLayout(id));
|
||||
contextMenu.addAction(&imageLayout);
|
||||
}
|
||||
|
||||
@@ -1828,7 +1828,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array<
|
||||
continue;
|
||||
}
|
||||
|
||||
const FetchDrawcall *curDraw = m_Ctx->GetDrawcall(u.eventID);
|
||||
const FetchDrawcall *curDraw = m_Ctx.GetDrawcall(u.eventID);
|
||||
|
||||
bool distinct = false;
|
||||
|
||||
@@ -1844,13 +1844,13 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array<
|
||||
// last event was where we were - otherwise it's a new
|
||||
// distinct set of drawcalls and should have a separate
|
||||
// entry in the context menu
|
||||
const FetchDrawcall *prev = m_Ctx->GetDrawcall(curDraw->previous);
|
||||
const FetchDrawcall *prev = m_Ctx.GetDrawcall(curDraw->previous);
|
||||
|
||||
while(prev != NULL && prev->eventID > end)
|
||||
{
|
||||
if((prev->flags & (eDraw_Dispatch | eDraw_Drawcall | eDraw_CmdList)) == 0)
|
||||
{
|
||||
prev = m_Ctx->GetDrawcall(prev->previous);
|
||||
prev = m_Ctx.GetDrawcall(prev->previous);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1890,8 +1890,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id,
|
||||
{
|
||||
if(id != ResourceId() || force)
|
||||
{
|
||||
FetchTexture *texptr = m_Ctx->GetTexture(id);
|
||||
FetchBuffer *bufptr = m_Ctx->GetBuffer(id);
|
||||
FetchTexture *texptr = m_Ctx.GetTexture(id);
|
||||
FetchBuffer *bufptr = m_Ctx.GetBuffer(id);
|
||||
|
||||
if(texptr != NULL)
|
||||
{
|
||||
@@ -1907,8 +1907,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id,
|
||||
|
||||
prev->setResourceName(fullname);
|
||||
WId handle = prev->thumbWinId();
|
||||
m_Ctx->Renderer()->AsyncInvoke([this, handle, id, typeHint](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), id, typeHint);
|
||||
m_Ctx.Renderer().AsyncInvoke([this, handle, id, typeHint](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), id, typeHint);
|
||||
});
|
||||
}
|
||||
else if(bufptr != NULL)
|
||||
@@ -1925,18 +1925,18 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id,
|
||||
|
||||
prev->setResourceName(fullname);
|
||||
WId handle = prev->thumbWinId();
|
||||
m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle),
|
||||
ResourceId(), eCompType_None);
|
||||
m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(),
|
||||
eCompType_None);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
prev->setResourceName("");
|
||||
WId handle = prev->thumbWinId();
|
||||
m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle),
|
||||
ResourceId(), eCompType_None);
|
||||
m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(),
|
||||
eCompType_None);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1952,8 +1952,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id,
|
||||
prev->setSelected(true);
|
||||
|
||||
WId handle = prev->thumbWinId();
|
||||
m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), ResourceId(),
|
||||
m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) {
|
||||
m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(),
|
||||
eCompType_None);
|
||||
});
|
||||
}
|
||||
@@ -2025,7 +2025,7 @@ void TextureViewer::InitStageResourcePreviews(ShaderStageType stage,
|
||||
|
||||
Following follow(rw ? FollowType::ReadWrite : FollowType::ReadOnly, stage, idx, arrayIdx);
|
||||
QString slotName =
|
||||
QString("%1 %2%3").arg(m_Ctx->CurPipelineState.Abbrev(stage)).arg(rw ? "RW " : "").arg(idx);
|
||||
QString("%1 %2%3").arg(m_Ctx.CurPipelineState.Abbrev(stage)).arg(rw ? "RW " : "").arg(idx);
|
||||
|
||||
if(arrayLen > 1)
|
||||
slotName += QString("[%1]").arg(arrayIdx);
|
||||
@@ -2129,7 +2129,7 @@ void TextureViewer::thumb_clicked(QMouseEvent *e)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Ctx->Renderer()->AsyncInvoke([this, id](IReplayRenderer *r) {
|
||||
m_Ctx.Renderer().AsyncInvoke([this, id](IReplayRenderer *r) {
|
||||
rdctype::array<EventUsage> usage;
|
||||
|
||||
r->GetUsage(id, &usage);
|
||||
@@ -2245,7 +2245,7 @@ void TextureViewer::render_keyPress(QKeyEvent *e)
|
||||
clipboard->setText(ui->texStatusDim->text() + " | " + ui->statusText->text());
|
||||
}
|
||||
|
||||
if(!m_Ctx->LogLoaded())
|
||||
if(!m_Ctx.LogLoaded())
|
||||
return;
|
||||
|
||||
if((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_G)
|
||||
@@ -2284,7 +2284,7 @@ void TextureViewer::render_keyPress(QKeyEvent *e)
|
||||
qBound(0, m_PickedPoint.y(), (int)texptr->height - 1));
|
||||
e->accept();
|
||||
|
||||
m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) {
|
||||
m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) {
|
||||
RT_PickPixelsAndUpdate(r);
|
||||
RT_UpdateAndDisplay(r);
|
||||
});
|
||||
@@ -2418,10 +2418,10 @@ void TextureViewer::on_renderVScroll_valueChanged(int position)
|
||||
|
||||
void TextureViewer::UI_RecreatePanels()
|
||||
{
|
||||
CaptureContext *ctx = m_Ctx;
|
||||
CaptureContext *ctx = &m_Ctx;
|
||||
|
||||
// while a log is loaded, pass NULL into the widget
|
||||
if(!ctx->LogLoaded())
|
||||
if(!m_Ctx.LogLoaded())
|
||||
ctx = NULL;
|
||||
|
||||
{
|
||||
@@ -2476,11 +2476,11 @@ void TextureViewer::OnLogfileLoaded()
|
||||
m_TexDisplay.lightBackgroundColour =
|
||||
FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f);
|
||||
|
||||
m_Ctx->Renderer()->BlockInvoke([renderID, contextID, this](IReplayRenderer *r) {
|
||||
m_Output = r->CreateOutput(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(renderID),
|
||||
m_Ctx.Renderer().BlockInvoke([renderID, contextID, this](IReplayRenderer *r) {
|
||||
m_Output = r->CreateOutput(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(renderID),
|
||||
eOutputType_TexDisplay);
|
||||
|
||||
m_Output->SetPixelContext(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(contextID));
|
||||
m_Output->SetPixelContext(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(contextID));
|
||||
|
||||
ui->render->setOutput(m_Output);
|
||||
ui->pixelContext->setOutput(m_Output);
|
||||
@@ -2490,7 +2490,7 @@ void TextureViewer::OnLogfileLoaded()
|
||||
|
||||
RT_UpdateAndDisplay(r);
|
||||
|
||||
GUIInvoke::call([this]() { OnEventChanged(m_Ctx->CurEvent()); });
|
||||
GUIInvoke::call([this]() { OnEventChanged(m_Ctx.CurEvent()); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2589,7 +2589,7 @@ void TextureViewer::OnEventChanged(uint32_t eventID)
|
||||
Following follow(FollowType::OutputColour, eShaderStage_Pixel, rt, 0);
|
||||
QString bindName = copy ? tr("Destination") : "";
|
||||
QString slotName =
|
||||
copy ? tr("DST") : (m_Ctx->CurPipelineState.OutputAbbrev() + QString::number(rt));
|
||||
copy ? tr("DST") : (m_Ctx.CurPipelineState.OutputAbbrev() + QString::number(rt));
|
||||
|
||||
InitResourcePreview(prev, RTs[rt].Id, RTs[rt].typeHint, false, follow, bindName, slotName);
|
||||
}
|
||||
@@ -2953,10 +2953,10 @@ void TextureViewer::on_visualiseRange_clicked()
|
||||
void TextureViewer::AutoFitRange()
|
||||
{
|
||||
// no log loaded or buffer/empty texture currently being viewed - don't autofit
|
||||
if(!m_Ctx->LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL)
|
||||
if(!m_Ctx.LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL)
|
||||
return;
|
||||
|
||||
m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) {
|
||||
m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) {
|
||||
PixelValue min, max;
|
||||
bool success = m_Output->GetMinMax(&min, &max);
|
||||
|
||||
@@ -3168,7 +3168,7 @@ void TextureViewer::ShowGotoPopup()
|
||||
|
||||
uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.mip);
|
||||
|
||||
if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL)
|
||||
p.setY((int)(mipHeight - 1) - p.y());
|
||||
if(m_TexDisplay.FlipY)
|
||||
p.setY((int)(mipHeight - 1) - p.y());
|
||||
@@ -3183,11 +3183,11 @@ void TextureViewer::on_viewTexBuffer_clicked()
|
||||
|
||||
if(texptr)
|
||||
{
|
||||
BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow());
|
||||
BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow());
|
||||
|
||||
viewer->ViewTexture(m_TexDisplay.sliceFace, m_TexDisplay.mip, texptr->ID);
|
||||
|
||||
m_Ctx->setupDockWindow(viewer);
|
||||
m_Ctx.setupDockWindow(viewer);
|
||||
|
||||
ToolWindowManager *manager = ToolWindowManager::managerOf(this);
|
||||
|
||||
@@ -3234,7 +3234,7 @@ void TextureViewer::on_saveTex_clicked()
|
||||
if(m_TexDisplay.CustomShader != ResourceId())
|
||||
{
|
||||
ResourceId id;
|
||||
m_Ctx->Renderer()->BlockInvoke(
|
||||
m_Ctx.Renderer().BlockInvoke(
|
||||
[this, &id](IReplayRenderer *r) { id = m_Output->GetCustomShaderTexID(); });
|
||||
|
||||
if(id != ResourceId())
|
||||
@@ -3251,7 +3251,7 @@ void TextureViewer::on_saveTex_clicked()
|
||||
bool ret = false;
|
||||
QString fn = saveDialog.filename();
|
||||
|
||||
m_Ctx->Renderer()->BlockInvoke([this, &ret, config, fn](IReplayRenderer *r) {
|
||||
m_Ctx.Renderer().BlockInvoke([this, &ret, config, fn](IReplayRenderer *r) {
|
||||
ret = r->SaveTexture(config, fn.toUtf8().data());
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user