OLD | NEW |
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 #include "GrVkCommandBuffer.h" | 8 #include "GrVkCommandBuffer.h" |
9 | 9 |
10 #include "GrVkFramebuffer.h" | 10 #include "GrVkFramebuffer.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // CommandBuffer commands | 188 // CommandBuffer commands |
189 //////////////////////////////////////////////////////////////////////////////// | 189 //////////////////////////////////////////////////////////////////////////////// |
190 | 190 |
191 void GrVkCommandBuffer::pipelineBarrier(const GrVkGpu* gpu, | 191 void GrVkCommandBuffer::pipelineBarrier(const GrVkGpu* gpu, |
192 VkPipelineStageFlags srcStageMask, | 192 VkPipelineStageFlags srcStageMask, |
193 VkPipelineStageFlags dstStageMask, | 193 VkPipelineStageFlags dstStageMask, |
194 bool byRegion, | 194 bool byRegion, |
195 BarrierType barrierType, | 195 BarrierType barrierType, |
196 void* barrier) const { | 196 void* barrier) const { |
197 SkASSERT(fIsActive); | 197 SkASSERT(fIsActive); |
| 198 // For images we can have barriers inside of render passes but they require
us to add more |
| 199 // support in subpasses which need self dependencies to have barriers inside
them. Also, we can |
| 200 // never have buffer barriers inside of a render pass. For now we will just
assert that we are |
| 201 // not in a render pass. |
| 202 SkASSERT(!fActiveRenderPass); |
198 VkDependencyFlags dependencyFlags = byRegion ? VK_DEPENDENCY_BY_REGION_BIT :
0; | 203 VkDependencyFlags dependencyFlags = byRegion ? VK_DEPENDENCY_BY_REGION_BIT :
0; |
199 | 204 |
200 switch (barrierType) { | 205 switch (barrierType) { |
201 case kMemory_BarrierType: { | 206 case kMemory_BarrierType: { |
202 const VkMemoryBarrier* barrierPtr = reinterpret_cast<VkMemoryBarrier
*>(barrier); | 207 const VkMemoryBarrier* barrierPtr = reinterpret_cast<VkMemoryBarrier
*>(barrier); |
203 GR_VK_CALL(gpu->vkInterface(), CmdPipelineBarrier(fCmdBuffer, srcSta
geMask, | 208 GR_VK_CALL(gpu->vkInterface(), CmdPipelineBarrier(fCmdBuffer, srcSta
geMask, |
204 dstStageMask, depe
ndencyFlags, | 209 dstStageMask, depe
ndencyFlags, |
205 1, barrierPtr, | 210 1, barrierPtr, |
206 0, nullptr, | 211 0, nullptr, |
207 0, nullptr)); | 212 0, nullptr)); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 firstSet, | 388 firstSet, |
384 setCount, | 389 setCount, |
385 descriptorSets, | 390 descriptorSets, |
386 dynamicOffsetCount, | 391 dynamicOffsetCount, |
387 dynamicOffsets)); | 392 dynamicOffsets)); |
388 pipelineState->addUniformResources(*this); | 393 pipelineState->addUniformResources(*this); |
389 } | 394 } |
390 | 395 |
391 void GrVkCommandBuffer::bindPipeline(const GrVkGpu* gpu, const GrVkPipeline* pip
eline) { | 396 void GrVkCommandBuffer::bindPipeline(const GrVkGpu* gpu, const GrVkPipeline* pip
eline) { |
392 SkASSERT(fIsActive); | 397 SkASSERT(fIsActive); |
393 SkASSERT(fActiveRenderPass); | |
394 GR_VK_CALL(gpu->vkInterface(), CmdBindPipeline(fCmdBuffer, | 398 GR_VK_CALL(gpu->vkInterface(), CmdBindPipeline(fCmdBuffer, |
395 VK_PIPELINE_BIND_POINT_GRAPHI
CS, | 399 VK_PIPELINE_BIND_POINT_GRAPHI
CS, |
396 pipeline->pipeline())); | 400 pipeline->pipeline())); |
397 addResource(pipeline); | 401 addResource(pipeline); |
398 } | 402 } |
399 | 403 |
400 void GrVkCommandBuffer::drawIndexed(const GrVkGpu* gpu, | 404 void GrVkCommandBuffer::drawIndexed(const GrVkGpu* gpu, |
401 uint32_t indexCount, | 405 uint32_t indexCount, |
402 uint32_t instanceCount, | 406 uint32_t instanceCount, |
403 uint32_t firstIndex, | 407 uint32_t firstIndex, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 462 } |
459 | 463 |
460 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu, | 464 void GrVkCommandBuffer::setBlendConstants(const GrVkGpu* gpu, |
461 const float blendConstants[4]) { | 465 const float blendConstants[4]) { |
462 SkASSERT(fIsActive); | 466 SkASSERT(fIsActive); |
463 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) { | 467 if (memcmp(blendConstants, fCachedBlendConstant, 4 * sizeof(float))) { |
464 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon
stants)); | 468 GR_VK_CALL(gpu->vkInterface(), CmdSetBlendConstants(fCmdBuffer, blendCon
stants)); |
465 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float)); | 469 memcpy(fCachedBlendConstant, blendConstants, 4 * sizeof(float)); |
466 } | 470 } |
467 } | 471 } |
OLD | NEW |