Remove GPUResourcesCollection and use GPUDevice instead to simplify code

This commit is contained in:
Wojciech Figat
2022-12-07 15:32:23 +01:00
parent 3017010ef4
commit f2c594569d
5 changed files with 105 additions and 185 deletions

View File

@@ -3,10 +3,11 @@
#pragma once
#include "Engine/Platform/Platform.h"
#include "Engine/Platform/CriticalSection.h"
#include "Engine/Core/Enums.h"
#include "Engine/Core/NonCopyable.h"
#include "Engine/Core/Collections/Array.h"
#include "Engine/Scripting/ScriptingObject.h"
#include "GPUResourcesCollection.h"
#include "GPUAdapter.h"
#include "GPULimits.h"
#include "Enums.h"
@@ -14,6 +15,7 @@
class ITextureOwner;
class RenderTask;
class GPUResource;
class GPUContext;
class GPUShader;
class GPUTimerQuery;
@@ -84,6 +86,7 @@ protected:
// Private resources (hidden with declaration)
struct PrivateData;
PrivateData* _res;
Array<GPUResource*> _resources;
protected:
/// <summary>
@@ -105,12 +108,6 @@ public:
/// </summary>
CriticalSection Locker;
/// <summary>
/// The GPU resources collection.
/// </summary>
GPUResourcesCollection Resources;
public:
/// <summary>
/// The total amount of graphics memory in bytes.
/// </summary>
@@ -220,6 +217,11 @@ public:
/// </summary>
API_PROPERTY() uint64 GetMemoryUsage() const;
/// <summary>
/// Gets the list with all active GPU resources.
/// </summary>
API_PROPERTY() Array<GPUResource*> GetResources() const;
/// <summary>
/// Gets the GPU asynchronous work manager.
/// </summary>
@@ -299,6 +301,15 @@ public:
/// </summary>
virtual void WaitForGPU() = 0;
public:
void AddResource(GPUResource* resource);
void RemoveResource(GPUResource* resource);
/// <summary>
/// Dumps all GPU resources information to the log.
/// </summary>
void DumpResourcesToLog() const;
protected:
virtual void preDispose();