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 #include "GrVkGpuCommandBuffer.h" | 8 #include "GrVkGpuCommandBuffer.h" |
9 | 9 |
10 #include "GrFixedClip.h" | 10 #include "GrFixedClip.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 SkASSERT(fRenderPass->isCompatible(*oldRP)); | 164 SkASSERT(fRenderPass->isCompatible(*oldRP)); |
165 oldRP->unref(fGpu); | 165 oldRP->unref(fGpu); |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, | 169 void GrVkGpuCommandBuffer::onClearStencilClip(GrRenderTarget* target, |
170 const GrFixedClip& clip, | 170 const GrFixedClip& clip, |
171 bool insideStencilMask) { | 171 bool insideStencilMask) { |
172 SkASSERT(target); | 172 SkASSERT(target); |
173 SkASSERT(!clip.hasWindowRectangles()); | |
174 | 173 |
175 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | 174 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
176 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); | 175 GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); |
177 // this should only be called internally when we know we have a | 176 // this should only be called internally when we know we have a |
178 // stencil buffer. | 177 // stencil buffer. |
179 SkASSERT(sb); | 178 SkASSERT(sb); |
180 int stencilBitCount = sb->bits(); | 179 int stencilBitCount = sb->bits(); |
181 | 180 |
182 // The contract with the callers does not guarantee that we preserve all bit
s in the stencil | 181 // The contract with the callers does not guarantee that we preserve all bit
s in the stencil |
183 // during this clear. Thus we will clear the entire stencil to the desired v
alue. | 182 // during this clear. Thus we will clear the entire stencil to the desired v
alue. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 attachment.colorAttachment = 0; // this value shouldn't matter | 216 attachment.colorAttachment = 0; // this value shouldn't matter |
218 attachment.clearValue.depthStencil = vkStencilColor; | 217 attachment.clearValue.depthStencil = vkStencilColor; |
219 | 218 |
220 fCommandBuffer->clearAttachments(fGpu, 1, &attachment, 1, &clearRect); | 219 fCommandBuffer->clearAttachments(fGpu, 1, &attachment, 1, &clearRect); |
221 fIsEmpty = false; | 220 fIsEmpty = false; |
222 } | 221 } |
223 | 222 |
224 void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const GrFixedClip& cl
ip, GrColor color) { | 223 void GrVkGpuCommandBuffer::onClear(GrRenderTarget* target, const GrFixedClip& cl
ip, GrColor color) { |
225 // parent class should never let us get here with no RT | 224 // parent class should never let us get here with no RT |
226 SkASSERT(target); | 225 SkASSERT(target); |
227 SkASSERT(!clip.hasWindowRectangles()); | |
228 | 226 |
229 VkClearColorValue vkColor; | 227 VkClearColorValue vkColor; |
230 GrColorToRGBAFloat(color, vkColor.float32); | 228 GrColorToRGBAFloat(color, vkColor.float32); |
231 | 229 |
232 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); | 230 GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(target); |
233 | 231 |
234 if (fIsEmpty && !clip.scissorEnabled()) { | 232 if (fIsEmpty && !clip.scissorEnabled()) { |
235 // We will change the render pass to do a clear load instead | 233 // We will change the render pass to do a clear load instead |
236 GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_CLEAR, | 234 GrVkRenderPass::LoadStoreOps vkColorOps(VK_ATTACHMENT_LOAD_OP_CLEAR, |
237 VK_ATTACHMENT_STORE_OP_STORE); | 235 VK_ATTACHMENT_STORE_OP_STORE); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 fGpu->stats()->incNumDraws(); | 442 fGpu->stats()->incNumDraws(); |
445 } while ((nonIdxMesh = iter.next())); | 443 } while ((nonIdxMesh = iter.next())); |
446 } | 444 } |
447 | 445 |
448 // Technically we don't have to call this here (since there is a safety chec
k in | 446 // Technically we don't have to call this here (since there is a safety chec
k in |
449 // pipelineState:setData but this will allow for quicker freeing of resource
s if the | 447 // pipelineState:setData but this will allow for quicker freeing of resource
s if the |
450 // pipelineState sits in a cache for a while. | 448 // pipelineState sits in a cache for a while. |
451 pipelineState->freeTempResources(fGpu); | 449 pipelineState->freeTempResources(fGpu); |
452 } | 450 } |
453 | 451 |
OLD | NEW |