Merge pull request #289 from Starnick/master

Updated C-API
pull/292/head
Ignacio 5 years ago committed by GitHub
commit 8a076c8e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,9 +36,23 @@ namespace Nvidia.TextureTools
CTX1, // Not supported on CPU yet.
BC6,
BC7, // Not supported yet.
BC7,
DXT1_Luma,
BC3_RGBM,
ETC1,
ETC2_R,
ETC2_RG,
ETC2_RGB,
ETC2_RGBA,
ETC2_RGB_A1,
ETC2_RGBM,
PVR_2BPP_RGB, // Using PVR textools.
PVR_4BPP_RGB,
PVR_2BPP_RGBA,
PVR_4BPP_RGBA
}
#endregion
@ -75,6 +89,8 @@ namespace Nvidia.TextureTools
{
Texture2D,
TextureCube,
Texture3D,
Texture2DArray
}
#endregion
@ -84,7 +100,10 @@ namespace Nvidia.TextureTools
/// </summary>
public enum InputFormat
{
BGRA_8UB
BGRA_8UB, // Normalized [0, 1] 8 bit fixed point.
RGBA_16F, // 16 bit floating point.
RGBA_32F, // 32 bit floating point.
R_32F, // Single channel 32 bit floating point.
}
#endregion
@ -120,7 +139,10 @@ namespace Nvidia.TextureTools
None,
ToNextPowerOfTwo,
ToNearestPowerOfTwo,
ToPreviousPowerOfTwo
ToPreviousPowerOfTwo,
ToNextMultipleOfFour,
ToNearestMultipleOfFour,
ToPreviousMultipleOfFour
}
#endregion
@ -168,7 +190,7 @@ namespace Nvidia.TextureTools
private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d);
private extern static void nvttSetInputOptionsTextureLayout(IntPtr inputOptions, TextureType type, int w, int h, int d, int arraySize);
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
@ -236,9 +258,9 @@ namespace Nvidia.TextureTools
nvttDestroyInputOptions(options);
}
public void SetTextureLayout(TextureType type, int w, int h, int d)
public void SetTextureLayout(TextureType type, int w, int h, int d, int arraySize = 1)
{
nvttSetInputOptionsTextureLayout(options, type, w, h, d);
nvttSetInputOptionsTextureLayout(options, type, w, h, d, arraySize);
}
public void ResetTextureLayout()
{

@ -78,9 +78,9 @@ void nvttDestroyInputOptions(NvttInputOptions * inputOptions)
delete inputOptions;
}
void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d)
void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d, int arraySize)
{
inputOptions->setTextureLayout((nvtt::TextureType)type, w, h, d);
inputOptions->setTextureLayout((nvtt::TextureType)type, w, h, d, arraySize);
}
void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions)

@ -71,10 +71,10 @@ typedef enum
// DX9 formats.
NVTT_Format_DXT1,
NVTT_Format_DXT1a,
NVTT_Format_DXT1a, // DXT1 with binary alpha.
NVTT_Format_DXT3,
NVTT_Format_DXT5,
NVTT_Format_DXT5n,
NVTT_Format_DXT5n, // Compressed HILO: R=1, G=y, B=0, A=x
// DX10 formats.
NVTT_Format_BC1 = NVTT_Format_DXT1,
@ -84,6 +84,28 @@ typedef enum
NVTT_Format_BC3n = NVTT_Format_DXT5n,
NVTT_Format_BC4,
NVTT_Format_BC5,
NVTT_Format_DXT1n, // Not supported.
NVTT_Format_CTX1, // Not supported.
NVTT_Format_BC6,
NVTT_Format_BC7,
NVTT_Format_BC3_RGBM,
NVTT_Format_ETC1,
NVTT_Format_ETC2_R,
NVTT_Format_ETC2_RG,
NVTT_Format_ETC2_RGB,
NVTT_Format_ETC2_RGBA,
NVTT_Format_ETC2_RGB_A1,
NVTT_Format_ETC2_RGBM,
NVTT_Format_PVR_2BPP_RGB, // Using PVR textools.
NVTT_Format_PVR_4BPP_RGB,
NVTT_Format_PVR_2BPP_RGBA,
NVTT_Format_PVR_4BPP_RGBA,
} NvttFormat;
/// Quality modes.
@ -108,12 +130,17 @@ typedef enum
{
NVTT_TextureType_2D,
NVTT_TextureType_Cube,
TextureType_3D,
TextureType_Array,
} NvttTextureType;
/// Input formats.
typedef enum
{
NVTT_InputFormat_BGRA_8UB,
NVTT_InputFormat_BGRA_8UB, // Normalized [0, 1] 8 bit fixed point.
NVTT_InputFormat_RGBA_16F, // 16 bit floating point.
NVTT_InputFormat_RGBA_32F, // 32 bit floating point.
NVTT_InputFormat_R_32F, // Single channel 32 bit floating point.
} NvttInputFormat;
/// Mipmap downsampling filters.
@ -131,6 +158,9 @@ typedef enum
NVTT_RoundMode_ToNextPowerOfTwo,
NVTT_RoundMode_ToNearestPowerOfTwo,
NVTT_RoundMode_ToPreviousPowerOfTwo,
NVTT_RoundMode_ToNextMultipleOfFour, // (New in NVTT 2.1)
NVTT_RoundMode_ToNearestMultipleOfFour, // (New in NVTT 2.1)
NVTT_RoundMode_ToPreviousMultipleOfFour, // (New in NVTT 2.1)
} NvttRoundMode;
/// Alpha mode.
@ -175,7 +205,7 @@ typedef void (* nvttEndImageHandler)();
NVTT_API NvttInputOptions * nvttCreateInputOptions();
NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions);
NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d);
NVTT_API void nvttSetInputOptionsTextureLayout(NvttInputOptions * inputOptions, NvttTextureType type, int w, int h, int d, int arraySize);
NVTT_API void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions);
NVTT_API NvttBoolean nvttSetInputOptionsMipmapData(NvttInputOptions * inputOptions, const void * data, int w, int h, int d, int face, int mipmap);
NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format);

Loading…
Cancel
Save