aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLCompiler.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-11-10 15:34:03 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-13 14:36:40 +0000
commitaae47c878b83ab6d9742d92a6fa47e762f6b9204 (patch)
treefd13dbc1dc7c5dc36f8262099cf8ade55ec0cb47 /src/sksl/SkSLCompiler.cpp
parent2d9cb57c83553be3434c04f860d5e9fec30cb453 (diff)
sksl enum support
Bug: skia: Change-Id: I4d505b31cf8b59de12bcdbca410aafc085977ba9 Reviewed-on: https://skia-review.googlesource.com/68621 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLCompiler.cpp')
-rw-r--r--src/sksl/SkSLCompiler.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 0b51824f0d..3b91511110 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -14,6 +14,7 @@
#include "SkSLIRGenerator.h"
#include "SkSLMetalCodeGenerator.h"
#include "SkSLSPIRVCodeGenerator.h"
+#include "ir/SkSLEnum.h"
#include "ir/SkSLExpression.h"
#include "ir/SkSLExpressionStatement.h"
#include "ir/SkSLIntLiteral.h"
@@ -28,8 +29,6 @@
#include "spirv-tools/libspirv.hpp"
#endif
-#define STRINGIFY(x) #x
-
// include the built-in shader symbols as static strings
static const char* SKSL_INCLUDE =
@@ -49,6 +48,7 @@ static const char* SKSL_GEOM_INCLUDE =
;
static const char* SKSL_FP_INCLUDE =
+#include "sksl_enums.include"
#include "sksl_fp.include"
;
@@ -1153,6 +1153,11 @@ std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, String tex
break;
}
fIRGenerator->fSymbolTable->markAllFunctionsBuiltin();
+ for (auto& element : elements) {
+ if (element->fKind == ProgramElement::kEnum_Kind) {
+ ((Enum&) *element).fBuiltin = true;
+ }
+ }
std::unique_ptr<String> textPtr(new String(std::move(text)));
fSource = textPtr.get();
fIRGenerator->convertProgram(textPtr->c_str(), textPtr->size(), *fTypes, &elements);