MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / allocVertexBuffer

Method allocVertexBuffer

Engine/source/gfx/gl/gfxGLDevice.cpp:371–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371GFXVertexBuffer *GFXGLDevice::allocVertexBuffer( U32 numVerts,
372 const GFXVertexFormat *vertexFormat,
373 U32 vertSize,
374 GFXBufferType bufferType,
375 void* data )
376{
377 PROFILE_SCOPE(GFXGLDevice_allocVertexBuffer);
378 if(bufferType == GFXBufferTypeVolatile)
379 return findVolatileVBO(numVerts, vertexFormat, vertSize);
380
381 GFXGLVertexBuffer* buf = new GFXGLVertexBuffer( GFX, numVerts, vertexFormat, vertSize, bufferType );
382 buf->registerResourceWithDevice(this);
383
384 if(data)
385 {
386 void* dest;
387 buf->lock(0, numVerts, &dest);
388 dMemcpy(dest, data, vertSize * numVerts);
389 buf->unlock();
390 }
391
392 return buf;
393}
394
395GFXPrimitiveBuffer *GFXGLDevice::allocPrimitiveBuffer( U32 numIndices, U32 numPrimitives, GFXBufferType bufferType, void* data )
396{

Callers 1

setMethod · 0.45

Calls 4

dMemcpyFunction · 0.50
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected