From 628df2aa24c660ca0a66c9677287cfc803b637e9 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 2 Jul 2018 11:46:11 -0400 Subject: Fix race condition in GrGLCaps Bug: 854778 Change-Id: I3421360a8549e231f508f28d3945d81f811e66de Reviewed-on: https://skia-review.googlesource.com/138923 Reviewed-by: Greg Daniel Commit-Queue: Robert Phillips --- src/gpu/gl/GrGLCaps.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 38435ccb18..b9c19c7c65 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -206,7 +206,7 @@ public: * using isConfigVerifiedColorAttachment(). */ void markConfigAsValidColorAttachment(GrPixelConfig config) { - fConfigTable[config].fFlags |= ConfigInfo::kVerifiedColorAttachment_Flag; + fConfigTable[config].fVerifiedColorAttachment = true; } /** @@ -214,7 +214,7 @@ public: * attachment. */ bool isConfigVerifiedColorAttachment(GrPixelConfig config) const { - return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kVerifiedColorAttachment_Flag); + return fConfigTable[config].fVerifiedColorAttachment; } /** @@ -588,18 +588,21 @@ private: SkTDArray fColorSampleCounts; enum { - kVerifiedColorAttachment_Flag = 0x1, - kTextureable_Flag = 0x2, - kRenderable_Flag = 0x4, - kRenderableWithMSAA_Flag = 0x8, + kTextureable_Flag = 0x1, + kRenderable_Flag = 0x2, + kRenderableWithMSAA_Flag = 0x4, /** kFBOColorAttachment means that even if the config cannot be a GrRenderTarget, we can still attach it to a FBO for blitting or reading pixels. */ - kFBOColorAttachment_Flag = 0x10, - kCanUseTexStorage_Flag = 0x20, - kCanUseWithTexelBuffer_Flag = 0x40, + kFBOColorAttachment_Flag = 0x8, + kCanUseTexStorage_Flag = 0x10, + kCanUseWithTexelBuffer_Flag = 0x20, }; uint32_t fFlags; + // verification of color attachment validity is done while flushing. Although only ever + // used in the (sole) rendering thread it can cause races if it is glommed into fFlags. + bool fVerifiedColorAttachment = false; + GrSwizzle fSwizzle; }; -- cgit v1.2.3