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

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 251013002: Split GrResource into GrCacheable/GrGpuObject (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 int maxVertex = startVertex + vertexCount; 354 int maxVertex = startVertex + vertexCount;
355 int maxValidVertex; 355 int maxValidVertex;
356 switch (geoSrc.fVertexSrc) { 356 switch (geoSrc.fVertexSrc) {
357 case kNone_GeometrySrcType: 357 case kNone_GeometrySrcType:
358 GrCrash("Attempting to draw without vertex src."); 358 GrCrash("Attempting to draw without vertex src.");
359 case kReserved_GeometrySrcType: // fallthrough 359 case kReserved_GeometrySrcType: // fallthrough
360 case kArray_GeometrySrcType: 360 case kArray_GeometrySrcType:
361 maxValidVertex = geoSrc.fVertexCount; 361 maxValidVertex = geoSrc.fVertexCount;
362 break; 362 break;
363 case kBuffer_GeometrySrcType: 363 case kBuffer_GeometrySrcType:
364 maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->sizeInBytes( ) / geoSrc.fVertexSize); 364 maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->gpuMemorySiz e() / geoSrc.fVertexSize);
365 break; 365 break;
366 } 366 }
367 if (maxVertex > maxValidVertex) { 367 if (maxVertex > maxValidVertex) {
368 GrCrash("Drawing outside valid vertex range."); 368 GrCrash("Drawing outside valid vertex range.");
369 } 369 }
370 if (indexCount > 0) { 370 if (indexCount > 0) {
371 int maxIndex = startIndex + indexCount; 371 int maxIndex = startIndex + indexCount;
372 int maxValidIndex; 372 int maxValidIndex;
373 switch (geoSrc.fIndexSrc) { 373 switch (geoSrc.fIndexSrc) {
374 case kNone_GeometrySrcType: 374 case kNone_GeometrySrcType:
375 GrCrash("Attempting to draw indexed geom without index src."); 375 GrCrash("Attempting to draw indexed geom without index src.");
376 case kReserved_GeometrySrcType: // fallthrough 376 case kReserved_GeometrySrcType: // fallthrough
377 case kArray_GeometrySrcType: 377 case kArray_GeometrySrcType:
378 maxValidIndex = geoSrc.fIndexCount; 378 maxValidIndex = geoSrc.fIndexCount;
379 break; 379 break;
380 case kBuffer_GeometrySrcType: 380 case kBuffer_GeometrySrcType:
381 maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->sizeInByte s() / sizeof(uint16_t)); 381 maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemoryS ize() / sizeof(uint16_t));
382 break; 382 break;
383 } 383 }
384 if (maxIndex > maxValidIndex) { 384 if (maxIndex > maxValidIndex) {
385 GrCrash("Index reads outside valid index range."); 385 GrCrash("Index reads outside valid index range.");
386 } 386 }
387 } 387 }
388 388
389 SkASSERT(NULL != drawState.getRenderTarget()); 389 SkASSERT(NULL != drawState.getRenderTarget());
390 390
391 for (int s = 0; s < drawState.numColorStages(); ++s) { 391 for (int s = 0; s < drawState.numColorStages(); ++s) {
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) { 1101 for (size_t i = 0; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
1102 if (i != kUnknown_GrPixelConfig) { 1102 if (i != kUnknown_GrPixelConfig) {
1103 r.appendf("%s is renderable: %s, with MSAA: %s\n", 1103 r.appendf("%s is renderable: %s, with MSAA: %s\n",
1104 kConfigNames[i], 1104 kConfigNames[i],
1105 gNY[fConfigRenderSupport[i][0]], 1105 gNY[fConfigRenderSupport[i][0]],
1106 gNY[fConfigRenderSupport[i][1]]); 1106 gNY[fConfigRenderSupport[i][1]]);
1107 } 1107 }
1108 } 1108 }
1109 return r; 1109 return r;
1110 } 1110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698