Tweak D2D1PixelShader.CreateFromConstantBuffer method
このコミットが含まれているのは:
1 親
50b718b412
コミット
00776d8a3d
3ファイル変更
+5
-9
検索条件に一致するファイルはありません
@@ -130,7 +130,9 @@ public interface ID2D1PixelShaderDescriptor<T>
|
||||
/// Creates a new <typeparamref name="T"/> shader instance from a constant buffer.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The input constant buffer to read.</param>
|
||||
/// <returns>The resulting <typeparamref name="T"/> instance.</returns>
|
||||
/// <remarks>The input buffer must be retrieved from <see cref="LoadConstantBuffer"/>.</remarks>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="buffer"/> is not large enough for the current shader type.</exception>
|
||||
static abstract T CreateFromConstantBuffer(ReadOnlySpan<byte> buffer);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -441,17 +441,11 @@ public static class D2D1PixelShader
|
||||
/// <typeparam name="T">The type of D2D1 pixel shader value to create.</typeparam>
|
||||
/// <param name="span">The input <see cref="ReadOnlySpan{T}"/> with the constant buffer data.</param>
|
||||
/// <returns>The resulting <typeparamref name="T"/> instance.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="span"/> is not large enough to contain the constant buffer.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="span"/> is not large enough for the current shader type.</exception>
|
||||
public static T CreateFromConstantBuffer<T>(ReadOnlySpan<byte> span)
|
||||
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
|
||||
{
|
||||
if (!TryCreateFromConstantBuffer(span, out T shader))
|
||||
{
|
||||
default(ArgumentException).Throw(nameof(span));
|
||||
}
|
||||
|
||||
return shader;
|
||||
|
||||
return T.CreateFromConstantBuffer(span);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -738,7 +738,7 @@ namespace ComputeSharp.D2D1.Tests
|
||||
[DataRow(0)]
|
||||
[DataRow(4)]
|
||||
[DataRow(27)]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void GetConstantBuffer_BufferTooShort(int size)
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする