diff --git a/src/ComputeSharp.Shaders/Translation/ShaderCacheManager.cs b/src/ComputeSharp.Shaders/Translation/ShaderHashCodeProvider.cs similarity index 94% rename from src/ComputeSharp.Shaders/Translation/ShaderCacheManager.cs rename to src/ComputeSharp.Shaders/Translation/ShaderHashCodeProvider.cs index 3a451d62..faa65d0b 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderCacheManager.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderHashCodeProvider.cs @@ -13,7 +13,7 @@ namespace ComputeSharp.Shaders.Translation /// /// A that handles the cache system for the generated shaders /// - internal static class ShaderCacheManager + internal static class ShaderHashCodeProvider { /// /// The mapping of hashcodes to aggregate hashing functions @@ -21,10 +21,11 @@ namespace ComputeSharp.Shaders.Translation private static readonly Dictionary HasherMapping = new Dictionary(); /// - /// Gets a unique key for the input shader closure + /// Gets a unique hashcode for the input shader closure /// /// The input representing the shader to run - private static int GetKey(Action action) + [Pure] + public static int GetHashCode(Action action) { // Get the delegate hashcode MethodInfo methodInfo = action.Method; @@ -76,7 +77,7 @@ namespace ComputeSharp.Shaders.Translation // Unroll the member access MethodInfo - validateDelegateInfo = typeof(ShaderCacheManager).GetMethod(nameof(ValidateDelegate)), + validateDelegateInfo = typeof(ShaderHashCodeProvider).GetMethod(nameof(ValidateDelegate)), getMethodInfo = typeof(Delegate).GetProperty(nameof(Delegate.Method)).GetMethod, getHashCodeInfo = typeof(object).GetMethod(nameof(GetHashCode)); foreach (FieldInfo fieldInfo in fieldInfos)