Optimize vertex buffer writing in Debug Draw
This commit is contained in:
@@ -75,6 +75,27 @@ public:
|
||||
Data.Add((byte*)bytes, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocates bytes in the buffer by resizing the buffer for new memory and returns the pointer to the start of the allocated space.
|
||||
/// </summary>
|
||||
/// <param name="size">Amount of data to allocate (in bytes)</param>
|
||||
FORCE_INLINE byte* WriteReserve(int32 size)
|
||||
{
|
||||
const int32 start = Data.Count();
|
||||
Data.AddUninitialized(size);
|
||||
return Data.Get() + start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocates bytes in the buffer by resizing the buffer for new memory and returns the pointer to the start of the allocated space.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of items to allocate</param>
|
||||
template<typename T>
|
||||
FORCE_INLINE T* WriteReserve(int32 count)
|
||||
{
|
||||
return (T*)WriteReserve(count * sizeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlock buffer and flush data with a buffer (it will be ready for an immediate draw).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user