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 // On arm we need to reset fetch per sample, used fb fetch extension. | |
bsalomon
2014/07/31 17:28:01
This sentence is a little unclear. Also, maybe unn
| |
280 if (kGLES_GrGLStandard == this->glStandard() && | |
281 fGLContext.hasExtension("GL_ARM_shader_framebuffer_fetch")) { | |
282 // The arm extension requires specifically enabling MSAA fetching pe r sample. | |
283 // On some devices this may have a perf hit. Also multiple render t argets are disabled | |
284 GL_CALL(Enable(GR_GL_FETCH_PER_SAMPLE_ARM)); | |
285 } | |
278 fHWWriteToColor = kUnknown_TriState; | 286 fHWWriteToColor = kUnknown_TriState; |
279 // we only ever use lines in hairline mode | 287 // we only ever use lines in hairline mode |
280 GL_CALL(LineWidth(1)); | 288 GL_CALL(LineWidth(1)); |
281 } | 289 } |
282 | 290 |
283 if (resetBits & kAA_GrGLBackendState) { | 291 if (resetBits & kAA_GrGLBackendState) { |
284 fHWAAState.invalidate(); | 292 fHWAAState.invalidate(); |
285 } | 293 } |
286 | 294 |
287 fHWActiveTextureUnitIdx = -1; // invalid | 295 fHWActiveTextureUnitIdx = -1; // invalid |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1483 return; | 1491 return; |
1484 } | 1492 } |
1485 } | 1493 } |
1486 | 1494 |
1487 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); | 1495 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
1488 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { | 1496 if (renderTarget->getUniqueID() != fHWBoundRenderTargetUniqueID) { |
1489 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1497 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
1490 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); | 1498 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
1491 } | 1499 } |
1492 switch (this->glCaps().invalidateFBType()) { | 1500 switch (this->glCaps().invalidateFBType()) { |
1493 case GrGLCaps::kNone_FBFetchType: | 1501 case GrGLCaps::kNone_InvalidateFBType: |
1494 SkFAIL("Should never get here."); | 1502 SkFAIL("Should never get here."); |
1495 break; | 1503 break; |
1496 case GrGLCaps::kInvalidate_InvalidateFBType: | 1504 case GrGLCaps::kInvalidate_InvalidateFBType: |
1497 if (0 == glRT->renderFBOID()) { | 1505 if (0 == glRT->renderFBOID()) { |
1498 // When rendering to the default framebuffer the legal values f or attachments | 1506 // 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 | 1507 // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the vari ous FBO attachment |
1500 // types. | 1508 // types. |
1501 static const GrGLenum attachments[] = { GR_GL_COLOR }; | 1509 static const GrGLenum attachments[] = { GR_GL_COLOR }; |
1502 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT( attachments), | 1510 GL_CALL(InvalidateFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT( attachments), |
1503 attachments)); | 1511 attachments)); |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3018 this->setVertexArrayID(gpu, 0); | 3026 this->setVertexArrayID(gpu, 0); |
3019 } | 3027 } |
3020 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3028 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3021 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3029 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3022 fDefaultVertexArrayAttribState.resize(attrCount); | 3030 fDefaultVertexArrayAttribState.resize(attrCount); |
3023 } | 3031 } |
3024 attribState = &fDefaultVertexArrayAttribState; | 3032 attribState = &fDefaultVertexArrayAttribState; |
3025 } | 3033 } |
3026 return attribState; | 3034 return attribState; |
3027 } | 3035 } |
OLD | NEW |