| 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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 static GrGLenum glMinFilterModes[] = { | 2021 static GrGLenum glMinFilterModes[] = { |
| 2022 GR_GL_NEAREST, | 2022 GR_GL_NEAREST, |
| 2023 GR_GL_LINEAR, | 2023 GR_GL_LINEAR, |
| 2024 GR_GL_LINEAR_MIPMAP_LINEAR | 2024 GR_GL_LINEAR_MIPMAP_LINEAR |
| 2025 }; | 2025 }; |
| 2026 static GrGLenum glMagFilterModes[] = { | 2026 static GrGLenum glMagFilterModes[] = { |
| 2027 GR_GL_NEAREST, | 2027 GR_GL_NEAREST, |
| 2028 GR_GL_LINEAR, | 2028 GR_GL_LINEAR, |
| 2029 GR_GL_LINEAR | 2029 GR_GL_LINEAR |
| 2030 }; | 2030 }; |
| 2031 newTexParams.fMinFilter = glMinFilterModes[params.filterMode()]; | 2031 GrTextureParams::FilterMode filterMode = params.filterMode(); |
| 2032 newTexParams.fMagFilter = glMagFilterModes[params.filterMode()]; | 2032 if (!this->caps()->mipMapSupport() && GrTextureParams::kMipMap_FilterMode ==
filterMode) { |
| 2033 filterMode = GrTextureParams::kBilerp_FilterMode; |
| 2034 } |
| 2035 newTexParams.fMinFilter = glMinFilterModes[filterMode]; |
| 2036 newTexParams.fMagFilter = glMagFilterModes[filterMode]; |
| 2033 | 2037 |
| 2034 if (params.filterMode() == GrTextureParams::kMipMap_FilterMode && | 2038 if (GrTextureParams::kMipMap_FilterMode == filterMode && texture->mipMapsAre
Dirty()) { |
| 2035 texture->mipMapsAreDirty()) { | |
| 2036 // GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST)); | 2039 // GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST)); |
| 2037 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); | 2040 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); |
| 2038 texture->dirtyMipMaps(false); | 2041 texture->dirtyMipMaps(false); |
| 2039 } | 2042 } |
| 2040 | 2043 |
| 2041 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); | 2044 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); |
| 2042 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); | 2045 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); |
| 2043 memcpy(newTexParams.fSwizzleRGBA, | 2046 memcpy(newTexParams.fSwizzleRGBA, |
| 2044 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), | 2047 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), |
| 2045 sizeof(newTexParams.fSwizzleRGBA)); | 2048 sizeof(newTexParams.fSwizzleRGBA)); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 this->setVertexArrayID(gpu, 0); | 2696 this->setVertexArrayID(gpu, 0); |
| 2694 } | 2697 } |
| 2695 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2698 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2696 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2699 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2697 fDefaultVertexArrayAttribState.resize(attrCount); | 2700 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2698 } | 2701 } |
| 2699 attribState = &fDefaultVertexArrayAttribState; | 2702 attribState = &fDefaultVertexArrayAttribState; |
| 2700 } | 2703 } |
| 2701 return attribState; | 2704 return attribState; |
| 2702 } | 2705 } |
| OLD | NEW |