Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: src/gpu/GrGpuCommandBuffer.h

Issue 2078483002: Start using GrGpuCommandBuffer in GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@memoryWAR
Patch Set: Support clears in CB Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 GrGpu;
14 class GrMesh;
15 class GrPipeline;
16 class GrPrimitiveProcessor;
13 class GrRenderTarget; 17 class GrRenderTarget;
18 struct SkIRect;
14 19
15 class GrGpuCommandBuffer { 20 class GrGpuCommandBuffer {
bsalomon 2016/06/22 15:41:15 I think we need a good description of exactly what
16 public: 21 public:
17 enum LoadAndStoreOp { 22 enum LoadAndStoreOp {
bsalomon 2016/06/22 15:41:15 Why make this enum a cross product rather than two
egdaniel 2016/06/22 21:13:35 Done.
18 kLoadAndStore_LoadAndStoreOp, 23 kLoadAndStore_LoadAndStoreOp,
19 kLoadAndDiscard_LoadAndStoreOp, 24 kLoadAndDiscard_LoadAndStoreOp,
20 kClearAndStore_LoadAndStoreOp, 25 kClearAndStore_LoadAndStoreOp,
21 kClearAndDiscard_LoadAndStoreOp, 26 kClearAndDiscard_LoadAndStoreOp,
22 kDiscardAndStore_LoadAndStoreOp, 27 kDiscardAndStore_LoadAndStoreOp,
23 kDiscardAndDiscard_LoadAndStoreOp, 28 kDiscardAndDiscard_LoadAndStoreOp,
24 }; 29 };
25 30
26 GrGpuCommandBuffer() {} 31 GrGpuCommandBuffer() {}
27 virtual ~GrGpuCommandBuffer() {} 32 virtual ~GrGpuCommandBuffer() {}
28 33
29 // Signals the end of recording to the command buffer and that it can now be submitted. 34 // Signals the end of recording to the command buffer and that it can now be submitted.
30 virtual void end() = 0; 35 virtual void end() = 0;
31 36
32 // Sends the command buffer off to the GPU object to execute the commands bu ilt up in the 37 // Sends the command buffer off to the GPU object to execute the commands bu ilt up in the
33 // buffer. The gpu object is allowed to defer execution of the commands unti l it is flushed. 38 // buffer. The gpu object is allowed to defer execution of the commands unti l it is flushed.
34 virtual void submit() = 0; 39 // The bounds should represent the bounds of all the draws put into the comm and buffer.
40 void submit(const SkIRect& bounds);
41
42 // We pass in an array of meshCount GrMesh to the draw. The backend should l oop over each
43 // GrMesh object and emit a draw for it. Each draw will use the same GrPipel ine and
44 // GrPrimitiveProcessor. This may fail if the draw would exceed any resource limits (e.g.
45 // number of vertex attributes is too large).
46 bool draw(const GrPipeline&,
47 const GrPrimitiveProcessor&,
48 const GrMesh*,
49 int meshCount);
50
51 /**
52 * Clear the passed in render target. Ignores the draw state and clip.
53 */
54 void clear(const SkIRect& rect, GrColor color, GrRenderTarget* renderTarget) ;
55
56 void clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* renderTarget);
57 /**
58 * Discards the contents render target. nullptr indicates that the current re nder target should
59 * be discarded.
60 **/
61 // TODO: This should be removed in the future to favor using the load and st ore ops for discard
62 virtual void discard(GrRenderTarget* = nullptr) = 0;
63
64 private:
65 virtual GrGpu* gpu() = 0;
66 virtual void onSubmit(const SkIRect& bounds) = 0;
67
68 // overridden by backend-specific derived class to perform the draw call.
69 virtual void onDraw(const GrPipeline&,
70 const GrPrimitiveProcessor&,
71 const GrMesh*,
72 int meshCount) = 0;
73
74 // overridden by backend-specific derived class to perform the clear.
75 virtual void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) = 0;
76
77 virtual void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool i nsideClip) = 0;
78
35 }; 79 };
36 80
37 #endif 81 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuCommandBuffer.cpp » ('j') | src/gpu/vk/GrVkGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698