| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 322 } |
| 323 fHWWriteToColor = kUnknown_TriState; | 323 fHWWriteToColor = kUnknown_TriState; |
| 324 // we only ever use lines in hairline mode | 324 // we only ever use lines in hairline mode |
| 325 GL_CALL(LineWidth(1)); | 325 GL_CALL(LineWidth(1)); |
| 326 } | 326 } |
| 327 | 327 |
| 328 if (resetBits & kAA_GrGLBackendState) { | 328 if (resetBits & kAA_GrGLBackendState) { |
| 329 fHWAAState.invalidate(); | 329 fHWAAState.invalidate(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // invalid | 332 fHWActiveTextureUnitIdx = -1; // invalid |
| 333 |
| 333 if (resetBits & kTextureBinding_GrGLBackendState) { | 334 if (resetBits & kTextureBinding_GrGLBackendState) { |
| 334 fHWActiveTextureUnitIdx = -1; | |
| 335 for (int s = 0; s < fHWBoundTextures.count(); ++s) { | 335 for (int s = 0; s < fHWBoundTextures.count(); ++s) { |
| 336 fHWBoundTextures[s] = NULL; | 336 fHWBoundTextures[s] = NULL; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 if (resetBits & kBlend_GrGLBackendState) { | 340 if (resetBits & kBlend_GrGLBackendState) { |
| 341 fHWBlendState.invalidate(); | 341 fHWBlendState.invalidate(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 if (resetBits & kView_GrGLBackendState) { | 344 if (resetBits & kView_GrGLBackendState) { |
| 345 fHWScissorSettings.invalidate(); | 345 fHWScissorSettings.invalidate(); |
| 346 fHWViewport.invalidate(); | 346 fHWViewport.invalidate(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 if (resetBits & kStencil_GrGLBackendState) { | 349 if (resetBits & kStencil_GrGLBackendState) { |
| 350 fHWStencilSettings.invalidate(); | 350 fHWStencilSettings.invalidate(); |
| 351 fHWStencilTestEnabled = kUnknown_TriState; | 351 fHWStencilTestEnabled = kUnknown_TriState; |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Vertex | 354 // Vertex |
| 355 if (resetBits & kVertex_GrGLBackendState) { | 355 if (resetBits & kVertex_GrGLBackendState) { |
| 356 fHWGeometryState.invalidate(); | 356 fHWGeometryState.invalidate(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 if (resetBits & kRenderTarget_GrGLBackendState) { | 359 if (resetBits & kRenderTarget_GrGLBackendState) { |
| 360 fHWBoundRenderTarget = NULL; | 360 fHWBoundRenderTarget = NULL; |
| 361 } | 361 } |
| 362 | 362 |
| 363 if (resetBits & kPathStencil_GrGLBackendState) { | 363 if (resetBits & kFixedFunction_GrGLBackendState && |
| 364 fHWPathStencilMatrixState.invalidate(); | 364 kDesktop_GrGLBinding == this->glBinding() && |
| 365 if (this->caps()->pathStencilingSupport()) { | 365 !this->glCaps().isCoreProfile()) { |
| 366 // we don't use the model view matrix. | 366 |
| 367 GL_CALL(MatrixMode(GR_GL_MODELVIEW)); | 367 fHWProjectionMatrixState.invalidate(); |
| 368 GL_CALL(LoadIdentity()); | 368 // we don't use the model view matrix. |
| 369 GL_CALL(MatrixMode(GR_GL_MODELVIEW)); |
| 370 GL_CALL(LoadIdentity()); |
| 371 |
| 372 // When we use fixed function vertex processing we always use the vertex
array |
| 373 // and none of the other arrays. |
| 374 GL_CALL(EnableClientState(GR_GL_VERTEX_ARRAY)); |
| 375 GL_CALL(DisableClientState(GR_GL_NORMAL_ARRAY)); |
| 376 GL_CALL(DisableClientState(GR_GL_COLOR_ARRAY)); |
| 377 GL_CALL(DisableClientState(GR_GL_INDEX_ARRAY)); |
| 378 GL_CALL(DisableClientState(GR_GL_EDGE_FLAG_ARRAY)); |
| 379 for (int i = 0; i < this->glCaps().maxFixedFunctionTextureCoords(); ++i)
{ |
| 380 GL_CALL(ClientActiveTexture(GR_GL_TEXTURE0 + i)); |
| 381 GL_CALL(DisableClientState(GR_GL_TEXTURE_COORD_ARRAY)); |
| 382 |
| 383 GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + i)); |
| 384 GL_CALL(Disable(GR_GL_TEXTURE_GEN_S)); |
| 385 GL_CALL(Disable(GR_GL_TEXTURE_GEN_T)); |
| 386 GL_CALL(Disable(GR_GL_TEXTURE_GEN_Q)); |
| 387 GL_CALL(Disable(GR_GL_TEXTURE_GEN_R)); |
| 369 } | 388 } |
| 370 } | 389 } |
| 371 | 390 |
| 372 // we assume these values | 391 // we assume these values |
| 373 if (resetBits & kPixelStore_GrGLBackendState) { | 392 if (resetBits & kPixelStore_GrGLBackendState) { |
| 374 if (this->glCaps().unpackRowLengthSupport()) { | 393 if (this->glCaps().unpackRowLengthSupport()) { |
| 375 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); | 394 GL_CALL(PixelStorei(GR_GL_UNPACK_ROW_LENGTH, 0)); |
| 376 } | 395 } |
| 377 if (this->glCaps().packRowLengthSupport()) { | 396 if (this->glCaps().packRowLengthSupport()) { |
| 378 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, 0)); | 397 GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, 0)); |
| (...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2552 this->setVertexArrayID(gpu, 0); | 2571 this->setVertexArrayID(gpu, 0); |
| 2553 } | 2572 } |
| 2554 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2573 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2574 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2556 fDefaultVertexArrayAttribState.resize(attrCount); | 2575 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2557 } | 2576 } |
| 2558 attribState = &fDefaultVertexArrayAttribState; | 2577 attribState = &fDefaultVertexArrayAttribState; |
| 2559 } | 2578 } |
| 2560 return attribState; | 2579 return attribState; |
| 2561 } | 2580 } |
| OLD | NEW |