mirror of
https://github.com/simple64/simple64.git
synced 2026-11-17 09:54:02 +01:00
update gliden64
This commit is contained in:
1 parent
1b370daf04
commit
94bc3854d4
62 files changed
+438
-567
No files matched your search
@@ -15,11 +15,14 @@ CombinerKey::CombinerKey(u64 _mux, bool _setModeBits)
|
||||
// [1 - 2] cycle type
|
||||
// [3 - 3] bi_lerp1
|
||||
// [4 - 4] bi_lerp0
|
||||
// [5 - 5] is HWL supported
|
||||
u32 flags = CombinerInfo::get().isRectMode() ? 1U : 0U;
|
||||
const u32 cycleType = gDP.otherMode.cycleType;
|
||||
const u32 bilerp = (gDP.otherMode.h >> 10) & 3;
|
||||
const u32 isHWLSupported = static_cast<u32>(GBI.isHWLSupported());
|
||||
flags |= (cycleType << 1);
|
||||
flags |= (bilerp << 3);
|
||||
flags |= (isHWLSupported << 5);
|
||||
|
||||
m_key.muxs0 |= (flags << 24);
|
||||
}
|
||||
@@ -64,6 +67,11 @@ bool CombinerKey::isRectKey() const
|
||||
return ((m_key.muxs0 >> 24) & 1) != 0;
|
||||
}
|
||||
|
||||
bool CombinerKey::isHWLSupported() const
|
||||
{
|
||||
return ((m_key.muxs0 >> 29) & 1) != 0;
|
||||
}
|
||||
|
||||
void CombinerKey::read(std::istream & _is)
|
||||
{
|
||||
_is.read(reinterpret_cast<char*>(&m_key.mux), sizeof(m_key.mux));
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
|
||||
bool isRectKey() const;
|
||||
|
||||
bool isHWLSupported() const;
|
||||
|
||||
u32 getCycleType() const;
|
||||
|
||||
u32 getBilerp() const;
|
||||
|
||||
@@ -25,6 +25,7 @@ void Config::resetToDefaults()
|
||||
video.fullscreenRefresh = 60;
|
||||
video.fxaa = 0;
|
||||
video.multisampling = 0;
|
||||
video.maxMultiSampling = 0;
|
||||
video.verticalSync = 0;
|
||||
|
||||
#if defined(OS_MAC_OS_X)
|
||||
@@ -44,6 +45,7 @@ void Config::resetToDefaults()
|
||||
generalEmulation.enableDitheringQuantization = 1;
|
||||
generalEmulation.rdramImageDitheringMode = BufferDitheringMode::bdmBlueNoise;
|
||||
generalEmulation.enableHWLighting = 0;
|
||||
generalEmulation.enableCoverage = 1;
|
||||
generalEmulation.enableCustomSettings = 1;
|
||||
generalEmulation.enableShadersStorage = 1;
|
||||
generalEmulation.enableLegacyBlending = 0;
|
||||
@@ -51,7 +53,6 @@ void Config::resetToDefaults()
|
||||
generalEmulation.hacks = 0;
|
||||
#if defined(OS_ANDROID) || defined(OS_IOS)
|
||||
generalEmulation.enableFragmentDepthWrite = 0;
|
||||
generalEmulation.enableBlitScreenWorkaround = 0;
|
||||
generalEmulation.forcePolygonOffset = 0;
|
||||
generalEmulation.polygonOffsetFactor = 0.0f;
|
||||
generalEmulation.polygonOffsetUnits = 0.0f;
|
||||
|
||||
@@ -28,7 +28,7 @@ struct Config
|
||||
u32 windowedWidth, windowedHeight;
|
||||
u32 fullscreenWidth, fullscreenHeight, fullscreenRefresh;
|
||||
u32 fxaa;
|
||||
u32 multisampling;
|
||||
u32 multisampling, maxMultiSampling;
|
||||
u32 verticalSync;
|
||||
u32 threadedVideo;
|
||||
} video;
|
||||
@@ -62,12 +62,12 @@ struct Config
|
||||
u32 rdramImageDitheringMode;
|
||||
u32 enableLOD;
|
||||
u32 enableHWLighting;
|
||||
u32 enableCoverage;
|
||||
u32 enableCustomSettings;
|
||||
u32 enableShadersStorage;
|
||||
u32 enableLegacyBlending;
|
||||
u32 enableHybridFilter;
|
||||
u32 enableFragmentDepthWrite;
|
||||
u32 enableBlitScreenWorkaround;
|
||||
u32 hacks;
|
||||
#if defined(OS_ANDROID) || defined(OS_IOS)
|
||||
u32 forcePolygonOffset;
|
||||
|
||||
@@ -19,6 +19,11 @@ bool DisplayWindow::start()
|
||||
m_drawer._initData();
|
||||
m_buffersSwapCount = 0;
|
||||
|
||||
// only query max MSAA when needed
|
||||
if (m_maxMsaa == 0) {
|
||||
m_maxMsaa = gfxContext.getMaxMSAALevel();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -190,3 +195,8 @@ void DisplayWindow::readScreen2(void * _dest, int * _width, int * _height, int _
|
||||
{
|
||||
_readScreen2(_dest, _width, _height, _front);
|
||||
}
|
||||
|
||||
u32 DisplayWindow::maxMSAALevel() const
|
||||
{
|
||||
return m_maxMsaa;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
void setToggleFullscreen() { m_bToggleFullscreen = true; }
|
||||
void readScreen(void **_pDest, long *_pWidth, long *_pHeight);
|
||||
void readScreen2(void * _dest, int * _width, int * _height, int _front);
|
||||
u32 maxMSAALevel() const;
|
||||
|
||||
void updateScale();
|
||||
f32 getScaleX() const { return m_scaleX; }
|
||||
@@ -61,6 +62,7 @@ protected:
|
||||
u32 m_screenRefresh = 0;
|
||||
u32 m_resizeWidth = 0;
|
||||
u32 m_resizeHeight = 0;
|
||||
u32 m_maxMsaa = 0;
|
||||
f32 m_scaleX = 0;
|
||||
f32 m_scaleY = 0;
|
||||
f32 m_adjustScale = 0;
|
||||
@@ -81,6 +83,7 @@ private:
|
||||
virtual void _readScreen(void **_pDest, long *_pWidth, long *_pHeight) = 0;
|
||||
virtual void _readScreen2(void * _dest, int * _width, int * _height, int _front) = 0;
|
||||
virtual graphics::ObjectHandle _getDefaultFramebuffer() = 0;
|
||||
|
||||
};
|
||||
|
||||
inline
|
||||
|
||||
@@ -37,6 +37,14 @@ void CConfigDlg::setRomName(const char * 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*/) {
|
||||
HICON hIcon = AtlLoadIconImage(IDI_APPICON, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
|
||||
SetIcon(hIcon, TRUE);
|
||||
@@ -221,7 +229,7 @@ void CConfigDlg::SaveSettings() {
|
||||
m_Saved = true;
|
||||
for (size_t i = 0; i < m_TabWindows.size(); i++)
|
||||
m_TabWindows[i]->SaveSettings();
|
||||
|
||||
|
||||
if (config.generalEmulation.enableCustomSettings && CButton(GetDlgItem(IDC_GAME_PROFILE)).GetCheck() == BST_CHECKED && m_romName != nullptr)
|
||||
saveCustomRomSettings(m_strIniPath.c_str(), m_romName);
|
||||
else
|
||||
@@ -390,7 +398,7 @@ void CConfigDlg::SetLanguage(const std::string & language) {
|
||||
m_Tabs.SetItem(i, &tci);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < m_TabWindows.size(); i++)
|
||||
for (size_t i = 0; i < m_TabWindows.size(); i++)
|
||||
m_TabWindows[i]->ApplyLanguage();
|
||||
ApplyLanguage();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
COMMAND_HANDLER(IDC_PROFILE, CBN_SELCHANGE, OnProfileChanged)
|
||||
COMMAND_HANDLER_EX(IDC_GAME_PROFILE, BN_CLICKED, OnGameProfile)
|
||||
COMMAND_HANDLER_EX(IDC_USE_PROFILE, BN_CLICKED, OnUseProfile)
|
||||
COMMAND_ID_HANDLER(IDC_REMOVE_PROFILE, OnRemoveProfile)
|
||||
COMMAND_ID_HANDLER(IDC_REMOVE_PROFILE, OnRemoveProfile)
|
||||
COMMAND_ID_HANDLER(ID_RESTORE_DEFAULTS, OnRestoreDefaults)
|
||||
COMMAND_ID_HANDLER(ID_SAVECLOSE, OnSaveClose)
|
||||
COMMAND_ID_HANDLER(ID_SAVE, OnSave)
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
|
||||
void setIniPath(const std::string & IniPath);
|
||||
void setRomName(const char * RomName);
|
||||
void setMSAALevel(uint32_t _maxMSAALevel);
|
||||
uint32_t getMSAALevel() const;
|
||||
bool Saved(void) const { return m_Saved; }
|
||||
void OnCustomSettingsToggled(bool checked);
|
||||
void SetLanguage(const std::string & language);
|
||||
@@ -62,6 +64,7 @@ protected:
|
||||
std::vector<CConfigTab *> m_TabWindows;
|
||||
std::string m_strIniPath;
|
||||
const char * m_romName;
|
||||
uint32_t m_maxMSAALevel;
|
||||
bool m_blockReInit;
|
||||
CFrameBufferTab * m_FrameBufferTab;
|
||||
CVideoTab * m_VideoTab;
|
||||
|
||||
@@ -16,7 +16,7 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
//#define RUN_DIALOG_IN_THREAD
|
||||
|
||||
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;
|
||||
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;
|
||||
Dlg.setIniPath(IniFolder.c_str());
|
||||
Dlg.setRomName(_romName);
|
||||
Dlg.setMSAALevel(_maxMSAALevel);
|
||||
Dlg.DoModal();
|
||||
_accepted = Dlg.Saved();
|
||||
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;
|
||||
#ifdef RUN_DIALOG_IN_THREAD
|
||||
std::thread configThread(openConfigDialog, _strFileName, std::ref(accepted));
|
||||
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||
configThread.join();
|
||||
#else
|
||||
openConfigDialog(_strFileName, _romName, accepted);
|
||||
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
||||
#endif
|
||||
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)
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
#define CALL
|
||||
#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 void CALL LoadConfig(const wchar_t * _strFileName);
|
||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||
|
||||
Binary file not shown.
@@ -84,6 +84,8 @@ void LoadDefaultStrings(void)
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_N64_STYLE_MIP_MAPPING_TOOLTIP, "The N64 uses a unique method of mip-mapping that's difficult to reproduce correctly on PCs. When checked, this option emulates N64-accurate mip-mapping. When unchecked, some games have sharper distant textures.\n\n[Recommended: Checked]"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_HWLIGHTING, "Enable per-pixel lighting (better quality, HLE only)"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_HWLIGHTING_TOOLTIP, "In N64 games lighting is calculated per vertex. This option enables Phong shading, which provides smoother and more realistic lighting.\n\n[Recommended: Your preference]"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_PIXEL_COVERAGE, "Enable pixel coverage calculation"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_PIXEL_COVERAGE_TOOLTIP, "Enables approximated pixel coverage calculation. N64 uses pixel coverage for anti-aliasing and in some special blending modes. Some games have wire-frame mode aka 'pen and ink' mode. This mode also needs pixel coverage calculated.\n\n[Recommended: Checked, unless performance is hurt]"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_SHADERS_STORAGE, "Store compiled shaders for performance (recommended)"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_SHADERS_STORAGE_TOOLTIP, "Use persistent storage for compiled shader programs.\nEach game uses a set of combiners. A combiner is an equation that defines how to build output color from various color inputs. GLideN64 translates shaders, and compiles shader programs on the fly. Shaders are large and complex. If the game uses several new combiners, compiling new shaders will take time and result in stuttering. When this option is checked, these shaders are saved so they're not recompiled the next time you run the game.\n\n[Recommended: Checked]"));
|
||||
g_defaultStrings.insert(LANG_STRINGS::value_type(EMULATION_INTERNAL_RES, "Internal resolution"));
|
||||
|
||||
@@ -118,6 +118,8 @@ enum languageStringID
|
||||
EMULATION_BACKGROUND_TOOLTIP = 3030,
|
||||
EMULATION_ONE_PIECE = 3031,
|
||||
EMULATION_STRIPPED = 3032,
|
||||
EMULATION_PIXEL_COVERAGE = 3033,
|
||||
EMULATION_PIXEL_COVERAGE_TOOLTIP = 3034,
|
||||
|
||||
/*********************************************************************************
|
||||
* Frame Buffer Tab *
|
||||
|
||||
@@ -28,6 +28,7 @@ void _loadSettings(GlSettings & settings)
|
||||
config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt();
|
||||
config.video.fullscreenRefresh = settings.value("fullscreenRefresh", config.video.fullscreenRefresh).toInt();
|
||||
config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt();
|
||||
config.video.maxMultiSampling = settings.value("maxMultiSampling", config.video.maxMultiSampling).toInt();
|
||||
config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt();
|
||||
config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt();
|
||||
config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt();
|
||||
@@ -47,6 +48,7 @@ void _loadSettings(GlSettings & settings)
|
||||
config.generalEmulation.rdramImageDitheringMode = settings.value("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode).toInt();
|
||||
config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt();
|
||||
config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt();
|
||||
config.generalEmulation.enableCoverage = settings.value("enableCoverage", config.generalEmulation.enableCoverage).toInt();
|
||||
config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt();
|
||||
config.generalEmulation.enableLegacyBlending = settings.value("enableLegacyBlending", config.generalEmulation.enableLegacyBlending).toInt(); //ini only
|
||||
config.generalEmulation.enableHybridFilter = settings.value("enableHybridFilter", config.generalEmulation.enableHybridFilter).toInt(); //ini only
|
||||
@@ -101,8 +103,8 @@ void _loadSettings(GlSettings & settings)
|
||||
config.textureFilter.txEnhancedTextureFileStorage = settings.value("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage).toInt();
|
||||
config.textureFilter.txHiresTextureFileStorage = settings.value("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage).toInt();
|
||||
wcscpy_s(config.textureFilter.txPath, ToUTF16(settings.value("txPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txCachePath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txDumpPath).c_str()).toString().c_str()).c_str());
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("font");
|
||||
@@ -210,6 +212,7 @@ void writeSettings(const char * _strIniFolder)
|
||||
settings.setValue("windowedHeight", config.video.windowedHeight);
|
||||
settings.setValue("fullscreenRefresh", config.video.fullscreenRefresh);
|
||||
settings.setValue("multisampling", config.video.multisampling);
|
||||
settings.setValue("maxMultiSampling", config.video.maxMultiSampling);
|
||||
settings.setValue("fxaa", config.video.fxaa);
|
||||
settings.setValue("verticalSync", config.video.verticalSync);
|
||||
settings.setValue("threadedVideo", config.video.threadedVideo);
|
||||
@@ -229,6 +232,7 @@ void writeSettings(const char * _strIniFolder)
|
||||
settings.setValue("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode);
|
||||
settings.setValue("enableLOD", config.generalEmulation.enableLOD);
|
||||
settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting);
|
||||
settings.setValue("enableCoverage", config.generalEmulation.enableCoverage);
|
||||
settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage);
|
||||
settings.setValue("enableLegacyBlending", config.generalEmulation.enableLegacyBlending); //ini only
|
||||
settings.setValue("enableHybridFilter", config.generalEmulation.enableHybridFilter); //ini only
|
||||
@@ -397,8 +401,8 @@ void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
|
||||
origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \
|
||||
settings.setValue(#S, config.G.S)
|
||||
#define WriteCustomSettingS(S) \
|
||||
const std::string new##S = FromUTF16(config.textureFilter.txPath); \
|
||||
const std::string orig##S = FromUTF16(origConfig.textureFilter.txPath); \
|
||||
const std::string new##S = FromUTF16(config.textureFilter.S); \
|
||||
const std::string orig##S = FromUTF16(origConfig.textureFilter.S); \
|
||||
if (orig##S != new##S || \
|
||||
orig##S != settings.value(#S, new##S.c_str()).toString()) \
|
||||
settings.setValue(#S, new##S.c_str())
|
||||
@@ -430,6 +434,7 @@ void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
|
||||
WriteCustomSetting(generalEmulation, rdramImageDitheringMode);
|
||||
WriteCustomSetting(generalEmulation, enableLOD);
|
||||
WriteCustomSetting(generalEmulation, enableHWLighting);
|
||||
WriteCustomSetting(generalEmulation, enableCoverage);
|
||||
WriteCustomSetting(generalEmulation, enableShadersStorage);
|
||||
settings.endGroup();
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ void CEmulationTab::ApplyLanguage(void)
|
||||
SetDlgItemTextW(IDC_CHK_USE_PER_GAME, wGS(EMULATION_USE_PER_GAME).c_str());
|
||||
SetDlgItemTextW(IDC_CHK_N64_STYLE_MIP_MAPPING, wGS(EMULATION_N64_STYLE_MIP_MAPPING).c_str());
|
||||
SetDlgItemTextW(IDC_CHK_HWLIGHTING, wGS(EMULATION_HWLIGHTING).c_str());
|
||||
SetDlgItemTextW(IDC_CHK_PIXEL_COVERAGE, wGS(EMULATION_PIXEL_COVERAGE).c_str());
|
||||
SetDlgItemTextW(IDC_CHK_SHADERS_STORAGE, wGS(EMULATION_SHADERS_STORAGE).c_str());
|
||||
SetDlgItemTextW(IDC_INTERNAL_RES_GROUP, wGS(EMULATION_INTERNAL_RES).c_str());
|
||||
SetDlgItemTextW(IDC_FACTOR0X_RADIO, wGS(EMULATION_FACTOR0X).c_str());
|
||||
@@ -95,6 +96,8 @@ void CEmulationTab::ApplyLanguage(void)
|
||||
TTSetTxt(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING), tooltip.c_str());
|
||||
tooltip = wGS(EMULATION_HWLIGHTING_TOOLTIP);
|
||||
TTSetTxt(GetDlgItem(IDC_CHK_HWLIGHTING), tooltip.c_str());
|
||||
tooltip = wGS(EMULATION_PIXEL_COVERAGE_TOOLTIP);
|
||||
TTSetTxt(GetDlgItem(IDC_CHK_PIXEL_COVERAGE), tooltip.c_str());
|
||||
tooltip = wGS(EMULATION_SHADERS_STORAGE_TOOLTIP);
|
||||
TTSetTxt(GetDlgItem(IDC_CHK_SHADERS_STORAGE), tooltip.c_str());
|
||||
tooltip = wGS(EMULATION_INTERNAL_RES_TOOLTIP);
|
||||
@@ -136,6 +139,7 @@ void CEmulationTab::LoadSettings(bool blockCustomSettings)
|
||||
}
|
||||
CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).SetCheck(config.generalEmulation.enableLOD != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).SetCheck(config.generalEmulation.enableHWLighting != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
CButton(GetDlgItem(IDC_CHK_PIXEL_COVERAGE)).SetCheck(config.generalEmulation.enableCoverage != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).SetCheck(config.generalEmulation.enableShadersStorage != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CButton(GetDlgItem(IDC_CHK_HALOS_REMOVAL)).SetCheck(config.texture.enableHalosRemoval != 0 ? BST_CHECKED : BST_UNCHECKED);
|
||||
@@ -168,6 +172,7 @@ void CEmulationTab::SaveSettings()
|
||||
config.generalEmulation.enableCustomSettings = CButton(GetDlgItem(IDC_CHK_USE_PER_GAME)).GetCheck() == BST_CHECKED ? 1 : 0;
|
||||
config.generalEmulation.enableLOD = CButton(GetDlgItem(IDC_CHK_N64_STYLE_MIP_MAPPING)).GetCheck() == BST_CHECKED ? 1 : 0;
|
||||
config.generalEmulation.enableHWLighting = CButton(GetDlgItem(IDC_CHK_HWLIGHTING)).GetCheck() == BST_CHECKED ? 1 : 0;
|
||||
config.generalEmulation.enableCoverage = CButton(GetDlgItem(IDC_CHK_PIXEL_COVERAGE)).GetCheck() == BST_CHECKED ? 1 : 0;
|
||||
config.generalEmulation.enableShadersStorage = CButton(GetDlgItem(IDC_CHK_SHADERS_STORAGE)).GetCheck() == BST_CHECKED ? 1 : 0;
|
||||
|
||||
if (CButton(GetDlgItem(IDC_FACTOR0X_RADIO)).GetCheck() == BST_CHECKED) {
|
||||
|
||||
@@ -205,17 +205,28 @@ void CTextureEnhancementTab::SaveDirectory(int EditCtrl, wchar_t * txPath)
|
||||
int TxtLen = EditWnd.GetWindowTextLength();
|
||||
std::wstring Path;
|
||||
Path.resize(TxtLen + 1);
|
||||
EditWnd.GetWindowText((wchar_t *)Path.data(), static_cast<int>(Path.size()));
|
||||
EditWnd.GetWindowTextW((wchar_t *)Path.data(), static_cast<int>(Path.size()));
|
||||
|
||||
WIN32_FIND_DATA FindData;
|
||||
HANDLE hFindFile = FindFirstFile(Path.c_str(), &FindData);
|
||||
bool exists = (hFindFile != INVALID_HANDLE_VALUE);
|
||||
bool exists = osal_path_existsW(Path.data());
|
||||
|
||||
if (hFindFile != NULL)
|
||||
FindClose(hFindFile);
|
||||
|
||||
if (exists)
|
||||
wcscpy(txPath, Path.c_str());
|
||||
if (!exists) {
|
||||
if (osal_mkdirp(Path.data()) != 0) {
|
||||
switch (EditCtrl) {
|
||||
case IDC_TEX_PACK_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture pack folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
case IDC_TEX_CACHE_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture pack cache folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
case IDC_TEX_DUMP_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture dump folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
wcscpy(txPath, Path.c_str());
|
||||
}
|
||||
|
||||
void CTextureEnhancementTab::SaveSettings()
|
||||
@@ -291,3 +302,4 @@ int CALLBACK CTextureEnhancementTab::SelectDirCallBack(HWND hwnd, uint32_t uMsg,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "config-tab.h"
|
||||
#include "wtl-tooltip.h"
|
||||
#include "resource.h"
|
||||
#include "../osal/osal_files.h"
|
||||
|
||||
class CTextureEnhancementTab :
|
||||
public CConfigTab,
|
||||
|
||||
@@ -412,9 +412,22 @@ void CVideoTab::LoadSettings(bool /*blockCustomSettings*/) {
|
||||
if (fullscreenRate == i)
|
||||
RefreshRateComboBox.SetCurSel(index);
|
||||
}
|
||||
|
||||
u32 maxMSAALevel = m_Dlg.getMSAALevel();
|
||||
if (maxMSAALevel == 0 && config.video.maxMultiSampling == 0) {
|
||||
// default value
|
||||
maxMSAALevel = 8;
|
||||
} else if (maxMSAALevel == 0 && config.video.maxMultiSampling != 0) {
|
||||
// use cached value
|
||||
maxMSAALevel = config.video.maxMultiSampling;
|
||||
} else {
|
||||
// assign cached value
|
||||
config.video.maxMultiSampling = maxMSAALevel;
|
||||
}
|
||||
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
||||
? config.video.multisampling
|
||||
: 8;
|
||||
? min(config.video.multisampling, maxMSAALevel)
|
||||
: maxMSAALevel;
|
||||
m_AliasingSlider.SetRangeMax(powof(maxMSAALevel));
|
||||
m_AliasingSlider.SetPos(powof(multisampling));
|
||||
std::wstring AliasingText = FormatStrW(L"%dx", multisampling);
|
||||
CWindow(GetDlgItem(IDC_ALIASING_LABEL)).SetWindowTextW(AliasingText.c_str());
|
||||
|
||||
Binary file not shown.
@@ -9,6 +9,7 @@
|
||||
#include <QCursor>
|
||||
#include <QRegExpValidator>
|
||||
#include <QInputDialog>
|
||||
#include <QDirIterator>
|
||||
|
||||
#include "../PluginAPI.h"
|
||||
#include "../Config.h"
|
||||
@@ -163,10 +164,23 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
||||
|
||||
ui->fullScreenCheckBox->setChecked(config.video.fullscreen != 0);
|
||||
|
||||
if (m_maxMSAA == 0 && config.video.maxMultiSampling == 0) {
|
||||
// default value
|
||||
m_maxMSAA = 8;
|
||||
} else if (m_maxMSAA == 0 && config.video.maxMultiSampling != 0) {
|
||||
// use cached value
|
||||
m_maxMSAA = config.video.maxMultiSampling;
|
||||
} else {
|
||||
// assign cached value
|
||||
config.video.maxMultiSampling = m_maxMSAA;
|
||||
}
|
||||
|
||||
const unsigned int multisampling = config.video.fxaa == 0 && config.video.multisampling > 0
|
||||
? config.video.multisampling
|
||||
: 8;
|
||||
? std::min(config.video.multisampling, m_maxMSAA)
|
||||
: m_maxMSAA;
|
||||
|
||||
ui->aliasingSlider->blockSignals(true);
|
||||
ui->aliasingSlider->setMaximum(powof(m_maxMSAA));
|
||||
ui->aliasingSlider->setValue(powof(multisampling));
|
||||
ui->aliasingSlider->blockSignals(false);
|
||||
ui->aliasingLabelVal->setText(QString::number(multisampling));
|
||||
@@ -200,6 +214,7 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
||||
// Emulation settings
|
||||
ui->emulateLodCheckBox->setChecked(config.generalEmulation.enableLOD != 0);
|
||||
ui->enableHWLightingCheckBox->setChecked(config.generalEmulation.enableHWLighting != 0);
|
||||
ui->enableCoverageCheckBox->setChecked(config.generalEmulation.enableCoverage != 0);
|
||||
ui->enableShadersStorageCheckBox->setChecked(config.generalEmulation.enableShadersStorage != 0);
|
||||
if (!blockCustomSettings)
|
||||
ui->customSettingsCheckBox->setChecked(config.generalEmulation.enableCustomSettings != 0);
|
||||
@@ -466,9 +481,10 @@ void ConfigDialog::setRomName(const char * _romName)
|
||||
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),
|
||||
ui(new Ui::ConfigDialog),
|
||||
m_maxMSAA(_maxMsaaLevel),
|
||||
m_accepted(false),
|
||||
m_fontsInited(false),
|
||||
m_blockReInit(false)
|
||||
@@ -537,6 +553,7 @@ void ConfigDialog::accept(bool justSave) {
|
||||
// Emulation settings
|
||||
config.generalEmulation.enableLOD = ui->emulateLodCheckBox->isChecked() ? 1 : 0;
|
||||
config.generalEmulation.enableHWLighting = ui->enableHWLightingCheckBox->isChecked() ? 1 : 0;
|
||||
config.generalEmulation.enableCoverage = ui->enableCoverageCheckBox->isChecked() ? 1 : 0;
|
||||
config.generalEmulation.enableShadersStorage = ui->enableShadersStorageCheckBox->isChecked() ? 1 : 0;
|
||||
config.generalEmulation.enableCustomSettings = ui->customSettingsCheckBox->isChecked() ? 1 : 0;
|
||||
|
||||
@@ -620,49 +637,53 @@ void ConfigDialog::accept(bool justSave) {
|
||||
config.textureFilter.txHiresTextureFileStorage = ui->hiresTexFileStorageCheckBox->isChecked() ? 1 : 0;
|
||||
|
||||
QDir txPath(ui->texPackPathLineEdit->text());
|
||||
if (txPath.exists()) {
|
||||
config.textureFilter.txPath[txPath.absolutePath().toWCharArray(config.textureFilter.txPath)] = L'\0';
|
||||
} else if (config.textureFilter.txHiresEnable != 0) {
|
||||
if (!txPath.exists() &&
|
||||
!txPath.mkdir(txPath.absolutePath()) &&
|
||||
config.textureFilter.txHiresEnable != 0) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setWindowTitle("GLideN64");
|
||||
msgBox.setText(tr("The texture pack folder is missing. Please change the folder or turn off texture packs."));
|
||||
msgBox.setText(tr("Failed to create the texture pack folder. Please change the folder or turn off texture packs."));
|
||||
msgBox.exec();
|
||||
ui->tabWidget->setCurrentIndex(3);
|
||||
ui->texPackPathLineEdit->setFocus(Qt::PopupFocusReason);
|
||||
ui->texPackPathLineEdit->selectAll();
|
||||
return;
|
||||
}
|
||||
config.textureFilter.txPath[txPath.path().toWCharArray(config.textureFilter.txPath)] = L'\0';
|
||||
|
||||
QDir txCachePath(ui->texCachePathLineEdit->text());
|
||||
if (txCachePath.exists()) {
|
||||
config.textureFilter.txCachePath[txCachePath.absolutePath().toWCharArray(config.textureFilter.txCachePath)] = L'\0';
|
||||
} else if (config.textureFilter.txHiresEnable != 0) {
|
||||
if (!txCachePath.exists() &&
|
||||
!txCachePath.mkdir(txCachePath.absolutePath()) &&
|
||||
config.textureFilter.txHiresEnable != 0) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setWindowTitle("GLideN64");
|
||||
msgBox.setText(tr("The texture pack cache folder is missing. Please change the folder or turn off texture packs."));
|
||||
msgBox.setText(tr("Failed to create the texture pack cache folder. Please change the folder or turn off texture packs."));
|
||||
msgBox.exec();
|
||||
ui->tabWidget->setCurrentIndex(3);
|
||||
ui->texCachePathLineEdit->setFocus(Qt::PopupFocusReason);
|
||||
ui->texCachePathLineEdit->selectAll();
|
||||
return;
|
||||
}
|
||||
config.textureFilter.txCachePath[txCachePath.path().toWCharArray(config.textureFilter.txCachePath)] = L'\0';
|
||||
|
||||
QDir txDumpPath(ui->texDumpPathLineEdit->text());
|
||||
if (txDumpPath.exists()) {
|
||||
config.textureFilter.txDumpPath[txDumpPath.absolutePath().toWCharArray(config.textureFilter.txDumpPath)] = L'\0';
|
||||
} else if (config.textureFilter.txHiresEnable != 0 && config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
|
||||
if (!txDumpPath.exists() &&
|
||||
!txDumpPath.mkdir(txDumpPath.absolutePath()) &&
|
||||
config.textureFilter.txHiresEnable != 0 &&
|
||||
config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setWindowTitle("GLideN64");
|
||||
msgBox.setText(tr("The texture dump folder is missing. Please change the folder or turn off dumping texture packs."));
|
||||
msgBox.setText(tr("Failed to create the texture dump folder. Please change the folder or turn off dumping texture packs."));
|
||||
msgBox.exec();
|
||||
ui->tabWidget->setCurrentIndex(3);
|
||||
ui->texDumpPathLineEdit->setFocus(Qt::PopupFocusReason);
|
||||
ui->texDumpPathLineEdit->selectAll();
|
||||
return;
|
||||
}
|
||||
config.textureFilter.txDumpPath[txDumpPath.path().toWCharArray(config.textureFilter.txDumpPath)] = L'\0';
|
||||
|
||||
#endif
|
||||
// OSD settings
|
||||
@@ -892,15 +913,15 @@ void ConfigDialog::on_tabWidget_currentChanged(int tab)
|
||||
ui->tabWidget->setCursor(QCursor(Qt::WaitCursor));
|
||||
|
||||
QMap<QString, QStringList> internalFontList;
|
||||
QDir fontDir(QStandardPaths::locate(QStandardPaths::FontsLocation, QString(), QStandardPaths::LocateDirectory));
|
||||
QString fontDir = QStandardPaths::locate(QStandardPaths::FontsLocation, QString(), QStandardPaths::LocateDirectory);
|
||||
QStringList fontFilter;
|
||||
fontFilter << "*.ttf";
|
||||
fontDir.setNameFilters(fontFilter);
|
||||
QFileInfoList fontList = fontDir.entryInfoList();
|
||||
for (int i = 0; i < fontList.size(); ++i) {
|
||||
int id = QFontDatabase::addApplicationFont(fontList.at(i).absoluteFilePath());
|
||||
QDirIterator fontIt(fontDir, fontFilter, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (fontIt.hasNext()) {
|
||||
QString font = fontIt.next();
|
||||
int id = QFontDatabase::addApplicationFont(font);
|
||||
QString fontListFamily = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||
internalFontList[fontListFamily].append(fontList.at(i).fileName());
|
||||
internalFontList[fontListFamily].append(font);
|
||||
}
|
||||
|
||||
QMap<QString, QStringList>::const_iterator i;
|
||||
|
||||
@@ -15,7 +15,7 @@ class ConfigDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
void setIniPath(const QString & _strIniPath);
|
||||
@@ -89,6 +89,7 @@ private:
|
||||
bool m_blockReInit;
|
||||
QString m_strIniPath;
|
||||
const char * m_romName;
|
||||
unsigned int m_maxMSAA;
|
||||
};
|
||||
|
||||
#endif // CONFIGDIALOG_H
|
||||
@@ -20,7 +20,8 @@ void Config_DoConfig(/*HWND hParent*/)
|
||||
api().FindPluginPath(strCustomFolderPath);
|
||||
|
||||
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)
|
||||
LoadCustomRomSettings(strCustomFolderPath, RSP.romname);
|
||||
config.validate();
|
||||
|
||||
@@ -21,7 +21,7 @@ inline void initMyResource() { Q_INIT_RESOURCE(icon); }
|
||||
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
|
||||
|
||||
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();
|
||||
initMyResource();
|
||||
@@ -48,7 +48,7 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool &
|
||||
if (translator.load(getTranslationFile(), strIniFileName))
|
||||
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.setRomName(_romName);
|
||||
@@ -79,13 +79,13 @@ int openAboutDialog(const wchar_t * _strFileName)
|
||||
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;
|
||||
#ifdef RUN_DIALOG_IN_THREAD
|
||||
std::thread configThread(openConfigDialog, _strFileName, std::ref(accepted));
|
||||
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
|
||||
configThread.join();
|
||||
#else
|
||||
openConfigDialog(_strFileName, _romName, accepted);
|
||||
openConfigDialog(_strFileName, _romName, _maxMSAALevel, accepted);
|
||||
#endif
|
||||
return accepted;
|
||||
|
||||
@@ -101,9 +101,9 @@ int runAboutThread(const wchar_t * _strFileName) {
|
||||
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)
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
#define CALL
|
||||
#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 void CALL LoadConfig(const wchar_t * _strFileName);
|
||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||
|
||||
@@ -25,6 +25,7 @@ void _loadSettings(QSettings & settings)
|
||||
config.video.windowedHeight = settings.value("windowedHeight", config.video.windowedHeight).toInt();
|
||||
config.video.fullscreen = settings.value("fullscreen", config.video.fullscreen).toInt();
|
||||
config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt();
|
||||
config.video.maxMultiSampling = settings.value("maxMultiSampling", config.video.maxMultiSampling).toInt();
|
||||
config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt();
|
||||
config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt();
|
||||
config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt();
|
||||
@@ -44,6 +45,7 @@ void _loadSettings(QSettings & settings)
|
||||
config.generalEmulation.rdramImageDitheringMode = settings.value("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode).toInt();
|
||||
config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt();
|
||||
config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt();
|
||||
config.generalEmulation.enableCoverage = settings.value("enableCoverage", config.generalEmulation.enableCoverage).toInt();
|
||||
config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt();
|
||||
config.generalEmulation.enableLegacyBlending = settings.value("enableLegacyBlending", config.generalEmulation.enableLegacyBlending).toInt(); //ini only
|
||||
config.generalEmulation.enableHybridFilter = settings.value("enableHybridFilter", config.generalEmulation.enableHybridFilter).toInt(); //ini only
|
||||
@@ -205,6 +207,7 @@ void writeSettings(const QString & _strIniFolder)
|
||||
settings.setValue("windowedHeight", config.video.windowedHeight);
|
||||
settings.setValue("fullscreen", config.video.fullscreen);
|
||||
settings.setValue("multisampling", config.video.multisampling);
|
||||
settings.setValue("maxMultiSampling", config.video.maxMultiSampling);
|
||||
settings.setValue("fxaa", config.video.fxaa);
|
||||
settings.setValue("verticalSync", config.video.verticalSync);
|
||||
settings.setValue("threadedVideo", config.video.threadedVideo);
|
||||
@@ -224,6 +227,7 @@ void writeSettings(const QString & _strIniFolder)
|
||||
settings.setValue("rdramImageDitheringMode", config.generalEmulation.rdramImageDitheringMode);
|
||||
settings.setValue("enableLOD", config.generalEmulation.enableLOD);
|
||||
settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting);
|
||||
settings.setValue("enableCoverage", config.generalEmulation.enableCoverage);
|
||||
settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage);
|
||||
settings.setValue("enableLegacyBlending", config.generalEmulation.enableLegacyBlending); //ini only
|
||||
settings.setValue("enableHybridFilter", config.generalEmulation.enableHybridFilter); //ini only
|
||||
@@ -392,8 +396,8 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
|
||||
origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \
|
||||
settings.setValue(#S, config.G.S)
|
||||
#define WriteCustomSettingS(S) \
|
||||
const QString new##S = QString::fromWCharArray(config.textureFilter.txPath); \
|
||||
const QString orig##S = QString::fromWCharArray(origConfig.textureFilter.txPath); \
|
||||
const QString new##S = QString::fromWCharArray(config.textureFilter.S); \
|
||||
const QString orig##S = QString::fromWCharArray(origConfig.textureFilter.S); \
|
||||
if (orig##S != new##S || \
|
||||
orig##S != settings.value(#S, new##S).toString()) \
|
||||
settings.setValue(#S, new##S)
|
||||
@@ -423,6 +427,7 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
|
||||
WriteCustomSetting(generalEmulation, rdramImageDitheringMode);
|
||||
WriteCustomSetting(generalEmulation, enableLOD);
|
||||
WriteCustomSetting(generalEmulation, enableHWLighting);
|
||||
WriteCustomSetting(generalEmulation, enableCoverage);
|
||||
WriteCustomSetting(generalEmulation, enableShadersStorage);
|
||||
settings.endGroup();
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@
|
||||
<item>
|
||||
<widget class="QSlider" name="aliasingSlider">
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
@@ -1109,6 +1109,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableCoverageCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Enable pixel coverage calculation. </span></p><p>Enables approximated pixel coverage calculation. N64 uses pixel coverage for anti-aliasing and in some special blending modes. Some games have wire-frame mode aka 'pen and ink' mode. This mode also needs pixel coverage calculated. </p><p>[Recommended: Checked, unless performance is hurt]</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable pixel coverage calculation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableShadersStorageCheckBox">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace graphics {
|
||||
vecOptions.push_back(config.generalEmulation.enableDitheringPattern);
|
||||
vecOptions.push_back(config.generalEmulation.enableDitheringQuantization);
|
||||
vecOptions.push_back(config.generalEmulation.enableLOD);
|
||||
vecOptions.push_back(config.generalEmulation.enableCoverage);
|
||||
vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcFast ? 1 : 0);
|
||||
vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcCompatible ? 1 : 0);
|
||||
vecOptions.push_back(config.generalEmulation.enableLegacyBlending);
|
||||
|
||||
@@ -314,11 +314,6 @@ ShaderProgram * Context::createGammaCorrectionShader()
|
||||
return m_impl->createGammaCorrectionShader();
|
||||
}
|
||||
|
||||
ShaderProgram * Context::createOrientationCorrectionShader()
|
||||
{
|
||||
return m_impl->createOrientationCorrectionShader();
|
||||
}
|
||||
|
||||
ShaderProgram * Context::createFXAAShader()
|
||||
{
|
||||
return m_impl->createFXAAShader();
|
||||
@@ -354,6 +349,11 @@ f32 Context::getMaxLineWidth()
|
||||
return m_impl->getMaxLineWidth();
|
||||
}
|
||||
|
||||
s32 Context::getMaxMSAALevel()
|
||||
{
|
||||
return m_impl->getMaxMSAALevel();
|
||||
}
|
||||
|
||||
bool Context::isError() const
|
||||
{
|
||||
return m_impl->isError();
|
||||
|
||||
@@ -247,8 +247,6 @@ namespace graphics {
|
||||
|
||||
ShaderProgram * createGammaCorrectionShader();
|
||||
|
||||
ShaderProgram * createOrientationCorrectionShader();
|
||||
|
||||
ShaderProgram * createFXAAShader();
|
||||
|
||||
TextDrawerShaderProgram * createTextDrawerShader();
|
||||
@@ -287,6 +285,7 @@ namespace graphics {
|
||||
f32 getMaxLineWidth();
|
||||
|
||||
/*---------------Misc-------------*/
|
||||
s32 getMaxMSAALevel();
|
||||
|
||||
bool isError() const;
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace graphics {
|
||||
virtual ShaderProgram * createTexrectDownscaleCopyShader() = 0;
|
||||
virtual ShaderProgram * createTexrectColorAndDepthDownscaleCopyShader() = 0;
|
||||
virtual ShaderProgram * createGammaCorrectionShader() = 0;
|
||||
virtual ShaderProgram * createOrientationCorrectionShader() = 0;
|
||||
virtual ShaderProgram * createFXAAShader() = 0;
|
||||
virtual TextDrawerShaderProgram * createTextDrawerShader() = 0;
|
||||
virtual void resetShaderProgram() = 0;
|
||||
@@ -72,6 +71,7 @@ namespace graphics {
|
||||
virtual void drawLine(f32 _width, SPVertex * _vertices) = 0;
|
||||
virtual f32 getMaxLineWidth() = 0;
|
||||
virtual bool isSupported(SpecialFeatures _feature) const = 0;
|
||||
virtual s32 getMaxMSAALevel() = 0;
|
||||
virtual bool isError() const = 0;
|
||||
virtual bool isFramebufferError() const = 0;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#ifdef OS_WINDOWS
|
||||
#include <windows.h>
|
||||
//#define FORCE_UNBUFFERED_DRAWER // Debug option.
|
||||
#elif defined(OS_LINUX)
|
||||
#include <winlnxdefs.h>
|
||||
#endif
|
||||
|
||||
@@ -278,6 +278,7 @@ public:
|
||||
"IN highp vec2 aTexCoord; \n"
|
||||
"IN lowp float aNumLights; \n"
|
||||
"IN highp vec4 aModify; \n"
|
||||
"IN highp vec2 aBaryCoords; \n"
|
||||
" \n"
|
||||
"uniform int uTexturePersp; \n"
|
||||
"uniform lowp int uTextureFilterMode; \n"
|
||||
@@ -297,6 +298,7 @@ public:
|
||||
"OUT mediump vec2 vLodTexCoord; \n"
|
||||
"OUT lowp float vNumLights; \n"
|
||||
"OUT lowp vec4 vShadeColor; \n"
|
||||
"OUT highp vec4 vBaryCoords; \n"
|
||||
;
|
||||
if (!_glinfo.isGLESX || _glinfo.noPerspective)
|
||||
m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n";
|
||||
@@ -348,6 +350,7 @@ public:
|
||||
" else \n"
|
||||
" vShadeColor.rgb = vec3(fp); \n"
|
||||
" } \n"
|
||||
" vBaryCoords = vec4(aBaryCoords, 1.0 - aBaryCoords.x - aBaryCoords.y, 0.5f); \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
@@ -362,6 +365,7 @@ public:
|
||||
"IN lowp vec4 aColor; \n"
|
||||
"IN lowp float aNumLights; \n"
|
||||
"IN highp vec4 aModify; \n"
|
||||
"IN highp vec2 aBaryCoords; \n"
|
||||
" \n"
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
"uniform mediump vec2 uFogScale; \n"
|
||||
@@ -369,6 +373,7 @@ public:
|
||||
" \n"
|
||||
"OUT lowp float vNumLights; \n"
|
||||
"OUT lowp vec4 vShadeColor; \n"
|
||||
"OUT highp vec4 vBaryCoords; \n"
|
||||
;
|
||||
if (!_glinfo.isGLESX || _glinfo.noPerspective)
|
||||
m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n";
|
||||
@@ -405,6 +410,7 @@ public:
|
||||
" else \n"
|
||||
" vShadeColor.rgb = vec3(fp); \n"
|
||||
" } \n"
|
||||
" vBaryCoords = vec4(aBaryCoords, 1.0 - aBaryCoords.x - aBaryCoords.y, 0.5f); \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
@@ -418,11 +424,13 @@ public:
|
||||
"IN highp vec4 aRectPosition; \n"
|
||||
"IN highp vec2 aTexCoord0; \n"
|
||||
"IN highp vec2 aTexCoord1; \n"
|
||||
"IN highp vec2 aBaryCoords; \n"
|
||||
" \n"
|
||||
"OUT highp vec2 vTexCoord0; \n"
|
||||
"OUT highp vec2 vTexCoord1; \n"
|
||||
"OUT lowp vec4 vShadeColor; \n"
|
||||
;
|
||||
"OUT highp vec4 vBaryCoords;"
|
||||
;
|
||||
if (!_glinfo.isGLESX || _glinfo.noPerspective)
|
||||
m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n";
|
||||
else
|
||||
@@ -436,6 +444,7 @@ public:
|
||||
" vShadeColorNoperspective = uRectColor; \n"
|
||||
" vTexCoord0 = aTexCoord0; \n"
|
||||
" vTexCoord1 = aTexCoord1; \n"
|
||||
" vBaryCoords = vec4(aBaryCoords, vec2(1.0) - aBaryCoords); \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
@@ -447,8 +456,10 @@ public:
|
||||
{
|
||||
m_part =
|
||||
"IN highp vec4 aRectPosition; \n"
|
||||
"IN highp vec2 aBaryCoords; \n"
|
||||
" \n"
|
||||
"OUT lowp vec4 vShadeColor; \n"
|
||||
"OUT highp vec4 vBaryCoords; \n"
|
||||
;
|
||||
if (!_glinfo.isGLESX || _glinfo.noPerspective)
|
||||
m_part += "noperspective OUT lowp vec4 vShadeColorNoperspective;\n";
|
||||
@@ -461,6 +472,7 @@ public:
|
||||
" gl_Position = aRectPosition; \n"
|
||||
" vShadeColor = uRectColor; \n"
|
||||
" vShadeColorNoperspective = uRectColor; \n"
|
||||
" vBaryCoords = vec4(aBaryCoords, vec2(1.0f) - aBaryCoords);\n"
|
||||
;
|
||||
}
|
||||
};
|
||||
@@ -661,7 +673,6 @@ public:
|
||||
if (_glinfo.dual_source_blending || _glinfo.ext_fetch || _glinfo.ext_fetch_arm) {
|
||||
m_part +=
|
||||
"if (uBlendAlphaMode != 2) { \n"
|
||||
" lowp float cvg = clampedColor.a; \n"
|
||||
" lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n"
|
||||
" lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n"
|
||||
" if (uBlendAlphaMode == 0) \n"
|
||||
@@ -929,6 +940,7 @@ public:
|
||||
"highp vec2 tcData1[5]; \n"
|
||||
"uniform lowp int uCvgDest; \n"
|
||||
"uniform lowp int uBlendAlphaMode; \n"
|
||||
"lowp float cvg;"
|
||||
;
|
||||
|
||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||
@@ -980,31 +992,36 @@ public:
|
||||
"IN highp vec2 vTexCoord1; \n"
|
||||
"IN mediump vec2 vLodTexCoord; \n"
|
||||
"IN lowp float vNumLights; \n"
|
||||
"IN highp vec4 vBaryCoords; \n"
|
||||
;
|
||||
|
||||
if (_glinfo.dual_source_blending) {
|
||||
m_part +=
|
||||
"layout(location = 0, index = 0) OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"layout(location = 0, index = 0) OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"layout(location = 0, index = 1) OUT lowp vec4 fragColor1; \n" // SECONDARY FRAGMENT SHADER OUTPUT
|
||||
"#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY
|
||||
"#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY
|
||||
;
|
||||
} else if (_glinfo.ext_fetch) {
|
||||
m_part +=
|
||||
"layout(location = 0) inout lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR fragColor \n" // CURRENT FRAMEBUFFER COLOR/ALPHA
|
||||
"#define LAST_FRAG_ALPHA fragColor.a \n" // CURRENT FRAMEBUFFER ALPHA
|
||||
;
|
||||
} else if (_glinfo.ext_fetch_arm) {
|
||||
m_part +=
|
||||
"OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR gl_LastFragColorARM \n" // CURRENT FRAMEBUFFER COLOR/ALPHA
|
||||
"#define LAST_FRAG_ALPHA gl_LastFragColorARM.a \n" // CURRENT FRAMEBUFFER ALPHA
|
||||
;
|
||||
} else {
|
||||
m_part +=
|
||||
"OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY
|
||||
"#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1045,7 +1062,7 @@ public:
|
||||
"uniform lowp int uScreenSpaceTriangle; \n"
|
||||
"uniform lowp int uCvgDest; \n"
|
||||
"uniform lowp int uBlendAlphaMode; \n"
|
||||
|
||||
"lowp float cvg; \n"
|
||||
;
|
||||
|
||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||
@@ -1086,6 +1103,7 @@ public:
|
||||
m_part +=
|
||||
"IN lowp vec4 vShadeColor; \n"
|
||||
"IN lowp float vNumLights; \n"
|
||||
"IN highp vec4 vBaryCoords; \n"
|
||||
;
|
||||
|
||||
if (_glinfo.dual_source_blending) {
|
||||
@@ -1093,24 +1111,28 @@ public:
|
||||
"layout(location = 0, index = 0) OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"layout(location = 0, index = 1) OUT lowp vec4 fragColor1; \n" // SECONDARY FRAGMENT SHADER OUTPUT
|
||||
"#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY
|
||||
"#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY
|
||||
;
|
||||
} else if (_glinfo.ext_fetch) {
|
||||
m_part +=
|
||||
"layout(location = 0) inout lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR fragColor \n" // CURRENT FRAMEBUFFER COLOR/ALPHA
|
||||
"#define LAST_FRAG_ALPHA fragColor.a \n" // CURRENT FRAMEBUFFER ALPHA
|
||||
;
|
||||
} else if (_glinfo.ext_fetch_arm) {
|
||||
m_part +=
|
||||
"OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR gl_LastFragColorARM \n" // CURRENT FRAMEBUFFER COLOR/ALPHA
|
||||
"#define LAST_FRAG_ALPHA gl_LastFragColorARM.a \n" // CURRENT FRAMEBUFFER ALPHA
|
||||
;
|
||||
} else {
|
||||
m_part +=
|
||||
"OUT lowp vec4 fragColor; \n" // MAIN FRAGMENT SHADER OUTPUT
|
||||
"lowp vec4 fragColor1; \n" // DUMMY
|
||||
"#define LAST_FRAG_COLOR vec4(0.0) \n" // DUMMY
|
||||
"#define LAST_FRAG_ALPHA 1.0 \n" // DUMMY
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1526,9 +1548,10 @@ public:
|
||||
" #define MUXPM(pos) muxPM*(STVEC(pos)) \n"
|
||||
" #define MUXF(pos) dot(muxF, STVEC(pos)) \n"
|
||||
" lowp vec4 lastFragColor = LAST_FRAG_COLOR; \n"
|
||||
" lowp float lastFragAlpha = LAST_FRAG_ALPHA; \n"
|
||||
" lowp mat4 muxPM = mat4(vec4(0.0), lastFragColor, uBlendColor, uFogColor); \n"
|
||||
" lowp vec4 muxA = vec4(0.0, uFogColor.a, shadeColor.a, 0.0); \n"
|
||||
" lowp vec4 muxB = vec4(0.0, lastFragColor.a, 1.0, 0.0); \n"
|
||||
" lowp vec4 muxB = vec4(0.0, lastFragAlpha, 1.0, 0.0); \n"
|
||||
" lowp vec4 muxF = vec4(0.0, 1.0, 0.0, 0.0); \n"
|
||||
" lowp vec4 muxp, muxm, srcColor1, srcColor2; \n"
|
||||
" lowp float muxa, muxb, dstFactor1, dstFactor2, muxaf, muxbf; \n"
|
||||
@@ -1730,24 +1753,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderFragmentMainEndSpecial : public ShaderPart
|
||||
{
|
||||
public:
|
||||
ShaderFragmentMainEndSpecial(const opengl::GLInfo & _glinfo)
|
||||
{
|
||||
if (_glinfo.isGLES2) {
|
||||
m_part =
|
||||
" gl_FragColor = fragColor; \n"
|
||||
"} \n\n"
|
||||
;
|
||||
} else {
|
||||
m_part =
|
||||
"} \n\n"
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderFragmentMainEnd : public ShaderPart
|
||||
{
|
||||
public:
|
||||
@@ -2585,6 +2590,27 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderCoverage : public ShaderPart {
|
||||
public:
|
||||
ShaderCoverage() {
|
||||
m_part =
|
||||
"const highp vec2 bias[8] = vec2[8] (vec2(-0.5,-0.5), vec2(0.0, -0.5), vec2(-0.25,-0.25), vec2(-0.25, 0.25), \n"
|
||||
" vec2(-0.5, 0.0), vec2(0.0,0.0), vec2(-0.25,0.25), vec2(0.25,0.25)); \n"
|
||||
"highp vec4 dBCdx = dFdx(vBaryCoords); \n"
|
||||
"highp vec4 dBCdy = dFdy(vBaryCoords); \n"
|
||||
"cvg = 0.0; \n"
|
||||
"for (int i = 0; i<8; i++) { \n"
|
||||
" lowp float addend = 0.125; \n"
|
||||
" for (int j=0; j<4; j++) { \n"
|
||||
" addend *= step(0.0, vBaryCoords[j] + dot(vec2(dBCdx[j], dBCdy[j]), bias[i])); \n"
|
||||
" } \n"
|
||||
" cvg += addend; \n"
|
||||
"} \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*---------------ShaderPartsEnd-------------*/
|
||||
|
||||
static
|
||||
@@ -2696,9 +2722,14 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
|
||||
else
|
||||
ssShader << " lowp vec4 clampedColor = clamp(cmbRes, 0.0, 1.0);" << std::endl;
|
||||
|
||||
if (g_cycleType <= G_CYC_2CYCLE)
|
||||
if (g_cycleType <= G_CYC_2CYCLE) {
|
||||
m_callDither->write(ssShader);
|
||||
|
||||
ssShader << "if (uCvgXAlpha != 0) cvg *= clampedColor.a;" << std::endl;
|
||||
ssShader << "if (uAlphaCvgSel != 0) clampedColor.a = cvg; " << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if (config.generalEmulation.enableLegacyBlending == 0) {
|
||||
if (g_cycleType <= G_CYC_2CYCLE) {
|
||||
m_blender1->write(ssShader);
|
||||
@@ -2714,6 +2745,10 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
|
||||
m_legacyBlender->write(ssShader);
|
||||
}
|
||||
|
||||
|
||||
// SHOW COVERAGE HACK
|
||||
// ssShader << "fragColor.rgb = vec3(cvg);" << std::endl;
|
||||
|
||||
_strShader = ssShader.str();
|
||||
return inputs;
|
||||
}
|
||||
@@ -2784,9 +2819,16 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
|
||||
else
|
||||
m_fragmentMain->write(ssShader);
|
||||
|
||||
|
||||
if (g_cycleType <= G_CYC_2CYCLE)
|
||||
m_fragmentBlendMux->write(ssShader);
|
||||
|
||||
if (g_cycleType <= G_CYC_2CYCLE && m_useCoverage)
|
||||
m_shaderCoverage->write(ssShader);
|
||||
else
|
||||
ssShader << "cvg = 1.0f; \n" << std::endl;
|
||||
|
||||
|
||||
if (bUseTextures) {
|
||||
if (combinerInputs.usesTile(0))
|
||||
{
|
||||
@@ -2974,8 +3016,10 @@ CombinerProgramBuilder::CombinerProgramBuilder(const opengl::GLInfo & _glinfo, o
|
||||
, m_shaderN64DepthCompare(new ShaderN64DepthCompare(_glinfo))
|
||||
, m_shaderN64DepthRender(new ShaderN64DepthRender(_glinfo))
|
||||
, m_shaderTextureEngine(new ShaderTextureEngine(_glinfo))
|
||||
, m_shaderCoverage(new ShaderCoverage())
|
||||
, m_useProgram(_useProgram)
|
||||
, m_combinerOptionsBits(graphics::CombinerProgram::getShaderCombinerOptionsBits())
|
||||
, m_useCoverage(_glinfo.coverage && config.generalEmulation.enableCoverage != 0)
|
||||
{
|
||||
m_vertexShaderRect = _createVertexShader(m_vertexHeader.get(), m_vertexRect.get(), m_vertexEnd.get());
|
||||
m_vertexShaderTriangle = _createVertexShader(m_vertexHeader.get(), m_vertexTriangle.get(), m_vertexEnd.get());
|
||||
|
||||
@@ -92,6 +92,7 @@ namespace glsl {
|
||||
ShaderPartPtr m_shaderN64DepthCompare;
|
||||
ShaderPartPtr m_shaderN64DepthRender;
|
||||
ShaderPartPtr m_shaderTextureEngine;
|
||||
ShaderPartPtr m_shaderCoverage;
|
||||
|
||||
std::unique_ptr<CombinerProgramUniformFactory> m_uniformFactory;
|
||||
|
||||
@@ -101,6 +102,7 @@ namespace glsl {
|
||||
GLuint m_vertexShaderTexturedTriangle;
|
||||
opengl::CachedUseProgram * m_useProgram;
|
||||
u32 m_combinerOptionsBits;
|
||||
bool m_useCoverage = false;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public:
|
||||
const int forceBlend2 = gDP.otherMode.forceBlender;
|
||||
uForceBlendCycle2.set(forceBlend2, _force);
|
||||
|
||||
if (!graphics::Context::DualSourceBlending || dwnd().getDrawer().isTexrectDrawerMode()) {
|
||||
if (!(graphics::Context::DualSourceBlending || graphics::Context::FramebufferFetchColor) || dwnd().getDrawer().isTexrectDrawerMode()) {
|
||||
// Modes, which shader blender can't emulate
|
||||
const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16);
|
||||
switch (mode) {
|
||||
@@ -574,24 +574,23 @@ public:
|
||||
{
|
||||
if (gDP.otherMode.cycleType == G_CYC_FILL) {
|
||||
uEnableAlphaTest.set(0, _force);
|
||||
}
|
||||
else if (gDP.otherMode.cycleType == G_CYC_COPY) {
|
||||
uAlphaCvgSel.set(0, _force);
|
||||
|
||||
} else if (gDP.otherMode.cycleType == G_CYC_COPY) {
|
||||
uAlphaCvgSel.set(0, _force);
|
||||
if (gDP.otherMode.alphaCompare & G_AC_THRESHOLD) {
|
||||
uEnableAlphaTest.set(1, _force);
|
||||
uAlphaCvgSel.set(0, _force);
|
||||
uAlphaTestValue.set(0.5f, _force);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
uEnableAlphaTest.set(0, _force);
|
||||
}
|
||||
}
|
||||
else if ((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) {
|
||||
} else if ((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) {
|
||||
uEnableAlphaTest.set(1, _force);
|
||||
uAlphaTestValue.set(gDP.blendColor.a, _force);
|
||||
uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
uEnableAlphaTest.set(0, _force);
|
||||
uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force);
|
||||
}
|
||||
|
||||
uCvgXAlpha.set(gDP.otherMode.cvgXAlpha, _force);
|
||||
|
||||
@@ -100,7 +100,6 @@ bool ShaderStorage::_saveCombinerKeys(const graphics::Combiners & _combiners) co
|
||||
|
||||
std::sort(keysData.begin(), keysData.end());
|
||||
keysOut << "0x" << std::hex << std::setfill('0') << std::setw(8) << m_keysFormatVersion << "\n";
|
||||
keysOut << "0x" << std::hex << std::setfill('0') << std::setw(8) << static_cast<u32>(GBI.isHWLSupported()) << "\n";
|
||||
keysOut << "0x" << std::hex << std::setfill('0') << std::setw(8) << keysData.size() << "\n";
|
||||
for (u64 key : keysData)
|
||||
keysOut << "0x" << std::hex << std::setfill('0') << std::setw(16) << key << "\n";
|
||||
@@ -202,7 +201,7 @@ bool ShaderStorage::saveShadersStorage(const graphics::Combiners & _combiners) c
|
||||
}
|
||||
|
||||
static
|
||||
CombinerProgramImpl * _readCominerProgramFromStream(std::istream & _is,
|
||||
CombinerProgramImpl * _readCombinerProgramFromStream(std::istream & _is,
|
||||
CombinerProgramUniformFactory & _uniformFactory,
|
||||
opengl::CachedUseProgram * _useProgram)
|
||||
{
|
||||
@@ -245,12 +244,16 @@ bool ShaderStorage::_loadFromCombinerKeys(graphics::Combiners & _combiners)
|
||||
|
||||
u32 version;
|
||||
fin >> std::hex >> version;
|
||||
if (version != m_keysFormatVersion)
|
||||
if (version < 4)
|
||||
return false;
|
||||
|
||||
u32 hwlSupport;
|
||||
fin >> std::hex >> hwlSupport;
|
||||
GBI.setHWLSupported(hwlSupport != 0);
|
||||
const bool useGlobalHWLSuport = version == 4;
|
||||
|
||||
if (useGlobalHWLSuport) {
|
||||
u32 hwlSupport = 0;
|
||||
fin >> std::hex >> hwlSupport;
|
||||
GBI.setHWLSupported(hwlSupport != 0);
|
||||
}
|
||||
|
||||
displayLoadProgress(L"LOAD COMBINER SHADERS %.1f%%", 0.0f);
|
||||
|
||||
@@ -260,10 +263,13 @@ bool ShaderStorage::_loadFromCombinerKeys(graphics::Combiners & _combiners)
|
||||
const f32 step = 100.0f / szCombiners;
|
||||
f32 progress = 0.0f;
|
||||
f32 percents = percent;
|
||||
u64 key;
|
||||
u64 mux;
|
||||
for (u32 i = 0; i < szCombiners; ++i) {
|
||||
fin >> std::hex >> key;
|
||||
graphics::CombinerProgram * pCombiner = Combiner_Compile(CombinerKey(key, false));
|
||||
fin >> std::hex >> mux;
|
||||
CombinerKey key(mux, false);
|
||||
if (!useGlobalHWLSuport)
|
||||
GBI.setHWLSupported(key.isHWLSupported());
|
||||
graphics::CombinerProgram * pCombiner = Combiner_Compile(key);
|
||||
pCombiner->update(true);
|
||||
_combiners[pCombiner->getKey()] = pCombiner;
|
||||
progress += step;
|
||||
@@ -338,7 +344,7 @@ bool ShaderStorage::loadShadersStorage(graphics::Combiners & _combiners)
|
||||
f32 progress = 0.0f;
|
||||
f32 percents = percent;
|
||||
for (u32 i = 0; i < len; ++i) {
|
||||
CombinerProgramImpl * pCombiner = _readCominerProgramFromStream(fin, uniformFactory, m_useProgram);
|
||||
CombinerProgramImpl * pCombiner = _readCombinerProgramFromStream(fin, uniformFactory, m_useProgram);
|
||||
pCombiner->update(true);
|
||||
_combiners[pCombiner->getKey()] = pCombiner;
|
||||
progress += step;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace glsl {
|
||||
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
|
||||
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
|
||||
|
||||
const u32 m_formatVersion = 0x2FU;
|
||||
const u32 m_keysFormatVersion = 0x04;
|
||||
const u32 m_formatVersion = 0x30U;
|
||||
const u32 m_keysFormatVersion = 0x05;
|
||||
const opengl::GLInfo & m_glinfo;
|
||||
opengl::CachedUseProgram * m_useProgram;
|
||||
};
|
||||
|
||||
@@ -542,22 +542,6 @@ namespace glsl {
|
||||
}
|
||||
};
|
||||
|
||||
class OrientationCorrection : public ShaderPart
|
||||
{
|
||||
public:
|
||||
OrientationCorrection(const opengl::GLInfo & _glinfo)
|
||||
{
|
||||
m_part =
|
||||
"IN mediump vec2 vTexCoord0; \n"
|
||||
"uniform sampler2D uTex0; \n"
|
||||
"OUT lowp vec4 fragColor; \n"
|
||||
"void main() \n"
|
||||
"{ \n"
|
||||
" fragColor = texture2D(uTex0, vec2(1.0 - vTexCoord0.x, 1.0 - vTexCoord0.y)); \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
/*---------------TextDrawerShaderPart-------------*/
|
||||
|
||||
class TextDraw : public ShaderPart
|
||||
@@ -903,25 +887,6 @@ namespace glsl {
|
||||
}
|
||||
};
|
||||
|
||||
typedef SpecialShader<VertexShaderTexturedRect, OrientationCorrection> OrientationCorrectionShaderBase;
|
||||
|
||||
class OrientationCorrectionShader : public OrientationCorrectionShaderBase
|
||||
{
|
||||
public:
|
||||
OrientationCorrectionShader(const opengl::GLInfo & _glinfo,
|
||||
opengl::CachedUseProgram * _useProgram,
|
||||
const ShaderPart * _vertexHeader,
|
||||
const ShaderPart * _fragmentHeader,
|
||||
const ShaderPart * _fragmentEnd)
|
||||
: OrientationCorrectionShaderBase(_glinfo, _useProgram, _vertexHeader, _fragmentHeader, _fragmentEnd)
|
||||
{
|
||||
m_useProgram->useProgram(m_program);
|
||||
const int texLoc = glGetUniformLocation(GLuint(m_program), "uTex0");
|
||||
glUniform1i(texLoc, 0);
|
||||
m_useProgram->useProgram(graphics::ObjectHandle::null);
|
||||
}
|
||||
};
|
||||
|
||||
/*---------------TexrectDrawerShader-------------*/
|
||||
|
||||
typedef SpecialShader<VertexShaderTexturedRect, TextDraw, graphics::TextDrawerShaderProgram> TextDrawerShaderBase;
|
||||
@@ -1018,11 +983,6 @@ namespace glsl {
|
||||
return new GammaCorrectionShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd);
|
||||
}
|
||||
|
||||
graphics::ShaderProgram * SpecialShadersFactory::createOrientationCorrectionShader() const
|
||||
{
|
||||
return new OrientationCorrectionShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd);
|
||||
}
|
||||
|
||||
graphics::ShaderProgram * SpecialShadersFactory::createFXAAShader() const
|
||||
{
|
||||
return new FXAAShader(m_glinfo, m_useProgram, m_vertexHeader, m_fragmentHeader, m_fragmentEnd);
|
||||
|
||||
@@ -38,8 +38,6 @@ namespace glsl {
|
||||
|
||||
graphics::ShaderProgram * createGammaCorrectionShader() const;
|
||||
|
||||
graphics::ShaderProgram * createOrientationCorrectionShader() const;
|
||||
|
||||
graphics::ShaderProgram * createFXAAShader() const;
|
||||
|
||||
graphics::TextDrawerShaderProgram * createTextDrawerShader() const;
|
||||
|
||||
@@ -7,8 +7,14 @@ using namespace glsl;
|
||||
|
||||
void Utils::locateAttributes(GLuint _program, bool _rect, bool _textures)
|
||||
{
|
||||
static GLint maxVertexAttribs = 0;
|
||||
if (maxVertexAttribs == 0)
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
|
||||
|
||||
if (_rect) {
|
||||
glBindAttribLocation(_program, opengl::rectAttrib::position, "aRectPosition");
|
||||
if (opengl::rectAttrib::barycoords < static_cast<u32>(maxVertexAttribs))
|
||||
glBindAttribLocation(_program, opengl::rectAttrib::barycoords, "aBaryCoords");
|
||||
if (_textures) {
|
||||
glBindAttribLocation(_program, opengl::rectAttrib::texcoord0, "aTexCoord0");
|
||||
glBindAttribLocation(_program, opengl::rectAttrib::texcoord1, "aTexCoord1");
|
||||
@@ -20,6 +26,8 @@ void Utils::locateAttributes(GLuint _program, bool _rect, bool _textures)
|
||||
glBindAttribLocation(_program, opengl::triangleAttrib::color, "aColor");
|
||||
glBindAttribLocation(_program, opengl::triangleAttrib::numlights, "aNumLights");
|
||||
glBindAttribLocation(_program, opengl::triangleAttrib::modify, "aModify");
|
||||
if (opengl::triangleAttrib::barycoords < static_cast<u32>(maxVertexAttribs))
|
||||
glBindAttribLocation(_program, opengl::triangleAttrib::barycoords, "aBaryCoords");
|
||||
if (_textures)
|
||||
glBindAttribLocation(_program, opengl::triangleAttrib::texcoord, "aTexCoord");
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace opengl {
|
||||
ptrDrawElements(mode, count, type, indices);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int typeSizeBytes;
|
||||
unsigned int maxElementIndex;
|
||||
|
||||
@@ -1443,7 +1443,7 @@ namespace opengl {
|
||||
if (m_threaded_wrapper) {
|
||||
executeCommand(CoreVideoQuitCommand::get());
|
||||
executeCommand(ShutdownCommand::get());
|
||||
}
|
||||
}
|
||||
else
|
||||
CoreVideoQuitCommand::get()->performCommandSingleThreaded();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace opengl {
|
||||
const GLuint texcoord = 2U;
|
||||
const GLuint numlights = 3U;
|
||||
const GLuint modify = 4U;
|
||||
const GLuint barycoords = 8U;
|
||||
}
|
||||
|
||||
// Rect attributes
|
||||
@@ -15,5 +16,6 @@ namespace opengl {
|
||||
const GLuint position = 5U;
|
||||
const GLuint texcoord0 = 6U;
|
||||
const GLuint texcoord1 = 7U;
|
||||
const GLuint barycoords = 9U;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ namespace opengl {
|
||||
extern const GLuint texcoord;
|
||||
extern const GLuint numlights;
|
||||
extern const GLuint modify;
|
||||
extern const GLuint barycoords;
|
||||
}
|
||||
|
||||
// Rect attributes
|
||||
@@ -17,7 +18,8 @@ namespace opengl {
|
||||
extern const GLuint position;
|
||||
extern const GLuint texcoord0;
|
||||
extern const GLuint texcoord1;
|
||||
extern const GLuint barycoords;
|
||||
}
|
||||
|
||||
#define MaxAttribIndex 8
|
||||
#define MaxAttribIndex 10
|
||||
}
|
||||
@@ -29,9 +29,12 @@ BufferedDrawer::BufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray *
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, true);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, true);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, true);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, true);
|
||||
glVertexAttribPointer(rectAttrib::position, 4, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, x)));
|
||||
glVertexAttribPointer(rectAttrib::texcoord0, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, s0)));
|
||||
glVertexAttribPointer(rectAttrib::texcoord1, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, s1)));
|
||||
if (_glinfo.coverage)
|
||||
glVertexAttribPointer(rectAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), (const GLvoid *)(offsetof(RectVertex, bc0)));
|
||||
|
||||
/* Init buffers for triangles */
|
||||
glGenVertexArrays(1, &m_trisBuffers.vao);
|
||||
@@ -47,6 +50,10 @@ BufferedDrawer::BufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray *
|
||||
glVertexAttribPointer(triangleAttrib::color, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, r)));
|
||||
glVertexAttribPointer(triangleAttrib::texcoord, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, s)));
|
||||
glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_TRUE, sizeof(Vertex), (const GLvoid *)(offsetof(Vertex, modify)));
|
||||
if (_glinfo.coverage) {
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, true);
|
||||
glVertexAttribPointer(triangleAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)(offsetof(Vertex, bc0)));
|
||||
}
|
||||
}
|
||||
|
||||
void BufferedDrawer::_initBuffer(Buffer & _buffer, GLuint _bufSize)
|
||||
@@ -162,6 +169,8 @@ void BufferedDrawer::_convertFromSPVertex(bool _flatColors, u32 _count, const SP
|
||||
dst.s = src.s;
|
||||
dst.t = src.t;
|
||||
dst.modify = src.modify;
|
||||
dst.bc0 = src.bc0;
|
||||
dst.bc1 = src.bc1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace opengl {
|
||||
f32 x, y, z, w;
|
||||
f32 r, g, b, a;
|
||||
f32 s, t;
|
||||
f32 bc0, bc1;
|
||||
u32 modify;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <Log.h>
|
||||
#include <Config.h>
|
||||
@@ -20,6 +21,10 @@
|
||||
#include <Graphics/OpenGLContext/GraphicBuffer/GraphicBufferWrapper.h>
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
using namespace opengl;
|
||||
|
||||
ContextImpl::ContextImpl()
|
||||
@@ -67,9 +72,11 @@ void ContextImpl::init()
|
||||
}
|
||||
|
||||
{
|
||||
#ifndef FORCE_UNBUFFERED_DRAWER
|
||||
if (!m_glInfo.isGLESX || (m_glInfo.bufferStorage && m_glInfo.drawElementsBaseVertex))
|
||||
m_graphicsDrawer.reset(new BufferedDrawer(m_glInfo, m_cachedFunctions->getCachedVertexAttribArray(), m_cachedFunctions->getCachedBindBuffer()));
|
||||
else
|
||||
#endif
|
||||
m_graphicsDrawer.reset(new UnbufferedDrawer(m_glInfo, m_cachedFunctions->getCachedVertexAttribArray()));
|
||||
}
|
||||
|
||||
@@ -450,11 +457,6 @@ graphics::ShaderProgram * ContextImpl::createGammaCorrectionShader()
|
||||
return m_specialShadersFactory->createGammaCorrectionShader();
|
||||
}
|
||||
|
||||
graphics::ShaderProgram * ContextImpl::createOrientationCorrectionShader()
|
||||
{
|
||||
return m_specialShadersFactory->createOrientationCorrectionShader();
|
||||
}
|
||||
|
||||
graphics::ShaderProgram * ContextImpl::createFXAAShader()
|
||||
{
|
||||
return m_specialShadersFactory->createFXAAShader();
|
||||
@@ -527,6 +529,15 @@ bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 ContextImpl::getMaxMSAALevel()
|
||||
{
|
||||
GLint maxMSAALevel = 0;
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &maxMSAALevel);
|
||||
// Limit maxMSAALevel by 16.
|
||||
// Graphics driver may return 32 for max samples, but pixel format with 32 samples is not supported.
|
||||
return std::min(maxMSAALevel, 16);
|
||||
}
|
||||
|
||||
bool ContextImpl::isError() const
|
||||
{
|
||||
return Utils::isGLError();
|
||||
|
||||
@@ -134,8 +134,6 @@ namespace opengl {
|
||||
|
||||
graphics::ShaderProgram * createGammaCorrectionShader() override;
|
||||
|
||||
graphics::ShaderProgram * createOrientationCorrectionShader() override;
|
||||
|
||||
graphics::ShaderProgram * createFXAAShader() override;
|
||||
|
||||
graphics::TextDrawerShaderProgram * createTextDrawerShader() override;
|
||||
@@ -152,6 +150,8 @@ namespace opengl {
|
||||
|
||||
bool isSupported(graphics::SpecialFeatures _feature) const override;
|
||||
|
||||
s32 getMaxMSAALevel() override;
|
||||
|
||||
bool isError() const override;
|
||||
|
||||
bool isFramebufferError() const override;
|
||||
|
||||
@@ -96,7 +96,7 @@ void GLInfo::init() {
|
||||
fragment_interlock = Utils::isExtensionSupported(*this, "GL_ARB_fragment_shader_interlock") && !hasBuggyFragmentShaderInterlock;
|
||||
fragment_interlockNV = Utils::isExtensionSupported(*this, "GL_NV_fragment_shader_interlock") && !fragment_interlock && !hasBuggyFragmentShaderInterlock;
|
||||
fragment_ordering = Utils::isExtensionSupported(*this, "GL_INTEL_fragment_shader_ordering") && !fragment_interlock && !fragment_interlockNV;
|
||||
|
||||
|
||||
const bool imageTexturesInterlock = imageTextures && (fragment_interlock || fragment_interlockNV || fragment_ordering);
|
||||
|
||||
if (isGLES2) {
|
||||
@@ -104,7 +104,9 @@ void GLInfo::init() {
|
||||
config.generalEmulation.enableHybridFilter = 0;
|
||||
}
|
||||
|
||||
drawElementsBaseVertex = !isGLESX || Utils::isExtensionSupported(*this, "GL_EXT_draw_elements_base_vertex");
|
||||
drawElementsBaseVertex = !isGLESX ||
|
||||
(Utils::isExtensionSupported(*this, "GL_EXT_draw_elements_base_vertex") && (renderer != Renderer::PowerVR ||
|
||||
numericVersion >= 32));
|
||||
|
||||
bufferStorage = (!isGLESX && (numericVersion >= 44)) || Utils::isExtensionSupported(*this, "GL_ARB_buffer_storage") ||
|
||||
Utils::isExtensionSupported(*this, "GL_EXT_buffer_storage");
|
||||
@@ -198,6 +200,13 @@ void GLInfo::init() {
|
||||
}
|
||||
}
|
||||
|
||||
coverage = dual_source_blending || ext_fetch || ext_fetch_arm;
|
||||
if (coverage) {
|
||||
GLint maxVertexAttribs = 0;
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);
|
||||
coverage = maxVertexAttribs >= 10;
|
||||
}
|
||||
|
||||
#ifdef EGL
|
||||
if (isGLESX)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ struct GLInfo {
|
||||
bool eglImage = false;
|
||||
bool eglImageFramebuffer = false;
|
||||
bool dual_source_blending = false;
|
||||
bool coverage = false;
|
||||
Renderer renderer = Renderer::Other;
|
||||
|
||||
void init();
|
||||
|
||||
@@ -9,6 +9,7 @@ using namespace opengl;
|
||||
UnbufferedDrawer::UnbufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArray * _cachedAttribArray)
|
||||
: m_glInfo(_glinfo)
|
||||
, m_cachedAttribArray(_cachedAttribArray)
|
||||
, m_useCoverage(_glinfo.coverage)
|
||||
{
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false);
|
||||
@@ -20,6 +21,11 @@ UnbufferedDrawer::UnbufferedDrawer(const GLInfo & _glinfo, CachedVertexAttribArr
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||
|
||||
if (m_useCoverage) {
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false);
|
||||
}
|
||||
|
||||
m_attribsData.fill(nullptr);
|
||||
}
|
||||
|
||||
@@ -69,12 +75,21 @@ void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParame
|
||||
glVertexAttribPointer(triangleAttrib::modify, 4, GL_BYTE, GL_FALSE, sizeof(SPVertex), ptr);
|
||||
}
|
||||
|
||||
if (m_useCoverage) {
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, true);
|
||||
const void * ptr = &_params.vertices->bc0;
|
||||
if (_updateAttribPointer(triangleAttrib::barycoords, ptr))
|
||||
glVertexAttribPointer(triangleAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(SPVertex), ptr);
|
||||
}
|
||||
|
||||
if (isHWLightingAllowed())
|
||||
glVertexAttrib1f(triangleAttrib::numlights, GLfloat(_params.vertices[0].HWLight));
|
||||
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||
if (m_useCoverage)
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, false);
|
||||
|
||||
if (config.frameBufferEmulation.N64DepthCompare != Config::dcCompatible) {
|
||||
if (_params.elements == nullptr) {
|
||||
@@ -133,10 +148,19 @@ void UnbufferedDrawer::drawRects(const graphics::Context::DrawRectParameters & _
|
||||
} else
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord1, false);
|
||||
|
||||
if (m_useCoverage) {
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::barycoords, true);
|
||||
const void * ptr = &_params.vertices->bc0;
|
||||
if (_updateAttribPointer(rectAttrib::barycoords, ptr))
|
||||
glVertexAttribPointer(rectAttrib::barycoords, 2, GL_FLOAT, GL_FALSE, sizeof(RectVertex), ptr);
|
||||
}
|
||||
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::position, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::color, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
||||
if (m_useCoverage)
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||
|
||||
glDrawArrays(GLenum(_params.mode), 0, _params.verticesCount);
|
||||
}
|
||||
@@ -159,6 +183,8 @@ void UnbufferedDrawer::drawLine(f32 _width, SPVertex * _vertices)
|
||||
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::texcoord, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::modify, false);
|
||||
if (m_useCoverage)
|
||||
m_cachedAttribArray->enableVertexAttribArray(triangleAttrib::barycoords, false);
|
||||
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::position, false);
|
||||
m_cachedAttribArray->enableVertexAttribArray(rectAttrib::texcoord0, false);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace opengl {
|
||||
const GLInfo & m_glInfo;
|
||||
CachedVertexAttribArray * m_cachedAttribArray;
|
||||
std::array<const void*, MaxAttribIndex> m_attribsData;
|
||||
bool m_useCoverage = false;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -84,7 +84,11 @@ bool WindowsWGL::start()
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, majorVersion,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, minorVersion,
|
||||
#ifdef FORCE_UNBUFFERED_DRAWER
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
#else
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
#endif
|
||||
0 //End
|
||||
};
|
||||
|
||||
@@ -127,4 +131,3 @@ void WindowsWGL::swapBuffers()
|
||||
else
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ public:
|
||||
static void swapBuffers();
|
||||
|
||||
private:
|
||||
|
||||
static HGLRC hRC;
|
||||
static HDC hDC;
|
||||
};
|
||||
|
||||
@@ -58,6 +58,12 @@ void GraphicsDrawer::addTriangle(u32 _v0, u32 _v1, u32 _v2)
|
||||
triangles.vertices[_v1].modify |
|
||||
triangles.vertices[_v2].modify;
|
||||
|
||||
for (u32 i = firstIndex; i < triangles.num; ++i) {
|
||||
SPVertex& vtx = triangles.vertices[triangles.elements[i]];
|
||||
vtx.bc0 = i - firstIndex == 0 ? 1.0f : 0.0f;
|
||||
vtx.bc1 = i - firstIndex == 1 ? 1.0f : 0.0f;
|
||||
}
|
||||
|
||||
if ((gSP.geometryMode & G_LIGHTING) == 0) {
|
||||
if ((gSP.geometryMode & G_SHADE) == 0) {
|
||||
// Prim shading
|
||||
@@ -470,9 +476,6 @@ void GraphicsDrawer::_legacyBlending() const
|
||||
} else {
|
||||
gfxContext.enable(enable::BLEND, false);
|
||||
}
|
||||
} else if ((config.generalEmulation.hacks & hack_blastCorps) != 0 && gDP.otherMode.cycleType < G_CYC_COPY && gSP.texture.on == 0 && currentCombiner()->usesTexture()) { // Blast Corps
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::ZERO, blend::ONE);
|
||||
} else {
|
||||
gfxContext.enable(enable::BLEND, false);
|
||||
}
|
||||
@@ -480,7 +483,6 @@ void GraphicsDrawer::_legacyBlending() const
|
||||
|
||||
void GraphicsDrawer::_ordinaryBlending() const
|
||||
{
|
||||
|
||||
// Set unsupported blend modes
|
||||
if (gDP.otherMode.cycleType == G_CYC_2CYCLE) {
|
||||
const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16);
|
||||
@@ -605,9 +607,6 @@ void GraphicsDrawer::_ordinaryBlending() const
|
||||
}
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(srcFactor, dstFactor);
|
||||
} else if ((config.generalEmulation.hacks & hack_blastCorps) != 0 && gDP.otherMode.cycleType < G_CYC_COPY && gSP.texture.on == 0 && currentCombiner()->usesTexture()) { // Blast Corps
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::ZERO, blend::ONE);
|
||||
} else if ((gDP.otherMode.forceBlender == 0 && gDP.otherMode.cycleType < G_CYC_COPY)) {
|
||||
// Just use first mux of blender
|
||||
bool useMemColor = false;
|
||||
@@ -652,11 +651,8 @@ void GraphicsDrawer::_dualSourceBlending() const
|
||||
dstFactor = blend::DST_ALPHA;
|
||||
}
|
||||
}
|
||||
} else if ((config.generalEmulation.hacks & hack_blastCorps) != 0 &&
|
||||
gSP.texture.on == 0 && currentCombiner()->usesTexture()) { // Blast Corps
|
||||
srcFactor = blend::ZERO;
|
||||
dstFactor = blend::ONE;
|
||||
}
|
||||
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlendingSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha);
|
||||
} else {
|
||||
@@ -666,6 +662,15 @@ void GraphicsDrawer::_dualSourceBlending() const
|
||||
|
||||
void GraphicsDrawer::setBlendMode(bool _forceLegacyBlending) const
|
||||
{
|
||||
bool blastCorpsHack = (config.generalEmulation.hacks & hack_blastCorps) != 0 &&
|
||||
gSP.texture.on == 0 && gDP.otherMode.cycleType < G_CYC_COPY && currentCombiner()->usesTexture();
|
||||
|
||||
if (blastCorpsHack) {
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::ZERO, blend::ONE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_forceLegacyBlending || config.generalEmulation.enableLegacyBlending != 0) {
|
||||
_legacyBlending();
|
||||
return;
|
||||
@@ -854,6 +859,9 @@ void GraphicsDrawer::drawScreenSpaceTriangle(u32 _numVtx, graphics::DrawModePara
|
||||
if (vtx.x < 0) vtx.clip |= CLIP_NEGX;
|
||||
if (vtx.y > gSP.viewport.height) vtx.clip |= CLIP_POSY;
|
||||
if (vtx.y < 0) vtx.clip |= CLIP_NEGY;
|
||||
|
||||
vtx.bc0 = (i % 3 == 0) ? 1.0f : 0.0f;
|
||||
vtx.bc1 = (i % 3 == 1) ? 1.0f : 0.0f;
|
||||
}
|
||||
m_modifyVertices = MODIFY_ALL;
|
||||
|
||||
@@ -871,7 +879,6 @@ void GraphicsDrawer::drawScreenSpaceTriangle(u32 _numVtx, graphics::DrawModePara
|
||||
g_debugger.addTriangles(triParams);
|
||||
m_dmaVerticesNum = 0;
|
||||
|
||||
#ifndef OLD_LLE
|
||||
if (config.frameBufferEmulation.enable != 0) {
|
||||
const f32 maxY = renderTriangles(m_dmaVertices.data(), nullptr, _numVtx);
|
||||
frameBufferList().setBufferChanged(maxY);
|
||||
@@ -882,7 +889,6 @@ void GraphicsDrawer::drawScreenSpaceTriangle(u32 _numVtx, graphics::DrawModePara
|
||||
pCurrentDepthBuffer->setDirty();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gSP.changed |= CHANGED_GEOMETRYMODE;
|
||||
}
|
||||
|
||||
@@ -1062,6 +1068,15 @@ void GraphicsDrawer::drawRect(int _ulx, int _uly, int _lrx, int _lry)
|
||||
m_rect[3].z = Z;
|
||||
m_rect[3].w = W;
|
||||
|
||||
m_rect[0].bc0 = 0.0f;
|
||||
m_rect[0].bc1 = 0.0f;
|
||||
m_rect[1].bc0 = 0.0f;
|
||||
m_rect[1].bc1 = 1.0f;
|
||||
m_rect[2].bc0 = 1.0f;
|
||||
m_rect[2].bc1 = 0.0f;
|
||||
m_rect[3].bc0 = 1.0f;
|
||||
m_rect[3].bc1 = 1.0f;
|
||||
|
||||
DisplayWindow & wnd = dwnd();
|
||||
if (wnd.isAdjustScreen() && (gDP.colorImage.width > VI.width * 98 / 100) && (static_cast<u32>(_lrx - _ulx) < VI.width * 9 / 10)) {
|
||||
const float scale = wnd.getAdjustScale();
|
||||
@@ -1449,6 +1464,16 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
||||
m_rect[i].x *= scale;
|
||||
}
|
||||
|
||||
m_rect[0].bc0 = 0.0f;
|
||||
m_rect[0].bc1 = 0.0f;
|
||||
m_rect[1].bc0 = 0.0f;
|
||||
m_rect[1].bc1 = 1.0f;
|
||||
m_rect[2].bc0 = 1.0f;
|
||||
m_rect[2].bc1 = 0.0f;
|
||||
m_rect[3].bc0 = 1.0f;
|
||||
m_rect[3].bc1 = 1.0f;
|
||||
|
||||
|
||||
if (bUseTexrectDrawer) {
|
||||
if (m_bBGMode) {
|
||||
m_texrectDrawer.addBackgroundRect();
|
||||
|
||||
@@ -34,6 +34,7 @@ struct RectVertex
|
||||
{
|
||||
float x, y, z, w;
|
||||
float s0, t0, s1, t1;
|
||||
float bc0, bc1;
|
||||
};
|
||||
|
||||
typedef std::chrono::milliseconds Milliseconds;
|
||||
|
||||
@@ -72,10 +72,6 @@ void PostProcessor::init()
|
||||
m_FXAAProgram.reset(gfxContext.createFXAAShader());
|
||||
m_postprocessingList.emplace_front(std::mem_fn(&PostProcessor::_doFXAA));
|
||||
}
|
||||
if (config.generalEmulation.enableBlitScreenWorkaround != 0) {
|
||||
m_orientationCorrectionProgram.reset(gfxContext.createOrientationCorrectionShader());
|
||||
m_postprocessingList.emplace_front(std::mem_fn(&PostProcessor::_doOrientationCorrection));
|
||||
}
|
||||
}
|
||||
|
||||
void PostProcessor::destroy()
|
||||
@@ -83,7 +79,6 @@ void PostProcessor::destroy()
|
||||
m_postprocessingList.clear();
|
||||
m_gammaCorrectionProgram.reset();
|
||||
m_FXAAProgram.reset();
|
||||
m_orientationCorrectionProgram.reset();
|
||||
m_pResultBuffer.reset();
|
||||
}
|
||||
|
||||
@@ -100,7 +95,8 @@ PostProcessor & PostProcessor::get()
|
||||
|
||||
void PostProcessor::_preDraw(FrameBuffer * _pBuffer)
|
||||
{
|
||||
if (!m_pResultBuffer || m_pResultBuffer->m_width != _pBuffer->m_width)
|
||||
if (!m_pResultBuffer || m_pResultBuffer->m_width != _pBuffer->m_width ||
|
||||
m_pResultBuffer->m_scale != _pBuffer->m_scale)
|
||||
_createResultBuffer(_pBuffer);
|
||||
|
||||
if (_pBuffer->m_pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
||||
@@ -163,17 +159,6 @@ FrameBuffer * PostProcessor::_doGammaCorrection(FrameBuffer * _pBuffer)
|
||||
return _doPostProcessing(_pBuffer, m_gammaCorrectionProgram.get());
|
||||
}
|
||||
|
||||
FrameBuffer * PostProcessor::_doOrientationCorrection(FrameBuffer * _pBuffer)
|
||||
{
|
||||
if (_pBuffer == nullptr)
|
||||
return nullptr;
|
||||
|
||||
if (config.generalEmulation.enableBlitScreenWorkaround == 0)
|
||||
return _pBuffer;
|
||||
|
||||
return _doPostProcessing(_pBuffer, m_orientationCorrectionProgram.get());
|
||||
}
|
||||
|
||||
FrameBuffer * PostProcessor::_doFXAA(FrameBuffer * _pBuffer)
|
||||
{
|
||||
if (_pBuffer == nullptr)
|
||||
|
||||
@@ -30,7 +30,6 @@ private:
|
||||
PostProcessor(const PostProcessor & _other) = delete;
|
||||
|
||||
FrameBuffer * _doGammaCorrection(FrameBuffer * _pBuffer);
|
||||
FrameBuffer * _doOrientationCorrection(FrameBuffer * _pBuffer);
|
||||
FrameBuffer * _doFXAA(FrameBuffer * _pBuffer);
|
||||
|
||||
void _createResultBuffer(const FrameBuffer * _pMainBuffer);
|
||||
@@ -39,7 +38,6 @@ private:
|
||||
FrameBuffer * _doPostProcessing(FrameBuffer * _pBuffer, graphics::ShaderProgram * _pShader);
|
||||
|
||||
std::unique_ptr<graphics::ShaderProgram> m_gammaCorrectionProgram;
|
||||
std::unique_ptr<graphics::ShaderProgram> m_orientationCorrectionProgram;
|
||||
std::unique_ptr<graphics::ShaderProgram> m_FXAAProgram;
|
||||
std::unique_ptr<FrameBuffer> m_pResultBuffer;
|
||||
CachedTexture * m_pTextureOriginal;
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
|
||||
#include "TextDrawer.h"
|
||||
|
||||
#include <osal_files.h>
|
||||
|
||||
#ifdef MUPENPLUSAPI
|
||||
#include "mupenplus/GLideN64_mupenplus.h"
|
||||
#include <osal_files.h>
|
||||
#endif
|
||||
|
||||
using namespace graphics;
|
||||
@@ -212,6 +213,12 @@ bool getFontFileName(char * _strName)
|
||||
#else
|
||||
sprintf(_strName, "/usr/share/fonts/truetype/freefont/%s", config.font.name.c_str());
|
||||
#endif
|
||||
|
||||
// if the font name is a full path, use that instead
|
||||
if (osal_path_existsA(config.font.name.c_str())) {
|
||||
sprintf(_strName, "%s", config.font.name.c_str());
|
||||
}
|
||||
|
||||
#ifdef MUPENPLUSAPI
|
||||
if (!osal_path_existsA(_strName)) {
|
||||
const char * fontPath = ConfigGetSharedDataFilepath("font.ttf");
|
||||
@@ -346,9 +353,16 @@ void TextDrawer::drawText(const char *_pText, float _x, float _y) const
|
||||
gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA);
|
||||
m_program->activate();
|
||||
|
||||
gfxContext.setViewport((wnd.getScreenWidth() - wnd.getWidth()) / 2, (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset(),
|
||||
wnd.getWidth(), wnd.getHeight());
|
||||
const s32 X = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const s32 Y = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset();
|
||||
const s32 W = static_cast<s32>(wnd.getWidth());
|
||||
const s32 H = static_cast<s32>(wnd.getHeight());
|
||||
|
||||
gfxContext.setViewport(X, Y, W, H);
|
||||
gfxContext.setScissor(X, Y, W, H);
|
||||
|
||||
gSP.changed |= CHANGED_VIEWPORT;
|
||||
gDP.changed |= CHANGED_SCISSOR;
|
||||
|
||||
Context::TexParameters setParams;
|
||||
setParams.handle = m_atlas->m_pTexture->name;
|
||||
|
||||
@@ -939,315 +939,6 @@ void gDPNoOp()
|
||||
DebugMsg( DEBUG_NORMAL | DEBUG_IGNORED, "gDPNoOp();\n" );
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
* Low level triangle *
|
||||
*******************************************
|
||||
* based on sources of ziggy's z64 *
|
||||
*******************************************/
|
||||
|
||||
#ifdef OLD_LLE
|
||||
|
||||
void gDPLLETriangle(u32 _w1, u32 _w2, int _shade, int _texture, int _zbuffer, u32 * _pRdpCmd)
|
||||
{
|
||||
gSP.texture.level = _SHIFTR(_w1, 19, 3);
|
||||
const u32 tile = _SHIFTR(_w1, 16, 3);
|
||||
gDPTile *textureTileOrg[2];
|
||||
textureTileOrg[0] = gSP.textureTile[0];
|
||||
textureTileOrg[1] = gSP.textureTile[1];
|
||||
gSP.textureTile[0] = &gDP.tiles[tile];
|
||||
gSP.textureTile[1] = needReplaceTex1ByTex0() ? &gDP.tiles[tile] : &gDP.tiles[(tile + 1) & 7];
|
||||
|
||||
int j;
|
||||
int xleft, xright, xleft_inc, xright_inc;
|
||||
int r, g, b, a, z, s, t, w;
|
||||
int drdx = 0, dgdx = 0, dbdx = 0, dadx = 0, dzdx = 0, dsdx = 0, dtdx = 0, dwdx = 0;
|
||||
int drde = 0, dgde = 0, dbde = 0, dade = 0, dzde = 0, dsde = 0, dtde = 0, dwde = 0;
|
||||
int flip = (_w1 & 0x800000) ? 1 : 0;
|
||||
|
||||
s32 yl, ym, yh;
|
||||
s32 xl, xm, xh;
|
||||
s32 dxldy, dxhdy, dxmdy;
|
||||
u32 w3, w4, w5, w6, w7, w8;
|
||||
|
||||
u32 * shade_base = _pRdpCmd + 8;
|
||||
u32 * texture_base = _pRdpCmd + 8;
|
||||
u32 * zbuffer_base = _pRdpCmd + 8;
|
||||
|
||||
if (_shade != 0) {
|
||||
texture_base += 16;
|
||||
zbuffer_base += 16;
|
||||
}
|
||||
if (_texture != 0) {
|
||||
zbuffer_base += 16;
|
||||
}
|
||||
|
||||
w3 = _pRdpCmd[2];
|
||||
w4 = _pRdpCmd[3];
|
||||
w5 = _pRdpCmd[4];
|
||||
w6 = _pRdpCmd[5];
|
||||
w7 = _pRdpCmd[6];
|
||||
w8 = _pRdpCmd[7];
|
||||
|
||||
yl = (_w1 & 0x3fff);
|
||||
ym = ((_w2 >> 16) & 0x3fff);
|
||||
yh = ((_w2 >> 0) & 0x3fff);
|
||||
xl = (s32)(w3);
|
||||
xh = (s32)(w5);
|
||||
xm = (s32)(w7);
|
||||
dxldy = (s32)(w4);
|
||||
dxhdy = (s32)(w6);
|
||||
dxmdy = (s32)(w8);
|
||||
|
||||
if (yl & (0x800 << 2)) yl |= 0xfffff000 << 2;
|
||||
if (ym & (0x800 << 2)) ym |= 0xfffff000 << 2;
|
||||
if (yh & (0x800 << 2)) yh |= 0xfffff000 << 2;
|
||||
|
||||
yh &= ~3;
|
||||
|
||||
r = 0xff; g = 0xff; b = 0xff; a = 0xff; z = 0xffff0000; s = 0; t = 0; w = 0x30000;
|
||||
|
||||
if (_shade != 0) {
|
||||
r = (shade_base[0] & 0xffff0000) | ((shade_base[+4] >> 16) & 0x0000ffff);
|
||||
g = ((shade_base[0] << 16) & 0xffff0000) | (shade_base[4] & 0x0000ffff);
|
||||
b = (shade_base[1] & 0xffff0000) | ((shade_base[5] >> 16) & 0x0000ffff);
|
||||
a = ((shade_base[1] << 16) & 0xffff0000) | (shade_base[5] & 0x0000ffff);
|
||||
drdx = (shade_base[2] & 0xffff0000) | ((shade_base[6] >> 16) & 0x0000ffff);
|
||||
dgdx = ((shade_base[2] << 16) & 0xffff0000) | (shade_base[6] & 0x0000ffff);
|
||||
dbdx = (shade_base[3] & 0xffff0000) | ((shade_base[7] >> 16) & 0x0000ffff);
|
||||
dadx = ((shade_base[3] << 16) & 0xffff0000) | (shade_base[7] & 0x0000ffff);
|
||||
drde = (shade_base[8] & 0xffff0000) | ((shade_base[12] >> 16) & 0x0000ffff);
|
||||
dgde = ((shade_base[8] << 16) & 0xffff0000) | (shade_base[12] & 0x0000ffff);
|
||||
dbde = (shade_base[9] & 0xffff0000) | ((shade_base[13] >> 16) & 0x0000ffff);
|
||||
dade = ((shade_base[9] << 16) & 0xffff0000) | (shade_base[13] & 0x0000ffff);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
s = (texture_base[0] & 0xffff0000) | ((texture_base[4] >> 16) & 0x0000ffff);
|
||||
t = ((texture_base[0] << 16) & 0xffff0000) | (texture_base[4] & 0x0000ffff);
|
||||
w = (texture_base[1] & 0xffff0000) | ((texture_base[5] >> 16) & 0x0000ffff);
|
||||
// w = abs(w);
|
||||
dsdx = (texture_base[2] & 0xffff0000) | ((texture_base[6] >> 16) & 0x0000ffff);
|
||||
dtdx = ((texture_base[2] << 16) & 0xffff0000) | (texture_base[6] & 0x0000ffff);
|
||||
dwdx = (texture_base[3] & 0xffff0000) | ((texture_base[7] >> 16) & 0x0000ffff);
|
||||
dsde = (texture_base[8] & 0xffff0000) | ((texture_base[12] >> 16) & 0x0000ffff);
|
||||
dtde = ((texture_base[8] << 16) & 0xffff0000) | (texture_base[12] & 0x0000ffff);
|
||||
dwde = (texture_base[9] & 0xffff0000) | ((texture_base[13] >> 16) & 0x0000ffff);
|
||||
}
|
||||
if (_zbuffer != 0) {
|
||||
z = zbuffer_base[0];
|
||||
dzdx = zbuffer_base[1];
|
||||
dzde = zbuffer_base[2];
|
||||
}
|
||||
|
||||
xh <<= 2; xm <<= 2; xl <<= 2;
|
||||
r <<= 2; g <<= 2; b <<= 2; a <<= 2;
|
||||
dsde >>= 2; dtde >>= 2; dsdx >>= 2; dtdx >>= 2;
|
||||
dzdx >>= 2; dzde >>= 2;
|
||||
dwdx >>= 2; dwde >>= 2;
|
||||
|
||||
#define XSCALE(x) (float(x)/(1<<18))
|
||||
#define YSCALE(y) (float(y)/(1<<2))
|
||||
#define ZSCALE(z) ((gDP.otherMode.depthSource == G_ZS_PRIM)? gDP.primDepth.z : float(u32(z))/0xffff0000)
|
||||
#define PERSP_EN (gDP.otherMode.texturePersp != 0)
|
||||
#define WSCALE(z) 1.0f/(PERSP_EN? (float(u32(z) + 0x10000)/0xffff0000) : 1.0f)
|
||||
#define CSCALE(c) _FIXED2FLOATCOLOR((((c)>0x3ff0000? 0x3ff0000:((c)<0? 0 : (c)))>>18), 8)
|
||||
#define _PERSP(w) ( w )
|
||||
#define PERSP(s, w) ( ((s64)(s) << 20) / (_PERSP(w)? _PERSP(w):1) )
|
||||
#define SSCALE(s, _w) (PERSP_EN? float(PERSP(s, _w))/(1 << 10) : float(s)/(1<<21))
|
||||
#define TSCALE(s, w) (PERSP_EN? float(PERSP(s, w))/(1 << 10) : float(s)/(1<<21))
|
||||
|
||||
GraphicsDrawer & drawer = dwnd().getDrawer();
|
||||
drawer.setDMAVerticesSize(16);
|
||||
SPVertex * vtx0 = drawer.getDMAVerticesData();
|
||||
SPVertex * vtx = vtx0;
|
||||
|
||||
xleft = xm;
|
||||
xright = xh;
|
||||
xleft_inc = dxmdy;
|
||||
xright_inc = dxhdy;
|
||||
|
||||
while (yh<ym &&
|
||||
!((!flip && xleft < xright + 0x10000) ||
|
||||
(flip && xleft > xright - 0x10000))) {
|
||||
xleft += xleft_inc;
|
||||
xright += xright_inc;
|
||||
s += dsde; t += dtde; w += dwde;
|
||||
r += drde; g += dgde; b += dbde; a += dade;
|
||||
z += dzde;
|
||||
yh++;
|
||||
}
|
||||
|
||||
j = ym - yh;
|
||||
if (j > 0) {
|
||||
int dx = (xleft - xright) >> 16;
|
||||
if ((!flip && xleft < xright) || (flip/* && xleft > xright*/))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r + drdx*dx);
|
||||
vtx->g = CSCALE(g + dgdx*dx);
|
||||
vtx->b = CSCALE(b + dbdx*dx);
|
||||
vtx->a = CSCALE(a + dadx*dx);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s + dsdx*dx, w + dwdx*dx);
|
||||
vtx->t = TSCALE(t + dtdx*dx, w + dwdx*dx);
|
||||
}
|
||||
vtx->x = XSCALE(xleft);
|
||||
vtx->y = YSCALE(yh);
|
||||
vtx->z = ZSCALE(z + dzdx*dx);
|
||||
vtx->w = WSCALE(w + dwdx*dx);
|
||||
++vtx;
|
||||
}
|
||||
if ((!flip/* && xleft < xright*/) || (/*flip &&*/ xleft > xright))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r);
|
||||
vtx->g = CSCALE(g);
|
||||
vtx->b = CSCALE(b);
|
||||
vtx->a = CSCALE(a);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s, w);
|
||||
vtx->t = TSCALE(t, w);
|
||||
}
|
||||
vtx->x = XSCALE(xright);
|
||||
vtx->y = YSCALE(yh);
|
||||
vtx->z = ZSCALE(z);
|
||||
vtx->w = WSCALE(w);
|
||||
++vtx;
|
||||
}
|
||||
xleft += xleft_inc*j; xright += xright_inc*j;
|
||||
s += dsde*j; t += dtde*j;
|
||||
if (w + dwde*j != 0) w += dwde*j;
|
||||
else w += dwde*(j - 1);
|
||||
r += drde*j; g += dgde*j; b += dbde*j; a += dade*j;
|
||||
z += dzde*j;
|
||||
// render ...
|
||||
}
|
||||
|
||||
if (xl != xh)
|
||||
xleft = xl;
|
||||
|
||||
//if (yl-ym > 0)
|
||||
{
|
||||
int dx = (xleft - xright) >> 16;
|
||||
if ((!flip && xleft <= xright) ||
|
||||
(flip/* && xleft >= xright*/))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r + drdx*dx);
|
||||
vtx->g = CSCALE(g + dgdx*dx);
|
||||
vtx->b = CSCALE(b + dbdx*dx);
|
||||
vtx->a = CSCALE(a + dadx*dx);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s + dsdx*dx, w + dwdx*dx);
|
||||
vtx->t = TSCALE(t + dtdx*dx, w + dwdx*dx);
|
||||
}
|
||||
vtx->x = XSCALE(xleft);
|
||||
vtx->y = YSCALE(ym);
|
||||
vtx->z = ZSCALE(z + dzdx*dx);
|
||||
vtx->w = WSCALE(w + dwdx*dx);
|
||||
++vtx;
|
||||
}
|
||||
if ((!flip/* && xleft <= xright*/) ||
|
||||
(/*flip && */xleft >= xright))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r);
|
||||
vtx->g = CSCALE(g);
|
||||
vtx->b = CSCALE(b);
|
||||
vtx->a = CSCALE(a);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s, w);
|
||||
vtx->t = TSCALE(t, w);
|
||||
}
|
||||
vtx->x = XSCALE(xright);
|
||||
vtx->y = YSCALE(ym);
|
||||
vtx->z = ZSCALE(z);
|
||||
vtx->w = WSCALE(w);
|
||||
++vtx;
|
||||
}
|
||||
}
|
||||
xleft_inc = dxldy;
|
||||
xright_inc = dxhdy;
|
||||
|
||||
j = yl - ym;
|
||||
//j--; // ?
|
||||
xleft += xleft_inc*j; xright += xright_inc*j;
|
||||
s += dsde*j; t += dtde*j; w += dwde*j;
|
||||
r += drde*j; g += dgde*j; b += dbde*j; a += dade*j;
|
||||
z += dzde*j;
|
||||
|
||||
while (yl>ym &&
|
||||
!((!flip && xleft < xright + 0x10000) ||
|
||||
(flip && xleft > xright - 0x10000))) {
|
||||
xleft -= xleft_inc; xright -= xright_inc;
|
||||
s -= dsde; t -= dtde; w -= dwde;
|
||||
r -= drde; g -= dgde; b -= dbde; a -= dade;
|
||||
z -= dzde;
|
||||
--j;
|
||||
--yl;
|
||||
}
|
||||
|
||||
// render ...
|
||||
if (j >= 0) {
|
||||
int dx = (xleft - xright) >> 16;
|
||||
if ((!flip && xleft <= xright) ||
|
||||
(flip/* && xleft >= xright*/))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r + drdx*dx);
|
||||
vtx->g = CSCALE(g + dgdx*dx);
|
||||
vtx->b = CSCALE(b + dbdx*dx);
|
||||
vtx->a = CSCALE(a + dadx*dx);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s + dsdx*dx, w + dwdx*dx);
|
||||
vtx->t = TSCALE(t + dtdx*dx, w + dwdx*dx);
|
||||
}
|
||||
vtx->x = XSCALE(xleft);
|
||||
vtx->y = YSCALE(yl);
|
||||
vtx->z = ZSCALE(z + dzdx*dx);
|
||||
vtx->w = WSCALE(w + dwdx*dx);
|
||||
++vtx;
|
||||
}
|
||||
if ((!flip/* && xleft <= xright*/) ||
|
||||
(/*flip &&*/ xleft >= xright))
|
||||
{
|
||||
if (_shade != 0) {
|
||||
vtx->r = CSCALE(r);
|
||||
vtx->g = CSCALE(g);
|
||||
vtx->b = CSCALE(b);
|
||||
vtx->a = CSCALE(a);
|
||||
}
|
||||
if (_texture != 0) {
|
||||
vtx->s = SSCALE(s, w);
|
||||
vtx->t = TSCALE(t, w);
|
||||
}
|
||||
vtx->x = XSCALE(xright);
|
||||
vtx->y = YSCALE(yl);
|
||||
vtx->z = ZSCALE(z);
|
||||
vtx->w = WSCALE(w);
|
||||
++vtx;
|
||||
}
|
||||
}
|
||||
|
||||
if (_texture != 0)
|
||||
gDP.changed |= CHANGED_TILE;
|
||||
if (_zbuffer != 0)
|
||||
gSP.geometryMode |= G_ZBUFFER;
|
||||
|
||||
drawer.drawScreenSpaceTriangle(static_cast<u32>(vtx - vtx0));
|
||||
gSP.textureTile[0] = textureTileOrg[0];
|
||||
gSP.textureTile[1] = textureTileOrg[1];
|
||||
|
||||
DebugMsg(DEBUG_NORMAL, "gDPLLETriangle(%08x, %08x) shade: %d, texture: %d, zbuffer: %d\n",
|
||||
_w1, _w2, _shade, _texture, _zbuffer);
|
||||
}
|
||||
|
||||
#endif // OLD_LLE
|
||||
|
||||
LLETriangle::LLETriangle()
|
||||
{
|
||||
m_textureTileOrg[0] = gSP.textureTile[0];
|
||||
@@ -1279,7 +970,6 @@ void LLETriangle::start(u32 _tile)
|
||||
|
||||
void LLETriangle::flush(u32 _cmd)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
if (_cmd >= 0x08 && _cmd <= 0x0f)
|
||||
return;
|
||||
|
||||
@@ -1292,7 +982,6 @@ void LLETriangle::flush(u32 _cmd)
|
||||
gSP.texture.scales = m_textureScaleOrg[0];
|
||||
gSP.texture.scalet = m_textureScaleOrg[1];
|
||||
m_flushed = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
||||
@@ -1654,118 +1343,79 @@ void LLETriangle::draw(bool _shade, bool _texture, bool _zbuffer, u32 * _pData)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OLD_LLE
|
||||
static void gDPTriangle(u32 _w1, u32 _w2, int shade, int texture, int zbuffer)
|
||||
{
|
||||
gDPLLETriangle(_w1, _w2, shade, texture, zbuffer, RDP.cmd_data + RDP.cmd_cur);
|
||||
}
|
||||
#endif
|
||||
|
||||
void gDPTriFill(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32));
|
||||
memset(&ewdata[8], 0, 36 * sizeof(s32));
|
||||
LLETriangle::get().draw(0, 0, 0, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 0, 0, 0);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trifill\n");
|
||||
}
|
||||
|
||||
void gDPTriShade(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 24 * sizeof(s32));
|
||||
memset(&ewdata[24], 0, 20 * sizeof(s32));
|
||||
LLETriangle::get().draw(1, 0, 0, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 1, 0, 0);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trishade\n");
|
||||
}
|
||||
|
||||
void gDPTriTxtr(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32));
|
||||
memset(&ewdata[8], 0, 16 * sizeof(s32));
|
||||
memcpy(&ewdata[24], RDP.cmd_data + RDP.cmd_cur + 8, 16 * sizeof(s32));
|
||||
memset(&ewdata[40], 0, 4 * sizeof(s32));
|
||||
LLETriangle::get().draw(0, 1, 0, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 0, 1, 0);
|
||||
#endif
|
||||
DebugMsg(DEBUG_NORMAL, "tritxtr\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeTxtr(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 40 * sizeof(s32));
|
||||
memset(&ewdata[40], 0, 4 * sizeof(s32));
|
||||
LLETriangle::get().draw(1, 1, 0, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 1, 1, 0);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trishadetxtr\n");
|
||||
}
|
||||
|
||||
void gDPTriFillZ(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32));
|
||||
memset(&ewdata[8], 0, 32 * sizeof(s32));
|
||||
memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 8, 4 * sizeof(s32));
|
||||
LLETriangle::get().draw(0, 0, 1, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 0, 0, 1);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trifillz\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeZ(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 24 * sizeof(s32));
|
||||
memset(&ewdata[24], 0, 16 * sizeof(s32));
|
||||
memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 24, 4 * sizeof(s32));
|
||||
LLETriangle::get().draw(1, 0, 1, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 1, 0, 1);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trishadez\n");
|
||||
}
|
||||
|
||||
void gDPTriTxtrZ(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 8 * sizeof(s32));
|
||||
memset(&ewdata[8], 0, 16 * sizeof(s32));
|
||||
memcpy(&ewdata[24], RDP.cmd_data + RDP.cmd_cur + 8, 16 * sizeof(s32));
|
||||
memcpy(&ewdata[40], RDP.cmd_data + RDP.cmd_cur + 24, 4 * sizeof(s32));
|
||||
LLETriangle::get().draw(0, 1, 1, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 0, 1, 1);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "tritxtrz\n");
|
||||
}
|
||||
|
||||
void gDPTriShadeTxtrZ(u32 w0, u32 w1)
|
||||
{
|
||||
#ifndef OLD_LLE
|
||||
u32 ewdata[44];
|
||||
memcpy(&ewdata[0], RDP.cmd_data + RDP.cmd_cur, 44 * sizeof(s32));
|
||||
LLETriangle::get().draw(1, 1, 1, ewdata);
|
||||
#else
|
||||
gDPTriangle(w0, w1, 1, 1, 1);
|
||||
#endif
|
||||
DebugMsg( DEBUG_NORMAL, "trishadetxtrz\n");
|
||||
}
|
||||
@@ -260,8 +260,6 @@ struct gDPInfo
|
||||
|
||||
extern gDPInfo gDP;
|
||||
|
||||
//#define OLD_LLE
|
||||
|
||||
class LLETriangle
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -40,6 +40,7 @@ struct SPVertex
|
||||
f32 r, g, b, a;
|
||||
f32 flat_r, flat_g, flat_b, flat_a;
|
||||
f32 s, t;
|
||||
f32 bc0, bc1;
|
||||
u32 modify;
|
||||
u8 HWLight;
|
||||
u8 clip;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
SCRIPT_DIRECTORY=`dirname $0`
|
||||
SCRIPT_DIRECTORY=`dirname "$0"`
|
||||
rev=\"`git rev-parse --short HEAD`\"
|
||||
lastrev=$(head -n 1 $SCRIPT_DIRECTORY/Revision.h 2> /dev/null | awk -F'PLUGIN_REVISION ' {'print $2'})
|
||||
lastrev=$(head -n 1 "$SCRIPT_DIRECTORY/Revision.h" 2> /dev/null | cut -d ' ' -f3)
|
||||
|
||||
echo current revision $rev
|
||||
echo last build revision $lastrev
|
||||
|
||||
if [ "$lastrev" != "$rev" ]
|
||||
then
|
||||
echo "#define PLUGIN_REVISION $rev" > $SCRIPT_DIRECTORY/Revision.h
|
||||
echo "#define PLUGIN_REVISION_W L$rev" >> $SCRIPT_DIRECTORY/Revision.h
|
||||
echo "#define PLUGIN_REVISION $rev" > "$SCRIPT_DIRECTORY/Revision.h"
|
||||
echo "#define PLUGIN_REVISION_W L$rev" >> "$SCRIPT_DIRECTORY/Revision.h"
|
||||
fi
|
||||
@@ -149,6 +149,8 @@ bool Config_SetDefault()
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHWLighting", config.generalEmulation.enableHWLighting, "Enable hardware per-pixel lighting.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCoverage", config.generalEmulation.enableCoverage, "Enable pixel coverage calculation. Used for better blending emulation and wire-frame mode. Needs fast GPU.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableShadersStorage", config.generalEmulation.enableShadersStorage, "Use persistent storage for compiled shaders.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableLegacyBlending", config.generalEmulation.enableLegacyBlending, "Do not use shaders to emulate N64 blending modes. Works faster on slow GPU. Can cause glitches.");
|
||||
@@ -160,8 +162,6 @@ bool Config_SetDefault()
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCustomSettings", config.generalEmulation.enableCustomSettings, "Use GLideN64 per-game settings.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
#if defined(OS_ANDROID) || defined(OS_IOS)
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableBlitScreenWorkaround", config.generalEmulation.enableBlitScreenWorkaround, "Enable to render everything upside down");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "ForcePolygonOffset", config.generalEmulation.forcePolygonOffset, "If true, use polygon offset values specified below");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultFloat(g_configVideoGliden64, "PolygonOffsetFactor", config.generalEmulation.polygonOffsetFactor, "Specifies a scale factor that is used to create a variable depth offset for each polygon");
|
||||
@@ -362,6 +362,8 @@ void Config_LoadCustomConfig()
|
||||
if (result == M64ERR_SUCCESS) config.generalEmulation.enableLOD = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableHWLighting", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.generalEmulation.enableHWLighting = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableCoverage", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.generalEmulation.enableCoverage = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableShadersStorage", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.generalEmulation.enableShadersStorage = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableLegacyBlending", value, sizeof(value));
|
||||
@@ -485,13 +487,13 @@ void Config_LoadConfig()
|
||||
|
||||
config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD");
|
||||
config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting");
|
||||
config.generalEmulation.enableCoverage = ConfigGetParamBool(g_configVideoGliden64, "EnableCoverage");
|
||||
config.generalEmulation.enableShadersStorage = ConfigGetParamBool(g_configVideoGliden64, "EnableShadersStorage");
|
||||
config.generalEmulation.enableLegacyBlending = ConfigGetParamBool(g_configVideoGliden64, "EnableLegacyBlending");
|
||||
config.generalEmulation.enableHybridFilter = ConfigGetParamBool(g_configVideoGliden64, "EnableHybridFilter");
|
||||
config.generalEmulation.enableFragmentDepthWrite = ConfigGetParamBool(g_configVideoGliden64, "EnableFragmentDepthWrite");
|
||||
config.generalEmulation.enableCustomSettings = ConfigGetParamBool(g_configVideoGliden64, "EnableCustomSettings");
|
||||
#if defined(OS_ANDROID) || defined(OS_IOS)
|
||||
config.generalEmulation.enableBlitScreenWorkaround = ConfigGetParamBool(g_configVideoGliden64, "EnableBlitScreenWorkaround");
|
||||
config.generalEmulation.forcePolygonOffset = ConfigGetParamBool(g_configVideoGliden64, "ForcePolygonOffset");
|
||||
config.generalEmulation.polygonOffsetFactor = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetFactor");
|
||||
config.generalEmulation.polygonOffsetUnits = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetUnits");
|
||||
|
||||
Reference in new issue
Block a user