| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGpuCommandBuffer_DEFINED | 8 #ifndef GrGpuCommandBuffer_DEFINED |
| 9 #define GrGpuCommandBuffer_DEFINED | 9 #define GrGpuCommandBuffer_DEFINED |
| 10 | 10 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 | 12 |
| 13 class GrFixedClip; |
| 13 class GrGpu; | 14 class GrGpu; |
| 14 class GrMesh; | 15 class GrMesh; |
| 15 class GrPipeline; | 16 class GrPipeline; |
| 16 class GrPrimitiveProcessor; | 17 class GrPrimitiveProcessor; |
| 17 class GrRenderTarget; | 18 class GrRenderTarget; |
| 18 struct SkIRect; | 19 struct SkIRect; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * The GrGpuCommandBuffer is a series of commands (draws, clears, and discards),
which all target | 22 * The GrGpuCommandBuffer is a series of commands (draws, clears, and discards),
which all target |
| 22 * the same render target. It is possible that these commands execute immediatel
y (GL), or get | 23 * the same render target. It is possible that these commands execute immediatel
y (GL), or get |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // GrPrimitiveProcessor. This may fail if the draw would exceed any resource
limits (e.g. | 59 // GrPrimitiveProcessor. This may fail if the draw would exceed any resource
limits (e.g. |
| 59 // number of vertex attributes is too large). | 60 // number of vertex attributes is too large). |
| 60 bool draw(const GrPipeline&, | 61 bool draw(const GrPipeline&, |
| 61 const GrPrimitiveProcessor&, | 62 const GrPrimitiveProcessor&, |
| 62 const GrMesh*, | 63 const GrMesh*, |
| 63 int meshCount); | 64 int meshCount); |
| 64 | 65 |
| 65 /** | 66 /** |
| 66 * Clear the passed in render target. Ignores the draw state and clip. | 67 * Clear the passed in render target. Ignores the draw state and clip. |
| 67 */ | 68 */ |
| 68 void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget)
; | 69 void clear(const GrFixedClip&, GrColor, GrRenderTarget*); |
| 69 | 70 |
| 70 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget*
renderTarget); | 71 void clearStencilClip(const GrFixedClip&, bool insideStencilMask, GrRenderTa
rget*); |
| 71 /** | 72 /** |
| 72 * Discards the contents render target. nullptr indicates that the current re
nder target should | 73 * Discards the contents render target. nullptr indicates that the current re
nder target should |
| 73 * be discarded. | 74 * be discarded. |
| 74 **/ | 75 **/ |
| 75 // TODO: This should be removed in the future to favor using the load and st
ore ops for discard | 76 // TODO: This should be removed in the future to favor using the load and st
ore ops for discard |
| 76 virtual void discard(GrRenderTarget* = nullptr) = 0; | 77 virtual void discard(GrRenderTarget* = nullptr) = 0; |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 virtual GrGpu* gpu() = 0; | 80 virtual GrGpu* gpu() = 0; |
| 80 virtual void onSubmit(const SkIRect& bounds) = 0; | 81 virtual void onSubmit(const SkIRect& bounds) = 0; |
| 81 | 82 |
| 82 // overridden by backend-specific derived class to perform the draw call. | 83 // overridden by backend-specific derived class to perform the draw call. |
| 83 virtual void onDraw(const GrPipeline&, | 84 virtual void onDraw(const GrPipeline&, |
| 84 const GrPrimitiveProcessor&, | 85 const GrPrimitiveProcessor&, |
| 85 const GrMesh*, | 86 const GrMesh*, |
| 86 int meshCount) = 0; | 87 int meshCount) = 0; |
| 87 | 88 |
| 88 // overridden by backend-specific derived class to perform the clear. | 89 // overridden by backend-specific derived class to perform the clear. |
| 89 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) =
0; | 90 virtual void onClear(GrRenderTarget*, const GrFixedClip&, GrColor) = 0; |
| 90 | 91 |
| 91 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i
nsideClip) = 0; | 92 virtual void onClearStencilClip(GrRenderTarget*, |
| 93 const GrFixedClip&, |
| 94 bool insideStencilMask) = 0; |
| 92 | 95 |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 #endif | 98 #endif |
| OLD | NEW |