Disable blend explicitly when the color mask is false.
Currently, GrGLGpu doesn't disable blend when the color mask is false. It causes bad happening as follows, * GPU thinks the blend is on so reads FBO unnecessary. * In the case the blend needs SRC1 but shader doesn't have the color attachment, some GPU driver can crash [1] * In the above case, it's undefined behavior according to the spec [2] [1] Mesa on Intel had the issue but it was fixed thank to this test failure. https://patchwork.freedesktop.org/patch/235939/ [2] https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_blend_func_extended.txt TEST: mixedtextblobs in dm or skqp Bug: b/116339546 Change-Id: I71a36defd0ffe48ed914aa428bd351fd0c5f5974 Reviewed-on: https://skia-review.googlesource.com/c/167220 Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
f1eda00bf6
commit
4e1f0225db
@ -1862,12 +1862,10 @@ bool GrGLGpu::flushGLState(const GrPrimitiveProcessor& primProc,
|
||||
|
||||
this->flushProgram(std::move(program));
|
||||
|
||||
if (blendInfo.fWriteColor) {
|
||||
// Swizzle the blend to match what the shader will output.
|
||||
const GrSwizzle& swizzle = this->caps()->shaderCaps()->configOutputSwizzle(
|
||||
pipeline.proxy()->config());
|
||||
this->flushBlend(blendInfo, swizzle);
|
||||
}
|
||||
// Swizzle the blend to match what the shader will output.
|
||||
const GrSwizzle& swizzle = this->caps()->shaderCaps()->configOutputSwizzle(
|
||||
pipeline.proxy()->config());
|
||||
this->flushBlend(blendInfo, swizzle);
|
||||
|
||||
fHWProgram->updateUniformsAndTextureBindings(primProc, pipeline, primProcProxiesToBind);
|
||||
|
||||
@ -2754,8 +2752,10 @@ void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSw
|
||||
GrBlendEquation equation = blendInfo.fEquation;
|
||||
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend;
|
||||
GrBlendCoeff dstCoeff = blendInfo.fDstBlend;
|
||||
bool blendOff = (kAdd_GrBlendEquation == equation || kSubtract_GrBlendEquation == equation) &&
|
||||
kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff;
|
||||
bool blendOff =
|
||||
((kAdd_GrBlendEquation == equation || kSubtract_GrBlendEquation == equation) &&
|
||||
kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff) ||
|
||||
!blendInfo.fWriteColor;
|
||||
if (blendOff) {
|
||||
if (kNo_TriState != fHWBlendState.fEnabled) {
|
||||
GL_CALL(Disable(GR_GL_BLEND));
|
||||
|
Loading…
Reference in New Issue
Block a user