using System.Diagnostics;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Rendering.RenderGraphModule
{
///
/// RayTracingAccelerationStructure resource handle.
///
[DebuggerDisplay("RayTracingAccelerationStructure ({handle.index})")]
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")]
public struct RayTracingAccelerationStructureHandle
{
private static RayTracingAccelerationStructureHandle s_NullHandle = new RayTracingAccelerationStructureHandle();
///
/// Returns a null ray tracing acceleration structure handle
///
/// A null ray tracing acceleration structure handle.
public static RayTracingAccelerationStructureHandle nullHandle { get { return s_NullHandle; } }
internal ResourceHandle handle;
internal RayTracingAccelerationStructureHandle(int handle) { this.handle = new ResourceHandle(handle, RenderGraphResourceType.AccelerationStructure, false); }
///
/// Cast to RayTracingAccelerationStructure
///
/// Input RayTracingAccelerationStructureHandle
/// Resource as a RayTracingAccelerationStructure.
public static implicit operator RayTracingAccelerationStructure(RayTracingAccelerationStructureHandle handle) => handle.IsValid() ? RenderGraphResourceRegistry.current.GetRayTracingAccelerationStructure(handle) : null;
///
/// Return true if the handle is valid.
///
/// True if the handle is valid.
public bool IsValid() => handle.IsValid();
}
///
/// Descriptor used to identify ray tracing acceleration structure resources
///
[MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")]
public struct RayTracingAccelerationStructureDesc
{
/// RayTracingAccelerationStructure name.
public string name;
}
[DebuggerDisplay("RayTracingAccelerationStructureResource ({desc.name})")]
class RayTracingAccelerationStructureResource : RenderGraphResource
{
public override string GetName()
{
return desc.name;
}
}
}