win32: pass around active shader to parameter dialog

This commit is contained in:
OV2 2019-02-01 22:41:29 +01:00
parent 1ea9bcf560
commit 7045cd8478
4 changed files with 22 additions and 8 deletions

View File

@ -82,6 +82,10 @@ public:
bool SetFullscreen(bool fullscreen); bool SetFullscreen(bool fullscreen);
void SetSnes9xColorFormat(void); void SetSnes9xColorFormat(void);
void EnumModes(std::vector<dMode> *modeVector); void EnumModes(std::vector<dMode> *modeVector);
GLSLShader *GetActiveShader()
{
return glslShader;
}
}; };

View File

@ -617,6 +617,11 @@ int WinGetAutomaticInputRate(void)
return (int)newInputRate; return (int)newInputRate;
} }
GLSLShader *WinGetActiveGLSLShader()
{
return OpenGL.GetActiveShader();
}
/* Depth conversion functions begin */ /* Depth conversion functions begin */
void Convert16To24 (SSurface *src, SSurface *dst, RECT *srect) void Convert16To24 (SSurface *src, SSurface *dst, RECT *srect)

View File

@ -10,6 +10,7 @@
#include "wsnes9x.h" #include "wsnes9x.h"
#include "port.h" #include "port.h"
#include "render.h" #include "render.h"
#include "../shaders/glsl.h"
#include <vector> #include <vector>
#define IsHiRes(x) ((x.Height > SNES_HEIGHT_EXTENDED || x.Width == 512)) #define IsHiRes(x) ((x.Height > SNES_HEIGHT_EXTENDED || x.Width == 512))
@ -40,5 +41,6 @@ char *ReadShaderFileContents(const TCHAR *filename);
void ReduceToPath(TCHAR *filename); void ReduceToPath(TCHAR *filename);
double WinGetRefreshRate(); double WinGetRefreshRate();
int WinGetAutomaticInputRate(); int WinGetAutomaticInputRate();
GLSLShader *WinGetActiveGLSLShader();
#endif #endif

View File

@ -7740,14 +7740,17 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
break; break;
} }
ShowWindow(hDlg, SW_HIDE); ShowWindow(hDlg, SW_HIDE);
GLSLShader shader; WinDisplayApplyChanges();
shader.load_shader(_tToChar(GUI.OGLshaderFileName)); WinRefreshDisplay();
CShaderParamDlg dlg(shader); GLSLShader *shader = WinGetActiveGLSLShader();
if (shader) {
CShaderParamDlg dlg(*shader);
if (dlg.show()) { if (dlg.show()) {
SetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName); SetDlgItemText(hDlg, IDC_SHADER_GLSL_FILE, GUI.OGLshaderFileName);
WinDisplayApplyChanges(); WinDisplayApplyChanges();
WinRefreshDisplay(); WinRefreshDisplay();
} }
}
ShowWindow(hDlg, SW_SHOW); ShowWindow(hDlg, SW_SHOW);
break; break;
} }