Skip to content

Commit eb2284d

Browse files
committed
Support disabling character SSAA
1 parent 4a6832c commit eb2284d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

ShaderSampleRateConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool shouldUseSampleRate(const void* data, SIZE_T length) {
5656
{0xd74438d8, 0xa2667a70, 0x5c3cae10, 0x1944d91e}, // Semi-transparent background (e.g. background tree leaves)
5757
};
5858
for (const ShaderHash& hash : sampleRateShaders)
59-
if (hash == header->hash)
59+
if (config.ssaaCharacters && hash == header->hash)
6060
return true;
6161
if (config.ssaaTransparentObjects && header->hash == ShaderHash({ 0x0cd1b9e5, 0x22e7069e, 0x476455ff, 0x98bfd850 }))
6262
return true;

impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ID3D11DeviceContext* hookContext(ID3D11DeviceContext* pContext);
1313
extern Log log;
1414
extern struct Config {
1515
DWORD msaaSamples;
16+
bool ssaaCharacters;
1617
bool ssaaTransparentObjects;
1718
bool ssaaAll;
1819
bool allowShaderToggle;

main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace atfix {
1818

1919
Log log("atfix.log");
20-
Config config { 8 };
20+
Config config { 8, true };
2121

2222
/** Load system D3D11 DLL and return entry points */
2323
using PFN_D3D11CreateDevice = HRESULT (__stdcall *) (
@@ -70,6 +70,8 @@ D3D11Proc loadSystemD3D11() {
7070
const char* str = "[MSAA]\n"
7171
"; Number of samples (1 = no MSAA)\n"
7272
"NumSamples = 8\n"
73+
"; Whether to do SSAA on characters (fairly cheap, improves thin lines on clothing)\n"
74+
"CharacterSSAA = 1\n"
7375
"; Whether to do SSAA on transparent objects like grass and tree leaves (somewhat expensive, but prevents them from shimmering when the camera moves)\n"
7476
"ObjectSSAA = 0\n"
7577
"; Apply SSAA to everything, because you have more GPU power than you know what to do with\n"
@@ -84,21 +86,24 @@ D3D11Proc loadSystemD3D11() {
8486
}
8587
} else {
8688
char NumSamples[8];
89+
char CharacterSSAA[8];
8790
char ObjectSSAA[8];
8891
char FullSSAA[8];
8992
char UseShaderToggle[8];
9093
bool ok = true;
9194
GetPrivateProfileStringA("MSAA", "NumSamples", "8", NumSamples, sizeof(NumSamples), ".\\atfix.ini");
95+
GetPrivateProfileStringA("MSAA", "CharacterSSAA", "1", CharacterSSAA, sizeof(CharacterSSAA), ".\\atfix.ini");
9296
GetPrivateProfileStringA("MSAA", "ObjectSSAA", "0", ObjectSSAA, sizeof(ObjectSSAA), ".\\atfix.ini");
9397
GetPrivateProfileStringA("MSAA", "FullSSAA", "0", FullSSAA, sizeof(FullSSAA), ".\\atfix.ini");
9498
GetPrivateProfileStringA("Other", "EnhancementToggle", "0", UseShaderToggle, sizeof(UseShaderToggle), ".\\atfix.ini");
9599
config.msaaSamples = atoi(NumSamples);
100+
config.ssaaCharacters = atoi(CharacterSSAA);
96101
config.ssaaTransparentObjects = atoi(ObjectSSAA);
97102
config.ssaaAll = atoi(FullSSAA);
98103
config.allowShaderToggle = atoi(UseShaderToggle);
99104
if (config.msaaSamples < 1)
100105
config.msaaSamples = 1;
101-
log("Loaded config, ", config.msaaSamples, " samples, ", config.ssaaTransparentObjects, " objectSSAA, ", config.ssaaAll, " fullSSAA, ", config.allowShaderToggle, " enhancementToggle ");
106+
log("Loaded config, ", config.msaaSamples, " samples, ", config.ssaaCharacters, " characterSSAA, ", config.ssaaTransparentObjects, " objectSSAA, ", config.ssaaAll, " fullSSAA, ", config.allowShaderToggle, " enhancementToggle ");
102107
}
103108

104109
d3d11Proc.D3D11CreateDevice = reinterpret_cast<PFN_D3D11CreateDevice>(

0 commit comments

Comments
 (0)