mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
Qt: show shader pass in parameters window, reload shader params when shader is reloaded
This commit is contained in:
parent
553394c266
commit
341cf63399
@ -2441,10 +2441,14 @@ TODO: Add a setting for these tweaks */
|
|||||||
if (!command_event_save_core_config())
|
if (!command_event_save_core_config())
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
case CMD_EVENT_SHADER_PRESET_LOADED:
|
||||||
|
ui_companion_event_command(cmd);
|
||||||
|
break;
|
||||||
case CMD_EVENT_SHADERS_APPLY_CHANGES:
|
case CMD_EVENT_SHADERS_APPLY_CHANGES:
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
menu_shader_manager_apply_changes();
|
menu_shader_manager_apply_changes();
|
||||||
#endif
|
#endif
|
||||||
|
ui_companion_event_command(cmd);
|
||||||
break;
|
break;
|
||||||
case CMD_EVENT_PAUSE_CHECKS:
|
case CMD_EVENT_PAUSE_CHECKS:
|
||||||
{
|
{
|
||||||
|
@ -158,6 +158,8 @@ enum event_command
|
|||||||
CMD_EVENT_MENU_REFRESH,
|
CMD_EVENT_MENU_REFRESH,
|
||||||
/* Applies shader changes. */
|
/* Applies shader changes. */
|
||||||
CMD_EVENT_SHADERS_APPLY_CHANGES,
|
CMD_EVENT_SHADERS_APPLY_CHANGES,
|
||||||
|
/* A new shader preset has been loaded */
|
||||||
|
CMD_EVENT_SHADER_PRESET_LOADED,
|
||||||
/* Initializes shader directory. */
|
/* Initializes shader directory. */
|
||||||
CMD_EVENT_SHADER_DIR_INIT,
|
CMD_EVENT_SHADER_DIR_INIT,
|
||||||
/* Deinitializes shader directory. */
|
/* Deinitializes shader directory. */
|
||||||
|
@ -3518,6 +3518,9 @@ bool video_shader_driver_get_current_shader(video_shader_ctx_t *shader)
|
|||||||
bool video_shader_driver_direct_get_current_shader(
|
bool video_shader_driver_direct_get_current_shader(
|
||||||
video_shader_ctx_t *shader)
|
video_shader_ctx_t *shader)
|
||||||
{
|
{
|
||||||
|
if (!current_shader)
|
||||||
|
return false;
|
||||||
|
|
||||||
shader->data = current_shader->get_current_shader(current_shader_data);
|
shader->data = current_shader->get_current_shader(current_shader_data);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
#include "../configuration.h"
|
#include "../configuration.h"
|
||||||
#include "../frontend/frontend_driver.h"
|
#include "../frontend/frontend_driver.h"
|
||||||
|
#include "../command.h"
|
||||||
#include "video_driver.h"
|
#include "video_driver.h"
|
||||||
#include "video_shader_parse.h"
|
#include "video_shader_parse.h"
|
||||||
|
|
||||||
@ -785,6 +786,8 @@ bool video_shader_read_conf_cgp(config_file_t *conf,
|
|||||||
string_list_free(file_list);
|
string_list_free(file_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command_event(CMD_EVENT_SHADER_PRESET_LOADED, NULL);
|
||||||
|
|
||||||
if (!video_shader_parse_textures(conf, shader))
|
if (!video_shader_parse_textures(conf, shader))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ UI
|
|||||||
#include "../ui/drivers/qt/ui_qt_browser_window.cpp"
|
#include "../ui/drivers/qt/ui_qt_browser_window.cpp"
|
||||||
#include "../ui/drivers/qt/ui_qt_msg_window.cpp"
|
#include "../ui/drivers/qt/ui_qt_msg_window.cpp"
|
||||||
#include "../ui/drivers/qt/ui_qt_application.cpp"
|
#include "../ui/drivers/qt/ui_qt_application.cpp"
|
||||||
|
#include "../ui/drivers/qt/flowlayout.cpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*============================================================
|
/*============================================================
|
||||||
|
@ -203,6 +203,22 @@ static void setElidedText(QLabel *label, QWidget *clipWidget, int padding, const
|
|||||||
|
|
||||||
const QPixmap getInvader();
|
const QPixmap getInvader();
|
||||||
|
|
||||||
|
ShaderParamsDialog::ShaderParamsDialog(QWidget *parent) :
|
||||||
|
QDialog(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderParamsDialog::~ShaderParamsDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderParamsDialog::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
QDialog::closeEvent(event);
|
||||||
|
|
||||||
|
emit closed();
|
||||||
|
}
|
||||||
|
|
||||||
GridItem::GridItem() :
|
GridItem::GridItem() :
|
||||||
QObject()
|
QObject()
|
||||||
,widget(NULL)
|
,widget(NULL)
|
||||||
@ -928,7 +944,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
,m_allPlaylistsGridMaxCount(0)
|
,m_allPlaylistsGridMaxCount(0)
|
||||||
,m_playlistEntryDialog(NULL)
|
,m_playlistEntryDialog(NULL)
|
||||||
,m_statusMessageElapsedTimer()
|
,m_statusMessageElapsedTimer()
|
||||||
,m_shaderParamsDialog(NULL)
|
,m_shaderParamsDialog()
|
||||||
,m_networkManager(new QNetworkAccessManager(this))
|
,m_networkManager(new QNetworkAccessManager(this))
|
||||||
,m_updateProgressDialog(new QProgressDialog())
|
,m_updateProgressDialog(new QProgressDialog())
|
||||||
,m_updateFile()
|
,m_updateFile()
|
||||||
@ -1152,7 +1168,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
/* make sure these use an auto connection so it will be queued if called from a different thread (some facilities in RA log messages from other threads) */
|
/* make sure these use an auto connection so it will be queued if called from a different thread (some facilities in RA log messages from other threads) */
|
||||||
connect(this, SIGNAL(gotLogMessage(const QString&)), this, SLOT(onGotLogMessage(const QString&)), Qt::AutoConnection);
|
connect(this, SIGNAL(gotLogMessage(const QString&)), this, SLOT(onGotLogMessage(const QString&)), Qt::AutoConnection);
|
||||||
connect(this, SIGNAL(gotStatusMessage(QString,unsigned,unsigned,bool)), this, SLOT(onGotStatusMessage(QString,unsigned,unsigned,bool)), Qt::AutoConnection);
|
connect(this, SIGNAL(gotStatusMessage(QString,unsigned,unsigned,bool)), this, SLOT(onGotStatusMessage(QString,unsigned,unsigned,bool)), Qt::AutoConnection);
|
||||||
connect(this, SIGNAL(gotReloadPlaylists()), this, SLOT(onGotReloadPlaylists()));
|
connect(this, SIGNAL(gotReloadPlaylists()), this, SLOT(onGotReloadPlaylists()), Qt::AutoConnection);
|
||||||
|
connect(this, SIGNAL(gotReloadShaderParams()), this, SLOT(onGotReloadShaderParams()), Qt::AutoConnection);
|
||||||
|
|
||||||
|
/* these are always queued */
|
||||||
connect(this, SIGNAL(showErrorMessageDeferred(QString)), this, SLOT(onShowErrorMessage(QString)), Qt::QueuedConnection);
|
connect(this, SIGNAL(showErrorMessageDeferred(QString)), this, SLOT(onShowErrorMessage(QString)), Qt::QueuedConnection);
|
||||||
connect(this, SIGNAL(extractArchiveDeferred(QString)), this, SLOT(onExtractArchive(QString)), Qt::QueuedConnection);
|
connect(this, SIGNAL(extractArchiveDeferred(QString)), this, SLOT(onExtractArchive(QString)), Qt::QueuedConnection);
|
||||||
|
|
||||||
@ -1218,9 +1237,11 @@ void MainWindow::removeUpdateTempFiles()
|
|||||||
|
|
||||||
void MainWindow::onShaderParamsClicked()
|
void MainWindow::onShaderParamsClicked()
|
||||||
{
|
{
|
||||||
QFormLayout *form = new QFormLayout();
|
|
||||||
video_shader_ctx_t shader_info;
|
video_shader_ctx_t shader_info;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
int last_pass = -1;
|
||||||
|
QFormLayout *last_form = NULL;
|
||||||
|
QGroupBox *last_group = NULL;
|
||||||
|
|
||||||
video_shader_driver_get_current_shader(&shader_info);
|
video_shader_driver_get_current_shader(&shader_info);
|
||||||
|
|
||||||
@ -1231,14 +1252,43 @@ void MainWindow::onShaderParamsClicked()
|
|||||||
if (m_shaderParamsDialog)
|
if (m_shaderParamsDialog)
|
||||||
delete m_shaderParamsDialog;
|
delete m_shaderParamsDialog;
|
||||||
|
|
||||||
m_shaderParamsDialog = new QDialog();
|
m_shaderParamsDialog = new ShaderParamsDialog();
|
||||||
m_shaderParamsDialog->setLayout(form);
|
m_shaderParamsDialog->setLayout(new QVBoxLayout());
|
||||||
m_shaderParamsDialog->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS));
|
m_shaderParamsDialog->setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PARAMETERS));
|
||||||
|
|
||||||
|
connect(m_shaderParamsDialog, SIGNAL(closed()), m_shaderParamsDialog, SLOT(deleteLater()));
|
||||||
|
|
||||||
|
if (shader_info.data->num_parameters == 0)
|
||||||
|
{
|
||||||
|
QLabel *label = new QLabel(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_SHADER_PARAMETERS), m_shaderParamsDialog);
|
||||||
|
label->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
m_shaderParamsDialog->layout()->addWidget(label);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* NOTE: We assume that parameters are always grouped in order by the pass number, e.g., all parameters for pass 0 come first, then params for pass 1, etc. */
|
||||||
for (i = 0; i < shader_info.data->num_parameters; i++)
|
for (i = 0; i < shader_info.data->num_parameters; i++)
|
||||||
{
|
{
|
||||||
struct video_shader_parameter *param = &shader_info.data->parameters[i];
|
struct video_shader_parameter *param = &shader_info.data->parameters[i];
|
||||||
QString desc = param->desc;
|
QString desc = param->desc;
|
||||||
|
QFormLayout *form = last_form;
|
||||||
|
|
||||||
|
if (param->pass > last_pass)
|
||||||
|
{
|
||||||
|
QGroupBox *groupBox = NULL;
|
||||||
|
QFileInfo fileInfo(shader_info.data->pass[param->pass].source.path);
|
||||||
|
QString shaderBasename = fileInfo.completeBaseName();
|
||||||
|
|
||||||
|
form = new QFormLayout();
|
||||||
|
groupBox = new QGroupBox(shaderBasename);
|
||||||
|
groupBox->setLayout(form);
|
||||||
|
|
||||||
|
m_shaderParamsDialog->layout()->addWidget(groupBox);
|
||||||
|
|
||||||
|
last_form = form;
|
||||||
|
last_pass = param->pass;
|
||||||
|
}
|
||||||
|
|
||||||
if ((param->minimum == 0.0)
|
if ((param->minimum == 0.0)
|
||||||
&& (param->maximum
|
&& (param->maximum
|
||||||
@ -1304,6 +1354,9 @@ void MainWindow::onShaderParamsClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_shaderParamsDialog->layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||||
|
}
|
||||||
|
|
||||||
m_shaderParamsDialog->resize(720, 480);
|
m_shaderParamsDialog->resize(720, 480);
|
||||||
m_shaderParamsDialog->show();
|
m_shaderParamsDialog->show();
|
||||||
}
|
}
|
||||||
@ -2456,6 +2509,17 @@ void MainWindow::onGotStatusMessage(QString msg, unsigned priority, unsigned dur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::deferReloadShaderParams()
|
||||||
|
{
|
||||||
|
emit gotReloadShaderParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onGotReloadShaderParams()
|
||||||
|
{
|
||||||
|
if (m_shaderParamsDialog && m_shaderParamsDialog->isVisible())
|
||||||
|
onShaderParamsClicked();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::deferReloadPlaylists()
|
void MainWindow::deferReloadPlaylists()
|
||||||
{
|
{
|
||||||
emit gotReloadPlaylists();
|
emit gotReloadPlaylists();
|
||||||
|
@ -623,11 +623,23 @@ static void ui_companion_qt_toggle(void *data, bool force)
|
|||||||
static void ui_companion_qt_event_command(void *data, enum event_command cmd)
|
static void ui_companion_qt_event_command(void *data, enum event_command cmd)
|
||||||
{
|
{
|
||||||
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
|
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
|
||||||
|
ui_window_qt_t *win_handle = (ui_window_qt_t*)handle->window;
|
||||||
(void)cmd;
|
|
||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
case CMD_EVENT_SHADERS_APPLY_CHANGES:
|
||||||
|
/* PRESET_LOADED already fires in more situations than APPLY_CHANGES, use that for reloading the params window */
|
||||||
|
break;
|
||||||
|
case CMD_EVENT_SHADER_PRESET_LOADED:
|
||||||
|
RARCH_LOG("[Qt]: Reloading shader parameters.\n");
|
||||||
|
win_handle->qtWindow->deferReloadShaderParams();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_companion_qt_notify_list_pushed(void *data, file_list_t *list,
|
static void ui_companion_qt_notify_list_pushed(void *data, file_list_t *list,
|
||||||
|
@ -250,6 +250,18 @@ private:
|
|||||||
QSpinBox *m_allPlaylistsGridMaxCountSpinBox;
|
QSpinBox *m_allPlaylistsGridMaxCountSpinBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShaderParamsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ShaderParamsDialog(QWidget *parent = 0);
|
||||||
|
~ShaderParamsDialog();
|
||||||
|
signals:
|
||||||
|
void closed();
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *event);
|
||||||
|
};
|
||||||
|
|
||||||
class CoreInfoLabel : public QLabel
|
class CoreInfoLabel : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -365,6 +377,7 @@ signals:
|
|||||||
void gotLogMessage(const QString &msg);
|
void gotLogMessage(const QString &msg);
|
||||||
void gotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush);
|
void gotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush);
|
||||||
void gotReloadPlaylists();
|
void gotReloadPlaylists();
|
||||||
|
void gotReloadShaderParams();
|
||||||
void showErrorMessageDeferred(QString msg);
|
void showErrorMessageDeferred(QString msg);
|
||||||
void extractArchiveDeferred(QString path);
|
void extractArchiveDeferred(QString path);
|
||||||
|
|
||||||
@ -393,6 +406,7 @@ public slots:
|
|||||||
void reloadPlaylists();
|
void reloadPlaylists();
|
||||||
void deferReloadPlaylists();
|
void deferReloadPlaylists();
|
||||||
void onGotReloadPlaylists();
|
void onGotReloadPlaylists();
|
||||||
|
void onGotReloadShaderParams();
|
||||||
void showWelcomeScreen();
|
void showWelcomeScreen();
|
||||||
void onIconViewClicked();
|
void onIconViewClicked();
|
||||||
void onListViewClicked();
|
void onListViewClicked();
|
||||||
@ -403,6 +417,7 @@ public slots:
|
|||||||
void showDocs();
|
void showDocs();
|
||||||
void updateRetroArchNightly();
|
void updateRetroArchNightly();
|
||||||
void onUpdateRetroArchFinished(bool success);
|
void onUpdateRetroArchFinished(bool success);
|
||||||
|
void deferReloadShaderParams();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
||||||
@ -520,7 +535,7 @@ private:
|
|||||||
int m_allPlaylistsGridMaxCount;
|
int m_allPlaylistsGridMaxCount;
|
||||||
PlaylistEntryDialog *m_playlistEntryDialog;
|
PlaylistEntryDialog *m_playlistEntryDialog;
|
||||||
QElapsedTimer m_statusMessageElapsedTimer;
|
QElapsedTimer m_statusMessageElapsedTimer;
|
||||||
QDialog *m_shaderParamsDialog;
|
QPointer<ShaderParamsDialog> m_shaderParamsDialog;
|
||||||
QNetworkAccessManager *m_networkManager;
|
QNetworkAccessManager *m_networkManager;
|
||||||
QProgressDialog *m_updateProgressDialog;
|
QProgressDialog *m_updateProgressDialog;
|
||||||
QFile m_updateFile;
|
QFile m_updateFile;
|
||||||
|
@ -103,6 +103,10 @@ void ui_companion_event_command(enum event_command action)
|
|||||||
|
|
||||||
if (ui && ui->event_command)
|
if (ui && ui->event_command)
|
||||||
ui->event_command(ui_companion_data, action);
|
ui->event_command(ui_companion_data, action);
|
||||||
|
#ifdef HAVE_QT
|
||||||
|
if (ui_companion_qt.toggle && qt_is_inited)
|
||||||
|
ui_companion_qt.event_command(ui_companion_qt_data, action);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_companion_driver_deinit(void)
|
void ui_companion_driver_deinit(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user