aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl')
-rw-r--r--src/sksl/SkSLGLSLCodeGenerator.cpp8
-rw-r--r--src/sksl/SkSLGLSLCodeGenerator.h1
-rw-r--r--src/sksl/SkSLUtil.h4
3 files changed, 13 insertions, 0 deletions
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 0ee0afa6a6..bcf45ba7be 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -1083,6 +1083,14 @@ void GLSLCodeGenerator::writeVarDeclarations(const VarDeclarations& decl, bool g
}
fFoundImageDecl = true;
}
+ if (!fFoundExternalSamplerDecl && var.fVar->fType == *fContext.fSamplerExternalOES_Type) {
+ if (fProgram.fSettings.fCaps->externalTextureExtensionString()) {
+ fHeader.writeText("#extension ");
+ fHeader.writeText(fProgram.fSettings.fCaps->externalTextureExtensionString());
+ fHeader.writeText(" : require\n");
+ }
+ fFoundExternalSamplerDecl = true;
+ }
}
if (wroteType) {
this->write(";");
diff --git a/src/sksl/SkSLGLSLCodeGenerator.h b/src/sksl/SkSLGLSLCodeGenerator.h
index 2b308e3702..362ae7ca18 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.h
+++ b/src/sksl/SkSLGLSLCodeGenerator.h
@@ -209,6 +209,7 @@ protected:
// true if we have run into usages of dFdx / dFdy
bool fFoundDerivatives = false;
bool fFoundImageDecl = false;
+ bool fFoundExternalSamplerDecl = false;
bool fFoundGSInvocations = false;
bool fSetupFragPositionGlobal = false;
bool fSetupFragPositionLocal = false;
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h
index 78a80736b8..dc87246605 100644
--- a/src/sksl/SkSLUtil.h
+++ b/src/sksl/SkSLUtil.h
@@ -151,6 +151,10 @@ public:
return nullptr;
}
+ const char* externalTextureExtensionString() const {
+ return nullptr;
+ }
+
const char* versionDeclString() const {
return "";
}