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

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

Issue 1658823002: Remove deferred clear from SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ptr->bool warning on windows Created 4 years, 10 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/gl/GrGLGpu.h ('k') | tests/ClearTest.cpp » ('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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 tempDrawInfo->fReadConfig = readConfig; 2152 tempDrawInfo->fReadConfig = readConfig;
2153 return true; 2153 return true;
2154 } 2154 }
2155 2155
2156 GrRenderTarget* srcAsRT = srcSurface->asRenderTarget(); 2156 GrRenderTarget* srcAsRT = srcSurface->asRenderTarget();
2157 if (!srcAsRT) { 2157 if (!srcAsRT) {
2158 // For now keep assuming the draw is not a format transformation, just a draw to get to a 2158 // For now keep assuming the draw is not a format transformation, just a draw to get to a
2159 // RT. We may add additional transformations below. 2159 // RT. We may add additional transformations below.
2160 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); 2160 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference);
2161 } 2161 }
2162
2163 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig && 2162 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig &&
2164 this->readPixelsSupported(kBGRA_8888_GrPixelConfig, kBGRA_8888_GrPixelCo nfig)) { 2163 this->readPixelsSupported(kBGRA_8888_GrPixelConfig, kBGRA_8888_GrPixelCo nfig)) {
2165 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; 2164 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig;
2166 tempDrawInfo->fSwizzle = GrSwizzle::BGRA(); 2165 tempDrawInfo->fSwizzle = GrSwizzle::BGRA();
2167 tempDrawInfo->fReadConfig = kBGRA_8888_GrPixelConfig; 2166 tempDrawInfo->fReadConfig = kBGRA_8888_GrPixelConfig;
2168 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); 2167 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference);
2169 } else if (kMesa_GrGLDriver == this->glContext().driver() && 2168 } else if (kMesa_GrGLDriver == this->glContext().driver() &&
2170 GrBytesPerPixel(readConfig) == 4 && 2169 GrBytesPerPixel(readConfig) == 4 &&
2171 GrPixelConfigSwapRAndB(readConfig) == srcConfig && 2170 GrPixelConfigSwapRAndB(readConfig) == srcConfig &&
2172 this->readPixelsSupported(srcSurface, srcConfig)) { 2171 this->readPixelsSupported(srcSurface, srcConfig)) {
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 GL_CALL(BlendEquation(gXfermodeEquation2Blend[equation])); 2771 GL_CALL(BlendEquation(gXfermodeEquation2Blend[equation]));
2773 fHWBlendState.fEquation = equation; 2772 fHWBlendState.fEquation = equation;
2774 } 2773 }
2775 2774
2776 if (GrBlendEquationIsAdvanced(equation)) { 2775 if (GrBlendEquationIsAdvanced(equation)) {
2777 SkASSERT(this->caps()->advancedBlendEquationSupport()); 2776 SkASSERT(this->caps()->advancedBlendEquationSupport());
2778 // Advanced equations have no other blend state. 2777 // Advanced equations have no other blend state.
2779 return; 2778 return;
2780 } 2779 }
2781 2780
2782 if (fHWBlendState.fSrcCoeff != srcCoeff || 2781 if (fHWBlendState.fSrcCoeff != srcCoeff || fHWBlendState.fDstCoeff != dstCoe ff) {
2783 fHWBlendState.fDstCoeff != dstCoeff) {
2784 GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff], 2782 GL_CALL(BlendFunc(gXfermodeCoeff2Blend[srcCoeff],
2785 gXfermodeCoeff2Blend[dstCoeff])); 2783 gXfermodeCoeff2Blend[dstCoeff]));
2786 fHWBlendState.fSrcCoeff = srcCoeff; 2784 fHWBlendState.fSrcCoeff = srcCoeff;
2787 fHWBlendState.fDstCoeff = dstCoeff; 2785 fHWBlendState.fDstCoeff = dstCoeff;
2788 } 2786 }
2789 2787
2790 if ((BlendCoeffReferencesConstant(srcCoeff) || BlendCoeffReferencesConstant( dstCoeff))) { 2788 if ((BlendCoeffReferencesConstant(srcCoeff) || BlendCoeffReferencesConstant( dstCoeff))) {
2791 GrColor blendConst = blendInfo.fBlendConstant; 2789 GrColor blendConst = blendInfo.fBlendConstant;
2792 blendConst = swizzle.applyTo(blendConst); 2790 blendConst = swizzle.applyTo(blendConst);
2793 if (!fHWBlendState.fConstColorValid || fHWBlendState.fConstColor != blen dConst) { 2791 if (!fHWBlendState.fConstColorValid || fHWBlendState.fConstColor != blen dConst) {
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 case kBlend_GrXferBarrierType: 3672 case kBlend_GrXferBarrierType:
3675 SkASSERT(GrCaps::kAdvanced_BlendEquationSupport == 3673 SkASSERT(GrCaps::kAdvanced_BlendEquationSupport ==
3676 this->caps()->blendEquationSupport()); 3674 this->caps()->blendEquationSupport());
3677 GL_CALL(BlendBarrier()); 3675 GL_CALL(BlendBarrier());
3678 return; 3676 return;
3679 default: break; // placate compiler warnings that kNone not handled 3677 default: break; // placate compiler warnings that kNone not handled
3680 } 3678 }
3681 } 3679 }
3682 3680
3683 GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in t h, 3681 GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, in t h,
3684 GrPixelConfig config) c onst { 3682 GrPixelConfig config) {
3685 if (!this->caps()->isConfigTexturable(config)) { 3683 if (!this->caps()->isConfigTexturable(config)) {
3686 return false; 3684 return false;
3687 } 3685 }
3688 GrGLTextureInfo* info = new GrGLTextureInfo; 3686 GrGLTextureInfo* info = new GrGLTextureInfo;
3689 info->fTarget = GR_GL_TEXTURE_2D; 3687 info->fTarget = GR_GL_TEXTURE_2D;
3690 info->fID = 0; 3688 info->fID = 0;
3691 GL_CALL(GenTextures(1, &info->fID)); 3689 GL_CALL(GenTextures(1, &info->fID));
3692 GL_CALL(ActiveTexture(GR_GL_TEXTURE0)); 3690 GL_CALL(ActiveTexture(GR_GL_TEXTURE0));
3693 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); 3691 GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
3694 GL_CALL(BindTexture(info->fTarget, info->fID)); 3692 GL_CALL(BindTexture(info->fTarget, info->fID));
3693 fHWBoundTextureUniqueIDs[0] = 0;
3695 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST )); 3694 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MAG_FILTER, GR_GL_NEAREST ));
3696 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST )); 3695 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_MIN_FILTER, GR_GL_NEAREST ));
3697 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_ED GE)); 3696 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_S, GR_GL_CLAMP_TO_ED GE));
3698 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_ED GE)); 3697 GL_CALL(TexParameteri(info->fTarget, GR_GL_TEXTURE_WRAP_T, GR_GL_CLAMP_TO_ED GE));
3699 3698
3700 GrGLenum internalFormat; 3699 GrGLenum internalFormat;
3701 GrGLenum externalFormat; 3700 GrGLenum externalFormat;
3702 GrGLenum externalType; 3701 GrGLenum externalType;
3703 3702
3704 if (!this->glCaps().getTexImageFormats(config, config, &internalFormat, &ext ernalFormat, 3703 if (!this->glCaps().getTexImageFormats(config, config, &internalFormat, &ext ernalFormat,
(...skipping 24 matching lines...) Expand all
3729 #else 3728 #else
3730 GrGLuint texID = reinterpret_cast<const GrGLTextureInfo*>(id)->fID; 3729 GrGLuint texID = reinterpret_cast<const GrGLTextureInfo*>(id)->fID;
3731 #endif 3730 #endif
3732 3731
3733 GrGLboolean result; 3732 GrGLboolean result;
3734 GL_CALL_RET(result, IsTexture(texID)); 3733 GL_CALL_RET(result, IsTexture(texID));
3735 3734
3736 return (GR_GL_TRUE == result); 3735 return (GR_GL_TRUE == result);
3737 } 3736 }
3738 3737
3739 void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandonTe xture) const { 3738 void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id, bool abandonTe xture) {
3740 #ifdef SK_IGNORE_GL_TEXTURE_TARGET 3739 #ifdef SK_IGNORE_GL_TEXTURE_TARGET
3741 GrGLuint texID = (GrGLuint)id; 3740 GrGLuint texID = (GrGLuint)id;
3742 #else 3741 #else
3743 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(id); 3742 const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(id);
3744 GrGLuint texID = info->fID; 3743 GrGLuint texID = info->fID;
3745 #endif 3744 #endif
3746 3745
3747 if (!abandonTexture) { 3746 if (!abandonTexture) {
3748 GL_CALL(DeleteTextures(1, &texID)); 3747 GL_CALL(DeleteTextures(1, &texID));
3749 } 3748 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 3823 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
3825 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 3824 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
3826 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 3825 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
3827 copyParams->fWidth = texture->width(); 3826 copyParams->fWidth = texture->width();
3828 copyParams->fHeight = texture->height(); 3827 copyParams->fHeight = texture->height();
3829 return true; 3828 return true;
3830 } 3829 }
3831 } 3830 }
3832 return false; 3831 return false;
3833 } 3832 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | tests/ClearTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698