Merge pull request #11964 from unknownbrackets/gpu-stencil-blend

GPU: Improve non dual source stencil replace
This commit is contained in:
Henrik Rydgård 2019-04-08 01:06:54 +02:00 committed by GitHub
commit b56c66e889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1171,7 +1171,13 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowShaderBlend) {
break;
}
} else if (!IsStencilTestOutputDisabled()) {
switch (ReplaceAlphaWithStencilType()) {
StencilValueType stencilValue = ReplaceAlphaWithStencilType();
if (stencilValue == STENCIL_VALUE_UNIFORM && constantAlpha == 0x00) {
stencilValue = STENCIL_VALUE_ZERO;
} else if (stencilValue == STENCIL_VALUE_UNIFORM && constantAlpha == 0xFF) {
stencilValue = STENCIL_VALUE_ONE;
}
switch (stencilValue) {
case STENCIL_VALUE_KEEP:
blendState.setFactors(glBlendFuncA, glBlendFuncB, BlendFactor::ZERO, BlendFactor::ONE);
break;