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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff); | 102 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff); |
103 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff); | 103 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff); |
104 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff); | 104 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff); |
105 | 105 |
106 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope | 106 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope |
107 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount == | 107 GR_STATIC_ASSERT(kTotalGrBlendCoeffCount == |
108 GR_ARRAY_COUNT(gXfermodeCoeff2Blend)); | 108 GR_ARRAY_COUNT(gXfermodeCoeff2Blend)); |
109 } | 109 } |
110 | 110 |
111 /////////////////////////////////////////////////////////////////////////////// | 111 /////////////////////////////////////////////////////////////////////////////// |
112 | 112 |
robertphillips
2013/12/19 14:24:33
Don't think we want to land this.
bsalomon
2013/12/19 15:03:35
haha right
| |
113 static bool gPrintStartupSpew; | 113 static bool gPrintStartupSpew = 1; |
114 | 114 |
115 GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) | 115 GrGpuGL::GrGpuGL(const GrGLContext& ctx, GrContext* context) |
116 : GrGpu(context) | 116 : GrGpu(context) |
117 , fGLContext(ctx) { | 117 , fGLContext(ctx) { |
118 | 118 |
119 SkASSERT(ctx.isInitialized()); | 119 SkASSERT(ctx.isInitialized()); |
120 | 120 |
121 fCaps.reset(SkRef(ctx.info().caps())); | 121 fCaps.reset(SkRef(ctx.info().caps())); |
122 | 122 |
123 fHWBoundTextures.reset(ctx.info().caps()->maxFragmentTextureUnits()); | 123 fHWBoundTextures.reset(ctx.info().caps()->maxFragmentTextureUnits()); |
(...skipping 1897 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 |