| 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 "GrCommandBuilder.h" | 8 #include "GrCommandBuilder.h" |
| 9 | 9 |
| 10 #include "GrInOrderCommandBuilder.h" | 10 #include "GrInOrderCommandBuilder.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 GrTargetCommands::Cmd* GrCommandBuilder::recordClear(const SkIRect& rect, | 21 GrTargetCommands::Cmd* GrCommandBuilder::recordClear(const SkIRect& rect, |
| 22 GrColor color, | 22 GrColor color, |
| 23 GrRenderTarget* renderTarge
t) { | 23 GrRenderTarget* renderTarge
t) { |
| 24 SkASSERT(renderTarget); | 24 SkASSERT(renderTarget); |
| 25 SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom); | 25 SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom); |
| 26 | 26 |
| 27 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg
et)); | 27 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg
et)); |
| 28 GrColorIsPMAssert(color); | 28 GrColorIsPMAssert(color); |
| 29 clr->fColor = color; | 29 clr->fColor = color; |
| 30 clr->fRect = rect; | 30 clr->fRect = rect; |
| 31 GrBATCH_INFO("Recording clear %d\n", clr->uniqueID()); |
| 31 return clr; | 32 return clr; |
| 32 } | 33 } |
| 33 | 34 |
| 34 GrTargetCommands::Cmd* GrCommandBuilder::recordClearStencilClip(const SkIRect& r
ect, | 35 GrTargetCommands::Cmd* GrCommandBuilder::recordClearStencilClip(const SkIRect& r
ect, |
| 35 bool insideClip, | 36 bool insideClip, |
| 36 GrRenderTarget*
renderTarget) { | 37 GrRenderTarget*
renderTarget) { |
| 37 SkASSERT(renderTarget); | 38 SkASSERT(renderTarget); |
| 38 | 39 |
| 39 ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), | 40 ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), |
| 40 ClearStencilClip, | 41 ClearStencilClip, |
| 41 (renderTarget)); | 42 (renderTarget)); |
| 42 clr->fRect = rect; | 43 clr->fRect = rect; |
| 43 clr->fInsideClip = insideClip; | 44 clr->fInsideClip = insideClip; |
| 45 GrBATCH_INFO("Recording clear stencil clip %d\n", clr->uniqueID()); |
| 44 return clr; | 46 return clr; |
| 45 } | 47 } |
| 46 | 48 |
| 47 GrTargetCommands::Cmd* GrCommandBuilder::recordDiscard(GrRenderTarget* renderTar
get) { | 49 GrTargetCommands::Cmd* GrCommandBuilder::recordDiscard(GrRenderTarget* renderTar
get) { |
| 48 SkASSERT(renderTarget); | 50 SkASSERT(renderTarget); |
| 49 | 51 |
| 50 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg
et)); | 52 Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarg
et)); |
| 51 clr->fColor = GrColor_ILLEGAL; | 53 clr->fColor = GrColor_ILLEGAL; |
| 54 GrBATCH_INFO("Recording discard %d\n", clr->uniqueID()); |
| 52 return clr; | 55 return clr; |
| 53 } | 56 } |
| 54 | 57 |
| 55 GrTargetCommands::Cmd* GrCommandBuilder::recordCopySurface(GrSurface* dst, | 58 GrTargetCommands::Cmd* GrCommandBuilder::recordCopySurface(GrSurface* dst, |
| 56 GrSurface* src, | 59 GrSurface* src, |
| 57 const SkIRect& srcRec
t, | 60 const SkIRect& srcRec
t, |
| 58 const SkIPoint& dstPo
int) { | 61 const SkIPoint& dstPo
int) { |
| 59 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), CopySurface,
(dst, src)); | 62 CopySurface* cs = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), CopySurface,
(dst, src)); |
| 60 cs->fSrcRect = srcRect; | 63 cs->fSrcRect = srcRect; |
| 61 cs->fDstPoint = dstPoint; | 64 cs->fDstPoint = dstPoint; |
| 65 GrBATCH_INFO("Recording copysurface %d\n", cs->uniqueID()); |
| 62 return cs; | 66 return cs; |
| 63 } | 67 } |
| 64 | 68 |
| 65 GrTargetCommands::Cmd* | 69 GrTargetCommands::Cmd* |
| 66 GrCommandBuilder::recordXferBarrierIfNecessary(const GrPipeline& pipeline, | 70 GrCommandBuilder::recordXferBarrierIfNecessary(const GrPipeline& pipeline, |
| 67 const GrCaps& caps) { | 71 const GrCaps& caps) { |
| 68 const GrXferProcessor& xp = *pipeline.getXferProcessor(); | 72 const GrXferProcessor& xp = *pipeline.getXferProcessor(); |
| 69 GrRenderTarget* rt = pipeline.getRenderTarget(); | 73 GrRenderTarget* rt = pipeline.getRenderTarget(); |
| 70 | 74 |
| 71 GrXferBarrierType barrierType; | 75 GrXferBarrierType barrierType; |
| 72 if (!xp.willNeedXferBarrier(rt, caps, &barrierType)) { | 76 if (!xp.willNeedXferBarrier(rt, caps, &barrierType)) { |
| 73 return NULL; | 77 return NULL; |
| 74 } | 78 } |
| 75 | 79 |
| 76 XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier,
(rt)); | 80 XferBarrier* xb = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), XferBarrier,
(rt)); |
| 77 xb->fBarrierType = barrierType; | 81 xb->fBarrierType = barrierType; |
| 82 GrBATCH_INFO("Recording xfer barrier %d\n", xb->uniqueID()); |
| 78 return xb; | 83 return xb; |
| 79 } | 84 } |
| OLD | NEW |