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

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

Issue 2112653002: Add static buffer support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments 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/GrVkGpu.h ('k') | src/gpu/vk/GrVkMemory.h » ('j') | 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 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
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 VK_PIPELINE_STAGE_TRANSFER_BIT, 548 VK_PIPELINE_STAGE_TRANSFER_BIT,
549 false); 549 false);
550 550
551 // Copy the buffer to the image 551 // Copy the buffer to the image
552 fCurrentCmdBuffer->copyBufferToImage(this, 552 fCurrentCmdBuffer->copyBufferToImage(this,
553 transferBuffer, 553 transferBuffer,
554 tex, 554 tex,
555 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 555 VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
556 regions.count(), 556 regions.count(),
557 regions.begin()); 557 regions.begin());
558
559 // Submit the current command buffer to the Queue
560 this->submitCommandBuffer(kSkip_SyncQueue);
561
562 transferBuffer->unref(); 558 transferBuffer->unref();
563 559
564 return true; 560 return true;
565 } 561 }
566 562
567 //////////////////////////////////////////////////////////////////////////////// 563 ////////////////////////////////////////////////////////////////////////////////
568 GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budget ed, 564 GrTexture* GrVkGpu::onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budget ed,
569 const SkTArray<GrMipLevel>& texels) { 565 const SkTArray<GrMipLevel>& texels) {
570 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); 566 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
571 567
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 tex->unref(); 650 tex->unref();
655 return nullptr; 651 return nullptr;
656 } 652 }
657 } 653 }
658 654
659 return tex; 655 return tex;
660 } 656 }
661 657
662 //////////////////////////////////////////////////////////////////////////////// 658 ////////////////////////////////////////////////////////////////////////////////
663 659
660 bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src, size_t srcSizeIn Bytes) {
661
662 // Update the buffer
663 fCurrentCmdBuffer->updateBuffer(this, buffer, 0, srcSizeInBytes, src);
664
665 return true;
666 }
667
668 ////////////////////////////////////////////////////////////////////////////////
669
664 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin) { 670 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin) {
665 // By default, all textures in Vk use TopLeft 671 // By default, all textures in Vk use TopLeft
666 if (kDefault_GrSurfaceOrigin == origin) { 672 if (kDefault_GrSurfaceOrigin == origin) {
667 return kTopLeft_GrSurfaceOrigin; 673 return kTopLeft_GrSurfaceOrigin;
668 } else { 674 } else {
669 return origin; 675 return origin;
670 } 676 }
671 } 677 }
672 678
673 GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, 679 GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 GrVkRenderTarget* target, 1488 GrVkRenderTarget* target,
1483 const SkIRect& bounds) { 1489 const SkIRect& bounds) {
1484 // Currently it is fine for us to always pass in 1 for the clear count even if no attachment 1490 // 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 1491 // 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. 1492 // which is always at the first attachment.
1487 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true); 1493 fCurrentCmdBuffer->beginRenderPass(this, renderPass, 1, colorClear, *target, bounds, true);
1488 fCurrentCmdBuffer->executeCommands(this, buffer); 1494 fCurrentCmdBuffer->executeCommands(this, buffer);
1489 fCurrentCmdBuffer->endRenderPass(this); 1495 fCurrentCmdBuffer->endRenderPass(this);
1490 } 1496 }
1491 1497
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkMemory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698