1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrTexureOpList_DEFINED 9 #define GrTexureOpList_DEFINED 10 11 #include "include/gpu/GrGpuResource.h" 12 #include "src/gpu/GrOpList.h" 13 #include "src/gpu/GrSurfaceProxy.h" 14 15 #include "include/private/SkTArray.h" 16 17 class GrAuditTrail; 18 class GrGpu; 19 class GrOp; 20 class GrTextureProxy; 21 struct SkIPoint; 22 struct SkIRect; 23 24 class GrTextureOpList final : public GrOpList { 25 public: 26 GrTextureOpList(sk_sp<GrOpMemoryPool>, sk_sp<GrTextureProxy>, GrAuditTrail*); 27 ~GrTextureOpList() override; 28 29 /** 30 * Empties the draw buffer of any queued ops. 31 */ 32 void endFlush() override; 33 34 /** 35 * Together these two functions flush all queued ops to GrGpuCommandBuffer. The return value 36 * of executeOps() indicates whether any commands were actually issued to the GPU. 37 */ 38 void onPrepare(GrOpFlushState* flushState) override; 39 bool onExecute(GrOpFlushState* flushState) override; 40 41 bool copySurface(GrRecordingContext*, 42 GrSurfaceProxy* src, 43 const SkIRect& srcRect, 44 const SkIPoint& dstPoint) override; 45 46 void transferFrom(GrRecordingContext*, 47 const SkIRect& srcRect, 48 GrColorType surfaceColorType, 49 GrColorType dstColorType, 50 sk_sp<GrGpuBuffer> dst, 51 size_t dstOffset) override; 52 asTextureOpList()53 GrTextureOpList* asTextureOpList() override { return this; } 54 55 SkDEBUGCODE(void dump(bool printDependencies) const override;) 56 57 private: 58 bool onIsUsed(GrSurfaceProxy*) const override; 59 60 void deleteOp(int index); 61 void deleteOps(); 62 63 void handleInternalAllocationFailure() override; 64 65 void gatherProxyIntervals(GrResourceAllocator*) const override; 66 67 void recordOp(std::unique_ptr<GrOp>); 68 69 // The memory for the ops in 'fOpChains' is actually stored in 'fOpMemoryPool' 70 SkSTArray<2, std::unique_ptr<GrOp>, true> fRecordedOps; 71 72 typedef GrOpList INHERITED; 73 }; 74 75 #endif 76