mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Implement max MSAA level detection.
Zilmar spec and Windows only. Fixes #2216 MSAA max not 16x in UI
This commit is contained in:
parent
deb84826e4
commit
f04ac8296d
|
@ -190,3 +190,8 @@ void DisplayWindow::readScreen2(void * _dest, int * _width, int * _height, int _
|
||||||
{
|
{
|
||||||
_readScreen2(_dest, _width, _height, _front);
|
_readScreen2(_dest, _width, _height, _front);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 DisplayWindow::maxMSAALevel() const
|
||||||
|
{
|
||||||
|
return _maxMSAALevel();
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
void setToggleFullscreen() { m_bToggleFullscreen = true; }
|
void setToggleFullscreen() { m_bToggleFullscreen = true; }
|
||||||
void readScreen(void **_pDest, long *_pWidth, long *_pHeight);
|
void readScreen(void **_pDest, long *_pWidth, long *_pHeight);
|
||||||
void readScreen2(void * _dest, int * _width, int * _height, int _front);
|
void readScreen2(void * _dest, int * _width, int * _height, int _front);
|
||||||
|
u32 maxMSAALevel() const;
|
||||||
|
|
||||||
void updateScale();
|
void updateScale();
|
||||||
f32 getScaleX() const { return m_scaleX; }
|
f32 getScaleX() const { return m_scaleX; }
|
||||||
|
@ -81,6 +82,8 @@ private:
|
||||||
virtual void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) = 0;
|
virtual void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) = 0;
|
||||||
virtual void _readScreen2(void * _dest, int * _width, int * _height, int _front) = 0;
|
virtual void _readScreen2(void * _dest, int * _width, int * _height, int _front) = 0;
|
||||||
virtual graphics::ObjectHandle _getDefaultFramebuffer() = 0;
|
virtual graphics::ObjectHandle _getDefaultFramebuffer() = 0;
|
||||||
|
virtual u32 _maxMSAALevel() const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
|
|
@ -37,6 +37,14 @@ void CConfigDlg::setRomName(const char * RomName) {
|
||||||
m_romName = RomName == NULL || strlen(RomName) == 0 ? NULL : RomName;
|
m_romName = RomName == NULL || strlen(RomName) == 0 ? NULL : RomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigDlg::setMSAALevel(uint32_t _maxMSAALevel) {
|
||||||
|
m_maxMSAALevel = _maxMSAALevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CConfigDlg::getMSAALevel() const {
|
||||||
|
return m_maxMSAALevel;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
|
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
|
||||||
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
|
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
|
||||||
SetIcon(hIcon, TRUE);
|
SetIcon(hIcon, TRUE);
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
|
|
||||||
void setIniPath(const std::string & IniPath);
|
void setIniPath(const std::string & IniPath);
|
||||||
void setRomName(const char * RomName);
|
void setRomName(const char * RomName);
|
||||||
|
void setMSAALevel(uint32_t _maxMSAALevel);
|
||||||
|
uint32_t getMSAALevel() const;
|
||||||
bool Saved(void) const { return m_Saved; }
|
bool Saved(void) const { return m_Saved; }
|
||||||
void OnCustomSettingsToggled(bool checked);
|
void OnCustomSettingsToggled(bool checked);
|
||||||
void SetLanguage(const std::string & language);
|
void SetLanguage(const std::string & language);
|
||||||
|
@ -62,6 +64,7 @@ protected:
|
||||||
std::vector<CConfigTab *> m_TabWindows;
|
std::vector<CConfigTab *> m_TabWindows;
|
||||||
std::string m_strIniPath;
|
std::string m_strIniPath;
|
||||||
const char * m_romName;
|
const char * m_romName;
|
||||||
|
uint32_t m_maxMSAALevel;
|
||||||
bool m_blockReInit;
|
bool m_blockReInit;
|
||||||
CFrameBufferTab * m_FrameBufferTab;
|
CFrameBufferTab * m_FrameBufferTab;
|
||||||
CVideoTab * m_VideoTab;
|
CVideoTab * m_VideoTab;
|
||||||
|
|
|
@ -16,7 +16,7 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||||
//#define RUN_DIALOG_IN_THREAD
|
//#define RUN_DIALOG_IN_THREAD
|
||||||
|
|
||||||
static
|
static
|
||||||
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool & _accepted)
|
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, bool & _accepted)
|
||||||
{
|
{
|
||||||
std::string IniFolder;
|
std::string IniFolder;
|
||||||
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
|
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
|
||||||
|
@ -33,26 +33,28 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool &
|
||||||
CConfigDlg Dlg;
|
CConfigDlg Dlg;
|
||||||
Dlg.setIniPath(IniFolder.c_str());
|
Dlg.setIniPath(IniFolder.c_str());
|
||||||
Dlg.setRomName(_romName);
|
Dlg.setRomName(_romName);
|
||||||
|
Dlg.setMSAALevel(_maxMSAALevel);
|
||||||
Dlg.DoModal();
|
Dlg.DoModal();
|
||||||
_accepted = Dlg.Saved();
|
_accepted = Dlg.Saved();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runConfigThread(const wchar_t * _strFileName, const char * _romName) {
|
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel)
|
||||||
|
{
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
#ifdef RUN_DIALOG_IN_THREAD
|
#ifdef RUN_DIALOG_IN_THREAD
|
||||||
std::thread configThread(openConfigDialog, _strFileName, std::ref(accepted));
|
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||||
configThread.join();
|
configThread.join();
|
||||||
#else
|
#else
|
||||||
openConfigDialog(_strFileName, _romName, accepted);
|
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
||||||
#endif
|
#endif
|
||||||
return accepted;
|
return accepted;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName)
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel)
|
||||||
{
|
{
|
||||||
return runConfigThread(_strFileName, _romName);
|
return runConfigThread(_strFileName, _romName, _maxMSAALevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName)
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName)
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern "C" {
|
||||||
#define CALL
|
#define CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel);
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||||
|
|
|
@ -412,9 +412,11 @@ void CVideoTab::LoadSettings(bool /*blockCustomSettings*/) {
|
||||||
if (fullscreenRate == i)
|
if (fullscreenRate == i)
|
||||||
RefreshRateComboBox.SetCurSel(index);
|
RefreshRateComboBox.SetCurSel(index);
|
||||||
}
|
}
|
||||||
|
const u32 maxMSAALevel = m_Dlg.getMSAALevel();
|
||||||
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
||||||
? config.video.multisampling
|
? min(config.video.multisampling, maxMSAALevel)
|
||||||
: 8;
|
: maxMSAALevel;
|
||||||
|
m_AliasingSlider.SetRangeMax(powof(maxMSAALevel));
|
||||||
m_AliasingSlider.SetPos(powof(multisampling));
|
m_AliasingSlider.SetPos(powof(multisampling));
|
||||||
std::wstring AliasingText = FormatStrW(L"%dx", multisampling);
|
std::wstring AliasingText = FormatStrW(L"%dx", multisampling);
|
||||||
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
|
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
|
||||||
|
|
|
@ -169,9 +169,10 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
||||||
ui->fullScreenRefreshRateComboBox->setCurrentIndex(fullscreenRate);
|
ui->fullScreenRefreshRateComboBox->setCurrentIndex(fullscreenRate);
|
||||||
|
|
||||||
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
||||||
? config.video.multisampling
|
? std::min(config.video.multisampling, m_maxMSAA)
|
||||||
: 8;
|
: m_maxMSAA;
|
||||||
ui->aliasingSlider->blockSignals(true);
|
ui->aliasingSlider->blockSignals(true);
|
||||||
|
ui->aliasingSlider->setMaximum(powof(m_maxMSAA));
|
||||||
ui->aliasingSlider->setValue(powof(multisampling));
|
ui->aliasingSlider->setValue(powof(multisampling));
|
||||||
ui->aliasingSlider->blockSignals(false);
|
ui->aliasingSlider->blockSignals(false);
|
||||||
ui->aliasingLabelVal->setText(QString::number(multisampling));
|
ui->aliasingLabelVal->setText(QString::number(multisampling));
|
||||||
|
@ -469,9 +470,10 @@ void ConfigDialog::setRomName(const char * _romName)
|
||||||
this->on_customSettingsCheckBox_toggled(ui->customSettingsCheckBox->isChecked());
|
this->on_customSettingsCheckBox_toggled(ui->customSettingsCheckBox->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDialog::ConfigDialog(QWidget *parent, Qt::WindowFlags f) :
|
ConfigDialog::ConfigDialog(QWidget *parent, Qt::WindowFlags f, unsigned int _maxMsaaLevel) :
|
||||||
QDialog(parent, f),
|
QDialog(parent, f),
|
||||||
ui(new Ui::ConfigDialog),
|
ui(new Ui::ConfigDialog),
|
||||||
|
m_maxMSAA(_maxMsaaLevel),
|
||||||
m_accepted(false),
|
m_accepted(false),
|
||||||
m_fontsInited(false),
|
m_fontsInited(false),
|
||||||
m_blockReInit(false)
|
m_blockReInit(false)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ConfigDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
explicit ConfigDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags(), unsigned int _maxMsaaLevel = 8);
|
||||||
~ConfigDialog();
|
~ConfigDialog();
|
||||||
|
|
||||||
void setIniPath(const QString & _strIniPath);
|
void setIniPath(const QString & _strIniPath);
|
||||||
|
@ -97,6 +97,7 @@ private:
|
||||||
bool m_blockReInit;
|
bool m_blockReInit;
|
||||||
QString m_strIniPath;
|
QString m_strIniPath;
|
||||||
const char * m_romName;
|
const char * m_romName;
|
||||||
|
unsigned int m_maxMSAA;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIGDIALOG_H
|
#endif // CONFIGDIALOG_H
|
||||||
|
|
|
@ -17,7 +17,8 @@ void Config_DoConfig(/*HWND hParent*/)
|
||||||
api().FindPluginPath(strIniFolderPath);
|
api().FindPluginPath(strIniFolderPath);
|
||||||
|
|
||||||
ConfigOpen = true;
|
ConfigOpen = true;
|
||||||
const bool bRestart = RunConfig(strIniFolderPath, api().isRomOpen() ? RSP.romname : nullptr);
|
const u32 maxMsaa = dwnd().maxMSAALevel();
|
||||||
|
const bool bRestart = RunConfig(strIniFolderPath, api().isRomOpen() ? RSP.romname : nullptr, maxMsaa);
|
||||||
if (config.generalEmulation.enableCustomSettings != 0)
|
if (config.generalEmulation.enableCustomSettings != 0)
|
||||||
LoadCustomRomSettings(strIniFolderPath, RSP.romname);
|
LoadCustomRomSettings(strIniFolderPath, RSP.romname);
|
||||||
config.validate();
|
config.validate();
|
||||||
|
|
|
@ -20,7 +20,7 @@ inline void initMyResource() { Q_INIT_RESOURCE(icon); }
|
||||||
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
|
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
|
||||||
|
|
||||||
static
|
static
|
||||||
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool & _accepted)
|
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, bool & _accepted)
|
||||||
{
|
{
|
||||||
cleanMyResource();
|
cleanMyResource();
|
||||||
initMyResource();
|
initMyResource();
|
||||||
|
@ -43,7 +43,7 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool &
|
||||||
if (translator.load(getTranslationFile(), strIniFileName))
|
if (translator.load(getTranslationFile(), strIniFileName))
|
||||||
pApp->installTranslator(&translator);
|
pApp->installTranslator(&translator);
|
||||||
|
|
||||||
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint, _maxMSAALevel);
|
||||||
|
|
||||||
w.setIniPath(strIniFileName);
|
w.setIniPath(strIniFileName);
|
||||||
w.setRomName(_romName);
|
w.setRomName(_romName);
|
||||||
|
@ -74,13 +74,13 @@ int openAboutDialog(const wchar_t * _strFileName)
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runConfigThread(const wchar_t * _strFileName, const char * _romName) {
|
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel) {
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
#ifdef RUN_DIALOG_IN_THREAD
|
#ifdef RUN_DIALOG_IN_THREAD
|
||||||
std::thread configThread(openConfigDialog, _strFileName, std::ref(accepted));
|
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||||
configThread.join();
|
configThread.join();
|
||||||
#else
|
#else
|
||||||
openConfigDialog(_strFileName, _romName, accepted);
|
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
||||||
#endif
|
#endif
|
||||||
return accepted;
|
return accepted;
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ int runAboutThread(const wchar_t * _strFileName) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName)
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel)
|
||||||
{
|
{
|
||||||
return runConfigThread(_strFileName, _romName);
|
return runConfigThread(_strFileName, _romName, _maxMSAALevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName)
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName)
|
||||||
|
|
|
@ -13,7 +13,7 @@ extern "C" {
|
||||||
#define CALL
|
#define CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel);
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||||
|
|
|
@ -479,7 +479,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSlider" name="aliasingSlider">
|
<widget class="QSlider" name="aliasingSlider">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>3</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
|
|
@ -5326,6 +5326,36 @@ private:
|
||||||
std::function<void()> m_swapBuffersCallback;
|
std::function<void()> m_swapBuffersCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WindowsMaxMSAALevelCommand : public OpenGlCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WindowsMaxMSAALevelCommand() :
|
||||||
|
OpenGlCommand(true, false, "WindowsMaxMSAALevelCommand", false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<OpenGlCommand> get(u32& returnValue)
|
||||||
|
{
|
||||||
|
static int poolId = OpenGlCommandPool::get().getNextAvailablePool();
|
||||||
|
auto ptr = getFromPool<WindowsMaxMSAALevelCommand>(poolId);
|
||||||
|
ptr->set(returnValue);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void commandToExecute() override
|
||||||
|
{
|
||||||
|
*m_returnValue = WindowsWGL::maxMSAALevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void set(u32& returnValue)
|
||||||
|
{
|
||||||
|
m_returnValue = &returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32* m_returnValue;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
|
|
@ -1658,4 +1658,20 @@ namespace opengl {
|
||||||
|
|
||||||
return textureSize;
|
return textureSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 FunctionWrapper::maxMSAALevel()
|
||||||
|
{
|
||||||
|
#if defined(OS_WINDOWS) && !defined(MUPENPLUSAPI)
|
||||||
|
u32 returnValue;
|
||||||
|
|
||||||
|
if (m_threaded_wrapper)
|
||||||
|
executeCommand(WindowsMaxMSAALevelCommand::get(returnValue));
|
||||||
|
else
|
||||||
|
WindowsMaxMSAALevelCommand::get(returnValue)->performCommandSingleThreaded();
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
#else
|
||||||
|
return 8;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,5 +221,6 @@ namespace opengl {
|
||||||
static void WaitForSwapBuffersQueued();
|
static void WaitForSwapBuffersQueued();
|
||||||
|
|
||||||
static int getTextureBytes(GLenum format, GLenum type, int width, int height);
|
static int getTextureBytes(GLenum format, GLenum type, int width, int height);
|
||||||
|
static u32 maxMSAALevel();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ private:
|
||||||
void _changeWindow() override;
|
void _changeWindow() override;
|
||||||
void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override {}
|
void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override {}
|
||||||
void _readScreen2(void * _dest, int * _width, int * _height, int _front) override;
|
void _readScreen2(void * _dest, int * _width, int * _height, int _front) override;
|
||||||
|
u32 _maxMSAALevel() const override;
|
||||||
#ifdef M64P_GLIDENUI
|
#ifdef M64P_GLIDENUI
|
||||||
bool _supportsWithRateFunctions = true;
|
bool _supportsWithRateFunctions = true;
|
||||||
#endif // M64P_GLIDENUI
|
#endif // M64P_GLIDENUI
|
||||||
|
@ -325,3 +326,10 @@ graphics::ObjectHandle DisplayWindowMupen64plus::_getDefaultFramebuffer()
|
||||||
return graphics::ObjectHandle(CoreVideo_GL_GetDefaultFramebuffer());
|
return graphics::ObjectHandle(CoreVideo_GL_GetDefaultFramebuffer());
|
||||||
return graphics::ObjectHandle::null;
|
return graphics::ObjectHandle::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 DisplayWindowMupen64plus::_maxMSAALevel() const
|
||||||
|
{
|
||||||
|
FunctionWrapper::setThreadedMode(config.video.threadedVideo);
|
||||||
|
|
||||||
|
return FunctionWrapper::maxMSAALevel();
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
HGLRC WindowsWGL::hRC = NULL;
|
HGLRC WindowsWGL::hRC = NULL;
|
||||||
HDC WindowsWGL::hDC = NULL;
|
HDC WindowsWGL::hDC = NULL;
|
||||||
|
unsigned int WindowsWGL::m_sMaxMsaa = 0;
|
||||||
|
|
||||||
bool WindowsWGL::start()
|
bool WindowsWGL::start()
|
||||||
{
|
{
|
||||||
|
@ -106,6 +107,57 @@ bool WindowsWGL::start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_sMaxMsaa > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB =
|
||||||
|
(PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||||
|
if (wglChoosePixelFormatARB != nullptr) {
|
||||||
|
|
||||||
|
const int piAttribIList16[] =
|
||||||
|
{
|
||||||
|
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
|
||||||
|
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
|
||||||
|
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||||
|
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||||
|
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||||
|
WGL_COLOR_BITS_ARB, 32,
|
||||||
|
WGL_DEPTH_BITS_ARB, 24,
|
||||||
|
WGL_STENCIL_BITS_ARB, 8,
|
||||||
|
WGL_SAMPLE_BUFFERS_ARB, 1,
|
||||||
|
WGL_SAMPLES_EXT, 16,
|
||||||
|
0 // zero term
|
||||||
|
};
|
||||||
|
const float pfAttribFList[] = { 0.0f };
|
||||||
|
|
||||||
|
int piFormats;
|
||||||
|
unsigned int nNumFormats;
|
||||||
|
int res = wglChoosePixelFormatARB(hDC, piAttribIList16, pfAttribFList, 1, &piFormats, &nNumFormats);
|
||||||
|
if (res > 0 && nNumFormats > 0)
|
||||||
|
m_sMaxMsaa = 16;
|
||||||
|
else {
|
||||||
|
const int piAttribIList8[] =
|
||||||
|
{
|
||||||
|
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
|
||||||
|
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
|
||||||
|
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||||
|
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||||
|
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||||
|
WGL_COLOR_BITS_ARB, 32,
|
||||||
|
WGL_DEPTH_BITS_ARB, 24,
|
||||||
|
WGL_STENCIL_BITS_ARB, 8,
|
||||||
|
WGL_SAMPLE_BUFFERS_ARB, 1,
|
||||||
|
WGL_SAMPLES_EXT, 8,
|
||||||
|
0 // zero term
|
||||||
|
};
|
||||||
|
res = wglChoosePixelFormatARB(hDC, piAttribIList16, pfAttribFList, 1, &piFormats, &nNumFormats);
|
||||||
|
if (res > 0 && nNumFormats > 0)
|
||||||
|
m_sMaxMsaa = 8;
|
||||||
|
else
|
||||||
|
m_sMaxMsaa = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,3 +184,12 @@ void WindowsWGL::swapBuffers()
|
||||||
SwapBuffers(hDC);
|
SwapBuffers(hDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int WindowsWGL::maxMSAALevel()
|
||||||
|
{
|
||||||
|
if (hRC != NULL || m_sMaxMsaa > 0)
|
||||||
|
return m_sMaxMsaa;
|
||||||
|
|
||||||
|
start();
|
||||||
|
stop();
|
||||||
|
return m_sMaxMsaa;
|
||||||
|
}
|
||||||
|
|
|
@ -11,10 +11,11 @@ public:
|
||||||
static bool start();
|
static bool start();
|
||||||
static void stop();
|
static void stop();
|
||||||
static void swapBuffers();
|
static void swapBuffers();
|
||||||
|
static unsigned int maxMSAALevel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static HGLRC hRC;
|
static HGLRC hRC;
|
||||||
static HDC hDC;
|
static HDC hDC;
|
||||||
|
static unsigned int m_sMaxMsaa;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ private:
|
||||||
void _changeWindow() override;
|
void _changeWindow() override;
|
||||||
void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override;
|
void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) override;
|
||||||
void _readScreen2(void * _dest, int * _width, int * _height, int _front) override {}
|
void _readScreen2(void * _dest, int * _width, int * _height, int _front) override {}
|
||||||
|
u32 _maxMSAALevel() const override;
|
||||||
graphics::ObjectHandle _getDefaultFramebuffer() override;
|
graphics::ObjectHandle _getDefaultFramebuffer() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,3 +228,8 @@ graphics::ObjectHandle DisplayWindowWindows::_getDefaultFramebuffer()
|
||||||
{
|
{
|
||||||
return graphics::ObjectHandle::null;
|
return graphics::ObjectHandle::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 DisplayWindowWindows::_maxMSAALevel() const
|
||||||
|
{
|
||||||
|
return FunctionWrapper::maxMSAALevel();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user