OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
9 | 9 |
10 #include "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 traceString = fGpuCmdMarkers[currCmdMarker].toString(); | 428 traceString = fGpuCmdMarkers[currCmdMarker].toString(); |
429 newMarker.fMarker = traceString.c_str(); | 429 newMarker.fMarker = traceString.c_str(); |
430 this->getGpu()->addGpuTraceMarker(&newMarker); | 430 this->getGpu()->addGpuTraceMarker(&newMarker); |
431 ++currCmdMarker; | 431 ++currCmdMarker; |
432 } | 432 } |
433 | 433 |
434 if (kSetState_Cmd == strip_trace_bit(iter->fType)) { | 434 if (kSetState_Cmd == strip_trace_bit(iter->fType)) { |
435 SetState* ss = reinterpret_cast<SetState*>(iter.get()); | 435 SetState* ss = reinterpret_cast<SetState*>(iter.get()); |
436 | 436 |
437 this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcesso
r, ss->fState, | 437 this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcesso
r, ss->fState, |
438 ss->fState.descInfo(), ss->fState.d
rawType(), | 438 ss->fState.descInfo(), ss->fDrawTyp
e, |
439 ss->fBatchTracker); | 439 ss->fBatchTracker); |
440 currentState = ss; | 440 currentState = ss; |
441 | 441 |
442 } else { | 442 } else { |
443 iter->execute(this, currentState); | 443 iter->execute(this, currentState); |
444 } | 444 } |
445 | 445 |
446 if (cmd_has_trace_marker(iter->fType)) { | 446 if (cmd_has_trace_marker(iter->fType)) { |
447 this->getGpu()->removeGpuTraceMarker(&newMarker); | 447 this->getGpu()->removeGpuTraceMarker(&newMarker); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker); | 451 SkASSERT(fGpuCmdMarkers.count() == currCmdMarker); |
452 ++fDrawID; | 452 ++fDrawID; |
453 } | 453 } |
454 | 454 |
455 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState
* state) { | 455 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState
* state) { |
456 SkASSERT(state); | 456 SkASSERT(state); |
457 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, | 457 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, |
458 &state->fBatchTracker); | 458 &state->fBatchTracker, state->fDrawType); |
459 buf->getGpu()->draw(args, fInfo); | 459 buf->getGpu()->draw(args, fInfo); |
460 } | 460 } |
461 | 461 |
462 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, const S
etState*) { | 462 void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf, const S
etState*) { |
463 GrGpu::StencilPathState state; | 463 GrGpu::StencilPathState state; |
464 state.fRenderTarget = fRenderTarget.get(); | 464 state.fRenderTarget = fRenderTarget.get(); |
465 state.fScissor = &fScissor; | 465 state.fScissor = &fScissor; |
466 state.fStencil = &fStencil; | 466 state.fStencil = &fStencil; |
467 state.fUseHWAA = fUseHWAA; | 467 state.fUseHWAA = fUseHWAA; |
468 state.fViewMatrix = &fViewMatrix; | 468 state.fViewMatrix = &fViewMatrix; |
469 | 469 |
470 buf->getGpu()->stencilPath(this->path(), state); | 470 buf->getGpu()->stencilPath(this->path(), state); |
471 } | 471 } |
472 | 472 |
473 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetS
tate* state) { | 473 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetS
tate* state) { |
474 SkASSERT(state); | 474 SkASSERT(state); |
475 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, | 475 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, |
476 &state->fBatchTracker); | 476 &state->fBatchTracker, state->fDrawType); |
477 buf->getGpu()->drawPath(args, this->path(), fStencilSettings); | 477 buf->getGpu()->drawPath(args, this->path(), fStencilSettings); |
478 } | 478 } |
479 | 479 |
480 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const Set
State* state) { | 480 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const Set
State* state) { |
481 SkASSERT(state); | 481 SkASSERT(state); |
482 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, | 482 DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDes
c, |
483 &state->fBatchTracker); | 483 &state->fBatchTracker, state->fDrawType); |
484 buf->getGpu()->drawPaths(args, this->pathRange(), | 484 buf->getGpu()->drawPaths(args, this->pathRange(), |
485 &buf->fPathIndexBuffer[fIndicesLocation], fIndexType
, | 485 &buf->fPathIndexBuffer[fIndicesLocation], fIndexType
, |
486 &buf->fPathTransformBuffer[fTransformsLocation], fTr
ansformType, | 486 &buf->fPathTransformBuffer[fTransformsLocation], fTr
ansformType, |
487 fCount, fStencilSettings); | 487 fCount, fStencilSettings); |
488 } | 488 } |
489 | 489 |
490 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const SetState
*) {} | 490 void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const SetState
*) {} |
491 | 491 |
492 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const SetStat
e*) { | 492 void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const SetStat
e*) { |
493 if (GrColor_ILLEGAL == fColor) { | 493 if (GrColor_ILLEGAL == fColor) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 dstCopy, drawType)); | 529 dstCopy, drawType)); |
530 if (ss->fState.mustSkip()) { | 530 if (ss->fState.mustSkip()) { |
531 fCmdBuffer.pop_back(); | 531 fCmdBuffer.pop_back(); |
532 return false; | 532 return false; |
533 } | 533 } |
534 | 534 |
535 ss->fPrimitiveProcessor->initBatchTracker(&ss->fBatchTracker, | 535 ss->fPrimitiveProcessor->initBatchTracker(&ss->fBatchTracker, |
536 ss->fState.getInitBatchTracker()); | 536 ss->fState.getInitBatchTracker()); |
537 | 537 |
538 if (fPrevState && | 538 if (fPrevState && |
| 539 fPrevState->fDrawType == ss->fDrawType && |
539 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, | 540 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, |
540 *ss->fPrimitiveProcessor, | 541 *ss->fPrimitiveProcessor, |
541 ss->fBatchTracker) && | 542 ss->fBatchTracker) && |
542 fPrevState->fState.isEqual(ss->fState)) { | 543 fPrevState->fState.isEqual(ss->fState)) { |
543 fCmdBuffer.pop_back(); | 544 fCmdBuffer.pop_back(); |
544 } else { | 545 } else { |
545 fPrevState = ss; | 546 fPrevState = ss; |
546 this->recordTraceMarkersIfNecessary(); | 547 this->recordTraceMarkersIfNecessary(); |
547 } | 548 } |
548 return true; | 549 return true; |
549 } | 550 } |
550 | 551 |
551 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { | 552 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { |
552 SkASSERT(!fCmdBuffer.empty()); | 553 SkASSERT(!fCmdBuffer.empty()); |
553 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 554 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
554 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 555 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
555 if (activeTraceMarkers.count() > 0) { | 556 if (activeTraceMarkers.count() > 0) { |
556 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 557 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
557 fGpuCmdMarkers.push_back(activeTraceMarkers); | 558 fGpuCmdMarkers.push_back(activeTraceMarkers); |
558 } | 559 } |
559 } | 560 } |
OLD | NEW |