mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 21:33:39 +01:00
Cleanup
This commit is contained in:
parent
0aa75306d4
commit
3415df5d40
32 changed files with 1718 additions and 1368 deletions
|
|
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
|||
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Textures;
|
||||
|
||||
using Lumina.Data.Files;
|
||||
|
||||
|
|
@ -121,14 +122,41 @@ public partial interface ITextureProvider
|
|||
TexFile file,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Gets the supported bitmap decoders.</summary>
|
||||
/// <returns>The supported bitmap decoders.</returns>
|
||||
/// <remarks>
|
||||
/// The following functions support the files of the container types pointed by yielded values.
|
||||
/// <ul>
|
||||
/// <li><see cref="GetFromFile"/></li>
|
||||
/// <li><see cref="GetFromManifestResource"/></li>
|
||||
/// <li><see cref="CreateFromImageAsync(ReadOnlyMemory{byte},CancellationToken)"/></li>
|
||||
/// <li><see cref="CreateFromImageAsync(Stream,bool,CancellationToken)"/></li>
|
||||
/// </ul>
|
||||
/// </remarks>
|
||||
IEnumerable<IBitmapCodecInfo> GetSupportedImageDecoderInfos();
|
||||
|
||||
/// <summary>Gets the supported bitmap encoders.</summary>
|
||||
/// <returns>The supported bitmap encoders.</returns>
|
||||
/// <remarks>
|
||||
/// The following function supports the files of the container types pointed by yielded values.
|
||||
/// <ul>
|
||||
/// <li><see cref="SaveToStreamAsync"/></li>
|
||||
/// </ul>
|
||||
/// </remarks>
|
||||
IEnumerable<IBitmapCodecInfo> GetSupportedImageEncoderInfos();
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given game resource icon specifier.</summary>
|
||||
/// <param name="lookup">A game icon specifier.</param>
|
||||
/// <returns>The shared texture that you may use to obtain the loaded texture wrap and load states.</returns>
|
||||
/// <remarks>This function is under the effect of <see cref="ITextureSubstitutionProvider.GetSubstitutedPath"/>.
|
||||
/// </remarks>
|
||||
ISharedImmediateTexture GetFromGameIcon(in GameIconLookup lookup);
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given path to a game resource.</summary>
|
||||
/// <param name="path">A path to a game resource.</param>
|
||||
/// <returns>The shared texture that you may use to obtain the loaded texture wrap and load states.</returns>
|
||||
/// <remarks>This function is under the effect of <see cref="ITextureSubstitutionProvider.GetSubstitutedPath"/>.
|
||||
/// </remarks>
|
||||
ISharedImmediateTexture GetFromGame(string path);
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given file on the filesystem.</summary>
|
||||
|
|
@ -173,26 +201,16 @@ public partial interface ITextureProvider
|
|||
/// then the source data will be returned.</para>
|
||||
/// <para>This function can fail.</para>
|
||||
/// </remarks>
|
||||
Task<(RawImageSpecification Specification, byte[] RawData)> GetRawDataAsync(
|
||||
Task<(RawImageSpecification Specification, byte[] RawData)> GetRawDataFromExistingTextureAsync(
|
||||
IDalamudTextureWrap wrap,
|
||||
Vector2 uv0,
|
||||
Vector2 uv1,
|
||||
int dxgiFormat = 0,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Gets the supported image file extensions available for loading.</summary>
|
||||
/// <returns>The supported extensions. Each <c>string[]</c> entry indicates that there can be multiple extensions
|
||||
/// that correspond to one container format.</returns>
|
||||
IEnumerable<string[]> GetLoadSupportedImageExtensions();
|
||||
|
||||
/// <summary>Gets the supported image file extensions available for saving.</summary>
|
||||
/// <returns>The supported extensions. Each <c>string[]</c> entry indicates that there can be multiple extensions
|
||||
/// that correspond to one container format.</returns>
|
||||
IEnumerable<string[]> GetSaveSupportedImageExtensions();
|
||||
|
||||
/// <summary>Saves a texture wrap to a stream in an image file format.</summary>
|
||||
/// <param name="wrap">The texture wrap to save.</param>
|
||||
/// <param name="extension">The extension of the file to deduce the file format with the leading dot.</param>
|
||||
/// <param name="containerGuid">The container GUID, obtained from <see cref="GetSupportedImageEncoderInfos"/>.</param>
|
||||
/// <param name="stream">The stream to save to.</param>
|
||||
/// <param name="leaveOpen">Whether to leave <paramref name="stream"/> open.</param>
|
||||
/// <param name="props">Properties to pass to the encoder. See
|
||||
|
|
@ -202,20 +220,33 @@ public partial interface ITextureProvider
|
|||
/// <returns>A task representing the save process.</returns>
|
||||
/// <remarks>
|
||||
/// <para><paramref name="wrap"/> may be disposed as soon as this function returns.</para>
|
||||
/// <para>If no image container format corresponding to <paramref name="extension"/> is found, then the image will
|
||||
/// be saved in png format.</para>
|
||||
/// </remarks>
|
||||
[SuppressMessage(
|
||||
"StyleCop.CSharp.LayoutRules",
|
||||
"SA1519:Braces should not be omitted from multi-line child statement",
|
||||
Justification = "Multiple fixed blocks")]
|
||||
Task SaveAsImageFormatToStreamAsync(
|
||||
Task SaveToStreamAsync(
|
||||
IDalamudTextureWrap wrap,
|
||||
string extension,
|
||||
Guid containerGuid,
|
||||
Stream stream,
|
||||
bool leaveOpen = false,
|
||||
IReadOnlyDictionary<string, object>? props = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>Saves a texture wrap to a file as an image file.</summary>
|
||||
/// <param name="wrap">The texture wrap to save.</param>
|
||||
/// <param name="containerGuid">The container GUID, obtained from <see cref="GetSupportedImageEncoderInfos"/>.</param>
|
||||
/// <param name="path">The target file path. The target file will be overwritten if it exist.</param>
|
||||
/// <param name="props">Properties to pass to the encoder. See
|
||||
/// <a href="https://learn.microsoft.com/en-us/windows/win32/wic/-wic-creating-encoder#encoder-options">Microsoft
|
||||
/// Learn</a> for available parameters.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A task representing the save process.</returns>
|
||||
/// <remarks>
|
||||
/// <para><paramref name="wrap"/> may be disposed as soon as this function returns.</para>
|
||||
/// </remarks>
|
||||
Task SaveToFileAsync(
|
||||
IDalamudTextureWrap wrap,
|
||||
Guid containerGuid,
|
||||
string path,
|
||||
IReadOnlyDictionary<string, object>? props = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the system supports the given DXGI format.
|
||||
|
|
|
|||
|
|
@ -9,14 +9,24 @@ namespace Dalamud.Plugin.Services;
|
|||
/// </summary>
|
||||
/// <param name="Width">The width of the image.</param>
|
||||
/// <param name="Height">The height of the image.</param>
|
||||
/// <param name="Pitch">The pitch of the image.</param>
|
||||
/// <param name="Pitch">The pitch of the image in bytes. The value may not always exactly match
|
||||
/// <c><paramref name="Width"/> * bytesPerPixelFromDxgiFormat</c>.</param>
|
||||
/// <param name="DxgiFormat">The format of the image. See <a href="https://learn.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format">DXGI_FORMAT</a>.</param>
|
||||
[SuppressMessage(
|
||||
"StyleCop.CSharp.NamingRules",
|
||||
"SA1313:Parameter names should begin with lower-case letter",
|
||||
Justification = "no")]
|
||||
public record struct RawImageSpecification(int Width, int Height, int Pitch, int DxgiFormat)
|
||||
public readonly record struct RawImageSpecification(int Width, int Height, int Pitch, int DxgiFormat)
|
||||
{
|
||||
private const string FormatNotSupportedMessage = $"{nameof(DxgiFormat)} is not supported.";
|
||||
|
||||
/// <summary>Gets the number of bits per pixel.</summary>
|
||||
/// <exception cref="NotSupportedException">Thrown if <see cref="DxgiFormat"/> is not supported.</exception>
|
||||
public int BitsPerPixel =>
|
||||
GetFormatInfo((DXGI_FORMAT)this.DxgiFormat, out var bitsPerPixel, out _)
|
||||
? bitsPerPixel
|
||||
: throw new NotSupportedException(FormatNotSupportedMessage);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="RawImageSpecification"/> record using the given resolution and pixel
|
||||
/// format. Pitch will be automatically calculated.
|
||||
|
|
@ -25,167 +35,11 @@ public record struct RawImageSpecification(int Width, int Height, int Pitch, int
|
|||
/// <param name="height">The height.</param>
|
||||
/// <param name="format">The format.</param>
|
||||
/// <returns>The new instance.</returns>
|
||||
/// <exception cref="NotSupportedException">Thrown if <see cref="DxgiFormat"/> is not supported.</exception>
|
||||
public static RawImageSpecification From(int width, int height, int format)
|
||||
{
|
||||
int bitsPerPixel;
|
||||
var isBlockCompression = false;
|
||||
switch ((DXGI_FORMAT)format)
|
||||
{
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_SINT:
|
||||
bitsPerPixel = 128;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_SINT:
|
||||
bitsPerPixel = 96;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G8X24_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
|
||||
bitsPerPixel = 64;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R11G11B10_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D24_UNORM_S8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_X24_TYPELESS_G8_UINT:
|
||||
bitsPerPixel = 32;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_SINT:
|
||||
bitsPerPixel = 16;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_A8_UNORM:
|
||||
bitsPerPixel = 8;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R1_UNORM:
|
||||
bitsPerPixel = 1;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_B8G8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_G8R8_G8B8_UNORM:
|
||||
throw new NotSupportedException();
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||
bitsPerPixel = 4;
|
||||
isBlockCompression = true;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM:
|
||||
bitsPerPixel = 4;
|
||||
isBlockCompression = true;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_SNORM:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM:
|
||||
bitsPerPixel = 16;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
|
||||
bitsPerPixel = 32;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_UF16:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_SF16:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
break;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_AYUV:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_Y410:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_Y416:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_NV12:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_P010:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_P016:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_420_OPAQUE:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_YUY2:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_Y210:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_Y216:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_NV11:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_AI44:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_IA44:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_P8:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_A8P8:
|
||||
throw new NotSupportedException();
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM:
|
||||
bitsPerPixel = 16;
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
if (!GetFormatInfo((DXGI_FORMAT)format, out var bitsPerPixel, out var isBlockCompression))
|
||||
throw new NotSupportedException(FormatNotSupportedMessage);
|
||||
|
||||
var pitch = isBlockCompression
|
||||
? Math.Max(1, (width + 3) / 4) * 2 * bitsPerPixel
|
||||
|
|
@ -223,4 +77,157 @@ public record struct RawImageSpecification(int Width, int Height, int Pitch, int
|
|||
/// <returns>The new instance.</returns>
|
||||
public static RawImageSpecification A8(int width, int height) =>
|
||||
new(width, height, width, (int)DXGI_FORMAT.DXGI_FORMAT_A8_UNORM);
|
||||
|
||||
private static bool GetFormatInfo(DXGI_FORMAT format, out int bitsPerPixel, out bool isBlockCompression)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_SINT:
|
||||
bitsPerPixel = 128;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32B32_SINT:
|
||||
bitsPerPixel = 96;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G32_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32G8X24_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
|
||||
bitsPerPixel = 64;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R11G11B10_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16G16_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R32_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D24_UNORM_S8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_X24_TYPELESS_G8_UINT:
|
||||
bitsPerPixel = 32;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8G8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_FLOAT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_D16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R16_SINT:
|
||||
bitsPerPixel = 16;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_UINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_SNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R8_SINT:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_A8_UNORM:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R1_UNORM:
|
||||
bitsPerPixel = 1;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB:
|
||||
bitsPerPixel = 4;
|
||||
isBlockCompression = true;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM:
|
||||
bitsPerPixel = 4;
|
||||
isBlockCompression = true;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC5_SNORM:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM:
|
||||
bitsPerPixel = 16;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
|
||||
bitsPerPixel = 32;
|
||||
isBlockCompression = false;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_UF16:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC6H_SF16:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_TYPELESS:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM:
|
||||
case DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
bitsPerPixel = 8;
|
||||
isBlockCompression = true;
|
||||
return true;
|
||||
case DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM:
|
||||
bitsPerPixel = 16;
|
||||
isBlockCompression = true;
|
||||
return false;
|
||||
default:
|
||||
bitsPerPixel = 0;
|
||||
isBlockCompression = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue