gp4vp.3Cg

Langue: en

Version: Cg Toolkit 3.0 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

gp4vp - OpenGL vertex profile for NVIDIA GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro

SYNOPSIS

   gp4vp
 
 

DESCRIPTION

This OpenGL profile corresponds to the per-vertex functionality introduced by NVIDIA's 4th generation of assembly instruction sets.

The compiler output for this profile conforms to the assembly format defined by NV_gpu_program4 and ARB_vertex_program.

Note that the NV_gpu_program4 extension has its vertex domain-specific aspects documented in the NV_vertex_program4 specification.

Data-dependent loops and branching are allowed.

Relative indexing of uniform arrays is supported.

Texture accesses are supported. While the prior vp40 profile has substantial limitations on vertex texturing, the gp4vp profile eliminates all the limitations.

Texture accesses include support for texture arrays (see the EXT_texture_array OpenGL extension for more details) and texture buffer objects (see the EXT_texture_buffer_object extension for details). Texture results can be either conventional floating-point vectors or integer vectors (see the EXT_texture_integer extension for details).

3D API DEPENDENCIES

Requires OpenGL support for the NV_gpu_program4 extension. This extension was introduced by the GeForce 8800 and other G8x-based GPUs.

OpenGL Extension Specifications

Programmability:

  http://www.opengl.org/registry/specs/NV/gpu_program4.txt 
  http://www.opengl.org/registry/specs/NV/vertex_program4.txt
 
 

New texture samplers:

  http://www.opengl.org/registry/specs/EXT/texture_array.txt 
  http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt
 
 

New integer texture formats:

  http://www.opengl.org/registry/specs/EXT/texture_integer.txt
 
 

PROFILE OPTIONS


Common GP4 Options

fastimul
Assume integer multiply inputs have at most 24 significant bits. Example: ``-po fastimul''

DATA TYPES


Samplers

This profile has additional samplers for texture arrays (1D and 2D) and texture buffers.

Standard OpenGL textures formats (GL_RGBA8, etc.) return floating-point sampled results, but new signed and unsigned integer texture formats require samplers the return signed and unsigned integer vectors respectively. Sampler variants for fetching signed and unsigned integer vectors are prefixed by i and u respectively. Your application is required to make sure the bound textures have the appropriate texture format. So a 3D texture specified with the GL_RGBA32UI_EXT internal format (see the EXT_texture_integer OpenGL extension) must be used with a usampler3D sampler. Otherwise, texture sampling returns undefined results.

sampler1D
1D texture unit corresponding to OpenGL's GL_TEXTURE_1D target. Sampling returns float vectors.
isampler1D
1D texture unit corresponding to OpenGL's GL_TEXTURE_1D target. Sampling returns int vectors.
usampler1D
1D texture unit corresponding to OpenGL's GL_TEXTURE_1D target. Sampling returns unsigned int vectors.
sampler1DARRAY
1D array texture unit corresponding to OpenGL's GL_TEXTURE_1D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns float vectors.
isampler1DARRAY
1D array texture unit corresponding to OpenGL's GL_TEXTURE_1D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns int vectors.
usampler1DARRAY
1D array texture unit corresponding to OpenGL's GL_TEXTURE_1D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns unsigned int vectors.
sampler2D
2D texture unit corresponding to OpenGL's GL_TEXTURE_2D target. Sampling returns float vectors.
isampler2D
2D texture unit corresponding to OpenGL's GL_TEXTURE_2D target. Sampling returns int vectors.
usampler2D
2D texture unit corresponding to OpenGL's GL_TEXTURE_2D target. Sampling returns unsigned int vectors.
sampler2DARRAY
2D array texture unit corresponding to OpenGL's GL_TEXTURE_2D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns float vectors.
isampler2DARRAY
2D array texture unit corresponding to OpenGL's GL_TEXTURE_2D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns int vectors.
usampler2DARRAY
2D array texture unit corresponding to OpenGL's GL_TEXTURE_2D_ARRAY_EXT target provided by the EXT_texture_array extension. Sampling returns unsigned int vectors.
sampler3D
3D texture unit corresponding to OpenGL's GL_TEXTURE_3D target. Sampling returns float vectors.
isampler3D
3D texture unit corresponding to OpenGL's GL_TEXTURE_3D target. Sampling returns int vectors.
usampler3D
3D texture unit corresponding to OpenGL's GL_TEXTURE_3D target. Sampling returns unsigned int vectors.
samplerCUBE
Cube map texture unit corresponding to OpenGL's GL_TEXTURE_CUBE_MAP target. Sampling returns float vectors.
isamplerCUBE
Cube map texture unit corresponding to OpenGL's GL_TEXTURE_CUBE_MAP target. Sampling returns int vectors.
usamplerCUBE
Cube map texture unit corresponding to OpenGL's GL_TEXTURE_CUBE_MAP target. Sampling returns unsigned int vectors.
samplerRECT
Rectangle texture unit corresponding to OpenGL's GL_TEXTURE_RECTANGLE_ARB target. Sampling returns float vectors.
isamplerRECT
Rectangle texture unit corresponding to OpenGL's GL_TEXTURE_RECTANGLE_ARB target. Sampling returns int vectors.
isamplerRECT
Rectangle texture unit corresponding to OpenGL's GL_TEXTURE_RECTANGLE_ARB target. Sampling returns unsigned int vectors.
samplerBUF
Buffer texture unit corresponding to OpenGL's GL_TEXTURE_BUFFER_EXT target provided by the EXT_texture_buffer_object extension. Sampling returns float vectors.
isamplerBUF
Buffer texture unit corresponding to OpenGL's GL_TEXTURE_BUFFER_EXT target provided by the EXT_texture_buffer_object extension. Sampling returns int vectors.
usamplerBUF
Buffer texture unit corresponding to OpenGL's GL_TEXTURE_BUFFER_EXT target provided by the EXT_texture_buffer_object extension. Sampling returns unsigned int vectors.

Floating-point

float
32-bit IEEE floating-point
half
32-bit IEEE floating-point
double
32-bit IEEE floating-point
fixed
Floating-point restricted to [-2,2) range.

Integer

This profile supports ``true'' integer data types. Shifting and bitwise operators are supported for integer data types.

int
32-bit signed integer
unsigned int
32-bit unsigned integer
short
16-bit signed integer
unsigned short
16-bit unsigned integer
char
8-bit signed integer
unsigned char
8-bit unsigned integer

SEMANTICS


VARYING INPUT SEMANTICS

Vertex Attribute Input Semantics

For geometry shader profiles such as gp4gp, varying parameters with vertex attribute input semantics must be declared with the AttribArray template-style syntax because a geometry shader accepts an attribute array of vertex attributes (rather than individual vertex attributes as a vertex shader does).

Example defining a varying parameter for the position vertex attribute:

   AttribArray<float4> position : POSITION
 
 

The set of binding semantics for varying input vertex attributes to gp4gp consists of POSITION, BLENDWEIGHT, NORMAL, COLOR0, COLOR1, TESSFACTOR, PSIZE, BLENDINDICES, and TEXCOORD0-TEXCOORD7. One can also use TANGENT and BINORMAL instead of TEXCOORD6 and TEXCOORD7.

Additionally, a set of binding semantics ATTR0-ATTR15 can be used. These binding semantics map to NV_gpu_program4 input attribute parameters as described in the NV_geometry_program4 document.

The two sets act as aliases to each other on NVIDIA GPUs excluding Apple Macs. ATI GPUs and NVIDIA Mac GPUs do not alias the conventional vertex attributes with the generic attributes.

   Binding Semantics Name       Corresponding Data
   
   POSITION, ATTR0              Input Vertex, Generic Attribute 0 
   
   BLENDWEIGHT, ATTR1           Input vertex weight, Generic Attribute 1 
   
   NORMAL, ATTR2                Input normal, Generic Attribute 2
   
   DIFFUSE, COLOR0, ATTR3       Input primary color, Generic Attribute 3
   
   SPECULAR, COLOR1, ATTR4      Input secondary color, Generic Attribute 4
   
   TESSFACTOR, FOGCOORD, ATTR5  Input fog coordinate, Generic Attribute 5
   
   PSIZE, ATTR6                 Input point size, Generic Attribute 6
   
   BLENDINDICES, ATTR7          Generic Attribute 7
     
   TEXCOORD0-TEXCOORD7,         Input texture coordinates (texcoord0-texcoord7)
   ATTR8-ATTR15                 Generic Attributes 8-15
   
   TANGENT, ATTR14              Generic Attribute 14
   
   BINORMAL, ATTR15             Generic Attribute 15
 
   VERTEXID                     Input vertex ID (integer)
                                Vertex index when using vertex arrays
 
   INSTANCEID                   Integer instance ID of the primitive
                                within the current batch
 
 

These vertex attribute semantics should match with the semantics of the outputs of the vertex shader feeding the geometry shader.

UNIFORM INPUT SEMANTICS

Buffer Semantics

gp4 profiles can specify that uniforms be specified to reside within binable buffers.

Example of automatic, compiler-determined specification of a uniform's location within a buffer:

   uniform float2 location   : BUFFER[3];  // compiler positions within buffer 3
   uniform float4 brickColor : BUFFER[3];  // compiler positions within buffer 3
 
 

Example of absolute byte offset specification of a uniform's locaiton within a buffer:

   uniform float4 mustBeHere : BUFFER[7][20];  // locate 20 bytes into buffer 7
 
 

Constant Register Semantics

   C0-C255           Constant register [0..255].
                     The aliases c0-c255 (lowercase) are also accepted.
 
 

If used with a variable that requires more than one constant register (e.g. a matrix), the semantic specifies the first register that is used.

Example:

   uniform float4 array[20] : C14;  // uses c14 through c33
 
 

Texture Unit Semantics

   TEXUNIT0-TEXUNIT15  Texture unit (but only 4 distinct texture units
                       are allowed)
 
 

Example:

   uniform sampler2DARRAY texArray : TEXUNIT7;
 
 

OUTPUT SEMANTICS

These vertex attribute output semantics match the output semantics for gp4vp.

   Binding Semantics Name        Corresponding Data
   
   POSITION, HPOS                Output position
   
   PSIZE, PSIZ                   Output point size
   
   FOG, FOGC                     Output fog coordinate
   
   COLOR0, COL0                  Output primary color 
   
   COLOR1, COL1                  Output secondary color
   
   BCOL0                         Output backface primary color
   
   BCOL1                         Output backface secondary color
   
   TEXCOORD0-TEXCOORD7,          Output texture coordinates
   TEX0-TEX7
   
   CLP0-CL5                      Output Clip distances
 
 

STANDARD LIBRARY ISSUES


Raw Cast from Floating-point to Integer Functions

It is possible to convert the raw bit patterns of IEEE single-precision floating-point to 32-bit unsigned integer.

floatToRawIntBits, floatToIntBits, intBitsToFloat

Texture Array Functions

New sampler data types for texture arrays and texture buffers lead to new standard library routines to access these samplers.

New standard library functions are used to access 1D texture array samplers (sampler1DARRAY).

tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod, tex1DARRAYproj

The dimensions of a texture array level can be determined.

tex1DARRAYsize

New standard library functions are used to access 2D texture array samplers (sampler2DARRAY).

tex2DARRAY, tex2DARRAYbias, tex2DARRAYcmpbias, tex2DARRAYlod, tex2DARRAYcmplod, tex2DARRAYproj

The dimensions of a texture array level can be determined.

tex2DARRAYsize

SEE ALSO

gp4, gp4gp, gp4fp, gp4gp, texBUF, texBUFsize, floatToRawIntBits, floatToIntBits, intBitsToFloat, tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod, tex1DARRAYproj, tex1DARRAYsize, tex2DARRAY, tex2DARRAYbias, tex2DARRAYcmpbias, tex2DARRAYlod, tex2DARRAYcmplod, tex2DARRAYproj, tex2DARRAYsize