mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
41 changed files with 768360 additions and 0 deletions
18
brutal.ktx/Brutal.Ktx/Abstractions/GpuUploadUtils.cs
Normal file
18
brutal.ktx/Brutal.Ktx/Abstractions/GpuUploadUtils.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
namespace Brutal.KtxApi.Abstractions;
|
||||
|
||||
public static class GpuUploadUtils
|
||||
{
|
||||
public static bool IsRowSize4BytePadded(KtxTextureHandle textureHandle, int level)
|
||||
{
|
||||
if (textureHandle.ClassId == ClassId.Texture2C)
|
||||
return false;
|
||||
|
||||
// Catches compressed textures (All multiple of 4 in element size), and uncompressed with 4 byte elements
|
||||
if (textureHandle.GetElementSize() % 4 == 0)
|
||||
return false;
|
||||
|
||||
var levelPixelWidth = textureHandle.BaseWidth >> level;
|
||||
|
||||
return textureHandle.GetRowPitch((uint)level) != textureHandle.GetElementSize() * levelPixelWidth;
|
||||
}
|
||||
}
|
||||
25
brutal.ktx/Brutal.Ktx/Abstractions/KtxAstcParamsPartial.cs
Normal file
25
brutal.ktx/Brutal.Ktx/Abstractions/KtxAstcParamsPartial.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
namespace Brutal.KtxApi;
|
||||
|
||||
public partial struct KtxAstcParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialises the StructSize field to the correct value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constructor only runs when you call <c>new KtxAstcParams()</c> explicitly - it is
|
||||
/// bypassed by <c>default(KtxAstcParams)</c>, array elements (<c>new KtxAstcParams[n]</c>),
|
||||
/// and struct fields in other types, all of which leave StructSize at 0. Prefer
|
||||
/// <see cref="Create"/> when you're not immediately assigning every field via an object
|
||||
/// initializer.
|
||||
/// </remarks>
|
||||
public unsafe KtxAstcParams()
|
||||
{
|
||||
StructSize = (uint)sizeof(KtxAstcParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a KtxAstcParams with StructSize correctly initialised. Preferred over
|
||||
/// <c>default(KtxAstcParams)</c> or array/field initialization, which leave StructSize at 0.
|
||||
/// </summary>
|
||||
public static KtxAstcParams Create() => new();
|
||||
}
|
||||
25
brutal.ktx/Brutal.Ktx/Abstractions/KtxBasisParamsPartial.cs
Normal file
25
brutal.ktx/Brutal.Ktx/Abstractions/KtxBasisParamsPartial.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
namespace Brutal.KtxApi;
|
||||
|
||||
public partial struct KtxBasisParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialises the StructSize field to the correct value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constructor only runs when you call <c>new KtxBasisParams()</c> explicitly - it is
|
||||
/// bypassed by <c>default(KtxBasisParams)</c>, array elements (<c>new KtxBasisParams[n]</c>),
|
||||
/// and struct fields in other types, all of which leave StructSize at 0. Prefer
|
||||
/// <see cref="Create"/> when you're not immediately assigning every field via an object
|
||||
/// initializer.
|
||||
/// </remarks>
|
||||
public unsafe KtxBasisParams()
|
||||
{
|
||||
StructSize = (uint)sizeof(KtxBasisParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a KtxBasisParams with StructSize correctly initialised. Preferred over
|
||||
/// <c>default(KtxBasisParams)</c> or array/field initialization, which leave StructSize at 0.
|
||||
/// </summary>
|
||||
public static KtxBasisParams Create() => new();
|
||||
}
|
||||
40
brutal.ktx/Brutal.Ktx/Abstractions/KtxNativeBuffer.cs
Normal file
40
brutal.ktx/Brutal.Ktx/Abstractions/KtxNativeBuffer.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
namespace Brutal.KtxApi;
|
||||
|
||||
/// <summary>
|
||||
/// Owns a native buffer returned by WriteToMemory/WriteKtx2ToMemory. The buffer is allocated with
|
||||
/// malloc() inside the native KTX library, so it must be freed with the matching native free() -
|
||||
/// Dispose() does this for you. Do not free the underlying pointer with any other allocator (e.g.
|
||||
/// Brutal.Memory.Mem.Free), as that frees memory with a different allocator than the one that
|
||||
/// allocated it, corrupting the heap.
|
||||
/// </summary>
|
||||
public unsafe struct KtxNativeBuffer : IDisposable
|
||||
{
|
||||
private byte* _pointer;
|
||||
|
||||
/// <summary>The size of the buffer in bytes.</summary>
|
||||
public ulong Length { get; }
|
||||
|
||||
/// <summary>Raw pointer to the native buffer.</summary>
|
||||
public byte* Pointer => _pointer;
|
||||
|
||||
/// <summary>
|
||||
/// A read-only view of the buffer. Throws if Length exceeds int.MaxValue, since Span<T>
|
||||
/// cannot address more than 2GiB - use Pointer and Length directly for buffers that large.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<byte> Span => new(_pointer, checked((int)Length));
|
||||
|
||||
internal KtxNativeBuffer(byte* pointer, ulong length)
|
||||
{
|
||||
_pointer = pointer;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_pointer is null)
|
||||
return;
|
||||
|
||||
KtxNativeMemory.Free(_pointer);
|
||||
_pointer = null;
|
||||
}
|
||||
}
|
||||
13
brutal.ktx/Brutal.Ktx/Abstractions/KtxNativeMemory.cs
Normal file
13
brutal.ktx/Brutal.Ktx/Abstractions/KtxNativeMemory.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi;
|
||||
|
||||
/// <summary>
|
||||
/// Binds to the native free() used by the KTX library itself, for releasing buffers it allocated
|
||||
/// with malloc() (e.g. via WriteToMemory/WriteKtx2ToMemory). See KtxNativeBuffer.
|
||||
/// </summary>
|
||||
internal static unsafe partial class KtxNativeMemory
|
||||
{
|
||||
[LibraryImport("Ktx", EntryPoint = "ktx_FreeWriteToMemoryBuffer1")]
|
||||
public static partial void Free(void* ptr);
|
||||
}
|
||||
137
brutal.ktx/Brutal.Ktx/Abstractions/KtxTextureExtensions.cs
Normal file
137
brutal.ktx/Brutal.Ktx/Abstractions/KtxTextureExtensions.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
using System.Text;
|
||||
using Brutal.Numerics;
|
||||
|
||||
namespace Brutal.KtxApi.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides useful extensions to the KTX texture types.
|
||||
/// </summary>
|
||||
public static class KtxTextureExtensions
|
||||
{
|
||||
#region File IO
|
||||
|
||||
public static KtxErrorCode WriteToNamedFile(this KtxTexture2Handle textureHandle, string filePath) =>
|
||||
textureHandle.WriteToNamedFile(Encoding.UTF8.GetBytes(filePath + "\0"));
|
||||
|
||||
public static KtxErrorCode WriteToNamedFile(this KtxTexture1Handle textureHandle, string filePath) =>
|
||||
textureHandle.WriteToNamedFile(Encoding.UTF8.GetBytes(filePath + "\0"));
|
||||
|
||||
public static KtxErrorCode WriteToNamedFile(this KtxTextureHandle textureHandle, string filePath) =>
|
||||
textureHandle.WriteToNamedFile(Encoding.UTF8.GetBytes(filePath + "\0"));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Data Access
|
||||
/// <summary>
|
||||
/// Returns a span covering the image data for a given level, layer and face.
|
||||
/// </summary>
|
||||
/// <param name="textureHandle">Handle to KTX texture of any version</param>
|
||||
/// <param name="level">The mip level to retrieve data for</param>
|
||||
/// <param name="layer">The layer</param>
|
||||
/// <param name="faceSlice">The face if this is cubemap texture </param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>KtxErrorCode for the result the function</returns>
|
||||
public static unsafe KtxErrorCode GetImageData(
|
||||
this KtxTextureHandle textureHandle,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
out Span<byte> data
|
||||
)
|
||||
{
|
||||
var result = textureHandle.GetImageOffset(level, layer, faceSlice, out var imageOffset);
|
||||
if (result != KtxErrorCode.Success)
|
||||
{
|
||||
data = new Span<byte>();
|
||||
return result;
|
||||
}
|
||||
|
||||
data = new Span<byte>(textureHandle.GetData() + imageOffset, (int)textureHandle.GetImageSize(level));
|
||||
return KtxErrorCode.Success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a span of the image data for a given level, layer and face for a v2 texture.
|
||||
/// </summary>
|
||||
/// <param name="textureHandle">Handle to version 2 KTX texture</param>
|
||||
/// <param name="level">The mip level to retrieve data for</param>
|
||||
/// <param name="layer">The layer</param>
|
||||
/// <param name="faceSlice">The face if this is cubemap texture </param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>KtxErrorCode for the result the function</returns>
|
||||
public static KtxErrorCode GetImageData(
|
||||
this KtxTexture2Handle textureHandle,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
out Span<byte> data
|
||||
)
|
||||
{
|
||||
return ((KtxTextureHandle)textureHandle).GetImageData(level, layer, faceSlice, out data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns a span of the image data for a given level, layer and face for a v1 texture.
|
||||
/// </summary>
|
||||
/// <param name="textureHandle">Handle to version 1 KTX texture</param>
|
||||
/// <param name="level">The mip level to retrieve data for</param>
|
||||
/// <param name="layer">The layer</param>
|
||||
/// <param name="faceSlice">The face if this is cubemap texture </param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>KtxErrorCode for the result the function</returns>
|
||||
public static KtxErrorCode GetImageData(
|
||||
this KtxTexture1Handle textureHandle,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
out Span<byte> data
|
||||
)
|
||||
{
|
||||
return ((KtxTextureHandle)textureHandle).GetImageData(level, layer, faceSlice, out data);
|
||||
}
|
||||
|
||||
public static unsafe int3 GetBlockExtent(this KtxTextureHandle textureHandle)
|
||||
{
|
||||
return new(
|
||||
(int)textureHandle.Protected->FormatSize.BlockWidth,
|
||||
(int)textureHandle.Protected->FormatSize.BlockHeight,
|
||||
(int)textureHandle.Protected->FormatSize.BlockDepth
|
||||
);
|
||||
}
|
||||
|
||||
#region Texture Version Conversion
|
||||
|
||||
/// <summary>
|
||||
/// Converts a generic KtxTextureHandle to a KtxTexture2Handle if the underlying texture is a version 2
|
||||
/// texture.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to the version agnostic KTX texture</param>
|
||||
/// <returns>The KtxTexture2Handle of the texture</returns>
|
||||
/// <exception cref="InvalidCastException">Thrown if the texture is not a version 2 texture</exception>
|
||||
public static KtxTexture2Handle AsKtxTexture2Handle(this KtxTextureHandle handle)
|
||||
{
|
||||
if (handle.ClassId != ClassId.Texture2C)
|
||||
throw new InvalidCastException($"Texture is not a v2 texture");
|
||||
|
||||
return new KtxTexture2Handle(handle.Impl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a generic KtxTextureHandle to a KtxTexture1Handle if the underlying texture is a version 1
|
||||
/// texture.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to the version agnostic KTX texture</param>
|
||||
/// <returns>The KtxTexture1Handle of the texture</returns>
|
||||
/// <exception cref="InvalidCastException">Thrown if the texture is not a version 1 texture</exception>
|
||||
public static KtxTexture1Handle AsKtxTexture1Handle(this KtxTextureHandle handle)
|
||||
{
|
||||
if (handle.ClassId != ClassId.Texture1C)
|
||||
throw new InvalidCastException($"Texture is not a v1 texture");
|
||||
|
||||
return new KtxTexture1Handle(handle.Impl);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
12
brutal.ktx/Brutal.Ktx/Generated/ClassId.gen.cs
Normal file
12
brutal.ktx/Brutal.Ktx/Generated/ClassId.gen.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum ClassId : int
|
||||
{
|
||||
Texture1C = 1,
|
||||
Texture2C = 2,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate KtxErrorCode IterateCallbackDelegate(
|
||||
int miplevel,
|
||||
int face,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
ulong faceLodSize,
|
||||
IntPtr pixels,
|
||||
IntPtr userdata
|
||||
);
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
152
brutal.ktx/Brutal.Ktx/Generated/KhrDfModel.gen.cs
Normal file
152
brutal.ktx/Brutal.Ktx/Generated/KhrDfModel.gen.cs
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KhrDfModel : int
|
||||
{
|
||||
/// <summary>No interpretation of color channels defined</summary>
|
||||
Unspecified = 0,
|
||||
|
||||
/// <summary>Color primaries (red, green, blue) + alpha, depth and stencil</summary>
|
||||
Rgbsda = 1,
|
||||
|
||||
/// <summary>Color differences (Y', Cb, Cr) + alpha, depth and stencil</summary>
|
||||
Yuvsda = 2,
|
||||
|
||||
/// <summary>Color differences (Y', I, Q) + alpha, depth and stencil</summary>
|
||||
Yiqsda = 3,
|
||||
|
||||
/// <summary>Perceptual color (CIE L*a*b*) + alpha, depth and stencil</summary>
|
||||
Labsda = 4,
|
||||
|
||||
/// <summary>Subtractive colors (cyan, magenta, yellow, black) + alpha</summary>
|
||||
Cmyka = 5,
|
||||
|
||||
/// <summary>Non-color coordinate data (X, Y, Z, W)</summary>
|
||||
Xyzw = 6,
|
||||
|
||||
/// <summary>Hue, saturation, value, hue angle on color circle, plus alpha</summary>
|
||||
HsvaAng = 7,
|
||||
|
||||
/// <summary>Hue, saturation, lightness, hue angle on color circle, plus alpha</summary>
|
||||
HslaAng = 8,
|
||||
|
||||
/// <summary>Hue, saturation, value, hue on color hexagon, plus alpha</summary>
|
||||
HsvaHex = 9,
|
||||
|
||||
/// <summary>Hue, saturation, lightness, hue on color hexagon, plus alpha</summary>
|
||||
HslaHex = 10,
|
||||
|
||||
/// <summary>Lightweight approximate color difference (luma, orange, green)</summary>
|
||||
Ycgcoa = 11,
|
||||
|
||||
/// <summary>ITU BT.2020 constant luminance YcCbcCrc</summary>
|
||||
Yccbccrc = 12,
|
||||
|
||||
/// <summary>ITU BT.2100 constant intensity ICtCp</summary>
|
||||
Ictcp = 13,
|
||||
|
||||
/// <summary>CIE 1931 XYZ color coordinates (X, Y, Z)</summary>
|
||||
Ciexyz = 14,
|
||||
|
||||
/// <summary>CIE 1931 xyY color coordinates (X, Y, Y)</summary>
|
||||
Ciexyy = 15,
|
||||
|
||||
/// <summary>Compressed formats start at 128.</summary>
|
||||
/// These compressed formats should generally have a single sample,sited at the 0,0 position of the texel block. Where multiplechannels are used to distinguish formats, these should be cosited.
|
||||
/// Direct3D (and S3) compressed formats
|
||||
/// Note that premultiplied status is recorded separately
|
||||
/// DXT1 "channels" are RGB (0), Alpha (1)
|
||||
/// DXT1/BC1 with one channel is opaque
|
||||
/// DXT1/BC1 with a cosited alpha sample is transparent
|
||||
Dxt1A = 128,
|
||||
|
||||
/// <summary>Compressed formats start at 128.</summary>
|
||||
/// These compressed formats should generally have a single sample,sited at the 0,0 position of the texel block. Where multiplechannels are used to distinguish formats, these should be cosited.
|
||||
/// Direct3D (and S3) compressed formats
|
||||
/// Note that premultiplied status is recorded separately
|
||||
/// DXT1 "channels" are RGB (0), Alpha (1)
|
||||
/// DXT1/BC1 with one channel is opaque
|
||||
/// DXT1/BC1 with a cosited alpha sample is transparent
|
||||
Bc1A = 128,
|
||||
|
||||
/// <summary>DXT2/DXT3/BC2, with explicit 4-bit alpha</summary>
|
||||
Dxt2 = 129,
|
||||
|
||||
/// <summary>DXT2/DXT3/BC2, with explicit 4-bit alpha</summary>
|
||||
Dxt3 = 129,
|
||||
|
||||
/// <summary>DXT2/DXT3/BC2, with explicit 4-bit alpha</summary>
|
||||
Bc2 = 129,
|
||||
|
||||
/// <summary>DXT4/DXT5/BC3, with interpolated alpha</summary>
|
||||
Dxt4 = 130,
|
||||
|
||||
/// <summary>DXT4/DXT5/BC3, with interpolated alpha</summary>
|
||||
Dxt5 = 130,
|
||||
|
||||
/// <summary>DXT4/DXT5/BC3, with interpolated alpha</summary>
|
||||
Bc3 = 130,
|
||||
|
||||
/// <summary>ATI1n/DXT5A/BC4 - single channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Ati1N = 131,
|
||||
|
||||
/// <summary>ATI1n/DXT5A/BC4 - single channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Dxt5A = 131,
|
||||
|
||||
/// <summary>ATI1n/DXT5A/BC4 - single channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Bc4 = 131,
|
||||
|
||||
/// <summary>ATI2n_XY/DXN/BC5 - two channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Ati2NXy = 132,
|
||||
|
||||
/// <summary>ATI2n_XY/DXN/BC5 - two channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Dxn = 132,
|
||||
|
||||
/// <summary>ATI2n_XY/DXN/BC5 - two channel interpolated 8-bit data</summary>
|
||||
/// (The UNORM/SNORM variation is recorded in the channel data)
|
||||
Bc5 = 132,
|
||||
|
||||
/// <summary>BC6H - DX11 format for 16-bit float channels</summary>
|
||||
Bc6H = 133,
|
||||
|
||||
/// <summary>BC7 - DX11 format</summary>
|
||||
Bc7 = 134,
|
||||
|
||||
/// <summary>Mobile compressed formats follow</summary>
|
||||
/// A format of ETC1 indicates that the format shall be decodableby an ETC1-compliant decoder and not rely on ETC2 features
|
||||
Etc1 = 160,
|
||||
|
||||
/// <summary>A format of ETC2 is permitted to use ETC2 encodings on top ofthe baseline ETC1 specification</summary>
|
||||
/// The ETC2 format has channels "red", "green", "RGB" and "alpha",which should be cosited samples
|
||||
/// Punch-through alpha can be distinguished from full alpha bythe plane size in bytes required for the texel block
|
||||
Etc2 = 161,
|
||||
|
||||
/// <summary>Adaptive Scalable Texture Compression</summary>
|
||||
/// ASTC HDR vs LDR is determined by the float flag in the channel
|
||||
/// ASTC block size can be distinguished by texel block size
|
||||
Astc = 162,
|
||||
|
||||
/// <summary>ETC1S is a simplified subset of ETC1</summary>
|
||||
Etc1S = 163,
|
||||
|
||||
/// <summary>PowerVR Texture Compression</summary>
|
||||
Pvrtc = 164,
|
||||
|
||||
/// <summary>PowerVR Texture Compression</summary>
|
||||
Pvrtc2 = 165,
|
||||
|
||||
/// <summary>PowerVR Texture Compression</summary>
|
||||
Uastc = 166,
|
||||
|
||||
/// <summary>Proprietary formats (ATITC, etc.) should follow</summary>
|
||||
Max = 255,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
54
brutal.ktx/Brutal.Ktx/Generated/KhrDfPrimaries.gen.cs
Normal file
54
brutal.ktx/Brutal.Ktx/Generated/KhrDfPrimaries.gen.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KhrDfPrimaries : int
|
||||
{
|
||||
/// <summary>No color primaries defined</summary>
|
||||
Unspecified = 0,
|
||||
|
||||
/// <summary>Color primaries of ITU-R BT.709 and sRGB</summary>
|
||||
Bt709 = 1,
|
||||
|
||||
/// <summary>Synonym for KHR_DF_PRIMARIES_BT709</summary>
|
||||
Srgb = 1,
|
||||
|
||||
/// <summary>Color primaries of ITU-R BT.601 (625-line EBU variant)</summary>
|
||||
Bt601Ebu = 2,
|
||||
|
||||
/// <summary>Color primaries of ITU-R BT.601 (525-line SMPTE C variant)</summary>
|
||||
Bt601Smpte = 3,
|
||||
|
||||
/// <summary>Color primaries of ITU-R BT.2020</summary>
|
||||
Bt2020 = 4,
|
||||
|
||||
/// <summary>ITU-R BT.2100 uses the same primaries as BT.2020</summary>
|
||||
Bt2100 = 4,
|
||||
|
||||
/// <summary>CIE theoretical color coordinate space</summary>
|
||||
Ciexyz = 5,
|
||||
|
||||
/// <summary>Academy Color Encoding System primaries</summary>
|
||||
Aces = 6,
|
||||
|
||||
/// <summary>Color primaries of ACEScc</summary>
|
||||
Acescc = 7,
|
||||
|
||||
/// <summary>Legacy NTSC 1953 primaries</summary>
|
||||
Ntsc1953 = 8,
|
||||
|
||||
/// <summary>Legacy PAL 525-line primaries</summary>
|
||||
Pal525 = 9,
|
||||
|
||||
/// <summary>Color primaries of Display P3</summary>
|
||||
Displayp3 = 10,
|
||||
|
||||
/// <summary>Color primaries of Adobe RGB (1998)</summary>
|
||||
Adobergb = 11,
|
||||
|
||||
/// <summary>Color primaries of Adobe RGB (1998)</summary>
|
||||
Max = 255,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
141
brutal.ktx/Brutal.Ktx/Generated/KhrDfTransfer.gen.cs
Normal file
141
brutal.ktx/Brutal.Ktx/Generated/KhrDfTransfer.gen.cs
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KhrDfTransfer : int
|
||||
{
|
||||
/// <summary>No transfer function defined</summary>
|
||||
Unspecified = 0,
|
||||
|
||||
/// <summary>Linear transfer function (value proportional to intensity)</summary>
|
||||
Linear = 1,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of sRGB (~2.2); also used for scRGB</summary>
|
||||
Srgb = 2,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of sRGB (~2.2); also used for scRGB</summary>
|
||||
SrgbEotf = 2,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of sRGB (~2.2); also used for scRGB</summary>
|
||||
Scrgb = 2,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of sRGB (~2.2); also used for scRGB</summary>
|
||||
ScrgbEotf = 2,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Itu = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
ItuOetf = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt601 = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt601Oetf = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt709 = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt709Oetf = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt2020 = 3,
|
||||
|
||||
/// <summary>Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45)</summary>
|
||||
Bt2020Oetf = 3,
|
||||
|
||||
/// <summary>SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) and a linear OOTF</summary>
|
||||
Smtpe170M = 3,
|
||||
|
||||
/// <summary>SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) and a linear OOTF</summary>
|
||||
Smtpe170MOetf = 3,
|
||||
|
||||
/// <summary>SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) and a linear OOTF</summary>
|
||||
Smtpe170MEotf = 3,
|
||||
|
||||
/// <summary>Perceptually-linear gamma function of original NTSC (simple 2.2 gamma)</summary>
|
||||
Ntsc = 4,
|
||||
|
||||
/// <summary>Perceptually-linear gamma function of original NTSC (simple 2.2 gamma)</summary>
|
||||
NtscEotf = 4,
|
||||
|
||||
/// <summary>Sony S-log used by Sony video cameras</summary>
|
||||
Slog = 5,
|
||||
|
||||
/// <summary>Sony S-log used by Sony video cameras</summary>
|
||||
SlogOetf = 5,
|
||||
|
||||
/// <summary>Sony S-log 2 used by Sony video cameras</summary>
|
||||
Slog2 = 6,
|
||||
|
||||
/// <summary>Sony S-log 2 used by Sony video cameras</summary>
|
||||
Slog2Oetf = 6,
|
||||
|
||||
/// <summary>ITU BT.1886 EOTF</summary>
|
||||
Bt1886 = 7,
|
||||
|
||||
/// <summary>ITU BT.1886 EOTF</summary>
|
||||
Bt1886Eotf = 7,
|
||||
|
||||
/// <summary>ITU BT.2100 HLG OETF (typical scene-referred content), linear light normalized 0..1</summary>
|
||||
HlgOetf = 8,
|
||||
|
||||
/// <summary>ITU BT.2100 HLG EOTF (nominal HDR display of HLG content), linear light normalized 0..1</summary>
|
||||
HlgEotf = 9,
|
||||
|
||||
/// <summary>ITU BT.2100 PQ EOTF (typical HDR display-referred PQ content)</summary>
|
||||
PqEotf = 10,
|
||||
|
||||
/// <summary>ITU BT.2100 PQ OETF (nominal scene described by PQ HDR content)</summary>
|
||||
PqOetf = 11,
|
||||
|
||||
/// <summary>DCI P3 transfer function</summary>
|
||||
Dcip3 = 12,
|
||||
|
||||
/// <summary>DCI P3 transfer function</summary>
|
||||
Dcip3Eotf = 12,
|
||||
|
||||
/// <summary>Legacy PAL OETF</summary>
|
||||
PalOetf = 13,
|
||||
|
||||
/// <summary>Legacy PAL 625-line EOTF</summary>
|
||||
Pal625Eotf = 14,
|
||||
|
||||
/// <summary>Legacy ST240 transfer function</summary>
|
||||
St240 = 15,
|
||||
|
||||
/// <summary>Legacy ST240 transfer function</summary>
|
||||
St240Oetf = 15,
|
||||
|
||||
/// <summary>Legacy ST240 transfer function</summary>
|
||||
St240Eotf = 15,
|
||||
|
||||
/// <summary>ACEScc transfer function</summary>
|
||||
Acescc = 16,
|
||||
|
||||
/// <summary>ACEScc transfer function</summary>
|
||||
AcesccOetf = 16,
|
||||
|
||||
/// <summary>ACEScct transfer function</summary>
|
||||
Acescct = 17,
|
||||
|
||||
/// <summary>ACEScct transfer function</summary>
|
||||
AcescctOetf = 17,
|
||||
|
||||
/// <summary>Adobe RGB (1998) transfer function</summary>
|
||||
Adobergb = 18,
|
||||
|
||||
/// <summary>Adobe RGB (1998) transfer function</summary>
|
||||
AdobergbEotf = 18,
|
||||
|
||||
/// <summary>Legacy ITU BT.2100 HLG OETF (typical scene-referred content), linear light normalized 0..12</summary>
|
||||
HlgUnnormalizedOetf = 19,
|
||||
|
||||
/// <summary>Legacy ITU BT.2100 HLG OETF (typical scene-referred content), linear light normalized 0..12</summary>
|
||||
Max = 255,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
38
brutal.ktx/Brutal.Ktx/Generated/KtxAstcParams.gen.cs
Normal file
38
brutal.ktx/Brutal.Ktx/Generated/KtxAstcParams.gen.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 4)]
|
||||
public unsafe partial struct KtxAstcParams
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public uint StructSize;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public Bool8 Verbose;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public uint ThreadCount;
|
||||
|
||||
/// <summary>astcenc params</summary>
|
||||
[FieldOffset(12)]
|
||||
public uint BlockDimension;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public uint Mode;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public uint QualityLevel;
|
||||
|
||||
[FieldOffset(24)]
|
||||
public Bool8 NormalMap;
|
||||
|
||||
[FieldOffset(25)]
|
||||
public Bool8 Perceptual;
|
||||
|
||||
[FieldOffset(26)]
|
||||
public unsafe fixed byte InputSwizzle[4];
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
87
brutal.ktx/Brutal.Ktx/Generated/KtxBasisParams.gen.cs
Normal file
87
brutal.ktx/Brutal.Ktx/Generated/KtxBasisParams.gen.cs
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 4)]
|
||||
public unsafe partial struct KtxBasisParams
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public uint StructSize;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public Bool8 Uastc;
|
||||
|
||||
[FieldOffset(5)]
|
||||
public Bool8 Verbose;
|
||||
|
||||
[FieldOffset(6)]
|
||||
public Bool8 NoSse;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public uint ThreadCount;
|
||||
|
||||
/// <summary>ETC1S params</summary>
|
||||
[FieldOffset(12)]
|
||||
public uint CompressionLevel;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public uint QualityLevel;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public uint MaxEndpoints;
|
||||
|
||||
[FieldOffset(24)]
|
||||
public float EndpointRdoThreshold;
|
||||
|
||||
[FieldOffset(28)]
|
||||
public uint MaxSelectors;
|
||||
|
||||
[FieldOffset(32)]
|
||||
public float SelectorRdoThreshold;
|
||||
|
||||
[FieldOffset(36)]
|
||||
public unsafe fixed byte InputSwizzle[4];
|
||||
|
||||
[FieldOffset(40)]
|
||||
public Bool8 NormalMap;
|
||||
|
||||
[FieldOffset(41)]
|
||||
public Bool8 SeparateRgtORgbA;
|
||||
|
||||
[FieldOffset(42)]
|
||||
public Bool8 PreSwizzle;
|
||||
|
||||
[FieldOffset(43)]
|
||||
public Bool8 NoEndpointRdo;
|
||||
|
||||
[FieldOffset(44)]
|
||||
public Bool8 NoSelectorRdo;
|
||||
|
||||
/// <summary>UASTC params</summary>
|
||||
[FieldOffset(48)]
|
||||
public KtxPackUastcFlagBits UastcFlags;
|
||||
|
||||
[FieldOffset(52)]
|
||||
public Bool8 UastcRdo;
|
||||
|
||||
[FieldOffset(56)]
|
||||
public float UastcRdoQualityScalar;
|
||||
|
||||
[FieldOffset(60)]
|
||||
public uint UastcRdoDictSize;
|
||||
|
||||
[FieldOffset(64)]
|
||||
public float UastcRdoMaxSmoothBlockErrorScale;
|
||||
|
||||
[FieldOffset(68)]
|
||||
public float UastcRdoMaxSmoothBlockStdDev;
|
||||
|
||||
[FieldOffset(72)]
|
||||
public Bool8 UastcRdoDontFavorSimplerModes;
|
||||
|
||||
[FieldOffset(73)]
|
||||
public Bool8 UastcRdoNoMultithreading;
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
75
brutal.ktx/Brutal.Ktx/Generated/KtxErrorCode.gen.cs
Normal file
75
brutal.ktx/Brutal.Ktx/Generated/KtxErrorCode.gen.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KtxErrorCode : int
|
||||
{
|
||||
/// <summary>Operation was successful.</summary>
|
||||
Success = 0,
|
||||
|
||||
/// <summary>The data in the file is inconsistent with the spec.</summary>
|
||||
FileDataError,
|
||||
|
||||
/// <summary>The file is a pipe or named pipe.</summary>
|
||||
FileIspipe,
|
||||
|
||||
/// <summary>The target file could not be opened.</summary>
|
||||
FileOpenFailed,
|
||||
|
||||
/// <summary>The operation would exceed the max file size.</summary>
|
||||
FileOverflow,
|
||||
|
||||
/// <summary>An error occurred while reading from the file.</summary>
|
||||
FileReadError,
|
||||
|
||||
/// <summary>An error occurred while seeking in the file.</summary>
|
||||
FileSeekError,
|
||||
|
||||
/// <summary>File does not have enough data to satisfy request.</summary>
|
||||
FileUnexpectedEof,
|
||||
|
||||
/// <summary>An error occurred while writing to the file.</summary>
|
||||
FileWriteError,
|
||||
|
||||
/// <summary>GL operations resulted in an error.</summary>
|
||||
GlError,
|
||||
|
||||
/// <summary>The operation is not allowed in the current state.</summary>
|
||||
InvalidOperation,
|
||||
|
||||
/// <summary>A parameter value was not valid.</summary>
|
||||
InvalidValue,
|
||||
|
||||
/// <summary>Requested metadata key or required dynamically loaded GPU function was not found.</summary>
|
||||
NotFound,
|
||||
|
||||
/// <summary>Not enough memory to complete the operation.</summary>
|
||||
OutOfMemory,
|
||||
|
||||
/// <summary>Transcoding of block compressed texture failed.</summary>
|
||||
TranscodeFailed,
|
||||
|
||||
/// <summary>The file not a KTX file</summary>
|
||||
UnknownFileFormat,
|
||||
|
||||
/// <summary>The KTX file specifies an unsupported texture type.</summary>
|
||||
UnsupportedTextureType,
|
||||
|
||||
/// <summary>Feature not included in in-use library or not yet implemented.</summary>
|
||||
UnsupportedFeature,
|
||||
|
||||
/// <summary>Library dependency (OpenGL or Vulkan) not linked into application.</summary>
|
||||
LibraryNotLinked,
|
||||
|
||||
/// <summary>Decompressed byte count does not match expected byte size</summary>
|
||||
DecompressLengthError,
|
||||
|
||||
/// <summary>Checksum mismatch when decompressing</summary>
|
||||
DecompressChecksumError,
|
||||
|
||||
/// <summary>For safety checks.</summary>
|
||||
ErrorMaxEnum = 20,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
39
brutal.ktx/Brutal.Ktx/Generated/KtxFormatSize.gen.cs
Normal file
39
brutal.ktx/Brutal.Ktx/Generated/KtxFormatSize.gen.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 4)]
|
||||
public unsafe partial struct KtxFormatSize
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public readonly uint Flags;
|
||||
|
||||
/// <summary>For KTX1.</summary>
|
||||
[FieldOffset(4)]
|
||||
public readonly uint PaletteSizeInBits;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public readonly uint BlockSizeInBits;
|
||||
|
||||
/// <summary>in texels</summary>
|
||||
[FieldOffset(12)]
|
||||
public readonly uint BlockWidth;
|
||||
|
||||
/// <summary>in texels</summary>
|
||||
[FieldOffset(16)]
|
||||
public readonly uint BlockHeight;
|
||||
|
||||
/// <summary>in texels</summary>
|
||||
[FieldOffset(20)]
|
||||
public readonly uint BlockDepth;
|
||||
|
||||
/// <summary>Minimum required number of blocks</summary>
|
||||
[FieldOffset(24)]
|
||||
public readonly uint MinBlocksX;
|
||||
|
||||
[FieldOffset(28)]
|
||||
public readonly uint MinBlocksY;
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KtxPackAstcBlockDimension : int
|
||||
{
|
||||
/// <summary>: 8.00 bpp</summary>
|
||||
BlockDimension4X4,
|
||||
|
||||
/// <summary>: 6.40 bpp</summary>
|
||||
BlockDimension5X4,
|
||||
|
||||
/// <summary>: 5.12 bpp</summary>
|
||||
BlockDimension5X5,
|
||||
|
||||
/// <summary>: 4.27 bpp</summary>
|
||||
BlockDimension6X5,
|
||||
|
||||
/// <summary>: 3.56 bpp</summary>
|
||||
BlockDimension6X6,
|
||||
|
||||
/// <summary>: 3.20 bpp</summary>
|
||||
BlockDimension8X5,
|
||||
|
||||
/// <summary>: 2.67 bpp</summary>
|
||||
BlockDimension8X6,
|
||||
|
||||
/// <summary>: 2.56 bpp</summary>
|
||||
BlockDimension10X5,
|
||||
|
||||
/// <summary>: 2.13 bpp</summary>
|
||||
BlockDimension10X6,
|
||||
|
||||
/// <summary>: 2.00 bpp</summary>
|
||||
BlockDimension8X8,
|
||||
|
||||
/// <summary>: 1.60 bpp</summary>
|
||||
BlockDimension10X8,
|
||||
|
||||
/// <summary>: 1.28 bpp</summary>
|
||||
BlockDimension10X10,
|
||||
|
||||
/// <summary>: 1.07 bpp</summary>
|
||||
BlockDimension12X10,
|
||||
|
||||
/// <summary>: 0.89 bpp</summary>
|
||||
BlockDimension12X12,
|
||||
|
||||
/// <summary>: 4.74 bpp</summary>
|
||||
BlockDimension3X3X3,
|
||||
|
||||
/// <summary>: 3.56 bpp</summary>
|
||||
BlockDimension4X3X3,
|
||||
|
||||
/// <summary>: 2.67 bpp</summary>
|
||||
BlockDimension4X4X3,
|
||||
|
||||
/// <summary>: 2.00 bpp</summary>
|
||||
BlockDimension4X4X4,
|
||||
|
||||
/// <summary>: 1.60 bpp</summary>
|
||||
BlockDimension5X4X4,
|
||||
|
||||
/// <summary>: 1.28 bpp</summary>
|
||||
BlockDimension5X5X4,
|
||||
|
||||
/// <summary>: 1.02 bpp</summary>
|
||||
BlockDimension5X5X5,
|
||||
|
||||
/// <summary>: 0.85 bpp</summary>
|
||||
BlockDimension6X5X5,
|
||||
|
||||
/// <summary>: 0.71 bpp</summary>
|
||||
BlockDimension6X6X5,
|
||||
|
||||
/// <summary>: 0.59 bpp</summary>
|
||||
BlockDimension6X6X6,
|
||||
BlockDimensionMax = 23,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KtxPackAstcQualityLevels : int
|
||||
{
|
||||
Fastest = 0,
|
||||
Fast = 10,
|
||||
Medium = 60,
|
||||
Thorough = 98,
|
||||
Exhaustive = 100,
|
||||
Max = 100,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
23
brutal.ktx/Brutal.Ktx/Generated/KtxPackUastcFlagBits.gen.cs
Normal file
23
brutal.ktx/Brutal.Ktx/Generated/KtxPackUastcFlagBits.gen.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
[System.Flags]
|
||||
public enum KtxPackUastcFlagBits : int
|
||||
{
|
||||
LevelFastest = 0,
|
||||
LevelFaster = 1,
|
||||
LevelDefault = 2,
|
||||
LevelSlower = 3,
|
||||
LevelVeryslow = 4,
|
||||
MaxLevel = 4,
|
||||
LevelMask = 15,
|
||||
FavorUastcError = 8,
|
||||
FavorBc7Error = 16,
|
||||
Etc1FasterHints = 64,
|
||||
Etc1FastestHints = 128,
|
||||
Etc1DisableFlipAndIndividual = 256,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
26
brutal.ktx/Brutal.Ktx/Generated/KtxSupercmpScheme.gen.cs
Normal file
26
brutal.ktx/Brutal.Ktx/Generated/KtxSupercmpScheme.gen.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public enum KtxSupercmpScheme : int
|
||||
{
|
||||
/// <summary>No supercompression.</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>Basis LZ supercompression.</summary>
|
||||
BasisLz = 1,
|
||||
|
||||
/// <summary>ZStd supercompression.</summary>
|
||||
Zstd = 2,
|
||||
|
||||
/// <summary>ZLIB supercompression.</summary>
|
||||
Zlib = 3,
|
||||
BeginRange = 0,
|
||||
EndRange = 3,
|
||||
BeginVendorRange = 65536,
|
||||
EndVendorRange = 131071,
|
||||
BeginReserved = 131072,
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
171
brutal.ktx/Brutal.Ktx/Generated/KtxTexture.gen.cs
Normal file
171
brutal.ktx/Brutal.Ktx/Generated/KtxTexture.gen.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
#pragma warning disable 1591
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Brutal.Pointers.Extensions;
|
||||
|
||||
namespace Brutal.KtxApi
|
||||
{
|
||||
public static unsafe partial class KtxTexture
|
||||
{
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_CreateFromNamedFile1")]
|
||||
public static unsafe partial KtxErrorCode CreateFromNamedFile(
|
||||
ReadOnlySpan<byte> filename,
|
||||
KtxTextureCreateFlagBits createFlags,
|
||||
out KtxTextureHandle newTex
|
||||
);
|
||||
|
||||
public static unsafe KtxErrorCode CreateFromMemory(
|
||||
ReadOnlySpan<byte> bytes,
|
||||
KtxTextureCreateFlagBits createFlags,
|
||||
out KtxTextureHandle newTex
|
||||
)
|
||||
{
|
||||
return CreateFromMemoryRealInterop(
|
||||
ref Unsafe.AsRef<byte>(bytes.AsPointer()),
|
||||
bytes.AsPointer() is not null ? (ulong)bytes.Length : 0,
|
||||
createFlags,
|
||||
out newTex
|
||||
);
|
||||
}
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_CreateFromMemory1")]
|
||||
private static unsafe partial KtxErrorCode CreateFromMemoryRealInterop(
|
||||
ref readonly byte bytes,
|
||||
ulong size,
|
||||
KtxTextureCreateFlagBits createFlags,
|
||||
out KtxTextureHandle newTex
|
||||
);
|
||||
|
||||
/// <summary>Returns a pointer to the image data of a ktxTexture object.</summary>
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetData1")]
|
||||
public static unsafe partial byte* GetData(this KtxTextureHandle thisParam);
|
||||
|
||||
/// <summary>Returns the pitch of a row of an image at the specified level.Similar to the rowPitch in a VkSubResourceLayout.</summary>
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetRowPitch1")]
|
||||
public static unsafe partial uint GetRowPitch(this KtxTextureHandle thisParam, uint level);
|
||||
|
||||
/// <summary>Return the element size of the texture's images.</summary>
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetElementSize1")]
|
||||
public static unsafe partial uint GetElementSize(this KtxTextureHandle thisParam);
|
||||
|
||||
/// <summary>Returns the size of all the image data of a ktxTexture object in bytes.</summary>
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetDataSize1")]
|
||||
public static unsafe partial ulong GetDataSize(this KtxTextureHandle thisParam);
|
||||
|
||||
/// <summary>Iterate over the levels or faces in a ktxTexture object.</summary>
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_IterateLevelFaces1")]
|
||||
public static unsafe partial KtxErrorCode IterateLevelFaces(
|
||||
this KtxTextureHandle thisParam,
|
||||
IterateCallbackDelegate iterCb,
|
||||
IntPtr userdata
|
||||
);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetVkFormat1")]
|
||||
public static unsafe partial VkFormat GetVkFormat(this KtxTextureHandle thisParam);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_Destroy1")]
|
||||
public static unsafe partial void Destroy(this KtxTextureHandle thisParam);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetImageOffset1")]
|
||||
public static unsafe partial KtxErrorCode GetImageOffset(
|
||||
this KtxTextureHandle thisParam,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
out ulong pOffset
|
||||
);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetDataSizeUncompressed1")]
|
||||
public static unsafe partial ulong GetDataSizeUncompressed(this KtxTextureHandle thisParam);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetImageSize1")]
|
||||
public static unsafe partial ulong GetImageSize(this KtxTextureHandle thisParam, uint level);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_GetLevelSize1")]
|
||||
public static unsafe partial ulong GetLevelSize(this KtxTextureHandle thisParam, uint level);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_IterateLevels1")]
|
||||
public static unsafe partial KtxErrorCode IterateLevels(
|
||||
this KtxTextureHandle thisParam,
|
||||
IterateCallbackDelegate iterCb,
|
||||
IntPtr userdata
|
||||
);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_IterateLoadLevelFaces1")]
|
||||
public static unsafe partial KtxErrorCode IterateLoadLevelFaces(
|
||||
this KtxTextureHandle thisParam,
|
||||
IterateCallbackDelegate iterCb,
|
||||
IntPtr userdata
|
||||
);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_NeedsTranscoding1")]
|
||||
public static unsafe partial Bool8 NeedsTranscoding(this KtxTextureHandle thisParam);
|
||||
|
||||
public static unsafe KtxErrorCode LoadImageData(this KtxTextureHandle thisParam, Span<byte> pBuffer)
|
||||
{
|
||||
return LoadImageDataRealInterop(
|
||||
thisParam,
|
||||
ref *pBuffer.AsPointer(),
|
||||
pBuffer.AsPointer() is not null ? (ulong)pBuffer.Length : 0
|
||||
);
|
||||
}
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_LoadImageData1")]
|
||||
private static unsafe partial KtxErrorCode LoadImageDataRealInterop(
|
||||
this KtxTextureHandle thisParam,
|
||||
ref byte pBuffer,
|
||||
ulong bufSize
|
||||
);
|
||||
|
||||
public static unsafe KtxErrorCode SetImageFromMemory(
|
||||
this KtxTextureHandle thisParam,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
ReadOnlySpan<byte> src
|
||||
)
|
||||
{
|
||||
return SetImageFromMemoryRealInterop(
|
||||
thisParam,
|
||||
level,
|
||||
layer,
|
||||
faceSlice,
|
||||
ref *src.AsPointer(),
|
||||
(ulong)src.Length
|
||||
);
|
||||
}
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_SetImageFromMemory1")]
|
||||
private static unsafe partial KtxErrorCode SetImageFromMemoryRealInterop(
|
||||
this KtxTextureHandle thisParam,
|
||||
uint level,
|
||||
uint layer,
|
||||
uint faceSlice,
|
||||
ref readonly byte src,
|
||||
ulong srcSize
|
||||
);
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_WriteToNamedFile1")]
|
||||
public static unsafe partial KtxErrorCode WriteToNamedFile(
|
||||
this KtxTextureHandle thisParam,
|
||||
ReadOnlySpan<byte> dstname
|
||||
);
|
||||
|
||||
public static unsafe KtxErrorCode WriteToMemory(this KtxTextureHandle thisParam, out KtxNativeBuffer bytes)
|
||||
{
|
||||
byte* mem;
|
||||
ulong size;
|
||||
var returnValue = WriteToMemoryRealInterop(thisParam, out mem, out size);
|
||||
bytes = new KtxNativeBuffer(mem, size);
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
[LibraryImport("Ktx", EntryPoint = "ktxTexture_WriteToMemory1")]
|
||||
private static unsafe partial KtxErrorCode WriteToMemoryRealInterop(
|
||||
this KtxTextureHandle thisParam,
|
||||
out byte* bytes,
|
||||
out ulong size
|
||||
);
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue