diff options
-rw-r--r-- | include/gpu/GrShaderCaps.h | 10 | ||||
-rw-r--r-- | src/gpu/GrShaderCaps.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 13 | ||||
-rw-r--r-- | src/sksl/SkSLGLSLCodeGenerator.cpp | 5 | ||||
-rw-r--r-- | src/sksl/SkSLUtil.h | 4 |
5 files changed, 27 insertions, 6 deletions
diff --git a/include/gpu/GrShaderCaps.h b/include/gpu/GrShaderCaps.h index b6afe3934f..d8f4d95eb6 100644 --- a/include/gpu/GrShaderCaps.h +++ b/include/gpu/GrShaderCaps.h @@ -176,11 +176,20 @@ public: return fSecondaryOutputExtensionString; } + // This returns the name of an extension that must be enabled in the shader to support external + // textures. In some cases, two extensions must be enabled - the second extension is returned + // by secondExternalTextureExtensionString(). If that function returns nullptr, then only one + // extension is required. const char* externalTextureExtensionString() const { SkASSERT(this->externalTextureSupport()); return fExternalTextureExtensionString; } + const char* secondExternalTextureExtensionString() const { + SkASSERT(this->externalTextureSupport()); + return fSecondExternalTextureExtensionString; + } + const char* texelBufferExtensionString() const { SkASSERT(this->texelBufferSupport()); return fTexelBufferExtensionString; @@ -279,6 +288,7 @@ private: const char* fFragCoordConventionsExtensionString; const char* fSecondaryOutputExtensionString; const char* fExternalTextureExtensionString; + const char* fSecondExternalTextureExtensionString; const char* fTexelBufferExtensionString; const char* fNoPerspectiveInterpolationExtensionString; const char* fImageLoadStoreExtensionString; diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp index c0b34ab746..486909e028 100644 --- a/src/gpu/GrShaderCaps.cpp +++ b/src/gpu/GrShaderCaps.cpp @@ -57,6 +57,7 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { fFragCoordConventionsExtensionString = nullptr; fSecondaryOutputExtensionString = nullptr; fExternalTextureExtensionString = nullptr; + fSecondExternalTextureExtensionString = nullptr; fTexelBufferExtensionString = nullptr; fNoPerspectiveInterpolationExtensionString = nullptr; fFBFetchColorName = nullptr; diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 3299416c5b..c569e031e2 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -2478,15 +2478,16 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo, fInvalidateFBType = kNone_InvalidateFBType; } - // Various Samsung devices (Note4, S7, ...) don't advertise the image_external_essl3 extension, - // (only the base image_external extension), but do support it, and require that it be enabled - // to work with ESSL3. This has been seen on both Mali and Adreno devices. skbug.com/7713 + // Many ES3 drivers only advertise the ES2 image_external extension, but support the _essl3 + // extension, and require that it be enabled to work with ESSL3. Other devices require the ES2 + // extension to be enabled, even when using ESSL3. Enabling both extensions fixes both cases. + // skbug.com/7713 if (ctxInfo.hasExtension("GL_OES_EGL_image_external") && ctxInfo.glslGeneration() >= k330_GrGLSLGeneration && - !shaderCaps->fExternalTextureSupport && // i.e. Missing the _essl3 extension - (kARM_GrGLVendor == ctxInfo.vendor() || kQualcomm_GrGLVendor == ctxInfo.vendor())) { + !shaderCaps->fExternalTextureSupport) { // i.e. Missing the _essl3 extension shaderCaps->fExternalTextureSupport = true; - shaderCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external_essl3"; + shaderCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external"; + shaderCaps->fSecondExternalTextureExtensionString = "GL_OES_EGL_image_external_essl3"; } } diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index bcf45ba7be..84c16d40f8 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -1089,6 +1089,11 @@ void GLSLCodeGenerator::writeVarDeclarations(const VarDeclarations& decl, bool g fHeader.writeText(fProgram.fSettings.fCaps->externalTextureExtensionString()); fHeader.writeText(" : require\n"); } + if (fProgram.fSettings.fCaps->secondExternalTextureExtensionString()) { + fHeader.writeText("#extension "); + fHeader.writeText(fProgram.fSettings.fCaps->secondExternalTextureExtensionString()); + fHeader.writeText(" : require\n"); + } fFoundExternalSamplerDecl = true; } } diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h index dc87246605..40a5a4774f 100644 --- a/src/sksl/SkSLUtil.h +++ b/src/sksl/SkSLUtil.h @@ -155,6 +155,10 @@ public: return nullptr; } + const char* secondExternalTextureExtensionString() const { + return nullptr; + } + const char* versionDeclString() const { return ""; } |