Merge pull request #256 from Sergio0694/bugfix/void-intrinsics-mapping

Fix void intrinsics mapping
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-05-01 11:35:11 +02:00
コミット abae101782
12ファイル変更
+620 -279

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

+274
ファイルの表示
@@ -6,6 +6,16 @@ namespace ComputeSharp;
/// <inheritdoc cref="Hlsl"/>
partial class Hlsl
{
/// <summary>
/// Submits an error message to the information queue and terminates the current draw or dispatch call being executed.
/// </summary>
/// <remarks>
/// This operation does nothing on rasterizers that do not support it.
/// <para>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</para>
/// </remarks>
[HlslIntrinsicName("abort")]
public static void Abort() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Abort)}()");
/// <summary>
/// Discards the current pixel if the specified value is less than zero.
/// </summary>
@@ -305,4 +315,268 @@ partial class Hlsl
/// </remarks>
[HlslIntrinsicName("clip")]
public static void Clip(Float4x4 x) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Clip)}({typeof(Float4x4)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <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.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <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.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Atomically compares the destination to the comparison value. If they
/// are identical, the destination is overwritten with the input value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedCompareStore(int destination, int comparison, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Atomically compares the destination to the comparison value. If they
/// are identical, the destination is overwritten with the input value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedCompareStore(uint destination, uint comparison, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Assigns value to dest and returns the original value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedExchange(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Assigns value to dest and returns the original value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedExchange(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedExchange)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(int destination, int value, out int original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(uint destination, uint value, out uint original) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
}
+18 -5
ファイルの表示
@@ -20,10 +20,20 @@ foreach (var intrinsic in Intrinsics)
else WriteLine("");
WriteLine("/// <summary>");
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("/// </summary>");
foreach (var param in intrinsic.Parameters)
foreach (var param in intrinsic.Parameters.Where(p => p.Name is not ""))
{
WriteLine($"/// <param name=\"{param.Name}\">{param.Info}</param>");
}
@@ -52,15 +62,18 @@ foreach (var intrinsic in Intrinsics)
WriteLine("/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>");
}
WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
if (intrinsic.Name != intrinsic.HlslName)
{
WriteLine($"[HlslIntrinsicName(\"{intrinsic.HlslName}\")]");
}
Write($"public static void {intrinsic.Name}(");
Write(string.Join(", ", intrinsic.Parameters.Zip(overload, (a, b) => $"{(a.IsOut ? "out " : "")}{b} {a.Name}")));
Write(string.Join(", ", intrinsic.Parameters.Where(p => p.Name is not "").Zip(overload, (a, b) => $"{(a.IsOut ? "out " : "")}{b} {a.Name}")));
Write(")");
Write(" => throw new InvalidExecutionContextException(");
var parameters = string.Join(", ", overload.Select(t => $"{{typeof({t})}}"));
var parameters = string.Join(", ", overload.Where(o => o.Length > 0).Select(t => $"{{typeof({t})}}"));
WriteLine($"$\"{{typeof(Hlsl)}}.{{nameof({intrinsic.Name})}}({parameters})\");");
}
+281
ファイルの表示
@@ -8,6 +8,18 @@
<#
var Intrinsics = new[]
{
new
{
Name = "Abort",
HlslName = "abort",
Summary = "Submits an error message to the information queue and terminates the current draw or dispatch call being executed.",
Remarks = "This operation does nothing on rasterizers that do not support it.",
Parameters = new[]
{
new { IsOut = false, IsRef = false, Name = "", Info = "" }
},
Overloads = new[] { new string[0] }
},
new
{
Name = "Clip",
@@ -46,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" }
}
}
};
#>
-271
ファイルの表示
@@ -8,13 +8,6 @@ namespace ComputeSharp;
/// </summary>
public static partial class Hlsl
{
/// <summary>
/// Submits an error message to the information queue and terminates the current draw or dispatch call being executed.
/// </summary>
/// <remarks>This operation does nothing on rasterizers that do not support it.</remarks>
[HlslIntrinsicName("abort")]
public static void Abort() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(Abort)}()");
/// <summary>
/// Blocks execution of all threads in a group until all memory accesses have been completed.
/// </summary>
@@ -61,270 +54,6 @@ public static partial class Hlsl
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void GroupMemoryBarrierWithGroupSync() => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(GroupMemoryBarrierWithGroupSync)}()");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAdd(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAdd)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic add of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedAnd(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedAnd)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic and of a value to a destination.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <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.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <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.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Atomically compares the destination to the comparison value. If they
/// are identical, the destination is overwritten with the input value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedCompareStore(ref int destination, int comparison, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(int)}, {typeof(int)}, {typeof(int)})");
/// <summary>
/// Atomically compares the destination to the comparison value. If they
/// are identical, the destination is overwritten with the input value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="comparison">The comparison value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedCompareStore(ref uint destination, uint comparison, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedCompareStore)}({typeof(uint)}, {typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Assigns value to dest and returns the original value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Assigns value to dest and returns the original value.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMax(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMax)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic max.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedMin(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedMin)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic min.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedOr(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedOr)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic or.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(ref int destination, int value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(int)}, {typeof(int)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static void InterlockedXor(ref uint destination, uint value) => throw new InvalidExecutionContextException($"{typeof(Hlsl)}.{nameof(InterlockedXor)}({typeof(uint)}, {typeof(uint)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Performs a guaranteed atomic xor.
/// </summary>
/// <param name="destination">The destination value.</param>
/// <param name="value">The input value.</param>
/// <param name="original">The original value.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
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)})");
/// <summary>
/// Returns a lighting coefficient vector.
/// </summary>
+4 -1
ファイルの表示
@@ -39,7 +39,10 @@ foreach (var intrinsic in Intrinsics)
WriteLine("/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>");
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}")));
+1
ファイルの表示
@@ -20,6 +20,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" />
バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.1 MiB

バイナリファイルは表示されません。

変更前

幅:  |  高さ:  |  サイズ: 24 KiB

変更後

幅:  |  高さ:  |  サイズ: 24 KiB

+3
ファイルの表示
@@ -29,6 +29,9 @@
<None Update="Assets\Landscape.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Landscape_CheckerboardClip.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Assets\Landscape_Inverted.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+32
ファイルの表示
@@ -0,0 +1,32 @@
namespace ComputeSharp.D2D1.Tests.Effects;
[D2DInputCount(1)]
[D2DInputSimple(0)]
[D2DRequiresScenePosition]
[D2DEmbeddedBytecode(D2D1ShaderProfile.PixelShader50)]
[AutoConstructor]
public partial struct CheckerboardClipEffect : ID2D1PixelShader
{
public int width;
public int height;
public int cellSize;
/// <inheritdoc/>
public float4 Execute()
{
float2 position = D2D.GetScenePosition().XY;
uint x = (uint)Hlsl.Floor(position.X);
uint y = (uint)Hlsl.Floor(position.Y);
uint cellX = (uint)(int)Hlsl.Floor(x / cellSize);
uint cellY = (uint)(int)Hlsl.Floor(y / cellSize);
if ((cellX % 2 == 0 && cellY % 2 == 0) ||
(cellX % 2 == 1 && cellY % 2 == 1))
{
Hlsl.Clip(-1);
}
return D2D.GetInput(0);
}
}
-1
ファイルの表示
@@ -3,7 +3,6 @@
[D2DInputCount(1)]
[D2DInputSimple(0)]
[D2DEmbeddedBytecode(D2D1ShaderProfile.PixelShader50)]
[AutoConstructor]
public partial struct InvertEffect : ID2D1PixelShader
{
/// <inheritdoc/>
+7 -1
ファイルの表示
@@ -29,7 +29,7 @@ public class EndToEndTests
public unsafe void Pixelate()
{
RunAndCompareShader(
new PixelateEffect.Shader(new PixelateEffect.Shader.Constants(1280, 720, 16)),
new PixelateEffect.Shader(new PixelateEffect.Shader.Constants(1280, 840, 16)),
static () => new PixelateEffect(),
"Landscape.png",
"Landscape_Pixelate.png");
@@ -41,6 +41,12 @@ public class EndToEndTests
RunAndCompareShader(new ZonePlateEffect(1280, 720, 800), null, 1280, 720, "ZonePlate.png");
}
[TestMethod]
public unsafe void CheckerboardClip()
{
RunAndCompareShader(new CheckerboardClipEffect(1280, 840, 32), null, "Landscape.png", "Landscape_CheckerboardClip.png");
}
/// <summary>
/// Executes a pixel shader and compares the expected results.
/// </summary>