Refactored all graphics resource handles to use Handle<GPUTexture> and Handle<GPUBuffer> instead of Handle<Texture> and Handle<GraphicsBuffer>. Updated all APIs, interfaces, and implementations to use the new types, including ICommandBuffer, IResourceAllocator, ISwapChain, IRenderOutput, IRenderGraphBuilder, and related classes. Introduced TempJobAllocator for frame-latency-aware allocations. Updated ResourceHandleExtensions for new conversions. Performed minor code cleanups and removed the empty ClusterLod.cs file. BREAKING CHANGE: All usages of Handle<Texture> and Handle<GraphicsBuffer> are replaced with Handle<GPUTexture> and Handle<GPUBuffer>. This affects all APIs and resource management code. Callers must update their code to use the new handle types.
33 lines
908 B
C#
33 lines
908 B
C#
using Ghost.Core;
|
|
|
|
namespace Ghost.Graphics.RHI;
|
|
|
|
public readonly struct GPUResource;
|
|
public readonly struct GPUTexture;
|
|
public readonly struct GPUBuffer;
|
|
|
|
public readonly struct Sampler;
|
|
|
|
public static class ResourceHandleExtensions
|
|
{
|
|
public static Handle<GPUResource> AsResource(this Handle<GPUTexture> texture)
|
|
{
|
|
return new Handle<GPUResource>(texture.ID, texture.Generation);
|
|
}
|
|
|
|
public static Handle<GPUResource> AsResource(this Handle<GPUBuffer> buffer)
|
|
{
|
|
return new Handle<GPUResource>(buffer.ID, buffer.Generation);
|
|
}
|
|
|
|
public static Handle<GPUTexture> AsTexture(this Handle<GPUResource> resource)
|
|
{
|
|
return new Handle<GPUTexture>(resource.ID, resource.Generation);
|
|
}
|
|
|
|
public static Handle<GPUBuffer> AsGraphicsBuffer(this Handle<GPUResource> resource)
|
|
{
|
|
return new Handle<GPUBuffer>(resource.ID, resource.Generation);
|
|
}
|
|
}
|