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

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

Issue 2225303002: Add flag for window rectangles to GrRenderTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add GrRenderTarget flag for window rectangles Created 4 years, 4 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/GrRenderTargetProxy.cpp ('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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 GrWrapOwnership ownership) { 715 GrWrapOwnership ownership) {
716 GrGLRenderTarget::IDDesc idDesc; 716 GrGLRenderTarget::IDDesc idDesc;
717 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); 717 idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
718 idDesc.fMSColorRenderbufferID = 0; 718 idDesc.fMSColorRenderbufferID = 0;
719 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; 719 idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
720 if (kAdopt_GrWrapOwnership == ownership) { 720 if (kAdopt_GrWrapOwnership == ownership) {
721 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kOwned; 721 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kOwned;
722 } else { 722 } else {
723 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed; 723 idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed;
724 } 724 }
725 idDesc.fSampleConfig = GrRenderTarget::kUnified_SampleConfig; 725 idDesc.fIsMixedSampled = false;
726 726
727 GrSurfaceDesc desc; 727 GrSurfaceDesc desc;
728 desc.fConfig = wrapDesc.fConfig; 728 desc.fConfig = wrapDesc.fConfig;
729 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; 729 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
730 desc.fWidth = wrapDesc.fWidth; 730 desc.fWidth = wrapDesc.fWidth;
731 desc.fHeight = wrapDesc.fHeight; 731 desc.fHeight = wrapDesc.fHeight;
732 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() ); 732 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() );
733 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); 733 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
734 734
735 return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencil Bits); 735 return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencil Bits);
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 1498
1499 bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc, 1499 bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
1500 const GrGLTextureInfo& texInfo, 1500 const GrGLTextureInfo& texInfo,
1501 GrGLRenderTarget::IDDesc* idDesc) { 1501 GrGLRenderTarget::IDDesc* idDesc) {
1502 idDesc->fMSColorRenderbufferID = 0; 1502 idDesc->fMSColorRenderbufferID = 0;
1503 idDesc->fRTFBOID = 0; 1503 idDesc->fRTFBOID = 0;
1504 idDesc->fRTFBOOwnership = GrBackendObjectOwnership::kOwned; 1504 idDesc->fRTFBOOwnership = GrBackendObjectOwnership::kOwned;
1505 idDesc->fTexFBOID = 0; 1505 idDesc->fTexFBOID = 0;
1506 SkASSERT((GrGLCaps::kMixedSamples_MSFBOType == this->glCaps().msFBOType()) = = 1506 SkASSERT((GrGLCaps::kMixedSamples_MSFBOType == this->glCaps().msFBOType()) = =
1507 this->caps()->usesMixedSamples()); 1507 this->caps()->usesMixedSamples());
1508 idDesc->fSampleConfig = GrRenderTarget::ComputeSampleConfig(*this->caps(), d esc.fSampleCnt); 1508 idDesc->fIsMixedSampled = desc.fSampleCnt > 0 && this->caps()->usesMixedSamp les();
1509 1509
1510 GrGLenum status; 1510 GrGLenum status;
1511 1511
1512 GrGLenum colorRenderbufferFormat = 0; // suppress warning 1512 GrGLenum colorRenderbufferFormat = 0; // suppress warning
1513 1513
1514 if (desc.fSampleCnt > 0 && GrGLCaps::kNone_MSFBOType == this->glCaps().msFBO Type()) { 1514 if (desc.fSampleCnt > 0 && GrGLCaps::kNone_MSFBOType == this->glCaps().msFBO Type()) {
1515 goto FAILED; 1515 goto FAILED;
1516 } 1516 }
1517 1517
1518 GL_CALL(GenFramebuffers(1, &idDesc->fTexFBOID)); 1518 GL_CALL(GenFramebuffers(1, &idDesc->fTexFBOID));
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2964 } 2964 }
2965 } else { 2965 } else {
2966 if (kNo_TriState != fMSAAEnabled) { 2966 if (kNo_TriState != fMSAAEnabled) {
2967 GL_CALL(Disable(GR_GL_MULTISAMPLE)); 2967 GL_CALL(Disable(GR_GL_MULTISAMPLE));
2968 fMSAAEnabled = kNo_TriState; 2968 fMSAAEnabled = kNo_TriState;
2969 } 2969 }
2970 } 2970 }
2971 } 2971 }
2972 2972
2973 if (0 != this->caps()->maxRasterSamples()) { 2973 if (0 != this->caps()->maxRasterSamples()) {
2974 if (useHWAA && rt->hasMixedSamples() && !stencilEnabled) { 2974 if (useHWAA && rt->isMixedSampled() && !stencilEnabled) {
2975 // Since stencil is disabled and we want more samples than are in th e color buffer, we 2975 // Since stencil is disabled and we want more samples than are in th e color buffer, we
2976 // need to tell the rasterizer explicitly how many to run. 2976 // need to tell the rasterizer explicitly how many to run.
2977 if (kYes_TriState != fHWRasterMultisampleEnabled) { 2977 if (kYes_TriState != fHWRasterMultisampleEnabled) {
2978 GL_CALL(Enable(GR_GL_RASTER_MULTISAMPLE)); 2978 GL_CALL(Enable(GR_GL_RASTER_MULTISAMPLE));
2979 fHWRasterMultisampleEnabled = kYes_TriState; 2979 fHWRasterMultisampleEnabled = kYes_TriState;
2980 } 2980 }
2981 if (rt->numStencilSamples() != fHWNumRasterSamples) { 2981 if (rt->numStencilSamples() != fHWNumRasterSamples) {
2982 SkASSERT(rt->numStencilSamples() <= this->caps()->maxRasterSampl es()); 2982 SkASSERT(rt->numStencilSamples() <= this->caps()->maxRasterSampl es());
2983 GL_CALL(RasterSamples(rt->numStencilSamples(), GR_GL_TRUE)); 2983 GL_CALL(RasterSamples(rt->numStencilSamples(), GR_GL_TRUE));
2984 fHWNumRasterSamples = rt->numStencilSamples(); 2984 fHWNumRasterSamples = rt->numStencilSamples();
2985 } 2985 }
2986 } else { 2986 } else {
2987 if (kNo_TriState != fHWRasterMultisampleEnabled) { 2987 if (kNo_TriState != fHWRasterMultisampleEnabled) {
2988 GL_CALL(Disable(GR_GL_RASTER_MULTISAMPLE)); 2988 GL_CALL(Disable(GR_GL_RASTER_MULTISAMPLE));
2989 fHWRasterMultisampleEnabled = kNo_TriState; 2989 fHWRasterMultisampleEnabled = kNo_TriState;
2990 } 2990 }
2991 } 2991 }
2992 } else { 2992 } else {
2993 SkASSERT(!useHWAA || !rt->hasMixedSamples() || stencilEnabled); 2993 SkASSERT(!useHWAA || !rt->isMixedSampled() || stencilEnabled);
2994 } 2994 }
2995 } 2995 }
2996 2996
2997 void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSw izzle& swizzle) { 2997 void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo, const GrSw izzle& swizzle) {
2998 // Any optimization to disable blending should have already been applied and 2998 // Any optimization to disable blending should have already been applied and
2999 // tweaked the equation to "add" or "subtract", and the coeffs to (1, 0). 2999 // tweaked the equation to "add" or "subtract", and the coeffs to (1, 0).
3000 3000
3001 GrBlendEquation equation = blendInfo.fEquation; 3001 GrBlendEquation equation = blendInfo.fEquation;
3002 GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; 3002 GrBlendCoeff srcCoeff = blendInfo.fSrcBlend;
3003 GrBlendCoeff dstCoeff = blendInfo.fDstBlend; 3003 GrBlendCoeff dstCoeff = blendInfo.fDstBlend;
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 4433
4434 // Unbind: 4434 // Unbind:
4435 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, 4435 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0,
4436 GR_GL_TEXTURE_2D, 0, 0)); 4436 GR_GL_TEXTURE_2D, 0, 0));
4437 4437
4438 return true; 4438 return true;
4439 } 4439 }
4440 4440
4441 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings& stencil, 4441 void GrGLGpu::onGetMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings& stencil,
4442 int* effectiveSampleCnt, SamplePattern* samp lePattern) { 4442 int* effectiveSampleCnt, SamplePattern* samp lePattern) {
4443 SkASSERT(!rt->hasMixedSamples() || rt->renderTargetPriv().getStencilAttachme nt() || 4443 SkASSERT(!rt->isMixedSampled() || rt->renderTargetPriv().getStencilAttachmen t() ||
4444 stencil.isDisabled()); 4444 stencil.isDisabled());
4445 4445
4446 this->flushStencil(stencil); 4446 this->flushStencil(stencil);
4447 this->flushHWAAState(rt, true, !stencil.isDisabled()); 4447 this->flushHWAAState(rt, true, !stencil.isDisabled());
4448 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI Rect()); 4448 this->flushRenderTarget(static_cast<GrGLRenderTarget*>(rt), &SkIRect::EmptyI Rect());
4449 4449
4450 if (0 != this->caps()->maxRasterSamples()) { 4450 if (0 != this->caps()->maxRasterSamples()) {
4451 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e ffectiveSampleCnt); 4451 GR_GL_GetIntegerv(this->glInterface(), GR_GL_EFFECTIVE_RASTER_SAMPLES, e ffectiveSampleCnt);
4452 } else { 4452 } else {
4453 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt ); 4453 GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt );
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4613 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4614 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4614 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4615 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4615 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4616 copyParams->fWidth = texture->width(); 4616 copyParams->fWidth = texture->width();
4617 copyParams->fHeight = texture->height(); 4617 copyParams->fHeight = texture->height();
4618 return true; 4618 return true;
4619 } 4619 }
4620 } 4620 }
4621 return false; 4621 return false;
4622 } 4622 }
OLDNEW
« no previous file with comments | « src/gpu/GrRenderTargetProxy.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698