OLD | NEW |
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 "GrGLGLSL.h" | 9 #include "GrGLGLSL.h" |
10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 get_tex_param_swizzle(texture->config(), this->glCaps(), newTexParams.fSwizz
leRGBA); | 3337 get_tex_param_swizzle(texture->config(), this->glCaps(), newTexParams.fSwizz
leRGBA); |
3338 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { | 3338 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { |
3339 this->setTextureUnit(unitIdx); | 3339 this->setTextureUnit(unitIdx); |
3340 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAG_FILTER, newTexParams.fMa
gFilter)); | 3340 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAG_FILTER, newTexParams.fMa
gFilter)); |
3341 } | 3341 } |
3342 if (setAll || newTexParams.fMinFilter != oldTexParams.fMinFilter) { | 3342 if (setAll || newTexParams.fMinFilter != oldTexParams.fMinFilter) { |
3343 this->setTextureUnit(unitIdx); | 3343 this->setTextureUnit(unitIdx); |
3344 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, newTexParams.fMi
nFilter)); | 3344 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_FILTER, newTexParams.fMi
nFilter)); |
3345 } | 3345 } |
3346 if (setAll || newTexParams.fMaxMipMapLevel != oldTexParams.fMaxMipMapLevel)
{ | 3346 if (setAll || newTexParams.fMaxMipMapLevel != oldTexParams.fMaxMipMapLevel)
{ |
3347 if (newTexParams.fMaxMipMapLevel != 0) { | 3347 // These are not supported in ES2 contexts |
3348 this->setTextureUnit(unitIdx); | 3348 if (this->glCaps().mipMapLevelAndLodControlSupport()) { |
3349 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_LOD, 0)); | 3349 if (newTexParams.fMaxMipMapLevel != 0) { |
3350 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_BASE_LEVEL, 0)); | 3350 this->setTextureUnit(unitIdx); |
3351 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LOD, | 3351 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MIN_LOD, 0)); |
3352 newTexParams.fMaxMipMapLevel)); | 3352 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_BASE_LEVEL, 0)); |
3353 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL, | 3353 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LOD, |
3354 newTexParams.fMaxMipMapLevel)); | 3354 newTexParams.fMaxMipMapLevel)); |
| 3355 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_MAX_LEVEL, |
| 3356 newTexParams.fMaxMipMapLevel)); |
| 3357 } |
3355 } | 3358 } |
3356 } | 3359 } |
3357 if (setAll || newTexParams.fWrapS != oldTexParams.fWrapS) { | 3360 if (setAll || newTexParams.fWrapS != oldTexParams.fWrapS) { |
3358 this->setTextureUnit(unitIdx); | 3361 this->setTextureUnit(unitIdx); |
3359 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_S, newTexParams.fWrapS)
); | 3362 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_S, newTexParams.fWrapS)
); |
3360 } | 3363 } |
3361 if (setAll || newTexParams.fWrapT != oldTexParams.fWrapT) { | 3364 if (setAll || newTexParams.fWrapT != oldTexParams.fWrapT) { |
3362 this->setTextureUnit(unitIdx); | 3365 this->setTextureUnit(unitIdx); |
3363 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_T, newTexParams.fWrapT)
); | 3366 GL_CALL(TexParameteri(target, GR_GL_TEXTURE_WRAP_T, newTexParams.fWrapT)
); |
3364 } | 3367 } |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4307 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4310 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4308 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4311 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4309 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4312 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4310 copyParams->fWidth = texture->width(); | 4313 copyParams->fWidth = texture->width(); |
4311 copyParams->fHeight = texture->height(); | 4314 copyParams->fHeight = texture->height(); |
4312 return true; | 4315 return true; |
4313 } | 4316 } |
4314 } | 4317 } |
4315 return false; | 4318 return false; |
4316 } | 4319 } |
OLD | NEW |