diff --git a/src/BufferCopy/ColorBufferToRDRAM.cpp b/src/BufferCopy/ColorBufferToRDRAM.cpp
index 4e80f8e1..d8784f76 100644
--- a/src/BufferCopy/ColorBufferToRDRAM.cpp
+++ b/src/BufferCopy/ColorBufferToRDRAM.cpp
@@ -261,26 +261,29 @@ u16 ColorBufferToRDRAM::_RGBAtoRGBA16(u32 _c, u32 x, u32 y) {
union RGBA c;
c.raw = _c;
- switch (config.generalEmulation.bufferDitheringMode) {
- case Config::BufferDitheringMode::bdmBayer:
- case Config::BufferDitheringMode::bdmMagicSquare:
- {
- s32 threshold = config.generalEmulation.bufferDitheringMode == Config::BufferDitheringMode::bdmBayer ?
- thresholdMapBayer[x & 3][y & 3] :
- thresholdMapMagicSquare[x & 3][y & 3];
- c.r = (u8)std::max(std::min((s32)c.r + threshold, 255), 0);
- c.g = (u8)std::max(std::min((s32)c.g + threshold, 255), 0);
- c.b = (u8)std::max(std::min((s32)c.b + threshold, 255), 0);
- }
- break;
- case Config::BufferDitheringMode::bdmBlueNoise:
- {
- const BlueNoiseItem& threshold = blueNoiseTex[m_blueNoiseIdx & 7][x & 63][y & 63];
- c.r = (u8)std::max(std::min((s32)c.r + threshold.r, 255), 0);
- c.g = (u8)std::max(std::min((s32)c.g + threshold.g, 255), 0);
- c.b = (u8)std::max(std::min((s32)c.b + threshold.b, 255), 0);
- }
- break;
+ if (config.generalEmulation.enableDitheringPattern == 0 || config.frameBufferEmulation.nativeResFactor != 1) {
+ // Apply color dithering
+ switch (config.generalEmulation.rdramImageDitheringMode) {
+ case Config::BufferDitheringMode::bdmBayer:
+ case Config::BufferDitheringMode::bdmMagicSquare:
+ {
+ s32 threshold = config.generalEmulation.rdramImageDitheringMode == Config::BufferDitheringMode::bdmBayer ?
+ thresholdMapBayer[x & 3][y & 3] :
+ thresholdMapMagicSquare[x & 3][y & 3];
+ c.r = (u8)std::max(std::min((s32)c.r + threshold, 255), 0);
+ c.g = (u8)std::max(std::min((s32)c.g + threshold, 255), 0);
+ c.b = (u8)std::max(std::min((s32)c.b + threshold, 255), 0);
+ }
+ break;
+ case Config::BufferDitheringMode::bdmBlueNoise:
+ {
+ const BlueNoiseItem& threshold = blueNoiseTex[m_blueNoiseIdx & 7][x & 63][y & 63];
+ c.r = (u8)std::max(std::min((s32)c.r + threshold.r, 255), 0);
+ c.g = (u8)std::max(std::min((s32)c.g + threshold.g, 255), 0);
+ c.b = (u8)std::max(std::min((s32)c.b + threshold.b, 255), 0);
+ }
+ break;
+ }
}
return ((c.r >> 3) << 11) | ((c.g >> 3) << 6) | ((c.b >> 3) << 1) | (c.a == 0 ? 0 : 1);
diff --git a/src/Config.cpp b/src/Config.cpp
index 9589bff9..77d40640 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -38,8 +38,10 @@ void Config::resetToDefaults()
texture.screenShotFormat = 0;
generalEmulation.enableLOD = 1;
- generalEmulation.ditheringMode = DitheringMode::dmNoise;
- generalEmulation.bufferDitheringMode = BufferDitheringMode::bdmBlueNoise;
+ generalEmulation.enableHiresNoiseDithering = 0;
+ generalEmulation.enableDitheringPattern = 0;
+ generalEmulation.enableDitheringQuantization = 0;
+ generalEmulation.rdramImageDitheringMode = BufferDitheringMode::bdmBlueNoise;
generalEmulation.enableHWLighting = 0;
generalEmulation.enableCustomSettings = 1;
generalEmulation.enableShadersStorage = 1;
diff --git a/src/Config.h b/src/Config.h
index 89c48261..eb0d10d4 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -46,14 +46,6 @@ struct Config
tcForce
};
- enum DitheringMode {
- dmDisable = 0,
- dmNoise,
- dmNoiseWithQuant,
- dmFull,
- dmFullWithQuant
- };
-
enum BufferDitheringMode {
bdmDisable = 0,
bdmBayer,
@@ -62,8 +54,10 @@ struct Config
};
struct {
- u32 ditheringMode;
- u32 bufferDitheringMode;
+ u32 enableHiresNoiseDithering;
+ u32 enableDitheringPattern;
+ u32 enableDitheringQuantization;
+ u32 rdramImageDitheringMode;
u32 enableLOD;
u32 enableHWLighting;
u32 enableCustomSettings;
diff --git a/src/GLideNUI/ConfigDialog.cpp b/src/GLideNUI/ConfigDialog.cpp
index d1c35d04..9323fc89 100644
--- a/src/GLideNUI/ConfigDialog.cpp
+++ b/src/GLideNUI/ConfigDialog.cpp
@@ -142,7 +142,7 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
break;
}
- ui->ditheringModeComboBox->setCurrentIndex(config.generalEmulation.ditheringMode);
+ ui->ditheringModeComboBox->setCurrentIndex(config.generalEmulation.rdramImageDitheringMode);
switch (config.texture.screenShotFormat) {
case 0:
@@ -444,7 +444,7 @@ void ConfigDialog::accept(bool justSave) {
else if (ui->blnr3PointRadioButton->isChecked())
config.texture.bilinearMode = BILINEAR_3POINT;
- config.generalEmulation.ditheringMode = ui->ditheringModeComboBox->currentIndex();
+ config.generalEmulation.rdramImageDitheringMode = ui->ditheringModeComboBox->currentIndex();
if (ui->pngRadioButton->isChecked())
config.texture.screenShotFormat = 0;
diff --git a/src/GLideNUI/Settings.cpp b/src/GLideNUI/Settings.cpp
index f8a38ebe..99c252e9 100644
--- a/src/GLideNUI/Settings.cpp
+++ b/src/GLideNUI/Settings.cpp
@@ -40,7 +40,7 @@ void _loadSettings(QSettings & settings)
settings.endGroup();
settings.beginGroup("generalEmulation");
- config.generalEmulation.ditheringMode = settings.value("ditheringMode", config.generalEmulation.ditheringMode).toInt();
+ config.generalEmulation.enableDitheringPattern = settings.value("enableDitheringPattern", config.generalEmulation.enableDitheringPattern).toInt();
config.generalEmulation.enableLOD = settings.value("enableLOD", config.generalEmulation.enableLOD).toInt();
config.generalEmulation.enableHWLighting = settings.value("enableHWLighting", config.generalEmulation.enableHWLighting).toInt();
config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt();
@@ -212,7 +212,7 @@ void writeSettings(const QString & _strIniFolder)
settings.endGroup();
settings.beginGroup("generalEmulation");
- settings.setValue("ditheringMode", config.generalEmulation.ditheringMode);
+ settings.setValue("enableDitheringPattern", config.generalEmulation.enableDitheringPattern);
settings.setValue("enableLOD", config.generalEmulation.enableLOD);
settings.setValue("enableHWLighting", config.generalEmulation.enableHWLighting);
settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage);
@@ -402,7 +402,7 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
settings.endGroup();
settings.beginGroup("generalEmulation");
- WriteCustomSetting(generalEmulation, ditheringMode);
+ WriteCustomSetting(generalEmulation, enableDitheringPattern);
WriteCustomSetting(generalEmulation, enableLOD);
WriteCustomSetting(generalEmulation, enableHWLighting);
WriteCustomSetting(generalEmulation, enableShadersStorage);
diff --git a/src/GLideNUI/configDialog.ui b/src/GLideNUI/configDialog.ui
index b0718d87..2b5d8748 100644
--- a/src/GLideNUI/configDialog.ui
+++ b/src/GLideNUI/configDialog.ui
@@ -10,7 +10,7 @@
0
0
559
- 595
+ 613
@@ -899,10 +899,24 @@
+ -
+
+
+ Dithering pattern on output image
+
+
+
+ -
+
+
+ High resolution noise dithering
+
+
+
-
- Dithering mode:
+ RDRAM image dithering mode:
@@ -915,22 +929,17 @@
-
- only noise dithering (default)
+ Bayer
-
- noise dithering with 5bit quantization
+ Magic square
-
- noise and ordered grid dithering
-
-
- -
-
- dithering with 5bit quantization
+ Blue noise
@@ -4049,9 +4058,9 @@
-
-
+
+
diff --git a/src/Graphics/CombinerProgram.cpp b/src/Graphics/CombinerProgram.cpp
index 3d086f55..37521bd6 100644
--- a/src/Graphics/CombinerProgram.cpp
+++ b/src/Graphics/CombinerProgram.cpp
@@ -12,10 +12,9 @@ namespace graphics {
vecOptions.push_back(config.texture.bilinearMode);
vecOptions.push_back(config.texture.enableHalosRemoval);
vecOptions.push_back(config.generalEmulation.enableHWLighting);
- vecOptions.push_back(config.generalEmulation.ditheringMode == Config::DitheringMode::dmNoise ? 1 : 0);
- vecOptions.push_back(config.generalEmulation.ditheringMode == Config::DitheringMode::dmNoiseWithQuant ? 1 : 0);
- vecOptions.push_back(config.generalEmulation.ditheringMode == Config::DitheringMode::dmFull ? 1 : 0);
- vecOptions.push_back(config.generalEmulation.ditheringMode == Config::DitheringMode::dmFullWithQuant ? 1 : 0);
+ vecOptions.push_back(config.generalEmulation.enableHiresNoiseDithering);
+ vecOptions.push_back(config.generalEmulation.enableDitheringPattern);
+ vecOptions.push_back(config.generalEmulation.enableDitheringQuantization);
vecOptions.push_back(config.generalEmulation.enableLOD);
vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcFast ? 1 : 0);
vecOptions.push_back(config.frameBufferEmulation.N64DepthCompare == Config::dcCompatible ? 1 : 0);
diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp
index 6456991e..f1cb60bf 100644
--- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp
+++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp
@@ -718,61 +718,62 @@ class ShaderCallDither : public ShaderPart
public:
ShaderCallDither(const opengl::GLInfo & _glinfo)
{
- if (!_glinfo.isGLES2) {
- if (config.generalEmulation.ditheringMode != Config::DitheringMode::dmDisable) {
- m_part =
- " if (uColorDitherMode == 2) { \n"
- " colorNoiseDither(snoiseRGB(), clampedColor.rgb); \n"
- " quantizeRGB(clampedColor.rgb); \n"
- " } \n"
- " if (uAlphaDitherMode == 2) { \n"
- " alphaNoiseDither(snoiseA(), clampedColor.a); \n"
- " quantizeA(clampedColor.a); \n"
- " } \n"
+ if (_glinfo.isGLES2)
+ return;
+
+ m_part =
+ " if (uColorDitherMode == 2) { \n"
+ " colorNoiseDither(snoiseRGB(), clampedColor.rgb); \n"
+ " quantizeRGB(clampedColor.rgb); \n"
+ " } \n"
+ " if (uAlphaDitherMode == 2) { \n"
+ " alphaNoiseDither(snoiseA(), clampedColor.a); \n"
+ " quantizeA(clampedColor.a); \n"
+ " } \n"
+ ;
+
+ if (config.generalEmulation.enableDitheringPattern != 0) {
+ m_part +=
+ // Try to keep dithering visible even at higher resolutions
+ " lowp float divider = 1.0 + step(3.0, uScreenScale.x); \n"
+ " mediump ivec2 position = ivec2(mod((gl_FragCoord.xy - 0.5) / divider,4.0));\n"
+ " \n"
+ " lowp mat4 bayer = mat4( 0.0, 0.75, 0.1875, 0.9375, \n"
+ " 0.5, 0.25, 0.6875, 0.4375, \n"
+ " 0.125, 0.875, 0.0625, 0.8125, \n"
+ " 0.625, 0.375, 0.5625, 0.3125); \n"
+ " lowp mat4 mSquare = mat4( 0.0, 0.6875, 0.75, 0.4375, \n"
+ " 0.875, 0.3125, 0.125, 0.5625, \n"
+ " 0.1875, 0.5, 0.9375, 0.25, \n"
+ " 0.8125, 0.375, 0.0625, 0.625); \n"
+ " \n"
+ " lowp float bayerThreshold = bayer[position.x][position.y]; \n"
+ " lowp float mSquareThreshold = mSquare[position.x][position.y]; \n"
+ " \n"
+ " if (uColorDitherMode < 2) { \n"
+ " lowp float threshold = mix(mSquareThreshold,bayerThreshold,float(uColorDitherMode));\n"
+ " colorNoiseDither(vec3(threshold), clampedColor.rgb); \n"
+ // 16 Bit quantization
+ " quantizeRGB(clampedColor.rgb); \n"
+ " } \n"
+ " if (uAlphaDitherMode < 2) { \n"
+ " lowp float thresholdPattern = mix(mSquareThreshold,bayerThreshold,clamp(float(uColorDitherMode),0.0,1.0));\n"
+ " thresholdPattern = mix(thresholdPattern,mSquareThreshold,clamp(float(uColorDitherMode - 1),0.0,1.0));\n" // uColorDitherMode = 2
+ " thresholdPattern = mix(thresholdPattern,bayerThreshold,clamp(float(uColorDitherMode - 2),0.0,1.0));\n" // uColorDitherMode = 3
+ " \n"
+ " lowp float thresholdNotPattern = mix(bayerThreshold,mSquareThreshold,clamp(float(uColorDitherMode),0.0,1.0));\n"
+ " thresholdNotPattern = mix(thresholdNotPattern,bayerThreshold,clamp(float(uColorDitherMode - 1),0.0,1.0));\n" // uColorDitherMode = 2
+ " thresholdNotPattern = mix(thresholdNotPattern,mSquareThreshold,clamp(float(uColorDitherMode - 2),0.0,1.0));\n" // uColorDitherMode = 3
+ " \n"
+ " lowp float threshold = mix(thresholdNotPattern, thresholdPattern,float(uAlphaDitherMode));\n"
+ " alphaNoiseDither(threshold, clampedColor.a); \n"
+ // 16 Bit quantization
+ " quantizeA(clampedColor.a); \n"
+ " } \n"
;
- }
- if (config.generalEmulation.ditheringMode >= Config::DitheringMode::dmFull) {
- m_part +=
- // Try to keep dithering visible even at higher resolutions
- " lowp float divider = 1.0 + step(3.0, uScreenScale.x); \n"
- " mediump ivec2 position = ivec2(mod((gl_FragCoord.xy - 0.5) / divider,4.0));\n"
- " \n"
- " lowp mat4 bayer = mat4( 0.0, 0.75, 0.1875, 0.9375, \n"
- " 0.5, 0.25, 0.6875, 0.4375, \n"
- " 0.125, 0.875, 0.0625, 0.8125, \n"
- " 0.625, 0.375, 0.5625, 0.3125); \n"
- " lowp mat4 mSquare = mat4( 0.0, 0.6875, 0.75, 0.4375, \n"
- " 0.875, 0.3125, 0.125, 0.5625, \n"
- " 0.1875, 0.5, 0.9375, 0.25, \n"
- " 0.8125, 0.375, 0.0625, 0.625); \n"
- " \n"
- " lowp float bayerThreshold = bayer[position.x][position.y]; \n"
- " lowp float mSquareThreshold = mSquare[position.x][position.y]; \n"
- " \n"
- " if (uColorDitherMode < 2) { \n"
- " lowp float threshold = mix(mSquareThreshold,bayerThreshold,float(uColorDitherMode));\n"
- " colorNoiseDither(vec3(threshold), clampedColor.rgb); \n"
- // 16 Bit quantization
- " quantizeRGB(clampedColor.rgb); \n"
- " } \n"
- " if (uAlphaDitherMode < 2) { \n"
- " lowp float thresholdPattern = mix(mSquareThreshold,bayerThreshold,clamp(float(uColorDitherMode),0.0,1.0));\n"
- " thresholdPattern = mix(thresholdPattern,mSquareThreshold,clamp(float(uColorDitherMode - 1),0.0,1.0));\n" // uColorDitherMode = 2
- " thresholdPattern = mix(thresholdPattern,bayerThreshold,clamp(float(uColorDitherMode - 2),0.0,1.0));\n" // uColorDitherMode = 3
- " \n"
- " lowp float thresholdNotPattern = mix(bayerThreshold,mSquareThreshold,clamp(float(uColorDitherMode),0.0,1.0));\n"
- " thresholdNotPattern = mix(thresholdNotPattern,bayerThreshold,clamp(float(uColorDitherMode - 1),0.0,1.0));\n" // uColorDitherMode = 2
- " thresholdNotPattern = mix(thresholdNotPattern,mSquareThreshold,clamp(float(uColorDitherMode - 2),0.0,1.0));\n" // uColorDitherMode = 3
- " \n"
- " lowp float threshold = mix(thresholdNotPattern, thresholdPattern,float(uAlphaDitherMode));\n"
- " alphaNoiseDither(threshold, clampedColor.a); \n"
- // 16 Bit quantization
- " quantizeA(clampedColor.a); \n"
- " } \n"
- ;
- }
}
}
+
};
class ShaderFragmentGlobalVariablesTex : public ShaderPart
@@ -1041,18 +1042,17 @@ class ShaderFragmentHeaderDither : public ShaderPart
public:
ShaderFragmentHeaderDither(const opengl::GLInfo & _glinfo)
{
- if (!_glinfo.isGLES2) {
- if (config.generalEmulation.ditheringMode != Config::DitheringMode::dmDisable) {
- m_part =
- "void colorNoiseDither(in lowp vec3 _noise, inout lowp vec3 _color);\n"
- "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n"
- "void quantizeRGB(inout lowp vec3 _color);\n"
- "void quantizeA(inout lowp float _alpha);\n"
- "lowp vec3 snoiseRGB();\n"
- "lowp float snoiseA();\n"
- ;
- }
- }
+ if (_glinfo.isGLES2)
+ return;
+
+ m_part =
+ "void colorNoiseDither(in lowp vec3 _noise, inout lowp vec3 _color);\n"
+ "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha);\n"
+ "void quantizeRGB(inout lowp vec3 _color);\n"
+ "void quantizeA(inout lowp float _alpha);\n"
+ "lowp vec3 snoiseRGB();\n"
+ "lowp float snoiseA();\n"
+ ;
}
};
@@ -1651,68 +1651,66 @@ class ShaderDither : public ShaderPart
public:
ShaderDither(const opengl::GLInfo & _glinfo)
{
- if (!_glinfo.isGLES2) {
- if (config.generalEmulation.ditheringMode != Config::DitheringMode::dmDisable) {
- m_part =
- "void colorNoiseDither(in lowp vec3 _noise, inout lowp vec3 _color)\n"
- "{ \n"
- " mediump vec3 threshold = 7.0 / 255.0 * (_noise - 0.5);\n"
- " _color = clamp(_color + threshold,0.0,1.0); \n"
- "} \n"
- "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha)\n"
- "{ \n"
- " mediump float threshold = 7.0 / 255.0 * (_noise - 0.5);\n"
- " _alpha = clamp(_alpha + threshold,0.0,1.0); \n"
- "} \n"
- "lowp vec3 snoiseRGB() \n"
- "{ \n"
- " mediump vec2 texSize = vec2(640.0, 580.0); \n"
- // multiplier for higher res noise effect
- " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"
- " \n"
- " mediump vec2 coordR = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
- " mediump vec2 coordG = mult * ((gl_FragCoord.xy + vec2( 0.0, texSize.y / 2.0 ))/uScreenScale/texSize);\n"
- " mediump vec2 coordB = mult * ((gl_FragCoord.xy + vec2( texSize.x / 2.0, 0.0))/uScreenScale/texSize);\n"
- " \n"
- // Only red channel of noise texture contains noise.
- " lowp float r = texture(uTexNoise,coordR).r; \n"
- " lowp float g = texture(uTexNoise,coordG).r; \n"
- " lowp float b = texture(uTexNoise,coordB).r; \n"
- " \n"
- " return vec3(r,g,b); \n"
- "} \n"
- "lowp float snoiseA() \n"
- "{ \n"
- " mediump vec2 texSize = vec2(640.0, 580.0); \n"
- // multiplier for higher res noise effect
- " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"
- " \n"
- " mediump vec2 coord = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
- " \n"
- // Only red channel of noise texture contains noise.
- " return texture(uTexNoise,coord).r; \n"
- "} \n"
+ if (_glinfo.isGLES2)
+ return;
+
+ m_part =
+ "void colorNoiseDither(in lowp vec3 _noise, inout lowp vec3 _color)\n"
+ "{ \n"
+ " mediump vec3 threshold = 7.0 / 255.0 * (_noise - 0.5);\n"
+ " _color = clamp(_color + threshold,0.0,1.0); \n"
+ "} \n"
+ "void alphaNoiseDither(in lowp float _noise, inout lowp float _alpha)\n"
+ "{ \n"
+ " mediump float threshold = 7.0 / 255.0 * (_noise - 0.5);\n"
+ " _alpha = clamp(_alpha + threshold,0.0,1.0); \n"
+ "} \n"
+ "lowp vec3 snoiseRGB() \n"
+ "{ \n"
+ " mediump vec2 texSize = vec2(640.0, 580.0); \n"
+ // multiplier for higher res noise effect
+ " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"
+ " \n"
+ " mediump vec2 coordR = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
+ " mediump vec2 coordG = mult * ((gl_FragCoord.xy + vec2( 0.0, texSize.y / 2.0 ))/uScreenScale/texSize);\n"
+ " mediump vec2 coordB = mult * ((gl_FragCoord.xy + vec2( texSize.x / 2.0, 0.0))/uScreenScale/texSize);\n"
+ " \n"
+ // Only red channel of noise texture contains noise.
+ " lowp float r = texture(uTexNoise,coordR).r; \n"
+ " lowp float g = texture(uTexNoise,coordG).r; \n"
+ " lowp float b = texture(uTexNoise,coordB).r; \n"
+ " \n"
+ " return vec3(r,g,b); \n"
+ "} \n"
+ "lowp float snoiseA() \n"
+ "{ \n"
+ " mediump vec2 texSize = vec2(640.0, 580.0); \n"
+ // multiplier for higher res noise effect
+ " lowp float mult = 1.0 + step(2.0, uScreenScale.x); \n"
+ " \n"
+ " mediump vec2 coord = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
+ " \n"
+ // Only red channel of noise texture contains noise.
+ " return texture(uTexNoise,coord).r; \n"
+ "} \n"
+ ;
+
+ if (config.generalEmulation.enableDitheringQuantization != 0) {
+ m_part +=
+ "void quantizeRGB(inout lowp vec3 _color) \n"
+ "{ \n"
+ " _color.rgb = round(_color.rgb * 32.0)/32.0; \n"
+ "} \n"
+ "void quantizeA(inout lowp float _alpha) \n"
+ "{ \n"
+ " _alpha = round(_alpha * 32.0)/32.0; \n"
+ "} \n"
+ ;
+ } else {
+ m_part +=
+ "void quantizeRGB(inout lowp vec3 _color){}\n"
+ "void quantizeA(inout lowp float _alpha){}\n"
;
- if (config.generalEmulation.ditheringMode == Config::DitheringMode::dmNoiseWithQuant ||
- config.generalEmulation.ditheringMode == Config::DitheringMode::dmFullWithQuant) {
- m_part +=
- "void quantizeRGB(inout lowp vec3 _color)\n"
- "{ \n"
- " _color.rgb = round(_color.rgb * 32.0)/32.0; \n"
- "} \n"
- "void quantizeA(inout lowp float _alpha)\n"
- "{ \n"
- " _alpha = round(_alpha * 32.0)/32.0; \n"
- "} \n"
- ;
- }
- else {
- m_part +=
- "void quantizeRGB(inout lowp vec3 _color){}\n"
- "void quantizeA(inout lowp float _alpha){}\n"
- ;
- }
- }
}
}
};
diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h b/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h
index 80ad42ab..10ef119e 100644
--- a/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h
+++ b/src/Graphics/OpenGLContext/GLSL/glsl_ShaderStorage.h
@@ -20,7 +20,7 @@ namespace glsl {
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
- const u32 m_formatVersion = 0x2BU;
+ const u32 m_formatVersion = 0x2CU;
const u32 m_keysFormatVersion = 0x04;
const opengl::GLInfo & m_glinfo;
opengl::CachedUseProgram * m_useProgram;
diff --git a/src/mupenplus/Config_mupenplus.cpp b/src/mupenplus/Config_mupenplus.cpp
index 88963d34..39bffa17 100644
--- a/src/mupenplus/Config_mupenplus.cpp
+++ b/src/mupenplus/Config_mupenplus.cpp
@@ -67,9 +67,13 @@ bool Config_SetDefault()
res = ConfigSetDefaultInt(g_configVideoGliden64, "MaxAnisotropy", config.texture.maxAnisotropy, "Max level of Anisotropic Filtering, 0 for off");
assert(res == M64ERR_SUCCESS);
//#Emulation Settings
- res = ConfigSetDefaultInt(g_configVideoGliden64, "DitheringMode", config.generalEmulation.ditheringMode, "Dithering mode. (0=disable, 1=noise dithering (default), 2=noise dithering with 5bit quantization, 3=full dithering, 4=full dithering with 5bit quantization)");
+ res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableDitheringPattern", config.generalEmulation.enableDitheringPattern, "Enable dithering pattern on output image.");
assert(res == M64ERR_SUCCESS);
- res = ConfigSetDefaultInt(g_configVideoGliden64, "BufferDitheringMode", config.generalEmulation.bufferDitheringMode, "Dithering mode for buffer in RDRAM. (0=disable, 1=bayer, 2=magic square, 3=blue noise)");
+ res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHiresNoiseDithering", config.generalEmulation.enableHiresNoiseDithering, "Enable hi-res noise dithering.");
+ assert(res == M64ERR_SUCCESS);
+ res = ConfigSetDefaultBool(g_configVideoGliden64, "DitheringQuantization", config.generalEmulation.enableDitheringQuantization, "Dither with color quantization.");
+ assert(res == M64ERR_SUCCESS);
+ res = ConfigSetDefaultInt(g_configVideoGliden64, "RDRAMImageDitheringMode", config.generalEmulation.rdramImageDitheringMode, "Dithering mode for image in RDRAM. (0=disable, 1=bayer, 2=magic square, 3=blue noise)");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableLOD", config.generalEmulation.enableLOD, "Enable LOD emulation.");
assert(res == M64ERR_SUCCESS);
@@ -272,10 +276,14 @@ void Config_LoadCustomConfig()
result = ConfigExternalGetParameter(fileHandle, sectionName, "texture\\screenShotFormat", value, sizeof(value));
if (result == M64ERR_SUCCESS) config.texture.screenShotFormat = atoi(value);
- result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\ditheringMode", value, sizeof(value));
- if (result == M64ERR_SUCCESS) config.generalEmulation.ditheringMode = atoi(value);
- result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\bufferDitheringMode", value, sizeof(value));
- if (result == M64ERR_SUCCESS) config.generalEmulation.bufferDitheringMode = atoi(value);
+ result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableDitheringPattern", value, sizeof(value));
+ if (result == M64ERR_SUCCESS) config.generalEmulation.enableDitheringPattern = atoi(value);
+ result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableHiresNoiseDithering", value, sizeof(value));
+ if (result == M64ERR_SUCCESS) config.generalEmulation.enableHiresNoiseDithering = atoi(value);
+ result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableDitheringQuantization", value, sizeof(value));
+ if (result == M64ERR_SUCCESS) config.generalEmulation.enableDitheringQuantization = atoi(value);
+ result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\rdramImageDitheringMode", value, sizeof(value));
+ if (result == M64ERR_SUCCESS) config.generalEmulation.rdramImageDitheringMode = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableLOD", value, sizeof(value));
if (result == M64ERR_SUCCESS) config.generalEmulation.enableLOD = atoi(value);
result = ConfigExternalGetParameter(fileHandle, sectionName, "generalEmulation\\enableHWLighting", value, sizeof(value));
@@ -398,8 +406,11 @@ void Config_LoadConfig()
config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy");
config.texture.enableHalosRemoval = ConfigGetParamBool(g_configVideoGliden64, "enableHalosRemoval");
//#Emulation Settings
- config.generalEmulation.ditheringMode = ConfigGetParamInt(g_configVideoGliden64, "DitheringMode");
- config.generalEmulation.bufferDitheringMode = ConfigGetParamInt(g_configVideoGliden64, "BufferDitheringMode");
+ config.generalEmulation.enableDitheringPattern = ConfigGetParamBool(g_configVideoGliden64, "EnableDitheringPattern");
+ config.generalEmulation.enableHiresNoiseDithering = ConfigGetParamBool(g_configVideoGliden64, "EnableHiresNoiseDithering");
+ config.generalEmulation.enableDitheringQuantization = ConfigGetParamBool(g_configVideoGliden64, "DitheringQuantization");
+ config.generalEmulation.rdramImageDitheringMode = ConfigGetParamInt(g_configVideoGliden64, "RDRAMImageDitheringMode");
+
config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD");
config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting");
config.generalEmulation.enableShadersStorage = ConfigGetParamBool(g_configVideoGliden64, "EnableShadersStorage");