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

Unified Diff: src/gpu/GrReorderCommandBuilder.cpp

Issue 1293563003: Put clear and discard into GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@protectedprepare
Patch Set: tiny Created 5 years, 4 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/GrReorderCommandBuilder.h ('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 d70e25ad81bea817fc148a662baf889f0bf331f3..af34998613048418c75b8047f6465f982850c096 100644
--- a/src/gpu/GrReorderCommandBuilder.cpp
+++ b/src/gpu/GrReorderCommandBuilder.cpp
@@ -6,6 +6,7 @@
*/
#include "GrReorderCommandBuilder.h"
+#include "SkStringUtils.h"
template <class Left, class Right>
static bool intersect(const Left& a, const Right& b) {
@@ -15,7 +16,7 @@ static bool intersect(const Left& a, const Right& b) {
a.fTop < b.fBottom && b.fTop < a.fBottom;
}
-GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* batch,
+GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrBatch* batch,
const GrCaps& caps) {
// Check if there is a Batch Draw we can batch with by linearly searching back until we either
// 1) check every draw
@@ -25,26 +26,13 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* bat
static const int kMaxLookback = 10;
int i = 0;
- GrRenderTarget* rt = batch->pipeline()->getRenderTarget();
-
GrBATCH_INFO("Re-Recording (%s, B%u)\n"
- "\tRenderTarget %p\n"
"\tBounds (%f, %f, %f, %f)\n",
batch->name(),
- batch->uniqueID(), rt,
+ batch->uniqueID(),
batch->bounds().fLeft, batch->bounds().fRight,
batch->bounds().fTop, batch->bounds().fBottom);
- if (GR_BATCH_SPEW) {
- SkDebugf("\tColorStages:\n");
- for (int i = 0; i < batch->pipeline()->numColorFragmentStages(); i++) {
- SkDebugf("\t\t%s\n", batch->pipeline()->getColorStage(i).processor()->name());
- }
- SkDebugf("\tCoverageStages:\n");
- for (int i = 0; i < batch->pipeline()->numCoverageFragmentStages(); i++) {
- SkDebugf("\t\t%s\n", batch->pipeline()->getCoverageStage(i).processor()->name());
- }
- SkDebugf("\tXP: %s\n", batch->pipeline()->getXferProcessor()->name());
- }
+ GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
GrBATCH_INFO("\tOutcome:\n");
if (!this->cmdBuffer()->empty()) {
GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer());
@@ -53,7 +41,7 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* bat
if (Cmd::kDrawBatch_CmdType == reverseIter->type()) {
DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get());
- if (previous->batch()->pipeline()->getRenderTarget() != rt) {
+ if (previous->batch()->renderTargetUniqueID() != batch->renderTargetUniqueID()) {
GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n",
previous->batch()->name(), previous->batch()->uniqueID());
break;
@@ -70,24 +58,9 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* bat
previous->batch()->name(), previous->batch()->uniqueID());
break;
}
- } else if (Cmd::kClear_CmdType == reverseIter->type()) {
- Clear* previous = static_cast<Clear*>(reverseIter.get());
-
- // We cannot continue to search backwards if the render target changes
- if (previous->renderTarget() != rt) {
- GrBATCH_INFO("\t\tBreaking because of Clear's Rendertarget change\n");
- break;
- }
-
- // We set the color to illegal if we are doing a discard.
- if (previous->fColor == GrColor_ILLEGAL ||
- intersect(batch->bounds(), previous->fRect)) {
- GrBATCH_INFO("\t\tBreaking because of Clear intersection\n");
- break;
- }
} else {
GrBATCH_INFO("\t\tBreaking because of other %08x\n", reverseIter->type());
- // TODO temporary until we can navigate the other types of commands
+ // TODO temporary until we only have batches.
break;
}
} while (reverseIter.previous() && ++i < kMaxLookback);
« no previous file with comments | « src/gpu/GrReorderCommandBuilder.h ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698