| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrBatchTarget.h" | 8 #include "GrBatchTarget.h" |
| 9 | 9 |
| 10 #include "GrBatchAtlas.h" |
| 10 #include "GrPipeline.h" | 11 #include "GrPipeline.h" |
| 11 | 12 |
| 12 /* | 13 GrBatchTarget::GrBatchTarget(GrGpu* gpu, |
| 13 void GrBatchTarget::flush() { | 14 GrVertexBufferAllocPool* vpool, |
| 14 FlushBuffer::Iter iter(fFlushBuffer); | 15 GrIndexBufferAllocPool* ipool) |
| 15 fVertexPool->unmap(); | 16 : fGpu(gpu) |
| 16 fIndexPool->unmap(); | 17 , fVertexPool(vpool) |
| 18 , fIndexPool(ipool) |
| 19 , fFlushBuffer(kFlushBufferInitialSizeInBytes) |
| 20 , fIter(fFlushBuffer) |
| 21 , fNumberOfDraws(0) |
| 22 , fCurrentToken(0) |
| 23 , fLastFlushedToken(0) |
| 24 , fInlineUpdatesIndex(0) { |
| 25 } |
| 17 | 26 |
| 18 while (iter.next()) { | 27 void GrBatchTarget::flushNext(int n) { |
| 28 for (; n > 0; n--) { |
| 29 fLastFlushedToken++; |
| 30 SkDEBUGCODE(bool verify =) fIter.next(); |
| 31 SkASSERT(verify); |
| 32 |
| 33 BufferedFlush* bf = fIter.get(); |
| 34 |
| 35 // Flush all texture uploads |
| 36 int uploadCount = fInlineUploads.count(); |
| 37 while (fInlineUpdatesIndex < uploadCount && |
| 38 fInlineUploads[fInlineUpdatesIndex]->lastUploadToken() <= fLastFl
ushedToken) { |
| 39 fInlineUploads[fInlineUpdatesIndex++]->upload(TextureUploader(fGpu))
; |
| 40 } |
| 41 |
| 19 GrProgramDesc desc; | 42 GrProgramDesc desc; |
| 20 BufferedFlush* bf = iter.get(); | |
| 21 const GrPipeline* pipeline = bf->fPipeline; | 43 const GrPipeline* pipeline = bf->fPipeline; |
| 22 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); | 44 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); |
| 23 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker); | 45 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker); |
| 24 | 46 |
| 25 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); | 47 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); |
| 26 for (int i = 0; i < bf->fDraws.count(); i++) { | 48 |
| 27 fGpu->draw(args, bf->fDraws[i]); | 49 int drawCount = bf->fDraws.count(); |
| 50 const SkSTArray<1, DrawInfo, true>& draws = bf->fDraws; |
| 51 for (int i = 0; i < drawCount; i++) { |
| 52 fGpu->draw(args, draws[i]); |
| 28 } | 53 } |
| 29 } | 54 } |
| 30 fFlushBuffer.reset(); | 55 } |
| 31 }*/ | |
| 32 /* | |
| 33 void GrBatchTarget::flushNext(int n) { | |
| 34 for (; n > 0; n--) { | |
| 35 SkDEBUGCODE(bool verify =) fIter.next(); | |
| 36 SkASSERT(verify); | |
| 37 GrProgramDesc desc; | |
| 38 BufferedFlush* bf = fIter.get(); | |
| 39 const GrPipeline* pipeline = bf->fPipeline; | |
| 40 const GrPrimitiveProcessor* primProc = bf->fPrimitiveProcessor.get(); | |
| 41 fGpu->buildProgramDesc(&desc, *primProc, *pipeline, bf->fBatchTracker); | |
| 42 | |
| 43 GrGpu::DrawArgs args(primProc, pipeline, &desc, &bf->fBatchTracker); | |
| 44 for (int i = 0; i < bf->fDraws.count(); i++) { | |
| 45 fGpu->draw(args, bf->fDraws[i]); | |
| 46 } | |
| 47 } | |
| 48 }*/ | |
| OLD | NEW |