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 "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
9 | 9 |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 height); | 418 height); |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 GR_VK_CALL(interface, UnmapMemory(fDevice, alloc.fMemory)); | 422 GR_VK_CALL(interface, UnmapMemory(fDevice, alloc.fMemory)); |
423 | 423 |
424 return true; | 424 return true; |
425 } | 425 } |
426 | 426 |
427 bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, | 427 bool GrVkGpu::uploadTexDataOptimal(GrVkTexture* tex, |
428 int left, int top, int width, int height, | 428 int left, int top, int width, int height, |
429 GrPixelConfig dataConfig, | 429 GrPixelConfig dataConfig, |
430 const SkTArray<GrMipLevel>& texels) { | 430 const SkTArray<GrMipLevel>& texels) { |
431 SkASSERT(!tex->isLinearTiled()); | 431 SkASSERT(!tex->isLinearTiled()); |
432 // The assumption is either that we have no mipmaps, or that our rect is the entire texture | 432 // The assumption is either that we have no mipmaps, or that our rect is the entire texture |
433 SkASSERT(1 == texels.count() || | 433 SkASSERT(1 == texels.count() || |
434 (0 == left && 0 == top && width == tex->width() && height == tex->h eight())); | 434 (0 == left && 0 == top && width == tex->width() && height == tex->h eight())); |
435 | 435 |
436 // If we're uploading compressed data then we should be using uploadCompress edTexData | 436 // If we're uploading compressed data then we should be using uploadCompress edTexData |
437 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); | 437 SkASSERT(!GrPixelConfigIsCompressed(dataConfig)); |
438 | 438 |
439 if (width == 0 || height == 0) { | 439 if (width == 0 || height == 0) { |
440 return false; | 440 return false; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 tex->unref(); | 654 tex->unref(); |
655 return nullptr; | 655 return nullptr; |
656 } | 656 } |
657 } | 657 } |
658 | 658 |
659 return tex; | 659 return tex; |
660 } | 660 } |
661 | 661 |
662 //////////////////////////////////////////////////////////////////////////////// | 662 //////////////////////////////////////////////////////////////////////////////// |
663 | 663 |
664 bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src, size_t srcSizeIn Bytes) { | |
665 | |
666 // Update the buffer | |
667 fCurrentCmdBuffer->updateBuffer(this, buffer, 0, srcSizeInBytes, src); | |
668 | |
669 // Submit the current command buffer to the Queue | |
670 // TODO: batch these? | |
671 this->submitCommandBuffer(kSkip_SyncQueue); | |
egdaniel
2016/06/30 13:51:19
why then need to submit the command buffer here?
jvanverth1
2016/06/30 14:56:38
Done.
| |
672 | |
673 return true; | |
674 } | |
675 | |
676 //////////////////////////////////////////////////////////////////////////////// | |
677 | |
664 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin) { | 678 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin) { |
665 // By default, all textures in Vk use TopLeft | 679 // By default, all textures in Vk use TopLeft |
666 if (kDefault_GrSurfaceOrigin == origin) { | 680 if (kDefault_GrSurfaceOrigin == origin) { |
667 return kTopLeft_GrSurfaceOrigin; | 681 return kTopLeft_GrSurfaceOrigin; |
668 } else { | 682 } else { |
669 return origin; | 683 return origin; |
670 } | 684 } |
671 } | 685 } |
672 | 686 |
673 GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, | 687 GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1482 GrVkRenderTarget* target, | 1496 GrVkRenderTarget* target, |
1483 const SkIRect& bounds) { | 1497 const SkIRect& bounds) { |
1484 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment | 1498 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment |
1485 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment | 1499 // uses it. In the current state, we also only use the LOAD_OP_CLEAR for the color attachment |
1486 // which is always at the first attachment. | 1500 // which is always at the first attachment. |
1487 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true); | 1501 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true); |
1488 fCurrentCmdBuffer->executeCommands(this, buffer); | 1502 fCurrentCmdBuffer->executeCommands(this, buffer); |
1489 fCurrentCmdBuffer->endRenderPass(this); | 1503 fCurrentCmdBuffer->endRenderPass(this); |
1490 } | 1504 } |
1491 | 1505 |
OLD | NEW |