Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (!glInterface) { 166 if (!glInterface) {
167 glInterface.reset(GrGLDefaultInterface()); 167 glInterface.reset(GrGLDefaultInterface());
168 } else { 168 } else {
169 glInterface->ref(); 169 glInterface->ref();
170 } 170 }
171 if (!glInterface) { 171 if (!glInterface) {
172 return NULL; 172 return NULL;
173 } 173 }
174 GrGLContext* glContext = GrGLContext::Create(glInterface, options); 174 GrGLContext* glContext = GrGLContext::Create(glInterface, options);
175 if (glContext) { 175 if (glContext) {
176 return SkNEW_ARGS(GrGLGpu, (glContext, context)); 176 return new GrGLGpu(glContext, context);
177 } 177 }
178 return NULL; 178 return NULL;
179 } 179 }
180 180
181 static bool gPrintStartupSpew; 181 static bool gPrintStartupSpew;
182 182
183 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) 183 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context)
184 : GrGpu(context) 184 : GrGpu(context)
185 , fGLContext(ctx) { 185 , fGLContext(ctx) {
186 SkASSERT(ctx); 186 SkASSERT(ctx);
(...skipping 13 matching lines...) Expand all
200 this); 200 this);
201 SkDebugf("------ VENDOR %s\n", vendor); 201 SkDebugf("------ VENDOR %s\n", vendor);
202 SkDebugf("------ RENDERER %s\n", renderer); 202 SkDebugf("------ RENDERER %s\n", renderer);
203 SkDebugf("------ VERSION %s\n", version); 203 SkDebugf("------ VERSION %s\n", version);
204 SkDebugf("------ EXTENSIONS\n"); 204 SkDebugf("------ EXTENSIONS\n");
205 this->glContext().extensions().print(); 205 this->glContext().extensions().print();
206 SkDebugf("\n"); 206 SkDebugf("\n");
207 SkDebugf("%s", this->glCaps().dump().c_str()); 207 SkDebugf("%s", this->glCaps().dump().c_str());
208 } 208 }
209 209
210 fProgramCache = SkNEW_ARGS(ProgramCache, (this)); 210 fProgramCache = new ProgramCache(this);
211 211
212 SkASSERT(this->glCaps().maxVertexAttributes() >= GrGeometryProcessor::kMaxVe rtexAttribs); 212 SkASSERT(this->glCaps().maxVertexAttributes() >= GrGeometryProcessor::kMaxVe rtexAttribs);
213 213
214 fLastSuccessfulStencilFmtIdx = 0; 214 fLastSuccessfulStencilFmtIdx = 0;
215 fHWProgramID = 0; 215 fHWProgramID = 0;
216 fTempSrcFBOID = 0; 216 fTempSrcFBOID = 0;
217 fTempDstFBOID = 0; 217 fTempDstFBOID = 0;
218 fStencilClearFBOID = 0; 218 fStencilClearFBOID = 0;
219 219
220 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { 220 if (this->glCaps().shaderCaps()->pathRenderingSupport()) {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 surfDesc.fOrigin = desc.fOrigin; 442 surfDesc.fOrigin = desc.fOrigin;
443 } 443 }
444 444
445 GrGLTexture* texture = NULL; 445 GrGLTexture* texture = NULL;
446 if (renderTarget) { 446 if (renderTarget) {
447 GrGLRenderTarget::IDDesc rtIDDesc; 447 GrGLRenderTarget::IDDesc rtIDDesc;
448 if (!this->createRenderTargetObjects(surfDesc, GrGpuResource::kUncached_ LifeCycle, 448 if (!this->createRenderTargetObjects(surfDesc, GrGpuResource::kUncached_ LifeCycle,
449 idDesc.fTextureID, &rtIDDesc)) { 449 idDesc.fTextureID, &rtIDDesc)) {
450 return NULL; 450 return NULL;
451 } 451 }
452 texture = SkNEW_ARGS(GrGLTextureRenderTarget, (this, surfDesc, idDesc, r tIDDesc)); 452 texture = new GrGLTextureRenderTarget(this, surfDesc, idDesc, rtIDDesc);
453 } else { 453 } else {
454 texture = SkNEW_ARGS(GrGLTexture, (this, surfDesc, idDesc)); 454 texture = new GrGLTexture(this, surfDesc, idDesc);
455 } 455 }
456 if (NULL == texture) { 456 if (NULL == texture) {
457 return NULL; 457 return NULL;
458 } 458 }
459 459
460 return texture; 460 return texture;
461 } 461 }
462 462
463 GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe sc& wrapDesc, 463 GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe sc& wrapDesc,
464 GrWrapOwnership ownership) { 464 GrWrapOwnership ownership) {
(...skipping 12 matching lines...) Expand all
477 idDesc.fSampleConfig = GrRenderTarget::kUnified_SampleConfig; 477 idDesc.fSampleConfig = GrRenderTarget::kUnified_SampleConfig;
478 478
479 GrSurfaceDesc desc; 479 GrSurfaceDesc desc;
480 desc.fConfig = wrapDesc.fConfig; 480 desc.fConfig = wrapDesc.fConfig;
481 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; 481 desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag;
482 desc.fWidth = wrapDesc.fWidth; 482 desc.fWidth = wrapDesc.fWidth;
483 desc.fHeight = wrapDesc.fHeight; 483 desc.fHeight = wrapDesc.fHeight;
484 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() ); 484 desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount() );
485 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); 485 desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
486 486
487 GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, desc, idDesc)); 487 GrRenderTarget* tgt = new GrGLRenderTarget(this, desc, idDesc);
488 if (wrapDesc.fStencilBits) { 488 if (wrapDesc.fStencilBits) {
489 GrGLStencilAttachment::IDDesc sbDesc; 489 GrGLStencilAttachment::IDDesc sbDesc;
490 GrGLStencilAttachment::Format format; 490 GrGLStencilAttachment::Format format;
491 format.fInternalFormat = GrGLStencilAttachment::kUnknownInternalFormat; 491 format.fInternalFormat = GrGLStencilAttachment::kUnknownInternalFormat;
492 format.fPacked = false; 492 format.fPacked = false;
493 format.fStencilBits = wrapDesc.fStencilBits; 493 format.fStencilBits = wrapDesc.fStencilBits;
494 format.fTotalBits = wrapDesc.fStencilBits; 494 format.fTotalBits = wrapDesc.fStencilBits;
495 GrGLStencilAttachment* sb = SkNEW_ARGS(GrGLStencilAttachment, 495 GrGLStencilAttachment* sb = new GrGLStencilAttachment(
496 (this, 496 this, sbDesc, desc.fWidth, desc.fHeight, desc.fSampleCnt, format );
497 sbDesc,
498 desc.fWidth,
499 desc.fHeight,
500 desc.fSampleCnt,
501 format));
502 tgt->renderTargetPriv().didAttachStencilAttachment(sb); 497 tgt->renderTargetPriv().didAttachStencilAttachment(sb);
503 sb->unref(); 498 sb->unref();
504 } 499 }
505 return tgt; 500 return tgt;
506 } 501 }
507 502
508 //////////////////////////////////////////////////////////////////////////////// 503 ////////////////////////////////////////////////////////////////////////////////
509 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 504 bool GrGLGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
510 size_t rowBytes, GrPixelConfig srcConfig, 505 size_t rowBytes, GrPixelConfig srcConfig,
511 DrawPreference* drawPreference, 506 DrawPreference* drawPreference,
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 GrGLTexture* tex; 1071 GrGLTexture* tex;
1077 if (renderTarget) { 1072 if (renderTarget) {
1078 // unbind the texture from the texture unit before binding it to the fra me buffer 1073 // unbind the texture from the texture unit before binding it to the fra me buffer
1079 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, 0)); 1074 GL_CALL(BindTexture(GR_GL_TEXTURE_2D, 0));
1080 GrGLRenderTarget::IDDesc rtIDDesc; 1075 GrGLRenderTarget::IDDesc rtIDDesc;
1081 1076
1082 if (!this->createRenderTargetObjects(desc, lifeCycle, idDesc.fTextureID, &rtIDDesc)) { 1077 if (!this->createRenderTargetObjects(desc, lifeCycle, idDesc.fTextureID, &rtIDDesc)) {
1083 GL_CALL(DeleteTextures(1, &idDesc.fTextureID)); 1078 GL_CALL(DeleteTextures(1, &idDesc.fTextureID));
1084 return return_null_texture(); 1079 return return_null_texture();
1085 } 1080 }
1086 tex = SkNEW_ARGS(GrGLTextureRenderTarget, (this, desc, idDesc, rtIDDesc) ); 1081 tex = new GrGLTextureRenderTarget(this, desc, idDesc, rtIDDesc);
1087 } else { 1082 } else {
1088 tex = SkNEW_ARGS(GrGLTexture, (this, desc, idDesc)); 1083 tex = new GrGLTexture(this, desc, idDesc);
1089 } 1084 }
1090 tex->setCachedTexParams(initialTexParams, this->getResetTimestamp()); 1085 tex->setCachedTexParams(initialTexParams, this->getResetTimestamp());
1091 #ifdef TRACE_TEXTURE_CREATION 1086 #ifdef TRACE_TEXTURE_CREATION
1092 SkDebugf("--- new texture [%d] size=(%d %d) config=%d\n", 1087 SkDebugf("--- new texture [%d] size=(%d %d) config=%d\n",
1093 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig); 1088 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig);
1094 #endif 1089 #endif
1095 return tex; 1090 return tex;
1096 } 1091 }
1097 1092
1098 GrTexture* GrGLGpu::onCreateCompressedTexture(const GrSurfaceDesc& desc, 1093 GrTexture* GrGLGpu::onCreateCompressedTexture(const GrSurfaceDesc& desc,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, 1131 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D,
1137 GR_GL_TEXTURE_WRAP_T, 1132 GR_GL_TEXTURE_WRAP_T,
1138 initialTexParams.fWrapT)); 1133 initialTexParams.fWrapT));
1139 1134
1140 if (!this->uploadCompressedTexData(desc, srcData)) { 1135 if (!this->uploadCompressedTexData(desc, srcData)) {
1141 GL_CALL(DeleteTextures(1, &idDesc.fTextureID)); 1136 GL_CALL(DeleteTextures(1, &idDesc.fTextureID));
1142 return return_null_texture(); 1137 return return_null_texture();
1143 } 1138 }
1144 1139
1145 GrGLTexture* tex; 1140 GrGLTexture* tex;
1146 tex = SkNEW_ARGS(GrGLTexture, (this, desc, idDesc)); 1141 tex = new GrGLTexture(this, desc, idDesc);
1147 tex->setCachedTexParams(initialTexParams, this->getResetTimestamp()); 1142 tex->setCachedTexParams(initialTexParams, this->getResetTimestamp());
1148 #ifdef TRACE_TEXTURE_CREATION 1143 #ifdef TRACE_TEXTURE_CREATION
1149 SkDebugf("--- new compressed texture [%d] size=(%d %d) config=%d\n", 1144 SkDebugf("--- new compressed texture [%d] size=(%d %d) config=%d\n",
1150 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig); 1145 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig);
1151 #endif 1146 #endif
1152 return tex; 1147 return tex;
1153 } 1148 }
1154 1149
1155 namespace { 1150 namespace {
1156 1151
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 sFmt.fInterna lFormat, 1211 sFmt.fInterna lFormat,
1217 width, height )); 1212 width, height ));
1218 created = (GR_GL_NO_ERROR == check_alloc_error(rt->desc(), this->glI nterface())); 1213 created = (GR_GL_NO_ERROR == check_alloc_error(rt->desc(), this->glI nterface()));
1219 } 1214 }
1220 if (created) { 1215 if (created) {
1221 fStats.incStencilAttachmentCreates(); 1216 fStats.incStencilAttachmentCreates();
1222 // After sized formats we attempt an unsized format and take 1217 // After sized formats we attempt an unsized format and take
1223 // whatever sizes GL gives us. In that case we query for the size. 1218 // whatever sizes GL gives us. In that case we query for the size.
1224 GrGLStencilAttachment::Format format = sFmt; 1219 GrGLStencilAttachment::Format format = sFmt;
1225 get_stencil_rb_sizes(this->glInterface(), &format); 1220 get_stencil_rb_sizes(this->glInterface(), &format);
1226 SkAutoTUnref<GrGLStencilAttachment> sb(SkNEW_ARGS(GrGLStencilAttachm ent, 1221 SkAutoTUnref<GrGLStencilAttachment> sb(
1227 (this, sbDesc, width, height, samples, format))); 1222 new GrGLStencilAttachment(this, sbDesc, width, height, sampl es, format));
1228 if (this->attachStencilAttachmentToRenderTarget(sb, rt)) { 1223 if (this->attachStencilAttachmentToRenderTarget(sb, rt)) {
1229 fLastSuccessfulStencilFmtIdx = sIdx; 1224 fLastSuccessfulStencilFmtIdx = sIdx;
1230 rt->renderTargetPriv().didAttachStencilAttachment(sb); 1225 rt->renderTargetPriv().didAttachStencilAttachment(sb);
1231 // This work around is currently breaking on windows 7 hd2000 bot when we bind a color buffer 1226 // This work around is currently breaking on windows 7 hd2000 bot when we bind a color buffer
1232 #if 0 1227 #if 0
1233 // Clear the stencil buffer. We use a special purpose FBO for th is so that the 1228 // Clear the stencil buffer. We use a special purpose FBO for th is so that the
1234 // entire stencil buffer is cleared, even if it is attached to a n FBO with a 1229 // entire stencil buffer is cleared, even if it is attached to a n FBO with a
1235 // smaller color target. 1230 // smaller color target.
1236 if (0 == fStencilClearFBOID) { 1231 if (0 == fStencilClearFBOID) {
1237 GL_CALL(GenFramebuffers(1, &fStencilClearFBOID)); 1232 GL_CALL(GenFramebuffers(1, &fStencilClearFBOID));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1354
1360 //////////////////////////////////////////////////////////////////////////////// 1355 ////////////////////////////////////////////////////////////////////////////////
1361 1356
1362 GrVertexBuffer* GrGLGpu::onCreateVertexBuffer(size_t size, bool dynamic) { 1357 GrVertexBuffer* GrGLGpu::onCreateVertexBuffer(size_t size, bool dynamic) {
1363 GrGLVertexBuffer::Desc desc; 1358 GrGLVertexBuffer::Desc desc;
1364 desc.fDynamic = dynamic; 1359 desc.fDynamic = dynamic;
1365 desc.fSizeInBytes = size; 1360 desc.fSizeInBytes = size;
1366 1361
1367 if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) { 1362 if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
1368 desc.fID = 0; 1363 desc.fID = 0;
1369 GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer, (this, des c)); 1364 GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, desc);
1370 return vertexBuffer; 1365 return vertexBuffer;
1371 } else { 1366 } else {
1372 GL_CALL(GenBuffers(1, &desc.fID)); 1367 GL_CALL(GenBuffers(1, &desc.fID));
1373 if (desc.fID) { 1368 if (desc.fID) {
1374 fHWGeometryState.setVertexBufferID(this, desc.fID); 1369 fHWGeometryState.setVertexBufferID(this, desc.fID);
1375 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); 1370 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
1376 // make sure driver can allocate memory for this buffer 1371 // make sure driver can allocate memory for this buffer
1377 GL_ALLOC_CALL(this->glInterface(), 1372 GL_ALLOC_CALL(this->glInterface(),
1378 BufferData(GR_GL_ARRAY_BUFFER, 1373 BufferData(GR_GL_ARRAY_BUFFER,
1379 (GrGLsizeiptr) desc.fSizeInBytes, 1374 (GrGLsizeiptr) desc.fSizeInBytes,
1380 NULL, // data ptr 1375 NULL, // data ptr
1381 desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_ STATIC_DRAW)); 1376 desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_ STATIC_DRAW));
1382 if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) { 1377 if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
1383 GL_CALL(DeleteBuffers(1, &desc.fID)); 1378 GL_CALL(DeleteBuffers(1, &desc.fID));
1384 this->notifyVertexBufferDelete(desc.fID); 1379 this->notifyVertexBufferDelete(desc.fID);
1385 return NULL; 1380 return NULL;
1386 } 1381 }
1387 GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer, (this, desc)); 1382 GrGLVertexBuffer* vertexBuffer = new GrGLVertexBuffer(this, desc);
1388 return vertexBuffer; 1383 return vertexBuffer;
1389 } 1384 }
1390 return NULL; 1385 return NULL;
1391 } 1386 }
1392 } 1387 }
1393 1388
1394 GrIndexBuffer* GrGLGpu::onCreateIndexBuffer(size_t size, bool dynamic) { 1389 GrIndexBuffer* GrGLGpu::onCreateIndexBuffer(size_t size, bool dynamic) {
1395 GrGLIndexBuffer::Desc desc; 1390 GrGLIndexBuffer::Desc desc;
1396 desc.fDynamic = dynamic; 1391 desc.fDynamic = dynamic;
1397 desc.fSizeInBytes = size; 1392 desc.fSizeInBytes = size;
1398 1393
1399 if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) { 1394 if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
1400 desc.fID = 0; 1395 desc.fID = 0;
1401 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc)); 1396 GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, desc);
1402 return indexBuffer; 1397 return indexBuffer;
1403 } else { 1398 } else {
1404 GL_CALL(GenBuffers(1, &desc.fID)); 1399 GL_CALL(GenBuffers(1, &desc.fID));
1405 if (desc.fID) { 1400 if (desc.fID) {
1406 fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, desc.fID ); 1401 fHWGeometryState.setIndexBufferIDOnDefaultVertexArray(this, desc.fID );
1407 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface()); 1402 CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
1408 // make sure driver can allocate memory for this buffer 1403 // make sure driver can allocate memory for this buffer
1409 GL_ALLOC_CALL(this->glInterface(), 1404 GL_ALLOC_CALL(this->glInterface(),
1410 BufferData(GR_GL_ELEMENT_ARRAY_BUFFER, 1405 BufferData(GR_GL_ELEMENT_ARRAY_BUFFER,
1411 (GrGLsizeiptr) desc.fSizeInBytes, 1406 (GrGLsizeiptr) desc.fSizeInBytes,
1412 NULL, // data ptr 1407 NULL, // data ptr
1413 desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_ STATIC_DRAW)); 1408 desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_ STATIC_DRAW));
1414 if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) { 1409 if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
1415 GL_CALL(DeleteBuffers(1, &desc.fID)); 1410 GL_CALL(DeleteBuffers(1, &desc.fID));
1416 this->notifyIndexBufferDelete(desc.fID); 1411 this->notifyIndexBufferDelete(desc.fID);
1417 return NULL; 1412 return NULL;
1418 } 1413 }
1419 GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc )); 1414 GrIndexBuffer* indexBuffer = new GrGLIndexBuffer(this, desc);
1420 return indexBuffer; 1415 return indexBuffer;
1421 } 1416 }
1422 return NULL; 1417 return NULL;
1423 } 1418 }
1424 } 1419 }
1425 1420
1426 void GrGLGpu::flushScissor(const GrScissorState& scissorState, 1421 void GrGLGpu::flushScissor(const GrScissorState& scissorState,
1427 const GrGLIRect& rtViewport, 1422 const GrGLIRect& rtViewport,
1428 GrSurfaceOrigin rtOrigin) { 1423 GrSurfaceOrigin rtOrigin) {
1429 if (scissorState.enabled()) { 1424 if (scissorState.enabled()) {
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 GrGLAttribArrayState* GrGLGpu::HWGeometryState::internalBind(GrGLGpu* gpu, 3170 GrGLAttribArrayState* GrGLGpu::HWGeometryState::internalBind(GrGLGpu* gpu,
3176 GrGLuint vbufferID, 3171 GrGLuint vbufferID,
3177 GrGLuint* ibufferID ) { 3172 GrGLuint* ibufferID ) {
3178 GrGLAttribArrayState* attribState; 3173 GrGLAttribArrayState* attribState;
3179 3174
3180 if (gpu->glCaps().isCoreProfile() && 0 != vbufferID) { 3175 if (gpu->glCaps().isCoreProfile() && 0 != vbufferID) {
3181 if (!fVBOVertexArray) { 3176 if (!fVBOVertexArray) {
3182 GrGLuint arrayID; 3177 GrGLuint arrayID;
3183 GR_GL_CALL(gpu->glInterface(), GenVertexArrays(1, &arrayID)); 3178 GR_GL_CALL(gpu->glInterface(), GenVertexArrays(1, &arrayID));
3184 int attrCount = gpu->glCaps().maxVertexAttributes(); 3179 int attrCount = gpu->glCaps().maxVertexAttributes();
3185 fVBOVertexArray = SkNEW_ARGS(GrGLVertexArray, (arrayID, attrCount)); 3180 fVBOVertexArray = new GrGLVertexArray(arrayID, attrCount);
3186 } 3181 }
3187 if (ibufferID) { 3182 if (ibufferID) {
3188 attribState = fVBOVertexArray->bindWithIndexBuffer(gpu, *ibufferID); 3183 attribState = fVBOVertexArray->bindWithIndexBuffer(gpu, *ibufferID);
3189 } else { 3184 } else {
3190 attribState = fVBOVertexArray->bind(gpu); 3185 attribState = fVBOVertexArray->bind(gpu);
3191 } 3186 }
3192 } else { 3187 } else {
3193 if (ibufferID) { 3188 if (ibufferID) {
3194 this->setIndexBufferIDOnDefaultVertexArray(gpu, *ibufferID); 3189 this->setIndexBufferIDOnDefaultVertexArray(gpu, *ibufferID);
3195 } else { 3190 } else {
3196 this->setVertexArrayID(gpu, 0); 3191 this->setVertexArrayID(gpu, 0);
3197 } 3192 }
3198 int attrCount = gpu->glCaps().maxVertexAttributes(); 3193 int attrCount = gpu->glCaps().maxVertexAttributes();
3199 if (fDefaultVertexArrayAttribState.count() != attrCount) { 3194 if (fDefaultVertexArrayAttribState.count() != attrCount) {
3200 fDefaultVertexArrayAttribState.resize(attrCount); 3195 fDefaultVertexArrayAttribState.resize(attrCount);
3201 } 3196 }
3202 attribState = &fDefaultVertexArrayAttribState; 3197 attribState = &fDefaultVertexArrayAttribState;
3203 } 3198 }
3204 return attribState; 3199 return attribState;
3205 } 3200 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698