skia2/dm
Brian Osman ed58e004e0 Add support for pre-compiling cached SkSL shaders
The client can do a test run of their application with
a persistent cache set to SkSL mode. They store the key
and data blobs that are produced.

Ship those blobs with the application. At startup, call
GrContext::precompileShader for each key/data pair. This
compiles the shaders, and stores the GL program ID, plus
a small amount of metadata in our runtime program cache.

Caveats:
* Currently only implemented for the GL backend. Other
  backends will require more metadata to do any useful
  amount of work. Metal may need a more drastic workflow
  change, involving offline compilation of the shaders.
* Currently only implemented for cached SkSL (not GLSL
  or program binaries). Supporting other formats again
  requires more metadata, and the cached shaders become
  increasingly specialized to GPU and driver versions.
* Reusing the cached SkSL on different hardware is not
  supported. Many driver workarounds are implemented in
  the SkSL -> GLSL transformation, but some are higher
  level. Limiting device variance by artificially hiding
  extensions may help, but there are no guarantees.

* The 'gltestprecompile' DM config exercises this code
  similarly to 'gltestpersistentcache', ensuring that
  results are visually identical when precompiling, and
  that no cache misses occur after precompiling.

Change-Id: Id314c5d5f5a58fe503a0505a613bd4a540cc3589
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239438
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-06 19:45:09 +00:00
..
DM.cpp Add support for pre-compiling cached SkSL shaders 2019-09-06 19:45:09 +00:00
DMGpuTestProcs.cpp Remove "nvpr" configs 2019-06-26 16:53:50 +00:00
DMJsonWriter.cpp Remove all global mutexes 2019-06-18 00:39:15 +00:00
DMJsonWriter.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
DMSrcSink.cpp Add support for pre-compiling cached SkSL shaders 2019-09-06 19:45:09 +00:00
DMSrcSink.h Add support for pre-compiling cached SkSL shaders 2019-09-06 19:45:09 +00:00