| 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 "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1203 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1204 GR_GL_STENCIL_ATTACHMENT, | 1204 GR_GL_STENCIL_ATTACHMENT, |
| 1205 GR_GL_RENDERBUFFER, sbDesc.fRend
erbufferID)); | 1205 GR_GL_RENDERBUFFER, sbDesc.fRend
erbufferID)); |
| 1206 if (sFmt.fPacked) { | 1206 if (sFmt.fPacked) { |
| 1207 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1207 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1208 GR_GL_DEPTH_ATTACHMENT, | 1208 GR_GL_DEPTH_ATTACHMENT, |
| 1209 GR_GL_RENDERBUFFER, sbDesc.f
RenderbufferID)); | 1209 GR_GL_RENDERBUFFER, sbDesc.f
RenderbufferID)); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 GL_CALL(ClearStencil(0)); | 1212 GL_CALL(ClearStencil(0)); |
| 1213 // At least some versions of the SGX 54x driver can't handle cle
aring a stencil | |
| 1214 // buffer without a color buffer and will crash. | |
| 1215 GrGLuint tempRB = 0; | |
| 1216 if (kPowerVR54x_GrGLRenderer == this->ctxInfo().renderer()) { | |
| 1217 GL_CALL(GenRenderbuffers(1, &tempRB)); | |
| 1218 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, tempRB)); | |
| 1219 GL_CALL(RenderbufferStorage(GR_GL_RENDERBUFFER, GR_GL_RGBA8,
width, height)); | |
| 1220 GL_CALL(FramebufferRenderbuffer(fboTarget, | |
| 1221 GR_GL_COLOR_ATTACHMENT0, | |
| 1222 GR_GL_RENDERBUFFER, tempRB))
; | |
| 1223 } | |
| 1224 | |
| 1225 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 1213 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
| 1226 | 1214 |
| 1227 if (tempRB) { | |
| 1228 GL_CALL(FramebufferRenderbuffer(fboTarget, | |
| 1229 GR_GL_COLOR_ATTACHMENT0, | |
| 1230 GR_GL_RENDERBUFFER, 0)); | |
| 1231 GL_CALL(DeleteRenderbuffers(1, &tempRB)); | |
| 1232 } | |
| 1233 | |
| 1234 // Unbind the SB from the FBO so that we don't keep it alive. | 1215 // Unbind the SB from the FBO so that we don't keep it alive. |
| 1235 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1216 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1236 GR_GL_STENCIL_ATTACHMENT, | 1217 GR_GL_STENCIL_ATTACHMENT, |
| 1237 GR_GL_RENDERBUFFER, 0)); | 1218 GR_GL_RENDERBUFFER, 0)); |
| 1238 if (sFmt.fPacked) { | 1219 if (sFmt.fPacked) { |
| 1239 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1220 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1240 GR_GL_DEPTH_ATTACHMENT, | 1221 GR_GL_DEPTH_ATTACHMENT, |
| 1241 GR_GL_RENDERBUFFER, 0)); | 1222 GR_GL_RENDERBUFFER, 0)); |
| 1242 } | 1223 } |
| 1243 | 1224 |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 this->setVertexArrayID(gpu, 0); | 2822 this->setVertexArrayID(gpu, 0); |
| 2842 } | 2823 } |
| 2843 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2824 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2844 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2825 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2845 fDefaultVertexArrayAttribState.resize(attrCount); | 2826 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2846 } | 2827 } |
| 2847 attribState = &fDefaultVertexArrayAttribState; | 2828 attribState = &fDefaultVertexArrayAttribState; |
| 2848 } | 2829 } |
| 2849 return attribState; | 2830 return attribState; |
| 2850 } | 2831 } |
| OLD | NEW |