OpenGL API DocumentationΒΆ

NVIDIA TXAA 3.0

struct NvTxaaCompressionRange
#include <GFSDK_TXAA.h>

Dynamic range compression data.

Dynamic range ompression occurs before the reconstruction filter and temporal feedback is applied in the TXAA resolve. The final resolved color is expanded back to the original dynamic range before being written to the TXAA resolve target.

Public Members

gfsdk_F32 threshold

Colors with luma above this range will be compressed, below will be untouched.

gfsdk_F32 range

The range of compression (should be >= threshold).

struct NvTxaaContextGL

Public Functions

__GFSDK_ALIGN__(64)

struct NvTxaaDebugParametersGL
#include <GFSDK_TXAA.h>

TXAA Debug Parameters.

Public Members

GLuint target

Debug render target, valid if it:

NvTxaaDebugChannel channel

Specifies what should be rendered into debugTarget.

struct NvTxaaFeedbackParameters
#include <GFSDK_TXAA.h>

TXAA Feedback Parameters.

Public Members

gfsdk_F32 weight

Weight to apply to feedback that is not clipped.

gfsdk_F32 clippedWeight

Weight to apply to feedback that is clipped.

struct NvTxaaMotionGL
#include <GFSDK_TXAA.h>

TXAA Motion Parameters.

Public Members

GLuint motionVectors

Velocity field; valid if it:

NvTxaaMotionParameters * parameters

The motion parameters; null to use default motion parameters.

struct NvTxaaMotionParameters
#include <GFSDK_TXAA.h>

Motion parameters.

Public Members

gfsdk_F32 motionOffsetX

The x motion offset (0-1, same scale as motion vectors). The motion offset is added to the motion from the velocity field.

gfsdk_F32 motionOffsetY

The y motion offset (0-1, same scale as motion vectors). The motion offset is added to the motion from the velocity field.

gfsdk_F32 motionLimitPixels

The motion limit in pixels; 16 pixels is recommended.

struct NvTxaaPerFrameConstants
#include <GFSDK_TXAA.h>

UI Constants that need to be passed to the shaders.

Public Functions

NvTxaaPerFrameConstants()

Public Members

gfsdk_U32 useBHFilters

Use Blackman Harris 3.3 filter.

gfsdk_U32 useAntiFlickerFilter

Use Anti flicker filter.

gfsdk_U32 motionVecSelection

Use longest MV in the neighborhood.

gfsdk_U32 useRGB

Use RGB instead of YCoCg.

gfsdk_U32 isZFlipped

Is Z flipped.

gfsdk_F32 xJitter

Jitter along X-axis.

gfsdk_F32 yJitter

Jitter along Y-axis.

gfsdk_F32 mvScale

Motion Vector Scale.

gfsdk_U32 enableClipping

Enable clipping.

gfsdk_F32 frameBlendFactor

frame blend factor

gfsdk_U32 dbg1

dbg variable

gfsdk_F32 bbScale

Scale factor to inflate bounding box.

struct NvTxaaResolveParametersGL
#include <GFSDK_TXAA.h>

TXAA Resolve Parameters.

Public Members

NvTxaaContextGL * txaaContext

The TXAA context.

GLuint resolveTarget

Target of the resolve; valid if it:

GLuint msaaSource

Source of the resolve; valid if it:

GLuint feedbackSource

Feedback from the prior frame (prior frame’s resolveTarget); valid if it:

GLuint controlSource

Texture used for per-pixel control of TXAA application; may be 0, valid if it:

NvTxaaAlphaResolveMode alphaResolveMode

The alpha resolve mode.

NvTxaaCompressionRange * compressionRange

The compression range to use for resolve; null to disable compression.

NvTxaaFeedbackParameters * feedback

The feedback parameters to use for resolve; null for default feedback parameters.

NvTxaaDebugParametersGL * debug

The debug parameters to use for resolve; may be null.

struct NvTxaaSamplePositionsGL
#include <GFSDK_TXAA.h>

Programmable sample positions.

Public Members

GLfloat xy[32]

struct NvTxaaVersion
#include <GFSDK_TXAA.h>

Contains the library version number.

Public Members

gfsdk_U32 major

Major version of the product, changed manually with every product release with a large new feature set.

gfsdk_U32 minor

Minor version of the product, changed manually with every minor product release containing some features.

gfsdk_U32 revision

Revision, changed manually with every revision for bug fixes.

gfsdk_U32 build

Build number of the same revision. Typically 0.

file GFSDK_TXAA.h
#include “GFSDK_TXAA_Common.h”
#include <GL3/gl3.h>
#include <float.h>

The TXAA API C/C++ header.

Defines

__GFSDK_TXAA_H__

NV_TXAA_MAX_NUM_FRAMES

Sample offsets that will be used in filtering.

The jitter offsets that are applied to the viewport matrix decide the filter weights that get used. Filter weights depend on the sample offsets. These offsets are same across all the pixels because same amount of jitter is applied to the entire viewport. They are laid out for each multi-sampling mode one after another. For a given MSAA mode and a frame, filter tap weights are laid out from 0..8 starting at the top left pixel and going row-wise to the bottom right pixel.

NV_TXAA_FILTER_TAPS_BLACKMAN_HARRIS

NV_TXAA_FILTER_SIZE

NV_TXAA_NUM_MAX_SAMPLES

TXAA_API

Typedefs

typedef struct NvTxaaContextGL NvTxaaContextGL

TXAA Context.

Enums

NvTxaaStatus enum

Status codes that may be returned by functions in the library.

Values:

  • NV_TXAA_STATUS_OK =   0 -

    Success. Request is completed.

  • NV_TXAA_STATUS_ERROR = -1 -

    Generic error. Request failed.

  • NV_TXAA_STATUS_SDK_VERSION_MISMATCH = -2 -

    Mismatch of dll vs header file+lib.

  • NV_TXAA_STATUS_UNSUPPORTED = -3 -

    The request is unsupported.

  • NV_TXAA_STATUS_INVALID_ARGUMENT = -4 -

    Invalid argument (such as a null pointer).

  • NV_TXAA_STATUS_CONTEXT_NOT_INITIALIZED = -100 -

    The supplied TXAA context is not initialized.

  • NV_TXAA_STATUS_CONTEXT_ALREADY_INITIALIZED = -101 -

    The supplied TXAA context was already initialized.

  • NV_TXAA_STATUS_INVALID_DEVICECONTEXT = -200 -

    The supplied device context is invalid (doesn’t belong to the device that the TXAA context was initialized with).

  • NV_TXAA_STATUS_INVALID_RESOLVETARGET = -201 -

    The supplied resolve target is invalid (the wrong format or dimensions).

  • NV_TXAA_STATUS_INVALID_MSAASOURCE = -202 -

    The supplied MSAA source is invalid (the wrong format or dimensions).

  • NV_TXAA_STATUS_INVALID_FEEDBACKSOURCE = -203 -

    The supplied feedback source is invalid (the wrong format or dimensions).

  • NV_TXAA_STATUS_INVALID_MOTIONVECTORS = -204 -

    The supplied motion vector field is invalid (the wrong format or dimensions).

  • NV_TXAA_STATUS_INVALID_CONTROLSOURCE = -205 -

    The supplied control source is invalid (the wrong format or dimensions).

  • NV_TXAA_STATUS_INVALID_COMPRESSIONRANGE = -206 -

    The supplied compression range is invalid.

  • NV_TXAA_STATUS_INVALID_DEPTH = -207 -

    The supplied depth source is invalid (the wrong format or dimensions).

NvTxaaAlphaResolveMode enum

Alpha resolve mode.

Controls what value is put into the destination alpha channel in the TXAA resolve operation. This enumeration affects nothing in alpha calculation. It will be removed.

Values:

  • NV_TXAA_ALPHARESOLVEMODE_KEEPDESTALPHA = 0 -

    Keeps the desitnation alpha channel value.

  • NV_TXAA_ALPHARESOLVEMODE_RESOLVESRCALPHA -

    Dest alhpa gets a box filtered version of the source MSAA alpha channel.

  • NV_TXAA_ALPHARESOLVEMODE_COUNT -

NvTxaaUseMV enum

Values:

  • NV_TXAA_USEMV_LONGEST_LOCAL -

    Use longest MV within a pixel.

  • NV_TXAA_USEMV_LONGEST_NEIGHBORHOOD -

    Use longest MV within a + shaped neighborhood.

  • NV_TXAA_USEMV_BEST_FIT -

    Use two MVs longest and shortest, and use the one that produces the closest color from the history.

  • NV_TXAA_USEMV_NEAREST -

    Use the MV of the sample that is closest.

  • NV_TXAA_USEMV_COUNT -

NvTxaaDebugChannel enum

Debug channel.

Values:

  • NV_TXAA_DEBUGCHANNEL_MSAA -

    Render MSAA resolve.

  • NV_TXAA_DEBUGCHANNEL_MOTIONVECTORS -

    Render motion vectors.

  • NV_TXAA_DEBUGCHANNEL_TEMPORALDIFFS -

    Render temporal differences.

  • NV_TXAA_DEBUGCHANNEL_TEMPORALREPROJ -

    Render the temporally reprojected image.

  • NV_TXAA_DEBUGCHANNEL_CONTROL -

    Render the AA control values.

  • NV_TXAA_DEBUGCHANNEL_COUNT -
Functions

TXAA_API NvTxaaStatus GFSDK_TXAA_GL_InitializeContext(NvTxaaContextGL * txaaContext, const NvTxaaVersion * version = &NvTxaaCurrentVersion)

Initializes the TXAA library.

Note this might be a high latency operation as it does a GPU->CPU read.

Return
NV_TXAA_STATUS_INVALID_ARGUMENT if txaaContext is null; NV_TXAA_STATUS_SDK_VERSION_MISMATCH if the application was compiled against an incompatible version of the library; NV_TXAA_STATUS_CONTEXT_ALREADY_INITIALIZED if txaaContext has already been initialized; NV_TXAA_STATUS_VERSION_MISMATCH if the application was compiled against an incompatible version of the library; NV_TXAA_STATUS_OK if initialization succeeded
Side Effects:
modifies the following GL state:
Parameters
  • txaaContext -

    Pointer to an uninitialized NvTxaaContextGL structure to be initialized

  • version -

    Pointer to an NvTxaaVersion structure; the application should pass the address of the NvTxaaCurrentVersion constant

TXAA_API NvTxaaStatus GFSDK_TXAA_GL_ReleaseContext(NvTxaaContextGL * txaaContext)

Releases the specified TXAA context.

Return
NV_TXAA_STATUS_INVALID_ARGUMENT if txaaContext is null; NV_TXAA_STATUS_CONTEXT_NOT_INITIALIZED if txaaContext has not been initialized with a call to GFSDK_TXAA_GL_InitializeContext; NV_TXAA_STATUS_OK if the context has been fully released
Parameters
  • txaaContext -

    Pointer to an initialized NvTxaaContextGL structure to be released

TXAA_API NvTxaaStatus GFSDK_TXAA_GL_ResolveFromMotionVectors(const NvTxaaResolveParametersGL * resolveParameters, const NvTxaaMotionGL * motion)

Resolves the supplied mutisample surface using a supplied motion vector field. If non-MSAA surface is provided, this will triger a non-MSAA mode TXAA resolve.

Use in-place of standard MSAA resolve.

The supplied control texture can be used to control the amount of antialiasing [0-1]. The filter is narrowed and temporal feedback is limited in areas with lower control values. If not supplied, all pixels use the widest filter and maximum temporal feedback.

Return
NV_TXAA_STATUS_INVALID_ARGUMENT if resolveParameters or motionVectors is null; NV_TXAA_STATUS_CONTEXT_NOT_INITIALIZED if resolveParameters->txaaContext has not been initialized with a call to GFSDK_TXAA_GL_InitializeContext; NV_TXAA_STATUS_INVALID_RESOLVETARGET if resolveParameters->resolveTarget is invalid; NV_TXAA_STATUS_INVALID_MSAASOURCE if resolveParameters->msaaSource is invalid; NV_TXAA_STATUS_INVALID_FEEDBACKSOURCE if resolveParameters->feedback is invalid; NV_TXAA_STATUS_INVALID_CONTROLSOURCE if resolveParameters->controlSource is invalid; NV_TXAA_STATUS_INVALID_COMPRESSIONRANGE if resolveParameters->compressionRange is invalid; NV_TXAA_STATUS_INVALID_MOTIONVECTORS if motionVectors is invalid; NV_TXAA_STATUS_OK if the resolve succeeded
Side Effects:
modifies the following GL state:
Parameters
  • resolveParameters -

    Resolve parameters

  • motion -

    Motion data

Variables

const NvTxaaVersion NvTxaaCurrentVersion

Contains the current library version number.

const NvTxaaCompressionRange NvTxaaNoCompression

Contains range compression settings for no compression.

const NvTxaaCompressionRange NvTxaaFullCompression

Contains range compression settings for full compression.

const NvTxaaCompressionRange NvTxaaHalfCompression

Contains range compression settings for half compression.

Only the colors in the upper half of standard luma range and HDR colors are compressed.

const NvTxaaCompressionRange NvTxaaHdrCompression

Contains range compression settings for HDR compression.

Only colors that exceed the standard (0-1) luma range are commpressed.

const NvTxaaCompressionRange NvTxaaDefaultCompression

Default range compression settings.

const NvTxaaFeedbackParameters NvTxaaDefaultFeedback

Contains default feedback parameters.

const NvTxaaMotionParameters NvTxaaDefaultMotion

Contains default motion parameters.