Add GetPixelShaderEffectRegistrationBlob<T> APIs

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:04:31 +02:00
1 親 993308f6e0
コミット f6282f53ff
4ファイル変更
+390 -3

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

+32
ファイルの表示
@@ -0,0 +1,32 @@
using System.Runtime.CompilerServices;
namespace ComputeSharp.D2D1.NetStandard.System.Buffers;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="BitOperations"/> on .NET 6.
/// </summary>
internal static class BitOperations
{
/// <summary>
/// Rounds the given integral value up to a power of 2.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>
/// The smallest power of 2 which is greater than or equal to <paramref name="value"/>.
/// If <paramref name="value"/> is 0 or the result overflows, returns 0.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint RoundUpToPowerOf2(uint value)
{
// Based on https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
--value;
value |= value >> 1;
value |= value >> 2;
value |= value >> 4;
value |= value >> 8;
value |= value >> 16;
return value + 1;
}
}