aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuCommandBuffer.h
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-08-24 15:59:33 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-24 20:18:27 +0000
commit500d58b2a6e6fd03239622da42b67b2c9843b7be (patch)
treedc77637f3bbcc07773c3bdbd292870c59f28e333 /src/gpu/GrGpuCommandBuffer.h
parentfb126fa96e0f49f5dc17a9a043acced68be99e93 (diff)
Make Copy Ops to go through GpuCommandBuffer instead of straigt to GPU.
Bug: skia: Change-Id: I4eae4507e07278997e26419e94586eef0780c423 Reviewed-on: https://skia-review.googlesource.com/38361 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrGpuCommandBuffer.h')
-rw-r--r--src/gpu/GrGpuCommandBuffer.h73
1 files changed, 55 insertions, 18 deletions
diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h
index 31e9a546d5..07e823fd11 100644
--- a/src/gpu/GrGpuCommandBuffer.h
+++ b/src/gpu/GrGpuCommandBuffer.h
@@ -22,13 +22,54 @@ class GrRenderTarget;
struct SkIRect;
struct SkRect;
+class GrGpuRTCommandBuffer;
+
+class GrGpuCommandBuffer {
+public:
+ virtual ~GrGpuCommandBuffer() {}
+
+ // Copy src into current surface owned by either a GrGpuTextureCommandBuffer or
+ // GrGpuRenderTargetCommandBuffer.
+ virtual void copy(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) = 0;
+
+ virtual void insertEventMarker(const char*) = 0;
+
+ virtual GrGpuRTCommandBuffer* asRTCommandBuffer() { return nullptr; }
+
+ // Sends the command buffer off to the GPU object to execute the commands built up in the
+ // buffer. The gpu object is allowed to defer execution of the commands until it is flushed.
+ virtual void submit() = 0;
+
+protected:
+ GrGpuCommandBuffer(GrSurfaceOrigin origin) : fOrigin(origin) {}
+
+ GrSurfaceOrigin fOrigin;
+};
+
+class GrGpuTextureCommandBuffer : public GrGpuCommandBuffer{
+public:
+ virtual ~GrGpuTextureCommandBuffer() {}
+
+ virtual void submit() = 0;
+
+protected:
+ GrGpuTextureCommandBuffer(GrTexture* texture, GrSurfaceOrigin origin)
+ : INHERITED(origin)
+ , fTexture(texture) {}
+
+ GrTexture* fTexture;
+
+private:
+ typedef GrGpuCommandBuffer INHERITED;
+};
+
/**
- * The GrGpuCommandBuffer is a series of commands (draws, clears, and discards), which all target
- * the same render target. It is possible that these commands execute immediately (GL), or get
- * buffered up for later execution (Vulkan). GrOps will execute their draw commands into a
+ * The GrGpuRenderTargetCommandBuffer is a series of commands (draws, clears, and discards), which
+ * all target the same render target. It is possible that these commands execute immediately (GL),
+ * or get buffered up for later execution (Vulkan). GrOps will execute their draw commands into a
* GrGpuCommandBuffer.
*/
-class GrGpuCommandBuffer {
+class GrGpuRTCommandBuffer : public GrGpuCommandBuffer {
public:
enum class LoadOp {
kLoad,
@@ -54,20 +95,14 @@ public:
StoreOp fStoreOp;
};
- GrGpuCommandBuffer(GrRenderTarget* rt, GrSurfaceOrigin origin)
- : fRenderTarget(rt)
- , fOrigin(origin) {
- }
- virtual ~GrGpuCommandBuffer() {}
+ virtual ~GrGpuRTCommandBuffer() {}
+
+ GrGpuRTCommandBuffer* asRTCommandBuffer() { return this; }
virtual void begin() = 0;
// Signals the end of recording to the command buffer and that it can now be submitted.
virtual void end() = 0;
- // Sends the command buffer off to the GPU object to execute the commands built up in the
- // buffer. The gpu object is allowed to defer execution of the commands until it is flushed.
- void submit();
-
// We pass in an array of meshCount GrMesh to the draw. The backend should loop over each
// GrMesh object and emit a draw for it. Each draw will use the same GrPipeline and
// GrPrimitiveProcessor. This may fail if the draw would exceed any resource limits (e.g.
@@ -95,17 +130,17 @@ public:
// TODO: This should be removed in the future to favor using the load and store ops for discard
virtual void discard() = 0;
- virtual void insertEventMarker(const char*) = 0;
-
protected:
+ GrGpuRTCommandBuffer(GrRenderTarget* rt, GrSurfaceOrigin origin)
+ : INHERITED(origin)
+ , fRenderTarget(rt) {
+ }
+
GrRenderTarget* fRenderTarget;
- GrSurfaceOrigin fOrigin;
private:
virtual GrGpu* gpu() = 0;
- virtual void onSubmit() = 0;
-
// overridden by backend-specific derived class to perform the draw call.
virtual void onDraw(const GrPipeline&,
const GrPrimitiveProcessor&,
@@ -118,6 +153,8 @@ private:
virtual void onClear(const GrFixedClip&, GrColor) = 0;
virtual void onClearStencilClip(const GrFixedClip&, bool insideStencilMask) = 0;
+
+ typedef GrGpuCommandBuffer INHERITED;
};
#endif