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

Method reloadCustomShaders

qrenderdoc/Windows/TextureViewer.cpp:4315–4530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4313}
4314
4315void TextureViewer::reloadCustomShaders(const QString &filter)
4316{
4317 if(!m_Ctx.IsCaptureLoaded())
4318 return;
4319
4320 if(filter.isEmpty())
4321 {
4322 QString prevtext = ui->customShader->currentText();
4323
4324 QList<ResourceId> shaders = m_CustomShaders.values();
4325
4326 m_Ctx.Replay().AsyncInvoke([shaders](IReplayController *r) {
4327 for(ResourceId s : shaders)
4328 r->FreeCustomShader(s);
4329 });
4330
4331 ui->customShader->clear();
4332 m_CustomShaders.clear();
4333
4334 ui->customShader->setCurrentText(prevtext);
4335 }
4336 else
4337 {
4338 QString fn = QFileInfo(filter).fileName();
4339 QString key = fn.toUpper();
4340
4341 if(m_CustomShaders.contains(key))
4342 {
4343 if(m_CustomShadersBusy.contains(key))
4344 return;
4345
4346 ResourceId freed = m_CustomShaders[key];
4347 m_Ctx.Replay().AsyncInvoke([freed](IReplayController *r) { r->FreeCustomShader(freed); });
4348
4349 m_CustomShaders.remove(key);
4350
4351 QString text = ui->customShader->currentText();
4352
4353 for(int i = 0; i < ui->customShader->count(); i++)
4354 {
4355 if(ui->customShader->itemText(i).compare(fn, Qt::CaseInsensitive) == 0)
4356 {
4357 ui->customShader->removeItem(i);
4358 break;
4359 }
4360 }
4361
4362 ui->customShader->setCurrentText(text);
4363 }
4364 }
4365
4366 QStringList filters;
4367 for(auto it = encodingExtensions.begin(); it != encodingExtensions.end(); ++it)
4368 {
4369 if(!canCompileCustomShader(it.value()))
4370 continue;
4371
4372 filters.push_back(lit("*.") + it.key());

Callers 1

on_customEdit_clickedMethod · 0.80

Calls 15

bytebufClass · 0.85
rdctieFunction · 0.85
ShaderCompileFlagsClass · 0.85
fileNameMethod · 0.80
toUpperMethod · 0.80
toUtf8Method · 0.80
ShowErrorsMethod · 0.80
existsMethod · 0.80
QFileInfoClass · 0.50
QStringFunction · 0.50
ResourceIdFunction · 0.50
IsCaptureLoadedMethod · 0.45

Tested by

no test coverage detected