mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Update blender to use coverage
This commit is contained in:
parent
fa848dc3f9
commit
61172283c1
|
@ -673,7 +673,6 @@ public:
|
||||||
if (_glinfo.dual_source_blending || _glinfo.ext_fetch || _glinfo.ext_fetch_arm) {
|
if (_glinfo.dual_source_blending || _glinfo.ext_fetch || _glinfo.ext_fetch_arm) {
|
||||||
m_part +=
|
m_part +=
|
||||||
"if (uBlendAlphaMode != 2) { \n"
|
"if (uBlendAlphaMode != 2) { \n"
|
||||||
" lowp float cvg = clampedColor.a; \n"
|
|
||||||
" lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n"
|
" lowp vec4 srcAlpha = vec4(cvg, cvg, 1.0, 0.0); \n"
|
||||||
" lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n"
|
" lowp vec4 dstFactorAlpha = vec4(1.0, 1.0, 0.0, 1.0); \n"
|
||||||
" if (uBlendAlphaMode == 0) \n"
|
" if (uBlendAlphaMode == 0) \n"
|
||||||
|
@ -941,7 +940,7 @@ public:
|
||||||
"highp vec2 tcData1[5]; \n"
|
"highp vec2 tcData1[5]; \n"
|
||||||
"uniform lowp int uCvgDest; \n"
|
"uniform lowp int uCvgDest; \n"
|
||||||
"uniform lowp int uBlendAlphaMode; \n"
|
"uniform lowp int uBlendAlphaMode; \n"
|
||||||
"lowp float mcvg;"
|
"lowp float cvg;"
|
||||||
;
|
;
|
||||||
|
|
||||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||||
|
@ -1063,7 +1062,7 @@ public:
|
||||||
"uniform lowp int uScreenSpaceTriangle; \n"
|
"uniform lowp int uScreenSpaceTriangle; \n"
|
||||||
"uniform lowp int uCvgDest; \n"
|
"uniform lowp int uCvgDest; \n"
|
||||||
"uniform lowp int uBlendAlphaMode; \n"
|
"uniform lowp int uBlendAlphaMode; \n"
|
||||||
"lowp float mcvg; \n"
|
"lowp float cvg; \n"
|
||||||
;
|
;
|
||||||
|
|
||||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||||
|
@ -2603,9 +2602,9 @@ public:
|
||||||
"highp vec2 deltaBC1 = vec2(dBCdx[1], dBCdy[1]); \n"
|
"highp vec2 deltaBC1 = vec2(dBCdx[1], dBCdy[1]); \n"
|
||||||
"highp vec2 deltaBC2 = vec2(dBCdx[2], dBCdy[2]); \n"
|
"highp vec2 deltaBC2 = vec2(dBCdx[2], dBCdy[2]); \n"
|
||||||
"highp vec2 deltaBC3 = vec2(dBCdx[3], dBCdy[3]); \n"
|
"highp vec2 deltaBC3 = vec2(dBCdx[3], dBCdy[3]); \n"
|
||||||
"mcvg = 0.0; \n"
|
"cvg = 0.0; \n"
|
||||||
"for (int i = 0; i<8; i++) { \n"
|
"for (int i = 0; i<8; i++) { \n"
|
||||||
" mcvg += 0.125 * step(0.0, vBaryCoords[0] + dot(deltaBC0, bias[i])) * step(0.0, vBaryCoords[1] + dot(deltaBC1, bias[i])) "
|
" cvg += 0.125 * step(0.0, vBaryCoords[0] + dot(deltaBC0, bias[i])) * step(0.0, vBaryCoords[1] + dot(deltaBC1, bias[i])) "
|
||||||
" * step(0.0, vBaryCoords[2] + dot(deltaBC2, bias[i])) * step(0.0, vBaryCoords[3] + dot(deltaBC3, bias[i])); \n"
|
" * step(0.0, vBaryCoords[2] + dot(deltaBC2, bias[i])) * step(0.0, vBaryCoords[3] + dot(deltaBC3, bias[i])); \n"
|
||||||
"} \n"
|
"} \n"
|
||||||
;
|
;
|
||||||
|
@ -2724,9 +2723,14 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
|
||||||
else
|
else
|
||||||
ssShader << " lowp vec4 clampedColor = clamp(cmbRes, 0.0, 1.0);" << std::endl;
|
ssShader << " lowp vec4 clampedColor = clamp(cmbRes, 0.0, 1.0);" << std::endl;
|
||||||
|
|
||||||
if (g_cycleType <= G_CYC_2CYCLE)
|
if (g_cycleType <= G_CYC_2CYCLE) {
|
||||||
m_callDither->write(ssShader);
|
m_callDither->write(ssShader);
|
||||||
|
|
||||||
|
ssShader << "if (uCvgXAlpha != 0) cvg *= clampedColor.a;" << std::endl;
|
||||||
|
ssShader << "if (uAlphaCvgSel != 0) clampedColor.a = cvg; " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (config.generalEmulation.enableLegacyBlending == 0) {
|
if (config.generalEmulation.enableLegacyBlending == 0) {
|
||||||
if (g_cycleType <= G_CYC_2CYCLE) {
|
if (g_cycleType <= G_CYC_2CYCLE) {
|
||||||
m_blender1->write(ssShader);
|
m_blender1->write(ssShader);
|
||||||
|
@ -2742,6 +2746,10 @@ CombinerInputs CombinerProgramBuilder::compileCombiner(const CombinerKey & _key,
|
||||||
m_legacyBlender->write(ssShader);
|
m_legacyBlender->write(ssShader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// SHOW COVERAGE HACK
|
||||||
|
// ssShader << "fragColor.rgb = vec3(cvg);" << std::endl;
|
||||||
|
|
||||||
_strShader = ssShader.str();
|
_strShader = ssShader.str();
|
||||||
return inputs;
|
return inputs;
|
||||||
}
|
}
|
||||||
|
@ -2819,7 +2827,7 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
|
||||||
if (g_cycleType <= G_CYC_2CYCLE)
|
if (g_cycleType <= G_CYC_2CYCLE)
|
||||||
m_shaderCoverage->write(ssShader);
|
m_shaderCoverage->write(ssShader);
|
||||||
else
|
else
|
||||||
ssShader << "mcvg = 1.0f; \n" << std::endl;
|
ssShader << "cvg = 1.0f; \n" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -574,24 +574,23 @@ public:
|
||||||
{
|
{
|
||||||
if (gDP.otherMode.cycleType == G_CYC_FILL) {
|
if (gDP.otherMode.cycleType == G_CYC_FILL) {
|
||||||
uEnableAlphaTest.set(0, _force);
|
uEnableAlphaTest.set(0, _force);
|
||||||
}
|
uAlphaCvgSel.set(0, _force);
|
||||||
else if (gDP.otherMode.cycleType == G_CYC_COPY) {
|
|
||||||
|
} else if (gDP.otherMode.cycleType == G_CYC_COPY) {
|
||||||
|
uAlphaCvgSel.set(0, _force);
|
||||||
if (gDP.otherMode.alphaCompare & G_AC_THRESHOLD) {
|
if (gDP.otherMode.alphaCompare & G_AC_THRESHOLD) {
|
||||||
uEnableAlphaTest.set(1, _force);
|
uEnableAlphaTest.set(1, _force);
|
||||||
uAlphaCvgSel.set(0, _force);
|
|
||||||
uAlphaTestValue.set(0.5f, _force);
|
uAlphaTestValue.set(0.5f, _force);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
uEnableAlphaTest.set(0, _force);
|
uEnableAlphaTest.set(0, _force);
|
||||||
}
|
}
|
||||||
}
|
} else if ((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) {
|
||||||
else if ((gDP.otherMode.alphaCompare & G_AC_THRESHOLD) != 0) {
|
|
||||||
uEnableAlphaTest.set(1, _force);
|
uEnableAlphaTest.set(1, _force);
|
||||||
uAlphaTestValue.set(gDP.blendColor.a, _force);
|
uAlphaTestValue.set(gDP.blendColor.a, _force);
|
||||||
uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force);
|
uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
uEnableAlphaTest.set(0, _force);
|
uEnableAlphaTest.set(0, _force);
|
||||||
|
uAlphaCvgSel.set(gDP.otherMode.alphaCvgSel, _force);
|
||||||
}
|
}
|
||||||
|
|
||||||
uCvgXAlpha.set(gDP.otherMode.cvgXAlpha, _force);
|
uCvgXAlpha.set(gDP.otherMode.cvgXAlpha, _force);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user