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

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

Issue 1933293002: Don't mark mipmaps dirty if uploading > 1 levels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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') | no next file » | 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 SkASSERT(config == glTex->desc().fConfig); 875 SkASSERT(config == glTex->desc().fConfig);
876 success = this->uploadCompressedTexData(glTex->desc(), glTex->target(), texels, 876 success = this->uploadCompressedTexData(glTex->desc(), glTex->target(), texels,
877 kWrite_UploadType, left, top, wi dth, height); 877 kWrite_UploadType, left, top, wi dth, height);
878 } else { 878 } else {
879 success = this->uploadTexData(glTex->desc(), glTex->target(), kWrite_Upl oadType, 879 success = this->uploadTexData(glTex->desc(), glTex->target(), kWrite_Upl oadType,
880 left, top, width, height, config, texels); 880 left, top, width, height, config, texels);
881 } 881 }
882 882
883 if (success) { 883 if (success) {
884 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); 884 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
885 this->didWriteToSurface(surface, &rect); 885 this->didWriteToSurface(surface, &rect, texels.count());
886 } 886 }
887 887
888 return success; 888 return success;
889 } 889 }
890 890
891 bool GrGLGpu::onTransferPixels(GrSurface* surface, 891 bool GrGLGpu::onTransferPixels(GrSurface* surface,
892 int left, int top, int width, int height, 892 int left, int top, int width, int height,
893 GrPixelConfig config, GrBuffer* transferBuffer, 893 GrPixelConfig config, GrBuffer* transferBuffer,
894 size_t offset, size_t rowBytes) { 894 size_t offset, size_t rowBytes) {
895 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture()); 895 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture());
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 this->didWriteToSurface(target, bounds); 2665 this->didWriteToSurface(target, bounds);
2666 } 2666 }
2667 2667
2668 void GrGLGpu::flushViewport(const GrGLIRect& viewport) { 2668 void GrGLGpu::flushViewport(const GrGLIRect& viewport) {
2669 if (fHWViewport != viewport) { 2669 if (fHWViewport != viewport) {
2670 viewport.pushToGLViewport(this->glInterface()); 2670 viewport.pushToGLViewport(this->glInterface());
2671 fHWViewport = viewport; 2671 fHWViewport = viewport;
2672 } 2672 }
2673 } 2673 }
2674 2674
2675 void GrGLGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds) const { 2675 void GrGLGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, int m ipLevels) const {
2676 SkASSERT(surface); 2676 SkASSERT(surface);
2677 // Mark any MIP chain and resolve buffer as dirty if and only if there is a non-empty bounds. 2677 // Mark any MIP chain and resolve buffer as dirty if and only if there is a non-empty bounds.
2678 if (nullptr == bounds || !bounds->isEmpty()) { 2678 if (nullptr == bounds || !bounds->isEmpty()) {
2679 if (GrRenderTarget* target = surface->asRenderTarget()) { 2679 if (GrRenderTarget* target = surface->asRenderTarget()) {
2680 target->flagAsNeedingResolve(bounds); 2680 target->flagAsNeedingResolve(bounds);
2681 } 2681 }
2682 if (GrTexture* texture = surface->asTexture()) { 2682 GrTexture* texture = surface->asTexture();
2683 if (texture && 1 == mipLevels) {
2683 texture->texturePriv().dirtyMipMaps(true); 2684 texture->texturePriv().dirtyMipMaps(true);
2684 } 2685 }
2685 } 2686 }
2686 } 2687 }
2687 2688
2688 GrGLenum gPrimitiveType2GLMode[] = { 2689 GrGLenum gPrimitiveType2GLMode[] = {
2689 GR_GL_TRIANGLES, 2690 GR_GL_TRIANGLES,
2690 GR_GL_TRIANGLE_STRIP, 2691 GR_GL_TRIANGLE_STRIP,
2691 GR_GL_TRIANGLE_FAN, 2692 GR_GL_TRIANGLE_FAN,
2692 GR_GL_POINTS, 2693 GR_GL_POINTS,
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
4271 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4272 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4272 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4273 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4273 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4274 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4274 copyParams->fWidth = texture->width(); 4275 copyParams->fWidth = texture->width();
4275 copyParams->fHeight = texture->height(); 4276 copyParams->fHeight = texture->height();
4276 return true; 4277 return true;
4277 } 4278 }
4278 } 4279 }
4279 return false; 4280 return false;
4280 } 4281 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698