Files
GhostEngine/Ghost.Graphics/Data/ResourceHandle.cs
2025-10-05 16:26:37 +09:00

30 lines
932 B
C#

using Ghost.Core;
namespace Ghost.Graphics.Data;
public readonly struct GPUResource : IHandleType;
public readonly struct Texture : IHandleType;
public readonly struct GraphicsBuffer : IHandleType;
public static class ResourceHandleExtensions
{
public static Handle<GPUResource> AsResource(this Handle<Texture> texture)
{
return new Handle<GPUResource>(texture.id, texture.generation);
}
public static Handle<GPUResource> AsResource(this Handle<GraphicsBuffer> buffer)
{
return new Handle<GPUResource>(buffer.id, buffer.generation);
}
internal static Handle<Texture> AsTexture(this Handle<GPUResource> resource)
{
return new Handle<Texture>(resource.id, resource.generation);
}
internal static Handle<GraphicsBuffer> AsGraphicsBuffer(this Handle<GPUResource> resource)
{
return new Handle<GraphicsBuffer>(resource.id, resource.generation);
}
}