Minor improvements

This commit is contained in:
Wojtek Figat
2022-11-10 23:45:58 +01:00
parent 4ba1531cda
commit aa978ce0e4
3 changed files with 6 additions and 7 deletions

View File

@@ -39,7 +39,6 @@ public:
/// <summary>
/// Returns true if data is valid.
/// </summary>
/// <returns>True if is valid, otherwise false.</returns>
FORCE_INLINE bool IsValid() const
{
return _data != nullptr;
@@ -48,7 +47,6 @@ public:
/// <summary>
/// Returns true if data is invalid.
/// </summary>
/// <returns>True if is invalid, otherwise false.</returns>
FORCE_INLINE bool IsInvalid() const
{
return _data == nullptr;
@@ -57,7 +55,6 @@ public:
/// <summary>
/// Gets length of the data.
/// </summary>
/// <returns>The amount of elements.</returns>
FORCE_INLINE int32 Length() const
{
return _length;
@@ -66,7 +63,6 @@ public:
/// <summary>
/// Gets the pointer to the data.
/// </summary>
/// <returns>The data.</returns>
FORCE_INLINE T* Get()
{
return _data;
@@ -75,7 +71,6 @@ public:
/// <summary>
/// Gets the pointer to the data.
/// </summary>
/// <returns>The data.</returns>
FORCE_INLINE const T* Get() const
{
return _data;
@@ -84,7 +79,6 @@ public:
/// <summary>
/// Gets the pointer to the data.
/// </summary>
/// <returns>The data.</returns>
template<typename U>
FORCE_INLINE U* Get() const
{

View File

@@ -470,7 +470,7 @@ API_STRUCT(NoDefault) struct RenderContextBatch
/// <summary>
/// The Job System labels to wait on, after draw calls collecting.
/// </summary>
API_FIELD() Array<int64, InlinedAllocation<8>> WaitLabels;
API_FIELD() Array<uint64, InlinedAllocation<8>> WaitLabels;
RenderContextBatch() = default;
RenderContextBatch(SceneRenderTask* task);

View File

@@ -40,6 +40,7 @@ namespace
};
Array<MemPoolEntry> MemPool;
CriticalSection MemPoolLocker;
}
void RendererDirectionalLightData::SetupLightData(LightData* data, bool useShadow) const
@@ -113,6 +114,7 @@ void RendererSkyLightData::SetupLightData(LightData* data, bool useShadow) const
void* RendererAllocation::Allocate(uintptr size)
{
void* result = nullptr;
MemPoolLocker.Lock();
for (int32 i = 0; i < MemPool.Count(); i++)
{
if (MemPool[i].Size == size)
@@ -122,6 +124,7 @@ void* RendererAllocation::Allocate(uintptr size)
break;
}
}
MemPoolLocker.Unlock();
if (!result)
{
result = Platform::Allocate(size, 16);
@@ -131,7 +134,9 @@ void* RendererAllocation::Allocate(uintptr size)
void RendererAllocation::Free(void* ptr, uintptr size)
{
MemPoolLocker.Lock();
MemPool.Add({ ptr, size });
MemPoolLocker.Unlock();
}
RenderList* RenderList::GetFromPool()