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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 GR_STATIC_ASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gWrapModes)); | 2239 GR_STATIC_ASSERT(SkShader::kTileModeCount == SK_ARRAY_COUNT(gWrapModes)); |
2240 GR_STATIC_ASSERT(0 == SkShader::kClamp_TileMode); | 2240 GR_STATIC_ASSERT(0 == SkShader::kClamp_TileMode); |
2241 GR_STATIC_ASSERT(1 == SkShader::kRepeat_TileMode); | 2241 GR_STATIC_ASSERT(1 == SkShader::kRepeat_TileMode); |
2242 GR_STATIC_ASSERT(2 == SkShader::kMirror_TileMode); | 2242 GR_STATIC_ASSERT(2 == SkShader::kMirror_TileMode); |
2243 return gWrapModes[tm]; | 2243 return gWrapModes[tm]; |
2244 } | 2244 } |
2245 | 2245 |
2246 void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
e* texture) { | 2246 void GrGLGpu::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
e* texture) { |
2247 SkASSERT(texture); | 2247 SkASSERT(texture); |
2248 | 2248 |
| 2249 #ifdef SK_DEBUG |
| 2250 if (!this->caps()->npotTextureTileSupport()) { |
| 2251 const bool tileX = SkShader::kClamp_TileMode != params.getTileModeX(); |
| 2252 const bool tileY = SkShader::kClamp_TileMode != params.getTileModeY(); |
| 2253 if (tileX || tileY) { |
| 2254 const int w = texture->width(); |
| 2255 const int h = texture->height(); |
| 2256 SkASSERT(SkIsPow2(w) && SkIsPow2(h)); |
| 2257 } |
| 2258 } |
| 2259 #endif |
| 2260 |
2249 // If we created a rt/tex and rendered to it without using a texture and now
we're texturing | 2261 // If we created a rt/tex and rendered to it without using a texture and now
we're texturing |
2250 // from the rt it will still be the last bound texture, but it needs resolvi
ng. So keep this | 2262 // from the rt it will still be the last bound texture, but it needs resolvi
ng. So keep this |
2251 // out of the "last != next" check. | 2263 // out of the "last != next" check. |
2252 GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTa
rget()); | 2264 GrGLRenderTarget* texRT = static_cast<GrGLRenderTarget*>(texture->asRenderTa
rget()); |
2253 if (texRT) { | 2265 if (texRT) { |
2254 this->onResolveRenderTarget(texRT); | 2266 this->onResolveRenderTarget(texRT); |
2255 } | 2267 } |
2256 | 2268 |
2257 uint32_t textureID = texture->getUniqueID(); | 2269 uint32_t textureID = texture->getUniqueID(); |
2258 if (fHWBoundTextureUniqueIDs[unitIdx] != textureID) { | 2270 if (fHWBoundTextureUniqueIDs[unitIdx] != textureID) { |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 this->setVertexArrayID(gpu, 0); | 3156 this->setVertexArrayID(gpu, 0); |
3145 } | 3157 } |
3146 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3158 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3147 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3159 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3148 fDefaultVertexArrayAttribState.resize(attrCount); | 3160 fDefaultVertexArrayAttribState.resize(attrCount); |
3149 } | 3161 } |
3150 attribState = &fDefaultVertexArrayAttribState; | 3162 attribState = &fDefaultVertexArrayAttribState; |
3151 } | 3163 } |
3152 return attribState; | 3164 return attribState; |
3153 } | 3165 } |
OLD | NEW |