diff options
author | 2017-08-23 10:12:00 -0400 | |
---|---|---|
committer | 2017-08-23 14:33:25 +0000 | |
commit | 51279987957a64d0f1a9cf7d299a8689734a0e50 (patch) | |
tree | 83d4c96ff5de8598a1025c58ac513f21650a8b99 /include/gpu | |
parent | db816992bb979850853965e0f03565a535204e7d (diff) |
Add an (optional) SkTaskGroup to GrContext
GrContextOptions has an SkExecutor field, allowing clients to supply a
thread pool. If present, the GrContext will create an SkTaskGroup that
can be used for internal threading work.
Bug: skia:
Change-Id: I8b01245515a21a83f9fe838caf0a01c9a26c0003
Reviewed-on: https://skia-review.googlesource.com/37580
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrContext.h | 3 | ||||
-rw-r--r-- | include/gpu/GrContextOptions.h | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 61446875cc..7510a7312d 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -46,6 +46,7 @@ class SkTraceMemoryDump; class SkImage; class SkSurfaceProps; +class SkTaskGroup; class SK_API GrContext : public SkRefCnt { public: @@ -359,6 +360,8 @@ private: // GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice. mutable GrSingleOwner fSingleOwner; + std::unique_ptr<SkTaskGroup> fTaskGroup; + struct CleanUpData { PFCleanUpFunc fFunc; void* fInfo; diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index f560b31e7b..d01d0725a6 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -11,6 +11,8 @@ #include "SkTypes.h" #include "GrTypes.h" +class SkExecutor; + struct GrContextOptions { GrContextOptions() {} @@ -33,6 +35,14 @@ struct GrContextOptions { deduce the optimal value for this platform. */ int fBufferMapThreshold = -1; + /** + * Executor to handle threaded work within Ganesh. If this is nullptr, then all work will be + * done serially on the main thread. To have worker threads assist with various tasks, set this + * to a valid SkExecutor instance. Currently, used for software path rendering, but may be used + * for other tasks. + */ + SkExecutor* fExecutor = nullptr; + /** some gpus have problems with partial writes of the rendertarget */ bool fUseDrawInsteadOfPartialRenderTargetWrite = false; |