Initial AntiAliasing Settings.

This commit is contained in:
Jules.A 2018-10-16 20:27:33 +08:00
parent 01225c65ee
commit d045b9fa34
6 changed files with 113 additions and 31 deletions

2
.gitignore vendored
View File

@ -5,6 +5,8 @@
/desmume/src/frontend/windows/__bins
/desmume/src/frontend/windows/*.tlog
/desmume/src/frontend/windows/*.aps
/desmume/src/frontend/windows/.vs/desmume/v15/
.vs/
*.user
*.suo
*.VC.db

View File

@ -533,6 +533,8 @@ extern struct TCommonSettings
, GFX3D_LineHack(true)
, GFX3D_Renderer_Multisample(false)
, GFX3D_Renderer_TextureScalingFactor(1) // Possible values: 1, 2, 4
, GFX3D_Renderer_AntiAliasingSamples(16) // Possible values: 4, 8, 16
, GFX3D_Renderer_AntiAliasingForce(false)
, GFX3D_Renderer_TextureDeposterize(false)
, GFX3D_Renderer_TextureSmoothing(false)
, GFX3D_TXTHack(false)
@ -592,6 +594,8 @@ extern struct TCommonSettings
bool GFX3D_LineHack;
bool GFX3D_Renderer_Multisample;
int GFX3D_Renderer_TextureScalingFactor; //must be one of {1,2,4}
int GFX3D_Renderer_AntiAliasingSamples; //must be one of {4,8,16}
bool GFX3D_Renderer_AntiAliasingForce;
bool GFX3D_Renderer_TextureDeposterize;
bool GFX3D_Renderer_TextureSmoothing;
bool GFX3D_TXTHack;

View File

@ -1481,17 +1481,21 @@ GLsizei OpenGLRenderer::GetLimitedMultisampleSize() const
GLsizei maxMultisamples = OGLMaxMultisamples_Tier1;
if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier1) &&
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier1) )
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier1) && CommonSettings.GFX3D_Renderer_AntiAliasingForce == false )
{
maxMultisamples = OGLMaxMultisamples_Tier1;
}
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier2) &&
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier2) )
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier2) &&
((CommonSettings.GFX3D_Renderer_AntiAliasingForce && CommonSettings.GFX3D_Renderer_AntiAliasingSamples == 16) ||
CommonSettings.GFX3D_Renderer_AntiAliasingForce == false) )
{
maxMultisamples = OGLMaxMultisamples_Tier2;
}
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier3) &&
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier3) )
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier3) &&
((CommonSettings.GFX3D_Renderer_AntiAliasingForce && CommonSettings.GFX3D_Renderer_AntiAliasingSamples == 8) ||
CommonSettings.GFX3D_Renderer_AntiAliasingForce == false) )
{
maxMultisamples = OGLMaxMultisamples_Tier3;
}

View File

@ -2374,6 +2374,8 @@ int _main()
CommonSettings.GFX3D_Texture = GetPrivateProfileBool("3D", "EnableTexture", 1, IniName);
CommonSettings.GFX3D_LineHack = GetPrivateProfileBool("3D", "EnableLineHack", 1, IniName);
CommonSettings.GFX3D_Renderer_Multisample = GetPrivateProfileBool("3D", "EnableAntiAliasing", 0, IniName);
CommonSettings.GFX3D_Renderer_AntiAliasingForce = GetPrivateProfileBool("3D", "AntiAliasingForce", 0, IniName);
CommonSettings.GFX3D_Renderer_AntiAliasingSamples = GetPrivateProfileInt("3D", "AntiAliasingSamples", 16, IniName);
CommonSettings.GFX3D_TXTHack = GetPrivateProfileBool("3D", "EnableTXTHack", 0, IniName); //default is off.
Change3DCoreWithFallbackAndSave(cur3DCore);
@ -5659,6 +5661,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
case WM_INITDIALOG:
{
int i;
HWND cur;
CheckDlgButton(hw,IDC_INTERPOLATECOLOR,CommonSettings.GFX3D_HighResolutionInterpolateColor);
CheckDlgButton(hw,IDC_3DSETTINGS_EDGEMARK,CommonSettings.GFX3D_EdgeMark);
@ -5666,6 +5669,10 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CheckDlgButton(hw,IDC_3DSETTINGS_TEXTURE,CommonSettings.GFX3D_Texture);
CheckDlgButton(hw,IDC_3DSETTINGS_LINEHACK, CommonSettings.GFX3D_LineHack);
CheckDlgButton(hw,IDC_3DSETTINGS_ANTIALIASING, CommonSettings.GFX3D_Renderer_Multisample);
CheckDlgButton(hw,IDC_MSAA_FORCE, CommonSettings.GFX3D_Renderer_AntiAliasingForce);
CheckDlgButton(hw,IDC_MSAA_SAMPLES_4, CommonSettings.GFX3D_Renderer_AntiAliasingSamples == 4);
CheckDlgButton(hw,IDC_MSAA_SAMPLES_8, CommonSettings.GFX3D_Renderer_AntiAliasingSamples == 8);
CheckDlgButton(hw,IDC_MSAA_SAMPLES_16, CommonSettings.GFX3D_Renderer_AntiAliasingSamples == 16);
CheckDlgButton(hw,IDC_TXTHACK, CommonSettings.GFX3D_TXTHack);
CheckDlgButton(hw,IDC_TEXSCALE_1, CommonSettings.GFX3D_Renderer_TextureScalingFactor == 1);
@ -5679,6 +5686,27 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CheckDlgButton(hw,IDC_TEX_DEPOSTERIZE, CommonSettings.GFX3D_Renderer_TextureDeposterize);
CheckDlgButton(hw,IDC_TEX_SMOOTH, CommonSettings.GFX3D_Renderer_TextureSmoothing);
if(CommonSettings.GFX3D_Renderer_Multisample == false)
{
cur = GetDlgItem(hw, IDC_MSAA_FORCE);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_4);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_8);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_16);
EnableWindow(cur, FALSE);
}
else if(CommonSettings.GFX3D_Renderer_Multisample && CommonSettings.GFX3D_Renderer_AntiAliasingForce == false)
{
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_4);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_8);
EnableWindow(cur, FALSE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_16);
EnableWindow(cur, FALSE);
}
SendDlgItemMessage(hw, IDC_NUD_PRESCALEHD, UDM_SETRANGE, 0, MAKELPARAM(16, 1));
SendDlgItemMessage(hw, IDC_NUD_PRESCALEHD, UDM_SETPOS, 0, video.prescaleHD);
@ -5702,6 +5730,7 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
CommonSettings.GFX3D_Texture = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_TEXTURE);
CommonSettings.GFX3D_LineHack = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_LINEHACK);
CommonSettings.GFX3D_Renderer_Multisample = IsDlgCheckboxChecked(hw,IDC_3DSETTINGS_ANTIALIASING);
CommonSettings.GFX3D_Renderer_AntiAliasingForce = IsDlgCheckboxChecked(hw,IDC_MSAA_FORCE);
CommonSettings.GFX3D_TXTHack = IsDlgCheckboxChecked(hw,IDC_TXTHACK);
int newPrescaleHD = video.prescaleHD;
@ -5711,6 +5740,10 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
newPrescaleHD = LOWORD(scaleResult);
}
if(IsDlgCheckboxChecked(hw,IDC_MSAA_SAMPLES_4)) CommonSettings.GFX3D_Renderer_AntiAliasingSamples = 4;
else if(IsDlgCheckboxChecked(hw,IDC_MSAA_SAMPLES_8)) CommonSettings.GFX3D_Renderer_AntiAliasingSamples = 8;
else if(IsDlgCheckboxChecked(hw,IDC_MSAA_SAMPLES_16)) CommonSettings.GFX3D_Renderer_AntiAliasingSamples = 16;
if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_1)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 1;
else if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_2)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 2;
else if(IsDlgCheckboxChecked(hw,IDC_TEXSCALE_4)) CommonSettings.GFX3D_Renderer_TextureScalingFactor = 4;
@ -5745,6 +5778,8 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
WritePrivateProfileBool("3D", "EnableTexture", CommonSettings.GFX3D_Texture, IniName);
WritePrivateProfileInt ("3D", "EnableLineHack", CommonSettings.GFX3D_LineHack, IniName);
WritePrivateProfileInt ("3D", "EnableAntiAliasing", CommonSettings.GFX3D_Renderer_Multisample, IniName);
WritePrivateProfileInt ("3D", "AntiAliasingSamples", CommonSettings.GFX3D_Renderer_AntiAliasingSamples, IniName);
WritePrivateProfileBool("3D", "AntiAliasingForce", CommonSettings.GFX3D_Renderer_AntiAliasingForce, IniName);
WritePrivateProfileInt ("3D", "EnableTXTHack", CommonSettings.GFX3D_TXTHack, IniName);
WritePrivateProfileInt ("3D", "PrescaleHD", video.prescaleHD, IniName);
WritePrivateProfileInt ("3D", "TextureScalingFactor", CommonSettings.GFX3D_Renderer_TextureScalingFactor, IniName);
@ -5757,7 +5792,37 @@ LRESULT CALLBACK GFX3DSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
EndDialog(hw, TRUE);
}
return TRUE;
case IDC_3DSETTINGS_ANTIALIASING:
{
HWND cur;
BOOL enable = IsDlgButtonChecked(hw, IDC_3DSETTINGS_ANTIALIASING);
cur = GetDlgItem(hw, IDC_MSAA_FORCE);
EnableWindow(cur, enable);
if (CommonSettings.GFX3D_Renderer_AntiAliasingForce)
{
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_4);
EnableWindow(cur, enable);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_8);
EnableWindow(cur, enable);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_16);
EnableWindow(cur, enable);
}
}
return TRUE;
case IDC_MSAA_FORCE:
{
HWND cur;
BOOL enable = IsDlgButtonChecked(hw, IDC_MSAA_FORCE);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_4);
EnableWindow(cur, enable);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_8);
EnableWindow(cur, enable);
cur = GetDlgItem(hw, IDC_MSAA_SAMPLES_16);
EnableWindow(cur, enable);
}
return TRUE;
case IDC_DEFAULT:
{
Change3DCoreWithFallbackAndSave(GPU3D_DEFAULT);

View File

@ -504,6 +504,10 @@
#define IDC_S4X 1091
#define IDC_S8X 1092
#define IDC_S16X 1093
#define IDC_MSAA_SAMPLES_4 1094
#define IDC_MSAA_SAMPLES_8 1095
#define IDC_MSAA_SAMPLES_16 1096
#define IDC_MSAA_FORCE 1097
#define IDM_FIRMSETTINGS 1100
#define IDD_FIRMSETTINGS 1101
#define IDC_EDIT1 1102
@ -1089,7 +1093,6 @@
#define IDC_TXTHACK 64002
#define ID_LABEL_TXTHACK1 64003
#define IDC_3DSETTINGS_ANTIALIASING 64004
#define IDC_3DSETTINGS_ANTIALIASING1 64005
#define ID_LABEL_TXTHACK2 64005
// Next default values for new objects

View File

@ -110,42 +110,46 @@ BEGIN
PUSHBUTTON "&Cancel",IDCANCEL,127,94,50,16
END
IDD_3DSETTINGS DIALOGEX 0, 0, 315, 206
IDD_3DSETTINGS DIALOGEX 0, 0, 313, 218
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "3D settings"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
COMBOBOX IDC_3DCORE,15,23,153,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_3DCORE,15,23,163,138,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Unrealistically High-Precision Color Interpolation",IDC_INTERPOLATECOLOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,62,165,10
CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,119,84,10
CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,130,52,10
CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,140,67,10
CONTROL "Enable Edge Marking",IDC_3DSETTINGS_EDGEMARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,119,84,10
CONTROL "Enable Fog",IDC_3DSETTINGS_FOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,130,52,10
CONTROL "Enable Textures",IDC_3DSETTINGS_TEXTURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,140,67,10
CONTROL "Enable Multisample Antialiasing",IDC_3DSETTINGS_ANTIALIASING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,157,114,10
EDITTEXT IDC_TEXT_PRESCALEHD,262,16,20,14,ES_AUTOHSCROLL
CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,281,16,11,14
PUSHBUTTON "Default",IDC_DEFAULT,136,185,50,14
DEFPUSHBUTTON "OK",IDOK,201,185,50,14
PUSHBUTTON "Cancel",IDCANCEL,257,185,50,14
GROUPBOX "Renderer:",IDC_STATIC,7,7,174,39
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,50,176,91
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,15,112,160,24
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,151,114,10
CONTROL "Force Max MSAA Samples",IDC_MSAA_FORCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,99,10
CONTROL "4x Max Samples",IDC_MSAA_SAMPLES_4,"Button",BS_AUTORADIOBUTTON,13,171,79,10
CONTROL "8x Max Samples",IDC_MSAA_SAMPLES_8,"Button",BS_AUTORADIOBUTTON,13,180,79,10
CONTROL "16x Max Samples",IDC_MSAA_SAMPLES_16,"Button",BS_AUTORADIOBUTTON,13,190,79,10
EDITTEXT IDC_TEXT_PRESCALEHD,267,16,20,14,ES_AUTOHSCROLL
CONTROL "",IDC_NUD_PRESCALEHD,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,286,16,11,14
PUSHBUTTON "Default",IDC_DEFAULT,196,195,50,14,BS_VCENTER
DEFPUSHBUTTON "OK",IDOK,196,167,50,14
PUSHBUTTON "Cancel",IDCANCEL,251,167,50,14
GROUPBOX "Renderer:",IDC_STATIC,7,7,180,39
GROUPBOX "SoftRasterizer Options",IDC_STATIC,7,50,180,82
LTEXT "Fixes some graphical bugs involving lines, but causes some other bugs. Not many games use lines.",ID_LABEL_ZELDA_SHADOW_DEPTH_HACK2,14,112,170,18
CONTROL "Enable Line Hack",IDC_3DSETTINGS_LINEHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,102,73,10
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,15,83,165,11
LTEXT "Fixes text bugs in some games.(e.g. Etrian Odyssey)",ID_LABEL_TXTHACK1,14,83,167,11
CONTROL "Enable TXT Hack",IDC_TXTHACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,73,73,10
GROUPBOX "OpenGL Renderer Options",IDC_STATIC,7,145,176,34
GROUPBOX "General Options",IDC_STATIC,189,6,118,175
LTEXT "GPU Scaling Factor",IDC_STATIC,195,19,64,8
CONTROL "Texture Scaling 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,195,81,77,10
CONTROL "Texture Scaling 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,195,91,79,10
CONTROL "Texture Scaling 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,195,102,72,10
CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,70,79,10
CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,167,75,10
LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,16,91,165,11
CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,195,33,98,10
CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,195,43,98,10
CONTROL "GPU Color Depth 15 bit",IDC_GPU_15BPP,"Button",BS_AUTORADIOBUTTON,195,53,98,10
GROUPBOX "OpenGL Renderer Options",IDC_STATIC,7,137,180,77
GROUPBOX "General Options",IDC_STATIC,194,6,109,150
LTEXT "GPU Scaling Factor",IDC_STATIC,200,19,64,8
CONTROL "Texture Scaling 1x",IDC_TEXSCALE_1,"Button",BS_AUTORADIOBUTTON,200,81,77,10
CONTROL "Texture Scaling 2x",IDC_TEXSCALE_2,"Button",BS_AUTORADIOBUTTON,200,91,79,10
CONTROL "Texture Scaling 4x",IDC_TEXSCALE_4,"Button",BS_AUTORADIOBUTTON,200,102,72,10
CONTROL "Deposterize Textures",IDC_TEX_DEPOSTERIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,70,79,10
CONTROL "Smooth Textures",IDC_TEX_SMOOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,201,75,10
LTEXT "You may need to toggle off && on by scene.",ID_LABEL_TXTHACK2,14,91,165,11
CONTROL "GPU Color Depth 24 bit",IDC_GPU_24BPP,"Button",BS_AUTORADIOBUTTON,200,33,98,10
CONTROL "GPU Color Depth 18 bit",IDC_GPU_18BPP,"Button",BS_AUTORADIOBUTTON,200,43,98,10
CONTROL "GPU Color Depth 15 bit",IDC_GPU_15BPP,"Button",BS_AUTORADIOBUTTON,200,53,98,10
END
IDD_ABOUT_BOX DIALOGEX 0, 0, 268, 198