mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-25 22:09:35 +00:00
Add option enableHalosRemoval for bilinear filtering.
This commit is contained in:
parent
2712e8f509
commit
32901bf5dd
|
@ -28,6 +28,7 @@ void Config::resetToDefaults()
|
|||
|
||||
texture.maxAnisotropy = 0;
|
||||
texture.bilinearMode = BILINEAR_STANDARD;
|
||||
texture.enableHalosRemoval = 0;
|
||||
texture.screenShotFormat = 0;
|
||||
|
||||
generalEmulation.enableLOD = 1;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Types.h"
|
||||
|
||||
#define CONFIG_WITH_PROFILES 23U
|
||||
#define CONFIG_VERSION_CURRENT 25U
|
||||
#define CONFIG_VERSION_CURRENT 26U
|
||||
|
||||
#define BILINEAR_3POINT 0
|
||||
#define BILINEAR_STANDARD 1
|
||||
|
@ -35,6 +35,7 @@ struct Config
|
|||
u32 maxAnisotropy;
|
||||
f32 maxAnisotropyF;
|
||||
u32 bilinearMode;
|
||||
u32 enableHalosRemoval;
|
||||
u32 screenShotFormat;
|
||||
} texture;
|
||||
|
||||
|
|
|
@ -125,13 +125,8 @@ void ConfigDialog::_init()
|
|||
case BILINEAR_STANDARD:
|
||||
ui->blnrStandardRadioButton->setChecked(true);
|
||||
break;
|
||||
case BILINEAR_3POINT_WITH_COLOR_BLEEDING:
|
||||
ui->blnr3PointColorBleedingRadioButton->setChecked(true);
|
||||
break;
|
||||
case BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA:
|
||||
ui->blnrStandardColorBleedingRadioButton->setChecked(true);
|
||||
break;
|
||||
}
|
||||
ui->halosRemovalCheckBox->setChecked(config.texture.enableHalosRemoval != 0);
|
||||
|
||||
switch (config.texture.screenShotFormat) {
|
||||
case 0:
|
||||
|
@ -412,10 +407,8 @@ void ConfigDialog::accept()
|
|||
config.texture.bilinearMode = BILINEAR_STANDARD;
|
||||
else if (ui->blnr3PointRadioButton->isChecked())
|
||||
config.texture.bilinearMode = BILINEAR_3POINT;
|
||||
else if (ui->blnr3PointColorBleedingRadioButton->isChecked())
|
||||
config.texture.bilinearMode = BILINEAR_3POINT_WITH_COLOR_BLEEDING;
|
||||
else if (ui->blnrStandardColorBleedingRadioButton->isChecked())
|
||||
config.texture.bilinearMode = BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA;
|
||||
|
||||
config.texture.enableHalosRemoval = ui->halosRemovalCheckBox->isChecked() ? 1 : 0;
|
||||
|
||||
if (ui->pngRadioButton->isChecked())
|
||||
config.texture.screenShotFormat = 0;
|
||||
|
|
|
@ -34,6 +34,7 @@ void _loadSettings(QSettings & settings)
|
|||
settings.beginGroup("texture");
|
||||
config.texture.maxAnisotropy = settings.value("maxAnisotropy", config.texture.maxAnisotropy).toInt();
|
||||
config.texture.bilinearMode = settings.value("bilinearMode", config.texture.bilinearMode).toInt();
|
||||
config.texture.enableHalosRemoval = settings.value("enableHalosRemoval", config.texture.enableHalosRemoval).toInt();
|
||||
config.texture.screenShotFormat = settings.value("screenShotFormat", config.texture.screenShotFormat).toInt();
|
||||
settings.endGroup();
|
||||
|
||||
|
@ -201,6 +202,7 @@ void writeSettings(const QString & _strIniFolder)
|
|||
settings.beginGroup("texture");
|
||||
settings.setValue("maxAnisotropy", config.texture.maxAnisotropy);
|
||||
settings.setValue("bilinearMode", config.texture.bilinearMode);
|
||||
settings.setValue("enableHalosRemoval", config.texture.enableHalosRemoval);
|
||||
settings.setValue("screenShotFormat", config.texture.screenShotFormat);
|
||||
settings.endGroup();
|
||||
|
||||
|
@ -387,6 +389,7 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
|
|||
settings.beginGroup("texture");
|
||||
WriteCustomSetting(texture, maxAnisotropy);
|
||||
WriteCustomSetting(texture, bilinearMode);
|
||||
WriteCustomSetting(texture, enableHalosRemoval);
|
||||
WriteCustomSetting(texture, screenShotFormat);
|
||||
settings.endGroup();
|
||||
|
||||
|
|
|
@ -823,16 +823,9 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="blnr3PointColorBleedingRadioButton">
|
||||
<widget class="QCheckBox" name="halosRemovalCheckBox">
|
||||
<property name="text">
|
||||
<string>3 point with halos removal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="blnrStandardColorBleedingRadioButton">
|
||||
<property name="text">
|
||||
<string>Standard with halos removal</string>
|
||||
<string>Enable halos removal</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace graphics {
|
|||
std::vector<u32> vecOptions;
|
||||
vecOptions.push_back(config.video.multisampling > 0 ? 1 : 0);
|
||||
vecOptions.push_back(config.texture.bilinearMode);
|
||||
vecOptions.push_back(config.texture.enableHalosRemoval);
|
||||
vecOptions.push_back(config.generalEmulation.enableHWLighting);
|
||||
vecOptions.push_back(config.generalEmulation.enableNoise);
|
||||
vecOptions.push_back(config.generalEmulation.enableLOD);
|
||||
|
|
|
@ -1009,7 +1009,8 @@ public:
|
|||
|
||||
if (g_textureConvert.useTextureFiltering()) {
|
||||
shaderPart += "uniform lowp int uTextureFilterMode; \n";
|
||||
if (config.texture.bilinearMode == BILINEAR_3POINT) {
|
||||
switch (config.texture.bilinearMode + config.texture.enableHalosRemoval * 2) {
|
||||
case BILINEAR_3POINT:
|
||||
// 3 point texture filtering.
|
||||
// Original author: ArthurCarvalho
|
||||
// GLSL implementation: twinaphex, mupen64plus-libretro project.
|
||||
|
@ -1026,7 +1027,8 @@ public:
|
|||
" name = c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0); \\\n"
|
||||
" } \n"
|
||||
;
|
||||
} else if (config.texture.bilinearMode == BILINEAR_STANDARD) {
|
||||
break;
|
||||
case BILINEAR_STANDARD:
|
||||
shaderPart +=
|
||||
"#define TEX_OFFSET(off, tex, texCoord) texture(tex, texCoord - (off)/texSize) \n"
|
||||
"#define TEX_FILTER(name, tex, texCoord) \\\n"
|
||||
|
@ -1048,7 +1050,8 @@ public:
|
|||
" name = mix( pInterp_q0, pInterp_q1, interpolationFactor.y ); \\\n" // Interpolate in Y direction.
|
||||
"} \n"
|
||||
;
|
||||
} else if (config.texture.bilinearMode == BILINEAR_3POINT_WITH_COLOR_BLEEDING) {
|
||||
break;
|
||||
case BILINEAR_3POINT_WITH_COLOR_BLEEDING:
|
||||
// 3 point texture filtering.
|
||||
// Original author: ArthurCarvalho
|
||||
// GLSL implementation: twinaphex, mupen64plus-libretro project.
|
||||
|
@ -1073,7 +1076,8 @@ public:
|
|||
" else name = c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0); \\\n"
|
||||
"} \n"
|
||||
;
|
||||
} else { // BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA
|
||||
break;
|
||||
case BILINEAR_STANDARD_WITH_COLOR_BLEEDING_AND_PREMULTIPLIED_ALPHA:
|
||||
shaderPart +=
|
||||
"#define TEX_OFFSET(off, tex, texCoord) texture(tex, texCoord - (off)/texSize) \n"
|
||||
"#define TEX_FILTER(name, tex, texCoord) \\\n"
|
||||
|
@ -1114,7 +1118,7 @@ public:
|
|||
" mediump vec2 interpolationFactor = abs(offset); \\\n"
|
||||
" lowp vec4 pInterp_q0 = mix( p0q0, p1q0, interpolationFactor.x ); \\\n" // Interpolates top row in X direction.
|
||||
" lowp vec4 pInterp_q1 = mix( p0q1, p1q1, interpolationFactor.x ); \\\n" // Interpolates bottom row in X direction.
|
||||
" name = mix( pInterp_q0, pInterp_q1, interpolationFactor.y ); \\\n"
|
||||
" name = mix( pInterp_q0, pInterp_q1, interpolationFactor.y ); \\\n"
|
||||
" } \\\n"
|
||||
" else{ \\\n"
|
||||
" mediump vec2 interpolationFactor = abs(offset); \\\n"
|
||||
|
@ -1124,6 +1128,7 @@ public:
|
|||
" } \\\n"
|
||||
"} \n"
|
||||
;
|
||||
break;
|
||||
}
|
||||
shaderPart +=
|
||||
"#define READ_TEX(name, tex, texCoord, fbMonochrome, fbFixedAlpha) \\\n"
|
||||
|
@ -1853,7 +1858,7 @@ public:
|
|||
" } \n"
|
||||
;
|
||||
if (g_textureConvert.useTextureFiltering()) {
|
||||
if (config.texture.bilinearMode == BILINEAR_3POINT || config.texture.bilinearMode == BILINEAR_3POINT_WITH_COLOR_BLEEDING) {
|
||||
if (config.texture.bilinearMode == BILINEAR_3POINT) {
|
||||
shaderPart +=
|
||||
"uniform mediump vec2 uTextureSize[2]; \n"
|
||||
// 3 point texture filtering.
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace glsl {
|
|||
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
|
||||
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
|
||||
|
||||
const u32 m_formatVersion = 0x24U;
|
||||
const u32 m_formatVersion = 0x25U;
|
||||
const u32 m_keysFormatVersion = 0x04;
|
||||
const opengl::GLInfo & m_glinfo;
|
||||
opengl::CachedUseProgram * m_useProgram;
|
||||
|
|
|
@ -57,7 +57,9 @@ bool Config_SetDefault()
|
|||
assert(res == M64ERR_SUCCESS);
|
||||
|
||||
//#Texture Settings
|
||||
res = ConfigSetDefaultInt(g_configVideoGliden64, "bilinearMode", config.texture.bilinearMode, "Bilinear filtering mode (0=N64 3point, 1=standard, 2=N64 3point with color bleeding, 3=standard with color bleeding and premultiplied alpha)");
|
||||
res = ConfigSetDefaultInt(g_configVideoGliden64, "bilinearMode", config.texture.bilinearMode, "Bilinear filtering mode (0=N64 3point, 1=standard)");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "enableHalosRemoval", config.texture.enableHalosRemoval, "Remove halos around filtered textures.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultInt(g_configVideoGliden64, "MaxAnisotropy", config.texture.maxAnisotropy, "Max level of Anisotropic Filtering, 0 for off");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
|
@ -250,6 +252,8 @@ void Config_LoadCustomConfig()
|
|||
if (result == M64ERR_SUCCESS) config.texture.maxAnisotropy = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\bilinearMode", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.texture.bilinearMode = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\enableHalosRemoval", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.texture.enableHalosRemoval = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\screenShotFormat", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.texture.screenShotFormat = atoi(value);
|
||||
|
||||
|
@ -367,6 +371,7 @@ void Config_LoadConfig()
|
|||
//#Texture Settings
|
||||
config.texture.bilinearMode = ConfigGetParamInt(g_configVideoGliden64, "bilinearMode");
|
||||
config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy");
|
||||
config.texture.enableHalosRemoval = ConfigGetParamBool(g_configVideoGliden64, "enableHalosRemoval");
|
||||
//#Emulation Settings
|
||||
config.generalEmulation.enableNoise = ConfigGetParamBool(g_configVideoGliden64, "EnableNoise");
|
||||
config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD");
|
||||
|
|
Loading…
Reference in New Issue
Block a user