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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1196 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1197 GR_GL_STENCIL_ATTACHMENT, | 1197 GR_GL_STENCIL_ATTACHMENT, |
1198 GR_GL_RENDERBUFFER, sbDesc.fRend
erbufferID)); | 1198 GR_GL_RENDERBUFFER, sbDesc.fRend
erbufferID)); |
1199 if (sFmt.fPacked) { | 1199 if (sFmt.fPacked) { |
1200 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1200 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1201 GR_GL_DEPTH_ATTACHMENT, | 1201 GR_GL_DEPTH_ATTACHMENT, |
1202 GR_GL_RENDERBUFFER, sbDesc.f
RenderbufferID)); | 1202 GR_GL_RENDERBUFFER, sbDesc.f
RenderbufferID)); |
1203 } | 1203 } |
1204 | 1204 |
1205 GL_CALL(ClearStencil(0)); | 1205 GL_CALL(ClearStencil(0)); |
| 1206 // Many GL implementations seem to have trouble with clearing an
FBO with only |
| 1207 // a stencil buffer. |
| 1208 GrGLuint tempRB; |
| 1209 GL_CALL(GenRenderbuffers(1, &tempRB)); |
| 1210 GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, tempRB)); |
| 1211 GL_CALL(RenderbufferStorage(GR_GL_RENDERBUFFER, GR_GL_RGBA8, wid
th, height)); |
| 1212 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 1213 GR_GL_COLOR_ATTACHMENT0, |
| 1214 GR_GL_RENDERBUFFER, tempRB)); |
| 1215 |
1206 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); | 1216 GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT)); |
1207 | 1217 |
| 1218 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
| 1219 GR_GL_COLOR_ATTACHMENT0, |
| 1220 GR_GL_RENDERBUFFER, 0)); |
| 1221 GL_CALL(DeleteRenderbuffers(1, &tempRB)); |
| 1222 |
1208 // Unbind the SB from the FBO so that we don't keep it alive. | 1223 // Unbind the SB from the FBO so that we don't keep it alive. |
1209 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1224 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1210 GR_GL_STENCIL_ATTACHMENT, | 1225 GR_GL_STENCIL_ATTACHMENT, |
1211 GR_GL_RENDERBUFFER, 0)); | 1226 GR_GL_RENDERBUFFER, 0)); |
1212 if (sFmt.fPacked) { | 1227 if (sFmt.fPacked) { |
1213 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1228 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1214 GR_GL_DEPTH_ATTACHMENT, | 1229 GR_GL_DEPTH_ATTACHMENT, |
1215 GR_GL_RENDERBUFFER, 0)); | 1230 GR_GL_RENDERBUFFER, 0)); |
1216 } | 1231 } |
1217 | 1232 |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 this->setVertexArrayID(gpu, 0); | 2811 this->setVertexArrayID(gpu, 0); |
2797 } | 2812 } |
2798 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2813 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2799 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2814 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2800 fDefaultVertexArrayAttribState.resize(attrCount); | 2815 fDefaultVertexArrayAttribState.resize(attrCount); |
2801 } | 2816 } |
2802 attribState = &fDefaultVertexArrayAttribState; | 2817 attribState = &fDefaultVertexArrayAttribState; |
2803 } | 2818 } |
2804 return attribState; | 2819 return attribState; |
2805 } | 2820 } |
OLD | NEW |