diff options
author | 2016-11-23 09:37:01 -0500 | |
---|---|---|
committer | 2016-11-23 15:52:27 +0000 | |
commit | 45580d3e3024c1536e8e1b2017b704805442b634 (patch) | |
tree | 9ed9fe3bdc0d949ec8e83b06691b37b6ffdcc54a /include/gpu/GrTextureContext.h | |
parent | 07764cefbb18041a77897df3453903b0a2016583 (diff) |
Added GrSurfaceContext and GrTextureContext
This lets copy-to-texture to be treated like copy-to-rt.
To match current behavior, though, copies to texture are
still executed immediately (forcing a flush).
Once MDB is enabled, copies to texture will be deferred.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5093
Change-Id: Icc0ce5435507a5f0a237c22eedef879824952367
Reviewed-on: https://skia-review.googlesource.com/5093
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include/gpu/GrTextureContext.h')
-rw-r--r-- | include/gpu/GrTextureContext.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/gpu/GrTextureContext.h b/include/gpu/GrTextureContext.h new file mode 100644 index 0000000000..da71c07c72 --- /dev/null +++ b/include/gpu/GrTextureContext.h @@ -0,0 +1,53 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrTextureContext_DEFINED +#define GrTextureContext_DEFINED + +#include "GrSurfaceContext.h" +#include "../private/GrTextureProxy.h" + +class GrContext; +class GrDrawingManager; +class GrSurface; +class GrTextureOpList; +class GrTextureProxy; +struct SkIPoint; +struct SkIRect; + +/** + * A helper object to orchestrate commands (currently just copies) for GrSurfaces that are + * GrTextures and not GrRenderTargets. + */ +class SK_API GrTextureContext : public GrSurfaceContext { +public: + ~GrTextureContext() override; + + bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) override; + +protected: + GrTextureContext(GrContext*, GrDrawingManager*, sk_sp<GrTextureProxy>, GrAuditTrail*, + GrSingleOwner*); + + GrDrawingManager* drawingManager() { return fDrawingManager; } + + SkDEBUGCODE(void validate() const;) + +private: + friend class GrDrawingManager; // for ctor + + GrTextureOpList* getOpList(); + + GrDrawingManager* fDrawingManager; + sk_sp<GrTextureProxy> fTextureProxy; + + // In MDB-mode the GrOpList can be closed by some other renderTargetContext that has picked + // it up. For this reason, the GrOpList should only ever be accessed via 'getOpList'. + GrTextureOpList* fOpList; +}; + +#endif |