OLD | NEW |
---|---|
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 #include "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 if (devBounds) { | 463 if (devBounds) { |
464 info.setDevBounds(*devBounds); | 464 info.setDevBounds(*devBounds); |
465 } | 465 } |
466 | 466 |
467 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, | 467 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, |
468 this); | 468 this); |
469 if (pipelineInfo.mustSkipDraw()) { | 469 if (pipelineInfo.mustSkipDraw()) { |
470 return; | 470 return; |
471 } | 471 } |
472 | 472 |
473 if (!pipelineBuilder->willBlendCoherently(*this->caps())) { | |
egdaniel
2015/03/31 14:23:41
So I feel like somewhere we need to be checking th
Chris Dalton
2015/03/31 17:06:42
That seems fine. What about "requiresBlendBarrier(
Mark Kilgard
2015/04/02 23:02:38
Two cents: I like the shorter requiresBlendBarrier
| |
474 this->onBlendBarrier(); | |
475 } | |
476 | |
473 this->setDrawBuffers(&info, gp->getVertexStride()); | 477 this->setDrawBuffers(&info, gp->getVertexStride()); |
474 | 478 |
475 this->onDraw(gp, info, pipelineInfo); | 479 this->onDraw(gp, info, pipelineInfo); |
476 } | 480 } |
477 } | 481 } |
478 | 482 |
479 void GrDrawTarget::drawNonIndexed(GrPipelineBuilder* pipelineBuilder, | 483 void GrDrawTarget::drawNonIndexed(GrPipelineBuilder* pipelineBuilder, |
480 const GrGeometryProcessor* gp, | 484 const GrGeometryProcessor* gp, |
481 GrPrimitiveType type, | 485 GrPrimitiveType type, |
482 int startVertex, | 486 int startVertex, |
(...skipping 25 matching lines...) Expand all Loading... | |
508 if (devBounds) { | 512 if (devBounds) { |
509 info.setDevBounds(*devBounds); | 513 info.setDevBounds(*devBounds); |
510 } | 514 } |
511 | 515 |
512 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, | 516 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, |
513 this); | 517 this); |
514 if (pipelineInfo.mustSkipDraw()) { | 518 if (pipelineInfo.mustSkipDraw()) { |
515 return; | 519 return; |
516 } | 520 } |
517 | 521 |
522 if (!pipelineBuilder->willBlendCoherently(*this->caps())) { | |
523 this->onBlendBarrier(); | |
524 } | |
525 | |
518 this->setDrawBuffers(&info, gp->getVertexStride()); | 526 this->setDrawBuffers(&info, gp->getVertexStride()); |
519 | 527 |
520 this->onDraw(gp, info, pipelineInfo); | 528 this->onDraw(gp, info, pipelineInfo); |
521 } | 529 } |
522 } | 530 } |
523 | 531 |
524 | 532 |
525 void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder, | 533 void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder, |
526 GrBatch* batch, | 534 GrBatch* batch, |
527 const SkRect* devBounds) { | 535 const SkRect* devBounds) { |
528 SkASSERT(pipelineBuilder); | 536 SkASSERT(pipelineBuilder); |
529 // TODO some kind of checkdraw, but not at this level | 537 // TODO some kind of checkdraw, but not at this level |
530 | 538 |
531 // Setup clip | 539 // Setup clip |
532 GrScissorState scissorState; | 540 GrScissorState scissorState; |
533 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 541 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
534 GrPipelineBuilder::AutoRestoreStencil ars; | 542 GrPipelineBuilder::AutoRestoreStencil ars; |
535 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, devBounds) ) { | 543 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, devBounds) ) { |
536 return; | 544 return; |
537 } | 545 } |
538 | 546 |
539 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batc h, devBounds, this); | 547 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, batc h, devBounds, this); |
540 if (pipelineInfo.mustSkipDraw()) { | 548 if (pipelineInfo.mustSkipDraw()) { |
541 return; | 549 return; |
542 } | 550 } |
543 | 551 |
552 if (!pipelineBuilder->willBlendCoherently(*this->caps())) { | |
553 this->onBlendBarrier(); | |
554 } | |
555 | |
544 this->onDrawBatch(batch, pipelineInfo); | 556 this->onDrawBatch(batch, pipelineInfo); |
545 } | 557 } |
546 | 558 |
547 static const GrStencilSettings& winding_path_stencil_settings() { | 559 static const GrStencilSettings& winding_path_stencil_settings() { |
548 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | 560 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
549 kIncClamp_StencilOp, | 561 kIncClamp_StencilOp, |
550 kIncClamp_StencilOp, | 562 kIncClamp_StencilOp, |
551 kAlwaysIfInClip_StencilFunc, | 563 kAlwaysIfInClip_StencilFunc, |
552 0xFFFF, 0xFFFF, 0xFFFF); | 564 0xFFFF, 0xFFFF, 0xFFFF); |
553 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | 565 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 info.fStartIndex, | 811 info.fStartIndex, |
800 info.fVertexCount, | 812 info.fVertexCount, |
801 info.fIndexCount)) { | 813 info.fIndexCount)) { |
802 | 814 |
803 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorSta te, gp, devBounds, | 815 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorSta te, gp, devBounds, |
804 this); | 816 this); |
805 if (pipelineInfo.mustSkipDraw()) { | 817 if (pipelineInfo.mustSkipDraw()) { |
806 return; | 818 return; |
807 } | 819 } |
808 | 820 |
821 if (!pipelineBuilder->willBlendCoherently(*this->caps())) { | |
822 this->onBlendBarrier(); | |
823 } | |
824 | |
809 this->setDrawBuffers(&info, gp->getVertexStride()); | 825 this->setDrawBuffers(&info, gp->getVertexStride()); |
810 this->onDraw(gp, info, pipelineInfo); | 826 this->onDraw(gp, info, pipelineInfo); |
811 } | 827 } |
812 info.fStartVertex += info.fVertexCount; | 828 info.fStartVertex += info.fVertexCount; |
813 instanceCount -= info.fInstanceCount; | 829 instanceCount -= info.fInstanceCount; |
814 } | 830 } |
815 } | 831 } |
816 | 832 |
817 //////////////////////////////////////////////////////////////////////////////// | 833 //////////////////////////////////////////////////////////////////////////////// |
818 | 834 |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp, | 1275 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp, |
1260 GrPipelineBuilder::AutoRestoreStencil* ars, | 1276 GrPipelineBuilder::AutoRestoreStencil* ars, |
1261 GrScissorState* scissorState, | 1277 GrScissorState* scissorState, |
1262 const SkRect* devBounds) { | 1278 const SkRect* devBounds) { |
1263 return fClipMaskManager.setupClipping(pipelineBuilder, | 1279 return fClipMaskManager.setupClipping(pipelineBuilder, |
1264 arfp, | 1280 arfp, |
1265 ars, | 1281 ars, |
1266 scissorState, | 1282 scissorState, |
1267 devBounds); | 1283 devBounds); |
1268 } | 1284 } |
OLD | NEW |