From 58d564881657b2c434fa20a9801f874feada0ad0 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Tue, 19 Dec 2017 09:29:22 -0500 Subject: 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 Reviewed-by: Chris Dalton --- tests/SkSLGLSLTest.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/SkSLGLSLTest.cpp') 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;" -- cgit v1.2.3