diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs
index 50f404e4..bf15e76d 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.g.cs
@@ -315,4 +315,268 @@ partial class Hlsl
///
[HlslIntrinsicName("clip")]
public static void Clip(Float4x4 x) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Clip)}({typeof(Float4x4)})");
+
+ ///
+ /// Performs a guaranteed atomic add of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAdd(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic add of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAdd(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic add of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAdd(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic add of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAdd(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic and of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAnd(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic and of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAnd(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic and of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAnd(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic and of a value to a destination.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedAnd(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Atomically compares the destination with the comparison value. If they are identical, the destination
+ /// is overwritten with the input value. The original value is set to the destination's original value.
+ ///
+ /// The destination value.
+ /// The comparison value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedCompareExchange(int destination, int comparison, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareExchange)}({typeof(int)}, {typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Atomically compares the destination with the comparison value. If they are identical, the destination
+ /// is overwritten with the input value. The original value is set to the destination's original value.
+ ///
+ /// The destination value.
+ /// The comparison value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedCompareExchange(uint destination, uint comparison, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareExchange)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Atomically compares the destination to the comparison value. If they
+ /// are identical, the destination is overwritten with the input value.
+ ///
+ /// The destination value.
+ /// The comparison value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedCompareStore(int destination, int comparison, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Atomically compares the destination to the comparison value. If they
+ /// are identical, the destination is overwritten with the input value.
+ ///
+ /// The destination value.
+ /// The comparison value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedCompareStore(uint destination, uint comparison, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Assigns value to dest and returns the original value.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedExchange(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Assigns value to dest and returns the original value.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedExchange(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic max.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMax(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic max.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMax(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic max.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMax(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic max.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMax(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic min.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMin(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic min.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMin(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic min.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMin(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic min.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedMin(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic or.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedOr(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic or.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedOr(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic or.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedOr(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic or.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedOr(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic xor.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedXor(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic xor.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedXor(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)})");
+
+ ///
+ /// Performs a guaranteed atomic xor.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedXor(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
+
+ ///
+ /// Performs a guaranteed atomic xor.
+ ///
+ /// The destination value.
+ /// The input value.
+ /// The original input value.
+ /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
+ public static void InterlockedXor(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
}
diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt
index 51214841..87acc1d4 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.tt
@@ -20,7 +20,17 @@ foreach (var intrinsic in Intrinsics)
else WriteLine("");
WriteLine("/// ");
- WriteLine($"/// {intrinsic.Summary}");
+
+ foreach (var line in intrinsic.Summary.Replace("\r", "").Split('\n'))
+ {
+ string trimmedLine = line.Trim();
+
+ if (trimmedLine.Length > 0)
+ {
+ WriteLine($"/// {line.Trim()}");
+ }
+ }
+
WriteLine("/// ");
foreach (var param in intrinsic.Parameters.Where(p => p.Name is not ""))
@@ -52,7 +62,10 @@ foreach (var intrinsic in Intrinsics)
WriteLine("/// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.");
}
- WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
+ if (intrinsic.Name != intrinsic.HlslName)
+ {
+ WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
+ }
Write($"public static void {intrinsic.Name}(");
Write(string.Join(", ", intrinsic.Parameters.Where(p => p.Name is not "").Zip(overload, (a, b) => $"{(a.IsOut ? "out " : "")}{b} {a.Name}")));
diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.ttinclude b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.ttinclude
index 897fc410..0a4939c8 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.ttinclude
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.Void.ttinclude
@@ -18,10 +18,7 @@ var Intrinsics = new[]
{
new { IsOut = false, IsRef = false, Name = "", Info = "" }
},
- Overloads = new[]
- {
- new string[0]
- }
+ Overloads = new[] { new string[0] }
},
new
{
@@ -61,6 +58,275 @@ var Intrinsics = new[]
new[] { "Float4x3" },
new[] { "Float4x4" }
}
+ },
+ new
+ {
+ Name = "InterlockedAdd",
+ HlslName = "InterlockedAdd",
+ Summary = "Performs a guaranteed atomic add of a value to a destination.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedAdd",
+ HlslName = "InterlockedAdd",
+ Summary = "Performs a guaranteed atomic add of a value to a destination.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedAnd",
+ HlslName = "InterlockedAnd",
+ Summary = "Performs a guaranteed atomic and of a value to a destination.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedAnd",
+ HlslName = "InterlockedAnd",
+ Summary = "Performs a guaranteed atomic and of a value to a destination.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedCompareExchange",
+ HlslName = "InterlockedCompareExchange",
+ Summary = @"
+ Atomically compares the destination with the comparison value. If they are identical, the destination
+ is overwritten with the input value. The original value is set to the destination's original value.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "comparison", Info = "The comparison value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int", "int" },
+ new[] { "uint", "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedCompareStore",
+ HlslName = "InterlockedCompareStore",
+ Summary = @"
+ Atomically compares the destination to the comparison value. If they
+ are identical, the destination is overwritten with the input value.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "comparison", Info = "The comparison value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedExchange",
+ HlslName = "InterlockedExchange",
+ Summary = "Assigns value to dest and returns the original value.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedMax",
+ HlslName = "InterlockedMax",
+ Summary = "Performs a guaranteed atomic max.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedMax",
+ HlslName = "InterlockedMax",
+ Summary = "Performs a guaranteed atomic max.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedMin",
+ HlslName = "InterlockedMin",
+ Summary = "Performs a guaranteed atomic min.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedMin",
+ HlslName = "InterlockedMin",
+ Summary = "Performs a guaranteed atomic min.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedOr",
+ HlslName = "InterlockedOr",
+ Summary = "Performs a guaranteed atomic or.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedOr",
+ HlslName = "InterlockedOr",
+ Summary = "Performs a guaranteed atomic or.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedXor",
+ HlslName = "InterlockedXor",
+ Summary = "Performs a guaranteed atomic xor.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int" },
+ new[] { "uint", "uint" }
+ }
+ },
+ new
+ {
+ Name = "InterlockedXor",
+ HlslName = "InterlockedXor",
+ Summary = "Performs a guaranteed atomic xor.",
+ Remarks = "",
+ Parameters = new[]
+ {
+ new { IsOut = false, IsRef = true, Name = "destination", Info = "The destination value." },
+ new { IsOut = false, IsRef = false, Name = "value", Info = "The input value." },
+ new { IsOut = true, IsRef = false, Name = "original", Info = "The original input value." }
+ },
+ Overloads = new[]
+ {
+ new[] { "int", "int", "int" },
+ new[] { "uint", "uint", "uint" }
+ }
}
};
#>
\ No newline at end of file
diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs
index 08285f00..3687dfc2 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs
@@ -54,270 +54,6 @@ public static partial class Hlsl
/// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
public static void GroupMemoryBarrierWithGroupSync() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(GroupMemoryBarrierWithGroupSync)}()");
- ///
- /// Performs a guaranteed atomic add of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAdd(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic add of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAdd(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic add of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// The original input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAdd(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic add of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// The original input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAdd(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic and of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAnd(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic and of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAnd(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic and of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// The original input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAnd(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic and of a value to a destination.
- ///
- /// The destination value.
- /// The input value.
- /// The original input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedAnd(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Atomically compares the destination with the comparison value. If they are identical, the destination
- /// is overwritten with the input value. The original value is set to the destination's original value.
- ///
- /// The destination value.
- /// The comparison value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedCompareExchange(ref int destination, int comparison, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareExchange)}({typeof(int)}, {typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Atomically compares the destination with the comparison value. If they are identical, the destination
- /// is overwritten with the input value. The original value is set to the destination's original value.
- ///
- /// The destination value.
- /// The comparison value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedCompareExchange(ref uint destination, uint comparison, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareExchange)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Atomically compares the destination to the comparison value. If they
- /// are identical, the destination is overwritten with the input value.
- ///
- /// The destination value.
- /// The comparison value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedCompareStore(ref int destination, int comparison, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Atomically compares the destination to the comparison value. If they
- /// are identical, the destination is overwritten with the input value.
- ///
- /// The destination value.
- /// The comparison value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedCompareStore(ref uint destination, uint comparison, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Assigns value to dest and returns the original value.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedExchange(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Assigns value to dest and returns the original value.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedExchange(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic max.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMax(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic max.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMax(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic max.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMax(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic max.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMax(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic min.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMin(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic min.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMin(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic min.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMin(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic min.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedMin(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic or.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedOr(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic or.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedOr(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic or.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedOr(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic or.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedOr(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic xor.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedXor(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic xor.
- ///
- /// The destination value.
- /// The input value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedXor(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)})");
-
- ///
- /// Performs a guaranteed atomic xor.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedXor(ref int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
-
- ///
- /// Performs a guaranteed atomic xor.
- ///
- /// The destination value.
- /// The input value.
- /// The original value.
- /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.
- public static void InterlockedXor(ref uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
-
///
/// Returns a lighting coefficient vector.
///
diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.tt b/src/ComputeSharp.Core/Intrinsics/Hlsl.tt
index 7e1b863f..543defc9 100644
--- a/src/ComputeSharp.Core/Intrinsics/Hlsl.tt
+++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.tt
@@ -39,7 +39,10 @@ foreach (var intrinsic in Intrinsics)
WriteLine("/// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.");
- WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
+ if (intrinsic.Name != intrinsic.HlslName)
+ {
+ WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
+ }
Write($"public static {overload.Return} {intrinsic.Name}(");
Write(string.Join(", ", intrinsic.Parameters.Zip(overload.Params, (a, b) => $"{(a.IsOut ? "out " : "")}{b} {a.Name}")));