diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-24 14:52:02 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-24 14:52:11 +0000 |
commit | fe8da17f5333a0134a01b9fe4d7f67e3df949c61 (patch) | |
tree | bcffa405e17967214abcc9efcf75ede8d9cff689 /tests/SkSLGLSLTest.cpp | |
parent | 3a08c65b9612dd845623f0e880fd68b3be75fceb (diff) |
Revert "Revert "converted vertex shaders to device coords""
This reverts commit 29b3434e48ca41672266ac40f5b9e8f8a0405cb5.
Reason for revert: The Chrome perf regression is suspect & the Nexus 5 is broken w/o this CL.
Original change's description:
> Revert "converted vertex shaders to device coords"
>
> This reverts commit e7e81c15c144b8133f696d0744ed9f7e8d06e936.
>
> Reason for revert: Chrome perf regressions
>
> Bug: skia:
> Change-Id: I17fadc97c4b8e80bfdccbf123554614a00c58473
> Reviewed-on: https://skia-review.googlesource.com/99040
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=csmartdalton@google.com,ethannicholas@google.com
Change-Id: Iff3c9fce65beeca16028ae59d4d08b1413b90530
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/99241
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/SkSLGLSLTest.cpp')
-rw-r--r-- | tests/SkSLGLSLTest.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp index 53710c9516..62c5cd6955 100644 --- a/tests/SkSLGLSLTest.cpp +++ b/tests/SkSLGLSLTest.cpp @@ -1072,6 +1072,21 @@ DEF_TEST(SkSLFragCoord, r) { SkSL::Program::kVertex_Kind); test(r, + "in uniform float4 sk_RTAdjust; in float4 pos; void main() { sk_Position = pos; }", + *SkSL::ShaderCapsFactory::CannotUseFragCoord(), + "#version 400\n" + "out vec4 sk_FragCoord_Workaround;\n" + "in uniform vec4 sk_RTAdjust;\n" + "in vec4 pos;\n" + "void main() {\n" + " sk_FragCoord_Workaround = (gl_Position = pos);\n" + " gl_Position = vec4(gl_Position.x * sk_RTAdjust.x + gl_Position.w * sk_RTAdjust.y, " + "gl_Position.y * sk_RTAdjust.z + gl_Position.w * sk_RTAdjust.w, 0.0, " + "gl_Position.w);\n" + "}\n", + SkSL::Program::kVertex_Kind); + + test(r, "void main() { sk_FragColor.xy = sk_FragCoord.xy; }", *SkSL::ShaderCapsFactory::CannotUseFragCoord(), "#version 400\n" @@ -1739,6 +1754,58 @@ DEF_TEST(SkSLForceHighPrecision, r) { &inputs); } +DEF_TEST(SkSLNormalization, r) { + test(r, + "uniform float4 sk_RTAdjust; void main() { sk_Position = half4(1); }", + *SkSL::ShaderCapsFactory::Default(), + "#version 400\n" + "uniform vec4 sk_RTAdjust;\n" + "void main() {\n" + " gl_Position = vec4(1.0);\n" + " gl_Position = vec4(gl_Position.x * sk_RTAdjust.x + gl_Position.w * sk_RTAdjust.y, " + "gl_Position.y * sk_RTAdjust.z + gl_Position.w * sk_RTAdjust.w, " + "0.0, " + "gl_Position.w);\n" + "}\n", + SkSL::Program::kVertex_Kind); + test(r, + "uniform float4 sk_RTAdjust;" + "layout(points) in;" + "layout(invocations = 2) in;" + "layout(line_strip, max_vertices = 2) out;" + "void main() {" + "sk_Position = sk_in[0].sk_Position + float4(-0.5, 0, 0, sk_InvocationID);" + "EmitVertex();" + "sk_Position = sk_in[0].sk_Position + float4(0.5, 0, 0, sk_InvocationID);" + "EmitVertex();" + "EndPrimitive();" + "}", + *SkSL::ShaderCapsFactory::GeometryShaderSupport(), + "#version 400\n" + "uniform vec4 sk_RTAdjust;\n" + "layout (points) in ;\n" + "layout (invocations = 2) in ;\n" + "layout (line_strip, max_vertices = 2) out ;\n" + "void main() {\n" + " gl_Position = gl_in[0].gl_Position + vec4(-0.5, 0.0, 0.0, float(gl_InvocationID));\n" + " {\n" + " gl_Position = vec4(gl_Position.x * sk_RTAdjust.x + gl_Position.w * " + "sk_RTAdjust.y, gl_Position.y * sk_RTAdjust.z + gl_Position.w * " + "sk_RTAdjust.w, 0.0, gl_Position.w);\n" + " EmitVertex();\n" + " }\n" + " gl_Position = gl_in[0].gl_Position + vec4(0.5, 0.0, 0.0, float(gl_InvocationID));\n" + " {\n" + " gl_Position = vec4(gl_Position.x * sk_RTAdjust.x + gl_Position.w * " + "sk_RTAdjust.y, gl_Position.y * sk_RTAdjust.z + gl_Position.w * " + "sk_RTAdjust.w, 0.0, gl_Position.w);\n" + " EmitVertex();\n" + " }\n" + " EndPrimitive();\n" + "}\n", + SkSL::Program::kGeometry_Kind); +} + DEF_TEST(SkSLTernaryLValue, r) { test(r, "void main() { half r, g; (true ? r : g) = 1; (false ? r : g) = 0; " |