Files
GhostEngine/src/Runtime/Ghost.Graphics.RHI/ResourceHandle.cs
Misaki 89e6c68f2a feat(rhi)!: refactor resource handles to GPUTexture/GPUBuffer
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.
2026-03-30 21:27:16 +09:00

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);
}
}