| 347 | } |
| 348 | |
| 349 | void 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) |
no test coverage detected