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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 this->addResource(srcBuffer->resource()); | 468 this->addResource(srcBuffer->resource()); |
469 this->addResource(dstImage->resource()); | 469 this->addResource(dstImage->resource()); |
470 GR_VK_CALL(gpu->vkInterface(), CmdCopyBufferToImage(fCmdBuffer, | 470 GR_VK_CALL(gpu->vkInterface(), CmdCopyBufferToImage(fCmdBuffer, |
471 srcBuffer->buffer(), | 471 srcBuffer->buffer(), |
472 dstImage->image(), | 472 dstImage->image(), |
473 dstLayout, | 473 dstLayout, |
474 copyRegionCount, | 474 copyRegionCount, |
475 copyRegions)); | 475 copyRegions)); |
476 } | 476 } |
477 | 477 |
| 478 void GrVkPrimaryCommandBuffer::updateBuffer(GrVkGpu* gpu, |
| 479 GrVkBuffer* dstBuffer, |
| 480 VkDeviceSize dstOffset, |
| 481 VkDeviceSize dataSize, |
| 482 const void* data) { |
| 483 SkASSERT(fIsActive); |
| 484 SkASSERT(!fActiveRenderPass); |
| 485 SkASSERT(0 == (dstOffset & 0x03)); // four byte aligned |
| 486 // TODO: handle larger transfer sizes |
| 487 SkASSERT(dataSize <= 65536); |
| 488 SkASSERT(0 == (dataSize & 0x03)); // four byte aligned |
| 489 this->addResource(dstBuffer->resource()); |
| 490 GR_VK_CALL(gpu->vkInterface(), CmdUpdateBuffer(fCmdBuffer, |
| 491 dstBuffer->buffer(), |
| 492 dstOffset, |
| 493 dataSize, |
| 494 (const uint32_t*) data)); |
| 495 } |
| 496 |
478 void GrVkPrimaryCommandBuffer::clearColorImage(const GrVkGpu* gpu, | 497 void GrVkPrimaryCommandBuffer::clearColorImage(const GrVkGpu* gpu, |
479 GrVkImage* image, | 498 GrVkImage* image, |
480 const VkClearColorValue* color, | 499 const VkClearColorValue* color, |
481 uint32_t subRangeCount, | 500 uint32_t subRangeCount, |
482 const VkImageSubresourceRange* su
bRanges) { | 501 const VkImageSubresourceRange* su
bRanges) { |
483 SkASSERT(fIsActive); | 502 SkASSERT(fIsActive); |
484 SkASSERT(!fActiveRenderPass); | 503 SkASSERT(!fActiveRenderPass); |
485 this->addResource(image->resource()); | 504 this->addResource(image->resource()); |
486 GR_VK_CALL(gpu->vkInterface(), CmdClearColorImage(fCmdBuffer, | 505 GR_VK_CALL(gpu->vkInterface(), CmdClearColorImage(fCmdBuffer, |
487 image->image(), | 506 image->image(), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 fIsActive = true; | 589 fIsActive = true; |
571 } | 590 } |
572 | 591 |
573 void GrVkSecondaryCommandBuffer::end(const GrVkGpu* gpu) { | 592 void GrVkSecondaryCommandBuffer::end(const GrVkGpu* gpu) { |
574 SkASSERT(fIsActive); | 593 SkASSERT(fIsActive); |
575 GR_VK_CALL_ERRCHECK(gpu->vkInterface(), EndCommandBuffer(fCmdBuffer)); | 594 GR_VK_CALL_ERRCHECK(gpu->vkInterface(), EndCommandBuffer(fCmdBuffer)); |
576 this->invalidateState(); | 595 this->invalidateState(); |
577 fIsActive = false; | 596 fIsActive = false; |
578 } | 597 } |
579 | 598 |
OLD | NEW |