Normalize storage of shader strings in the cache

Adds a tag that can be used to verify the expected type
of shaders. My follow-up CL that adds SkSL editing to
Vulkan relies heavily on this.

Change-Id: Ifda420c2dcbaff07cdf1b8157d0ece02b1ab6c78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210262
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tools/gpu/MemoryCache.cpp b/tools/gpu/MemoryCache.cpp
index d7dae9d..c3bc633 100644
--- a/tools/gpu/MemoryCache.cpp
+++ b/tools/gpu/MemoryCache.cpp
@@ -93,16 +93,11 @@
         SkSL::Program::Inputs inputsIgnored[kGrShaderTypeCount];
         SkSL::String shaders[kGrShaderTypeCount];
         const SkData* data = it->second.fData.get();
-        const char* ext;
-        if (GrBackendApi::kOpenGL == api) {
-            ext = "frag";
-            GrPersistentCacheUtils::UnpackCachedGLSL(data, inputsIgnored, shaders);
-        } else if (GrBackendApi::kVulkan == api) {
-            // Even with the SPIR-V switches, it seems like we must use .spv, or malisc tries to
-            // run glslang on the input.
-            ext = "spv";
-            GrPersistentCacheUtils::UnpackCachedSPIRV(data, shaders, inputsIgnored);
-        }
+        // Even with the SPIR-V switches, it seems like we must use .spv, or malisc tries to
+        // run glslang on the input.
+        const char* ext = GrBackendApi::kOpenGL == api ? "frag" : "spv";
+        GrPersistentCacheUtils::UnpackCachedShaders(data, shaders,
+                                                    inputsIgnored, kGrShaderTypeCount);
 
         SkString filename = SkStringPrintf("%s/%s.%s", path, md5.c_str(), ext);
         SkFILEWStream file(filename.c_str());