Remove version string from Viewer's "highlight" SkSL shader
Change-Id: Id61b7b9d9bc7611727a27be0172fcabc2ef4345a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220522
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index cbc5350..eb78473 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -2040,9 +2040,12 @@
auto shaderCaps = ctx->priv().caps()->shaderCaps();
bool sksl = params.fGrContextOptions.fCacheSKSL;
- SkSL::String highlight = shaderCaps->versionDeclString();
- if (shaderCaps->usesPrecisionModifiers() && !sksl) {
- highlight.append("precision mediump float;\n");
+ SkSL::String highlight;
+ if (!sksl) {
+ highlight = shaderCaps->versionDeclString();
+ if (shaderCaps->usesPrecisionModifiers()) {
+ highlight.append("precision mediump float;\n");
+ }
}
const char* f4Type = sksl ? "half4" : "vec4";
highlight.appendf("out %s sk_FragColor;\n"