Name
gp4gp - OpenGL geometry profile for NVIDIA GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro
Synopsis
gp4gp
Description
This OpenGL profile corresponds to the per-primitive 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 geometry domain-specific
aspects documented in the NV_geometry_program4 specification.
Data-dependent loops and branching are allowed.
Relative indexing of uniform arrays is supported.
Parameter buffer objects (also known as "constant buffers" in DirectX
10 or "bindable uniform" in GLSL's EXT_bindable_uniform extension)
provide a way to source uniform values from OpenGL buffer objects.
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).
If the system supports the NV_explicit_multisample OpenGL extension,
renderbuffers can be bound as textures, which allows texture access
to individual samples stored in multi-sample renderbuffer.
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.
Renderbuffer sampler access requires NV_explicit_multisample extension.
Opengl Extension Specifications
Programmability:
http://www.opengl.org/registry/specs/NV/gpu_program4.txt
http://www.opengl.org/registry/specs/NV/geometry_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
Optional renderbuffer textures:
http://www.opengl.org/registry/specs/NV/explicit_multisample.txt
Profile Options
Geometry Domain-Specific Gp4 Options
-
Normally the options below to specify primitive input and output type are
better specified as a profile modifier preceding the Cg entry function.
- Vertices=val
-
Maximum number of output vertices. Emitting more than this number of
vertices results in the extra vertices being discarded. Example "-po Vertices=3"
-
On NVIDIA GPUs, the throughput for geometry shaders is inverse
proporational to the maximum number of vertices output times the number
of scalar components per vertex. For this reason, keep the maximum
number of output vertices as small as possible for best performance.
- POINT
-
The entry function inputs point primitives. Example: "-po POINT"
-
If an output primitive is not also specified with a command line profile option, POINT_OUT is assumed.
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- LINE
-
The entry function inputs line primitives. Example: "-po LINE"
-
If an output primitive is not also specified with a command line profile option, LINE_OUT is assumed.
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- LINE_ADJ
-
The entry function inputs line adjacency primitives. Example: "-po LINE_ADJ"
-
If an output primitive is not also specified with a command line profile option, LINE_OUT is assumed.
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- TRIANGLE
-
The entry function inputs triangle primitives. Example: "-po TRIANGLE"
-
If an output primitive is not also specified with a command line profile option, TRIANGLE_OUT is assumed.
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- TRIANGLE_ADJ
-
The entry function inputs triangle adjacency primitives. Example: "-po TRIANGLE_ADJ"
-
If an output primitive is not also specified with a command line profile option, TRIANGLE_OUT is assumed.
- POINT_OUT
-
The entry function outputs point primitives. Example: "-po POINT_OUT"
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- LINE_OUT
-
The entry function outputs line primitives. Example: "-po LINE_OUT"
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
- TRIANGLE_OUT
-
The entry function outputs triangle primitives. Example: "-po TRIANGLE_OUT"
-
Normally this is option is better specified as a profile modifier preceding the Cg entry function.
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.
- samplerRBUF
-
Renderbuffer texture unit corresponding to OpenGL's GL_TEXTURE_RENDERBUFFER_NV target provided by the NV_explicit_multisample extension.
Sampling returns float vectors.
- isamplerRBUF
-
Renderbuffer texture unit corresponding to OpenGL's GL_TEXTURE_RENDERBUFFER_NV target provided by the NV_explicit_multisample extension.
Sampling returns int vectors.
- usamplerRBUF
-
Renderbuffer texture unit corresponding to OpenGL's GL_TEXTURE_RENDERBUFFER_NV target provided by the NV_explicit_multisample 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
Primitive Instance Input Semantic
Within a batch of primitives (defined in OpenGL by a glBegin/glEnd
sequence or an implied glBegin/glEnd performed by glDrawElements,
glDrawArrays, etc.) a counter tracks each assembled primitive instance.
The geometry shader has access to this counter through the INSTANCEID
semantic.
Binding Semantics Name Corresponding Data
INSTANCEID Integer instance ID of the primitive
within the current batch
The first primitive generated after a glBegin is numbered zero, and the
instance ID counter is incremented after every individual point, line,
or polygon primitive is processed. For QUADS and QUAD_STRIP primitives
that are decomposed into triangles, the instance ID is incremented after
each complete quad is processed. For POLYGON primitives, the instance
ID counter is zero. Restarting a primitive topology using the primitive
restart index has no effect on the instance ID counter.
Example:
int primID : INSTANCEID
Vertex Instance Input Semantic
The geometry shader can identify the vertex index (when using vertex
buffer objects) that sourced each vertex making up the primitive.
The vertex instance input semantic must be declared with the
AttribArray template-style syntax because a geometry shader accepts
an attribute array of vertex instance IDs.
Binding Semantics Name Corresponding Data
VERTEXID Integer ID of the vertex's index
for vertex pulling
The vertex ID is equal to value effectively passed to glArrayElement
(or routines that implicitly call glArrayElements such as glDrawElements
or glDrawArrays) when the vertex is specified, and is defined only if
vertex arrays are used with buffer objects (VBOs).
Example defining a varying parameter for the position vertex attribute:
AttribArray<int> vertexID : VERTEXID
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
PRIMITIVEID Input primitive ID (integer)
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-TEXUNIT31 Texture image unit
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
PRIMITIVEID Output primitive ID (integer)
LAYER Output layer (integer)
Output 0 through 5 for cube map faces
Output 0 through N for 2D texture arrays
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,
tex2DARRAYlod,
tex2DARRAYproj
The dimensions of a texture array level can be determined.
tex2DARRAYsize
See Also
gp4,
gp4vp,
gp4fp,
texBUF,
texBUFsize,
texRBUF,
texRBUFsize,
floatToRawIntBits,
floatToIntBits,
intBitsToFloat,
tex1DARRAY,
tex1DARRAYbias,
tex1DARRAYcmpbias,
tex1DARRAYlod,
tex1DARRAYcmplod,
tex1DARRAYproj,
tex1DARRAYsize,
tex2DARRAY,
tex2DARRAYbias,
tex2DARRAYlod,
tex2DARRAYproj,
tex2DARRAYsize
|