aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-18 02:01:32 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-18 02:24:07 +0000
commit56fbbd65807d1c4ff63b5233764c6e15cba51bb4 (patch)
treeac7cc908e2fb7898eb87be61e32a8ad53ba0fba6
parentf3eac7140aebda2e0c3b570f23b94b222d7664aa (diff)
Revert "Minor fixes to SkSL precisions"
This reverts commit 9752c3c3079140d7dbcf1fb2feb513f1e139a03a. Reason for revert: prerequisite to reverting 05d5a13fea6246648de7e41358ed338d53c85ea2 Original change's description: > Minor fixes to SkSL precisions > > No-Presubmit: true > No-Tree-Checks: true > Bug: skia: > Change-Id: Ife95d3ba457f79c00bf4fdd54af898a3a50402aa > Reviewed-on: https://skia-review.googlesource.com/47241 > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> TBR=bsalomon@google.com,ethannicholas@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: Ib1ef28bc94263154e54c01fd172d83ee48a797a8 Reviewed-on: https://skia-review.googlesource.com/47720 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
-rw-r--r--src/gpu/ccpr/GrCCPRCubicProcessor.cpp4
-rw-r--r--src/sksl/SkSLGLSLCodeGenerator.cpp3
-rw-r--r--tests/SkSLGLSLTest.cpp6
3 files changed, 2 insertions, 11 deletions
diff --git a/src/gpu/ccpr/GrCCPRCubicProcessor.cpp b/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
index 1fc2a29342..fcf2076c1c 100644
--- a/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
@@ -124,7 +124,7 @@ void GrCCPRCubicProcessor::emitPerVertexGeometryCode(SkString* fnBody, const cha
const char* /*coverage*/,
const char* /*wind*/) const {
fnBody->appendf("highfloat3 klm = highfloat3(%s, 1) * %s;", position, fKLMMatrix.c_str());
- fnBody->appendf("highfloat d = dot(highfloat3(%s, 1), %s);",
+ fnBody->appendf("highfloat d = dot(float3(%s, 1), %s);",
position, fEdgeDistanceEquation.c_str());
fnBody->appendf("%s = highfloat4(klm, d);", fKLMD.gsOut());
this->onEmitPerVertexGeometryCode(fnBody);
@@ -202,7 +202,7 @@ void GrCCPRCubicCornerProcessor::emitShaderCoverage(GrGLSLFragmentBuilder* f,
// Use software msaa to estimate actual coverage at the corner pixels.
const int sampleCount = this->defineSoftSampleLocations(f, "samples");
- f->codeAppendf("highfloat4 klmd_center = highfloat4(%s.xyz, %s.w + 0.5);",
+ f->codeAppendf("highfloat4 klmd_center = float4(%s.xyz, %s.w + 0.5);",
fKLMD.fsIn(), fKLMD.fsIn());
f->codeAppendf("for (int i = 0; i < %i; ++i) {", sampleCount);
f->codeAppend ( "highfloat4 klmd = grad_klmd * samples[i] + klmd_center;");
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index c6b4806245..a30262f3fe 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -1025,9 +1025,6 @@ bool GLSLCodeGenerator::generateCode() {
fOut = rawOut;
write_stringstream(fHeader, *rawOut);
- if (this->usesPrecisionModifiers()) {
- this->writeLine("precision mediump float;");
- }
write_stringstream(body, *rawOut);
return true;
}
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp
index bfcedacc90..851c0e8a34 100644
--- a/tests/SkSLGLSLTest.cpp
+++ b/tests/SkSLGLSLTest.cpp
@@ -321,7 +321,6 @@ DEF_TEST(SkSLUsesPrecisionModifiers, r) {
"sk_FragColor.rg = half2(x, y); }",
*SkSL::ShaderCapsFactory::UsesPrecisionModifiers(),
"#version 400\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"void main() {\n"
" mediump float x = 0.75;\n"
@@ -511,7 +510,6 @@ DEF_TEST(SkSLDerivatives, r) {
"void main() { sk_FragColor.r = 1; }",
*SkSL::ShaderCapsFactory::ShaderDerivativeExtensionString(),
"#version 400\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"void main() {\n"
" sk_FragColor.x = 1.0;\n"
@@ -521,7 +519,6 @@ DEF_TEST(SkSLDerivatives, r) {
*SkSL::ShaderCapsFactory::ShaderDerivativeExtensionString(),
"#version 400\n"
"#extension GL_OES_standard_derivatives : require\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"void main() {\n"
" sk_FragColor.x = dFdx(1.0);\n"
@@ -1488,7 +1485,6 @@ DEF_TEST(SkSLTypePrecision, r) {
"half2x4 h24 = half2x4(1, 2, 3, 4, 5, 6, 7, 8);",
*SkSL::ShaderCapsFactory::UsesPrecisionModifiers(),
"#version 400\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"highp float f = 1.0;\n"
"mediump float h = 2.0;\n"
@@ -1582,7 +1578,6 @@ DEF_TEST(SkSLForceHighPrecision, r) {
"void main() { half x = sqrt(1); half4 y = half4(x); sk_FragColor = y; }",
*SkSL::ShaderCapsFactory::UsesPrecisionModifiers(),
"#version 400\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"void main() {\n"
" mediump float x = sqrt(1.0);\n"
@@ -1598,7 +1593,6 @@ DEF_TEST(SkSLForceHighPrecision, r) {
"void main() { half x = sqrt(1); half4 y = half4(x); sk_FragColor = y; }",
settings,
"#version 400\n"
- "precision mediump float;\n"
"out mediump vec4 sk_FragColor;\n"
"void main() {\n"
" highp float x = sqrt(1.0);\n"