.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R

.fi
..
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.hy 0
.if n .na
.bd B 3
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.IX Title "gp4vp Cg"
.TH gp4vp Cg "" "Cg Toolkit 2.2" "Cg Profiles"
.UC
.SH "NAME"
\&\fBgp4vp\fR \- OpenGL vertex profile for G8x (GeForce 8xxx Series, G8x-based Quadro \s-1FX\s0, etc.)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&  gp4vp
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This OpenGL profile corresponds to the per-vertex functionality
introduced by the GeForce 8800 and other G8x-based \s-1NVIDIA\s0 GPUs.
.PP
The compiler output for this profile conforms to the assembly format
defined by \fBNV_gpu_program4\fR and \fBARB_vertex_program\fR.
.PP
Note that the \fBNV_gpu_program4\fR extension has its vertex domain-specific
aspects documented in the \fBNV_vertex_program4\fR specification.
.PP
Data-dependent loops and branching \fIare\fR allowed.
.PP
Relative indexing of uniform arrays \fIis\fR supported.
.PP
Texture accesses are supported. While the prior \fBvp40\fR profile has substantial
limitations on vertex texturing, the \fBgp4vp\fR profile eliminates all
the limitations.
.PP
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).
.SH "3D API DEPENDENCIES"
.IX Header "3D API DEPENDENCIES"
Requires OpenGL support for the \fBNV_gpu_program4\fR extension.  This
extension was introduced by the GeForce 8800 and other G8x-based GPUs.
.PP
Programmability:
.PP
.Vb 2
\& http://www.opengl.org/registry/specs/NV/gpu_program4.txt 
\& http://www.opengl.org/registry/specs/NV/vertex_program4.txt
.Ve
New texture samplers:
.PP
.Vb 2
\& http://www.opengl.org/registry/specs/EXT/texture_array.txt 
\& http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt
.Ve
New integer texture formats:
.PP
.Vb 1
\& http://www.opengl.org/registry/specs/EXT/texture_integer.txt
.Ve
.SH "PROFILE OPTIONS"
.IX Header "PROFILE OPTIONS"
.Sh "Common \s-1GP4\s0 Options"
.IX Subsection "Common GP4 Options"
.Ip "fastimul" 4
.IX Item "fastimul"
Assume integer multiply inputs have at most 24 significant bits.  Example: \*(L"\-po fastimul\*(R"
.SH "DATA TYPES"
.IX Header "DATA TYPES"
.Sh "Samplers"
.IX Subsection "Samplers"
This profile has additional samplers for texture arrays (1D and 2D)
and texture buffers.
.PP
Standard OpenGL textures formats (\s-1GL_RGBA8\s0, 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 \fBi\fR and \fBu\fR respectively.  Your application is
required to make sure the bound textures have the appropriate texture
format.  So a 3D texture specified with the \s-1GL_RGBA32UI_EXT\s0 internal
format (see the EXT_texture_integer OpenGL extension) must be used with
a \fBusampler3D\fR sampler.  Otherwise, texture sampling returns undefined
results.
.Ip "sampler1D" 8
.IX Item "sampler1D"
1D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D\s0\fR target.
Sampling returns \fBfloat\fR vectors.
.Ip "isampler1D" 8
.IX Item "isampler1D"
1D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D\s0\fR target.
Sampling returns \fBint\fR vectors.
.Ip "usampler1D" 8
.IX Item "usampler1D"
1D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D\s0\fR target.
Sampling returns \fBunsigned int\fR vectors.
.Ip "sampler1DARRAY" 8
.IX Item "sampler1DARRAY"
1D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBfloat\fR vectors.
.Ip "isampler1DARRAY" 8
.IX Item "isampler1DARRAY"
1D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBint\fR vectors.
.Ip "usampler1DARRAY" 8
.IX Item "usampler1DARRAY"
1D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_1D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBunsigned int\fR vectors.
.Ip "sampler2D" 8
.IX Item "sampler2D"
2D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D\s0\fR target.
Sampling returns \fBfloat\fR vectors.
.Ip "isampler2D" 8
.IX Item "isampler2D"
2D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D\s0\fR target.
Sampling returns \fBint\fR vectors.
.Ip "usampler2D" 8
.IX Item "usampler2D"
2D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D\s0\fR target.
Sampling returns \fBunsigned int\fR vectors.
.Ip "sampler2DARRAY" 8
.IX Item "sampler2DARRAY"
2D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBfloat\fR vectors.
.Ip "isampler2DARRAY" 8
.IX Item "isampler2DARRAY"
2D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBint\fR vectors.
.Ip "usampler2DARRAY" 8
.IX Item "usampler2DARRAY"
2D array texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_2D_ARRAY_EXT\s0\fR target provided by the \fBEXT_texture_array\fR extension.
Sampling returns \fBunsigned int\fR vectors.
.Ip "sampler3D" 8
.IX Item "sampler3D"
3D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_3D\s0\fR target.
Sampling returns \fBfloat\fR vectors.
.Ip "isampler3D" 8
.IX Item "isampler3D"
3D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_3D\s0\fR target.
Sampling returns \fBint\fR vectors.
.Ip "usampler3D" 8
.IX Item "usampler3D"
3D texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_3D\s0\fR target.
Sampling returns \fBunsigned int\fR vectors.
.Ip "samplerCUBE" 8
.IX Item "samplerCUBE"
Cube map texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_CUBE_MAP\s0\fR target.
Sampling returns \fBfloat\fR vectors.
.Ip "isamplerCUBE" 8
.IX Item "isamplerCUBE"
Cube map texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_CUBE_MAP\s0\fR target.
Sampling returns \fBint\fR vectors.
.Ip "usamplerCUBE" 8
.IX Item "usamplerCUBE"
Cube map texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_CUBE_MAP\s0\fR target.
Sampling returns \fBunsigned int\fR vectors.
.Ip "samplerRECT" 8
.IX Item "samplerRECT"
Rectangle texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_RECTANGLE_ARB\s0\fR target.
Sampling returns \fBfloat\fR vectors.
.Ip "isamplerRECT" 8
.IX Item "isamplerRECT"
Rectangle texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_RECTANGLE_ARB\s0\fR target.
Sampling returns \fBint\fR vectors.
.Ip "isamplerRECT" 8
.IX Item "isamplerRECT"
Rectangle texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_RECTANGLE_ARB\s0\fR target.
Sampling returns \fBunsigned int\fR vectors.
.Ip "samplerBUF" 8
.IX Item "samplerBUF"
Buffer texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_BUFFER_EXT\s0\fR target provided by the \fBEXT_texture_buffer_object\fR extension.
Sampling returns \fBfloat\fR vectors.
.Ip "isamplerBUF" 8
.IX Item "isamplerBUF"
Buffer texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_BUFFER_EXT\s0\fR target provided by the \fBEXT_texture_buffer_object\fR extension.
Sampling returns \fBint\fR vectors.
.Ip "usamplerBUF" 8
.IX Item "usamplerBUF"
Buffer texture unit corresponding to OpenGL's \fB\s-1GL_TEXTURE_BUFFER_EXT\s0\fR target provided by the \fBEXT_texture_buffer_object\fR extension.
Sampling returns \fBunsigned int\fR vectors.
.Sh "Floating-point"
.IX Subsection "Floating-point"
.Ip "float" 8
.IX Item "float"
32\-bit \s-1IEEE\s0 floating-point
.Ip "half" 8
.IX Item "half"
32\-bit \s-1IEEE\s0 floating-point
.Ip "double" 8
.IX Item "double"
32\-bit \s-1IEEE\s0 floating-point
.Ip "fixed" 8
.IX Item "fixed"
Floating-point restricted to [\-2,2) range.
.Sh "Integer"
.IX Subsection "Integer"
This profile supports \*(L"true\*(R" integer data types.  Shifting and bitwise operators are supported for integer data types.
.Ip "int" 8
.IX Item "int"
32\-bit signed integer
.Ip "unsigned int" 8
.IX Item "unsigned int"
32\-bit unsigned integer
.Ip "short" 8
.IX Item "short"
16\-bit signed integer
.Ip "unsigned short" 8
.IX Item "unsigned short"
16\-bit unsigned integer
.Ip "char" 8
.IX Item "char"
8\-bit signed integer
.Ip "unsigned char" 8
.IX Item "unsigned char"
8\-bit unsigned integer
.SH "SEMANTICS"
.IX Header "SEMANTICS"
.Sh "\s-1VARYING\s0 \s-1INPUT\s0 \s-1SEMANTICS\s0"
.IX Subsection "VARYING INPUT SEMANTICS"
.I "Vertex Attribute Input Semantics"
.IX Subsection "Vertex Attribute Input Semantics"
.PP
For geometry shader profiles such as gp4gp, varying parameters with
vertex attribute input semantics must be declared with the \fBAttribArray\fR
template-style syntax because a geometry shader accepts an attribute
array of vertex attributes (rather than individual vertex attributes as
a vertex shader does).
.PP
Example defining a varying parameter for the position vertex attribute:
.PP
.Vb 1
\&  AttribArray<float4> position : POSITION
.Ve
The set of binding semantics for varying input vertex attributes to gp4gp
consists of \s-1POSITION\s0, \s-1BLENDWEIGHT\s0, \s-1NORMAL\s0, \s-1COLOR0\s0, \s-1COLOR1\s0, \s-1TESSFACTOR\s0,
\&\s-1PSIZE\s0, \s-1BLENDINDICES\s0, and \s-1TEXCOORD0\-TEXCOORD7\s0. One can also use \s-1TANGENT\s0
and \s-1BINORMAL\s0 instead of \s-1TEXCOORD6\s0 and \s-1TEXCOORD7\s0.
.PP
Additionally, a set of binding semantics \s-1ATTR0\-ATTR15\s0 can be used. These
binding semantics map to NV_gpu_program4 input attribute parameters as
described in the NV_geometry_program4 document.
.PP
The two sets act as aliases to each other on \s-1NVIDIA\s0 GPUs excluding Apple
Macs.  \s-1ATI\s0 GPUs and \s-1NVIDIA\s0 Mac GPUs do \fInot\fR alias the conventional
vertex attributes with the generic attributes.
.PP
.Vb 1
\&  Binding Semantics Name       Corresponding Data
.Ve
.Vb 1
\&  POSITION, ATTR0              Input Vertex, Generic Attribute 0
.Ve
.Vb 1
\&  BLENDWEIGHT, ATTR1           Input vertex weight, Generic Attribute 1
.Ve
.Vb 1
\&  NORMAL, ATTR2                Input normal, Generic Attribute 2
.Ve
.Vb 1
\&  DIFFUSE, COLOR0, ATTR3       Input primary color, Generic Attribute 3
.Ve
.Vb 1
\&  SPECULAR, COLOR1, ATTR4      Input secondary color, Generic Attribute 4
.Ve
.Vb 1
\&  TESSFACTOR, FOGCOORD, ATTR5  Input fog coordinate, Generic Attribute 5
.Ve
.Vb 1
\&  PSIZE, ATTR6                 Input point size, Generic Attribute 6
.Ve
.Vb 1
\&  BLENDINDICES, ATTR7          Generic Attribute 7
.Ve
.Vb 2
\&  TEXCOORD0-TEXCOORD7,         Input texture coordinates (texcoord0-texcoord7)
\&  ATTR8-ATTR15                 Generic Attributes 8-15
.Ve
.Vb 1
\&  TANGENT, ATTR14              Generic Attribute 14
.Ve
.Vb 1
\&  BINORMAL, ATTR15             Generic Attribute 15
.Ve
.Vb 2
\&  VERTEXID                     Input vertex ID (integer)
\&                               Vertex index when using vertex arrays
.Ve
These vertex attribute semantics should match with the semantics of the
outputs of the vertex shader feeding the geometry shader.
.Sh "\s-1UNIFORM\s0 \s-1INPUT\s0 \s-1SEMANTICS\s0"
.IX Subsection "UNIFORM INPUT SEMANTICS"
.I "Buffer Semantics"
.IX Subsection "Buffer Semantics"
.PP
gp4 profiles can specify that uniforms be specified to reside within
binable buffers.
.PP
Example of automatic, compiler-determined specification of a uniform's
location within a buffer:
.PP
.Vb 2
\&  uniform float2 location   : BUFFER[3];  // compiler positions within buffer 3
\&  uniform float4 brickColor : BUFFER[3];  // compiler positions within buffer 3
.Ve
Example of absolute byte offset specification of a uniform's locaiton
within a buffer:
.PP
.Vb 1
\&  uniform float4 mustBeHere : BUFFER[7][20];  // locate 20 bytes into buffer 7
.Ve
.I "Constant Register Semantics"
.IX Subsection "Constant Register Semantics"
.PP
.Vb 2
\&  C0-C255           Constant register [0..255].
\&                    The aliases c0-c255 (lowercase) are also accepted.
.Ve
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.
.PP
Example:
.PP
.Vb 1
\&  uniform float4 array[20] : C14;  // uses c14 through c33
.Ve
.I "Texture Unit Semantics"
.IX Subsection "Texture Unit Semantics"
.PP
.Vb 2
\&  TEXUNIT0-TEXUNIT15  Texture unit (but only 4 distinct texture units
\&                      are allowed)
.Ve
Example:
.PP
.Vb 1
\&  uniform sampler2DARRAY texArray : TEXUNIT7;
.Ve
.Sh "\s-1OUTPUT\s0 \s-1SEMANTICS\s0"
.IX Subsection "OUTPUT SEMANTICS"
These vertex attribute output semantics match the output semantics for gp4vp.
.PP
.Vb 1
\&  Binding Semantics Name        Corresponding Data
.Ve
.Vb 1
\&  POSITION, HPOS                Output position
.Ve
.Vb 1
\&  PSIZE, PSIZ                   Output point size
.Ve
.Vb 1
\&  FOG, FOGC                     Output fog coordinate
.Ve
.Vb 1
\&  COLOR0, COL0                  Output primary color
.Ve
.Vb 1
\&  COLOR1, COL1                  Output secondary color
.Ve
.Vb 1
\&  BCOL0                         Output backface primary color
.Ve
.Vb 1
\&  BCOL1                         Output backface secondary color
.Ve
.Vb 2
\&  TEXCOORD0-TEXCOORD7,          Output texture coordinates
\&  TEX0-TEX7
.Ve
.Vb 1
\&  CLP0-CL5                      Output Clip distances
.Ve
.SH "STANDARD LIBRARY ISSUES"
.IX Header "STANDARD LIBRARY ISSUES"
.Sh "Raw Cast from Floating-point to Integer Functions"
.IX Subsection "Raw Cast from Floating-point to Integer Functions"
It is possible to convert the raw bit patterns of \s-1IEEE\s0 single-precision
floating-point to 32\-bit unsigned integer.
.PP
floatToRawIntBits, floatToIntBits, intBitsToFloat
.Sh "Texture Array Functions"
.IX Subsection "Texture Array Functions"
New sampler data types for texture arrays and texture buffers lead to
new standard library routines to access these samplers.
.PP
New standard library functions are used to access 1D texture array
samplers (sampler1DARRAY).
.PP
tex1DARRAY, 
tex1DARRAYbias, 
tex1DARRAYcmpbias, 
tex1DARRAYlod, 
tex1DARRAYcmplod, and
tex1DARRAYproj
.PP
The dimensions of a texture array level can be determined.
.PP
tex1DARRAYsize
.PP
New standard library functions are used to access 2D texture array
samplers (sampler2DARRAY).
.PP
tex2DARRAY, 
tex2DARRAYbias, 
tex2DARRAYcmpbias, 
tex2DARRAYlod, 
tex2DARRAYcmplod, and
tex2DARRAYproj
.PP
The dimensions of a texture array level can be determined.
.PP
tex2DARRAYsize
.SH "SEE ALSO"
.IX Header "SEE ALSO"
gp4fp, gp4gp, texBUF, texBUFsize, floatToRawIntBits,
floatToIntBits, intBitsToFloat
.PP
tex1DARRAY, 
tex1DARRAYbias, 
tex1DARRAYcmpbias, 
tex1DARRAYlod, 
tex1DARRAYcmplod, 
tex1DARRAYproj,
tex1DARRAYsize
.PP
tex2DARRAY, 
tex2DARRAYbias, 
tex2DARRAYcmpbias, 
tex2DARRAYlod, 
tex2DARRAYcmplod, 
tex2DARRAYproj,
tex2DARRAYsize
