MCPcopy Create free account
hub / github.com/beefytech/Beef / AllocIndexed

Method AllocIndexed

BeefySysLib/gfx/DrawLayer.cpp:129–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void DrawBatch::AllocIndexed(int vtxCount, int idxCount, void** verticesOut, uint16** indicesOut, uint16* idxOfsOut)
130{
131 bool fits = (idxCount + mIdxIdx <= mAllocatedIndices) && (vtxCount + mVtxIdx <= mAllocatedVertices);
132 if ((mRenderState != gBFApp->mRenderDevice->mCurRenderState) || (!fits))
133 {
134 if ((mVtxIdx > 0) || (!fits))
135 {
136 DrawBatch* nextBatch = AllocateChainedBatch(vtxCount, idxCount);
137 return nextBatch->AllocIndexed(vtxCount, idxCount, verticesOut, indicesOut, idxOfsOut);
138 }
139
140 mRenderState = gBFApp->mRenderDevice->mCurRenderState;
141 }
142
143 *verticesOut = (uint8*)mVertices + (mVtxIdx * mVtxSize);
144 *indicesOut = mIndices + mIdxIdx;
145 *idxOfsOut = mVtxIdx;
146
147 mVtxIdx += vtxCount;
148 mIdxIdx += idxCount;
149}
150
151//
152

Callers 3

Gfx_DrawQuadsFunction · 0.80
Gfx_DrawIndexedVerticesFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected