本文整理汇总了C++中DrawInfo::indexCount方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawInfo::indexCount方法的具体用法?C++ DrawInfo::indexCount怎么用?C++ DrawInfo::indexCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawInfo
的用法示例。
在下文中一共展示了DrawInfo::indexCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDraw
void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
const GrDrawState& drawState = this->getDrawState();
AutoClipReenable acr;
if (drawState.isClipState() &&
info.getDevBounds() &&
this->quickInsideClip(*info.getDevBounds())) {
acr.set(this->drawState());
}
this->recordClipIfNecessary();
this->recordStateIfNecessary();
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(info);
if (info.instanceCount() > instancesConcated) {
draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, vb, ib));
draw->fInfo.adjustInstanceCount(-instancesConcated);
} else {
return;
}
} else {
draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, vb, ib));
}
this->recordTraceMarkersIfNecessary();
// Adjust the starting vertex and index when we are using reserved or array sources to
// compensate for the fact that the data was inserted into a larger vb/ib owned by the pool.
if (kBuffer_GeometrySrcType != this->getGeomSrc().fVertexSrc) {
size_t bytes = (info.vertexCount() + info.startVertex()) * drawState.getVertexStride();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, bytes);
draw->fInfo.adjustStartVertex(poolState.fPoolStartVertex);
}
if (info.isIndexed() && kBuffer_GeometrySrcType != this->getGeomSrc().fIndexSrc) {
size_t bytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t);
poolState.fUsedPoolIndexBytes = SkTMax(poolState.fUsedPoolIndexBytes, bytes);
draw->fInfo.adjustStartIndex(poolState.fPoolStartIndex);
}
}
示例2: onDraw
void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
GeometryPoolState& poolState = fGeoPoolStateStack.back();
const GrDrawState& drawState = this->getDrawState();
AutoClipReenable acr;
if (drawState.isClipState() &&
NULL != info.getDevBounds() &&
this->quickInsideClip(*info.getDevBounds())) {
acr.set(this->drawState());
}
if (this->needsNewClip()) {
this->recordClip();
}
if (this->needsNewState()) {
this->recordState();
}
DrawRecord* draw;
if (info.isInstanced()) {
int instancesConcated = this->concatInstancedDraw(info);
if (info.instanceCount() > instancesConcated) {
draw = this->recordDraw(info);
draw->adjustInstanceCount(-instancesConcated);
} else {
return;
}
} else {
draw = this->recordDraw(info);
}
switch (this->getGeomSrc().fVertexSrc) {
case kBuffer_GeometrySrcType:
draw->fVertexBuffer = this->getGeomSrc().fVertexBuffer;
break;
case kReserved_GeometrySrcType: // fallthrough
case kArray_GeometrySrcType: {
size_t vertexBytes = (info.vertexCount() + info.startVertex()) *
drawState.getVertexSize();
poolState.fUsedPoolVertexBytes = GrMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->fVertexBuffer = poolState.fPoolVertexBuffer;
draw->adjustStartVertex(poolState.fPoolStartVertex);
break;
}
default:
GrCrash("unknown geom src type");
}
draw->fVertexBuffer->ref();
if (info.isIndexed()) {
switch (this->getGeomSrc().fIndexSrc) {
case kBuffer_GeometrySrcType:
draw->fIndexBuffer = this->getGeomSrc().fIndexBuffer;
break;
case kReserved_GeometrySrcType: // fallthrough
case kArray_GeometrySrcType: {
size_t indexBytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t);
poolState.fUsedPoolIndexBytes = GrMax(poolState.fUsedPoolIndexBytes, indexBytes);
draw->fIndexBuffer = poolState.fPoolIndexBuffer;
draw->adjustStartIndex(poolState.fPoolStartIndex);
break;
}
default:
GrCrash("unknown geom src type");
}
draw->fIndexBuffer->ref();
} else {
draw->fIndexBuffer = NULL;
}
}