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

Unified Diff: src/gpu/GrTargetCommands.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 8 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/GrTargetCommands.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTargetCommands.cpp
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f228756edfdfd409813a268bf651973966ccbdad
--- /dev/null
+++ b/src/gpu/GrTargetCommands.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrTargetCommands.h"
+
+#include "GrBatchFlushState.h"
+#include "GrGpu.h"
+#include "GrPathRendering.h"
+#include "batches/GrDrawBatch.h"
+#include "batches/GrVertexBatch.h"
+
+GrBATCH_SPEW(int32_t GrTargetCommands::Cmd::gUniqueID = 0;)
+
+void GrTargetCommands::reset() {
+ fCmdBuffer.reset();
+}
+
+void GrTargetCommands::flush(GrGpu* gpu, GrResourceProvider* resourceProvider) {
+ GrBATCH_INFO("Flushing\n");
+ if (fCmdBuffer.empty()) {
+ return;
+ }
+ GrBatchFlushState flushState(fFoo, gpu, resourceProvider, fLastFlushToken);
+ // Loop over all batches and generate geometry
+ CmdBuffer::Iter genIter(fCmdBuffer);
+ while (genIter.next()) {
+ if (Cmd::kDrawBatch_CmdType == genIter->type()) {
+ DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get());
+ db->batch()->prepare(&flushState);
+ }
+ }
+
+ flushState.preIssueDraws();
+
+ CmdBuffer::Iter iter(fCmdBuffer);
+ while (iter.next()) {
+ iter->execute(&flushState);
+ }
+ fLastFlushToken = flushState.lastFlushedToken();
+}
+
+void GrTargetCommands::DrawPath::execute(GrBatchFlushState* state) {
+ if (!fState->fCompiled) {
+ state->gpu()->buildProgramDesc(&fState->fDesc, *fState->fPrimitiveProcessor,
+ *fState->getPipeline(), fState->fBatchTracker);
+ fState->fCompiled = true;
+ }
+ GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState->getPipeline(),
+ &fState->fDesc, &fState->fBatchTracker, &fStencilSettings);
+ state->gpu()->pathRendering()->drawPath(args, this->path());
+}
+
+void GrTargetCommands::DrawPaths::execute(GrBatchFlushState* state) {
+ if (!fState->fCompiled) {
+ state->gpu()->buildProgramDesc(&fState->fDesc, *fState->fPrimitiveProcessor,
+ *fState->getPipeline(), fState->fBatchTracker);
+ fState->fCompiled = true;
+ }
+ GrPathRendering::DrawPathArgs args(fState->fPrimitiveProcessor.get(), fState->getPipeline(),
+ &fState->fDesc, &fState->fBatchTracker, &fStencilSettings);
+ state->gpu()->pathRendering()->drawPaths(args, this->pathRange(), fIndices, fIndexType,
+ fTransforms, fTransformType, fCount);
+}
+
+void GrTargetCommands::DrawBatch::execute(GrBatchFlushState* state) {
+ fBatch->draw(state);
+}
« no previous file with comments | « src/gpu/GrTargetCommands.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698