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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 fStats.incStencilBufferCreates(); | 1175 fStats.incStencilBufferCreates(); |
1176 // After sized formats we attempt an unsized format and take | 1176 // After sized formats we attempt an unsized format and take |
1177 // whatever sizes GL gives us. In that case we query for the size. | 1177 // whatever sizes GL gives us. In that case we query for the size. |
1178 GrGLStencilBuffer::Format format = sFmt; | 1178 GrGLStencilBuffer::Format format = sFmt; |
1179 get_stencil_rb_sizes(this->glInterface(), &format); | 1179 get_stencil_rb_sizes(this->glInterface(), &format); |
1180 SkAutoTUnref<GrGLStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, | 1180 SkAutoTUnref<GrGLStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, |
1181 (this, sbDesc, width, height,
samples, format))); | 1181 (this, sbDesc, width, height,
samples, format))); |
1182 if (this->attachStencilBufferToRenderTarget(sb, rt)) { | 1182 if (this->attachStencilBufferToRenderTarget(sb, rt)) { |
1183 fLastSuccessfulStencilFmtIdx = sIdx; | 1183 fLastSuccessfulStencilFmtIdx = sIdx; |
1184 rt->renderTargetPriv().didAttachStencilBuffer(sb); | 1184 rt->renderTargetPriv().didAttachStencilBuffer(sb); |
1185 | 1185 // This work around is currently breaking on windows 7 hd2000 bot when we bind a
color buffer |
| 1186 #if 0 |
1186 // Clear the stencil buffer. We use a special purpose FBO for th
is so that the | 1187 // Clear the stencil buffer. We use a special purpose FBO for th
is so that the |
1187 // entire stencil buffer is cleared, even if it is attached to a
n FBO with a | 1188 // entire stencil buffer is cleared, even if it is attached to a
n FBO with a |
1188 // smaller color target. | 1189 // smaller color target. |
1189 if (0 == fStencilClearFBOID) { | 1190 if (0 == fStencilClearFBOID) { |
1190 GL_CALL(GenFramebuffers(1, &fStencilClearFBOID)); | 1191 GL_CALL(GenFramebuffers(1, &fStencilClearFBOID)); |
1191 } | 1192 } |
1192 | 1193 |
1193 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fStencilClearFBOID)); | 1194 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, fStencilClearFBOID)); |
1194 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; | 1195 fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; |
1195 fStats.incRenderTargetBinds(); | 1196 fStats.incRenderTargetBinds(); |
(...skipping 30 matching lines...) Expand all Loading... |
1226 | 1227 |
1227 // Unbind the SB from the FBO so that we don't keep it alive. | 1228 // Unbind the SB from the FBO so that we don't keep it alive. |
1228 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1229 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1229 GR_GL_STENCIL_ATTACHMENT, | 1230 GR_GL_STENCIL_ATTACHMENT, |
1230 GR_GL_RENDERBUFFER, 0)); | 1231 GR_GL_RENDERBUFFER, 0)); |
1231 if (sFmt.fPacked) { | 1232 if (sFmt.fPacked) { |
1232 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, | 1233 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, |
1233 GR_GL_DEPTH_ATTACHMENT, | 1234 GR_GL_DEPTH_ATTACHMENT, |
1234 GR_GL_RENDERBUFFER, 0)); | 1235 GR_GL_RENDERBUFFER, 0)); |
1235 } | 1236 } |
1236 | 1237 #endif |
1237 return true; | 1238 return true; |
1238 } | 1239 } |
1239 // Remove the scratch key from this resource so we don't grab it fro
m the cache ever | 1240 // Remove the scratch key from this resource so we don't grab it fro
m the cache ever |
1240 // again. | 1241 // again. |
1241 sb->resourcePriv().removeScratchKey(); | 1242 sb->resourcePriv().removeScratchKey(); |
1242 // Set this to 0 since we handed the valid ID off to the failed sten
cil buffer resource. | 1243 // Set this to 0 since we handed the valid ID off to the failed sten
cil buffer resource. |
1243 sbDesc.fRenderbufferID = 0; | 1244 sbDesc.fRenderbufferID = 0; |
1244 } | 1245 } |
1245 } | 1246 } |
1246 GL_CALL(DeleteRenderbuffers(1, &sbDesc.fRenderbufferID)); | 1247 GL_CALL(DeleteRenderbuffers(1, &sbDesc.fRenderbufferID)); |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 this->setVertexArrayID(gpu, 0); | 2816 this->setVertexArrayID(gpu, 0); |
2816 } | 2817 } |
2817 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2818 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2818 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2819 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2819 fDefaultVertexArrayAttribState.resize(attrCount); | 2820 fDefaultVertexArrayAttribState.resize(attrCount); |
2820 } | 2821 } |
2821 attribState = &fDefaultVertexArrayAttribState; | 2822 attribState = &fDefaultVertexArrayAttribState; |
2822 } | 2823 } |
2823 return attribState; | 2824 return attribState; |
2824 } | 2825 } |
OLD | NEW |