UnityGame/Library/PackageCache/com.unity.rendering.light-transport/Runtime/UnifiedRayTracing/Common/Utilities/BackendHelpers.cs
2024-10-27 10:53:47 +03:00

30 lines
988 B
C#

using System;
namespace UnityEngine.Rendering.UnifiedRayTracing
{
internal static class BackendHelpers
{
internal static string GetFileNameOfShader(RayTracingBackend backend, string fileName)
{
string postFix = backend switch
{
RayTracingBackend.Hardware => "raytrace",
RayTracingBackend.Compute => "compute",
_ => throw new ArgumentOutOfRangeException(nameof(backend), backend, null)
};
return $"{fileName}.{postFix}";
}
internal static Type GetTypeOfShader(RayTracingBackend backend)
{
Type shaderType = backend switch
{
RayTracingBackend.Hardware => typeof(RayTracingShader),
RayTracingBackend.Compute => typeof(ComputeShader),
_ => throw new ArgumentOutOfRangeException(nameof(backend), backend, null)
};
return shaderType;
}
}
}