diff options
author | Brian Osman <brianosman@google.com> | 2017-11-17 15:29:47 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-17 20:52:26 +0000 |
commit | f5beefd34df7360f7ffa219434d11d481bd72efc (patch) | |
tree | 7e4c6b8df51ef699a4bb0ed2cad5836e8f1f28e2 /bench | |
parent | eb549c8c0e99b2860e0bb7b610cf54689d1567ec (diff) |
Fix shader linker errors on several GL benchmarks
These were using an obsolete shader caps bit to manaully declare their
own FP output variable. That led to two outputs (after SkSL added
sk_FragColor), which led to errors about multiple outputs being declared
(without specifying location). SkSL handles all of this, so just use
sk_FragColor directly.
Bug: skia:
Change-Id: Id38657b6bf8c63c8f80d6ae3354a1507734a209f
Reviewed-on: https://skia-review.googlesource.com/73344
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'bench')
-rw-r--r-- | bench/GLInstancedArraysBench.cpp | 16 | ||||
-rw-r--r-- | bench/GLVec4ScalarBench.cpp | 18 | ||||
-rw-r--r-- | bench/GLVertexAttributesBench.cpp | 14 |
3 files changed, 8 insertions, 40 deletions
diff --git a/bench/GLInstancedArraysBench.cpp b/bench/GLInstancedArraysBench.cpp index 8c0060728c..42cb02a015 100644 --- a/bench/GLInstancedArraysBench.cpp +++ b/bench/GLInstancedArraysBench.cpp @@ -131,26 +131,16 @@ GrGLuint GLCpuPosInstancedArraysBench::setupShader(const GrGLContext* ctx) { "}\n"); // setup fragment shader - GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier); SkString fshaderTxt(version); oColor.setTypeModifier(GrShaderVar::kIn_TypeModifier); oColor.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";\n"); - const char* fsOutName; - if (shaderCaps->mustDeclareFragmentShaderOutput()) { - oFragColor.appendDecl(shaderCaps, &fshaderTxt); - fshaderTxt.append(";\n"); - fsOutName = oFragColor.c_str(); - } else { - fsOutName = "sk_FragColor"; - } - - fshaderTxt.appendf( + fshaderTxt.append( "void main()\n" "{\n" - "%s = float4(o_color, 1.0);\n" - "}\n", fsOutName); + "sk_FragColor = float4(o_color, 1.0);\n" + "}\n"); return CreateProgram(ctx, vshaderTxt.c_str(), fshaderTxt.c_str()); } diff --git a/bench/GLVec4ScalarBench.cpp b/bench/GLVec4ScalarBench.cpp index 2a68381438..b007a7a8ba 100644 --- a/bench/GLVec4ScalarBench.cpp +++ b/bench/GLVec4ScalarBench.cpp @@ -129,7 +129,6 @@ 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); SkString fshaderTxt(version); oPosition.setTypeModifier(GrShaderVar::kIn_TypeModifier); oPosition.appendDecl(shaderCaps, &fshaderTxt); @@ -138,16 +137,6 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) { oColor.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";\n"); - const char* fsOutName; - if (shaderCaps->mustDeclareFragmentShaderOutput()) { - oFragColor.appendDecl(shaderCaps, &fshaderTxt); - fshaderTxt.append(";\n"); - fsOutName = oFragColor.c_str(); - } else { - fsOutName = "sk_FragColor"; - } - - fshaderTxt.appendf( "void main()\n" "{\n" @@ -176,12 +165,11 @@ GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) { ); radius *= 0.8f; } - fshaderTxt.appendf( + fshaderTxt.append( " {\n" - " %s = outputColor * outputCoverage;\n" + " sk_FragColor = outputColor * outputCoverage;\n" " }\n" - "}\n", - fsOutName); + "}\n"); return CreateProgram(ctx, vshaderTxt.c_str(), fshaderTxt.c_str()); } diff --git a/bench/GLVertexAttributesBench.cpp b/bench/GLVertexAttributesBench.cpp index ea0bbcb535..2c073b4721 100644 --- a/bench/GLVertexAttributesBench.cpp +++ b/bench/GLVertexAttributesBench.cpp @@ -115,28 +115,18 @@ GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t a vshaderTxt.append("}\n"); // setup fragment shader - GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier); SkString fshaderTxt(version); - const char* fsOutName; - if (shaderCaps->mustDeclareFragmentShaderOutput()) { - oFragColor.appendDecl(shaderCaps, &fshaderTxt); - fshaderTxt.append(";\n"); - fsOutName = oFragColor.c_str(); - } else { - fsOutName = "sk_FragColor"; - } - for (uint32_t i = 0; i < maxAttribs; i++) { oVars[i].setTypeModifier(GrShaderVar::kIn_TypeModifier); oVars[i].appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";\n"); } - fshaderTxt.appendf( + fshaderTxt.append( "void main()\n" "{\n" - "%s = ", fsOutName); + "sk_FragColor = "); fshaderTxt.appendf("%s", oVars[0].c_str()); for (uint32_t i = 1; i < maxAttribs; i++) { |