Move external texture extension logic into SkSL
Automatically enable the extension if any external samplers are used.
Bug: skia:7713
Change-Id: I1de2faddd7c8eda864873941b90d7a4c4606497a
Reviewed-on: https://skia-review.googlesource.com/121797
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 0ee0afa..bcf45ba 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -1083,6 +1083,14 @@
}
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(";");