Fixed HLSL compilation when using nested struct types

このコミットが含まれているのは:
Sergio Pedri committed 2021-03-11 23:12:09 +01:00
1 親 cd8fb59593
コミット 9d41cbf94c
10ファイル変更
+104 -57

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

+38 -38
ファイルの表示
@@ -177,6 +177,19 @@ namespace ComputeSharp.Tests.Internals
Assert.AreEqual(9999, *(int*)&p1[120]);
}
[AutoConstructor]
public partial struct SimpleTypes
{
public Float2x3 f2x3;
public int a;
public Int1x3 i1x3;
public Double2 d2;
public int c;
public Int1x2 i1x2;
public Int2x2 i2x2;
public int d;
}
[AutoConstructor]
public partial struct FlatCustomTypeShader : IComputeShader
{
@@ -236,6 +249,31 @@ namespace ComputeSharp.Tests.Internals
Assert.AreEqual(9999, *(int*)&p1[120]);
}
[AutoConstructor]
public partial struct CustomType1
{
public Float3 a;
public SimpleTypes b;
public int c;
public CustomType2 d;
public CustomType3 e;
}
[AutoConstructor]
public partial struct CustomType2
{
public int a;
public Float2 b;
public CustomType3 c;
}
[AutoConstructor]
public partial struct CustomType3
{
public int a;
public Float2 b;
}
[AutoConstructor]
public partial struct NestedCustomTypesShader : IComputeShader
{
@@ -320,42 +358,4 @@ namespace ComputeSharp.Tests.Internals
Assert.AreEqual(444.4f, *(float*)&p1[184]);
}
}
[AutoConstructor]
public partial struct SimpleTypes
{
public Float2x3 f2x3;
public int a;
public Int1x3 i1x3;
public Double2 d2;
public int c;
public Int1x2 i1x2;
public Int2x2 i2x2;
public int d;
}
[AutoConstructor]
public partial struct CustomType1
{
public Float3 a;
public SimpleTypes b;
public int c;
public CustomType2 d;
public CustomType3 e;
}
[AutoConstructor]
public partial struct CustomType2
{
public int a;
public Float2 b;
public CustomType3 c;
}
[AutoConstructor]
public partial struct CustomType3
{
public int a;
public Float2 b;
}
}
+32 -6
ファイルの表示
@@ -11,11 +11,11 @@ namespace ComputeSharp.Tests
[TestMethod]
public void ReservedKeywords()
{
ReflectionServices.GetShaderInfo<ReservedKeywords_Kernel>(out _);
ReflectionServices.GetShaderInfo<ReservedKeywordsShader>(out _);
}
[AutoConstructor]
public readonly partial struct ReservedKeywords_Kernel : IComputeShader
public readonly partial struct ReservedKeywordsShader : IComputeShader
{
public readonly ReadWriteBuffer<float> row_major;
public readonly float dword;
@@ -32,11 +32,11 @@ namespace ComputeSharp.Tests
[TestMethod]
public void SpecialTypeAsReturnType()
{
ReflectionServices.GetShaderInfo<SpecialTypeAsReturnType_Kernel>(out _);
ReflectionServices.GetShaderInfo<SpecialTypeAsReturnTypeShader>(out _);
}
[AutoConstructor]
public readonly partial struct SpecialTypeAsReturnType_Kernel : IComputeShader
public readonly partial struct SpecialTypeAsReturnTypeShader : IComputeShader
{
public readonly ReadWriteBuffer<Float2> buffer;
@@ -53,11 +53,11 @@ namespace ComputeSharp.Tests
[TestMethod]
public void LocalFunctionInExternalMethods()
{
ReflectionServices.GetShaderInfo<LocalFunctionInExternalMethods_Kernel>(out _);
ReflectionServices.GetShaderInfo<LocalFunctionInExternalMethodsShader>(out _);
}
[AutoConstructor]
public readonly partial struct LocalFunctionInExternalMethods_Kernel : IComputeShader
public readonly partial struct LocalFunctionInExternalMethodsShader : IComputeShader
{
public readonly ReadWriteBuffer<Float2> buffer;
@@ -73,5 +73,31 @@ namespace ComputeSharp.Tests
buffer[ThreadIds.X] = Foo(ThreadIds.X);
}
}
[TestMethod]
public void CapturedNestedStructType()
{
ReflectionServices.GetShaderInfo<CapturedNestedStructTypeShader>(out _);
}
[AutoConstructor]
public partial struct CustomStructType
{
public Float2 a;
public int b;
}
[AutoConstructor]
public readonly partial struct CapturedNestedStructTypeShader : IComputeShader
{
public readonly ReadWriteBuffer<float> buffer;
public readonly CustomStructType foo;
/// <inheritdoc/>
public void Execute()
{
buffer[ThreadIds.X] *= foo.a.X + foo.b;
}
}
}
}