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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 2078483002: Start using GrGpuCommandBuffer in GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@memoryWAR
Patch Set: clean up Created 4 years, 6 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 | « gyp/gpu.gypi ('k') | src/gpu/GrGpu.h » ('j') | src/gpu/GrGpuCommandBuffer.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 7213a92152af7d1efca0a48c65e815074a38a9a1..fe388752960aba05027643490cd4ba5a26c1b8d7 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -11,6 +11,7 @@
#include "GrCaps.h"
#include "GrDrawContext.h"
#include "GrGpu.h"
+#include "GrGpuCommandBuffer.h"
#include "GrPath.h"
#include "GrPipeline.h"
#include "GrMemoryPool.h"
@@ -209,10 +210,33 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) {
void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
// Draw all the generated geometry.
SkRandom random;
+ GrRenderTarget* currentRT = nullptr;
+ SkAutoTDelete<GrGpuCommandBuffer> commandBuffer;
for (int i = 0; i < fBatches.count(); ++i) {
if (!fBatches[i]) {
continue;
}
+ if (fBatches[i]->renderTarget() != currentRT /* || commandBuffer*/) {
jvanverth1 2016/06/17 15:25:15 Remove /* || commandBuffer */?
egdaniel 2016/06/17 18:49:14 Done.
+ if (commandBuffer) {
+ commandBuffer->end();
+ // For now just use size of whole render target, but this should be updated to
+ // only be the actual bounds of the various draws.
+ SkIRect bounds = SkIRect::MakeWH(currentRT->width(), currentRT->height());
+ commandBuffer->submit(bounds);
+ commandBuffer.reset();
+ }
+ currentRT = fBatches[i]->renderTarget();
+ if (currentRT) {
+ static const GrGpuCommandBuffer::LoadAndStoreOp kBasicLoadStoreOp =
+ GrGpuCommandBuffer::kLoadAndStore_LoadAndStoreOp;
+ static const GrColor kClearValue = GrColor_ILLEGAL;
+ commandBuffer.reset(fGpu->createCommandBuffer(currentRT,
+ kBasicLoadStoreOp, // Color
+ kClearValue, // Color clear
+ kBasicLoadStoreOp, // Stencil
+ kClearValue)); // Stencil clear
+ }
+ }
if (fDrawBatchBounds) {
const SkRect& bounds = fBatches[i]->bounds();
SkIRect ibounds;
@@ -223,7 +247,14 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
fGpu->drawDebugWireRect(rt, ibounds, 0xFF000000 | random.nextU());
}
}
- fBatches[i]->draw(flushState);
+ fBatches[i]->draw(flushState, commandBuffer);
+ }
+ if (commandBuffer) {
+ commandBuffer->end();
+ // For now just use size of whole render target, but this should be updated to
+ // only be the actual bounds of the various draws.
+ SkIRect bounds = SkIRect::MakeWH(currentRT->width(), currentRT->height());
+ commandBuffer->submit(bounds);
}
fGpu->finishDrawTarget();
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrGpu.h » ('j') | src/gpu/GrGpuCommandBuffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698