Remove kCheckAllocation_GrSurfaceFlags.
authorBrian Salomon <bsalomon@google.com>
Mon, 15 May 2017 17:48:50 +0000 (13:48 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 15 May 2017 18:19:49 +0000 (18:19 +0000)
This flags was only specified in one place (per backend). However, it was specified when no allocations occur.

Change-Id: Ic892d3064598519a07fb6773ba626fe022ef2f78
Reviewed-on: https://skia-review.googlesource.com/16904
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>

include/gpu/GrTypes.h
src/gpu/GrTexture.cpp
src/gpu/gl/GrGLGpu.cpp
src/gpu/vk/GrVkGpu.cpp

index 654febd..f52af3a 100644 (file)
@@ -589,11 +589,6 @@ enum GrSurfaceFlags {
      * Placeholder for managing zero-copy textures
      */
     kZeroCopy_GrSurfaceFlag         = 0x2,
-    /**
-     * Indicates that all allocations (color buffer, FBO completeness, etc)
-     * should be verified.
-     */
-    kCheckAllocation_GrSurfaceFlag  = 0x4,
 };
 
 GR_MAKE_BITFIELD_OPS(GrSurfaceFlags)
index ea0ed76..6609fa6 100644 (file)
@@ -95,7 +95,7 @@ void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k
     static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
 
     GrSurfaceOrigin origin = resolve_origin(desc);
-    uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag;
+    uint32_t flags = desc.fFlags;
 
     // make sure desc.fConfig fits in 5 bits
     SkASSERT(sk_float_log2(kLast_GrPixelConfig) <= 5);
index 5a8809b..842e229 100644 (file)
@@ -604,7 +604,7 @@ sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
 
     GrSurfaceDesc desc;
     desc.fConfig = backendRT.config();
-    desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
+    desc.fFlags = kRenderTarget_GrSurfaceFlag;
     desc.fWidth = backendRT.width();
     desc.fHeight = backendRT.height();
     desc.fSampleCnt = SkTMin(backendRT.sampleCnt(), this->caps()->maxSampleCount());
@@ -841,15 +841,6 @@ static inline GrGLint config_alignment(GrPixelConfig config) {
     return 0;
 }
 
-static inline GrGLenum check_alloc_error(const GrSurfaceDesc& desc,
-                                         const GrGLInterface* interface) {
-    if (SkToBool(desc.fFlags & kCheckAllocation_GrSurfaceFlag)) {
-        return GR_GL_GET_ERROR(interface);
-    } else {
-        return CHECK_ALLOC_ERROR(interface);
-    }
-}
-
 /**
  * Creates storage space for the texture and fills it with texels.
  *
@@ -893,7 +884,7 @@ static bool allocate_and_populate_uncompressed_texture(const GrSurfaceDesc& desc
                                    SkTMax(texels.count(), 1),
                                    internalFormatForTexStorage,
                                    desc.fWidth, desc.fHeight));
-        GrGLenum error = check_alloc_error(desc, &interface);
+        GrGLenum error = CHECK_ALLOC_ERROR(&interface);
         if (error != GR_GL_NO_ERROR) {
             return  false;
         } else {
@@ -929,7 +920,7 @@ static bool allocate_and_populate_uncompressed_texture(const GrSurfaceDesc& desc
                                      0, // border
                                      externalFormat, externalType,
                                      nullptr));
-            GrGLenum error = check_alloc_error(desc, &interface);
+            GrGLenum error = CHECK_ALLOC_ERROR(&interface);
             if (error != GR_GL_NO_ERROR) {
                 return false;
             }
@@ -950,7 +941,7 @@ static bool allocate_and_populate_uncompressed_texture(const GrSurfaceDesc& desc
                                          0, // border
                                          externalFormat, externalType,
                                          currentMipData));
-                GrGLenum error = check_alloc_error(desc, &interface);
+                GrGLenum error = CHECK_ALLOC_ERROR(&interface);
                 if (error != GR_GL_NO_ERROR) {
                     return false;
                 }
@@ -992,7 +983,7 @@ static bool allocate_and_populate_compressed_texture(const GrSurfaceDesc& desc,
                                    texels.count(),
                                    internalFormat,
                                    baseWidth, baseHeight));
-        GrGLenum error = check_alloc_error(desc, &interface);
+        GrGLenum error = CHECK_ALLOC_ERROR(&interface);
         if (error != GR_GL_NO_ERROR) {
             return false;
         } else {
@@ -1041,7 +1032,7 @@ static bool allocate_and_populate_compressed_texture(const GrSurfaceDesc& desc,
                                                SkToInt(dataSize),
                                                texels[currentMipLevel].fPixels));
 
-            GrGLenum error = check_alloc_error(desc, &interface);
+            GrGLenum error = CHECK_ALLOC_ERROR(&interface);
             if (error != GR_GL_NO_ERROR) {
                 return false;
             }
@@ -1435,8 +1426,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
                                         GR_GL_COLOR_ATTACHMENT0,
                                         GR_GL_RENDERBUFFER,
                                         idDesc->fMSColorRenderbufferID));
-        if ((desc.fFlags & kCheckAllocation_GrSurfaceFlag) ||
-            !this->glCaps().isConfigVerifiedColorAttachment(desc.fConfig)) {
+        if (!this->glCaps().isConfigVerifiedColorAttachment(desc.fConfig)) {
             GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
             if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
                 goto FAILED;
@@ -1458,8 +1448,7 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
                                      texInfo.fTarget,
                                      texInfo.fID, 0));
     }
-    if ((desc.fFlags & kCheckAllocation_GrSurfaceFlag) ||
-        !this->glCaps().isConfigVerifiedColorAttachment(desc.fConfig)) {
+    if (!this->glCaps().isConfigVerifiedColorAttachment(desc.fConfig)) {
         GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
         if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
             goto FAILED;
@@ -1816,7 +1805,7 @@ GrStencilAttachment* GrGLGpu::createStencilAttachmentForRenderTarget(const GrRen
         GL_ALLOC_CALL(this->glInterface(), RenderbufferStorage(GR_GL_RENDERBUFFER,
                                                                sFmt.fInternalFormat,
                                                                width, height));
-        SkASSERT(GR_GL_NO_ERROR == check_alloc_error(rt->desc(), this->glInterface()));
+        SkASSERT(GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface()));
     }
     fStats.incStencilAttachmentCreates();
     // After sized formats we attempt an unsized format and take
index 48e2e69..e6a69b7 100644 (file)
@@ -881,7 +881,7 @@ sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTa
 
     GrSurfaceDesc desc;
     desc.fConfig = backendRT.config();
-    desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
+    desc.fFlags = kRenderTarget_GrSurfaceFlag;
     desc.fWidth = backendRT.width();
     desc.fHeight = backendRT.height();
     desc.fSampleCnt = 0;