nvtt: nvtt::EncodeSettings Struct Reference

nvtt

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
nvtt::EncodeSettings Struct Reference

`#include <nvtt_lowlevel.h>`

## Public Member Functions

NVTT_API EncodeSettings & | SetFormat (Format _format)
NVTT_API EncodeSettings & | SetQuality (Quality _quality)
NVTT_API EncodeSettings & | SetRGBPixelType (PixelType _rgb_pixel_type)
NVTT_API EncodeSettings & | SetTimingContext (TimingContext *_timing_context)
NVTT_API EncodeSettings & | SetUseGPU (bool _use_gpu)
NVTT_API EncodeSettings & | SetOutputToGPUMem (bool _to_device_mem)
NVTT_API EncodeSettings & | SetIsOpaque (bool _is_opaque)

## Public Attributes

uint32_t | sType = EncodeSettings_Version_1
Format | format = Format_Unset
| The desired compression format.
Quality | quality = Quality_Normal
| The desired compression quality.
PixelType | rgb_pixel_type = (PixelType)0
TimingContext * | timing_context = nullptr
uint32_t | encode_flags = EncodeFlags_UseGPU

## Detailed Description

Low-level settings including the compression format, where compressed data should be written, and how to encode the data. This can be used in the low-level compression API (

See also
  nvtt_encode) for any format NVTT supports.

Most new apps will only need to use `format` and `SetOutputToGPUMem()`. EncodeSettings' functions provide concise ways to change individual properties. For instance, here's one way to configure it to encode data to ASTC 4x4 at Production quality, attach a timing context, and output data on the GPU:

using namespace nvtt;
TimingContext tc = TimingContext();
const auto settings = EncodeSettings().SetFormat(Format_ASTC_LDR_4x4)
.SetQuality(Quality_Production)
.SetTimingContext(&tc)
.SetOutputToGPUMem(true)
nvtt
Namespace for all public non-macro NVTT fields.
Definition nvtt.h:52
nvtt::Format_ASTC_LDR_4x4
@ Format_ASTC_LDR_4x4
ASTC - LDR - format, tile size 4x4.
Definition nvtt_lowlevel.h:274
nvtt::EncodeSettings
Definition nvtt_lowlevel.h:388
nvtt::EncodeSettings::SetFormat
NVTT_API EncodeSettings & SetFormat(Format _format)
nvtt::EncodeSettings::SetOutputToGPUMem
NVTT_API EncodeSettings & SetOutputToGPUMem(bool _to_device_mem)
nvtt::TimingContext
A TimingContext is a way to collect timing data from a number of functions, and report how much time ...
Definition nvtt.h:1722

If your compiler supports C++20 aggregate initialization, it can also be used (and the C wrapper supports C99's designated initialization):

const EncodeSettings settings{
.format = Format_ASTC_LDR_4x4,
.quality = Quality_Production,
.timing_context = &tc,
.encode_flags = EncodeFlags_UseGPU | EncodeFlags_OutputToGPUMem };
nvtt::EncodeFlags_OutputToGPUMem
@ EncodeFlags_OutputToGPUMem
Definition nvtt_lowlevel.h:349
nvtt::EncodeFlags_UseGPU
@ EncodeFlags_UseGPU
Compress on the GPU if CUDA is available, instead of the CPU.
Definition nvtt_lowlevel.h:345
nvtt::EncodeSettings::format
Format format
The desired compression format.
Definition nvtt_lowlevel.h:395

Since
  NVTT 3.2

## Member Function Documentation

## ◆ SetFormat()

NVTT_API EncodeSettings & nvtt::EncodeSettings::SetFormat | ( | Format | _format | ) |

Functions that set this object's fields and return this object. These allows setters to be chained.

## ◆ SetIsOpaque()

NVTT_API EncodeSettings & nvtt::EncodeSettings::SetIsOpaque | ( | bool | _is_opaque | ) |

See also
  EncodeFlags_Opaque

## ◆ SetOutputToGPUMem()

NVTT_API EncodeSettings & nvtt::EncodeSettings::SetOutputToGPUMem | ( | bool | _to_device_mem | ) |

See also
  EncodeFlags_OutputToGPUMem

## ◆ SetUseGPU()

NVTT_API EncodeSettings & nvtt::EncodeSettings::SetUseGPU | ( | bool | _use_gpu | ) |

See also
  EncodeFlags_UseGPU

## Member Data Documentation

## ◆ encode_flags

uint32_t nvtt::EncodeSettings::encode_flags = EncodeFlags_UseGPU

A bitmask of EncodeFlags. This can be set using bit operations, like `encode_flags = EncodeFlags_UseGPU | EncodeFlags_Opaque`, or using EncodeSettings' functions for individual flags.

## ◆ format

Format nvtt::EncodeSettings::format = Format_Unset

The desired compression format.

See also
  Format

## ◆ quality

Quality nvtt::EncodeSettings::quality = Quality_Normal

The desired compression quality.

See also
  Quality

## ◆ rgb_pixel_type

PixelType nvtt::EncodeSettings::rgb_pixel_type = (PixelType)0

When `format` is Format_RGB, this defines the type of the output data.

## ◆ sType

uint32_t nvtt::EncodeSettings::sType = EncodeSettings_Version_1

The structure type and version. This is here to allow this struct to be identified from its first 32 bits, and to allow future NVTT versions to add new members to this struct without breaking backwards compatibility. It should not be changed from the default.

## ◆ timing_context

TimingContext* nvtt::EncodeSettings::timing_context = nullptr

See also
  nvtt::TimingContext.

The documentation for this struct was generated from the following file:

- nvtt/nvtt_lowlevel.h