mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Fix anisotropic filtering.
Fixed #2527 Is anisotropic filtering always ON
This commit is contained in:
parent
14229b93ba
commit
5072ec8ee8
|
@ -34,6 +34,7 @@ void Config::resetToDefaults()
|
||||||
video.threadedVideo = 0;
|
video.threadedVideo = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
texture.anisotropy = 0;
|
||||||
texture.maxAnisotropy = 0;
|
texture.maxAnisotropy = 0;
|
||||||
texture.bilinearMode = BILINEAR_STANDARD;
|
texture.bilinearMode = BILINEAR_STANDARD;
|
||||||
texture.enableHalosRemoval = 0;
|
texture.enableHalosRemoval = 0;
|
||||||
|
|
|
@ -33,8 +33,8 @@ struct Config
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
u32 anisotropy;
|
||||||
u32 maxAnisotropy;
|
u32 maxAnisotropy;
|
||||||
f32 maxAnisotropyF;
|
|
||||||
u32 bilinearMode;
|
u32 bilinearMode;
|
||||||
u32 enableHalosRemoval;
|
u32 enableHalosRemoval;
|
||||||
u32 screenShotFormat;
|
u32 screenShotFormat;
|
||||||
|
|
|
@ -28,6 +28,10 @@ bool DisplayWindow::start()
|
||||||
m_maxMsaa = gfxContext.getMaxMSAALevel();
|
m_maxMsaa = gfxContext.getMaxMSAALevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_maxAnisotropy == 0) {
|
||||||
|
m_maxAnisotropy = static_cast<u32>(gfxContext.getMaxAnisotropy());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,3 +208,8 @@ u32 DisplayWindow::maxMSAALevel() const
|
||||||
{
|
{
|
||||||
return m_maxMsaa;
|
return m_maxMsaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 DisplayWindow::maxAnisotropy() const
|
||||||
|
{
|
||||||
|
return m_maxAnisotropy;
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
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;
|
u32 maxMSAALevel() const;
|
||||||
|
u32 maxAnisotropy() const;
|
||||||
|
|
||||||
void updateScale();
|
void updateScale();
|
||||||
f32 getScaleX() const { return m_scaleX; }
|
f32 getScaleX() const { return m_scaleX; }
|
||||||
|
@ -63,6 +64,7 @@ protected:
|
||||||
u32 m_resizeWidth = 0;
|
u32 m_resizeWidth = 0;
|
||||||
u32 m_resizeHeight = 0;
|
u32 m_resizeHeight = 0;
|
||||||
u32 m_maxMsaa = 0;
|
u32 m_maxMsaa = 0;
|
||||||
|
u32 m_maxAnisotropy = 0;
|
||||||
f32 m_scaleX = 0.0f;
|
f32 m_scaleX = 0.0f;
|
||||||
f32 m_scaleY = 0.0f;
|
f32 m_scaleY = 0.0f;
|
||||||
f32 m_adjustScale = 1.0f;
|
f32 m_adjustScale = 1.0f;
|
||||||
|
|
|
@ -45,6 +45,16 @@ uint32_t CConfigDlg::getMSAALevel() const {
|
||||||
return m_maxMSAALevel;
|
return m_maxMSAALevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigDlg::setMaxAnisotropy(uint32_t _maxAnisotropy)
|
||||||
|
{
|
||||||
|
m_maxAnisotropy = _maxAnisotropy;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CConfigDlg::getMaxAnisotropy() const
|
||||||
|
{
|
||||||
|
return m_maxAnisotropy;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
void setRomName(const char * RomName);
|
void setRomName(const char * RomName);
|
||||||
void setMSAALevel(uint32_t _maxMSAALevel);
|
void setMSAALevel(uint32_t _maxMSAALevel);
|
||||||
uint32_t getMSAALevel() const;
|
uint32_t getMSAALevel() const;
|
||||||
|
void setMaxAnisotropy(uint32_t _maxAnisotropy);
|
||||||
|
uint32_t getMaxAnisotropy() 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);
|
||||||
|
@ -65,6 +67,7 @@ protected:
|
||||||
std::string m_strIniPath;
|
std::string m_strIniPath;
|
||||||
const char * m_romName;
|
const char * m_romName;
|
||||||
uint32_t m_maxMSAALevel;
|
uint32_t m_maxMSAALevel;
|
||||||
|
uint32_t m_maxAnisotropy;
|
||||||
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, unsigned int _maxMSAALevel, bool & _accepted)
|
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy, 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);
|
||||||
|
@ -34,27 +34,28 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsign
|
||||||
Dlg.setIniPath(IniFolder.c_str());
|
Dlg.setIniPath(IniFolder.c_str());
|
||||||
Dlg.setRomName(_romName);
|
Dlg.setRomName(_romName);
|
||||||
Dlg.setMSAALevel(_maxMSAALevel);
|
Dlg.setMSAALevel(_maxMSAALevel);
|
||||||
|
Dlg.setMaxAnisotropy(_maxAnisotropy);
|
||||||
Dlg.DoModal();
|
Dlg.DoModal();
|
||||||
_accepted = Dlg.Saved();
|
_accepted = Dlg.Saved();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel)
|
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
|
||||||
{
|
{
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
#ifdef RUN_DIALOG_IN_THREAD
|
#ifdef RUN_DIALOG_IN_THREAD
|
||||||
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||||
configThread.join();
|
configThread.join();
|
||||||
#else
|
#else
|
||||||
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
openConfigDialog(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy, accepted);
|
||||||
#endif
|
#endif
|
||||||
return accepted;
|
return accepted;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel)
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
|
||||||
{
|
{
|
||||||
return runConfigThread(_strFileName, _romName, _maxMSAALevel);
|
return runConfigThread(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy);
|
||||||
}
|
}
|
||||||
|
|
||||||
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, unsigned int _maxMSAALevel);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
||||||
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);
|
||||||
|
|
|
@ -35,6 +35,7 @@ void _loadSettings(GlSettings & settings)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
config.texture.anisotropy = settings.value("anisotropy", config.texture.anisotropy).toInt();
|
||||||
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
|
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
|
||||||
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
|
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
|
||||||
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
|
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
|
||||||
|
@ -220,6 +221,7 @@ void writeSettings(const char * _strIniFolder)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
settings.setValue("anisotropy", config.texture.anisotropy);
|
||||||
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
|
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
|
||||||
settings.setValue("bilinearMode", config.texture.bilinearMode);
|
settings.setValue("bilinearMode", config.texture.bilinearMode);
|
||||||
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
|
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
|
||||||
|
@ -423,6 +425,7 @@ void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
WriteCustomSetting(texture, anisotropy);
|
||||||
WriteCustomSetting(texture, maxAnisotropy);
|
WriteCustomSetting(texture, maxAnisotropy);
|
||||||
WriteCustomSetting(texture, bilinearMode);
|
WriteCustomSetting(texture, bilinearMode);
|
||||||
WriteCustomSetting(texture, enableHalosRemoval);
|
WriteCustomSetting(texture, enableHalosRemoval);
|
||||||
|
|
|
@ -449,7 +449,21 @@ void CVideoTab::LoadSettings(bool /*blockCustomSettings*/) {
|
||||||
CButton(GetDlgItem(IDC_NOAA_RADIO)).SetCheck(config.video.multisampling == 0 && config.video.fxaa == 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_NOAA_RADIO)).SetCheck(config.video.multisampling == 0 && config.video.fxaa == 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(config.video.fxaa != 0 && config.video.multisampling == 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_FXAA_RADIO)).SetCheck(config.video.fxaa != 0 && config.video.multisampling == 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
CButton(GetDlgItem(IDC_MSAA_RADIO)).SetCheck(config.video.fxaa == 0 && config.video.multisampling != 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_MSAA_RADIO)).SetCheck(config.video.fxaa == 0 && config.video.multisampling != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
m_AnisotropicSlider.SetPos(config.texture.maxAnisotropy);
|
|
||||||
|
u32 maxAnisotropy = m_Dlg.getMaxAnisotropy();
|
||||||
|
if (maxAnisotropy == 0 && config.texture.maxAnisotropy == 0) {
|
||||||
|
// default value
|
||||||
|
maxAnisotropy = 16;
|
||||||
|
} else if (maxAnisotropy == 0 && config.texture.maxAnisotropy != 0) {
|
||||||
|
// use cached value
|
||||||
|
maxAnisotropy = config.texture.maxAnisotropy;
|
||||||
|
} else {
|
||||||
|
// assign cached value
|
||||||
|
config.texture.maxAnisotropy = maxAnisotropy;
|
||||||
|
}
|
||||||
|
const u32 anisotropy = min(config.texture.anisotropy, maxAnisotropy);
|
||||||
|
m_AnisotropicSlider.SetRangeMax(maxAnisotropy);
|
||||||
|
m_AnisotropicSlider.SetPos(anisotropy);
|
||||||
CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str());
|
CWindow(GetDlgItem(IDC_ANISOTROPIC_LABEL)).SetWindowTextW(FormatStrW(L"%dx", m_AnisotropicSlider.GetPos()).c_str());
|
||||||
|
|
||||||
CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).SetCheck(config.video.verticalSync != 0 ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_CHK_VERTICAL_SYNC)).SetCheck(config.video.verticalSync != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
@ -540,7 +554,7 @@ void CVideoTab::SaveSettings()
|
||||||
&& CComboBox(m_FrameBufferTab.GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel() != 0) {
|
&& CComboBox(m_FrameBufferTab.GetDlgItem(IDC_CMB_N64_DEPTH_COMPARE)).GetCurSel() != 0) {
|
||||||
config.video.fxaa = 1;
|
config.video.fxaa = 1;
|
||||||
}
|
}
|
||||||
config.texture.maxAnisotropy = m_AnisotropicSlider.GetPos();
|
config.texture.anisotropy = m_AnisotropicSlider.GetPos();
|
||||||
|
|
||||||
if (CButton(GetDlgItem(IDC_BILINEAR_3POINT)).GetCheck() == BST_CHECKED)
|
if (CButton(GetDlgItem(IDC_BILINEAR_3POINT)).GetCheck() == BST_CHECKED)
|
||||||
config.texture.bilinearMode = BILINEAR_3POINT;
|
config.texture.bilinearMode = BILINEAR_3POINT;
|
||||||
|
|
|
@ -182,15 +182,27 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
||||||
// assign cached value
|
// assign cached value
|
||||||
config.video.maxMultiSampling = m_maxMSAA;
|
config.video.maxMultiSampling = m_maxMSAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned int multisampling = std::min(config.video.multisampling, m_maxMSAA);
|
const unsigned int multisampling = std::min(config.video.multisampling, m_maxMSAA);
|
||||||
|
|
||||||
|
if (m_maxAnisotropy == 0 && config.texture.maxAnisotropy == 0) {
|
||||||
|
// default value
|
||||||
|
m_maxAnisotropy = 16;
|
||||||
|
} else if (m_maxAnisotropy == 0 && config.texture.maxAnisotropy != 0) {
|
||||||
|
// use cached value
|
||||||
|
m_maxAnisotropy = config.texture.maxAnisotropy;
|
||||||
|
} else {
|
||||||
|
// assign cached value
|
||||||
|
config.texture.maxAnisotropy = m_maxAnisotropy;
|
||||||
|
}
|
||||||
|
const unsigned int anisotropy = std::min(config.texture.anisotropy, m_maxAnisotropy);
|
||||||
|
|
||||||
ui->aliasingSlider->blockSignals(true);
|
ui->aliasingSlider->blockSignals(true);
|
||||||
ui->aliasingSlider->setMaximum(powof(m_maxMSAA));
|
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));
|
||||||
ui->anisotropicSlider->setValue(config.texture.maxAnisotropy);
|
ui->anisotropicSlider->setMaximum(m_maxAnisotropy);
|
||||||
|
ui->anisotropicSlider->setValue(anisotropy);
|
||||||
ui->vSyncCheckBox->setChecked(config.video.verticalSync != 0);
|
ui->vSyncCheckBox->setChecked(config.video.verticalSync != 0);
|
||||||
ui->threadedVideoCheckBox->setChecked(config.video.threadedVideo != 0);
|
ui->threadedVideoCheckBox->setChecked(config.video.threadedVideo != 0);
|
||||||
|
|
||||||
|
@ -487,13 +499,14 @@ 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, unsigned int _maxMsaaLevel) :
|
ConfigDialog::ConfigDialog(QWidget *parent, Qt::WindowFlags f, unsigned int _maxMsaaLevel, unsigned int _maxAnisotropy) :
|
||||||
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),
|
||||||
|
m_maxMSAA(_maxMsaaLevel),
|
||||||
|
m_maxAnisotropy(_maxAnisotropy)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
_init();
|
_init();
|
||||||
|
@ -528,7 +541,7 @@ void ConfigDialog::accept(bool justSave) {
|
||||||
|| ui->noaaRadioButton->isChecked()
|
|| ui->noaaRadioButton->isChecked()
|
||||||
) ? 0
|
) ? 0
|
||||||
: pow2(ui->aliasingSlider->value());
|
: pow2(ui->aliasingSlider->value());
|
||||||
config.texture.maxAnisotropy = ui->anisotropicSlider->value();
|
config.texture.anisotropy = ui->anisotropicSlider->value();
|
||||||
|
|
||||||
if (ui->blnrStandardRadioButton->isChecked())
|
if (ui->blnrStandardRadioButton->isChecked())
|
||||||
config.texture.bilinearMode = BILINEAR_STANDARD;
|
config.texture.bilinearMode = BILINEAR_STANDARD;
|
||||||
|
|
|
@ -15,7 +15,10 @@ class ConfigDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags(), unsigned int _maxMsaaLevel = 8);
|
explicit ConfigDialog(QWidget *parent = Q_NULLPTR,
|
||||||
|
Qt::WindowFlags f = Qt::WindowFlags(),
|
||||||
|
unsigned int _maxMsaaLevel = 8,
|
||||||
|
unsigned int _maxAnisotropy = 16);
|
||||||
~ConfigDialog();
|
~ConfigDialog();
|
||||||
|
|
||||||
void setIniPath(const QString & _strIniPath);
|
void setIniPath(const QString & _strIniPath);
|
||||||
|
@ -98,6 +101,7 @@ private:
|
||||||
QString m_strIniPath;
|
QString m_strIniPath;
|
||||||
const char * m_romName;
|
const char * m_romName;
|
||||||
unsigned int m_maxMSAA;
|
unsigned int m_maxMSAA;
|
||||||
|
unsigned int m_maxAnisotropy;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIGDIALOG_H
|
#endif // CONFIGDIALOG_H
|
||||||
|
|
|
@ -18,7 +18,8 @@ void Config_DoConfig(/*HWND hParent*/)
|
||||||
|
|
||||||
ConfigOpen = true;
|
ConfigOpen = true;
|
||||||
const u32 maxMsaa = dwnd().maxMSAALevel();
|
const u32 maxMsaa = dwnd().maxMSAALevel();
|
||||||
const bool bRestart = RunConfig(strIniFolderPath, api().isRomOpen() ? RSP.romname : nullptr, maxMsaa);
|
const u32 maxAnisotropy = dwnd().maxAnisotropy();
|
||||||
|
const bool bRestart = RunConfig(strIniFolderPath, api().isRomOpen() ? RSP.romname : nullptr, maxMsaa, maxAnisotropy);
|
||||||
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, unsigned int _maxMSAALevel, bool & _accepted)
|
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, float _maxAnisotropy, bool & _accepted)
|
||||||
{
|
{
|
||||||
cleanMyResource();
|
cleanMyResource();
|
||||||
initMyResource();
|
initMyResource();
|
||||||
|
@ -43,7 +43,7 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsign
|
||||||
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, _maxMSAALevel);
|
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint, _maxMSAALevel, _maxAnisotropy);
|
||||||
|
|
||||||
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, unsigned int _maxMSAALevel) {
|
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy) {
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
#ifdef RUN_DIALOG_IN_THREAD
|
#ifdef RUN_DIALOG_IN_THREAD
|
||||||
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||||
configThread.join();
|
configThread.join();
|
||||||
#else
|
#else
|
||||||
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
openConfigDialog(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy, 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, unsigned int _maxMSAALevel)
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
|
||||||
{
|
{
|
||||||
return runConfigThread(_strFileName, _romName, _maxMSAALevel);
|
return runConfigThread(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy);
|
||||||
}
|
}
|
||||||
|
|
||||||
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, unsigned int _maxMSAALevel);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
||||||
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);
|
||||||
|
|
|
@ -34,6 +34,7 @@ void _loadSettings(QSettings & settings)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
config.texture.anisotropy = settings.value("anisotropy", config.texture.anisotropy).toInt();
|
||||||
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
|
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
|
||||||
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
|
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
|
||||||
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
|
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
|
||||||
|
@ -220,6 +221,7 @@ void writeSettings(const QString & _strIniFolder)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
settings.setValue("anisotropy", config.texture.anisotropy);
|
||||||
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
|
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
|
||||||
settings.setValue("bilinearMode", config.texture.bilinearMode);
|
settings.setValue("bilinearMode", config.texture.bilinearMode);
|
||||||
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
|
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
|
||||||
|
@ -424,6 +426,7 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("texture");
|
settings.beginGroup("texture");
|
||||||
|
WriteCustomSetting(texture, anisotropy);
|
||||||
WriteCustomSetting(texture, maxAnisotropy);
|
WriteCustomSetting(texture, maxAnisotropy);
|
||||||
WriteCustomSetting(texture, bilinearMode);
|
WriteCustomSetting(texture, bilinearMode);
|
||||||
WriteCustomSetting(texture, enableHalosRemoval);
|
WriteCustomSetting(texture, enableHalosRemoval);
|
||||||
|
|
|
@ -174,6 +174,11 @@ s32 Context::getMaxTextureSize() const
|
||||||
return m_impl->getMaxTextureSize();
|
return m_impl->getMaxTextureSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f32 Context::getMaxAnisotropy() const
|
||||||
|
{
|
||||||
|
return m_impl->getMaxAnisotropy();
|
||||||
|
}
|
||||||
|
|
||||||
void Context::bindImageTexture(const BindImageTextureParameters & _params)
|
void Context::bindImageTexture(const BindImageTextureParameters & _params)
|
||||||
{
|
{
|
||||||
m_impl->bindImageTexture(_params);
|
m_impl->bindImageTexture(_params);
|
||||||
|
|
|
@ -148,6 +148,8 @@ namespace graphics {
|
||||||
|
|
||||||
s32 getMaxTextureSize() const;
|
s32 getMaxTextureSize() const;
|
||||||
|
|
||||||
|
f32 getMaxAnisotropy() const;
|
||||||
|
|
||||||
struct BindImageTextureParameters {
|
struct BindImageTextureParameters {
|
||||||
ImageUnitParam imageUnit;
|
ImageUnitParam imageUnit;
|
||||||
ObjectHandle texture;
|
ObjectHandle texture;
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace graphics {
|
||||||
virtual void setTextureUnpackAlignment(s32 _param) = 0;
|
virtual void setTextureUnpackAlignment(s32 _param) = 0;
|
||||||
virtual s32 getTextureUnpackAlignment() const = 0;
|
virtual s32 getTextureUnpackAlignment() const = 0;
|
||||||
virtual s32 getMaxTextureSize() const = 0;
|
virtual s32 getMaxTextureSize() const = 0;
|
||||||
|
virtual f32 getMaxAnisotropy() const = 0;
|
||||||
virtual void bindImageTexture(const Context::BindImageTextureParameters & _params) = 0;
|
virtual void bindImageTexture(const Context::BindImageTextureParameters & _params) = 0;
|
||||||
virtual u32 convertInternalTextureFormat(u32 _format) const = 0;
|
virtual u32 convertInternalTextureFormat(u32 _format) const = 0;
|
||||||
virtual void textureBarrier() = 0;
|
virtual void textureBarrier() = 0;
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
#include "GLSL/glsl_SpecialShadersFactory.h"
|
#include "GLSL/glsl_SpecialShadersFactory.h"
|
||||||
#include "GLSL/glsl_ShaderStorage.h"
|
#include "GLSL/glsl_ShaderStorage.h"
|
||||||
|
|
||||||
|
#ifndef GL_EXT_texture_filter_anisotropic
|
||||||
|
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef OS_ANDROID
|
#ifdef OS_ANDROID
|
||||||
#include <Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h>
|
#include <Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -269,6 +273,13 @@ s32 ContextImpl::getMaxTextureSize() const
|
||||||
return maxTextureSize;
|
return maxTextureSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f32 ContextImpl::getMaxAnisotropy() const
|
||||||
|
{
|
||||||
|
GLfloat maxInisotropy = 0.0f;
|
||||||
|
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxInisotropy);
|
||||||
|
return maxInisotropy;
|
||||||
|
}
|
||||||
|
|
||||||
void ContextImpl::bindImageTexture(const graphics::Context::BindImageTextureParameters & _params)
|
void ContextImpl::bindImageTexture(const graphics::Context::BindImageTextureParameters & _params)
|
||||||
{
|
{
|
||||||
glBindImageTexture(GLuint(_params.imageUnit), GLuint(_params.texture), 0, GL_FALSE, 0, GLenum(_params.accessMode), GLenum(_params.textureFormat));
|
glBindImageTexture(GLuint(_params.imageUnit), GLuint(_params.texture), 0, GL_FALSE, 0, GLenum(_params.accessMode), GLenum(_params.textureFormat));
|
||||||
|
|
|
@ -74,6 +74,8 @@ namespace opengl {
|
||||||
|
|
||||||
s32 getMaxTextureSize() const override;
|
s32 getMaxTextureSize() const override;
|
||||||
|
|
||||||
|
f32 getMaxAnisotropy() const override;
|
||||||
|
|
||||||
void bindImageTexture(const graphics::Context::BindImageTextureParameters & _params) override;
|
void bindImageTexture(const graphics::Context::BindImageTextureParameters & _params) override;
|
||||||
|
|
||||||
u32 convertInternalTextureFormat(u32 _format) const override;
|
u32 convertInternalTextureFormat(u32 _format) const override;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#ifndef GL_EXT_texture_filter_anisotropic
|
#ifndef GL_EXT_texture_filter_anisotropic
|
||||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace opengl {
|
namespace opengl {
|
||||||
|
@ -295,8 +294,8 @@ namespace opengl {
|
||||||
(*m_texparams)[u32(_parameters.handle)].maxMipmapLevel = GLint(_parameters.maxMipmapLevel);
|
(*m_texparams)[u32(_parameters.handle)].maxMipmapLevel = GLint(_parameters.maxMipmapLevel);
|
||||||
}
|
}
|
||||||
if (_parameters.maxAnisotropy.isValid() && !(iterValid && iter->second.maxAnisotropy == GLfloat(_parameters.maxAnisotropy))) {
|
if (_parameters.maxAnisotropy.isValid() && !(iterValid && iter->second.maxAnisotropy == GLfloat(_parameters.maxAnisotropy))) {
|
||||||
glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, GLfloat(_parameters.maxMipmapLevel));
|
glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, GLfloat(_parameters.maxAnisotropy));
|
||||||
(*m_texparams)[u32(_parameters.handle)].maxAnisotropy = GLfloat(_parameters.maxMipmapLevel);
|
(*m_texparams)[u32(_parameters.handle)].maxAnisotropy = GLfloat(_parameters.maxAnisotropy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1404,11 +1404,11 @@ void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
|
||||||
params.wrapT = _pTexture->clampT ? textureParameters::WRAP_CLAMP_TO_EDGE :
|
params.wrapT = _pTexture->clampT ? textureParameters::WRAP_CLAMP_TO_EDGE :
|
||||||
_pTexture->mirrorT ? textureParameters::WRAP_MIRRORED_REPEAT : textureParameters::WRAP_REPEAT;
|
_pTexture->mirrorT ? textureParameters::WRAP_MIRRORED_REPEAT : textureParameters::WRAP_REPEAT;
|
||||||
|
|
||||||
if (config.texture.maxAnisotropyF > 0.0f) {
|
if (config.texture.anisotropy != 0) {
|
||||||
switch (dwnd().getDrawer().getDrawingState()) {
|
switch (dwnd().getDrawer().getDrawingState()) {
|
||||||
case DrawingState::Triangle:
|
case DrawingState::Triangle:
|
||||||
case DrawingState::ScreenSpaceTriangle:
|
case DrawingState::ScreenSpaceTriangle:
|
||||||
params.maxAnisotropy = Parameter(config.texture.maxAnisotropyF);
|
params.maxAnisotropy = Parameter(static_cast<f32>(config.texture.anisotropy));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -138,7 +138,7 @@ bool Config_SetDefault()
|
||||||
assert(res == M64ERR_SUCCESS);
|
assert(res == M64ERR_SUCCESS);
|
||||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "enableHalosRemoval", config.texture.enableHalosRemoval, "Remove halos around filtered textures.");
|
res = ConfigSetDefaultBool(g_configVideoGliden64, "enableHalosRemoval", config.texture.enableHalosRemoval, "Remove halos around filtered textures.");
|
||||||
assert(res == M64ERR_SUCCESS);
|
assert(res == M64ERR_SUCCESS);
|
||||||
res = ConfigSetDefaultInt(g_configVideoGliden64, "MaxAnisotropy", config.texture.maxAnisotropy, "Max level of Anisotropic Filtering, 0 for off");
|
res = ConfigSetDefaultInt(g_configVideoGliden64, "anisotropy", config.texture.anisotropy, "Max level of Anisotropic Filtering, 0 for off");
|
||||||
assert(res == M64ERR_SUCCESS);
|
assert(res == M64ERR_SUCCESS);
|
||||||
//#Emulation Settings
|
//#Emulation Settings
|
||||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableDitheringPattern", config.generalEmulation.enableDitheringPattern, "Enable dithering pattern on output image.");
|
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableDitheringPattern", config.generalEmulation.enableDitheringPattern, "Enable dithering pattern on output image.");
|
||||||
|
@ -351,8 +351,8 @@ void Config_LoadCustomConfig()
|
||||||
config.video.multisampling = 0;
|
config.video.multisampling = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\maxAnisotropy", value, sizeof(value));
|
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\anisotropy", value, sizeof(value));
|
||||||
if (result == M64ERR_SUCCESS) config.texture.maxAnisotropy = atoi(value);
|
if (result == M64ERR_SUCCESS) config.texture.anisotropy = atoi(value);
|
||||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\bilinearMode", value, sizeof(value));
|
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\bilinearMode", value, sizeof(value));
|
||||||
if (result == M64ERR_SUCCESS) config.texture.bilinearMode = atoi(value);
|
if (result == M64ERR_SUCCESS) config.texture.bilinearMode = atoi(value);
|
||||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\enableHalosRemoval", value, sizeof(value));
|
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\enableHalosRemoval", value, sizeof(value));
|
||||||
|
@ -491,7 +491,7 @@ void Config_LoadConfig()
|
||||||
|
|
||||||
//#Texture Settings
|
//#Texture Settings
|
||||||
config.texture.bilinearMode = ConfigGetParamBool(g_configVideoGliden64, "bilinearMode");
|
config.texture.bilinearMode = ConfigGetParamBool(g_configVideoGliden64, "bilinearMode");
|
||||||
config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy");
|
config.texture.anisotropy = ConfigGetParamInt(g_configVideoGliden64, "anisotropy");
|
||||||
config.texture.enableHalosRemoval = ConfigGetParamBool(g_configVideoGliden64, "enableHalosRemoval");
|
config.texture.enableHalosRemoval = ConfigGetParamBool(g_configVideoGliden64, "enableHalosRemoval");
|
||||||
//#Emulation Settings
|
//#Emulation Settings
|
||||||
config.generalEmulation.enableDitheringPattern = ConfigGetParamBool(g_configVideoGliden64, "EnableDitheringPattern");
|
config.generalEmulation.enableDitheringPattern = ConfigGetParamBool(g_configVideoGliden64, "EnableDitheringPattern");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user