diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/ConstantBufferSyntaxProcessor.Generation.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/ConstantBufferSyntaxProcessor.Generation.cs
index 33ef9421..3cd7393e 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/ConstantBufferSyntaxProcessor.Generation.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/ConstantBufferSyntaxProcessor.Generation.cs
@@ -199,7 +199,7 @@ partial class ConstantBufferSyntaxProcessor
writer.WriteLine($"""/// The marshalled instance.""");
writer.WriteLine($"""[MethodImpl(MethodImplOptions.AggressiveInlining)]""");
writer.WriteLine($"""[SkipLocalsInit]""");
- writer.WriteLine($"public static {fullyQualifiedTypeName} ToManaged(in ConstantBuffer buffer)");
+ writer.WriteLine($"public static {fullyQualifiedTypeName} ToManaged(ref readonly ConstantBuffer buffer)");
using (writer.WriteBlock())
{
diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs
index c7b39878..f772dbcc 100644
--- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs
+++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs
@@ -281,7 +281,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
/// The marshalled instance.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SkipLocalsInit]
- public static global::MyNamespace.MyShader ToManaged(in ConstantBuffer buffer)
+ public static global::MyNamespace.MyShader ToManaged(ref readonly ConstantBuffer buffer)
{
Unsafe.SkipInit(out global::MyNamespace.MyShader shader);
@@ -583,7 +583,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
/// The marshalled instance.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SkipLocalsInit]
- public static global::MyNamespace.MyShader ToManaged(in ConstantBuffer buffer)
+ public static global::MyNamespace.MyShader ToManaged(ref readonly ConstantBuffer buffer)
{
Unsafe.SkipInit(out global::MyNamespace.MyShader shader);
@@ -933,7 +933,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
/// The marshalled instance.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SkipLocalsInit]
- public static global::MyNamespace.MyShader ToManaged(in ConstantBuffer buffer)
+ public static global::MyNamespace.MyShader ToManaged(ref readonly ConstantBuffer buffer)
{
Unsafe.SkipInit(out global::MyNamespace.MyShader shader);
@@ -1231,7 +1231,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
/// The marshalled instance.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[SkipLocalsInit]
- public static global::MyNamespace.MyShader ToManaged(in ConstantBuffer buffer)
+ public static global::MyNamespace.MyShader ToManaged(ref readonly ConstantBuffer buffer)
{
Unsafe.SkipInit(out global::MyNamespace.MyShader shader);