aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkSLGLSLTest.cpp
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-10-20 09:54:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-20 09:54:00 -0700
commitddb37d67ba4db42fa5c6012b58d0f4985b454dc0 (patch)
treeb456baa999164506a397509b20be0c8fdc413f7a /tests/SkSLGLSLTest.cpp
parent4a5e49dc6e970c4edb21f0797774082181682163 (diff)
re-re-land of skslc now automatically turns on derivatives support
Only change from last attempt is putting the call to shaderDerivativeExtensionString behind a check for shaderDerivativeSupport to avoid a spurious assertion failure. TBR=benjaminwagner@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2437063002 Review-Url: https://chromiumcodereview.appspot.com/2437063002
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r--tests/SkSLGLSLTest.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index b615f67814..ad1fe0d901 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -27,15 +27,7 @@ static void test(skiatest::Reporter* r, const char* src, SkSL::GLCaps caps, cons
}
static SkSL::GLCaps default_caps() {
- return {
- 400,
- SkSL::GLCaps::kGL_Standard,
- false, // isCoreProfile
- false, // usesPrecisionModifiers;
- false, // mustDeclareFragmentShaderOutput
- true, // canUseMinAndAbsTogether
- false // mustForceNegatedAtanParamToFloat
- };
+ return SkSL::GLCaps();
}
DEF_TEST(SkSLHelloWorld, r) {
@@ -387,3 +379,30 @@ DEF_TEST(SkSLArrayConstructors, r) {
"vec2 test2[] = vec2[](vec2(1.0, 2.0), vec2(3.0, 4.0));\n"
"mat4 test3[] = mat4[]();\n");
}
+
+DEF_TEST(SkSLDerivatives, r) {
+ test(r,
+ "void main() { float x = dFdx(1); }",
+ default_caps(),
+ "#version 400\n"
+ "void main() {\n"
+ " float x = dFdx(1.0);\n"
+ "}\n");
+ SkSL::GLCaps caps = default_caps();
+ caps.fShaderDerivativeExtensionString = "GL_OES_standard_derivatives";
+ test(r,
+ "void main() { float x = 1; }",
+ caps,
+ "#version 400\n"
+ "void main() {\n"
+ " float x = 1.0;\n"
+ "}\n");
+ test(r,
+ "void main() { float x = dFdx(1); }",
+ caps,
+ "#version 400\n"
+ "#extension GL_OES_standard_derivatives : require\n"
+ "void main() {\n"
+ " float x = dFdx(1.0);\n"
+ "}\n");
+}