From 57ae15ab7f826177921c6d57f95d74497976e874 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 16 Sep 2019 03:23:58 +0200 Subject: [PATCH] Renamed shader hash code class --- .../{ShaderCacheManager.cs => ShaderHashCodeProvider.cs} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename src/ComputeSharp.Shaders/Translation/{ShaderCacheManager.cs => ShaderHashCodeProvider.cs} (94%) 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)