Chromium Code Reviews| Index: src/gpu/GrGpuCommandBuffer.h |
| diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h |
| index 3c6e6116fb6a17f61bd0fb23ac0b270de0baa0c9..aa051dae61b8b71301b3cc555a16b94ae1b7001a 100644 |
| --- a/src/gpu/GrGpuCommandBuffer.h |
| +++ b/src/gpu/GrGpuCommandBuffer.h |
| @@ -10,7 +10,12 @@ |
| #include "GrColor.h" |
| +class GrGpu; |
| +class GrMesh; |
| +class GrPipeline; |
| +class GrPrimitiveProcessor; |
| class GrRenderTarget; |
| +struct SkIRect; |
| class GrGpuCommandBuffer { |
| public: |
| @@ -31,7 +36,46 @@ public: |
| // 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; |
| + // The bounds should represent the bounds of all the draws put into the command buffer. |
| + void submit(const SkIRect& bounds); |
| + |
| + // 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. |
| + // number of vertex attributes is too large). |
| + bool draw(const GrPipeline&, |
| + const GrPrimitiveProcessor&, |
| + const GrMesh*, |
| + int meshCount); |
| + |
| + /** |
| + * Clear the passed in render target. Ignores the draw state and clip. |
| + */ |
| + void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget); |
| + |
| + void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget); |
| + /** |
| + * Discards the contents render target. nullptr indicates that the current render target should |
| + * be discarded. |
| + **/ |
| + // TODO: This should be removed in the future to favor using the load and store ops for discard |
|
bsalomon
2016/06/20 16:51:14
Go ahead and remove this whenever you feel like it
egdaniel
2016/06/22 15:26:57
Ill do this in a follow up.
|
| + virtual void discard(GrRenderTarget* = nullptr) = 0; |
| + |
| +private: |
| + virtual GrGpu* gpu() = 0; |
| + virtual void onSubmit(const SkIRect& bounds) = 0; |
| + |
| + // overridden by backend-specific derived class to perform the draw call. |
| + virtual void onDraw(const GrPipeline&, |
| + const GrPrimitiveProcessor&, |
| + const GrMesh*, |
| + int meshCount) = 0; |
| + |
| + // overridden by backend-specific derived class to perform the clear. |
| + virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0; |
| + |
| + virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideClip) = 0; |
| + |
| }; |
| #endif |