Improve the title of shader edit windows

This commit is contained in:
baldurk
2020-04-03 15:19:28 +01:00
parent 590785c470
commit 9ba81634b4
8 changed files with 27 additions and 21 deletions
+3 -3
View File
@@ -2163,14 +2163,14 @@ void CaptureContext::ShowResourceInspector()
m_MainWindow->showResourceInspector();
}
IShaderViewer *CaptureContext::EditShader(bool customShader, ShaderStage stage,
IShaderViewer *CaptureContext::EditShader(ResourceId id, ShaderStage stage,
const rdcstr &entryPoint, const rdcstrpairs &files,
ShaderEncoding shaderEncoding, ShaderCompileFlags flags,
IShaderViewer::SaveCallback saveCallback,
IShaderViewer::CloseCallback closeCallback)
{
return ShaderViewer::EditShader(*this, customShader, stage, entryPoint, files, shaderEncoding,
flags, saveCallback, closeCallback, m_MainWindow->Widget());
return ShaderViewer::EditShader(*this, id, stage, entryPoint, files, shaderEncoding, flags,
saveCallback, closeCallback, m_MainWindow->Widget());
}
IShaderViewer *CaptureContext::DebugShader(const ShaderBindpointMapping *bind,
+1 -1
View File
@@ -234,7 +234,7 @@ public:
void ShowPythonShell() override;
void ShowResourceInspector() override;
IShaderViewer *EditShader(bool customShader, ShaderStage stage, const rdcstr &entryPoint,
IShaderViewer *EditShader(ResourceId id, ShaderStage stage, const rdcstr &entryPoint,
const rdcstrpairs &files, ShaderEncoding shaderEncoding,
ShaderCompileFlags flags, IShaderViewer::SaveCallback saveCallback,
IShaderViewer::CloseCallback closeCallback) override;
+3 -2
View File
@@ -1837,7 +1837,8 @@ place if needed.
DOCUMENT(R"(Show a new :class:`ShaderViewer` window, showing an editable view of a given shader.
:param bool customShader: ``True`` if the shader being edited is a custom display shader.
:param ~renderdoc.ResourceId id: The shader object, if applicable, that's being edited. If this edit
corresponds to no shader object (such as if it's a custom shader) this can be a null ID.
:param ~renderdoc.ShaderStage stage: The shader stage for this shader.
:param str entryPoint: The entry point to be used when compiling the edited shader.
:param list files: The files stored in a ``list`` with 2-tuples of ``str``. The first element being
@@ -1851,7 +1852,7 @@ place if needed.
:return: The new :class:`ShaderViewer` window opened but not shown for editing.
:rtype: ShaderViewer
)");
virtual IShaderViewer *EditShader(bool customShader, ShaderStage stage, const rdcstr &entryPoint,
virtual IShaderViewer *EditShader(ResourceId id, ShaderStage stage, const rdcstr &entryPoint,
const rdcstrpairs &files, ShaderEncoding shaderEncoding,
ShaderCompileFlags flags,
IShaderViewer::SaveCallback saveCallback,
@@ -853,7 +853,7 @@ IShaderViewer *PipelineStateViewer::EditShader(ResourceId id, ShaderStage shader
});
};
IShaderViewer *sv = m_Ctx.EditShader(false, shaderType, entry, files, encoding, compileFlags,
IShaderViewer *sv = m_Ctx.EditShader(id, shaderType, entry, files, encoding, compileFlags,
saveCallback, closeCallback);
m_Ctx.AddDockWindow(sv->Widget(), DockReference::AddTo, this);
+4 -4
View File
@@ -405,15 +405,15 @@ struct CaptureContextInvoker : ICaptureContext
{
InvokeVoidFunction(&ICaptureContext::ShowResourceInspector);
}
virtual IShaderViewer *EditShader(bool customShader, ShaderStage stage, const rdcstr &entryPoint,
virtual IShaderViewer *EditShader(ResourceId id, ShaderStage stage, const rdcstr &entryPoint,
const rdcstrpairs &files, ShaderEncoding shaderEncoding,
ShaderCompileFlags flags,
IShaderViewer::SaveCallback saveCallback,
IShaderViewer::CloseCallback closeCallback) override
{
return InvokeRetFunction<IShaderViewer *>(&ICaptureContext::EditShader, customShader, stage,
entryPoint, files, shaderEncoding, flags,
saveCallback, closeCallback);
return InvokeRetFunction<IShaderViewer *>(&ICaptureContext::EditShader, id, stage, entryPoint,
files, shaderEncoding, flags, saveCallback,
closeCallback);
}
virtual IShaderViewer *DebugShader(const ShaderBindpointMapping *bind,
+11 -6
View File
@@ -183,7 +183,7 @@ ShaderViewer::ShaderViewer(ICaptureContext &ctx, QWidget *parent)
m_Ctx.AddCaptureViewer(this);
}
void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QString &entryPoint,
void ShaderViewer::editShader(ResourceId id, ShaderStage stage, const QString &entryPoint,
const rdcstrpairs &files, ShaderEncoding shaderEncoding,
ShaderCompileFlags flags)
{
@@ -195,7 +195,7 @@ void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QStrin
m_Stage = stage;
m_Flags = flags;
m_CustomShader = customShader;
m_CustomShader = (id == ResourceId());
// set up compilation parameters
for(ShaderEncoding i : values<ShaderEncoding>())
@@ -221,7 +221,7 @@ void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QStrin
// if it's a custom shader, hide the group entirely (don't allow customisation of compile
// parameters). We can still use it to store the parameters passed in. When visible we collapse it
// by default.
if(customShader)
if(m_CustomShader)
ui->compilationGroup->hide();
// hide debugging windows
@@ -231,7 +231,7 @@ void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QStrin
ui->callstack->hide();
ui->sourceVars->hide();
ui->snippets->setVisible(customShader);
ui->snippets->setVisible(m_CustomShader);
// hide debugging toolbar buttons
ui->debugSep->hide();
@@ -283,12 +283,17 @@ void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QStrin
sel = scintilla;
if(sel == scintilla || title.isEmpty())
title = tr("%1 - Edit (%2)").arg(entryPoint).arg(name);
title = tr(" - %1 - %2()").arg(name).arg(entryPoint);
}
if(sel != NULL)
ToolWindowManager::raiseToolWindow(sel);
if(m_CustomShader)
title.prepend(tr("Editing %1 Shader").arg(ToQStr(stage, m_Ctx.APIProps().pipelineType)));
else
title.prepend(tr("Editing %1").arg(m_Ctx.GetResourceNameUnsuffixed(id)));
setWindowTitle(title);
if(files.count() > 2)
@@ -311,7 +316,7 @@ void ShaderViewer::editShader(bool customShader, ShaderStage stage, const QStrin
ui->docking->setToolWindowProperties(
m_Errors, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow);
if(!customShader)
if(!m_CustomShader)
{
ui->compilationGroup->setWindowTitle(tr("Compilation Settings"));
ui->docking->addToolWindow(ui->compilationGroup,
+3 -3
View File
@@ -61,7 +61,7 @@ class ShaderViewer : public QFrame, public IShaderViewer, public ICaptureViewer
Q_OBJECT
public:
static IShaderViewer *EditShader(ICaptureContext &ctx, bool customShader, ShaderStage stage,
static IShaderViewer *EditShader(ICaptureContext &ctx, ResourceId id, ShaderStage stage,
const QString &entryPoint, const rdcstrpairs &files,
ShaderEncoding shaderEncoding, ShaderCompileFlags flags,
IShaderViewer::SaveCallback saveCallback,
@@ -70,7 +70,7 @@ public:
ShaderViewer *ret = new ShaderViewer(ctx, parent);
ret->m_SaveCallback = saveCallback;
ret->m_CloseCallback = closeCallback;
ret->editShader(customShader, stage, entryPoint, files, shaderEncoding, flags);
ret->editShader(id, stage, entryPoint, files, shaderEncoding, flags);
return ret;
}
@@ -154,7 +154,7 @@ public slots:
private:
explicit ShaderViewer(ICaptureContext &ctx, QWidget *parent = 0);
void editShader(bool customShader, ShaderStage stage, const QString &entryPoint,
void editShader(ResourceId id, ShaderStage stage, const QString &entryPoint,
const rdcstrpairs &files, ShaderEncoding shaderEncoding, ShaderCompileFlags flags);
void debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader,
ResourceId pipeline, ShaderDebugTrace *trace, const QString &debugContext);
+1 -1
View File
@@ -4225,7 +4225,7 @@ void TextureViewer::on_customEdit_clicked()
QPointer<TextureViewer> thisPointer(this);
IShaderViewer *s = m_Ctx.EditShader(
true, ShaderStage::Fragment, lit("main"), files,
ResourceId(), ShaderStage::Fragment, lit("main"), files,
encodingExtensions[QFileInfo(filename).completeSuffix()], ShaderCompileFlags(),
// Save Callback
[thisPointer, key, filename, path](ICaptureContext *ctx, IShaderViewer *viewer,