aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-12-19 09:29:22 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-19 14:58:56 +0000
commit58d564881657b2c434fa20a9801f874feada0ad0 (patch)
treec3cd9742c7d9620d38c24a87aa4a257f6a112d41 /tests
parent1ad81981b0027e96ef0cecd78661ab2c22bdc4aa (diff)
fixed a couple of SkSL ushort issues
This fixes SkSL omitting the 'u' literal on ushort values, and ushorts can now implicitly coerce to ints. Bug: skia: Change-Id: I21e5dc06d34e09a4fc1aa4d746e6e75c0d2d8c7e Reviewed-on: https://skia-review.googlesource.com/85960 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/SkSLGLSLTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index d815b8c439..7c69de62be 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -470,6 +470,8 @@ DEF_TEST(SkSLHex, r) {
"u3++;"
"uint u4 = 0xffffffff;"
"u4++;"
+ "ushort u5 = 0xffff;"
+ "u5++;"
"}",
*SkSL::ShaderCapsFactory::Default(),
"#version 400\n"
@@ -493,6 +495,8 @@ DEF_TEST(SkSLHex, r) {
" u3++;\n"
" uint u4 = 4294967295u;\n"
" u4++;\n"
+ " uint u5 = 65535u;\n"
+ " u5++;\n"
"}\n");
}
@@ -1114,6 +1118,22 @@ DEF_TEST(SkSLArrayTypes, r) {
"}\n");
}
+DEF_TEST(SkSLArrayIndexTypes, r) {
+ test(r,
+ "void main() { float array[4] = float[4](1, 2, 3, 4);"
+ "short x = 0; ushort y = 1; int z = 2; uint w = 3;"
+ "sk_FragColor = float4(array[x], array[y], array[z], array[w]); }",
+ *SkSL::ShaderCapsFactory::Default(),
+ "#version 400\n"
+ "out vec4 sk_FragColor;\n"
+ "void main() {\n"
+ " sk_FragColor = vec4(float[4](1.0, 2.0, 3.0, 4.0)[0], "
+ "float[4](1.0, 2.0, 3.0, 4.0)[1], "
+ "float[4](1.0, 2.0, 3.0, 4.0)[2], "
+ "float[4](1.0, 2.0, 3.0, 4.0)[3]);\n"
+ "}\n");
+}
+
DEF_TEST(SkSLGeometry, r) {
test(r,
"layout(points) in;"