1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

Make the hybrid texture filter optional through configuration

This commit is contained in:
fzurita 2020-02-08 15:53:50 -05:00 committed by Sergey Lipskiy
parent 0692abea4a
commit 0a5216f8e1
5 changed files with 33 additions and 25 deletions

View File

@ -43,6 +43,7 @@ void Config::resetToDefaults()
generalEmulation.enableCustomSettings = 1;
generalEmulation.enableShadersStorage = 1;
generalEmulation.enableLegacyBlending = 0;
generalEmulation.enableHybridFilter = 1;
generalEmulation.hacks = 0;
#if defined(OS_ANDROID) || defined(OS_IOS)
generalEmulation.enableFragmentDepthWrite = 0;

View File

@ -53,6 +53,7 @@ struct Config
u32 enableCustomSettings;
u32 enableShadersStorage;
u32 enableLegacyBlending;
u32 enableHybridFilter;
u32 enableFragmentDepthWrite;
u32 enableBlitScreenWorkaround;
u32 hacks;

View File

@ -10,6 +10,7 @@
#include <Graphics/ObjectHandle.h>
#include <Graphics/ShaderProgram.h>
#include <Graphics/OpenGLContext/opengl_CachedFunctions.h>
#include <Config.h>
#include "glsl_SpecialShadersFactory.h"
#include "glsl_ShaderPart.h"
#include "glsl_FXAA.h"
@ -448,17 +449,7 @@ namespace glsl {
public:
TexrectCopy(const opengl::GLInfo & _glinfo)
{
if (_glinfo.isGLES2) {
m_part =
"IN mediump vec2 vTexCoord0; \n"
"uniform sampler2D uTex0; \n"
"OUT lowp vec4 fragColor; \n"
" \n"
"void main() \n"
"{ \n"
" fragColor = texture2D(uTex0, vTexCoord0); \n"
;
} else {
if (config.generalEmulation.enableHybridFilter) {
m_part = getHybridTextureFilter();
m_part +=
"IN mediump vec2 vTexCoord0; \n"
@ -468,6 +459,16 @@ namespace glsl {
"{ \n"
" fragColor = hybridFilter(vTexCoord0); \n"
;
} else {
m_part =
"IN mediump vec2 vTexCoord0; \n"
"uniform sampler2D uTex0; \n"
"OUT lowp vec4 fragColor; \n"
" \n"
"void main() \n"
"{ \n"
" fragColor = texture2D(uTex0, vTexCoord0); \n"
;
}
}
};
@ -479,19 +480,7 @@ namespace glsl {
public:
TexrectColorAndDepthCopy(const opengl::GLInfo & _glinfo)
{
if (_glinfo.isGLES2) {
m_part =
"IN mediump vec2 vTexCoord0; \n"
"uniform sampler2D uTex0; \n"
"uniform sampler2D uTex1; \n"
"OUT lowp vec4 fragColor; \n"
" \n"
"void main() \n"
"{ \n"
" fragColor = texture2D(uTex0, vTexCoord0); \n"
" gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n"
;
} else {
if (config.generalEmulation.enableHybridFilter) {
m_part = getHybridTextureFilter();
m_part +=
"IN mediump vec2 vTexCoord0; \n"
@ -503,6 +492,18 @@ namespace glsl {
" fragColor = hybridFilter(vTexCoord0); \n"
" gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n"
;
} else {
m_part =
"IN mediump vec2 vTexCoord0; \n"
"uniform sampler2D uTex0; \n"
"uniform sampler2D uTex1; \n"
"OUT lowp vec4 fragColor; \n"
" \n"
"void main() \n"
"{ \n"
" fragColor = texture2D(uTex0, vTexCoord0); \n"
" gl_FragDepth = texture2D(uTex1, vTexCoord0).r; \n"
;
}
}
};

View File

@ -95,8 +95,10 @@ void GLInfo::init() {
const bool imageTexturesInterlock = imageTextures && (fragment_interlock || fragment_interlockNV || fragment_ordering);
if (isGLES2)
if (isGLES2) {
config.generalEmulation.enableFragmentDepthWrite = 0;
config.generalEmulation.enableHybridFilter = 0;
}
bufferStorage = (!isGLESX && (numericVersion >= 44)) || Utils::isExtensionSupported(*this, "GL_ARB_buffer_storage") ||
Utils::isExtensionSupported(*this, "GL_EXT_buffer_storage");

View File

@ -77,6 +77,8 @@ bool Config_SetDefault()
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.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHybridFilter", config.generalEmulation.enableHybridFilter, "Enable hybrid integer scaling filter, this can be slow with low-end GPUs");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableFragmentDepthWrite", config.generalEmulation.enableFragmentDepthWrite, "Enable writing of fragment depth. Some mobile GPUs do not support it, thus it made optional. Leave enabled.");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableCustomSettings", config.generalEmulation.enableCustomSettings, "Use GLideN64 per-game settings.");
@ -397,6 +399,7 @@ void Config_LoadConfig()
config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting");
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)