Merge pull request #289 from Starnick/master

Updated C-API
pull/292/head
Ignacio 6 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. CTX1, // Not supported on CPU yet.
BC6, 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 #endregion
@ -75,6 +89,8 @@ namespace Nvidia.TextureTools
{ {
Texture2D, Texture2D,
TextureCube, TextureCube,
Texture3D,
Texture2DArray
} }
#endregion #endregion
@ -84,7 +100,10 @@ namespace Nvidia.TextureTools
/// </summary> /// </summary>
public enum InputFormat 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 #endregion
@ -120,7 +139,10 @@ namespace Nvidia.TextureTools
None, None,
ToNextPowerOfTwo, ToNextPowerOfTwo,
ToNearestPowerOfTwo, ToNearestPowerOfTwo,
ToPreviousPowerOfTwo ToPreviousPowerOfTwo,
ToNextMultipleOfFour,
ToNearestMultipleOfFour,
ToPreviousMultipleOfFour
} }
#endregion #endregion
@ -168,7 +190,7 @@ namespace Nvidia.TextureTools
private extern static void nvttDestroyInputOptions(IntPtr inputOptions); private extern static void nvttDestroyInputOptions(IntPtr inputOptions);
[DllImport("nvtt"), SuppressUnmanagedCodeSecurity] [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] [DllImport("nvtt"), SuppressUnmanagedCodeSecurity]
private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions); private extern static void nvttResetInputOptionsTextureLayout(IntPtr inputOptions);
@ -236,9 +258,9 @@ namespace Nvidia.TextureTools
nvttDestroyInputOptions(options); 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() public void ResetTextureLayout()
{ {

@ -78,9 +78,9 @@ void nvttDestroyInputOptions(NvttInputOptions * inputOptions)
delete 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) void nvttResetInputOptionsTextureLayout(NvttInputOptions * inputOptions)

@ -71,10 +71,10 @@ typedef enum
// DX9 formats. // DX9 formats.
NVTT_Format_DXT1, NVTT_Format_DXT1,
NVTT_Format_DXT1a, NVTT_Format_DXT1a, // DXT1 with binary alpha.
NVTT_Format_DXT3, NVTT_Format_DXT3,
NVTT_Format_DXT5, NVTT_Format_DXT5,
NVTT_Format_DXT5n, NVTT_Format_DXT5n, // Compressed HILO: R=1, G=y, B=0, A=x
// DX10 formats. // DX10 formats.
NVTT_Format_BC1 = NVTT_Format_DXT1, NVTT_Format_BC1 = NVTT_Format_DXT1,
@ -84,6 +84,28 @@ typedef enum
NVTT_Format_BC3n = NVTT_Format_DXT5n, NVTT_Format_BC3n = NVTT_Format_DXT5n,
NVTT_Format_BC4, NVTT_Format_BC4,
NVTT_Format_BC5, 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; } NvttFormat;
/// Quality modes. /// Quality modes.
@ -108,12 +130,17 @@ typedef enum
{ {
NVTT_TextureType_2D, NVTT_TextureType_2D,
NVTT_TextureType_Cube, NVTT_TextureType_Cube,
TextureType_3D,
TextureType_Array,
} NvttTextureType; } NvttTextureType;
/// Input formats. /// Input formats.
typedef enum 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; } NvttInputFormat;
/// Mipmap downsampling filters. /// Mipmap downsampling filters.
@ -131,6 +158,9 @@ typedef enum
NVTT_RoundMode_ToNextPowerOfTwo, NVTT_RoundMode_ToNextPowerOfTwo,
NVTT_RoundMode_ToNearestPowerOfTwo, NVTT_RoundMode_ToNearestPowerOfTwo,
NVTT_RoundMode_ToPreviousPowerOfTwo, 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; } NvttRoundMode;
/// Alpha mode. /// Alpha mode.
@ -175,7 +205,7 @@ typedef void (* nvttEndImageHandler)();
NVTT_API NvttInputOptions * nvttCreateInputOptions(); NVTT_API NvttInputOptions * nvttCreateInputOptions();
NVTT_API void nvttDestroyInputOptions(NvttInputOptions * inputOptions); 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 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 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); NVTT_API void nvttSetInputOptionsFormat(NvttInputOptions * inputOptions, NvttInputFormat format);

Loading…
Cancel
Save