Fold color attachment verification bit into GrGLCaps::ConfigInfo
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1536033003
Review URL: https://codereview.chromium.org/1536033003
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 89a9b9a..5406e6f 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -17,7 +17,6 @@
GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
const GrGLContextInfo& ctxInfo,
const GrGLInterface* glInterface) : INHERITED(contextOptions) {
- fVerifiedColorConfigs.reset();
fStencilFormats.reset();
fMSFBOType = kNone_MSFBOType;
fInvalidateFBType = kNone_InvalidateFBType;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 0f1b2c5..f32684e 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -175,7 +175,7 @@
* using isConfigVerifiedColorAttachment().
*/
void markConfigAsValidColorAttachment(GrPixelConfig config) {
- fVerifiedColorConfigs.markVerified(config);
+ fConfigTable[config].fFlags |= ConfigInfo::kVerifiedColorAttachment_Flag;
}
/**
@@ -183,7 +183,7 @@
* attachment.
*/
bool isConfigVerifiedColorAttachment(GrPixelConfig config) const {
- return fVerifiedColorConfigs.isVerified(config);
+ return SkToBool(fConfigTable[config].fFlags & ConfigInfo::kVerifiedColorAttachment_Flag);
}
/**
@@ -335,43 +335,6 @@
void onApplyOptionsOverrides(const GrContextOptions& options) override;
- /**
- * Maintains a bit per GrPixelConfig. It is used to avoid redundantly
- * performing glCheckFrameBufferStatus for the same config.
- */
- struct VerifiedColorConfigs {
- VerifiedColorConfigs() {
- this->reset();
- }
-
- void reset() {
- for (int i = 0; i < kNumUints; ++i) {
- fVerifiedColorConfigs[i] = 0;
- }
- }
-
- static const int kNumUints = (kGrPixelConfigCnt + 31) / 32;
- uint32_t fVerifiedColorConfigs[kNumUints];
-
- void markVerified(GrPixelConfig config) {
-#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
- return;
-#endif
- int u32Idx = config / 32;
- int bitIdx = config % 32;
- fVerifiedColorConfigs[u32Idx] |= 1 << bitIdx;
- }
-
- bool isVerified(GrPixelConfig config) const {
-#if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT
- return false;
-#endif
- int u32Idx = config / 32;
- int bitIdx = config % 32;
- return SkToBool(fVerifiedColorConfigs[u32Idx] & (1 << bitIdx));
- }
- };
-
void initFSAASupport(const GrGLContextInfo&, const GrGLInterface*);
void initBlendEqationSupport(const GrGLContextInfo&);
void initStencilFormats(const GrGLContextInfo&);
@@ -389,10 +352,6 @@
void initConfigTable(const GrGLContextInfo&);
- // tracks configs that have been verified to pass the FBO completeness when
- // used as a color attachment
- VerifiedColorConfigs fVerifiedColorConfigs;
-
SkTArray<StencilFormat, true> fStencilFormats;
int fMaxFragmentUniformVectors;
@@ -431,20 +390,24 @@
bool fExternalTextureSupport : 1;
struct ConfigInfo {
- ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex) {};
+ ConfigInfo() : fStencilFormatIndex(kUnknown_StencilIndex), fFlags(0) {};
ConfigFormats fFormats;
- // Index into GrGLCaps's list of stencil formats. Support is determined experimentally and
- // lazily.
- int fStencilFormatIndex;
-
enum {
// This indicates that a stencil format has not yet been determined for the config.
kUnknown_StencilIndex = -1,
// This indicates that there is no supported stencil format for the config.
kUnsupported_StencilFormatIndex = -2
};
+
+ // Index fStencilFormats.
+ int fStencilFormatIndex;
+
+ enum {
+ kVerifiedColorAttachment_Flag = 0x1
+ };
+ uint32_t fFlags;
};
ConfigInfo fConfigTable[kGrPixelConfigCnt];