add --dylib to viewer
This JIT mode helps debugging and profiling by shelling out to an
external assembler then loading its results back in via dlopen(),
so you can see coherent function profiles and not just every
instruction as its own line in the profile.
It's very slow, so viewer will stutter for a second or two before
drawing goes smooth again. We can paper over this by using the
interpreter while these compiles are in progress, but I haven't hooked
that up yet.
Change-Id: I23e74d65a1a3a6d89649733296db8217be306438
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285864
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 07b3cae..8e20bb5 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -132,6 +132,7 @@
static DEFINE_bool(offscreen, false, "Force rendering to an offscreen surface.");
static DEFINE_bool(skvm, false, "Try to use skvm blitters for raster.");
+static DEFINE_bool(dylib, false, "JIT via dylib (much slower compile but easier to debug/profile)");
#ifndef SK_GL
static_assert(false, "viewer requires GL backend for raster.")
@@ -254,6 +255,7 @@
const char* kRefreshStateName = "Refresh";
extern bool gUseSkVMBlitter;
+extern bool gSkVMJITViaDylib;
Viewer::Viewer(int argc, char** argv, void* platformData)
: fCurrentSlide(-1)
@@ -304,6 +306,7 @@
#endif
gUseSkVMBlitter = FLAGS_skvm;
+ gSkVMJITViaDylib = FLAGS_dylib;
ToolUtils::SetDefaultFontMgr();