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 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 GR_GL_LINEAR_MIPMAP_LINEAR | 2013 GR_GL_LINEAR_MIPMAP_LINEAR |
2014 }; | 2014 }; |
2015 static GrGLenum glMagFilterModes[] = { | 2015 static GrGLenum glMagFilterModes[] = { |
2016 GR_GL_NEAREST, | 2016 GR_GL_NEAREST, |
2017 GR_GL_LINEAR, | 2017 GR_GL_LINEAR, |
2018 GR_GL_LINEAR | 2018 GR_GL_LINEAR |
2019 }; | 2019 }; |
2020 newTexParams.fMinFilter = glMinFilterModes[params.filterMode()]; | 2020 newTexParams.fMinFilter = glMinFilterModes[params.filterMode()]; |
2021 newTexParams.fMagFilter = glMagFilterModes[params.filterMode()]; | 2021 newTexParams.fMagFilter = glMagFilterModes[params.filterMode()]; |
2022 | 2022 |
2023 #ifndef SKIA_IGNORE_GPU_MIPMAPS | |
2024 if (params.filterMode() == GrTextureParams::kMipMap_FilterMode && | 2023 if (params.filterMode() == GrTextureParams::kMipMap_FilterMode && |
2025 texture->mipMapsAreDirty()) { | 2024 texture->mipMapsAreDirty()) { |
2026 // GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST)); | 2025 // GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST)); |
2027 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); | 2026 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); |
2028 texture->dirtyMipMaps(false); | 2027 texture->dirtyMipMaps(false); |
2029 } | 2028 } |
2030 #endif | |
2031 | 2029 |
2032 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); | 2030 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); |
2033 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); | 2031 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); |
2034 memcpy(newTexParams.fSwizzleRGBA, | 2032 memcpy(newTexParams.fSwizzleRGBA, |
2035 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), | 2033 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), |
2036 sizeof(newTexParams.fSwizzleRGBA)); | 2034 sizeof(newTexParams.fSwizzleRGBA)); |
2037 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { | 2035 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { |
2038 this->setTextureUnit(unitIdx); | 2036 this->setTextureUnit(unitIdx); |
2039 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 2037 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
2040 GR_GL_TEXTURE_MAG_FILTER, | 2038 GR_GL_TEXTURE_MAG_FILTER, |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 this->setVertexArrayID(gpu, 0); | 2682 this->setVertexArrayID(gpu, 0); |
2685 } | 2683 } |
2686 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2684 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2687 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2685 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2688 fDefaultVertexArrayAttribState.resize(attrCount); | 2686 fDefaultVertexArrayAttribState.resize(attrCount); |
2689 } | 2687 } |
2690 attribState = &fDefaultVertexArrayAttribState; | 2688 attribState = &fDefaultVertexArrayAttribState; |
2691 } | 2689 } |
2692 return attribState; | 2690 return attribState; |
2693 } | 2691 } |
OLD | NEW |