MCPcopy Create free account
hub / github.com/baldurk/renderdoc / editShader

Method editShader

qrenderdoc/Windows/ShaderViewer.cpp:349–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void ShaderViewer::editShader(ResourceId id, ShaderStage stage, const QString &entryPoint,
350 const rdcstrpairs &files, KnownShaderTool knownTool,
351 ShaderEncoding shaderEncoding, ShaderCompileFlags flags)
352{
353 m_Scintillas.removeOne(m_DisassemblyView);
354 ui->docking->removeToolWindow(m_DisassemblyFrame);
355
356 m_DisassemblyView = NULL;
357
358 m_Stage = stage;
359 m_Flags = flags;
360
361 m_CustomShader = (id == ResourceId());
362 m_EditingShader = id;
363
364 // set up compilation parameters
365 for(ShaderEncoding i : values<ShaderEncoding>())
366 if(IsTextRepresentation(i) || shaderEncoding == i)
367 m_Encodings << i;
368
369 QStringList strs;
370 strs.clear();
371 for(ShaderEncoding i : m_Encodings)
372 strs << ToQStr(i);
373
374 ui->encoding->addItems(strs);
375 ui->encoding->setCurrentIndex(m_Encodings.indexOf(shaderEncoding));
376 ui->entryFunc->setText(entryPoint);
377
378 QObject::connect(ui->entryFunc, &QLineEdit::textChanged,
379 [this](const QString &) { MarkModification(); });
380 QObject::connect(ui->toolCommandLine, &QTextEdit::textChanged, [this]() { MarkModification(); });
381
382 PopulateCompileTools();
383
384 QObject::connect(ui->encoding, OverloadedSlot<int>::of(&QComboBox::currentIndexChanged),
385 [this](int) {
386 PopulateCompileTools();
387 MarkModification();
388 });
389 QObject::connect(ui->compileTool, OverloadedSlot<int>::of(&QComboBox::currentIndexChanged),
390 [this](int) {
391 PopulateCompileToolParameters();
392 MarkModification();
393 });
394
395 // if we know the shader was originally compiled with a specific tool, pick the first matching
396 // tool we have configured.
397 if(knownTool != KnownShaderTool::Unknown)
398 {
399 for(const ShaderProcessingTool &tool : m_Ctx.Config().ShaderProcessors)
400 {
401 // skip tools that can't accept our inputs, or doesn't produce a supported output
402 if(tool.tool == knownTool)
403 {
404 for(int i = 0; i < ui->compileTool->count(); i++)
405 {
406 if(ui->compileTool->itemText(i) == tool.name)

Callers 1

EditShaderMethod · 0.80

Calls 15

IsTextRepresentationFunction · 0.85
connectFunction · 0.85
FindStateClass · 0.85
AreaReferenceClass · 0.85
fileNameMethod · 0.80
setReadOnlyMethod · 0.80
setPropertyMethod · 0.80
RegisterShortcutMethod · 0.80
setWindowTitleMethod · 0.80
setMarginWidthNMethod · 0.80
areaOfMethod · 0.80

Tested by

no test coverage detected