diff --git a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs
index 71306ce6..3b347f1d 100644
--- a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs
+++ b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs
@@ -47,7 +47,7 @@ namespace ComputeSharp.Shaders.Translation.Models
// Load the argument (the object instance) and cast it to the right type
il.Emit(OpCodes.Ldarg_0);
- il.Emit(DeclaringType.IsValueType ? OpCodes.Unbox : OpCodes.Castclass, DeclaringType);
+ if (!IsStatic) il.Emit(DeclaringType.IsValueType ? OpCodes.Unbox : OpCodes.Castclass, DeclaringType);
// Get the member value with the appropriate method
if (Property != null) il.EmitCall(OpCodes.Callvirt, Property.GetMethod, null);
diff --git a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs
index 02c66f33..4fbd6b79 100644
--- a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs
+++ b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.cs
@@ -68,6 +68,20 @@ namespace ComputeSharp.Shaders.Translation.Models
///
public string Name => (Field?.Name ?? Property?.Name) ?? throw new InvalidOperationException("Field and property can't both be null at the same time");
+ ///
+ /// Gets whether or not the current member is not an instance member
+ ///
+ public bool IsStatic
+ {
+ get
+ {
+ if (Field != null) return Field.IsStatic;
+ if (Property != null) return Property.GetMethod.IsStatic;
+
+ throw new InvalidOperationException("Field and property can't both be null at the same time");
+ }
+ }
+
///
/// Converts a object into a instance
///