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 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2046 GR_GL_NEAREST, | 2046 GR_GL_NEAREST, |
2047 GR_GL_LINEAR, | 2047 GR_GL_LINEAR, |
2048 GR_GL_LINEAR_MIPMAP_LINEAR | 2048 GR_GL_LINEAR_MIPMAP_LINEAR |
2049 }; | 2049 }; |
2050 static GrGLenum glMagFilterModes[] = { | 2050 static GrGLenum glMagFilterModes[] = { |
2051 GR_GL_NEAREST, | 2051 GR_GL_NEAREST, |
2052 GR_GL_LINEAR, | 2052 GR_GL_LINEAR, |
2053 GR_GL_LINEAR | 2053 GR_GL_LINEAR |
2054 }; | 2054 }; |
2055 GrTextureParams::FilterMode filterMode = params.filterMode(); | 2055 GrTextureParams::FilterMode filterMode = params.filterMode(); |
2056 if (!this->caps()->mipMapSupport() && GrTextureParams::kMipMap_FilterMode ==
filterMode) { | 2056 |
2057 filterMode = GrTextureParams::kBilerp_FilterMode; | 2057 if (GrTextureParams::kMipMap_FilterMode == filterMode) { |
| 2058 if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture-
>config())) { |
| 2059 filterMode = GrTextureParams::kBilerp_FilterMode; |
| 2060 } |
2058 } | 2061 } |
| 2062 |
2059 newTexParams.fMinFilter = glMinFilterModes[filterMode]; | 2063 newTexParams.fMinFilter = glMinFilterModes[filterMode]; |
2060 newTexParams.fMagFilter = glMagFilterModes[filterMode]; | 2064 newTexParams.fMagFilter = glMagFilterModes[filterMode]; |
2061 | 2065 |
2062 if (GrTextureParams::kMipMap_FilterMode == filterMode && | 2066 if (GrTextureParams::kMipMap_FilterMode == filterMode && |
2063 texture->texturePriv().mipMapsAreDirty() && !GrPixelConfigIsCompressed(t
exture->config())) { | 2067 texture->texturePriv().mipMapsAreDirty()) { |
2064 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); | 2068 GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); |
2065 texture->texturePriv().dirtyMipMaps(false); | 2069 texture->texturePriv().dirtyMipMaps(false); |
2066 } | 2070 } |
2067 | 2071 |
2068 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); | 2072 newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); |
2069 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); | 2073 newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); |
2070 memcpy(newTexParams.fSwizzleRGBA, | 2074 memcpy(newTexParams.fSwizzleRGBA, |
2071 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), | 2075 GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps
()), |
2072 sizeof(newTexParams.fSwizzleRGBA)); | 2076 sizeof(newTexParams.fSwizzleRGBA)); |
2073 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { | 2077 if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 this->setVertexArrayID(gpu, 0); | 2610 this->setVertexArrayID(gpu, 0); |
2607 } | 2611 } |
2608 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2612 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2609 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2613 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2610 fDefaultVertexArrayAttribState.resize(attrCount); | 2614 fDefaultVertexArrayAttribState.resize(attrCount); |
2611 } | 2615 } |
2612 attribState = &fDefaultVertexArrayAttribState; | 2616 attribState = &fDefaultVertexArrayAttribState; |
2613 } | 2617 } |
2614 return attribState; | 2618 return attribState; |
2615 } | 2619 } |
OLD | NEW |