diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader.IL.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader.IL.cs index 3e01ddeb..630b43d5 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderLoader.IL.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader.IL.cs @@ -102,7 +102,7 @@ namespace ComputeSharp.Shaders.Translation if (HlslKnownTypes.IsKnownBufferType(member.MemberType)) { // Load the offset address into the resource buffers - il.Emit(OpCodes.Ldarg_0); + il.Emit(OpCodes.Ldarg_1); if (_ResourcesCount > 0) il.EmitAddOffset(_ResourcesCount); _ResourcesCount++; @@ -121,7 +121,7 @@ namespace ComputeSharp.Shaders.Translation if (_VariablesByteSize % 16 > 16 - size) _VariablesByteSize += 16 - _VariablesByteSize % 16; // Load the target address into the variables buffer - il.Emit(OpCodes.Ldarg_1); + il.Emit(OpCodes.Ldarg_2); il.EmitAddOffset(_VariablesByteSize); // Load the variable and store it in the loaded address