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 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 this->setTextureUnit(unitIdx); | 1999 this->setTextureUnit(unitIdx); |
2000 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texture->textureID())); | 2000 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, texture->textureID())); |
2001 fHWBoundTextures[unitIdx] = texture; | 2001 fHWBoundTextures[unitIdx] = texture; |
2002 } | 2002 } |
2003 | 2003 |
2004 ResetTimestamp timestamp; | 2004 ResetTimestamp timestamp; |
2005 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti
mestamp); | 2005 const GrGLTexture::TexParams& oldTexParams = texture->getCachedTexParams(&ti
mestamp); |
2006 bool setAll = timestamp < this->getResetTimestamp(); | 2006 bool setAll = timestamp < this->getResetTimestamp(); |
2007 GrGLTexture::TexParams newTexParams; | 2007 GrGLTexture::TexParams newTexParams; |
2008 | 2008 |
2009 newTexParams.fFilter = params.isBilerp() ? GR_GL_LINEAR : GR_GL_NEAREST; | 2009 newTexParams.fFilter = (params.filterMode() == GrTextureParams::kNone_Filter
Mode) ? GR_GL_LINEAR : GR_GL_NEAREST; |
2010 | 2010 |
2011 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); | 2011 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); |
2012 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); | 2012 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); |
2013 memcpy(newTexParams.fSwizzleRGBA, | 2013 memcpy(newTexParams.fSwizzleRGBA, |
2014 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), | 2014 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), |
2015 sizeof(newTexParams.fSwizzleRGBA)); | 2015 sizeof(newTexParams.fSwizzleRGBA)); |
2016 if (setAll || newTexParams.fFilter != oldTexParams.fFilter) { | 2016 if (setAll || newTexParams.fFilter != oldTexParams.fFilter) { |
2017 this->setTextureUnit(unitIdx); | 2017 this->setTextureUnit(unitIdx); |
2018 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 2018 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
2019 GR_GL_TEXTURE_MAG_FILTER, | 2019 GR_GL_TEXTURE_MAG_FILTER, |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 this->setVertexArrayID(gpu, 0); | 2515 this->setVertexArrayID(gpu, 0); |
2516 } | 2516 } |
2517 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2517 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2518 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2518 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2519 fDefaultVertexArrayAttribState.resize(attrCount); | 2519 fDefaultVertexArrayAttribState.resize(attrCount); |
2520 } | 2520 } |
2521 attribState = &fDefaultVertexArrayAttribState; | 2521 attribState = &fDefaultVertexArrayAttribState; |
2522 } | 2522 } |
2523 return attribState; | 2523 return attribState; |
2524 } | 2524 } |
OLD | NEW |