Merge pull request #810 from Sergio0694/dev/generator-tweaks

Minor tweaks to generated code
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2024-06-06 21:08:40 -07:00
コミット 86077ea28c
4ファイル変更
+7 -6

検索条件に一致するファイルはありません

@@ -199,7 +199,7 @@ partial class ConstantBufferSyntaxProcessor
writer.WriteLine($"""/// <returns>The marshalled <see cref="{fullyQualifiedTypeName}"/> instance.</returns>""");
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())
{
+1 -1
ファイルの表示
@@ -82,7 +82,7 @@ partial class ComputeShaderDescriptorGenerator
writer.WriteLine("buffer.__x = x;");
writer.WriteLine("buffer.__y = y;");
writer.WriteLineIf(!info.IsPixelShaderLike, "buffer.__z = z;");
writer.WriteLineIf(!info.IsPixelShaderLike);
writer.WriteLine(skipIfPresent: true);
writer.WriteLine("loader.LoadConstantBuffer(new global::System.ReadOnlySpan<byte>(&buffer, sizeof(global::ComputeSharp.Generated.ConstantBuffer)));");
}
}
@@ -281,7 +281,7 @@ public class Test_D2DPixelShaderDescriptorGenerator
/// <returns>The marshalled <see cref="global::MyNamespace.MyShader"/> instance.</returns>
[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
/// <returns>The marshalled <see cref="global::MyNamespace.MyShader"/> instance.</returns>
[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
/// <returns>The marshalled <see cref="global::MyNamespace.MyShader"/> instance.</returns>
[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
/// <returns>The marshalled <see cref="global::MyNamespace.MyShader"/> instance.</returns>
[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);
+1
ファイルの表示
@@ -423,6 +423,7 @@ public class Test_ComputeShaderDescriptorGenerator
buffer.__x = x;
buffer.__y = y;
loader.LoadConstantBuffer(new global::System.ReadOnlySpan<byte>(&buffer, sizeof(global::ComputeSharp.Generated.ConstantBuffer)));
}