diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp index eb06b24a80..0147d0db74 100644 --- a/src/libANGLE/validationES.cpp +++ b/src/libANGLE/validationES.cpp @@ -4149,16 +4149,18 @@ const char *ValidateDrawStates(const Context *context, GLenum *outErrorCode) bool framebufferIsYUV = framebuffer->hasYUVAttachment(); if (ANGLE_UNLIKELY(framebufferIsYUV)) { - const BlendState &blendState = state.getBlendState(); - if (!blendState.colorMaskRed || !blendState.colorMaskGreen || !blendState.colorMaskBlue || - !blendState.colorMaskAlpha) + // Read indexed blend state: the legacy BlendState is not updated by + // glColorMaskiOES / glEnableiOES (OES_draw_buffers_indexed), so it can be stale. + // A YUV framebuffer can only have COLOR_ATTACHMENT0, so checking index 0 suffices. + const BlendStateExt &blendStateExt = state.getBlendStateExt(); + if (blendStateExt.getColorMaskIndexed(0) != BlendStateExt::kColorMaskRGBA) { // When rendering into a YUV framebuffer, the color mask must have r g b and alpha set // to true. return kInvalidColorMaskForYUV; } - if (blendState.blend) + if (blendStateExt.getEnabledMask().test(0)) { // When rendering into a YUV framebuffer, blending must be disabled. return kInvalidBlendStateForYUV;