From 2555ee2e9940d00d0cc54772a934e7215d055ba2 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Thu, 17 Dec 2015 18:39:46 -0800 Subject: [PATCH] Remove some unneeded calls to GrGLGpu::configToGLFormats GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1530313005 Review URL: https://codereview.chromium.org/1530313005 --- src/gpu/gl/GrGLGpu.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 06405aa7d0..ecb576f0c5 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -415,9 +415,6 @@ static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwnership ownership) { - if (!this->configToGLFormats(desc.fConfig, false, nullptr, nullptr, nullptr)) { - return nullptr; - } #ifdef SK_IGNORE_GL_TEXTURE_TARGET if (!desc.fTextureHandle) { return nullptr; @@ -800,6 +797,7 @@ bool GrGLGpu::uploadCompressedTexData(const GrSurfaceDesc& desc, const void* data, bool isNewTexture, int left, int top, int width, int height) { + SkASSERT(this->caps()->isConfigTexturable(desc.fConfig)); SkASSERT(data || isNewTexture); // No support for software flip y, yet... @@ -827,11 +825,9 @@ bool GrGLGpu::uploadCompressedTexData(const GrSurfaceDesc& desc, // is a multiple of the block size. size_t dataSize = GrCompressedFormatDataSize(desc.fConfig, width, height); - // We only need the internal format for compressed 2D textures. - GrGLenum internalFormat = 0; - if (!this->configToGLFormats(desc.fConfig, false, &internalFormat, nullptr, nullptr)) { - return false; - } + // We only need the internal format for compressed 2D textures. There is on + // sized vs base internal format distinction for compressed textures. + GrGLenum internalFormat = fConfigTable[desc.fConfig].fSizedInternalFormat; if (isNewTexture) { CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); @@ -1971,12 +1967,9 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, return false; } - GrGLenum format = 0; - GrGLenum type = 0; + GrGLenum format = fConfigTable[config].fExternalFormat; + GrGLenum type = fConfigTable[config].fExternalType; bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); - if (!this->configToGLFormats(config, false, nullptr, &format, &type)) { - return false; - } // resolve the render target if necessary switch (tgt->getResolveType()) {