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

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

Issue 1915403004: Ensure we're operating on the correct texture when generating mipmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | 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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 // If we created a rt/tex and rendered to it without using a texture and now we're texturing 3143 // If we created a rt/tex and rendered to it without using a texture and now we're texturing
3144 // from the rt it will still be the last bound texture, but it needs resolvi ng. So keep this 3144 // from the rt it will still be the last bound texture, but it needs resolvi ng. So keep this
3145 // out of the "last != next" check. 3145 // out of the "last != next" check.
3146 GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTa rget()); 3146 GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTa rget());
3147 if (texRT) { 3147 if (texRT) {
3148 this->onResolveRenderTarget(texRT); 3148 this->onResolveRenderTarget(texRT);
3149 } 3149 }
3150 3150
3151 uint32_t textureID = texture->getUniqueID(); 3151 uint32_t textureID = texture->getUniqueID();
3152 GrGLenum target = texture->target(); 3152 GrGLenum target = texture->target();
3153 if (fHWBoundTextureUniqueIDs[unitIdx] != textureID) { 3153 if (fHWBoundTextureUniqueIDs[unitIdx] != textureID) {
robertphillips 2016/04/26 21:31:05 How is this not getting called ?
Brian Osman 2016/04/26 21:35:02 I don't have a test-case that demonstrates this as
robertphillips 2016/04/26 21:52:47 I think you're right.
3154 this->setTextureUnit(unitIdx); 3154 this->setTextureUnit(unitIdx);
3155 GL_CALL(BindTexture(target, texture->textureID())); 3155 GL_CALL(BindTexture(target, texture->textureID()));
3156 fHWBoundTextureUniqueIDs[unitIdx] = textureID; 3156 fHWBoundTextureUniqueIDs[unitIdx] = textureID;
3157 } 3157 }
3158 3158
3159 ResetTimestamp timestamp; 3159 ResetTimestamp timestamp;
3160 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti mestamp); 3160 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti mestamp);
3161 bool setAll = timestamp < this->getResetTimestamp(); 3161 bool setAll = timestamp < this->getResetTimestamp();
3162 GrGLTexture::TexParams newTexParams; 3162 GrGLTexture::TexParams newTexParams;
3163 3163
(...skipping 26 matching lines...) Expand all
3190 if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture- >config())) { 3190 if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture- >config())) {
3191 filterMode = GrTextureParams::kBilerp_FilterMode; 3191 filterMode = GrTextureParams::kBilerp_FilterMode;
3192 } 3192 }
3193 } 3193 }
3194 3194
3195 newTexParams.fMinFilter = glMinFilterModes[filterMode]; 3195 newTexParams.fMinFilter = glMinFilterModes[filterMode];
3196 newTexParams.fMagFilter = glMagFilterModes[filterMode]; 3196 newTexParams.fMagFilter = glMagFilterModes[filterMode];
3197 3197
3198 if (GrTextureParams::kMipMap_FilterMode == filterMode) { 3198 if (GrTextureParams::kMipMap_FilterMode == filterMode) {
3199 if (texture->texturePriv().mipMapsAreDirty()) { 3199 if (texture->texturePriv().mipMapsAreDirty()) {
3200 this->setTextureUnit(unitIdx);
3200 GL_CALL(GenerateMipmap(target)); 3201 GL_CALL(GenerateMipmap(target));
3201 texture->texturePriv().dirtyMipMaps(false); 3202 texture->texturePriv().dirtyMipMaps(false);
3202 texture->texturePriv().setMaxMipMapLevel(SkMipMap::ComputeLevelCount ( 3203 texture->texturePriv().setMaxMipMapLevel(SkMipMap::ComputeLevelCount (
3203 texture->width(), texture->height())); 3204 texture->width(), texture->height()));
3204 } 3205 }
3205 } 3206 }
3206 3207
3207 newTexParams.fMaxMipMapLevel = texture->texturePriv().maxMipMapLevel(); 3208 newTexParams.fMaxMipMapLevel = texture->texturePriv().maxMipMapLevel();
3208 3209
3209 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); 3210 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX());
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
4269 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4270 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4270 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4271 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4271 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4272 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4272 copyParams->fWidth = texture->width(); 4273 copyParams->fWidth = texture->width();
4273 copyParams->fHeight = texture->height(); 4274 copyParams->fHeight = texture->height();
4274 return true; 4275 return true;
4275 } 4276 }
4276 } 4277 }
4277 return false; 4278 return false;
4278 } 4279 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698