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

Side by Side Diff: src/gpu/GrTexture.cpp

Issue 1286203002: Defer flushes if kPreferNoIO is specified (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use explicit size in test Created 5 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/GrSurface.cpp ('k') | src/gpu/GrTextureProvider.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 24 matching lines...) Expand all
35 35
36 if (GrPixelConfigIsCompressed(fDesc.fConfig)) { 36 if (GrPixelConfigIsCompressed(fDesc.fConfig)) {
37 textureSize = GrCompressedFormatDataSize(fDesc.fConfig, fDesc.fWidth, fD esc.fHeight); 37 textureSize = GrCompressedFormatDataSize(fDesc.fConfig, fDesc.fWidth, fD esc.fHeight);
38 } else { 38 } else {
39 textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fD esc.fConfig); 39 textureSize = (size_t) fDesc.fWidth * fDesc.fHeight * GrBytesPerPixel(fD esc.fConfig);
40 } 40 }
41 41
42 if (this->texturePriv().hasMipMaps()) { 42 if (this->texturePriv().hasMipMaps()) {
43 // We don't have to worry about the mipmaps being a different size than 43 // We don't have to worry about the mipmaps being a different size than
44 // we'd expect because we never change fDesc.fWidth/fHeight. 44 // we'd expect because we never change fDesc.fWidth/fHeight.
45 textureSize *= 2; 45 textureSize += textureSize/3;
46 } 46 }
47
48 SkASSERT(!SkToBool(fDesc.fFlags & kRenderTarget_GrSurfaceFlag));
49 SkASSERT(textureSize <= WorseCaseSize(fDesc));
50
47 return textureSize; 51 return textureSize;
48 } 52 }
49 53
50 void GrTexture::validateDesc() const { 54 void GrTexture::validateDesc() const {
51 if (this->asRenderTarget()) { 55 if (this->asRenderTarget()) {
52 // This texture has a render target 56 // This texture has a render target
53 SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); 57 SkASSERT(0 != (fDesc.fFlags & kRenderTarget_GrSurfaceFlag));
54 SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numColorSamples()); 58 SkASSERT(fDesc.fSampleCnt == this->asRenderTarget()->numColorSamples());
55 } else { 59 } else {
56 SkASSERT(0 == (fDesc.fFlags & kRenderTarget_GrSurfaceFlag)); 60 SkASSERT(0 == (fDesc.fFlags & kRenderTarget_GrSurfaceFlag));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 SkASSERT(desc.fWidth <= SK_MaxU16); 106 SkASSERT(desc.fWidth <= SK_MaxU16);
103 SkASSERT(desc.fHeight <= SK_MaxU16); 107 SkASSERT(desc.fHeight <= SK_MaxU16);
104 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); 108 SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6));
105 SkASSERT(desc.fSampleCnt < (1 << 8)); 109 SkASSERT(desc.fSampleCnt < (1 << 8));
106 SkASSERT(flags < (1 << 10)); 110 SkASSERT(flags < (1 << 10));
107 SkASSERT(static_cast<int>(origin) < (1 << 8)); 111 SkASSERT(static_cast<int>(origin) < (1 << 8));
108 112
109 builder[0] = desc.fWidth | (desc.fHeight << 16); 113 builder[0] = desc.fWidth | (desc.fHeight << 16);
110 builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); 114 builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
111 } 115 }
OLDNEW
« no previous file with comments | « src/gpu/GrSurface.cpp ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698