Add bitwise operators to HLSL matrix types

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-25 01:11:16 +02:00
1 親 4ad7bba4b8
コミット 25191af0af
3ファイル変更
+3307

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

ファイル差分が大きすぎるため表示されません。 差分を読み込み
+107
ファイルの表示
@@ -301,6 +301,113 @@ public unsafe partial struct <#=fullTypeName#>
<#
}
// Generate the bitwise operators
if (typeName == "Int" || typeName == "UInt")
{
WriteLine("");
#>
/// <summary>
/// Bitwise negates a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to bitwise negate.</param>
/// <returns>The bitwise negated value of <paramref name="matrix"/>.</returns>
/// <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 <#=fullTypeName#> operator ~(<#=fullTypeName#> matrix) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> right by <paramref name="amount"/>.</returns>
/// <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 <#=fullTypeName#> operator >>(<#=fullTypeName#> matrix, Int<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts right a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift right.</param>
/// <param name="amount">The amount to shift each element right by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> right by <paramref name="amount"/>.</returns>
/// <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 <#=fullTypeName#> operator >>(<#=fullTypeName#> matrix, UInt<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> left by <paramref name="amount"/>.</returns>
/// <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 <#=fullTypeName#> operator <<(<#=fullTypeName#> matrix, Int<#=rows#>x<#=columns#> amount) => default;
/// <summary>
/// Shifts left a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="matrix">The <see cref="<#=fullTypeName#>"/> value to shift left.</param>
/// <param name="amount">The amount to shift each element left by.</param>
/// <returns>The result of shifting <paramref name="matrix"/> left by <paramref name="amount"/>.</returns>
/// <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 <#=fullTypeName#> operator <<(<#=fullTypeName#> matrix, UInt<#=rows#>x<#=columns#> amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator &(<#=fullTypeName#> left, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ands a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise and.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator &(<#=fullTypeName#> left, UInt<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise or between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator |(<#=fullTypeName#> left, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise ors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise or.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise or between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator |(<#=fullTypeName#> left, UInt<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="Int<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise xor between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator ^(<#=fullTypeName#> left, Int<#=rows#>x<#=columns#> right) => default;
/// <summary>
/// Bitwise xors a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
/// <param name="left">The <see cref="<#=fullTypeName#>"/> value to bitwise xor.</param>
/// <param name="right">The <see cref="UInt<#=rows#>x<#=columns#>"/> value to combine.</param>
/// <returns>The result of performing the bitwise xor between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <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 <#=fullTypeName#> operator ^(<#=fullTypeName#> left, UInt<#=rows#>x<#=columns#> right) => default;
<#
}
WriteLine("");
#>
/// <summary>
ファイル差分が大きすぎるため表示されません。 差分を読み込み