aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-01-19 16:58:02 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-19 22:36:26 +0000
commitde4d301881e7fd084f1f0b359ec6f9b2bf8bd4c5 (patch)
treeedbe55dab521fec2922e3826b4e3d26150254411 /tests
parent5bee0b6de6b3ad1166d067e6b5046b48b8240a29 (diff)
Replaced all calls to fragmentPosition() with sk_FragCoord
BUG=skia: Change-Id: I179576e148ea6caf6e1c40f0a216421898bcb35d Reviewed-on: https://skia-review.googlesource.com/5941 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageStorageTest.cpp4
-rw-r--r--tests/SkSLErrorTest.cpp9
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index 8ffb82d690..a55c61b8f5 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -30,7 +30,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
TestFP(sk_sp<GrTexture> texture, GrSLMemoryModel mm, GrSLRestrict restrict)
: fImageStorageAccess(std::move(texture), kRead_GrIOType, mm, restrict) {
this->initClassID<TestFP>();
- this->setWillReadFragmentPosition();
this->addImageStorageAccess(&fImageStorageAccess);
}
@@ -50,8 +49,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
const TestFP& tfp = args.fFp.cast<TestFP>();
GrGLSLFPFragmentBuilder* fb = args.fFragBuilder;
SkString imageLoadStr;
- fb->codeAppendf("highp vec2 coord = %s.xy;",
- args.fFragBuilder->fragmentPosition());
+ fb->codeAppend("highp vec2 coord = sk_FragCoord.xy;");
fb->appendImageStorageLoad(&imageLoadStr, args.fImageStorages[0],
"ivec2(coord)");
if (GrPixelConfigIsSint(tfp.fImageStorageAccess.texture()->config())) {
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index a33e6f16e6..c28dbbb7f3 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -418,4 +418,13 @@ DEF_TEST(SkSLDivByZero, r) {
"error: 1: division by zero\n1 error\n");
}
+DEF_TEST(SkSLUnsupportedGLSLIdentifiers, r) {
+ test_failure(r,
+ "void main() { float x = gl_FragCoord.x; };",
+ "error: 1: unknown identifier 'gl_FragCoord'\n1 error\n");
+ test_failure(r,
+ "void main() { float r = gl_FragColor.r; };",
+ "error: 1: unknown identifier 'gl_FragColor'\n1 error\n");
+}
+
#endif