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

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

Issue 23137022: Replace uses of GR_DEBUG by SK_DEBUG. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: not GR_RELEASE Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.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 /* 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 27 matching lines...) Expand all
38 fDevBounds = &fDevBoundsStorage; 38 fDevBounds = &fDevBoundsStorage;
39 } else { 39 } else {
40 fDevBounds = NULL; 40 fDevBounds = NULL;
41 } 41 }
42 42
43 fDstCopy = di.fDstCopy; 43 fDstCopy = di.fDstCopy;
44 44
45 return *this; 45 return *this;
46 } 46 }
47 47
48 #if GR_DEBUG 48 #ifdef SK_DEBUG
49 bool GrDrawTarget::DrawInfo::isInstanced() const { 49 bool GrDrawTarget::DrawInfo::isInstanced() const {
50 if (fInstanceCount > 0) { 50 if (fInstanceCount > 0) {
51 SkASSERT(0 == fIndexCount % fIndicesPerInstance); 51 SkASSERT(0 == fIndexCount % fIndicesPerInstance);
52 SkASSERT(0 == fVertexCount % fVerticesPerInstance); 52 SkASSERT(0 == fVertexCount % fVerticesPerInstance);
53 SkASSERT(fIndexCount / fIndicesPerInstance == fInstanceCount); 53 SkASSERT(fIndexCount / fIndicesPerInstance == fInstanceCount);
54 SkASSERT(fVertexCount / fVerticesPerInstance == fInstanceCount); 54 SkASSERT(fVertexCount / fVerticesPerInstance == fInstanceCount);
55 // there is no way to specify a non-zero start index to drawIndexedInsta nces(). 55 // there is no way to specify a non-zero start index to drawIndexedInsta nces().
56 SkASSERT(0 == fStartIndex); 56 SkASSERT(0 == fStartIndex);
57 return true; 57 return true;
58 } else { 58 } else {
(...skipping 30 matching lines...) Expand all
89 89
90 GrDrawTarget::GrDrawTarget(GrContext* context) 90 GrDrawTarget::GrDrawTarget(GrContext* context)
91 : fClip(NULL) 91 : fClip(NULL)
92 , fContext(context) { 92 , fContext(context) {
93 SkASSERT(NULL != context); 93 SkASSERT(NULL != context);
94 94
95 fDrawState = &fDefaultDrawState; 95 fDrawState = &fDefaultDrawState;
96 // We assume that fDrawState always owns a ref to the object it points at. 96 // We assume that fDrawState always owns a ref to the object it points at.
97 fDefaultDrawState.ref(); 97 fDefaultDrawState.ref();
98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); 98 GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back();
99 #if GR_DEBUG 99 #ifdef SK_DEBUG
100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; 100 geoSrc.fVertexCount = DEBUG_INVAL_START_IDX;
101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; 101 geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER;
102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; 102 geoSrc.fIndexCount = DEBUG_INVAL_START_IDX;
103 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; 103 geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER;
104 #endif 104 #endif
105 geoSrc.fVertexSrc = kNone_GeometrySrcType; 105 geoSrc.fVertexSrc = kNone_GeometrySrcType;
106 geoSrc.fIndexSrc = kNone_GeometrySrcType; 106 geoSrc.fIndexSrc = kNone_GeometrySrcType;
107 } 107 }
108 108
109 GrDrawTarget::~GrDrawTarget() { 109 GrDrawTarget::~GrDrawTarget() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 case kNone_GeometrySrcType: 232 case kNone_GeometrySrcType:
233 break; 233 break;
234 case kArray_GeometrySrcType: 234 case kArray_GeometrySrcType:
235 this->releaseVertexArray(); 235 this->releaseVertexArray();
236 break; 236 break;
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 #if GR_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 GrCrash("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 #if GR_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 GrCrash("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,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 this->releasePreviousIndexSource(); 318 this->releasePreviousIndexSource();
319 GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); 319 GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
320 geoSrc.fIndexSrc = kNone_GeometrySrcType; 320 geoSrc.fIndexSrc = kNone_GeometrySrcType;
321 } 321 }
322 322
323 void GrDrawTarget::pushGeometrySource() { 323 void GrDrawTarget::pushGeometrySource() {
324 this->geometrySourceWillPush(); 324 this->geometrySourceWillPush();
325 GeometrySrcState& newState = fGeoSrcStateStack.push_back(); 325 GeometrySrcState& newState = fGeoSrcStateStack.push_back();
326 newState.fIndexSrc = kNone_GeometrySrcType; 326 newState.fIndexSrc = kNone_GeometrySrcType;
327 newState.fVertexSrc = kNone_GeometrySrcType; 327 newState.fVertexSrc = kNone_GeometrySrcType;
328 #if GR_DEBUG 328 #ifdef SK_DEBUG
329 newState.fVertexCount = ~0; 329 newState.fVertexCount = ~0;
330 newState.fVertexBuffer = (GrVertexBuffer*)~0; 330 newState.fVertexBuffer = (GrVertexBuffer*)~0;
331 newState.fIndexCount = ~0; 331 newState.fIndexCount = ~0;
332 newState.fIndexBuffer = (GrIndexBuffer*)~0; 332 newState.fIndexBuffer = (GrIndexBuffer*)~0;
333 #endif 333 #endif
334 } 334 }
335 335
336 void GrDrawTarget::popGeometrySource() { 336 void GrDrawTarget::popGeometrySource() {
337 // if popping last element then pops are unbalanced with pushes 337 // if popping last element then pops are unbalanced with pushes
338 SkASSERT(fGeoSrcStateStack.count() > 1); 338 SkASSERT(fGeoSrcStateStack.count() > 1);
339 339
340 this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1)); 340 this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1));
341 this->releasePreviousVertexSource(); 341 this->releasePreviousVertexSource();
342 this->releasePreviousIndexSource(); 342 this->releasePreviousIndexSource();
343 fGeoSrcStateStack.pop_back(); 343 fGeoSrcStateStack.pop_back();
344 } 344 }
345 345
346 //////////////////////////////////////////////////////////////////////////////// 346 ////////////////////////////////////////////////////////////////////////////////
347 347
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 #if GR_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 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;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return true; 418 return true;
419 } 419 }
420 GrRenderTarget* rt = this->drawState()->getRenderTarget(); 420 GrRenderTarget* rt = this->drawState()->getRenderTarget();
421 421
422 const GrClipData* clip = this->getClip(); 422 const GrClipData* clip = this->getClip();
423 SkIRect copyRect; 423 SkIRect copyRect;
424 clip->getConservativeBounds(this->getDrawState().getRenderTarget(), &copyRec t); 424 clip->getConservativeBounds(this->getDrawState().getRenderTarget(), &copyRec t);
425 SkIRect drawIBounds; 425 SkIRect drawIBounds;
426 if (info->getDevIBounds(&drawIBounds)) { 426 if (info->getDevIBounds(&drawIBounds)) {
427 if (!copyRect.intersect(drawIBounds)) { 427 if (!copyRect.intersect(drawIBounds)) {
428 #if GR_DEBUG 428 #ifdef SK_DEBUG
429 GrPrintf("Missed an early reject. Bailing on draw from setupDstReadI fNecessary.\n"); 429 GrPrintf("Missed an early reject. Bailing on draw from setupDstReadI fNecessary.\n");
430 #endif 430 #endif
431 return false; 431 return false;
432 } 432 }
433 } else { 433 } else {
434 #if GR_DEBUG 434 #ifdef SK_DEBUG
435 //GrPrintf("No dev bounds when dst copy is made.\n"); 435 //GrPrintf("No dev bounds when dst copy is made.\n");
436 #endif 436 #endif
437 } 437 }
438 438
439 // MSAA consideration: When there is support for reading MSAA samples in the shader we could 439 // MSAA consideration: When there is support for reading MSAA samples in the shader we could
440 // have per-sample dst values by making the copy multisampled. 440 // have per-sample dst values by making the copy multisampled.
441 GrTextureDesc desc; 441 GrTextureDesc desc;
442 this->initCopySurfaceDstDesc(rt, &desc); 442 this->initCopySurfaceDstDesc(rt, &desc);
443 desc.fWidth = copyRect.width(); 443 desc.fWidth = copyRect.width();
444 desc.fHeight = copyRect.height(); 444 desc.fHeight = copyRect.height();
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); 990 GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
991 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]); 991 GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSuppor t]);
992 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]); 992 GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
993 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]); 993 GrPrintf("Path Stenciling Support : %s\n", gNY[fPathStencilingSupport]);
994 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ; 994 GrPrintf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]) ;
995 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]); 995 GrPrintf("Reuse Scratch Textures : %s\n", gNY[fReuseScratchTextures]);
996 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize); 996 GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
997 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize); 997 GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
998 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount); 998 GrPrintf("Max Sample Count : %d\n", fMaxSampleCount);
999 } 999 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698