aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-07-27 12:38:35 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-27 19:04:46 +0000
commit49d14e98fe43fdff818e7571c1a61cd5045fedc0 (patch)
tree18d48cd1922c646b6dafa851fbe214c8904aef87 /tests
parentf4f6bbfadac327619a3832acad9c8afe06629b55 (diff)
sksl: Add a "sk_Clockwise" built-in
This allows us to identify clockwise-winding triangles, in terms of Skia device space, in all backends and with all render target origins. Bug: skia: Change-Id: I220e1c459e0129d1cc4dee6458ef94277fbedd21 Reviewed-on: https://skia-review.googlesource.com/142662 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/SkSLGLSLTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index 275fb2b017..5b083fa511 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -1154,6 +1154,17 @@ DEF_TEST(SkSLFragCoord, r) {
"}\n");
}
+DEF_TEST(SkSLClockwise, r) {
+ test(r,
+ "void main() { sk_FragColor = half4(sk_Clockwise ? +1 : -1); }",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(float(gl_FrontFacing ? 1 : -1));\n"
+ "}\n");
+}
+
DEF_TEST(SkSLVertexID, r) {
test(r,
"out int id; void main() { id = sk_VertexID; }",