You're breathtaking!

This commit is contained in:
Wojtek Figat
2020-12-07 23:40:54 +01:00
commit 6fb9eee74c
5143 changed files with 1153594 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
// Copyright (c) 2012-2020 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Collections/Array.h"
#include "Engine/Platform/Platform.h"
#include "Engine/Platform/CriticalSection.h"
class GPUResource;
class StringBuilder;
/// <summary>
/// GPU Resources collection container
/// </summary>
class GPUResourcesCollection
{
private:
CriticalSection _locker;
Array<GPUResource*> _collection;
public:
/// <summary>
/// Initializes a new instance of the <see cref="GPUResourcesCollection"/> class.
/// </summary>
GPUResourcesCollection()
: _collection(1024)
{
}
/// <summary>
/// Finalizes an instance of the <see cref="GPUResourcesCollection"/> class.
/// </summary>
~GPUResourcesCollection()
{
}
public:
/// <summary>
/// Gets the total memory usage (in bytes).
/// </summary>
/// <returns>GPU memory usage (in bytes).</returns>
uint64 GetMemoryUsage() const;
/// <summary>
/// Called when device is being disposed.
/// </summary>
void OnDeviceDispose();
/// <summary>
/// Dumps all resources information to the log.
/// </summary>
void DumpToLog() const;
/// <summary>
/// Dumps all resources information to the log.
/// </summary>
void DumpToLog(StringBuilder& output) const;
public:
/// <summary>
/// Adds the specified resource to the collection.
/// </summary>
/// <param name="resource">The resource.</param>
void Add(GPUResource* resource);
/// <summary>
/// Removes the specified resource from the collection.
/// </summary>
/// <param name="resource">The resource.</param>
void Remove(GPUResource* resource);
};