Revert "Revert "Add a flag to GrSurfaceFlags that requires the texture to be cleared upon creation. ""
This reverts commit a9e795eab5f59a52d96b8fdc39351452835f5eb9.
Bug: skia:
Change-Id: Ibfc51497ae99f332f8f72a799393a1b2996f7f3f
Reviewed-on: https://skia-review.googlesource.com/17767
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b9eee08..8c43303 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -54,6 +54,7 @@
fSRGBDecodeDisableSupport = false;
fSRGBDecodeDisableAffectsMipmaps = false;
fClearToBoundaryValuesIsBroken = false;
+ fClearTextureSupport = false;
fDrawArraysBaseVertexIsBroken = false;
fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag;
@@ -252,6 +253,22 @@
// vis-versa.
fRGBAToBGRAReadbackConversionsAreSlow = isMESA || isMAC;
+ if (kGL_GrGLStandard == standard) {
+ if (version >= GR_GL_VER(4,4) || ctxInfo.hasExtension("GL_ARB_clear_texture")) {
+ // glClearTexImage seems to have a bug in NVIDIA drivers that was fixed sometime between
+ // 340.96 and 367.57.
+ if (ctxInfo.driver() != kNVIDIA_GrGLDriver ||
+ ctxInfo.driverVersion() >= GR_GL_DRIVER_VER(367, 57)) {
+ fClearTextureSupport = true;
+ }
+ }
+ } else if (ctxInfo.hasExtension("GL_EXT_clear_texture")) {
+ // Calling glClearTexImage crashes on the NexusPlayer.
+ if (kPowerVRRogue_GrGLRenderer != ctxInfo.renderer()) {
+ fClearTextureSupport = true;
+ }
+ }
+
/**************************************************************************
* GrShaderCaps fields
**************************************************************************/