| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrTargetCommands.h" | 8 #include "GrTargetCommands.h" |
| 9 | 9 |
| 10 #include "GrColor.h" | 10 #include "GrColor.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 | 335 |
| 336 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu, const SetState*) { | 336 void GrTargetCommands::ClearStencilClip::execute(GrGpu* gpu, const SetState*) { |
| 337 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); | 337 gpu->clearStencilClip(fRect, fInsideClip, this->renderTarget()); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void GrTargetCommands::CopySurface::execute(GrGpu* gpu, const SetState*) { | 340 void GrTargetCommands::CopySurface::execute(GrGpu* gpu, const SetState*) { |
| 341 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); | 341 gpu->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void GrTargetCommands::XferBarrier::execute(GrGpu* gpu, const SetState* state) { |
| 345 gpu->xferBarrier(fBarrierType); |
| 346 } |
| 347 |
| 344 GrTargetCommands::Cmd* GrTargetCommands::recordCopySurface(GrSurface* dst, | 348 GrTargetCommands::Cmd* GrTargetCommands::recordCopySurface(GrSurface* dst, |
| 345 GrSurface* src, | 349 GrSurface* src, |
| 346 const SkIRect& srcRec
t, | 350 const SkIRect& srcRec
t, |
| 347 const SkIPoint& dstPo
int) { | 351 const SkIPoint& dstPo
int) { |
| 348 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst, sr
c)); | 352 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst, sr
c)); |
| 349 cs->fSrcRect = srcRect; | 353 cs->fSrcRect = srcRect; |
| 350 cs->fDstPoint = dstPoint; | 354 cs->fDstPoint = dstPoint; |
| 351 return cs; | 355 return cs; |
| 352 } | 356 } |
| 353 | 357 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 368 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && | 372 if (fPrevState && fPrevState->fPrimitiveProcessor.get() && |
| 369 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, | 373 fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker, |
| 370 *ss->fPrimitiveProcessor, | 374 *ss->fPrimitiveProcessor, |
| 371 ss->fBatchTracker) && | 375 ss->fBatchTracker) && |
| 372 fPrevState->getPipeline()->isEqual(*ss->getPipeline())) { | 376 fPrevState->getPipeline()->isEqual(*ss->getPipeline())) { |
| 373 fCmdBuffer.pop_back(); | 377 fCmdBuffer.pop_back(); |
| 374 } else { | 378 } else { |
| 375 fPrevState = ss; | 379 fPrevState = ss; |
| 376 iodb->recordTraceMarkersIfNecessary(ss); | 380 iodb->recordTraceMarkersIfNecessary(ss); |
| 377 } | 381 } |
| 382 |
| 383 this->recordXferBarrierIfNecessary(iodb, pipelineInfo); |
| 378 return true; | 384 return true; |
| 379 } | 385 } |
| 380 | 386 |
| 381 bool GrTargetCommands::setupPipelineAndShouldDraw(GrInOrderDrawBuffer* iodb, | 387 bool GrTargetCommands::setupPipelineAndShouldDraw(GrInOrderDrawBuffer* iodb, |
| 382 GrBatch* batch, | 388 GrBatch* batch, |
| 383 const GrDrawTarget::PipelineIn
fo& pipelineInfo) { | 389 const GrDrawTarget::PipelineIn
fo& pipelineInfo) { |
| 384 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, ()); | 390 SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, ()); |
| 385 iodb->setupPipeline(pipelineInfo, ss->pipelineLocation()); | 391 iodb->setupPipeline(pipelineInfo, ss->pipelineLocation()); |
| 386 | 392 |
| 387 if (ss->getPipeline()->mustSkip()) { | 393 if (ss->getPipeline()->mustSkip()) { |
| 388 fCmdBuffer.pop_back(); | 394 fCmdBuffer.pop_back(); |
| 389 return false; | 395 return false; |
| 390 } | 396 } |
| 391 | 397 |
| 392 batch->initBatchTracker(ss->getPipeline()->getInitBatchTracker()); | 398 batch->initBatchTracker(ss->getPipeline()->getInitBatchTracker()); |
| 393 | 399 |
| 394 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && | 400 if (fPrevState && !fPrevState->fPrimitiveProcessor.get() && |
| 395 fPrevState->getPipeline()->isEqual(*ss->getPipeline())) { | 401 fPrevState->getPipeline()->isEqual(*ss->getPipeline())) { |
| 396 fCmdBuffer.pop_back(); | 402 fCmdBuffer.pop_back(); |
| 397 } else { | 403 } else { |
| 398 fPrevState = ss; | 404 fPrevState = ss; |
| 399 iodb->recordTraceMarkersIfNecessary(ss); | 405 iodb->recordTraceMarkersIfNecessary(ss); |
| 400 } | 406 } |
| 407 |
| 408 this->recordXferBarrierIfNecessary(iodb, pipelineInfo); |
| 401 return true; | 409 return true; |
| 402 } | 410 } |
| 403 | 411 |
| 412 void GrTargetCommands::recordXferBarrierIfNecessary(GrInOrderDrawBuffer* iodb, |
| 413 const GrDrawTarget::Pipeline
Info& info) { |
| 414 SkASSERT(fPrevState); |
| 415 const GrXferProcessor& xp = *fPrevState->getXferProcessor(); |
| 416 GrRenderTarget* rt = fPrevState->getRenderTarget(); |
| 417 |
| 418 GrXferBarrierType barrierType; |
| 419 if (!xp.willNeedXferBarrier(rt, *iodb->caps(), &barrierType)) { |
| 420 return; |
| 421 } |
| 422 |
| 423 XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, XferBarrier, ()); |
| 424 xb->fBarrierType = barrierType; |
| 425 |
| 426 iodb->recordTraceMarkersIfNecessary(xb); |
| 427 } |
| 428 |
| OLD | NEW |