Skip to content

Commit b0e770d

Browse files
committed
Add full SSAA option
1 parent 3a3170a commit b0e770d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

ShaderSampleRateConverter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ bool shouldUseSampleRate(const void* data, SIZE_T length) {
5757
return true;
5858
if (config.ssaaTransparentObjects && header->hash == ShaderHash({ 0x0cd1b9e5, 0x22e7069e, 0x476455ff, 0x98bfd850 }))
5959
return true;
60-
return false;
60+
return config.ssaaAll;
6161
}
6262

6363
enum DXShaderOpcode {
@@ -92,6 +92,12 @@ void* convertShaderToSampleRate(const void* data, SIZE_T length) {
9292
DWORD insn = *insns;
9393
DWORD opcode = insn & 0xff;
9494
DWORD length = (insn >> 24) & 0x1f;
95+
if (!length)
96+
length = insns[1];
97+
if (!length) {
98+
free(out);
99+
return nullptr;
100+
}
95101
if (opcode == OP_DCL_INPUT_PS || opcode == OP_DCL_INPUT_PS_SIV) {
96102
DWORD interpolation = (insn >> 11) & 0xf;
97103
DWORD old = interpolation;

impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern Log log;
1414
extern struct Config {
1515
DWORD msaaSamples;
1616
bool ssaaTransparentObjects;
17+
bool ssaaAll;
1718
bool allowShaderToggle;
1819
} config;
1920
}

main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ D3D11Proc loadSystemD3D11() {
7272
"NumSamples = 8\n"
7373
"; Whether to do SSAA on transparent objects like grass and tree leaves (somewhat expensive, but prevents them from shimmering when the camera moves)\n"
7474
"ObjectSSAA = 0\n"
75+
"; Apply SSAA to everything, because you have more GPU power than you know what to do with\n"
76+
"FullSSAA = 0\n"
7577
"[Other]\n"
7678
"; Allow toggling shader enhancements by holding BACK / SELECT (will not toggle MSAA but will toggle most other things)\n"
7779
"EnhancementToggle = 0\n";
@@ -83,17 +85,20 @@ D3D11Proc loadSystemD3D11() {
8385
} else {
8486
char NumSamples[8];
8587
char ObjectSSAA[8];
88+
char FullSSAA[8];
8689
char UseShaderToggle[8];
8790
bool ok = true;
8891
GetPrivateProfileStringA("MSAA", "NumSamples", "8", NumSamples, sizeof(NumSamples), ".\\atfix.ini");
8992
GetPrivateProfileStringA("MSAA", "ObjectSSAA", "0", ObjectSSAA, sizeof(ObjectSSAA), ".\\atfix.ini");
93+
GetPrivateProfileStringA("MSAA", "FullSSAA", "0", FullSSAA, sizeof(FullSSAA), ".\\atfix.ini");
9094
GetPrivateProfileStringA("Other", "EnhancementToggle", "0", UseShaderToggle, sizeof(UseShaderToggle), ".\\atfix.ini");
9195
config.msaaSamples = atoi(NumSamples);
9296
config.ssaaTransparentObjects = atoi(ObjectSSAA);
97+
config.ssaaAll = atoi(FullSSAA);
9398
config.allowShaderToggle = atoi(UseShaderToggle);
9499
if (config.msaaSamples < 1)
95100
config.msaaSamples = 1;
96-
log("Loaded config, ", config.msaaSamples, " samples, ", config.ssaaTransparentObjects, " objectSSAA, ", config.allowShaderToggle, " enhancementToggle ");
101+
log("Loaded config, ", config.msaaSamples, " samples, ", config.ssaaTransparentObjects, " objectSSAA, ", config.ssaaAll, " fullSSAA, ", config.allowShaderToggle, " enhancementToggle ");
97102
}
98103

99104
d3d11Proc.D3D11CreateDevice = reinterpret_cast<PFN_D3D11CreateDevice>(

0 commit comments

Comments
 (0)