aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-01-11 00:46:14 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-11 19:27:39 +0000
commit8fd7955d03aa37e65493a6d4eeaa5a36dd45c278 (patch)
tree4f675d65eba78b7d4556b8162a0e532b79e60d6e /src/sksl
parent1c153c0fba31a90e9c76156b7805448653f17226 (diff)
Enable the GL_EXT_geometry_shader extension where necessary
Bug: skia: Change-Id: I37bfb90efed28748d6c3e53be5c9703c291b036c Reviewed-on: https://skia-review.googlesource.com/93460 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/sksl')
-rw-r--r--src/sksl/SkSLGLSLCodeGenerator.cpp6
-rw-r--r--src/sksl/SkSLUtil.h22
2 files changed, 27 insertions, 1 deletions
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index ad3fde52f9..9e2336e22e 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -1246,6 +1246,12 @@ bool GLSLCodeGenerator::generateCode() {
fOut = &fHeader;
fProgramKind = fProgram.fKind;
this->writeHeader();
+ if (Program::kGeometry_Kind == fProgramKind &&
+ fProgram.fSettings.fCaps->geometryShaderExtensionString()) {
+ fHeader.writeText("#extension ");
+ fHeader.writeText(fProgram.fSettings.fCaps->geometryShaderExtensionString());
+ fHeader.writeText(" : require\n");
+ }
StringStream body;
fOut = &body;
for (const auto& e : fProgram.fElements) {
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h
index 1d9d53f6e8..7a39386269 100644
--- a/src/sksl/SkSLUtil.h
+++ b/src/sksl/SkSLUtil.h
@@ -155,6 +155,10 @@ public:
return nullptr;
}
+ const char* geometryShaderExtensionString() const {
+ return nullptr;
+ }
+
const char* gsInvocationsExtensionString() const {
return nullptr;
}
@@ -184,7 +188,6 @@ public:
sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
result->fVersionDeclString = "#version 400";
result->fShaderDerivativeSupport = true;
- result->fGSInvocationsSupport = true;
return result;
}
@@ -253,6 +256,14 @@ public:
return result;
}
+ static sk_sp<GrShaderCaps> GeometryShaderSupport() {
+ sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
+ result->fVersionDeclString = "#version 400";
+ result->fGeometryShaderSupport = true;
+ result->fGSInvocationsSupport = true;
+ return result;
+ }
+
static sk_sp<GrShaderCaps> NoGSInvocationsSupport() {
sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
result->fVersionDeclString = "#version 400";
@@ -261,6 +272,15 @@ public:
return result;
}
+ static sk_sp<GrShaderCaps> GeometryShaderExtensionString() {
+ sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
+ result->fVersionDeclString = "#version 310es";
+ result->fGeometryShaderSupport = true;
+ result->fGeometryShaderExtensionString = "GL_EXT_geometry_shader";
+ result->fGSInvocationsSupport = true;
+ return result;
+ }
+
static sk_sp<GrShaderCaps> GSInvocationsExtensionString() {
sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
result->fVersionDeclString = "#version 400";