This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +58
-3
lines changed Expand file tree Collapse file tree 4 files changed +58
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ This file includes a list of high level updates for each milestone release.
77Milestone 82
88
99<Insert new notes here- top is most recent.>
10+ * Made SkDeferredDisplayList.h officially part of the public API (i.e., moved it to
11+ include/core). Also added a ProgramIterator to SkDeferredDisplayList which allows
12+ clients to pre-compile some of the shaders the DDL requires.
13+
1014 * Added two new helper methods to SkSurfaceCharacterization: createBackendFormat and
1115 createFBO0. These make it easier for clients to create new surface characterizations that
1216 differ only a little from an existing surface characterization.
Original file line number Diff line number Diff line change @@ -35,6 +35,26 @@ class SkDeferredDisplayList {
3535 return fCharacterization ;
3636 }
3737
38+ #if SK_SUPPORT_GPU
39+ /* *
40+ * Iterate through the programs required by the DDL.
41+ */
42+ class SK_API ProgramIterator {
43+ public:
44+ ProgramIterator (GrContext*, SkDeferredDisplayList*);
45+ ~ProgramIterator ();
46+
47+ void compile ();
48+ bool done () const ;
49+ void next ();
50+
51+ private:
52+ GrContext* fContext ;
53+ const SkTArray<GrRecordingContext::ProgramData>& fProgramData ;
54+ int fIndex ;
55+ };
56+ #endif
57+
3858 // Provides access to functions that aren't part of the public API.
3959 SkDeferredDisplayListPriv priv ();
4060 const SkDeferredDisplayListPriv priv () const ;
Original file line number Diff line number Diff line change 1414class SkSurfaceCharacterization ;
1515
1616#if SK_SUPPORT_GPU
17+ #include " src/gpu/GrContextPriv.h"
1718#include " src/gpu/GrRenderTask.h"
1819#include " src/gpu/ccpr/GrCCPerOpsTaskPaths.h"
1920#endif
@@ -28,3 +29,33 @@ SkDeferredDisplayList::SkDeferredDisplayList(const SkSurfaceCharacterization& ch
2829}
2930
3031SkDeferredDisplayList::~SkDeferredDisplayList () {}
32+
33+ // -------------------------------------------------------------------------------------------------
34+ #if SK_SUPPORT_GPU
35+
36+ SkDeferredDisplayList::ProgramIterator::ProgramIterator (GrContext* context,
37+ SkDeferredDisplayList* ddl)
38+ : fContext(context)
39+ , fProgramData(ddl->programData ())
40+ , fIndex(0 ) {
41+ }
42+
43+ SkDeferredDisplayList::ProgramIterator::~ProgramIterator () {}
44+
45+ void SkDeferredDisplayList::ProgramIterator::compile () {
46+ if (!fContext || fIndex < 0 || fIndex >= (int ) fProgramData .size ()) {
47+ return ;
48+ }
49+
50+ fContext ->priv ().compile (fProgramData [fIndex ].desc (), fProgramData [fIndex ].info ());
51+ }
52+
53+ bool SkDeferredDisplayList::ProgramIterator::done () const {
54+ return fIndex >= (int ) fProgramData .size ();
55+ }
56+
57+ void SkDeferredDisplayList::ProgramIterator::next () {
58+ ++fIndex ;
59+ }
60+
61+ #endif
Original file line number Diff line number Diff line change @@ -164,11 +164,11 @@ void DDLTileHelper::createDDLsInParallel() {
164164// replay the DDL into a surface to make the tile image
165165// compose the tile image into the main canvas
166166static void do_gpu_stuff (GrContext* context, DDLTileHelper::TileData* tile) {
167- auto & programData = tile->ddl ()->priv ().programData ();
168167
169168 // TODO: schedule program compilation as their own tasks
170- for (auto & programDatum : programData) {
171- context->priv ().compile (programDatum.desc (), programDatum.info ());
169+ SkDeferredDisplayList::ProgramIterator iter (context, tile->ddl ());
170+ for (; !iter.done (); iter.next ()) {
171+ iter.compile ();
172172 }
173173
174174 tile->draw (context);
You can’t perform that action at this time.
0 commit comments