Add texture load/save overloads with string parameter
このコミットが含まれているのは:
1 親
fcc99d20aa
コミット
f3eb04e4b7
5ファイル変更
+223
-23
検索条件に一致するファイルはありません
@@ -3,6 +3,7 @@ using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
using ComputeSharp.Resources;
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
@@ -1070,6 +1071,24 @@ public static partial class GraphicsDeviceExtensions
|
||||
return new(device, width, height, depth, allocationMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a new readonly 2D texture with the contents of the specified file.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to store in the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the texture.</param>
|
||||
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
|
||||
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
|
||||
[Pure]
|
||||
public static ReadOnlyTexture2D<T, TPixel> LoadReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, string filename)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(filename, nameof(filename));
|
||||
|
||||
return device.LoadReadOnlyTexture2D<T, TPixel>(filename.AsSpan());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a new readonly 2D texture with the contents of the specified file.
|
||||
/// </summary>
|
||||
@@ -1114,6 +1133,24 @@ public static partial class GraphicsDeviceExtensions
|
||||
return texture;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a new writeable 2D texture with the contents of the specified file.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to store in the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the texture.</param>
|
||||
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
|
||||
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
|
||||
[Pure]
|
||||
public static ReadWriteTexture2D<T, TPixel> LoadReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, string filename)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(filename, nameof(filename));
|
||||
|
||||
return device.LoadReadWriteTexture2D<T, TPixel>(filename.AsSpan());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a new writeable 2D texture with the contents of the specified file.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする