diff options
author | 2016-10-26 12:02:18 -0400 | |
---|---|---|
committer | 2016-10-26 17:17:40 +0000 | |
commit | 62e7b5fd79d3d61e9821ecd6123a3588d94893cc (patch) | |
tree | 365f6bf23fa89d8f216fb9931962eb58a06431ec /src/gpu/GrTextureOpList.h | |
parent | c7d853343a42e28edd9c38a3308afaa846fce1bc (diff) |
Create GrTextureOpList to support deferred copy batches for textures
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3967
Change-Id: I63b926f63294795f999a130c0ceead87fbaf978d
Reviewed-on: https://skia-review.googlesource.com/3967
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrTextureOpList.h')
-rw-r--r-- | src/gpu/GrTextureOpList.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h new file mode 100644 index 0000000000..5b700dcaed --- /dev/null +++ b/src/gpu/GrTextureOpList.h @@ -0,0 +1,69 @@ +/* + * 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 GrTexureOpList_DEFINED +#define GrTexureOpList_DEFINED + +#include "GrOpList.h" + +#include "SkTArray.h" + +class GrAuditTrail; +class GrBatch; +class GrGpu; +class GrTexture; +struct SkIPoint; +struct SkIRect; + +class GrTextureOpList final : public GrOpList { +public: + GrTextureOpList(GrTexture*, GrGpu*, GrAuditTrail*); + + ~GrTextureOpList() override; + + /** + * Empties the draw buffer of any queued up draws. + */ + void reset() override; + + void abandonGpuResources() override {} + void freeGpuResources() override {} + + /** + * Together these two functions flush all queued up draws to GrCommandBuffer. The return value + * of drawBatches() indicates whether any commands were actually issued to the GPU. + */ + void prepareBatches(GrBatchFlushState* flushState) override; + bool drawBatches(GrBatchFlushState* flushState) override; + + /** + * Copies a pixel rectangle from one surface to another. This call may finalize + * reserved vertex/index data (as though a draw call was made). The src pixels + * copied are specified by srcRect. They are copied to a rect of the same + * size in dst with top left at dstPoint. If the src rect is clipped by the + * src bounds then pixel values in the dst rect corresponding to area clipped + * by the src rect are not overwritten. This method is not guaranteed to succeed + * depending on the type of surface, configs, etc, and the backend-specific + * limitations. + */ + bool copySurface(GrSurface* dst, + GrSurface* src, + const SkIRect& srcRect, + const SkIPoint& dstPoint); + + SkDEBUGCODE(void dump() const override;) + +private: + void recordBatch(GrBatch*); + + SkSTArray<2, sk_sp<GrBatch>, true> fRecordedBatches; + GrGpu* fGpu; + + typedef GrOpList INHERITED; +}; + +#endif |