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

Side by Side Diff: src/gpu/vk/GrVkGpu.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 2015 Google Inc. 2 * Copyright 2015 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 GrVkGpu_DEFINED 8 #ifndef GrVkGpu_DEFINED
9 #define GrVkGpu_DEFINED 9 #define GrVkGpu_DEFINED
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 }; 58 };
59 59
60 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes, 60 bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeigh t, size_t rowBytes,
61 GrPixelConfig readConfig, DrawPreference*, 61 GrPixelConfig readConfig, DrawPreference*,
62 ReadPixelTempDrawInfo*) override; 62 ReadPixelTempDrawInfo*) override;
63 63
64 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 64 bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
65 GrPixelConfig srcConfig, DrawPreference*, 65 GrPixelConfig srcConfig, DrawPreference*,
66 WritePixelTempDrawInfo*) override; 66 WritePixelTempDrawInfo*) override;
67 67
68 void discard(GrRenderTarget*) override {}
69
70 bool onCopySurface(GrSurface* dst, 68 bool onCopySurface(GrSurface* dst,
71 GrSurface* src, 69 GrSurface* src,
72 const SkIRect& srcRect, 70 const SkIRect& srcRect,
73 const SkIPoint& dstPoint) override; 71 const SkIPoint& dstPoint) override;
74 72
75 void onGetMultisampleSpecs(GrRenderTarget* rt, 73 void onGetMultisampleSpecs(GrRenderTarget* rt,
76 const GrStencilSettings&, 74 const GrStencilSettings&,
77 int* effectiveSampleCnt, 75 int* effectiveSampleCnt,
78 SkAutoTDeleteArray<SkPoint>*) override; 76 SkAutoTDeleteArray<SkPoint>*) override;
79 77
80 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override; 78 bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override;
81 79
82 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} 80 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
83 81
84 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, 82 GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
85 GrPixelConfig config) overri de; 83 GrPixelConfig config) overri de;
86 bool isTestingOnlyBackendTexture(GrBackendObject id) const override; 84 bool isTestingOnlyBackendTexture(GrBackendObject id) const override;
87 void deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandonTexture ) override; 85 void deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandonTexture ) override;
88 86
89 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*, 87 GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTa rget*,
90 int width, 88 int width,
91 int height) over ride; 89 int height) over ride;
92 90
93 void clearStencil(GrRenderTarget* target) override; 91 void clearStencil(GrRenderTarget* target) override;
94 92
95 GrGpuCommandBuffer* createCommandBuffer(const GrRenderTarget& target, 93 GrGpuCommandBuffer* createCommandBuffer(GrRenderTarget* target,
96 GrGpuCommandBuffer::LoadAndStoreOp c olorOp, 94 GrGpuCommandBuffer::LoadAndStoreOp c olorOp,
97 GrColor colorClear, 95 GrColor colorClear,
98 GrGpuCommandBuffer::LoadAndStoreOp s tencilOp, 96 GrGpuCommandBuffer::LoadAndStoreOp s tencilOp,
99 GrColor stencilClear) override; 97 GrColor stencilClear) override;
100 98
101 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {} 99 void drawDebugWireRect(GrRenderTarget*, const SkIRect&, GrColor) override {}
102 100
103 void addMemoryBarrier(VkPipelineStageFlags srcStageMask, 101 void addMemoryBarrier(VkPipelineStageFlags srcStageMask,
104 VkPipelineStageFlags dstStageMask, 102 VkPipelineStageFlags dstStageMask,
105 bool byRegion, 103 bool byRegion,
106 VkMemoryBarrier* barrier) const; 104 VkMemoryBarrier* barrier) const;
107 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask, 105 void addBufferMemoryBarrier(VkPipelineStageFlags srcStageMask,
108 VkPipelineStageFlags dstStageMask, 106 VkPipelineStageFlags dstStageMask,
109 bool byRegion, 107 bool byRegion,
110 VkBufferMemoryBarrier* barrier) const; 108 VkBufferMemoryBarrier* barrier) const;
111 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask, 109 void addImageMemoryBarrier(VkPipelineStageFlags srcStageMask,
112 VkPipelineStageFlags dstStageMask, 110 VkPipelineStageFlags dstStageMask,
113 bool byRegion, 111 bool byRegion,
114 VkImageMemoryBarrier* barrier) const; 112 VkImageMemoryBarrier* barrier) const;
115 113
116 shaderc_compiler_t shadercCompiler() const { 114 shaderc_compiler_t shadercCompiler() const {
117 return fCompiler; 115 return fCompiler;
118 } 116 }
119 117
120 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*); 118 void submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer*,
119 const GrVkRenderPass*,
120 const VkClearValue*,
121 GrVkRenderTarget*,
122 const SkIRect& bounds);
121 123
122 void finishDrawTarget() override; 124 void finishDrawTarget() override;
123 125
124 void generateMipmap(GrVkTexture* tex) const; 126 void generateMipmap(GrVkTexture* tex) const;
125 127
126 // Heaps 128 // Heaps
127 enum Heap { 129 enum Heap {
128 kLinearImage_Heap = 0, 130 kLinearImage_Heap = 0,
129 // We separate out small (i.e., <= 16K) images to reduce fragmentation 131 // We separate out small (i.e., <= 16K) images to reduce fragmentation
130 // in the main heap. 132 // in the main heap.
(...skipping 27 matching lines...) Expand all
158 160
159 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override; 161 GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership ) override;
160 162
161 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&, 163 GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
162 GrWrapOwnership) override; 164 GrWrapOwnership) override;
163 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes c&) override { return NULL; } 165 GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDes c&) override { return NULL; }
164 166
165 GrBuffer* onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern, 167 GrBuffer* onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern,
166 const void* data) override; 168 const void* data) override;
167 169
168 void onClear(GrRenderTarget*, const SkIRect& rect, GrColor color) override;
169
170 void onClearStencilClip(GrRenderTarget*, const SkIRect& rect, bool insideCli p) override;
171
172 void onDraw(const GrPipeline&,
173 const GrPrimitiveProcessor&,
174 const GrMesh*,
175 int meshCount) override;
176
177 bool onReadPixels(GrSurface* surface, 170 bool onReadPixels(GrSurface* surface,
178 int left, int top, int width, int height, 171 int left, int top, int width, int height,
179 GrPixelConfig, 172 GrPixelConfig,
180 void* buffer, 173 void* buffer,
181 size_t rowBytes) override; 174 size_t rowBytes) override;
182 175
183 bool onWritePixels(GrSurface* surface, 176 bool onWritePixels(GrSurface* surface,
184 int left, int top, int width, int height, 177 int left, int top, int width, int height,
185 GrPixelConfig config, const SkTArray<GrMipLevel>&) overri de; 178 GrPixelConfig config, const SkTArray<GrMipLevel>&) overri de;
186 179
187 bool onTransferPixels(GrSurface*, 180 bool onTransferPixels(GrSurface*,
188 int left, int top, int width, int height, 181 int left, int top, int width, int height,
189 GrPixelConfig config, GrBuffer* transferBuffer, 182 GrPixelConfig config, GrBuffer* transferBuffer,
190 size_t offset, size_t rowBytes) override { return fals e; } 183 size_t offset, size_t rowBytes) override { return fals e; }
191 184
192 void onResolveRenderTarget(GrRenderTarget* target) override {} 185 void onResolveRenderTarget(GrRenderTarget* target) override {}
193 186
194 sk_sp<GrVkPipelineState> prepareDrawState(const GrPipeline&,
195 const GrPrimitiveProcessor&,
196 GrPrimitiveType,
197 const GrVkRenderPass&);
198
199 // Bind vertex and index buffers
200 void bindGeometry(const GrPrimitiveProcessor&, const GrNonInstancedMesh&);
201
202 // Ends and submits the current command buffer to the queue and then creates a new command 187 // Ends and submits the current command buffer to the queue and then creates a new command
203 // buffer and begins it. If sync is set to kForce_SyncQueue, the function wi ll wait for all 188 // buffer and begins it. If sync is set to kForce_SyncQueue, the function wi ll wait for all
204 // work in the queue to finish before returning. 189 // work in the queue to finish before returning.
205 void submitCommandBuffer(SyncQueue sync); 190 void submitCommandBuffer(SyncQueue sync);
206 191
207 void copySurfaceAsCopyImage(GrSurface* dst, 192 void copySurfaceAsCopyImage(GrSurface* dst,
208 GrSurface* src, 193 GrSurface* src,
209 GrVkImage* dstImage, 194 GrVkImage* dstImage,
210 GrVkImage* srcImage, 195 GrVkImage* srcImage,
211 const SkIRect& srcRect, 196 const SkIRect& srcRect,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 242
258 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once 243 // Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once
259 // since there is significant overhead to the first compile of any compiler. 244 // since there is significant overhead to the first compile of any compiler.
260 shaderc_compiler_t fCompiler; 245 shaderc_compiler_t fCompiler;
261 246
262 247
263 typedef GrGpu INHERITED; 248 typedef GrGpu INHERITED;
264 }; 249 };
265 250
266 #endif 251 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698