| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "GrTargetCommands.h" | |
| 9 | |
| 10 #include "GrBatchFlushState.h" | |
| 11 #include "GrGpu.h" | |
| 12 #include "GrPathRendering.h" | |
| 13 #include "batches/GrDrawBatch.h" | |
| 14 #include "batches/GrVertexBatch.h" | |
| 15 | |
| 16 GrBATCH_SPEW(int32_t GrTargetCommands::Cmd::gUniqueID = 0;) | |
| 17 | |
| 18 void GrTargetCommands::reset() { | |
| 19 fCmdBuffer.reset(); | |
| 20 } | |
| 21 | |
| 22 void GrTargetCommands::flush(GrGpu* gpu, GrResourceProvider* resourceProvider) { | |
| 23 GrBATCH_INFO("Flushing\n"); | |
| 24 if (fCmdBuffer.empty()) { | |
| 25 return; | |
| 26 } | |
| 27 GrBatchFlushState flushState(gpu, resourceProvider, fLastFlushToken); | |
| 28 // Loop over all batches and generate geometry | |
| 29 CmdBuffer::Iter genIter(fCmdBuffer); | |
| 30 while (genIter.next()) { | |
| 31 if (Cmd::kDrawBatch_CmdType == genIter->type()) { | |
| 32 DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get()); | |
| 33 db->batch()->prepare(&flushState); | |
| 34 } | |
| 35 } | |
| 36 | |
| 37 flushState.preIssueDraws(); | |
| 38 | |
| 39 CmdBuffer::Iter iter(fCmdBuffer); | |
| 40 while (iter.next()) { | |
| 41 iter->execute(&flushState); | |
| 42 } | |
| 43 fLastFlushToken = flushState.lastFlushedToken(); | |
| 44 } | |
| 45 | |
| 46 void GrTargetCommands::DrawBatch::execute(GrBatchFlushState* state) { | |
| 47 fBatch->draw(state); | |
| 48 } | |
| OLD | NEW |