Skip to content

Commit

Permalink
Fix OpenGL shader changed race.
Browse files Browse the repository at this point in the history
  • Loading branch information
bearoso committed Aug 25, 2023
1 parent 8bb1e77 commit ad613b5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qt/src/DisplayPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, [&] {
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions qt/src/EmuMainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,4 +640,12 @@ void EmuMainWindow::recreateUIAssets()
if (canvas)
canvas->recreateUIAssets();
}, true);
}

void EmuMainWindow::shaderChanged()
{
app->emu_thread->runOnThread([&] {
if (canvas)
canvas->shaderChanged();
});
}
1 change: 1 addition & 0 deletions qt/src/EmuMainWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ad613b5

Please sign in to comment.