| 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 |
| 1213 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 1225 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
| 1214 | 1226 |
| 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 |
| 1215 // Unbind the SB from the FBO so that we don't keep it alive. | 1234 // Unbind the SB from the FBO so that we don't keep it alive. |
| 1216 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1235 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1217 GR_GL_STENCIL_ATTACHMENT, | 1236 GR_GL_STENCIL_ATTACHMENT, |
| 1218 GR_GL_RENDERBUFFER, 0)); | 1237 GR_GL_RENDERBUFFER, 0)); |
| 1219 if (sFmt.fPacked) { | 1238 if (sFmt.fPacked) { |
| 1220 GL_CALL(FramebufferRenderbuffer(fboTarget, | 1239 GL_CALL(FramebufferRenderbuffer(fboTarget, |
| 1221 GR_GL_DEPTH_ATTACHMENT, | 1240 GR_GL_DEPTH_ATTACHMENT, |
| 1222 GR_GL_RENDERBUFFER, 0)); | 1241 GR_GL_RENDERBUFFER, 0)); |
| 1223 } | 1242 } |
| 1224 | 1243 |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2822 this->setVertexArrayID(gpu, 0); | 2841 this->setVertexArrayID(gpu, 0); |
| 2823 } | 2842 } |
| 2824 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2843 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2825 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2844 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2826 fDefaultVertexArrayAttribState.resize(attrCount); | 2845 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2827 } | 2846 } |
| 2828 attribState = &fDefaultVertexArrayAttribState; | 2847 attribState = &fDefaultVertexArrayAttribState; |
| 2829 } | 2848 } |
| 2830 return attribState; | 2849 return attribState; |
| 2831 } | 2850 } |
| OLD | NEW |