Files
CartoonFPS/Library/PackageCache/com.unity.rendering.light-transport@9bd588f963c0/Runtime/UnifiedRayTracing/Compute/ComputeRayTracingBackend.cs
SHOUTING_PIRATE 4c8592d0ab initial commit
2025-08-05 09:30:40 +01:00

30 lines
1.1 KiB
C#

namespace UnityEngine.Rendering.UnifiedRayTracing
{
internal class ComputeRayTracingBackend : IRayTracingBackend
{
public ComputeRayTracingBackend(RayTracingResources resources)
{
m_Resources = resources;
}
public IRayTracingShader CreateRayTracingShader(Object shader, string kernelName, GraphicsBuffer dispatchBuffer)
{
Debug.Assert(shader is ComputeShader);
return new ComputeRayTracingShader((ComputeShader)shader, kernelName, dispatchBuffer);
}
public IRayTracingAccelStruct CreateAccelerationStructure(AccelerationStructureOptions options, ReferenceCounter counter)
{
return new ComputeRayTracingAccelStruct(options, m_Resources, counter);
}
public ulong GetRequiredTraceScratchBufferSizeInBytes(uint width, uint height, uint depth)
{
uint rayCount = width * height * depth;
return (RadeonRays.RadeonRaysAPI.GetTraceMemoryRequirements(rayCount) * RayTracingContext.GetScratchBufferStrideInBytes());
}
readonly RayTracingResources m_Resources;
}
}