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

Side by Side Diff: src/gpu/vk/GrVkGpuCommandBuffer.cpp

Issue 2104353002: Add discard support to Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « src/gpu/vk/GrVkGpuCommandBuffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "GrVkGpuCommandBuffer.h" 8 #include "GrVkGpuCommandBuffer.h"
9 9
10 #include "GrMesh.h" 10 #include "GrMesh.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIM AL, 123 VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIM AL,
124 VK_ACCESS_SHADER_READ_BIT, 124 VK_ACCESS_SHADER_READ_BIT,
125 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, 125 VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT,
126 false); 126 false);
127 } 127 }
128 128
129 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear Value, 129 fGpu->submitSecondaryCommandBuffer(fCommandBuffer, fRenderPass, &fColorClear Value,
130 fRenderTarget, bounds); 130 fRenderTarget, bounds);
131 } 131 }
132 132
133 void GrVkGpuCommandBuffer::discard(GrRenderTarget* target) {
134 if (fIsEmpty) {
135 // We will change the render pass to do a clear load instead
136 GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_DONT_CARE,
137 VK_ATTACHMENT_STORE_OP_STORE);
138 GrVkRenderPass::LoadStoreOps vkStencilOps(VK_ATTACHMENT_LOAD_OP_LOAD,
jvanverth1 2016/06/29 16:00:30 Shouldn't this and the resolve be LOAD_OP_DONT_CAR
egdaniel 2016/06/29 16:11:30 In general, when we call discard on a RT do we mea
bsalomon 2016/06/29 17:45:24 both, I guess? The current discard stuff is not us
139 VK_ATTACHMENT_STORE_OP_STORE);
140 GrVkRenderPass::LoadStoreOps vkResolveOps(VK_ATTACHMENT_LOAD_OP_LOAD,
141 VK_ATTACHMENT_STORE_OP_STORE);
142
143 const GrVkRenderPass* oldRP = fRenderPass;
144
145 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target);
146 const GrVkResourceProvider::CompatibleRPHandle& rpHandle =
147 vkRT->compatibleRenderPassHandle();
148 if (rpHandle.isValid()) {
149 fRenderPass = fGpu->resourceProvider().findRenderPass(rpHandle,
150 vkColorOps,
151 vkResolveOps,
152 vkStencilOps);
153 } else {
154 fRenderPass = fGpu->resourceProvider().findRenderPass(*vkRT,
155 vkColorOps,
156 vkResolveOps,
157 vkStencilOps);
158 }
159
160 SkASSERT(fRenderPass->isCompatible(*oldRP));
161 oldRP->unref(fGpu);
162 }
163 }
164
133 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, 165 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target,
134 const SkIRect& rect, 166 const SkIRect& rect,
135 bool insideClip) { 167 bool insideClip) {
136 SkASSERT(target); 168 SkASSERT(target);
137 169
138 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); 170 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target);
139 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); 171 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment();
140 // this should only be called internally when we know we have a 172 // this should only be called internally when we know we have a
141 // stencil buffer. 173 // stencil buffer.
142 SkASSERT(sb); 174 SkASSERT(sb);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 fGpu->stats()->incNumDraws(); 420 fGpu->stats()->incNumDraws();
389 } while ((nonIdxMesh = iter.next())); 421 } while ((nonIdxMesh = iter.next()));
390 } 422 }
391 423
392 // Technically we don't have to call this here (since there is a safety chec k in 424 // Technically we don't have to call this here (since there is a safety chec k in
393 // pipelineState:setData but this will allow for quicker freeing of resource s if the 425 // pipelineState:setData but this will allow for quicker freeing of resource s if the
394 // pipelineState sits in a cache for a while. 426 // pipelineState sits in a cache for a while.
395 pipelineState->freeTempResources(fGpu); 427 pipelineState->freeTempResources(fGpu);
396 } 428 }
397 429
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpuCommandBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698