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

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

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: Created 6 years 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/GrDrawTarget.h ('k') | src/gpu/GrGeometryProcessor.h » ('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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 300
301 this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1)); 301 this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1));
302 this->releasePreviousVertexSource(); 302 this->releasePreviousVertexSource();
303 this->releasePreviousIndexSource(); 303 this->releasePreviousIndexSource();
304 fGeoSrcStateStack.pop_back(); 304 fGeoSrcStateStack.pop_back();
305 } 305 }
306 306
307 //////////////////////////////////////////////////////////////////////////////// 307 ////////////////////////////////////////////////////////////////////////////////
308 308
309 bool GrDrawTarget::checkDraw(const GrDrawState& drawState, 309 bool GrDrawTarget::checkDraw(const GrDrawState& drawState,
310 const GrGeometryProcessor* gp,
311 GrPrimitiveType type, 310 GrPrimitiveType type,
312 int startVertex, 311 int startVertex,
313 int startIndex, 312 int startIndex,
314 int vertexCount, 313 int vertexCount,
315 int indexCount) const { 314 int indexCount) const {
316 #ifdef SK_DEBUG 315 #ifdef SK_DEBUG
317 const GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); 316 const GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
318 int maxVertex = startVertex + vertexCount; 317 int maxVertex = startVertex + vertexCount;
319 int maxValidVertex; 318 int maxValidVertex;
320 switch (geoSrc.fVertexSrc) { 319 switch (geoSrc.fVertexSrc) {
(...skipping 22 matching lines...) Expand all
343 maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemoryS ize() / sizeof(uint16_t)); 342 maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemoryS ize() / sizeof(uint16_t));
344 break; 343 break;
345 } 344 }
346 if (maxIndex > maxValidIndex) { 345 if (maxIndex > maxValidIndex) {
347 SkFAIL("Index reads outside valid index range."); 346 SkFAIL("Index reads outside valid index range.");
348 } 347 }
349 } 348 }
350 349
351 SkASSERT(drawState.getRenderTarget()); 350 SkASSERT(drawState.getRenderTarget());
352 351
353 if (gp) { 352 if (drawState.hasGeometryProcessor()) {
353 const GrGeometryProcessor* gp = drawState.getGeometryProcessor();
354 int numTextures = gp->numTextures(); 354 int numTextures = gp->numTextures();
355 for (int t = 0; t < numTextures; ++t) { 355 for (int t = 0; t < numTextures; ++t) {
356 GrTexture* texture = gp->texture(t); 356 GrTexture* texture = gp->texture(t);
357 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget()); 357 SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget());
358 } 358 }
359 } 359 }
360 360
361 for (int s = 0; s < drawState.numColorStages(); ++s) { 361 for (int s = 0; s < drawState.numColorStages(); ++s) {
362 const GrProcessor* effect = drawState.getColorStage(s).getProcessor(); 362 const GrProcessor* effect = drawState.getColorStage(s).getProcessor();
363 int numTextures = effect->numTextures(); 363 int numTextures = effect->numTextures();
(...skipping 12 matching lines...) Expand all
376 } 376 }
377 377
378 #endif 378 #endif
379 if (NULL == drawState.getRenderTarget()) { 379 if (NULL == drawState.getRenderTarget()) {
380 return false; 380 return false;
381 } 381 }
382 return true; 382 return true;
383 } 383 }
384 384
385 bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds, 385 bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds,
386 const GrPrimitiveProcessor* primProc, 386 GrColor color,
387 uint8_t coverage,
387 GrDeviceCoordTexture* dstCopy, 388 GrDeviceCoordTexture* dstCopy,
388 const SkRect* drawBounds) { 389 const SkRect* drawBounds) {
389 if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(pr imProc)) { 390 GrColor c = GrColorPackRGBA(coverage, coverage, coverage, coverage);
391 if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor(co lor, c)) {
390 return true; 392 return true;
391 } 393 }
392 SkIRect copyRect; 394 SkIRect copyRect;
393 const GrClipData* clip = this->getClip(); 395 const GrClipData* clip = this->getClip();
394 GrRenderTarget* rt = ds->getRenderTarget(); 396 GrRenderTarget* rt = ds->getRenderTarget();
395 clip->getConservativeBounds(rt, &copyRect); 397 clip->getConservativeBounds(rt, &copyRect);
396 398
397 if (drawBounds) { 399 if (drawBounds) {
398 SkIRect drawIBounds; 400 SkIRect drawIBounds;
399 drawBounds->roundOut(&drawIBounds); 401 drawBounds->roundOut(&drawIBounds);
(...skipping 27 matching lines...) Expand all
427 if (this->copySurface(copy, rt, copyRect, dstPoint)) { 429 if (this->copySurface(copy, rt, copyRect, dstPoint)) {
428 dstCopy->setTexture(copy); 430 dstCopy->setTexture(copy);
429 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); 431 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop);
430 return true; 432 return true;
431 } else { 433 } else {
432 return false; 434 return false;
433 } 435 }
434 } 436 }
435 437
436 void GrDrawTarget::drawIndexed(GrDrawState* ds, 438 void GrDrawTarget::drawIndexed(GrDrawState* ds,
437 const GrGeometryProcessor* gp,
438 GrPrimitiveType type, 439 GrPrimitiveType type,
439 int startVertex, 440 int startVertex,
440 int startIndex, 441 int startIndex,
441 int vertexCount, 442 int vertexCount,
442 int indexCount, 443 int indexCount,
443 const SkRect* devBounds) { 444 const SkRect* devBounds) {
444 SkASSERT(ds); 445 SkASSERT(ds);
445 if (indexCount > 0 && 446 if (indexCount > 0 &&
446 this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, ind exCount)) { 447 this->checkDraw(*ds, type, startVertex, startIndex, vertexCount, indexCo unt)) {
447 448
448 // Setup clip 449 // Setup clip
449 GrClipMaskManager::ScissorState scissorState; 450 GrClipMaskManager::ScissorState scissorState;
450 GrDrawState::AutoRestoreEffects are; 451 GrDrawState::AutoRestoreEffects are;
451 GrDrawState::AutoRestoreStencil ars; 452 GrDrawState::AutoRestoreStencil ars;
452 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { 453 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) {
453 return; 454 return;
454 } 455 }
455 456
456 DrawInfo info; 457 DrawInfo info;
457 info.fPrimitiveType = type; 458 info.fPrimitiveType = type;
458 info.fStartVertex = startVertex; 459 info.fStartVertex = startVertex;
459 info.fStartIndex = startIndex; 460 info.fStartIndex = startIndex;
460 info.fVertexCount = vertexCount; 461 info.fVertexCount = vertexCount;
461 info.fIndexCount = indexCount; 462 info.fIndexCount = indexCount;
462 463
463 info.fInstanceCount = 0; 464 info.fInstanceCount = 0;
464 info.fVerticesPerInstance = 0; 465 info.fVerticesPerInstance = 0;
465 info.fIndicesPerInstance = 0; 466 info.fIndicesPerInstance = 0;
466 467
467 if (devBounds) { 468 if (devBounds) {
468 info.setDevBounds(*devBounds); 469 info.setDevBounds(*devBounds);
469 } 470 }
470 471
471 // TODO: We should continue with incorrect blending. 472 // TODO: We should continue with incorrect blending.
472 GrDeviceCoordTexture dstCopy; 473 GrDeviceCoordTexture dstCopy;
473 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { 474 const GrGeometryProcessor* gp = ds->getGeometryProcessor();
475 if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage() , &dstCopy,
476 devBounds)) {
474 return; 477 return;
475 } 478 }
476 this->setDrawBuffers(&info, gp->getVertexStride()); 479 this->setDrawBuffers(&info, gp->getVertexStride());
477 480
478 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); 481 this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NUL L);
479 } 482 }
480 } 483 }
481 484
482 void GrDrawTarget::drawNonIndexed(GrDrawState* ds, 485 void GrDrawTarget::drawNonIndexed(GrDrawState* ds,
483 const GrGeometryProcessor* gp,
484 GrPrimitiveType type, 486 GrPrimitiveType type,
485 int startVertex, 487 int startVertex,
486 int vertexCount, 488 int vertexCount,
487 const SkRect* devBounds) { 489 const SkRect* devBounds) {
488 SkASSERT(ds); 490 SkASSERT(ds);
489 if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, verte xCount, -1)) { 491 if (vertexCount > 0 && this->checkDraw(*ds, type, startVertex, -1, vertexCou nt, -1)) {
490 492
491 // Setup clip 493 // Setup clip
492 GrClipMaskManager::ScissorState scissorState; 494 GrClipMaskManager::ScissorState scissorState;
493 GrDrawState::AutoRestoreEffects are; 495 GrDrawState::AutoRestoreEffects are;
494 GrDrawState::AutoRestoreStencil ars; 496 GrDrawState::AutoRestoreStencil ars;
495 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) { 497 if (!this->setupClip(devBounds, &are, &ars, ds, &scissorState)) {
496 return; 498 return;
497 } 499 }
498 500
499 DrawInfo info; 501 DrawInfo info;
500 info.fPrimitiveType = type; 502 info.fPrimitiveType = type;
501 info.fStartVertex = startVertex; 503 info.fStartVertex = startVertex;
502 info.fStartIndex = 0; 504 info.fStartIndex = 0;
503 info.fVertexCount = vertexCount; 505 info.fVertexCount = vertexCount;
504 info.fIndexCount = 0; 506 info.fIndexCount = 0;
505 507
506 info.fInstanceCount = 0; 508 info.fInstanceCount = 0;
507 info.fVerticesPerInstance = 0; 509 info.fVerticesPerInstance = 0;
508 info.fIndicesPerInstance = 0; 510 info.fIndicesPerInstance = 0;
509 511
510 if (devBounds) { 512 if (devBounds) {
511 info.setDevBounds(*devBounds); 513 info.setDevBounds(*devBounds);
512 } 514 }
513 515
514 // TODO: We should continue with incorrect blending. 516 // TODO: We should continue with incorrect blending.
515 GrDeviceCoordTexture dstCopy; 517 GrDeviceCoordTexture dstCopy;
516 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy, devBounds)) { 518 const GrGeometryProcessor* gp = ds->getGeometryProcessor();
519 if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage() , &dstCopy,
520 devBounds)) {
517 return; 521 return;
518 } 522 }
519 523
520 this->setDrawBuffers(&info, gp->getVertexStride()); 524 this->setDrawBuffers(&info, gp->getVertexStride());
521 525
522 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL); 526 this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NUL L);
523 } 527 }
524 } 528 }
525 529
526 static const GrStencilSettings& winding_path_stencil_settings() { 530 static const GrStencilSettings& winding_path_stencil_settings() {
527 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, 531 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
528 kIncClamp_StencilOp, 532 kIncClamp_StencilOp,
529 kIncClamp_StencilOp, 533 kIncClamp_StencilOp,
530 kAlwaysIfInClip_StencilFunc, 534 kAlwaysIfInClip_StencilFunc,
531 0xFFFF, 0xFFFF, 0xFFFF); 535 0xFFFF, 0xFFFF, 0xFFFF);
532 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); 536 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
(...skipping 19 matching lines...) Expand all
552 *outStencilSettings = winding_path_stencil_settings(); 556 *outStencilSettings = winding_path_stencil_settings();
553 break; 557 break;
554 case GrPathRendering::kEvenOdd_FillType: 558 case GrPathRendering::kEvenOdd_FillType:
555 *outStencilSettings = even_odd_path_stencil_settings(); 559 *outStencilSettings = even_odd_path_stencil_settings();
556 break; 560 break;
557 } 561 }
558 this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings); 562 this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings);
559 } 563 }
560 564
561 void GrDrawTarget::stencilPath(GrDrawState* ds, 565 void GrDrawTarget::stencilPath(GrDrawState* ds,
562 const GrPathProcessor* pathProc,
563 const GrPath* path, 566 const GrPath* path,
564 GrPathRendering::FillType fill) { 567 GrPathRendering::FillType fill) {
565 // TODO: extract portions of checkDraw that are relevant to path stenciling. 568 // TODO: extract portions of checkDraw that are relevant to path stenciling.
566 SkASSERT(path); 569 SkASSERT(path);
567 SkASSERT(this->caps()->pathRenderingSupport()); 570 SkASSERT(this->caps()->pathRenderingSupport());
568 SkASSERT(ds); 571 SkASSERT(ds);
569 572
570 // Setup clip 573 // Setup clip
571 GrClipMaskManager::ScissorState scissorState; 574 GrClipMaskManager::ScissorState scissorState;
572 GrDrawState::AutoRestoreEffects are; 575 GrDrawState::AutoRestoreEffects are;
573 GrDrawState::AutoRestoreStencil ars; 576 GrDrawState::AutoRestoreStencil ars;
574 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) { 577 if (!this->setupClip(NULL, &are, &ars, ds, &scissorState)) {
575 return; 578 return;
576 } 579 }
577 580
578 // set stencil settings for path 581 // set stencil settings for path
579 GrStencilSettings stencilSettings; 582 GrStencilSettings stencilSettings;
580 this->getPathStencilSettingsForFilltype(fill, 583 this->getPathStencilSettingsForFilltype(fill,
581 ds->getRenderTarget()->getStencilBuf fer(), 584 ds->getRenderTarget()->getStencilBuf fer(),
582 &stencilSettings); 585 &stencilSettings);
583 586
584 this->onStencilPath(*ds, pathProc, path, scissorState, stencilSettings); 587 this->onStencilPath(*ds, path, scissorState, stencilSettings);
585 } 588 }
586 589
587 void GrDrawTarget::drawPath(GrDrawState* ds, 590 void GrDrawTarget::drawPath(GrDrawState* ds,
588 const GrPathProcessor* pathProc, 591 GrColor color,
589 const GrPath* path, 592 const GrPath* path,
590 GrPathRendering::FillType fill) { 593 GrPathRendering::FillType fill) {
591 // TODO: extract portions of checkDraw that are relevant to path rendering. 594 // TODO: extract portions of checkDraw that are relevant to path rendering.
592 SkASSERT(path); 595 SkASSERT(path);
593 SkASSERT(this->caps()->pathRenderingSupport()); 596 SkASSERT(this->caps()->pathRenderingSupport());
594 SkASSERT(ds); 597 SkASSERT(ds);
595 598
596 SkRect devBounds = path->getBounds(); 599 SkRect devBounds = path->getBounds();
597 SkMatrix viewM = ds->getViewMatrix(); 600 SkMatrix viewM = ds->getViewMatrix();
598 viewM.mapRect(&devBounds); 601 viewM.mapRect(&devBounds);
599 602
600 // Setup clip 603 // Setup clip
601 GrClipMaskManager::ScissorState scissorState; 604 GrClipMaskManager::ScissorState scissorState;
602 GrDrawState::AutoRestoreEffects are; 605 GrDrawState::AutoRestoreEffects are;
603 GrDrawState::AutoRestoreStencil ars; 606 GrDrawState::AutoRestoreStencil ars;
604 if (!this->setupClip(&devBounds, &are, &ars, ds, &scissorState)) { 607 if (!this->setupClip(&devBounds, &are, &ars, ds, &scissorState)) {
605 return; 608 return;
606 } 609 }
607 610
608 // set stencil settings for path 611 // set stencil settings for path
609 GrStencilSettings stencilSettings; 612 GrStencilSettings stencilSettings;
610 this->getPathStencilSettingsForFilltype(fill, 613 this->getPathStencilSettingsForFilltype(fill,
611 ds->getRenderTarget()->getStencilBuf fer(), 614 ds->getRenderTarget()->getStencilBuf fer(),
612 &stencilSettings); 615 &stencilSettings);
613 616
614 GrDeviceCoordTexture dstCopy; 617 GrDeviceCoordTexture dstCopy;
615 if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, &devBounds)) { 618 if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, &devBounds)) {
616 return; 619 return;
617 } 620 }
618 621
619 this->onDrawPath(*ds, pathProc, path, scissorState, stencilSettings, dstCopy .texture() ? &dstCopy : 622 this->onDrawPath(*ds, color, path, scissorState, stencilSettings, dstCopy.te xture() ? &dstCopy :
620 NULL); 623 NULL);
621 } 624 }
622 625
623 void GrDrawTarget::drawPaths(GrDrawState* ds, 626 void GrDrawTarget::drawPaths(GrDrawState* ds,
624 const GrPathProcessor* pathProc, 627 GrColor color,
625 const GrPathRange* pathRange, 628 const GrPathRange* pathRange,
626 const void* indices, 629 const void* indices,
627 PathIndexType indexType, 630 PathIndexType indexType,
628 const float transformValues[], 631 const float transformValues[],
629 PathTransformType transformType, 632 PathTransformType transformType,
630 int count, 633 int count,
631 GrPathRendering::FillType fill) { 634 GrPathRendering::FillType fill) {
632 SkASSERT(this->caps()->pathRenderingSupport()); 635 SkASSERT(this->caps()->pathRenderingSupport());
633 SkASSERT(pathRange); 636 SkASSERT(pathRange);
634 SkASSERT(indices); 637 SkASSERT(indices);
(...skipping 14 matching lines...) Expand all
649 GrStencilSettings stencilSettings; 652 GrStencilSettings stencilSettings;
650 this->getPathStencilSettingsForFilltype(fill, 653 this->getPathStencilSettingsForFilltype(fill,
651 ds->getRenderTarget()->getStencilBuf fer(), 654 ds->getRenderTarget()->getStencilBuf fer(),
652 &stencilSettings); 655 &stencilSettings);
653 656
654 // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt 657 // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt
655 // instead for it to just copy the entire dst. Realistically this is a moot 658 // instead for it to just copy the entire dst. Realistically this is a moot
656 // point, because any context that supports NV_path_rendering will also 659 // point, because any context that supports NV_path_rendering will also
657 // support NV_blend_equation_advanced. 660 // support NV_blend_equation_advanced.
658 GrDeviceCoordTexture dstCopy; 661 GrDeviceCoordTexture dstCopy;
659 if (!this->setupDstReadIfNecessary(ds, pathProc, &dstCopy, NULL)) { 662 if (!this->setupDstReadIfNecessary(ds, color, 0xff, &dstCopy, NULL)) {
660 return; 663 return;
661 } 664 }
662 665
663 this->onDrawPaths(*ds, pathProc, pathRange, indices, indexType, transformVal ues, transformType, 666 this->onDrawPaths(*ds, color, pathRange, indices, indexType, transformValues , transformType,
664 count, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : NULL); 667 count, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : NULL);
665 } 668 }
666 669
667 void GrDrawTarget::clear(const SkIRect* rect, 670 void GrDrawTarget::clear(const SkIRect* rect,
668 GrColor color, 671 GrColor color,
669 bool canIgnoreRect, 672 bool canIgnoreRect,
670 GrRenderTarget* renderTarget) { 673 GrRenderTarget* renderTarget) {
671 if (fCaps->useDrawInsteadOfClear()) { 674 if (fCaps->useDrawInsteadOfClear()) {
672 // This works around a driver bug with clear by drawing a rect instead. 675 // This works around a driver bug with clear by drawing a rect instead.
673 // The driver will ignore a clear if it is the only thing rendered to a 676 // The driver will ignore a clear if it is the only thing rendered to a
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 if (this->caps()->gpuTracingSupport()) { 726 if (this->caps()->gpuTracingSupport()) {
724 SkASSERT(fGpuTraceMarkerCount >= 1); 727 SkASSERT(fGpuTraceMarkerCount >= 1);
725 this->fActiveTraceMarkers.remove(*marker); 728 this->fActiveTraceMarkers.remove(*marker);
726 --fGpuTraceMarkerCount; 729 --fGpuTraceMarkerCount;
727 } 730 }
728 } 731 }
729 732
730 //////////////////////////////////////////////////////////////////////////////// 733 ////////////////////////////////////////////////////////////////////////////////
731 734
732 void GrDrawTarget::drawIndexedInstances(GrDrawState* ds, 735 void GrDrawTarget::drawIndexedInstances(GrDrawState* ds,
733 const GrGeometryProcessor* gp,
734 GrPrimitiveType type, 736 GrPrimitiveType type,
735 int instanceCount, 737 int instanceCount,
736 int verticesPerInstance, 738 int verticesPerInstance,
737 int indicesPerInstance, 739 int indicesPerInstance,
738 const SkRect* devBounds) { 740 const SkRect* devBounds) {
739 SkASSERT(ds); 741 SkASSERT(ds);
740 742
741 if (!verticesPerInstance || !indicesPerInstance) { 743 if (!verticesPerInstance || !indicesPerInstance) {
742 return; 744 return;
743 } 745 }
(...skipping 18 matching lines...) Expand all
762 info.fIndicesPerInstance = indicesPerInstance; 764 info.fIndicesPerInstance = indicesPerInstance;
763 info.fVerticesPerInstance = verticesPerInstance; 765 info.fVerticesPerInstance = verticesPerInstance;
764 766
765 // Set the same bounds for all the draws. 767 // Set the same bounds for all the draws.
766 if (devBounds) { 768 if (devBounds) {
767 info.setDevBounds(*devBounds); 769 info.setDevBounds(*devBounds);
768 } 770 }
769 771
770 // TODO: We should continue with incorrect blending. 772 // TODO: We should continue with incorrect blending.
771 GrDeviceCoordTexture dstCopy; 773 GrDeviceCoordTexture dstCopy;
772 if (!this->setupDstReadIfNecessary(ds, gp, &dstCopy,devBounds)) { 774 const GrGeometryProcessor* gp = ds->getGeometryProcessor();
775 if (!this->setupDstReadIfNecessary(ds, gp->getColor(), gp->getCoverage(), &d stCopy,devBounds)) {
773 return; 776 return;
774 } 777 }
775 778
776 while (instanceCount) { 779 while (instanceCount) {
777 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); 780 info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw);
778 info.fVertexCount = info.fInstanceCount * verticesPerInstance; 781 info.fVertexCount = info.fInstanceCount * verticesPerInstance;
779 info.fIndexCount = info.fInstanceCount * indicesPerInstance; 782 info.fIndexCount = info.fInstanceCount * indicesPerInstance;
780 783
781 if (this->checkDraw(*ds, 784 if (this->checkDraw(*ds,
782 gp,
783 type, 785 type,
784 info.fStartVertex, 786 info.fStartVertex,
785 info.fStartIndex, 787 info.fStartIndex,
786 info.fVertexCount, 788 info.fVertexCount,
787 info.fIndexCount)) { 789 info.fIndexCount)) {
788 this->setDrawBuffers(&info, gp->getVertexStride()); 790 this->setDrawBuffers(&info, gp->getVertexStride());
789 this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCo py : NULL); 791 this->onDraw(*ds, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
790 } 792 }
791 info.fStartVertex += info.fVertexCount; 793 info.fStartVertex += info.fVertexCount;
792 instanceCount -= info.fInstanceCount; 794 instanceCount -= info.fInstanceCount;
793 } 795 }
794 } 796 }
795 797
796 //////////////////////////////////////////////////////////////////////////////// 798 ////////////////////////////////////////////////////////////////////////////////
797 799
798 GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry( 800 GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry(
799 GrDrawTarget* target, 801 GrDrawTarget* target,
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 GrDrawState::AutoRestoreStencil* ars, 1217 GrDrawState::AutoRestoreStencil* ars,
1216 GrDrawState* ds, 1218 GrDrawState* ds,
1217 GrClipMaskManager::ScissorState* scissorState) { 1219 GrClipMaskManager::ScissorState* scissorState) {
1218 return fClipMaskManager.setupClipping(ds, 1220 return fClipMaskManager.setupClipping(ds,
1219 are, 1221 are,
1220 ars, 1222 ars,
1221 scissorState, 1223 scissorState,
1222 this->getClip(), 1224 this->getClip(),
1223 devBounds); 1225 devBounds);
1224 } 1226 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698