diff options
author | Derek Sollenberger <djsollen@google.com> | 2018-04-18 16:11:37 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2018-04-18 16:12:39 -0400 |
commit | a4887a12890b7c810808e571a782c778cfeddc13 (patch) | |
tree | 732835fc6ed49ec18428e1b08ee2a824c3d98050 | |
parent | b638a5295d0e1d00b537ab535b74253644a8d9d0 (diff) | |
parent | 98b880084e26a802aa935db8cd59ba702985bb31 (diff) | |
download | platform_external_skqp-a4887a12890b7c810808e571a782c778cfeddc13.tar.gz platform_external_skqp-a4887a12890b7c810808e571a782c778cfeddc13.tar.bz2 platform_external_skqp-a4887a12890b7c810808e571a782c778cfeddc13.zip |
Merge 'aosp/upstream-skqp/release' into pi-dev
Test: atest CtsSkQPTestCases
Bug: 78217594
Change-Id: I0a490c3f44b877f2c3fb7f34256ea89c954ca2c3
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index b2ba075acb..e3c4092dfa 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -1348,7 +1348,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, // Correctness workarounds. bool disableTextureRedForMesa = false; - bool disableBGRATexStorageForDriver = false; bool disableSRGBForX86PowerVR = false; bool disableSRGBWriteControlForAdreno4xx = false; bool disableR8TexStorageForANGLEGL = false; @@ -1365,12 +1364,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, isX86PowerVR = true; } #endif - // Adreno 3xx, 4xx, 5xx, and NexusPlayer all fail if we try to use TexStorage with BGRA - disableBGRATexStorageForDriver = kAdreno3xx_GrGLRenderer == ctxInfo.renderer() || - kAdreno4xx_GrGLRenderer == ctxInfo.renderer() || - kAdreno5xx_GrGLRenderer == ctxInfo.renderer() || - isX86PowerVR; - // NexusPlayer has strange bugs with sRGB (skbug.com/4148). This is a targeted fix to // blacklist that device (and any others that might be sharing the same driver). disableSRGBForX86PowerVR = isX86PowerVR; @@ -1456,6 +1449,12 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, GR_GL_BGRA; fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fExternalType = GR_GL_UNSIGNED_BYTE; fConfigTable[kBGRA_8888_GrPixelConfig].fFormatType = kNormalizedFixedPoint_FormatType; + + // TexStorage requires using a sized internal format and BGRA8 is only supported if we have the + // GL_APPLE_texture_format_BGRA8888 extension or if we have GL_EXT_texutre_storage and + // GL_EXT_texture_format_BGRA8888. + bool supportsBGRATexStorage = false; + if (kGL_GrGLStandard == standard) { fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_RGBA; fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_RGBA8; @@ -1464,10 +1463,24 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag | allRenderFlags; } + // Since we are using RGBA8 we can use tex storage. + supportsBGRATexStorage = true; } else { fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fBaseInternalFormat = GR_GL_BGRA; fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fSizedInternalFormat = GR_GL_BGRA8; - if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { + if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { + fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag | + nonMSAARenderFlags; + + if (ctxInfo.hasExtension("GL_EXT_texture_storage")) { + supportsBGRATexStorage = true; + } + if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") && + (this->usesMSAARenderBuffers() || this->fMSFBOType == kMixedSamples_MSFBOType)) { + fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= + ConfigInfo::kRenderableWithMSAA_Flag; + } + } else if (ctxInfo.hasExtension("GL_APPLE_texture_format_BGRA8888")) { // This APPLE extension introduces complexity on ES2. It leaves the internal format // as RGBA, but allows BGRA as the external format. From testing, it appears that the // driver remembers the external format when the texture is created (with TexImage). @@ -1478,19 +1491,12 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, if (version >= GR_GL_VER(3,0)) { // The APPLE extension doesn't make this renderable. fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag; - } - } else if (ctxInfo.hasExtension("GL_EXT_texture_format_BGRA8888")) { - fConfigTable[kBGRA_8888_GrPixelConfig].fFlags = ConfigInfo::kTextureable_Flag | - nonMSAARenderFlags; - if (ctxInfo.hasExtension("GL_CHROMIUM_renderbuffer_format_BGRA8888") && - (this->usesMSAARenderBuffers() || this->fMSFBOType == kMixedSamples_MSFBOType)) { - fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= - ConfigInfo::kRenderableWithMSAA_Flag; + supportsBGRATexStorage = true; } } } - if (texStorageSupported && !disableBGRATexStorageForDriver) { + if (texStorageSupported && supportsBGRATexStorage) { fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag; } fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA(); @@ -1931,7 +1937,7 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions, // ES 2.0: the extension makes BGRA an external format but not an internal format. // ES 3.0: the extension explicitly states GL_BGRA8 is not a valid internal format for // glTexImage (just for glTexStorage). - if (useSizedTexFormats && this->bgraIsInternalFormat()) { + if (useSizedTexFormats && this->bgraIsInternalFormat()) { fConfigTable[kBGRA_8888_GrPixelConfig].fFormats.fInternalFormatTexImage = GR_GL_BGRA; } |