void RenderPropertyBuffer::Upload( Context& context, BufferIndex bufferIndex )
{
- bool hasGpuBuffer = NULL != mGpuBuffer;
-
// Check if we have a gpu-buffer
unsigned int gpuBufferId = 0; // TODO: MESH_REWORK FIX THIS mDataProvider.GetGpuBufferId( bufferIndex );
- if ( ! hasGpuBuffer )
+ if ( ! mGpuBuffer )
{
// TODO: MESH_REWORK
// mGpuBuffer /*= gpuBufferCache.GetGpuBuffer( gpuBufferId ) */;
}
// Update the GpuBuffer
- if ( ! hasGpuBuffer || mDataProvider.HasDataChanged( bufferIndex ) )
+ if ( mGpuBuffer || mDataProvider.HasDataChanged( bufferIndex ) )
{
std::size_t dataSize = mDataProvider.GetDataSize( bufferIndex );
+ DALI_ASSERT_DEBUG( dataSize && "No data in the property buffer!" );
const void *data = &(mDataProvider.GetData( bufferIndex )[0]);
Vector<unsigned short> ushortData;
{
ushortData.Resize( dataSize );
const unsigned int* unsignedData = static_cast<const unsigned int*>(data);
- for( unsigned int i = 0; i < dataSize; ++i )
+ unsigned int numberOfElements = dataSize / sizeof(unsigned int);
+ for( unsigned int i = 0; i < numberOfElements; ++i )
{
ushortData[i] = unsignedData[i];
}
const PropertyBufferDataProvider& mDataProvider; ///< Data provider used by this property buffer
Vector<GLint> mAttributesLocation; ///< Location of the attributes for the property buffer in this renderer.
- GpuBuffer* mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer
+ OwnerPointer<GpuBuffer> mGpuBuffer; ///< Pointer to the GpuBuffer associated with this RenderPropertyBuffer
GpuBuffer::Target mGpuBufferTarget; ///< The type of GPU buffer to create
GpuBuffer::Usage mGpuBufferUsage; ///< The type of usage the GPU buffer will have
};