nvtt
|
Namespace for all public non-macro NVTT fields. More...
Classes | |
struct | BatchList |
Structure defining a list of inputs to be compressed. More... | |
struct | CompressionOptions |
Compression options. This class describes the desired compression format and other compression settings. More... | |
struct | Context |
Compression context. More... | |
struct | CPUInputBuffer |
Structure containing all the input images from host memory. The image data is reordered by tiles. More... | |
struct | CubeSurface |
A CubeSurface is one level of a cube map texture. More... | |
struct | EncodeSettings |
struct | ErrorHandler |
Inheritable interface for handling errors. More... | |
struct | GPUInputBuffer |
Structure containing all the input images from device memory. The image data is reordered by tiles. More... | |
struct | OutputHandler |
Inheritable interface for outputting data. More... | |
struct | OutputOptions |
Output Options. More... | |
struct | RefImage |
Use this structure to reference each of the input images. More... | |
struct | Surface |
A surface is one level of a 2D or 3D texture. More... | |
struct | SurfaceSet |
Surface-set struct for convenience of handling multi-level texture files such as DDS, currently only supporting reading. More... | |
struct | TimingContext |
A TimingContext is a way to collect timing data from a number of functions, and report how much time each function took. More... | |
Typedefs | |
typedef void(* | MessageCallback) (Severity severity, Error error, const char *message, const void *userData) |
Functions | |
NVTT_API unsigned int | version () |
Return the NVTT version number, as 10000*fork + 100*major + minor. | |
NVTT_API const char * | errorString (Error e) |
Return string for the given error code. | |
NVTT_API bool | setMessageCallback (MessageCallback callback, const void *userData) |
NVTT_API float | rmsError (const Surface &reference, const Surface &img, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API float | rmsAlphaError (const Surface &reference, const Surface &img, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API float | cieLabError (const Surface &reference, const Surface &img, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API float | angularError (const Surface &reference, const Surface &img, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API Surface | diff (const Surface &reference, const Surface &img, float scale, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API float | rmsToneMappedError (const Surface &reference, const Surface &img, float exposure, TimingContext *tc=0) |
Image comparison and error measurement functions. (New in NVTT 2.1) | |
NVTT_API Surface | histogram (const Surface &img, int width, int height, TimingContext *tc=0) |
Generate histogram from surface. | |
NVTT_API Surface | histogram (const Surface &img, float minRange, float maxRange, int width, int height, TimingContext *tc=0) |
Generate histogram from surface. | |
NVTT_API void | getTargetExtent (int *width, int *height, int *depth, int maxExtent, RoundMode roundMode, TextureType textureType, TimingContext *tc=0) |
Geting the target extent for round-mode and texture-type. (New in NVTT 3.0) | |
NVTT_API int | countMipmaps (int w, int h, int d, TimingContext *tc=0) |
Calculate the count of mipmaps given width, height, depth. (New in NVTT 3.0) | |
NVTT_API bool | isCudaSupported () |
Check if CUDA is supported by the run-time environment. | |
NVTT_API void | useCurrentDevice () |
Tells NVTT to always use an application-set device rather than selecting its own. | |
NVTT_API bool | nvtt_encode (const CPUInputBuffer &input, void *output, const EncodeSettings &settings) |
NVTT_API bool | nvtt_encode (const GPUInputBuffer &input, void *output, const EncodeSettings &settings) |
NVTT_DEPRECATED_API void | nvtt_encode_bc1 (const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc1 (const GPUInputBuffer &input, bool fast_mode, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc1a (const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc1a (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc2 (const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc2 (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc3 (const CPUInputBuffer &input, bool fast_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc3 (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc3n (const CPUInputBuffer &input, int qualityLevel, void *output, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc3_rgbm (const CPUInputBuffer &input, void *output, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc4 (const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc4 (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc4s (const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc4s (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_ati2 (const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_ati2 (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc5 (const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc5 (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc5s (const CPUInputBuffer &input, bool slow_mode, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc5s (const GPUInputBuffer &input, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc7 (const CPUInputBuffer &input, bool slow_mode, bool imageHasAlpha, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc7 (const GPUInputBuffer &input, bool imageHasAlpha, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc6h (const CPUInputBuffer &input, bool slow_mode, bool is_signed, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_bc6h (const GPUInputBuffer &input, bool is_signed, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_astc (const CPUInputBuffer &input, int qualityLevel, bool imageHasAlpha, void *output, bool useGpu=false, bool to_device_mem=false, nvtt::TimingContext *tc=nullptr) |
NVTT_DEPRECATED_API void | nvtt_encode_astc (const GPUInputBuffer &input, int qualityLevel, bool imageHasAlpha, void *output, bool to_device_mem=true, nvtt::TimingContext *tc=nullptr) |
Namespace for all public non-macro NVTT fields.
typedef void(* nvtt::MessageCallback) (Severity severity, Error error, const char *message, const void *userData) |
A MessageCallback is a function that takes a message Severity
, an error enumeration (only nonzero for error messages), a null-terminated description of the message (usually with useful information for debugging; no newline at end), and a custom user pointer set when calling nvtt::SetMessageCallback()
.
enum nvtt::AlphaMode |
Alpha mode.
enum nvtt::Container |
Container type for encoded data.
reserved[]
fields to allow consumers to detect writer versions.reserved[7]
is the FourCC code "UVER", and reserved[8]
stores a version number that can be set by the user.reserved[9]
is the FourCC code "NVTT", and reserved[10]
is the NVTT writer version (which isn't necessarily the same as nvtt::version()
).dwFlags
field with two more flags.DDPF_SRGB
(0x40000000U
) indicates that the texture uses an sRGB transfer function. Note that most readers will ignore this and instead guess the transfer function from the format.DDPF_NORMAL
(0x80000000U
) indicates that the texture is a normal map. enum nvtt::CubeLayout |
Specifies how to fold or unfold a cube map from or to a 2D texture.
enum nvtt::EdgeFixup |
Use EdgeFixup_None if unsure; this affects how certain cube surface processing algorithms work.
enum nvtt::EncodeFlags : uint32_t |
Encode flags for EncodeSettings.
enum nvtt::Error |
Error codes.
enum nvtt::Format |
Supported block-compression formats, including compressor variants.
That is:
enum nvtt::InputFormat |
Input formats. Used when creating an nvtt::Surface from an RGB/RGBA array.
enum nvtt::MipmapFilter |
Mipmap downsampling filters. Each of these can be customized using filterWidth
and params
when calling Surface::buildNextMipmap().
Enumerator | |
---|---|
MipmapFilter_Box | Box filter is quite good and very fast. It has some special paths for downsampling by exactly a factor of 2. |
MipmapFilter_Triangle | Triangle filter blurs the results too much, but that might be what you want. |
MipmapFilter_Kaiser | Kaiser-windowed Sinc filter is the best downsampling filter, and close to a mathematically ideal windowing filter. If the window size is too large, it can introduce ringing.
|
MipmapFilter_Mitchell | Mitchell & Netravali's two parameter cubic filter.
|
MipmapFilter_Min | Takes the minimum over all input texels that contribute to each output texel. This is especially useful for generating mipmaps for parallax occlusion mapping, or for structures like hierarchical Z-buffers. Specifically, this acts as if for an X x Y x Z image, the texel at (i, j, k) covers the open box (i/X, (i+1)/X) x (j/Y, (j+1)/Y) x (k/Z, (k+1)/Z). Then for each output texel, the set of contributing texels is the set of input texels whose boxes intersect the output texel's box. |
MipmapFilter_Max | Like MipmapFilter_Min, but takes the maximum over all contributing texels instead of the minimum. |
Specifies a normal transformation, used to store 3D (x, y, z) normals in 2D (x, y).
We define these in terms of their 2D -> 3D reconstructions, since their transformations are the inverse of the reconstructions. Most require z >= 0.0f.
enum nvtt::PixelType |
Pixel value types.
These are used for Format_RGB: they indicate how the output should be interpreted, but do not have any influence over the input. They are ignored for other compression modes.
enum nvtt::Quality |
Quality modes.
These can be used to trade off speed of compression for lower error, and often selects the specific compression algorithm that will be used. Here's a table showing which (format, quality) combinations support CUDA acceleration:
Quality | BC1 | BC1a | BC2 | BC3 | BC3n | RGBM | BC4 | BC5 | BC6 | BC7 | ASTC |
---|---|---|---|---|---|---|---|---|---|---|---|
Fastest | Yes | No | No | No | No | No | Yes | Yes | Yes | Yes | Yes |
Normal | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes |
Production | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No (slow) | Yes |
Highest | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No (slow) | Yes |
See the documentation of the different compression functions in nvtt_lowlevel.h for more information.
enum nvtt::ResizeFilter |
Texture resizing filters.
enum nvtt::RoundMode |
Extents rounding mode.
Determines how to round sizes to different sets when shrinking an image.
For each of the PowerOfTwo modes, maxExtent
is first rounded to the previous power of two.
Then all extents are scaled and truncated without changing the aspect ratio, using s = max((s * maxExtent) / m, 1)
, where m
is the maximum width, height, or depth.
If the texture is a cube map, the width and height are then averaged to make the resulting texture square.
Finally, extents are rounded to a set of possible sizes depending on this enum.
enum nvtt::Severity |
Message severity.
enum nvtt::ToneMapper |
Tone mapping functions.
Enumerator | |
---|---|
ToneMapper_Linear | Colors inside [0,1)^3 are preserved; colors outside are tone mapped using (r', g', b') = (r, g, b)/max(r, g, b). This clamps colors to the RGB cube, but preserves hue. It is not invertible. |
ToneMapper_Reinhard | Applies a Reinhard operator to each channel: c' = c / (c + 1). |
ToneMapper_Reindhart | Name for backwards compatibility.
|
ToneMapper_Halo | Applies an exponential tone mapper to each channel: c' = 1 - 2^(-c). |
ToneMapper_Lightmap | Same as ToneMapper_Linear. |
enum nvtt::ValueType |
Value type of the input images. The input buffer will use the same value type as the input images
enum nvtt::WrapMode |
Wrap modes. Specifies how to handle coordinates outside the typical image range.
NVTT_API bool nvtt::nvtt_encode | ( | const CPUInputBuffer & | input, |
void * | output, | ||
const EncodeSettings & | settings ) |
Low-level interface for compressing to any of NVTT's formats from a CPUInputBuffer. If encoding succeeded, returns true. On failure, logs at least one error (
Here's an example of how to encode data in CPU memory to BC7 format on the GPU, writing the output to CUDA device memory:
input | Constant reference to input in CPU memory. |
output | Pointer to output: CUDA device pointer if settings.encode_flags includes ENCODE_USE_GPU, and a pointer to CPU memory otherwise. |
settings | Encoder settings, including the compression format and quality. |
NVTT_API bool nvtt::nvtt_encode | ( | const GPUInputBuffer & | input, |
void * | output, | ||
const EncodeSettings & | settings ) |
Low-level interface for compressing to any of NVTT's formats from a GPUInputBuffer. If encoding succeeded, returns true. On failure, logs at least one error (
Here's an example of how to encode data in GPU memory to BC7 format on the GPU, writing the output to CUDA device memory:
input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if settings.encode_flags includes ENCODE_USE_GPU, and a pointer to CPU memory otherwise. |
settings | Encoder settings, including the compression format and quality. |
settings
flag ENCODE_USE_GPU is ignored; data compressed using this function is currently always compressed on the GPU.NVTT_DEPRECATED_API void nvtt::nvtt_encode_astc | ( | const CPUInputBuffer & | input, |
int | qualityLevel, | ||
bool | imageHasAlpha, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to ASTC format from CPUInputBuffer. This supports 4 quality levels on both the CPU and GPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
qualityLevel | The quality level, 0, 1, 2, or 3. Higher quality levels produce less compression error, but take longer. |
imageHasAlpha | Specifies that some pixels in the image have an alpha value less than 1.0f. If false, this makes compression slightly faster. It's still valid to set it to true even if the image is opaque. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_astc | ( | const GPUInputBuffer & | input, |
int | qualityLevel, | ||
bool | imageHasAlpha, | ||
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to ASTC format from GPUInputBuffer, always using GPU compression. This supports 4 quality levels.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
qualityLevel | The quality level, 0, 1, 2, or 3. Higher quality levels produce less compression error, but take longer. |
imageHasAlpha | Specifies that some pixels in the image have an alpha value less than 1.0f. If false, this makes compression slightly faster. It's still valid to set it to true even if the image is opaque. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_ati2 | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to ATI2 format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_ati2 | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to ATI2 format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc1 | ( | const CPUInputBuffer & | input, |
bool | fast_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
NVTT 3's initial implementation of the low-level compression API below used a different function for each combination of the encoding format category and the input type. Because these functions have different signatures, we recommend using NVTT 3.2's nvtt_encode API above. The functions below are provided for backwards compatibility and will remain supported for all versions of NVTT 3. Interface for compressing to BC1 format from CPUInputBuffer.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
fast_mode | If true, uses a faster but lower-quality compressor; otherwise, uses a slower but higher-quality compressor. This applies to both CPU and GPU compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc1 | ( | const GPUInputBuffer & | input, |
bool | fast_mode, | ||
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC1 format from GPUInputBuffer, always using GPU compression.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
fast_mode | If true, uses a faster but lower-quality compressor; otherwise, uses a slower but higher-quality compressor. Compression always happens on the GPU, so CUDA must be available. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc1a | ( | const CPUInputBuffer & | input, |
bool | fast_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC1a format from CPUInputBuffer. No fast-mode algorithm for the GPU is available, so when fast_mode
is true this ignores useGPU
and compresses on the CPU. In this case, slow-mode GPU compression may be faster than fast-mode CPU compression.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
fast_mode | If true, uses a faster but lower-quality compressor; otherwise, uses a slower but higher-quality compressor. Also overrides useGPU if true and uses the CPU for fast-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on fast_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc1a | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC1a format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU slow-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc2 | ( | const CPUInputBuffer & | input, |
bool | fast_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC2 format from CPUInputBuffer. No fast-mode algorithm for the GPU is available, so when fast_mode
is true this ignores useGPU
and compresses on the CPU. In this case, slow-mode GPU compression may be faster than fast-mode CPU compression.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
fast_mode | If true, uses a faster but lower-quality compressor; otherwise, uses a slower but higher-quality compressor. Also overrides useGPU if true and uses the CPU for fast-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on fast_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc2 | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC2 format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU slow-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc3 | ( | const CPUInputBuffer & | input, |
bool | fast_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC3 format from CPUInputBuffer. No fast-mode algorithm for the GPU is available, so when fast_mode
is true this ignores useGPU
and compresses on the CPU. In this case, slow-mode GPU compression may be faster than fast-mode CPU compression.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
fast_mode | If true, uses a faster but lower-quality compressor; otherwise, uses a slower but higher-quality compressor. Also overrides useGPU if true and uses the CPU for fast-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on fast_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc3 | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC3 format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU slow-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc3_rgbm | ( | const CPUInputBuffer & | input, |
void * | output, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC3 - rgbm format from CPUInputBuffer. This method is currently CPU-only and has 1 quality level. See nvtt::Format_BC3_RGBM.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
output | Pointer to output in CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc3n | ( | const CPUInputBuffer & | input, |
int | qualityLevel, | ||
void * | output, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC3n format from CPUInputBuffer. This method is currently CPU-only, but supports 3 quality levels
0, 1, and 2. See nvtt::Format_BC3n.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
qualityLevel | Higher quality levels produce less compression error, but take longer to compress. Can be 0, 1, or 2. |
output | Pointer to output in CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc4 | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC4U format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc4 | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC4U format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc4s | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC4S format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc4s | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC4S format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc5 | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC5U format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc5 | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC5U format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc5s | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC5S format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc5s | ( | const GPUInputBuffer & | input, |
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC5S format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc6h | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
bool | is_signed, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC6H format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
is_signed | If true, compresses to the BC6S format, instead of BC6U. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc6h | ( | const GPUInputBuffer & | input, |
bool | is_signed, | ||
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC6H format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
is_signed | If true, compresses to the BC6S format, instead of BC6U. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc7 | ( | const CPUInputBuffer & | input, |
bool | slow_mode, | ||
bool | imageHasAlpha, | ||
void * | output, | ||
bool | useGpu = false, | ||
bool | to_device_mem = false, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC7 format from CPUInputBuffer. No slow-mode algorithm for the GPU is available, so when slow_mode
is true this ignores useGPU
and compresses on the CPU. The slow-mode CPU compressor is particularly slow in this case (as it searches though a very large space of possibilities), so fast-mode compression is recommended.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in CPU memory. |
slow_mode | If true, uses a slower but higher-quality compressor; otherwise, uses a faster but lower-quality compressor. Also overrides useGPU if true and uses the CPU for slow-mode compression. |
imageHasAlpha | Specifies that some pixels in the image have an alpha value less than 1.0f. If false, this makes compression slightly faster. It's still valid to set it to true even if the image is opaque. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
useGpu | Whether to run the compression algorithm on the GPU as opposed to the CPU. See note on slow_mode . |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_DEPRECATED_API void nvtt::nvtt_encode_bc7 | ( | const GPUInputBuffer & | input, |
bool | imageHasAlpha, | ||
void * | output, | ||
bool | to_device_mem = true, | ||
nvtt::TimingContext * | tc = nullptr ) |
Interface for compressing to BC7 format from GPUInputBuffer, always using GPU compression. This method has only one quality level, corresponding to CPU fast-mode.
nvtt_encode()
is more general and consistent. This function is now only a wrapper for an nvtt_encode()
call.input | Constant reference to input in GPU memory. |
imageHasAlpha | Specifies that some pixels in the image have an alpha value less than 1.0f. If false, this makes compression slightly faster. It's still valid to set it to true even if the image is opaque. |
output | Pointer to output: CUDA device pointer if to_device_mem is true, and a pointer to CPU memory otherwise. |
to_device_mem | Specifies that output is a CUDA device pointer, rather than a pointer to CPU memory. |
tc | Timing context for recording performance information. |
NVTT_API bool nvtt::setMessageCallback | ( | MessageCallback | callback, |
const void * | userData ) |
Sets the current thread's NVTT MessageCallback
. NVTT calls this function whenever it encounters an error or performance warning, or has useful information. Here's an example showing how to use a message callback to detect and print errors:
Since each thread has its own callback pointer, a custom callback should be set whenever an app creates a new thread. If no callback has been set, the default callback prints the severity and the message, followed by a newline, to stdout. If a callback has been set, setting the callback to nullptr will make NVTT switch to the default callback. Returns true if setting the message callback succeeded.
NVTT_API void nvtt::useCurrentDevice | ( | ) |
Tells NVTT to always use an application-set device rather than selecting its own.
By default, NVTT functions such as nvtt::isCudaSupported() and nvtt::Context() can choose a device and call cudaSetDevice(). Calling this function will prevent NVTT from calling cudaSetDevice(), and will make it use the currently set device instead. The application must then call cudaSetDevice() before calling NVTT functions, and whenever it wants to change the device subsequent NVTT functions will use.
For instance, this may be useful when managing devices on multi-GPU systems.