Prevent bool fields in custom struct types in shaders

These are not allowed due to alignment reasons
このコミットが含まれているのは:
Sergio Pedri committed 2022-08-27 16:50:22 +02:00
1 親 f68d56fcec
コミット 1e3611a060
4ファイル変更
+44 -4

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

+32
ファイルの表示
@@ -1697,6 +1697,38 @@ public class DiagnosticsTests
VerifyGeneratedDiagnostics<IShaderGenerator>(source, "CMPS0047", "CMPS0050");
}
[TestMethod]
public void InvalidDiscoveredType_CustomType_SystemBoolean()
{
string source = @"
using System;
using ComputeSharp;
namespace ComputeSharp
{
public class ReadWriteBuffer<T> { }
}
namespace MyFancyApp.Sample
{
public struct Foo
{
public bool bar;
}
public struct MyShader : IComputeShader
{
public readonly ReadWriteBuffer<Foo> buffer;
public void Execute()
{
}
}
}";
VerifyGeneratedDiagnostics<IShaderGenerator>(source, "CMPS0047", "CMPS0050");
}
/// <summary>
/// Verifies the output of a source generator.
/// </summary>