1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-24 21:39:35 +00:00

Fix static noise on screens in Space Station Silicon Valley.

Problem: the static on the screens is the result of alpha test with a random threshold.
The screens use 2 cycle combiner. First cycle for alpha uses "combined" input.
A value for this input is not set yet in the first cycle, so the result of alpha test is usually wrong.

Solution: replace "combined" input in the first cycle by special "half" input.

Fixed #1764
This commit is contained in:
Sergey Lipskiy 2020-03-08 23:28:54 +07:00
parent a2b28fdc74
commit 8a9d52b41b
2 changed files with 28 additions and 2 deletions

View File

@ -89,6 +89,7 @@
#define G_GCI_K5 18
#define G_GCI_ONE 19
#define G_GCI_ZERO 20
#define G_GCI_HALF 21
#define G_GCI_HW_LIGHT 22
struct CombinerOp

View File

@ -64,7 +64,8 @@ const char *ColorInput[] = {
"vec3(uK4)",
"vec3(uK5)",
"vec3(1.0)",
"vec3(0.0)"
"vec3(0.0)",
"vec3(0.5)"
};
static
@ -89,7 +90,8 @@ const char *AlphaInput[] = {
"uK4",
"uK5",
"1.0",
"0.0"
"0.0",
"0.5"
};
inline
@ -114,6 +116,26 @@ void _correctFirstStageParams(CombinerStage & _stage)
}
}
inline
int correctFirstStageParam2Cyc(int _param)
{
switch (_param) {
case G_GCI_COMBINED:
return G_GCI_HALF;
}
return _param;
}
static
void _correctFirstStageParams2Cyc(CombinerStage & _stage)
{
for (int i = 0; i < _stage.numOps; ++i) {
_stage.op[i].param1 = correctFirstStageParam2Cyc(_stage.op[i].param1);
_stage.op[i].param2 = correctFirstStageParam2Cyc(_stage.op[i].param2);
_stage.op[i].param3 = correctFirstStageParam2Cyc(_stage.op[i].param3);
}
}
inline
int correctSecondStageParam(int _param)
{
@ -2291,6 +2313,9 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
if (g_cycleType != G_CYC_2CYCLE) {
_correctFirstStageParams(_alpha.stage[0]);
_correctFirstStageParams(_color.stage[0]);
} else {
_correctFirstStageParams2Cyc(_alpha.stage[0]);
_correctFirstStageParams2Cyc(_color.stage[0]);
}
ssShader << " alpha1 = ";
CombinerInputs inputs = _compileCombiner(_alpha.stage[0], AlphaInput, ssShader);