Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: src/gpu/GrReorderCommandBuilder.cpp

Issue 1161643002: Reorder across clears (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrCommandBuilder.cpp ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrReorderCommandBuilder.cpp
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp
index 14279de8242e4ea8be030b1b1023e7d3075efed4..e373381cb28becd93630f59323c8486e05bf1f61 100644
--- a/src/gpu/GrReorderCommandBuilder.cpp
+++ b/src/gpu/GrReorderCommandBuilder.cpp
@@ -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;
« no previous file with comments | « src/gpu/GrCommandBuilder.cpp ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698