| 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" |
| 11 #include "GrGLTextureRenderTarget.h" | 11 #include "GrGLTextureRenderTarget.h" |
| 12 #include "GrGpuResourceCacheAccess.h" | 12 #include "GrGpuResourcePriv.h" |
| 13 #include "GrPipeline.h" | 13 #include "GrPipeline.h" |
| 14 #include "GrSurfacePriv.h" | 14 #include "GrSurfacePriv.h" |
| 15 #include "GrTemplates.h" | 15 #include "GrTemplates.h" |
| 16 #include "GrTexturePriv.h" | 16 #include "GrTexturePriv.h" |
| 17 #include "GrTypes.h" | 17 #include "GrTypes.h" |
| 18 #include "SkStrokeRec.h" | 18 #include "SkStrokeRec.h" |
| 19 #include "SkTemplates.h" | 19 #include "SkTemplates.h" |
| 20 | 20 |
| 21 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 21 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
| 22 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) | 22 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 get_stencil_rb_sizes(this->glInterface(), &format); | 1179 get_stencil_rb_sizes(this->glInterface(), &format); |
| 1180 SkAutoTUnref<GrStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, | 1180 SkAutoTUnref<GrStencilBuffer> 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->setStencilBuffer(sb); | 1184 rt->setStencilBuffer(sb); |
| 1185 return true; | 1185 return true; |
| 1186 } | 1186 } |
| 1187 // Remove the scratch key from this resource so we don't grab it fro
m the cache ever | 1187 // Remove the scratch key from this resource so we don't grab it fro
m the cache ever |
| 1188 // again. | 1188 // again. |
| 1189 sb->cacheAccess().removeScratchKey(); | 1189 sb->resourcePriv().removeScratchKey(); |
| 1190 // Set this to 0 since we handed the valid ID off to the failed sten
cil buffer resource. | 1190 // Set this to 0 since we handed the valid ID off to the failed sten
cil buffer resource. |
| 1191 sbDesc.fRenderbufferID = 0; | 1191 sbDesc.fRenderbufferID = 0; |
| 1192 } | 1192 } |
| 1193 } | 1193 } |
| 1194 GL_CALL(DeleteRenderbuffers(1, &sbDesc.fRenderbufferID)); | 1194 GL_CALL(DeleteRenderbuffers(1, &sbDesc.fRenderbufferID)); |
| 1195 return false; | 1195 return false; |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 bool GrGLGpu::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
get* rt) { | 1198 bool GrGLGpu::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar
get* rt) { |
| 1199 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); | 1199 GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 this->setVertexArrayID(gpu, 0); | 2763 this->setVertexArrayID(gpu, 0); |
| 2764 } | 2764 } |
| 2765 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2765 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2766 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2766 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2767 fDefaultVertexArrayAttribState.resize(attrCount); | 2767 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2768 } | 2768 } |
| 2769 attribState = &fDefaultVertexArrayAttribState; | 2769 attribState = &fDefaultVertexArrayAttribState; |
| 2770 } | 2770 } |
| 2771 return attribState; | 2771 return attribState; |
| 2772 } | 2772 } |
| OLD | NEW |