aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-18 02:41:08 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-18 03:01:47 +0000
commit27185a9b9756d2f5fcc077c6c2c005259d4ba517 (patch)
tree7b1747160cb0fb3fb69ecd61de24f4310ee8cf7b /bench
parent56fbbd65807d1c4ff63b5233764c6e15cba51bb4 (diff)
Revert "Revert "Revert "Switched highp float to highfloat and mediump float to half."""
This reverts commit 05d5a13fea6246648de7e41358ed338d53c85ea2. Reason for revert: looks like it broke filterfastbounds Original change's description: > Revert "Revert "Switched highp float to highfloat and mediump float to half."" > > This reverts commit 1d816b92bb7cf2258007f3f74ffd143b89f25d01. > > Bug: skia: > Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1 > Reviewed-on: https://skia-review.googlesource.com/46464 > Reviewed-by: Brian Salomon <bsalomon@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: Iddf6aef2ab084aa73da7ceebdfc303a1d2b80cde Reviewed-on: https://skia-review.googlesource.com/47441 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'bench')
-rw-r--r--bench/GLInstancedArraysBench.cpp13
-rw-r--r--bench/GLVec4ScalarBench.cpp27
-rw-r--r--bench/GLVertexAttributesBench.cpp11
3 files changed, 27 insertions, 24 deletions
diff --git a/bench/GLInstancedArraysBench.cpp b/bench/GLInstancedArraysBench.cpp
index a5348d5d3e..37d1f2c430 100644
--- a/bench/GLInstancedArraysBench.cpp
+++ b/bench/GLInstancedArraysBench.cpp
@@ -111,9 +111,9 @@ GrGLuint GLCpuPosInstancedArraysBench::setupShader(const GrGLContext* ctx) {
const char* version = shaderCaps->versionDeclString();
// setup vertex shader
- GrShaderVar aPosition("a_position", kHalf2_GrSLType, GrShaderVar::kIn_TypeModifier);
- GrShaderVar aColor("a_color", kHalf3_GrSLType, GrShaderVar::kIn_TypeModifier);
- GrShaderVar oColor("o_color", kHalf3_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar aPosition("a_position", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier);
+ GrShaderVar aColor("a_color", kVec3f_GrSLType, GrShaderVar::kIn_TypeModifier);
+ GrShaderVar oColor("o_color", kVec3f_GrSLType, GrShaderVar::kOut_TypeModifier);
SkString vshaderTxt(version);
aPosition.appendDecl(shaderCaps, &vshaderTxt);
@@ -126,13 +126,14 @@ GrGLuint GLCpuPosInstancedArraysBench::setupShader(const GrGLContext* ctx) {
vshaderTxt.append(
"void main()\n"
"{\n"
- "gl_Position = highfloat4(a_position, 0., 1.);\n"
+ "gl_Position = float4(a_position, 0., 1.);\n"
"o_color = a_color;\n"
"}\n");
// setup fragment shader
- GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_TypeModifier);
SkString fshaderTxt(version);
+ GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, *shaderCaps, &fshaderTxt);
oColor.setTypeModifier(GrShaderVar::kIn_TypeModifier);
oColor.appendDecl(shaderCaps, &fshaderTxt);
fshaderTxt.append(";\n");
@@ -149,7 +150,7 @@ GrGLuint GLCpuPosInstancedArraysBench::setupShader(const GrGLContext* ctx) {
fshaderTxt.appendf(
"void main()\n"
"{\n"
- "%s = highfloat4(o_color, 1.0);\n"
+ "%s = float4(o_color, 1.0);\n"
"}\n", fsOutName);
return CreateProgram(ctx, vshaderTxt.c_str(), fshaderTxt.c_str());
diff --git a/bench/GLVec4ScalarBench.cpp b/bench/GLVec4ScalarBench.cpp
index 413e766c07..fab397b220 100644
--- a/bench/GLVec4ScalarBench.cpp
+++ b/bench/GLVec4ScalarBench.cpp
@@ -101,10 +101,10 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) {
// corner of the screen than the previous circle.
// set up vertex shader; this is a trivial vertex shader that passes through position and color
- GrShaderVar aPosition("a_position", kHalf2_GrSLType, GrShaderVar::kIn_TypeModifier);
- GrShaderVar oPosition("o_position", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier);
- GrShaderVar aColor("a_color", kHalf3_GrSLType, GrShaderVar::kIn_TypeModifier);
- GrShaderVar oColor("o_color", kHalf3_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar aPosition("a_position", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier);
+ GrShaderVar oPosition("o_position", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar aColor("a_color", kVec3f_GrSLType, GrShaderVar::kIn_TypeModifier);
+ GrShaderVar oColor("o_color", kVec3f_GrSLType, GrShaderVar::kOut_TypeModifier);
SkString vshaderTxt(version);
aPosition.appendDecl(shaderCaps, &vshaderTxt);
@@ -119,7 +119,7 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) {
vshaderTxt.append(
"void main()\n"
"{\n"
- " gl_Position = highfloat4(a_position, 0.0, 1.0);\n"
+ " gl_Position = float4(a_position, 0.0, 1.0);\n"
" o_position = a_position;\n"
" o_color = a_color;\n"
"}\n");
@@ -129,8 +129,9 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) {
// coded center and compare that to some hard-coded circle radius to compute a coverage.
// Then, this coverage is mixed with the coverage from the previous stage and passed to the
// next stage.
- GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_TypeModifier);
SkString fshaderTxt(version);
+ GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, *shaderCaps, &fshaderTxt);
oPosition.setTypeModifier(GrShaderVar::kIn_TypeModifier);
oPosition.appendDecl(shaderCaps, &fshaderTxt);
fshaderTxt.append(";\n");
@@ -151,13 +152,13 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) {
fshaderTxt.appendf(
"void main()\n"
"{\n"
- " half4 outputColor;\n"
+ " float4 outputColor;\n"
" %s outputCoverage;\n"
- " outputColor = half4(%s, 1.0);\n"
+ " outputColor = float4(%s, 1.0);\n"
" outputCoverage = %s;\n",
- fCoverageSetup == kUseVec4_CoverageSetup ? "half4" : "half",
+ fCoverageSetup == kUseVec4_CoverageSetup ? "float4" : "float",
oColor.getName().c_str(),
- fCoverageSetup == kUseVec4_CoverageSetup ? "half4(1.0)" : "1.0"
+ fCoverageSetup == kUseVec4_CoverageSetup ? "float4(1.0)" : "1.0"
);
float radius = 1.0f;
@@ -166,13 +167,13 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) {
float centerY = 1.0f - radius;
fshaderTxt.appendf(
" {\n"
- " half d = length(%s - half2(%f, %f));\n"
- " half edgeAlpha = clamp(100.0 * (%f - d), 0.0, 1.0);\n"
+ " float d = length(%s - float2(%f, %f));\n"
+ " float edgeAlpha = clamp(100.0 * (%f - d), 0.0, 1.0);\n"
" outputCoverage = 0.5 * outputCoverage + 0.5 * %s;\n"
" }\n",
oPosition.getName().c_str(), centerX, centerY,
radius,
- fCoverageSetup == kUseVec4_CoverageSetup ? "half4(edgeAlpha)" : "edgeAlpha"
+ fCoverageSetup == kUseVec4_CoverageSetup ? "float4(edgeAlpha)" : "edgeAlpha"
);
radius *= 0.8f;
}
diff --git a/bench/GLVertexAttributesBench.cpp b/bench/GLVertexAttributesBench.cpp
index f10bd11392..3980a0be0c 100644
--- a/bench/GLVertexAttributesBench.cpp
+++ b/bench/GLVertexAttributesBench.cpp
@@ -69,7 +69,7 @@ GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t a
const char* version = shaderCaps->versionDeclString();
// setup vertex shader
- GrShaderVar aPosition("a_position", kHighFloat4_GrSLType, GrShaderVar::kIn_TypeModifier);
+ GrShaderVar aPosition("a_position", kVec4f_GrSLType, GrShaderVar::kIn_TypeModifier);
SkTArray<GrShaderVar> aVars;
SkTArray<GrShaderVar> oVars;
@@ -81,7 +81,7 @@ GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t a
SkString aname;
aname.appendf("a_color_%d", i);
aVars.push_back(GrShaderVar(aname.c_str(),
- kHalf4_GrSLType,
+ kVec4f_GrSLType,
GrShaderVar::kIn_TypeModifier));
aVars.back().appendDecl(shaderCaps, &vshaderTxt);
vshaderTxt.append(";\n");
@@ -92,7 +92,7 @@ GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t a
SkString oname;
oname.appendf("o_color_%d", i);
oVars.push_back(GrShaderVar(oname.c_str(),
- kHalf4_GrSLType,
+ kVec4f_GrSLType,
GrShaderVar::kOut_TypeModifier));
oVars.back().appendDecl(shaderCaps, &vshaderTxt);
vshaderTxt.append(";\n");
@@ -109,14 +109,15 @@ GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t a
// Passthrough position as a dummy
for (uint32_t i = attribs; i < maxAttribs; i++) {
- vshaderTxt.appendf("%s = highfloat4(0, 0, 0, 1);\n", oVars[i].c_str());
+ vshaderTxt.appendf("%s = float4(0, 0, 0, 1);\n", oVars[i].c_str());
}
vshaderTxt.append("}\n");
// setup fragment shader
- GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier);
+ GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_TypeModifier);
SkString fshaderTxt(version);
+ GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, *shaderCaps, &fshaderTxt);
const char* fsOutName;
if (shaderCaps->mustDeclareFragmentShaderOutput()) {