Fix Interlocked HLSL intrinsics
このコミットが含まれているのは:
1 親
ca6d535720
コミット
fb1c24a623
2ファイル変更
+29
検索条件に一致するファイルはありません
@@ -22,6 +22,7 @@
|
||||
<Compile Include="..\ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" Link="ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.g.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool2.cs" />
|
||||
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool3.cs" />
|
||||
|
||||
@@ -279,4 +279,32 @@ public partial class ShaderRewriterTests
|
||||
buffer2[7] = exponentUppercaseField;
|
||||
}
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public void InterlockedOperations(Device device)
|
||||
{
|
||||
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer<int>(16);
|
||||
|
||||
device.Get().For(16, new InterlockedOperationsShader(buffer));
|
||||
|
||||
int[] result = buffer.ToArray();
|
||||
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
{
|
||||
Assert.AreEqual(i, result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
[EmbeddedBytecode(DispatchAxis.X)]
|
||||
internal readonly partial struct InterlockedOperationsShader : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteBuffer<int> buffer;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
Hlsl.InterlockedAdd(buffer[ThreadIds.X], ThreadIds.X);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする