1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Alpha compare should happen after the 1st cycle of a two-cycle combiner

Fixed invisible rocks in Mischief Makers intro.
This commit is contained in:
Sergey Lipskiy 2016-02-09 22:00:41 +06:00
parent 8425a840ae
commit 1d1f4bdbb4
3 changed files with 6 additions and 14 deletions

View File

@ -179,13 +179,6 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
strFragmentShader.append(" vec_color = vec4(input_color, vShadeColor.a); \n");
strFragmentShader.append(strCombiner);
strFragmentShader.append(
" if (uEnableAlphaTest != 0) { \n"
" lowp float alphaTestValue = (uAlphaCompareMode == 3 && alpha2 > 0.0) ? snoise() : uAlphaTestValue; \n"
" if (alpha2 < alphaTestValue) discard; \n"
" } \n"
);
if (!g_weakGLSL) {
strFragmentShader.append(
" lowp int fogUsage = uFogUsage; \n"

View File

@ -330,13 +330,6 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
strFragmentShader.append(" vec_color = vec4(input_color, vShadeColor.a); \n");
strFragmentShader.append(strCombiner);
strFragmentShader.append(
" if (uEnableAlphaTest != 0) { \n"
" lowp float alphaTestValue = (uAlphaCompareMode == 3 && alpha2 > 0.0) ? snoise() : uAlphaTestValue; \n"
" if (alpha2 < alphaTestValue) discard; \n"
" } \n"
);
if (config.generalEmulation.enableNoise != 0) {
strFragmentShader.append(
" if (uColorDitherMode == 2) colorNoiseDither(snoise(), color2); \n"

View File

@ -235,6 +235,12 @@ int compileCombiner(Combiner & _color, Combiner & _alpha, char * _strShader)
}
strcpy(_strShader, " alpha1 = ");
int nInputs = _compileCombiner(_alpha.stage[0], AlphaInput, _strShader);
strcat(_strShader,
" if (uEnableAlphaTest != 0) { \n"
" lowp float alphaTestValue = (uAlphaCompareMode == 3 && alpha1 > 0.0) ? snoise() : uAlphaTestValue; \n"
" if (alpha1 < alphaTestValue) discard; \n"
" } \n"
);
strcat(_strShader, " color1 = ");
nInputs |= _compileCombiner(_color.stage[0], ColorInput, _strShader);
strcat(_strShader, fragment_shader_blender);