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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 737723003: drawinfo carries bufferinfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 1 month 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/GrInOrderDrawBuffer.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index b0504b75a970e1c19cfbecfc9a32d7129085d488..778b8cf590894d042f1c7b7b99d09bc7ff93c837 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -219,8 +219,8 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds,
if (!draw->fInfo.isInstanced() ||
draw->fInfo.verticesPerInstance() != info.verticesPerInstance() ||
draw->fInfo.indicesPerInstance() != info.indicesPerInstance() ||
- draw->vertexBuffer() != vertexBuffer ||
- draw->indexBuffer() != geomSrc.fIndexBuffer ||
+ draw->fInfo.vertexBuffer() != vertexBuffer ||
+ draw->fInfo.indexBuffer() != geomSrc.fIndexBuffer ||
draw->fScissorState != scissorState) {
return 0;
}
@@ -260,39 +260,25 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds,
void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
const DrawInfo& info,
const GrClipMaskManager::ScissorState& scissorState) {
+ SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
+
GeometryPoolState& poolState = fGeoPoolStateStack.back();
this->recordStateIfNecessary(ds,
GrGpu::PrimTypeToDrawType(info.primitiveType()),
info.getDstCopy());
- const GrVertexBuffer* vb;
- if (kBuffer_GeometrySrcType == this->getGeomSrc().fVertexSrc) {
- vb = this->getGeomSrc().fVertexBuffer;
- } else {
- vb = poolState.fPoolVertexBuffer;
- }
-
- const GrIndexBuffer* ib = NULL;
- if (info.isIndexed()) {
- if (kBuffer_GeometrySrcType == this->getGeomSrc().fIndexSrc) {
- ib = this->getGeomSrc().fIndexBuffer;
- } else {
- ib = poolState.fPoolIndexBuffer;
- }
- }
-
Draw* draw;
if (info.isInstanced()) {
int instancesConcated = this->concatInstancedDraw(ds, info, scissorState);
if (info.instanceCount() > instancesConcated) {
- draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorState, vb, ib));
+ draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorState));
draw->fInfo.adjustInstanceCount(-instancesConcated);
} else {
return;
}
} else {
- draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorState, vb, ib));
+ draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, scissorState));
}
this->recordTraceMarkersIfNecessary();
@@ -432,6 +418,23 @@ void GrInOrderDrawBuffer::discard(GrRenderTarget* renderTarget) {
this->recordTraceMarkersIfNecessary();
}
+void GrInOrderDrawBuffer::setDrawBuffers(DrawInfo* info) {
+ GeometryPoolState& poolState = fGeoPoolStateStack.back();
+ if (kBuffer_GeometrySrcType == this->getGeomSrc().fVertexSrc) {
+ info->setVertexBuffer(this->getGeomSrc().fVertexBuffer);
+ } else {
+ info->setVertexBuffer(poolState.fPoolVertexBuffer);
+ }
+
+ if (info->isIndexed()) {
+ if (kBuffer_GeometrySrcType == this->getGeomSrc().fIndexSrc) {
+ info->setIndexBuffer(this->getGeomSrc().fIndexBuffer);
+ } else {
+ info->setIndexBuffer(poolState.fPoolIndexBuffer);
+ }
+ }
+}
+
void GrInOrderDrawBuffer::reset() {
SkASSERT(1 == fGeoPoolStateStack.count());
this->resetVertexSource();
@@ -511,12 +514,7 @@ void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const GrOptDra
if (!optState) {
return;
}
- GrGpu* dstGpu = buf->fDstGpu;
- dstGpu->setVertexSourceToBuffer(this->vertexBuffer(), optState->getVertexStride());
- if (fInfo.isIndexed()) {
- dstGpu->setIndexSourceToBuffer(this->indexBuffer());
- }
- dstGpu->draw(*optState, fInfo, fScissorState);
+ buf->fDstGpu->draw(*optState, fInfo, fScissorState);
}
void GrInOrderDrawBuffer::StencilPath::execute(GrInOrderDrawBuffer* buf,
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/gl/GrGpuGL_program.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698