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

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 2448593002: Remove SkAutoTUnref and SkAutoTDelete from public includes. (Closed)
Patch Set: And Vulcan. Created 4 years, 1 month 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/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLRenderTarget.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 2011 Google Inc. 2 * Copyright 2011 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 "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // By default, GrRenderTargets are GL's normal orientation so that they 617 // By default, GrRenderTargets are GL's normal orientation so that they
618 // can be drawn to by the outside world without the client having 618 // can be drawn to by the outside world without the client having
619 // to render upside down. 619 // to render upside down.
620 if (kDefault_GrSurfaceOrigin == origin) { 620 if (kDefault_GrSurfaceOrigin == origin) {
621 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin; 621 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin;
622 } else { 622 } else {
623 return origin; 623 return origin;
624 } 624 }
625 } 625 }
626 626
627 GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc, 627 sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
628 GrWrapOwnership ownership) { 628 GrWrapOwnership ownership) {
629 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc. fTextureHandle); 629 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc. fTextureHandle);
630 if (!info || !info->fID) { 630 if (!info || !info->fID) {
631 return nullptr; 631 return nullptr;
632 } 632 }
633 633
634 // next line relies on GrBackendTextureDesc's flags matching GrTexture's 634 // next line relies on GrBackendTextureDesc's flags matching GrTexture's
635 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla g); 635 bool renderTarget = SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFla g);
636 636
637 GrGLTexture::IDDesc idDesc; 637 GrGLTexture::IDDesc idDesc;
638 idDesc.fInfo = *info; 638 idDesc.fInfo = *info;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // FIXME: this should be calling resolve_origin(), but Chrome code is curre ntly 674 // FIXME: this should be calling resolve_origin(), but Chrome code is curre ntly
675 // assuming the old behaviour, which is that backend textures are always 675 // assuming the old behaviour, which is that backend textures are always
676 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to: 676 // BottomLeft, even for non-RT's. Once Chrome is fixed, change this to:
677 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget); 677 // glTexDesc.fOrigin = resolve_origin(desc.fOrigin, renderTarget);
678 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { 678 if (kDefault_GrSurfaceOrigin == desc.fOrigin) {
679 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; 679 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
680 } else { 680 } else {
681 surfDesc.fOrigin = desc.fOrigin; 681 surfDesc.fOrigin = desc.fOrigin;
682 } 682 }
683 683
684 GrGLTexture* texture = nullptr;
685 if (renderTarget) { 684 if (renderTarget) {
686 GrGLRenderTarget::IDDesc rtIDDesc; 685 GrGLRenderTarget::IDDesc rtIDDesc;
687 if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) { 686 if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) {
688 return nullptr; 687 return nullptr;
689 } 688 }
690 texture = GrGLTextureRenderTarget::CreateWrapped(this, surfDesc, idDesc, rtIDDesc); 689 return GrGLTextureRenderTarget::MakeWrapped(this, surfDesc, idDesc, rtID Desc);
691 } else {
692 texture = GrGLTexture::CreateWrapped(this, surfDesc, idDesc);
693 } 690 }
694 if (nullptr == texture) { 691 return GrGLTexture::MakeWrapped(this, surfDesc, idDesc);
695 return nullptr;
696 }
697
698 return texture;
699 } 692 }
700 693
701 GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe sc& wrapDesc, 694 sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTa rgetDesc& wrapDesc,
702 GrWrapOwnership ownership) { 695 GrWrapOwnership ownersh ip) {
703 GrGLRenderTarget::IDDesc idDesc; 696 GrGLRenderTarget::IDDesc idDesc;
704 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); 697 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
705 idDesc.fMSColorRenderbufferID = 0; 698 idDesc.fMSColorRenderbufferID = 0;
706 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; 699 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
707 if (kAdopt_GrWrapOwnership == ownership) { 700 if (kAdopt_GrWrapOwnership == ownership) {
708 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kOwned; 701 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kOwned;
709 } else { 702 } else {
710 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed; 703 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
711 } 704 }
712 idDesc.fIsMixedSampled = false; 705 idDesc.fIsMixedSampled = false;
713 706
714 GrSurfaceDesc desc; 707 GrSurfaceDesc desc;
715 desc.fConfig = wrapDesc.fConfig; 708 desc.fConfig = wrapDesc.fConfig;
716 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; 709 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
717 desc.fWidth = wrapDesc.fWidth; 710 desc.fWidth = wrapDesc.fWidth;
718 desc.fHeight = wrapDesc.fHeight; 711 desc.fHeight = wrapDesc.fHeight;
719 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() ); 712 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() );
720 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); 713 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
721 714
722 return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencil Bits); 715 return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, wrapDesc.fStencilBi ts);
723 } 716 }
724 717
725 GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextu reDesc& desc) { 718 sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBacken dTextureDesc& desc){
726 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc. fTextureHandle); 719 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc. fTextureHandle);
727 if (!info || !info->fID) { 720 if (!info || !info->fID) {
728 return nullptr; 721 return nullptr;
729 } 722 }
730 723
731 GrGLTextureInfo texInfo; 724 GrGLTextureInfo texInfo;
732 texInfo = *info; 725 texInfo = *info;
733 726
734 if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget && 727 if (GR_GL_TEXTURE_RECTANGLE != texInfo.fTarget &&
735 GR_GL_TEXTURE_2D != texInfo.fTarget) { 728 GR_GL_TEXTURE_2D != texInfo.fTarget) {
(...skipping 16 matching lines...) Expand all
752 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { 745 if (kDefault_GrSurfaceOrigin == desc.fOrigin) {
753 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin; 746 surfDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
754 } else { 747 } else {
755 surfDesc.fOrigin = desc.fOrigin; 748 surfDesc.fOrigin = desc.fOrigin;
756 } 749 }
757 750
758 GrGLRenderTarget::IDDesc rtIDDesc; 751 GrGLRenderTarget::IDDesc rtIDDesc;
759 if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) { 752 if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) {
760 return nullptr; 753 return nullptr;
761 } 754 }
762 return GrGLRenderTarget::CreateWrapped(this, surfDesc, rtIDDesc, 0); 755 return GrGLRenderTarget::MakeWrapped(this, surfDesc, rtIDDesc, 0);
763 } 756 }
764 757
765 //////////////////////////////////////////////////////////////////////////////// 758 ////////////////////////////////////////////////////////////////////////////////
766 759
767 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 760 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
768 GrPixelConfig srcConfig, 761 GrPixelConfig srcConfig,
769 DrawPreference* drawPreference, 762 DrawPreference* drawPreference,
770 WritePixelTempDrawInfo* tempDrawInfo) { 763 WritePixelTempDrawInfo* tempDrawInfo) {
771 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) { 764 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) {
772 return false; 765 return false;
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after
4649 4642
4650 bool GrGLGpu::waitFence(GrFence fence, uint64_t timeout) const { 4643 bool GrGLGpu::waitFence(GrFence fence, uint64_t timeout) const {
4651 GrGLenum result; 4644 GrGLenum result;
4652 GL_CALL_RET(result, ClientWaitSync((GrGLsync)fence, GR_GL_SYNC_FLUSH_COMMAND S_BIT, timeout)); 4645 GL_CALL_RET(result, ClientWaitSync((GrGLsync)fence, GR_GL_SYNC_FLUSH_COMMAND S_BIT, timeout));
4653 return (GR_GL_CONDITION_SATISFIED == result); 4646 return (GR_GL_CONDITION_SATISFIED == result);
4654 } 4647 }
4655 4648
4656 void GrGLGpu::deleteFence(GrFence fence) const { 4649 void GrGLGpu::deleteFence(GrFence fence) const {
4657 GL_CALL(DeleteSync((GrGLsync)fence)); 4650 GL_CALL(DeleteSync((GrGLsync)fence));
4658 } 4651 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698