aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLCaps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gl/GrGLCaps.cpp')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 56f25ea4cc..0f5126b820 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -1334,7 +1334,6 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
// Correctness workarounds.
bool disableTextureRedForMesa = false;
- bool disableBGRATexStorageForDriver = false;
bool disableSRGBForX86PowerVR = false;
bool disableSRGBWriteControlForAdreno4xx = false;
bool disableR8TexStorageForANGLEGL = false;
@@ -1351,12 +1350,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;
@@ -1442,6 +1435,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;
@@ -1450,6 +1449,8 @@ 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;
@@ -1464,10 +1465,15 @@ 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;
+ supportsBGRATexStorage = true;
}
} else 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 |=
@@ -1476,7 +1482,7 @@ void GrGLCaps::initConfigTable(const GrContextOptions& contextOptions,
}
}
- if (texStorageSupported && !disableBGRATexStorageForDriver) {
+ if (texStorageSupported && supportsBGRATexStorage) {
fConfigTable[kBGRA_8888_GrPixelConfig].fFlags |= ConfigInfo::kCanUseTexStorage_Flag;
}
fConfigTable[kBGRA_8888_GrPixelConfig].fSwizzle = GrSwizzle::RGBA();
@@ -1890,7 +1896,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;
}