| 393 | } |
| 394 | |
| 395 | GFXPrimitiveBuffer *GFXGLDevice::allocPrimitiveBuffer( U32 numIndices, U32 numPrimitives, GFXBufferType bufferType, void* data ) |
| 396 | { |
| 397 | GFXPrimitiveBuffer* buf; |
| 398 | |
| 399 | if(bufferType == GFXBufferTypeVolatile) |
| 400 | { |
| 401 | buf = findVolatilePBO(numIndices, numPrimitives); |
| 402 | } |
| 403 | else |
| 404 | { |
| 405 | buf = new GFXGLPrimitiveBuffer(GFX, numIndices, numPrimitives, bufferType); |
| 406 | buf->registerResourceWithDevice(this); |
| 407 | } |
| 408 | |
| 409 | if(data) |
| 410 | { |
| 411 | void* dest; |
| 412 | buf->lock(0, numIndices, &dest); |
| 413 | dMemcpy(dest, data, sizeof(U16) * numIndices); |
| 414 | buf->unlock(); |
| 415 | } |
| 416 | return buf; |
| 417 | } |
| 418 | |
| 419 | void GFXGLDevice::setVertexStream( U32 stream, GFXVertexBuffer *buffer ) |
| 420 | { |