aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-02-07 14:53:32 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 23:15:34 +0000
commita51740c4f879b3c15877975118ef7588b99eaaea (patch)
tree32690a7c5d4eb24b89c9847502ad53af465ff2f0 /tests/SkSLGLSLTest.cpp
parent8c3f4ae56ad0d0555b8b9e6565f75f3357a95309 (diff)
added support for sk_VertexID
Change-Id: If3a2b7527ae6805ba54860c6ca6219431e2f3f76 Reviewed-on: https://skia-review.googlesource.com/8145 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r--tests/SkSLGLSLTest.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 1501dc5677..671f6d849b 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -12,12 +12,11 @@
#if SK_SUPPORT_GPU
static void test(skiatest::Reporter* r, const char* src, const SkSL::Program::Settings& settings,
- const char* expected, SkSL::Program::Inputs* inputs) {
+ const char* expected, SkSL::Program::Inputs* inputs,
+ SkSL::Program::Kind kind = SkSL::Program::kFragment_Kind) {
SkSL::Compiler compiler;
SkString output;
- std::unique_ptr<SkSL::Program> program = compiler.convertProgram(SkSL::Program::kFragment_Kind,
- SkString(src),
- settings);
+ std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, SkString(src), settings);
if (!program) {
SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str());
}
@@ -35,11 +34,11 @@ static void test(skiatest::Reporter* r, const char* src, const SkSL::Program::Se
}
static void test(skiatest::Reporter* r, const char* src, const GrShaderCaps& caps,
- const char* expected) {
+ const char* expected, SkSL::Program::Kind kind = SkSL::Program::kFragment_Kind) {
SkSL::Program::Settings settings;
settings.fCaps = &caps;
SkSL::Program::Inputs inputs;
- test(r, src, settings, expected, &inputs);
+ test(r, src, settings, expected, &inputs, kind);
}
DEF_TEST(SkSLHelloWorld, r) {
@@ -677,4 +676,16 @@ DEF_TEST(SkSLFragCoord, r) {
REPORTER_ASSERT(r, !inputs.fRTHeight);
}
+DEF_TEST(SkSLVertexID, r) {
+ test(r,
+ "out int id; void main() { id = sk_VertexID; }",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out int id;\n"
+ "void main() {\n"
+ " id = gl_VertexID;\n"
+ "}\n",
+ SkSL::Program::kVertex_Kind);
+}
+
#endif