Avoid recomputing the shaderblend setup in ComputeFragmentShaderID.
This commit is contained in:
parent
0fe064d970
commit
fd6ab4c495
3 changed files with 11 additions and 10 deletions
|
@ -1085,7 +1085,6 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead,
|
|||
blendState.applyFramebufferRead = false;
|
||||
blendState.dirtyShaderBlendFixValues = false;
|
||||
blendState.useBlendColor = false;
|
||||
blendState.replaceAlphaWithStencil = REPLACE_ALPHA_NO;
|
||||
|
||||
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(allowFramebufferRead, gstate_c.framebufFormat);
|
||||
if (forceReplaceBlend) {
|
||||
|
@ -1094,6 +1093,8 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead,
|
|||
blendState.replaceBlend = replaceBlend;
|
||||
|
||||
ReplaceAlphaType replaceAlphaWithStencil = ReplaceAlphaWithStencil(replaceBlend);
|
||||
blendState.replaceAlphaWithStencil = replaceAlphaWithStencil;
|
||||
|
||||
bool usePreSrc = false;
|
||||
|
||||
bool blueToAlpha = false;
|
||||
|
@ -1115,7 +1116,6 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead,
|
|||
blendState.blendEnabled = true;
|
||||
blendState.applyFramebufferRead = true;
|
||||
blendState.resetFramebufferRead = false;
|
||||
blendState.replaceAlphaWithStencil = replaceAlphaWithStencil;
|
||||
break;
|
||||
|
||||
case REPLACE_BLEND_PRE_SRC:
|
||||
|
|
|
@ -263,15 +263,15 @@ void ComputeFragmentShaderID(FShaderID *id_out, const ComputedPipelineState &pip
|
|||
bool doFlatShading = gstate.getShadeMode() == GE_SHADE_FLAT;
|
||||
bool useShaderDepal = gstate_c.useShaderDepal;
|
||||
bool useSmoothedDepal = gstate_c.useSmoothedShaderDepal;
|
||||
bool colorWriteMask = IsColorWriteMaskComplex(gstate_c.allowFramebufferRead);
|
||||
bool colorWriteMask = pipelineState.maskState.applyFramebufferRead;
|
||||
|
||||
// Note how we here recompute some of the work already done in state mapping.
|
||||
// Not ideal! At least we share the code.
|
||||
ReplaceBlendType replaceBlend = ReplaceBlendWithShader(gstate_c.allowFramebufferRead, gstate_c.framebufFormat);
|
||||
if (colorWriteMask) {
|
||||
replaceBlend = REPLACE_BLEND_READ_FRAMEBUFFER;
|
||||
}
|
||||
ReplaceAlphaType stencilToAlpha = ReplaceAlphaWithStencil(replaceBlend);
|
||||
ReplaceBlendType replaceBlend = pipelineState.blendState.replaceBlend;
|
||||
ReplaceAlphaType stencilToAlpha = pipelineState.blendState.replaceAlphaWithStencil;
|
||||
|
||||
// For debugging, can probably delete soon.
|
||||
// _assert_(colorWriteMask == IsColorWriteMaskComplex(gstate_c.allowFramebufferRead));
|
||||
// _assert_(replaceBlend == ReplaceBlendWithShader(gstate_c.allowFramebufferRead, gstate_c.framebufFormat);
|
||||
// _assert_(stencilToAlpha == ReplaceAlphaWithStencil(replaceBlend));
|
||||
|
||||
// All texfuncs except replace are the same for RGB as for RGBA with full alpha.
|
||||
// Note that checking this means that we must dirty the fragment shader ID whenever textureFullAlpha changes.
|
||||
|
|
|
@ -169,6 +169,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
|||
if (blendState.applyFramebufferRead || maskState.applyFramebufferRead) {
|
||||
ApplyFramebufferRead(&fboTexNeedsBind_);
|
||||
// The shader takes over the responsibility for blending, so recompute.
|
||||
// We might still end up using blend to write something to alpha.
|
||||
ApplyStencilReplaceAndLogicOpIgnoreBlend(blendState.replaceAlphaWithStencil, blendState);
|
||||
dirtyRequiresRecheck_ |= DIRTY_FRAGMENTSHADER_STATE;
|
||||
gstate_c.Dirty(DIRTY_FRAGMENTSHADER_STATE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue