GLSL editing in Viewer
When in GL backend, adds a "Shaders" section to the debug menu.
"Load" scrapes all of the vertex and fragment shaders being used,
then displays them. They can be edited, and "Save" pushes the
results.
Note: It is trivial to trigger an assert by saving a shader that
doesn't compile. I'd like to make the program builder more robust
in a follow-up CL, to fall back to the "real" SkSL, not draw, or
something along those lines.
Change-Id: I841fe2ee76a3c2eae58b64ef587fcbe25b95cc7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206905
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 2cb5726..4a8f150 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -56,15 +56,20 @@
}
void GrGLGpu::ProgramCache::abandon() {
+ fMap.foreach([](std::unique_ptr<Entry>* e) {
+ (*e)->fProgram->abandon();
+ });
+
+ this->reset();
+}
+
+void GrGLGpu::ProgramCache::reset() {
#ifdef PROGRAM_CACHE_STATS
fTotalRequests = 0;
fCacheMisses = 0;
fHashMisses = 0;
#endif
- fMap.foreach([](std::unique_ptr<Entry>* e) {
- (*e)->fProgram->abandon();
- });
fMap.reset();
}