| 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 "GrGLNameAllocator.h" | 10 #include "GrGLNameAllocator.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 GL_CALL(Disable(GR_GL_POLYGON_OFFSET_FILL)); | 269 GL_CALL(Disable(GR_GL_POLYGON_OFFSET_FILL)); |
| 270 // Since ES doesn't support glPointSize at all we always use the VS
to | 270 // Since ES doesn't support glPointSize at all we always use the VS
to |
| 271 // set the point size | 271 // set the point size |
| 272 GL_CALL(Enable(GR_GL_VERTEX_PROGRAM_POINT_SIZE)); | 272 GL_CALL(Enable(GR_GL_VERTEX_PROGRAM_POINT_SIZE)); |
| 273 | 273 |
| 274 // We should set glPolygonMode(FRONT_AND_BACK,FILL) here, too. It is
n't | 274 // We should set glPolygonMode(FRONT_AND_BACK,FILL) here, too. It is
n't |
| 275 // currently part of our gl interface. There are probably others as | 275 // currently part of our gl interface. There are probably others as |
| 276 // well. | 276 // well. |
| 277 } | 277 } |
| 278 |
| 279 if (kGLES_GrGLStandard == this->glStandard() && |
| 280 fGLContext.hasExtension("GL_ARM_shader_framebuffer_fetch")) { |
| 281 // The arm extension requires specifically enabling MSAA fetching pe
r sample. |
| 282 // On some devices this may have a perf hit. Also multiple render t
argets are disabled |
| 283 GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM)); |
| 284 } |
| 278 fHWWriteToColor = kUnknown_TriState; | 285 fHWWriteToColor = kUnknown_TriState; |
| 279 // we only ever use lines in hairline mode | 286 // we only ever use lines in hairline mode |
| 280 GL_CALL(LineWidth(1)); | 287 GL_CALL(LineWidth(1)); |
| 281 } | 288 } |
| 282 | 289 |
| 283 if (resetBits & kAA_GrGLBackendState) { | 290 if (resetBits & kAA_GrGLBackendState) { |
| 284 fHWAAState.invalidate(); | 291 fHWAAState.invalidate(); |
| 285 } | 292 } |
| 286 | 293 |
| 287 fHWActiveTextureUnitIdx = -1; // invalid | 294 fHWActiveTextureUnitIdx = -1; // invalid |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 return; | 1490 return; |
| 1484 } | 1491 } |
| 1485 } | 1492 } |
| 1486 | 1493 |
| 1487 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); | 1494 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
| 1488 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { | 1495 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { |
| 1489 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1496 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
| 1490 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); | 1497 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
| 1491 } | 1498 } |
| 1492 switch (this->glCaps().invalidateFBType()) { | 1499 switch (this->glCaps().invalidateFBType()) { |
| 1493 case GrGLCaps::kNone_FBFetchType: | 1500 case GrGLCaps::kNone_InvalidateFBType: |
| 1494 SkFAIL("Should never get here."); | 1501 SkFAIL("Should never get here."); |
| 1495 break; | 1502 break; |
| 1496 case GrGLCaps::kInvalidate_InvalidateFBType: | 1503 case GrGLCaps::kInvalidate_InvalidateFBType: |
| 1497 if (0 == glRT->renderFBOID()) { | 1504 if (0 == glRT->renderFBOID()) { |
| 1498 // When rendering to the default framebuffer the legal values f
or attachments | 1505 // When rendering to the default framebuffer the legal values f
or attachments |
| 1499 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment | 1506 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari
ous FBO attachment |
| 1500 // types. | 1507 // types. |
| 1501 static const GrGLenum attachments[] = { GR_GL_COLOR }; | 1508 static const GrGLenum attachments[] = { GR_GL_COLOR }; |
| 1502 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), | 1509 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(
attachments), |
| 1503 attachments)); | 1510 attachments)); |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 this->setVertexArrayID(gpu, 0); | 3025 this->setVertexArrayID(gpu, 0); |
| 3019 } | 3026 } |
| 3020 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3027 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3021 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3028 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3022 fDefaultVertexArrayAttribState.resize(attrCount); | 3029 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3023 } | 3030 } |
| 3024 attribState = &fDefaultVertexArrayAttribState; | 3031 attribState = &fDefaultVertexArrayAttribState; |
| 3025 } | 3032 } |
| 3026 return attribState; | 3033 return attribState; |
| 3027 } | 3034 } |
| OLD | NEW |