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

View File

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

View File

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