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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 777673003: move program descriptor generation to flush (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 6 years 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
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 55331748531a67749c1a1c4ef2f4534d9fffa939..1e7d4e569c27e937fe73367f3672bbd76194fadc 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -409,8 +409,9 @@ void GrInOrderDrawBuffer::onFlush() {
if (kSetState_Cmd == strip_trace_bit(iter->fType)) {
SetState* ss = reinterpret_cast<SetState*>(iter.get());
currentOptState = &ss->fState;
+ this->getGpu()->buildProgramDesc(*currentOptState, ss->fDrawType, &fDesc);
} else {
- iter->execute(this, currentOptState);
+ iter->execute(this, currentOptState, &fDesc);
}
if (cmd_has_trace_marker(iter->fType)) {
@@ -422,35 +423,44 @@ void GrInOrderDrawBuffer::onFlush() {
++fDrawID;
}
-void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const GrOptDrawState* optState) {
- SkASSERT(optState);
- buf->getGpu()->draw(*optState, fInfo);
+void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf,
+ const GrOptDrawState* optState,
+ const GrProgramDesc* desc) {
+ SkASSERT(optState && desc);
+ buf->getGpu()->draw(*optState, *desc, fInfo);
}
void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf,
- const GrOptDrawState* optState) {
- SkASSERT(optState);
- buf->getGpu()->stencilPath(*optState, this->path(), fStencilSettings);
+ const GrOptDrawState* optState,
+ const GrProgramDesc* desc) {
+ SkASSERT(optState && desc);
+ buf->getGpu()->stencilPath(*optState, *desc, this->path(), fStencilSettings);
}
void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf,
- const GrOptDrawState* optState) {
- SkASSERT(optState);
- buf->getGpu()->drawPath(*optState, this->path(), fStencilSettings);
+ const GrOptDrawState* optState,
+ const GrProgramDesc* desc) {
+ SkASSERT(optState && desc);
+ buf->getGpu()->drawPath(*optState, *desc, this->path(), fStencilSettings);
}
void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf,
- const GrOptDrawState* optState) {
- SkASSERT(optState);
- buf->getGpu()->drawPaths(*optState, this->pathRange(),
+ const GrOptDrawState* optState,
+ const GrProgramDesc* desc) {
+ SkASSERT(optState && desc);
+ buf->getGpu()->drawPaths(*optState, *desc, this->pathRange(),
&buf->fPathIndexBuffer[fIndicesLocation], fIndexType,
&buf->fPathTransformBuffer[fTransformsLocation], fTransformType,
fCount, fStencilSettings);
}
-void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*, const GrOptDrawState*) {}
+void GrInOrderDrawBuffer::SetState::execute(GrInOrderDrawBuffer*,
+ const GrOptDrawState*,
+ const GrProgramDesc*) {}
-void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const GrOptDrawState*) {
+void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf,
+ const GrOptDrawState*,
+ const GrProgramDesc*) {
if (GrColor_ILLEGAL == fColor) {
buf->getGpu()->discard(this->renderTarget());
} else {
@@ -459,11 +469,14 @@ void GrInOrderDrawBuffer::Clear::execute(GrInOrderDrawBuffer* buf, const GrOptDr
}
void GrInOrderDrawBuffer::ClearStencilClip::execute(GrInOrderDrawBuffer* buf,
- const GrOptDrawState*) {
+ const GrOptDrawState*,
+ const GrProgramDesc*) {
buf->getGpu()->clearStencilClip(fRect, fInsideClip, this->renderTarget());
}
-void GrInOrderDrawBuffer::CopySurface::execute(GrInOrderDrawBuffer* buf, const GrOptDrawState*) {
+void GrInOrderDrawBuffer::CopySurface::execute(GrInOrderDrawBuffer* buf,
+ const GrOptDrawState*,
+ const GrProgramDesc*) {
buf->getGpu()->copySurface(this->dst(), this->src(), fSrcRect, fDstPoint);
}
@@ -486,7 +499,8 @@ bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
const GrClipMaskManager::ScissorState& scissor,
const GrDeviceCoordTexture* dstCopy) {
SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState,
- (ds, this->getGpu(), scissor, dstCopy, drawType));
+ (ds, *this->getGpu()->caps(), scissor, dstCopy,
+ drawType));
if (ss->fState.mustSkip()) {
fCmdBuffer.pop_back();
return false;

Powered by Google App Engine
This is Rietveld 408576698