aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-10-14 22:12:33 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-17 17:22:32 +0000
commit8580d51cd8cb733321978966621056fa38b7be8c (patch)
treebff686d40a5083437b052385b7e70fc5dec58550 /src/sksl
parent87d54cd1aec2d282b0e7f1ef9c8bb8fc3da06a84 (diff)
Add sk_InstanceID
Bug: skia: Change-Id: I79b0dce96d9af7632f027afa5317a7725e96cda3 Reviewed-on: https://skia-review.googlesource.com/59861 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/sksl')
-rw-r--r--src/sksl/README1
-rw-r--r--src/sksl/SkSLCompiler.h1
-rw-r--r--src/sksl/SkSLGLSLCodeGenerator.cpp3
-rw-r--r--src/sksl/sksl_vert.include1
4 files changed, 6 insertions, 0 deletions
diff --git a/src/sksl/README b/src/sksl/README
index c8fba509c5..d33217b7ee 100644
--- a/src/sksl/README
+++ b/src/sksl/README
@@ -41,6 +41,7 @@ Differences from GLSL
* use sk_Position instead of gl_Position
* use sk_PointSize instead of gl_PointSize
* use sk_VertexID instead of gl_VertexID
+* use sk_InstanceID instead of gl_InstanceID
* the fragment coordinate is sk_FragCoord, and is always relative to the upper
left.
* you do not need to include ".0" to make a number a float (meaning that
diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h
index 1c8ef4f0fa..53cde1a618 100644
--- a/src/sksl/SkSLCompiler.h
+++ b/src/sksl/SkSLCompiler.h
@@ -26,6 +26,7 @@
#define SK_TEXTURESAMPLERS_BUILTIN 10006
#define SK_FRAGCOORD_BUILTIN 15
#define SK_VERTEXID_BUILTIN 5
+#define SK_INSTANCEID_BUILTIN 6
#define SK_CLIPDISTANCE_BUILTIN 3
#define SK_INVOCATIONID_BUILTIN 8
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 229b183ac7..5edb8833bf 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -449,6 +449,9 @@ void GLSLCodeGenerator::writeVariableReference(const VariableReference& ref) {
case SK_VERTEXID_BUILTIN:
this->write("gl_VertexID");
break;
+ case SK_INSTANCEID_BUILTIN:
+ this->write("gl_InstanceID");
+ break;
case SK_CLIPDISTANCE_BUILTIN:
this->write("gl_ClipDistance");
break;
diff --git a/src/sksl/sksl_vert.include b/src/sksl/sksl_vert.include
index b4dd63a8ce..9e797b326d 100644
--- a/src/sksl/sksl_vert.include
+++ b/src/sksl/sksl_vert.include
@@ -9,6 +9,7 @@ out sk_PerVertex {
};
layout(builtin=5) in int sk_VertexID;
+layout(builtin=6) in int sk_InstanceID;
)