Clean up for DDL program pre-compilation
This CL:
1) Fixes a GrTexture access in GrTextureEffect that was blocking pre-compilation
2) Adds program pre-compilation to the DDL Via - which would've caught the GrTextureEffect problem on the bots
3) Adds some #if'ed out code for collecting program pre-compilation stats
Bug: skia:9455
Change-Id: Ibcb07ae855b7a644e1f22c3427a928f116ab300d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275336
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tools/DDLTileHelper.cpp b/tools/DDLTileHelper.cpp
index 45ca86d..7063bc7 100644
--- a/tools/DDLTileHelper.cpp
+++ b/tools/DDLTileHelper.cpp
@@ -84,6 +84,15 @@
fDisplayList = recorder.detach();
}
+void DDLTileHelper::TileData::precompile(GrContext* context) {
+ SkASSERT(fDisplayList);
+
+ SkDeferredDisplayList::ProgramIterator iter(context, fDisplayList.get());
+ for (; !iter.done(); iter.next()) {
+ iter.compile();
+ }
+}
+
void DDLTileHelper::TileData::draw(GrContext* context) {
SkASSERT(fDisplayList && !fImage);
@@ -168,10 +177,7 @@
static void do_gpu_stuff(GrContext* context, DDLTileHelper::TileData* tile) {
// TODO: schedule program compilation as their own tasks
- SkDeferredDisplayList::ProgramIterator iter(context, tile->ddl());
- for (; !iter.done(); iter.next()) {
- iter.compile();
- }
+ tile->precompile(context);
tile->draw(context);
@@ -204,8 +210,9 @@
}
}
-void DDLTileHelper::drawAllTiles(GrContext* context) {
+void DDLTileHelper::precompileAndDrawAllTiles(GrContext* context) {
for (int i = 0; i < this->numTiles(); ++i) {
+ fTiles[i].precompile(context);
fTiles[i].draw(context);
}
}