fix not creating an index buffer on the GPU if a graphics device object is passed in, and ensure all Initialize() overloads call BufferObject's Initialize() as well
This commit is contained in:
parent
52d9989224
commit
c5d4a3094c
|
@ -38,6 +38,9 @@ bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BU
|
|||
|
||||
Resize(numIndices);
|
||||
|
||||
if (graphicsDevice != NULL)
|
||||
CreateOnGpu();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,10 +63,16 @@ bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *
|
|||
if (source->GetNumElements() == 0)
|
||||
return false;
|
||||
|
||||
if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_INDEX, source->GetUsage()))
|
||||
return false;
|
||||
|
||||
Resize(source->GetNumElements());
|
||||
|
||||
memcpy(&m_buffer[0], source->GetBuffer(), GetNumElements() * GetElementWidthInBytes());
|
||||
|
||||
if (graphicsDevice != NULL)
|
||||
CreateOnGpu();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue