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

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

Issue 20362002: make the filter mode for GrTextureAccess an enum so we can plumb down (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fall back to mipmaps for HQ sampling (for now) Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | src/gpu/GrTextureAccess.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 9
10 #include "GrTexture.h" 10 #include "GrTexture.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // These flags need to fit in a GrResourceKey::ResourceFlags so they can be fold ed into the texture 107 // These flags need to fit in a GrResourceKey::ResourceFlags so they can be fold ed into the texture
108 // key 108 // key
109 enum TextureFlags { 109 enum TextureFlags {
110 /** 110 /**
111 * The kStretchToPOT bit is set when the texture is NPOT and is being repeat ed but the 111 * The kStretchToPOT bit is set when the texture is NPOT and is being repeat ed but the
112 * hardware doesn't support that feature. 112 * hardware doesn't support that feature.
113 */ 113 */
114 kStretchToPOT_TextureFlag = 0x1, 114 kStretchToPOT_TextureFlag = 0x1,
115 /** 115 /**
116 * The kFilter bit can only be set when the kStretchToPOT flag is set and in dicates whether the 116 * The kBilerp bit can only be set when the kStretchToPOT flag is set and in dicates whether the
117 * stretched texture should be bilerp filtered or point sampled. 117 * stretched texture should be bilerped.
118 */ 118 */
119 kFilter_TextureFlag = 0x2, 119 kBilerp_TextureFlag = 0x2,
120 }; 120 };
121 121
122 namespace { 122 namespace {
123 GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu, 123 GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu,
124 const GrTextureParams* params, 124 const GrTextureParams* params,
125 const GrTextureDesc& desc) { 125 const GrTextureDesc& desc) {
126 GrResourceKey::ResourceFlags flags = 0; 126 GrResourceKey::ResourceFlags flags = 0;
127 bool tiled = NULL != params && params->isTiled(); 127 bool tiled = NULL != params && params->isTiled();
128 if (tiled && !gpu->caps()->npotTextureTileSupport()) { 128 if (tiled && !gpu->caps()->npotTextureTileSupport()) {
129 if (!GrIsPow2(desc.fWidth) || !GrIsPow2(desc.fHeight)) { 129 if (!GrIsPow2(desc.fWidth) || !GrIsPow2(desc.fHeight)) {
130 flags |= kStretchToPOT_TextureFlag; 130 flags |= kStretchToPOT_TextureFlag;
131 if (params->isBilerp()) { 131 switch(params->filterMode()) {
132 flags |= kFilter_TextureFlag; 132 case GrTextureParams::kNone_FilterMode:
133 break;
134 case GrTextureParams::kBilerp_FilterMode:
135 case GrTextureParams::kMipMap_FilterMode:
136 flags |= kBilerp_TextureFlag;
137 break;
133 } 138 }
134 } 139 }
135 } 140 }
136 return flags; 141 return flags;
137 } 142 }
138 143
139 GrResourceKey::ResourceType texture_resource_type() { 144 GrResourceKey::ResourceType texture_resource_type() {
140 static const GrResourceKey::ResourceType gType = GrResourceKey::GenerateReso urceType(); 145 static const GrResourceKey::ResourceType gType = GrResourceKey::GenerateReso urceType();
141 return gType; 146 return gType;
142 } 147 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 memset(idKey.fData8 + 16, 0, kPadSize); 184 memset(idKey.fData8 + 16, 0, kPadSize);
180 185
181 GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey); 186 GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
182 return GrResourceKey(cacheID, texture_resource_type(), 0); 187 return GrResourceKey(cacheID, texture_resource_type(), 0);
183 } 188 }
184 189
185 bool GrTexture::NeedsResizing(const GrResourceKey& key) { 190 bool GrTexture::NeedsResizing(const GrResourceKey& key) {
186 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); 191 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
187 } 192 }
188 193
189 bool GrTexture::NeedsFiltering(const GrResourceKey& key) { 194 bool GrTexture::NeedsBilerp(const GrResourceKey& key) {
190 return SkToBool(key.getResourceFlags() & kFilter_TextureFlag); 195 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
191 } 196 }
OLDNEW
« no previous file with comments | « src/gpu/GrTextContext.cpp ('k') | src/gpu/GrTextureAccess.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698