Reorder across clears
BUG=skia: Review URL: https://codereview.chromium.org/1161643002
This commit is contained in:
parent
43315bbe4b
commit
36ec383c57
@ -32,6 +32,11 @@ GrTargetCommands::Cmd* GrCommandBuilder::recordClear(const SkIRect* rect,
|
||||
r.setLTRB(0, 0, renderTarget->width(), renderTarget->height());
|
||||
rect = &r;
|
||||
}
|
||||
|
||||
SkASSERT(color == GrColor_ILLEGAL ||
|
||||
canIgnoreRect ||
|
||||
(rect->fLeft <= rect->fRight && rect->fTop <= rect->fBottom));
|
||||
|
||||
Clear* clr = GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), Clear, (renderTarget));
|
||||
GrColorIsPMAssert(color);
|
||||
clr->fColor = color;
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
#include "GrReorderCommandBuilder.h"
|
||||
|
||||
static bool intersect(const SkRect& a, const SkRect& b) {
|
||||
template <class Left, class Right>
|
||||
static bool intersect(const Left& a, const Right& b) {
|
||||
SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom &&
|
||||
b.fLeft <= b.fRight && b.fTop <= b.fBottom);
|
||||
return a.fLeft < b.fRight && b.fLeft < a.fRight &&
|
||||
@ -37,6 +38,16 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr
|
||||
if (intersect(previous->fBatch->bounds(), batch->bounds())) {
|
||||
break;
|
||||
}
|
||||
} else if (Cmd::kClear_CmdType == reverseIter->type()) {
|
||||
Clear* previous = static_cast<Clear*>(reverseIter.get());
|
||||
|
||||
// We set the color to illegal if we are doing a discard.
|
||||
// If we can ignore the rect, then we do a full clear
|
||||
if (previous->fColor == GrColor_ILLEGAL ||
|
||||
previous->fCanIgnoreRect ||
|
||||
intersect(batch->bounds(), previous->fRect)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// TODO temporary until we can navigate the other types of commands
|
||||
break;
|
||||
|
@ -35,11 +35,12 @@ public:
|
||||
kStencilPath_CmdType = 1,
|
||||
kSetState_CmdType = 2,
|
||||
kClear_CmdType = 3,
|
||||
kCopySurface_CmdType = 4,
|
||||
kDrawPath_CmdType = 5,
|
||||
kDrawPaths_CmdType = 6,
|
||||
kDrawBatch_CmdType = 7,
|
||||
kXferBarrier_CmdType = 8,
|
||||
kClearStencil_CmdType = 4,
|
||||
kCopySurface_CmdType = 5,
|
||||
kDrawPath_CmdType = 6,
|
||||
kDrawPaths_CmdType = 7,
|
||||
kDrawBatch_CmdType = 8,
|
||||
kXferBarrier_CmdType = 9,
|
||||
};
|
||||
|
||||
Cmd(CmdType type) : fMarkerID(-1), fType(type) {}
|
||||
@ -190,7 +191,7 @@ private:
|
||||
|
||||
// This command is ONLY used by the clip mask manager to clear the stencil clip bits
|
||||
struct ClearStencilClip : public Cmd {
|
||||
ClearStencilClip(GrRenderTarget* rt) : Cmd(kClear_CmdType), fRenderTarget(rt) {}
|
||||
ClearStencilClip(GrRenderTarget* rt) : Cmd(kClearStencil_CmdType), fRenderTarget(rt) {}
|
||||
|
||||
GrRenderTarget* renderTarget() const { return fRenderTarget.get(); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user