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

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

Issue 257393004: Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAIL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace change Created 6 years, 7 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
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 case kReserved_GeometrySrcType: 237 case kReserved_GeometrySrcType:
238 this->releaseReservedVertexSpace(); 238 this->releaseReservedVertexSpace();
239 break; 239 break;
240 case kBuffer_GeometrySrcType: 240 case kBuffer_GeometrySrcType:
241 geoSrc.fVertexBuffer->unref(); 241 geoSrc.fVertexBuffer->unref();
242 #ifdef SK_DEBUG 242 #ifdef SK_DEBUG
243 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; 243 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
244 #endif 244 #endif
245 break; 245 break;
246 default: 246 default:
247 GrCrash("Unknown Vertex Source Type."); 247 SkFAIL("Unknown Vertex Source Type.");
248 break; 248 break;
249 } 249 }
250 } 250 }
251 251
252 void GrDrawTarget::releasePreviousIndexSource() { 252 void GrDrawTarget::releasePreviousIndexSource() {
253 GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); 253 GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
254 switch (geoSrc.fIndexSrc) { 254 switch (geoSrc.fIndexSrc) {
255 case kNone_GeometrySrcType: // these two don't require 255 case kNone_GeometrySrcType: // these two don't require
256 break; 256 break;
257 case kArray_GeometrySrcType: 257 case kArray_GeometrySrcType:
258 this->releaseIndexArray(); 258 this->releaseIndexArray();
259 break; 259 break;
260 case kReserved_GeometrySrcType: 260 case kReserved_GeometrySrcType:
261 this->releaseReservedIndexSpace(); 261 this->releaseReservedIndexSpace();
262 break; 262 break;
263 case kBuffer_GeometrySrcType: 263 case kBuffer_GeometrySrcType:
264 geoSrc.fIndexBuffer->unref(); 264 geoSrc.fIndexBuffer->unref();
265 #ifdef SK_DEBUG 265 #ifdef SK_DEBUG
266 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; 266 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
267 #endif 267 #endif
268 break; 268 break;
269 default: 269 default:
270 GrCrash("Unknown Index Source Type."); 270 SkFAIL("Unknown Index Source Type.");
271 break; 271 break;
272 } 272 }
273 } 273 }
274 274
275 void GrDrawTarget::setVertexSourceToArray(const void* vertexArray, 275 void GrDrawTarget::setVertexSourceToArray(const void* vertexArray,
276 int vertexCount) { 276 int vertexCount) {
277 this->releasePreviousVertexSource(); 277 this->releasePreviousVertexSource();
278 GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); 278 GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
279 geoSrc.fVertexSrc = kArray_GeometrySrcType; 279 geoSrc.fVertexSrc = kArray_GeometrySrcType;
280 geoSrc.fVertexSize = this->drawState()->getVertexSize(); 280 geoSrc.fVertexSize = this->drawState()->getVertexSize();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex, 348 bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex,
349 int startIndex, int vertexCount, 349 int startIndex, int vertexCount,
350 int indexCount) const { 350 int indexCount) const {
351 const GrDrawState& drawState = this->getDrawState(); 351 const GrDrawState& drawState = this->getDrawState();
352 #ifdef SK_DEBUG 352 #ifdef SK_DEBUG
353 const GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); 353 const GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
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 SkFAIL("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->sizeInBytes( ) / geoSrc.fVertexSize);
365 break; 365 break;
366 } 366 }
367 if (maxVertex > maxValidVertex) { 367 if (maxVertex > maxValidVertex) {
368 GrCrash("Drawing outside valid vertex range."); 368 SkFAIL("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 SkFAIL("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->sizeInByte s() / 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 SkFAIL("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) {
392 const GrEffectRef& effect = *drawState.getColorStage(s).getEffect(); 392 const GrEffectRef& effect = *drawState.getColorStage(s).getEffect();
393 int numTextures = effect->numTextures(); 393 int numTextures = effect->numTextures();
394 for (int t = 0; t < numTextures; ++t) { 394 for (int t = 0; t < numTextures; ++t) {
395 GrTexture* texture = effect->texture(t); 395 GrTexture* texture = effect->texture(t);
(...skipping 705 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
« include/core/SkTypes.h ('K') | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698