Fix OpenGL shader changed race.

This commit is contained in:
BearOso 2023-07-16 14:00:11 -05:00
parent 8bb1e7747d
commit ad613b5f0b
3 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@ DisplayPanel::DisplayPanel(EmuApplication *app_)
QObject::connect(checkBox_use_shader, &QCheckBox::clicked, [&](bool checked) {
app->config->use_shader = checked;
app->window->canvas->shaderChanged();
app->window->shaderChanged();
});
QObject::connect(pushButton_browse_shader, &QPushButton::clicked, [&] {
@ -116,7 +116,7 @@ void DisplayPanel::selectShaderDialog()
app->config->shader = dialog.selectedFiles().at(0).toUtf8();
app->config->last_shader_folder = dialog.directory().absolutePath().toStdString();
lineEdit_shader->setText(app->config->shader.c_str());
app->window->canvas->shaderChanged();
app->window->shaderChanged();
}
void DisplayPanel::populateDevices()

View File

@ -641,3 +641,11 @@ void EmuMainWindow::recreateUIAssets()
canvas->recreateUIAssets();
}, true);
}
void EmuMainWindow::shaderChanged()
{
app->emu_thread->runOnThread([&] {
if (canvas)
canvas->shaderChanged();
});
}

View File

@ -34,6 +34,7 @@ class EmuMainWindow : public QMainWindow
void openFile();
bool openFile(std::string filename);
void recreateUIAssets();
void shaderChanged();
std::vector<std::string> getDisplayDeviceList();
EmuApplication *app;
EmuCanvas *canvas;