Cg Reference Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 1159 [warning: Documents this large are best viewed by clicking the View PDF Link!]

CG(Cg) Cg Topics CG(Cg)
NAME Cg −Amulti-platform, multi-API C−based programming language for GPUs
DESCRIPTION
Cg is a high-levelprogramming language designed to compile to the instruction sets of the programmable
portions of GPUs. While Cg programs have great flexibility in the way that theyexpress the computations
theyperform, the inputs, outputs, and basic resources available to those programs are dictated by where
theyexecute in the graphics pipeline. Other documents describe howtowrite Cg programs. This
document describes the library that application programs use to interact with Cg programs. This library
and its associated API is referred to as the Cg runtime.
DOCUMENTATION ORGANIZATION
Cg Topics
Cg Language Specification
Cg Commands
Cg Core Runtime API
Cg OpenGL Runtime API
Cg Direct3D11 Runtime API
Cg Direct3D10 Runtime API
Cg Direct3D9 Runtime API
Cg Direct3D8 Runtime API
Cg Profiles
Cg Standard Libary Routines
CgFX States
CgFX Sampler States
SEE ALSO
Cg_language, cgc, cgCreateContext, cgDestroyContext
perl v5.10.0 Cg Toolkit 3.0 1
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
Cg 1.2 RUNTIME API ADDITIONS
Version 1.2 of the Cg runtime adds a number of newcapabilities to the existing set of functionality from
previous releases. These newfeatures include functionality that makeitpossible to write programs that can
run more efficiently on the GPU,techniques that help hide some of the inherent limitations of some Cg
profiles on the GPU,and entrypoints that support newlanguage functionality in the Cg 1.2 release.
Parameter Literalization
The 1.2 Cg runtime makes it possible to denote some of the parameters to a program as having a fixed
constant value. This feature can lead to substantially more efficient programs in a number of cases. For
example, a program might have a block of code that implements functionality that is only used some of the
time:
float4 main(uniform float enableDazzle, ...) : COLOR {
if (enableDazzle) {
// do lengthy computation
}
else {
// do basic computation
}
}
Some hardware profiles don’tdirectly support branching (this includes all of the fragment program profiles
supported in this release), and have tohandle code likethe program by effectively following both sides of
the if() test. (Theystill compute the correct result in the end, just not very efficiently.)
However, ifthe ‘‘enableDazzle’’parameter is marked as a literal parameter and a value is provided for it,
the compiler can generate an optimized version of the program with the knowledge of ‘‘enableDazzle’’’ s
value, just generating GPU code for one of the twocases. This can lead to substantial performance
improvments. This feature also makes it easier to write general purpose shaders with a wide variety of
supported functionality,while only paying the runtime cost for the functionality provided.
This feature is also useful for parameters with numeric values. For example, consider a shader that
implements a diffuse reflection model:
float4 main(uniform float3 lightPos, uniform float3 lightColor,
uniform float3 Kd, float3 pos : TEXCOORD0,
float3 normal : TEXCOORD1) : COLOR
{
return Kd*lightColor*max(0., dot(normalize(lightPos−pos), normal));
}
If the ‘‘lightColor’’and ‘‘Kd’’parameters are set to literals, it is possible for the compiler to compute the
product ‘‘Kd * lightColor’’once, rather than once each time the program executes.
Givenaparameter handle, the cgSetParameterVariability() entrypoint sets the variability of a parameter:
void cgSetParameterVariability(CGparameter param, CGenum vary);
To set it to a literal parameter,the CG_LITERAL enumerant should be passed as the second parameter.
After a parameter has set to be a literal, the following routines should be used to set the parameter’svalue.
perl v5.10.0 Cg Toolkit 3.0 2
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
void cgSetParameter1f(CGparameter param, float x);
void cgSetParameter2f(CGparameter param, float x, float y);
void cgSetParameter3f(CGparameter param, float x, float y, float z);
void cgSetParameter4f(CGparameter param, float x, float y, float z,
float w);
void cgSetParameter1d(CGparameter param, double x);
void cgSetParameter2d(CGparameter param, double x, double y);
void cgSetParameter3d(CGparameter param, double x, double y, double z);
void cgSetParameter4d(CGparameter param, double x, double y, double z,
double w);
void cgSetParameter1fv(CGparameter param, const float *v);
void cgSetParameter2fv(CGparameter param, const float *v);
void cgSetParameter3fv(CGparameter param, const float *v);
void cgSetParameter4fv(CGparameter param, const float *v);
void cgSetParameter1dv(CGparameter param, const double *v);
void cgSetParameter2dv(CGparameter param, const double *v);
void cgSetParameter3dv(CGparameter param, const double *v);
void cgSetParameter4dv(CGparameter param, const double *v);
void cgSetMatrixParameterdr(CGparameter param, const double *matrix);
void cgSetMatrixParameterfr(CGparameter param, const float *matrix);
void cgSetMatrixParameterdc(CGparameter param, const double *matrix);
void cgSetMatrixParameterfc(CGparameter param, const float *matrix);
After a parameter has been set to be a literal, or after the value of a literal parameter has been changed, the
program must be compiled and loaded into the GPU,reg ardless of whether it had already been compiled.
This issue is discussed further in the section on program recompilation below.
Array Size Specification
The Cg 1.2 language also adds support for ‘‘unsized array’’variables; programs can be written to take
parameters that are arrays with an indeterminate size. The actual size of these arrays is then set via the Cg
runtime. This feature is useful for writing general-purpose shaders with a minimal performance penalty.
Forexample, consider a shader that computes shading givensome number of light sources. If the
information about each light source is stored in a struct LightInfo, the shader might be written as:
float4 main(LightInfo lights[], ...) : COLOR
{
float4 color = float4(0,0,0,1);
for (i = 0; i < lights.length; ++i) {
// add lights[i]'s contribution to color
}
return color;
}
The runtime can then be used to set the length of the lights[] array (and then to initialize the values of the
LightInfo structures.) As with literal parameters, the program must be recompiled and reloaded after a
parameter’sarray size is set or changes.
These twoentrypoints set the size of an unsized array parameter referenced by the givenparameter handle.
To set the size of a multidimensional unsized array,all of the dimensions’ sizes must be set simultaneously,
by providing them all via the pointer to an array of integer values.
void cgSetArraySize(CGparameter param, int size);
void cgSetMultiDimArraySize(CGparameter param, const int *sizes);
XXX what happens if these are called with an already-sized array?? XXX
perl v5.10.0 Cg Toolkit 3.0 3
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
To get the size of an array parameter,the cgGetArraySize() entrypoint can be used.
int cgGetArraySize(CGparameter param, int dimension);
Program Recompilation at Runtime
The Cg 1.2 runtime environment will allowautomatic and manual recompilation of programs. This
functionality is useful for multiple reasons :
Changing variability of parameters
Parameters may be changed from uniform variability to literal variability as described above.
Changing value of literal parameters
Changing the value of a literal parameter will require recompilation since the value is used at compile
time.
Resizing parameter arrays
Changing the length of a parameter array may require recompilation depending on the capabilities of
the profile of the program.
Binding sub-shader parameters
Sub-shader parameters are structures that overload methods that need to be provided at compile time;
theyare described below. Binding such parameters to program parameters will require recompilation.
See ‘‘Sub-Shaders’’for more information.
Recompilation can be executed manually by the application using the runtime or automatically by the
runtime.
The entry point:
void cgCompileProgram(CGprogram program);
causes the givenprogram to be recompiled, and the function:
CGbool cgIsProgramCompiled(CGprogram program);
reurns a boolean value indicating whether the current program needs recompilation.
By default, programs are automatically compiled when cgCreateProgram() or cgCreateProgramFromFile()
is called. This behavior can be controled with the entry point :
void cgSetAutoCompile(CGcontext ctx, CGenum flag);
Where flag is one of the following three enumerants :
CG_COMPILE_MANUAL
With this method the application is responsible for manually recompiling a program. It may check to
see if a program requires recompilation with the entry point cgIsProgramCompiled().
cgCompileProgram() can then be used to force compilation.
CG_COMPILE_IMMEDIATE
CG_COMPILE_IMMEDIATE will force recompilation automatically and immediately when a
program enters an uncompiled state.
CG_COMPILE_LAZY
This method is similar to CG_COMPILE_IMMEDIATE butwill delay program recompilation until the
program object code is needed. The advantage of this method is the reduction of extraneous
recompilations. The disadvantage is that compile time errors will not be encountered when the
program is enters the uncompiled state but will instead be encountered at some later time.
Forprograms that use features likeunsized arrays that can not be compiled until their array sizes are set, it
is good practice to change the default behavior of compilation to CG_COMPILE_MANUAL so that
perl v5.10.0 Cg Toolkit 3.0 4
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
cgCreateProgram() or cgCreateProgramFromFile() do not unnecessarily encounter and report compilation
errors.
Shared Parameters (context global parameters)
Version 1.2 of the runtime introduces parameters that may be shared across programs in the same context
via a newbinding mechanism. Once shared parameters are constructed and bound to program parameters,
setting the value of the shared parameter will automatically set the value of all of the program parameters
theyare bound to.
Shared parameters belong to a CGcontext instead of a CGprogram.Theymay be created with the
following newentry points :
CGparameter cgCreateParameter(CGcontext ctx, CGtype type);
CGparameter cgCreateParameterArray(CGcontext ctx, CGtype type,
int length);
CGparameter cgCreateParameterMultiDimArray(CGcontext ctx, CGtype type,
int dim, const int *lengths);
Theymay be deleted with :
void cgDestroyParameter(CGparameter param);
After a parameter has been created, its value should be set with the cgSetParameter*() routines described in
the literalization section above.
Once a shared parameter is created it may be associated with anynumber of program parameters with the
call:
void cgConnectParameter(CGparameter from, CGparameter to);
where ‘‘from’’isaparameter created with one of the cgCreateParameter() calls, and ‘‘to’’isaprogram
parameter.
Givenaprogram parameter,the handle to the shared parameter that is bound to it (if any) can be found with
the call:
CGparameter cgGetConnectedParameter(CGparameter param);
It returns NULL if no shared parameter has been connected to ‘‘param’’.
There are also calls that makeitpossible to find the set of program parameters to which a givenshared
parameter has been connected to. The entry point:
int cgGetNumConnectedToParameters(CGparameter param);
returns the total number of program parameters that ‘‘param’’has been conencted to, and the entry point:
CGparameter cgGetConnectedToParameter(CGparameter param, int index);
can be used to get CGparameter handles for each of the program parameters to which a shared parameter is
connected.
Ashared parameter can be unbound from a program parameter with :
void cgDisconnectParameter(CGparameter param);
The context in which a shared parameter was created can be returned with:
CGcontext cgGetParameterContext(CGparameter param);
And the entrypoint:
CGbool cgIsParameterGlobal(CGparameter param);
can be used to determine if a parameter is a shared (global) parameter.
perl v5.10.0 Cg Toolkit 3.0 5
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
Shader Interface Support
From the runtime’sperspective,shader interfaces are simply struct parameters that have a CGtype
associated with them. Forexample, if the following Cg code is included in some program source compiled
in the runtime :
interface FooInterface
{
float SomeMethod(float x);
}
struct FooStruct : FooInterface
{
float SomeMethod(float x);
{
return(Scale * x);
}
float Scale;
};
The named types FooInterface and FooStruct will be added to the context. Each one will have a unique
CGtype associated with it. The CGtype can be retrievedwith :
CGtype cgGetNamedUserType(CGprogram program, const char *name);
int cgGetNumUserTypes(CGprogram program);
CGtype cgGetUserType(CGprogram program, int index);
CGbool cgIsParentType(CGtype parent, CGtype child);
CGbool cgIsInterfaceType(CGtype type);
Once the CGtype has been retrieved, it may be used to construct an instance of the struct using
cgCreateParameter().Itmay then be bound to a program parameter of the parent type (in the above
example this would be FooInterface) using cgBindParameter().
Calling cgGetParameterType() on such a parameter will return the CG_STRUCT to keep backwards
compatibility with code that recurses parameter trees. In order to obtain the enumerant of the named type
the following entry point should be used :
CGtype cgGetParameterNamedType(CGparameter param);
The parent types of a givennamed type may be obtained with the following entry points :
int cgGetNumParentTypes(CGtype type);
CGtype cgGetParentType(CGtype type, int index);
If Cg source modules with differing definitions of named types are added to the same context, an error will
be thrown.
XXX update for newscoping/context/program local definitions stuff XXX
Updated Parameter Management Routines
XXX where should these go?
Some entrypoints from before have been updated in backwards compatible ways
CGparameter cgGetFirstParameter(CGprogram program, CGenum name_space);
CGparameter cgGetFirstLeafParameter(CGprogram program, CGenum name_space);
likecgGetNamedParameter,but limits search to the givenname_space (CG_PROGRAM or CG_GLOBAL)...
perl v5.10.0 Cg Toolkit 3.0 6
CG1_2_RUNTIME_CHANGES(Cg) Cg Topics CG1_2_RUNTIME_CHANGES(Cg)
CGparameter cgGetNamedProgramParameter(CGprogram program, CGenum name_space,
const char *name);
perl v5.10.0 Cg Toolkit 3.0 7
GLUT(Cg) Cg Topics GLUT(Cg)
TOPICglut −using Cg with the OpenGL Utility Toolkit (GLUT)
ABSTRACT
GLUT provides a cross-platform windowsystem API for writing OpenGL examples and demos. Forthis
reason, the Cg examples packaged with the Cg Toolkit rely on GLUT.
WINDOWS INSTALLATION
The Cg Toolkit installer for Windows provides a pre-compiled 32−bit (and 64−bit if selected) versions of
GLUT.GLUT is provided both as a Dynamic Link Library (DLL)and a static library.
The GLUT DLL is called glut32.dll and requires linking against glut32.lib.These 32−bit versions are
typically installed at:
c:\Program Files\NVIDIA Corporation\Cg\bin\glut32.dll
c:\Program Files\NVIDIA Corporation\Cg\lib\glut32.lib
The 64−bit (x64) versions are installed at:
c:\Program Files\NVIDIA Corporation\Cg\bin.x64\glut32.dll
c:\Program Files\NVIDIA Corporation\Cg\lib.x64\glut32.lib
As with any DLL in Windows, if you link your application with the GLUT DLL,running your application
requires that glut32.dll can be found when executing GLUT.
Alternatively you can link statically with GLUT.This can easily be done by defining the
GLUT_STATIC_LIB preprocessor macro before including GLUT’s <GL/glut.h> header file. This is typically
done by adding the −DGLUT_STATIC_LIB option to your compiler command line. When defined, a
#pragma in <GL/glut.h> requests the linker link against glutstatic.lib instead of glut32.lib.
The 32−bit and 64−bit versions of the GLUT static library are installed at:
c:\Program Files\NVIDIA Corporation\Cg\lib\glutstatic.lib
c:\Program Files\NVIDIA Corporation\Cg\lib.x64\glutstatic.lib
SEE ALSO
TBD
perl v5.10.0 Cg Toolkit 3.0 8
TRACE(Cg) Cg Topics TRACE(Cg)
TOPICTrace API Trace for Cg, CgGL, OpenGL and GLUT
INTRODUCTION
The NVIDIA Cg Toolkit provides trace wrapper libraries for logging API calls to Cg, CgGL, OpenGL and
GLUT libraries. The log includes nested function call information and function parameter and return
values. The logged data can be useful for debugging, trouble shooting and reporting issues.
The libraries are experimental and require some software development expertise.
REQUIREMENTS AND LIMITATIONS
Trace supports Cg version 2.2.010 (October 2009) and onwards. Cg, CgGL, OpenGL, and GLUT trace
libraries are included.
CgD3D8, CgD3D9, CgD3D10 and CgD3D10 are not currently supported.
Cg and GLUT are supported for OSX,but currently not OpenGL.
Trace captures calls and parameters, but not the contents of files referenced by calls such as
cgCreateProgramFromFile. Archive the logs, .cg and .cgfx files together into a .zip or .tgz for later
reference.
BUILDING
The trace library source code, makefile and Visual Studio projects are located in the examples/Tools/trace
directory of the Cg Toolkit installation. Pre-built binaries are also included.
The trace library components are as follows.
trace.c }
traceOutput.c } −−−−> trace library
traceFilter.c }
traceTime.c }
b64.c }
traceCg.c −−−−> Cg wrapper library
traceCgGL.c −−−−> CgGL wrapper library
traceGLUT.c −−−−> GLUT wrapper library
traceGL.c }
traceGLX.c } −−−−> GL wrapper library
traceWGL.c }
DEPLOYMENT
ENVIRONMENT VARIABLES
The CG_TRACE_FILE and CG_TRACE_ERROR environment variables specify paths to the trace log and
error log. The twofile names can be the same. Otherwise stdout and stderr are used.
The CG_TRACE_CG_LIBRARY and CG_TRACE_CGGL_LIBRARY environment variables specify the
path of the target Cg and CgGL libraries. The CG_TRACE_GL_LIBRARY environment variable specifies
the path of the target OpenGL library.The CG_TRACE_GLUT_LIBRARY environment variable specifies
the path of the target OpenGL library.
Otherwise, default system locations are used.
The CG_TRACE_BLOB_LIMIT environment variable limits the size of rawdata logged. Just the pointer
value is stored for parameters that exceed the limit. This variable is typically set to avoid capturing texture
image data. By default there is no limit and all parameter data is logged.
The CG_TRACE_TIMESTAMP environment variable specifies timestamp logging for each call. Anynon-
zero integer value enables timestamp tracing. By default timestamp logging is disabled.
perl v5.10.0 Cg Toolkit 3.0 9
TRACE(Cg) Cg Topics TRACE(Cg)
Recommended settings:
CG_TRACE_FILE traceLog.txt
CG_TRACE_ERROR traceError.txt
WINDOWS
Select a trace directory to copythe trace libraries to. This can be the same as the application directory.The
directory of the target .exe is recommended.
Copy trace.dll to the trace directory.The API-specific trace libraries depend on trace.dll.The other trace
libraries are optional.
Optionally copytrace cg.dll and cgGL.dll to the trace directory.The CG_BIN_PATH(32−bit) or
CG_BIN64_PATH(64−bit) environment variables are used unless CG_TRACE_CG_LIBRARY or
CG_TRACE_CGGL_LIBRARY are defined.
Optionally copytrace opengl32.dll to the trace directory.
Optionally copytrace glut32.dll to the trace directory.
LINUX and SOLARIS
Set the LD_LIBRARY_PATHenvironment variable to the directory containing the trace libraries. The API-
specific trace libraries depend on libtrace.so.The other trace libraries are optional.
OSX
Set the DYLD_LIBRARY_PATHenvironment variable to the directory containing the trace libraries. These
are installed to /Developer/NVIDIA/Cg/examples/Tools/trace by default. The API-specific trace libraries
depend on libtrace.dylib.The Cg and GLUT trace frameworks are both optional. The symlinks
libCg.dylib and libGLUT.dylib specify the full path of the native frameworks.
CREDITS AND LICENCES
The core trace library uses the base64 C implementation of Base64 Content-Transfer-Encoding standard
(also known as RFC1113)byBob Trower,Trantor Standard Systems Inc.
The Cg trace library uses the uthash C hash table implementation by TroyD.Hanson.
perl v5.10.0 Cg Toolkit 3.0 10
WIN64(Cg) Cg Topics WIN64(Cg)
TOPICwin64 −using Cg with 64−bit Windows
ABSTRACT
The Cg Toolkit for Windows installs versions of the Cg compiler and runtime libraries for both 32−bit
(x86) and 64−bit (x64) compilation. This topic documents howtouse Cg for 64−bit Windows.
64−BIT INSTALLATION
The Cg Toolkit installer (CgSetup.exe)installs the 32−bit version of the Cg compiler and the Cg runtime
libraries by default. Toinstall the 64−bit support, you must check the component labeled ‘‘Files to run and
link 64−bit (x64) Cg-based applications’’during your installation.
If you’ve forgotten to install the 64−bit component, you can re-run the Cg Toolkit installer and check the
64−bit component.
EXAMPLES
The Cg Toolkit includes Visual Studio .NET 2003 projects intended to compile 64−bit versions of the Cg
Toolkit examples.
These project files match the pattern *_x64.vcproj
The solution files that collect these projects matches the pattern *_x64.sln
To use these project files with Visual Studio .NET 2003, you must also install the latest Windows Platform
SDK to obtain 64−bit compiler tools and libraries.
Once the Platform SDK is installed, from the Start menu navigate to start a Windows shell for the 64−bit
Windows Build Environment. This shell is started with the correct environment variables (Path, Include,
and Lib) for the 64−bit compiler tools and libraries.
Nowrun devenv.exe with the /useenvcommand line option that forces Visual Studio to pick up Path,
Include, and Lib settings from the shell’senvironment. When the Visual Studio IDE appears, select
File−>Open−>Project... and locate one of the *_x64.sln files for the Cg examples. These are usually under:
c:\Program Files\NVIDIA Corporation\Cg\examples
When you open a *_x64.vcproj solution, it references a number of *_x64.vcproj projects. These have a
‘‘Debug x64’’and ‘‘Release x64’’configuration to build.
HINTS Remember to link with BufferOverflowU.lib because of the /GS option to help detect string overflow
runtime errors because Microsoft has enabled this option by default in its 64−bit compilers. See:
http://support.microsoft.com/?id=894573
IA64 SUPPORT
The Cg Toolkit does not provide 64−bit support for Intel’sItanium architecture.
SEE ALSO
TBD
perl v5.10.0 Cg Toolkit 3.0 11
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Cg Language Specification
Copyright (c) 2001−2011 NVIDIA Corp.
This is version 2.0 of the Cg Language specification. This language specification describes version 2.0 of
the Cg language
Language Overview
The Cg language is primarily modeled on ANSI C, but adopts some ideas from modern languages such as
C++ and Java,and from earlier shading languages such as RenderMan and the Stanford shading language.
The language also introduces a fewnew ideas. In particular,itincludes features designed to represent data
flowinstream-processing architectures such as GPUs. Profiles, which are specified at compile time, may
subset certain features of the language, including the ability to implement loops and the precision at which
certain computations are performed.
LikeC,Cgisdesigned primarily as a low-levelprogramming language. Features are provided that map as
directly as possible to hardware capabilities. Higher levelabstractions are designed primarily to not get in
the way of writing code that maps directly to the hardware in the most efficient way possible. The changes
in the language from C primarily reflect differences in the way GPU hardware works compared to
conventional CPUs. GPUs are designed to run large numbers of small threads of processing in parallel,
each running a copyofthe same program on a different data set.
Differences from ANSI C
Cg was developed based on the ANSI-C language with the following major additions, deletions, and
changes. (This is a summary-more detail is provided later in this document):
Silent Incompatibilities
Most of the changes from ANSI Care either omissions or additions, but there are a fewpotentially silent
incompatibilities. These are changes within Cg that could cause a program that compiles without errors to
behave inamanner different from C:
•The type promotion rules for constants are different when the constant is not explicitly typed using a
type cast or type suffix. In general, a binary operation between a constant that is not explicitly typed
and a variable is performed at the variable’sprecision, rather than at the constant’sdefault precision.
•Declarations of struct perform an automatic typedef (as in C++)and thus could override a
previously declared type.
•Arrays are first-class types that are distinct from pointers. As a result, array assignments semantically
perform a copyoperation for the entire array.
Similar Operations That Must be Expressed Differently
There are several changes that force the same operation to be expressed differently in Cg than in C:
•ABoolean type, bool,isintroduced, with corresponding implications for operators and control
constructs.
•Arrays are first-class types because Cg does not support pointers.
•Functions pass values by value/result, and thus use an out or inout modifier in the formal parameter
list to return a parameter.Bydefault, formal parameters are in,but it is acceptable to specify this
explicitly.Parameters can also be specified as in out,which is semantically the same as inout.
Cfeatures not present in Cg
•Language profiles (described in the Profiles section) may subset language capabilities in a variety of
ways. In particular,language profiles may restrict the use of for and while loops. Forexample, some
profiles may only support loops that can be fully unrolled at compile time.
•Reserved keywords goto,switch,case,and default are not supported, nor are labels.
perl v5.10.0 Cg Toolkit 3.0 12
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
•Pointers and pointer-related capabilities, such as the &and −> operators, are not supported.
•Arrays are supported, but with some limitations on size and dimensionality.Restrictions on the use of
computed subscripts are also permitted. Arrays may be designated as packed.The operations
allowed on packed arrays may be different from those allowed on unpacked arrays. Predefined
packed types are provided for vectors and matrices. It is strongly recommended that these predefined
types be used.
•There is no enum or union.
•There are no bit-field declarations in structures.
•All integral types are implicitly signed, there is no signed keyword.
Cg features not present in C
•Abinding semantic may be associated with a structure tag, a variable, or a structure element to denote
that object’smapping to a specific hardware or API resource. Binding semantics are described in the
Binding Semantics section.
•There is a built-in swizzle operator: .xyzw or .rgba for vectors. This operator allows the
components of a vector to be rearranged and also replicated. It also allows the creation of a vector
from a scalar.
•For an lvalue, the swizzle operator allows components of a vector or matrix to be selectively written.
•There is a similar built-in swizzle operator for matrices:
._m<row><col>[_m<row><col>][...].This operator allows access to individual matrix
components and allows the creation of a vector from elements of a matrix. Forcompatibility with
DirectX 8 notation, there is a second form of matrix swizzle, which is described later.
•Numeric data types are different. Cg’sprimary numeric data types are float,half,and fixed.
Fragment profiles are required to support all three data types, but may choose to implement half
and/or fixed at float precision. Vertexprofiles are required to support half and float,but may
choose to implement half at float precision. Vertexprofiles may omit support for fixed
operations, but must still support definition of fixed variables. Cg allows profiles to omit run-time
support for int and other integer types. Cg allows profiles to treat double as float.
•Manyoperators support per-element vector operations.
•The ?:,||,&&,!,and comparison operators can be used with bool vectors to perform multiple
conditional operations simultaneously.The side effects of all operands to vector ?:,||,and &&
operators are always executed.
•Non-static global variables, and parameters to top-levelfunctions (such as main())may be designated
as uniform.Auniform variable may be read and written within a program, just likeany other
variable. However, the uniform modifier indicates that the initial value of the variable/parameter is
expected to be constant across a large number of invocations of the program.
•Anewset of sampler* types represents handles to texture sampler units.
•Functions may have default values for their parameters, as in C++.These defaults are expressed using
assignment syntax.
•Function and operator overloading is supported.
•Variables may be defined anywhere before theyare used, rather than just at the beginning of a scope as
in C. (That is, we adopt the C++ rules that govern where variable declarations are allowed.) Variables
may not be redeclared within the same scope.
•Vector constructors, such as the form float4(1,2,3,4),and matrix constructors may be used
anywhere in an expression.
•Astruct definition automatically performs a corresponding typedef,asinC
++.
perl v5.10.0 Cg Toolkit 3.0 13
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
•C
++−style // comments are allowed in addition to C−style /* ... */ comments.
•Alimited form of inheritance is supported; interface types may be defined which contain only
member functions (no data members) and struct types may inherit from a single interface and
provide specific implementations for all the member functions. Interface objects may not be created; a
variable of interface type may have any implementing struct type assigned to it.
Detailed Language Specification
Definitions
The following definitions are based on the ANSI Cstandard:
Object
An object is a region of data storage in the execution environment, the contents of which can represent
values. When referenced, an object may be interpreted as having a particular type.
Declaration
Adeclaration specifies the interpretation and attributes of a set of identifiers.
Definition
Adeclaration that also causes storage to be reserved for an object or code that will be generated for a
function named by an identifier is a definition.
Profiles
Compilation of a Cg program, a top-levelfunction, always occurs in the context of a compilation profile.
The profile specifies whether certain optional language features are supported. These optional language
features include certain control constructs and standard library functions. The compilation profile also
defines the precision of the float,half,and fixed data types, and specifies whether the fixed and
sampler* data types are fully or only partially supported. The profile also specifies the environment in
which the program will be run. The choice of a compilation profile is made externally to the language, by
using a compiler command-line switch, for example.
The profile restrictions are only applied to the top-levelfunction that is being compiled and to anyvariables
or functions that it references, either directly or indirectly.Ifafunction is present in the source code, but
not called directly or indirectly by the top-levelfunction, it is free to use capabilities that are not supported
by the current profile.
The intent of these rules is to allowasingle Cg source file to contain manydifferent top-levelfunctions that
are targeted at different profiles. The core Cg language specification is sufficiently complete to allowall of
these functions to be parsed. The restrictions provided by a compilation profile are only needed for code
generation, and are therefore only applied to those functions for which code is being generated. This
specification uses the word ‘‘program’’torefer to the top-levelfunction, anyfunctions the top-level
function calls, and anyglobal variables or typedef definitions it references.
Each profile must have a separate specification that describes its characteristics and limitations.
This core Cg specification requires certain minimum capabilities for all profiles. In some cases, the core
specification distinguishes between vertex-program and fragment-program profiles, with different minimum
capabilities for each.
Declarations and declaration specifiers.
ACgprogram consists of a series of declarations, each of which declares one or more variables or
functions, or declares and defines a single function. Each declaration consists of zero or more declaration
specifiers, a type, and one or more declarators. Some of the declaration specifiers are the same as those in
ANSI C; others are newtoCg
const
Marks a variable as a constant that cannot be assigned to within the program. Unless this is combined
with uniform or varying,the declarator must include an initializer to give the variable a value.
perl v5.10.0 Cg Toolkit 3.0 14
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
extern
Marks this declaration as solely a declaration and not a definition. There must be a non−extern
declaration elsewhere in the program.
in Only usable on parameter and varying declarations. Marks the parameter or varying as an input to
the function or program. Function parameters with no in,out,orinout specifier are implicitly in
inline
Only usable on a function definition. Tells the compiler that it should always inline calls to the
function if at all possible.
inout
Only usable on parameter and varying declarations. Marks the parameter or varying as both an
input to and an output from the function or program
static
Only usable on global variables. Marks the variable as ’private’ to the program, and not visible
externally.Cannot be combined with uniform or varying
out Only usable on parameter and varying declarations. Marks the parameter or varying as an output
from the function or program
uniform
Only usable on global variables and parameters to the top-levelmain function of a program. If
specified on a non-top-levelfunction parameter it is ignored. The intent of this rule is to allowa
function to serveaseither a top-levelfunction or as one that is not.
Note that uniform variables may be read and written just likenon−uniform variables. The
uniform qualifier simply provides information about howthe initial value of the variable is to be
specified and stored, through a mechanism external to the language.
varying
Only usable on global variables and parameters to the top-levelmain function of a program. If
specified on a non-top-levelfunction parameter it is ignored.
profile name
The name of anyprofile (or profile wildcard —see Profiles) may be used as a specifier on any
function declaration. It defines a function that is only visible in the corresponding profiles.
The specifiers uniform and varying specify howdata is transferred between the rest of the world and a
Cg program. Typically,the initial value of a uniform variable or parameter is stored in a different class
of hardware register for a varying.Furthermore, the external mechanism for specifying the initial value
of uniform variables or parameters may be different than that used for specifying the initial value of
varying variables or parameters. Parameters qualified as uniform are normally treated as persistent
state, while varying parameters are treated as streaming data, with a newvalue specified for each stream
record (such as within a vertexarray).
Non−static global variables are treated as uniform by default, while parameters to the top-level
function are treated as varying by default.
Each declaration is visible (‘‘in scope’’) from the point of its declarator until the end of the enclosing block
or the end of the compilation unit if outside anyblock. Declarations in named scopes (such as structs and
interfaces) may be visible outside of their scope using explicit scope qualifiers, as in C++.
Semantics
Each declarator in a declaration may optionally have a semantic specified with it. Asemantic specifies how
the variable is connected to the environment in which the program runs. All semantics are profile specific
(so theyhav e different meanings in different profiles), though there is some attempt to be consistent across
profiles. Each profile specification must specify the set of semantics which the profile understands, as well
as what behavior occurs for anyother unspecified semantics.
perl v5.10.0 Cg Toolkit 3.0 15
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Function Declarations
Functions are declared essentially as in C. Afunction that does not return a value must be declared with a
void return type. Afunction that takes no parameters may be declared in one of twoways:
As in C, using the void keyword:
functionName(void)
With no parameters at all:
functionName()
Functions may be declared as static.Ifso, theymay not be compiled as a program and are not visible
externally
Function overloading and optional arguments
Cg supports function overloading; that is you may define multiple functions with the same name. The
function actually called at anygiv encall site is based on the types of the arguments at that call site; the
definition that best matches is called. See the function overloading section for the precise rules. Trailing
arguments with initializers are optional arguments; defining a function with optional arguments is
equivalent to defining multiple overloaded functions that differ by having and not having the optional
argument. The value of the initializer is used only for the version that does not have the argument and is
ignored if the argument is present.
Overloading of Functions by Profile
Cg supports overloading of functions by compilation profile. This capability allows a function to be
implemented differently for different profiles. It is also useful because different profiles may support
different subsets of the language capabilities, and because the most efficient implementation of a function
may be different for different profiles.
The profile name must precede the return type name in the function declaration. For example, to define two
different versions of the function myfunc for the profileA and profileB profiles:
profileA float myfunc(float x) {...};
profileB float myfunc(float x) {...};
If a type is defined (using a typedef)that has the same name as a profile, the identifier is treated as a type
name, and is not available for profile overloading at anysubsequent point in the file.
If a function definition does not include a profile, the function is referred to as an ‘‘open-profile’’function.
Open-profile functions apply to all profiles.
Several wildcard profile names are defined. The name vs matches anyvertexprofile, while the name ps
matches anyfragment or pixel profile. The names ps_1 and ps_2 match any DX8 pixel shader 1.x profile,
or DX9 pixel shader 2.x profile, respectively.Similarly,the names vs_1 and vs_2 match any DX vertex
shader 1.x or 2.x, respectively.Additional valid wildcard profile names may be defined by individual
profiles.
In general, the most specific version of a function is used. More details are provided in the section on
function overloading, but roughly speaking, the search order is the following:
1. version of the function with the exact profile overload
2. version of the function with the most specific wildcard profile overload (e.g. vs,‘‘ps_1’’)
3. version of function with no profile overload
This search process allows generic versions of a function to be defined that can be overridden as needed for
particular hardware.
perl v5.10.0 Cg Toolkit 3.0 16
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Syntax for Parameters in Function Definitions
Functions are declared in a manner similar to C, but the parameters in function definitions may include a
binding semantic (discussed later) and a default value.
Each parameter in a function definition takes the following form:
<declspecs> <type> identifier [: <binding_semantic>] [= <default>]
<default >isanexpression that resolves to a constant at compile time.
Default values are only permitted for uniform parameters, and for in parameters to non top-level
functions.
Function Calls
Afunction call returns an rvalue. Therefore, if a function returns an array,the array may be read but not
written. For example, the following is allowed:
y=myfunc(x)[2];
But, this is not:
myfunc(x)[2] = y;
Formultiple function calls within an expression, the calls can occur in anyorder — it is undefined.
Types
Cg’stypes are as follows:
•The int type is preferably 32−bit two’scomplement. Profiles may optionally treat int as float.
•The unsigned type is preferably a 32−bit ordinal value. unsigned may also be used with other
integer types to makedifferent sized unsigned values
•The char,short,and long types are two’scomplement integers of various sizes. The only
requirement is that char is no larger that short,short is no larger than int and long is at least
as large as int
•The float type is as close as possible to the IEEE single precision (32−bit) floating point format.
Profiles must support the float data type.
•The half type is lower-precision IEEE-likefloating point. Profiles must support the half type, but
may choose to implement it with the same precision as the float type.
•The fixed type is a signed type with a range of at least [−2,2) and with at least 10 bits of fractional
precision. Overflowoperations on the data type clamp rather than wrap. Fragment profiles must
support the fixed type, but may implement it with the same precision as the half or float types.
Vertexprofiles are required to provide partial support (as defined below) for the fixed type. Vertex
profiles have the option to provide full support for the fixed type or to implement the fixed type
with the same precision as the half or float types.
•The bool type represents Boolean values. Objects of bool type are either true or false.
•The cint type is 32−bit two’scomplement. This type is meaningful only at compile time; it is not
possible to declare objects of type cint.
•The cfloat type is IEEE single-precision (32−bit) floating point. This type is meaningful only at
compile time; it is not possible to declare objects of type cfloat.
•The void type may not be used in anyexpression. It may only be used as the return type of functions
that do not return a value.
•The sampler* types are handles to texture objects. Formal parameters of a program or function may
be of type sampler*.Noother definition of sampler* variables is permitted. A sampler*
variable may only be used by passing it to another function as an in parameter.Assignment to
sampler* variables is not permitted, and sampler* expressions are not permitted.
perl v5.10.0 Cg Toolkit 3.0 17
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
The following sampler types are always defined: sampler,sampler1D,sampler2D,
sampler3D,samplerCUBE,samplerRECT.
The base sampler type may be used in anycontext in which a more specific sampler type is valid.
However, a sampler variable must be used in a consistent way throughout the program. For
example, it cannot be used in place of both a sampler1D and a sampler2D in the same program.
The sampler type is deprecated and only provided for backwards compatibility with Cg 1.0
Fragment profiles are required to fully support the sampler,sampler1D,sampler2D,
sampler3D,and samplerCUBE data types. Fragment profiles are required to provide partial
support (as defined below) for the samplerRECT data type and may optionally provide full support
for this data type.
Vertexprofiles are required to provide partial support for the six sampler data types and may
optionally provide full support for these data types.
•Anarray type is a collection of one or more elements of the same type. An array variable has a single
index.
•Some array types may be optionally designated as packed,using the packed type modifier.The
storage format of a packed type may be different from the storage format of the corresponding
unpacked type. The storage format of packed types is implementation dependent, but must be
consistent for anyparticular combination of compiler and profile. The operations supported on a
packed type in a particular profile may be different than the operations supported on the corresponding
unpacked type in that same profile. Profiles may define a maximum allowable size for packed arrays,
butmust support at least size 4 for packed vector (1D array) types, and 4x4 for packed matrix (2D
array) types.
•When declaring an array of arrays in a single declaration, the packed modifier refers to all of the
arrays. However, itispossible to declare an unpacked array of packed arrays by declaring the first
levelofarray in a typedef using the packed keyword and then declaring an array of this type in a
second statement. It is not possible to declare a packed array of unpacked arrays.
•For anysupported numeric data type TYPE,implementations must support the following packed array
types, which are called vector types.Type identifiers must be predefined for these types in the global
scope:
typedef packed TYPE TYPE1[1];
typedef packed TYPE TYPE2[2];
typedef packed TYPE TYPE3[3];
typedef packed TYPE TYPE4[4];
Forexample, implementations must predefine the type identifiers float1,float2,float3,
float4,and so on for anyother supported numeric type.
•For anysupported numeric data type TYPE,implementations must support the following packed array
types, which are called matrix types.Implementations must also predefine type identifiers (in the
global scope) to represent these types:
packed TYPE1 TYPE1x1[1];
packed TYPE2 TYPE1x2[1];
packed TYPE3 TYPE1x3[1];
packed TYPE4 TYPE1x4[1];
packed TYPE1 TYPE2x1[2];
packed TYPE2 TYPE2x2[2];
packed TYPE3 TYPE2x3[2];
packed TYPE4 TYPE2x4[2];
packed TYPE1 TYPE3x1[3];
packed TYPE2 TYPE3x2[3];
packed TYPE3 TYPE3x3[3];
perl v5.10.0 Cg Toolkit 3.0 18
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
packed TYPE4 TYPE3x4[3];
packed TYPE1 TYPE4x1[4];
packed TYPE2 TYPE4x2[4];
packed TYPE3 TYPE4x3[4];
packed TYPE4 TYPE4x4[4];
Forexample, implementations must predefine the type identifiers float2x1,float3x3,
float4x4,and so on. Atypedef follows the usual matrix-naming convention of
TYPErows_X_columns.Ifwedeclare float4x4 a,then
a[3] is equivalent to a._m30_m31_m32_m33
Both expressions extract the third rowofthe matrix.
•Implementations are required to support indexing of vectors and matrices with constant indices.
•Astruct type is a collection of one or more members of possibly different types. It may include
both function members (methods) and data members (fields).
Struct and Interface types
Interface types are defined with a interface keyword in place of the normal struct keyword. Interface types
may only declare member functions, not data members. Interface member functions may only be declared,
not defined (no default implementations in C++ parlance).
Struct types may inherit from a single interface type, and must define an implementation member function
for every member function declared in the interface type.
Partial Support of Types
This specification mandates ‘‘partial support’’for some types. Partial support for a type requires the
following:
•Definitions and declarations using the type are supported.
•Assignment and copyofobjects of that type are supported (including implicit copies when passing
function parameters).
•Top-levelfunction parameters may be defined using that type.
If a type is partially supported, variables may be defined using that type but no useful operations can be
performed on them. Partial support for types makes it easier to share data structures in code that is targeted
at different profiles.
Type Categories
•The signed integral type category includes types cint,char,short,int,and long.
•The unsigned integral type category includes types unsigned char,unsigned short,
unsigned int,and unsigned long.unsigned is the same as unsigned int
•The integral category includes both signed integral and unsigned integral types
•The floating type category includes types cfloat,float,half,and fixed (Note that floating
really means floating or fixed/fractional.)
•The numeric type category includes integral and floating types.
•The compile-time type category includes types cfloat and cint.These types are used by the
compiler for constant type conversions.
•The dynamic type category includes all interface and unsized array types
•The concrete type category includes all types that are not included in the compile-time and dynamic
type category.
perl v5.10.0 Cg Toolkit 3.0 19
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
•The scalar type category includes all types in the numeric category,the bool type, and all types in the
compile-time category.Inthis specification, a reference to a category type (such as a reference to a
numeric type) means one of the types included in the category (such as float,half,orfixed).
Constants
Constant literals are defined as in C, including an optional 0or 0x prefix for octal or hexadecimal
constants, and eexponent suffix for floating point constants. A constant may be explicitly typed or
implicitly typed. Explicit typing of a constant is performed, as in C, by suffixing the constant with a one or
twocharacters indicating the type of the constant:
dfor double
ffor float
hfor half
ifor int
lfor long
sfor short
tfor char
ufor unsigned,which may also be followed by s,t,i,orl
xfor fixed
Anyconstant that is not explicitly typed is implicitly typed. If the constant includes a decimal point or an
’e’ exponent suffix, it is implicitly typed as cfloat.Ifitdoes not include a decimal point, it is implicitly
typed as cint.
By default, constants are base 10. Forcompatibility with C, integer hexadecimal constants may be
specified by prefixing the constant with 0x,and integer octal constants may be specified by prefixing the
constant with 0.
Compile-time constant folding is preferably performed at the same precision that would be used if the
operation were performed at run time. Some compilation profiles may allowsome precision flexibility for
the hardware; in such cases the compiler should ideally perform the constant folding at the highest
hardware precision allowed for that data type in that profile.
If constant folding cannot be performed at run-time precision, it may optionally be performed using the
precision indicated belowfor each of the numeric datatypes:
float s23e8 (‘‘fp32’’) IEEE single precision floating point
half s10e5 (‘‘fp16’’) floating point w/ IEEE semantics
fixedS1.10 fixed point, clamping to [−2, 2)
double
s52e11 (‘‘fp64’’) IEEE double precision floating point
int signed 32 bit twos-complement integer
char signed 8 bit twos-complement integer
shortsigned 16 bit twos-complement integer
long signed 64 bit twos-complement integer
perl v5.10.0 Cg Toolkit 3.0 20
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Type Conversions
Some type conversions are allowed implicitly,while others require an cast. Some implicit conversions may
cause a warning, which can be suppressed by using an explicit cast. Explicit casts are indicated using
C−style syntax (e.g., casting variable to the float4 type may be achievedvia
‘‘(float4)variablename’’).
Scalar conversions
Implicit conversion of anyscalar numeric type to anyother scalar numeric type is allowed. A warning
may be issued if the conversion is implicit and it is possible that precision is lost. implicit conversion
of anyscalar object type to anycompatible scalar object type is also allowed. Conversions between
incompatible scalar object types or object and numeric types are not allowed, evenwith an explicit
cast. ‘‘sampler’’iscompatible with ‘‘sampler1D’’, ‘‘sampler2D’’, ‘‘sampler3D’’, ‘‘samplerCube’’, and
‘‘samplerRECT’’. No other object types are compatible (‘‘sampler1D’’isnot compatible with
‘‘sampler2D’’, eventhough both are compatible with ‘‘sampler’’).
Scalar types may be implicitly converted to vectors and matrixes of compatible type. The scalar will
be replicated to all elements of the vector or matrix. Scalar types may also be explicitly cast to
structure types if the scalar type can be legally cast to every member of the structure.
Vector conversions
Vectors may be converted to scalar types (selects the first element of the vector). A warning is issued
if this is done implicitly.Avector may also be implicitly converted to another vector of the same size
and compatible element type.
Avector may be converted to a smaller compatible vector,oramatrix of the same total size, but a
warning if issued if an explicit cast is not used.
Matrix conversions
Matrixes may be converted to a scalar type (selects to 0,0 element). As with vectors, this causes a
warning if its done implicitly.Amatrix may also be converted implicitly to a matrix of the same size
and shape and compatible element type
AMatrix may be converted to a smaller matrix type (selects the upper− left submatrix), or to a vector
of the same total size, but a warning is issued if an explicit cast is not used.
Structure conversions
astructure may be explicitly cast to the type of its first member,ortoanother structure type with the
same number of members, if each member of the struct can be converted to the corresponding member
of the newstruct. No implicit conversions of struct types are allowed.
Array conversions
An array may be explicitly converted to another array type with the same number of elements and a
compatible element type. Acompatible element type is anytype to which the element type of the
initial array may be implicitly converted to. No implicit conversions of array types are allowed.
Source type
|Scalar | Vector | Matrix | Struct | Array |
T−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
aScalar | A|W|W|E(3) | −|
r−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
gVector | A|A/W(1) | W(2) | E(3) | E(6) |
e−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
tMatrix | A|W(2) | A/W(1) | E(3) | E(7) |
−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
tStruct | E|E(4) | E(4) | E(4/5) | E(4) |
y−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
pArray | −|E(6) | E(7) | E(3) | E(6) |
e−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+−−−−−−−−+
perl v5.10.0 Cg Toolkit 3.0 21
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
A=allowed implicitly or explicitly
W=allowed, but warning issued if implicit
E=only allowed with explicit cast
−=not allowed
notes
(1) not allowed if target is larger than source. Warning if
target is smaller than source
(2) only allowed if source and target are the same total size
(3) only if the first member of the source can be converted to
the target
(4) only if the target struct contains a single field of the
source type
(5) only if both source and target have the same number of
members and each member of the source can be converted
to the corresponding member of the target.
(6) Source and target sizes must be the same and element types
must be compatible
(7) Array type must be an array of vectors that matches the
matrix type.
Explicit casts are:
•compile-time type when applied to expressions of compile-time type.
•numeric type when applied to expressions of numeric or compile-time types.
•numeric vector type when applied to another vector type of the same number of elements.
•numeric matrix type when applied to another matrix type of the same
number of rows and columns.
Type Equivalency
Type T1 is equivalent to type T2 if anyofthe following are true:
•T2isequivalent to T1.
•T1and T2 are the same scalar,vector,orstructure type. Apacked array type is not equivalent to the
same size unpacked array.
•T1isatypedef name of T2.
•T1and T2 are arrays of equivalent types with the same number of elements.
•The unqualified types of T1 and T2 are equivalent, and both types have the same qualifications.
•T1and T2 are functions with equivalent return types, the same number of parameters, and all
corresponding parameters are pair-wise equivalent.
Type-Promotion Rules
The cfloat and cint types behave like float and int types, except for the usual arithmetic
conversion behavior (defined below) and function-overloading rules (defined later).
The usual arithmetic conversions for binary operators are defined as follows:
1. If one operand is cint it is converted to the other type
2. If one operand is cfloat and the other is floating,the cfloat is converted to the other type
3. If both operands are floating then the smaller type is converted to the larger type
4. If one operand is floating and the other is integral,the integral argument is converted to the floating
type.
perl v5.10.0 Cg Toolkit 3.0 22
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
5. If both operands are integral the smaller type is converted to the larger type
6. If one operand is signed integral while the other is unsigned integral and theyare the same size, the
signed type is converted to unsigned.
Note that conversions happen prior to performing the operation.
Assignment
Assignment of an expression to a concrete typed object converts the expression to the type of the object.
The resulting value is then assigned to the object or value.
The value of the assignment expressions (=,*=,and so on) is defined as in C:
An assignment expression has the value of the left operand after the assignment but is not an lvalue. The
type of an assignment expression is the type of the left operand unless the left operand has a qualified type,
in which case it is the unqualified version of the type of the left operand. The side effect of updating the
stored value of the left operand occurs between the previous and the next sequence point.
An assignment of an expression to a dynamic typed object is only possible if the type of the expression is
compatible with the dynamic object type. The object will then takeonthe type of the expression assigned
to it until the next assignment to it.
‘‘Smearing’’ofScalars to Vectors
If a binary operator is applied to a vector and a scalar,the scalar is automatically type-promoted to a same-
sized vector by replicating the scalar into each component. The ternary ?: operator also supports
smearing. The binary rule is applied to the second and third operands first, and then the binary rule is
applied to this result and the first operand.
Namespaces
Just as in C, there are twonamespaces. Each has multiple scopes, as in C.
•Tag namespace, which consists of struct tags
•Regular namespace:
−typedef names (including an automatic typedef from a struct declaration)
−variables
−function names
Arrays and Subscripting
Arrays are declared as in C, except that theymay optionally be declared to be packed,asdescribed
earlier.Arrays in Cg are first-class types, so array parameters to functions and programs must be declared
using array syntax, rather than pointer syntax. Likewise, assignment of an array−typed object implies an
array copyrather than a pointer copy.
Arrays with size [1] may be declared but are considered a different type from the corresponding non-array
type.
Because the language does not currently support pointers, the storage order of arrays is only visible when
an application passes parameters to a vertexorfragment program. Therefore, the compiler is currently free
to allocate temporary variables as it sees fit.
The declaration and use of arrays of arrays is in the same style as in C. That is, if the 2D array Ais
declared as
float A[4][4];
then, the following statements are true:
•The array is indexedasA[row][column];
perl v5.10.0 Cg Toolkit 3.0 23
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
•The array can be built with a constructor using
float4x4 A = { { A[0][0], A[0][1], A[0][2], A[0][3] },
{A[1][0], A[1][1], A[1][2], A[1][3] },
{A[2][0], A[2][1], A[2][2], A[2][3] },
{A[3][0], A[3][1], A[3][2], A[3][3] } };
A[0] is equivalent to float4(A[0][0], A[0][1], A[0][2], A[0][3])
Support must be provided for structs containing arrays.
Unsized Arrays
Objects may be declared as unsized arrays by using a declaration with an empty size [] and no initializer.
If a declarator uses unsized array syntax with an initializer,itisdeclared with a concrete (sized) array type
based on the declarator.Unsized arrays are dynamic typed objects that takeonthe size of anyarray
assigned to them.
Minimum Array Requirements
Profiles are required to provide partial support for certain kinds of arrays. This partial support is designed
to support vectors and matrices in all profiles. Forvertexprofiles, it is additionally designed to support
arrays of light state (indexedbylight number) passed as uniform parameters, and arrays of skinning
matrices passed as uniform parameters.
Profiles must support subscripting, copying, size querying and swizzling of vectors and matrices. However,
subscripting with run-time computed indices is not required to be supported.
Vertexprofiles must support the following operations for anynon-packed array that is a uniform parameter
to the program, or is an element of a structure that is a uniform parameter to the program. This requirement
also applies when the array is indirectly a uniform program parameter (that is, it and or the structure
containing it has been passed via a chain of in function parameters). The three operations that must be
supported are
•rvalue subscripting by a run-time computed value or a compile-time value.
•passing the entire array as a parameter to a function, where the corresponding formal function
parameter is declared as in.
•querying the size of the array with a .length suffix.
The following operations are explicitly not required to be supported:
•lvalue-subscripting
•copying
•other operators, including multiply,add, compare, and so on
Note that when a uniform array is rvalue subscripted, the result is an expression, and this expression is no
longer considered to be a uniform program parameter.Therefore, if this expression is an array,its
subsequent use must conform to the standard rules for array usage.
These rules are not limited to arrays of numeric types, and thus imply support for arrays of struct, arrays of
matrices, and arrays of vectors when the array is a uniform program parameter.Maximum array sizes
may be limited by the number of available registers or other resource limits, and compilers are permitted to
issue error messages in these cases. However, profiles must support sizes of at least float arr[8],
float4 arr[8],and float4x4 arr[4][4].
Fragment profiles are not required to support anyoperations on arbitrarily sized arrays; only support for
vectors and matrices is required.
perl v5.10.0 Cg Toolkit 3.0 24
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Function Overloading
Multiple functions may be defined with the same name, as long as the definitions can be distinguished by
unqualified parameter types and do not have anopen-profile conflict (as described in the section on open
functions).
Function-matching rules:
1. Add all visible functions with a matching name in the calling scope to the set of function candidates.
2. Eliminate functions whose profile conflicts with the current compilation profile.
3. Eliminate functions with the wrong number of formal parameters. If a candidate function has excess
formal parameters, and each of the excess parameters has a default value, do not eliminate the
function.
4. If the set is empty,fail.
5. For each actual parameter expression in sequence (left to right), perform the following:
a. If the type of the actual parameter matches the unqualified type of the corresponding formal
parameter in anyfunction in the set, remove all functions whose corresponding parameter does
not match exactly.
b. Ifthere is a function with a dynamically typed formal argument which is compatible with the
actual parameter type, remove all functions whose corresponding parameter is not similarly
compatible.
c. If there is a defined promotion for the type of the actual parameter to the unqualified type of the
formal parameter of anyfunction, remove all functions for which this is not true from the set.
d. If there is a valid implicit cast that converts the type of the actual parameter to the unqualified
type of the formal parameter of anyfunction, remove all functions for which this is not true from
the set
e. Fail.
6. Choose afunction based on profile:
a. If there is at least one function with a profile that exactly matches the compilation profile, discard
all functions that don’texactly match.
b. Otherwise, if there is at least one function with a wildcard profile that matches the compilation
profile, determine the ’most specific’ matching wildcard profile in the candidate set. Discard all
functions except those with this ’most specific’ wildcard profile. How’specific’ a givenwildcard
profile name is relative toaparticular profile is determined by the profile specification.
7. If the number of functions remaining in the set is not one, then fail.
Global Variables
Global variables are declared and used as in C. Non-static variables may have a semantic associated with
them. Uniform non-static variables may have their value set through the run-time API.
Use of Uninitialized Variables
It is incorrect for a program to use an uninitialized static or local variable. However, the compiler is not
obligated to detect such errors, evenifitwould be possible to do so by compile-time data-flowanalysis.
The value obtained from reading an uninitialized variable is undefined. This same rule applies to the
implicit use of a variable that occurs when it is returned by a top-levelfunction. In particular,ifatop-level
function returns a struct,and some element of that struct is neverwritten, then the value of that
element is undefined.
Note: The language designers did not choose to define variables as being initialized to zero because that
would result in a performance penalty in cases where the compiler is unable to determine if a variable is
properly initialized by the programmer.
perl v5.10.0 Cg Toolkit 3.0 25
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Preprocessor
Cg profiles must support the full ANSI Cstandard preprocessor capabilities: #if,#define,and so on.
However, while #include must be supported the mechanism by which the file to be included is located is
implementation defined.
Overview of Binding Semantics
In stream-processing architectures, data packets flowbetween different programmable units. On a GPU,for
example, packets of vertexdata flowfrom the application to the vertexprogram.
Because packets are produced by one program (the application, in this case), and consumed by another (the
vertexprogram), there must be some mechanism for defining the interface between the two. Cg allows the
user to choose between twodifferent approaches to defining these interfaces.
The first approach is to associate a binding semantic with each element of the packet. This approach is a
bind-by-name approach. For example, an output with the binding semantic FOO is fed to an input with the
binding semantic FOO.Profiles may allowthe user to define arbitrary identifiers in this ‘‘semantic
namespace’’, or theymay restrict the allowed identifiers to a predefined set. Often, these predefined names
correspond to the names of hardware registers or API resources.
In some cases, predefined names may control non-programmable parts of the hardware. For example,
vertexprograms normally compute a position that is fed to the rasterizer,and this position is stored in an
output with the binding semantic POSITION.
Forany profile, there are twonamespaces for predefined binding semantics —the namespace used for in
variables and the namespace used for out variables. The primary implication of having twonamespaces is
that the binding semantic cannot be used to implicitly specify whether a variable is in or out.
The second approach to defining data packets is to describe the data that is present in a packet and allowthe
compiler to decide howtostore it. In Cg, the user can describe the contents of a data packet by placing all
of its contents into a struct.When a struct is used in this manner,werefer to it as a connector.The
twoapproaches are not mutually exclusive,asisdiscussed later.The connector approach allows the user to
rely on a combination of user-specified semantic bindings and compiler-determined bindings.
Binding Semantics
Abinding semantic may be associated with an input to a top-levelfunction or a global variable in one of
three ways:
•The binding semantic is specified in the formal parameter declaration for the function. The syntax for
formal parameters to a function is:
[const] [in | out | inout] <type> <identifier> [: <binding−semantic>] [= <initializer>];
•Ifthe formal parameter is a struct,the binding semantic may be specified with an element of the
struct when the struct is defined:
struct <struct−tag> {
<type> <identifier>[ : <binding−semantic>];
...
};
•Ifthe input to the function is implicit (a non-static global variable that is read by the function), the
binding semantic may be specified when the non-static global variable is declared:
[varying [in | out]] <type> <identifier> [ : <binding−semantic>];
If the non-static global variable is a struct, the binding semantic may be specified when the
struct is defined, as described in the second bullet above.
•Abinding semantic may be associated with the output of a top-levelfunction in a similar manner:
perl v5.10.0 Cg Toolkit 3.0 26
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
<type> <identifier> ( <parameter−list> ) [: <binding−semantic>]
{
:
Another method available for specifying a semantic for an output value is to return a struct,and to
specify the binding semantic(s) with elements of the struct when the struct is defined. In addition, if
the output is a formal parameter,then the binding semantic may be specified using the same approach used
to specify binding semantics for inputs.
Aliasing of Semantics
Semantics must honor a copy-on-input and copy-on-output model. Thus, if the same input binding
semantic is used for twodifferent variables, those variables are initialized with the same value, but the
variables are not aliased thereafter.Output aliasing is illegal, but implementations are not required to detect
it. If the compiler does not issue an error on a program that aliases output binding semantics, the results are
undefined.
Additional Details for Binding Semantics
The following are somewhat redundant, but provide extra clarity:
•Semantic names are case-insensitive.
•Semantics attached to parameters to non-main functions are ignored.
•Input semantics may be aliased by multiple variables.
•Output semantics may not be aliased.
Using a StructuretoDefine Binding Semantics (Connectors)
Cg profiles may optionally allowthe user to avoid the requirement that a binding semantic be specified for
ev e ry non-uniform input (or output) variable to a top-levelprogram. Toavoid this requirement, all the non-
uniform variables should be included within a single struct.The compiler automatically allocates the
elements of this structure to hardware resources in a manner that allows anyprogram that returns this
struct to interoperate with anyprogram that uses this struct as an input.
It is not required that all non-uniform inputs be included within a single struct in order to omit binding
semantics. Binding semantics may be omitted from anyinput or output, and the compiler
performs automatic allocation of that input or output to a hardware resource. However, toguarantee
interoperability of one program’soutput with another program’sinput when automatic binding is
performed, it is necessary to put all of the variables in a single struct.
It is permissible to explicitly specify a binding semantic for some elements of the struct,but not others.
The compiler’sautomatic allocation must honor these explicit bindings. The allowed set of explicitly
specified binding semantics is defined by the allocation-rule identifier.The most common use of this
capability is to bind variables to hardware registers that write to, or read from, non-programmable parts of
the hardware. For example, in a typical vertex-program profile, the output struct would contain an
element with an explicitly specified POSITION semantic. This element is used to control the hardware
rasterizer.
Defining Binding Semantics via an external API
It may be possible to define binding semantics on inputs and outputs by using an external API that
manipulates the programs environment. The Cg Runtime API is such an API that allows this, and others
may exist.
HowPrograms Receive and ReturnData
Aprogram is a non-static function that has been designated as the main entry point at compilation time.
The varying inputs to the program come from this top-levelfunction’svarying in parameters, and any
global varying variables that do not have anout modifier.The uniform inputs to the program come from
the top-levelfunction’suniform in parameters and from anynon-static global variables that are referenced
perl v5.10.0 Cg Toolkit 3.0 27
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
by the top-levelfunction or by anyfunctions that it calls. The output of the program comes from the return
value of the function (which is always implicitly varying), from any out parameters, which must also be
varying, and from any varying out global variables that are written by the program.
Parameters to a program of type sampler* are implicitly const.
Statements and Expressions
Statements are expressed just as in C, unless an exception is stated elsewhere in this document.
Additionally,
if,while,and for require bool expressions in the appropriate places.
•Assignment is performed using =.The assignment operator returns a value, just as in C, so
assignments may be chained.
•The new discard statement terminates execution of the program for the current data element (such
as the current vertexorcurrent fragment) and suppresses its output. Vertexprofiles may choose to omit
support for discard.
Minimum Requirements for if,while, for
The minimum requirements are as follows:
•All profiles should support if,but such support is not strictly required for older hardware.
•All profiles should support for and while loops if the number of loop iterations can be determined
at compile time. ‘‘Can be determined at compile time’’isdefined as follows: The loop-iteration
expressions can be evaluated at compile time by use of intra-procedural constant propagation and
folding, where the variables through which constant values are propagated do not appear as lvalues
within anykind of control statement (if,for,orwhile)or?: construct. Profiles may choose to
support more general constant propagation techniques, but such support is not required.
•Profiles may optionally support fully general for and while loops.
New Vector Operators
These newoperators are defined for vector types:
•Vector construction operator: typeID(...):
This operator builds a vector from multiple scalars or shorter vectors:
float4(scalar, scalar, scalar, scalar)
float4(float3, scalar)
•Matrix construction operator: typeID(...):
This operator builds a matrix from multiple rows.
Each rowmay be specified either as multiple scalars or as anycombination of scalars and vectors with
the appropriate size, e.g.
float3x3(1, 2, 3, 4, 5, 6, 7, 8, 9)
float3x3(float3, float3, float3)
float3x3(1, float2, float3, 1, 1, 1)
•Vector swizzle operator: (.)
a=b.xxyz; // A swizzle operator example
−Atleast one swizzle character must followthe operator.
−There are three sets of swizzle characters and theymay not be mixed: Set one is xyzw = 0123,
set twoisrgba = 0123,and set three is stpq = 0123.
−The vector swizzle operator may only be applied to vectors or to scalars.
perl v5.10.0 Cg Toolkit 3.0 28
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
−Applying the vector swizzle operator to a scalar givesthe same result as applying the operator to
avector of length one. Thus, myscalar.xxx and float3(myscalar, myscalar,
myscalar) yield the same value.
−Ifonly one swizzle character is specified, the result is a scalar not a vector of length one.
Therefore, the expression b.y returns a scalar.
−Care is required when swizzling a constant scalar because of ambiguity in the use of the decimal
point character.For example, to create a three-vector from a scalar,use one of the following:
(1).xxx or 1..xxx or 1.0.xxx or 1.0f.xxx
−The size of the returned vector is determined by the number of swizzle characters. Therefore, the
size of the result may be larger or smaller than the size of the original vector.For example,
float2(0,1).xxyy and float4(0,0,1,1) yields the same result.
•Matrix swizzle operator:
Forany matrix type of the form ’<type><rows>x<columns>’, the notation:
’<matrixObject>._m<row><col>[_m<row><col>][...]’ can be used to access individual matrix
elements (in the case of only one <row>,<col> pair) or to construct vectors from elements of a matrix
(in the case of more than one <row>,<col> pair). The rowand column numbers are zero-based.
Forexample:
float4x4 myMatrix;
float myFloatScalar;
float4 myFloatVec4;
// Set myFloatScalar to myMatrix[3][2]
myFloatScalar = myMatrix._m32;
// Assign the main diagonal of myMatrix to myFloatVec4
myFloatVec4 = myMatrix._m00_m11_m22_m33;
Forcompatibility with the D3DMatrix data type, Cg also allows one-based swizzles, using a form with
the momitted after the _:’<matrixObject>._<row><col>[_<row><col>][...]’ In this form, the indexes
for <row> and <col> are one-based, rather than the C standard zero-based. So, the twoforms are
functionally equivalent:
float4x4 myMatrix;
float4 myVec;
// These two statements are functionally equivalent:
myVec = myMatrix._m00_m23_m11_m31;
myVec = myMatrix._11_34_22_42;
Because of the confusion that can be caused by the one-based indexing, its use is strongly discouraged.
Also one-based indexing and zero-based indexing cannot be mixed in a single swizzle
The matrix swizzles may only be applied to matrices. When multiple components are extracted from a
matrix using a swizzle, the result is an appropriately sized vector.When a swizzle is used to extract a
single component from a matrix, the result is a scalar.
•The write-mask operator: (.)Itcan only be applied to an lvalue that is a vector or matrix. It allows
assignment to particular elements of a vector or matrix, leaving other elements unchanged. It looks
exactly likeaswizzle, with the additional restriction that a component cannot be repeated.
perl v5.10.0 Cg Toolkit 3.0 29
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Arithmetic Precision and Range
Some hardware may not conform exactly to IEEE arithmetic rules. Fixed-point data types do not have
IEEE-defined rules.
Optimizations are permitted to produce slightly different results than unoptimized code. Constant folding
must be done with approximately the correct precision and range, but is not required to produce bit-exact
results. It is recommended that compilers provide an option either to forbid these optimizations or to
guarantee that theyare made in bit-exact fashion.
Operator Precedence
Cg uses the same operator precedence as C for operators that are common between the twolanguages.
The swizzle and write-mask operators (.)hav e the same precedence as the structure member operator (.)
and the array indexoperator [].
Operator Enhancements
The standard C arithmetic operators (+,,*,/,%,unary −)are extended to support vectors and
matrices. Sizes of vectors and matrices must be appropriately matched, according to standard mathematical
rules. Scalar-to-vector promotion, as described earlier,allows relaxation of these rules.
M[n][m]
Matrix with nrows and mcolumns
V[n]Vector with nelements
−V[n] −> V[n]
Unary vector negate
−M[n] −> M[n]
Unary matrix negate
V[n] * V[n] −> V[n]
Componentwise *
V[n] / V[n] −> V[n]
Componentwise /
V[n] % V[n] −> V[n]
Componentwise %
V[n] + V[n] −> V[n]
Componentwise +
V[n] − V[n] −> V[n]
Componentwise −
M[n][m] * M[n][m] −> M[n][m]
Componentwise *
M[n][m] / M[n][m] −> M[n][m]
Componentwise /
M[n][m] % M[n][m] −> M[n][m]
Componentwise %
M[n][m] + M[n][m] −> M[n][m]
Componentwise +
M[n][m] − M[n][m] −> M[n][m]
Componentwise −
perl v5.10.0 Cg Toolkit 3.0 30
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
Operators
Boolean
&& || !
Boolean operators may be applied to bool packed bool vectors, in which case theyare applied in
elementwise fashion to produce a result vector of the same size. Each operand must be a bool vector of
the same size.
Both sides of && and || are always evaluated; there is no short-circuiting as there is in C.
Comparisons
<><=>=!===
Comparison operators may be applied to numeric vectors. Both operands must be vectors of the same size.
The comparison operation is performed in elementwise fashion to produce a bool vector of the same size.
Comparison operators may also be applied to bool vectors. For the purpose of relational comparisons,
true is treated as one and false is treated as zero. The comparison operation is performed in
elementwise fashion to produce a bool vector of the same size.
Comparison operators may also be applied to numeric or bool scalars.
Arithmetic
+−*/%++−−unary− unary+
The arithmetic operator %is the remainder operator,asinC.Itmay only be applied to twooperands of
cint or int types.
When /or %is used with cint or int operands, C rules for integer /and %apply.
The C operators that combine assignment with arithmetic operations (such as +=)are also supported when
the corresponding arithmetic operator is supported by Cg.
Conditional Operator
?:
If the first operand is of type bool,one of the following must hold for the second and third operands:
•Both operands have compatible structure types.
•Both operands are scalars with numeric or bool type.
•Both operands are vectors with numeric or bool type, where the twovectors are of the same size,
which is less than or equal to four.
If the first operand is a packed vector of bool,then the conditional selection is performed on an
elementwise basis. Both the second and third operands must be numeric vectors of the same size as the first
operand.
UnlikeC,side effects in the expressions in the second and third operands are always executed, regardless of
the condition.
Miscellaneous Operators
(typecast) ,
Cg supports C’stypecast and comma operators.
ReservedWords
The following are currently used reserved words in Cg. A’*’ indicates that the reserved word is case-
insensitive.
__[anything] (i.e. anyidentifier with twounderscores as a prefix)
asm*
perl v5.10.0 Cg Toolkit 3.0 31
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
asm_fragment
auto
bool
break
case
catch
char
class
column_major
compile
const
const_cast
continue
decl*
default
delete
discard
do
double
dword*
dynamic_cast
else
emit
enum
explicit
extern
false
fixed
float*
for
friend
get
goto
half
if
in
inline
inout
int
interface
long
matrix*
mutable
namespace
new
operator
out
packed
pass*
pixelfragment*
pixelshader*
private
perl v5.10.0 Cg Toolkit 3.0 32
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
protected
public
register
reinterpret_cast
return
row_major
sampler
sampler_state
sampler1D
sampler2D
sampler3D
samplerCUBE
shared
short
signed
sizeof
static
static_cast
string*
struct
switch
technique*
template
texture*
texture1D
texture2D
texture3D
textureCUBE
textureRECT
this
throw
true
try
typedef
typeid
typename
uniform
union
unsigned
using
vector*
vertexfragment*
vertexshader*
virtual
void
volatile
while
Cg Standard Library Functions
Cg provides a set of built-in functions and structures to simplify GPU programming. These functions are
similar in spirit to the C standard library functions, providing a convenient set of common functions.
The Cg Standard Library is documented in ‘‘spec_stdlib.txt’’.
perl v5.10.0 Cg Toolkit 3.0 33
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
VERTEX PROGRAM PROFILES
Afew features of the Cg language that are specific to vertexprogram profiles are required to be
implemented in the same manner for all vertexprogram profiles.
Mandatory Computation of Position Output
Vertexprogram profiles may (and typically do) require that the program compute a position output. This
homogeneous clip-space position is used by the hardware rasterizer and must be stored in a program output
with an output binding semantic of POSITION (or HPOS for backward compatibility).
Position Invariance
In manygraphics APIs, the user can choose between twodifferent approaches to specifying per-vertex
computations: use a built-in configurable ‘‘fixed-function’’pipeline or specify a user-written vertex
program. If the user wishes to mix these twoapproaches, it is sometimes desirable to guarantee that the
position computed by the first approach is bit-identical to the position computed by the second approach.
This ‘‘position invariance’’isparticularly important for multipass rendering.
Support for position invariance is optional in Cg vertexprofiles, but for those vertexprofiles that support it,
the following rules apply:
•Position invariance with respect to the fixed function pipeline is guaranteed if twoconditions are met:
−A#pragma position_invariant <top−level−function−name> appears before
the body of the top-levelfunction for the vertexprogram.
−The vertexprogram computes position as follows:
OUT_POSITION = mul(MVP, IN_POSITION)
where:
OUT_POSITION
is a variable (or structure element) of type float4 with an output binding semantic of
POSITION or HPOS.
IN_POSITION
is a variable (or structure element) of type float4 with an input binding semantic of
POSITION.
MVP
is a uniform variable (or structure element) of type float4x4 with an input binding
semantic that causes it to track the fixed-function modelview-projection matrix. (The name
of this binding semantic is currently profile-specific —for OpenGL profiles, the semantic
state.matrix.mvp is recommended).
•Ifthe first condition is met but not the second, the compiler is encouraged to issue a warning.
•Implementations may choose to recognize more general versions of the second condition (such as the
variables being copypropagated from the original inputs and outputs), but this additional generality is
not required.
Binding Semantics for Outputs
As shown in Table 10, there are twooutput binding semantics for vertexprogram profiles:
Table 10 Vertex Output Binding Semantics
Name Meaning Type Default Value
−−−−−−−− −−−−−−− −−−−−− −−−−−−−−−−−−−
POSITION Homogeneous clip−space float4 Undefined
position; fed to rasterizer.
PSIZE Point size float Undefined
Profiles may define additional output binding semantics with specific behaviors, and these definitions are
perl v5.10.0 Cg Toolkit 3.0 34
CG_LANGUAGE(Cg) Cg Language Specification CG_LANGUAGE(Cg)
expected to be consistent across commonly used profiles.
FRAGMENT PROGRAM PROFILES
Afew features of the Cg language that are specific to fragment program profiles are required to be
implemented in the same manner for all fragment program profiles.
Binding semantics for outputs
As shown in Table 11, there are three output binding semantics for fragment program profiles:
Table 11 Fragment Output Binding Semantics
Name Meaning Type Default Value
−−−− −−−−−−− −−−−−− −−−−−−−−−−−−−
COLOR RGBA output color float4 Undefined
COLOR0 Same as COLOR
DEPTH Fragment depth value float Interpolated depth from rasterizer
(in range [0,1]) (in range [0,1])
Profiles may define additional output binding semantics with specific behaviors, and these definitions are
expected to be consistent across commonly used profiles.
If a program desires an output color alpha of 1.0, it should explicitly write a value of 1.0 to the W
component of the COLOR output. The language does *not* define a default value for this output.
Note: If the target hardware uses a default value for this output, the compiler may choose to optimize away
an explicit write specified by the user if it matches the default hardware value. Such defaults are not
exposed in the language.)
In contrast, the language does define a default value for the DEPTH output. This default value is the
interpolated depth obtained from the rasterizer.Semantically,this default value is copied to the output at
the beginning of the execution of the fragment program.
As discussed earlier,when a binding semantic is applied to an output, the type of the output variable is not
required to match the type of the binding semantic. Forexample, the following is legal, although not
recommended:
struct myfragoutput {
float2 mycolor : COLOR;
}
In such cases, the variable is implicitly copied (with a typecast) to the semantic upon program completion.
If the variable’svector size is shorter than the semantic’svector size, the larger-numbered components of
the semantic receive their default values if applicable, and otherwise are undefined. In the case above,the R
and Gcomponents of the output color are obtained from mycolor,while the Band Acomponents of the
color are undefined.
perl v5.10.0 Cg Toolkit 3.0 35
CGC(1) Cg Commands CGC(1)
NAME cgc −cgcompiler driver
SYNOPSIS
cgc [options] file ...
DESCRIPTION
cgc is the standalone Cg compiler which translates Cg or GLSL programs into OpenGL or DirectX shader
assembly code, or OpenGL or DirectX shading language code.
OPTIONS
Basic options
−entry name
Sets the entry function for the shader to compile. Defaults to main.
−o file
Sets the output file to be written. Default outputs to stdout.
−l file
Sets the listing file, where error and warning messages are written. Defaults to stderr.
−profile name
Selects the target profile, specifying the shader language to be generated.
−profileopts opt1,opt2,...
−po opt1,opt2,...
Sets one or more profile specific options.
−noentry
Sets check only mode, where no shader is compiled, but all the code in the input file is checked for
syntactic correctness.
Language options
−oglsl
Sets the source language to GLSL.
−ogles
Sets the source language to OpneGL/ES GLSL.
−strict
−nostrict
Enable or disable strict typechecking, where most questionable constructs will be flagged as warnings.
−glslWerror
Like −strict butinaddition, unportable GLSL constructs will be flagged as errors.
−nowarn
Disable all warnings.
−nowarn=N,N,...
Disable one or more specific numbered warnings.
−fx
−nofx
Enables or disables FX parsing mode, where FX keywords are recognized. Defaults to on in Cg mode
and offinGLSL mode.
−nostdlib
Disable the standard library.
perl v5.10.0 Cg Toolkit 3.0 36
CGC(1) Cg Commands CGC(1)
Code Generation Options
−fastmath
−nofastmath
Enable or disable optimizations that may chage/lose precision in loworder bits, such as assocative
transforms like (a + b) + c instead of a+(b+c).Default is −fastmath.
−fastprecision
−nofastprecision
Enable or disable optimzations doing operations at lower precision than is specified when the result is
later converted to a lower precision or the operands were originally in lower precision. Default is
−nofastprecision.
−bestprecision
Always do things in the best possible precision; only use lower precision operations if there is no
possibility of difference. Implies −nofastmath and −nofastprecision.
−unroll all|none|count=N
Control loop unrolling. −unroll all will force unrolling of all loops that can be unrolled, while
−unroll none will prevent unrolling except if code cannot otherwise be generated in the current
profiles (so it will have noeffect in profiles that don’tsupport looping). unroll count=Nwill
unroll loops if the estimate of the resulting code is less than Ninstructions. The estimate does not take
into account further optimizations that may be done after unrolling, so it might be quite inaccurate.
−inline all|none|count=N
Control function inlining. Setting −inline none will additionally disable inlining of functions
with an explicit inline keyword, which are otherwise always inlined. Setting −inline count=0
will effectively disable inlining of all functions that do not have anexplicit inline keyword.
−ifcvt all|none|count=N
control if conversion (replacement of small if/else blocks with conditional assignments).
−ON
Sets the optimization levelofthe compiler,from 0 (lowest) to 3 (highest). Higher values may produce
better code and will cause compile time to increase. Default is −O1.
−looplimit N
Assume loops that the compiler cannot determine an upper bound on the number of iterations may
loop as manyasNiterations. This may require generating extra code for such loops in some profiles.
−d3dGenerate code compatable with the Direct3D specification.
−MaxInstInBasicBlock N
break basic blocks after Ninstructions. This has an effect on local optimizations that don’tcross basic
block boundaries and may avoid bad compile time blowups in the presence of huge basic blocks due to
algorithms that are non-linear in the basic block size.
−maxunrollcount N
Deprecated. Don’tunroll loops with more than Niterations. Use the −unroll option instead, which
provides better fine-grained control.
Preprocessor Options
−DMACRO[=VALUE]
Sets a preprocessor macro. If VALUE is not specified it defaults to 1.
−Idirectory
Adds a directory to the end of the search path for #include files. The default search path is empty.
−E Don’tcompile, just prepocess the input.
perl v5.10.0 Cg Toolkit 3.0 37
CGC(1) Cg Commands CGC(1)
−P With −E,supresses the generation of #line directivesinthe output.
−C With −E,preserves comments in the output.
−MG
Ignore #include files that can’tbefound, rather than issuing an error.
−M
−MM
−MD
−MMD
−MP
−MF file
−MT target
−MQ target
Generate dependencyinformation about #includedfiles. These options are intended to be
compatible with the options to gcc.
Miscellaneous Options
−quiet
−q Supress all ’noise’ output (copyright notices, indications of which files are being compiled, etc). With
−o and −l, should result in no output being produced.
−nocode
Supress final code generation. Will actually run all the way through the compiler (so anyerrors
present should be diagnosed), but don’tproduce anyactual output code.
−v
−−version
Print compiler version information to listing.
−h Print short option help summary to stdout and exit.
−help
Print longer option help summary to stdout, including all supported profiles and profile options, and
exit.
−type type_definition
Set an override type binding for a variable.
−typefile file
Read override type bindings for variables from a file.
−dumpinputbind file
Dump type bindings for all variables to a file. This file may be passed back to the compiler with
−typefile.
Debugging options
−debug
Enable the debug builtin function to abort operation of a shader and immedaitely output a value.
−debuglast
Like −debug,except the shader does not abort; instead it continues and outputs the value of the last
debug function called.
−debugdefault=value
Like −debug,except if no debug call is reached, the output will be set to the specified value instead
of what the shader normally computes.
perl v5.10.0 Cg Toolkit 3.0 38
CGC(1) Cg Commands CGC(1)
−deprecated
Issue errors instead of warnings for anydeprecated features used.
PROFILES
Aprofile specifies the output language of the cg compiler (either a shader assembly dialect, or a shading
language). Each profile has its own set of profile options that can be set for it, though manyrelated profiles
have similar or identical options. Profiles can be grouped by program type, API,orGPU generation.
DirectX profiles
ds_5_0, gs_4_0, gs_5_0, hlslf, hlslv,hs_5_0, ps_1_1, ps_1_2, ps_1_3, ps_2_0, ps_2_x, ps_3_0,
ps_4_0, ps_5_0, vs_1_1, vs_2_0, vs_2_x, vs_3_0, vs_4_0, vs_5_0
OpenGL profiles
arbfp1, arbvp1, fp20, fp30, fp30unlimited,fp40, fp40unlimited,glslf, glslg, glslv,gp4fp,
gp4gp, gp4vp, gp5fp, gp5gp, gp5tcp, gp5tep, gp5vp, vp20, vp30, vp40
Fragment profiles
arbfp1, fp20, fp30, fp30unlimited,fp40, fp40unlimited,glslf, gp4fp, gp5fp, hlslf, ps_1_1,
ps_1_2, ps_1_3, ps_2_0, ps_2_x, ps_3_0, ps_4_0, ps_5_0
Geometry profiles
glslg, gp4gp, gp5gp, gs_4_0, gs_5_0
Vertexprofiles
arbvp1, glslv,gp4vp, gp5vp, hlslv,vp20, vp30, vp40, vs_1_1, vs_2_0, vs_2_x, vs_3_0, vs_4_0,
vs_5_0
GeForce 3/4 Series profiles
fp20, vp20
GeForce 5 Series profiles
fp30, vp30
GeForce 6/7 Series profiles
fp40, vp40
GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro profiles
gp4fp, gp4gp, gp4vp
GeForce 400 Series, OpenGL 4.x Quadro profiles
gp5fp, gp5gp, gp5tcp, gp5tep, gp5vp
Profile options
Here is a complete list of all profiles and their corresponding profile options
arbfp1
Targets the ARB_fragment_program OpenGL extension
−po ARB_draw_buffers
Use the ARB_draw_buffers option for multiple renderbuffer targets (MRT). This is the default
−po ATI_draw_buffers
Use the ATI_draw_buffers option for multiple renderbuffer targets (MRT).
−po MaxDrawBuffers=N
Set the maximum number of renderbuffer targets. Default is 1
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 32
−po MaxTexIndirections=N
Sets the maximum number of texture indirections allowed in the output program. Default is 1024
perl v5.10.0 Cg Toolkit 3.0 39
CGC(1) Cg Commands CGC(1)
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 1024
−po NumMathInstructionSlots=N
Sets the maximum number of non-texture instructions in the output program. Default is 1024
−po NumTemps=N
Sets the maximum number of TEMP registers in the output program. Default is 32
−po NumTexInstructionSlots=N
Sets the maximum number of texture instructions in the output program. Default is 1024
arbvp1
Targets the ARB_vertex_program OpenGL extension
−po MaxAddressRegs=N
Sets the maximum number of ADDRESS registers in the output program. Default is 1
−po MaxInstructions=N
Sets the maximum number of instructions in the output program. Default is 1024
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 96
−po NumTemps=N
Sets the maximum number of TEMP registers in the output program. Default is 32
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
fp20 Targets the NV_register_combiners2 and NV_texture_shader OpenGL extensions
fp30 Targets the NV_fragment_program OpenGL extension
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 256
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 32
fp30unlimited
Same as fp30 with various hardware limits on registers and instructions lifted
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 4194304
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 512
fp40 Targets the NV_fragment_program2 OpenGL extension
−po appleKilWAR
Work around various bugs with KIL instructions in the OSX-tiger implementation of
NV_fragment_program2
−po ARB_draw_buffers
Use the ARB_draw_buffers option for multiple renderbuffer targets (MRT). This is the default
−po ATI_draw_buffers
Use the ATI_draw_buffers option for multiple renderbuffer targets (MRT).
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is infinite
perl v5.10.0 Cg Toolkit 3.0 40
CGC(1) Cg Commands CGC(1)
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is infinite
−po NumTemps=N
Sets the maximum number of TEMP registers in the output program. Default is infinite
−po OutColorPrec=N
If Nis 3 or 4, force output to fp16 precision. If Nis 2, force output to fp32 precision.
fp40unlimited
Same as fp40 with various hardware limits on registers and instructions lifted
−po appleKilWAR
Work around various bugs with KIL instructions in the OSX-tiger implementation of
NV_fragment_program2
−po ARB_draw_buffers
Use the ARB_draw_buffers option for multiple renderbuffer targets (MRT). This is the default
−po ATI_draw_buffers
Use the ATI_draw_buffers option for multiple renderbuffer targets (MRT).
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 1024
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 4194304
−po NumTemps=N
Sets the maximum number of TEMP registers in the output program. Default is 512
−po OutColorPrec=N
If Nis 3 or 4, force output to fp16 precision. If Nis 2, force output to fp32 precision.
generic
Produces a dump of the program in a non-executable format
glslf, glslg and glslv
Targets the OpenGL Shading language (GLSL)v1.10. glslf targets fragment programs while glslv
targets vertexprograms
version=val
GLSL version to target. Supported versions are 100,110,120,130,140 and 150.
userTexCoord
Use user-defined varying instead of gl_TexCoord.
ATI_draw_buffers
Use ATI_draw_buffers extension for MRT.
EXT_gpu_shader4
Use EXT_gpu_shader4 extension where useful.
gp4fp
Targets the NV_gpu_program4 and NV_fragment_program4 OpenGL extensions.
−po fastimul
Assume integer multiply inputs have atmost 24 significant bits.
−po NV_shader_buffer_load
Use the NV_shader_buffer_load OpenGL extension.
−po NV_parameter_buffer_object2
Use the NV_parameter_buffer_object2 OpenGL extension.
perl v5.10.0 Cg Toolkit 3.0 41
CGC(1) Cg Commands CGC(1)
−po PaBO2
Use the NV_parameter_buffer_object2 OpenGL extension.
−po ARB_draw_buffers
Use the ARB_draw_buffers option for multiple renderbuffer targets (MRT). This is the default
−po ATI_draw_buffers
Use the ATI_draw_buffers option for multiple renderbuffer targets (MRT).
−po pixel_center_integer
Use integer pixel centers.
−po origin_upper_left
Use upper left pixel origin.
gp4gp
Targets the NV_gpu_program4 and NV_geometry_program4 OpenGL extensions.
−po POINT
−po LINE
−po LINE_ADJ
−po TRIANGLE
−po TRIANGLE_ADJ
Set the input primitive type for the geometry program
−po POINT_OUT
−po LINE_OUT
−po TRIANGLE_OUT
Set the output primitive type for the geometry program
−po Vertices=N
Set the number of vertices output by the geometry program
gp4vp
Targets the NV_gpu_program4 and NV_vertex_program4 OpenGL extensions.
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
gp5fp
Targets the NV_gpu_program5 OpenGL extension.
−po fastimul
Assume integer multiply inputs have atmost 24 significant bits.
−po NV_shader_buffer_load
Use the NV_shader_buffer_load OpenGL extension.
−po NV_parameter_buffer_object2
Use the NV_parameter_buffer_object2 OpenGL extension.
−po PaBO2
Use the NV_parameter_buffer_object2 OpenGL extension.
−po ARB_draw_buffers
Use the ARB_draw_buffers option for multiple renderbuffer targets (MRT). This is the default
−po ATI_draw_buffers
Use the ATI_draw_buffers option for multiple renderbuffer targets (MRT).
−po pixel_center_integer
Use the ARB_fragment_coord_conventions OpenGL extension to specify integer pixel centers.
−po origin_upper_left
Use the ARB_fragment_coord_conventions OpenGL extension to specify upper left pixel
origin.
perl v5.10.0 Cg Toolkit 3.0 42
CGC(1) Cg Commands CGC(1)
−po NV_early_fragment_tests
Perform depth and stencil tests prior to fragment program invocation.
gp5gp
Targets the NV_gpu_program5 OpenGL extension.
−po POINT
−po LINE
−po LINE_ADJ
−po TRIANGLE
−po TRIANGLE_ADJ
Set the input primitive type for the geometry program
−po POINT_OUT
−po LINE_OUT
−po TRIANGLE_OUT
Set the output primitive type for the geometry program
−po Vertices=N
Set the number of vertices output by the geometry program
gp5tcp
Targets the NV_tessellation_program and NV_gpu_program5 OpenGL extensions.
gp5tep
Targets the NV_tessellation_program and NV_gpu_program5 OpenGL extensions.
gp5vp
Targets the NV_gpu_program5 OpenGL extension.
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
hlslf hlslv
Targets Microsoft High-LevelShading Language (HLSL). hlslf targets pixel programs while hlslv
targets vertexprograms
ps_1_1 ps_1_2 ps_1_3
Targets DirectX pixel programs
−po MaxPixelShaderValue=N
Maximum absolute value representable in a pixel shader.Default is 1.
ps_2_0 ps_2_x
Targets DirectX pixel programs
−po MaxDrawBuffers=N
Set the maximum number of renderbuffer targets. Default is 1
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 96 or 512
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 12 or 32
ps_3_0
Targets DirectX pixel programs
−po MaxDrawBuffers=N
Set the maximum number of renderbuffer targets. Default is 1
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 224
perl v5.10.0 Cg Toolkit 3.0 43
CGC(1) Cg Commands CGC(1)
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 32768
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 32
−po OutColorPrec=N
If Nis 3 or 4, force output to fp16 precision. If Nis 2, force output to fp32 precision.
vp20Targets the NV_vertex_program OpenGL extension
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 96
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
vp30Targets the NV_vertex_program2 OpenGL extension
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 256
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
vp40Targets the NV_vertex_program3 OpenGL extension
−po MaxAddressRegs=N
Sets the maximum number of ADDRESS registers in the output program. Default is 2
−po MaxInstructions=N
Sets the maximum number of instructions in the output program. Default is 2048
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 544
−po NumTemps=N
Sets the maximum number of TEMP registers in the output program. Default is 32
−po PosInv
Generate position invariant code (same as fixed-function) for POSITION output
vs_1_1
Targets DirectX vertexprograms
−po dcls
Output dx9−style dcls statements
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 96
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 128
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 12
vs_2_0 vs_2_x
Targets DirectX vertexprograms
−po dcls
Output dx9−style dcls statements
perl v5.10.0 Cg Toolkit 3.0 44
CGC(1) Cg Commands CGC(1)
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 256
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 256
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 12
vs_3_0
Targets DirectX vertexprograms
−po dcls
Output dx9−style dcls statements
−po MaxLocalParams=N
Set the maximum number of uniform parameter slots available. Default is 256
−po NumInstructionSlots=N
Sets the maximum number of instructions in the output program. Default is 32768
−po NumTemps=N
Sets the maximum number of temporaries in the output program. Default is 32
ENVIRONMENT
SEE ALSO
Cg_language, arbfp1, arbvp1, fp20, fp30, fp40, glslf, glslv,gp4fp, gp4gp, gp4vp, hlslf, hlslv,vp20, vp30,
vp40
perl v5.10.0 Cg Toolkit 3.0 45
CGFXCAT(1) Cg Commands CGFXCAT(1)
NAME cgfxcat −dump a Cg effect or program file to standard out
SYNOPSIS
cgfxcat.exe [−gl] [−effect] [−program] [−object] [−profile profile] [−entry entry] file
DESCRIPTION
cgfxcat loads an effect or program file and calls every query operation available in the core runtime on the
resulting Cg object. The values returned by the queries are written to standard out.
The source code for cgfxcat is found under examples/Tools/cgfxcat.
OPTIONS
file The effect or program file to be processed. cgfxcat can handle effect files, program files, or
precompiled program files.
Files with a .cgfx or .fx extension will be loaded using cgCreateEffectFromFile. Files with a .cg or
.hlsl extension will be loaded using cgCreateProgramFromFile. Anyother extension is passed to
cgGetProfile and if a valid CGprofile is found the file is loaded using cgCreateProgramFromFile with
the program_type set to CG_OBJECT.You can override these built-in file extension mappings with
the −effect,−program,or<−object> options.
−effect
Treat file as an effect file, ignoring its extension.
−program
Treat file as a program file, ignoring its extension.
−object
Treat file as an precompiled program file, ignoring its extension.
−profile profile
Use the CGprofile returned by cgGetProfile for profile as the profile argument of
cgCreateProgramFromFile when compiling file.
−entry entry
Use entry as the entry argument of cgCreateProgramFromFile when compiling file.
−gl Register states with cgGLRegisterStates rather than using the generic state code built into cgfxcat.
SEE ALSO
cgCreateEffectFromFile, cgCreateProgramFromFile, cgGetProfile, cgGLRegisterStates
perl v5.10.0 Cg Toolkit 3.0 46
CGINFO(1) Cg Commands CGINFO(1)
NAME cginfo −print Cg library information
SYNOPSIS
cginfo [−help] [−profiles] [/path/to/library]
DESCRIPTION
cginfo will print a Cg library’sversion string to the standard output along with the path to the library from
which the version was retrieved. The list of supported profiles can also be displayed.
The source code for cginfo is found under examples/Tools/cginfo. This example demonstrates howtoload
the Cg library and get the address of a symbol from the library for all of the platforms on which Cg is
supported.
OPTIONS
−help
Print a description of the command line options understood by cginfo on the standard output.
−profiles
Also print a list of profiles supported by this library on the standard output. Note that the APIs to
enumerate supported profiles were introduced in Cg 2.2. If the library being queried is 2.1 or earlier
then this option will have noeffect.
/path/to/library
Platform specific path the library to be queried. If no explicit library path is giventhe platform
specific rules for finding shared libraries will be used to locate a copyofthe Cg library to query.
SEE ALSO
Cg_language
perl v5.10.0 Cg Toolkit 3.0 47
cgAddStateEnumerant(3) Cg Core Runtime API cgAddStateEnumerant(3)
NAME cgAddStateEnumerant −associates an integer enumerant value as a possible value for a state
SYNOPSIS
#include <Cg/cg.h>
void cgAddStateEnumerant( CGstate state,
const char * name,
int value );
PARAMETERS
state The state to which to associate the name and value.
name The name of the enumerant.
value The value of the enumerant.
RETURN VALUES
None.
DESCRIPTION
cgAddStateEnumerant associates a givennamed integer enumerant value with a state definition. When
that state is later used in a pass in an effect file, the value of the state assignment can optionally be givenby
providing a named enumerant defined with cgAddStateEnumerant.The state assignment will then take
on the value provided when the enumerant was defined.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgAddStateEnumerant wasintroduced in Cg 1.4.
SEE ALSO
cgCreateState, cgCreateArrayState, cgCreateSamplerState, cgCreateArraySamplerState, cgGetStateName
perl v5.10.0 Cg Toolkit 3.0 48
cgCallStateResetCallback(3) Cg Core Runtime API cgCallStateResetCallback(3)
NAME cgCallStateResetCallback −calls the state resetting callback function for a state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgCallStateResetCallback( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the boolean value returned by the callback function. It should be CG_TRUE upon success.
Returns CG_TRUE if no callback function was defined.
DESCRIPTION
cgCallStateResetCallback calls the graphics state resetting callback function for the givenstate
assignment.
The semantics of ‘‘resetting state’’will depend on the particular graphics state manager that defined the
valid state assignments; it will generally either mean that graphics state is reset to what it was before the
pass, or that it is reset to the default value. The OpenGL state manager in the OpenGL Cg runtime
implements the latter approach.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgCallStateResetCallback wasintroduced in Cg 1.4.
SEE ALSO
cgResetPassState, cgSetStateCallbacks, cgCallStateSetCallback, cgCallStateValidateCallback
perl v5.10.0 Cg Toolkit 3.0 49
cgCallStateSetCallback(3) Cg Core Runtime API cgCallStateSetCallback(3)
NAME cgCallStateSetCallback −calls the state setting callback function for a state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgCallStateSetCallback( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the boolean value returned by the callback function. It should be CG_TRUE upon success.
Returns CG_TRUE if no callback function was defined.
DESCRIPTION
cgCallStateSetCallback calls the graphics state setting callback function for the givenstate assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgCallStateSetCallback wasintroduced in Cg 1.4.
SEE ALSO
cgSetPassState, cgSetStateCallbacks, cgCallStateResetCallback, cgCallStateValidateCallback
perl v5.10.0 Cg Toolkit 3.0 50
cgCallStateValidateCallback(3) Cg Core Runtime API cgCallStateValidateCallback(3)
NAME cgCallStateValidateCallback −calls the state validation callback function for a state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgCallStateValidateCallback( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the boolean value returned by the validation function. It should be CG_TRUE upon success.
Returns CG_TRUE if no callback function was defined.
DESCRIPTION
cgCallStateValidateCallback calls the state validation callback function for the givenstate assignment.
The validation callback will return CG_TRUE or CG_FALSE depending on whether the current hardware
and driversupport the graphics state set by the state assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgCallStateValidateCallback wasintroduced in Cg 1.4.
SEE ALSO
cgSetStateCallbacks, cgCallStateSetCallback, cgCallStateResetCallback
perl v5.10.0 Cg Toolkit 3.0 51
cgCombinePrograms(3) Cg Core Runtime API cgCombinePrograms(3)
NAME cgCombinePrograms −combine programs from different domains
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCombinePrograms( int n,
const CGprogram * exeList );
PARAMETERS
nThe number of program objects in exeList.
exeList An array of twoormore executable programs, each from a different domain.
RETURN VALUES
Returns a handle to the newly created program on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCombinePrograms will takeaset of n programs and combine them into a single CGprogram.This
allows a single call to BindProgram (instead of a BindProgram for each individual program) and provides
optimizations between the combined set of program inputs and outputs.
EXAMPLES
CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
vEntryName, NULL);
CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
fEntryName, NULL);
CGprogram programs[] = {p1, p2};
CGprogram combined = cgCombinePrograms(2, programs);
cgDestroyProgram(p1);
cgDestroyProgram(p2);
cgGLBindProgram(combined); /* Assuming cgGL runtime */
/* Render... */
ERRORS
CG_INVALID_DIMENSION_ERROR is generated if nless than or equal to 1 or nis greater than 3.
CG_INVALID_PARAMETER_ERROR is generated if exeList is NULL.
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if one of the programs in exeList is invalid.
The errors listed in cgCreateProgram might also be generated.
HISTORY
cgCombinePrograms wasintroduced in Cg 1.5.
SEE ALSO
cgCombinePrograms2, cgCombinePrograms3, cgCombinePrograms4, cgCombinePrograms5,
cgCreateProgram, cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram
perl v5.10.0 Cg Toolkit 3.0 52
cgCombinePrograms2(3) Cg Core Runtime API cgCombinePrograms2(3)
NAME cgCombinePrograms2 −combine programs from twodifferent domains
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCombinePrograms2( const CGprogram program1,
const CGprogram program2 );
PARAMETERS
program1An executable program from one domain.
program2An executable program from a different domain.
RETURN VALUES
Returns a handle to the newly created program on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCombinePrograms2 takes twoprograms from different domains and combines them into a single
CGprogram.This is a convenience function for cgCombinePrograms.
EXAMPLES
CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
vEntryName, NULL);
CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
fEntryName, NULL);
CGprogram combined = cgCombinePrograms2(p1, p2);
cgDestroyProgram(p1);
cgDestroyProgram(p2);
cgGLBindProgram(combined); /* Assuming cgGL runtime */
/* Render... */
ERRORS
The errors listed in cgCombinePrograms might be generated.
HISTORY
cgCombinePrograms2 wasintroduced in Cg 1.5.
SEE ALSO
cgCombinePrograms, cgCombinePrograms3, cgCombinePrograms4, cgCombinePrograms5
perl v5.10.0 Cg Toolkit 3.0 53
cgCombinePrograms3(3) Cg Core Runtime API cgCombinePrograms3(3)
NAME cgCombinePrograms3 −combine programs from three different domains
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCombinePrograms3( const CGprogram program1,
const CGprogram program2,
const CGprogram program3 );
PARAMETERS
program1An executable program from one domain.
program2An executable program from a second domain.
program3An executable program from a third domain.
RETURN VALUES
Returns a handle to the newly created program on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCombinePrograms3 takes three programs from different domains and combines them into a single
CGprogram.This is a convenience function for cgCombinePrograms.
EXAMPLES
CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
vEntryName, NULL);
CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
fEntryName, NULL);
CGprogram p3 = cgCreateProgram(context, CG_SOURCE, gSrc, gProfile,
gEntryName, NULL);
CGprogram combined = cgCombinePrograms3(p1, p2, p3);
cgDestroyProgram(p1);
cgDestroyProgram(p2);
cgDestroyProgram(p3);
cgGLBindProgram(combined); /* Assuming cgGL runtime */
/* Render... */
ERRORS
The errors listed in cgCombinePrograms might be generated.
HISTORY
cgCombinePrograms3 wasintroduced in Cg 1.5.
SEE ALSO
cgCombinePrograms, cgCombinePrograms2, cgCombinePrograms4, cgCombinePrograms5
perl v5.10.0 Cg Toolkit 3.0 54
cgCombinePrograms4(3) Cg Core Runtime API cgCombinePrograms4(3)
NAME cgCombinePrograms4 −combine programs from three different domains
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCombinePrograms4( const CGprogram program1,
const CGprogram program2,
const CGprogram program3,
const CGprogram program4 );
PARAMETERS
program1An executable program from one domain.
program2An executable program from a second domain.
program3An executable program from a third domain.
program4An executable program from a fourth domain.
RETURN VALUES
Returns a handle to the newly created program on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCombinePrograms4 takes four programs from different domains and combines them into a single
CGprogram.This is a convenience function for cgCombinePrograms.
EXAMPLES
CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
vEntryName, NULL);
CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
fEntryName, NULL);
CGprogram p3 = cgCreateProgram(context, CG_SOURCE, tcSrc, tcProfile,
tcEntryName, NULL);
CGprogram p4 = cgCreateProgram(context, CG_SOURCE, teSrc, teProfile,
teEntryName, NULL);
CGprogram combined = cgCombinePrograms4(p1, p2, p3, p4);
cgDestroyProgram(p1);
cgDestroyProgram(p2);
cgDestroyProgram(p3);
cgDestroyProgram(p4);
cgGLBindProgram(combined); /* Assuming cgGL runtime */
/* Render... */
ERRORS
The errors listed in cgCombinePrograms might be generated.
HISTORY
cgCombinePrograms4 wasintroduced in Cg 3.0.
perl v5.10.0 Cg Toolkit 3.0 55
cgCombinePrograms4(3) Cg Core Runtime API cgCombinePrograms4(3)
SEE ALSO
cgCombinePrograms, cgCombinePrograms2, cgCombinePrograms3, cgCombinePrograms5
perl v5.10.0 Cg Toolkit 3.0 56
cgCombinePrograms5(3) Cg Core Runtime API cgCombinePrograms5(3)
NAME cgCombinePrograms5 −combine programs from three different domains
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCombinePrograms5( const CGprogram program1,
const CGprogram program2,
const CGprogram program3,
const CGprogram program4,
const CGprogram program5 );
PARAMETERS
program1An executable program from one domain.
program2An executable program from a second domain.
program3An executable program from a third domain.
program4An executable program from a fourth domain.
program5An executable program from a fifth domain.
RETURN VALUES
Returns a handle to the newly created program on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCombinePrograms5 takes fiveprograms from different domains and combines them into a single
CGprogram.This is a convenience function for cgCombinePrograms.
EXAMPLES
CGprogram p1 = cgCreateProgram(context, CG_SOURCE, vSrc, vProfile,
vEntryName, NULL);
CGprogram p2 = cgCreateProgram(context, CG_SOURCE, fSrc, fProfile,
fEntryName, NULL);
CGprogram p3 = cgCreateProgram(context, CG_SOURCE, gSrc, gProfile,
gEntryName, NULL);
CGprogram p4 = cgCreateProgram(context, CG_SOURCE, tcSrc, tcProfile,
tcEntryName, NULL);
CGprogram p5 = cgCreateProgram(context, CG_SOURCE, teSrc, teProfile,
teEntryName, NULL);
CGprogram combined = cgCombinePrograms5(p1, p2, p3, p4, p5);
cgDestroyProgram(p1);
cgDestroyProgram(p2);
cgDestroyProgram(p3);
cgDestroyProgram(p4);
cgDestroyProgram(p5);
cgGLBindProgram(combined); /* Assuming cgGL runtime */
/* Render... */
perl v5.10.0 Cg Toolkit 3.0 57
cgCombinePrograms5(3) Cg Core Runtime API cgCombinePrograms5(3)
ERRORS
The errors listed in cgCombinePrograms might be generated.
HISTORY
cgCombinePrograms5 wasintroduced in Cg 3.0.
SEE ALSO
cgCombinePrograms, cgCombinePrograms2, cgCombinePrograms3, cgCombinePrograms4
perl v5.10.0 Cg Toolkit 3.0 58
cgCompileProgram(3) Cg Core Runtime API cgCompileProgram(3)
NAME cgCompileProgram −compile a program object
SYNOPSIS
#include <Cg/cg.h>
void cgCompileProgram( CGprogram program );
PARAMETERS
program The program object to compile.
RETURN VALUES
None.
DESCRIPTION
cgCompileProgram compiles the specified Cg program for its target profile. Aprogram must be compiled
before it can be loaded (by the API-specific part of the runtime). It must also be compiled before its
parameters can be inspected.
The compiled program can be retrievedasatextstring by passing CG_COMPILED_PROGRAM to
cgGetProgramString.
Certain actions invalidate a compiled program and the current value of all of its parameters. If one of these
actions is performed, the program must be recompiled before it can be used. Aprogram is invalidated if the
program source is modified, if the compile arguments are modified, or if the entry point is changed.
If one of the parameter bindings for a program is changed, that action invalidates the compiled program, but
does not invalidate the current value of the program’sparameters.
EXAMPLES
if(!cgIsProgramCompiled(program))
cgCompileProgram(program);
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCompileProgram wasintroduced in Cg 1.1.
SEE ALSO
cgIsProgramCompiled, cgCreateProgram, cgGetNextParameter,cgIsParameter,cgGetProgramString
perl v5.10.0 Cg Toolkit 3.0 59
cgConnectParameter(3) Cg Core Runtime API cgConnectParameter(3)
NAME cgConnectParameter −connect twoparameters
SYNOPSIS
#include <Cg/cg.h>
void cgConnectParameter( CGparameter from,
CGparameter to );
PARAMETERS
from The source parameter.
to The destination parameter.
RETURN VALUES
None.
DESCRIPTION
cgConnectParameter connects a source (from) parameter to a destination (to) parameter.The resulting
connection forces the value and variability of the destination parameter to be identical to the source
parameter.Asource parameter may be connected to multiple destination parameters but there may only be
one source parameter per destination parameter.
cgConnectParameter may be used to create an arbitrarily deep tree. Aruntime error will be thrown if a
cycle is inadvertently created. For example, the following code snipped would generate a
CG_BIND_CREATES_CYCLE_ERROR :
CGcontext context = cgCreateContext();
CGparameter Param1 = cgCreateParameter(context, CG_FLOAT);
CGparameter Param2 = cgCreateParameter(context, CG_FLOAT);
CGparameter Param3 = cgCreateParameter(context, CG_FLOAT);
cgConnectParameter(Param1, Param2);
cgConnectParameter(Param2, Param3);
cgConnectParameter(Param3, Param1); /* This will generate the error */
If the source type is a complextype (e.g., struct, or array) the topology and member types of both
parameters must be identical. Each correlating member parameter will be connected.
Both parameters must be of the same type unless the source parameter is a struct type, the destination
parameter is an interface type, and the struct type implements the interface type. In such a case, a copyof
the parameter tree under the source parameter will be duplicated, linked to the orignal tree, and placed
under the destination parameter.
If an array parameter is connected to a resizable array parameter the destination parameter array will
automatically be resized to match the source array.
The source parameter may not be a program parameter.Also the variability of the parameters may not be
CG_VARYING.
EXAMPLES
CGparameter TimeParam1 = cgGetNamedParameter(program1, "time");
CGparameter TimeParam2 = cgGetNamedParameter(program2, "time");
CGparameter SharedTime = cgCreateParameter(context,
cgGetParameterType(TimeParam1));
cgConnectParameter(SharedTime, TimeParam1);
cgConnectParameter(SharedTime, TimeParam2);
cgSetParameter1f(SharedTime, 2.0);
perl v5.10.0 Cg Toolkit 3.0 60
cgConnectParameter(3) Cg Core Runtime API cgConnectParameter(3)
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if either of the from or to parameters are invalid
handles.
CG_PARAMETER_IS_NOT_SHARED_ERROR is generated if the source parameter is a program
parameter.
CG_BIND_CREATES_CYCLE_ERROR is generated if the connection will result in a cycle.
CG_PARAMETERS_DO_NOT_MATCH_ERROR is generated if the parameters do not have the same type
or the topologies do not match.
CG_ARRAY_TYPES_DO_NOT_MATCH_ERROR is generated if the type of twoarrays being connected do
not match.
CG_ARRAY_DIMENSIONS_DO_NOT_MATCH_ERROR is generated if the dimensions of twoarrays being
connected do not match.
HISTORY
cgConnectParameter wasintroduced in Cg 1.2.
SEE ALSO
cgGetConnectedParameter,cgGetConnectedToParameter,cgDisconnectParameter
perl v5.10.0 Cg Toolkit 3.0 61
cgCopyEffect(3) Cg Core Runtime API cgCopyEffect(3)
NAME cgCopyEffect −makeacopyofaneffect
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgCopyEffect( CGeffect effect );
PARAMETERS
effect The effect object to be copied.
RETURN VALUES
Returns a copyofeffect on success.
Returns NULL if effect is invalid or the copyfails.
DESCRIPTION
cgCopyEffect creates a neweffect object that is a copyofeffect and adds it to the same context as effect.
Note: Currently cgCopyEffect does not work and therefore will always returns NULL.
EXAMPLES
CGeffect effectCopy = cgCopyEffect(effect);
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgCopyEffect wasintroduced in Cg 2.0.
cgCopyEffect is not operational as of Cg 3.0.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile, cgDestroyEffect
perl v5.10.0 Cg Toolkit 3.0 62
cgCopyProgram(3) Cg Core Runtime API cgCopyProgram(3)
NAME cgCopyProgram −makeacopyofaprogram object
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCopyProgram( CGprogram program );
PARAMETERS
program The program object to copy.
RETURN VALUES
Returns a copyofprogram on success.
Returns NULL if program is invalid or the copyfails.
DESCRIPTION
cgCopyProgram creates a newprogram object that is a copyofprogram and adds it to the same context
as program.cgCopyProgram is useful for creating a newinstance of a program whose parameter
properties have been modified by the run-time API.
EXAMPLES
CGprogram programCopy = cgCopyProgram(program);
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgCopyProgram wasintroduced in Cg 1.1.
cgCopyProgram is operational as of Cg 3.0.
SEE ALSO
cgCreateProgram, cgDestroyProgram
perl v5.10.0 Cg Toolkit 3.0 63
cgCreateArraySamplerState(3) Cg Core Runtime API cgCreateArraySamplerState(3)
NAME cgCreateArraySamplerState −create an array-typed sampler state definition
SYNOPSIS
#include <Cg/cg.h>
CGstate cgCreateArraySamplerState( CGcontext context,
const char * name,
CGtype type,
int nelements );
PARAMETERS
context The context in which to define the sampler state.
name The name of the newsampler state.
type The type of the newsampler state.
nelements The number of elements in the array.
RETURN VALUES
Returns a handle to the newly created CGstate.
Returns NULL if there is an error.
DESCRIPTION
cgCreateArraySamplerState adds a newarray-typed sampler state definition to context.All state in
sampler_state blocks must have been defined ahead of time via a call to cgCreateSamplerState or
cgCreateArraySamplerState before adding an effect file to the context.
Applications will typically call cgSetStateCallbacks shortly after creating a newstate with
cgCreateArraySamplerState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier,iftype is not
asimple scalar,vector,ormatrix-type, or if nelements is not a positive number.
HISTORY
cgCreateArraySamplerState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateSamplerState, cgGetStateName, cgGetStateType, cgIsState, cgSetStateCallbacks,
cgGLRegisterStates
perl v5.10.0 Cg Toolkit 3.0 64
cgCreateArrayState(3) Cg Core Runtime API cgCreateArrayState(3)
NAME cgCreateArrayState −create an array-typed state definition
SYNOPSIS
#include <Cg/cg.h>
CGstate cgCreateArrayState( CGcontext context,
const char * name,
CGtype type,
int nelements );
PARAMETERS
context The context in which to define the state.
name The name of the newstate.
type The type of the newstate.
nelements The number of elements in the array.
RETURN VALUES
Returns a handle to the newly created CGstate.
Returns NULL if there is an error.
DESCRIPTION
cgCreateArrayState adds a newarray-typed state definition to context.Before a CgFX file is added to a
context, all state assignments in the file must have previously been defined via a call to cgCreateState or
cgCreateArrayState.
Applications will typically call cgSetStateCallbacks shortly after creating a newstate with
cgCreateArrayState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier,iftype is not
asimple scalar,vector,ormatrix-type, or if nelements is not a positive number.
HISTORY
cgCreateArrayState wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateContext, cgGetStateName, cgGetStateType, cgIsState, cgSetStateCallbacks, cgGLRegisterStates
perl v5.10.0 Cg Toolkit 3.0 65
cgCreateBuffer(3) Cg Core Runtime API cgCreateBuffer(3)
NAME cgCreateBuffer −create a buffer object managed by the runtime
SYNOPSIS
#include <Cg/cg.h>
CGbuffer cgCreateBuffer( CGcontext context,
int size,
const void *data,
CGbufferusage bufferUsage );
PARAMETERS
context The context to which the newbuffer will be added.
size The length in bytes of the buffer to create.
data Pointer to inital buffer data. NULL will fill the buffer with zero.
bufferUsage
Indicates the intended usage method of the buffer.
Can be one of the following types:
CG_BUFFER_USAGE_STREAM_DRAW
CG_BUFFER_USAGE_STREAM_READ
CG_BUFFER_USAGE_STREAM_COPY
CG_BUFFER_USAGE_STATIC_DRAW
CG_BUFFER_USAGE_STATIC_READ
CG_BUFFER_USAGE_STATIC_COPY
CG_BUFFER_USAGE_DYNAMIC_DRAW
CG_BUFFER_USAGE_DYNAMIC_READ
CG_BUFFER_USAGE_DYNAMIC_COPY
RETURN VALUES
Returns a CGbuffer handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateBuffer creates a runtime managed Cg buffer object.
There is no way to query the 3D API-specific resource for a managed buffer.cgGLCreateBuffer should be
used if the application wishes to later query the 3D API-specific resource for the buffer.
EXAMPLES
CGbuffer myBuffer = cgCreateBuffer( myCgContext, sizeof( float ) * 16,
initalData, CG_BUFFER_USAGE_STATIC_DRAW );
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgCreateBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgGLCreateBuffer,cgDestroyBuffer
perl v5.10.0 Cg Toolkit 3.0 66
cgCreateContext(3) Cg Core Runtime API cgCreateContext(3)
NAME cgCreateContext −create a context
SYNOPSIS
#include <Cg/cg.h>
CGcontext cgCreateContext( void );
PARAMETERS
None.
RETURN VALUES
Returns a valid CGcontext on success.
Returns NULL if context creation fails.
DESCRIPTION
cgCreateContext creates a Cg context object and returns its handle. ACgcontext is a container for Cg
programs. All Cg programs must be added to a Cg context.
EXAMPLES
CGcontext context = cgCreateContext();
ERRORS
CG_MEMORY_ALLOC_ERROR is generated if a context couldn’tbecreated.
HISTORY
cgCreateContext wasintroduced in Cg 1.1.
SEE ALSO
cgDestroyContext, cgSetContextBehavior,cgGetContextBehavior,cgCreateProgram, cgCreateEffect,
cgCreateState
perl v5.10.0 Cg Toolkit 3.0 67
cgCreateEffect(3) Cg Core Runtime API cgCreateEffect(3)
NAME cgCreateEffect −create an effect object from a source string
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgCreateEffect( CGcontext context,
const char * source,
const char ** args );
PARAMETERS
context The context to which the neweffect will be added.
source A string containing the effect’ssource code.
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGeffect handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateEffect generates a new CGeffect object and adds it to the specified Cg context.
If an error occurs cgGetLastListing can be called to retrieve any warning or error messages from the
compilation process.
EXAMPLES
Creating an effect:
char *effectSource = ...;
CGcontext context = cgCreateContext();
CGeffect effect =cgCreateEffect(context,
effectSource,
NULL);
Iterating through the techniques in an effect:
CGtechnique technique = cgGetFirstTechnique(effect);
while (technique) {
// Do something with each technique
technique = cgGetNextTechnique(technique);
}
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCreateEffect wasintroduced in Cg 1.4.
SEE ALSO
cgCreateContext, cgCreateEffectFromFile, cgGetLastListing, cgGetFirstTechnique, cgGetTechniqueEffect,
cgGetFirstEffect
perl v5.10.0 Cg Toolkit 3.0 68
cgCreateEffectAnnotation(3) Cg Core Runtime API cgCreateEffectAnnotation(3)
NAME cgCreateEffectAnnotation −create an effect annotation
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgCreateEffectAnnotation( CGeffect effect,
const char * name,
CGtype type );
PARAMETERS
effect The effect to which the newannotation will be added.
name The name of the newannotation.
type The type of the newannotation.
RETURN VALUES
Returns the new CGannotation handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateEffectAnnotation adds a newannotation to the effect.
EXAMPLES
/* create a float annotation named "Apple" for CGeffect effect */
CGannotation ann = cgCreateEffectAnnotation( effect, "Apple", CG_FLOAT );
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this effect.
CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT,CG_FLOAT,CG_BOOL,or
CG_STRING.
HISTORY
cgCreateEffectAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedEffectAnnotation, cgGetFirstEffectAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 69
cgCreateEffectFromFile(3) Cg Core Runtime API cgCreateEffectFromFile(3)
NAME cgCreateEffectFromFile −create an effect object from a file
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgCreateEffectFromFile( CGcontext context,
const char * filename,
const char ** args );
PARAMETERS
context The context to which the neweffect will be added.
filename Name of a file that contains the effect’ssource code.
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGeffect handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateEffectFromFile generates a new CGeffect object and adds it to the specified Cg context.
If an error occurs cgGetLastListing can be called to retrieve any warning or error messages from the
compilation process.
EXAMPLES
CGcontext context = cgCreateContext();
CGeffect effect = cgCreateEffectFromFile(context, "filename.cgfx", NULL);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_FILE_READ_ERROR is generated if the givenfilename cannot be read.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCreateEffectFromFile wasintroduced in Cg 1.4.
SEE ALSO
cgCreateContext, cgCreateEffect, cgGetLastListing, cgGetTechniqueEffect, cgGetEffectName,
cgSetEffectName, cgCreateEffectAnnotation, cgDestroyEffect, cgGetFirstEffect
perl v5.10.0 Cg Toolkit 3.0 70
cgCreateEffectParameter(3) Cg Core Runtime API cgCreateEffectParameter(3)
NAME cgCreateEffectParameter −create a parameter in an effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateEffectParameter( CGeffect effect,
const char * name,
CGtype type );
PARAMETERS
effect The effect to which the newparameter will be added.
name The name of the newparameter.
type The type of the newparameter.
RETURN VALUES
Returns the handle to the newparameter.
DESCRIPTION
cgCreateEffectParameter adds a newparameter to the specified effect.
EXAMPLES
CGeffect effect = cgCreateEffect( ... );
CGparameter param = cgCreateEffectParameter( effect, "myFloatParam", CG_FLOAT );
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
HISTORY
cgCreateEffectParameter wasintroduced in Cg 1.5.
SEE ALSO
cgIsParameter,cgCreateEffectParameterArray,cgCreateEffectParameterMultiDimArray,
cgCreateTechnique, cgCreatePass, cgConnectParameter
perl v5.10.0 Cg Toolkit 3.0 71
cgCreateEffectParameterArray(3) Cg Core Runtime API cgCreateEffectParameterArray(3)
NAME cgCreateEffectParameterArray −create an array parameter in an effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateEffectParameterArray( CGeffect effect,
const char * name,
CGtype type,
int length );
PARAMETERS
effect The effect to which the newparameter will be added.
name The name of the newparameter.
type The type of the newparameter.
length The size of the array.
RETURN VALUES
Returns the handle to the newarray parameter on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateEffectParameterArray adds a newarray parameter to the specificed effect.
EXAMPLES
CGeffect effect = cgCreateEffect( ... );
CGparameter array = cgCreateEffectParameterArray( effect, "myFloatArray",
CG_FLOAT, 2 );
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
HISTORY
cgCreateEffectParameterArray wasintroduced in Cg 1.5.
SEE ALSO
cgCreateEffectParameter,cgCreateEffectParameterMultiDimArray
perl v5.10.0 Cg Toolkit 3.0 72
cgCreateEffectParameterMultiDimArray(3) Cg Core Runtime API cgCreateEffectParameterMultiDimArray(3)
NAME cgCreateEffectParameterMultiDimArray −create a multi-dimensional array in an effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateEffectParameterMultiDimArray( CGeffect effect,
const char * name,
CGtype type,
int dim,
const int * lengths );
PARAMETERS
effect The effect to which the newparameter will be added.
name The name of the newparameter.
type The type of the newparameter.
dim The dimension of the array.
lengths The sizes for each dimension of the array.
RETURN VALUES
Returns the handle of the newparameter on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateEffectParameterMultiDimArray adds a newmultidimensional array parameter to the specified
effect.
EXAMPLES
CGeffect effect = cgCreateEffect( ... );
int lengths[] = {2,2};
CGparameter array = cgCreateEffectParameterMultiDimArray(effect,
"myFloatMultiArray", CG_FLOAT, 2, lengths);
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
HISTORY
cgCreateEffectParameterMultiDimArray wasintroduced in Cg 1.5.
SEE ALSO
cgCreateEffectParameter,cgCreateEffectParameterArray
perl v5.10.0 Cg Toolkit 3.0 73
cgCreateObj(3) Cg Core Runtime API cgCreateObj(3)
NAME cgCreateObj −create a cg object type from a shader string
SYNOPSIS
#include <Cg/cg.h>
CGobj cgCreateObj( CGcontext context,
CGenum program_type,
const char * source,
CGprofile profile,
const char ** args );
PARAMETERS
context The context to which the newobject will be added.
program_type
An enumerant describing the contents of the source string. The following enumerants are
allowed:
CG_SOURCE
source contains Cg source code.
CG_OBJECT
source contains object code that resulted from the precompilation of some Cg source code.
source A string containing either the programs source or object code. See program_type for more
information.
profile The profile enumerant for the program.
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGobj handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateObj creates a new CGobj which is a source code object similar to a .obj or .o in C/C++
programming where various forms of data can be extracted. This can be used, for example, to create user
defined data types from a Cg source string.
EXAMPLES
// Imagine a Cg source string that contains:
const char src[] =
"typedef struct { \n"
"float3 param1; \n"
"half4 param2; \n"
"} MyType;";
// To create a Cg obj:
CGcontext ctx = cgCreateContext();
CGobj structObj = cgCreateObj(ctx, CG_SOURCE, src, CG_PROFILE_ARBVP1, NULL);
// Now we can get the CGtype:
CGtype userDefinedMyType = cgGetNamedUserType(structObj, "MyType");
// We could also iterate through all the types in the CGobj printing their
perl v5.10.0 Cg Toolkit 3.0 74
cgCreateObj(3) Cg Core Runtime API cgCreateObj(3)
// names like this:
int numTypes = cgGetNumUserTypes(structObj);
for (int i=0; i<numTypes; i++) {
cout << cgGetTypeString(cgGetUserType(structObj, i)) << endl;
}
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE or CG_OBJECT.
CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCreateObj wasintroduced in Cg 2.0.
SEE ALSO
cgCreateObjFromFile, cgDestroyObj
perl v5.10.0 Cg Toolkit 3.0 75
cgCreateObjFromFile(3) Cg Core Runtime API cgCreateObjFromFile(3)
NAME cgCreateObjFromFile −create a cg object type from a shader file
SYNOPSIS
#include <Cg/cg.h>
CGobj cgCreateObjFromFile( CGcontext context,
CGenum program_type,
const char * source_file,
CGprofile profile,
const char ** args );
PARAMETERS
context The context to which the newobject will be added.
program_type
An enumerant describing the contents of the source string. The following enumerants are
allowed:
CG_SOURCE
source contains Cg source code.
CG_OBJECT
source contains object code that resulted from the precompilation of some Cg source code.
source_file
Name of a file containing source or object code. See program_type for more information.
profile The profile enumerant for the program.
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGobj handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateObjFromFile creates a new CGobj which is a source code object similar to a .obj or .o in C/C++
programming where various forms of data can be extracted. This can be used, for example, to create user
defined data types from a Cg source string.
EXAMPLES
// To create a Cg obj:
CGcontext ctx = cgCreateContext();
CGobj structObj = cgCreateObjFromFile(ctx, CG_SOURCE, source_file,
CG_PROFILE_ARBVP1, NULL);
// Now we can get the CGtype:
CGtype userDefinedMyType = cgGetNamedUserType(structObj, "MyType");
// We could also iterate through all the types in the CGobj printing
// their names like this:
int numTypes = cgGetNumUserTypes(structObj);
for (int i=0; i<numTypes; i++) {
cout << cgGetTypeString(cgGetUserType(structObj, i)) << endl;
}
perl v5.10.0 Cg Toolkit 3.0 76
cgCreateObjFromFile(3) Cg Core Runtime API cgCreateObjFromFile(3)
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE or CG_OBJECT.
CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCreateObjFromFile wasintroduced in Cg 2.0.
SEE ALSO
cgCreateObj, cgDestroyObj
perl v5.10.0 Cg Toolkit 3.0 77
cgCreateParameter(3) Cg Core Runtime API cgCreateParameter(3)
NAME cgCreateParameter −create a parameter
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateParameter( CGcontext context,
CGtype type );
PARAMETERS
context The context to which the newparameter will be added.
type The type of the newparameter.
RETURN VALUES
Returns the handle to the newparameter.
DESCRIPTION
cgCreateParameter creates context levelshared parameters. These parameters are primarily used by
connecting them to one or more program parameters with cgConnectParameter.
EXAMPLES
CGcontext context = cgCreateContext();
CGparameter param = cgCreateParameter(context, CG_FLOAT);
ERRORS
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgCreateParameter wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameterArray,cgCreateParameterMultiDimArray,cgCreateEffectParameter,
cgDestroyParameter,cgConnectParameter
perl v5.10.0 Cg Toolkit 3.0 78
cgCreateParameterAnnotation(3) Cg Core Runtime API cgCreateParameterAnnotation(3)
NAME cgCreateParameterAnnotation −create an annotation in a parameter
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgCreateParameterAnnotation( CGparameter param,
const char * name,
CGtype type );
PARAMETERS
parm The parameter to which the newannotation will be added.
name The name of the newannotation.
type The type of the newannotation.
RETURN VALUES
Returns the new CGannotation handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateParameterAnnotation adds a newannotation to the specified parameter.
EXAMPLES
CGannotation ann = cgCreateParameterAnnotation( param, "Apple", CG_FLOAT );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this parameter.
CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT,CG_FLOAT,CG_BOOL,or
CG_STRING.
HISTORY
cgCreateParameterAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedParameterAnnotation, cgGetFirstParameterAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 79
cgCreateParameterArray(3) Cg Core Runtime API cgCreateParameterArray(3)
NAME cgCreateParameterArray −creates a parameter array
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateParameterArray( CGcontext context,
CGtype type,
int length );
PARAMETERS
context The context to which the newparameter will be added.
type The type of the newparameter.
length The length of the array being created.
RETURN VALUES
Returns the handle to the newparameter array.
DESCRIPTION
cgCreateParameterArray creates context levelshared parameter arrays. These parameters are primarily
used by connecting them to one or more program parameter arrays with cgConnectParameter.
cgCreateParameterArray works similarly to cgCreateParameter,but creates an array of parameters rather
than a single parameter.
EXAMPLES
CGcontext context = cgCreateContext();
CGparameter param = cgCreateParameterArray(context, CG_FLOAT, 5);
ERRORS
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgCreateParameterArray wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameter,cgCreateParameterMultiDimArray,cgDestroyParameter
perl v5.10.0 Cg Toolkit 3.0 80
cgCreateParameterMultiDimArray(3) Cg Core Runtime API cgCreateParameterMultiDimArray(3)
NAME cgCreateParameterMultiDimArray −creates a multi-dimensional parameter array
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgCreateParameterMultiDimArray( CGcontext context,
CGtype type,
int dim,
const int * lengths );
PARAMETERS
context The context to which the newparameter will be added.
type The type of the newparameter.
dim The dimension of the multi-dimensional array.
lengths An array of length values, one for each dimension of the array to be created.
RETURN VALUES
Returns the handle to the newparameter array.
DESCRIPTION
cgCreateParameterMultiDimArray creates context levelshared multi-dimensional parameter arrays.
These parameters are primarily used by connecting them to one or more program parameter arrays with
cgConnectParameter.
cgCreateParameterMultiDimArray works similarly to cgCreateParameterArray.Instead of taking a
single length parameter it takes an array of lengths, one per dimension. The dimension of the array is
defined by the dim parameter.
EXAMPLES
/* Creates a three dimensional float array similar to */
/* the C declaration : float param[5][3][4]; */
int lengths[] = { 5, 3, 4 };
CGcontext context = cgCreateContext();
CGparameter param = cgCreateParameterMultiDimArray(context, CG_FLOAT,
3, lengths);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_VALUE_TYPE_ERROR is generated if type is invalid.
HISTORY
cgCreateParameterMultiDimArray wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameter,cgCreateParameterArray,cgDestroyParameter,cgConnectParameter
perl v5.10.0 Cg Toolkit 3.0 81
cgCreatePass(3) Cg Core Runtime API cgCreatePass(3)
NAME cgCreatePass −create a pass in a technique
SYNOPSIS
#include <Cg/cg.h>
CGpass cgCreatePass( CGtechnique tech,
const char * name );
PARAMETERS
tech The technique to which the newpass will be added.
name The name of the newpass.
RETURN VALUES
Returns the handle to the newpass on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreatePass adds a newpass to the specified technique.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgCreatePass wasintroduced in Cg 1.5.
SEE ALSO
cgCreateTechnique
perl v5.10.0 Cg Toolkit 3.0 82
cgCreatePassAnnotation(3) Cg Core Runtime API cgCreatePassAnnotation(3)
NAME cgCreatePassAnnotation −create an annotation in a pass
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgCreatePassAnnotation( CGpass pass,
const char * name,
CGtype type );
PARAMETERS
pass The pass to which the newannotation will be added.
name The name of the newannotation.
type The type of the newannotation.
RETURN VALUES
Returns the new CGannotation handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreatePassAnnotation adds a newannotation to a pass.
EXAMPLES
/* create a float annotation named "Apple" for CGpass pass */
CGannotation ann = cgCreatePassAnnotation( pass, "Apple", CG_FLOAT );
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this pass.
CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT,CG_FLOAT,CG_BOOL,or
CG_STRING.
HISTORY
cgCreatePassAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedPassAnnotation, cgGetFirstPassAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 83
cgCreateProgram(3) Cg Core Runtime API cgCreateProgram(3)
NAME cgCreateProgram −create a program object from a string
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCreateProgram( CGcontext context,
CGenum program_type,
const char * program,
CGprofile profile,
const char * entry,
const char ** args );
PARAMETERS
context The context to which the newprogram will be added.
program_type
An enumerant describing the contents of the program string. The following enumerants are
allowed:
CG_SOURCE
program contains Cg source code.
CG_OBJECT
program contains object code that resulted from the precompilation of some Cg source
code.
program A string containing either the programs source or object code. See program_type for more
information.
profile The profile enumerant for the program.
entry The entry point to the program in the Cg source. If NULL,the entry point defaults to "main".
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGprogram handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateProgram generates a new CGprogram object and adds it to the specified Cg context.
EXAMPLES
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgram(context,
CG_SOURCE,
mysourcestring,
CG_PROFILE_ARBVP1,
"myshader",
NULL);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE or CG_OBJECT.
CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.
CG_COMPILER_ERROR is generated if compilation fails.
perl v5.10.0 Cg Toolkit 3.0 84
cgCreateProgram(3) Cg Core Runtime API cgCreateProgram(3)
HISTORY
cgCreateProgram wasintroduced in Cg 1.1.
SEE ALSO
cgCreateContext, cgCreateProgramFromFile, cgDestroyProgram, cgGetProgramString
perl v5.10.0 Cg Toolkit 3.0 85
cgCreateProgramAnnotation(3) Cg Core Runtime API cgCreateProgramAnnotation(3)
NAME cgCreateProgramAnnotation −create an annotation in a program
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgCreateProgramAnnotation( CGprogram program,
const char * name,
CGtype type );
PARAMETERS
program The program to which the newannotation will be added.
name The name of the newannotation.
type The type of the newannotation.
RETURN VALUES
Returns the new CGannotation handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateProgramAnnotation adds a newannotation to a program.
EXAMPLES
/* create a float annotation named "Apple" for CGprogram prog */
CGannotation ann = cgCreateProgramAnnotation( prog, "Apple", CG_FLOAT );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this program.
CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT,CG_FLOAT,CG_BOOL,or
CG_STRING.
HISTORY
cgCreateProgramAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedProgramAnnotation, cgGetFirstProgramAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 86
cgCreateProgramFromEffect(3) Cg Core Runtime API cgCreateProgramFromEffect(3)
NAME cgCreateProgramFromEffect −create a program object from an effect
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCreateProgramFromEffect( CGeffect effect,
CGprofile profile,
const char * entry,
const char ** args );
PARAMETERS
effect The effect containing the program source code from which to create the program.
profile The profile enumerant for the program.
entry The entry point to the program in the Cg source. If NULL,the entry point defaults to "main".
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGprogram handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateProgramFromEffect generates a new CGprogram object and adds it to the effect’sCgcontext.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.
CG_COMPILER_ERROR is generated if compilation fails.
HISTORY
cgCreateProgramFromEffect wasintroduced in Cg 1.4.
SEE ALSO
cgCreateProgram, cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 87
cgCreateProgramFromFile(3) Cg Core Runtime API cgCreateProgramFromFile(3)
NAME cgCreateProgramFromFile −create a program object from a file
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgCreateProgramFromFile( CGcontext context,
CGenum program_type,
const char * program_file,
CGprofile profile,
const char * entry,
const char ** args );
PARAMETERS
context The context to which the newprogram will be added.
program_type
An enumerant describing the contents of the program_file.The following enumerants are
allowed:
CG_SOURCE
program_file contains Cg source code.
CG_OBJECT
program_file contains object code that resulted from the precompilation of some Cg source
code.
program_file
Name of a file containing source or object code. See program_type for more information.
profile The profile enumerant for the program.
entry The entry point to the program in the Cg source. If NULL,the entry point defaults to "main".
args If args is not NULL it is assumed to be an array of NULL-terminated strings that will be passed
directly to the compiler as arguments. The last value of the array must be a NULL.
RETURN VALUES
Returns a CGprogram handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateProgramFromFile generates a new CGprogram object and adds it to the specified Cg context.
EXAMPLES
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgramFromFile(context,
CG_SOURCE,
mysourcefilename,
CG_PROFILE_ARBVP1,
"myshader",
NULL);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE or CG_OBJECT.
CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.
CG_COMPILER_ERROR is generated if compilation fails.
perl v5.10.0 Cg Toolkit 3.0 88
cgCreateProgramFromFile(3) Cg Core Runtime API cgCreateProgramFromFile(3)
HISTORY
cgCreateProgramFromFile wasintroduced in Cg 1.1.
SEE ALSO
cgCreateContext, cgCreateProgram, cgCreateProgramFromEffect, cgGetProgramString
perl v5.10.0 Cg Toolkit 3.0 89
cgCreateSamplerState(3) Cg Core Runtime API cgCreateSamplerState(3)
NAME cgCreateSamplerState −create a sampler state definition
SYNOPSIS
#include <Cg/cg.h>
CGstate cgCreateSamplerState( CGcontext context,
const char * name,
CGtype type );
PARAMETERS
context The context in which to define the newsampler state.
name The name of the newsampler state.
type The type of the newsampler state.
RETURN VALUES
Returns a handle to the newly created CGstate.
Returns NULL if there is an error.
DESCRIPTION
cgCreateSamplerState adds a newsampler state definition to the context. When an effect file is added to
the context, all state in sampler_state blocks must have already been defined via a call to
cgCreateSamplerState or cgCreateArraySamplerState.
Applications will typically call cgSetStateCallbacks shortly after creating a newstate with
cgCreateSamplerState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier,oriftype is
not a simple scalar,vector,ormatrix-type. Array-typed state should be created with cgCreateArrayState.
HISTORY
cgCreateSamplerState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateArraySamplerState, cgGetStateName, cgGetStateType, cgIsState,
cgCreateSamplerStateAssignment, cgGLRegisterStates
perl v5.10.0 Cg Toolkit 3.0 90
cgCreateSamplerStateAssignment(3) Cg Core Runtime API cgCreateSamplerStateAssignment(3)
NAME cgCreateSamplerStateAssignment −create a sampler state assignment
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgCreateSamplerStateAssignment( CGparameter param,
CGstate state );
PARAMETERS
param The sampler parameter to which the newstate assignment will be associated.
state The state for which to create the newstate assignment.
RETURN VALUES
Returns the handle to the created sampler state assignment.
DESCRIPTION
cgCreateSamplerStateAssignment creates a newstate assignment for the givenstate and sampler
parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgCreateSamplerStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgCreateTechnique, cgCreateStateAssignment, cgCreateSamplerState
perl v5.10.0 Cg Toolkit 3.0 91
cgCreateState(3) Cg Core Runtime API cgCreateState(3)
NAME cgCreateState −create a state definition
SYNOPSIS
#include <Cg/cg.h>
CGstate cgCreateState( CGcontext context,
const char * name,
CGtype type );
PARAMETERS
context The context in which to define the newstate.
name The name of the newstate.
type The type of the newstate.
RETURN VALUES
Returns a handle to the newly created CGstate.
Returns NULL if there is an error.
DESCRIPTION
cgCreateState adds a newstate definition to the context. When aCgFX file is added to the context, all
state assignments in the file must have already been defined via a call to cgCreateState or
cgCreateArrayState.
Applications will typically call cgSetStateCallbacks shortly after creating a newstate with cgCreateState.
EXAMPLES
Example callback functions for a state to register:
CGbool foo_set( CGstateassignment sa )
{
int nVals = 0;
const CGbool *val = cgGetBoolStateAssignmentValues( sa, &nVals );
printf( "\nFooState set called with value %d.\n", *val );
return CG_TRUE;
}
CGbool foo_reset( CGstateassignment sa )
{
printf( "\nFooState reset called.\n" );
return CG_TRUE;
}
CGbool foo_validate( CGstateassignment sa )
{
printf( "FooState validate called.\n" );
return CG_TRUE;
}
Registering the state:
// Create and register new state FooState
CGstate fooState = cgCreateState( myCgContext, "FooState", CG_BOOL );
cgSetStateCallbacks( fooState, foo_set, foo_reset, foo_validate );
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier,oriftype is
not a simple scalar,vector,ormatrix-type. Array-typed state should be created with cgCreateArrayState.
perl v5.10.0 Cg Toolkit 3.0 92
cgCreateState(3) Cg Core Runtime API cgCreateState(3)
HISTORY
cgCreateState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateArrayState, cgGetStateContext, cgGetStateName, cgGetStateType, cgIsState, cgSetStateCallbacks,
cgGLRegisterStates, cgD3D9RegisterStates, cgCreateContext
perl v5.10.0 Cg Toolkit 3.0 93
cgCreateStateAssignment(3) Cg Core Runtime API cgCreateStateAssignment(3)
NAME cgCreateStateAssignment −create a state assignment
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgCreateStateAssignment( CGpass pass,
CGstate state );
PARAMETERS
pass The pass in which to create the state assignment.
state The state used to create the state assignment.
RETURN VALUES
Returns the handle to the created state assignment.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateStateAssignment creates a state assignment for the specified pass. The newstate assignment is
appended to the pass’ existing list of state assignments. If the state is actually a state array,the created state
assignment is created for array indexzero. Use cgCreateStateAssignmentIndextocreate state assignments
for other indices of an array state.
EXAMPLES
/* Procedurally create state assignment equivalent to */
/* "BlendFunc = { SrcAlpha, OneMinusSrcAlpha };" */
CGstate blendFuncState = cgGetNamedState(context, "BlendFunc");
CGstateassignment blendFuncSA =
cgCreateStateAssignment(pass, blendFuncState);
static const int blendFuncConfig[2] =
{GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
cgSetIntArrayStateAssignment(blendFuncSA, blendFuncConfig);
/* Procedurally create state assignment equivalent to */
/* "BlendEnable = true;" */
CGstate blendEnableState =
cgGetNamedState(context, "BlendEnable");
CGstateassignment blendEnableSA =
cgCreateStateAssignment(pass, blendEnableState);
cgSetBoolStateAssignment(blendEnableSA, CG_TRUE);
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgCreateStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState, cgCreateStateAssignmentIndex
perl v5.10.0 Cg Toolkit 3.0 94
cgCreateStateAssignmentIndex(3) Cg Core Runtime API cgCreateStateAssignmentIndex(3)
NAME cgCreateStateAssignmentIndex −create a state assignment for a state array
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgCreateStateAssignmentIndex( CGpass pass,
CGstate state,
int index );
PARAMETERS
pass The pass in which to create the state assignment.
state The state array used to create the state assignment.
indexThe indexfor the state array.
RETURN VALUES
Returns the newstate assignment handle.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateStateAssignmentIndex creates a state assignment for the specified pass. The newstate
assignment is appended to the pass’sexisting list of state assignments. The state assignment is for the given
indexoffor the specified array state.
EXAMPLES
This example shows howtocreate a state assignment for enabling light 5:
/* Procedurally create state assignment equivalent to */
/* "LightEnable[5] = 1;" */
CGstate lightEnableState = cgGetNamedState(context, "LightEnable");
CGstateassignment light5sa =
cgCreateStateAssignmentIndex(pass, lightEnableState , 5);
cgSetBoolStateAssignment(light5sa, CG_TRUE);
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
If the index is negative orindex is greater than or equal the number of elements for the state array,noerror
is generated but NULL is returned.
HISTORY
cgCreateStateAssignmentIndex wasintroduced in Cg 1.5.
SEE ALSO
cgGetStateAssignmentIndex, cgCreateTechnique, cgCreateSamplerStateAssignment, cgCreateState,
cgCreateStateAssignment
perl v5.10.0 Cg Toolkit 3.0 95
cgCreateTechnique(3) Cg Core Runtime API cgCreateTechnique(3)
NAME cgCreateTechnique −create a technique in an effect
SYNOPSIS
#include <Cg/cg.h>
CGtechnique cgCreateTechnique( CGeffect effect,
const char * name );
PARAMETERS
effect The effect to which the newtechnique will be added.
name The name for the newtechnique.
RETURN VALUES
Returns the handle to the newtechnique on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateTechnique adds a newtechnique to the specified effect.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgCreateTechnique wasintroduced in Cg 1.5.
SEE ALSO
cgIsTechnique, cgCreatePass, cgCreateEffectParameter,cgCreateEffectParameterArray,
cgCreateEffectParameterMultiDimArray
perl v5.10.0 Cg Toolkit 3.0 96
cgCreateTechniqueAnnotation(3) Cg Core Runtime API cgCreateTechniqueAnnotation(3)
NAME cgCreateTechniqueAnnotation −create a technique annotation
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgCreateTechniqueAnnotation( CGtechnique tech,
const char * name,
CGtype type );
PARAMETERS
tech The technique to which the newannotation will be added.
name The name of the newannotation.
type The type of the newannotation.
RETURN VALUES
Returns the new CGannotation handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgCreateTechniqueAnnotation adds a newannotation to the technique.
EXAMPLES
/* create a float annotation named "Apple" for CGtechnique technique */
CGannotation ann = cgCreateTechniqueAnnotation( tech, "Apple", CG_FLOAT );
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
CG_DUPLICATE_NAME_ERROR is generated if name is already used by an annotation for this technique.
CG_INVALID_ENUMERANT_ERROR is generated if type is not CG_INT,CG_FLOAT,CG_BOOL,or
CG_STRING.
HISTORY
cgCreateTechniqueAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedTechniqueAnnotation, cgGetFirstTechniqueAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 97
cgDestroyBuffer(3) Cg Core Runtime API cgDestroyBuffer(3)
NAME cgDestroyBuffer −delete a buffer
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyBuffer( CGbuffer buffer );
PARAMETERS
buffer The buffer to delete.
RETURN VALUES
None.
DESCRIPTION
cgDestroyBuffer deletes a buffer.The buffer object is not actually destroyed until no more programs are
bound to the buffer object and anypending use of the buffer has completed. However, the handle buffer no
longer refers to the buffer object (although it may be subsequently allocated to a different created resource).
EXAMPLES
cgDestroyBuffer( myBuffer );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
HISTORY
cgDestroyBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 98
cgDestroyContext(3) Cg Core Runtime API cgDestroyContext(3)
NAME cgDestroyContext −destroyacontext
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyContext( CGcontext context );
PARAMETERS
context
The context to be deleted.
RETURN VALUES
None.
DESCRIPTION
cgDestroyContext deletes a Cg context object and all the programs it contains.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgDestroyContext wasintroduced in Cg 1.1.
SEE ALSO
cgCreateContext
perl v5.10.0 Cg Toolkit 3.0 99
cgDestroyEffect(3) Cg Core Runtime API cgDestroyEffect(3)
NAME cgDestroyEffect −destroyaneffect
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyEffect( CGeffect effect );
PARAMETERS
effect The effect object to delete.
RETURN VALUES
None.
DESCRIPTION
cgDestroyEffect removesthe specified effect object and all its associated data. Any CGeffect handles that
reference this effect will become invalid after the effect is deleted. Likewise, all techniques, passes, and
parameters contained in the effect also become invalid after the effect is destroyed.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgDestroyEffect wasintroduced in Cg 1.4.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile
perl v5.10.0 Cg Toolkit 3.0 100
cgDestroyObj(3) Cg Core Runtime API cgDestroyObj(3)
NAME cgDestroyObj −destroyanobj
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyObj( CGobj obj );
PARAMETERS
obj The object to delete.
RETURN VALUES
None.
DESCRIPTION
cgDestroyObj removedthe specified object and all its associated data.
EXAMPLES
CGcontext ctx = cgCreateContext();
CGobj structObj = cgCreateObj(ctx, CG_SOURCE, src, CG_PROFILE_ARBVP1, NULL);
// Use obj, then ...
cgDestroyObj( structObj );
ERRORS
CG_INVALID_OBJ_HANDLE_ERROR is generated if obj is not a valid object handle.
HISTORY
cgDestroyObj wasintroduced in Cg 2.0.
SEE ALSO
cgCreateObj, cgCreateObjFromFile
perl v5.10.0 Cg Toolkit 3.0 101
cgDestroyParameter(3) Cg Core Runtime API cgDestroyParameter(3)
NAME cgDestroyParameter −destroyaparameter
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyParameter( CGparameter param );
PARAMETERS
param The parameter to destroy.
RETURN VALUES
None.
DESCRIPTION
cgDestroyParameter destroys parameters created with cgCreateParameter,cgCreateParameterArray,or
cgCreateParameterMultiDimArray.
Upon destruction, param will become invalid. Anyconnections (see cgConnectParameter) in which
param is the destination parameter will be disconnected. An error will be thrown if param is a source
parameter in anyconnections.
The parameter being destroyed may not be one of the children parameters of a struct or array parameter.In
other words it must be a CGparameter returned by one of the cgCreateParameter family of entry points.
EXAMPLES
CGcontext context = cgCreateContext();
CGparameter floatParam = cgCreateParameter(context, CG_FLOAT);
CGparameter floatParamArray = cgCreateParameterArray(context, CG_FLOAT, 5);
/* ... */
cgDestroyParameter(floatParam);
cgDestroyParameter(floatParamArray);
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_NOT_ROOT_PARAMETER_ERROR is generated if the param isn’tthe top-levelparameter of a struct
or array that was created.
CG_PARAMETER_IS_NOT_SHARED_ERROR is generated if param does not refer to a parameter created
by one of the cgCreateParameter family of entry points.
CG_CANNOT_DESTROY_PARAMETER_ERROR is generated if param is a source parameter in a
connection made by cgConnectParameter.cgDisconnectParameter should be used before calling
cgDestroyParameter in such a case.
HISTORY
cgDestroyParameter wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameter,cgCreateParameterArray,cgCreateParameterMultiDimArray
perl v5.10.0 Cg Toolkit 3.0 102
cgDestroyProgram(3) Cg Core Runtime API cgDestroyProgram(3)
NAME cgDestroyProgram −destroyaprogram
SYNOPSIS
#include <Cg/cg.h>
void cgDestroyProgram( CGprogram program );
PARAMETERS
program The program object to delete.
RETURN VALUES
None.
DESCRIPTION
cgDestroyProgram removesthe specified program object and all its associated data. Any CGprogram
variables that reference this program will become invalid after the program is deleted. Likewise, any
objects contained by this program (e.g. CGparameter objects) will also become invalid after the program
is deleted.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgDestroyProgram wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram, cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 103
cgDisconnectParameter(3) Cg Core Runtime API cgDisconnectParameter(3)
NAME cgDisconnectParameter −disconnects twoparameters
SYNOPSIS
#include <Cg/cg.h>
void cgDisconnectParameter( CGparameter param );
PARAMETERS
param The destination parameter in the connection that will be disconnected.
RETURN VALUES
None.
DESCRIPTION
cgDisconnectParameter disconnects an existing connection made with cgConnectParameter between two
parameters. Since agiv e nparameter can only be connected to one source parameter,only the destination
parameter is required as an argument to cgDisconnectParameter.
If the type of param is an interface and the struct connected to it implements the interface, anysub-
parameters created by the connection will also be destroyed. See cgConnectParameter for more
information.
EXAMPLES
CGparameter timeParam = cgGetNamedParameter(program, "time");
CGparameter sharedTime = cgCreateParameter(context,
cgGetParameterType(timeParam));
cgConnectParameter(sharedTime, timeParam);
/* ... */
cgDisconnectParameter(timeParam);
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgDisconnectParameter wasintroduced in Cg 1.2.
SEE ALSO
cgGetConnectedParameter,cgGetConnectedToParameter,cgConnectParameter
perl v5.10.0 Cg Toolkit 3.0 104
cgEvaluateProgram(3) Cg Core Runtime API cgEvaluateProgram(3)
NAME cgEvaluateProgram −evaluates a Cg program on the CPU
SYNOPSIS
#include <Cg/cg.h>
void cgEvaluateProgram( CGprogram program,
float * buf,
int ncomps,
int nx,
int ny,
int nz );
PARAMETERS
program The program to be evalutated.
bufBuffer in which to store the results of program evaluation.
ncomps Number of components to store for each returned program value.
nx Number of points at which to evaluate the program in the x direction.
ny Number of points at which to evaluate the program in the y direction.
nz Number of points at which to evaluate the program in the z direction.
RETURN VALUES
None.
DESCRIPTION
cgEvaluateProgram evaluates a Cg program at a set of regularly spaced points in one, two, or three
dimensions. The program must have been compiled with the CG_PROFILE_GENERIC profile. The value
returned from the program via the COLOR semantic is stored in the givenbuffer for each evaluation point,
and anyvarying parameters to the program with POSITION semantic takeonthe (x,y,z) position overthe
range zero to one at which the program is evaluated at each point. The PSIZE semantic can be used to find
the spacing between evaluating points.
The total size of bufshould be equal to ncomps*nx*ny*nz.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PROFILE_ERROR is generated if program’s profile is not CG_PROFILE_GENERIC.
CG_INVALID_PARAMETER_ERROR is generated if bufis NULL,any ofnx,ny,ornz is less than zero, or
ncomps is not 0, 1, 2, or 3.
HISTORY
cgEvaluateProgram wasintroduced in Cg 1.4.
SEE ALSO
cgCreateProgram, cgCreateProgramFromFile, cgCreateProgramFromEffect, cgGetProgramProfile
perl v5.10.0 Cg Toolkit 3.0 105
cgGetAnnotationName(3) Cg Core Runtime API cgGetAnnotationName(3)
NAME cgGetAnnotationName −get an annotation’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetAnnotationName( CGannotation ann );
PARAMETERS
ann The annotation from which to get the name.
RETURN VALUES
Returns the NULL-terminated name string for the annotation.
Returns NULL if ann is invalid.
DESCRIPTION
cgGetAnnotationName allows the application to retrieve the name of a annotation. This name can be used
later to retrieve the annotation using cgGetNamedPassAnnotation, cgGetNamedParameterAnnotation,
cgGetNamedTechniqueAnnotation, or cgGetNamedProgramAnnotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
HISTORY
cgGetAnnotationName wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedPassAnnotation, cgGetNamedParameterAnnotation, cgGetNamedTechniqueAnnotation,
cgGetNamedProgramAnnotation
perl v5.10.0 Cg Toolkit 3.0 106
cgGetAnnotationType(3) Cg Core Runtime API cgGetAnnotationType(3)
NAME cgGetAnnotationType −get an annotation’stype
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetAnnotationType( CGannotation ann );
PARAMETERS
ann The annotation from which to get the type.
RETURN VALUES
Returns the type enumerant of ann.
Returns CG_UNKNOWN_TYPE if an error occurs.
DESCRIPTION
cgGetAnnotationType allows the application to retrieve the type of an annotation in a Cg effect.
cgGetAnnotationType will return CG_STRUCT if the annotation is a struct and CG_ARRAY if the
annotation is an array.Otherwise it will return the data type associated with the annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
HISTORY
cgGetAnnotationType wasintroduced in Cg 1.4.
SEE ALSO
cgGetType, cgGetTypeString
perl v5.10.0 Cg Toolkit 3.0 107
cgGetArrayDimension(3) Cg Core Runtime API cgGetArrayDimension(3)
NAME cgGetArrayDimension −get the dimension of an array parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetArrayDimension( CGparameter param );
PARAMETERS
param The array parameter handle.
RETURN VALUES
Returns the dimension of param if param references an array.
Returns 0otherwise.
DESCRIPTION
cgGetArrayDimension returns the dimension of the array specified by param.cgGetArrayDimension is
used when inspecting an array parameter in a program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
HISTORY
cgGetArrayDimension wasintroduced in Cg 1.1.
SEE ALSO
cgGetArraySize, cgCreateParameterArray,cgCreateParameterMultiDimArray
perl v5.10.0 Cg Toolkit 3.0 108
cgGetArrayParameter(3) Cg Core Runtime API cgGetArrayParameter(3)
NAME cgGetArrayParameter −get a parameter from an array
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetArrayParameter( CGparameter param,
int index );
PARAMETERS
param The array parameter handle.
indexThe indexinto the array.
RETURN VALUES
Returns the parameter at the specified indexofparam if param references an array,and the indexisvalid.
Returns NULL otherwise.
DESCRIPTION
cgGetArrayParameter returns the parameter of array param specified by index.cgGetArrayParameter
is used when inspecting elements of an array parameter in a program.
EXAMPLES
CGparameter array = ...; /* some array parameter */
int array_size = cgGetArraySize( array );
for(i=0; i < array_size; ++i)
{
CGparameter element = cgGetArrayParameter(array, i);
/* Do stuff with element */
}
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the bounds of param.
HISTORY
cgGetArrayParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetArrayDimension, cgGetArraySize, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 109
cgGetArraySize(3) Cg Core Runtime API cgGetArraySize(3)
NAME cgGetArraySize −get the size of one dimension of an array parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetArraySize( CGparameter param,
int dimension );
PARAMETERS
param The array parameter handle.
dimension
The array dimension whose size will be returned.
RETURN VALUES
Returns the size of param if param is an array.
Returns 0if param is not an array,oranerror occurs.
DESCRIPTION
cgGetArraySize returns the size of the givendimension of the array specified by param.cgGetArraySize
is used when inspecting an array parameter in a program.
EXAMPLES
/* Compute the number of elements in an array, in the */
/* style of cgGetArrayTotalSize(param) */
int elements = cgGetArraySize(param, 0);
if (elements>0) {
int dim = cgGetArrayDimension(param);
for (int i = 1; i < dim; i++) {
elements *= cgGetArraySize(param, i);
}
}
ERRORS
CG_INVALID_DIMENSION_ERROR is generated if dimension is less than 0.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetArraySize wasintroduced in Cg 1.1.
SEE ALSO
cgGetArrayTotalSize, cgGetArrayDimension, cgGetArrayParameter,cgGetMatrixSize, cgGetTypeSizes
perl v5.10.0 Cg Toolkit 3.0 110
cgGetArrayTotalSize(3) Cg Core Runtime API cgGetArrayTotalSize(3)
NAME cgGetArrayTotalSize −get the total size of an array parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetArrayTotalSize( CGparameter param );
PARAMETERS
param The array parameter handle.
RETURN VALUES
Returns the total size of param if pararm is an array.
Returns 0if param is not an array,orifanerror occurs.
DESCRIPTION
cgGetArrayTotalSize returns the total number of elements of the array specified by param.The total
number of elements is equal to the product of the size of each dimension of the array.
EXAMPLES
Givenahandle to a parameter declared as:
float2x3 array[6][1][4];
cgGetArrayTotalSize will return 24.
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetArrayTotalSize wasintroduced in Cg 1.4.
SEE ALSO
cgGetArraySize, cgGetArrayDimension, cgGetArrayParameter
perl v5.10.0 Cg Toolkit 3.0 111
cgGetArrayType(3) Cg Core Runtime API cgGetArrayType(3)
NAME cgGetArrayType −get the type of an array parameter
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetArrayType( CGparameter param );
PARAMETERS
param The array parameter handle.
RETURN VALUES
Returns the the type of the inner most array.
Returns CG_UNKNOWN_TYPE if an error occurs.
DESCRIPTION
cgGetArrayType returns the type of the members of an array.Ifthe givenarray is multi-dimensional, it
will return the type of the members of the inner most array.
EXAMPLES
CGcontext context = cgCreateContext();
CGparameter array = cgCreateParameterArray(context, CG_FLOAT, 5);
CGtype arrayType = cgGetArrayType(array); /* This will return CG_FLOAT */
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
HISTORY
cgGetArrayType wasintroduced in Cg 1.2.
SEE ALSO
cgGetArraySize, cgGetArrayDimension
perl v5.10.0 Cg Toolkit 3.0 112
cgGetAutoCompile(3) Cg Core Runtime API cgGetAutoCompile(3)
NAME cgGetAutoCompile −get the auto-compile enumerant for a context
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetAutoCompile( CGcontext context );
PARAMETERS
context The context.
RETURN VALUES
Returns the auto-compile enumerant for context.
Returns CG_UNKNOWN if context is not a valid context.
DESCRIPTION
cgGetAutoCompile returns the auto-compile enumerant for context.See cgSetAutoCompile for more
information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetAutoCompile wasintroduced in Cg 1.4.
SEE ALSO
cgSetAutoCompile
perl v5.10.0 Cg Toolkit 3.0 113
cgGetBehavior(3) Cg Core Runtime API cgGetBehavior(3)
NAME cgGetBehavior −get the behavior enumerant from a behavior name
SYNOPSIS
#include <Cg/cg.h>
CGbehavior cgGetBehavior( const char * behavior_string );
PARAMETERS
behavior_string
Astring containing the case-sensitive behavior name.
RETURN VALUES
Returns the behavior enumerant associated with behavior_string.
Returns CG_BEHAVIOR_UNKNOWN if behavior_string is NULL or if no CGbehavior is associated with
the givenstring.
DESCRIPTION
cgGetBehavior returns the enumerant assigned to a behavior name.
EXAMPLES
CGbehavior b = cgGetBehavior("latest");
/* b == CG_BEHAVIOR_LATEST */
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if behavior_string is NULL.
HISTORY
cgGetBehavior wasintroduced in Cg 3.0.
SEE ALSO
cgGetBehaviorString, cgGetContextBehavior,cgSetContextBehavior
perl v5.10.0 Cg Toolkit 3.0 114
cgGetBehaviorString(3) Cg Core Runtime API cgGetBehaviorString(3)
NAME cgGetBehaviorString −get the behavior name associated with a behavior enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetBehaviorString( CGbehavior behavior );
PARAMETERS
behavior The behavior enumerant.
RETURN VALUES
Returns the behavior string associated with behavior.
Returns NULL if behavior is not a valid CGbehavior.
DESCRIPTION
cgGetBehaviorString returns the behavior name associated with a givenbehavior enumerant.
EXAMPLES
static void dumpCgContextInfo(CGcontext context)
{
const char* p = cgGetBehaviorString(cgGetContextBehavior(context));
if ( p ) {
printf(" Behavior: %s\n", p );
}
/* ... */
}
ERRORS
None.
HISTORY
cgGetBehaviorString wasintroduced in Cg 3.0.
SEE ALSO
cgGetBehavior,cgGetContextBehavior,cgSetContextBehavior
perl v5.10.0 Cg Toolkit 3.0 115
cgGetBoolAnnotationValues(3) Cg Core Runtime API cgGetBoolAnnotationValues(3)
NAME cgGetBoolAnnotationValues −get the values from a boolean-valued annotation
SYNOPSIS
#include <Cg/cg.h>
const CGbool * cgGetBoolAnnotationValues( CGannotation ann,
int * nvalues );
PARAMETERS
ann The annotation.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of CGbool values. The number of values in the array is returned via the
nv a lues parameter.
Returns NULL if no values are available. nv a lues will be 0.
DESCRIPTION
cgGetBoolAnnotationValues allows the application to retrieve the value(s) of a boolean typed annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
HISTORY
cgGetBoolAnnotationValues wasintroduced in Cg 1.5.
SEE ALSO
cgGetAnnotationType, cgGetFloatAnnotationValues, cgGetIntAnnotationValues,
cgGetStringAnnotationValue
perl v5.10.0 Cg Toolkit 3.0 116
cgGetBoolStateAssignmentValues(3) Cg Core Runtime API cgGetBoolStateAssignmentValues(3)
NAME cgGetBoolStateAssignmentValues −get the values from a bool-valued state assignment
SYNOPSIS
#include <Cg/cg.h>
const CGbool * cgGetBoolStateAssignmentValues( CGstateassignment sa,
int * nvalues );
PARAMETERS
sa The state assignment.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of CGbool values. The number of values in the array is returned via the
nv a lues parameter.
Returns NULL if an error occurs or if no values are available. nv a lues will be 0in the latter case.
DESCRIPTION
cgGetBoolStateAssignmentValues allows the application to retrieve the value(s) of a boolean typed state
assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
bool type.
HISTORY
cgGetBoolStateAssignmentValues wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetIntStateAssignmentValues, cgGetStringStateAssignmentValue, cgGetProgramStateAssignmentValue,
cgGetSamplerStateAssignmentValue, cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 117
cgGetBooleanAnnotationValues(3) Cg Core Runtime API cgGetBooleanAnnotationValues(3)
NAME cgGetBooleanAnnotationValues −deprecated
DESCRIPTION
cgGetBooleanAnnotationValues is deprecated. Use cgGetBoolAnnotationValues instead.
SEE ALSO
cgGetBoolAnnotationValues
perl v5.10.0 Cg Toolkit 3.0 118
cgGetBufferSize(3) Cg Core Runtime API cgGetBufferSize(3)
NAME cgGetBufferSize −get the size of a buffer
SYNOPSIS
#include <Cg/cg.h>
int cgGetBufferSize( CGbuffer buffer );
PARAMETERS
buffer The buffer for which the size will be retrieved.
RETURN VALUES
Returns the size in bytes of buffer.
Returns −1 if an error occurs.
DESCRIPTION
cgGetBufferSize returns the size in bytes of buffer.
EXAMPLES
int size = cgGetBufferSize( myBuffer );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
HISTORY
cgGetBufferSize wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLCreateBuffer,cgSetBufferData, cgSetBufferSubData
perl v5.10.0 Cg Toolkit 3.0 119
cgGetCompilerIncludeCallback(3) Cg Core Runtime API cgGetCompilerIncludeCallback(3)
NAME cgGetCompilerIncludeCallback −get the include callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGIncludeCallbackFunc)( CGcontext context, const char *filename );
CGIncludeCallbackFunc cgGetCompilerIncludeCallback( CGcontext context );
PARAMETERS
context The context of the desired include callback function.
RETURN VALUES
Returns the current include callback function.
Returns NULL if no callback function is set.
DESCRIPTION
cgGetCompilerIncludeCallback returns the current callback function used for handing include
statements.
EXAMPLES
CGIncludeCallbackFunc includeCB = cgGetCompilerIncludeCallback(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetCompilerIncludeCallback wasintroduced in Cg 2.1.
SEE ALSO
cgSetCompilerIncludeCallback, cgSetCompilerIncludeString, cgSetCompilerIncludeFile
perl v5.10.0 Cg Toolkit 3.0 120
cgGetConnectedParameter(3) Cg Core Runtime API cgGetConnectedParameter(3)
NAME cgGetConnectedParameter −gets the connected source parameter
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetConnectedParameter( CGparameter param );
PARAMETERS
param The destination parameter.
RETURN VALUES
Returns the connected source parameter if param is connected to one.
Returns NULL otherwise.
DESCRIPTION
Returns the source parameter to which param is connected.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetConnectedParameter wasintroduced in Cg 1.2.
SEE ALSO
cgConnectParameter,cgDisconnectParameter,cgGetConnectedToParameter
perl v5.10.0 Cg Toolkit 3.0 121
cgGetConnectedStateAssignmentParameter(3) Cg Core Runtime API cgGetConnectedStateAssignmentParameter(3)
NAME cgGetConnectedStateAssignmentParameter −get effect parameter which determines a state
assignment’svalue
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetConnectedStateAssignmentParameter( CGstateassignment sa );
PARAMETERS
sa A state assignment whose value is determined using an effect parameter.
RETURN VALUES
Returns the effect parameter used by sa.
Returns 0if sa is not using a parameter for its value, if the state assignment is set to an expression, or if an
error occurs.
DESCRIPTION
cgGetConnectedStateAssignmentParameter returns the effect parameter from which a givenstate
assignment’svalue is determined.
EXAMPLES
/* in Effect.cgfx file */
int MyMinFilter;
sampler2D Samp = sampler_state {
MinFilter = MyMinFilter;
};
/* in .c/.cpp file */
CGparameter sampParam = cgGetNamedEffectParameter( myEffect, "Samp" );
CGstateassignment sa = cgGetNamedSamplerStateAssignment( sampParam,
"MinFilter" );
CGparameter connected = cgGetConnectedStateAssignmentParameter( sa );
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetConnectedStateAssignmentParameter wasintroduced in Cg 2.0.
SEE ALSO
cgGetNamedEffectParameter,cgGetNamedSamplerStateAssignment
perl v5.10.0 Cg Toolkit 3.0 122
cgGetConnectedToParameter(3) Cg Core Runtime API cgGetConnectedToParameter(3)
NAME cgGetConnectedToParameter −gets a connected destination parameter
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetConnectedToParameter( CGparameter param,
int index );
PARAMETERS
param The source parameter.
indexSince there may be multiple destination (to) parameters connected to param,index is need to
specify which one is returned. index must be within the range of 0to N−1where Nis the
number of connected destination parameters.
RETURN VALUES
Returns one of the destination parameters connected to param.
Returns NULL if an error occurs.
DESCRIPTION
Returns one of the destination parameters connected to param.cgGetNumConnectedToParameters should
be used to determine the number of destination parameters connected to param.
EXAMPLES
int nParams = cgGetNumConnectedToParameters( sourceParam );
for ( int i=0; i < nParams; ++i )
{
CGparameter toParam = cgGetConnectedToParameter( sourceParam, i );
/* Do stuff with toParam ... */
}
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than 0 or greater than or equal to the
number of parameters connected to param.
HISTORY
cgGetConnectedToParameter wasintroduced in Cg 1.2.
SEE ALSO
cgConnectParameter,cgGetNumConnectedToParameters
perl v5.10.0 Cg Toolkit 3.0 123
cgGetContextBehavior(3) Cg Core Runtime API cgGetContextBehavior(3)
NAME cgGetContextBehavior −get the behavior enumerant for a context
SYNOPSIS
#include <Cg/cg.h>
CGbehavior cgGetContextBehavior( CGcontext context );
PARAMETERS
context The context for which the behavior enumerant will be returned.
RETURN VALUES
Returns the behavior enumerant for context.
Returns CG_BEHAVIOR_UNKNOWN if an error occurs.
DESCRIPTION
cgGetContextBehavior allows the application to retrieve the behavior enumerant for a context. The valid
enumerants and their meanings are described in cgSetContextBehavior.
EXAMPLES
/* create a context and get the default context behavior enum */
CGcontext context = cgCreateContext();
CGbehavior cb = cgGetContextBehavior(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetContextBehavior wasintroduced in Cg 3.0.
SEE ALSO
cgCreateContext, cgSetContextBehavior,cgGetBehavior,cgGetBehaviorString
perl v5.10.0 Cg Toolkit 3.0 124
cgGetDependentAnnotationParameter(3) Cg Core Runtime API cgGetDependentAnnotationParameter(3)
NAME cgGetDependentAnnotationParameter −get one of the parameters that an annotation’svalue depends on
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetDependentAnnotationParameter( CGannotation ann,
int index );
PARAMETERS
ann The annotation handle.
indexThe indexofthe parameter to return.
RETURN VALUES
Returns a handle to the selected dependent annotation on success.
Returns NULL if an error occurs.
DESCRIPTION
Annotations in CgFX files may include references to one or more effect parameters on the right hand side
of the annotation that are used for computing the annotation’svalue.
cgGetDependentAnnotationParameter returns one of these parameters, as indicated by the givenindex.
cgGetNumDependentAnnotationParameters can be used to determine the total number of such parameters.
This information can be useful for applications that wish to cache the values of annotations so that theycan
determine which annotations may change as the result of changing a particular parameter’svalue.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than zero or greater than or equal to
the number of dependent parameters, as returned by cgGetNumDependentAnnotationParameters.
HISTORY
cgGetDependentAnnotationParameter wasintroduced in Cg 1.4.
SEE ALSO
cgGetDependentStateAssignmentParameter,cgGetNumDependentAnnotationParameters
perl v5.10.0 Cg Toolkit 3.0 125
cgGetDependentProgramArrayStateAssignmentParameter(3)Cg Core Runtime APIcgGetDependentProgramArrayStateAssignmentParameter(3)
NAME cgGetDependentProgramArrayStateAssignmentParameter −get one of the parameters that a state
assignment’svalue depends on
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetDependentProgramArrayStateAssignmentParameter( CGstateassignment sa,
int index );
PARAMETERS
sa The state assignment handle.
indexThe indexofthe parameter to return.
RETURN VALUES
Returns a handle to the selected dependent parameter on success.
Returns NULL if sa is not a program state assignment or an error occurs.
DESCRIPTION
State assignments in CgFX files may include references to an array indexedbyaneffect parameter (or
expression) on the right hand side of the state assignment that is used for computing the state assignment’s
value. Usually this array holds the compile statements of shader programs and by changing the indexofthe
shader array,it’spossible to switch to a different program or profile on-the-fly.
Each compile statement in the array can depend on one or more effect parameters which are passed to the
program in its parameter list. It is sometimes necessary for the application to query what those parameters
are so values can be properly set to them.
cgGetDependentProgramArrayStateAssignmentParameter returns one of these parameters, as
indicated by the givenindex.
EXAMPLES
/* In CgFX file */
vertexshader Torus[4] =
{
compile vp40 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile vp30 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile arbvp1 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile vp20 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) )
};
pixelshader SpecSurf[4] =
{
compile fp40 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube ),
compile fp30 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube ),
perl v5.10.0 Cg Toolkit 3.0 126
cgGetDependentProgramArrayStateAssignmentParameter(3)Cg Core Runtime APIcgGetDependentProgramArrayStateAssignmentParameter(3)
compile arbfp1 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube ),
compile fp20 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube )
};
int select = 0;
technique bumpdemo
{
pass
{
VertexProgram = (Torus[select]);
FragmentProgram = (SpecSurf[select]);
}
}
/* In application */
int numParameters = cgGetNumDependentProgramArrayStateAssignmentParameters(stateAssignment);
for(int i = 0; i < numParameters; ++i) {
CGparameter param = cgGetDependentProgramArrayStateAssignmentParameter(stateAssignment, i);
/* Set value for 'param' */
}
In the above example, assuming select = 0 and stateAssignment is for VertexProgram, the list of parameters
returned from cgGetDependentProgramArrayStateAssignmentParameter would be: LightPosition,
EyePosition, ModelViewProj, OuterRadius, InnerRadius.
If stateAssignment was for FragmentProgram, then the list of parameters returned from
cgGetDependentProgramArrayStateAssignmentParameter would be: Ambient, DiffuseMaterial,
LightColor,SpecularMaterial, LightColor,normalMap, normalizeCube, normalizeCube.
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than zero or greater than or equal to
the number of dependent parameters, as returned by
cgGetNumDependentProgramArrayStateAssignmentParameters.
HISTORY
cgGetDependentProgramArrayStateAssignmentParameter wasintroduced in Cg 3.0.
SEE ALSO
cgGetNumDependentProgramArrayStateAssignmentParameters
perl v5.10.0 Cg Toolkit 3.0 127
cgGetDependentStateAssignmentParameter(3) Cg Core Runtime API cgGetDependentStateAssignmentParameter(3)
NAME cgGetDependentStateAssignmentParameter −get one of the parameters that a state assignment’svalue
depends on
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetDependentStateAssignmentParameter( CGstateassignment sa,
int index );
PARAMETERS
sa The state assignment handle.
indexThe indexofthe parameter to return.
RETURN VALUES
Returns a handle to the selected dependent parameter on success.
Returns NULL if an error occurs.
DESCRIPTION
State assignments in CgFX files may include references to one or more effect parameters on the right hand
side of the state assignment that are used for computing the state assignment’svalue.
cgGetDependentStateAssignmentParameter returns one of these parameters, as indicated by the given
index. cgGetNumDependentStateAssignmentParameters can be used to determine the total number of such
parameters.
This information can be useful for applications that wish to cache the values of annotations so that theycan
determine which annotations may change as the result of changing a particular parameter’svalue.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is less than zero or greater than or equal to
the number of dependent parameters, as returned by cgGetNumDependentStateAssignmentParameters.
HISTORY
cgGetDependentStateAssignmentParameter wasintroduced in Cg 1.4.
SEE ALSO
cgGetDependentAnnotationParameter,cgGetNumDependentStateAssignmentParameters
perl v5.10.0 Cg Toolkit 3.0 128
cgGetDomain(3) Cg Core Runtime API cgGetDomain(3)
NAME cgGetDomain −get the domain enumerant from a domain name
SYNOPSIS
#include <Cg/cg.h>
CGdomain cgGetDomain( const char * domain_string );
PARAMETERS
domain_string
Astring containing the case-sensitive domain name.
RETURN VALUES
Returns the domain enumerant of domain_string.
Returns CG_UNKNOWN if the givendomain does not exist.
DESCRIPTION
cgGetDomain returns the enumerant assigned to a domain name.
EXAMPLES
CGdomain ARBVP1domain = cgGetDomain("arbvp1");
if(cgGetProgramDomain(myprog) == ARBVP1Domain)
{
/* Do stuff */
}
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if domain_string is NULL.
HISTORY
cgGetDomain wasintroduced in Cg 2.2.
SEE ALSO
cgGetDomainString, cgGetProgramDomain
perl v5.10.0 Cg Toolkit 3.0 129
cgGetDomainString(3) Cg Core Runtime API cgGetDomainString(3)
NAME cgGetDomainString −get the domain name associated with a domain enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetDomainString( CGdomain domain );
PARAMETERS
domain The domain enumerant.
RETURN VALUES
Returns the domain string of the enumerant domain.
Returns NULL if domain is not a valid domain.
DESCRIPTION
cgGetDomainString returns the domain name associated with a domain enumerant.
EXAMPLES
static void dumpCgProgramInfo(CGprogram program)
{
const char* p = cgGetDomainString(cgGetProgramDomain(program));
if ( p ) {
printf(" Domain: %s\n", cgGetDomainString(cgGetProgramDomain(program)));
}
/* ... */
}
ERRORS
None.
HISTORY
cgGetDomainString wasintroduced in Cg 2.2.
SEE ALSO
cgGetDomain, cgGetProgramDomain
perl v5.10.0 Cg Toolkit 3.0 130
cgGetEffectContext(3) Cg Core Runtime API cgGetEffectContext(3)
NAME cgGetEffectContext −get a effect’scontext
SYNOPSIS
#include <Cg/cg.h>
CGcontext cgGetEffectContext( CGeffect effect );
PARAMETERS
effect The effect.
RETURN VALUES
Returns the context to which effect belongs.
Returns NULL if an error occurs.
DESCRIPTION
cgGetEffectContext allows the application to retrieve a handle to the context to which a giveneffect
belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetEffectContext wasintroduced in Cg 1.4.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile, cgCreateContext
perl v5.10.0 Cg Toolkit 3.0 131
cgGetEffectName(3) Cg Core Runtime API cgGetEffectName(3)
NAME cgGetEffectName −get an effect’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetEffectName( CGeffect effect );
PARAMETERS
effect The effect from which the name will be retrieved.
RETURN VALUES
Returns the name from the specified effect.
Returns NULL if the effect doesn’thav e avalid name or an error occurs.
DESCRIPTION
cgGetEffectName returns the name from the specified effect.
EXAMPLES
char *effectSource = ...;
CGcontext context = cgCreateContext();
CGeffect effect = cgCreateEffect(context, effectSource, NULL);
const char* myEffectName = "myEffectName";
CGbool okay = cgSetEffectName(effect, myEffectName);
if (!okay) {
/* handle error */
}
const char* testName = cgGetEffectName(effect);
if (strcmp(testName, myEffectName)) {
/* shouldn't be here */
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetEffectName wasintroduced in Cg 1.5.
SEE ALSO
cgSetEffectName
perl v5.10.0 Cg Toolkit 3.0 132
cgGetEffectParameterBuffer(3) Cg Core Runtime API cgGetEffectParameterBuffer(3)
NAME cgGetEffectParameterBuffer −get the Cg buffer associated to the passed effect parameter.
SYNOPSIS
#include <Cg/cg.h>
CGbuffer cgGetEffectParameterBuffer(CGparameter param)
PARAMETERS
param The effect parameter associated with a Cg buffer (using the BUFFER semantic) set by
cgSetEffectParameterBuffer.
RETURN VALUES
Returns the CGbuffer object set by cgSetEffectParameterBuffer.
Returns NULL if param is invalid or does not have a CGbuffer set by cgSetEffectParameterBuffer.
DESCRIPTION
cgGetEffectParameterBuffer returns the CGbuffer object set by cgSetEffectParameterBuffer.
EXAMPLES
In effect:
struct Material {
float4 ambient;
float4 diffuse;
float4 specular;
float4 shine; } cbuffer0_Material : BUFFER[0];
In C/C++:
CGbuffer myCgBuffer = cgCreateBuffer(...);
cgSetEffectParameterBuffer(cgGetNamedEffectParameter(myCgEffect, ‘‘cbuffer0_Material’’),
myCgBuffer);
// ...
CGbuffer buffer = cgGetEffectParameterBuffer(cgGetNamedEffectParameter(myCgEffect,
‘‘cbuffer0_Material’’));
// Nowbuffer == myCgBuffer
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetEffectParameterBuffer wasintroduced in Cg 3.0.
SEE ALSO
cgSetEffectParameterBuffer
perl v5.10.0 Cg Toolkit 3.0 133
cgGetEffectParameterBySemantic(3) Cg Core Runtime API cgGetEffectParameterBySemantic(3)
NAME cgGetEffectParameterBySemantic −get the a parameter in an effect via its semantic
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetEffectParameterBySemantic( CGeffect effect,
const char * semantic );
PARAMETERS
effect The effect from which to retrieve the parameter.
semantic The name of the semantic.
RETURN VALUES
Returns the CGparameter object in effect that has the givensemantic.
Returns NULL if effect is invalid or does not have any parameters with the givensemantic.
DESCRIPTION
cgGetEffectParameterBySemantic returns the parameter in an effect which is associated with the given
semantic. It multiple parameters in the effect have this semantic, an arbitrary one of them will be returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_INVALID_PARAMETER_ERROR is generated if semantic is NULL or the empty string.
HISTORY
cgGetEffectParameterBySemantic wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedEffectParameter
perl v5.10.0 Cg Toolkit 3.0 134
cgGetEnum(3) Cg Core Runtime API cgGetEnum(3)
NAME cgGetEnum −get the enumerant assigned with the givenstring name
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetEnum( const char * enum_string );
PARAMETERS
enum_string
Astring containing the case-sensitive enum name.
RETURN VALUES
Returns the enumerant for enum_string.
Returns CG_UNKNOWN if no such enumerant exists
DESCRIPTION
cgGetEnum returns the enumerant assigned to an enum name.
EXAMPLES
CGenum VaryingEnum = cgGetEnum("CG_VARYING");
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if enum_string is NULL.
HISTORY
cgGetEnum wasintroduced in Cg 1.2.
SEE ALSO
cgGetEnumString
perl v5.10.0 Cg Toolkit 3.0 135
cgGetEnumString(3) Cg Core Runtime API cgGetEnumString(3)
NAME cgGetEnumString −get the name string associated with an enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetEnumString( CGenum enum );
PARAMETERS
enum The enumerant.
RETURN VALUES
Returns the string representation of the enumerant enum.
Returns NULL if enum is not a valid Cg enumerant.
DESCRIPTION
cgGetEnumString returns the name string associated with an enumerant. It’sprimary use to print
debugging information.
EXAMPLES
/* This prints "CG_UNIFORM" to stdout */
const char *EnumString = cgGetEnumString(CG_UNIFORM);
printf("%s\n", EnumString);
ERRORS
None.
HISTORY
cgGetEnumString wasintroduced in Cg 1.2.
SEE ALSO
cgGetEnum
perl v5.10.0 Cg Toolkit 3.0 136
cgGetError(3) Cg Core Runtime API cgGetError(3)
NAME cgGetError −get error condition
SYNOPSIS
#include <Cg/cg.h>
CGerror cgGetError( void );
PARAMETERS
None.
RETURN VALUES
Returns the last error condition that has occured.
Returns CG_NO_ERROR if no error has occurred.
DESCRIPTION
cgGetError returns the last error condition that has occured. The error condition is reset after cgGetError
is called.
EXAMPLES
CGerror err = cgGetError();
ERRORS
None.
HISTORY
cgGetError wasintroduced in Cg 1.1.
SEE ALSO
cgSetErrorCallback, cgSetErrorHandler
perl v5.10.0 Cg Toolkit 3.0 137
cgGetErrorCallback(3) Cg Core Runtime API cgGetErrorCallback(3)
NAME cgGetErrorCallback −get the error callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGerrorCallbackFunc)( void );
CGerrorCallbackFunc cgGetErrorCallback( void );
PARAMETERS
None.
RETURN VALUES
Returns the currently set error callback function.
Returns NULL if no callback function has been set.
DESCRIPTION
cgGetErrorCallback returns the current error callback function.
EXAMPLES
CGerrorCallbackFunc errorCB = cgGetErrorCallback();
ERRORS
None.
HISTORY
cgGetErrorCallback wasintroduced in Cg 1.1.
SEE ALSO
cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 138
cgGetErrorHandler(3) Cg Core Runtime API cgGetErrorHandler(3)
NAME cgGetErrorHandler −get the error handler callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGerrorHandlerFunc)( CGcontext context,
CGerror error,
void * appdata );
CGerrorHandlerFunc cgGetErrorHandler( void ** appdataptr );
PARAMETERS
appdataptr
Apointer for an application provided data pointer.
RETURN VALUES
Returns the current error handler callback function.
Returns NULL if no callback function is set.
If appdataptr is not NULL then the current appdata pointer will be copied into the location pointed to by
appdataptr.
DESCRIPTION
cgGetErrorHandler returns the current error handler callback function and application provided data
pointer.
EXAMPLES
void * appdata = NULL;
CGerrorHandlerFunc errorHandler = cgGetErrorHandler( &appdata );
ERRORS
None.
HISTORY
cgGetErrorHandler wasintroduced in Cg 1.4.
SEE ALSO
cgSetErrorHandler
perl v5.10.0 Cg Toolkit 3.0 139
cgGetErrorString(3) Cg Core Runtime API cgGetErrorString(3)
NAME cgGetErrorString −get a human readable error string
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetErrorString( CGerror error );
PARAMETERS
error The error condition.
RETURN VALUES
Returns a human readable error string for the givenerror condition.
DESCRIPTION
cgGetErrorString returns a human readable error string for the givenerror condition.
EXAMPLES
const char * pCompilerError = cgGetErrorString( CG_COMPILER_ERROR );
ERRORS
None.
HISTORY
cgGetErrorString wasintroduced in Cg 1.1.
SEE ALSO
cgGetError
perl v5.10.0 Cg Toolkit 3.0 140
cgGetFirstDependentParameter(3) Cg Core Runtime API cgGetFirstDependentParameter(3)
NAME cgGetFirstDependentParameter −get the first dependent parameter from a parameter
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstDependentParameter( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns a handle to the first member parameter.
Returns NULL if param is not a struct or if some other error occurs.
DESCRIPTION
cgGetFirstDependentParameter returns the first member dependent parameter associated with a given
parameter.The rest of the members may be retrievedfrom the first member by iterating with
cgGetNextParameter.
Dependent parameters are parameters that have the same name as a givenparameter but different resources.
Theyonly exist in profiles that have multiple resources associated with one parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetFirstDependentParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextParameter,cgGetFirstParameter
perl v5.10.0 Cg Toolkit 3.0 141
cgGetFirstEffect(3) Cg Core Runtime API cgGetFirstEffect(3)
NAME cgGetFirstEffect −get the first effect in a context
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgGetFirstEffect( CGcontext context );
PARAMETERS
context The context from which to retrieve the first effect.
RETURN VALUES
Returns the first CGeffect object in context.
Returns NULL if context contains no effects.
DESCRIPTION
cgGetFirstEffect is used to begin iteration overall of the effects contained by a context. See
cgGetNextEffect for more information.
EXAMPLES
/* one or more effects have previously been loaded into context */
CGeffect effect = cgGetFirstEffect( context );
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetFirstEffect wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextEffect, cgCreateEffect, cgCreateEffectFromFile, cgDestroyEffect, cgIsEffect, cgGetFirstProgram
perl v5.10.0 Cg Toolkit 3.0 142
cgGetFirstEffectAnnotation(3) Cg Core Runtime API cgGetFirstEffectAnnotation(3)
NAME cgGetFirstEffectAnnotation −get the first annotation in an effect
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetFirstEffectAnnotation( CGeffect effect );
PARAMETERS
effect The effect from which to retrieve the first annotation.
RETURN VALUES
Returns the first annotation in an effect.
Returns NULL if the effect has no annotations.
DESCRIPTION
The first annotation associated with an effect can be retrievedusing cgGetFirstEffectAnnotation.The rest
of the effect’sannotations can be discovered by iterating through them using cgGetNextAnnotation.
EXAMPLES
CGannotation ann = cgGetFirstEffectAnnotation( effect );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetFirstEffectAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedEffectAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 143
cgGetFirstEffectParameter(3) Cg Core Runtime API cgGetFirstEffectParameter(3)
NAME cgGetFirstEffectParameter −get the first parameter in an effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstEffectParameter( CGeffect effect );
PARAMETERS
effect The effect from which to retrieve the first parameter.
RETURN VALUES
Returns the first CGparameter object in effect.
Returns NULL if effect is invalid or if effect does not have any parameters.
DESCRIPTION
The first top-levelparameter in an effect can be retrievedusing cgGetFirstEffectParameter.The rest of
the effect’sparameters can be discovered by iterating through them using cgGetNextParameter.
EXAMPLES
CGparameter param = cgGetFirstEffectParameter( effect );
while( param )
{
/* do something with param */
param = cgGetNextParameter( param );
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetFirstEffectParameter wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextParameter,cgGetNamedEffectParameter
perl v5.10.0 Cg Toolkit 3.0 144
cgGetFirstError(3) Cg Core Runtime API cgGetFirstError(3)
NAME cgGetFirstError −get the first error condition
SYNOPSIS
#include <Cg/cg.h>
CGerror cgGetFirstError( void );
PARAMETERS
None.
RETURN VALUES
Returns the first error condition that has occured since cgGetFirstError waslast called.
Returns CG_NO_ERROR if no error has occurred.
DESCRIPTION
cgGetFirstError returns the first error condition that has occured since cgGetFirstError waspreviously
called.
EXAMPLES
CGerror firstError = cgGetFirstError();
ERRORS
None.
HISTORY
cgGetFirstError wasintroduced in Cg 1.4.
SEE ALSO
cgSetErrorHandler,cgGetError
perl v5.10.0 Cg Toolkit 3.0 145
cgGetFirstLeafEffectParameter(3) Cg Core Runtime API cgGetFirstLeafEffectParameter(3)
NAME cgGetFirstLeafEffectParameter −get the first leaf parameter in an effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstLeafEffectParameter( CGeffect effect );
PARAMETERS
effect The effect from which to retrieve the first leaf parameter.
RETURN VALUES
Returns the first leaf CGparameter object in effect.
Returns NULL if effect is invalid or if effect does not have any parameters.
DESCRIPTION
cgGetFirstLeafEffectParameter returns the first leaf parameter in an effect. The combination of
cgGetFirstLeafEffectParameter and cgGetNextLeafParameter allows the iteration through all of the
parameters of basic data types (not structs or arrays) without recursion. See cgGetNextLeafParameter for
more information.
EXAMPLES
CGparameter leaf = cgGetFirstLeafEffectParameter( effect );
while(leaf)
{
/* Do stuff with leaf */
leaf = cgGetNextLeafParameter( leaf );
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetFirstLeafEffectParameter wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextLeafParameter,cgGetFirstLeafParameter
perl v5.10.0 Cg Toolkit 3.0 146
cgGetFirstLeafParameter(3) Cg Core Runtime API cgGetFirstLeafParameter(3)
NAME cgGetFirstLeafParameter −get the first leaf parameter in a program
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstLeafParameter( CGprogram program,
CGenum name_space );
PARAMETERS
program The program from which to retrieve the first leaf parameter.
name_space Specifies the parameter namespace through which to iterate. Currently CG_PROGRAM and
CG_GLOBAL are supported.
RETURN VALUES
Returns the first leaf CGparameter object in program.
Returns NULL if program is invalid or if program does not have any parameters.
DESCRIPTION
cgGetFirstLeafParameter returns the first leaf parameter in a program. The combination of
cgGetFirstLeafParameter and cgGetNextLeafParameter allowthe iteration through all of the parameters
of basic data types (not structs or arrays) without recursion. See cgGetNextLeafParameter for more
information.
EXAMPLES
CGparameter leaf = cgGetFirstLeafParameter( program );
while ( leaf )
{
/* Do stuff with leaf */
leaf = cgGetNextLeafParameter( leaf );
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_ENUMERANT_ERROR is generated if name_space is not CG_PROGRAM or
CG_GLOBAL.
HISTORY
cgGetFirstLeafParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextLeafParameter
perl v5.10.0 Cg Toolkit 3.0 147
cgGetFirstParameter(3) Cg Core Runtime API cgGetFirstParameter(3)
NAME cgGetFirstParameter −get the first parameter in a program
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstParameter( CGprogram program,
CGenum name_space );
PARAMETERS
program The program from which to retrieve the first parameter.
name_space Specifies the parameter namespace through which to iterate. Currently CG_PROGRAM and
CG_GLOBAL are supported.
RETURN VALUES
Returns the first CGparameter object in program.
Returns zero if program is invalid or if program does not have any parameters.
Also returns zero if program is a combined program. To access the parameters of a combined program,
use cgGetProgramDomainProgram to get each domain program and then call cgGetFirstParameter on
each domain program.
DESCRIPTION
cgGetFirstParameter returns the first top-levelparameter in a program. cgGetFirstParameter is used for
recursing through all parameters in a program. See cgGetNextParameter for more information on
parameter traversal.
EXAMPLES
CGparameter param = cgGetFirstParameter( program, CG_GLOBAL );
while ( param )
{
/* Do stuff with leaf */
param = cgGetNextParameter( param );
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_ENUMERANT_ERROR is generated if name_space is not CG_PROGRAM or
CG_GLOBAL.
HISTORY
cgGetFirstParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextParameter,cgGetProgramDomainProgram, cgGetFirstDependentParameter,
cgGetFirstEffectParameter,cgGetFirstParameterAnnotation
perl v5.10.0 Cg Toolkit 3.0 148
cgGetFirstParameterAnnotation(3) Cg Core Runtime API cgGetFirstParameterAnnotation(3)
NAME cgGetFirstParameterAnnotation −get the first annotation of a parameter
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetFirstParameterAnnotation( CGparameter param );
PARAMETERS
param The parameter from which to retrieve the annotation.
RETURN VALUES
Returns the first annotation for the givenparameter.
Returns NULL if the parameter has no annotations or an error occurs.
DESCRIPTION
The annotations associated with a parameter can be retrievedwith cgGetFirstParameterAnnotation.Use
cgGetNextAnnotation to iterate through the remainder of the parameter’sannotations.
EXAMPLES
CGannotation ann = cgGetFirstParameterAnnotation( param );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetFirstParameterAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedParameterAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 149
cgGetFirstPass(3) Cg Core Runtime API cgGetFirstPass(3)
NAME cgGetFirstPass −get the first pass in a technique
SYNOPSIS
#include <Cg/cg.h>
CGpass cgGetFirstPass( CGtechnique tech );
PARAMETERS
tech The technique from which to retrieve the first pass.
RETURN VALUES
Returns the first CGpass object in tech.
Returns NULL if tech contains no passes.
DESCRIPTION
cgGetFirstPass is used to begin iteration overall of the passes contained within a technique. See
cgGetNextPass for more information.
EXAMPLES
CGpass pass = cgGetFirstPass( tech );
while ( pass )
{
/* Do stuff with pass */
leaf = cgGetNextPass( pass );
}
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetFirstPass wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextPass, cgGetNamedPass, cgIsPass, cgGetFirstPassAnnotation
perl v5.10.0 Cg Toolkit 3.0 150
cgGetFirstPassAnnotation(3) Cg Core Runtime API cgGetFirstPassAnnotation(3)
NAME cgGetFirstPassAnnotation −get the first annotation of a pass
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetFirstPassAnnotation( CGpass pass );
PARAMETERS
pass The pass from which to retrieve the annotation.
RETURN VALUES
Returns the first annotation from the givenpass.
Returns NULL if the pass has no annotations or an error occurs.
DESCRIPTION
The annotations associated with a pass can be retrievedusing cgGetFirstPassAnnotation.The remainder
of the pass’sannotations can be discovered by iterating through the parameters, calling
cgGetNextAnnotation to get to the next one.
EXAMPLES
CGannotation ann = cgGetFirstPassAnnotation( pass );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetFirstPassAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedPassAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 151
cgGetFirstProgram(3) Cg Core Runtime API cgGetFirstProgram(3)
NAME cgGetFirstProgram −get the first program in a context
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetFirstProgram( CGcontext context );
PARAMETERS
context The context from which to retrieve the first program.
RETURN VALUES
Returns the first CGprogram object in context.
Returns NULL if context contains no programs or an error occurs.
DESCRIPTION
cgGetFirstProgram is used to begin iteration overall of the programs contained within a context. See
cgGetNextProgram for more information.
EXAMPLES
CGprogram program = cgGetFirstProgram( context );
while ( program )
{
/* do something with program */
program = cgGetNextProgram( program );
}
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetFirstProgram wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextProgram, cgCreateProgram, cgDestroyProgram, cgIsProgram, cgGetFirstEffect
perl v5.10.0 Cg Toolkit 3.0 152
cgGetFirstProgramAnnotation(3) Cg Core Runtime API cgGetFirstProgramAnnotation(3)
NAME cgGetFirstProgramAnnotation −get the first annotation of a program
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetFirstProgramAnnotation( CGprogram program );
PARAMETERS
program The program from which to retrieve the annotation.
RETURN VALUES
Returns the first annotation from the givenprogram.
Returns NULL if the program has no annotations.
DESCRIPTION
The annotations associated with a program can be retrievedusing cgGetFirstProgramAnnotation.The
remainder of the program’sannotations can be discovered by iterating through the parameters, calling
cgGetNextAnnotation to get to the next one.
EXAMPLES
CGannotation ann = cgGetFirstProgramAnnotation( program );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetFirstProgramAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedProgramAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 153
cgGetFirstSamplerState(3) Cg Core Runtime API cgGetFirstSamplerState(3)
NAME cgGetFirstSamplerState −get the first sampler state definition in a context
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetFirstSamplerState( CGcontext context );
PARAMETERS
context The context from which to retrieve the first sampler state definition.
RETURN VALUES
Returns the first CGstate object in context.
Returns NULL if context contains no programs or an error occurs.
DESCRIPTION
cgGetFirstSamplerState is used to begin iteration overall of the sampler state definitions contained within
acontext. See cgGetNextState for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetFirstSamplerState wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextState, cgGetNamedSamplerState
perl v5.10.0 Cg Toolkit 3.0 154
cgGetFirstSamplerStateAssignment(3) Cg Core Runtime API cgGetFirstSamplerStateAssignment(3)
NAME cgGetFirstSamplerStateAssignment −get the first state assignment in a sampler_state block
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgGetFirstSamplerStateAssignment( CGparameter param );
PARAMETERS
param The sampler parameter from which to retrieve the first state assignment.
RETURN VALUES
Returns the first CGstateassignment object assigned to param.
Returns NULL if param has no sampler_state block or an error occurs.
DESCRIPTION
cgGetFirstSamplerStateAssignment is used to begin iteration overall of the state assignments contained
within a sampler_state block assigned to a parameter in an effect file. See cgGetNextStateAssignment for
more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetFirstSamplerStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextStateAssignment, cgIsStateAssignment
perl v5.10.0 Cg Toolkit 3.0 155
cgGetFirstState(3) Cg Core Runtime API cgGetFirstState(3)
NAME cgGetFirstState −get the first state definition in a context
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetFirstState( CGcontext context );
PARAMETERS
context The context from which to retrieve the first state definition.
RETURN VALUES
Returns the first CGstate object in context.
Returns NULL if context contains no state definitions or an error occurs.
DESCRIPTION
cgGetFirstState is used to begin iteration overall of the state definitions contained within a context. See
cgGetNextState for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetFirstState wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextState, cgGetNamedState, cgIsState
perl v5.10.0 Cg Toolkit 3.0 156
cgGetFirstStateAssignment(3) Cg Core Runtime API cgGetFirstStateAssignment(3)
NAME cgGetFirstStateAssignment −get the first state assignment in a pass
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgGetFirstStateAssignment( CGpass pass );
PARAMETERS
pass The pass from which to retrieve the first state assignment.
RETURN VALUES
Returns the first CGstateassignment object in pass.
Returns NULL if pass contains no state assignments or an error occurs.
DESCRIPTION
cgGetFirstStateAssignment is used to begin iteration overall of the state assignment contained within a
pass. See cgGetNextStateAssignment for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetFirstStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextStateAssignment, cgIsStateAssignment
perl v5.10.0 Cg Toolkit 3.0 157
cgGetFirstStructParameter(3) Cg Core Runtime API cgGetFirstStructParameter(3)
NAME cgGetFirstStructParameter −get the first child parameter from a struct parameter
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetFirstStructParameter( CGparameter param );
PARAMETERS
param Specifies the struct parameter.This parameter must be of type CG_STRUCT (returned by
cgGetParameterType).
RETURN VALUES
Returns a handle to the first member parameter.
Returns NULL if param is not a struct or if some other error occurs.
DESCRIPTION
cgGetFirstStructParameter returns the first member parameter of a struct parameter.The rest of the
members may be retrievedfrom the first member by iterating with cgGetNextParameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not a struct parameter.
HISTORY
cgGetFirstStructParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextParameter,cgGetFirstParameter
perl v5.10.0 Cg Toolkit 3.0 158
cgGetFirstTechnique(3) Cg Core Runtime API cgGetFirstTechnique(3)
NAME cgGetFirstTechnique −get the first technique in an effect
SYNOPSIS
#include <Cg/cg.h>
CGtechnique cgGetFirstTechnique( CGeffect effect );
PARAMETERS
effect The effect from which to retrieve the first technique.
RETURN VALUES
Returns the first CGtechnique object in effect.
Returns NULL if effect contains no techniques or an error occurs.
DESCRIPTION
cgGetFirstTechnique is used to begin iteration overall of the techniques contained within a effect. See
cgGetNextTechnique for more information.
EXAMPLES
Iterating through the techniques in an effect:
CGeffect effect = cgCreateEffectFromFile(context, cgfx_filename, NULL);
CGtechnique technique = cgGetFirstTechnique(effect);
while (technique) {
// Do something with each technique
technique = cgGetNextTechnique(technique);
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetFirstTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstTechniqueAnnotation, cgGetNamedTechniqueAnnotation, cgGetNextTechnique,
cgGetNamedTechnique, cgValidateTechnique, cgGetPassTechnique, cgGetTechniqueEffect,
cgGetTechniqueName, cgIsTechnique
perl v5.10.0 Cg Toolkit 3.0 159
cgGetFirstTechniqueAnnotation(3) Cg Core Runtime API cgGetFirstTechniqueAnnotation(3)
NAME cgGetFirstTechniqueAnnotation −get the first annotation of a technique
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetFirstTechniqueAnnotation( CGtechnique tech );
PARAMETERS
tech The technique from which to retrieve the annotation.
RETURN VALUES
Returns the first annotation in the giventechnique.
Returns NULL if the technique has no annotations or an error occurs.
DESCRIPTION
The annotations associated with a technique can be retrievedusing cgGetFirstTechniqueAnnotation.The
remainder of the technique’sannotations can be discovered by iterating through the parameters, calling
cgGetNextAnnotation to get to the next one.
EXAMPLES
CGannotation ann = cgGetFirstTechniqueAnnotation( technique );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetFirstTechniqueAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedTechniqueAnnotation, cgGetNextAnnotation
perl v5.10.0 Cg Toolkit 3.0 160
cgGetFloatAnnotationValues(3) Cg Core Runtime API cgGetFloatAnnotationValues(3)
NAME cgGetFloatAnnotationValues −get a float-valued annotation’svalues
SYNOPSIS
#include <Cg/cg.h>
const float * cgGetFloatAnnotationValues( CGannotation ann,
int * nvalues );
PARAMETERS
ann The annotation from which the values will be retrieved.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of float values. The number of values in the array is returned via the nv a lues
parameter.
Returns NULL if no values are available. nv a lues will be 0.
DESCRIPTION
cgGetFloatAnnotationValues allows the application to retrieve the value(s) of a floating-point typed
annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
HISTORY
cgGetFloatAnnotationValues wasintroduced in Cg 1.4.
SEE ALSO
cgGetAnnotationType, cgGetIntAnnotationValues, cgGetStringAnnotationValue,
cgGetBoolAnnotationValues
perl v5.10.0 Cg Toolkit 3.0 161
cgGetFloatStateAssignmentValues(3) Cg Core Runtime API cgGetFloatStateAssignmentValues(3)
NAME cgGetFloatStateAssignmentValues −get a float-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
const float * cgGetFloatStateAssignmentValues( CGstateassignment sa,
int * nvalues );
PARAMETERS
sa The state assignment from which the values will be retrieved.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of float values. The number of values in the array is returned via the nv a lues
parameter.
Returns NULL if an error occurs or if no values are available. nv a lues will be 0in the latter case.
DESCRIPTION
cgGetFloatStateAssignmentValues allows the application to retrieve the value(s) of a floating-point typed
state assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
float type.
HISTORY
cgGetFloatStateAssignmentValues wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetIntStateAssignmentValues,
cgGetBoolStateAssignmentValues, cgGetStringStateAssignmentValue,
cgGetProgramStateAssignmentValue, cgGetSamplerStateAssignmentValue,
cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 162
cgGetIntAnnotationValues(3) Cg Core Runtime API cgGetIntAnnotationValues(3)
NAME cgGetIntAnnotationValues −get an integer-valued annotation’svalues
SYNOPSIS
#include <Cg/cg.h>
const int * cgGetIntAnnotationValues( CGannotation ann,
int * nvalues );
PARAMETERS
ann The annotation from which the values will be retrieved.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of int values. The number of values in the array is returned via the nv alues
parameter.
Returns NULL if no values are available. nv a lues will be 0.
DESCRIPTION
cgGetIntAnnotationValues allows the application to retrieve the value(s) of an int typed annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
HISTORY
cgGetIntAnnotationValues wasintroduced in Cg 1.4.
SEE ALSO
cgGetAnnotationType, cgGetFloatAnnotationValues, cgGetStringAnnotationValue,
cgGetBoolAnnotationValues
perl v5.10.0 Cg Toolkit 3.0 163
cgGetIntStateAssignmentValues(3) Cg Core Runtime API cgGetIntStateAssignmentValues(3)
NAME cgGetIntStateAssignmentValues −get an int-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
const int * cgGetIntStateAssignmentValues( CGstateassignment sa,
int * nvalues );
PARAMETERS
sa The state assignment from which the values will be retrieved.
nv a lues Pointer to integer where the number of values returned will be stored.
RETURN VALUES
Returns a pointer to an array of int values. The number of values in the array is returned via the nv alues
parameter.
Returns NULL if an error occurs or if no values are available. nv a lues will be 0in the latter case.
DESCRIPTION
cgGetIntStateAssignmentValues allows the application to retrieve the value(s) of an integer typed state
assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of an
integer type.
HISTORY
cgGetIntStateAssignmentValues wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetBoolStateAssignmentValues, cgGetStringStateAssignmentValue,
cgGetProgramStateAssignmentValue, cgGetSamplerStateAssignmentValue,
cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 164
cgGetLastErrorString(3) Cg Core Runtime API cgGetLastErrorString(3)
NAME cgGetLastErrorString −get the current error condition
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetLastErrorString( CGerror * error );
PARAMETERS
error A pointer to a CGerror variable for returning the last error code.
RETURN VALUES
Returns the last error string.
Returns NULL if there was no error.
If error is not NULL,the last error code will be returned in the location specified by error.This is the
same value that would be returned by cgGetError.
DESCRIPTION
cgGetLastErrorString returns the current error condition and error condition string. It’ssimilar to calling
cgGetErrorString with the result of cgGetError.Howev erincertain cases the error string may contain more
information about the specific error that last ocurred than what cgGetErrorString would return.
EXAMPLES
CGerror error;
const char* errorString = cgGetLastErrorString( &error );
ERRORS
None.
HISTORY
cgGetLastErrorString wasintroduced in Cg 1.2.
SEE ALSO
cgGetError,cgGetErrorString
perl v5.10.0 Cg Toolkit 3.0 165
cgGetLastListing(3) Cg Core Runtime API cgGetLastListing(3)
NAME cgGetLastListing −get the current listing text
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetLastListing( CGcontext context );
PARAMETERS
context The context handle.
RETURN VALUES
Returns a NULL-terminated string containing the current listing text.
Returns NULL if no listing text is available, or the listing text string is empty.
In all cases, the pointer returned by cgGetLastListing is only guaranteed to be valid until the next Cg entry
point not related to error reporting is called. Forexample, calls to cgCreateProgram, cgCompileProgram,
cgCreateEffect, or cgValidateTechnique will invalidate anypreviously-returned listing pointer.
DESCRIPTION
Each Cg context maintains a NULL-terminated string containing warning and error messages generated by
the Cg compiler,state managers and the like. cgGetLastListing allows applications and custom state
managers to query the listing text.
cgGetLastListing returns the currrent listing string for the givenCGcontext.When a Cg runtime error
occurs, applications can use the listing text from the appropriate context to provide the user with detailed
information about the error.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetLastListing wasintroduced in Cg 1.1.
SEE ALSO
cgSetLastListing, cgCreateContext, cgSetErrorHandler
perl v5.10.0 Cg Toolkit 3.0 166
cgGetLockingPolicy(3) Cg Core Runtime API cgGetLockingPolicy(3)
NAME cgGetLockingPolicy −get locking policy
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetLockingPolicy( void );
PARAMETERS
None.
RETURN VALUES
Returns an enumerant indicating the current locking policy.
DESCRIPTION
cgGetLockingPolicy returns an enumerant indicating the current locking policyfor the library.See
cgSetLockingPolicyfor more information.
EXAMPLES
CGenum currentLockingPolicy = cgGetLockingPolicy();
ERRORS
None.
HISTORY
cgGetLockingPolicy wasintroduced in Cg 2.0.
SEE ALSO
cgSetLockingPolicy
perl v5.10.0 Cg Toolkit 3.0 167
cgGetMatrixParameter(3) Cg Core Runtime API cgGetMatrixParameter(3)
NAME cgGetMatrixParameter −gets the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float, or double */
void cgGetMatrixParameter{ifd}{rc}( CGparameter param,
TYPE * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of values into which the parameter’svalue will be written. The array must have size
equal to the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
The cgGetMatrixParameter functions retrieve the value of a givenmatrix parameter.The functions are
available in various combinations.
There are versions of each function that take int,float or double values signified by the i,for din the
function name.
There are versions of each function that specify the order in which matrix values should be written to the
array.Row-major copying is indicated by r,while column-major is indicated by c.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
The cgGetMatrixParameter functions were introduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameterOrder,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 168
cgGetMatrixParameterOrder(3) Cg Core Runtime API cgGetMatrixParameterOrder(3)
NAME cgGetMatrixParameterOrder −get the roworcolumn order of a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetMatrixParameterOrder( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns CG_ROW_MAJOR for a row-major matrix parameter.
Returns CG_COLUMN_MAJOR for a column-major matrix parameter.
Returns CG_UNKNOWN for a parameter that is not a matrix.
DESCRIPTION
cgGetMatrixParameterOrder returns the roworcolumn order of a matrix parameter.
The Cg compiler supports #pragma pack_matrix(row_major) or #pragma
pack_matrix(column_major) for specifying the order of matrix parameters. Row-major order is the Cg
default.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter or param is not a
matrix parameter.
HISTORY
cgGetMatrixParameterOrder wasintroduced in Cg 2.2.
SEE ALSO
cgGetMatrixParameter,cgGetMatrixSize
perl v5.10.0 Cg Toolkit 3.0 169
cgGetMatrixParameterdc(3) Cg Core Runtime API cgGetMatrixParameterdc(3)
NAME cgGetMatrixParameterdc −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameterdc( CGparameter param,
double * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of doubles into which the matrix values will be written. The array must have size equal
to the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameterdc retrievesthe values of the givenmatrix parameter using column-major
ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameterdc wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 170
cgGetMatrixParameterdr(3) Cg Core Runtime API cgGetMatrixParameterdr(3)
NAME cgGetMatrixParameterdr −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameterdr( CGparameter param,
double * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of doubles into which the matrix values will be written. The array must have size equal
to the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameterdr retrievesthe values of the givenmatrix parameter using row-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameterdr wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 171
cgGetMatrixParameterfc(3) Cg Core Runtime API cgGetMatrixParameterfc(3)
NAME cgGetMatrixParameterfc −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameterfc( CGparameter param,
float * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of floats into which the matrix values will be written. The array must have size equal to
the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameterfc retrievesthe values of the givenmatrix parameter using column-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameterfc wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 172
cgGetMatrixParameterfr(3) Cg Core Runtime API cgGetMatrixParameterfr(3)
NAME cgGetMatrixParameterfr −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameterfr( CGparameter param,
float * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of floats into which the matrix values will be written. The array must have size equal to
the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameterfr retrievesthe values of the givenmatrix parameter using row-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameterfr wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 173
cgGetMatrixParameteric(3) Cg Core Runtime API cgGetMatrixParameteric(3)
NAME cgGetMatrixParameteric −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameteric( CGparameter param,
int * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of ints into which the matrix values will be written. The array must have size equal to
the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameteric retrievesthe values of the givenmatrix parameter using column-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameteric wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 174
cgGetMatrixParameterir(3) Cg Core Runtime API cgGetMatrixParameterir(3)
NAME cgGetMatrixParameterir −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixParameterir( CGparameter param,
int * matrix );
PARAMETERS
param The parameter from which the values will be returned.
matrix An array of ints into which the matrix values will be written. The array must have size equal to
the number of rows in the matrix times the number of columns in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixParameterir retrievesthe values of the givenmatrix parameter using row-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetMatrixParameterir wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 175
cgGetMatrixSize(3) Cg Core Runtime API cgGetMatrixSize(3)
NAME cgGetMatrixSize −get the size of one dimension of an array parameter
SYNOPSIS
#include <Cg/cg.h>
void cgGetMatrixSize( CGtype type,
int * nrows,
int * ncols );
PARAMETERS
type The type enumerant.
nrows A pointer to the location where the number of rows that type has will be written.
ncols A pointer to the location where the number of columns that type has will be written.
RETURN VALUES
None.
DESCRIPTION
cgGetMatrixSize writes the number of rows and columns contained by the specified matrix type into
nrowsand ncols locations respectively.Iftype is not a matrix enumerant type, 0is written as both the
rows and columns size.
Contrast this routine with cgGetTypeSizes where the number of rows and columns will be set to 1rowand
1column for both scalar and non-numeric types but for vector types, the number of rows and columns will
be set to 1rowand Ncolumns where Nis the number of components in the vector.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGetMatrixSize wasintroduced in Cg 1.5.
SEE ALSO
cgGetMatrixParameterOrder,cgGetArrayTotalSize, cgGetArrayDimension, cgGetArrayParameter,
cgGetTypeSizes
perl v5.10.0 Cg Toolkit 3.0 176
cgGetNamedEffect(3) Cg Core Runtime API cgGetNamedEffect(3)
NAME cgGetNamedEffect −get an effect from a context by name
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgGetNamedEffect( CGcontext context,
const char * name );
PARAMETERS
context The context from which to retrieve the effect.
name The name of the effect to retrieve.
RETURN VALUES
Returns the named effect if found.
Returns NULL if context has no effect corresponding to name or if an error occurs.
DESCRIPTION
The effects in a context can be retrieveddirectly by name using cgGetNamedEffect.The effect names can
be discovered by iterating through the context’seffects (see cgGetFirstEffect and cgGetNextEffect) and
calling cgGetEffectName for each.
EXAMPLES
/* get "simpleEffect" from context */
CGeffect effect = cgGetNamedEffect( context, "simpleEffect" );
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetNamedEffect wasintroduced in Cg 1.5.
SEE ALSO
cgGetEffectName, cgSetEffectName, cgGetFirstEffect, cgGetNextEffect
perl v5.10.0 Cg Toolkit 3.0 177
cgGetNamedEffectAnnotation(3) Cg Core Runtime API cgGetNamedEffectAnnotation(3)
NAME cgGetNamedEffectAnnotation −get an effect annotation by name
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNamedEffectAnnotation( CGeffect effect,
const char * name );
PARAMETERS
effect The effect from which to retrieve the annotation.
name The name of the annotation to retrieve.
RETURN VALUES
Returns the named annotation.
Returns NULL if the effect has no annotation corresponding to name.
DESCRIPTION
The annotations associated with an effect can be retrieveddirectly by name using
cgGetNamedEffectAnnotation.The names of a effect’sannotations can be discovered by iterating
through the annotations (see cgGetFirstEffectAnnotation and cgGetNextAnnotation), calling
cgGetAnnotationName for each one in turn.
EXAMPLES
/* fetch annotation "Apple" from CGeffect effect */
CGannotation ann = cgGetNamedEffectAnnotation( effect, "Apple" );
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
CG_INVALID_POINTER_ERROR is generated if name is NULL.
HISTORY
cgGetNamedEffectAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetFirstEffectAnnotation, cgGetNextAnnotation, cgGetAnnotationName
perl v5.10.0 Cg Toolkit 3.0 178
cgGetNamedEffectParameter(3) Cg Core Runtime API cgGetNamedEffectParameter(3)
NAME cgGetNamedEffectParameter −get an effect parameter by name
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNamedEffectParameter( CGeffect effect,
const char * name );
PARAMETERS
effect The effect from which to retrieve the parameter.
name The name of the parameter to retrieve.
RETURN VALUES
Returns the named parameter from the effect.
Returns NULL if the effect has no parameter corresponding to name.
DESCRIPTION
The parameters of a effect can be retrieveddirectly by name using cgGetNamedEffectParameter.The
names of the parameters in a effect can be discovered by iterating through the effect’sparameters (see
cgGetFirstEffectParameter and cgGetNextParameter), calling cgGetParameterName for each one in turn.
The givenname may be of the form ‘‘foo.bar[2]’’, which retrievesthe second element of the array ‘‘bar’’in
astructure named ‘‘foo’’.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetNamedEffectParameter wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstEffectParameter,cgGetNextParameter,cgGetParameterName, cgGetNamedParameter
perl v5.10.0 Cg Toolkit 3.0 179
cgGetNamedParameter(3) Cg Core Runtime API cgGetNamedParameter(3)
NAME cgGetNamedParameter −get a program parameter by name
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNamedParameter( CGprogram program,
const char * name );
PARAMETERS
program The program from which to retrieve the parameter.
name The name of the parameter to retrieve.
RETURN VALUES
Returns the named parameter from the program.
Returns NULL if the program has no parameter corresponding to name.
DESCRIPTION
The parameters of a program can be retrieveddirectly by name using cgGetNamedParameter.The names
of the parameters in a program can be discovered by iterating through the program’sparameters (see
cgGetNextParameter), calling cgGetParameterName for each one in turn.
The parameter name does not have tobecomplete name for a leaf node parameter.For example, if you
have Cgprogram with the following parameters :
struct FooStruct
{
float4 A;
float4 B;
};
struct BarStruct
{
FooStruct Foo[2];
};
void main(BarStruct Bar[3])
{
/* ... */
}
The following leaf-node parameters will be generated :
Bar[0].Foo[0].A
Bar[0].Foo[0].B
Bar[0].Foo[1].A
Bar[0].Foo[1].B
Bar[1].Foo[0].A
Bar[1].Foo[0].B
Bar[1].Foo[1].A
Bar[1].Foo[1].B
Bar[2].Foo[0].A
Bar[2].Foo[0].B
Bar[2].Foo[1].A
Bar[2].Foo[1].B
Ahandle to anyofthe non-leaf arrays or structs can be directly obtained by using the appropriate name.
The following are a fewexamples of names valid names that may be used with cgGetNamedParameter
giventhe above Cgprogram :
perl v5.10.0 Cg Toolkit 3.0 180
cgGetNamedParameter(3) Cg Core Runtime API cgGetNamedParameter(3)
"Bar"
"Bar[1]"
"Bar[1].Foo"
"Bar[1].Foo[0]"
"Bar[1].Foo[0].B"
...
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetNamedParameter wasintroduced in Cg 1.1.
SEE ALSO
cgIsParameter,cgGetFirstParameter,cgGetNextParameter,cgGetArrayParameter,cgGetParameterName
perl v5.10.0 Cg Toolkit 3.0 181
cgGetNamedParameterAnnotation(3) Cg Core Runtime API cgGetNamedParameterAnnotation(3)
NAME cgGetNamedParameterAnnotation −get a parameter annotation by name
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNamedParameterAnnotation( CGparameter param,
const char * name );
PARAMETERS
param The parameter from which to retrieve the annotation.
name The name of the annotation to retrieve.
RETURN VALUES
Returns the named annotation.
Returns NULL if the parameter has no annotation corresponding to name.
DESCRIPTION
The annotations associated with a parameter can be retrieveddirectly by name using
cgGetNamedParameterAnnotation.The names of a parameter’sannotations can be discovered by
iterating through the annotations (see cgGetFirstParameterAnnotation and cgGetNextAnnotation), calling
cgGetAnnotationName for each one in turn.
EXAMPLES
/* fetch annotation "Apple" from CGparameter param */
CGannotation ann = cgGetNamedParameterAnnotation( param, "Apple" );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetNamedParameterAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstParameterAnnotation, cgGetNextAnnotation, cgGetAnnotationName
perl v5.10.0 Cg Toolkit 3.0 182
cgGetNamedPass(3) Cg Core Runtime API cgGetNamedPass(3)
NAME cgGetNamedPass −get a technique pass by name
SYNOPSIS
#include <Cg/cg.h>
CGpass cgGetNamedPass( CGtechnique tech,
const char * name );
PARAMETERS
tech The technique from which to retrieve the pass.
name The name of the pass to retrieve.
RETURN VALUES
Returns the named pass from the technique.
Returns NULL if the technique has no pass corresponding to name.
DESCRIPTION
The passes of a technique can be retrieveddirectly by name using cgGetNamedPass.The names of the
passes in a technique can be discovered by iterating through the technique’spasses (see cgGetFirstPass and
cgGetNextPass), calling cgGetPassName for each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetNamedPass wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstPass, cgGetNextPass, cgGetPassName
perl v5.10.0 Cg Toolkit 3.0 183
cgGetNamedPassAnnotation(3) Cg Core Runtime API cgGetNamedPassAnnotation(3)
NAME cgGetNamedPassAnnotation −get a pass annotation by name
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNamedPassAnnotation( CGpass pass,
const char * name );
PARAMETERS
pass The pass from which to retrieve the annotation.
name The name of the annotation to retrieve.
RETURN VALUES
Returns the named annotation.
Returns NULL if the pass has no annotation corresponding to name.
DESCRIPTION
The annotations associated with a pass can be retrieveddirectly by name using
cgGetNamedPassAnnotation.The names of a pass’sannotations can be discovered by iterating through
the annotations (see cgGetFirstPassAnnotation and cgGetNextAnnotation), calling cgGetAnnotationName
for each one in turn.
EXAMPLES
/* fetch annotation "Apple" from CGpass pass */
CGannotation ann = cgGetNamedPassAnnotation( pass, "Apple" );
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetNamedPassAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstPassAnnotation, cgGetNextAnnotation, cgGetAnnotationName
perl v5.10.0 Cg Toolkit 3.0 184
cgGetNamedProgramAnnotation(3) Cg Core Runtime API cgGetNamedProgramAnnotation(3)
NAME cgGetNamedProgramAnnotation −get a program annotation by name
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNamedProgramAnnotation( CGprogram program,
const char * name );
PARAMETERS
program The program from which to retrieve the annotation.
name The name of the annotation to retrieve.
RETURN VALUES
Returns the named annotation.
Returns NULL if the program has no annotation corresponding to name.
DESCRIPTION
The annotations associated with a program can be retrieveddirectly by name using
cgGetNamedProgramAnnotation.The names of a program’sannotations can be discovered by iterating
through the annotations (see cgGetFirstProgramAnnotation and cgGetNextAnnotation), calling
cgGetAnnotationName for each one in turn.
EXAMPLES
/* fetch annotation "Apple" from CGprogram program */
CGannotation ann = cgGetNamedProgramAnnotation( program, "Apple" );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetNamedProgramAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstProgramAnnotation, cgGetNextAnnotation, cgGetAnnotationName
perl v5.10.0 Cg Toolkit 3.0 185
cgGetNamedProgramParameter(3) Cg Core Runtime API cgGetNamedProgramParameter(3)
NAME cgGetNamedProgramParameter −get a program parameter by name
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNamedProgramParameter( CGprogram program,
CGenum name_space,
const char * name );
PARAMETERS
program The program from which to retrieve the parameter.
name_space Specifies the namespace of the parameter to iterate through. Currently CG_PROGRAM and
CG_GLOBAL are supported.
name Specifies the name of the parameter to retrieve.
RETURN VALUES
Returns the named parameter from the program.
Returns NULL if the program has no parameter corresponding to name.
DESCRIPTION
cgGetNamedProgramParameter is essentially identical to cgGetNamedParameter except it limits the
search of the parameter to the name space specified by name_space.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetNamedProgramParameter wasintroduced in Cg 1.2.
SEE ALSO
cgGetNamedParameter
perl v5.10.0 Cg Toolkit 3.0 186
cgGetNamedSamplerState(3) Cg Core Runtime API cgGetNamedSamplerState(3)
NAME cgGetNamedSamplerState −get a sampler state by name
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetNamedSamplerState( CGcontext context,
const char * name );
PARAMETERS
context The context from which to retrieve the named sampler state.
name The name of the state to retrieve.
RETURN VALUES
Returns the named sampler state.
Returns NULL if context is invalid or if context has no sampler states corresponding to name.
DESCRIPTION
The sampler states associated with a context, as specified with a sampler_state block in an effect file, can
be retrieveddirectly by name using cgGetNamedSamplerState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_PARAMETER_ERROR is generated if name is NULL.
HISTORY
cgGetNamedSamplerState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateArraySamplerState, cgCreateSamplerState, cgGetFirstSamplerState, cgSetSamplerState
perl v5.10.0 Cg Toolkit 3.0 187
cgGetNamedSamplerStateAssignment(3) Cg Core Runtime API cgGetNamedSamplerStateAssignment(3)
NAME cgGetNamedSamplerStateAssignment −get a sampler state assignment by name
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgGetNamedSamplerStateAssignment( CGparameter param,
const char * name );
PARAMETERS
param The sampler parameter from which to retrieve the sampler state assignment.
name The name of the state assignment to retrieve.
RETURN VALUES
Returns the named sampler state assignment.
Returns NULL if the pass has no sampler state assignment corresponding to name.
DESCRIPTION
The sampler state assignments associated with a sampler parameter,asspecified with a sampler_state
block in an effect file, can be retrieveddirectly by name using cgGetNamedSamplerStateAssignment.
The names of the sampler state assignments can be discovered by iterating through the sampler’sstate
assignments (see cgGetFirstSamplerStateAssignment and cgGetNextStateAssignment), calling
cgGetSamplerStateAssignmentState then cgGetStateName for each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetNamedSamplerStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgIsStateAssignment, cgGetFirstSamplerStateAssignment, cgGetNextStateAssignment, cgGetStateName
perl v5.10.0 Cg Toolkit 3.0 188
cgGetNamedState(3) Cg Core Runtime API cgGetNamedState(3)
NAME cgGetNamedState −get a context state by name
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetNamedState( CGcontext context,
const char * name );
PARAMETERS
context The context from which to retrieve the state.
name The name of the state to retrieve.
RETURN VALUES
Returns the named state from the context.
Returns NULL if the context has no state corresponding to name.
DESCRIPTION
The states of a context can be retrieveddirectly by name using cgGetNamedState.The names of the states
in a context can be discovered by iterating through the context’sstates (see cgGetFirstState and
cgGetNextState), calling cgGetStateName for each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if name is NULL.
HISTORY
cgGetNamedState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateState, cgGetFirstState, cgGetNextState, cgGetStateEnumerantName, cgGetStateEnumerantValue,
cgGetStateName, cgGetStateType, cgIsState
perl v5.10.0 Cg Toolkit 3.0 189
cgGetNamedStateAssignment(3) Cg Core Runtime API cgGetNamedStateAssignment(3)
NAME cgGetNamedStateAssignment −get a pass state assignment by name
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgGetNamedStateAssignment( CGpass pass,
const char * name );
PARAMETERS
pass The pass from which to retrieve the state assignment.
name The name of the state assignment to retrieve.
RETURN VALUES
Returns the named state assignment from the pass.
Returns NULL if the pass has no state assignment corresponding to name.
DESCRIPTION
The state assignments of a pass can be retrieveddirectly by name using cgGetNamedStateAssignment.
The names of the state assignments in a pass can be discovered by iterating through the pass’sstate
assignments (see cgGetFirstStateAssignment and cgGetNextStateAssignment), calling
cgGetStateAssignmentState then cgGetStateName for each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetNamedStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgIsStateAssignment, cgGetFirstStateAssignment, cgGetNextStateAssignment,
cgGetStateAssignmentState, cgGetStateName
perl v5.10.0 Cg Toolkit 3.0 190
cgGetNamedStructParameter(3) Cg Core Runtime API cgGetNamedStructParameter(3)
NAME cgGetNamedStructParameter −get a struct parameter by name
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNamedStructParameter( CGparameter param,
const char * name );
PARAMETERS
param The struct parameter from which to retrieve the member parameter.
name The name of the member parameter to retrieve.
RETURN VALUES
Returns the member parameter from the givenstruct.
Returns NULL if the struct has no member parameter corresponding to name.
DESCRIPTION
The member parameters of a struct parameter may be retrieveddirectly by name using
cgGetNamedStructParameter.
The names of the parameters in a struct may be discovered by iterating through the struct’smember
parameters (see cgGetFirstStructParameter and cgGetNextParameter), and calling cgGetParameterName for
each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not a struct parameter.
HISTORY
cgGetNamedStructParameter wasintroduced in Cg 1.2.
SEE ALSO
cgGetFirstStructParameter,cgGetNextParameter,cgGetParameterName
perl v5.10.0 Cg Toolkit 3.0 191
cgGetNamedSubParameter(3) Cg Core Runtime API cgGetNamedSubParameter(3)
NAME cgGetNamedSubParameter −gets a ‘‘shallow’’or‘‘deep’’parameter from an aggregate parameter (ie
struct, array,etc.)
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNamedSubParameter( CGparameter param,
const char * name );
PARAMETERS
param Aggregate parameter.
name Name of the parameter inside the aggregate parameter (param) being requested.
RETURN VALUES
Returns the named parameter.
Returns NULL if param has no parameter corresponding to name.
DESCRIPTION
cgGetNamedSubParameter is a generalized parameter getter function that will retrieve parameters,
including deep parameters, of an aggregate parameter type such as a structure or an array.
EXAMPLES
CGparameter parent = cgGetNamedParameter( program, "someParameter" );
CGparameter deepChild = cgGetNamedSubParameter( parent, "foo.list[3].item" );
/* Note: 'deepChild' is the same parameter returned by:
cgGetNamedParameter( program, "someParameter.foo.list[3].item" ); */
ERRORS
None.
HISTORY
cgGetNamedSubParameter wasintroduced in Cg 1.5.
SEE ALSO
cgGetNamedParameter,cgGetNamedStructParameter,cgGetArrayParameter
perl v5.10.0 Cg Toolkit 3.0 192
cgGetNamedTechnique(3) Cg Core Runtime API cgGetNamedTechnique(3)
NAME cgGetNamedTechnique −get an effect’stechnique by name
SYNOPSIS
#include <Cg/cg.h>
CGtechnique cgGetNamedTechnique( CGeffect effect,
const char * name );
PARAMETERS
effect The effect from which to retrieve the technique.
name The name of the technique to retrieve.
RETURN VALUES
Returns the named technique from the effect.
Returns NULL if the effect has no technique corresponding to name.
DESCRIPTION
The techniques of an effect can be retrieveddirectly by name using cgGetNamedTechnique.The names
of the techniques in a effect can be discovered by iterating through the effect’stechniques (see
cgGetFirstTechnique and cgGetNextTechnique), calling cgGetTechniqueName for each one in turn.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetNamedTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstTechnique, cgGetNextTechnique, cgGetTechniqueName
perl v5.10.0 Cg Toolkit 3.0 193
cgGetNamedTechniqueAnnotation(3) Cg Core Runtime API cgGetNamedTechniqueAnnotation(3)
NAME cgGetNamedTechniqueAnnotation −get a technique annotation by name
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNamedTechniqueAnnotation( CGtechnique tech,
const char * name );
PARAMETERS
tech The technique from which to retrieve the annotation.
name The name of the annotation to retrieve.
RETURN VALUES
Returns the named annotation.
Returns NULL if the technique has no annotation corresponding to name.
DESCRIPTION
The annotations associated with a technique can be retrieveddirectly by name using
cgGetNamedTechniqueAnnotation.The names of a technique’sannotations can be discovered by
iterating through the annotations (see cgGetFirstTechniqueAnnotation and cgGetNextAnnotation), calling
cgGetAnnotationName for each one in turn.
EXAMPLES
/* fetch annotation "Apple" from CGtechnique technique */
CGannotation ann = cgGetNamedTechniqueAnnotation( technique, "Apple" );
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetNamedTechniqueAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstTechniqueAnnotation, cgGetNextAnnotation, cgGetAnnotationName
perl v5.10.0 Cg Toolkit 3.0 194
cgGetNamedUserType(3) Cg Core Runtime API cgGetNamedUserType(3)
NAME cgGetNamedUserType −get enumerant associated with type name
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetNamedUserType( CGhandle handle,
const char * name );
PARAMETERS
handle The CGprogram or CGeffect in which the type is defined.
name A string containing the case-sensitive type name.
RETURN VALUES
Returns the type enumerant associated with name.
Returns CG_UNKNOWN_TYPE if no such type exists.
DESCRIPTION
cgGetNamedUserType returns the enumerant associated with the named type defined in the constuct
associated with handle,which may be a CGprogram or CGeffect.
Foragiv entype name, the enumerant returned by this entry point is guaranteed to be identical if called
with either an CGeffect handle, or a CGprogram that is defined within that effect.
If twoprograms in the same context define a type using identical names and definitions, the associated
enumerants are also guaranteed to be identical.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if handle is not a valid program or effect.
HISTORY
cgGetNamedUserType wasintroduced in Cg 1.2.
SEE ALSO
cgGetUserType, cgGetType
perl v5.10.0 Cg Toolkit 3.0 195
cgGetNextAnnotation(3) Cg Core Runtime API cgGetNextAnnotation(3)
NAME cgGetNextAnnotation −iterate through annotations
SYNOPSIS
#include <Cg/cg.h>
CGannotation cgGetNextAnnotation( CGannotation ann );
PARAMETERS
ann The current annotation.
RETURN VALUES
Returns the next annotation in the sequence of annotations associated with the annotated object.
Returns NULL when ann is the last annotation.
DESCRIPTION
The annotations associated with a parameter,pass, technique, or program can be iterated overbyusing
cgGetNextAnnotation.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each
annotation will be visited exactly once.
EXAMPLES
CGannotation ann = cgGetFirstParameterAnnotation( param );
while( ann )
{
/* do something with ann */
ann = cgGetNextAnnotation( ann );
}
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
HISTORY
cgGetNextAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstParameterAnnotation, cgGetFirstPassAnnotation, cgGetFirstTechniqueAnnotation,
cgGetFirstProgramAnnotation, cgGetNamedParameterAnnotation, cgGetNamedPassAnnotation,
cgGetNamedTechniqueAnnotation, cgGetNamedProgramAnnotation, cgIsAnnotation
perl v5.10.0 Cg Toolkit 3.0 196
cgGetNextEffect(3) Cg Core Runtime API cgGetNextEffect(3)
NAME cgGetNextEffect −iterate through effects in a context
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgGetNextEffect( CGeffect effect );
PARAMETERS
effect The current effect.
RETURN VALUES
Returns the next effect in the context’sinternal sequence of effects.
Returns NULL when effect is the last effect in the context.
DESCRIPTION
The effects within a context can be iterated overwith cgGetNextEffect.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each effect
will be visited exactly once. No guarantees can be made if effects are created or deleted during iteration.
EXAMPLES
CGeffect effect = cgGetFirstEffect( context );
while( effect )
{
/* do something with effect */
effect = cgGetNextEffect( effect );
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgGetNextEffect wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstEffect
perl v5.10.0 Cg Toolkit 3.0 197
cgGetNextLeafParameter(3) Cg Core Runtime API cgGetNextLeafParameter(3)
NAME cgGetNextLeafParameter −get the next leaf parameter in a program or effect
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNextLeafParameter( CGparameter param );
PARAMETERS
param The current leaf parameter.
RETURN VALUES
Returns the next leaf CGparameter object.
Returns NULL if param is invalid or if the program or effect from which the iteration started does not have
anymore leaf parameters.
DESCRIPTION
cgGetNextLeafParameter returns the next leaf parameter (not struct or array parameters) following a
givenleaf parameter.
In a similar manner,the leaf parameters in an effect can be iterated overstarting with a call to
cgGetFirstLeafEffectParameter.
EXAMPLES
CGparameter leaf = cgGetFirstLeafParameter( program );
while(leaf)
{
/* Do stuff with leaf */
leaf = cgGetNextLeafParameter( leaf );
}
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetNextLeafParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetFirstLeafParameter,cgGetFirstLeafEffectParameter
perl v5.10.0 Cg Toolkit 3.0 198
cgGetNextParameter(3) Cg Core Runtime API cgGetNextParameter(3)
NAME cgGetNextParameter −iterate through a program’soreffect’sparameters
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetNextParameter( CGparameter current );
PARAMETERS
current The current parameter.
RETURN VALUES
Returns the next parameter in the program or effect’sinternal sequence of parameters.
Returns NULL when current is the last parameter in the program or effect.
DESCRIPTION
The parameters of a program or effect can be iterated overusing cgGetNextParameter with
cgGetFirstParameter,orcgGetArrayParameter.
Similarly,the parameters in an effect can be iterated overstarting with a call to cgGetFirstEffectParameter.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each
parameter will be visited exactly once.
EXAMPLES
void RecurseParams( CGparameter param )
{
if(!param)
return;
do
{
switch(cgGetParameterType(param))
{
case CG_STRUCT :
RecurseParams(cgGetFirstStructParameter(param));
break;
case CG_ARRAY :
{
int ArraySize = cgGetArraySize(param, 0);
int i;
for(i=0; i < ArraySize; ++i)
RecurseParams(cgGetArrayParameter(param, i));
}
break;
default :
/* Do stuff to param */
}
}while((param = cgGetNextParameter(param)) != 0);
}
void RecurseParamsInProgram( CGprogram program )
{
RecurseParams( cgGetFirstParameter( program ) );
}
perl v5.10.0 Cg Toolkit 3.0 199
cgGetNextParameter(3) Cg Core Runtime API cgGetNextParameter(3)
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetNextParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetFirstParameter,cgGetFirstEffectParameter,cgGetFirstStructParameter,cgGetArrayParameter,
cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 200
cgGetNextPass(3) Cg Core Runtime API cgGetNextPass(3)
NAME cgGetNextPass −iterate through the passes in a technique
SYNOPSIS
#include <Cg/cg.h>
CGpass cgGetNextPass( CGpass pass );
PARAMETERS
pass The current pass.
RETURN VALUES
Returns the next pass in the technique’sinternal sequence of passes.
Returns NULL when pass is the last pass in the technique.
DESCRIPTION
The passes within a technique can be iterated overusing cgGetNextPass.
Passes are returned in the order defined in the technique.
EXAMPLES
CGpass pass = cgGetFirstPass( technique );
while( pass )
{
/* do something with pass */
pass = cgGetNextPass( pass )
}
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetNextPass wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstPass, cgGetNamedPass, cgIsPass
perl v5.10.0 Cg Toolkit 3.0 201
cgGetNextProgram(3) Cg Core Runtime API cgGetNextProgram(3)
NAME cgGetNextProgram −iterate through programs in a context
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetNextProgram( CGprogram program );
PARAMETERS
program The current program.
RETURN VALUES
Returns the next program in the context’sinternal sequence of programs.
Returns NULL when program is the last program in the context.
DESCRIPTION
The programs within a context can be iterated overbyusing cgGetNextProgram.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each
program will be visited exactly once. No guarantees can be made if programs are generated or deleted
during iteration.
EXAMPLES
CGprogram program = cgGetFirstProgram( context );
while( program )
{
/* do something with program */
program = cgGetNextProgram( program )
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetNextProgram wasintroduced in Cg 1.1.
SEE ALSO
cgGetFirstProgram, cgCreateProgram, cgDestroyProgram, cgIsProgram
perl v5.10.0 Cg Toolkit 3.0 202
cgGetNextState(3) Cg Core Runtime API cgGetNextState(3)
NAME cgGetNextState −iterate through states in a context
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetNextState( CGstate state );
PARAMETERS
state The current state.
RETURN VALUES
Returns the next state in the context’sinternal sequence of states.
Returns NULL when state is the last state in the context.
DESCRIPTION
The states within a context can be iterated overusing cgGetNextState.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each state
will be visited exactly once. No guarantees can be made if states are created or deleted during iteration.
EXAMPLES
CGstate state = cgGetFirstState( context );
while( state )
{
/* do something with state */
state = cgGetNextState( state )
}
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetNextState wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstState, cgGetNamedState, cgCreateState, cgIsState
perl v5.10.0 Cg Toolkit 3.0 203
cgGetNextStateAssignment(3) Cg Core Runtime API cgGetNextStateAssignment(3)
NAME cgGetNextStateAssignment −iterate through state assignments in a pass
SYNOPSIS
#include <Cg/cg.h>
CGstateassignment cgGetNextStateAssignment( CGstateassignment sa );
PARAMETERS
sa The current state assignment.
RETURN VALUES
Returns the next state assignment in the pass’ internal sequence of state assignments.
Returns NULL when prog is the last state assignment in the pass.
DESCRIPTION
The state assignments within a pass can be iterated overbyusing cgGetNextStateAssignment.
State assignments are returned in the same order specified in the pass in the effect.
EXAMPLES
CGstateassignment sa = cgGetFirstStateAssignment( pass );
while( sa )
{
/* do something with sa */
sa = cgGetNextStateAssignment( sa )
}
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetNextStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstStateAssignment, cgGetNamedStateAssignment, cgIsStateAssignment
perl v5.10.0 Cg Toolkit 3.0 204
cgGetNextTechnique(3) Cg Core Runtime API cgGetNextTechnique(3)
NAME cgGetNextTechnique −iterate through techniques in a effect
SYNOPSIS
#include <Cg/cg.h>
CGtechnique cgGetNextTechnique( CGtechnique tech );
PARAMETERS
tech The current technique.
RETURN VALUES
Returns the next technique in the effect’sinternal sequence of techniques.
Returns NULL when tech is the last technique in the effect.
DESCRIPTION
The techniques within a effect can be iterated overusing cgGetNextTechnique.
Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each
technique will be visited exactly once.
EXAMPLES
CGtechnique tech = cgGetFirstTechnique( effect );
while( tech )
{
/* do something with tech */
tech = cgGetNextTechnique( tech )
}
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetNextTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstTechnique, cgGetNamedTechnique
perl v5.10.0 Cg Toolkit 3.0 205
cgGetNumConnectedToParameters(3) Cg Core Runtime API cgGetNumConnectedToParameters(3)
NAME cgGetNumConnectedToParameters −gets the number of connected destination parameters
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumConnectedToParameters( CGparameter param );
PARAMETERS
param The source parameter.
RETURN VALUES
Returns the number of destination parameters connected to param.
Returns 0if an error occurs.
DESCRIPTION
cgGetNumConnectedToParameters returns the number of destination parameters connected to the source
parameter param.It’sprimarily used with cgGetConnectedToParameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetNumConnectedToParameters wasintroduced in Cg 1.2.
SEE ALSO
cgConnectParameter,cgGetConnectedParameter,cgGetConnectedToParameter
perl v5.10.0 Cg Toolkit 3.0 206
cgGetNumDependentAnnotationParameters(3) Cg Core Runtime APIcgGetNumDependentAnnotationParameters(3)
NAME cgGetNumDependentAnnotationParameters −get the number of effect parameters on which an
annotation depends
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumDependentAnnotationParameters( CGannotation ann );
PARAMETERS
ann The annotation handle.
RETURN VALUES
Returns the number of parameters on which ann depends.
DESCRIPTION
Annotations in CgFX files may include references to one or more effect parameters on the right hand side
of the annotation that are used for computing the annotation’svalue.
cgGetNumDependentAnnotationParameters returns the total number of such parameters.
cgGetDependentAnnotationParameter can then be used to iterate overthese parameters.
This information can be useful for applications that wish to cache the values of annotations so that theycan
determine which annotations may change as the result of changing a particular parameter’svalue.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
HISTORY
cgGetNumDependentAnnotationParameters wasintroduced in Cg 1.4.
SEE ALSO
cgGetDependentAnnotationParameter,cgGetNumDependentStateAssignmentParameters
perl v5.10.0 Cg Toolkit 3.0 207
cgGetNumDependentProgramArrayStateAssignmentParameters(3)Cg Core Runtime APIcgGetNumDependentProgramArrayStateAssignmentParameters(3)
NAME cgGetNumDependentProgramArrayStateAssignmentParameters −get the number of parameters on
which a state assignment’svalue depends
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumDependentProgramArrayStateAssignmentParameters( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the number of parameters on which sa depends.
Returns 0if sa is not a program state assignment or an error occurs.
DESCRIPTION
State assignments in CgFX files may include references to an array indexedbyaneffect parameter (or
expression) on the right hand side of the state assignment that is used for computing the state assignment’s
value. Usually this array holds the compile statements of shader programs and by changing the indexofthe
shader array,it’spossible to switch to a different program or profile on-the-fly.
Each compile statement in the array can depend on one or more effect parameters which are passed to the
program in its parameter list. It is sometimes necessary for the application to query what those parameters
are so values can be properly set to them.
Before you can query these parameters, you must knowhow manythere are.
cgGetNumDependentProgramArrayStateAssignmentParameters will return this number.
EXAMPLES
/* In CgFX file */
vertexshader Torus[4] =
{
compile vp40 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile vp30 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile arbvp1 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) ),
compile vp20 C8E6v_torus( LightPosition, EyePosition, ModelViewProj,
float2( OuterRadius, InnerRadius ) )
};
pixelshader SpecSurf[4] =
{
compile fp40 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube ),
compile fp30 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube ),
compile arbfp1 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
perl v5.10.0 Cg Toolkit 3.0 208
cgGetNumDependentProgramArrayStateAssignmentParameters(3)Cg Core Runtime APIcgGetNumDependentProgramArrayStateAssignmentParameters(3)
normalMap, normalizeCube, normalizeCube ),
compile fp20 C8E4f_specSurf( Ambient, float4(DiffuseMaterial *LightColor, 1),
float4(SpecularMaterial * LightColor, 1),
normalMap, normalizeCube, normalizeCube )
};
int select = 0;
technique bumpdemo
{
pass
{
VertexProgram = (Torus[select]);
FragmentProgram = (SpecSurf[select]);
}
}
/* In application */
int numParameters = cgGetNumDependentProgramArrayStateAssignmentParameters(stateAssignment);
for(int i = 0; i < numParameters; ++i) {
CGparameter param = cgGetDependentProgramArrayStateAssignmentParameter(stateAssignment, i);
/* Set value for 'param' */
}
Forthis example when select = 0 cgGetNumDependentProgramArrayStateAssignmentParameters will
return 5 for VertexProgram and 8 for FragmentProgram.
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetNumDependentProgramArrayStateAssignmentParameters wasintroduced in Cg 3.0.
SEE ALSO
cgGetDependentProgramArrayStateAssignmentParameter
perl v5.10.0 Cg Toolkit 3.0 209
cgGetNumDependentStateAssignmentParameters(3)Cg Core Runtime APIcgGetNumDependentStateAssignmentParameters(3)
NAME cgGetNumDependentStateAssignmentParameters −get the number of effect parameters on which a
state assignment depends
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumDependentStateAssignmentParameters( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the number of parameters on which sa depends.
DESCRIPTION
State assignments in CgFX passes may include references to one or more effect parameters on the right
hand side of the state assignment that are used for computing the state assignment’svalue.
cgGetNumDependentStateAssignmentParameters returns the total number of such parameters.
cgGetDependentStateAssignmentParameter can then be used to iterate overthese parameters.
This information can be useful for applications that wish to cache the values of state assignments for
customized state mangement so that theycan determine which state assignments may change as the result
of changing a parameter’svalue.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetNumDependentStateAssignmentParameters wasintroduced in Cg 1.4.
SEE ALSO
cgGetDependentStateAssignmentParameter,cgGetFirstStateAssignment, cgGetNamedStateAssignment,
cgGetNumDependentAnnotationParameters
perl v5.10.0 Cg Toolkit 3.0 210
cgGetNumParentTypes(3) Cg Core Runtime API cgGetNumParentTypes(3)
NAME cgGetNumParentTypes −gets the number of parent types of a giventype
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumParentTypes( CGtype type );
PARAMETERS
type The child type.
RETURN VALUES
Returns the number of parent types.
Returns 0if there are no parents.
DESCRIPTION
cgGetNumParentTypes returns the number of parents from which type inherits.
Aparent type is one from which the giventype inherits, or an interface type that the giventype implements.
Note that the current Cg language specification implies that a type may only have a single parent type
an interface implemented by the giventype.
EXAMPLES
Giventhe type definitions:
interface myiface {
float4 eval(void);
};
struct mystruct : myiface {
float4 value;
float4 eval(void ) { return value; }
};
mystruct has a single parent type, myiface.
ERRORS
None.
HISTORY
cgGetNumParentTypes wasintroduced in Cg 1.2.
SEE ALSO
cgGetParentType
perl v5.10.0 Cg Toolkit 3.0 211
cgGetNumProgramDomains(3) Cg Core Runtime API cgGetNumProgramDomains(3)
NAME cgGetNumProgramDomains −get the number of domains in a combined program
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumProgramDomains( CGprogram program );
PARAMETERS
program The combined program object to be queried.
RETURN VALUES
Returns the number of domains in the combined program program.
Returns 0if an error occurs.
DESCRIPTION
cgGetNumProgramDomains returns the number of domains in a combined program. For example, if the
combined program contained a vertexprogram and a fragment program, cgGetNumProgramDomains will
return 2.
cgGetNumProgramDomains will always return 1for a non-combined program.
EXAMPLES
CGprogram combined = cgCombinePrograms2( prog1, prog2 );
int numDomains = cgGetNumProgramDomains( combined );
/* numDomains == 2 */
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetNumProgramDomains wasintroduced in Cg 1.5.
SEE ALSO
cgGetProfileDomain, cgGetProgramDomainProfile, cgGetProgramDomainProgram
perl v5.10.0 Cg Toolkit 3.0 212
cgGetNumStateEnumerants(3) Cg Core Runtime API cgGetNumStateEnumerants(3)
NAME cgGetNumStateEnumerants −gets the number of enumerants associated with a state
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumStateEnumerants( CGstate state );
PARAMETERS
state The state from which to retrieve the number of associated enumerants.
RETURN VALUES
Returns the number of enumerants associated with state.
Returns 0if an error occurs.
DESCRIPTION
cgGetNumStateEnumerants returns the number of enumerants associated with a givenCGstate.
Enumerants can be added to a CGstate using cgAddStateEnumerant.
EXAMPLES
int value;
char* pName;
int nEnums = cgGetNumStateEnumerants(state);
for (ii=0; ii<nEnums; ++ii) {
pName = cgGetStateEnumerant(state, ii, &value );
printf("%i: %s %i\n", ii+1, pName, value);
}
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetNumStateEnumerants wasintroduced in Cg 2.2.
SEE ALSO
cgAddStateEnumerant, cgGetStateEnumerant, cgGetStateEnumerantName, cgGetStateEnumerantValue
perl v5.10.0 Cg Toolkit 3.0 213
cgGetNumSupportedProfiles(3) Cg Core Runtime API cgGetNumSupportedProfiles(3)
NAME cgGetNumSupportedProfiles −get the number of supported profiles
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumSupportedProfiles( void );
PARAMETERS
None.
RETURN VALUES
Returns the number of profiles supported by this version of Cg.
DESCRIPTION
cgGetNumSupportedProfiles provides the number of profiles which are supported by this version of the
Cg library.
Note that a profile may be recognized by Cg but not supported by the platform on which the application is
currently running. Agraphics API specific routine such as cgGLIsProfileSupported must still be used to
determine if the current GPU and drivercombination supports a givenprofile.
EXAMPLES
CGprofile profile;
int nProfiles;
int ii;
nProfiles = cgGetNumSupportedProfiles();
printf("NumSupportedProfiles: %i\n", nProfiles);
for (ii=0; ii<nProfiles; ++ii) {
profile = cgGetSupportedProfile(ii);
printf("SupportedProfile %i: %s %i\n", ii, cgGetProfileString(profile),
cgGetProfile(cgGetProfileString(profile)));
}
ERRORS
None.
HISTORY
cgGetNumSupportedProfiles wasintroduced in Cg 2.2.
SEE ALSO
cgGetSupportedProfile, cgIsProfileSupported, cgGetProfileProperty,cgGLIsProfileSupported,
cgD3D9IsProfileSupported, cgD3D10IsProfileSupported, cgGetProfileString, cgGetProfile
perl v5.10.0 Cg Toolkit 3.0 214
cgGetNumUserTypes(3) Cg Core Runtime API cgGetNumUserTypes(3)
NAME cgGetNumUserTypes −get number of user-defined types in a program or effect
SYNOPSIS
#include <Cg/cg.h>
int cgGetNumUserTypes( CGhandle handle );
PARAMETERS
handle The CGprogram or CGeffect in which the types are defined.
RETURN VALUES
Returns the number of user defined types.
DESCRIPTION
cgGetNumUserTypes returns the number of user-defined types in a givenCGprogram or CGeffect.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if handle is not a valid program or effect
handle.
HISTORY
cgGetNumUserTypes wasintroduced in Cg 1.2.
SEE ALSO
cgGetUserType, cgGetNamedUserType
perl v5.10.0 Cg Toolkit 3.0 215
cgGetParameterBaseResource(3) Cg Core Runtime API cgGetParameterBaseResource(3)
NAME cgGetParameterBaseResource −get a parameter’sbase resource
SYNOPSIS
#include <Cg/cg.h>
CGresource cgGetParameterBaseResource( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the base resource of param.
Returns CG_UNDEFINED if no base resource exists for the givenparameter.
DESCRIPTION
cgGetParameterBaseResource allows the application to retrieve the base resource for a parameter in a Cg
program. The base resource is the first resource in a set of sequential resources. Forexample, if a given
parameter has a resource of CG_ATTR7,it’sbase resource would be CG_ATTR0.Only parameters with
resources whose name ends with a number will have a base resource. Forall other parameters the
undefined resource CG_UNDEFINED will be returned.
The numerical portion of the resource may be retrievedwith cgGetParameterResourceIndex. For example,
if the resource for a givenparameter is CG_ATTR7,cgGetParameterResourceIndexwill return 7.
EXAMPLES
/* log info about parameter param for debugging */
printf("Resource: %s:%d (base %s)\n",
cgGetResourceString(cgGetParameterResource(param)),
cgGetParameterResourceIndex(param),
cgGetResourceString(cgGetParameterBaseResource(param)));
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node.
HISTORY
cgGetParameterBaseResource wasintroduced in Cg 1.1.
SEE ALSO
cgGetParameterResource, cgGetParameterResourceIndex, cgGetResourceString
perl v5.10.0 Cg Toolkit 3.0 216
cgGetParameterBaseType(3) Cg Core Runtime API cgGetParameterBaseType(3)
NAME cgGetParameterBaseType −get a program parameter’sbase type
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetParameterBaseType( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the base type enumerant of param.
Returns CG_UNKNOWN_TYPE if an error occurs.
DESCRIPTION
cgGetParameterBaseType allows the application to retrieve the base type of a parameter.
If param is of a numeric type (scalar,vector,ormatrix), the scalar enumerant corresponding to param’s
type will be returned. Forexample, if param is of type CG_FLOAT4x3,cgGetParameterBaseType will
return CG_FLOAT.
If param is an array,the base type of the array elements will be returned.
If param is a structure, its type-specific enumerant will be returned, as per cgGetParameterNamedType.
Otherwise, param’s type enumerant will be returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterBaseType wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterType, cgGetParameterNamedType, cgGetType, cgGetTypeString, cgGetParameterClass
perl v5.10.0 Cg Toolkit 3.0 217
cgGetParameterBufferIndex(3) Cg Core Runtime API cgGetParameterBufferIndex(3)
NAME cgGetParameterBufferIndex −get buffer indexbyparameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterBufferIndex( CGparameter param );
PARAMETERS
param The parameter for which the associated buffer indexwill be retrieved.
RETURN VALUES
Returns the indexfor the buffer to which param belongs.
Returns −1 if param does not belong to a buffer or an error occurs.
DESCRIPTION
cgGetParameterBufferIndex returns the indexfor the buffer to which a parameter belongs. If param
does not belong to a buffer,then −1 is returned.
If the program to which param belongs is in an uncompiled state, it will be compiled by
cgGetParameterBufferIndex.See cgSetAutoCompile for more information about program compile
states.
EXAMPLES
int index = cgGetParameterBufferIndex( myParam );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterBufferIndex wasintroduced in Cg 2.0.
SEE ALSO
cgSetProgramBuffer,cgGetParameterBufferOffset, cgGetParameterResourceSize, cgSetAutoCompile
perl v5.10.0 Cg Toolkit 3.0 218
cgGetParameterBufferOffset(3) Cg Core Runtime API cgGetParameterBufferOffset(3)
NAME cgGetParameterBufferOffset −get a parameter’sbuffer offset
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterBufferOffset( CGparameter param );
PARAMETERS
param The parameter for which the buffer offset will be retrieved.
RETURN VALUES
Returns the buffer offset for param.
Returns −1 if param does not belong to a buffer or an error occurs.
DESCRIPTION
cgGetParameterBufferOffset returns the buffer offset associated with a parameter.Ifparam does not
belong to a buffer,then −1 is returned.
If the program to which param belongs is in an uncompiled state, it will be compiled by
cgGetParameterBufferOffset.See cgSetAutoCompile for more information about program compile
states.
EXAMPLES
int offset = cgGetParameterBufferOffset( myParam );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterBufferOffset wasintroduced in Cg 2.0.
SEE ALSO
cgSetProgramBuffer,cgGetParameterBufferIndex, cgGetParameterResourceSize, cgSetAutoCompile
perl v5.10.0 Cg Toolkit 3.0 219
cgGetParameterClass(3) Cg Core Runtime API cgGetParameterClass(3)
NAME cgGetParameterClass −get a parameter’sclass
SYNOPSIS
#include <Cg/cg.h>
CGparameterclass cgGetParameterClass( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the parameter class enumerant of param.
Returns CG_PARAMETERCLASS_UNKNOWN if an error occurs.
DESCRIPTION
cgGetParameterClass allows the application to retrieve the class of a parameter.
The returned CGparameterclass value enumerates the high-levelparameter classes:
CG_PARAMETERCLASS_SCALAR
The parameter is of a scalar type, such as CG_INT,orCG_FLOAT.
CG_PARAMETERCLASS_VECTOR
The parameter is of a vector type, such as CG_INT1,orCG_FLOAT4.
CG_PARAMETERCLASS_MATRIX
The parameter is of a matrix type, such as CG_INT1x1,orCG_FLOAT4x4.
CG_PARAMETERCLASS_STRUCT
The parameter is a struct or interface.
CG_PARAMETERCLASS_ARRAY
The parameter is an array.
CG_PARAMETERCLASS_SAMPLER
The parameter is a sampler.
CG_PARAMETERCLASS_OBJECT
The parameter is a texture, string, or program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterClass wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterClassString, cgGetParameterClassEnum, cgGetParameterType, cgGetType,
cgGetTypeString
perl v5.10.0 Cg Toolkit 3.0 220
cgGetParameterClassEnum(3) Cg Core Runtime API cgGetParameterClassEnum(3)
NAME cgGetParameterClassEnum −get the enumerant associated with a parameter class name
SYNOPSIS
#include <Cg/cg.h>
CGparameterclass cgGetParameterClassEnum( const char * pString );
PARAMETERS
pString A string containing the case-sensitive parameter class name.
RETURN VALUES
Returns the parameter class enumerant associated with pString.
Returns CG_PARAMETERCLASS_UNKNOWN if the givenparameter class does not exist.
DESCRIPTION
cgGetParameterClassEnum returns the enumerant associated with a parameter class name.
EXAMPLES
CGparameterclass structParameterClass = cgGetParameterClassEnum("struct");
if(cgGetParameterClassEnum(myparam) == structParameterClass)
{
/* Do struct stuff */
}
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if pString is NULL.
HISTORY
cgGetParameterClassEnum wasintroduced in Cg 2.2.
SEE ALSO
cgGetParameterClassString, cgGetParameterClass, cgGetTypeClass
perl v5.10.0 Cg Toolkit 3.0 221
cgGetParameterClassString(3) Cg Core Runtime API cgGetParameterClassString(3)
NAME cgGetParameterClassString −get the name associated with a parameter class enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetParameterClassString( CGparameterclass parameterclass );
PARAMETERS
parameterclass
The parameter class enumerant.
RETURN VALUES
Returns the name associated with parameterclass.
Returns ‘‘unknown’’ifparameterclass is not a valid parameter class.
DESCRIPTION
cgGetParameterClassString returns the name associated with a parameter class enumerant.
EXAMPLES
static void dumpCgParameterInfo(CGparameter parameter)
{
/* ... */
const char* p = cgGetParameterClassString(cgGetParameterType(parameter));
if ( p ) {
printf(" ParameterClass: %s\n", p);
}
/* ... */
}
ERRORS
None.
HISTORY
cgGetParameterClassString wasintroduced in Cg 2.2.
SEE ALSO
cgGetParameterClassEnum, cgGetParameterClass, cgGetTypeClass
perl v5.10.0 Cg Toolkit 3.0 222
cgGetParameterColumns(3) Cg Core Runtime API cgGetParameterColumns(3)
NAME cgGetParameterColumns −get number of parameter columns
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterColumns( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the number of columns associated with the type if param is a numeric type or an array of numeric
types.
Returns 0otherwise.
DESCRIPTION
cgGetParameterColumns return the number of columns associated with the givenparameter’stype.
If param is an array,the number of columns associated with each element of the array is returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterColumns wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterType, cgGetParameterRows
perl v5.10.0 Cg Toolkit 3.0 223
cgGetParameterContext(3) Cg Core Runtime API cgGetParameterContext(3)
NAME cgGetParameterContext −get a parameter’sparent context
SYNOPSIS
#include <Cg/cg.h>
CGcontext cgGetParameterContext( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns a CGcontext handle to the parent context.
Returns NULL if an error occurs.
DESCRIPTION
cgGetParameterContext allows the application to retrieve a handle to the context to which a given
parameter belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterContext wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameter,cgGetParameterProgram
perl v5.10.0 Cg Toolkit 3.0 224
cgGetParameterDefaultValue(3) Cg Core Runtime API cgGetParameterDefaultValue(3)
NAME cgGetParameterDefaultValue −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float, or double */
int cgGetParameterDefaultValue{ifd}{rc}( CGparameter param,
int nelements,
TYPE * v );
PARAMETERS
param The program parameter whose default values will be retrieved.
nelements The number of elements in array v.
vDestination buffer to which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
The cgGetParameterDefaultValue functions allowthe application to get the default values from any
numeric parameter or parameter array.The default values are returned in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
There are versions of each function that return int,float or double values signified by i,for din the
function name.
There are versions of each function that will cause anymatrices referenced by param to be copied in either
row-major or column-major order,assignified by the ror cin the function name.
Forexample, cgGetParameterDefaultValueic retrievesthe default values of the givenparameter using the
supplied array of integer data, and copies matrix data in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter, ntotal,may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
The cgGetParameterDefaultValue functions were introduced in Cg 2.1.
perl v5.10.0 Cg Toolkit 3.0 225
cgGetParameterDefaultValue(3) Cg Core Runtime API cgGetParameterDefaultValue(3)
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize, cgGetParameterValue,
cgSetParameterValue, cgGetParameterDefaultValuedc, cgGetParameterDefaultValuedr,
cgGetParameterDefaultValuefc, cgGetParameterDefaultValuefr,cgGetParameterDefaultValueic,
cgGetParameterDefaultValueir
perl v5.10.0 Cg Toolkit 3.0 226
cgGetParameterDefaultValuedc(3) Cg Core Runtime API cgGetParameterDefaultValuedc(3)
NAME cgGetParameterDefaultValuedc −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValuedc( CGparameter param,
int nelements,
double * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValuedc allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as doubles in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValuedc wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 227
cgGetParameterDefaultValuedr(3) Cg Core Runtime API cgGetParameterDefaultValuedr(3)
NAME cgGetParameterDefaultValuedr −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValuedr( CGparameter param,
int nelements,
double * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValuedr allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as doubles in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValuedr wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 228
cgGetParameterDefaultValuefc(3) Cg Core Runtime API cgGetParameterDefaultValuefc(3)
NAME cgGetParameterDefaultValuefc −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValuefc( CGparameter param,
int nelements,
float * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValuefc allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as floats in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValuefc wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 229
cgGetParameterDefaultValuefr(3) Cg Core Runtime API cgGetParameterDefaultValuefr(3)
NAME cgGetParameterDefaultValuefr −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValuefr( CGparameter param,
int nelements,
float * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValuefr allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as floats in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValuefr wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 230
cgGetParameterDefaultValueic(3) Cg Core Runtime API cgGetParameterDefaultValueic(3)
NAME cgGetParameterDefaultValueic −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValueic( CGparameter param,
int nelements,
int * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValueic allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as ints in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValueic wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 231
cgGetParameterDefaultValueir(3) Cg Core Runtime API cgGetParameterDefaultValueir(3)
NAME cgGetParameterDefaultValueir −get the default values of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterDefaultValueir( CGparameter param,
int nelements,
int * v );
PARAMETERS
param The parameter whose default values will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter default values will be written.
RETURN VALUES
Returns the total number of default values written to v.
DESCRIPTION
cgGetParameterDefaultValueir allows the application to get the default values from anynumeric
parameter or parameter array.The default values are returned as ints in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of default values in the given
source parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of default values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterDefaultValueir wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterValue, cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns,
cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 232
cgGetParameterDirection(3) Cg Core Runtime API cgGetParameterDirection(3)
NAME cgGetParameterDirection −get a program parameter’sdirection
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetParameterDirection( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the direction of param.
Returns CG_ERROR if an error occurs.
DESCRIPTION
cgGetParameterDirection allows the application to distinguish program input parameters from program
output parameters. This information is necessary for the application to properly supply the program inputs
and use the program outputs.
cgGetParameterDirection will return one of the following enumerants :
CG_IN Specifies an input parameter.
CG_OUT Specifies an output parameter.
CG_INOUT Specifies a parameter that is both input and output.
CG_ERROR If an error occurs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterDirection wasintroduced in Cg 1.1.
SEE ALSO
cgGetNamedParameter,cgGetNextParameter,cgGetParameterName, cgGetParameterType,
cgGetParameterVariability,cgSetParameterVariability
perl v5.10.0 Cg Toolkit 3.0 233
cgGetParameterEffect(3) Cg Core Runtime API cgGetParameterEffect(3)
NAME cgGetParameterEffect −get a parameter’sparent program
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgGetParameterEffect( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns a CGeffect handle to the parent effect.
Returns NULL if the parameter is not a child of an effect or if an error occurs.
DESCRIPTION
cgGetParameterEffect allows the application to retrieve a handle to the effect to which a givenparameter
belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterEffect wasintroduced in Cg 1.5.
SEE ALSO
cgCreateEffect, cgGetParameterProgram, cgCreateParameter
perl v5.10.0 Cg Toolkit 3.0 234
cgGetParameterIndex(3) Cg Core Runtime API cgGetParameterIndex(3)
NAME cgGetParameterIndex −get an array member parameter’sindex
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterIndex( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the indexassociated with an array member parameter.
Returns −1 if the parameter is not in an array.
DESCRIPTION
cgGetParameterIndex returns the integer indexofanarray parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
HISTORY
cgGetParameterIndex wasintroduced in Cg 1.2.
SEE ALSO
cgGetArrayParameter
perl v5.10.0 Cg Toolkit 3.0 235
cgGetParameterName(3) Cg Core Runtime API cgGetParameterName(3)
NAME cgGetParameterName −get a program parameter’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetParameterName( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the NULL-terminated name string for the parameter.
Returns NULL if param is invalid.
DESCRIPTION
cgGetParameterName allows the application to retrieve the name of a parameter in a Cg program. This
name can be used later to retrieve the parameter from the program using cgGetNamedParameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterName wasintroduced in Cg 1.1.
SEE ALSO
cgGetNamedParameter,cgGetNextParameter,cgGetParameterType, cgGetParameterVariability,
cgGetParameterDirection, cgSetParameterVariability
perl v5.10.0 Cg Toolkit 3.0 236
cgGetParameterNamedType(3) Cg Core Runtime API cgGetParameterNamedType(3)
NAME cgGetParameterNamedType −get a program parameter’stype
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetParameterNamedType( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the type of param.
DESCRIPTION
cgGetParameterNamedType returns the type of param similarly to cgGetParameterType. However, if
the type is a user defined struct it will return the unique enumerant associated with the user defined type
instead of CG_STRUCT.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterNamedType wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterType, cgGetParameterBaseType
perl v5.10.0 Cg Toolkit 3.0 237
cgGetParameterOrdinalNumber(3) Cg Core Runtime API cgGetParameterOrdinalNumber(3)
NAME cgGetParameterOrdinalNumber −get a program parameter’sordinal number
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterOrdinalNumber( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the ordinal number associated with a parameter.Ifthe parameter is a constant
(cgGetParameterVariability returns CG_CONSTANT)then 0is returned and no error is generated.
When cgGetParameterOrdinalNumber is passed an array,the ordinal number of the first array element is
returned. When passed a struct, the ordinal number of first struct data member is returned.
DESCRIPTION
cgGetParameterOrdinalNumber returns an integer that represents the order in which the parameter was
declared within the Cg program.
Ordinal numbering begins at zero, starting with a program’sfirst local leaf parameter.The subsequent local
leaf parameters are enumerated in turn, followed by the program’sglobal leaf parameters.
EXAMPLES
The following Cg program:
struct MyStruct { float a; sampler2D b; };
float globalvar1;
float globalvar2
float4 main(float2 position : POSITION,
float4 color :COLOR,
uniform MyStruct mystruct,
float2 texCoord : TEXCOORD0) : COLOR
{
/* etc ... */
}
Would result in the following parameter ordinal numbering:
position −> 0
color −> 1
mystruct.a −> 2
mystruct.b −> 3
texCoord −> 4
globalvar1 −> 5
globalvar2 −> 6
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterOrdinalNumber wasintroduced in Cg 1.1.
SEE ALSO
cgGetParameterVariability
perl v5.10.0 Cg Toolkit 3.0 238
cgGetParameterProgram(3) Cg Core Runtime API cgGetParameterProgram(3)
NAME cgGetParameterProgram −get a parameter’sparent program
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetParameterProgram( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns a CGprogram handle to the parent program.
Returns NULL if the parameter is not a child of a program or an error occurs.
DESCRIPTION
cgGetParameterProgram allows the application to retrieve a handle to the program to which a given
parameter belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterProgram wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram, cgGetParameterEffect
perl v5.10.0 Cg Toolkit 3.0 239
cgGetParameterResource(3) Cg Core Runtime API cgGetParameterResource(3)
NAME cgGetParameterResource −get a program parameter’sresource
SYNOPSIS
#include <Cg/cg.h>
CGresource cgGetParameterResource( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the resource of param.
DESCRIPTION
cgGetParameterResource allows the application to retrieve the resource for a parameter in a Cg program.
This resource is necessary for the application to be able to supply the program’sinputs and use the
program’soutputs.
The resource enumerant is a profile-specific hardware resource.
EXAMPLES
/* log info about parameter param for debugging */
printf("Resource: %s:%d (base %s)\n",
cgGetResourceString(cgGetParameterResource(param)),
cgGetParameterResourceIndex(param),
cgGetResourceString(cgGetParameterBaseResource(param)));
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node.
HISTORY
cgGetParameterResource wasintroduced in Cg 1.1.
SEE ALSO
cgGetParameterResourceIndex, cgGetParameterBaseResource, cgGetResourceString
perl v5.10.0 Cg Toolkit 3.0 240
cgGetParameterResourceIndex(3) Cg Core Runtime API cgGetParameterResourceIndex(3)
NAME cgGetParameterResourceIndex −get a program parameter’sresource index
SYNOPSIS
#include <Cg/cg.h>
unsigned long cgGetParameterResourceIndex( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the resource indexofparam.
Returns 0if an error occurs.
DESCRIPTION
cgGetParameterResourceIndex allows the application to retrieve the resource indexfor a parameter in a
Cg program. This indexvalue is only used with resources that are linearly addressable.
EXAMPLES
/* log info about parameter param for debugging */
printf("Resource: %s:%d (base %s)\n",
cgGetResourceString(cgGetParameterResource(param)),
cgGetParameterResourceIndex(param),
cgGetResourceString(cgGetParameterBaseResource(param)));
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node.
HISTORY
cgGetParameterResourceIndex wasintroduced in Cg 1.1.
SEE ALSO
cgGetParameterResource, cgGetResource, cgGetResourceString
perl v5.10.0 Cg Toolkit 3.0 241
cgGetParameterResourceName(3) Cg Core Runtime API cgGetParameterResourceName(3)
NAME cgGetParameterResourceName −get a program parameter’sresource name
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetParameterResourceName( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the resource name of param.
Returns NULL if an error occurs.
DESCRIPTION
cgGetParameterResourceName allows the application to retrieve the resource name for a parameter in a
Cg program. Fortranslated profiles this name will most likely be different from the string returned by
cgGetResourceString.
EXAMPLES
/* log info about parameter param for debugging */
printf("Resource: %s:%d (base %s) [name:%s]\n",
cgGetResourceString(cgGetParameterResource(param)),
cgGetParameterResourceIndex(param),
cgGetResourceString(cgGetParameterBaseResource(param)),
cgGetParameterResourceName(param));
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node.
HISTORY
cgGetParameterResourceName wasintroduced in Cg 2.1.
SEE ALSO
cgGetParameterBaseResource, cgGetParameterResource, cgGetParameterResourceIndex, cgGetResource,
cgGetResourceString
perl v5.10.0 Cg Toolkit 3.0 242
cgGetParameterResourceSize(3) Cg Core Runtime API cgGetParameterResourceSize(3)
NAME cgGetParameterResourceSize −get size of resource associated with a parameter
SYNOPSIS
#include <Cg/cg.h>
long cgGetParameterResourceSize( CGparameter param );
PARAMETERS
param The parameter for which the associated resource size will be retrieved.
RETURN VALUES
Returns the size on the GPU of the resource associated with param.
Returns −1 if an error occurs.
DESCRIPTION
cgGetParameterResourceSize returns the size in bytes of the resource corresponding to a parameter if the
parameter belongs to a Cg buffer resource.
The size of sampler parameters is zero because theyhav e no actual data storage.
The size of an array parameter is the size of an array element parameter times the length of the array.
The size of a structure parameter is the sum of the size of all the members of the structure plus zero or more
bytes of profile-dependent padding.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterResourceSize wasintroduced in Cg 2.0.
SEE ALSO
cgGetParameterBufferOffset, cgGetParameterBufferIndex
perl v5.10.0 Cg Toolkit 3.0 243
cgGetParameterResourceType(3) Cg Core Runtime API cgGetParameterResourceType(3)
NAME cgGetParameterResourceType −get a parameter’sresource type
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetParameterResourceType( CGparameter param );
PARAMETERS
param The parameter for which the resource type will be returned.
RETURN VALUES
Returns the resource type of param.
Returns CG_UNKNOWN_TYPE if the parameter does not belong to a program, if the program is not
compiled, or if an error occurs.
DESCRIPTION
cgGetParameterResourceType allows the application to retrieve the resource type for a parameter in a Cg
program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterResourceType wasintroduced in Cg 2.0.
SEE ALSO
cgGetParameterResource, cgGetParameterResourceIndex, cgGetParameterResourceSize, cgGetResource,
cgGetResourceString
perl v5.10.0 Cg Toolkit 3.0 244
cgGetParameterRows(3) Cg Core Runtime API cgGetParameterRows(3)
NAME cgGetParameterRows −get number of parameter rows
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterRows( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the number of rows associated with the type if param is a numeric type or an array of numeric
types.
Returns 0otherwise.
DESCRIPTION
cgGetParameterRows return the number of rows associated with the givenparameter’stype.
If param is an array,the number of rows associated with each element of the array is returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterRows wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterType, cgGetParameterColumns
perl v5.10.0 Cg Toolkit 3.0 245
cgGetParameterSemantic(3) Cg Core Runtime API cgGetParameterSemantic(3)
NAME cgGetParameterSemantic −get a parameter’ssemantic
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetParameterSemantic( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the NULL-terminated semantic string for the parameter.
Returns NULL if an error occurs.
DESCRIPTION
cgGetParameterSemantic allows the application to retrieve the semantic of a parameter in a Cg program.
If a uniform parameter does not have a user-assigned semantic, an empty string will be returned. If a
varying parameter does not have a user-assigned semantic, the semantic string corresponding to the
compiler-assigned resource for that varying will be returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterSemantic wasintroduced in Cg 1.1.
SEE ALSO
cgSetParameterSemantic, cgGetSemanticCasePolicy, cgSetSemanticCasePolicy, cgGetParameterResource,
cgGetParameterResourceIndex, cgGetParameterName, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 246
cgGetParameterSettingMode(3) Cg Core Runtime API cgGetParameterSettingMode(3)
NAME cgGetParameterSettingMode −get the parameter setting mode for a context
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetParameterSettingMode( CGcontext context );
PARAMETERS
context The context from which the parameter setting mode will be retrieved.
RETURN VALUES
Returns the parameter setting mode enumerant for context.
Returns CG_UNKNOWN if an error occurs.
DESCRIPTION
cgGetParameterSettingMode returns the current parameter setting mode enumerant for context.See
cgSetParameterSettingMode for more information.
EXAMPLES
/* assumes cgGetProgramContext(program) == context */
if (cgGetParameterSettingMode(context) == CG_DEFERRED_PARAMETER_SETTING) {
cgUpdateProgramParameters(program);
}
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGetParameterSettingMode wasintroduced in Cg 2.0.
SEE ALSO
cgSetParameterSettingMode, cgUpdatePassParameters, cgUpdateProgramParameters
perl v5.10.0 Cg Toolkit 3.0 247
cgGetParameterType(3) Cg Core Runtime API cgGetParameterType(3)
NAME cgGetParameterType −get a program parameter’stype
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetParameterType( CGparameter param );
PARAMETERS
param The parameter.
RETURN VALUES
Returns the type enumerant of param.
Returns CG_UNKNOWN_TYPE if an error occurs.
DESCRIPTION
cgGetParameterType allows the application to retrieve the type of a parameter in a Cg program. This type
is necessary for the application to be able to supply the program’sinputs and use the program’soutputs.
cgGetParameterType will return CG_STRUCT if the parameter is a struct and CG_ARRAY if the
parameter is an array.Otherwise it will return the data type associated with the parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterType wasintroduced in Cg 1.1.
SEE ALSO
cgGetType, cgGetParameterBaseType, cgGetTypeString, cgGetParameterClass
perl v5.10.0 Cg Toolkit 3.0 248
cgGetParameterValue(3) Cg Core Runtime API cgGetParameterValue(3)
NAME cgGetParameterValue −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float, or double */
int cgGetParameterValue{ifd}{rc}( CGparameter param,
int nelements,
TYPE * v );
PARAMETERS
param The program parameter whose value will be retrieved.
nelements The number of elements in array v.
vDestination buffer to which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
The cgGetParameterValue functions allowthe application to get the value(s) from anynumeric parameter
or parameter array.The value(s) are returned in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
There are versions of each function that return int,float or double values signified by i,for din the
function name.
There are versions of each function that will cause anymatrices referenced by param to be copied in either
row-major or column-major order,assignified by the ror cin the function name.
Forexample, cgGetParameterValueic retrievesthe values of the givenparameter using the supplied array of
integer data, and copies matrix data in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter, ntotal,may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
Note: Previous releases of Cg allowed you to store more values in a parameter than indicated by the
parameter’stype. For example, one could use cgGLSetParameter4f to store four values into a parameter of
type CG_FLOAT (not CG_FLOAT4). All four values could later be retrievedusing a get call which
requested more than one value. However, this feature conflicts with the GLSL approach and also leads to
issues with parameters mapped into BUFFERS.Therefore, beginning with Cg 2.0 anycomponents
beyond the number indicated by the parameter type are ignored.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
perl v5.10.0 Cg Toolkit 3.0 249
cgGetParameterValue(3) Cg Core Runtime API cgGetParameterValue(3)
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
The cgGetParameterValue functions were introduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize, cgGetParameterDefaultValue,
cgSetParameterValue, cgGetParameterValuedc, cgGetParameterValuedr,cgGetParameterValuefc,
cgGetParameterValuefr,cgGetParameterValueic, cgGetParameterValueir
perl v5.10.0 Cg Toolkit 3.0 250
cgGetParameterValuedc(3) Cg Core Runtime API cgGetParameterValuedc(3)
NAME cgGetParameterValuedc −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValuedc( CGparameter param,
int nelements,
double * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValuedc allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as doubles in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValuedc wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValuedc, cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 251
cgGetParameterValuedr(3) Cg Core Runtime API cgGetParameterValuedr(3)
NAME cgGetParameterValuedr −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValuedr( CGparameter param,
int nelements,
double * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValuedr allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as doubles in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValuedr wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValuedr,cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 252
cgGetParameterValuefc(3) Cg Core Runtime API cgGetParameterValuefc(3)
NAME cgGetParameterValuefc −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValuefc( CGparameter param,
int nelements,
float * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValuefc allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as floats in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValuefc wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValuefc, cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 253
cgGetParameterValuefr(3) Cg Core Runtime API cgGetParameterValuefr(3)
NAME cgGetParameterValuefr −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValuefr( CGparameter param,
int nelements,
float * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValuefr allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as floats in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValuefr wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValuefr,cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 254
cgGetParameterValueic(3) Cg Core Runtime API cgGetParameterValueic(3)
NAME cgGetParameterValueic −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValueic( CGparameter param,
int nelements,
int * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValueic allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as ints in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in column-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValueic wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValueic, cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 255
cgGetParameterValueir(3) Cg Core Runtime API cgGetParameterValueir(3)
NAME cgGetParameterValueir −get the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
int cgGetParameterValueir( CGparameter param,
int nelements,
int * v );
PARAMETERS
param The parameter whose value will be retrieved.
nelementsThe number of elements in array v.
vDestination buffer into which the parameter values will be written.
RETURN VALUES
Returns the total number of values written to v.
DESCRIPTION
cgGetParameterValueir allows the application to get the value(s) from anynumeric parameter or
parameter array.The value(s) are returned as ints in v.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param will be copied in row-major order.
The size of vis passed as nelements.Ifvis smaller than the total number of values in the givensource
parameter, CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgGetParameterValueir wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterDefaultValueir,cgGetParameterValue, cgSetParameterValue, cgGetParameterRows,
cgGetParameterColumns, cgGetArrayTotalSize
perl v5.10.0 Cg Toolkit 3.0 256
cgGetParameterValues(3) Cg Core Runtime API cgGetParameterValues(3)
NAME cgGetParameterValues −deprecated
DESCRIPTION
cgGetParameterValues is deprecated. Use a variation of cgGetParameterValue or
cgGetParameterDefaultValue instead.
SEE ALSO
cgGetParameterValue, cgGetParameterDefaultValue
perl v5.10.0 Cg Toolkit 3.0 257
cgGetParameterVariability(3) Cg Core Runtime API cgGetParameterVariability(3)
NAME cgGetParameterVariability −get a parameter’svariability
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetParameterVariability( CGparameter param );
PARAMETERS
param The program parameter.
RETURN VALUES
Returns the variability of param.
Returns CG_ERROR if an error occurs.
DESCRIPTION
cgGetParameterVariability allows the application to retrieve the variability of a parameter in a Cg
program. This variability is necessary for the application to be able to supply the program’sinputs and use
the program’soutputs.
cgGetParameterVariability will return one of the following variabilities:
CG_VARYING
Avarying parameter is one whose value changes with each invocation of the program.
CG_UNIFORM
Auniform parameter is one whose value does not change with each invocation of a program, but
whose value can change between groups of program invocations.
CG_LITERAL
Aliteral parameter is folded out at compile time. Making a uniform parameter literal with
cgSetParameterVariability will often makeaprogram more efficient at the expense of requiring a
compile every time the value is set.
CG_CONSTANT
Aconstant parameter is neverchanged by the user.It’sgenerated by the compiler by certain profiles
that require immediate values to be placed in certain resource locations.
CG_MIXED
Astructure parameter that contains parameters that differ in variability.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGetParameterVariability wasintroduced in Cg 1.1.
SEE ALSO
cgGetNamedParameter,cgGetNextParameter,cgGetParameterName, cgGetParameterType,
cgGetParameterDirection, cgSetParameterVariability
perl v5.10.0 Cg Toolkit 3.0 258
cgGetParentType(3) Cg Core Runtime API cgGetParentType(3)
NAME cgGetParentType −gets a parent type of a child type
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetParentType( CGtype type,
int index );
PARAMETERS
type The child type.
indexThe indexofthe parent type. index must be greater than or equal to 0and less than the value
returned by cgGetNumParentTypes.
RETURN VALUES
Returns the number of parent types.
Returns NULL if there are no parents.
Returns CG_UNKNOWN_TYPE if type is a built-in type or an error is thrown.
DESCRIPTION
cgGetParentType returns a parent type of type.
Aparent type is one from which the giventype inherits, or an interface type that the giventype implements.
Forexample, giventhe type definitions:
interface myiface {
float4 eval(void);
};
struct mystruct : myiface {
float4 value;
float4 eval(void ) { return value; }
};
mystruct has a single parent type, myiface.
Note that the current Cg language specification implies that a type may only have a single parent type
an interface implemented by the giventype.
EXAMPLES
to-be-written
ERRORS
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the proper range.
HISTORY
cgGetParentType wasintroduced in Cg 1.2.
SEE ALSO
cgGetNumParentTypes
perl v5.10.0 Cg Toolkit 3.0 259
cgGetPassName(3) Cg Core Runtime API cgGetPassName(3)
NAME cgGetPassName −get a technique pass’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetPassName( CGpass pass );
PARAMETERS
pass The pass.
RETURN VALUES
Returns the NULL-terminated name string for the pass.
Returns NULL if pass is invalid.
DESCRIPTION
cgGetPassName allows the application to retrieve the name of a pass in a Cg program. This name can be
used later to retrieve the pass from the program using cgGetNamedPass.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetPassName wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedPass, cgGetFirstPass, cgGetNextPass
perl v5.10.0 Cg Toolkit 3.0 260
cgGetPassProgram(3) Cg Core Runtime API cgGetPassProgram(3)
NAME cgGetPassProgram −get domain program from a pass
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetPassProgram( CGpass pass,
CGdomain domain );
PARAMETERS
pass The pass from which to get a program.
domain The domain for which a program will be retrieved.
RETURN VALUES
Returns the program associated with a specified domain from the givenpass.
Returns NULL if pass or domain is invalid.
DESCRIPTION
cgGetPassProgram allows the application to retrieve the program associated with a specific domain from a
pass.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_ENUMERANT_ERROR is generated if domain is not CG_VERTEX_DOMAIN,
CG_FRAGMENT_DOMAIN,orCG_GEOMETRY_DOMAIN.
HISTORY
cgGetPassProgram wasintroduced in Cg 2.1.
SEE ALSO
cgGetFirstPass, cgGetNextPass
perl v5.10.0 Cg Toolkit 3.0 261
cgGetPassTechnique(3) Cg Core Runtime API cgGetPassTechnique(3)
NAME cgGetPassTechnique −get a pass’stechnique
SYNOPSIS
#include <Cg/cg.h>
CGtechnique cgGetPassTechnique( CGpass pass );
PARAMETERS
pass The pass.
RETURN VALUES
Returns a CGtechnique handle to the technique.
Returns NULL if an error occurs.
DESCRIPTION
cgGetPassTechnique allows the application to retrieve a handle to the technique to which a givenpass
belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
HISTORY
cgGetPassTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgIsTechnique, cgGetNextTechnique, cgIsPass
perl v5.10.0 Cg Toolkit 3.0 262
cgGetProfile(3) Cg Core Runtime API cgGetProfile(3)
NAME cgGetProfile −get the profile enumerant from a profile name
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgGetProfile( const char * profile_string );
PARAMETERS
profile_string
Astring containing the case-sensitive profile name.
RETURN VALUES
Returns the profile enumerant of profile_string.
Returns CG_PROFILE_UNKNOWN if the givenprofile does not exist.
DESCRIPTION
cgGetProfile returns the enumerant assigned to a profile name.
EXAMPLES
CGprofile ARBVP1Profile = cgGetProfile("arbvp1");
if(cgGetProgramProfile(myprog) == ARBVP1Profile)
{
/* Do stuff */
}
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if profile_string is NULL.
HISTORY
cgGetProfile wasintroduced in Cg 1.1.
SEE ALSO
cgGetProfileString, cgGetProgramProfile
perl v5.10.0 Cg Toolkit 3.0 263
cgGetProfileDomain(3) Cg Core Runtime API cgGetProfileDomain(3)
NAME cgGetProfileDomain −get the domain of a profile enumerant
SYNOPSIS
#include <Cg/cg.h>
CGdomain cgGetProfileDomain( CGprofile profile );
PARAMETERS
profile The profile enumerant.
RETURN VALUES
Returns:
CG_UNKNOWN_DOMAIN
CG_VERTEX_DOMAIN
CG_FRAGMENT_DOMAIN
CG_GEOMETRY_DOMAIN
DESCRIPTION
cgGetProfileDomain returns which type of domain the givenprofile belongs to.
EXAMPLES
CGdomain domain = cgGetProfileDomain(CG_PROFILE_PS_3_0);
/* domain == CG_FRAGMENT_DOMAIN */
ERRORS
None.
HISTORY
cgGetProfileDomain wasintroduced in Cg 1.5.
CG_GEOMETRY_DOMAIN wasintroduced in Cg 2.0.
SEE ALSO
cgGetNumProgramDomains, cgGetProgramDomainProfile
perl v5.10.0 Cg Toolkit 3.0 264
cgGetProfileProperty(3) Cg Core Runtime API cgGetProfileProperty(3)
NAME cgGetProfileProperty −query property of a profile
SYNOPSIS
#include <Cg/cg.h>
CGbool cgGetProfileProperty( CGprofile profile, CGenum query );
PARAMETERS
profile The profile to query.
query An enumerant describing the property to be queried. The following enumerants are allowed:
CG_IS_OPENGL_PROFILE
CG_IS_DIRECT3D_PROFILE
CG_IS_DIRECT3D_8_PROFILE
CG_IS_DIRECT3D_9_PROFILE
CG_IS_DIRECT3D_10_PROFILE
CG_IS_DIRECT3D_11_PROFILE
CG_IS_VERTEX_PROFILE
CG_IS_FRAGMENT_PROFILE
CG_IS_GEOMETRY_PROFILE
CG_IS_TESSELLATION_CONTROL_PROFILE
CG_IS_TESSELLATION_EVALUATION_PROFILE
CG_IS_TRANSLATION_PROFILE
CG_IS_HLSL_PROFILE
CG_IS_GLSL_PROFILE
RETURN VALUES
Returns CG_TRUE if profile holds the property expressed by query.
Returns CG_FALSE otherwise.
DESCRIPTION
cgGetProfileProperty returns property information about the givenprofile.
query must be one of the following enumerants :
CG_IS_OPENGL_PROFILE
profile is an OpenGL profile.
CG_IS_DIRECT3D_PROFILE
profile is Direct3D profile.
CG_IS_DIRECT3D_8_PROFILE
profile is Direct3D8 profile.
CG_IS_DIRECT3D_9_PROFILE
profile is Direct3D9 profile.
CG_IS_DIRECT3D_10_PROFILE
profile is Direct3D10 profile.
CG_IS_DIRECT3D_11_PROFILE
profile is Direct3D11 profile.
perl v5.10.0 Cg Toolkit 3.0 265
cgGetProfileProperty(3) Cg Core Runtime API cgGetProfileProperty(3)
CG_IS_VERTEX_PROFILE
profile is vertexprofile.
CG_IS_FRAGMENT_PROFILE
profile is fragment profile.
CG_IS_GEOMETRY_PROFILE
profile is geometry profile.
CG_IS_TESSELLATION_CONTROL_PROFILE
profile is tessellation control profile.
CG_IS_TESSELLATION_EVALUATION_PROFILE
profile is tessellation evaluation profile.
CG_IS_TRANSLATION_PROFILE
profile is a translation profile.
CG_IS_HLSL_PROFILE
profile is an HLSL translation profile.
CG_IS_GLSL_PROFILE
profile is a GLSL translation profile.
EXAMPLES
CGprofile profile;
int nProfiles;
int ii;
nProfiles = cgGetNumSupportedProfiles();
printf("NumSupportedProfiles: %i\n", nProfiles);
for (ii=0; ii<nProfiles; ++ii) {
profile = cgGetSupportedProfile(ii);
if (cgGetProfileProperty(profile, CG_IS_OPENGL_PROFILE)) {
printf("%s is an OpenGL profile\n", cgGetProfileString(profile));
}else {
printf("%s is not an OpenGL profile\n", cgGetProfileString(profile));
}
}
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if profile is not supported by this version of the Cg
library.
CG_INVALID_ENUMERANT_ERROR is generated if query is not CG_IS_OPENGL_PROFILE,
CG_IS_DIRECT3D_PROFILE,CG_IS_DIRECT3D_8_PROFILE,CG_IS_DIRECT3D_9_PROFILE,
CG_IS_DIRECT3D_10_PROFILE,CG_IS_DIRECT3D_11_PROFILE,CG_IS_VERTEX_PROFILE,
CG_IS_FRAGMENT_PROFILE,CG_IS_GEOMETRY_PROFILE,
CG_IS_TESSELLATION_CONTROL_PROFILE,CG_IS_TESSELLATION_EVALUATION_PROFILE,
CG_IS_TRANSLATION_PROFILE,CG_IS_HLSL_PROFILE,orCG_IS_GLSL_PROFILE
HISTORY
cgGetProfileProperty wasintroduced in Cg 2.2.
SEE ALSO
cgGetNumSupportedProfiles, cgGetSupportedProfile, cgIsProfileSupported, cgGetProfileString,
cgGetProfile
perl v5.10.0 Cg Toolkit 3.0 266
cgGetProfileString(3) Cg Core Runtime API cgGetProfileString(3)
NAME cgGetProfileString −get the profile name associated with a profile enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetProfileString( CGprofile profile );
PARAMETERS
profile The profile enumerant.
RETURN VALUES
Returns the profile string of the enumerant profile.
Returns NULL if profile is not a valid profile.
DESCRIPTION
cgGetProfileString returns the profile name associated with a profile enumerant.
EXAMPLES
static void dumpCgProgramInfo(CGprogram program)
{
const char* p = cgGetProfileString(cgGetProgramProfile(program));
if ( p ) {
printf(" Profile: %s\n", p );
}
/* ... */
}
ERRORS
None.
HISTORY
cgGetProfileString wasintroduced in Cg 1.1.
SEE ALSO
cgGetProfile, cgGetProgramProfile
perl v5.10.0 Cg Toolkit 3.0 267
cgGetProgramBuffer(3) Cg Core Runtime API cgGetProgramBuffer(3)
NAME cgGetProgramBuffer −get buffer associated with a buffer index
SYNOPSIS
#include <Cg/cg.h>
CGbuffer cgGetProgramBuffer( CGprogram program,
int bufferIndex );
PARAMETERS
program The program from which the associated buffer will be retrieved.
bufferIndex
The buffer indexfor which the associated buffer will be retrieved.
RETURN VALUES
Returns a buffer handle on success.
Returns NULL if an error occurs.
DESCRIPTION
cgGetProgramBuffer returns the buffer handle associated with a givenbuffer indexfrom program.The
returned value can be NULL if no buffer is associated with this indexorifanerror occurs.
EXAMPLES
CGbuffer myBuffer = cgGetProgramBuffer( myProgram, 0 );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if bufferIndex is not within the valid range
of buffer indices for program.
HISTORY
cgGetProgramBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgSetProgramBuffer,cgGetParameterBufferIndex, cgCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 268
cgGetProgramBufferMaxIndex(3) Cg Core Runtime API cgGetProgramBufferMaxIndex(3)
NAME cgGetProgramBufferMaxIndex −get the maximum indexofabuffer for a givenprofile
SYNOPSIS
#include <Cg/cg.h>
int cgGetProgramBufferMaxIndex( CGprofile profile );
PARAMETERS
profile The target for determining the maximum buffer index.
RETURN VALUES
Returns the maximum buffer indexfor a givenprofile.
Returns 0if an error occurs.
DESCRIPTION
cgGetProgramBufferMaxIndex returns the maximum buffer indexfor a profile.
cgGetProgramBufferMaxIndex will return 0if an invalid profile is passed.
EXAMPLES
int size = cgGetProgramBufferMaxIndex( CG_PROFILE_GPU_VP );
ERRORS
none.
HISTORY
cgGetProgramBufferMaxIndex wasintroduced in Cg 2.0.
SEE ALSO
cgSetProgramBuffer,cgGetParameterBufferIndex, cgCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 269
cgGetProgramBufferMaxSize(3) Cg Core Runtime API cgGetProgramBufferMaxSize(3)
NAME cgGetProgramBufferMaxSize −get the maximum size of a buffer in bytes for a givenprofile
SYNOPSIS
#include <Cg/cg.h>
int cgGetProgramBufferMaxSize( CGprofile profile );
PARAMETERS
profile The target for determining the maximum buffer size.
RETURN VALUES
Returns the size of a buffer for the givenprofile in bytes.
Returns 0if an error occurs.
DESCRIPTION
cgGetProgramBufferMaxSize returns the maximum size of a buffer for a profile in bytes.
cgGetProgramBufferMaxSize will return 0if an invalid profile is passed.
EXAMPLES
int size = cgGetProgramBufferMaxSize( CG_PROFILE_GPU_VP );
ERRORS
none.
HISTORY
cgGetProgramBufferMaxSize wasintroduced in Cg 2.0.
SEE ALSO
cgSetProgramBuffer,cgGetParameterBufferIndex, cgCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 270
cgGetProgramContext(3) Cg Core Runtime API cgGetProgramContext(3)
NAME cgGetProgramContext −get a programs parent context
SYNOPSIS
#include <Cg/cg.h>
CGcontext cgGetProgramContext( CGprogram program );
PARAMETERS
program The program.
RETURN VALUES
Returns a CGcontext handle to the parent context.
Returns NULL if an error occurs.
DESCRIPTION
cgGetProgramContext allows the application to retrieve a handle to the context to which a givenprogram
belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetProgramContext wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram, cgCreateContext
perl v5.10.0 Cg Toolkit 3.0 271
cgGetProgramDomain(3) Cg Core Runtime API cgGetProgramDomain(3)
NAME cgGetProgramDomain −get a program’sdomain
SYNOPSIS
#include <Cg/cg.h>
CGdomain cgGetProgramDomain( CGprogram program );
PARAMETERS
program The program.
RETURN VALUES
Returns the domain enumerant associated with program.
DESCRIPTION
cgGetProgramDomain retrievesthe domain enumerant currently associated with a program. This is a
convenience routine which essentially calls cgGetProgramProfile followed by cgGetProfileDomain.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetProgramDomain wasintroduced in Cg 2.2.
SEE ALSO
cgGetDomain, cgGetDomainString
perl v5.10.0 Cg Toolkit 3.0 272
cgGetProgramDomainProfile(3) Cg Core Runtime API cgGetProgramDomainProfile(3)
NAME cgGetProgramDomainProfile −get the profile associated with a domain
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgGetProgramDomainProfile( CGprogram program,
int index );
PARAMETERS
program The handle of the combined program object.
indexThe indexofthe program’sdomain to be queried.
RETURN VALUES
Returns the profile enumerant for the program with the givendomain index, specifically one of:
CG_UNKNOWN_DOMAIN
CG_VERTEX_DOMAIN
CG_FRAGMENT_DOMAIN
CG_GEOMETRY_DOMAIN
Returns CG_PROFILE_UNKNOWN if an error occurs.
DESCRIPTION
cgGetProgramDomainProfile gets the profile of the passed combined program using the indextoselect
which domain to choose.
EXAMPLES
/* This will enable all profiles for each domain in glslComboProgram */
int domains = cgGetProgramDomains(glslComboProgram);
for (int i=0; i<domains; i++) {
cgGLEnableProfile( cgGetProgramDomainProfile(glslComboProgram, i) );
}
/* This will enable the profile for the first program domain */
/* in glslComboProgram */
cgGLEnableProfile( cgGetProgramDomainProfile(glslComboProgram, 0) );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PARAMETER_ERROR is generated if index is less than 0or greater than or equal to the
number of domains in program.
HISTORY
cgGetProgramDomainProfile wasintroduced in Cg 1.5.
SEE ALSO
cgGetNumProgramDomains, cgGetProfileDomain
perl v5.10.0 Cg Toolkit 3.0 273
cgGetProgramDomainProgram(3) Cg Core Runtime API cgGetProgramDomainProgram(3)
NAME cgGetProgramDomainProgram −get an indexeddomain program of a combined program
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetProgramDomainProgram( CGprogram program,
int index );
PARAMETERS
program The handle of the combined program object.
indexThe indexofthe program’sdomain program to be queried.
RETURN VALUES
Returns the program handle for the program with the givendomain index.
Returns 0 if an error occurs.
DESCRIPTION
Acombined program consists of multiple domain programs. Forexample, a combined program may
contain a vertexdomain program and a fragment domain program. cgGetProgramDomainProgram gets
the indexeddomain program of the specified combined program.
If the program parameter is not a combined program and the indexiszero, program handle is simply
returned as-is without error.
EXAMPLES
/* This will enable all profiles for each domain in glslComboProgram */
int domains = cgGetNumProgramDomains(glslComboProgram);
for (int i=0; i<domains; i++) {
CGprogram subprog = cgGetProgramDomainProgram(glslComboProgram, i);
CGparameter param = cgGetFirstParameter(subprog);
while (param) {
// Do something to each parameter of each domain program
param = cgGetNextParameter(param);
}
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PARAMETER_ERROR is generated if index is less than 0or greater than or equal to the
number of domains in program.
HISTORY
cgGetProgramDomainProgram wasintroduced in Cg 2.1.
SEE ALSO
cgGetNumProgramDomains, cgGetProfileDomain, cgGetProgramDomainProfile
perl v5.10.0 Cg Toolkit 3.0 274
cgGetProgramInput(3) Cg Core Runtime API cgGetProgramInput(3)
NAME cgGetProgramInput −get the program’sinput
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetProgramInput( CGprogram program );
PARAMETERS
program A program handle.
RETURN VALUES
Returns a program input enumerant. If the program is a vertexorfragment program, it returns
CG_VERTEX or CG_FRAGMENT,respectively.For geometry programs the input is one of: CG_POINT,
CG_LINE,CG_LINE_ADJ,CG_TRIANGLE,orCG_TRIANGLE_ADJ.For tessellation control and
evaluation programs the input is CG_PATCH.
Returns CG_UNKNOWN if the input is unknown.
DESCRIPTION
cgGetProgramInput returns the program input enumerant.
EXAMPLES
void printProgramInput(CGprogram program)
{
char * input = NULL;
switch(cgGetProgramInput(program))
{
case CG_FRAGMENT:
input = "fragment";
break;
case CG_VERTEX:
input = "vertex";
break;
case CG_POINT:
input = "point";
break;
case CG_LINE:
input = "line";
break;
case CG_LINE_ADJ:
input = "line adjacency";
break;
case CG_TRIANGLE:
input = "triangle";
break;
case CG_TRIANGLE_ADJ:
input = "triangle adjacency";
break;
case CG_PATCH:
input = "patch";
break;
default:
input = "unknown";
break;
}
printf("Program inputs %s.\n", input);
}
perl v5.10.0 Cg Toolkit 3.0 275
cgGetProgramInput(3) Cg Core Runtime API cgGetProgramInput(3)
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not valid program handle.
HISTORY
cgGetProgramInput wasintroduced in Cg 2.0.
SEE ALSO
cgGetProgramOutput
perl v5.10.0 Cg Toolkit 3.0 276
cgGetProgramOptions(3) Cg Core Runtime API cgGetProgramOptions(3)
NAME cgGetProgramOptions −get strings from a program object
SYNOPSIS
#include <Cg/cg.h>
char const * const * cgGetProgramOptions( CGprogram program );
PARAMETERS
program The Cg program to query.
RETURN VALUES
Returns the options used to compile the program as an array of NULL-terminated strings.
Returns NULL if no options exist, or if an error occurs.
DESCRIPTION
cgGetProgramOptions allows the application to retrieve the set of options used to compile the program.
The options are returned in an array of ASCII-encoded NULL-terminated character strings. Each string
contains a single option. The last element of the string array is guaranteed to be NULL.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetProgramOptions wasintroduced in Cg 1.4.
SEE ALSO
cgGetProgramString
perl v5.10.0 Cg Toolkit 3.0 277
cgGetProgramOutput(3) Cg Core Runtime API cgGetProgramOutput(3)
NAME cgGetProgramOutput −get the program’soutput
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetProgramOutput( CGprogram program );
PARAMETERS
program A program handle.
RETURN VALUES
Returns a program output enumerant. If the program is a vertexorfragment program, it returns
CG_VERTEX or CG_FRAGMENT,respectively.For geometry programs the output is one of:
CG_POINT_OUT,CG_LINE_OUT,orCG_TRIANGLE_OUT.For tessellation control programs the output
is CG_PATCH.
Returns CG_UNKNOWN if the output is unknown.
DESCRIPTION
cgGetProgramOutput returns the program output enumerant.
Forgeometry programs, an input must be specified but not an output because of implicit output defaults.
Forexample, if either ‘TRIANGLE’’ or‘TRIANGLE_ADJ’’ isspecified as an input without an explicit
output in the shader source, then cgGetProgramOutput will return CG_TRIANGLE_OUT.
EXAMPLES
void printProgramOutput(CGprogram program)
{
char * output = NULL;
switch(cgGetProgramOutput(program))
{
case CG_VERTEX:
output = "vertex";
break;
case CG_FRAGMENT:
output = "fragment";
break;
case CG_POINT_OUT:
output = "point";
break;
case CG_LINE_OUT:
output = "line";
break;
case CG_TRIANGLE_OUT:
output = "triangle";
break;
case CG_PATCH:
output = "patch";
break;
default:
output = "unknown";
break;
}
printf("Program outputs %s.\n", output);
}
perl v5.10.0 Cg Toolkit 3.0 278
cgGetProgramOutput(3) Cg Core Runtime API cgGetProgramOutput(3)
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetProgramOutput wasintroduced in Cg 2.0.
SEE ALSO
cgGetProgramInput
perl v5.10.0 Cg Toolkit 3.0 279
cgGetProgramProfile(3) Cg Core Runtime API cgGetProgramProfile(3)
NAME cgGetProgramProfile −get a program’sprofile
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgGetProgramProfile( CGprogram program );
PARAMETERS
program The program.
RETURN VALUES
Returns the profile enumerant associated with program.
DESCRIPTION
cgGetProgramProfile retrievesthe profile enumerant currently associated with a program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGetProgramProfile wasintroduced in Cg 1.1.
SEE ALSO
cgSetProgramProfile, cgGetProfile, cgGetProfileString, cgCreateProgram
perl v5.10.0 Cg Toolkit 3.0 280
cgGetProgramStateAssignmentValue(3) Cg Core Runtime API cgGetProgramStateAssignmentValue(3)
NAME cgGetProgramStateAssignmentValue −get a program-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
CGprogram cgGetProgramStateAssignmentValue( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a CGprogram handle.
Returns NULL if an error occurs or no program is available.
DESCRIPTION
cgGetProgramStateAssignmentValue allows the application to retrieve the value(s) of a state assignment
that stores a CGprogram.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
program type.
HISTORY
cgGetProgramStateAssignmentValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetIntStateAssignmentValues, cgGetBoolStateAssignmentValues, cgGetStringStateAssignmentValue,
cgGetSamplerStateAssignmentValue, cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 281
cgGetProgramString(3) Cg Core Runtime API cgGetProgramString(3)
NAME cgGetProgramString −get strings from a program object
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetProgramString( CGprogram program,
CGenum enum );
PARAMETERS
program The program to query.
enum Specifies the string to retrieve.enum can be one of CG_PROGRAM_SOURCE,
CG_PROGRAM_ENTRY,CG_PROGRAM_PROFILE,orCG_COMPILED_PROGRAM.
RETURN VALUES
Returns a NULL-terminated string based on the value of enum.
Returns an empty string if an error occurs.
DESCRIPTION
cgGetProgramString allows the application to retrieve program strings that have been set via functions
that modify program state.
When enum is CG_PROGRAM_SOURCE the original Cg source program is returned.
When enum is CG_PROGRAM_ENTRY the main entry point for the program is returned.
When enum is CG_PROGRAM_PROFILE the profile for the program is returned.
When enum is CG_COMPILED_PROGRAM the string for the compiled program is returned.
EXAMPLES
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgramFromFile(context,
CG_SOURCE,
mysourcefilename,
CG_PROFILE_ARBVP1,
"myshader",
NULL);
if(cgIsProgramCompiled(program))
printf("%s\n", cgGetProgramString(program, CG_COMPILED_PROGRAM));
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_ENUMERANT_ERROR is generated if enum is not CG_PROGRAM_SOURCE,
CG_PROGRAM_ENTRY,CG_PROGRAM_PROFILE,orCG_COMPILED_PROGRAM.
HISTORY
cgGetProgramString wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram, cgGetProgramOptions
perl v5.10.0 Cg Toolkit 3.0 282
cgGetResource(3) Cg Core Runtime API cgGetResource(3)
NAME cgGetResource −get the resource enumerant assigned to a resource name
SYNOPSIS
#include <Cg/cg.h>
CGresource cgGetResource( const char * resource_string );
PARAMETERS
resource_string A string containing the resource name.
RETURN VALUES
Returns the resource enumerant of resource_string.
Returns CG_UNKNOWN if no such resource exists.
DESCRIPTION
cgGetResource returns the enumerant assigned to a resource name.
EXAMPLES
CGresource PositionResource = cgGetResource("POSITION");
if(cgGetParameterResource(myparam) == PositionResource)
{
/* Do stuff to the "POSITION" parameter */
}
ERRORS
None.
HISTORY
cgGetResource wasintroduced in Cg 1.1.
SEE ALSO
cgGetResourceString, cgGetParameterResource
perl v5.10.0 Cg Toolkit 3.0 283
cgGetResourceString(3) Cg Core Runtime API cgGetResourceString(3)
NAME cgGetResourceString −get the resource name associated with a resource enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetResourceString( CGresource resource );
PARAMETERS
resource The resource enumerant.
RETURN VALUES
Returns the NULL-terminated resource string of the enumerant resource.
DESCRIPTION
cgGetResourceString returns the resource name associated with a resource enumerant.
EXAMPLES
/* log info about parameter param for debugging */
printf("Resource: %s:%d (base %s)\n",
cgGetResourceString(cgGetParameterResource(param)),
cgGetParameterResourceIndex(param),
cgGetResourceString(cgGetParameterBaseResource(param)));
ERRORS
None.
HISTORY
cgGetResourceString wasintroduced in Cg 1.1.
SEE ALSO
cgGetResource, cgGetParameterResource
perl v5.10.0 Cg Toolkit 3.0 284
cgGetSamplerStateAssignmentParameter(3) Cg Core Runtime API cgGetSamplerStateAssignmentParameter(3)
NAME cgGetSamplerStateAssignmentParameter −get the sampler parameter being set up givenastate
assignment in its sampler_state block
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetSamplerStateAssignmentParameter( CGstateassignment sa );
PARAMETERS
sa The state assignment in a sampler_state block
RETURN VALUES
Returns a handle to a parameter.
Returns NULL if sa is not a state assignment in a sampler_state block.
DESCRIPTION
Giventhe handle to a state assignment in a sampler_state block in an effect file,
cgGetSamplerStateAssignmentParameter returns a handle to the sampler parameter being initialized.
EXAMPLES
Givenaneffect file with:
sampler2D foo = sampler_state { GenerateMipmap = true; }
cgGetSamplerStateAssignmentParameter returns a handle to fooif passed a handle to the
GenerateMipmap state assignment.
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetSamplerStateAssignmentParameter wasintroduced in Cg 1.4.
SEE ALSO
cgIsStateAssignment, cgIsParameter
perl v5.10.0 Cg Toolkit 3.0 285
cgGetSamplerStateAssignmentState(3) Cg Core Runtime API cgGetSamplerStateAssignmentState(3)
NAME cgGetSamplerStateAssignmentState −get a sampler-valued state assignment’sstate
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetSamplerStateAssignmentState( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a CGstate handle for the state.
Returns NULL if the handle sa is invalid.
DESCRIPTION
cgGetSamplerStateAssignmentState allows the application to retrieve the state of a state assignment that
stores a sampler.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetSamplerStateAssignmentState wasintroduced in Cg 1.4.
SEE ALSO
cgGetFirstSamplerStateAssignment, cgGetNamedSamplerStateAssignment,
cgGetSamplerStateAssignmentParameter,cgGetSamplerStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 286
cgGetSamplerStateAssignmentValue(3) Cg Core Runtime API cgGetSamplerStateAssignmentValue(3)
NAME cgGetSamplerStateAssignmentValue −get a sampler-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetSamplerStateAssignmentValue( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a CGparameter handle for the sampler.
Returns NULL if an error occurs.
DESCRIPTION
cgGetSamplerStateAssignmentValue allows the application to retrieve the value(s) of a state assignment
that stores a sampler.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
sampler type.
HISTORY
cgGetSamplerStateAssignmentValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetIntStateAssignmentValues, cgGetBoolStateAssignmentValues, cgGetStringStateAssignmentValue,
cgGetProgramStateAssignmentValue, cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 287
cgGetSemanticCasePolicy(3) Cg Core Runtime API cgGetSemanticCasePolicy(3)
NAME cgGetSemanticCasePolicy −get semantic case policy
SYNOPSIS
#include <Cg/cg.h>
CGenum cgGetSemanticCasePolicy( void );
PARAMETERS
None.
RETURN VALUES
Returns an enumerant indicating the current semantic case policy.
DESCRIPTION
cgGetSemanticCasePolicy returns an enumerant indicating the current semantic case policyfor the library.
See cgSetSemanticCasePolicyfor more information.
EXAMPLES
CGenum currentSemanticCasePolicy = cgGetSemanticCasePolicy();
ERRORS
None.
HISTORY
cgGetSemanticCasePolicy wasintroduced in Cg 2.0.
SEE ALSO
cgSetSemanticCasePolicy, cgGetParameterSemantic, cgSetParameterSemantic
perl v5.10.0 Cg Toolkit 3.0 288
cgGetStateAssignmentIndex(3) Cg Core Runtime API cgGetStateAssignmentIndex(3)
NAME cgGetStateAssignmentIndex −get the array indexofastate assignment for array-valued state
SYNOPSIS
#include <Cg/cg.h>
int cgGetStateAssignmentIndex( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns an integer indexvalue.
Returns 0if the CGstate for this state assignment is not an array type.
DESCRIPTION
cgGetStateAssignmentIndex returns the array indexofastate assignment if the state it is based on is an
array type.
EXAMPLES
Givena‘‘LightPosition’’state defined as an array of eight float3 values and an effect file with the following
state assignment:
pass { LightPosition[3] = float3(10,0,0); }
cgGetStateAssignmentIndex will return 3when passed a handle to this state assignment.
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetStateAssignmentIndex wasintroduced in Cg 1.4.
SEE ALSO
cgIsStateAssignment, cgCreateStateAssignmentIndex
perl v5.10.0 Cg Toolkit 3.0 289
cgGetStateAssignmentPass(3) Cg Core Runtime API cgGetStateAssignmentPass(3)
NAME cgGetStateAssignmentPass −get a state assignment’spass
SYNOPSIS
#include <Cg/cg.h>
CGpass cgGetStateAssignmentPass( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a CGpass handle to the pass.
Returns NULL if an error occurs.
DESCRIPTION
cgGetStateAssignmentPass allows the application to retrieve a handle to the pass to which a given
stateassignment belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
HISTORY
cgGetStateAssignmentPass wasintroduced in Cg 1.4.
SEE ALSO
cgIsStateAssignment, cgIsPass
perl v5.10.0 Cg Toolkit 3.0 290
cgGetStateAssignmentState(3) Cg Core Runtime API cgGetStateAssignmentState(3)
NAME cgGetStateAssignmentState −returns the state type of a particular state assignment
SYNOPSIS
#include <Cg/cg.h>
CGstate cgGetStateAssignmentState( CGstateassignment sa );
PARAMETERS
sa The state assignment handle.
RETURN VALUES
Returns the state corresponding to the givenstate assignment.
Returns NULL if an error occurs.
DESCRIPTION
cgGetStateAssignmentState returns the CGstate object that corresponds to a particular state assignment
in a pass. This object can then be queried to find out its type, giving the type of the state assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_INVALID_STATE_HANDLE_ERROR is generated if the effect doesn’tcontain a state matching the
givenstate assignment.
HISTORY
cgGetStateAssignmentState wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateType, cgCreateState, cgCreateArrayState
perl v5.10.0 Cg Toolkit 3.0 291
cgGetStateContext(3) Cg Core Runtime API cgGetStateContext(3)
NAME cgGetStateContext −get a state’scontext
SYNOPSIS
#include <Cg/cg.h>
CGcontext cgGetStateContext( CGstate state );
PARAMETERS
state The state.
RETURN VALUES
Returns the context to which state belongs.
Returns NULL if an error occurs.
DESCRIPTION
cgGetStateContext allows the application to retrieve the context of a state. This is the context used to
create the state with cgCreateState.
EXAMPLES
CGcontext context = cgCreateContext();
CGstate state = cgCreateState(context, "GreatStateOfTexas", CG_FLOAT);
assert(context == cgGetStateContext(state));
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateContext wasintroduced in Cg 1.5.
SEE ALSO
cgCreateState, cgCreateArrayState, cgGetEffectContext, cgGetParameterContext, cgGetProgramContext
perl v5.10.0 Cg Toolkit 3.0 292
cgGetStateEnumerant(3) Cg Core Runtime API cgGetStateEnumerant(3)
NAME cgGetStateEnumerant −get a state enumerant name and value by index
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStateEnumerant( CGstate state, int index, int * value );
PARAMETERS
state The state from which to retrieve anenumerant name and value.
indexThe indexfor the enumerant in state.
value Pointer to integer where the enumerant value will be stored.
RETURN VALUES
Returns the NULL-terminated enumerant name string associated with state at position index.The
enumerant value is returned via the value parameter.
Returns NULL if an error occurs. value will be 0.
DESCRIPTION
cgGetStateEnumerant allows the application to retrieve the enumerant name and value associated with a
CGstate at a specified indexlocation. The number of enumerants assocated with a state can be discovered
using cgGetNumStateEnumerants.
EXAMPLES
int value;
char* pName;
int nEnums = cgGetNumStateEnumerants(state);
for (ii=0; ii<nEnums; ++ii) {
pName = cgGetStateEnumerant(state, ii, &value );
printf("%i: %s %i\n", ii+1, pName, value);
}
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
CG_INVALID_POINTER_ERROR is generated if value is NULL.
CG_INVALID_PARAMETER_ERROR is generated if index is less than 0or index is greater than or equal
to the number of enumerants associated with state.
HISTORY
cgGetStateEnumerant wasintroduced in Cg 2.2.
SEE ALSO
cgAddStateEnumerant, cgGetNumStateEnumerants, cgGetStateEnumerantName,
cgGetStateEnumerantValue
perl v5.10.0 Cg Toolkit 3.0 293
cgGetStateEnumerantName(3) Cg Core Runtime API cgGetStateEnumerantName(3)
NAME cgGetStateEnumerantName −get a state enumerant name by value
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStateEnumerantName( CGstate state,
int value );
PARAMETERS
state The state from which to retrieve anenumerant name.
value The enumerant value for which to retrieve the associated name.
RETURN VALUES
Returns the NULL-terminated enumerant name string associated with the givenenumerant value in state.
Returns NULL if an error occurs.
DESCRIPTION
cgGetStateEnumerantName returns the enumerant name associated with a givenenumerant value from a
specified state.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
CG_INVALID_PARAMETER_ERROR is generated if state does not contain an enumerant defined for
value.
HISTORY
cgGetStateEnumerantName wasintroduced in Cg 1.5.
SEE ALSO
cgGetStateEnumerantValue, cgAddStateEnumerant, cgIsState
perl v5.10.0 Cg Toolkit 3.0 294
cgGetStateEnumerantValue(3) Cg Core Runtime API cgGetStateEnumerantValue(3)
NAME cgGetStateEnumerantValue −get state enumerant value by name
SYNOPSIS
#include <Cg/cg.h>
int cgGetStateEnumerantValue( CGstate state,
const char * name );
PARAMETERS
state The state from which to retrieve the value associated with name.
name The enumerant name for which to retrieve the associated value from state.
RETURN VALUES
Returns the enumerant value associated with name.
Returns −1 if an error occurs.
DESCRIPTION
cgGetStateEnumerantValue retrievesthe enumerant value associated with a givenenumerant name from
the specified state.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
CG_INVALID_PARAMETER_ERROR is generated if state does not contain name,ifname is NULL,orif
name points to an empty string.
HISTORY
cgGetStateEnumerantValue wasintroduced in Cg 1.5.
SEE ALSO
cgGetStateEnumerantName, cgAddStateEnumerant, cgIsState
perl v5.10.0 Cg Toolkit 3.0 295
cgGetStateLatestProfile(3) Cg Core Runtime API cgGetStateLatestProfile(3)
NAME cgGetStateLatestProfile −gets a state’sdesignated latest profile
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgGetStateLatestProfile( CGstate state );
PARAMETERS
state The state handle.
RETURN VALUES
Returns the designated latest profile if state is of type CG_PROGRAM_TYPE.
Returns CG_PROFILE_UNKNOWN otherwise.
DESCRIPTION
cgGetStateLatestProfile gets the specified state’sdesignated latest profile for states of type
CG_PROGRAM_TYPE.
This profile is used to compile the program for a state assignment for the state where the profile in the
compile statement is the identifier latest.
EXAMPLES
Get the latest profile for fragment programs:
CGstate state = cgGetNamedState(context, "FragmentProgram");
CGprofile profile = cgGetStateLatestProfile(state);
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateLatestProfile wasintroduced in Cg 2.2.
SEE ALSO
cgGetNamedState, cgSetStateLatestProfile
perl v5.10.0 Cg Toolkit 3.0 296
cgGetStateName(3) Cg Core Runtime API cgGetStateName(3)
NAME cgGetStateName −get a state’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStateName( CGstate state );
PARAMETERS
state The state.
RETURN VALUES
Returns the NULL-terminated name string for the state.
Returns NULL if state is invalid.
DESCRIPTION
cgGetStateName allows the application to retrieve the name of a state defined in a Cg context. This name
can be used later to retrieve the state from the context using cgGetNamedState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateName wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedState, cgGetFirstState, cgGetNextState
perl v5.10.0 Cg Toolkit 3.0 297
cgGetStateResetCallback(3) Cg Core Runtime API cgGetStateResetCallback(3)
NAME cgGetStateResetCallback −get the state resetting callback function for a state
SYNOPSIS
#include <Cg/cg.h>
CGstatecallback cgGetStateResetCallback( CGstate state );
PARAMETERS
state The state from which to retrieve the callback.
RETURN VALUES
Returns a pointer to the state resetting callback function.
Returns NULL if state is not a valid state or if it has no callback.
DESCRIPTION
cgGetStateResetCallback returns the callback function used for resetting the state when the givenstate is
encountered in a pass in a technique. See cgSetStateCallbacks for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateResetCallback wasintroduced in Cg 1.4.
SEE ALSO
cgSetStateCallbacks, cgCallStateResetCallback, cgResetPassState
perl v5.10.0 Cg Toolkit 3.0 298
cgGetStateSetCallback(3) Cg Core Runtime API cgGetStateSetCallback(3)
NAME cgGetStateSetCallback −get the state setting callback function for a state
SYNOPSIS
#include <Cg/cg.h>
CGstatecallback cgGetStateSetCallback( CGstate state );
PARAMETERS
state The state from which to retrieve the callback.
RETURN VALUES
Returns a pointer to the state setting callback function.
Returns NULL if state is not a valid state or if it has no callback.
DESCRIPTION
cgGetStateSetCallback returns the callback function used for setting the state when the givenstate is
encountered in a pass in a technique. See cgSetStateCallbacks for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateSetCallback wasintroduced in Cg 1.4.
SEE ALSO
cgSetStateCallbacks, cgCallStateSetCallback, cgSetPassState
perl v5.10.0 Cg Toolkit 3.0 299
cgGetStateType(3) Cg Core Runtime API cgGetStateType(3)
NAME cgGetStateType −returns the type of a givenstate
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetStateType( CGstate state );
PARAMETERS
state The state from which to retrieve the type.
RETURN VALUES
Returns the CGtype of the givenstate.
DESCRIPTION
cgGetStateType returns the type of a state that was previously defined via cgCreateState,
cgCreateArrayState, cgCreateSamplerState, or cgCreateArraySamplerState.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateType wasintroduced in Cg 1.4.
SEE ALSO
cgCreateState, cgCreateArrayState, cgCreateSamplerState, cgCreateArraySamplerState, cgGetStateName
perl v5.10.0 Cg Toolkit 3.0 300
cgGetStateValidateCallback(3) Cg Core Runtime API cgGetStateValidateCallback(3)
NAME cgGetStateValidateCallback −get the state validation callback function for a state
SYNOPSIS
#include <Cg/cg.h>
CGstatecallback cgGetStateValidateCallback( CGstate state );
PARAMETERS
state The state from which to retrieve the callback.
RETURN VALUES
Returns a pointer to the state validateting callback function.
Returns NULL if state is not a valid state or if it has no callback.
DESCRIPTION
cgGetStateValidateCallback returns the callback function used for validating the state when the given
state is encountered in a pass in a technique. See cgSetStateCallbacks and cgCallStateValidateCallback for
more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgGetStateValidateCallback wasintroduced in Cg 1.4.
SEE ALSO
cgSetStateCallbacks, cgCallStateValidateCallback, cgValidateTechnique
perl v5.10.0 Cg Toolkit 3.0 301
cgGetString(3) Cg Core Runtime API cgGetString(3)
NAME cgGetString −gets a special string
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetString( CGenum enum );
PARAMETERS
enum An enumerant describing the string to be returned.
RETURN VALUES
Returns the string associtated with enum.
Returns NULL in the event of an error.
DESCRIPTION
cgGetString returns an informative string depending on the enum.Currently there is only one valid
enumerant that may be passed in.
CG_VERSION
Returns the version string of the Cg runtime and compiler.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ENUMERANT_ERROR is generated if enum is not CG_VERSION.
HISTORY
cgGetString wasintroduced in Cg 1.2.
SEE ALSO
Cg
perl v5.10.0 Cg Toolkit 3.0 302
cgGetStringAnnotationValue(3) Cg Core Runtime API cgGetStringAnnotationValue(3)
NAME cgGetStringAnnotationValue −get a string-valued annotation’svalue
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStringAnnotationValue( CGannotation ann );
PARAMETERS
ann The annotation.
RETURN VALUES
Returns a pointer to a string contained by ann.
Returns NULL if no value is available.
DESCRIPTION
cgGetStringAnnotationValue allows the application to retrieve the value of a string typed annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
HISTORY
cgGetStringAnnotationValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetAnnotationType, cgGetStringAnnotationValues, cgGetFloatAnnotationValues,
cgGetIntAnnotationValues, cgGetBoolAnnotationValues
perl v5.10.0 Cg Toolkit 3.0 303
cgGetStringAnnotationValues(3) Cg Core Runtime API cgGetStringAnnotationValues(3)
NAME cgGetStringAnnotationValues −get the values from a string-valued annotation
SYNOPSIS
#include <Cg/cg.h>
const char * const * cgGetStringAnnotationValues( CGannotation ann,
int * nvalues );
PARAMETERS
ann The annotation from which the values will be retrieved.
nv a lues Pointer to integer where the number of returned values will be stored.
RETURN VALUES
Returns a pointer to an array of string values. The number of values in the array is returned via the nv a lues
parameter.
Returns NULL if no values are available, ann is not string-typed, or an error occurs. nv a lues will be 0.
DESCRIPTION
cgGetStringAnnotationValues allows the application to retrieve the value(s) of a string typed annotation.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_ERROR is generated if nv alues is NULL.
HISTORY
cgGetStringAnnotationValues wasintroduced in Cg 2.0.
SEE ALSO
cgGetAnnotationType, cgGetStringAnnotationValue, cgGetBoolAnnotationValues,
cgGetFloatAnnotationValues, cgGetIntAnnotationValues
perl v5.10.0 Cg Toolkit 3.0 304
cgGetStringParameterValue(3) Cg Core Runtime API cgGetStringParameterValue(3)
NAME cgGetStringParameterValue −get the value of a string parameter
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStringParameterValue( CGparameter param );
PARAMETERS
param The parameter whose value will be retrieved.
RETURN VALUES
Returns a pointer to the string contained by a string parameter.
Returns NULL if the parameter does not contain a valid string value.
DESCRIPTION
cgGetStringParameterValue allows the application to get the value of a string parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not string-typed.
HISTORY
cgGetStringParameterValue wasintroduced in Cg 1.4.
SEE ALSO
cgSetStringParameterValue
perl v5.10.0 Cg Toolkit 3.0 305
cgGetStringStateAssignmentValue(3) Cg Core Runtime API cgGetStringStateAssignmentValue(3)
NAME cgGetStringStateAssignmentValue −get a string-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetStringStateAssignmentValue( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a pointer to a string.
Returns NULL if an error occurs.
DESCRIPTION
cgGetStringStateAssignmentValue allows the application to retrieve the value(s) of a string typed state
assignment.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
string type.
HISTORY
cgGetStringStateAssignmentValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetIntStateAssignmentValues, cgGetBoolStateAssignmentValues, cgGetProgramStateAssignmentValue,
cgGetSamplerStateAssignmentValue, cgGetTextureStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 306
cgGetSupportedProfile(3) Cg Core Runtime API cgGetSupportedProfile(3)
NAME cgGetSupportedProfile −get a supported profile by index
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgGetSupportedProfile( int index );
PARAMETERS
indexThe indexfor the supported profile.
RETURN VALUES
Returns the supported CGprofile at position index.
Returns the CG_PROFILE_UNKNOWN if an error occurs.
DESCRIPTION
cgGetSupportedProfile retrievesbyindex aprofile supported by this version of the Cg library.The
number of supported profiles can be found using cgGetNumSupportedProfiles.
Note that a profile may be recognized by Cg but not supported by the platform on which the application is
currently running. Agraphics API specific routine such as cgGLIsProfileSupported must still be used to
determine if the current GPU and drivercombination supports a givenprofile.
EXAMPLES
CGprofile profile;
int nProfiles;
int ii;
nProfiles = cgGetNumSupportedProfiles();
printf("NumSupportedProfiles: %i\n", nProfiles);
for (ii=0; ii<nProfiles; ++ii) {
profile = cgGetSupportedProfile(ii);
printf("SupportedProfile %i: %s %i\n", ii, cgGetProfileString(profile), profile);
}
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if index is less than 0or greater than or equal to the
number of supported profiles returned by cgGetNumSupportedProfiles.
HISTORY
cgGetSupportedProfile wasintroduced in Cg 2.2.
SEE ALSO
cgGetNumSupportedProfiles, cgIsProfileSupported, cgGetProfileProperty,cgGLIsProfileSupported,
cgD3D9IsProfileSupported, cgD3D10IsProfileSupported, cgGetProfileString, cgGetProfile
perl v5.10.0 Cg Toolkit 3.0 307
cgGetTechniqueEffect(3) Cg Core Runtime API cgGetTechniqueEffect(3)
NAME cgGetTechniqueEffect −get a technique’seffect
SYNOPSIS
#include <Cg/cg.h>
CGeffect cgGetTechniqueEffect( CGtechnique tech );
PARAMETERS
tech The technique.
RETURN VALUES
Returns a CGeffect handle to the effect.
Returns NULL if an error occurs.
DESCRIPTION
cgGetTechniqueEffect allows the application to retrieve a handle to the effect to which a giventechnique
belongs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetTechniqueEffect wasintroduced in Cg 1.4.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile
perl v5.10.0 Cg Toolkit 3.0 308
cgGetTechniqueName(3) Cg Core Runtime API cgGetTechniqueName(3)
NAME cgGetTechniqueName −get a technique’sname
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetTechniqueName( CGtechnique tech );
PARAMETERS
tech The technique.
RETURN VALUES
Returns the NULL-terminated name string for the technique.
Returns NULL if tech is invalid.
DESCRIPTION
cgGetTechniqueName allows the application to retrieve the name of a technique in a Cg effect. This name
can be used later to retrieve the technique from the effect using cgGetNamedTechnique.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgGetTechniqueName wasintroduced in Cg 1.4.
SEE ALSO
cgGetNamedTechnique, cgGetFirstTechnique, cgGetNextTechnique
perl v5.10.0 Cg Toolkit 3.0 309
cgGetTextureStateAssignmentValue(3) Cg Core Runtime API cgGetTextureStateAssignmentValue(3)
NAME cgGetTextureStateAssignmentValue −get a texture-valued state assignment’svalues
SYNOPSIS
#include <Cg/cg.h>
CGparameter cgGetTextureStateAssignmentValue( CGstateassignment sa );
PARAMETERS
sa The state assignment.
RETURN VALUES
Returns a handle to the texture parameter associated with this state assignment.
Returns NULL if an error occurs.
DESCRIPTION
cgGetTextureStateAssignmentValue allows the application to retrieve the value(s) of a state assignment
that stores a texture parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
texture type.
HISTORY
cgGetTextureStateAssignmentValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetStateAssignmentState, cgGetStateType, cgGetFloatStateAssignmentValues,
cgGetIntStateAssignmentValues, cgGetStringStateAssignmentValue, cgGetSamplerStateAssignmentValue
perl v5.10.0 Cg Toolkit 3.0 310
cgGetType(3) Cg Core Runtime API cgGetType(3)
NAME cgGetType −get the type enumerant assigned to a type name
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetType( const char * type_string );
PARAMETERS
type_string
Astring containing the case-sensitive type name.
RETURN VALUES
Returns the type enumerant of type_string.
Returns CG_UNKNOWN_TYPE if no such type exists.
DESCRIPTION
cgGetType returns the enumerant assigned to a type name.
EXAMPLES
CGtype Float4Type = cgGetType("float4");
if(cgGetParameterType(myparam) == Float4Type)
{
/* Do stuff */
}
ERRORS
None.
HISTORY
cgGetType wasintroduced in Cg 1.1.
SEE ALSO
cgGetTypeString, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 311
cgGetTypeBase(3) Cg Core Runtime API cgGetTypeBase(3)
NAME cgGetTypeBase −get the base type associated with a type enumerant
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetTypeBase( CGtype type );
PARAMETERS
type The type enumerant.
RETURN VALUES
Returns the scalar base type of the enumerant type.
DESCRIPTION
cgGetTypeBase returns the base (scalar) type associated with a type enumerant. Forexample,
cgGetTypeBase(CG_FLOAT3x4) returns CG_FLOAT.The base type for a non-numeric type such as
CG_STRING,CG_STRUCT,CG_SAMPLER2D,oruser-defined types is simply the type itself.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGetTypeBase wasintroduced in Cg 1.5.
SEE ALSO
cgGetType, cgGetTypeClass, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 312
cgGetTypeClass(3) Cg Core Runtime API cgGetTypeClass(3)
NAME cgGetTypeClass −get the parameter class associated with a type enumerant
SYNOPSIS
#include <Cg/cg.h>
CGparameterclass cgGetTypeClass( CGtype type );
PARAMETERS
type The type enumerant.
RETURN VALUES
Returns the parameter class of the enumerant type.Possible return values are:
CG_PARAMETERCLASS_UNKNOWN
CG_PARAMETERCLASS_SCALAR
CG_PARAMETERCLASS_VECTOR
CG_PARAMETERCLASS_MATRIX
CG_PARAMETERCLASS_STRUCT
CG_PARAMETERCLASS_ARRAY
CG_PARAMETERCLASS_SAMPLER
CG_PARAMETERCLASS_OBJECT
DESCRIPTION
cgGetTypeClass returns the parameter class associated with a type enumerant. Forexample,
cgGetTypeClass(CG_FLOAT3x4) returns CG_PARAMETERCLASS_MATRIX while
cgGetTypeClass(CG_HALF)returns CG_PARAMETERCLASS_SCALAR and cgGetTypeClass(CG_BOOL3)
returns CG_PARAMETERCLASS_VECTOR.
CG_PARAMETERCLASS_UNKNOWN is returned if the type is unknown.
EXAMPLES
to-be-written
ERRORS
None
HISTORY
cgGetTypeClass wasintroduced in Cg 1.5.
SEE ALSO
cgGetType, cgGetTypeBase, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 313
cgGetTypeSizes(3) Cg Core Runtime API cgGetTypeSizes(3)
NAME cgGetTypeSizes −get the rowand/or column size of a type enumerant
SYNOPSIS
#include <Cg/cg.h>
CGbool cgGetTypeSizes( CGtype type,
int * nrows,
int * ncols );
PARAMETERS
type The type enumerant.
nrows The location where the number of rows will be written.
ncols The location where the number of columns will be written.
RETURN VALUES
Returns CG_TRUE if the type enumerant is for a matrix.
Returns CG_FALSE otherwise.
DESCRIPTION
cgGetTypeSizes returns the number of rows and columns for enumerant type in the locations specified by
nrowsand ncols respectively.
When the type enumerant is not a matrix type then 1is returned in nrows,incontrast to cgGetMatrixSize
where the number of rows and columns will be 0if the type enumerant is not a matrix.
Foranumeric types, ncols will be the vector length for vectors and 1for scalars. Fornon-numeric types,
ncols will be 0.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGetTypeSizes wasintroduced in Cg 1.5.
SEE ALSO
cgGetArrayTotalSize, cgGetArrayDimension, cgGetArrayParameter,cgGetMatrixSize
perl v5.10.0 Cg Toolkit 3.0 314
cgGetTypeString(3) Cg Core Runtime API cgGetTypeString(3)
NAME cgGetTypeString −get the type name associated with a type enumerant
SYNOPSIS
#include <Cg/cg.h>
const char * cgGetTypeString( CGtype type );
PARAMETERS
type The type enumerant.
RETURN VALUES
Returns the type string of the enumerant type.
DESCRIPTION
cgGetTypeString returns the type name associated with a type enumerant.
EXAMPLES
const char *MatrixTypeStr = cgGetTypeString(CG_FLOAT4x4);
/* MatrixTypeStr will be "float4x4" */
ERRORS
None.
HISTORY
cgGetTypeString wasintroduced in Cg 1.1.
SEE ALSO
cgGetType, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 315
cgGetUserType(3) Cg Core Runtime API cgGetUserType(3)
NAME cgGetUserType −get enumerant of user-defined type from a program or effect
SYNOPSIS
#include <Cg/cg.h>
CGtype cgGetUserType( CGhandle handle,
int index );
PARAMETERS
handle The CGprogram or CGeffect in which the type is defined.
indexThe indexofthe user-defined type. index must be greater than or equal to 0and less than the
value returned by cgGetNumUserTypes.
RETURN VALUES
Returns the type enumerant associated with the type with the givenindex.
DESCRIPTION
cgGetUserType returns the enumerant associated with the user-defined type with the givenindex in the
givenCGprogram or CGeffect.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if handle is not a valid program or effect
handle.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if index is outside the proper range.
HISTORY
cgGetUserType wasintroduced in Cg 1.2.
SEE ALSO
cgGetNumUserTypes, cgGetNamedUserType
perl v5.10.0 Cg Toolkit 3.0 316
cgIsAnnotation(3) Cg Core Runtime API cgIsAnnotation(3)
NAME cgIsAnnotation −determine if an annotation handle references a valid annotation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsAnnotation( CGannotation ann );
PARAMETERS
ann The annotation handle to check.
RETURN VALUES
Returns CG_TRUE if ann references a valid annotation.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsAnnotation returns CG_TRUE if ann references a valid annotation, CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsAnnotation wasintroduced in Cg 1.4.
SEE ALSO
cgGetNextAnnotation, cgGetAnnotationName, cgGetAnnotationType, cgCreateEffectAnnotation,
cgCreateParameterAnnotation, cgCreatePassAnnotation, cgCreateProgramAnnotation,
cgCreateTechniqueAnnotation
perl v5.10.0 Cg Toolkit 3.0 317
cgIsContext(3) Cg Core Runtime API cgIsContext(3)
NAME cgIsContext −determine if a context handle references a valid context
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsContext( CGcontext context );
PARAMETERS
context The context handle to check.
RETURN VALUES
Returns CG_TRUE if context references a valid context.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsContext returns CG_TRUE if context references a valid context, CG_FALSE otherwise.
EXAMPLES
CGcontext context = NULL;
cgIsContext(context); /* returns CG_FALSE */
context = cgCreateContext();
cgIsContext(context); /* returns CG_TRUE if create succeeded */
cgDestroyContext(context);
cgIsContext(context); /* returns CG_FALSE */
ERRORS
None.
HISTORY
cgIsContext wasintroduced in Cg 1.1.
SEE ALSO
cgCreateContext, cgDestroyContext
perl v5.10.0 Cg Toolkit 3.0 318
cgIsEffect(3) Cg Core Runtime API cgIsEffect(3)
NAME cgIsEffect −determine if an effect handle references a valid effect
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsEffect( CGeffect effect );
PARAMETERS
effect The effect handle to check.
RETURN VALUES
Returns CG_TRUE if effect references a valid effect.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsEffect returns CG_TRUE if effect references a valid effect, CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsEffect wasintroduced in Cg 1.4.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile
perl v5.10.0 Cg Toolkit 3.0 319
cgIsInterfaceType(3) Cg Core Runtime API cgIsInterfaceType(3)
NAME cgIsInterfaceType −determine if a type is an interface
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsInterfaceType( CGtype type );
PARAMETERS
type The type being evaluated.
RETURN VALUES
Returns CG_TRUE if type is an interface (not just a struct).
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsInterfaceType returns CG_TRUE if type is an interface (not just a struct), CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsInterfaceType wasintroduced in Cg 1.2.
SEE ALSO
cgGetType
perl v5.10.0 Cg Toolkit 3.0 320
cgIsParameter(3) Cg Core Runtime API cgIsParameter(3)
NAME cgIsParameter −determine if a parameter handle references a valid parameter
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsParameter( CGparameter param );
PARAMETERS
param The parameter handle to check.
RETURN VALUES
Returns CG_TRUE if param references a valid parameter object.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsParameter returns CG_TRUE if param references a valid parameter object. cgIsParameter is
typically used for iterating through the parameters of an object. It can also be used as a consistencycheck
when the application caches CGparameter handles. Certain program operations likedeleting the program
or context object that the parameter is contained in will cause a parameter object to become invalid.
EXAMPLES
if (cgIsParameter(param)) {
/* do something with param */
}else {
/* handle situation where param is not a valid parameter */
}
ERRORS
None.
HISTORY
cgIsParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGetNextParameter
perl v5.10.0 Cg Toolkit 3.0 321
cgIsParameterGlobal(3) Cg Core Runtime API cgIsParameterGlobal(3)
NAME cgIsParameterGlobal −determine if a parameter is global
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsParameterGlobal( CGparameter param );
PARAMETERS
param The parameter handle to check.
RETURN VALUES
Returns CG_TRUE if param is global.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsParameterGlobal returns CG_TRUE if param is a global parameter and CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgIsParameterGlobal wasintroduced in Cg 1.2.
SEE ALSO
cgCreateParameter,cgIsParameter,cgIsParameterReferenced, cgIsParameterUsed
perl v5.10.0 Cg Toolkit 3.0 322
cgIsParameterReferenced(3) Cg Core Runtime API cgIsParameterReferenced(3)
NAME cgIsParameterReferenced −determine if a program parameter is potentially referenced
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsParameterReferenced( CGparameter param );
PARAMETERS
param The handle of the parameter to check.
RETURN VALUES
Returns CG_TRUE if param is a program parameter and is potentially referenced by the program.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsParameterReferenced returns CG_TRUE if param is a program parameter,and is potentially
referenced (used) within the program. It otherwise returns CG_FALSE.
Program parameters are those parameters associated directly with a CGprogram,whose handles are
retrievedbycalling, for example, cgGetNamedProgramParameter.
The value returned by cgIsParameterReferenced is conservative,but not always exact. A return value of
CG_TRUE indicates that the parameter may be used by its associated program. Areturn value of
CG_FALSE indicates that the parameter is definintely not referenced by the program.
If param is an aggregate program parameter (a struct or array), CG_TRUE is returned if anyofparam’s
children are potentially referenced by the program.
If param is a leaf parameter and the return value is CG_FALSE,cgGetParameterResource may return
CG_INVALID_VALUE for this parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgIsParameterReferenced wasintroduced in Cg 1.1.
SEE ALSO
cgGetNamedProgramParameter,cgIsParameterUsed, cgGetParameterResource
perl v5.10.0 Cg Toolkit 3.0 323
cgIsParameterUsed(3) Cg Core Runtime API cgIsParameterUsed(3)
NAME cgIsParameterUsed −determine if a parameter is potentially used
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsParameterUsed( CGparameter param,
CGhandle container );
PARAMETERS
param The parameter to check.
container Specifies the CGeffect,CGtechnique,CGpass,CGstateassignment,orCGprogram that may
potentially use param.
RETURN VALUES
Returns CG_TRUE if param is potentially used by container.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsParameterUsed returns CG_TRUE if param is potentially used by the givencontainer.Ifparam is a
struct or array, CG_TRUE is returned if anyofits children are potentially used by container.Itotherwise
returns CG_FALSE.
The value returned by cgIsParameterUsed is conservative,but not always exact. A return value of
CG_TRUE indicates that the parameter may be used by container.Areturn value of CG_FALSE indicates
that the parameter is definintely not used by container.
The givenparam handle may reference a program parameter,aneffect parameter,orashared parameter.
The container handle may reference a CGeffect,CGtechnique,CGpass,CGstateassignment,or
CGprogram.
If container is a CGprogram,CG_TRUE is returned if anyofthe program’sreferenced parameters inherit
their values directly or indirectly (due to parameter connections) from param.
If container is a CGstateassignment,CG_TRUE is returned if the right-hand side of the state assignment
may directly or indirectly depend on the value of param.Ifthe state assignment involves a CGprogram,
the program’sparameters are also considered, as above.
If container is a CGpass,CG_TRUE is returned if anyofthe pass’ state assignments potentially use
param.
If container is a CGtechnique,CG_TRUE is returned if anyofthe technqiue’spasses potentially use
param.
If container is a CGeffect,CG_TRUE is returned if anyofthe effect’stechniques potentially use param.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter,orifcontainer
is not the handle of a valid container.
HISTORY
cgIsParameterUsed wasintroduced in Cg 1.4.
SEE ALSO
cgIsParameterReferenced, cgConnectParameter
perl v5.10.0 Cg Toolkit 3.0 324
cgIsParentType(3) Cg Core Runtime API cgIsParentType(3)
NAME cgIsParentType −determine if a type is a parent of another type
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsParentType( CGtype parent,
CGtype child );
PARAMETERS
parent The parent type.
child The child type.
RETURN VALUES
Returns CG_TRUE if parent is a parent type of child.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsParentType returns CG_TRUE if parent is a parent type of child.Otherwise CG_FALSE is returned.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsParentType wasintroduced in Cg 1.2.
SEE ALSO
cgGetParentType
perl v5.10.0 Cg Toolkit 3.0 325
cgIsPass(3) Cg Core Runtime API cgIsPass(3)
NAME cgIsPass −determine if a pass handle references a valid pass
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsPass( CGpass pass );
PARAMETERS
pass The pass handle to check.
RETURN VALUES
Returns CG_TRUE if pass references a valid pass.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsPass returns CG_TRUE if pass references a valid pass, CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsPass wasintroduced in Cg 1.4.
SEE ALSO
cgCreatePass, cgGetFirstPass, cgGetNamedPass, cgGetNextPass, cgGetPassName, cgGetPassTechnique
perl v5.10.0 Cg Toolkit 3.0 326
cgIsProfileSupported(3) Cg Core Runtime API cgIsProfileSupported(3)
NAME cgIsProfileSupported −determine if a profile is supported
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsProfileSupported( CGprofile profile );
PARAMETERS
profile The profile enumerant to test.
RETURN VALUES
Returns CG_TRUE if profile is supported.
DESCRIPTION
cgIsProfileSupported checks whether profile is supported by this version of the Cg library.
Note that a profile may be recognized by Cg but not supported by the platform on which the application is
currently running. Agraphics API specific routine such as cgGLIsProfileSupported must still be used to
determine if the current GPU and drivercombination supports a givenprofile.
EXAMPLES
CGprofile profile;
int nProfiles;
int ii;
nProfiles = cgGetNumSupportedProfiles();
printf("NumSupportedProfiles: %i\n", nProfiles);
for (ii=0; ii<nProfiles; ++ii) {
profile = cgGetSupportedProfile(ii);
printf("IsProfileSupported %i: %s %i\n", ii, cgGetProfileString(profile),
cgIsProfileSupported(profile));
}
ERRORS
None.
HISTORY
cgIsProfileSupported wasintroduced in Cg 2.2.
SEE ALSO
cgGetNumSupportedProfiles, cgGetSupportedProfile, cgGetProfileProperty,cgGLIsProfileSupported,
cgD3D9IsProfileSupported, cgD3D10IsProfileSupported, cgGetProfileString, cgGetProfile
perl v5.10.0 Cg Toolkit 3.0 327
cgIsProgram(3) Cg Core Runtime API cgIsProgram(3)
NAME cgIsProgram −determine if a program handle references a program object
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsProgram( CGprogram program );
PARAMETERS
program The program handle to check.
RETURN VALUES
Returns CG_TRUE if program references a valid program object.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsProgram return CG_TRUE if program references a valid program object. Note that this does not
imply that the program has been successfully compiled.
EXAMPLES
char *programSource = ...;
CGcontext context = cgCreateContext();
CGprogram program = cgCreateProgram( context,
CG_SOURCE,
programSource,
CG_PROFILE_ARBVP1,
"myshader",
NULL );
CGbool isProgram = cgIsProgram( program );
ERRORS
None.
HISTORY
cgIsProgram wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram, cgDestroyProgram, cgGetNextProgram
perl v5.10.0 Cg Toolkit 3.0 328
cgIsProgramCompiled(3) Cg Core Runtime API cgIsProgramCompiled(3)
NAME cgIsProgramCompiled −determine if a program has been compiled
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsProgramCompiled( CGprogram program );
PARAMETERS
program The program.
RETURN VALUES
Returns CG_TRUE if program has been compiled.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsProgramCompiled returns CG_TRUE if program has been compiled and CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgIsProgramCompiled wasintroduced in Cg 1.1.
SEE ALSO
cgCompileProgram, cgSetAutoCompile
perl v5.10.0 Cg Toolkit 3.0 329
cgIsState(3) Cg Core Runtime API cgIsState(3)
NAME cgIsState −determine if a state handle references a valid state
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsState( CGstate state );
PARAMETERS
state The state handle to check.
RETURN VALUES
Returns CG_TRUE if state references a valid state.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsState returns CG_TRUE if state references a valid state, CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgIsState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateState
perl v5.10.0 Cg Toolkit 3.0 330
cgIsStateAssignment(3) Cg Core Runtime API cgIsStateAssignment(3)
NAME cgIsStateAssignment −determine if a state assignment handle references a valid Cg state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsStateAssignment( CGstateassignment sa );
PARAMETERS
sa The state assignment handle to check.
RETURN VALUES
Returns CG_TRUE if sa references a valid state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsStateAssignment returns CG_TRUE if sa references a valid state assignment, CG_FALSE otherwise.
EXAMPLES
if (cgIsStateAssignment(sa)) {
/* do something with sa */
}else {
/* handle situation where sa is not a valid state assignment */
}
ERRORS
None.
HISTORY
cgIsStateAssignment wasintroduced in Cg 1.4.
SEE ALSO
cgCreateStateAssignment, cgCreateStateAssignmentIndex, cgGetFirstStateAssignment,
cgGetFirstSamplerStateAssignment, cgGetNamedStateAssignment, cgGetNamedSamplerStateAssignment,
cgGetNextStateAssignment, cgGetStateAssignmentIndex, cgGetStateAssignmentPass,
cgGetStateAssignmentState
perl v5.10.0 Cg Toolkit 3.0 331
cgIsTechnique(3) Cg Core Runtime API cgIsTechnique(3)
NAME cgIsTechnique −determine if a technique handle references a valid technique
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsTechnique( CGtechnique tech );
PARAMETERS
tech The technique handle to check.
RETURN VALUES
Returns CG_TRUE if tech references a valid technique.
Returns CG_FALSE otherwise.
DESCRIPTION
cgIsTechnique returns CG_TRUE if tech references a valid technique, CG_FALSE otherwise.
EXAMPLES
if (cgIsTechnique(tech)) {
/* do something with tech */
}else {
/* handle situation where tech is not a valid technique */
}
ERRORS
None.
HISTORY
cgIsTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgCreateTechnique, cgGetFirstTechnique, cgGetNamedTechnique, cgGetNextTechnique,
cgGetTechniqueEffect, cgGetTechniqueName, cgIsTechniqueValidated, cgValidateTechnique
perl v5.10.0 Cg Toolkit 3.0 332
cgIsTechniqueValidated(3) Cg Core Runtime API cgIsTechniqueValidated(3)
NAME cgIsTechniqueValidated −indicates whether the technique has passed validation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgIsTechniqueValidated( CGtechnique tech );
PARAMETERS
tech The technique handle.
RETURN VALUES
Returns CG_TRUE if the technique has previously passes validation via a call to cgValidateTechnique.
Returns CG_FALSE if validation hasn’tbeen attempted or the technique has failed a validation attempt.
DESCRIPTION
cgIsTechniqueValidated returns CG_TRUE if the technique has previously passes validation via a call to
cgValidateTechnique. CG_FALSE is returned both if validation hasn’tbeen attempted as well as if the
technique has failed a validation attempt.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgIsTechniqueValidated wasintroduced in Cg 1.4.
SEE ALSO
cgValidateTechnique, cgCallStateValidateCallback
perl v5.10.0 Cg Toolkit 3.0 333
cgMapBuffer(3) Cg Core Runtime API cgMapBuffer(3)
NAME cgMapBuffer −map buffer into application’saddress space
SYNOPSIS
#include <Cg/cg.h>
void * cgMapBuffer( CGbuffer buffer,
CGbufferaccess access );
PARAMETERS
buffer The buffer which will be mapped into the application’saddress space.
access An enumerant indicating the operations the client may perform on the data store through the
pointer while the buffer data is mapped.
The following enumerants are allowed:
CG_MAP_READ
The application can read but not write through the data pointer.
CG_MAP_WRITE
The application can write but not read through the data pointer.
CG_MAP_READ_WRITE
The application can read and write through the data pointer.
CG_MAP_WRITE_DISCARD
Same as CG_MAP_READ_WRITE if using a GL buffer.
CG_MAP_WRITE_NO_OVERWRITE
Same as CG_MAP_READ_WRITE if using a GL buffer.
RETURN VALUES
Returns a pointer through which the application can read or write the buffer’sdata store.
Returns NULL if an error occurs.
DESCRIPTION
cgMapBuffer maps a buffer into the application’saddress space for memory-mapped updating of the
buffer’sdata. The application should call cgUnmapBuffer|cgUnmapBuffer when it’sdone updating or
querying the buffer.
EXAMPLES
unsigned char *bufferPtr = cgMapBuffer( myBuffer, CG_MAP_READ_WRITE );
memcpy( ptr, bufferPtr, size );
cgUnmapBuffer( myBuffer );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
CG_INVALID_ENUMERANT_ERROR is generated if access is not CG_READ_ONLY,CG_WRITE_ONLY,
or CG_READ_WRITE.
CG_BUFFER_ALREADY_MAPPED_ERROR is generated if buffer is already mapped.
HISTORY
cgMapBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgUnmapBuffer,cgSetBufferData, cgSetBufferSubData, cgSetParameter
perl v5.10.0 Cg Toolkit 3.0 334
cgResetPassState(3) Cg Core Runtime API cgResetPassState(3)
NAME cgResetPassState −calls the state resetting callback functions for all of the state assignments in a pass.
SYNOPSIS
#include <Cg/cg.h>
void cgResetPassState( CGpass pass );
PARAMETERS
pass The pass handle.
RETURN VALUES
None.
DESCRIPTION
cgResetPassState resets all of the graphics state defined in a pass by calling the state resetting callbacks for
all of the state assignments in the pass.
The semantics of ‘‘resetting state’’will depend on the particular graphics state manager that defined the
valid state assignments; it will generally either mean that graphics state is reset to what it was before the
pass, or that it is reset to the default value. The OpenGL state manager in the OpenGL Cg runtime
implements the latter approach.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_TECHNIQUE_ERROR is generated if the technique of which pass is a part has failed
validation.
HISTORY
cgResetPassState wasintroduced in Cg 1.4.
SEE ALSO
cgSetPassState, cgCallStateResetCallback
perl v5.10.0 Cg Toolkit 3.0 335
cgSetArraySize(3) Cg Core Runtime API cgSetArraySize(3)
NAME cgSetArraySize −sets the size of a resizable array parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetArraySize( CGparameter param,
int size );
PARAMETERS
param The array parameter handle.
size The newsize of the array.
RETURN VALUES
None.
DESCRIPTION
cgSetArraySize sets the size of a resiable array parameter param to size.
EXAMPLES
If you have Cgprogram with a parameter likethis :
/* ... */
float4 main(float4 myarray[])
{
/* ... */
}
Youcan set the size of the myarray array parameter to 5likeso:
CGparameter arrayParam =
cgGetNamedProgramParameter(program, CG_PROGRAM, "myarray");
cgSetArraySize(arrayParam, 5);
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_ARRAY_HAS_WRONG_DIMENSION_ERROR is generated if the dimension of the array parameter
param is not 1.
CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR is generated if param is not a resizable array.
CG_INVALID_PARAMETER_ERROR is generated if size is less than 0.
HISTORY
cgSetArraySize wasintroduced in Cg 1.2.
SEE ALSO
cgGetArraySize, cgGetArrayDimension, cgSetMultiDimArraySize
perl v5.10.0 Cg Toolkit 3.0 336
cgSetAutoCompile(3) Cg Core Runtime API cgSetAutoCompile(3)
NAME cgSetAutoCompile −sets the auto-compile mode for a context
SYNOPSIS
#include <Cg/cg.h>
void cgSetAutoCompile( CGcontext context,
CGenum autoCompileMode );
PARAMETERS
context The context.
autoCompileMode
The auto-compile mode to which to set context.Must be one of the following :
CG_COMPILE_MANUAL
CG_COMPILE_IMMEDIATE
CG_COMPILE_LAZY
RETURN VALUES
None.
DESCRIPTION
cgSetAutoCompile sets the auto compile mode for a givencontext. By default, programs are immediately
recompiled when theyenter an uncompiled state. This may happen for a variety of reasons including :
•Setting the value of a literal parameter.
•Resizing arrays.
•Binding structs to interface parameters.
autoCompileMode may be one of the following three enumerants :
CG_COMPILE_IMMEDIATE
CG_COMPILE_IMMEDIATE will force recompilation automatically and immediately when a
program enters an uncompiled state. This is the default mode.
CG_COMPILE_MANUAL
With this method the application is responsible for manually recompiling a program. It may check to
see if a program requires recompilation with the entry point cgIsProgramCompiled.
cgCompileProgram can then be used to force compilation.
CG_COMPILE_LAZY
This method is similar to CG_COMPILE_IMMEDIATE butwill delay program recompilation until the
program object code is needed. The advantage of this method is the reduction of extraneous
recompilations. The disadvantage is that compile time errors will not be encountered when the
program is enters the uncompiled state but will instead be encountered at some later time.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if autoCompileMode is not CG_COMPILE_MANUAL,
CG_COMPILE_IMMEDIATE,orCG_COMPILE_LAZY.
HISTORY
cgSetAutoCompile wasintroduced in Cg 1.2.
perl v5.10.0 Cg Toolkit 3.0 337
cgSetAutoCompile(3) Cg Core Runtime API cgSetAutoCompile(3)
SEE ALSO
cgCompileProgram, cgIsProgramCompiled
perl v5.10.0 Cg Toolkit 3.0 338
cgSetBoolAnnotation(3) Cg Core Runtime API cgSetBoolAnnotation(3)
NAME cgSetBoolAnnotation −set the value of a bool annotation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetBoolAnnotation( CGannotation ann,
CGbool value );
PARAMETERS
ann The annotation that will be set.
value The value to which ann will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the annotation.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetBoolAnnotation sets the value of an annotation of bool type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of bool type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.
HISTORY
cgSetBoolAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetBoolAnnotationValues, cgSetIntAnnotation, cgSetFloatAnnotation, cgSetStringAnnotation
perl v5.10.0 Cg Toolkit 3.0 339
cgSetBoolArrayStateAssignment(3) Cg Core Runtime API cgSetBoolArrayStateAssignment(3)
NAME cgSetBoolArrayStateAssignment −set a bool-valued state assignment array
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetBoolArrayStateAssignment( CGstateassignment sa,
const CGbool * vals );
PARAMETERS
sa A handle to a state assignment array of type CG_BOOL.
vals The values which will be used to set sa.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetBoolArrayStateAssignment sets the value of a state assignment of bool array type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
bool type.
HISTORY
cgSetBoolArrayStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetBoolStateAssignmentValues, cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment,
cgSetFloatStateAssignment, cgSetIntArrayStateAssignment, cgSetIntStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 340
cgSetBoolStateAssignment(3) Cg Core Runtime API cgSetBoolStateAssignment(3)
NAME cgSetBoolStateAssignment −set the value of a bool state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetBoolStateAssignment( CGstateassignment sa,
CGbool value );
PARAMETERS
sa A handle to a state assignment of type CG_BOOL.
value The value to which sa will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetBoolStateAssignment sets the value of a state assignment of bool type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
bool type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
HISTORY
cgSetBoolStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetBoolStateAssignmentValues, cgSetBoolArrayStateAssignment, cgSetFloatArrayStateAssignment,
cgSetFloatStateAssignment, cgSetIntArrayStateAssignment, cgSetIntStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 341
cgSetBufferData(3) Cg Core Runtime API cgSetBufferData(3)
NAME cgSetBufferData −resize and completely update a buffer object
SYNOPSIS
#include <Cg/cg.h>
void cgSetBufferData( CGbuffer buffer,
int size,
const void * data );
PARAMETERS
buffer The buffer which will be updated.
size Specifies anew size for the buffer object. Zero for size means use the existing size of the buffer as
the effective size.
data Pointer to the data to copyinto the buffer.The number of bytes to copyisdetermined by the size
parameter.
RETURN VALUES
None.
DESCRIPTION
cgSetBufferData resizes and completely updates an existing buffer object.
Abuffer which has been mapped into an applications address space with cgMapBuffer must be unmapped
using cgUnmapBuffer before it can be updated with cgSetBufferData.
EXAMPLES
cgSetBufferData( myBuffer,sizeof( myData ), myData );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR is generated if buffer is currently mapped.
HISTORY
cgSetBufferData wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLCreateBuffer,cgSetBufferSubData, cgMapBuffer,cgUnmapBuffer
perl v5.10.0 Cg Toolkit 3.0 342
cgSetBufferSubData(3) Cg Core Runtime API cgSetBufferSubData(3)
NAME cgSetBufferSubData −partially update a Cg buffer object
SYNOPSIS
#include <Cg/cg.h>
void cgSetBufferSubData( CGbuffer buffer,
int offset,
int size,
const void * data );
PARAMETERS
buffer Buffer being updated.
offset Buffer offset in bytes of the beginning of the partial update.
size Number of buffer bytes to be updated. Zero means no update.
data Pointer to the start of the data being copied into the buffer.
RETURN VALUES
None.
DESCRIPTION
cgSetBufferSubData resizes and partially updates an existing buffer object.
Abuffer which has been mapped into an applications address space with cgMapBuffer must be unmapped
using cgUnmapBuffer before it can be updated with cgSetBufferSubData.
EXAMPLES
cgSetBufferSubData( myBuffer,16, sizeof( myData ), myData );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR is generated if buffer is currently mapped.
CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if offset or size is out of range.
HISTORY
cgSetBufferSubData wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLCreateBuffer,cgSetBufferData, cgMapBuffer,cgUnmapBuffer
perl v5.10.0 Cg Toolkit 3.0 343
cgSetCompilerIncludeCallback(3) Cg Core Runtime API cgSetCompilerIncludeCallback(3)
NAME cgSetCompilerIncludeCallback −set the include callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGIncludeCallbackFunc)( CGcontext context, const char *filename );
void cgSetCompilerIncludeCallback( CGcontext context, CGIncludeCallbackFunc func );
PARAMETERS
context The context for which the include callback will be used.
func A pointer to the include callback function.
RETURN VALUES
None.
DESCRIPTION
cgSetCompilerIncludeCallback sets a callback function used for handing include statements. Each Cg
runtime context maintains a virtual file system of shader source code for inclusion by the compiler.Source
code is populated into the virtual filesystem using cgSetCompilerIncludeString and
cgSetCompilerIncludeFile. When the compiler encounters an include, firstly the virtual file system is
searched for a match. Secondly the include callback function is called, providing an opportunity for
populating shader source via cgSetCompilerIncludeString and cgSetCompilerIncludeFile. The callback
function is passed the context and the requested name. Thirdly,the filesystem is searched in the usual
manner.Fourthly,anerror is raised by the compiler that the include can not be satisfied. NULL is passed to
cgSetCompilerIncludeCallback to disable the callback.
EXAMPLES
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgSetCompilerIncludeCallback wasintroduced in Cg 2.1.
SEE ALSO
cgGetCompilerIncludeCallback, cgSetCompilerIncludeString, cgSetCompilerIncludeFile
perl v5.10.0 Cg Toolkit 3.0 344
cgSetCompilerIncludeFile(3) Cg Core Runtime API cgSetCompilerIncludeFile(3)
NAME cgSetCompilerIncludeFile −add shader source file to context
SYNOPSIS
#include <Cg/cg.h>
void cgSetCompilerIncludeFile( CGcontext context, const char *name, const char *filename );
PARAMETERS
context The context in which to add the source code for inclusion by the compiler.
name The virtual file system name of the shader source.
filename System file system name of shader source file.
RETURN VALUES
None.
DESCRIPTION
Each Cg runtime context maintains a virtual filesystem of shader source code for inclusion by the compiler.
cgSetCompilerIncludeFile populates source code into the virtual filesystem from a file. Aname is
removedfrom the virtual filesystem by using NULL for the filename.The virtual filesystem is completely
cleared by using NULL for the name.
EXAMPLES
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_FILE_READ_ERROR is generated if the file filename can not be opened for input.
HISTORY
cgSetCompilerIncludeFile wasintroduced in Cg 2.1.
SEE ALSO
cgSetCompilerIncludeString, cgGetCompilerIncludeCallback, cgSetCompilerIncludeCallback
perl v5.10.0 Cg Toolkit 3.0 345
cgSetCompilerIncludeString(3) Cg Core Runtime API cgSetCompilerIncludeString(3)
NAME cgSetCompilerIncludeString −add shader source string to context
SYNOPSIS
#include <Cg/cg.h>
void cgSetCompilerIncludeString( CGcontext context, const char *name, const char *source );
PARAMETERS
context The context in which to add the source code for inclusion by the compiler.
name The virtual file system name of the shader source.
source Shader source code string.
RETURN VALUES
None.
DESCRIPTION
Each Cg runtime context maintains a virtual file system of shader source code for inclusion by the
compiler. cgSetCompilerIncludeString populates source code into the virtual filesystem. Aname is
removedfrom the virtual filesystem by using NULL for the source.The virtual filesystem is completely
cleared by using NULL for the name.
EXAMPLES
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgSetCompilerIncludeString wasintroduced in Cg 2.1.
SEE ALSO
cgSetCompilerIncludeFile, cgGetCompilerIncludeCallback, cgSetCompilerIncludeCallback
perl v5.10.0 Cg Toolkit 3.0 346
cgSetContextBehavior(3) Cg Core Runtime API cgSetContextBehavior(3)
NAME cgSetContextBehavior −set the behavior for a context
SYNOPSIS
#include <Cg/cg.h>
void cgSetContextBehavior( CGcontext context,
CGbehavior behavior );
PARAMETERS
context The context for which the behavior will be set.
behavior
An enumerant which defines the behavior that will be exhibited by context.The following
enumerants are allowed:
CG_BEHAVIOR_3000
CG_BEHAVIOR_2200
CG_BEHAVIOR_CURRENT
CG_BEHAVIOR_LATEST
RETURN VALUES
None.
DESCRIPTION
Each newversion of Cg is supposed to be completely backwards compatible with previous versions,
providing bug fixes and/or newcapabilities while maintaining the behavior which applications were written
against. The intent is to allowCgtobeupdated and have existing applications continue to work exactly as
designed.
Occasionally a case is made that some behavior of Cg is wrong, but fixing that behavior could break
existing applications. This is a problem. cgSetContextBehavior provides a solution by documenting such
changes to the library’sbehavior and allowing applications to explicitly opt-in to the newbehavior.For
applications which don’tuse cgSetContextBehavior Cg will continue to behave exactly as it did before
this routine was introduced.
It is expected that the definition of a newcontext behavior will be a rare occurance and not something that
happens with every newCgrelease. Routine bugfixesand additions to the API won’tresult in creating new
values of behavior.Instead this will only be done when the fix for a broken library behavior could cause a
correctly written application to fail.
behavior must be one of the following enumerants :
CG_BEHAVIOR_3000
Cg 3.0 added support for 16 additional texture units for a total of 32 using the semantics TEXUNIT16
through TEXUNIT31 and resource enums CG_TEXUNIT16 through CG_TEXUNIT31.Touse these new
resources, CG_BEHAVIOR_3000 is required. Using CG_BEHAVIOR_2200 with these newtexture unit
resources will result in a Cg error.
CG_BEHAVIOR_2200
This value specifies a pattern of behavior matching what was seen from Cg through release 2.2.
Applications which specify CG_BEHAVIOR_2200 do not need to be modified to handle newcontext
behaviors since theywill continue to get the oldest behavior from the library.
Note that this selection is the default behavior for applications which nevercall
cgSetContextBehavior,which means that existing binaries will continue to get the behavior they
expect from Cg. This is also the fallback behavior if an invalid value of behavior is passed to
cgSetContextBehavior.
perl v5.10.0 Cg Toolkit 3.0 347
cgSetContextBehavior(3) Cg Core Runtime API cgSetContextBehavior(3)
CG_BEHAVIOR_CURRENT
When this value is used the most advanced context behavior supported by the library will be
determined at compile time and will become part of the application binary.Updating the Cg runtime
files will not change the behavior seen by the application at runtime. However, ifthe updated version
of Cg defines a newvalue for behavior then this newbehavior will be used after the application is
recompiled.
CG_BEHAVIOR_LATEST
When this value is used the most advanced context behavior supported by the library will be
determined at application runtime. Updating the Cg runtime files may result in newbehavior from Cg
ev e nthough the same application binaries are being used.
CG_BEHAVIOR_UNKNOWN
This value is returned by cgGetBehaviorString to indicate an invalid string argument has been used.
Passing CG_BEHAVIOR_UNKNOWN to cgSetContextBehavior will generate an
CG_INVALID_ENUMERANT_ERROR and result in the context’sbehavior being set to
CG_BEHAVIOR_2200 instead.
If the environment variable CG_BEHAVIOR is set to anyofthe valid CGbehavior enumerant names, then
that context behavior will be used instead of the behavior compiled into the application binary.This is true
ev e nwhen the application doesn’texplicitly call cgSetContextBehavior.Note that
CG_BEHAVIOR_CURRENT and CG_BEHAVIOR_UNKNOWN are not valid choices for CG_BEHAVIOR.
Trying to use either will result in an error.
EXAMPLES
/* create a context and set the behavior to CG_BEHAVIOR_3000 */
CGcontext context = cgCreateContext();
cgSetContextBehavior(context, CG_BEHAVIOR_3000);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if behavior is not CG_BEHAVIOR_3000,
CG_BEHAVIOR_2200,CG_BEHAVIOR_CURRENT,orCG_BEHAVIOR_LATEST.
HISTORY
cgSetContextBehavior wasintroduced in Cg 3.0.
SEE ALSO
cgCreateContext, cgGetContextBehavior,cgGetBehavior,cgGetBehaviorString
perl v5.10.0 Cg Toolkit 3.0 348
cgSetEffectName(3) Cg Core Runtime API cgSetEffectName(3)
NAME cgSetEffectName −set the name of an effect
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetEffectName( CGeffect effect,
const char * name );
PARAMETERS
effect The effect in which the name will be set.
name The newname for effect.
RETURN VALUES
Returns CG_TRUE if it succeeds.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetEffectName allows the application to set the name of an effect.
EXAMPLES
char *effectSource = ...;
CGcontext context = cgCreateContext();
CGeffect effect = cgCreateEffect(context, effectSource, NULL);
const char* myEffectName = "myEffectName";
CGbool okay = cgSetEffectName(effect, myEffectName);
if (!okay) {
/* handle error */
}
ERRORS
CG_INVALID_EFFECT_HANDLE_ERROR is generated if effect is not a valid effect.
HISTORY
cgSetEffectName wasintroduced in Cg 1.5.
SEE ALSO
cgGetEffectName, cgCreateEffect
perl v5.10.0 Cg Toolkit 3.0 349
cgSetEffectParameterBuffer(3) Cg Core Runtime API cgSetEffectParameterBuffer(3)
NAME cgSetEffectParameterBuffer −sets a Cg buffer to every program in the effect that uses the passed effect
buffer parameter.
SYNOPSIS
#include <Cg/cg.h>
void cgSetEffectParameterBuffer(CGparameter param,
CGbuffer buffer)
PARAMETERS
param The effect parameter used by programs in the effect as a buffer parameter.
buffer The Cg buffer being set to param for each program in the effect that uses param.
RETURN VALUES
None.
DESCRIPTION
cgSetEffectParameterBuffer allows the application with a single API call to set a Cg buffer to an effect
parameter using the BUFFER semantic for each program in the effect that uses this effect parameter.
cgSetEffectParameterBuffer does the equivalent of the following:
CGtechnique technique = cgGetFirstTechnique(myCgEffect);
for(; technique; technique = cgGetNextTechnique(technique))
{
if(!cgIsTechniqueValidated(technique))
continue;
CGpass pass = cgGetFirstPass(technique);
for(; pass; pass = cgiGetNextPass(pass))
{
for(int i = 0; i < numDomains; ++i)
{
CGprogram prog = cgGetPassProgram(pass, domains[i]);
if(!prog)
continue;
CGparameter param = cgGetNamedParameter(prog, "paramName");
CGbool isUsed = cgIsParameterUsed(param, prog);
if(isUsed == CG_FALSE)
continue;
int idx = cgGetParameterBufferIndex(param);
if(idx < 0)
continue;
cgSetProgramBuffer(prog, idx, myCgBuffer);
}
}
}
EXAMPLES
cgSetEffectParameterBuffer(cgGetNamedEffectParameter(myCgEffect, "paramName"), myCgBuffer);
See examples/OpenGL/advanced/cgfx_buffer_lighting.
perl v5.10.0 Cg Toolkit 3.0 350
cgSetEffectParameterBuffer(3) Cg Core Runtime API cgSetEffectParameterBuffer(3)
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is not a valid parameter.
HISTORY
cgSetEffectParameterBuffer wasintroduced in Cg 3.0.
SEE ALSO
cgGetEffectParameterBuffer,cgSetProgramBuffer
perl v5.10.0 Cg Toolkit 3.0 351
cgSetErrorCallback(3) Cg Core Runtime API cgSetErrorCallback(3)
NAME cgSetErrorCallback −set the error callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGerrorCallbackFunc)( void );
void cgSetErrorCallback( CGerrorCallbackFunc func );
PARAMETERS
func A function pointer to the error callback function.
RETURN VALUES
None.
DESCRIPTION
cgSetErrorCallback sets a callback function that will be called every time an error occurrs. The callback
function is not passed anyparameters. It is assumed that the callback function will call cgGetError to
obtain the current error.Todisable the callback function, cgSetErrorCallback may be called with NULL.
EXAMPLES
The following is an example of howtoset and use an error callback :
void MyErrorCallback( void ) {
int myError = cgGetError();
fprintf(stderr, "CG ERROR : %s\n", cgGetErrorString(myError));
}
void main(int argc, char *argv[])
{
cgSetErrorCallback(MyErrorCallback);
/* Do stuff */
}
ERRORS
None.
HISTORY
cgSetErrorCallback wasintroduced in Cg 1.1.
SEE ALSO
cgGetErrorCallback, cgGetError,cgGetErrorString
perl v5.10.0 Cg Toolkit 3.0 352
cgSetErrorHandler(3) Cg Core Runtime API cgSetErrorHandler(3)
NAME cgSetErrorHandler −set the error handler callback function
SYNOPSIS
#include <Cg/cg.h>
typedef void (*CGerrorHandlerFunc)( CGcontext context,
CGerror error,
void * appdata );
void cgSetErrorHandler( CGerrorHandlerFunc func,
void * appdata );
PARAMETERS
func A pointer to the error handler callback function.
appdata A pointer to arbitrary application-provided data.
RETURN VALUES
None.
DESCRIPTION
cgSetErrorHandler specifies an error handler function that will be called every time a Cg runtime error
occurrs. The callback function is passed:
context
The context in which the error occured. If the context cannot be determined, NULL is used.
error
The enumerant of the error triggering the callback.
appdata
The value of the pointer passed to cgSetErrorHandler.This pointer can be used to makearbitrary
application-side information available to the error handler.
To disable the callback function, specify a NULL callback function pointer via cgSetErrorHandler.
EXAMPLES
void MyErrorHandler(CGcontext context, CGerror error, void *data) {
char *progname = (char *)data;
fprintf(stderr, "%s: Error: %s\n", progname, cgGetErrorString(error));
}
void main(int argc, char *argv[])
{
...
cgSetErrorHandler(MyErrorHandler, (void *)argv[0]);
...
}
ERRORS
to-be-written
HISTORY
cgSetErrorHandler wasintroduced in Cg 1.4.
SEE ALSO
cgGetErrorHandler,cgGetError,cgGetErrorString, cgGetFirstError
perl v5.10.0 Cg Toolkit 3.0 353
cgSetFloatAnnotation(3) Cg Core Runtime API cgSetFloatAnnotation(3)
NAME cgSetFloatAnnotation −set the value of a float annotation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetFloatAnnotation( CGannotation ann,
float value );
PARAMETERS
ann The annotation that will be set.
value The value to which ann will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the annotation.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetFloatAnnotation sets the value of an annotation of float type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of float type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.
HISTORY
cgSetFloatAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetFloatAnnotationValues, cgSetBoolAnnotation, cgSetIntAnnotation, cgSetStringAnnotation
perl v5.10.0 Cg Toolkit 3.0 354
cgSetFloatArrayStateAssignment(3) Cg Core Runtime API cgSetFloatArrayStateAssignment(3)
NAME cgSetFloatArrayStateAssignment −set a float-valued state assignment array
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetFloatArrayStateAssignment( CGstateassignment sa,
const float * vals );
PARAMETERS
sa A handle to a state assignment array of type CG_FLOAT,CG_FIXED,CG_HALF.
vals The values which will be used to set sa.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetFloatArrayStateAssignment sets the value of a state assignment of float array type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
float type.
HISTORY
cgSetFloatArrayStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetFloatStateAssignmentValues, cgSetFloatStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetIntArrayStateAssignment, cgSetIntStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 355
cgSetFloatStateAssignment(3) Cg Core Runtime API cgSetFloatStateAssignment(3)
NAME cgSetFloatStateAssignment −set the value of a state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetFloatStateAssignment( CGstateassignment sa,
float value );
PARAMETERS
sa A handle to a state assignment of type CG_FLOAT,CG_FIXED,orCG_HALF.
value The value to which sa will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetFloatStateAssignment sets the value of a state assignment of float type.
EXAMPLES
to-be-written
ERRORS
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
float type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
HISTORY
cgSetFloatStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetFloatStateAssignmentValues, cgSetFloatArrayStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetIntArrayStateAssignment, cgSetIntStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 356
cgSetIntAnnotation(3) Cg Core Runtime API cgSetIntAnnotation(3)
NAME cgSetIntAnnotation −set the value of an int annotation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetIntAnnotation( CGannotation ann,
int value );
PARAMETERS
ann The annotation that will be set.
value The value to which ann will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the annotation.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetIntAnnotation sets the value of an annotation of int type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of int type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.
HISTORY
cgSetIntAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetIntAnnotationValues, cgSetBoolAnnotation, cgSetFloatAnnotation, cgSetStringAnnotation
perl v5.10.0 Cg Toolkit 3.0 357
cgSetIntArrayStateAssignment(3) Cg Core Runtime API cgSetIntArrayStateAssignment(3)
NAME cgSetIntArrayStateAssignment −set an int-valued state assignment array
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetIntArrayStateAssignment( CGstateassignment sa,
const int * vals );
PARAMETERS
sa A handle to a state assignment array of type CG_INT.
vals The values which will be used to set sa.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetIntArrayStateAssignment sets the value of a state assignment of int array type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of an
int type.
HISTORY
cgSetIntArrayStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetIntStateAssignmentValues, cgSetIntStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 358
cgSetIntStateAssignment(3) Cg Core Runtime API cgSetIntStateAssignment(3)
NAME cgSetIntStateAssignment −set the value of an int state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetIntStateAssignment( CGstateassignment sa,
int value );
PARAMETERS
sa A handle to a state assignment of type CG_INT.
value The value to which sa will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetIntStateAssignment sets the value of a state assignment of int type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of an
int type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
HISTORY
cgSetIntStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetIntStateAssignmentValues, cgSetIntArrayStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment,
cgSetProgramStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 359
cgSetLastListing(3) Cg Core Runtime API cgSetLastListing(3)
NAME cgSetLastListing −set the current listing text
SYNOPSIS
#include <Cg/cg.h>
void cgSetLastListing( CGhandle handle,
const char * listing );
PARAMETERS
handle A CGcontext,CGstateassignment,CGeffect,CGpass,orCGtechnique belonging to the
context whose listing text is to be set.
listing The newlisting text.
RETURN VALUES
None.
DESCRIPTION
Each Cg context maintains a NULL-terminated string containing warning and error messages generated by
the Cg compiler,state managers and the like. cgSetLastListing allows applications and custom state
managers to set the listing text.
cgSetLastListing is not normally used directly by applications. Instead, custom state managers can use
cgSetLastListing to provide detailed technique validation error messages to the application.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if handle is invalid.
HISTORY
cgSetLastListing wasintroduced in Cg 1.4.
SEE ALSO
cgGetLastListing, cgCreateContext, cgSetErrorHandler
perl v5.10.0 Cg Toolkit 3.0 360
cgSetLockingPolicy(3) Cg Core Runtime API cgSetLockingPolicy(3)
NAME cgSetLockingPolicy −set locking policy
SYNOPSIS
#include <Cg/cg.h>
CGenum cgSetLockingPolicy( CGenum lockingPolicy );
PARAMETERS
lockingPolicy
An enumerant describing the desired locking policyfor the library.The following enumerants are
allowed:
CG_THREAD_SAFE_POLICY
Locks will be used to serialize thread access to the library.
CG_NO_LOCKS_POLICY
Locks will not be used.
RETURN VALUES
Returns the previous locking policy, orCG_UNKNOWN if an error occurs.
DESCRIPTION
cgSetLockingPolicy allows an application to change the locking policyused by the Cg library.The default
policyisCG_THREAD_SAFE_POLICY,meaning a lock is used to serialize access to the library by
mulitiple threads. Single threaded applications can change this policytoCG_NO_LOCKS_POLICY to
avoid the overhead associated with this lock. Multithreaded applications should neverchange this policy.
EXAMPLES
/* multithreaded apps should *never* do this */
cgSetLockingPolicy(CG_NO_LOCKS_POLICY);
ERRORS
CG_INVALID_ENUMERANT_ERROR is generated if lockingPolicy is not CG_NO_LOCKS_POLICY or
CG_THREAD_SAFE_POLICY.
HISTORY
cgSetLockingPolicy wasintroduced in Cg 2.0.
SEE ALSO
cgGetLockingPolicy
perl v5.10.0 Cg Toolkit 3.0 361
cgSetMatrixParameter(3) Cg Core Runtime API cgSetMatrixParameter(3)
NAME cgSetMatrixParameter −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float or double */
void cgSetMatrixParameter{ifd}{rc}( CGparameter param,
const TYPE * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values to which to set the matrix parameter.The array must be the number of rows
times the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
The cgSetMatrixParameter functions set the value of a givenmatrix parameter.The functions are
available in various combinations.
There are versions of each function that take int,float or double values signified by the i,for din the
function name.
There are versions of each function that assume the array of values are laid out in either roworcolumn
order signified by the ror cin the function name respectively.
The cgSetMatrixParameter functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
The dand fversions of cgSetMatrixParameter were introduced in Cg 1.2.
The iversions of cgSetMatrixParameter were introduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 362
cgSetMatrixParameterdc(3) Cg Core Runtime API cgSetMatrixParameterdc(3)
NAME cgSetMatrixParameterdc −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameterdc( CGparameter param,
const double * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameterdc sets the value of a givenmatrix parameter from an array of doubles laid out in
column-major order.
cgSetMatrixParameterdc may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameterdc wasintroduced in Cg 1.2.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 363
cgSetMatrixParameterdr(3) Cg Core Runtime API cgSetMatrixParameterdr(3)
NAME cgSetMatrixParameterdr −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameterdr( CGparameter param,
const double * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameterdr sets the value of a givenmatrix parameter from an array of doubles laid out in
row-major order.
cgSetMatrixParameterdr may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameterdr wasintroduced in Cg 1.2.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 364
cgSetMatrixParameterfc(3) Cg Core Runtime API cgSetMatrixParameterfc(3)
NAME cgSetMatrixParameterfc −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameterfc( CGparameter param,
const float * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameterfc sets the value of a givenmatrix parameter from an array of floats laid out in
column-major order.
cgSetMatrixParameterfc may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameterfc wasintroduced in Cg 1.2.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 365
cgSetMatrixParameterfr(3) Cg Core Runtime API cgSetMatrixParameterfr(3)
NAME cgSetMatrixParameterfr −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameterfr( CGparameter param,
const float * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameterfr sets the value of a givenmatrix parameter from an array of floats laid out in row-
major order.
cgSetMatrixParameterfr may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameterfr wasintroduced in Cg 1.2.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 366
cgSetMatrixParameteric(3) Cg Core Runtime API cgSetMatrixParameteric(3)
NAME cgSetMatrixParameteric −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameteric( CGparameter param,
const int * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameteric sets the value of a givenmatrix parameter from an array of ints laid out in
column-major order.
cgSetMatrixParameteric may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameteric wasintroduced in Cg 1.4.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 367
cgSetMatrixParameterir(3) Cg Core Runtime API cgSetMatrixParameterir(3)
NAME cgSetMatrixParameterir −sets the value of matrix parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetMatrixParameterir( CGparameter param,
const int * matrix );
PARAMETERS
param The parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgSetMatrixParameterir sets the value of a givenmatrix parameter from an array of ints laid out in row-
major order.
cgSetMatrixParameterir may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgSetMatrixParameterir wasintroduced in Cg 1.4.
SEE ALSO
cgSetMatrixParameter,cgGetParameterRows, cgGetParameterColumns, cgGetMatrixParameter,
cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 368
cgSetMultiDimArraySize(3) Cg Core Runtime API cgSetMultiDimArraySize(3)
NAME cgSetMultiDimArraySize −sets the size of a resizable multi-dimensional array parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetMultiDimArraySize( CGparameter param,
const int * sizes );
PARAMETERS
param The array parameter handle.
sizes An array of sizes for each dimension of the array.
RETURN VALUES
None.
DESCRIPTION
cgSetMultiDimArraySize sets the size of each dimension of resizable multi-dimensional array parameter
param.sizes must be an array that has Nnumber of elements where Nis equal to the result of
cgGetArrayDimension.
EXAMPLES
If you have Cgprogram with a parameter likethis :
/* ... */
float4 main(float4 myarray[][][])
{
/* ... */
}
Youcan set the sizes of each dimension of the myarray array parameter likeso:
const int sizes[] = { 3, 2, 4 };
CGparameter myArrayParam =
cgGetNamedProgramParameter(program, CG_PROGRAM, "myarray");
cgSetMultiDimArraySize(myArrayParam, sizes);
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_INVALID_POINTER_ERROR is generated if sizes is NULL.
CG_INVALID_PARAMETER_ERROR is generated if anyvalue in sizes is less than or equal to 0.
CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR is generated if param is not a resizable array.
HISTORY
cgSetMultiDimArraySize wasintroduced in Cg 1.2.
SEE ALSO
cgGetArraySize, cgGetArrayDimension, cgSetArraySize
perl v5.10.0 Cg Toolkit 3.0 369
cgSetParameter(3) Cg Core Runtime API cgSetParameter(3)
NAME cgSetParameter −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float or double */
void cgSetParameter1{ifd}( CGparameter param,
TYPE x );
void cgSetParameter2{ifd}( CGparameter param,
TYPE x,
TYPE y );
void cgSetParameter3{ifd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z );
void cgSetParameter4{ifd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z,
TYPE w );
void cgSetParameter{1234}{ifd}v( CGparameter param,
const TYPE * v );
PARAMETERS
param The parameter that will be set.
x, y,z,and w
The values to which to set the parameter.
vThe values to set the parameter to for the array versions of the set functions.
RETURN VALUES
None.
DESCRIPTION
The cgSetParameter functions set the value of a givenscalar or vector parameter.The functions are
available in various combinations.
Each function takes either 1, 2, 3, or 4 values depending on the function that is used. If more values are
passed in than the parameter requires, the extra values will be ignored.
There are versions of each function that take int,float or double values signified by the i,for din the
function name.
The functions with the vat the end of their names takeanarray of values instead of explicit parameters.
Once cgSetParameter has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
Note: Previous releases of Cg allowed you to store more values in a parameter than indicated by the
parameter’stype. For example, one could use cgGLSetParameter4f to store four values into a parameter of
type CG_FLOAT (not CG_FLOAT4). All four values could later be retrievedusing a get call which
requested more than one value. However, this feature conflicts with the GLSL approach and also leads to
perl v5.10.0 Cg Toolkit 3.0 370
cgSetParameter(3) Cg Core Runtime API cgSetParameter(3)
issues with parameters mapped into BUFFERS.Therefore, beginning with Cg 2.0 anycomponents
beyond the number indicated by the parameter type are ignored.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
The dand fversions of cgSetParameter were introduced in Cg 1.2.
The iversions of cgSetParameter were introduced in Cg 1.4.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 371
cgSetParameter1d(3) Cg Core Runtime API cgSetParameter1d(3)
NAME cgSetParameter1d −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1d( CGparameter param,
double x );
PARAMETERS
param The parameter that will be set.
xThe value to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1d sets the value of a givenscalar or vector parameter.
Once cgSetParameter1d has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1d wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 372
cgSetParameter1dv(3) Cg Core Runtime API cgSetParameter1dv(3)
NAME cgSetParameter1dv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1dv sets the value of a givenscalar or vector parameter.
Once cgSetParameter1dv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1dv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 373
cgSetParameter1f(3) Cg Core Runtime API cgSetParameter1f(3)
NAME cgSetParameter1f −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1f( CGparameter param,
float x );
PARAMETERS
param The parameter that will be set.
xThe value to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1f sets the value of a givenscalar or vector parameter.
Once cgSetParameter1f has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1f wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 374
cgSetParameter1fv(3) Cg Core Runtime API cgSetParameter1fv(3)
NAME cgSetParameter1fv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1fv sets the value of a givenscalar or vector parameter.
Once cgSetParameter1fv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1fv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 375
cgSetParameter1i(3) Cg Core Runtime API cgSetParameter1i(3)
NAME cgSetParameter1i −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1i( CGparameter param,
int x );
PARAMETERS
param The parameter that will be set.
xThe value to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1i sets the value of a givenscalar or vector parameter.
Once cgSetParameter1i has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1i wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 376
cgSetParameter1iv(3) Cg Core Runtime API cgSetParameter1iv(3)
NAME cgSetParameter1iv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter1iv( CGparameter param,
const int * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter1iv sets the value of a givenscalar or vector parameter.
Once cgSetParameter1iv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter1iv wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 377
cgSetParameter2d(3) Cg Core Runtime API cgSetParameter2d(3)
NAME cgSetParameter2d −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2d( CGparameter param,
double x,
double y );
PARAMETERS
param The parameter that will be set.
x, y The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2d sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2d has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2d wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 378
cgSetParameter2dv(3) Cg Core Runtime API cgSetParameter2dv(3)
NAME cgSetParameter2dv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2dv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2dv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2dv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 379
cgSetParameter2f(3) Cg Core Runtime API cgSetParameter2f(3)
NAME cgSetParameter2f −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2f( CGparameter param,
float x,
float y );
PARAMETERS
param The parameter that will be set.
x, y The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2f sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2f has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2f wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 380
cgSetParameter2fv(3) Cg Core Runtime API cgSetParameter2fv(3)
NAME cgSetParameter2fv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2fv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2fv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2fv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 381
cgSetParameter2i(3) Cg Core Runtime API cgSetParameter2i(3)
NAME cgSetParameter2i −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2i( CGparameter param,
int x,
int y );
PARAMETERS
param The parameter that will be set.
x, y The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2i sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2i has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2i wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 382
cgSetParameter2iv(3) Cg Core Runtime API cgSetParameter2iv(3)
NAME cgSetParameter2iv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter2iv( CGparameter param,
const int * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter2iv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter2iv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter2iv wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 383
cgSetParameter3d(3) Cg Core Runtime API cgSetParameter3d(3)
NAME cgSetParameter3d −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3d( CGparameter param,
double x,
double y,
double z );
PARAMETERS
param The parameter that will be set.
x, y,z The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3d sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3d has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3d wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 384
cgSetParameter3dv(3) Cg Core Runtime API cgSetParameter3dv(3)
NAME cgSetParameter3dv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3dv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3dv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3dv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 385
cgSetParameter3f(3) Cg Core Runtime API cgSetParameter3f(3)
NAME cgSetParameter3f −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3f( CGparameter param,
float x,
float y,
float z );
PARAMETERS
param The parameter that will be set.
x, y,z The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3f sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3f has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3f wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 386
cgSetParameter3fv(3) Cg Core Runtime API cgSetParameter3fv(3)
NAME cgSetParameter3fv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3fv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3fv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3fv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 387
cgSetParameter3i(3) Cg Core Runtime API cgSetParameter3i(3)
NAME cgSetParameter3i −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3i( CGparameter param,
int x,
int y,
int z );
PARAMETERS
param The parameter that will be set.
x, y,z The values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3i sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3i has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3i wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 388
cgSetParameter3iv(3) Cg Core Runtime API cgSetParameter3iv(3)
NAME cgSetParameter3iv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter3iv( CGparameter param,
const int * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter3iv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter3iv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter3iv wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 389
cgSetParameter4d(3) Cg Core Runtime API cgSetParameter4d(3)
NAME cgSetParameter4d −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4d( CGparameter param,
double x,
double y,
double z,
double w );
PARAMETERS
param The parameter that will be set.
x, y,z,wThe values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4d sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4d has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4d wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 390
cgSetParameter4dv(3) Cg Core Runtime API cgSetParameter4dv(3)
NAME cgSetParameter4dv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4dv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4dv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4dv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 391
cgSetParameter4f(3) Cg Core Runtime API cgSetParameter4f(3)
NAME cgSetParameter4f −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4f( CGparameter param,
float x,
float y,
float z,
float w );
PARAMETERS
param The parameter that will be set.
x, y,z,wThe values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4f sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4f has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4f wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 392
cgSetParameter4fv(3) Cg Core Runtime API cgSetParameter4fv(3)
NAME cgSetParameter4fv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4fv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4fv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4fv wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 393
cgSetParameter4i(3) Cg Core Runtime API cgSetParameter4i(3)
NAME cgSetParameter4i −set the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4i( CGparameter param,
int x,
int y,
int z,
int w );
PARAMETERS
param The parameter that will be set.
x, y,z,wThe values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4i sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4i has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4i wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue, cgGetParameterValues
perl v5.10.0 Cg Toolkit 3.0 394
cgSetParameter4iv(3) Cg Core Runtime API cgSetParameter4iv(3)
NAME cgSetParameter4iv −sets the value of scalar and vector parameters
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameter4iv( CGparameter param,
const int * v );
PARAMETERS
param The parameter that will be set.
vArray of values to use to set param.
RETURN VALUES
None.
DESCRIPTION
cgSetParameter4iv sets the value of a givenscalar or vector parameter.
If more values are passed in than param requires, the extra values will be ignored.
Once cgSetParameter4iv has been used to set a parameter,the values may be retrievedfrom the parameter
using the CG_CURRENT enumerant with cgGetParameterValues.
If an API-dependant layer of the Cg runtime (e.g. cgGL) is used, these entry points may end up making API
(e.g. OpenGL) calls.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
HISTORY
cgSetParameter4iv wasintroduced in Cg 1.4.
SEE ALSO
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 395
cgSetParameterSemantic(3) Cg Core Runtime API cgSetParameterSemantic(3)
NAME cgSetParameterSemantic −set a program parameter’ssemantic
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterSemantic( CGparameter param,
const char * semantic );
PARAMETERS
param The program parameter.
semantic The semantic.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterSemantic allows the application to set the semantic of a parameter in a Cg program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node, or if the semantic string is
NULL.
HISTORY
cgSetParameterSemantic wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterSemantic, cgGetSemanticCasePolicy, cgSetSemanticCasePolicy, cgGetParameterResource,
cgGetParameterResourceIndex, cgGetParameterName, cgGetParameterType
perl v5.10.0 Cg Toolkit 3.0 396
cgSetParameterSettingMode(3) Cg Core Runtime API cgSetParameterSettingMode(3)
NAME cgSetParameterSettingMode −set the parameter setting mode for a context
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterSettingMode( CGcontext context,
CGenum parameterSettingMode );
PARAMETERS
context The context in which to set the parameter setting mode.
parameterSettingMode
The mode to which context will be set. Must be one of the following :
CG_IMMEDIATE_PARAMETER_SETTING
CG_DEFERRED_PARAMETER_SETTING
RETURN VALUES
None.
DESCRIPTION
cgSetParameterSettingMode controls the behavior of the context when setting parameters. With deferred
parameter setting, the corresponding 3D API parameter is not immediately updated by cgSetParameter
commands. If the application does not need to access these 3D API parameter values, then this mode
allows improvedperformance by avoiding unnecessary 3D API calls.
Parameters of variability CG_VARYING are neverdeferred.
When the parameter setting mode is CG_DEFERRED_PARAMETER_SETTING,non-erroneous
cgSetParameter commands record the updated parameter value but do not immediately update the
corresponding 3D API parameter.Instead the parameter is marked internally as update deferred.The 3D
API commands required to update anyprogram parameters marked update deferred are performed as part of
the next program bind (see cgGLBindProgram, cgD3D9BindProgram, or cgD3D8BindProgram).
If a context’sparameter setting mode was CG_DEFERRED_PARAMETER_SETTING and one or more
parameters are marked update deferred,changing the parameter setting mode to
CG_IMMEDIATE_PARAMETER_SETTING does not cause parameters marked update deferred to be
updated. The application can use cgUpdateProgramParameters or cgUpdatePassParameters to force the
updating of parameters marked update deferred.
parameterSettingMode must be one of the following enumerants :
CG_IMMEDIATE_PARAMETER_SETTING
Non-erroneous cgSetParameter commands immediately update the corresponding 3D API parameter.
This is the default mode.
CG_DEFERRED_PARAMETER_SETTING
Non-erroneous cgSetParameter commands record the updated parameter value but do not immediately
update the corresponding 3D API parameter.These updates will happen during the next program bind.
The updates can be explicitly forced to occur by using cgUpdateProgramParameters or
cgUpdatePassParameters.
EXAMPLES
Change context to use deferred parameter updates:
cgSetParameterSettingMode(myCgContext, CG_DEFERRED_PARAMETER_SETTING);
Change context to its initial behavior of performing parameter updates immediately:
cgSetParameterSettingMode(myCgContext, CG_IMMEDIATE_PARAMETER_SETTING);
perl v5.10.0 Cg Toolkit 3.0 397
cgSetParameterSettingMode(3) Cg Core Runtime API cgSetParameterSettingMode(3)
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_INVALID_ENUMERANT_ERROR is generated if parameterSettingMode is not
CG_IMMEDIATE_PARAMETER_SETTING or CG_DEFERRED_PARAMETER_SETTING.
HISTORY
cgSetParameterSettingMode wasintroduced in Cg 2.0.
SEE ALSO
cgGetParameterSettingMode, cgUpdateProgramParameters, cgUpdatePassParameters, cgSetParameter,
cgSetParameterVariability,cgGetParameterVariability,cgGLBindProgram, cgD3D9BindProgram,
cgD3D8BindProgram
perl v5.10.0 Cg Toolkit 3.0 398
cgSetParameterValue(3) Cg Core Runtime API cgSetParameterValue(3)
NAME cgSetParameterValue −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
/* TYPE is int, float or double */
void cgSetParameterValue{ifd}{rc}( CGparameter param,
int nelements,
const TYPE * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValue allows the application to set the value of anynumeric parameter or parameter array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
There are versions of each function that take int,float or double values signified by the i,for din the
function name.
There are versions of each function that will cause anymatrices referenced by param to be initialized in
either row-major or column-major order,assignified by the ror cin the function name.
Forexample, cgSetParameterValueic sets the givenparameter using the supplied array of integer data, and
initializes matrices in column-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
Note: Previous releases of Cg allowed you to store more values in a parameter than indicated by the
parameter’stype. For example, one could use cgGLSetParameter4f to store four values into a parameter of
type CG_FLOAT (not CG_FLOAT4). All four values could later be retrievedusing a get call which
requested more than one value. However, this feature conflicts with the GLSL approach and also leads to
issues with parameters mapped into BUFFERS.Therefore, beginning with Cg 2.0 anycomponents beyond
the number indicated by the parameter type are ignored.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
perl v5.10.0 Cg Toolkit 3.0 399
cgSetParameterValue(3) Cg Core Runtime API cgSetParameterValue(3)
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
The cgSetParameterValue functions were introduced in Cg 1.4.
SEE ALSO
cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize, cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 400
cgSetParameterValuedc(3) Cg Core Runtime API cgSetParameterValuedc(3)
NAME cgSetParameterValuedc −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValuedc( CGparameter param,
int nelements,
const double * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValuedc allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in column-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValuedc wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 401
cgSetParameterValuedr(3) Cg Core Runtime API cgSetParameterValuedr(3)
NAME cgSetParameterValuedr −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValuedr( CGparameter param,
int nelements,
const double * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValuedr allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in row-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValuedr wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 402
cgSetParameterValuefc(3) Cg Core Runtime API cgSetParameterValuefc(3)
NAME cgSetParameterValuefc −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValuefc( CGparameter param,
int nelements,
const float * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValuefc allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in column-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValuefc wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 403
cgSetParameterValuefr(3) Cg Core Runtime API cgSetParameterValuefr(3)
NAME cgSetParameterValuefr −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValuefr( CGparameter param,
int nelements,
const float * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValuefr allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in row-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValuefr wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 404
cgSetParameterValueic(3) Cg Core Runtime API cgSetParameterValueic(3)
NAME cgSetParameterValueic −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValueic( CGparameter param,
int nelements,
const int * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValueic allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in column-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValueic wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 405
cgSetParameterValueir(3) Cg Core Runtime API cgSetParameterValueir(3)
NAME cgSetParameterValueir −set the value of anynumeric parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterValueir( CGparameter param,
int nelements,
const int * v );
PARAMETERS
param The program parameter whose value will be set.
nelementsThe number of elements in array v.
vSource buffer from which the parameter values will be read.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterValueir allows the application to set the value of anynumeric parameter or parameter
array.
The givenparameter must be a scalar,vector,matrix, or a (possibly multidimensional) array of scalars,
vectors, or matrices.
Anymatrices referenced by param to be initialized in row-major order.
If vis smaller than the total number of values in the givensource parameter,
CG_NOT_ENOUGH_DAT A_ERROR is generated.
The total number of values in a parameter,ntotal, may be computed as follow:
int nrows = cgGetParameterRows(param);
int ncols = cgGetParameterColumns(param);
int asize = cgGetArrayTotalSize(param);
int ntotal = nrows*ncols;
if (asize > 0) ntotal *= asize;
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is a varying input to a fragment program.
CG_INVALID_POINTER_ERROR is generated if vis NULL.
CG_NOT_ENOUGH_DAT A_ERROR is generated if nelements is less than the total size of param.
CG_NON_NUMERIC_PARAMETER_ERROR is generated if param is of a non-numeric type.
HISTORY
cgSetParameterValueir wasintroduced in Cg 1.4.
SEE ALSO
cgSetParameterValue, cgGetParameterRows, cgGetParameterColumns, cgGetArrayTotalSize,
cgGetParameterValue
perl v5.10.0 Cg Toolkit 3.0 406
cgSetParameterVariability(3) Cg Core Runtime API cgSetParameterVariability(3)
NAME cgSetParameterVariability −set a parameter’svariability
SYNOPSIS
#include <Cg/cg.h>
void cgSetParameterVariability( CGparameter param,
CGenum vary );
PARAMETERS
param The parameter.
vary The variability to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgSetParameterVariability allows the application to change the variability of a parameter.
Currently parameters may not be changed to or from CG_VARYING variability.Howev erparameters of
CG_UNIFORM and CG_LITERAL variability may be changed.
Valid values for vary include :
CG_UNIFORM
Auniform parameter is one whose value does not change with each invocation of a program, but
whose value can change between groups of program invocations.
CG_LITERAL
Aliteral parameter is folded out at compile time. Making a uniform parameter literal will often make
aprogram more efficient at the expense of requiring a compile every time the value is set.
CG_DEFAULT
By default, the variability of a parameter will be overridden by the a source parameter connected to it
unless it is changed with cgSetParameterVariability.Ifitisset to CG_DEFAULT it will restore the
default state of assuming the source parameters variability.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_ENUMERANT_ERROR is generated if vary is not CG_UNIFORM,CG_LITERAL,or
CG_DEFAULT.
CG_INVALID_PARAMETER_VARIABILITY_ERROR is generated if the parameter could not be changed
to the variability indicated by vary.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if vary is CG_LITERAL and param is a not a
numeric parameter.
HISTORY
cgSetParameterVariability wasintroduced in Cg 1.2.
SEE ALSO
cgGetParameterVariability
perl v5.10.0 Cg Toolkit 3.0 407
cgSetPassProgramParameters(3) Cg Core Runtime API cgSetPassProgramParameters(3)
NAME cgSetPassProgramParameters −set uniform parameters specified via a compile statement
SYNOPSIS
#include <Cg/cg.h>
void cgSetPassProgramParameters( CGprogram program );
PARAMETERS
program The program
RETURN VALUES
None.
DESCRIPTION
Giventhe handle to a program specified in a pass in a CgFX file, cgSetPassProgramParameters sets the
values of the program’suniform parameters giventhe expressions in the compile statement in the CgFX
file.
(This entrypoint is normally only needed by state managers and doesn’tneed to be called by users.)
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgSetPassProgramParameters wasintroduced in Cg 1.4.
SEE ALSO
cgCreateEffect, cgCreateEffectFromFile
perl v5.10.0 Cg Toolkit 3.0 408
cgSetPassState(3) Cg Core Runtime API cgSetPassState(3)
NAME cgSetPassState −calls the state setting callback functions for all state assignments in a pass
SYNOPSIS
#include <Cg/cg.h>
void cgSetPassState( CGpass pass );
PARAMETERS
pass The pass handle.
RETURN VALUES
None.
DESCRIPTION
cgSetPassState sets all of the graphics state defined in a pass by calling the state setting callbacks for all of
the state assignments in the pass.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_TECHNIQUE_ERROR is generated if the technique of which pass is a part has failed
validation.
HISTORY
cgSetPassState wasintroduced in Cg 1.4.
SEE ALSO
cgResetPassState, cgCallStateSetCallback
perl v5.10.0 Cg Toolkit 3.0 409
cgSetProgramBuffer(3) Cg Core Runtime API cgSetProgramBuffer(3)
NAME cgSetProgramBuffer −set a buffer for a program
SYNOPSIS
#include <Cg/cg.h>
void cgSetProgramBuffer( CGprogram program,
int bufferIndex,
CGbuffer buffer );
PARAMETERS
program The program for which the buffer will be set.
bufferIndex
The buffer indexofprogram to which buffer will be bound.
buffer The buffer to be bound.
RETURN VALUES
None.
DESCRIPTION
cgSetProgramBuffer sets the buffer for a givenbuffer indexofaprogram. A NULL buffer handle means
the givenbuffer indexshould not be bound to a buffer.
bufferIndex must be non-negative and within the program’srange of buffer indices. ForOpenGL
programs, bufferIndex can be 0 to 11. ForDirect3D10 programs, bufferIndex can be 0 to 15.
When the next program bind operation occurs, each buffer indexwhich is set to a valid buffer handle is
bound (along with the program) for use by the 3D API.Nobuffer bind operation occurs for buffer indices
bound to a NULL buffer handle.
EXAMPLES
cgSetProgramBuffer( myProgram, 2, myBuffer );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if bufferIndex is not within the valid range
of buffer indices for program.
HISTORY
cgSetProgramBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGetProgramBuffer,cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram
perl v5.10.0 Cg Toolkit 3.0 410
cgSetProgramProfile(3) Cg Core Runtime API cgSetProgramProfile(3)
NAME cgSetProgramProfile −set a program’sprofile
SYNOPSIS
#include <Cg/cg.h>
void cgSetProgramProfile( CGprogram program,
CGprofile profile );
PARAMETERS
program The program.
profile The profile to be used when compiling the program.
RETURN VALUES
None.
DESCRIPTION
cgSetProgramProfile allows the application to specify the profile to be used when compiling the given
program. When called, the program will be unloaded if it is currently loaded, and marked as uncompiled.
When the program is next compiled (see cgSetAutoCompile), the givenprofile will be used.
cgSetProgramProfile can be used to override the profile specified in a CgFX compile statement, or to
change the profile associated with a program created by a call to cgCreateProgram.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PROFILE_ERROR is generated if profile is not a valid profile enumerant.
HISTORY
cgSetProgramProfile wasintroduced in Cg 1.4.
SEE ALSO
cgGetProgramProfile, cgGetProfile, cgGetProfileString, cgCreateProgram, cgSetAutoCompile
perl v5.10.0 Cg Toolkit 3.0 411
cgSetProgramStateAssignment(3) Cg Core Runtime API cgSetProgramStateAssignment(3)
NAME cgSetProgramStateAssignment −set the value of a program state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetProgramStateAssignment( CGstateassignment sa,
CGprogram program );
PARAMETERS
sa A handle to a state assignment of type CG_PROGRAM_TYPE.
program The program object to which sa will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetProgramStateAssignment sets the value of a state assignment of program type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
program type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgSetProgramStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetProgramStateAssignmentValue, cgSetBoolArrayStateAssignment, cgSetBoolStateAssignment,
cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment, cgSetIntArrayStateAssignment,
cgSetIntStateAssignment, cgSetSamplerStateAssignment, cgSetStringStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 412
cgSetSamplerState(3) Cg Core Runtime API cgSetSamplerState(3)
NAME cgSetSamplerState −initializes the state specified for a sampler parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetSamplerState( CGparameter param );
PARAMETERS
param The parameter handle.
RETURN VALUES
None.
DESCRIPTION
cgSetSamplerState sets the sampler state for a sampler parameter that was specified via a sampler_state
block in a CgFX file. The corresponding sampler should be bound via the graphics API before this call is
made.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgSetSamplerState wasintroduced in Cg 1.4.
SEE ALSO
cgCreateSamplerState, cgGetFirstSamplerState, cgGetNamedSamplerState, cgGetNextState
perl v5.10.0 Cg Toolkit 3.0 413
cgSetSamplerStateAssignment(3) Cg Core Runtime API cgSetSamplerStateAssignment(3)
NAME cgSetSamplerStateAssignment −sets a state assignment to a sampler effect parameter.
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetSamplerStateAssignment( CGstateassignment sa,
CGparameter param );
PARAMETERS
sa A state assignment of a sampler type (one of CG_SAMPLER1D,CG_SAMPLER2D,
CG_SAMPLER3D,CG_SAMPLERCUBE,orCG_SAMPLERRECT).
param An effect parameter of a sampler type.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetSamplerStateAssignment sets a state assignment of a sampler type to an effect parameter of the
same sampler type.
EXAMPLES
CGparameter effectParam = cgCreateEffectParameter(effect,
"normalizeCube",
CG_SAMPLERCUBE);
CGstate state = cgGetNamedSamplerState(context, "TextureCubeMap");
CGstateassignment sa = cgCreateStateAssignment(technique, state);
CGbool ok = cgSetSamplerStateAssignment(sa, effectParam);
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
sampler type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgSetSamplerStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetSamplerStateAssignmentValue, cgSetTextureStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment,
cgSetIntArrayStateAssignment, cgSetIntStateAssignment, cgSetProgramStateAssignment,
cgSetStringStateAssignment
perl v5.10.0 Cg Toolkit 3.0 414
cgSetSemanticCasePolicy(3) Cg Core Runtime API cgSetSemanticCasePolicy(3)
NAME cgSetSemanticCasePolicy −set semantic case policy
SYNOPSIS
#include <Cg/cg.h>
CGenum cgSetSemanticCasePolicy( CGenum casePolicy );
PARAMETERS
casePolicy
An enumerant describing the desired semantic case policyfor the library.The following
enumerants are allowed:
CG_FORCE_UPPER_CASE_POLICY
Semantics strings will be converted to all upper-case letters. This is the default policy.
CG_UNCHANGED_CASE_POLICY
Semantic strings will be left unchanged.
RETURN VALUES
Returns the previous semantic case policy, orCG_UNKNOWN if an error occurs.
DESCRIPTION
cgSetSemanticCasePolicy allows an application to change the semantic case policyused by the Cg library.
ApolicyofCG_FORCE_UPPER_CASE_POLICY means that semantic strings returned by
cgGetParameterSemantic will have been converted to all upper-case letters. This is the default policyfor
the library.Ifthe policyischanged to CG_UNCHANGED_CASE_POLICY no case coversion will be done
to the semantic strings.
EXAMPLES
/* set to return original semantic strings */
cgSetSemanticCasePolicy(CG_UNCHANGED_CASE_POLICY);
ERRORS
CG_INVALID_ENUMERANT_ERROR is generated if casePolicy is not
CG_FORCE_UPPER_CASE_POLICY or CG_UNCHANGED_CASE_POLICY.
HISTORY
cgSetSemanticCasePolicy wasintroduced in Cg 2.0.
SEE ALSO
cgGetSemanticCasePolicy, cgGetParameterSemantic, cgSetParameterSemantic
perl v5.10.0 Cg Toolkit 3.0 415
cgSetStateCallbacks(3) Cg Core Runtime API cgSetStateCallbacks(3)
NAME cgSetStateCallbacks −registers the callback functions for a state assignment
SYNOPSIS
#include <Cg/cg.h>
void cgSetStateCallbacks( CGstate state,
CGstatecallback set,
CGstatecallback reset,
CGstatecallback validate );
PARAMETERS
state The state handle.
set The pointer to the callback function to call for setting the state of state assignments based on
state.This may be a NULL pointer.
reset The pointer to the callback function to call for resetting the state of state assignments based on
state.This may be a NULL pointer.
validate The pointer to the callback function to call for validating the state of state assignments based on
state.This may be a NULL pointer.
RETURN VALUES
None.
DESCRIPTION
cgSetStateCallbacks sets the three callback functions for a state definition. These functions are later
called when the state a particular state assignment based on this state must be set, reset, or validated. Any
of the callback functions may be specified as NULL.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
HISTORY
cgSetStateCallbacks wasintroduced in Cg 1.4.
SEE ALSO
cgSetPassState, cgCallStateSetCallback, cgCallStateResetCallback, cgCallStateValidateCallback,
cgValidateTechnique
perl v5.10.0 Cg Toolkit 3.0 416
cgSetStateLatestProfile(3) Cg Core Runtime API cgSetStateLatestProfile(3)
NAME cgSetStateLatestProfile −sets a state’sdesignated latest profile
SYNOPSIS
#include <Cg/cg.h>
CGprofile cgSetStateLatestProfile( CGstate state, CGprofile profile );
PARAMETERS
state The state handle.
profile The profile to designate as the state’slatest profile.
RETURN VALUES
None.
DESCRIPTION
cgSetStateLatestProfile sets the specified state’sdesignated latest profile for states of type
CG_PROGRAM_TYPE.
This profile is used to compile the program for a state assignment for the state where the profile in the
compile statement is the identifier latest.
EXAMPLES
This shows howtoforce the designated latest state profile for the FragmentProgram state assignment to
be the arbfp1 profile (evenifcgGLRegisterStates was to register a different profile).
cgGLRegisterStates(context);
CGstate state = cgGetNamedState(context, "FragmentProgram");
cgSetStateLatestProfile(state, CG_PROFILE_ARBFP1);
ERRORS
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if the type of state is not
CG_PROGRAM_TYPE.
HISTORY
cgSetStateLatestProfile wasintroduced in Cg 2.2.
SEE ALSO
cgGetNamedState, cgGetStateLatestProfile, cgGLRegisterStates
perl v5.10.0 Cg Toolkit 3.0 417
cgSetStringAnnotation(3) Cg Core Runtime API cgSetStringAnnotation(3)
NAME cgSetStringAnnotation −set the value of a string annotation
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetStringAnnotation( CGannotation ann,
const char * value );
PARAMETERS
ann The annotation that will be set.
value The value to which ann will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the annotation.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetStringAnnotation sets the value of an annotation of string type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_ANNOTATION_HANDLE_ERROR is generated if ann is not a valid annotation.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if ann is not an annotation of string type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if ann is not a scalar.
HISTORY
cgSetStringAnnotation wasintroduced in Cg 1.5.
SEE ALSO
cgGetStringAnnotationValue, cgSetBoolAnnotation, cgSetIntAnnotation, cgSetFloatAnnotation
perl v5.10.0 Cg Toolkit 3.0 418
cgSetStringParameterValue(3) Cg Core Runtime API cgSetStringParameterValue(3)
NAME cgSetStringParameterValue −set the value of a string parameter
SYNOPSIS
#include <Cg/cg.h>
void cgSetStringParameterValue( CGparameter param,
const char * value );
PARAMETERS
param The parameter whose value will be set.
value The string to set the parameter’svalue as.
RETURN VALUES
None.
DESCRIPTION
cgSetStringParameterValue allows the application to set the value of a string parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_TYPE_ERROR is generated if param is not string-typed.
CG_INVALID_PARAMETER_ERROR is generated if value is NULL.
HISTORY
cgSetStringParameterValue wasintroduced in Cg 1.4.
SEE ALSO
cgGetStringParameterValue
perl v5.10.0 Cg Toolkit 3.0 419
cgSetStringStateAssignment(3) Cg Core Runtime API cgSetStringStateAssignment(3)
NAME cgSetStringStateAssignment −set the value of a string state assignment
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetStringStateAssignment( CGstateassignment sa,
const char * value );
PARAMETERS
sa A handle to a state assignment of type CG_STRING.
value The value to which sa will be set.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetStringStateAssignment sets the value of a state assignment of string type.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of a
string type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
HISTORY
cgSetStringStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetStringStateAssignmentValue, cgSetBoolArrayStateAssignment, cgSetBoolStateAssignment,
cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment, cgSetIntArrayStateAssignment,
cgSetIntStateAssignment, cgSetProgramStateAssignment, cgSetSamplerStateAssignment,
cgSetTextureStateAssignment
perl v5.10.0 Cg Toolkit 3.0 420
cgSetTextureStateAssignment(3) Cg Core Runtime API cgSetTextureStateAssignment(3)
NAME cgSetTextureStateAssignment −sets a state assignment to a texture effect parameter
SYNOPSIS
#include <Cg/cg.h>
CGbool cgSetTextureStateAssignment( CGstateassignment sa,
CGparameter param );
PARAMETERS
sa A state assignment of type CG_TEXTURE.
param An effect parameter of type CG_TEXTURE.
RETURN VALUES
Returns CG_TRUE if it succeeds in setting the state assignment.
Returns CG_FALSE otherwise.
DESCRIPTION
cgSetTextureStateAssignment sets the value of a state assignment of texture type to an effect parameter of
type CG_TEXTURE.
EXAMPLES
CGparameter effectParam = cgCreateEffectParameter(effect,
"normalizeCube",
CG_SAMPLERCUBE);
CGstate state = cgGetNamedSamplerState(context, "Texture");
CGstateassignment sa = cgCreateSamplerStateAssignment(effectParam, state);
CGbool ok = cgSetTextureStateAssignment(sa, value);
ERRORS
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR is generated if sa is not a state assignment of
texture type.
CG_ARRAY_SIZE_MISMATCH_ERROR is generated if sa is an array and not a scalar.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgSetTextureStateAssignment wasintroduced in Cg 1.5.
SEE ALSO
cgGetTextureStateAssignmentValue, cgSetSamplerStateAssignment, cgSetBoolArrayStateAssignment,
cgSetBoolStateAssignment, cgSetFloatArrayStateAssignment, cgSetFloatStateAssignment,
cgSetIntArrayStateAssignment, cgSetIntStateAssignment, cgSetProgramStateAssignment,
cgSetStringStateAssignment
perl v5.10.0 Cg Toolkit 3.0 421
cgUnmapBuffer(3) Cg Core Runtime API cgUnmapBuffer(3)
NAME cgUnmapBuffer −unmap buffer from application’saddress space
SYNOPSIS
#include <Cg/cg.h>
void cgUnmapBuffer( CGbuffer buffer );
PARAMETERS
buffer The buffer which will be unmapped from the application’saddress space.
RETURN VALUES
None.
DESCRIPTION
cgUnmapBuffer unmaps a buffer from the application’saddress space.
EXAMPLES
unsigned char *bufferPtr = cgMapBuffer( myBuffer, CG_MAP_READ_WRITE );
memcpy( data, bufferPtr, size );
cgUnmapBuffer( myBuffer );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
HISTORY
cgUnmapBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgMapBuffer,cgSetBufferData, cgSetBufferSubData, cgSetParameter
perl v5.10.0 Cg Toolkit 3.0 422
cgUpdatePassParameters(3) Cg Core Runtime API cgUpdatePassParameters(3)
NAME cgUpdatePassParameters −update the deferred parameters for a pass
SYNOPSIS
#include <Cg/cg.h>
void cgUpdatePassParameters( CGpass pass );
PARAMETERS
pass The pass for which deferred parameters will be updated.
RETURN VALUES
None.
DESCRIPTION
cgUpdatePassParameters is a convenience routine which calls cgUpdateProgramParameters for all
programs of a pass.
EXAMPLES
cgSetParameterSettingMode(context, CG_DEFERRED_PARAMETER_SETTING);
CGeffect effect = cgCreateEffectFromFile( context, "tst.cgfx", NULL );
CGtechnique tech1 = cgGetNamedTechnique( effect, "tech1" );
CGpass pass1 = cgGetNamedPass( tech1, "pass1" );
cgSetPassState(pass1);
for (some number of times)
{
cgSetParameter(uniform1,...);
cgSetParameter(uniform2,...);
cgUpdatePassParameters(pass1);
DrawSomeGeometry();
}
cgResetPassState(pass1);
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if pass is not a valid pass handle.
HISTORY
cgUpdatePassParameters wasintroduced in Cg 2.1.
SEE ALSO
cgSetParameterSettingMode, cgGetParameterSettingMode, cgUpdateProgramParameters, cgSetParameter,
cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram
perl v5.10.0 Cg Toolkit 3.0 423
cgUpdateProgramParameters(3) Cg Core Runtime API cgUpdateProgramParameters(3)
NAME cgUpdateProgramParameters −update the 3D API state for deferred parameters
SYNOPSIS
#include <Cg/cg.h>
void cgUpdateProgramParameters( CGprogram program );
PARAMETERS
program The program for which deferred parameters will be sent to the corresponding 3D API parameters.
RETURN VALUES
None.
DESCRIPTION
cgUpdateProgramParameters performs the appropriate 3D API commands to set the 3D API resources for
all of program’s parameters that are marked update deferred and clears the update deferred state of these
parameters. cgUpdateProgramParameters does nothing when none of program’s parameters are marked
update deferred.
cgUpdateProgramParameters assumes the specified program has already been bound using the
appropriate 3D API commands. Results are undefined if the program is not actually bound by the 3D API
when cgUpdateProgramParameters is called, with the likely result being that the 3D API state for
program’s parameters will be mis-loaded.
EXAMPLES
/* assumes cgGetProgramContext(program) == context */
if (cgGetParameterSettingMode(context) == CG_DEFERRED_PARAMETER_SETTING) {
cgUpdateProgramParameters(program);
}
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgUpdateProgramParameters wasintroduced in Cg 2.0.
SEE ALSO
cgSetParameterSettingMode, cgGetParameterSettingMode, cgUpdatePassParameters, cgSetParameter,
cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram
perl v5.10.0 Cg Toolkit 3.0 424
cgValidateTechnique(3) Cg Core Runtime API cgValidateTechnique(3)
NAME cgValidateTechnique −validate a technique from an effect
SYNOPSIS
#include <Cg/cg.h>
CGbool cgValidateTechnique( CGtechnique tech );
PARAMETERS
tech The technique handle to validate.
RETURN VALUES
Returns CG_TRUE if all of the state assignments in all of the passes in tech are valid and can be used on
the current hardware.
Returns CG_FALSE if anystate assignment fails validation, or if an error occurs.
DESCRIPTION
cgValidateTechnique iterates overall of the passes of a technique and tests to see if every state assignment
in the pass passes validation.
EXAMPLES
CGcontext context = cgCreateContext();
CGeffect effect = cgCreateEffectFromFile(context, filename, NULL);
CGtechnique tech = cgGetFirstTechnique(effect);
while (tech && cgValidateTechnique(tech) == CG_FALSE) {
fprintf(stderr, "Technique %s did not validate. Skipping.\n",
cgGetTechniqueName(tech));
tech = cgGetNextTechnique(tech);
}
if (tech) {
fprintf(stderr, "Using technique %s.\n", cgGetTechniqueName(tech));
}else {
fprintf(stderr, "No valid technique found\n");
exit(1);
}
ERRORS
CG_INVALID_TECHNIQUE_HANDLE_ERROR is generated if tech is not a valid technique.
HISTORY
cgValidateTechnique wasintroduced in Cg 1.4.
SEE ALSO
cgCallStateValidateCallback, cgSetStateCallbacks
perl v5.10.0 Cg Toolkit 3.0 425
cgGLBindProgram(3) Cg OpenGL Runtime API cgGLBindProgram(3)
NAME cgGLBindProgram −bind a program to the current state
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLBindProgram( CGprogram program );
PARAMETERS
program The program to bind to the current state.
RETURN VALUES
None.
DESCRIPTION
cgGLBindProgram binds a program to the current state. The program must have been loaded with
cgGLLoadProgram before it can be bound. Also, the profile of the program must be enabled for the
binding to work. This may be done with the cgGLEnableProfile function.
Forprofiles that do not support program local parameters (e.g. the vp20 profile), cgGLBindProgram will
reset all uniform parameters that were set with anyofthe Cg parameter setting functions
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PROFILE_ERROR is generated if program’s profile is not a supported OpenGL profile.
CG_PROGRAM_BIND_ERROR is generated if the program fails to bind for anyreason.
HISTORY
cgGLBindProgram wasintroduced in Cg 1.1.
SEE ALSO
cgGLLoadProgram, cgGLSetParameter,cgGLSetMatrixParameter,cgGLSetTextureParameter,
cgGLEnableProfile
perl v5.10.0 Cg Toolkit 3.0 426
cgGLCreateBuffer(3) Cg OpenGL Runtime API cgGLCreateBuffer(3)
NAME cgGLCreateBuffer −create an OpenGL buffer object
SYNOPSIS
#include <Cg/cgGL.h>
CGbuffer cgGLCreateBuffer( CGcontext context,
int size,
const void *data,
GLenum bufferUsage );
PARAMETERS
context The context to which the newbuffer will be added.
size The length in bytes of the buffer to create.
data The inital data to be copied into the buffer. NULL will fill the buffer with zero.
bufferUsage
One of the usage flags specified as valid for glBufferData.
RETURN VALUES
Returns a CGbuffer handle on success.
Returns NULL if anyerror occurs.
DESCRIPTION
cgGLCreateBuffer creates an OpenGL buffer object.
EXAMPLES
CGbuffer myBuffer = cgGLCreateBuffer( myCgContext, sizeof( float ) * 16,
myData, GL_STATIC_DRAW );
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGLCreateBuffer wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLGetBufferObject
perl v5.10.0 Cg Toolkit 3.0 427
cgGLDisableClientState(3) Cg OpenGL Runtime API cgGLDisableClientState(3)
NAME cgGLDisableClientState −disables a vertexattribute in the OpenGL state
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLDisableClientState( CGparameter param );
PARAMETERS
param The varying parameter for which the client state will be disabled.
RETURN VALUES
None.
DESCRIPTION
cgGLDisableClientState disables the vertexattribute associated with the givenvarying parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is not a varying parameter.
HISTORY
cgGLDisableClientState wasintroduced in Cg 1.1.
SEE ALSO
cgGLEnableClientState
perl v5.10.0 Cg Toolkit 3.0 428
cgGLDisableProfile(3) Cg OpenGL Runtime API cgGLDisableProfile(3)
NAME cgGLDisableProfile −disable a profile within OpenGL
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLDisableProfile( CGprofile profile );
PARAMETERS
profile The enumerant for the profile to disable.
RETURN VALUES
None.
DESCRIPTION
cgGLDisableProfile disables a profile by making the necessary OpenGL calls. Formost profiles, this will
simply makeacall to glDisable with the approriate enumerant.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if profile is not a supported OpenGL profile.
HISTORY
cgGLDisableProfile wasintroduced in Cg 1.1.
SEE ALSO
cgGLEnableProfile
perl v5.10.0 Cg Toolkit 3.0 429
cgGLDisableProgramProfiles(3) Cg OpenGL Runtime API cgGLDisableProgramProfiles(3)
NAME cgGLDisableProgramProfiles −disable all profiles associated with a combined program
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLDisableProgramProfiles( CGprogram program );
PARAMETERS
program The combined program for which the profiles will be disabled.
RETURN VALUES
None.
DESCRIPTION
cgGLDisableProgramProfiles disables the profiles for all of the programs in a combined program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PROFILE_ERROR is generated if the profile for anyofthe programs in program is not a
supported OpenGL profile.
HISTORY
cgGLDisableProgramProfiles wasintroduced in Cg 1.5.
SEE ALSO
cgGLEnableProgramProfiles, cgCombinePrograms
perl v5.10.0 Cg Toolkit 3.0 430
cgGLDisableTextureParameter(3) Cg OpenGL Runtime API cgGLDisableTextureParameter(3)
NAME cgGLDisableTextureParameter −disables the texture unit associated with a texture parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLDisableTextureParameter( CGparameter param );
PARAMETERS
param The texture parameter which will be disabled.
RETURN VALUES
None.
DESCRIPTION
cgGLDisableTextureParameter unbinds and disables the texture object associated param.
See cgGLEnableTextureParameter for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAMETER_ERROR is generated if param is not a texture parameter or if the parameter
fails to set for anyother reason.
HISTORY
cgGLDisableTextureParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGLEnableTextureParameter,cgGLSetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 431
cgGLEnableClientState(3) Cg OpenGL Runtime API cgGLEnableClientState(3)
NAME cgGLEnableClientState −enables a vertexattribute in the OpenGL state
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLEnableClientState( CGparameter param );
PARAMETERS
param The varying parameter for which the client state will be enabled.
RETURN VALUES
None.
DESCRIPTION
cgGLEnableClientState enables the vertexattribute associated with the givenvarying parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is not a varying parameter.
HISTORY
cgGLEnableClientState wasintroduced in Cg 1.1.
SEE ALSO
cgGLDisableClientState
perl v5.10.0 Cg Toolkit 3.0 432
cgGLEnableProfile(3) Cg OpenGL Runtime API cgGLEnableProfile(3)
NAME cgGLEnableProfile −enable a profile within OpenGL
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLEnableProfile( CGprofile profile );
PARAMETERS
profile The enumerant for the profile to enable.
RETURN VALUES
None.
DESCRIPTION
cgGLEnableProfile enables a profile by making the necessary OpenGL calls. Formost profiles, this will
simply makeacall to glEnable with the approriate enumerant.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if profile is not a supported OpenGL profile.
HISTORY
cgGLEnableProfile wasintroduced in Cg 1.1.
SEE ALSO
cgGLDisableProfile
perl v5.10.0 Cg Toolkit 3.0 433
cgGLEnableProgramProfiles(3) Cg OpenGL Runtime API cgGLEnableProgramProfiles(3)
NAME cgGLEnableProgramProfiles −enable all profiles associated with a combined program
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLEnableProgramProfiles( CGprogram program );
PARAMETERS
program The combined program for which the profiles will be enabled.
RETURN VALUES
None.
DESCRIPTION
cgGLEnableProgramProfiles enables the profiles for all of the programs in a combined program.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_INVALID_PROFILE_ERROR is generated if the profile for anyofthe programs in program is not a
supported OpenGL profile.
HISTORY
cgGLEnableProgramProfiles wasintroduced in Cg 1.5.
SEE ALSO
cgGLDisableProgramProfiles, cgCombinePrograms
perl v5.10.0 Cg Toolkit 3.0 434
cgGLEnableTextureParameter(3) Cg OpenGL Runtime API cgGLEnableTextureParameter(3)
NAME cgGLEnableTextureParameter −enables the texture unit associated with a texture parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLEnableTextureParameter( CGparameter param );
PARAMETERS
param The texture parameter which will be enabled.
RETURN VALUES
None.
DESCRIPTION
cgGLEnableTextureParameter binds and enables the texture object associated with param.Itmust be
called after cgGLSetTextureParameter is called but before the geometry is drawn.
cgGLDisableTextureParameter should be called once all of the geometry is drawn to avoid applying the
texture to the wrong geometry and shaders.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile. In
particular,ifparam is not a parameter handle retrievedfrom a CGprogram butwas instead retrievedfrom
aCGeffect or is a shared parameter created at runtime, this error will be generated since those parameters
do not have a profile associated with them.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a texture parameter or if the enable
operation fails for anyother reason.
HISTORY
cgGLEnableTextureParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGLDisableTextureParameter,cgGLSetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 435
cgGLGetBufferObject(3) Cg OpenGL Runtime API cgGLGetBufferObject(3)
NAME cgGLGetBufferObject −get OpenGL buffer object for a buffer
SYNOPSIS
#include <Cg/cgGL.h>
GLuint cgGLGetBufferObject( CGbuffer buffer );
PARAMETERS
buffer The buffer for which the associated OpenGL buffer object will be retrieved.
RETURN VALUES
Returns the OpenGL buffer object associated with buffer.
Returns 0if an error occurs.
DESCRIPTION
cgGLGetBufferObject returns the OpenGL buffer object associated with a buffer.
EXAMPLES
GLuint id = cgGLGetBufferObject( myBuffer );
ERRORS
CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.
HISTORY
cgGLGetBufferObject wasintroduced in Cg 2.0.
SEE ALSO
cgCreateBuffer,cgGLCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 436
cgGLGetLatestProfile(3) Cg OpenGL Runtime API cgGLGetLatestProfile(3)
NAME cgGLGetLatestProfile −get the latest profile for a profile class
SYNOPSIS
#include <Cg/cgGL.h>
CGprofile cgGLGetLatestProfile( CGGLenum profileClass );
PARAMETERS
profileClass
The class of profile that will be returned. Must be one of the following :
CG_GL_VERTEX
CG_GL_GEOMETRY
CG_GL_FRAGMENT
CG_GL_TESSELLATION_CONTROL
CG_GL_TESSELLATION_EVALUATION
RETURN VALUES
Returns a profile enumerant for the latest profile of the givenclass.
Returns CG_PROFILE_UNKNOWN if no appropriate profile is available or an error occurs.
DESCRIPTION
cgGLGetLatestProfile returns the best available profile of a givenclass. The OpenGL extensions are
checked to determine the best profile which is supported by the current GPU,driver, and cgGL library
combination.
profileClass may be one of the following enumerants :
CG_GL_VERTEX
The latest available vertexprofile will be returned.
CG_GL_GEOMETRY
The latest available geometry profile will be returned.
CG_GL_FRAGMENT
The latest available fragment profile will be returned.
CG_GL_TESSELLATION_CONTROL
The latest available tessellation control profile will be returned.
CG_GL_TESSELLATION_EVALUATION
The latest available tessellation evaluation profile will be returned.
cgGLGetLatestProfile can be used in conjuction with cgCreateProgram to ensure that more optimal
profiles are used as theyare made available, eventhough theymight not have been available at compile
time or with a different version of the runtime.
Starting in Cg 2.2, certain environment variables can override the value returned by
cgGLGetLatestProfile:
If cgGLGetLatestProfile is called with profileClass being CG_GL_VERTEX and an environment variable
named CGGL_LATEST_VERTEX_PROFILE is set in the application’senvironment to a string that
cgGetProfile translates to a valid profile (meaning not CG_PROFILE_UNKNOWN), the CGprofile value
returned by cgGetProfile is returned by cgGLGetLatestProfile.
If cgGLGetLatestProfile is called with profileClass being CG_GL_GEOMETRY and an environment
variable named CGGL_LATEST_GEOMETRY_PROFILE is set in the application’senvironment to a string
that cgGetProfile translates to a valid profile (meaning not CG_PROFILE_UNKNOWN), the CGprofile
perl v5.10.0 Cg Toolkit 3.0 437
cgGLGetLatestProfile(3) Cg OpenGL Runtime API cgGLGetLatestProfile(3)
value returned by cgGetProfile is returned by cgGLGetLatestProfile.
If cgGLGetLatestProfile is called with profileClass being CG_GL_FRAGMENT and an environment
variable named CGGL_LATEST_FRAGMENT_PROFILE is set in the application’senvironment to a string
that cgGetProfile translates to a valid profile (meaning not CG_PROFILE_UNKNOWN), the CGprofile
value returned by cgGetProfile is returned by cgGLGetLatestProfile.
If cgGLGetLatestProfile is called with profileClass being CG_GL_TESSELLATION_CONTROL and an
environment variable named CGGL_LATEST_TESSELLATION_CONTROL_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), the CGprofile value returned by cgGetProfile is returned by
cgGLGetLatestProfile.
If cgGLGetLatestProfile is called with profileClass being CG_GL_TESSELLATION_EVALUATION and
an environment variable named CGGL_LATEST_TESSELLATION_EVALUATION_PROFILE is set in
the application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), the CGprofile value returned by cgGetProfile is returned by
cgGLGetLatestProfile.
EXAMPLES
/* Output information about available profiles */
printf("vertex profile: %s\n",
cgGetProfileString(cgGLGetLatestProfile(CG_GL_VERTEX)));
printf("geometry profile: %s\n",
cgGetProfileString(cgGLGetLatestProfile(CG_GL_GEOMETRY)));
printf("fragment profile: %s\n",
cgGetProfileString(cgGLGetLatestProfile(CG_GL_FRAGMENT)));
printf("tessellation control profile: %s\n",
cgGetProfileString(cgGLGetLatestProfile(CG_GL_TESSELLATION_CONTROL)));
printf("tessellation evalutation profile: %s\n",
cgGetProfileString(cgGLGetLatestProfile(CG_GL_TESSELLATION_EVALUATION)));
ERRORS
CG_INVALID_ENUMERANT_ERROR is generated if profileClass is not CG_GL_VERTEX,
CG_GL_GEOMETRY,CG_GL_FRAGMENT,CG_GL_TESSELLATION_CONTROL,or
CG_GL_TESSELLATION_EVALUATION.
HISTORY
cgGLGetLatestProfile wasintroduced in Cg 1.1.
CG_GL_GEOMETRY support was introduced in Cg 2.0.
CG_GL_TESSELLATION_CONTROL and CG_GL_TESSELLATION_EVALUATION support was
introduced in Cg 3.0.
SEE ALSO
cgGLSetOptimalOptions, cgCreateProgram
perl v5.10.0 Cg Toolkit 3.0 438
cgGLGetManageTextureParameters(3) Cg OpenGL Runtime API cgGLGetManageTextureParameters(3)
NAME cgGLGetManageTextureParameters −gets the manage texture parameters flag from a context
SYNOPSIS
#include <Cg/cgGL.h>
CGbool cgGLGetManageTextureParameters( CGcontext context );
PARAMETERS
context The context from which the automatic texture management setting will be retrieved.
RETURN VALUES
Returns the manage textures setting for context.
DESCRIPTION
cgGLGetManageTextureParameters gets the current manage textures setting from context.See
cgGLSetManageTextureParameters for more information.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGLGetManageTextureParameters wasintroduced in Cg 1.2.
SEE ALSO
cgGLSetManageTextureParameters, cgGLBindProgram, cgGLUnbindProgram
perl v5.10.0 Cg Toolkit 3.0 439
cgGLGetMatrixParameter(3) Cg OpenGL Runtime API cgGLGetMatrixParameter(3)
NAME cgGLGetMatrixParameter −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLGetMatrixParameter{fd}{rc}( CGparameter param,
TYPE * matrix );
PARAMETERS
param The matrix parameter from which the values will be retrieved.
matrix An array into which the values will be retrieved. The size must be the number of rows times the
number of columns of param.
RETURN VALUES
None.
DESCRIPTION
The cgGLGetMatrixParameter functions retrieve the values from a matrix parameter.
There are versions of the function that return either float or double values signified by for din the function
name.
There are versions of the function that assume the array of values is laid out in either roworcolumn order
signified by ror crespectively in the function name.
The cgGLGetMatrixParameter functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
The cgGLGetMatrixParameter functions were introduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameterArray,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 440
cgGLGetMatrixParameterArray(3) Cg OpenGL Runtime API cgGLGetMatrixParameterArray(3)
NAME cgGLGetMatrixParameterArray −get the values from an matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLGetMatrixParameterArray{fd}{rc}( CGparameter param,
long offset,
long nelements,
TYPE * v );
PARAMETERS
param The matrix array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array into which to retrieve the values. The size of the array must be nelements times the
number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
The cgGLGetMatrixParameterArray functions retrieve anarray of values from a matrix array parameter.
There are versions of the function that return either float or double values signified by for din the function
name.
There are versions of the function that assume the array of values is laid out in either roworcolumn order
signified by ror crespectively in the function name.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if the offset or the nelements parameter is out of
the array bounds.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
The cgGLGetMatrixParameterArray functions were introduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 441
cgGLGetMatrixParameterArraydc(3) Cg OpenGL Runtime API cgGLGetMatrixParameterArraydc(3)
NAME cgGLGetMatrixParameterArraydc −get the values from a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterArraydc( CGparameter param,
long offset,
long nelements,
double * v );
PARAMETERS
param The matrix array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array into which to retrieve the values. The size of vmust be nelements times the number of
elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterArraydc retrievesanarray of values from a matrix array parameter using
column-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterArraydc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 442
cgGLGetMatrixParameterArraydr(3) Cg OpenGL Runtime API cgGLGetMatrixParameterArraydr(3)
NAME cgGLGetMatrixParameterArraydr −get the values from a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterArraydr( CGparameter param,
long offset,
long nelements,
double * v );
PARAMETERS
param The matrix array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array into which to retrieve the values. The size of vmust be nelements times the number of
elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterArraydr retrievesanarray of values from a matrix array parameter using row-
major ordering.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterArraydr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 443
cgGLGetMatrixParameterArrayfc(3) Cg OpenGL Runtime API cgGLGetMatrixParameterArrayfc(3)
NAME cgGLGetMatrixParameterArrayfc −get the values from a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterArrayfc( CGparameter param,
long offset,
long nelements,
float * v );
PARAMETERS
param The matrix array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array into which to retrieve the values. The size of vmust be nelements times the number of
elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterArrayfc retrievesanarray of values from a matrix array parameter using
column-major ordering.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterArrayfc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 444
cgGLGetMatrixParameterArrayfr(3) Cg OpenGL Runtime API cgGLGetMatrixParameterArrayfr(3)
NAME cgGLGetMatrixParameterArrayfr −get the values from a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterArrayfr( CGparameter param,
long offset,
long nelements,
float * v );
PARAMETERS
param The matrix array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array into which to retrieve the values. The size of vmust be nelements times the number of
elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterArrayfr retrievesanarray of values from a matrix array parameter using row-
major ordering.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterArrayfr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 445
cgGLGetMatrixParameterdc(3) Cg OpenGL Runtime API cgGLGetMatrixParameterdc(3)
NAME cgGLGetMatrixParameterdc −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterdc( CGparameter param,
double * matrix );
PARAMETERS
param The matrix parameter from which the values will be retrieved.
matrix An array of doublesinto which the matrix values will be retrieved. The size must be the number
of rows times the number of columns of param.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterdc retrievesthe values from a matrix parameter using column-major ordering.
cgGLGetMatrixParameterdc may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterdc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameterArray,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 446
cgGLGetMatrixParameterdr(3) Cg OpenGL Runtime API cgGLGetMatrixParameterdr(3)
NAME cgGLGetMatrixParameterdr −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterdr( CGparameter param,
double * matrix );
PARAMETERS
param The matrix parameter from which the values will be retrieved.
matrix An array of doublesinto which the matrix values will be retrieved. The size must be the number
of rows times the number of columns of param.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterdr retrievesthe values from a matrix parameter using row-major ordering.
cgGLGetMatrixParameterdr may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterdr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameterArray,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 447
cgGLGetMatrixParameterfc(3) Cg OpenGL Runtime API cgGLGetMatrixParameterfc(3)
NAME cgGLGetMatrixParameterfc −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterfc( CGparameter param,
float * matrix );
PARAMETERS
param The matrix parameter from which the values will be retrieved.
matrix An array of floatsinto which the matrix values will be retrieved. The size must be the number of
rows times the number of columns of param.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterfc retrievesthe values from a matrix parameter using column-major ordering.
cgGLGetMatrixParameterfc may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterfc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameterArray,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 448
cgGLGetMatrixParameterfr(3) Cg OpenGL Runtime API cgGLGetMatrixParameterfr(3)
NAME cgGLGetMatrixParameterfr −get the values from a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetMatrixParameterfr( CGparameter param,
float * matrix );
PARAMETERS
param The matrix parameter from which the values will be retrieved.
matrix An array of floatsinto which the matrix values will be retrieved. The size must be the number of
rows times the number of columns of param.
RETURN VALUES
None.
DESCRIPTION
cgGLGetMatrixParameterfr retrievesthe values from a matrix parameter using row-major ordering.
cgGLGetMatrixParameterfr may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetMatrixParameterfr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameterArray,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 449
cgGLGetOptimalOptions(3) Cg OpenGL Runtime API cgGLGetOptimalOptions(3)
NAME cgGLGetOptimalOptions −get the best set of compiler options for a profile
SYNOPSIS
#include <Cg/cgGL.h>
char const ** cgGLGetOptimalOptions( CGprofile profile );
PARAMETERS
profile The profile whose optimal arguments are requested.
RETURN VALUES
Returns a null-terminated array of strings representing the optimal set of compiler options for profile.
Returns NULL if profile isn’tsupported by the current driverorGPU.
DESCRIPTION
cgGLGetOptimalOptions returns the best set of compiler options for a givenprofile on the current driver
and GPU.Note that different driver/GPU combinations might return different sets of options for the same
profile value.
The elements of the returned array are meant to be used as part of the args parameter to cgCreateProgram
or cgCreateProgramFromFile.
The strings returned for each value of profile remain valid until the next time cgGLGetOptimalOptions is
called with this profile value.
The application does not need to destroythe returned strings.
EXAMPLES
char const ** ppOptions = cgGLGetOptimalOptions(vertProfile);
if (ppOptions && *ppOptions) {
while (*ppOptions) {
printf("%s\n", *ppOptions);
ppOptions++;
}
}
const char* vertOptions[] ={myCustomArgs,
ppOptions,
NULL };
CGprogram myVS = cgCreateProgramFromFile( context,
CG_SOURCE,
"vshader.cg",
vertProfile,
"VertexShader",
vertOptions);
ERRORS
None.
HISTORY
cgGLGetOptimalOptions wasintroduced in Cg 2.2.
SEE ALSO
cgGLSetOptimalOptions, cgGLGetLatestProfile, cgCreateProgram, cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 450
cgGLGetParameter(3) Cg OpenGL Runtime API cgGLGetParameter(3)
NAME cgGLGetParameter −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLGetParameter{1234}{fd}( CGparameter param,
TYPE * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
The cgGLGetParameter functions extract the values set by cgGLSetParameter functions.
There are versions of the function that takeeither float or double values signified by for din the function
name.
Each function returns either 1, 2, 3, or 4 values.
These functions may only be called with uniform numeric parameters.
Note: Previous releases of Cg allowed you to store more values in a parameter than indicated by the
parameter’stype. For example, one could use cgGLSetParameter4f to store four values into a parameter of
type CG_FLOAT (not CG_FLOAT4). All four values could later be retrievedusing a get call which
requested more than one value. However, this feature conflicts with the GLSL approach and also leads to
issues with parameters mapped into BUFFERS.Therefore, beginning with Cg 2.0 anycomponents beyond
the number indicated by the parameter type are ignored.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
The cgGLGetParameter functions were introduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 451
cgGLGetParameter1d(3) Cg OpenGL Runtime API cgGLGetParameter1d(3)
NAME cgGLGetParameter1d −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter1d( CGparameter param,
double * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter1d extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter1d may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter1d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 452
cgGLGetParameter1f(3) Cg OpenGL Runtime API cgGLGetParameter1f(3)
NAME cgGLGetParameter1f −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter1f( CGparameter param,
float * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter1f extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter1f may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter1f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 453
cgGLGetParameter2d(3) Cg OpenGL Runtime API cgGLGetParameter2d(3)
NAME cgGLGetParameter2d −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter2d( CGparameter param,
double * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter2d extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter2d may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter2d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 454
cgGLGetParameter2f(3) Cg OpenGL Runtime API cgGLGetParameter2f(3)
NAME cgGLGetParameter2f −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter2f( CGparameter param,
float * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter2f extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter2f may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter2f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 455
cgGLGetParameter3d(3) Cg OpenGL Runtime API cgGLGetParameter3d(3)
NAME cgGLGetParameter3d −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter3d( CGparameter param,
double * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter3d extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter3d may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter3d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 456
cgGLGetParameter3f(3) Cg OpenGL Runtime API cgGLGetParameter3f(3)
NAME cgGLGetParameter3f −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter3f( CGparameter param,
float * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter3f extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter3f may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter3f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 457
cgGLGetParameter4d(3) Cg OpenGL Runtime API cgGLGetParameter4d(3)
NAME cgGLGetParameter4d −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter4d( CGparameter param,
double * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter4d extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter4d may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter4d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 458
cgGLGetParameter4f(3) Cg OpenGL Runtime API cgGLGetParameter4f(3)
NAME cgGLGetParameter4f −get the values from a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameter4f( CGparameter param,
float * v );
PARAMETERS
param The parameter from which the values will be retrieved.
vDestination buffer into which the values will be written.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameter4f extracts parameter values set by the cgGLSetParameter functions.
cgGLGetParameter4f may only be called with uniform numeric parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameter4f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 459
cgGLGetParameterArray(3) Cg OpenGL Runtime API cgGLGetParameterArray(3)
NAME cgGLGetParameterArray −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLGetParameterArray{1234}{fd}( CGparameter param,
long offset,
long nelements,
const TYPE * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be nelements times
the vector size indicated by the number in the function name.
RETURN VALUES
None.
DESCRIPTION
The cgGLGetParameterArray functions retrieve the values from a scalar or vector array parameter.
There are versions of each function that return either float or double values signified by for din the
function name.
Either 1, 2, 3, or 4 values per array element is returned depending on which function is used.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
The cgGLGetParameterArray functions were introduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 460
cgGLGetParameterArray1d(3) Cg OpenGL Runtime API cgGLGetParameterArray1d(3)
NAME cgGLGetParameterArray1d −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray1d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray1d retrievesthe values from a scalar or vector array parameter.
The function retrieves1value per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray1d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 461
cgGLGetParameterArray1f(3) Cg OpenGL Runtime API cgGLGetParameterArray1f(3)
NAME cgGLGetParameterArray1f −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray1f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray1f retrievesthe values from a scalar or vector array parameter.
The function retrieves1value per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray1f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 462
cgGLGetParameterArray2d(3) Cg OpenGL Runtime API cgGLGetParameterArray2d(3)
NAME cgGLGetParameterArray2d −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray2d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 2*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray2d retrievesthe values from a scalar or vector array parameter.
The function retrieves2values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray2d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 463
cgGLGetParameterArray2f(3) Cg OpenGL Runtime API cgGLGetParameterArray2f(3)
NAME cgGLGetParameterArray2f −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray2f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 2*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray2f retrievesthe values from a scalar or vector array parameter.
The function retrieves2values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray2f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 464
cgGLGetParameterArray3d(3) Cg OpenGL Runtime API cgGLGetParameterArray3d(3)
NAME cgGLGetParameterArray3d −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray3d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 3*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray3d retrievesthe values from a scalar or vector array parameter.
The function retrieves3values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray3d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 465
cgGLGetParameterArray3f(3) Cg OpenGL Runtime API cgGLGetParameterArray3f(3)
NAME cgGLGetParameterArray3f −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray3f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 3*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray3f retrievesthe values from a scalar or vector array parameter.
The function retrieves3values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray3f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 466
cgGLGetParameterArray4d(3) Cg OpenGL Runtime API cgGLGetParameterArray4d(3)
NAME cgGLGetParameterArray4d −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray4d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 4*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray4d retrievesthe values from a scalar or vector array parameter.
The function retrieves4values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray4d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 467
cgGLGetParameterArray4f(3) Cg OpenGL Runtime API cgGLGetParameterArray4f(3)
NAME cgGLGetParameterArray4f −get the values from an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLGetParameterArray4f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter from which the values will be retrieved.
offset An offset into the array parameter at which to start getting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to get. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vDestination buffer into which the values will be written. The size of vmust be 4*nelements.
RETURN VALUES
None.
DESCRIPTION
cgGLGetParameterArray4f retrievesthe values from a scalar or vector array parameter.
The function retrieves4values per array element.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
HISTORY
cgGLGetParameterArray4f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameter,cgGLSetParameterArray
perl v5.10.0 Cg Toolkit 3.0 468
cgGLGetProgramID(3) Cg OpenGL Runtime API cgGLGetProgramID(3)
NAME cgGLGetProgramID −get the OpenGL program ID associated with a program
SYNOPSIS
#include <Cg/cgGL.h>
GLuint cgGLGetProgramID( CGprogram program );
PARAMETERS
program The program for which the OpenGL program ID will be retrieved.
RETURN VALUES
Returns a GLuint associated with the GL program object for profiles that use program object.
Returns 0for profiles that do not have OpenGL programs (e.g. fp20).
DESCRIPTION
cgGLGetProgramID returns the identifier to the OpenGL program object associated with program.
cgGLGetProgramID should not be called before cgGLLoadProgram is called.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if program’s profile is not a supported OpenGL profile.
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGLGetProgramID wasintroduced in Cg 1.2.
SEE ALSO
cgGLLoadProgram, cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 469
cgGLGetTextureEnum(3) Cg OpenGL Runtime API cgGLGetTextureEnum(3)
NAME cgGLGetTextureEnum −get the OpenGL enumerant for the texture unit associated with a parameter
SYNOPSIS
#include <Cg/cgGL.h>
GLenum cgGLGetTextureEnum( CGparameter param );
PARAMETERS
param The texture parameter for which the OpenGL texture unit enumerant will be retrieved.
RETURN VALUES
Returns a GLenum of the form GL_TEXTURE#_ARB.
Returns GL_INVALID_OPERATION if an error occurs.
DESCRIPTION
cgGLGetTextureEnum returns the OpenGL enumerant for the texture unit assigned to param.The
enumerant has the form GL_TEXTURE#_ARB where #is the texture unit number.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a texture parameter or if the operation
fails for anyother reason.
HISTORY
cgGLGetTextureEnum wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 470
cgGLGetTextureParameter(3) Cg OpenGL Runtime API cgGLGetTextureParameter(3)
NAME cgGLGetTextureParameter −get the OpenGL object from a texture parameter
SYNOPSIS
#include <Cg/cgGL.h>
GLuint cgGLGetTextureParameter( CGparameter param );
PARAMETERS
param The texture parameter for which the OpenGL texture object will be retrieved.
RETURN VALUES
Returns the OpenGL object to which the texture was set.
Returns 0if the parameter has not been set.
DESCRIPTION
cgGLGetTextureParameter gets the OpenGL object from a texture parameter.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGLGetTextureParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetTextureParameter,cgGLGetParameter
perl v5.10.0 Cg Toolkit 3.0 471
cgGLIsProfileSupported(3) Cg OpenGL Runtime API cgGLIsProfileSupported(3)
NAME cgGLIsProfileSupported −determine if a profile is supported by cgGL
SYNOPSIS
#include <Cg/cgGL.h>
CGbool cgGLIsProfileSupported( CGprofile profile );
PARAMETERS
profile The profile which will be checked for support.
RETURN VALUES
Returns CG_TRUE if profile is supported by the cgGL library.
Returns CG_FALSE otherwise.
DESCRIPTION
cgGLIsProfileSupported returns CG_TRUE if the profile indicated by profile is supported by the cgGL
library.Aprofile may not be supported if required OpenGL extensions are not available.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGLIsProfileSupported wasintroduced in Cg 1.1.
SEE ALSO
cgGLEnableProfile, cgGLDisableProfile
perl v5.10.0 Cg Toolkit 3.0 472
cgGLIsProgramLoaded(3) Cg OpenGL Runtime API cgGLIsProgramLoaded(3)
NAME cgGLIsProgramLoaded −determine if a program is loaded
SYNOPSIS
#include <Cg/cgGL.h>
CGbool cgGLIsProgramLoaded( CGprogram program );
PARAMETERS
program The program which will be checked.
RETURN VALUES
Returns CG_TRUE if program has been loaded.
Returns CG_FALSE otherwise.
DESCRIPTION
cgGLIsProgramLoaded returns CG_TRUE if program has been loaded with cgGLLoadProgram and
CG_FALSE otherwise.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGLIsProgramLoaded wasintroduced in Cg 1.2.
SEE ALSO
cgGLLoadProgram cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 473
cgGLLoadProgram(3) Cg OpenGL Runtime API cgGLLoadProgram(3)
NAME cgGLLoadProgram −prepares a program for binding
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLLoadProgram( CGprogram program );
PARAMETERS
program The program which will be loaded.
RETURN VALUES
None.
DESCRIPTION
cgGLLoadProgram prepares a program for binding. All programs must be loaded before theycan be
bound to the current state. See cgGLBindProgram for more information about binding programs.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if program’s profile is not a supported OpenGL profile.
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
CG_PROGRAM_LOAD_ERROR is generated if the program fails to load for anyreason.
HISTORY
cgGLLoadProgram wasintroduced in Cg 1.1.
SEE ALSO
cgGLIsProgramLoaded, cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 474
cgGLRegisterStates(3) Cg OpenGL Runtime API cgGLRegisterStates(3)
NAME cgGLRegisterStates −registers graphics pass states for CgFX files
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLRegisterStates( CGcontext context );
PARAMETERS
context The context in which to register the states.
RETURN VALUES
None.
DESCRIPTION
cgGLRegisterStates registers a set of states for the passes in a CgFX effect file. These states correspond
to the set of OpenGL state that is relevant and/or useful to be setting in passes in effect files. See the Cg
User’sGuide for complete documentation of the states that are made available after calling
cgGLRegisterStates.
EXAMPLES
CGcontext context = cgCreateContext();
HGLRC glcontext = wglCreateContext(hdc);
wglMakeCurrent(hdc, glcontext);
cgGLRegisterStates(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgGLRegisterStates wasintroduced in Cg 1.4.
Starting with Cg 2.2, cgGLRegisterStates calls cgSetStateLatestProfile for program states it creates and
registers the latest profile returned by cgGLGetLatestProfile for the appropriate program domain.
SEE ALSO
cgCreateState, cgSetStateLatestProfile, cgSetPassState, cgResetPassState, cgCallStateValidateCallback,
cgD3D9RegisterStates
perl v5.10.0 Cg Toolkit 3.0 475
cgGLSetDebugMode(3) Cg OpenGL Runtime API cgGLSetDebugMode(3)
NAME cgGLSetDebugMode −control whether the cgGL runtime calls glGetError
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetDebugMode( CGbool debug );
PARAMETERS
debug Flag indicating whether the library should use OpenGL error checking.
RETURN VALUES
None.
DESCRIPTION
The OpenGL Cg runtime calls glGetError at various points to verify that no errors have occurred. While
this is helpful during development, the resulting performance penalty may be deemed too severe.
cgGLSetDebugMode allows the application to turn offthe OpenGL error checking if so desired.
EXAMPLES
cgGLSetDebugMode( CG_TRUE ); // Enables debug mode
cgGLSetDebugMode( CG_FALSE ); // Disables debug mode
ERRORS
None.
HISTORY
cgGLSetDebugMode wasintroduced in Cg 1.5.
SEE ALSO
cgSetErrorHandler,cgGetError
perl v5.10.0 Cg Toolkit 3.0 476
cgGLSetManageTextureParameters(3) Cg OpenGL Runtime API cgGLSetManageTextureParameters(3)
NAME cgGLSetManageTextureParameters −set the manage texture parameters flag for a context
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetManageTextureParameters( CGcontext context,
CGbool flag );
PARAMETERS
context The context in which the automatic texture management behavior will be changed.
flag A boolean switch which controls automatic texture management by the runtime.
RETURN VALUES
None.
DESCRIPTION
By default, cgGL does not manage anytexture state in OpenGL. It is up to the user to enable and disable
textures using cgGLEnableTextureParameter and cgGLDisableTextureParameter respectively.This
behavior is the default in order to avoid conflicts with texture state on geometry that’srendered with the
fixed function pipeline or without cgGL.
If automatic texture management is desired, cgGLSetManageTextureParameters may be called with flag
set to CG_TRUE before cgGLBindProgram is called. WhenevercgGLBindProgram is called, the cgGL
runtime will makeall the appropriate texture parameter calls on the application’sbehalf.
cgGLUnbindProgram may be used to reset the texture state
Calling cgGLSetManageTextureParameters with flag set to CG_FALSE will disable automatic texture
management.
NOTE:When cgGLSetManageTextureParameters is set to CG_TRUE,applications should not make
texture state change calls to OpenGL (such as glBindTexture,glActiveTexture,etc.) after calling
cgGLBindProgram, unless the application is trying to override some parts of cgGL’s texture management.
EXAMPLES
to-be-written
ERRORS
None.
HISTORY
cgGLSetManageTextureParameters wasintroduced in Cg 1.2.
SEE ALSO
cgGLGetManageTextureParameters, cgGLBindProgram, cgGLUnbindProgram
perl v5.10.0 Cg Toolkit 3.0 477
cgGLSetMatrixParameter(3) Cg OpenGL Runtime API cgGLSetMatrixParameter(3)
NAME cgGLSetMatrixParameter −set the value of a matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLSetMatrixParameter{fd}{rc}( CGparameter param,
const TYPE * matrix );
PARAMETERS
param The matrix parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
The cgGLSetMatrixParameter functions set the value of a matrix parameter.
There are versions of the function that takeeither float or double values signified by for din the function
name.
There are versions of the function that assume the array of values are laid out in either roworcolumn order
signified by ror cin the function name respectively.
The cgGLSetMatrixParameter functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_POINTER_ERROR is generated if matrix is NULL.
CG_INVALID_PARAMETER_ERROR is generated if the operation fails for anyother reason.
HISTORY
The cgGLSetMatrixParameter functions were introduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameter,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 478
cgGLSetMatrixParameterArray(3) Cg OpenGL Runtime API cgGLSetMatrixParameterArray(3)
NAME cgGLSetMatrixParameterArray −set the value of an array matrix parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLSetMatrixParameterArray{fd}{rc}( CGparameter param,
long offset,
long nelements,
const TYPE * v );
PARAMETERS
param The matrix array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values to which to set the parameter.This must be a contiguous set of values with
size nelements times the number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
The cgGLSetMatrixParameterArray functions set the value of a scalar or vector array parameter.
There are versions of the function that takeeither float or double values signified by for din the function
name.
There are versions of the function that assume the array of values are laid out in either roworcolumn order
signified by ror cin the function name respectively.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
The cgGLSetMatrixParameterArray functions were introduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameterArray
perl v5.10.0 Cg Toolkit 3.0 479
cgGLSetMatrixParameterArraydc(3) Cg OpenGL Runtime API cgGLSetMatrixParameterArraydc(3)
NAME cgGLSetMatrixParameterArraydc −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterArraydc( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The matrix array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values to which to set the parameter.This must be a contiguous set of values with
size nelements times the number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterArraydc sets the value of a matrix array parameter from an array of doubles
laid out in column-major order.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterArraydc wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameterArray
perl v5.10.0 Cg Toolkit 3.0 480
cgGLSetMatrixParameterArraydr(3) Cg OpenGL Runtime API cgGLSetMatrixParameterArraydr(3)
NAME cgGLSetMatrixParameterArraydr −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterArraydr( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The matrix array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values to which to set the parameter.This must be a contiguous set of values with
size nelements times the number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterArraydr sets the value of a matrix array parameter from an array of doubles
laid out in row-major order.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterArraydr wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameterArray
perl v5.10.0 Cg Toolkit 3.0 481
cgGLSetMatrixParameterArrayfc(3) Cg OpenGL Runtime API cgGLSetMatrixParameterArrayfc(3)
NAME cgGLSetMatrixParameterArrayfc −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterArrayfc( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The matrix array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values to which to set the parameter.This must be a contiguous set of values with
size nelements times the number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterArrayfc sets the value of a matrix array parameter from an array of floatslaid
out in column-major order.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterArrayfc wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameterArray
perl v5.10.0 Cg Toolkit 3.0 482
cgGLSetMatrixParameterArrayfr(3) Cg OpenGL Runtime API cgGLSetMatrixParameterArrayfr(3)
NAME cgGLSetMatrixParameterArrayfr −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterArrayfr( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The matrix array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values to which to set the parameter.This must be a contiguous set of values with
size nelements times the number of elements in the matrix.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterArrayfr sets the value of a matrix array parameter from an array of floatslaid
out in row-major order.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_NOT_MATRIX_PARAM_ERROR is generated if the elements of param are not matrix parameters.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterArrayfr wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameterArray
perl v5.10.0 Cg Toolkit 3.0 483
cgGLSetMatrixParameterdc(3) Cg OpenGL Runtime API cgGLSetMatrixParameterdc(3)
NAME cgGLSetMatrixParameterdc −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterdc( CGparameter param,
const double * matrix );
PARAMETERS
param The matrix parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterdc sets the value of a matrix parameter from an array of doubleslaid out in
column-major order.
cgGLSetMatrixParameterdc functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterdc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameter,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 484
cgGLSetMatrixParameterdr(3) Cg OpenGL Runtime API cgGLSetMatrixParameterdr(3)
NAME cgGLSetMatrixParameterdr −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterdr( CGparameter param,
const double * matrix );
PARAMETERS
param The matrix parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterdr sets the value of a matrix parameter from an array of doubleslaid out in
row-major order.
cgGLSetMatrixParameterdr functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterdr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameter,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 485
cgGLSetMatrixParameterfc(3) Cg OpenGL Runtime API cgGLSetMatrixParameterfc(3)
NAME cgGLSetMatrixParameterfc −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterfc( CGparameter param,
const float * matrix );
PARAMETERS
param The matrix parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterfc sets the value of a matrix parameter from an array of floatslaid out in
column-major order.
cgGLSetMatrixParameterfc functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterfc wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameter,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 486
cgGLSetMatrixParameterfr(3) Cg OpenGL Runtime API cgGLSetMatrixParameterfr(3)
NAME cgGLSetMatrixParameterfr −set the values of a matrix array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetMatrixParameterfr( CGparameter param,
const float * matrix );
PARAMETERS
param The matrix parameter that will be set.
matrix An array of values used to set the matrix parameter.The array must be the number of rows times
the number of columns in size.
RETURN VALUES
None.
DESCRIPTION
cgGLSetMatrixParameterfr sets the value of a matrix parameter from an array of floatslaid out in row-
major order.
cgGLSetMatrixParameterfr functions may only be called with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetMatrixParameterfr wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetMatrixParameter,cgGLSetMatrixParameterArray,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 487
cgGLSetOptimalOptions(3) Cg OpenGL Runtime API cgGLSetOptimalOptions(3)
NAME cgGLSetOptimalOptions −set the implicit compiler optimization options for a profile
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetOptimalOptions( CGprofile profile );
PARAMETERS
profile The profile for which the optimal options will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetOptimalOptions sets implicit compiler arguments that are appended to the argument list passed
to cgCreateProgram. The arguments are chosen based on the the available compiler arguments, GPU,and
driver.
The arguments will be appended to the argument list every time cgCreateProgram is called until the last
CGcontext is destroyed, after which this function should be called again.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if profile is not a supported OpenGL profile.
HISTORY
cgGLSetOptimalOptions wasintroduced in Cg 1.1.
SEE ALSO
cgCreateProgram
perl v5.10.0 Cg Toolkit 3.0 488
cgGLSetParameter(3) Cg OpenGL Runtime API cgGLSetParameter(3)
NAME cgGLSetParameter −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLSetParameter1{fd}( CGparameter param,
TYPE x );
void cgGLSetParameter2{fd}( CGparameter param,
TYPE x,
TYPE y );
void cgGLSetParameter3{fd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z );
void cgGLSetParameter4{fd}( CGparameter param,
TYPE x,
TYPE y,
TYPE z,
TYPE w );
void cgGLSetParameter{1234}{fd}v( CGparameter param,
const TYPE * v );
PARAMETERS
param The parameter that will be set.
x, y,z,and w
The values used to set the parameter.
vAnarray of values used to set the parameter for the array versions of the set functions.
RETURN VALUES
None.
DESCRIPTION
The cgGLSetParameter functions set the value of a scalar or vector parameter.
The function takes either 1, 2, 3, or 4 values depending on which version is used. If more values are passed
in than the parameter requires, the extra values will be ignored.
There are versions of each function that takeeither float or double values signified by for din the function
name.
The functions with vat the end of their names takeanarray of values instead of explicit parameters.
The cgGLSetParameter functions may be called with either uniform or varying parameters. When called
with a varying parameter,the appropriate immediate mode OpenGL entry point will be called. However,
the cgGLGetParameter functions will only work with uniform parameters.
Note: Previous releases of Cg allowed you to store more values in a parameter than indicated by the
parameter’stype. For example, one could use cgGLSetParameter4f to store four values into a parameter of
type CG_FLOAT (not CG_FLOAT4). All four values could later be retrievedusing a get call which
requested more than one value. However, this feature conflicts with the GLSL approach and also leads to
issues with parameters mapped into BUFFERS.Therefore, beginning with Cg 2.0 anycomponents beyond
the number indicated by the parameter type are ignored.
perl v5.10.0 Cg Toolkit 3.0 489
cgGLSetParameter(3) Cg OpenGL Runtime API cgGLSetParameter(3)
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
The cgGLSetParameter functions were introduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 490
cgGLSetParameter1d(3) Cg OpenGL Runtime API cgGLSetParameter1d(3)
NAME cgGLSetParameter1d −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter1d( CGparameter param,
double x );
PARAMETERS
param The parameter that will be set.
xThe value to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter1d sets the value of a scalar or vector parameter.
cgGLSetParameter1d may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter1d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 491
cgGLSetParameter1dv(3) Cg OpenGL Runtime API cgGLSetParameter1dv(3)
NAME cgGLSetParameter1dv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter1dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter1dv sets the values of a scalar or vector parameter from the givenarray of values.
cgGLSetParameter1dv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter1dv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 492
cgGLSetParameter1f(3) Cg OpenGL Runtime API cgGLSetParameter1f(3)
NAME cgGLSetParameter1f −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter1f( CGparameter param,
float x );
PARAMETERS
param The parameter that will be set.
xThe value to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter1f sets the value of a scalar or vector parameter.
cgGLSetParameter1f may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter1f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 493
cgGLSetParameter1fv(3) Cg OpenGL Runtime API cgGLSetParameter1fv(3)
NAME cgGLSetParameter1fv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter1fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter1fv sets the values of a scalar or vector parameter from the givenarray of values.
cgGLSetParameter1fv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter1fv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 494
cgGLSetParameter2d(3) Cg OpenGL Runtime API cgGLSetParameter2d(3)
NAME cgGLSetParameter2d −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter2d( CGparameter param,
double x,
double y );
PARAMETERS
param The parameter that will be set.
x, y The values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter2d sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter2d may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter2d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 495
cgGLSetParameter2dv(3) Cg OpenGL Runtime API cgGLSetParameter2dv(3)
NAME cgGLSetParameter2dv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter2dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter2dv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter2dv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter2dv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 496
cgGLSetParameter2f(3) Cg OpenGL Runtime API cgGLSetParameter2f(3)
NAME cgGLSetParameter2f −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter2f( CGparameter param,
float x,
float y );
PARAMETERS
param The parameter that will be set.
x, y The values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter2f sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter2f may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter2f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 497
cgGLSetParameter2fv(3) Cg OpenGL Runtime API cgGLSetParameter2fv(3)
NAME cgGLSetParameter2fv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter2fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter2fv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter2fv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter2fv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 498
cgGLSetParameter3d(3) Cg OpenGL Runtime API cgGLSetParameter3d(3)
NAME cgGLSetParameter3d −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter3d( CGparameter param,
double x,
double y,
double z );
PARAMETERS
param The parameter that will be set.
x, y,z The values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter3d sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter3d may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter3d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 499
cgGLSetParameter3dv(3) Cg OpenGL Runtime API cgGLSetParameter3dv(3)
NAME cgGLSetParameter3dv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter3dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter3dv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter3dv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter3dv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 500
cgGLSetParameter3f(3) Cg OpenGL Runtime API cgGLSetParameter3f(3)
NAME cgGLSetParameter3f −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter3f( CGparameter param,
float x,
float y,
float z );
PARAMETERS
param The parameter that will be set.
x, y,z The values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter3f sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter3f may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter3f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 501
cgGLSetParameter3fv(3) Cg OpenGL Runtime API cgGLSetParameter3fv(3)
NAME cgGLSetParameter3fv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter3fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter3fv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter3fv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter3fv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 502
cgGLSetParameter4d(3) Cg OpenGL Runtime API cgGLSetParameter4d(3)
NAME cgGLSetParameter4d −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter4d( CGparameter param,
double x,
double y,
double z,
double w );
PARAMETERS
param The parameter that will be set.
x, y,z,wThe values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter4d sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter4d may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter4d wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 503
cgGLSetParameter4dv(3) Cg OpenGL Runtime API cgGLSetParameter4dv(3)
NAME cgGLSetParameter4dv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter4dv( CGparameter param,
const double * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter4dv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter4dv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter4dv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 504
cgGLSetParameter4f(3) Cg OpenGL Runtime API cgGLSetParameter4f(3)
NAME cgGLSetParameter4f −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter4f( CGparameter param,
float x,
float y,
float z,
float w );
PARAMETERS
param The parameter that will be set.
x, y,z,wThe values to which param will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter4f sets the value of a scalar or vector parameter.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter4f may be called with uniform or varying parameters. When called with a varying
parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter4f wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 505
cgGLSetParameter4fv(3) Cg OpenGL Runtime API cgGLSetParameter4fv(3)
NAME cgGLSetParameter4fv −set the values of a scalar or vector parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameter4fv( CGparameter param,
const float * v );
PARAMETERS
param The parameter that will be set.
vArray of values used to set param.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameter4fv sets the values of a scalar or vector parameter from the givenarray of values.
If more values are passed in than the parameter requires, the extra values will be ignored.
cgGLSetParameter4fv may be called with either uniform or varying parameters. When called with a
varying parameter,the appropriate immediate mode OpenGL entry point will be called. However, the
cgGLGetParameter functions only work with uniform parameters.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameter4fv wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetParameter,cgGLSetParameterArray,cgGLSetMatrixParameter,cgGLSetMatrixParameterArray,
cgGLSetTextureParameter,cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 506
cgGLSetParameterArray(3) Cg OpenGL Runtime API cgGLSetParameterArray(3)
NAME cgGLSetParameterArray −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
/* TYPE is float or double */
void cgGLSetParameterArray{1234}{fd}( CGparameter param,
long offset,
long nelements,
const TYPE * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of values that total
nelements times the vector size indicated by the number in the function name.
RETURN VALUES
None.
DESCRIPTION
The cgGLSetParameterArray functions set the value of a scalar or vector array parameter.
Either 1, 2, 3, or 4 values per array element will be set, depending on which function is used.
There are versions of the function that takeeither float or double values signified by for din the function
name.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
The cgGLSetParameterArray functions were introduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 507
cgGLSetParameterArray1d(3) Cg OpenGL Runtime API cgGLSetParameterArray1d(3)
NAME cgGLSetParameterArray1d −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray1d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of nelements values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray1d sets 1 value per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray1d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 508
cgGLSetParameterArray1f(3) Cg OpenGL Runtime API cgGLSetParameterArray1f(3)
NAME cgGLSetParameterArray1f −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray1f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of nelements values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray1f sets 1 value per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray1f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 509
cgGLSetParameterArray2d(3) Cg OpenGL Runtime API cgGLSetParameterArray2d(3)
NAME cgGLSetParameterArray2d −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray2d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 2*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray2d sets 2 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray2d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 510
cgGLSetParameterArray2f(3) Cg OpenGL Runtime API cgGLSetParameterArray2f(3)
NAME cgGLSetParameterArray2f −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray2f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 2*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray2f sets 2 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray2f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 511
cgGLSetParameterArray3d(3) Cg OpenGL Runtime API cgGLSetParameterArray3d(3)
NAME cgGLSetParameterArray3d −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray3d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 3*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray3d sets 3 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray3d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 512
cgGLSetParameterArray3f(3) Cg OpenGL Runtime API cgGLSetParameterArray3f(3)
NAME cgGLSetParameterArray3f −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray3f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 3*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray3f sets 3 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray3f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 513
cgGLSetParameterArray4d(3) Cg OpenGL Runtime API cgGLSetParameterArray4d(3)
NAME cgGLSetParameterArray4d −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray4d( CGparameter param,
long offset,
long nelements,
const double * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 4*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray4d sets 4 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray4d wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 514
cgGLSetParameterArray4f(3) Cg OpenGL Runtime API cgGLSetParameterArray4f(3)
NAME cgGLSetParameterArray4f −set the values of an array parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterArray4f( CGparameter param,
long offset,
long nelements,
const float * v );
PARAMETERS
param The array parameter that will be set.
offset An offset into the array parameter at which to start setting elements. Avalue of 0will begin at
the first element of the array.
nelementsThe number of elements to set. Avalue of 0will default to the total number of elements in the
array minus the value of offset.
vThe array of values used to set the parameter.This must be a contiguous set of 4*nelements
values.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterArray4f sets 4 values per element of a scalar or vector array parameter.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_ARRAY_PARAM_ERROR is generated if param is not an array parameter.
CG_OUT_OF_ARRAY_BOUNDS_ERROR is generated if offset or nelements is outside the bounds of
param.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterArray4f wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter,cgGLGetParameterArray
perl v5.10.0 Cg Toolkit 3.0 515
cgGLSetParameterPointer(3) Cg OpenGL Runtime API cgGLSetParameterPointer(3)
NAME cgGLSetParameterPointer −sets a varying parameter with an attribute array
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetParameterPointer( CGparameter param,
GLint fsize,
GLenum type,
GLsizei stride,
const GLvoid * pointer );
PARAMETERS
param The parameter that will be set.
fsize The number of coordinates per vertex.
type The data type of each coordinate. Possible values are GL_UNSIGNED_BYTE,GL_SHORT,
GL_INT,GL_FLOAT,and GL_DOUBLE.
stride The byte offset between consecutive vertices. When stride is 0the array is assumed to be tightly
packed.
pointer The pointer to the first coordinate in the vertexarray.
RETURN VALUES
None.
DESCRIPTION
cgGLSetParameterPointer sets a varying parameter to a givenvertexarray in the typical OpenGL style.
See the OpenGL documentation on the various vertexarray functions (e.g. glVertexPointer,
glNormalPointer,etc...) for more information.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_UNSUPPORTED_GL_EXTENSION_ERROR is generated if param required an OpenGL extension that
is not available.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetParameterPointer wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 516
cgGLSetStateMatrixParameter(3) Cg OpenGL Runtime API cgGLSetStateMatrixParameter(3)
NAME cgGLSetStateMatrixParameter −set the values of a matrix parameter to a matrix in the OpenGL state
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetStateMatrixParameter( CGparameter param,
CGGLenum matrix,
CGGLenum transform );
PARAMETERS
param The matrix parameter that will be set.
matrix An enumerant indicating which matrix should be retrievedfrom the OpenGL state. Must be one
of the following :
CG_GL_MODELVIEW_MATRIX
CG_GL_PROJECTION_MATRIX
CG_GL_TEXTURE_MATRIX
CG_GL_MODELVIEW_PROJECTION_MATRIX
transformAn enumerant indicating an optional transformation that may be applied to the matrix before it is
set. Must be one of the following :
CG_GL_MATRIX_IDENTITY
CG_GL_MATRIX_TRANSPOSE
CG_GL_MATRIX_INVERSE
CG_GL_MATRIX_INVERSE_TRANSPOSE
RETURN VALUES
None.
DESCRIPTION
cgGLSetStateMatrixParameter sets a matrix parameter to the values retrievedfrom an OpenGL state
matrix. The state matrix to retrieve isindicated by matrix,which may be one of the following :
CG_GL_MODELVIEW_MATRIX
Get the current modelviewmatrix.
CG_GL_PROJECTION_MATRIX
Get the current projection matrix.
CG_GL_TEXTURE_MATRIX
Get the current texture matrix.
CG_GL_MODELVIEW_PROJECTION_MATRIX
Get the concatenated modelviewand projection matrices.
The transform parameter specifies an optional transformation which will be applied to the retrievedmatrix
before setting the values in the parameter. transform must be one of the following :
CG_GL_MATRIX_IDENTITY
Don’tapply anytransform, leaving the matrix as is.
CG_GL_MATRIX_TRANSPOSE
Transpose the matrix.
perl v5.10.0 Cg Toolkit 3.0 517
cgGLSetStateMatrixParameter(3) Cg OpenGL Runtime API cgGLSetStateMatrixParameter(3)
CG_GL_MATRIX_INVERSE
Invert the matrix.
CG_GL_MATRIX_INVERSE_TRANSPOSE
Transpose and invert the matrix.
cgGLSetStateMatrixParameter may only be called with a uniform matrix parameter.Ifthe size of the
matrix is less than 4x4, the upper left corner of the matrix that fits into the givenmatrix parameter will be
returned.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.
CG_INVALID_ENUMERANT_ERROR is generated if either matrix or transform is not one of the allowed
enumerant values.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for anyother reason.
HISTORY
cgGLSetStateMatrixParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGLSetMatrixParameter,cgGLGetMatrixParameter
perl v5.10.0 Cg Toolkit 3.0 518
cgGLSetTextureParameter(3) Cg OpenGL Runtime API cgGLSetTextureParameter(3)
NAME cgGLSetTextureParameter −sets the value of a texture parameter
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetTextureParameter( CGparameter param,
GLuint texobj );
PARAMETERS
param The texture parameter that will be set.
texobj An OpenGL texture object name to which the parameter will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetTextureParameter sets the value of a texture parameter to an OpenGL texture object.
Note that in order to use the texture, either cgGLEnableTextureParameter must be called after
cgGLSetTextureParameter and before the geometry is drawn, or cgGLSetManageTextureParameters must
be called with a value of CG_TRUE.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a texture parameter or if the parameter
fails to set for anyother reason.
HISTORY
cgGLSetTextureParameter wasintroduced in Cg 1.1.
SEE ALSO
cgGLGetTextureParameter,cgGLSetParameter
perl v5.10.0 Cg Toolkit 3.0 519
cgGLSetupSampler(3) Cg OpenGL Runtime API cgGLSetupSampler(3)
NAME cgGLSetupSampler −initializes a sampler’sstate and texture object handle
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLSetupSampler( CGparameter param,
GLuint texobj );
PARAMETERS
param The sampler parameter that will be set.
texobj An OpenGL texture object name to which the parameter will be set.
RETURN VALUES
None.
DESCRIPTION
cgGLSetupSampler initializes a sampler; likecgGLSetTextureParameter,itinforms the OpenGL Cg
runtime which OpenGL texture object to associate with the sampler.Furthermore, if the sampler was
defined in the source file with a sampler_state block that specifies sampler state, this sampler state is
initialized for the giventexture object.
Note that in order to use the texture, either cgGLEnableTextureParameter must be called after
cgGLSetTextureParameter and before the geometry is drawn, or cgGLSetManageTextureParameters must
be called with a value of CG_TRUE.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if param’s profile is not a supported OpenGL profile.
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.
CG_INVALID_PARAMETER_ERROR is generated if param is not a texture parameter or if the parameter
fails to set for anyother reason.
HISTORY
cgGLSetupSampler wasintroduced in Cg 1.4.
SEE ALSO
cgGLSetTextureParameter,cgGLGetTextureParameter,cgGLSetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 520
cgGLUnbindProgram(3) Cg OpenGL Runtime API cgGLUnbindProgram(3)
NAME cgGLUnbindProgram −unbinds the program bound in a profile
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLUnbindProgram( CGprofile profile );
PARAMETERS
profile The profile from which to unbind anybound program.
RETURN VALUES
None.
DESCRIPTION
cgGLUnbindProgram unbinds the program which is bound in the profile specified by profile.Italso
resets the texture state back to the state it was in at the point cgGLBindProgram was first called with a
program in the givenprofile.
EXAMPLES
to-be-written
ERRORS
CG_INVALID_PROFILE_ERROR is generated if profile is not a supported OpenGL profile.
HISTORY
cgGLUnbindProgram wasintroduced in Cg 1.2.
SEE ALSO
cgGLSetManageTextureParameters, cgGLBindProgram
perl v5.10.0 Cg Toolkit 3.0 521
cgGLUnloadProgram(3) Cg OpenGL Runtime API cgGLUnloadProgram(3)
NAME cgGLUnloadProgram −destroythe OpenGL shader object associated with a program
SYNOPSIS
#include <Cg/cgGL.h>
void cgGLUnloadProgram( CGprogram program );
PARAMETERS
program The program for which to destroythe shader object. The CGprogram handle is still valid after
this call.
RETURN VALUES
None.
DESCRIPTION
cgGLUnloadProgram destroys the OpenGL shader object for a program.
This call does not destroythe CGprogram itself, only the associated GL shader object. Use
cgDestroyProgram to free the CGprogram itself. Also note that freeing a CGprogram using the core
runtime implicitly calls this routine to avoid resource leaks.
EXAMPLES
// prog is a CGprogram initialized elsewhere
...
cgGLUnloadProgram(prog);
CGbool loaded = cgGLIsProgramLoaded(prog); // loaded == CG_FALSE
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgGLUnloadProgram wasintroduced in Cg 2.1.
SEE ALSO
cgGLLoadProgram, cgGLIsProgramLoaded, cgDestroyProgram
perl v5.10.0 Cg Toolkit 3.0 522
cgD3D11BindProgram(3) Cg Direct3D11 Runtime API cgD3D11BindProgram(3)
NAME cgD3D11BindProgram −activate a program with D3D
SYNOPSIS
#include <Cg/cgD3D11.h>
HRESULT cgD3D11BindProgram( CGprogram program );
PARAMETERS
program The program to activate with D3D.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D11BindProgram activates a program with D3D. The program is activated using
ID3D11DeviceContext::VSSetShader or ID3D11DeviceContext::PSSetShader depending on the
program’sprofile type.
D3D allows only one vertexshader and one pixel shader to be active atany giv e ntime, so activating a
program of a giventype implicitly deactivates anyother program of a that type.
EXAMPLES
// vertexProg and pixelProg are CGprograms initialized elsewhere
// pDevContext is an ID3D11DeviceContext interface intialized elsewhere
...
HRESULT hr = cgD3D11BindProgram(vertexProg);
HRESULT hr2 = cgD3D11BindProgram(pixelProg);
ERRORS
E_FAIL is returned if program wasnot loaded with the cgD3D11LoadProgram.
E_FAIL is returned if a required D3D device is NULL.This usually occurs when an expanded interface
routine is called but a D3D device has not been set with cgD3D11SetDevice.
HISTORY
cgD3D11BindProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11LoadProgram, cgD3D11SetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 523
cgD3D11GetBufferByIndex(3) Cg Direct3D11 Runtime API cgD3D11GetBufferByIndex(3)
NAME cgD3D11GetBufferByIndex −Returns a pointer to an ID3D11Buffer interface by the constant buffer
index.
SYNOPSIS
#include <Cg/cgD3D11.h>
ID3D11Buffer * cgD3D11GetBufferByIndex( CGprogram Program.
UINT Index );
PARAMETERS
Program The Cg program containing the buffer.
IndexAzero-based index.
RETURN VALUES
Returns a pointer to an ID3D11Buffer interface containing the constant buffer.
DESCRIPTION
cgD3D11GetBufferByIndex returns a pointer to an ID3D11Buffer interface containing the constant buffer
for manual manipulation. If the user manually changes the constant values in this way,the constant values
contained in the corresponding CGbuffer (if exists) will be stale.
EXAMPLES
ID3D11Buffer * myConstantBuffer = cgD3D11GetBufferByIndex( myCgProgram, 0 );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR if Program is not a valid Cg program.
HISTORY
cgD3D11GetBufferByIndex wasintroduced in Cg 3.0.
SEE ALSO
cgCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 524
cgD3D11GetCompiledProgram(3) Cg Direct3D11 Runtime API cgD3D11GetCompiledProgram(3)
NAME cgD3D11GetCompiledProgram −Gets the compiled shader as a ID3DBlob returned from Direct3D after
cgD3D11LoadProgram is called.
SYNOPSIS
#include <Cg/cgD3D11.h>
ID3DBlob * cgD3D11GetCompiledProgram( CGprogram program );
PARAMETERS
program The program handle after a call to cgD3D11LoadProgram has been made.
RETURN VALUES
Returns a pointer to a ID3DBlob object containing the compiled shader code.
Returns NULL if the program was not loaded.
DESCRIPTION
cgD3D11GetCompiledProgram allows the user to get back the compiled shader from Direct3D once
cgD3D11LoadProgram has been called.
EXAMPLES
CGprogram myCgProgram = cgCreateProgram( ... ); cgD3D11LoadProgram( myCgProgram, 0 );
ID3DBlob * obj = cgD3D11GetCompiledProgram( myCgProgram );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if the program is invalid.
HISTORY
cgD3D11GetCompiledProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11LoadProgram
perl v5.10.0 Cg Toolkit 3.0 525
cgD3D11GetDevice(3) Cg Direct3D11 Runtime API cgD3D11GetDevice(3)
NAME cgD3D11GetDevice −retrievesthe current D3D11 device associated with a context
SYNOPSIS
#include <Cg/cgD3D11.h>
ID3D11Device * cgD3D11GetDevice( CGcontext context );
PARAMETERS
context The context from which to get the current device.
RETURN VALUES
Returns the current D3D11 device associated with context.
DESCRIPTION
cgD3D11GetDevice retrievesthe current D3D11 device associated with context.Note that the returned
device pointer may be NULL.
EXAMPLES
ID3D11Device* curDevice = cgD3D11GetDevice(ctx);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgD3D11GetDevice wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetDevice
perl v5.10.0 Cg Toolkit 3.0 526
cgD3D11GetIASignatureByPass(3) Cg Direct3D11 Runtime API cgD3D11GetIASignatureByPass(3)
NAME cgD3D11GetIASignatureByPass −Gets the compiled vertexshader signature as a ID3DBlob from a pass
of a validated technique.
SYNOPSIS
#include <Cg/cgD3D11.h>
ID3DBlob * cgD3D11GetIASignatureByPass( CGpass pass );
PARAMETERS
pass The pass handle after validation of a CgFX technique.
RETURN VALUES
Returns a pointer to a ID3DBlob object containing the vertexshader signature.
Returns NULL if the program was not loaded.
DESCRIPTION
cgD3D11GetIASignatureByPass allows the user to get back the vertexshader signature of a pass of a
validated CgFX technique.
EXAMPLES
myCgEffect = cgCreateEffectFromFile( myCgContext, ‘‘effect.cgfx’’, NULL ); myCgTechnique =
cgGetFirstTechnique( myCgEffect );
if( cgValidateTechnique( myCgTechnique ) != CG_FALSE ){
const D3D11_INPUT_ELEMENT_DESC layout[] =
{{‘POSITION’’,0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,
D3D11_INPUT_PER_VERTEX_DAT A,0},
};
CGpass myPass = cgGetFirstPass( myCgTechnique );
ID3DBlob * pVSBuf = cgD3D11GetIASignatureByPass( myPass );
hr = pDevice−>CreateInputLayout( layout, 1, pVSBuf−>GetBufferPointer(),
pVSBuf−>GetBufferSize(), &g_pVertexLayout );
}
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if the pass is invalid.
HISTORY
cgD3D11GetIASignatureByPass wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetCompiledProgram
perl v5.10.0 Cg Toolkit 3.0 527
cgD3D11GetLastError(3) Cg Direct3D11 Runtime API cgD3D11GetLastError(3)
NAME cgD3D11GetLastError −get the last D3D error that occurred
SYNOPSIS
#include <Cg/cgD3D11.h>
HRESULT cgD3D11GetLastError( void );
PARAMETERS
None.
RETURN VALUES
Returns the last D3D error that occurred during an expanded interface function call.
Returns D3D_OK if no D3D error has occurred since the last call to cgD3D11GetLastError.
DESCRIPTION
cgD3D11GetLastError retrievesthe last D3D error that occurred during an expanded interface function
call. The last error is always cleared immediately after the call.
EXAMPLES
HRESULT lastError = cgD3D11GetLastError();
ERRORS
None.
HISTORY
cgD3D11GetLastError wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11TranslateHRESULT
perl v5.10.0 Cg Toolkit 3.0 528
cgD3D11GetLatestDomainProfile(3) Cg Direct3D11 Runtime API cgD3D11GetLatestDomainProfile(3)
NAME cgD3D11GetLatestDomainProfile −get the latest supported domain shader version
SYNOPSIS
#include <Cg/cgD3D11.h>
CGprofile cgD3D11GetLatestDomainProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest domain shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D11GetLatestDomainProfile retrievesthe latest domain shader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 3.0, if the environment variable CGD3D11_LATEST_DOMAIN_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D11GetLatestDomainProfile.
EXAMPLES
CGprofile bestDomainProfile = cgD3D11GetLatestDomainProfile();
ERRORS
None.
HISTORY
cgD3D11GetLatestDomainProfile wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestGeometryProfile, cgD3D11GetLatestHullProfile, cgD3D11GetLatestPixelProfile,
cgD3D11GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 529
cgD3D11GetLatestGeometryProfile(3) Cg Direct3D11 Runtime API cgD3D11GetLatestGeometryProfile(3)
NAME cgD3D11GetLatestGeometryProfile −get the latest supported geometry shader version
SYNOPSIS
#include <Cg/cgD3D11.h>
CGprofile cgD3D11GetLatestGeometryProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest geometry shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D11GetLatestGeometryProfile retrievesthe latest geometry shader version that the current D3D
device supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 3.0, if the environment variable CGD3D11_LATEST_GEOMETRY_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D11GetLatestGeometryProfile.
EXAMPLES
CGprofile bestGeometryProfile = cgD3D11GetLatestGeometryProfile();
ERRORS
None.
HISTORY
cgD3D11GetLatestGeometryProfile wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestDomainProfile, cgD3D11GetLatestHullProfile, cgD3D11GetLatestPixelProfile,
cgD3D11GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 530
cgD3D11GetLatestHullProfile(3) Cg Direct3D11 Runtime API cgD3D11GetLatestHullProfile(3)
NAME cgD3D11GetLatestHullProfile −get the latest supported hull shader version
SYNOPSIS
#include <Cg/cgD3D11.h>
CGprofile cgD3D11GetLatestHullProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest hull shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D11GetLatestHullProfile retrievesthe latest hull shader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 3.0, if the environment variable CGD3D11_LATEST_HULL_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D11GetLatestHullProfile.
EXAMPLES
CGprofile bestHullProfile = cgD3D11GetLatestHullProfile();
ERRORS
None.
HISTORY
cgD3D11GetLatestHullProfile wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestDomainProfile, cgD3D11GetLatestGeometryProfile, cgD3D11GetLatestPixelProfile,
cgD3D11GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 531
cgD3D11GetLatestPixelProfile(3) Cg Direct3D11 Runtime API cgD3D11GetLatestPixelProfile(3)
NAME cgD3D11GetLatestPixelProfile −get the latest supported pixel shader version
SYNOPSIS
#include <Cg/cgD3D11.h>
CGprofile cgD3D11GetLatestPixelProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest pixel shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D11GetLatestPixelProfile retrievesthe latest pixel shader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 3.0, if the environment variable CGD3D11_LATEST_PIXEL_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D11GetLatestPixelProfile.
EXAMPLES
CGprofile bestPixelProfile = cgD3D11GetLatestPixelProfile();
ERRORS
None.
HISTORY
cgD3D11GetLatestPixelProfile wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestDomainProfile, cgD3D11GetLatestGeometryProfile, cgD3D11GetLatestHullProfile,
cgD3D11GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 532
cgD3D11GetLatestVertexProfile(3) Cg Direct3D11 Runtime API cgD3D11GetLatestVertexProfile(3)
NAME cgD3D11GetLatestVertexProfile −get the latest supported vertexshader version
SYNOPSIS
#include <Cg/cgD3D11.h>
CGprofile cgD3D11GetLatestVertexProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest vertexshader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D11GetLatestVertexProfile retrievesthe latest vertexshader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 3.0, if the environment variable CGD3D11_LATEST_VERTEX_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D11GetLatestVertexProfile.
EXAMPLES
CGprofile bestVertexProfile = cgD3D11GetLatestVertexProfile();
ERRORS
None.
HISTORY
cgD3D11GetLatestVertexProfile wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestDomainProfile, cgD3D11GetLatestGeometryProfile, cgD3D11GetLatestHullProfile,
cgD3D11GetLatestPixelProfile
perl v5.10.0 Cg Toolkit 3.0 533
cgD3D11GetManageTextureParameters(3) Cg Direct3D11 Runtime API cgD3D11GetManageTextureParameters(3)
NAME cgD3D11GetManageTextureParameters −get the manage texture parameters flag from a context
SYNOPSIS
#include <Cg/cgD3D11.h>
CGbool cgD3D11GetManageTextureParameters( CGcontext context );
PARAMETERS
context The context from which the automatic texture management setting will be retrieved.
RETURN VALUES
Returns the manage texture management flag from context.
DESCRIPTION
cgD3D11GetManageTextureParameters returns the manage texture management flag from context. See
cgD3D11SetManageTextureParameters for more information.
EXAMPLES
CGbool manage = cgD3D11GetManageTextureParameters( pCtx );
if( manage )
doSomething();
ERRORS
None.
HISTORY
cgD3D11GetManageTextureParameters wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 534
cgD3D11GetOptimalOptions(3) Cg Direct3D11 Runtime API cgD3D11GetOptimalOptions(3)
NAME cgD3D11GetOptimalOptions −get the best set of compiler options for a profile
SYNOPSIS
#include <Cg/cgD3D11.h>
char const ** cgD3D11GetOptimalOptions( CGprofile profile );
PARAMETERS
profile The profile whose optimal arguments are requested.
RETURN VALUES
Returns a null-terminated array of strings representing the optimal set of compiler options for profile.
Returns NULL if no D3D device is currently set.
DESCRIPTION
cgD3D11GetOptimalOptions returns the best set of compiler options for a givenprofile. This is an
expanded interface function because it needs to knowabout the D3D device to determine the most optimal
options.
The elements of the returned array are meant to be used as part of the args parameter to cgCreateProgram
or cgCreateProgramFromFile.
The returned string does not need to be destroyed by the application. However, the contents could change
if the function is called again for the same profile but a different D3D device.
EXAMPLES
const char* vertOptions[] ={myCustomArgs,
cgD3D11GetOptimalOptions(vertProfile),
NULL };
// create the vertex shader
CGprogram myVS = cgCreateProgramFromFile( context,
CG_SOURCE,
"vshader.cg",
vertProfile,
"VertexShader",
vertOptions);
ERRORS
None.
HISTORY
cgD3D11GetOptimalOptions wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestVertexProfile, cgD3D11GetLatestPixelProfile, cgCreateProgram,
cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 535
cgD3D11GetProgramErrors(3) Cg Direct3D11 Runtime API cgD3D11GetProgramErrors(3)
NAME cgD3D11GetProgramErrors −Gets a list of errors returned from Direct3D if the program did not load.
SYNOPSIS
#include <Cg/cgD3D11.h>
ID3D10Blob * cgD3D11GetProgramErrors( CGprogram program );
PARAMETERS
program The program handle after a call to cgD3D11LoadProgram has been made.
RETURN VALUES
Returns a pointer to a ID3DBlob object containing a list of errors if the program did not load.
Returns NULL if the program was loaded.
DESCRIPTION
cgD3D11GetProgramErrors allows the user to get back the compiled shader from Direct3D once
cgD3D11LoadProgram has been called.
EXAMPLES
CGprogram myCgProgram = cgCreateProgram( ... ); cgD3D11LoadProgram( myCgProgram, 0 );
ID3DBlob * err = cgD3D11GetProgramErrors( myCgProgram );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if the program is invalid;
HISTORY
cgD3D11GetProgramErrors wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11LoadProgram
perl v5.10.0 Cg Toolkit 3.0 536
cgD3D11IsProfileSupported(3) Cg Direct3D11 Runtime API cgD3D11IsProfileSupported(3)
NAME cgD3D11IsProfileSupported −determine if a profile is supported by cgD3D11
SYNOPSIS
#include <Cg/cgD3D11.h>
CGbool cgD3D11IsProfileSupported( CGprofile profile );
PARAMETERS
profile The profile which will be checked for support.
RETURN VALUES
Returns CG_TRUE if profile is supported by the cgD3D10 library.
Returns CG_FALSE otherwise.
HoweverifcgD3D11SetDevice has not been called to register a ID3D11Device device yet, this routine
returns CG_TRUE for all valid D3D11 profiles.
DESCRIPTION
cgD3D11IsProfileSupported returns CG_TRUE if the profile indicated by profile is supported by the
cgD3D11 library.
EXAMPLES
// assuming the program requires Shader Model 5.0 ...
if ((!cgD3D11IsProfileSupported(CG_PROFILE_VS_5_0)) ||
(!cgD3D11IsProfileSupported(CG_PROFILE_PS_5_0))) {
fprintf(stderr, "Sorry, required profiles not supported on this system.\n");
exit(1);
}
ERRORS
None.
HISTORY
cgD3D11IsProfileSupported wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetLatestPixelProfile, cgD3D11GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 537
cgD3D11IsProgramLoaded(3) Cg Direct3D11 Runtime API cgD3D11IsProgramLoaded(3)
NAME cgD3D11IsProgramLoaded −determine if a program has been loaded
SYNOPSIS
#include <Cg/cgD3D11.h>
CGbool cgD3D11IsProgramLoaded( CGprogram program );
PARAMETERS
program The program which will be checked.
RETURN VALUES
Returns CG_TRUE if program has been loaded using cgD3D11LoadProgram.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D11IsProgramLoaded determines if a program has been loaded using cgD3D11LoadProgram.
EXAMPLES
// program is a CGprogram initialized elsewhere
...
CGbool isLoaded = cgD3D11IsProgramLoaded(program);
ERRORS
None.
HISTORY
cgD3D11IsProgramLoaded wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11LoadProgram
perl v5.10.0 Cg Toolkit 3.0 538
cgD3D11LoadProgram(3) Cg Direct3D11 Runtime API cgD3D11LoadProgram(3)
NAME cgD3D11LoadProgram −create a D3D shader and enable the expanded interface routines
SYNOPSIS
#include <Cg/cgD3D11.h>
HRESULT cgD3D11LoadProgram( CGprogram program,
UINT flags );
PARAMETERS
program A program whose compiled output is used to create the D3D shader.
flags The flags to pass to D3DCompile.See the D3D documentation for a list of valid flags.
RETURN VALUES
Returns D3D_OK if the function succeeds or program has already been loaded.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D11LoadProgram creates a D3D shader for a program and enables use of expanded interface
routines for that program.
cgD3D11LoadProgram compiles the compiled Cg output for program using D3DCompile and then
creates a D3D shader using ID3D11Device::CreateVertexShader or ID3D11Device::CreatePixelShader
depending on the program’sprofile.
The D3D shader handle is not returned. If the shader handle is desired by the application, the expanded
interface should not be used for that program.
EXAMPLES
// vertexProg is a CGprogram using a vertex profile
// pixelProg is a CGprogram using a pixel profile
...
HRESULT hr1 = cgD3D11LoadProgram(vertexProg, 0);
HRESULT hr2 = cgD3D11LoadProgram(pixelProg, 0);
ERRORS
E_FAIL is generated if a D3D function returns an error.
E_FAIL is returned if program’s profile is not a supported D3D profile.
E_FAIL is returned if a required D3D device is NULL.This usually occurs when an expanded interface
routine is called but a D3D device has not been set with cgD3D11SetDevice.
HISTORY
cgD3D11LoadProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetDevice
perl v5.10.0 Cg Toolkit 3.0 539
cgD3D11RegisterStates(3) Cg Direct3D11 Runtime API cgD3D11RegisterStates(3)
NAME cgD3D11RegisterStates −registers graphics pass states for CgFX files
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11RegisterStates( CGcontext context );
PARAMETERS
context The context in which to register the states.
RETURN VALUES
None.
DESCRIPTION
cgD3D11RegisterStates registers a set of states for passes in techniques in CgFX effect files. These states
correspond to the set of D3D states that is relevant and/or useful to be set in passes in effect files. See the
Cg User’sGuide for complete documentation of the states that are made available after calling
cgD3D11RegisterStates.
EXAMPLES
// register D3D11 states for this context
CGcontext context = cgCreateContext();
cgD3D11RegisterStates(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgD3D11RegisterStates wasintroduced in Cg 3.0.
Starting with Cg 3.0, cgD3D11RegisterStates calls cgSetStateLatestProfile for program states it creates
and registers the latest profile returned by cgD3D11GetLatestVertexProfile,
cgD3D11GetLatestGeometryProfile or cgD3D11GetLatestPixelProfile for the appropriate program domain.
SEE ALSO
cgCreateState, cgSetStateLatestProfile, cgSetPassState, cgResetPassState, cgCallStateValidateCallback,
cgGLRegisterStates, cgD3D9RegisterStates
perl v5.10.0 Cg Toolkit 3.0 540
cgD3D11SetDevice(3) Cg Direct3D11 Runtime API cgD3D11SetDevice(3)
NAME cgD3D11SetDevice −set the D3D device
SYNOPSIS
#include <Cg/cgD3D11.h>
HRESULT cgD3D11SetDevice( CGcontext context,
ID3D11Device * device );
PARAMETERS
context The context in which to set the current device.
device Pointer to an ID3D11Device interface that the expanded interface will use for anyD3D−specific
routine it may call. This parameter can be NULL to free all D3D resources used by the expanded
interface and remove its reference to the D3D device.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D11SetDevice informs the expanded interface of the newD3D device. This will destroyany D3D
resources for programs previously loaded with cgD3D11LoadProgram and use the newD3D device to
recreate them. The expanded interface will increment the reference count to the D3D device, so this
function must eventually be called with NULL to release that reference so D3D can be properly shut down.
If device is NULL,all D3D resources for programs previously loaded with cgD3D11LoadProgram are
destroyed. However, these programs are still considered managed by the expanded interface, so if a new
D3D device is set later these programs will be recreated using the newD3D device.
If a newdevice is being set, all D3D resources for programs previously loaded with cgD3D11LoadProgram
are rebuilt using the newdevice. All shadowed parameters for these programs are maintained across D3D
device changes except texture parameters. Since textures in D3D are bound to a particular D3D device,
these resources cannot be savedacross device changes. When these textures are recreated for the newD3D
device, theymust be re-bound to the sampler parameter.
Note that calling cgD3D11SetDevice(NULL)does not destroyany core runtime resources (CGprograms,
CGparameters,etc.) used by the expanded interface. These must be destroyed seperately using
cgDestroyProgram and cgDestroyContext.
EXAMPLES
// pDev is an ID3D11Device interface initialized elsewhere
...
cgD3D11SetDevice(pDev);
ERRORS
E_FAIL is returned if a D3D function returns an error.
HISTORY
cgD3D11SetDevice wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetDevice, cgDestroyProgram, cgDestroyContext, cgD3D11LoadProgram
perl v5.10.0 Cg Toolkit 3.0 541
cgD3D11SetManageTextureParameters(3) Cg Direct3D11 Runtime API cgD3D11SetManageTextureParameters(3)
NAME cgD3D11SetManageTextureParameters −set the manage texture parameters flag for a context
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11SetManageTextureParameters( CGcontext context,
CGbool flag );
PARAMETERS
context The context in which the automatic texture management behavior will be changed.
flag A boolean switch which controls automatic texture management by the runtime.
RETURN VALUES
None.
DESCRIPTION
By default, cgD3D11 does not manage anytexture state in D3D. It is up to the user to enable and disable
textures using D3D. This behavior is the default to avoid conflicts with texture state on geometry that’s
rendered with the fixed function pipeline or without cgD3D11.
If automatic texture management is desired, cgD3D11SetManageTextureParameters may be called with
flag set to CG_TRUE before cgD3D11BindProgram is called. WhenevercgD3D11BindProgram is called,
the cgD3D11 runtime will makeall the appropriate texture parameter calls on the application’sbehalf.
Calling cgD3D11SetManageTextureParameters with flag set to CG_FALSE will disable automatic
texture management.
NOTE: When cgD3D11SetManageTextureParameters is set to CG_TRUE,applications should not make
texture state change calls to D3D after calling cgD3D11BindProgram, unless the application is trying to
override some parts of cgD3D11’stexture management.
EXAMPLES
// Enable automatic texture management
cgD3D11SetManageTextureParmeters( pCtx, CG_TRUE );
ERRORS
None.
HISTORY
cgD3D11SetManageTextureParameters wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11GetManageTextureParameters, cgD3D11BindProgram
perl v5.10.0 Cg Toolkit 3.0 542
cgD3D11SetSamplerStateParameter(3) Cg Direct3D11 Runtime API cgD3D11SetSamplerStateParameter(3)
NAME cgD3D11SetSamplerStateParameter −Sets a sampler state object to a Cg sampler parameter.
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11SetSamplerStateParameter( CGparameter param,
ID3D11SamplerState * samplerState );
PARAMETERS
param The sampler parameter whose state is to be set.
samplerState
The D3D sampler state to set.
RETURN VALUES
None.
DESCRIPTION
cgD3D11SetSamplerStateParameter sets the sampler state associated with a sampler parameter.
NULL means default sampler state.
EXAMPLES
ID3D11SamplerState * sstate = NULL;Device−>CreateSamplerState( &samplerDesc, &sstate );
cgD3D11SetSamplerStateParameter( myCgSamplerParam, sstate );
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is invalid.
HISTORY
cgD3D11SetSamplerStateParameter wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetTextureSamplerStateParameter
perl v5.10.0 Cg Toolkit 3.0 543
cgD3D11SetTextureParameter(3) Cg Direct3D11 Runtime API cgD3D11SetTextureParameter(3)
NAME cgD3D11SetTextureParameter −sets the value of a texture parameter
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11SetTextureParameter( CGparameter param,
ID3D11Resource * texture );
PARAMETERS
param The texture parameter that will be set.
texture An D3D texture to which the parameter will be set.
RETURN VALUES
None.
DESCRIPTION
cgD3D11SetTextureParameter sets the value of a texture parameter to a givenD3D11 texture object.
EXAMPLES
ID3D11Resource *myTexture;
// Assume myTexture is loaded here...
// .. and param is an effect sampler parameter
cgD3D11SetTextureParameter( param, myTexture );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter handle.
HISTORY
cgD3D11SetTextureParameter wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 544
cgD3D11SetTextureSamplerStateParameter(3)Cg Direct3D11 Runtime APIcgD3D11SetTextureSamplerStateParameter(3)
NAME cgD3D11SetTextureSamplerStateParameter −Sets a texture resource and sampler state object to a Cg
sampler parameter.
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11SetTextureSamplerStateParameter( CGparameter param,
ID3D11Resource * texture,
ID3D11SamplerState * samplerState );
PARAMETERS
param The sampler parameter whose texture and state is to be set.
texture The texture resource object being set.
samplerState
The sampler state object being set.
RETURN VALUES
None.
DESCRIPTION
cgD3D11SetTextureSamplerStateParameter accomplishes the same thing as calling both
cgD3D11SetTextureParameter and cgD3D11SetSamplerStateParameter together.
EXAMPLES
ID3D11Resource * myTexture; ID3D11SamplerState * mySamplerState;
Device−>CreateTexture2D( &desc, &initalData, &myTexture ); Device−>CreateSamplerState( &desc,
&mySamplerState );
cgD3D11SetTextureSamplerStateParameter( myCgSamplerParam, myTexture, mySamplerState );
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is invalid.
HISTORY
cgD3D11SetTextureSamplerStateParameter wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetTextureParameter,cgD3D11SetSamplerStateParameter
perl v5.10.0 Cg Toolkit 3.0 545
cgD3D11TranslateCGerror(3) Cg Direct3D11 Runtime API cgD3D11TranslateCGerror(3)
NAME cgD3D11TranslateCGerror −convert a Cg runtime error into a string
SYNOPSIS
#include <Cg/cgD3D11.h>
const char * cgD3D11TranslateCGerror( CGerror error );
PARAMETERS
error The error code to translate. Can be a core runtime error or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing error.
DESCRIPTION
cgD3D11TranslateCGerror converts a Cg runtime error into a string. This routine should be called
instead of the core runtime routine cgGetErrorString because it will also translate errors that the Cg D3D
runtime generates.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
CGerror error = cgGetLastError();
if (error != CG_NO_ERROR)
{
sprintf(buf, "An error occurred. Error description: '%s'\n",
cgD3D11TranslateCGerror(error));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D11TranslateCGerror wasintroduced in Cg 3.0.
SEE ALSO
cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 546
cgD3D11TranslateHRESULT(3) Cg Direct3D11 Runtime API cgD3D11TranslateHRESULT(3)
NAME cgD3D11TranslateHRESULT −convert an HRESULT into a string
SYNOPSIS
#include <Cg/cgD3D11.h>
const char * cgD3D11TranslateHRESULT( HRESULT hr );
PARAMETERS
hr The HRESULT to translate. Can be a generic HRESULT or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing the error.
DESCRIPTION
cgD3D11TranslateHRESULT converts an HRESULT into a string.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
HRESULT hres = cgGetLastError();
if (FAILED(hres))
{
sprintf(buf, "A D3D error occurred. Error description: '%s'\n",
cgD3D11TranslateHRESULT(hres));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D11TranslateHRESULT wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11TranslateCGerror,cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 547
cgD3D11TypeToSize(3) Cg Direct3D11 Runtime API cgD3D11TypeToSize(3)
NAME cgD3D11TypeToSize −get the size of a CGtype enumerated type
SYNOPSIS
#include <Cg/cgD3D11.h>
DWORD cgD3D11TypeToSize( CGtype type );
PARAMETERS
type Member of the CGtype enumerated type whose size is to be returned.
RETURN VALUES
Returns the size of type in terms of consecutive floating point values.
Returns 0if the type does not have aninherent size. Sampler types fall into this category.
DESCRIPTION
cgD3D11TypeToSize retrievesthe size of a CGtype enumerated type in terms of consecutive floating point
values.
If the type does not have aninherent size, the return value is 0. Sampler types fall into this category.
EXAMPLES
// param is a CGparameter initialized earlier
...
DWORD size = cgD3D11TypeToSize(cgGetParameterType(param));
// (sanity check that parameters have the expected size)
...
assert(cgD3D11TypeToSize(cgGetParameterType(vsModelView)) == 16);
assert(cgD3D11TypeToSize(cgGetParameterType(psColor)) == 4);
ERRORS
None.
HISTORY
cgD3D11TypeToSize wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11SetDevice
perl v5.10.0 Cg Toolkit 3.0 548
cgD3D11UnbindProgram(3) Cg Direct3D11 Runtime API cgD3D11UnbindProgram(3)
NAME cgD3D11UnbindProgram −Unbinds a D3D11 program.
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11UnbindProgram( CGprogram Program );
PARAMETERS
Program A program whose profile is used to unbind the program from the API.
RETURN VALUES
None.
DESCRIPTION
cgD3D11UnbindProgram Unbinds a D3D11 program from the profile of the givenprogram ’Program.
EXAMPLES
// CGprogram vertexProg;
//...
cgD3D11UnbindProgram( vertexProg );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if Program is not a valid program.
HISTORY
cgD3D11UnbindProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11BindProgram
perl v5.10.0 Cg Toolkit 3.0 549
cgD3D11UnloadProgram(3) Cg Direct3D11 Runtime API cgD3D11UnloadProgram(3)
NAME cgD3D11UnloadProgram −Unloads a D3D shader from the runtime data structures
SYNOPSIS
#include <Cg/cgD3D11.h>
void cgD3D11UnloadProgram( CGprogram Program );
PARAMETERS
Program A program whose compiled output is used to create the D3D shader.
RETURN VALUES
None.
DESCRIPTION
cgD3D11UnloadProgram Unloads a D3D shader from the runtime data structures.
EXAMPLES
// vertexProg is a CGprogram using a vertex profile
...
cgD3D11UnloadProgram( vertexProg );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if Program is not a valid program.
HISTORY
cgD3D11UnloadProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D11LoadProgram
perl v5.10.0 Cg Toolkit 3.0 550
cgD3D10BindProgram(3) Cg Direct3D10 Runtime API cgD3D10BindProgram(3)
NAME cgD3D10BindProgram −activate a program with D3D
SYNOPSIS
#include <Cg/cgD3D10.h>
HRESULT cgD3D10BindProgram( CGprogram program );
PARAMETERS
program The program to activate with D3D.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D10BindProgram activates a program with D3D. The program is activated using
ID3D10Device::SetVertexShader or ID3D10Device::SetPixelShader depending on the program’sprofile
type.
D3D allows only one vertexshader and one pixel shader to be active atany giv e ntime, so activating a
program of a giventype implicitly deactivates anyother program of a that type.
EXAMPLES
// vertexProg and pixelProg are CGprograms initialized elsewhere
// pDev is an ID3D10Device interface intialized elsewhere
...
HRESULT hr = cgD3D10BindProgram(vertexProg);
HRESULT hr2 = cgD3D10BindProgram(pixelProg);
// Draw a quad using the vertex and pixel shader
// A vertex and index buffer are set up elsewhere.
HRESULT hr3 = pDev−>DrawIndexedPrimitve(D3DPT_TRIANGLELIST, 0, 4, 0, 2);
ERRORS
cgD3D10Failed is generated if a D3D function returns an error.
CGD3D10ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D10LoadProgram.
CGD3D10ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D10SetDevice.
HISTORY
cgD3D10BindProgram wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram, cgD3D10SetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 551
cgD3D10GetBufferByIndex(3) Cg Direct3D10 Runtime API cgD3D10GetBufferByIndex(3)
NAME cgD3D10GetBufferByIndex −Returns a pointer to an ID3D10Buffer interface by the constant buffer
index.
SYNOPSIS
#include <Cg/cgD3D10.h>
ID3D10Buffer * cgD3D10GetBufferByIndex( CGprogram Program.
UINT Index );
PARAMETERS
Program The Cg program containing the buffer.
IndexAzero-based index.
RETURN VALUES
Returns a pointer to an ID3D10Buffer interface containing the constant buffer.
DESCRIPTION
cgD3D10GetBufferByIndex returns a pointer to an ID3D10Buffer interface containing the constant buffer
for manual manipulation. If the user manually changes the constant values in this way,the constant values
contained in the corresponding CGbuffer (if exists) will be stale.
EXAMPLES
ID3D10Buffer * myConstantBuffer = cgD3D10GetBufferByIndex( myCgProgram, 0 );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR if Program is not a valid Cg program.
HISTORY
cgD3D10GetBufferByIndex wasintroduced in Cg 2.1.
SEE ALSO
cgCreateBuffer
perl v5.10.0 Cg Toolkit 3.0 552
cgD3D10GetCompiledProgram(3) Cg Direct3D10 Runtime API cgD3D10GetCompiledProgram(3)
NAME cgD3D10GetCompiledProgram −Gets the compiled shader as a ID3D10Blob returned from Direct3D
after cgD3D10LoadProgram is called.
SYNOPSIS
#include <Cg/cgD3D10.h>
ID3D10Blob * cgD3D10GetCompiledProgram( CGprogram program );
PARAMETERS
program The program handle after a call to cgD3D10LoadProgram has been made.
RETURN VALUES
Returns a pointer to a ID3D10Blob object containing the compiled shader code.
Returns NULL if the program was not loaded.
DESCRIPTION
cgD3D10GetCompiledProgram allows the user to get back the compiled shader from Direct3D once
cgD3D10LoadProgram has been called.
EXAMPLES
CGprogram myCgProgram = cgCreateProgram( ... ); cgD3D10LoadProgram( myCgProgram, 0 );
ID3D10Blob * obj = cgD3D10GetCompiledProgram( myCgProgram );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if the program is invalid.
HISTORY
cgD3D10GetCompiledProgram wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram
perl v5.10.0 Cg Toolkit 3.0 553
cgD3D10GetDevice(3) Cg Direct3D10 Runtime API cgD3D10GetDevice(3)
NAME cgD3D10GetDevice −retrievesthe current D3D10 device associated with a context
SYNOPSIS
#include <Cg/cgD3D10.h>
ID3D10Device * cgD3D10GetDevice( CGcontext context );
PARAMETERS
context The context from which to get the current device.
RETURN VALUES
Returns the current D3D10 device associated with context.
DESCRIPTION
cgD3D10GetDevice retrievesthe current D3D10 device associated with context.Note that the returned
device pointer may be NULL.
EXAMPLES
ID3D10Device* curDevice = cgD3D10GetDevice(ctx);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgD3D10GetDevice wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetDevice
perl v5.10.0 Cg Toolkit 3.0 554
cgD3D10GetIASignatureByPass(3) Cg Direct3D10 Runtime API cgD3D10GetIASignatureByPass(3)
NAME cgD3D10GetIASignatureByPass −Gets the compiled vertexshader signature as a ID3D10Blob from a
pass of a validated technique.
SYNOPSIS
#include <Cg/cgD3D10.h>
ID3D10Blob * cgD3D10GetIASignatureByPass( CGpass pass );
PARAMETERS
pass The pass handle after validation of a CgFX technique.
RETURN VALUES
Returns a pointer to a ID3D10Blob object containing the vertexshader signature.
Returns NULL if the program was not loaded.
DESCRIPTION
cgD3D10GetIASignatureByPass allows the user to get back the vertexshader signature of a pass of a
validated CgFX technique.
EXAMPLES
myCgEffect = cgCreateEffectFromFile( myCgContext, ‘‘effect.cgfx’’, NULL ); myCgTechnique =
cgGetFirstTechnique( myCgEffect );
if( cgValidateTechnique( myCgTechnique ) != CG_FALSE ){
const D3D10_INPUT_ELEMENT_DESC layout[] =
{{‘POSITION’’,0,DXGI_FORMAT_R32G32B32_FLOAT,0,0,
D3D10_INPUT_PER_VERTEX_DAT A,0},
};
CGpass myPass = cgGetFirstPass( myCgTechnique );
ID3D10Blob * pVSBuf = cgD3D10GetIASignatureByPass( myPass );
hr = pDevice−>CreateInputLayout( layout, 1, pVSBuf−>GetBufferPointer(),
pVSBuf−>GetBufferSize(), &g_pVertexLayout );
}
ERRORS
CG_INVALID_PASS_HANDLE_ERROR is generated if the pass is invalid.
HISTORY
cgD3D10GetIASignatureByPass wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetCompiledProgram
perl v5.10.0 Cg Toolkit 3.0 555
cgD3D10GetLastError(3) Cg Direct3D10 Runtime API cgD3D10GetLastError(3)
NAME cgD3D10GetLastError −get the last D3D error that occurred
SYNOPSIS
#include <Cg/cgD3D10.h>
HRESULT cgD3D10GetLastError( void );
PARAMETERS
None.
RETURN VALUES
Returns the last D3D error that occurred during an expanded interface function call.
Returns D3D_OK if no D3D error has occurred since the last call to cgD3D10GetLastError.
DESCRIPTION
cgD3D10GetLastError retrievesthe last D3D error that occurred during an expanded interface function
call. The last error is always cleared immediately after the call.
EXAMPLES
HRESULT lastError = cgD3D10GetLastError();
ERRORS
None.
HISTORY
cgD3D10GetLastError wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10TranslateHRESULT
perl v5.10.0 Cg Toolkit 3.0 556
cgD3D10GetLatestGeometryProfile(3) Cg Direct3D10 Runtime API cgD3D10GetLatestGeometryProfile(3)
NAME cgD3D10GetLatestGeometryProfile −get the latest supported geometry shader version
SYNOPSIS
#include <Cg/cgD3D10.h>
CGprofile cgD3D10GetLatestGeometryProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest geometry shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D10GetLatestGeometryProfile retrievesthe latest geometry shader version that the current D3D
device supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 2.2, if the environment variable CGD3D10_LATEST_GEOMETRY_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D10GetLatestGeometryProfile.
EXAMPLES
CGprofile bestGeometryProfile = cgD3D10GetLatestGeometryProfile();
ERRORS
None.
HISTORY
cgD3D10GetLatestGeometryProfile wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetLatestPixelProfile, cgD3D10GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 557
cgD3D10GetLatestPixelProfile(3) Cg Direct3D10 Runtime API cgD3D10GetLatestPixelProfile(3)
NAME cgD3D10GetLatestPixelProfile −get the latest supported pixel shader version
SYNOPSIS
#include <Cg/cgD3D10.h>
CGprofile cgD3D10GetLatestPixelProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest pixel shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D10GetLatestPixelProfile retrievesthe latest pixel shader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 2.2, if the environment variable CGD3D10_LATEST_PIXEL_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D10GetLatestPixelProfile.
EXAMPLES
CGprofile bestPixelProfile = cgD3D10GetLatestPixelProfile();
ERRORS
None.
HISTORY
cgD3D10GetLatestPixelProfile wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetLatestGeometryProfile, cgD3D10GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 558
cgD3D10GetLatestVertexProfile(3) Cg Direct3D10 Runtime API cgD3D10GetLatestVertexProfile(3)
NAME cgD3D10GetLatestVertexProfile −get the latest supported vertexshader version
SYNOPSIS
#include <Cg/cgD3D10.h>
CGprofile cgD3D10GetLatestVertexProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest vertexshader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D10GetLatestVertexProfile retrievesthe latest vertexshader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 2.2, if the environment variable CGD3D10_LATEST_VERTEX_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D10GetLatestVertexProfile.
EXAMPLES
CGprofile bestVertexProfile = cgD3D10GetLatestVertexProfile();
ERRORS
None.
HISTORY
cgD3D10GetLatestVertexProfile wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetLatestGeometryProfile, cgD3D10GetLatestPixelProfile
perl v5.10.0 Cg Toolkit 3.0 559
cgD3D10GetManageTextureParameters(3) Cg Direct3D10 Runtime API cgD3D10GetManageTextureParameters(3)
NAME cgD3D10GetManageTextureParameters −get the manage texture parameters flag from a context
SYNOPSIS
#include <Cg/cgD3D10.h>
CGbool cgD3D10GetManageTextureParameters( CGcontext context );
PARAMETERS
context The context from which the automatic texture management setting will be retrieved.
RETURN VALUES
Returns the manage texture management flag from context.
DESCRIPTION
cgD3D10GetManageTextureParameters returns the manage texture management flag from context. See
cgD3D10SetManageTextureParameters for more information.
EXAMPLES
CGbool manage = cgD3D10GetManageTextureParameters( pCtx );
if( manage )
doSomething();
ERRORS
None.
HISTORY
cgD3D10GetManageTextureParameters wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 560
cgD3D10GetOptimalOptions(3) Cg Direct3D10 Runtime API cgD3D10GetOptimalOptions(3)
NAME cgD3D10GetOptimalOptions −get the best set of compiler options for a profile
SYNOPSIS
#include <Cg/cgD3D10.h>
char const ** cgD3D10GetOptimalOptions( CGprofile profile );
PARAMETERS
profile The profile whose optimal arguments are requested.
RETURN VALUES
Returns a null-terminated array of strings representing the optimal set of compiler options for profile.
Returns NULL if no D3D device is currently set.
DESCRIPTION
cgD3D10GetOptimalOptions returns the best set of compiler options for a givenprofile. This is an
expanded interface function because it needs to knowabout the D3D device to determine the most optimal
options.
The elements of the returned array are meant to be used as part of the args parameter to cgCreateProgram
or cgCreateProgramFromFile.
The returned string does not need to be destroyed by the application. However, the contents could change
if the function is called again for the same profile but a different D3D device.
EXAMPLES
const char* vertOptions[] ={myCustomArgs,
cgD3D10GetOptimalOptions(vertProfile),
NULL };
// create the vertex shader
CGprogram myVS = cgCreateProgramFromFile( context,
CG_SOURCE,
"vshader.cg",
vertProfile,
"VertexShader",
vertOptions);
ERRORS
None.
HISTORY
cgD3D10GetOptimalOptions wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetLatestVertexProfile, cgD3D10GetLatestPixelProfile, cgCreateProgram,
cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 561
cgD3D10GetProgramErrors(3) Cg Direct3D10 Runtime API cgD3D10GetProgramErrors(3)
NAME cgD3D10GetProgramErrors −Gets a list of errors returned from Direct3D if the program did not load.
SYNOPSIS
#include <Cg/cgD3D10.h>
ID3D10Blob * cgD3D10GetProgramErrors( CGprogram program );
PARAMETERS
program The program handle after a call to cgD3D10LoadProgram has been made.
RETURN VALUES
Returns a pointer to a ID3D10Blob object containing a list of errors if the program did not load.
Returns NULL if the program was loaded.
DESCRIPTION
cgD3D10GetProgramErrors allows the user to get back the compiled shader from Direct3D once
cgD3D10LoadProgram has been called.
EXAMPLES
CGprogram myCgProgram = cgCreateProgram( ... ); cgD3D10LoadProgram( myCgProgram, 0 );
ID3D10Blob * err = cgD3D10GetProgramErrors( myCgProgram );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if the program is invalid;
HISTORY
cgD3D10GetProgramErrors wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram
perl v5.10.0 Cg Toolkit 3.0 562
cgD3D10IsProfileSupported(3) Cg Direct3D10 Runtime API cgD3D10IsProfileSupported(3)
NAME cgD3D10IsProfileSupported −determine if a profile is supported by cgD3D10
SYNOPSIS
#include <Cg/cgD3D10.h>
CGbool cgD3D10IsProfileSupported( CGprofile profile );
PARAMETERS
profile The profile which will be checked for support.
RETURN VALUES
Returns CG_TRUE if profile is supported by the cgD3D10 library.
Returns CG_FALSE otherwise.
HoweverifcgD3D10SetDevice has not been called to register a ID3D10Device device yet, this routine
returns CG_TRUE for all valid D3D10 profiles.
DESCRIPTION
cgD3D10IsProfileSupported returns CG_TRUE if the profile indicated by profile is supported by the
cgD3D10 library.
EXAMPLES
// assuming the program requires Shader Model 3.0 ...
if ((!cgD3D10IsProfileSupported(CG_PROFILE_VS_3_0)) ||
(!cgD3D10IsProfileSupported(CG_PROFILE_PS_3_0))) {
fprintf(stderr, "Sorry, required profiles not supported on this system.\n");
exit(1);
}
ERRORS
None.
HISTORY
cgD3D10IsProfileSupported wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetLatestPixelProfile, cgD3D10GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 563
cgD3D10IsProgramLoaded(3) Cg Direct3D10 Runtime API cgD3D10IsProgramLoaded(3)
NAME cgD3D10IsProgramLoaded −determine if a program has been loaded
SYNOPSIS
#include <Cg/cgD3D10.h>
CGbool cgD3D10IsProgramLoaded( CGprogram program );
PARAMETERS
program The program which will be checked.
RETURN VALUES
Returns CG_TRUE if program has been loaded using cgD3D10LoadProgram.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D10IsProgramLoaded determines if a program has been loaded using cgD3D10LoadProgram.
EXAMPLES
// program is a CGprogram initialized elsewhere
...
CGbool isLoaded = cgD3D10IsProgramLoaded(program);
ERRORS
None.
HISTORY
cgD3D10IsProgramLoaded wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram
perl v5.10.0 Cg Toolkit 3.0 564
cgD3D10LoadProgram(3) Cg Direct3D10 Runtime API cgD3D10LoadProgram(3)
NAME cgD3D10LoadProgram −create a D3D shader and enable the expanded interface routines
SYNOPSIS
#include <Cg/cgD3D10.h>
HRESULT cgD3D10LoadProgram( CGprogram program,
UINT flags );
PARAMETERS
program A program whose compiled output is used to create the D3D shader.
flags The flags to pass to D3DXAssembleShader.See the D3D documentation for a list of valid flags.
RETURN VALUES
Returns D3D_OK if the function succeeds or program has already been loaded.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D10LoadProgram creates a D3D shader for a program and enables use of expanded interface
routines for that program.
cgD3D10LoadProgram assembles the compiled Cg output for program using D3DXAssembleShader
and then creates a D3D shader using ID3D10Device::CreateVertexShader or
ID3D10Device::CreatePixelShader depending on the program’sprofile.
The D3D shader handle is not returned. If the shader handle is desired by the application, the expanded
interface should not be used for that program.
EXAMPLES
// vertexProg is a CGprogram using a vertex profile
// pixelProg is a CGprogram using a pixel profile
...
HRESULT hr1 = cgD3D10LoadProgram(vertexProg, TRUE, D3DXASM_DEBUG);
HRESULT hr2 = cgD3D10LoadProgram(pixelProg, TRUE, 0);
ERRORS
cgD3D10Failed is generated if a D3D function returns an error.
CGD3D10ERR_INVALIDPROFILE is returned if program’s profile is not a supported D3D profile.
CGD3D10ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D10SetDevice.
HISTORY
cgD3D10LoadProgram wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetDevice
perl v5.10.0 Cg Toolkit 3.0 565
cgD3D10RegisterStates(3) Cg Direct3D10 Runtime API cgD3D10RegisterStates(3)
NAME cgD3D10RegisterStates −registers graphics pass states for CgFX files
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10RegisterStates( CGcontext context );
PARAMETERS
context The context in which to register the states.
RETURN VALUES
None.
DESCRIPTION
cgD3D10RegisterStates registers a set of states for passes in techniques in CgFX effect files. These states
correspond to the set of D3D states that is relevant and/or useful to be set in passes in effect files. See the
Cg User’sGuide for complete documentation of the states that are made available after calling
cgD3D10RegisterStates.
EXAMPLES
// register D3D10 states for this context
CGcontext context = cgCreateContext();
cgD3D10RegisterStates(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgD3D10RegisterStates wasintroduced in Cg 2.1.
Starting with Cg 2.2, cgD3D10RegisterStates calls cgSetStateLatestProfile for program states it creates
and registers the latest profile returned by cgD3D10GetLatestVertexProfile,
cgD3D10GetLatestGeometryProfile or cgD3D10GetLatestPixelProfile for the appropriate program domain.
SEE ALSO
cgCreateState, cgSetStateLatestProfile, cgSetPassState, cgResetPassState, cgCallStateValidateCallback,
cgGLRegisterStates, cgD3D9RegisterStates
perl v5.10.0 Cg Toolkit 3.0 566
cgD3D10SetDevice(3) Cg Direct3D10 Runtime API cgD3D10SetDevice(3)
NAME cgD3D10SetDevice −set the D3D device
SYNOPSIS
#include <Cg/cgD3D10.h>
HRESULT cgD3D10SetDevice( CGcontext context,
ID3D10Device * device );
PARAMETERS
context The context in which to set the current device.
device Pointer to an ID3D10Device interface that the expanded interface will use for anyD3D−specific
routine it may call. This parameter can be NULL to free all D3D resources used by the expanded
interface and remove its reference to the D3D device.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D10SetDevice informs the expanded interface of the newD3D device. This will destroyany D3D
resources for programs previously loaded with cgD3D10LoadProgram and use the newD3D device to
recreate them. The expanded interface will increment the reference count to the D3D device, so this
function must eventually be called with NULL to release that reference so D3D can be properly shut down.
If device is NULL,all D3D resources for programs previously loaded with cgD3D10LoadProgram are
destroyed. However, these programs are still considered managed by the expanded interface, so if a new
D3D device is set later these programs will be recreated using the newD3D device.
If a newdevice is being set, all D3D resources for programs previously loaded with cgD3D10LoadProgram
are rebuilt using the newdevice. All shadowed parameters for these programs are maintained across D3D
device changes except texture parameters. Since textures in D3D are bound to a particular D3D device,
these resources cannot be savedacross device changes. When these textures are recreated for the newD3D
device, theymust be re-bound to the sampler parameter.
Note that calling cgD3D10SetDevice(NULL)does not destroyany core runtime resources (CGprograms,
CGparameters,etc.) used by the expanded interface. These must be destroyed seperately using
cgDestroyProgram and cgDestroyContext.
EXAMPLES
// pDev is an ID3D10Device interface initialized elsewhere
...
cgD3D10SetDevice(pDev);
ERRORS
cgD3D10Failed is generated if a D3D function returns an error.
HISTORY
cgD3D10SetDevice wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetDevice, cgDestroyProgram, cgDestroyContext, cgD3D10LoadProgram
perl v5.10.0 Cg Toolkit 3.0 567
cgD3D10SetManageTextureParameters(3) Cg Direct3D10 Runtime API cgD3D10SetManageTextureParameters(3)
NAME cgD3D10SetManageTextureParameters −set the manage texture parameters flag for a context
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10SetManageTextureParameters( CGcontext context,
CGbool flag );
PARAMETERS
context The context in which the automatic texture management behavior will be changed.
flag A boolean switch which controls automatic texture management by the runtime.
RETURN VALUES
None.
DESCRIPTION
By default, cgD3D10 does not manage anytexture state in D3D. It is up to the user to enable and disable
textures using D3D. This behavior is the default to avoid conflicts with texture state on geometry that’s
rendered with the fixed function pipeline or without cgD3D10.
If automatic texture management is desired, cgD3D10SetManageTextureParameters may be called with
flag set to CG_TRUE before cgD3D10BindProgram is called. WhenevercgD3D10BindProgram is called,
the cgD3D10 runtime will makeall the appropriate texture parameter calls on the application’sbehalf.
Calling cgD3D10SetManageTextureParameters with flag set to CG_FALSE will disable automatic
texture management.
NOTE: When cgD3D10SetManageTextureParameters is set to CG_TRUE,applications should not make
texture state change calls to D3D after calling cgD3D10BindProgram, unless the application is trying to
override some parts of cgD3D10’stexture management.
EXAMPLES
// Enable automatic texture management
cgD3D10SetManageTextureParmeters( pCtx, CG_TRUE );
ERRORS
None.
HISTORY
cgD3D10SetManageTextureParameters wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10GetManageTextureParameters, cgD3D10BindProgram
perl v5.10.0 Cg Toolkit 3.0 568
cgD3D10SetSamplerStateParameter(3) Cg Direct3D10 Runtime API cgD3D10SetSamplerStateParameter(3)
NAME cgD3D10SetSamplerStateParameter −Sets a sampler state object to a Cg sampler parameter.
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10SetSamplerStateParameter( CGparameter param,
ID3D10SamplerState * samplerState );
PARAMETERS
param The sampler parameter whose state is to be set.
samplerState
The D3D sampler state to set.
RETURN VALUES
None.
DESCRIPTION
cgD3D10SetSamplerStateParameter sets the sampler state associated with a sampler parameter.
NULL means default sampler state.
EXAMPLES
ID3D10SamplerState * sstate = NULL;Device−>CreateSamplerState( &samplerDesc, &sstate );
cgD3D10SetSamplerStateParameter( myCgSamplerParam, sstate );
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is invalid.
HISTORY
cgD3D10SetSamplerStateParameter wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetTextureSamplerStateParameter
perl v5.10.0 Cg Toolkit 3.0 569
cgD3D10SetTextureParameter(3) Cg Direct3D10 Runtime API cgD3D10SetTextureParameter(3)
NAME cgD3D10SetTextureParameter −sets the value of a texture parameter
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10SetTextureParameter( CGparameter param,
ID3D10Resource * texture );
PARAMETERS
param The texture parameter that will be set.
texture An D3D texture to which the parameter will be set.
RETURN VALUES
None.
DESCRIPTION
cgD3D10SetTextureParameter sets the value of a texture parameter to a givenD3D10 texture object.
EXAMPLES
ID3D10Resource *myTexture;
// Assume myTexture is loaded here...
// .. and param is an effect sampler parameter
cgD3D10SetTextureParameter( param, myTexture );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter handle.
HISTORY
cgD3D10SetTextureParameter wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 570
cgD3D10SetTextureSamplerStateParameter(3)Cg Direct3D10 Runtime APIcgD3D10SetTextureSamplerStateParameter(3)
NAME cgD3D10SetTextureSamplerStateParameter −Sets a texture resource and sampler state object to a Cg
sampler parameter.
SYNOPSIS
#include <Cg/cg.h>
void cgD3D10SetTextureSamplerStateParameter( CGparameter param,
ID3D10Resource * texture,
ID3D10SamplerState * samplerState );
PARAMETERS
param The sampler parameter whose texture and state is to be set.
texture The texture resource object being set.
samplerState
The sampler state object being set.
RETURN VALUES
None.
DESCRIPTION
cgD3D10SetTextureSamplerStateParameter accomplishes the same thing as calling both
cgD3D10SetTextureParameter and cgD3D10SetSamplerStateParameter together.
EXAMPLES
ID3D10Resource * myTexture; ID3D10SamplerState * mySamplerState;
Device−>CreateTexture2D( &desc, &initalData, &myTexture ); Device−>CreateSamplerState( &desc,
&mySamplerState );
cgD3D10SetTextureSamplerStateParameter( myCgSamplerParam, myTexture, mySamplerState );
ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is invalid.
HISTORY
cgD3D10SetTextureSamplerStateParameter wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetTextureParameter,cgD3D10SetSamplerStateParameter
perl v5.10.0 Cg Toolkit 3.0 571
cgD3D10TranslateCGerror(3) Cg Direct3D10 Runtime API cgD3D10TranslateCGerror(3)
NAME cgD3D10TranslateCGerror −convert a Cg runtime error into a string
SYNOPSIS
#include <Cg/cgD3D10.h>
const char * cgD3D10TranslateCGerror( CGerror error );
PARAMETERS
error The error code to translate. Can be a core runtime error or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing error.
DESCRIPTION
cgD3D10TranslateCGerror converts a Cg runtime error into a string. This routine should be called
instead of the core runtime routine cgGetErrorString because it will also translate errors that the Cg D3D
runtime generates.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
CGerror error = cgGetLastError();
if (error != CG_NO_ERROR)
{
sprintf(buf, "An error occurred. Error description: '%s'\n",
cgD3D10TranslateCGerror(error));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D10TranslateCGerror wasintroduced in Cg 2.1.
SEE ALSO
cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 572
cgD3D10TranslateHRESULT(3) Cg Direct3D10 Runtime API cgD3D10TranslateHRESULT(3)
NAME cgD3D10TranslateHRESULT −convert an HRESULT into a string
SYNOPSIS
#include <Cg/cgD3D10.h>
const char * cgD3D10TranslateHRESULT( HRESULT hr );
PARAMETERS
hr The HRESULT to translate. Can be a generic HRESULT or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing the error.
DESCRIPTION
cgD3D10TranslateHRESULT converts an HRESULT into a string. This routine should be called instead of
DXGetErrorDescription10 because it will also translate errors that the Cg D3D runtime generates.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
HRESULT hres = cgD3D10GetLastError();
if (FAILED(hres))
{
sprintf(buf, "A D3D error occurred. Error description: '%s'\n",
cgD3D10TranslateHRESULT(hres));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D10TranslateHRESULT wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10TranslateCGerror,cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 573
cgD3D10TypeToSize(3) Cg Direct3D10 Runtime API cgD3D10TypeToSize(3)
NAME cgD3D10TypeToSize −get the size of a CGtype enumerated type
SYNOPSIS
#include <Cg/cgD3D10.h>
DWORD cgD3D10TypeToSize( CGtype type );
PARAMETERS
type Member of the CGtype enumerated type whose size is to be returned.
RETURN VALUES
Returns the size of type in terms of consecutive floating point values.
Returns 0if the type does not have aninherent size. Sampler types fall into this category.
DESCRIPTION
cgD3D10TypeToSize retrievesthe size of a CGtype enumerated type in terms of consecutive floating point
values.
If the type does not have aninherent size, the return value is 0. Sampler types fall into this category.
EXAMPLES
// param is a CGparameter initialized earlier
...
DWORD size = cgD3D10TypeToSize(cgGetParameterType(param));
// (sanity check that parameters have the expected size)
...
assert(cgD3D10TypeToSize(cgGetParameterType(vsModelView)) == 16);
assert(cgD3D10TypeToSize(cgGetParameterType(psColor)) == 4);
ERRORS
None.
HISTORY
cgD3D10TypeToSize wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10SetDevice
perl v5.10.0 Cg Toolkit 3.0 574
cgD3D10UnbindProgram(3) Cg Direct3D10 Runtime API cgD3D10UnbindProgram(3)
NAME cgD3D10UnbindProgram −Unbinds a D3D10 program.
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10UnbindProgram( CGprogram Program );
PARAMETERS
Program A program whose profile is used to unbind the program from the API.
RETURN VALUES
None.
DESCRIPTION
cgD3D10UnbindProgram Unbinds a D3D10 program from the profile of the givenprogram ’Program.
EXAMPLES
// CGprogram vertexProg;
//...
cgD3D10UnbindProgram( vertexProg );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if Program is not a valid program.
HISTORY
cgD3D10UnbindProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D10BindProgram
perl v5.10.0 Cg Toolkit 3.0 575
cgD3D10UnloadProgram(3) Cg Direct3D10 Runtime API cgD3D10UnloadProgram(3)
NAME cgD3D10UnloadProgram −Unloads a D3D shader from the runtime data structures
SYNOPSIS
#include <Cg/cgD3D10.h>
void cgD3D10UnloadProgram( CGprogram Program );
PARAMETERS
Program A program whose compiled output is used to create the D3D shader.
RETURN VALUES
None.
DESCRIPTION
cgD3D10UnloadProgram Unloads a D3D shader from the runtime data structures.
EXAMPLES
// vertexProg is a CGprogram using a vertex profile
...
cgD3D10UnloadProgram( vertexProg );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if Program is not a valid program.
HISTORY
cgD3D10UnloadProgram wasintroduced in Cg 2.1.
SEE ALSO
cgD3D10LoadProgram
perl v5.10.0 Cg Toolkit 3.0 576
cgD3D9BindProgram(3) Cg Direct3D9 Runtime API cgD3D9BindProgram(3)
NAME cgD3D9BindProgram −activate a program with D3D
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9BindProgram( CGprogram program );
PARAMETERS
program The program to activate with D3D.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9BindProgram activates a program with D3D. The program is activated using
IDirect3DDevice9::SetVertexShader or IDirect3DDevice9::SetPixelShader depending on the program’s
profile type.
D3D allows only one vertexshader and one pixel shader to be active atany giv e ntime, so activating a
program of a giventype implicitly deactivates anyother program of a that type.
If parameter shadowing is enabled for program,this call will set the D3D state for all shadowed
parameters associated with program.Ifaparameter associated with program has not been shadowed when
this function is called, the D3D state associated with that parameter is not modified.
If parameter shadowing is disabled, only the D3D shader is activated, and no other D3D state is modified.
EXAMPLES
// vertexProg and pixelProg are CGprograms initialized elsewhere
// pDev is an IDirect3DDevice9 interface intialized elsewhere
...
HRESULT hr = cgD3D9BindProgram(vertexProg);
HRESULT hr2 = cgD3D9BindProgram(pixelProg);
// Draw a quad using the vertex and pixel shader
// A vertex and index buffer are set up elsewhere.
HRESULT hr3 = pDev−>DrawIndexedPrimitve(D3DPT_TRIANGLELIST, 0, 4, 0, 2);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
HISTORY
cgD3D9BindProgram wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9LoadProgram, cgD3D9EnableParameterShadowing, cgD3D9IsParameterShadowingEnabled,
cgD3D9SetUniform, cgD3D9SetUniformMatrix, cgD3D9SetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 577
cgD3D9EnableDebugTracing(3) Cg Direct3D9 Runtime API cgD3D9EnableDebugTracing(3)
NAME cgD3D9EnableDebugTracing −enable or disable debug output
SYNOPSIS
#include <Cg/cgD3D9.h>
void cgD3D9EnableDebugTracing( CGbool enable );
PARAMETERS
enable A boolean switch which controls debugging output by the library.
RETURN VALUES
None.
DESCRIPTION
cgD3D9EnableDebugTracing enables or disables debug output for an application when using the debug
DLL.
If an error callback is registered, breakpoints can be set for Debug DLL debug traces by testing the result of
cgGetError for cgD3D9DebugTrace.Breakpoints can be set for D3D errors by testing for cgD3D9Failed
and using cgD3D9GetLastError to determine the particular D3D error that occurred.
EXAMPLES
cgD3D9EnableDebugTracing(CG_TRUE);
// use code to be debugged
...
cgD3D9EnableDebugTracing(CG_FALSE);
ERRORS
None.
HISTORY
cgD3D9EnableDebugTracing wasintroduced in Cg 1.1.
SEE ALSO
cgSetErrorCallback, cgGetError,cgD3D9GetLastError
perl v5.10.0 Cg Toolkit 3.0 578
cgD3D9EnableParameterShadowing(3) Cg Direct3D9 Runtime API cgD3D9EnableParameterShadowing(3)
NAME cgD3D9EnableParameterShadowing −enable or disable parameter shadowing for a program
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9EnableParameterShadowing( CGprogram program,
CGbool enable );
PARAMETERS
program The program in which to set the parameter shadowing state.
enable A boolean switch which controls parameter shadowing for program.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9EnableParameterShadowing enables or disables parameter shadowing for a program.
If parameter shadowing is enabled for a program, anycall to set the value of a parameter for that program
does not set anyD3D state. Instead it merely shadows the value so it can be set during a subsequent call to
cgD3D9BindProgram.
If parameter shadowing is disabled, these calls immediately sets the D3D state and do not shadowthe
value.
When using this call to disable parameter shadowing, all shadowed parameters for that program are
immediately invalidated. No D3D calls are made, so anyactive program retains its current D3D state.
However, subsequent calls to cgD3D9BindProgram for that program will not apply anyshadowed state.
Parameter shadowing for the program will continue to be disabled until explicitly enabled with another call
to cgD3D9EnableParameterShadowing.
Parameter shadowing can also be specified during a call to cgD3D9LoadProgram.
EXAMPLES
// prog is a CGprogram initialized elsewhere
...
HRESULT hres = cgD3D9EnableParameterShadowing(prog, CG_FALSE);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
HISTORY
cgD3D9EnableParameterShadowing wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9IsParameterShadowingEnabled, cgD3D9LoadProgram
perl v5.10.0 Cg Toolkit 3.0 579
cgD3D9GetDevice(3) Cg Direct3D9 Runtime API cgD3D9GetDevice(3)
NAME cgD3D9GetDevice −retrievesthe current D3D9 device associated with the runtime
SYNOPSIS
#include <Cg/cgD3D9.h>
IDirect3DDevice9 * cgD3D9GetDevice( void );
PARAMETERS
None.
RETURN VALUES
Returns the current D3D9 device associated with the runtime.
DESCRIPTION
cgD3D9GetDevice retrievesthe current D3D9 device associated with the runtime. Note that the returned
device pointer may be NULL.
EXAMPLES
IDirect3DDevice9* curDevice = cgD3D9GetDevice();
ERRORS
None.
HISTORY
cgD3D9GetDevice wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetDevice
perl v5.10.0 Cg Toolkit 3.0 580
cgD3D9GetLastError(3) Cg Direct3D9 Runtime API cgD3D9GetLastError(3)
NAME cgD3D9GetLastError −get the last D3D error that occurred
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9GetLastError( void );
PARAMETERS
None.
RETURN VALUES
Returns the last D3D error that occurred during an expanded interface function call.
Returns D3D_OK if no D3D error has occurred since the last call to cgD3D9GetLastError.
DESCRIPTION
cgD3D9GetLastError retrievesthe last D3D error that occurred during an expanded interface function
call. The last error is always cleared immediately after the call.
EXAMPLES
HRESULT lastError = cgD3D9GetLastError();
ERRORS
None.
HISTORY
cgD3D9GetLastError wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9TranslateHRESULT
perl v5.10.0 Cg Toolkit 3.0 581
cgD3D9GetLatestPixelProfile(3) Cg Direct3D9 Runtime API cgD3D9GetLatestPixelProfile(3)
NAME cgD3D9GetLatestPixelProfile −get the latest supported pixel shader version
SYNOPSIS
#include <Cg/cgD3D9.h>
CGprofile cgD3D9GetLatestPixelProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest pixel shader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D9GetLatestPixelProfile retrievesthe latest pixel shader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 2.2, if the environment variable CGD3D9_LATEST_PIXEL_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D9GetLatestPixelProfile.
EXAMPLES
CGprofile bestPixelProfile = cgD3D9GetLatestPixelProfile();
ERRORS
None.
HISTORY
cgD3D9GetLatestPixelProfile wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 582
cgD3D9GetLatestVertexProfile(3) Cg Direct3D9 Runtime API cgD3D9GetLatestVertexProfile(3)
NAME cgD3D9GetLatestVertexProfile −get the latest supported vertexshader version
SYNOPSIS
#include <Cg/cgD3D9.h>
CGprofile cgD3D9GetLatestVertexProfile( void );
PARAMETERS
None.
RETURN VALUES
Returns the latest vertexshader version supported by the current D3D device.
Returns CG_PROFILE_UNKNOWN if no D3D device is currently set.
DESCRIPTION
cgD3D9GetLatestVertexProfile retrievesthe latest vertexshader version that the current D3D device
supports. This is an expanded interface function because it needs to knowabout the D3D device to
determine the most current version supported.
Starting in Cg 2.2, if the environment variable CGD3D9_LATEST_VERTEX_PROFILE is set in the
application’senvironment to a string that cgGetProfile translates to a valid profile (meaning not
CG_PROFILE_UNKNOWN), then it is this CGprofile value that will be returned by
cgD3D9GetLatestVertexProfile.
EXAMPLES
CGprofile bestVertexProfile = cgD3D9GetLatestVertexProfile();
ERRORS
None.
HISTORY
cgD3D9GetLatestVertexProfile wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9GetLatestPixelProfile
perl v5.10.0 Cg Toolkit 3.0 583
cgD3D9GetManageTextureParameters(3) Cg Direct3D9 Runtime API cgD3D9GetManageTextureParameters(3)
NAME cgD3D9GetManageTextureParameters −get the manage texture parameters flag from a context
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9GetManageTextureParameters( CGcontext context );
PARAMETERS
context The context from which the automatic texture management setting will be retrieved.
RETURN VALUES
Returns the manage texture management flag from context.
DESCRIPTION
cgD3D9GetManageTextureParameters returns the manage texture management flag from context. See
cgD3D9SetManageTextureParameters for more information.
EXAMPLES
CGbool manage = cgD3D9GetManageTextureParameters( pCtx );
if( manage )
doSomething();
ERRORS
None.
HISTORY
cgD3D9GetManageTextureParameters wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 584
cgD3D9GetOptimalOptions(3) Cg Direct3D9 Runtime API cgD3D9GetOptimalOptions(3)
NAME cgD3D9GetOptimalOptions −get the best set of compiler options for a profile
SYNOPSIS
#include <Cg/cgD3D9.h>
char const ** cgD3D9GetOptimalOptions( CGprofile profile );
PARAMETERS
profile The profile whose optimal arguments are requested.
RETURN VALUES
Returns a null-terminated array of strings representing the optimal set of compiler options for profile.
Returns NULL if no D3D device is currently set.
DESCRIPTION
cgD3D9GetOptimalOptions returns the best set of compiler options for a givenprofile. This is an
expanded interface function because it needs to knowabout the D3D device to determine the most optimal
options.
The elements of the returned array are meant to be used as part of the args parameter to cgCreateProgram
or cgCreateProgramFromFile.
The returned string does not need to be destroyed by the application. However, the contents could change
if the function is called again for the same profile but a different D3D device.
EXAMPLES
const char* vertOptions[] ={myCustomArgs,
cgD3D9GetOptimalOptions(vertProfile),
NULL };
// create the vertex shader
CGprogram myVS = cgCreateProgramFromFile( context,
CG_SOURCE,
"vshader.cg",
vertProfile,
"VertexShader",
vertOptions);
ERRORS
None.
HISTORY
cgD3D9GetOptimalOptions wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9GetLatestVertexProfile, cgD3D9GetLatestPixelProfile, cgCreateProgram,
cgCreateProgramFromFile
perl v5.10.0 Cg Toolkit 3.0 585
cgD3D9GetTextureParameter(3) Cg Direct3D9 Runtime API cgD3D9GetTextureParameter(3)
NAME cgD3D9GetTextureParameter −get the value of a texture parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
IDirect3DBaseTexture9 * cgD3D9GetTextureParameter( CGparameter param );
PARAMETERS
param The texture parameter for which the D3D texture object will be retrieved.
RETURN VALUES
Returns a pointer to the D3D texture to which param wasset.
Return NULL if param has not been set.
DESCRIPTION
cgD3D9GetTextureParameter returns the D3D texture pointer to which a texture parameter was set using
cgD3D9SetTextureParameter.Ifthe parameter has not been set, the NULL will be returned.
EXAMPLES
// param is a texture parameter defined elsewhere...
HRESULT hr = cgD3D9SetTexture( param, cgD3D9GetTextureParameter( param ) );
ERRORS
None.
HISTORY
cgD3D9GetTextureParameter wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9SetTextureParameter
perl v5.10.0 Cg Toolkit 3.0 586
cgD3D9GetVertexDeclaration(3) Cg Direct3D9 Runtime API cgD3D9GetVertexDeclaration(3)
NAME cgD3D9GetVertexDeclaration −get the default vertexdeclaration stream
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9GetVertexDeclaration( CGprogram program,
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH] );
PARAMETERS
program The program from which to retrieve the vertexdeclaration.
decl A D3DVERTEXELEMENT9 array that will be filled with the D3D9 vertexdeclaration.
RETURN VALUES
Returns CG_TRUE on success.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D9GetVertexDeclaration retrievesthe default vertexdeclaration stream for a program. The
declaration always uses a tightly packed single stream. The stream is always terminated with
D3DDECL_END(),sothis can be used to determine the actual length of the returned declaration.
The default vertexdeclaration is always a single stream. There will be one D3DVERTEXELEMENT9
element for each varying input parameter.
If you want to use a custom vertexdeclaration, you can test that declaration for compatibility by calling
cgD3D9ValidateVertexDeclaration.
EXAMPLES
Forexample:
void main( in float4 pos : POSITION,
in float4 dif : COLOR0,
in float4 tex : TEXCOORD0,
out float4 hpos : POSITION );
would have this default vertexdeclaration:
const D3DVERTEXELEMENT9 decl[] = {
{0,0,D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{0,16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
{0,32, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
D3DDECL_END()
};
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgD3D9GetVertexDeclaration wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9ValidateVertexDeclaration
perl v5.10.0 Cg Toolkit 3.0 587
cgD3D9IsParameterShadowingEnabled(3) Cg Direct3D9 Runtime API cgD3D9IsParameterShadowingEnabled(3)
NAME cgD3D9IsParameterShadowingEnabled −determine if parameter shadowing is enabled
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9IsParameterShadowingEnabled( CGprogram program );
PARAMETERS
program The program to check for parameter shadowing.
RETURN VALUES
Returns CG_TRUE if parameter shadowing is enabled for program.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D9IsParameterShadowingEnabled determines if parameter shadowing is enabled for program.
EXAMPLES
// program is a CGprogram initialized elsewhere
...
CGbool isShadowing = cgD3D9IsParameterShadowingEnabled(program);
ERRORS
None.
HISTORY
cgD3D9IsParameterShadowingEnabled wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9EnableParameterShadowing, cgD3D9LoadProgram
perl v5.10.0 Cg Toolkit 3.0 588
cgD3D9IsProfileSupported(3) Cg Direct3D9 Runtime API cgD3D9IsProfileSupported(3)
NAME cgD3D9IsProfileSupported −determine if a profile is supported by cgD3D9
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9IsProfileSupported( CGprofile profile );
PARAMETERS
profile The profile which will be checked for support.
RETURN VALUES
Returns CG_TRUE if profile is supported by the cgD3D9 library.
Returns CG_FALSE otherwise.
HoweverifcgD3D9SetDevice has not been called to register a IDirect3DDevice9 device yet, this routine
returns CG_TRUE for all valid D3D9 profiles.
DESCRIPTION
cgD3D9IsProfileSupported returns CG_TRUE if the profile indicated by profile is supported by the
cgD3D9 library.
EXAMPLES
// assuming the program requires Shader Model 3.0 ...
if ((!cgD3D9IsProfileSupported(CG_PROFILE_VS_3_0)) ||
(!cgD3D9IsProfileSupported(CG_PROFILE_PS_3_0))) {
fprintf(stderr, "Sorry, required profiles not supported on this system.\n");
exit(1);
}
ERRORS
None.
HISTORY
cgD3D9IsProfileSupported wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9GetLatestPixelProfile, cgD3D9GetLatestVertexProfile
perl v5.10.0 Cg Toolkit 3.0 589
cgD3D9IsProgramLoaded(3) Cg Direct3D9 Runtime API cgD3D9IsProgramLoaded(3)
NAME cgD3D9IsProgramLoaded −determine if a program has been loaded
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9IsProgramLoaded( CGprogram program );
PARAMETERS
program The program which will be checked.
RETURN VALUES
Returns CG_TRUE if program has been loaded using cgD3D9LoadProgram.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D9IsProgramLoaded determines if a program has been loaded using cgD3D9LoadProgram.
EXAMPLES
// program is a CGprogram initialized elsewhere
...
CGbool isLoaded = cgD3D9IsProgramLoaded(program);
ERRORS
None.
HISTORY
cgD3D9IsProgramLoaded wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9LoadProgram
perl v5.10.0 Cg Toolkit 3.0 590
cgD3D9LoadProgram(3) Cg Direct3D9 Runtime API cgD3D9LoadProgram(3)
NAME cgD3D9LoadProgram −create a D3D shader and enable the expanded interface routines
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9LoadProgram( CGprogram program,
CGbool paramShadowing,
DWORD assemFlags );
PARAMETERS
program A program whose compiled output is used to create the D3D shader.
paramShadowing
Indicates if parameter shadowing is desired for program.
assemFlags
The flags to pass to D3DXAssembleShader.See the D3D documentation for a list of valid flags.
RETURN VALUES
Returns D3D_OK if the function succeeds or program has already been loaded.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9LoadProgram creates a D3D shader for a program and enables use of expanded interface routines
for that program.
cgD3D9LoadProgram assembles the compiled Cg output for program using D3DXAssembleShader and
then creates a D3D shader using IDirect3DDevice9::CreateVertexShader or
IDirect3DDevice9::CreatePixelShader depending on the program’sprofile.
Parameter shadowing is enabled or disabled for the program with paramShadowing.This behavior can be
changed after creating the program by calling cgD3D9EnableParameterShadowing.
The D3D shader handle is not returned. If the shader handle is desired by the application, the expanded
interface should not be used for that program.
EXAMPLES
// vertexProg is a CGprogram using a vertex profile
// pixelProg is a CGprogram using a pixel profile
...
HRESULT hr1 = cgD3D9LoadProgram(vertexProg, TRUE, D3DXASM_DEBUG);
HRESULT hr2 = cgD3D9LoadProgram(pixelProg, TRUE, 0);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_INVALIDPROFILE is returned if program’s profile is not a supported D3D profile.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
HISTORY
cgD3D9LoadProgram wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9EnableParameterShadowing, cgD3D9ValidateVertexDeclaration, cgD3D9SetDevice
perl v5.10.0 Cg Toolkit 3.0 591
cgD3D9RegisterStates(3) Cg Direct3D9 Runtime API cgD3D9RegisterStates(3)
NAME cgD3D9RegisterStates −registers graphics pass states for CgFX files
SYNOPSIS
#include <Cg/cgD3D9.h>
void cgD3D9RegisterStates( CGcontext context );
PARAMETERS
context The context in which to register the states.
RETURN VALUES
None.
DESCRIPTION
cgD3D9RegisterStates registers a set of states for passes in techniques in CgFX effect files. These states
correspond to the set of D3D states that is relevant and/or useful to be set in passes in effect files. See the
Cg User’sGuide for complete documentation of the states that are made available after calling
cgD3D9RegisterStates.
EXAMPLES
// register D3D9 states for this context
CGcontext = cgCreateContext();
cgD3D9RegisterStates(context);
ERRORS
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
HISTORY
cgD3D9RegisterStates wasintroduced in Cg 1.5.
Starting with Cg 2.2, when cgD3D9RegisterStates creates program states it calls cgSetStateLatestProfile to
register the latest profile for the appropriate program domain. The latest profile value is determined via
cgD3D9GetLatestVertexProfile or cgD3D9GetLatestPixelProfile
SEE ALSO
cgCreateState, cgSetStateLatestProfile, cgSetPassState, cgResetPassState, cgCallStateValidateCallback,
cgGLRegisterStates, cgD3D10RegisterStates
perl v5.10.0 Cg Toolkit 3.0 592
cgD3D9ResourceToDeclUsage(3) Cg Direct3D9 Runtime API cgD3D9ResourceToDeclUsage(3)
NAME cgD3D9ResourceToDeclUsage −get the D3DDECLUSAGE member associated with a resource
SYNOPSIS
#include <Cg/cgD3D9.h>
BYTE cgD3D9ResourceToDeclUsage( CGresource resource );
PARAMETERS
resource Enumerated type indicating the resource to convert to a D3DDECLUSAGE.
RETURN VALUES
Returns the D3DDECLUSAGE member associated with resource.This is generally the CGresource name
with the indexstripped off.
Returns CGD3D9_INVALID_USAGE if the resource is not a vertexshader input resource.
DESCRIPTION
cgD3D9ResourceToDeclUsage converts a CGresource enumerated type to a member of the
D3DDECLUSAGE enum. The returned type is not an explicit member of the enum to match the associated
member of the D3DVERTEXELEMENT9 struct, and also to allowfor an error return condition.
The returned value can be used as the Usage member of the D3DVERTEXELEMENT9 struct to create a
vertexdeclaration for a shader.See the D3D9 documentation for the full details on declaring vertex
declarations in D3D9.
EXAMPLES
D3DVERTEXELEMENT9 elt =
{
0, 0,
D3DDECLTYPE_FLOAT3,
D3DDECLMETHOD_DEFAULT,
cgD3D9ResourceToDeclUsage(CG_TEXCOORD3),
cgD3D9GetParameterResourceIndex(CG_TEXCOORD3)
};
ERRORS
None.
HISTORY
cgD3D9ResourceToDeclUsage wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9GetVertexDeclaration, cgD3D9ValidateVertexDeclaration
perl v5.10.0 Cg Toolkit 3.0 593
cgD3D9SetDevice(3) Cg Direct3D9 Runtime API cgD3D9SetDevice(3)
NAME cgD3D9SetDevice −set the D3D device
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetDevice( IDirect3DDevice9 * device );
PARAMETERS
device Pointer to an IDirect3DDevice9 interface that the expanded interface will use for any
D3D−specific routine it may call. This parameter can be NULL to free all D3D resources used by
the expanded interface and remove its reference to the D3D device.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetDevice informs the expanded interface of the newD3D device. This will destroyany D3D
resources for programs previously loaded with cgD3D9LoadProgram and use the newD3D device to
recreate them. The expanded interface will increment the reference count to the D3D device, so this
function must eventually be called with NULL to release that reference so D3D can be properly shut down.
If device is NULL,all D3D resources for programs previously loaded with cgD3D9LoadProgram are
destroyed. However, these programs are still considered managed by the expanded interface, so if a new
D3D device is set later these programs will be recreated using the newD3D device.
If a newdevice is being set, all D3D resources for programs previously loaded with cgD3D9LoadProgram
are rebuilt using the newdevice. All shadowed parameters for these programs are maintained across D3D
device changes except texture parameters. Since textures in D3D are bound to a particular D3D device,
these resources cannot be savedacross device changes. When these textures are recreated for the newD3D
device, theymust be re-bound to the sampler parameter.
Note that calling cgD3D9SetDevice(NULL)does not destroyany core runtime resources (CGprograms,
CGparameters,etc.) used by the expanded interface. These must be destroyed seperately using
cgDestroyProgram and cgDestroyContext.
EXAMPLES
// pDev is an IDirect3DDevice9 interface initialized elsewhere
...
cgD3D9SetDevice(pDev);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
HISTORY
cgD3D9SetDevice wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9GetDevice, cgDestroyProgram, cgDestroyContext, cgD3D9LoadProgram
perl v5.10.0 Cg Toolkit 3.0 594
cgD3D9SetManageTextureParameters(3) Cg Direct3D9 Runtime API cgD3D9SetManageTextureParameters(3)
NAME cgD3D9SetManageTextureParameters −set the manage texture parameters flag for a context
SYNOPSIS
#include <Cg/cgD3D9.h>
void cgD3D9SetManageTextureParameters( CGcontext context,
CGbool flag );
PARAMETERS
context The context in which the automatic texture management behavior will be changed.
flag A boolean switch which controls automatic texture management by the runtime.
RETURN VALUES
None.
DESCRIPTION
By default, cgD3D9 does not manage anytexture state in D3D. It is up to the user to enable and disable
textures using D3D. This behavior is the default to avoid conflicts with texture state on geometry that’s
rendered with the fixed function pipeline or without cgD3D9.
If automatic texture management is desired, cgD3D9SetManageTextureParameters may be called with
flag set to CG_TRUE before cgD3D9BindProgram is called. WhenevercgD3D9BindProgram is called, the
cgD3D9 runtime will makeall the appropriate texture parameter calls on the application’sbehalf.
Calling cgD3D9SetManageTextureParameters with flag set to CG_FALSE will disable automatic texture
management.
NOTE: When cgD3D9SetManageTextureParameters is set to CG_TRUE,applications should not make
texture state change calls to D3D after calling cgD3D9BindProgram, unless the application is trying to
override some parts of cgD3D9’stexture management.
EXAMPLES
// Enable automatic texture management
cgD3D9SetManageTextureParmeters( pCtx, CG_TRUE );
ERRORS
None.
HISTORY
cgD3D9SetManageTextureParameters wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9GetManageTextureParameters, cgD3D9BindProgram
perl v5.10.0 Cg Toolkit 3.0 595
cgD3D9SetSamplerState(3) Cg Direct3D9 Runtime API cgD3D9SetSamplerState(3)
NAME cgD3D9SetSamplerState −set the state associated with a sampler parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetSamplerState( CGparameter param,
D3DSAMPLERSTATETYPE type,
DWORD value );
PARAMETERS
param The sampler parameter whose state is to be set.
type The D3D sampler state to set.
value A value appropriate for type.See the D3D documentation for appropriate values for each valid
type.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetSamplerState sets the state associated with a sampler parameter.
EXAMPLES
// param is a CGparameter handle of type sampler
...
// Set this sampler for tri−linear filtering
cgD3D9SetSamplerState(param, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
cgD3D9SetSamplerState(param, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
cgD3D9SetSamplerState(param, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_INVALIDPROFILE is returned if params’s profile is not a supported D3D profile.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTSAMPLER is returned if param is not a sampler.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetSamplerState wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetTexture, cgD3D9SetTextureWrapMode
perl v5.10.0 Cg Toolkit 3.0 596
cgD3D9SetTexture(3) Cg Direct3D9 Runtime API cgD3D9SetTexture(3)
NAME cgD3D9SetTexture −set the texture for a sampler parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetTexture( CGparameter param,
IDirect3DBaseTexture9 * texture );
PARAMETERS
param The sampler parameter whose values are to be set.
texture Pointer to an IDirect3DBaseTexture9,the texture to set for param.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetTexture sets the texture for a sampler parameter.
When parameter shadowing is enabled, the D3D runtime will maintain a reference (via AddRef)to
texture,socare must be taken to set the parameter back to NULL when the texture is no longer needed.
Otherwise the reference count will not reach zero and the texture’sresources will not get destroyed. When
destroying the program that the parameter is associated with, all references to these textures are
automatically removed.
EXAMPLES
// param is a CGparameter handle of type sampler
// tex is an IDirect3DTexture9* intialized elswhere
...
cgD3D9SetTexture(param, tex);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_INVALIDPROFILE is returned if params’s profile is not a supported D3D profile.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTSAMPLER is returned if param is not a sampler.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetTexture wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetSamplerState, cgD3D9SetTextureWrapMode
perl v5.10.0 Cg Toolkit 3.0 597
cgD3D9SetTextureParameter(3) Cg Direct3D9 Runtime API cgD3D9SetTextureParameter(3)
NAME cgD3D9SetTextureParameter −sets the value of a texture parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
void cgD3D9SetTextureParameter( CGparameter param,
IDirect3DBaseTexture9 * texture );
PARAMETERS
param The texture parameter that will be set.
texture An D3D texture to which the parameter will be set.
RETURN VALUES
None.
DESCRIPTION
cgD3D9SetTextureParameter sets the value of a texture parameter to a givenD3D9 texture object.
cgD3D9SetTextureParameter is to be used for setting texture parameters in a CgFX effect instead of
cgD3D9SetTexture.
EXAMPLES
IDirect3DTexture9 *myTexture;
// Assume myTexture is loaded here...
// param is an effect sampler parameter
cgD3D9SetTextureParameter( param, myTexture );
ERRORS
CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter handle.
HISTORY
cgD3D9SetTextureParameter wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9GetTextureParameter,cgD3D9SetManageTextureParameters
perl v5.10.0 Cg Toolkit 3.0 598
cgD3D9SetTextureWrapMode(3) Cg Direct3D9 Runtime API cgD3D9SetTextureWrapMode(3)
NAME cgD3D9SetTextureWrapMode −set the texture wrap mode for a sampler parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetTextureWrapMode( CGparameter param,
DWORD value );
PARAMETERS
param The sampler parameter whose wrap mode is to be set.
value The texture wrap mode. value can be zero (0) or a combination of D3DWRAP_U,
D3DWRAP_V,and D3DWRAP_W.See the D3D documentation for an explanation of texture
wrap modes (D3DRS_WRAP0−7).
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetTextureWrapMode sets the texture wrap mode associated with a sampler parameter.
EXAMPLES
// param is a CGparameter handle of type sampler
...
// Set this sampler for wrapping in 2D
cgD3D9SetTextureWrapMode(param, D3DWRAP_U | D3DWRAP_V);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_INVALIDPROFILE is returned if params’s profile is not a supported D3D profile.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTSAMPLER is returned if param is not a sampler.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetTextureWrapMode wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetTexture, cgD3D9SetSamplerState
perl v5.10.0 Cg Toolkit 3.0 599
cgD3D9SetUniform(3) Cg Direct3D9 Runtime API cgD3D9SetUniform(3)
NAME cgD3D9SetUniform −set the value of a uniform parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetUniform( CGparameter param,
const void * values );
PARAMETERS
param The parameter whose values are to be set. param must be a uniform parameter that is not a
sampler.
values The values to which to set param.The amount of data required depends on the type of
parameter,but is always specified as an array of one or more floating point values. The type is
void* so a compatible user-defined structure can be passed in without type-casting. Use
cgD3D9TypeToSize to determine howmanyvalues are required for a particular type.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetUniform sets the value for a uniform parameter.All values should be of type float. There is
assumed to be enough values to set all elements of the parameter.
EXAMPLES
// param is a CGparameter handle of type float3
// matrixParam is a CGparameter handle of type float2x3
// arrayParam is a CGparameter handle of type float2x2[3]
...
// intialize the data for each parameter
D3DXVECTOR3 paramData(1,2,3);
float matrixData[2][3] =
{
0,1,2,
3,4,5
};
float arrayData[3][2][2] =
{
0,1,
2,3,
4,5,
6,7,
8,9,
0,1
};
...
// set the parameters
cgD3D9SetUniform(param, paramData);
cgD3D9SetUniform(matrixParam, matrixData);
// you can use arrays, but you must set the entire array
cgD3D9SetUniform(arrayParam, arrayData);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
perl v5.10.0 Cg Toolkit 3.0 600
cgD3D9SetUniform(3) Cg Direct3D9 Runtime API cgD3D9SetUniform(3)
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetUniform wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetUniformArray,cgD3D9SetUniformMatrix, cgD3D9SetUniformMatrixArray,
cgD3D9TypeToSize
perl v5.10.0 Cg Toolkit 3.0 601
cgD3D9SetUniformArray(3) Cg Direct3D9 Runtime API cgD3D9SetUniformArray(3)
NAME cgD3D9SetUniformArray −set the elements of an array of uniform parameters
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetUniformArray( CGparameter param,
DWORD offset,
DWORD numItems,
const void * values );
PARAMETERS
param The parameter whose array elements are to be set. It must be a uniform parameter that is not a
sampler.
offset The offset at which to start setting array elements.
numItemsThe number of array elements to set.
values An array of floats, the elements in the array to set for param. The amount of data required
depends on the type of parameter,but is always specified as an array of one or more floating point
values. The type is void* so a compatible user-defined structure can be passed in without type-
casting. Use cgD3D9TypeToSize to determine howmanyvalues are required for a particular
type. This size multiplied by numItems is the number of values this function expects.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetUniformArray sets the elements for an array of uniform parameters. All values should be of
type float. There is assumed to be enough values to set all specified elements of the array.
EXAMPLES
// param is a CGparameter handle of type float3
// arrayParam is a CGparameter handle of type float2x2[3]
...
// intialize the data for each parameter
D3DXVECTOR3 paramData(1,2,3);
float arrayData[2][2][2] =
{
0,1,
2,3,
4,5,
6,7
};
...
// non−arrays can be set, but only when offset=0 and numItems=1.
cgD3D9SetUniformArray(param, paramData, 0, 1);
// set the 2nd and 3rd elements of the array
cgD3D9SetUniform(arrayParam, arrayData, 1, 2);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
perl v5.10.0 Cg Toolkit 3.0 602
cgD3D9SetUniformArray(3) Cg Direct3D9 Runtime API cgD3D9SetUniformArray(3)
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_NULLVALUE is returned if values is NULL.
CGD3D9ERR_OUTOFRANGE is returned if offset plus numItems is out of the range of param.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetUniformArray wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetUniform, cgD3D9SetUniformMatrix, cgD3D9SetUniformMatrixArray,cgD3D9TypeToSize
perl v5.10.0 Cg Toolkit 3.0 603
cgD3D9SetUniformMatrix(3) Cg Direct3D9 Runtime API cgD3D9SetUniformMatrix(3)
NAME cgD3D9SetUniformMatrix −set the values of a uniform matrix parameter
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetUniformMatrix( CGparameter param,
const D3DMATRIX * matrix );
PARAMETERS
param The parameter whose values are to be set. It must be a uniform matrix parameter.
matrix The matrix to set for the parameter.The upper-left portion of the matrix is extracted to fit the size
of param.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetUniformMatrix sets the values of a uniform matrix parameter.
EXAMPLES
// matrixParam is a CGparameter handle of type float3x2
// arrayParam is a CGparameter handle of type float4x4[2]
...
// intialize the data for each parameter
D3DXMATRIX matTexTransform(
0.5f, 0, 0, 0,
0, 0.5f, 0, 0,
0.5f, 0.5f, 0, 0,
0, 0, 0, 0
);
D3DXMATRIX matRot[2];
D3DXMatrixRotationAxis(&matRot[0], &D3DXVECTOR3(0,0,1), D3DX_PI*0.5f);
D3DXMatrixRotationAxis(&matRot[1], &D3DXVECTOR3(0,1,0), D3DX_PI*0.5f);
...
// only use the upper−left portion
cgD3D9SetUniform(matrixParam, &matTexTransform);
// you can use arrays, but you must set the entire array
cgD3D9SetUniform(arrayParam, matRot);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTMATRIX is returned if param is not a matrix.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetUniformMatrix wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetUniform, cgD3D9SetUniformMatrixArray,cgD3D9TypeToSize
perl v5.10.0 Cg Toolkit 3.0 604
cgD3D9SetUniformMatrixArray(3) Cg Direct3D9 Runtime API cgD3D9SetUniformMatrixArray(3)
NAME cgD3D9SetUniformMatrixArray −set the elements for an array of uniform matrix parameters
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9SetUniformMatrixArray( CGparameter param,
DWORD offset,
DWORD numItems,
const D3DMATRIX * matrices );
PARAMETERS
param The parameter whose array elements are to be set. It must be a uniform matrix parameter.
offset The offset at which to start setting array elements.
numItemsThe number of array elements to set.
matrices An array of matrices to set for param.The upper-left portion of each matrix is extracted to fit the
size of the input parameter. numItems matrices are expected to be passed to the function.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9SetUniformMatrixArray sets the elements for an array of uniform matrix parameters.
EXAMPLES
// matrixParam is a CGparameter handle of type float3x2
// arrayParam is a CGparameter handle of type float4x4[4]
...
// intialize the data for each parameter
D3DXMATRIX matTexTransform(
0.5f,0, 0,0,
0,0.5f, 0,0,
0.5f,0.5f, 0,0,
0,0, 0,0
);
D3DXMATRIX matRot[2];
D3DXMatrixRotationAxis(&matRot[0], &D3DXVECTOR3(0,0,1), D3DX_PI*0.5f);
D3DXMatrixRotationAxis(&matRot[1], &D3DXVECTOR3(0,1,0), D3DX_PI*0.5f);
...
// only use the upper−left portion.
// non−arrays can be set, but only when offset=0 and numItems=1.
cgD3D9SetUniformArray(matrixParam, &matTexTransform, 0, 1);
// set the 3rd and 4th elements of the array
cgD3D9SetUniformArray(arrayParam, matRot, 2, 2);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NOTMATRIX is returned if param is not a matrix.
CGD3D9ERR_NOTUNIFORM is returned if param is not a uniform parameter.
perl v5.10.0 Cg Toolkit 3.0 605
cgD3D9SetUniformMatrixArray(3) Cg Direct3D9 Runtime API cgD3D9SetUniformMatrixArray(3)
CGD3D9ERR_NULLVALUE is returned if matrices is NULL.
CGD3D9ERR_OUTOFRANGE is returned if offset plus numItems is out of the range of param.
CGD3D9ERR_INVALIDPARAM is returned if the parameter fails to set for anyother reason.
HISTORY
cgD3D9SetUniformMatrixArray wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9SetUniform, cgD3D9SetUniformArray,cgD3D9SetUniformMatrix, cgD3D9TypeToSize
perl v5.10.0 Cg Toolkit 3.0 606
cgD3D9TranslateCGerror(3) Cg Direct3D9 Runtime API cgD3D9TranslateCGerror(3)
NAME cgD3D9TranslateCGerror −convert a Cg runtime error into a string
SYNOPSIS
#include <Cg/cgD3D9.h>
const char * cgD3D9TranslateCGerror( CGerror error );
PARAMETERS
error The error code to translate. Can be a core runtime error or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing error.
DESCRIPTION
cgD3D9TranslateCGerror converts a Cg runtime error into a string. This routine should be called instead
of the core runtime routine cgGetErrorString because it will also translate errors that the Cg D3D runtime
generates.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
CGerror error = cgGetLastError();
if (error != CG_NO_ERROR)
{
sprintf(buf, "An error occurred. Error description: '%s'\n",
cgD3D9TranslateCGerror(error));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D9TranslateCGerror wasintroduced in Cg 1.1.
SEE ALSO
cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 607
cgD3D9TranslateHRESULT(3) Cg Direct3D9 Runtime API cgD3D9TranslateHRESULT(3)
NAME cgD3D9TranslateHRESULT −convert an HRESULT into a string
SYNOPSIS
#include <Cg/cgD3D9.h>
const char * cgD3D9TranslateHRESULT( HRESULT hr );
PARAMETERS
hr The HRESULT to translate. Can be a generic HRESULT or a D3D runtime error.
RETURN VALUES
Returns a pointer to a string describing the error.
DESCRIPTION
cgD3D9TranslateHRESULT converts an HRESULT into a string. This routine should be called instead of
DXGetErrorDescription9 because it will also translate errors that the Cg D3D runtime generates.
This routine will typically be called in debugging situations such as inside an error callback set using
cgSetErrorCallback.
EXAMPLES
char buf[512];
HRESULT hres = cgD3D9GetLastError();
if (FAILED(hres))
{
sprintf(buf, "A D3D error occurred. Error description: '%s'\n",
cgD3D9TranslateHRESULT(hres));
OutputDebugString(buf);
}
ERRORS
None.
HISTORY
cgD3D9TranslateHRESULT wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9TranslateCGerror,cgGetErrorString, cgSetErrorCallback
perl v5.10.0 Cg Toolkit 3.0 608
cgD3D9TypeToSize(3) Cg Direct3D9 Runtime API cgD3D9TypeToSize(3)
NAME cgD3D9TypeToSize −get the size of a CGtype enumerated type
SYNOPSIS
#include <Cg/cgD3D9.h>
DWORD cgD3D9TypeToSize( CGtype type );
PARAMETERS
type Member of the CGtype enumerated type whose size is to be returned.
RETURN VALUES
Returns the size of type in terms of consecutive floating point values.
Returns 0if the type does not have aninherent size. Sampler types fall into this category.
DESCRIPTION
cgD3D9TypeToSize retrievesthe size of a CGtype enumerated type in terms of consecutive floating point
values.
If the type does not have aninherent size, the return value is 0. Sampler types fall into this category.
EXAMPLES
// param is a CGparameter initialized earlier
...
DWORD size = cgD3D9TypeToSize(cgGetParameterType(param));
// (sanity check that parameters have the expected size)
...
assert(cgD3D9TypeToSize(cgGetParameterType(vsModelView)) == 16);
assert(cgD3D9TypeToSize(cgGetParameterType(psColor)) == 4);
ERRORS
None.
HISTORY
cgD3D9TypeToSize wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9ResourceToDeclUsage, cgD3D9GetVertexDeclaration, cgD3D9ValidateVertexDeclaration
perl v5.10.0 Cg Toolkit 3.0 609
cgD3D9UnbindProgram(3) Cg Direct3D9 Runtime API cgD3D9UnbindProgram(3)
NAME cgD3D9UnbindProgram −de-activate a program with D3D
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9UnbindProgram( CGprogram program );
PARAMETERS
program The program to de-activate with D3D.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9UnbindProgram de-activates a program with D3D. The program is de-activated using
IDirect3DDevice9::SetVertexShader or IDirect3DDevice9::SetPixelShader with a NULL argument
depending on the program’sprofile type.
EXAMPLES
// vertexProg and pixelProg are CGprograms initialized elsewhere
// pDev is an IDirect3DDevice9 interface intialized elsewhere
...
HRESULT hr = cgD3D9BindProgram(vertexProg);
HRESULT hr2 = cgD3D9BindProgram(pixelProg);
// Draw a quad using the vertex and pixel shader
// A vertex and index buffer are set up elsewhere.
HRESULT hr3 = pDev−>DrawIndexedPrimitve(D3DPT_TRIANGLELIST, 0, 4, 0, 2);
cgD3D9UnbindProgram(vertexProg);
cgD3D9UnbindProgram(pixelProg);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
HISTORY
cgD3D9UnbindProgram wasintroduced in Cg 3.0.
SEE ALSO
cgD3D9LoadProgram, cgD3D9BindProgram
perl v5.10.0 Cg Toolkit 3.0 610
cgD3D9UnloadAllPrograms(3) Cg Direct3D9 Runtime API cgD3D9UnloadAllPrograms(3)
NAME cgD3D9UnloadAllPrograms −unload all D3D programs
SYNOPSIS
#include <Cg/cgD3D9.h>
void cgD3D9UnloadAllPrograms( void );
PARAMETERS
None.
RETURN VALUES
None.
DESCRIPTION
cgD3D9UnloadAllPrograms unloads all of the currently loaded D3D programs.
See cgD3D9UnloadProgram for details on what the runtime does when unloading a program.
EXAMPLES
// unload all D3D programs
cgD3D9UnloadAllPrograms();
ERRORS
None.
HISTORY
cgD3D9UnloadAllPrograms wasintroduced in Cg 1.5.
SEE ALSO
cgD3D9UnloadProgram
perl v5.10.0 Cg Toolkit 3.0 611
cgD3D9UnloadProgram(3) Cg Direct3D9 Runtime API cgD3D9UnloadProgram(3)
NAME cgD3D9UnloadProgram −destroyD3D shader and disable use of expanded interface routines
SYNOPSIS
#include <Cg/cgD3D9.h>
HRESULT cgD3D9UnloadProgram( CGprogram program );
PARAMETERS
program The program for which to disable expanded interface management. The CGprogram handle is
still valid after this call.
RETURN VALUES
Returns D3D_OK if the function succeeds.
Returns the D3D failure code if the function fails due to a D3D call.
DESCRIPTION
cgD3D9UnloadProgram destroys the D3D shader for a program and disables use of expanded interface
routines for that program.
This call does not destroythe CGprogram itself. It only destroys the resources used by the expanded
interface, such as the D3D shader object and anyshadowed parameters. Use the core runtime function
cgDestroyProgram to free the CGprogram itself. Also note that freeing a CGprogram using the core
runtime implicitly calls this routine to avoid resource leaks.
This call is only necessary if specific lifetime control of expanded interface resources outside the lifetime of
their associated CGprogram is desired. Forinstance, if the expanded interface is no longer used, but the
CGprogram handle will still be used.
EXAMPLES
// prog is a CGprogram initialized elsewhere
...
HRESULT hres = cgD3D9UnloadProgram(prog);
ERRORS
cgD3D9Failed is generated if a D3D function returns an error.
CGD3D9ERR_NOTLOADED is returned if program wasnot loaded with the cgD3D9LoadProgram.
CGD3D9ERR_NODEVICE is returned if a required D3D device is NULL.This usually occurs when an
expanded interface routine is called but a D3D device has not been set with cgD3D9SetDevice.
HISTORY
cgD3D9UnloadProgram wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9UnloadAllPrograms, cgDestroyProgram
perl v5.10.0 Cg Toolkit 3.0 612
cgD3D9ValidateVertexDeclaration(3) Cg Direct3D9 Runtime API cgD3D9ValidateVertexDeclaration(3)
NAME cgD3D9ValidateVertexDeclaration −validate a custom D3D9 vertexdeclaration stream
SYNOPSIS
#include <Cg/cgD3D9.h>
CGbool cgD3D9ValidateVertexDeclaration( CGprogram program,
const D3DVERTEXELEMENT9 * decl );
PARAMETERS
program The program to test for compatibility.
decl The D3D9 custom vertexdeclaration stream to test for compatibility.Itmust be terminated by
D3DDECL_END().
RETURN VALUES
Returns CG_TRUE if the vertexstream is compatible.
Returns CG_FALSE otherwise.
DESCRIPTION
cgD3D9ValidateVertexDeclaration tests a custom D3D9 vertexdeclaration stream for compatibility with
the inputs expected by a program.
Foravertexstream to be compatible with a program’sexpected inputs it must have a
D3DVERTEXELEMENT9 element for each varying input parameter that the program uses.
EXAMPLES
// Decl is a custom vertex declaraton already setup
CGbool ret = cgD3D9ValidateVertexDeclaration( program, Decl );
if( ret == CG_FALSE )
printf( "Vertex declaration not compatable with "
"the program's varying parameters.\n" );
ERRORS
CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.
HISTORY
cgD3D9ValidateVertexDeclaration wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9ResourceToDeclUsage
perl v5.10.0 Cg Toolkit 3.0 613
cgD3D8BindProgram(3) Cg Direct3D8 Runtime API cgD3D8BindProgram(3)
NAME cgD3D8BindProgram −activate a program with D3D
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8BindProgram( CGprogram prog );
PARAMETERS
program A CGprogram handle, the program to activate with D3D.
RETURN VALUES
cgD3D8BindProgram returns D3D_OK if the function succeeds.
If the function fails due to a D3D call, that D3D failure code is returned.
DESCRIPTION
cgD3D8BindProgram does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8BindProgram wasintroduced in Cg 1.1.
SEE ALSO
cgD3D9BindProgram
perl v5.10.0 Cg Toolkit 3.0 614
cgD3D8EnableDebugTracing(3) Cg Direct3D8 Runtime API cgD3D8EnableDebugTracing(3)
NAME cgD3D8EnableDebugTracing to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
void cgD3D8EnableDebugTracing( CGbool enable );
PARAMETERS
to-be-written
to-be-written
RETURN VALUES
None.
or
cgD3D8EnableDebugTracing returns to-be-written
DESCRIPTION
cgD3D8EnableDebugTracing does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8EnableDebugTracing wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 615
cgD3D8EnableParameterShadowing(3) Cg Direct3D8 Runtime API cgD3D8EnableParameterShadowing(3)
NAME cgD3D8EnableParameterShadowing to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetTextureWrapMode( CGparameter param,
DWORD value );
PARAMETERS
to-be-written
to-be-written
RETURN VALUES
None.
or
cgD3D8EnableParameterShadowing returns to-be-written
DESCRIPTION
cgD3D8EnableParameterShadowing does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8EnableParameterShadowing wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 616
cgD3D8GetDevice(3) Cg Direct3D8 Runtime API cgD3D8GetDevice(3)
NAME cgD3D8GetDevice to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
IDirect3DDevice8* cgD3D8GetDevice();
PARAMETERS
to-be-written
to-be-written
RETURN VALUES
None.
or
cgD3D8GetDevice returns to-be-written
DESCRIPTION
cgD3D8GetDevice does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetDevice wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 617
cgD3D8GetLastError(3) Cg Direct3D8 Runtime API cgD3D8GetLastError(3)
NAME cgD3D8GetLastError to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8GetLastError();
PARAMETERSNone
RETURN VALUES
None.
or
cgD3D8GetLastError returns to-be-written
DESCRIPTION
cgD3D8GetLastError does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetLastError wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 618
cgD3D8GetLatestPixelProfile(3) Cg Direct3D8 Runtime API cgD3D8GetLatestPixelProfile(3)
NAME cgD3D8GetLatestPixelProfile to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
CGprofile cgD3D8GetLatestPixelProfile();
PARAMETERS
to-be-written
to-be-written
RETURN VALUES
None.
or
cgD3D8GetLatestPixelProfile returns to-be-written
DESCRIPTION
cgD3D8GetLatestPixelProfile does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetLatestPixelProfile wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 619
cgD3D8GetLatestVertexProfile(3) Cg Direct3D8 Runtime API cgD3D8GetLatestVertexProfile(3)
NAME cgD3D8GetLatestVertexProfile to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
CGprofile cgD3D8GetLatestVertexProfile();
PARAMETERSNone
RETURN VALUES
None.
or
cgD3D8GetLatestVertexProfile returns to-be-written
DESCRIPTION
cgD3D8GetLatestVertexProfile does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetLatestVertexProfile wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 620
cgD3D8GetOptimalOptions(3) Cg Direct3D8 Runtime API cgD3D8GetOptimalOptions(3)
NAME cgD3D8GetOptimalOptions to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
char const* cgD3D8GetOptimalOptions( CGprofile profile );
PARAMETERS
profile Cg profile for which to get optimal options.
RETURN VALUES
None.
or
cgD3D8GetOptimalOptions returns to-be-written
DESCRIPTION
cgD3D8GetOptimalOptions does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetOptimalOptions wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 621
cgD3D8GetVertexDeclaration(3) Cg Direct3D8 Runtime API cgD3D8GetVertexDeclaration(3)
NAME cgD3D8GetVertexDeclaration to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
cgD3D8GetVertexDeclaration prototype goes here.
CGbool cgD3D8GetVertexDeclaration( CGprogram prog,
DWORD decl[MAX_FVF_DECL_SIZE] );
PARAMETERS
to-be-written
to-be-written
RETURN VALUES
None.
or
cgD3D8GetVertexDeclaration returns to-be-written
DESCRIPTION
cgD3D8GetVertexDeclaration does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8GetVertexDeclaration wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 622
cgD3D8IsParameterShadowingEnabled(3) Cg Direct3D8 Runtime API cgD3D8IsParameterShadowingEnabled(3)
NAME cgD3D8IsParameterShadowingEnabled to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
CGbool cgD3D8IsParameterShadowingEnabled( CGprogram prog );
PARAMETERS
prog Cg program for which to query if parameter shadowing is enabled.
RETURN VALUES
None.
or
cgD3D8IsParameterShadowingEnabled returns to-be-written
DESCRIPTION
cgD3D8IsParameterShadowingEnabled does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8IsParameterShadowingEnabled wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 623
cgD3D8IsProgramLoaded(3) Cg Direct3D8 Runtime API cgD3D8IsProgramLoaded(3)
NAME cgD3D8IsProgramLoaded to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
CGbool cgD3D8IsProgramLoaded( CGprogram prog );
PARAMETERS
prog Cg program handle.
RETURN VALUES
None.
or
cgD3D8IsProgramLoaded returns to-be-written
DESCRIPTION
cgD3D8IsProgramLoaded does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8IsProgramLoaded wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 624
cgD3D8LoadProgram(3) Cg Direct3D8 Runtime API cgD3D8LoadProgram(3)
NAME cgD3D8LoadProgram to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8LoadProgram( CGprogram prog,
CGbool paramShadowing,
DWORD assemFlags,
DWORD vshaderUsage,
const DWORD* vertexDecl );
PARAMETERS
prog Cg program handle.
paramShadowing
Boolean for whether parameter shadowing should occur.
assemFlags
Flags passed to the assembler.
vsharedUsage
to-be-written
vertexDecl
to-be-written
RETURN VALUES
None.
or
cgD3D8LoadProgram returns to-be-written
DESCRIPTION
cgD3D8LoadProgram does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8LoadProgram wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 625
cgD3D8ResourceToInputRegister(3) Cg Direct3D8 Runtime API cgD3D8ResourceToInputRegister(3)
NAME cgD3D8ResourceToInputRegister to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
DWORD cgD3D8ResourceToInputRegister( CGresource resource );
PARAMETERS
resource to-be-written
RETURN VALUES
None.
or
cgD3D8ResourceToInputRegister returns to-be-written
DESCRIPTION
cgD3D8ResourceToInputRegister does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8ResourceToInputRegister wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 626
cgD3D8SetDevice(3) Cg Direct3D8 Runtime API cgD3D8SetDevice(3)
NAME cgD3D8SetDevice to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetDevice( IDirect3DDevice8* pDevice );
PARAMETERS
pDevice to-be-written
RETURN VALUES
None.
or
cgD3D8SetDevice returns to-be-written
DESCRIPTION
cgD3D8SetDevice does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetDevice wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 627
cgD3D8SetTexture(3) Cg Direct3D8 Runtime API cgD3D8SetTexture(3)
NAME cgD3D8SetTexture to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetTexture( CGparameter param,
IDirect3DBaseTexture8* tex );
PARAMETERS
param Cg parameter handle.
texto-be-written
RETURN VALUES
None.
or
cgD3D8SetTexture returns to-be-written
DESCRIPTION
cgD3D8SetTexture does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetTexture wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 628
cgD3D8SetTextureStageState(3) Cg Direct3D8 Runtime API cgD3D8SetTextureStageState(3)
NAME cgD3D8SetTextureStageState to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetTextureStageState( CGparameter param,
D3DTEXTURESTAGESTATETYPE type,
DWORD value );
PARAMETERS
param Cg parameter handle.
type to-be-written
value to-be-written
RETURN VALUES
None.
or
cgD3D8SetTextureStageState returns to-be-written
DESCRIPTION
cgD3D8SetTextureStageState does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetTextureStageState wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 629
cgD3D8SetTextureWrapMode(3) Cg Direct3D8 Runtime API cgD3D8SetTextureWrapMode(3)
NAME cgD3D8SetTextureWrapMode to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetTextureWrapMode( CGparameter param,
DWORD value );
PARAMETERS
param Cg parameter handle.
value to-be-written
RETURN VALUES
None.
or
cgD3D8SetTextureWrapMode returns to-be-written
DESCRIPTION
cgD3D8SetTextureWrapMode does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetTextureWrapMode wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 630
cgD3D8SetUniform(3) Cg Direct3D8 Runtime API cgD3D8SetUniform(3)
NAME cgD3D8SetUniform to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetUniform( CGparameter param,
const void* floats );
PARAMETERS
param Cg parameter handle.
floats to-be-written
RETURN VALUES
None.
or
cgD3D8SetUniform returns to-be-written
DESCRIPTION
cgD3D8SetUniform does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetUniform wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 631
cgD3D8SetUniformArray(3) Cg Direct3D8 Runtime API cgD3D8SetUniformArray(3)
NAME cgD3D8SetUniformArray to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetUniformArray( CGparameter param,
DWORD offset,
DWORD numItems,
const void* values );
PARAMETERS
param Cg parameter handle.
offset to-be-written
numItems
to-be-written
values to-be-written
RETURN VALUES
None.
or
cgD3D8SetUniformArray returns to-be-written
DESCRIPTION
cgD3D8SetUniformArray does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetUniformArray wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 632
cgD3D8SetUniformMatrix(3) Cg Direct3D8 Runtime API cgD3D8SetUniformMatrix(3)
NAME cgD3D8SetUniformMatrix to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetUniformMatrix( CGparameter param,
const D3DMATRIX* matrix );
PARAMETERS
param Cg parameter handle.
matrix to-be-written
RETURN VALUES
None.
or
cgD3D8SetUniformMatrix returns to-be-written
DESCRIPTION
cgD3D8SetUniformMatrix does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetUniformMatrix wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 633
cgD3D8SetUniformMatrixArray(3) Cg Direct3D8 Runtime API cgD3D8SetUniformMatrixArray(3)
NAME cgD3D8SetUniformMatrixArray to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8SetUniformMatrixArray( CGparameter param,
DWORD offset,
DWORD numItems,
const D3DMATRIX* matrices );
PARAMETERS
param Cg parameter handle.
offset to-be-written
numItems
to-be-written
matrices to-be-written
RETURN VALUES
None.
or
cgD3D8SetUniformMatrixArray returns to-be-written
DESCRIPTION
cgD3D8SetUniformMatrixArray does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8SetUniformMatrixArray wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 634
cgD3D8TranslateCGerror(3) Cg Direct3D8 Runtime API cgD3D8TranslateCGerror(3)
NAME cgD3D8TranslateCGerror to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
const char* cgD3D8TranslateCGerror( CGerror error );
PARAMETERS
error Cg error code.
RETURN VALUES
None.
or
cgD3D8TranslateCGerror returns to-be-written
DESCRIPTION
cgD3D8TranslateCGerror does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8TranslateCGerror wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 635
cgD3D8TranslateHRESULT(3) Cg Direct3D8 Runtime API cgD3D8TranslateHRESULT(3)
NAME cgD3D8TranslateHRESULT to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
const char* cgD3D8TranslateHRESULT( HRESULT hr );
PARAMETERS
hr to-be-written
RETURN VALUES
None.
or
cgD3D8TranslateHRESULT returns to-be-written
DESCRIPTION
cgD3D8TranslateHRESULT does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8TranslateHRESULT wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 636
cgD3D8TypeToSize(3) Cg Direct3D8 Runtime API cgD3D8TypeToSize(3)
NAME cgD3D8TypeToSize to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
DWORD cgD3D8TypeToSize( CGtype type );
PARAMETERS
type Cg type enumerant.
RETURN VALUES
None.
or
cgD3D8TypeToSize returns to-be-written
DESCRIPTION
cgD3D8TypeToSize does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8TypeToSize wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 637
cgD3D8UnloadProgram(3) Cg Direct3D8 Runtime API cgD3D8UnloadProgram(3)
NAME cgD3D8UnloadProgram to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
HRESULT cgD3D8UnloadProgram( CGprogram prog );
PARAMETERS
prog Cg program handle.
RETURN VALUES
None.
or
cgD3D8UnloadProgram returns to-be-written
DESCRIPTION
cgD3D8UnloadProgram does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8UnloadProgram wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 638
cgD3D8ValidateVertexDeclaration(3) Cg Direct3D8 Runtime API cgD3D8ValidateVertexDeclaration(3)
NAME cgD3D8ValidateVertexDeclaration to-be-written
SYNOPSIS
#include <Cg/cgD3D8.h>
CGbool cgD3D8ValidateVertexDeclaration( CGprogram prog,
const DWORD* decl );
PARAMETERS
prog Cg program handle.
decl to-be-written
RETURN VALUES
None.
or
cgD3D8ValidateVertexDeclaration returns to-be-written
DESCRIPTION
cgD3D8ValidateVertexDeclaration does to-be-written
EXAMPLES
// example code to−be−written
ERRORS
None.
or
to-be-written
HISTORY
cgD3D8ValidateVertexDeclaration wasintroduced in Cg 1.1.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 639
GP5(Cg) Cg Profiles GP5(Cg)
NAME gp5 −OpenGL profiles for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5
DESCRIPTION
gp5 corresponds not to a single profile but to a family of profiles that include gp5vp, gp5tcp, gp5tep, gp5gp
and gp5fp. Since most of the functionality exposed in these profiles is almost identical and defined by
NV_gpu_program5 these profiles are named the gp5 profiles. For more details refer to each profile
documentation.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
SEE ALSO
gp5tcp, gp5tep, gp5vp, gp5gp, gp5fp
perl v5.10.0 Cg Toolkit 3.0 640
GP5TCP(Cg) Cg Profiles GP5TCP(Cg)
NAME gp5tcp −OpenGL tessellation control profile for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5tcp
DESCRIPTION
This OpenGL profile corresponds to tessellation control functionality introduced by NVIDIA’s 5th
generation of assembly instruction sets.
The compiler output for this profile conforms to the assembly format defined by
NV_tessellation_program,NV_gpu_program5 and ARB_vertex_program.
3D API DEPENDENCIES
Requires OpenGL support for the NV_gpu_program5 extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
http://www.opengl.org/registry/specs/NV/tessellation_program5.txt
SEE ALSO
gp5, gp5tep, gp5vp, gp5gp, gp5fp
perl v5.10.0 Cg Toolkit 3.0 641
GP5TEP(Cg) Cg Profiles GP5TEP(Cg)
NAME gp5tep −OpenGL tessellation evaluation profile for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5tep
DESCRIPTION
This OpenGL profile corresponds to tessellation control functionality introduced by NVIDIA’s 5th
generation of assembly instruction sets.
The compiler output for this profile conforms to the assembly format defined by
NV_tessellation_program,NV_gpu_program5 and ARB_vertex_program.
3D API DEPENDENCIES
Requires OpenGL support for the NV_gpu_program5 extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
http://www.opengl.org/registry/specs/NV/tessellation_program5.txt
SEE ALSO
gp5, gp5tcp, gp5vp, gp5gp, gp5fp
perl v5.10.0 Cg Toolkit 3.0 642
GP5VP(Cg) Cg Profiles GP5VP(Cg)
NAME gp5vp −OpenGL vertexprofile for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5vp
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by NVIDIA’s 5th generation of
assembly instruction sets. It extends gp4vp.
The compiler output for this profile conforms to the assembly format defined by NV_gpu_program5 and
ARB_vertex_program.
3D API DEPENDENCIES
Requires OpenGL support for the NV_gpu_program5 extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
SEE ALSO
gp4vp, gp5, gp5tcp, gp5tep, gp5gp, gp5fp
perl v5.10.0 Cg Toolkit 3.0 643
GP5GP(Cg) Cg Profiles GP5GP(Cg)
NAME gp5gp −OpenGL geometry profile for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5gp
DESCRIPTION
This OpenGL profile corresponds to the per-primitive functionality introduced by NVIDIA’s 5th generation
of assembly instruction sets. It extends gp4gp.
Tessellation patch input primitivesare supported.
Instanced invocations are supported.
The compiler output for this profile conforms to the assembly format defined by NV_gpu_program5 and
ARB_vertex_program.
Note that the NV_gpu_program5 extension has its geometry domain-specific aspects documented in the
NV_geometry_program4 specification.
3D API DEPENDENCIES
Requires OpenGL support for the NV_gpu_program5 extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
http://www.opengl.org/registry/specs/NV/geometry_program4.txt
PROFILE OPTIONS
Invocations=val
The number of instanced invocations. Example: ‘‘Invocations=2’
PATCH_1 .. PATCH_32
Patch input primitive ofsize 1 to 32. Example: ‘PATCH_16’’
SEE ALSO
gp4gp, gp5, gp5tcp, gp5tep, gp5vp, gp5fp
perl v5.10.0 Cg Toolkit 3.0 644
GP5FP(Cg) Cg Profiles GP5FP(Cg)
NAME gp5fp −OpenGL fragment profile for NVIDIA GeForce 400 Series, OpenGL 4.x Quadro
SYNOPSIS
gp5fp
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by NVIDIA’s 5th generation
of assembly instruction sets. It extends gp4fp.
The compiler output for this profile conforms to the assembly format defined by NV_gpu_program5 and
ARB_fragment_program.
3D API DEPENDENCIES
Requires OpenGL support for the NV_gpu_program5 extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program5.txt
SEE ALSO
gp4fp, gp5, gp5tcp, gp5tep, gp5vp, gp5gp
perl v5.10.0 Cg Toolkit 3.0 645
GP4(Cg) Cg Profiles GP4(Cg)
NAME gp4 −OpenGL profiles for NVIDIA GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro
SYNOPSIS
gp4
DESCRIPTION
gp4 corresponds not to a single profile but to a family of profiles that include gp4vp, gp4gp and gp4fp.
Since most of the functionality exposed in these profiles is almost identical and defined by
NV_gpu_program4 these profiles are named the gp4 profiles. For more details refer to each profile
documentation.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/gpu_program4.txt
SEE ALSO
gp4vp, gp4gp, gp4fp
perl v5.10.0 Cg Toolkit 3.0 646
GP4VP(Cg) Cg Profiles GP4VP(Cg)
NAME gp4vp −OpenGL vertexprofile for NVIDIA GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro
SYNOPSIS
gp4vp
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality 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 vertexdomain-specific aspects documented in the
NV_vertex_program4 specification.
Data-dependent loops and branching are allowed.
Relative indexing of uniform arrays is supported.
Te x ture accesses are supported. While the prior vp40 profile has substantial limitations on vertextexturing,
the gp4vp profile eliminates all the limitations.
Te x ture 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).
Te x ture 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
Newtexture samplers:
http://www.opengl.org/registry/specs/EXT/texture_array.txt
http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt
Newinteger texture formats:
http://www.opengl.org/registry/specs/EXT/texture_integer.txt
PROFILE OPTIONS
Common GP4 Options
fastimul
Assume integer multiply inputs have atmost 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 newsigned
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 iand u
respectively.Your application is required to makesure the bound textures have the appropriate texture
format. So a3Dtexture 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.
perl v5.10.0 Cg Toolkit 3.0 647
GP4VP(Cg) Cg Profiles GP4VP(Cg)
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.
perl v5.10.0 Cg Toolkit 3.0 648
GP4VP(Cg) Cg Profiles GP4VP(Cg)
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
perl v5.10.0 Cg Toolkit 3.0 649
GP4VP(Cg) Cg Profiles GP4VP(Cg)
VARYING INPUT SEMANTICS
VertexAttribute Input Semantics
Forgeometry shader profiles such as gp4gp, varying parameters with vertexattribute input semantics must
be declared with the AttribArray template-style syntax because a geometry shader accepts an attribute
array of vertexattributes (rather than individual vertexattributes as a vertexshader does).
Example defining a varying parameter for the position vertexattribute:
AttribArray<float4> position : POSITION
The set of binding semantics for varying input vertexattributes 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,aset 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 twosets act as aliases to each other on NVIDIA GPUs excluding Apple Macs. ATIGPUs and NVIDIA
Mac GPUs do not alias the conventional vertexattributes 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 vertexattribute semantics should match with the semantics of the outputs of the vertexshader
feeding the geometry shader.
perl v5.10.0 Cg Toolkit 3.0 650
GP4VP(Cg) Cg Profiles GP4VP(Cg)
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’slocation 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’slocaiton 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
Te x tureUnit Semantics
TEXUNIT0−TEXUNIT31 Texture image unit
Example:
uniform sampler2DARRAY texArray : TEXUNIT7;
OUTPUT SEMANTICS
These vertexattribute 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 LIBRARYISSUES
perl v5.10.0 Cg Toolkit 3.0 651
GP4VP(Cg) Cg Profiles GP4VP(Cg)
Raw Cast from Floating-point to Integer Functions
It is possible to convert the rawbit patterns of IEEE single-precision floating-point to 32−bit unsigned
integer.
floatToRawIntBits, floatToIntBits, intBitsToFloat
TextureArray Functions
Newsampler data types for texture arrays and texture buffers lead to newstandard library routines to access
these samplers.
Newstandard library functions are used to access 1D texture array samplers (sampler1DARRAY).
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj
The dimensions of a texture array levelcan be determined.
tex1DARRAYsize
Newstandard library functions are used to access 2D texture array samplers (sampler2DARRAY).
tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod, tex2DARRAYproj
The dimensions of a texture array levelcan be determined.
tex2DARRAYsize
SEE ALSO
gp4, gp4gp, gp4fp, gp4gp, texBUF,texBUFsize, floatToRawIntBits, floatToIntBits, intBitsToFloat,
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj, tex1DARRAYsize, tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod,
tex2DARRAYproj, tex2DARRAYsize
perl v5.10.0 Cg Toolkit 3.0 652
GP4GP(Cg) Cg Profiles GP4GP(Cg)
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’’inDirectX 10 or ‘‘bindable uniform’’inGLSL’s
EXT_bindable_uniform extension) provide a way to source uniform values from OpenGL buffer objects.
Te x ture 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).
Te x ture 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/geometry_program4.txt
Newtexture samplers:
http://www.opengl.org/registry/specs/EXT/texture_array.txt
http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt
Newinteger texture formats:
http://www.opengl.org/registry/specs/EXT/texture_integer.txt
PROFILE OPTIONS
Common GP4 Options
fastimul
Assume integer multiply inputs have atmost 24 significant bits. Example: ‘‘−po fastimul’
Geometry Domain-specific GP4 Options
Normally the options belowtospecify 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.
perl v5.10.0 Cg Toolkit 3.0 653
GP4GP(Cg) Cg Profiles GP4GP(Cg)
POINT
The entry function inputs point primitives. Example: ‘‘−po POINT’’
If an output primitive isnot 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 isnot 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 adjacencyprimitives. Example: ‘‘−po LINE_ADJ’’
If an output primitive isnot 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 isnot 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 adjacencyprimitives. Example: ‘‘−po TRIANGLE_ADJ’’
If an output primitive isnot 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 newsigned
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 iand u
respectively.Your application is required to makesure the bound textures have the appropriate texture
format. So a3Dtexture specified with the GL_RGBA32UI_EXT internal format (see the
EXT_texture_integer OpenGL extension) must be used with a usampler3D sampler.Otherwise, texture
perl v5.10.0 Cg Toolkit 3.0 654
GP4GP(Cg) Cg Profiles GP4GP(Cg)
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.
perl v5.10.0 Cg Toolkit 3.0 655
GP4GP(Cg) Cg Profiles GP4GP(Cg)
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
perl v5.10.0 Cg Toolkit 3.0 656
GP4GP(Cg) Cg Profiles GP4GP(Cg)
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 isprocessed. For QUADS and QUAD_STRIP
primitivesthat 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 indexhas no effect on the instance ID counter.
Example:
int primID : INSTANCEID
VertexInstance Input Semantic
The geometry shader can identify the vertexindex(when using vertexbuffer objects) that sourced each
vertexmaking up the primitive.
The vertexinstance input semantic must be declared with the AttribArray template-style syntax because a
geometry shader accepts an attribute array of vertexinstance 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 vertexisspecified, and is defined
only if vertexarrays are used with buffer objects (VBOs).
Example defining a varying parameter for the position vertexattribute:
AttribArray<int> vertexID : VERTEXID
VertexAttribute Input Semantics
Forgeometry shader profiles such as gp4gp, varying parameters with vertexattribute input semantics must
be declared with the AttribArray template-style syntax because a geometry shader accepts an attribute
array of vertexattributes (rather than individual vertexattributes as a vertexshader does).
Example defining a varying parameter for the position vertexattribute:
AttribArray<float4> position : POSITION
The set of binding semantics for varying input vertexattributes 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,aset 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 twosets act as aliases to each other on NVIDIA GPUs excluding Apple Macs. ATIGPUs and NVIDIA
Mac GPUs do not alias the conventional vertexattributes with the generic attributes.
perl v5.10.0 Cg Toolkit 3.0 657
GP4GP(Cg) Cg Profiles GP4GP(Cg)
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 vertexattribute semantics should match with the semantics of the outputs of the vertexshader
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’slocation 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’slocaiton 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
Te x tureUnit Semantics
perl v5.10.0 Cg Toolkit 3.0 658
GP4GP(Cg) Cg Profiles GP4GP(Cg)
TEXUNIT0−TEXUNIT31 Texture image unit
Example:
uniform sampler2DARRAY texArray : TEXUNIT7;
OUTPUT SEMANTICS
These vertexattribute 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 LIBRARYISSUES
Raw Cast from Floating-point to Integer Functions
It is possible to convert the rawbit patterns of IEEE single-precision floating-point to 32−bit unsigned
integer.
floatToRawIntBits, floatToIntBits, intBitsToFloat
TextureArray Functions
Newsampler data types for texture arrays and texture buffers lead to newstandard library routines to access
these samplers.
Newstandard library functions are used to access 1D texture array samplers (sampler1DARRAY).
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj
The dimensions of a texture array levelcan be determined.
tex1DARRAYsize
Newstandard library functions are used to access 2D texture array samplers (sampler2DARRAY).
tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod, tex2DARRAYproj
The dimensions of a texture array levelcan be determined.
perl v5.10.0 Cg Toolkit 3.0 659
GP4GP(Cg) Cg Profiles GP4GP(Cg)
tex2DARRAYsize
SEE ALSO
gp4, gp4vp, gp4fp, gp4vp, texBUF,texBUFsize, floatToRawIntBits, floatToIntBits, intBitsToFloat,
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj, tex1DARRAYsize, tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod,
tex2DARRAYproj, tex2DARRAYsize
POD ERRORS
Hey! The above document had some coding errors, which areexplained below:
Around line 71:
Youcan’thav e =items (as at line 76) unless the first thing after the =overisan=item
perl v5.10.0 Cg Toolkit 3.0 660
GP4FP(Cg) Cg Profiles GP4FP(Cg)
NAME gp4fp −OpenGL fragment profile for NVIDIA GeForce 8/9/100/200/300 Series, OpenGL 3.x Quadro
SYNOPSIS
gp4fp
DESCRIPTION
This OpenGL profile corresponds to the per-fragment 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_fragment_program.
Note that the NV_gpu_program4 extension has its fragment domain-specific aspects documented in the
NV_fragment_program4 specification.
Data-dependent loops and branching are allowed.
Relative indexing of uniform arrays is supported.
Parameter buffer objects (also known as ‘‘constant buffers’’inDirectX 10 or ‘‘bindable uniform’’inGLSL’s
EXT_bindable_uniform extension) provide a way to source uniform values from OpenGL buffer objects.
Te x ture 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).
Te x ture 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 6800 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/fragment_program4.txt
Newtexture samplers:
http://www.opengl.org/registry/specs/EXT/texture_array.txt
http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt
Newinteger texture formats:
http://www.opengl.org/registry/specs/EXT/texture_integer.txt
Drawbuffers:
http://www.opengl.org/registry/specs/ARB/draw_buffers.txt
http://www.opengl.org/registry/specs/ATI/draw_buffers.txt
PROFILE OPTIONS
Common GP4 Options
fastimul
Assume integer multiply inputs have atmost 24 significant bits. Example: ‘‘−po fastimul’
Fragment Domain-specific GP4 Options
ARB_draw_buffers=val
ATI_draw_buffers=val
Indicates that the ARB_draw_buffers or ATI_draw_buffers OpenGL extension is supported and
what the extension’simplementation dependent value of GL_MAX_DRAW_BUFFERS_ARB or
GL_MAX_DRAW_BUFFERS_ATI is.
perl v5.10.0 Cg Toolkit 3.0 661
GP4FP(Cg) Cg Profiles GP4FP(Cg)
When specified, the compiler generates the ‘OPTION ARB_draw_buffers;’’or‘OPTION
ATI_draw_buffers;’’inthe compiled code to enable output to multiple drawbuffers. Output to
multiple drawbuffers is done by specifying output parameters with the COLOR1,COLOR2,etc.
semantics.
GPUs that support these extensions typically support up to 4 buffers.
These options are useful in the rare situation you want to control the specific OPTION name used. For
example, Apple drivers support the ARB_draw_buffers extension but not the ATI_draw_buffers
extension.
The CgGL runtime routine cgGLSetOptimalOptions will automatically add the appropriate option
based on querying the current OpenGL context’sextension support (prefering the ARB extension) and
specify the proper limit.
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 newsigned
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 iand u
respectively.Your application is required to makesure the bound textures have the appropriate texture
format. So a3Dtexture 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.
perl v5.10.0 Cg Toolkit 3.0 662
GP4FP(Cg) Cg Profiles GP4FP(Cg)
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.
perl v5.10.0 Cg Toolkit 3.0 663
GP4FP(Cg) Cg Profiles GP4FP(Cg)
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
Interpolated Input Semantics
The varying input semantics in the gp4fp profile correspond to the respectively named varying output
semantics of the gp4vp profile (or gp4gp if a geometry shader is present).
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
WPOS Window position (with lower−left origin)
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
perl v5.10.0 Cg Toolkit 3.0 664
GP4FP(Cg) Cg Profiles GP4FP(Cg)
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
Interpolation Semantic Modifiers
Anumber of interpolation semantic modifiers control howinterpolation happens for the interpolated input
semantics above.These modifiers are suffixed to the semantic name with a ‘‘.’’ (period) seperator.Without
amodifier,perspective-correct interpolation applies.
Semantic Modifier Name Meaning
CENTROID Interpolate at the centroid of the covered samples
(only applies when rendering to multisampled surface)
FLAT Flat shading using provoking vertex's value
NOPERSPECTIVE Interpolate without perspective correction
Examples:
float4 a : TEXCOORD0
float4 b : TEXCOORD1.CENTROID
float4 c : TEXCOORD2.FLAT
float4 d : TEXCOORD3.NOPERSPECTIVE
Per-primitive Input Semantics
FACE Polygon facing.
+1 for front−facing polygon or line or point
−1 for back−facing polygon
PRIMITIVEID Primitive ID (int)
If a geometry program is active,parameters giventhe PRIMITIVEID semantic obtained their integer value
from the primitive ID value emitted by the geometry program for the provoking vertex. If no geometry
program is active,the value is the number of primitivesprocessed by the rasterizer since the last time
glBegin was called (directly or indirectly via vertexarray functions). The first primitive generated after a
glBegin is numbered zero, and the primitive ID counter is incremented after every individual point, line, or
polygon primitive isprocessed. For polygons drawn in point or line mode, the primitive ID counter is
incremented only once, eventhough multiple points or lines may be drawn. For QUADS and QUAD_STRIP
primitivesthat are decomposed into triangles, the primitive ID is incremented after each complete quad is
processed. For POLYGON primitives, the primitive ID counter is zero. The primitive ID is zero for
fragments generated by DrawPixels or Bitmap. Restarting a primitive topology using the primitive restart
indexhas no effect on the primitive ID counter.
perl v5.10.0 Cg Toolkit 3.0 665
GP4FP(Cg) Cg Profiles GP4FP(Cg)
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’slocation 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’slocaiton 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
Te x tureUnit Semantics
TEXUNIT0−TEXUNIT31 Texture image unit
Example:
uniform sampler2DARRAY texArray : TEXUNIT7;
OUTPUT SEMANTICS
COLOR Output color (float4 or int4)
COL
COLOR0−COLOR7 Output color (float4 or int4) for draw buffers 0 to 7
COL0−COL7
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Raw Cast from Floating-point to Integer Functions
It is possible to convert the rawbit patterns of IEEE single-precision floating-point to 32−bit unsigned
integer.
floatToRawIntBits, floatToIntBits, intBitsToFloat
TextureArray Functions
Newsampler data types for texture arrays and texture buffers lead to newstandard library routines to access
these samplers.
Newstandard library functions are used to access 1D texture array samplers (sampler1DARRAY).
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj
The dimensions of a texture array levelcan be determined.
tex1DARRAYsize
Newstandard library functions are used to access 2D texture array samplers (sampler2DARRAY).
perl v5.10.0 Cg Toolkit 3.0 666
GP4FP(Cg) Cg Profiles GP4FP(Cg)
tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod, tex2DARRAYproj
The dimensions of a texture array levelcan be determined.
tex2DARRAYsize
SEE ALSO
gp4, gp4vp, gp4gp, gp4vp, texBUF,texBUFsize, floatToRawIntBits, floatToIntBits, intBitsToFloat,
tex1DARRAY, tex1DARRAYbias, tex1DARRAYcmpbias, tex1DARRAYlod, tex1DARRAYcmplod,
tex1DARRAYproj, tex1DARRAYsize, tex2DARRAY, tex2DARRAYbias, tex2DARRAYlod,
tex2DARRAYproj, tex2DARRAYsize
perl v5.10.0 Cg Toolkit 3.0 667
GLSLV(Cg) Cg Profiles GLSLV(Cg)
NAME glslv −OpenGL vertexprofile for the OpenGL Shading Lanauge (GLSL)
SYNOPSIS
glslv
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by the OpenGL Shading
Language.
The compiler output for this profile conforms to the language grammar defined by the OpenGL Shading
Language specification.
3D API DEPENDENCIES
Requires OpenGL support for OpenGL 2.0.
OpenGL Extension Specifications
http://www.opengl.org/documentation/specs/version2.0/glspec20.pdf
http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
PROFILE OPTIONS
version=val
GLSL version to target. Supported versions are 100,110,120,130,140 and 150.
userTexCoord
Use user-defined varying instead of gl_TexCoord.
ATI_draw_buffers
Use ATI_draw_buffers extension for MRT.
EXT_gpu_shader4
Use EXT_gpu_shader4 extension where useful.
DATA TYPES
The Cg half and fixed data types are both mapped to float because GLSL lacks first-class half and fixed data
types.
SEMANTICS
VARYING INPUT SEMANTICS
Binding Semantics Name Corresponding Data GLSL Equivalent
POSITION Object−space position gl_Vertex
ATTR0
NORMAL Object−space normal gl_Normal
ATTR2
COLOR Primary color (float4) gl_Color
COLOR0
ATTR3
DIFFUSE
COLOR1 Secondary color (float4) gl_SecondaryColor
SPECULAR
ATTR4
FOGCOORD Fog coordinate gl_FogCoord
ATTR5
perl v5.10.0 Cg Toolkit 3.0 668
GLSLV(Cg) Cg Profiles GLSLV(Cg)
TEXCOORD# Texture coordinate set # gl_MultiTexCoord#
ATTR8 Texture coordinate set 0
ATTR9 Texture coordinate set 1
ATTR10 Texture coordinate set 2
ATTR11 Texture coordinate set 3
ATTR12 Texture coordinate set 4
ATTR13 Texture coordinate set 5
ATTR14 Texture coordinate set 6
ATTR15 Texture coordinate set 7
UNIFORM INPUT SEMANTICS
The Cg profiles for GLSL provide access to all the uniform constants and variables documented in Section
7.4 (Built-in Constants) and 7.5 (Built-in Uniform State) respectively of the OpenGL Shading Language
specification found at:
http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
Example:
glslv void main(float4 position : POSITION,
out float4 opos : POSITION)
{
opos = mul(gl_ModelViewMatrix, position);
}
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data GLSL Equivalent
POSITION Clip−space position gl_Position
HPOS
COLOR Front primary color gl_FrontColor
COLOR0
COL0
COL
COLOR1 Front secondary color gl_FrontSecondaryColor
COL1
BCOL0 Back primary color gl_BackColor
BCOL1 Back secondary color gl_BackSecondaryColor
CLPV Clip vertex gl_ClipVertex
TEXCOORD# Texture coordinate set # gl_TexCoord[#}
TEX#
FOGC Fog coordinate gl_FogFragCoord
FOG
PSIZE Point size gl_PointSize
PSIZ
perl v5.10.0 Cg Toolkit 3.0 669
GLSLV(Cg) Cg Profiles GLSLV(Cg)
STANDARD LIBRARYISSUES
Vertexprogram Cg standard library routines are available.
Vertextexture fetches are supported only if the OpenGL implementation advertises a positive value for the
implementation-dependent GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS limit.
SEE ALSO
glslg, glslf
perl v5.10.0 Cg Toolkit 3.0 670
GLSLG(Cg) Cg Profiles GLSLG(Cg)
NAME glslg −OpenGL geometry profile for the OpenGL Shading Lanauge (GLSL)
SYNOPSIS
glslg
DESCRIPTION
This OpenGL profile corresponds to the geometry shader functionality introduced by the
EXT_geometry_shader4 multi-vendor OpenGL extension.
The compiler output for this profile conforms to the language grammar defined by the OpenGL Shading
Language specification.
3D API DEPENDENCIES
Requires support for OpenGL 2.0 and the EXT_geometry_shader4 extension.
OpenGL Extension Specifications
http://www.opengl.org/documentation/specs/version2.0/glspec20.pdf
http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
http://www.opengl.org/registry/specs/EXT/geometry_shader4.txt
PROFILE OPTIONS
version=val
GLSL version to target. Supported versions are 100,110,120,130,140 and 150.
userTexCoord
Use user-defined varying instead of gl_TexCoord.
ATI_draw_buffers
Use ATI_draw_buffers extension for MRT.
EXT_gpu_shader4
Use EXT_gpu_shader4 extension where useful.
DATA TYPES
SEMANTICS
to-be-written
VARYING INPUT SEMANTICS
UNIFORM INPUT SEMANTICS
OUTPUT SEMANTICS
STANDARD LIBRARYISSUES
Geometry program Cg standard library routines are available.
SEE ALSO
glslf, glslv
perl v5.10.0 Cg Toolkit 3.0 671
GLSLF(Cg) Cg Profiles GLSLF(Cg)
NAME glslf −OpenGL fragment profile for the OpenGL Shading Lanauge (GLSL)
SYNOPSIS
glslf
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by the OpenGL Shading
Language.
The compiler output for this profile conforms to the language grammar defined by the OpenGL Shading
Language specification.
3D API DEPENDENCIES
Requires support for OpenGL 2.0.
OpenGL Extension Specifications
http://www.opengl.org/documentation/specs/version2.0/glspec20.pdf
http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
PROFILE OPTIONS
version=val
GLSL version to target. Supported versions are 100,110,120,130,140 and 150.
userTexCoord
Use user-defined varying instead of gl_TexCoord.
ATI_draw_buffers
Use ATI_draw_buffers extension for MRT.
EXT_gpu_shader4
Use EXT_gpu_shader4 extension where useful.
DATA TYPES
The Cg half and fixed data types are both mapped to float because GLSL lacks first-class half and fixed data
types.
SEMANTICS
VARYING INPUT SEMANTICS
Binding Semantics Name Corresponding Data GLSL Equivalent
COLOR Primary color (float4) gl_Color
COLOR0
COL0
COL
COLOR1 Secondary color (float4) gl_SecondaryColor
COL1
TEXCOORD Texture coordinate set 0 gl_TexCoord[0]
TEXCOORD# Texture coordinate set # gl_TexCoord[#]
TEX#
FACE Front/back facing (+1/−1) gl_FrontFacing
perl v5.10.0 Cg Toolkit 3.0 672
GLSLF(Cg) Cg Profiles GLSLF(Cg)
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
The Cg profiles for GLSL provide access to all the uniform constants and variables documented in Section
7.4 (Built-in Constants) and 7.5 (Built-in Uniform State) respectively of the OpenGL Shading Language
specification found at:
http://www.opengl.org/documentation/glsl/
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf
Example:
glslf void main(float4 color : COLOR,
out float4 ocol : COLOR)
{
ocol.xyz = mul(gl_NormalMatrix, color.xyz);
ocol.w = 1;
}
OUTPUT SEMANTICS
The following standard fragment output semantics are supported:
Binding Semantics Name Corresponding Data GLSL Equivalent
COLOR Output color (float4) gl_FragColor
COLOR0
COL0
COL
COLOR0−COLOR7 Output color (float4) gl_FragData[n]
COL0−COL7 for draw buffers 0 to 7
DEPTH Output depth (float) gl_FragDepth
DEPR
STANDARD LIBRARYISSUES
Fragment program Cg standard library routines are available.
SEE ALSO
glslv,glslg
perl v5.10.0 Cg Toolkit 3.0 673
VP40(Cg) Cg Profiles VP40(Cg)
NAME vp40 −OpenGL vertexprofile for NVIDIA GeForce 6/7 Series, NV4x−based Quadro FX
SYNOPSIS
vp40
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by the GeForce 6800 and other
NV4x−based NVIDIA GPUs.
The compiler output for this profile conforms to the assembly format defined by NV_vertex_program3
and ARB_vertex_program.
Data-dependent loops and branching are allowed.
Relative indexing of uniform arrays is supported.
Te x ture accesses are supported. Howeversubstantial limitations on vertextexturing exist for hardware
acceleration by NV4x hardware.
NV4x hardware accelerates vertexfetches only for 1−, 3−, and 4−component floating-point textures. NV4x
hardware does not accelerated vertex-texturing for cube maps or 3D textures. NV4x does allownon-power-
of-twosizes (width and height).
3D API DEPENDENCIES
Requires OpenGL support for the NV_fragment_program3 extension. These extensions were introduced
by the GeForce 6800 and other NV4x−based GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/vertex_program3.txt
http://www.opengl.org/registry/specs/ARB/vertex_program.txt
PROFILE OPTIONS
PosInv=val
Non-zero means generates code for position-invariant (with fixed-function) position transformation.
NumTemps=val
Maximum number of temporary registers the implementation supports. Set to the implementaiton-
dependent value of GL_MAX_NATIVE_TEMPORARIES_ARB for best performance.
MaxAddressRegs=val
Maximum number of address registers the implementation supports. Set to the implementaiton-
dependent value of GL_MAX_NATIVE_ADDRESS_REGISTERS_ARB for best performance.
MaxInstructions=val
Maximum number of instructions the implementation supports. Set to the implementaiton-dependent
value of GL_MAX_NATIVE_INSTRUCTIONS_ARB for best performance.
MaxLocalParams=val
Maximum number of local parameters the implementation supports.
DATA TYPES
float This profile implements the float data type as IEEE 32−bit single precision.
half
double
half and double data types are treated as float.
int The int data type is supported using floating point operations, which adds extra instructions for
proper truncation for divides, modulos and casts from floating point types. Because integer values are
simulated with IEEE single-precision floating-point, theyare accurate overthe range −2ˆ24 to 2ˆ24 but
will not overflowliketrue integers.
perl v5.10.0 Cg Toolkit 3.0 674
VP40(Cg) Cg Profiles VP40(Cg)
fixed
sampler*
This profile does not support anyoperations on the fixed or sampler*data types, but does provide
the minimal partial support that is required for these data types by the core language spec (i.e. it is
legaltodeclare variables using these types, as long as no operations are performed on the variables).
SEMANTICS
VARYING INPUT SEMANTICS
The set of binding semantics for varying input data to vp40 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,aset of binding semantics ATTR0−ATTR15 can be used. These binding semantics map to
NV_vertex_program3 input attribute parameters.
The twosets act as aliases to each other on NVIDIA GPUs excluding Apple Macs. ATIGPUs and NVIDIA
Mac GPUs do not alias the conventional vertexattributes 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
UNIFORM INPUT 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.
TEXUNIT0−TEXUNIT15 Texture unit (but only 4 distinct texture units
are allowed)
perl v5.10.0 Cg Toolkit 3.0 675
VP40(Cg) Cg Profiles VP40(Cg)
OUTPUT SEMANTICS
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 LIBRARYISSUES
Standard library routines for texture cube map and rectangle samplers are not supported by vp40.
SEE ALSO
fp40
perl v5.10.0 Cg Toolkit 3.0 676
FP40(Cg) Cg Profiles FP40(Cg)
NAME fp40 −OpenGL fragment profile for NVIDIA GeForce 6/7 Series, NV4x−based Quadro FX
SYNOPSIS
fp40
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by the GeForce 6800 and
other NV4x−based NVIDIA GPUs.
The compiler output for this profile conforms to the assembly format defined by NV_fragment_program2.
Data-dependent loops are allowed with a limit of 256 iterations maximum. Four levels of nesting are
allowed.
Conditional expressions can be supported with data-dependent branching.
Relative indexing of uniform arrays is not supported; use texture accesses instead.
3D API DEPENDENCIES
Requires OpenGL support for the NV_fragment_program2 extension. These extensions were introduced
by the GeForce 6800 and other NV4x−based GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/fragment_program2.txt
PROFILE OPTIONS
None.
DATA TYPES
fixed The fixed data type corresponds to a native signed fixed-point integers with the range [−2.0,+2.0),
sometimes called fx12.This type provides 10 fractional bits of precision.
half The half data type corresponds to a floating-point encoding with a sign bit, 10 mantissa bits, and
5exponent bits (biased by 16), sometimes called s10e5.
float The half data type corresponds to a standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
SEMANTICS
VARYING INPUT SEMANTICS
The varying input semantics in the fp40 profile correspond to the respectively named varying output
semantics of the vp40 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
perl v5.10.0 Cg Toolkit 3.0 677
FP40(Cg) Cg Profiles FP40(Cg)
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
FACE Polygon facing.
+1 for front−facing polygon or line or point
−1 for back−facing polygon
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare supported.
SEE ALSO
vp40
perl v5.10.0 Cg Toolkit 3.0 678
ARBFP1(Cg) Cg Profiles ARBFP1(Cg)
NAME arbfp1 −OpenGL fragment profile for multi-vendor ARB_fragment_program extension
SYNOPSIS
arbfp1
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by GeForce FX and other
DirectX 9 GPUs. This profile is supported by anyOpenGL implementation that conformantly implements
ARB_fragment_program.
The compiler output for this profile conforms to the assembly format defined by
ARB_fragment_program.
Data-dependent loops are not allowed; all loops must be unrollable.
Conditional expressions are supported without branching so both conditions must be evaluated.
Relative indexing of uniform arrays is not supported; use texture accesses instead.
3D API DEPENDENCIES
Requires OpenGL support for the multi-vendor ARB_fragment_program extension. This extension is
supported by GeForce FX and later GPUS.ATIGPUs also support this extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/ARB/fragment_program.txt
PROFILE OPTIONS
NumTemps=n
Number of temporaries to use, 32 by default.
NumInstructionSlots=n
Maximum allowable (static) instructions. Not an issue for NVIDIA GPUs.
NumTexInstructionSlots=n
Maximum number of texture instructions to generate. Not an issue for NVIDIA GPUs, but
important for ATIGPUs (set it to 32).
NumMathInstructionSlots=n
Maximum number of math instructions to generate. Not an issue for NVIDIA GPUs, but
important for ATIGPUs (set it to 64).
MaxTexIndirections=n
Maximum number of texture indirections. Not an issue for NVIDIA GPUs, but important for ATI
GPUs (set it to 4).
ATI_draw_buffers
When multiple drawbuffers are used, use the ATI_draw_buffers syntax so the generated code
says OPTION ATI_draw_buffers.The default, if this option is not specified, is to use
ARB_draw_buffers.
ARB_draw_buffers
When multiple drawbuffers are used, use the ARB_draw_buffers syntax so the generated code
says OPTION ARB_draw_buffers.This option is the default.
MaxDrawBuffers=n
Maximum drawbuffers for use with ARB_draw_buffers.Set to 1 for NV3x GPUs. Use up to 4
for NV4x or ATIGPUs.
MaxLocalParams=n
Maximum allowable local parameters.
perl v5.10.0 Cg Toolkit 3.0 679
ARBFP1(Cg) Cg Profiles ARBFP1(Cg)
pixel_center_integer=b
Boolean to enable integer pixel centers.
origin_upper_left=b
Boolean to enable upper left pixel origin.
DATA TYPES
to-be-written
SEMANTICS
VARYING INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
OUTPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
to-be-written
SEE ALSO
arbvp1
perl v5.10.0 Cg Toolkit 3.0 680
ARBVP1(Cg) Cg Profiles ARBVP1(Cg)
NAME arbvp1 −OpenGL vertexprofile for multi-vendor ARB_vertex_program extension
SYNOPSIS
arbvp1
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by GeForce3. This profile is
supported by anyOpenGL implementation that conformantly implements ARB_vertex_program.
The compiler output for this profile conforms to the assembly format defined by ARB_vertex_program.
Data-dependent loops are not allowed; all loops must be unrollable.
Conditional expressions are supported without branching so both conditions must be evaluated.
Relative indexing of uniform arrays is supported; but texture accesses are not supported.
3D API DEPENDENCIES
Requires OpenGL support for the multi-vendor ARB_vertex_program extension. These extensions were
introduced by GeForce3 and Quadro DCC GPUs. ATIGPUs also support this extension.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/ARB/vertex_program.txt
PROFILE OPTIONS
NumTemps=n
Number of temporaries to use, 32 by default.
MaxInstructions=n
Maximum allowable (static) instructions.
MaxLocalParams=n
Maximum allowable local parameters.
MaxAddressRegs=n
Maximum allowable address registers.
PosInv=b Boolean to enable position invariance.
DATA TYPES
to-be-written
SEMANTICS
VARYING INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
OUTPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
to-be-written
SEE ALSO
arbfp1
perl v5.10.0 Cg Toolkit 3.0 681
VP30(Cg) Cg Profiles VP30(Cg)
NAME vp30 −OpenGL fragment profile for NV3x (GeForce FX,Quadro FX,etc.)
SYNOPSIS
vp30
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by the GeForce FX and Quadro
FX line of NVIDIA GPUs.
The compiler output for this profile conforms to the assembly format defined by NV_vertex_program2.
Data-dependent loops and branching are allowed.
Relative indexing of uniform arrays is supported; but texture accesses are not supported.
3D API DEPENDENCIES
Requires OpenGL support for the NV_vertex_program2 extension. These extensions were introduced by
the GeForce FX and Quadro FX GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/vertex_program2.txt
PROFILE OPTIONS
PosInv=val
Non-zero means generates code for position-invariant (with fixed-function) position transformation.
MaxLocalParams=val
Maximum number of local parameters the implementation supports.
DATA TYPES
to-be-written
SEMANTICS
VARYING INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
OUTPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
to-be-written
SEE ALSO
fp30
perl v5.10.0 Cg Toolkit 3.0 682
FP30(Cg) Cg Profiles FP30(Cg)
NAME fp30 −OpenGL fragment profile for NV3x (GeForce FX,Quadro FX,etc.)
SYNOPSIS
fp30
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by the GeForce FX and
Quadro FX line of NVIDIA GPUs.
The compiler output for this profile conforms to the assembly format defined by NV_fragment_program.
Data-dependent loops are not allowed; all loops must be unrollable.
Conditional expressions are supported without branching so both conditions must be evaluated.
Relative indexing of uniform arrays is not supported; use texture accesses instead.
3D API DEPENDENCIES
Requires OpenGL support for the NV_fragment_program extension. These extensions were introduced
by the GeForce FX and Quadro FX GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/fragment_program.txt
PROFILE OPTIONS
NumInstructionSlots=val
Howmanyinstructions the compiler should assume it can use.
NumTemps=val
Howmanytemporaries the compiler should assume it can use.
DATA TYPES
fixed The fixed data type corresponds to a native signed fixed-point integers with the range [−2.0,+2.0),
sometimes called fx12.This type provides 10 fractional bits of precision.
half The half data type corresponds to a floating-point encoding with a sign bit, 10 mantissa bits, and
5exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
SEMANTICS
VARYING INPUT SEMANTICS
The varying input semantics in the fp30 profile correspond to the respectively named varying output
semantics of the vp30 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
perl v5.10.0 Cg Toolkit 3.0 683
FP30(Cg) Cg Profiles FP30(Cg)
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare supported.
SEE ALSO
vp30
perl v5.10.0 Cg Toolkit 3.0 684
VP20(Cg) Cg Profiles VP20(Cg)
NAME vp20 −OpenGL fragment profile for NV2x (GeForce3, GeForce4 Ti, Quadro DCC,etc.)
SYNOPSIS
vp20
DESCRIPTION
This OpenGL profile corresponds to the per-vertexfunctionality introduced by GeForce3.
The compiler output for this profile conforms to the assembly format defined by NV_vertex_program1_1
(which assumes NV_vertex_program).
Data-dependent loops are not allowed; all loops must be unrollable.
Conditional expressions are supported without branching so both conditions must be evaluated.
Relative indexing of uniform arrays is supported; but texture accesses are not supported.
3D API DEPENDENCIES
Requires OpenGL support for NV_vertex_program and NV_vertex_program1_1 extensions. These
extensions were introduced by GeForce3 and Quadro DCC GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/vertex_program.txt
http://www.opengl.org/registry/specs/NV/vertex_program1_1.txt
PROFILE OPTIONS
PosInv=val
Non-zero means generates code for position-invariant (with fixed-function) position transformation.
MaxLocalParams=val
Maximum number of local parameters the implementation supports.
DATA TYPES
to-be-written
SEMANTICS
VARYING INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
OUTPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
to-be-written
SEE ALSO
fp20
perl v5.10.0 Cg Toolkit 3.0 685
FP20(Cg) Cg Profiles FP20(Cg)
NAME fp20 −OpenGL fragment profile for NV2x (GeForce3, GeForce4 Ti, Quadro DCC,etc.)
SYNOPSIS
fp20
DESCRIPTION
This OpenGL profile corresponds to the per-fragment functionality introduced by GeForce3.
The capabilities of this profile are quite limited.
The compiler output for this profile conforms to the nvparse file format for describing
NV_register_combiners and NV_texture_shader state configurations.
3D API DEPENDENCIES
Requires OpenGL support for NV_texture_shader,NV_texture_shader2,and NV_register_combiners2
extensions. These extensions were introduced by GeForce3 and Quadro DCC GPUs.
Some standard library functions may require NV_texture_shader3.This extension was introduced by
GeForce4 Tiand Quadro4 XGL GPUs.
OpenGL Extension Specifications
http://www.opengl.org/registry/specs/NV/register_combiners.txt
http://www.opengl.org/registry/specs/NV/register_combiners2.txt
http://www.opengl.org/registry/specs/NV/texture_shader.txt
http://www.opengl.org/registry/specs/NV/texture_shader2.txt
PROFILE OPTIONS
None.
DATA TYPES
fixed The fixed data type corresponds to a native signed 9−bit integers normalized to the [−1.0,+1.0]
range.
float
half In most cases, the float and half data types are mapped to fixed for math operations.
Certain built-in standard library functions corresponding to NV_texture_shader operations
operate at 32−bit floating-point precision.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the fp20 profile correspond to the respectively named varying output
semantics of the vp20 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
perl v5.10.0 Cg Toolkit 3.0 686
FP20(Cg) Cg Profiles FP20(Cg)
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
FOGP Input fog color (XYZ) and factor (W)
FOG
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
There are a lot of standard library issues with this profile.
Because the ’fp20’ profile has limited capabilities, not all of the Cg standard library functions are
supported. The list belowpresents the Cg standard library functions that are supported by this profile. See
the standard library documentation for descriptions of these functions.
dot(floatN, floatN)
lerp(floatN, floatN, floatN)
lerp(floatN, floatN, float)
tex1D(sampler1D, float)
tex1D(sampler1D, float2)
tex1Dproj(sampler1D, float2)
tex1Dproj(sampler1D, float3)
tex2D(sampler2D, float2)
tex2D(sampler2D, float3)
tex2Dproj(sampler2D, float3)
tex2Dproj(sampler2D, float4)
texRECT(samplerRECT, float2)
texRECT(samplerRECT, float3)
texRECTproj(samplerRECT, float3)
texRECTproj(samplerRECT, float4)
tex3D(sampler3D, float3)
tex3Dproj(sampler3D, float4)
texCUBE(samplerCUBE, float3)
texCUBEproj(samplerCUBE, float4)
Note: The non-projective texture lookup functions are actually done as projective lookups on the underlying
hardware. Because of this, the ’w’ component of the texture coordinates passed to these functions from the
application or vertexprogram must contain the value 1.
Te x ture coordinate parameters for projective texture lookup functions must have swizzles that match the
swizzle done by the generated texture shader instruction. While this may seem burdensome, it is intended
to allow’fp20’ profile programs to behave correctly under other pixel shader profiles. The list belowshows
the swizzles required on the texture coordinate parameter to the projective texture lookup functions.
Texture lookup function Texture coordinate swizzle
tex1Dproj .xw/.ra
tex2Dproj .xyw/.rga
perl v5.10.0 Cg Toolkit 3.0 687
FP20(Cg) Cg Profiles FP20(Cg)
texRECTproj .xyw/.rga
tex3Dproj .xyzw/.rgba
texCUBEproj .xyzw/.rgba
TEXTURE SHADER OPERATIONS
In order to takeadvantage of the more complexhard-wired shader operations provided by
NV_texture_shader,acollection of built-in functions implement the various shader operations.
offsettex2D
offsettexRECT
offsettex2D(uniform sampler2D tex,
float2 st,
float4 prevlookup,
uniform float4 m)
offsettexRECT(uniform samplerRECT tex,
float2 st,
float4 prevlookup,
uniform float4 m)
Performs the following
float2 newst = st + m.xy * prevlookup.xx + m.zw * prevlookup.yy;
return tex2D/RECT(tex, newst);
where ’st’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation, and ’m’ is the offset texture matrix. This function can be used to
generate the ’offset_2d’ or ’offset_rectangle’ NV_texture_shader instructions.
offsettex2DScaleBias
offsettexRECTScaleBias
offsettex2DScaleBias(uniform sampler2D tex,
float2 st,
float4 prevlookup,
uniform float4 m,
uniform float scale,
uniform float bias)
offsettexRECTScaleBias(uniform samplerRECT tex,
float2 st,
float4 prevlookup,
uniform float4 m,
uniform float scale,
uniform float bias)
Performs the following
float2 newst = st + m.xy * prevlookup.xx + m.zw * prevlookup.yy;
float4 result = tex2D/RECT(tex, newst);
return result * saturate(prevlookup.z * scale + bias);
where ’st’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation, ’m’ is the offset texture matrix, ’scale’ is the offset texture scale and
’bias’ is the offset texture bias. This function can be used to generate the ’offset_2d_scale’ or
’offset_rectangle_scale’ NV_texture_shader instructions.
tex1D_dp3(sampler1D tex, float3 str,float4 prevlookup
perl v5.10.0 Cg Toolkit 3.0 688
FP20(Cg) Cg Profiles FP20(Cg)
tex1D_dp3(sampler1D tex,
float3 str,
float4 prevlookup
Performs the following
return tex1D(tex, dot(str, prevlookup.xyz));
where ’str’ are texture coordinates associated with sampler ’tex’ and ’prevlookup’ is the result of
aprevious texture operation. This function can be used to generate the ’dot_product_1d’
NV_texture_shader instruction.
tex2D_dp3x2
texRECT_dp3x2
tex2D_dp3x2(uniform sampler2D tex,
float3 str,
float4 intermediate_coord,
float4 prevlookup)
texRECT_dp3x2(uniform samplerRECT tex,
float3 str,
float4 intermediate_coord,
float4 prevlookup)
Performs the following
float2 newst = float2(dot(intermediate_coord.xyz, prevlookup.xyz),
dot(str, prevlookup.xyz));
return tex2D/RECT(tex, newst);
where ’str’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation and ’intermediate_coord’ are texture coordinates associated with the
previous texture unit. This function can be used to generate the ’dot_product_2d’ or
’dot_product_rectangle’ NV_texture_shader instruction combinations.
tex3D_dp3x3
texCUBE_dp3x3
tex3D_dp3x3(sampler3D tex,
float3 str,
float4 intermediate_coord1,
float4 intermediate_coord2,
float4 prevlookup)
texCUBE_dp3x3(samplerCUBE tex,
float3 str,
float4 intermediate_coord1,
float4 intermediate_coord2,
float4 prevlookup)
Performs the following
float3 newst = float3(dot(intermediate_coord1.xyz, prevlookup.xyz),
dot(intermediate_coord2.xyz, prevlookup.xyz),
dot(str, prevlookup.xyz));
return tex3D/CUBE(tex, newst);
where ’str’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation, ’intermediate_coord1’ are texture coordinates associated with the
’n−2’ texture unit and ’intermediate_coord2’ are texture coordinates associated with the ’n−1’
texture unit. This function can be used to generate the ’dot_product_3d’ or
perl v5.10.0 Cg Toolkit 3.0 689
FP20(Cg) Cg Profiles FP20(Cg)
’dot_product_cube_map’ NV_texture_shader instruction combinations.
texCUBE_reflect_dp3x3
texCUBE_reflect_dp3x3(uniform samplerCUBE tex,
float4 strq,
float4 intermediate_coord1,
float4 intermediate_coord2,
float4 prevlookup)
Performs the following
float3 E = float3(intermediate_coord2.w, intermediate_coord1.w,
strq.w);
float3 N = float3(dot(intermediate_coord1.xyz, prevlookup.xyz),
dot(intermediate_coord2.xyz, prevlookup.xyz),
dot(strq.xyz, prevlookup.xyz));
return texCUBE(tex, 2 * dot(N, E) / dot(N, N) * N − E);
where ’strq’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation, ’intermediate_coord1’ are texture coordinates associated with the
’n−2’ texture unit and ’intermediate_coord2’ are texture coordinates associated with the ’n−1’
texture unit. This function can be used to generate the
’dot_product_reflect_cube_map_eye_from_qs’ NV_texture_shader instruction combination.
texCUBE_reflect_eye_dp3x3
texCUBE_reflect_eye_dp3x3(uniform samplerCUBE tex,
float3 str,
float4 intermediate_coord1,
float4 intermediate_coord2,
float4 prevlookup,
uniform float3 eye)
Performs the following
float3 N = float3(dot(intermediate_coord1.xyz, prevlookup.xyz),
dot(intermediate_coord2.xyz, prevlookup.xyz),
dot(coords.xyz, prevlookup.xyz));
return texCUBE(tex, 2 * dot(N, E) / dot(N, N) * N − E);
where ’strq’ are texture coordinates associated with sampler ’tex’, ’prevlookup’ is the result of a
previous texture operation, ’intermediate_coord1’ are texture coordinates associated with the
’n−2’ texture unit, ’intermediate_coord2’ are texture coordinates associated with the ’n−1’ texture
unit and ’eye’ is the eye-ray vector.This function can be used generate the
’dot_product_reflect_cube_map_const_eye’ NV_texture_shader instruction combination.
tex_dp3x2_depth
tex_dp3x2_depth(float3 str,
float4 intermediate_coord,
float4 prevlookup)
Performs the following
float z = dot(intermediate_coord.xyz, prevlookup.xyz);
float w = dot(str, prevlookup.xyz);
return z / w;
where ’str’ are texture coordinates associated with the ’n’th texture unit, ’intermediate_coord’ are
texture coordinates associated with the ’n−1’ texture unit and ’prevlookup’ is the result of a
previous texture operation. This function can be used in conjunction with the ’DEPTH’varying
out semantic to generate the ’dot_product_depth_replace’ NV_texture_shader instruction
combination.
perl v5.10.0 Cg Toolkit 3.0 690
FP20(Cg) Cg Profiles FP20(Cg)
EXAMPLES
The following examples illustrate howadev e loper can use Cg to achieve
NV_texture_shader/NV_register_combiners functionality.
Example 1
struct VertexOut {
float4 color :COLOR0;
float4 texCoord0 : TEXCOORD0;
float4 texCoord1 : TEXCOORD1;
};
float4 main(VertexOut IN,
uniform sampler2D diffuseMap,
uniform sampler2D normalMap) : COLOR
{
float4 diffuseTexColor = tex2D(diffuseMap, IN.texCoord0.xy);
float4 normal = 2 * (tex2D(normalMap, IN.texCoord1.xy) − 0.5);
float3 light_vector = 2 * (IN.color.rgb − 0.5);
float4 dot_result = saturate(dot(light_vector, normal.xyz).xxxx);
return dot_result * diffuseTexColor;
}
Example 2
struct VertexOut {
float4 texCoord0 : TEXCOORD0;
float4 texCoord1 : TEXCOORD1;
float4 texCoord2 : TEXCOORD2;
float4 texCoord3 : TEXCOORD3;
};
float4 main(VertexOut IN,
uniform sampler2D normalMap,
uniform sampler2D intensityMap,
uniform sampler2D colorMap) : COLOR
{
float4 normal = 2 * (tex2D(normalMap, IN.texCoord0.xy) − 0.5);
float2 intensCoord = float2(dot(IN.texCoord1.xyz, normal.xyz),
dot(IN.texCoord2.xyz, normal.xyz));
float4 intensity = tex2D(intensityMap, intensCoord);
float4 color = tex2D(colorMap, IN.texCoord3.xy);
return color * intensity;
}
SEE ALSO
vp20
perl v5.10.0 Cg Toolkit 3.0 691
DS_5_0(Cg) Cg Profiles DS_5_0(Cg)
NAME ds_5_0 −Translation profile to DirectX 11’sHigh LevelShader Language for domain shaders.
SYNOPSIS
ds_5_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 11’sHigh LevelShader Language (HLSL11)for domain
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 11’s
High LevelShading Language.
The limitations of the ds_5_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 11 support.
http://msdn.microsoft.com/en−us/library/ff476340.aspx
http://msdn.microsoft.com/en−us/library/ff471356.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL11 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL11 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ds_5_0 profile correspond to the respectively named varying output
semantics of the hs_5_0 profile.
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 692
DS_5_0(Cg) Cg Profiles DS_5_0(Cg)
UNIFORM INPUT SEMANTICS
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Clip−space position (SV_Position)
HPOS
COLOR Front primary color (SV_Target)
COLOR0
COL0
COL
COLOR1 Front secondary color
COL1
TEXCOORD# Texture coordinate set #
TEX# TEX# is translated to TEXCOORD#
FOGC Fog coordinate
FOG
PSIZE Point size
PSIZ
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL11 for domain shaders. In general, the
Cg and HLSL11 standard libraries are very similar.
SEE ALSO
ps_5_0, vs_5_0, gs_5_0, hs_5_0
perl v5.10.0 Cg Toolkit 3.0 693
HS_5_0(Cg) Cg Profiles HS_5_0(Cg)
NAME hs_5_0 −Translation profile to DirectX 11’sHigh LevelShader Language for hull shaders.
SYNOPSIS
vs_5_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 11’sHigh LevelShader Language (HLSL11)for hull
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 11’s
High LevelShading Language.
The limitations of the vs_5_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 11 support.
http://msdn.microsoft.com/en−us/library/ff476340.aspx
http://msdn.microsoft.com/en−us/library/ff471356.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL11 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL11 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the hs_5_0 profile correspond to the respectively named varying output
semantics of the vs_5_0 profile.
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 694
HS_5_0(Cg) Cg Profiles HS_5_0(Cg)
UNIFORM INPUT SEMANTICS
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Clip−space position (SV_Position)
HPOS
COLOR Front primary color (SV_Target)
COLOR0
COL0
COL
COLOR1 Front secondary color
COL1
TEXCOORD# Texture coordinate set #
TEX# TEX# is translated to TEXCOORD#
FOGC Fog coordinate
FOG
PSIZE Point size
PSIZ
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL11 for hull shaders. In general, the Cg
and HLSL11 standard libraries are very similar.
SEE ALSO
ps_5_0, vs_5_0, gs_5_0, ds_5_0
perl v5.10.0 Cg Toolkit 3.0 695
VS_5_0(Cg) Cg Profiles VS_5_0(Cg)
NAME vs_5_0 −Translation profile to DirectX 11’sHigh LevelShader Language for vertexshaders.
SYNOPSIS
vs_5_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 11’sHigh LevelShader Language (HLSL11)for vertex
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 11’s
High LevelShading Language.
The limitations of the vs_5_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 11 support.
http://msdn.microsoft.com/en−us/library/ff471356.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL11 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL11 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 696
VS_5_0(Cg) Cg Profiles VS_5_0(Cg)
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
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 LIBRARYISSUES
This profile is limited to standard library support available in HLSL11 for vertexshaders. In general, the Cg
and HLSL11 standard libraries are very similar.
SEE ALSO
ps_5_0, hs_5_0, gs_5_0, ds_5_0
perl v5.10.0 Cg Toolkit 3.0 697
GS_5_0(Cg) Cg Profiles GS_5_0(Cg)
NAME gs_5_0 −Translation profile to DirectX 11’sHigh LevelShader Language for geometry shaders.
SYNOPSIS
gs_5_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 11’sHigh LevelShader Language (HLSL11)for geometry
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 11’s
High LevelShading Language.
The limitations of the gs_5_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 11 support.
http://msdn.microsoft.com/en−us/library/ff471356.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL11 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL11 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the gs_5_0 profile correspond to the respectively named varying output
semantics of the vs_5_0 profile.
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 698
GS_5_0(Cg) Cg Profiles GS_5_0(Cg)
UNIFORM INPUT SEMANTICS
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Clip−space position (SV_Position)
HPOS
COLOR Front primary color (SV_Target)
COLOR0
COL0
COL
COLOR1 Front secondary color
COL1
TEXCOORD# Texture coordinate set #
TEX# TEX# is translated to TEXCOORD#
FOGC Fog coordinate
FOG
PSIZE Point size
PSIZ
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL11 for vertexshaders. In general, the Cg
and HLSL11 standard libraries are very similar.
SEE ALSO
ps_5_0, vs_5_0, hs_5_0, ds_5_0
perl v5.10.0 Cg Toolkit 3.0 699
PS_5_0(Cg) Cg Profiles PS_5_0(Cg)
NAME ps_5_0 −Translation profile to DirectX 11’sHigh LevelShader Language for pixel shaders.
SYNOPSIS
ps_5_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 11’sHigh LevelShader Language (HLSL11)for pixel
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 11’s
High LevelShading Language.
The limitations of the ps_5_0 profile depend on what HLSL11 profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 11 support.
http://msdn.microsoft.com/en−us/library/ff471356.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL11 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL11 data types with the same name.
half NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting ps_5_0 use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_5_0 profile correspond to the respectively named varying output
semantics of the vs_5_0 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0 TEX# translates to TEXCOORD#
TEX1 Input texture coordinate sets 1
perl v5.10.0 Cg Toolkit 3.0 700
PS_5_0(Cg) Cg Profiles PS_5_0(Cg)
TEXCOORD1 TEX# translates to TEXCOORD#
TEX2 Input texture coordinate sets 2
TEXCOORD2 TEX# translates to TEXCOORD#
TEX3 Input texture coordinate sets 3
TEXCOORD3 TEX# translates to TEXCOORD#
TEX4 Input texture coordinate sets 4
TEXCOORD4 TEX# translates to TEXCOORD#
TEX5 Input texture coordinate sets 5
TEXCOORD5 TEX# translates to TEXCOORD#
TEX6 Input texture coordinate sets 6
TEXCOORD6 TEX# translates to TEXCOORD#
TEX7 Input texture coordinate sets 7
TEXCOORD7 TEX# translates to TEXCOORD#
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL11.Ingeneral, the Cg and HLSL11
standard libraries are very similar.
SEE ALSO
hs_5_0, vs_5_0, gs_5_0, ds_5_0
perl v5.10.0 Cg Toolkit 3.0 701
VS_4_0(Cg) Cg Profiles VS_4_0(Cg)
NAME vs_4_0 −Translation profile to DirectX 10’sHigh LevelShader Language for vertexshaders.
SYNOPSIS
vs_4_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 10’sHigh LevelShader Language (HLSL10)for vertex
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 10’s
High LevelShading Language.
The limitations of the vs_4_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 10 support.
http://msdn.microsoft.com/en−us/library/bb509657.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL10 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL10 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 702
VS_4_0(Cg) Cg Profiles VS_4_0(Cg)
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
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 LIBRARYISSUES
This profile is limited to standard library support available in HLSL10 for vertexshaders. In general, the Cg
and HLSL10 standard libraries are very similar.
SEE ALSO
gs_4_0, ps_4_0
perl v5.10.0 Cg Toolkit 3.0 703
GS_4_0(Cg) Cg Profiles GS_4_0(Cg)
NAME gs_4_0 −Translation profile to DirectX 10’sHigh LevelShader Language for geometry shaders.
SYNOPSIS
gs_4_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 10’sHigh LevelShader Language (HLSL10)for geometry
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 10’s
High LevelShading Language.
The limitations of the gs_4_0 profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 10 support.
http://msdn.microsoft.com/en−us/library/bb509657.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL10 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL10 data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the gs_4_0 profile correspond to the respectively named varying output
semantics of the vs_4_0 profile.
Binding Semantics Name Corresponding Data
POSITION Object−space position (SV_Position)
NORMAL Object−space normal
COLOR Primary color (float4) (SV_Target)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
perl v5.10.0 Cg Toolkit 3.0 704
GS_4_0(Cg) Cg Profiles GS_4_0(Cg)
UNIFORM INPUT SEMANTICS
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Clip−space position (SV_Position)
HPOS
COLOR Front primary color (SV_Target)
COLOR0
COL0
COL
COLOR1 Front secondary color
COL1
TEXCOORD# Texture coordinate set #
TEX# TEX# is translated to TEXCOORD#
FOGC Fog coordinate
FOG
PSIZE Point size
PSIZ
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL10 for vertexshaders. In general, the Cg
and HLSL10 standard libraries are very similar.
SEE ALSO
vs_4_0, ps_4_0
perl v5.10.0 Cg Toolkit 3.0 705
PS_4_0(Cg) Cg Profiles PS_4_0(Cg)
NAME ps_4_0 −Translation profile to DirectX 10’sHigh LevelShader Language for pixel shaders.
SYNOPSIS
ps_4_0
DESCRIPTION
This Direct3D profile translates Cg into DirectX 10’sHigh LevelShader Language (HLSL10)for pixel
shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 10’s
High LevelShading Language.
The limitations of the ps_4_0 profile depend on what HLSL10 profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 10 support.
http://msdn.microsoft.com/en−us/library/bb509657.aspx
PROFILE OPTIONS
−po pad16
This will add padding variables to the cbuffer declarations to match
the 16 byte padding the GP4 OpenGL profiles use. This makes sure
each variable in the cbuffer uses an entire float4 constant instead
of the tight packing HLSL10 normally uses.
DATA TYPES
In general, the Cg data types translate to the HLSL10 data types with the same name.
half NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting ps_4_0 use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_4_0 profile correspond to the respectively named varying output
semantics of the vs_4_0 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0 TEX# translates to TEXCOORD#
TEX1 Input texture coordinate sets 1
perl v5.10.0 Cg Toolkit 3.0 706
PS_4_0(Cg) Cg Profiles PS_4_0(Cg)
TEXCOORD1 TEX# translates to TEXCOORD#
TEX2 Input texture coordinate sets 2
TEXCOORD2 TEX# translates to TEXCOORD#
TEX3 Input texture coordinate sets 3
TEXCOORD3 TEX# translates to TEXCOORD#
TEX4 Input texture coordinate sets 4
TEXCOORD4 TEX# translates to TEXCOORD#
TEX5 Input texture coordinate sets 5
TEXCOORD5 TEX# translates to TEXCOORD#
TEX6 Input texture coordinate sets 6
TEXCOORD6 TEX# translates to TEXCOORD#
TEX7 Input texture coordinate sets 7
TEXCOORD7 TEX# translates to TEXCOORD#
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL10.Ingeneral, the Cg and HLSL10
standard libraries are very similar.
SEE ALSO
vs_4_0, gs_4_0
perl v5.10.0 Cg Toolkit 3.0 707
HLSLV(Cg) Cg Profiles HLSLV(Cg)
NAME hlslv −Translation profile to DirectX 9’sHigh LevelShader Language for vertexshaders.
SYNOPSIS
hlslv
DESCRIPTION
This Direct3D profile translates Cg into DirectX 9’sHigh LevelShader Language (HLSL)for pixel shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 9’s
High LevelShading Language. See:
http://msdn.microsoft.com/en−us/library/bb509561.aspx
The limitations of the hlslv profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
None.
DATA TYPES
In general, the Cg data types translate to the HLSL data types with the same name.
float, half, fixed
These numeric data types all correspond to standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
int This integral data type operates likeaninteger overthe −2ˆ24 to 2ˆ24 range. The result of int by
int division is an integer (rounding down) to match C.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the hlslv profile correspond to the respectively named varying output
semantics of the ps_2_0 profile.
Binding Semantics Name Corresponding Data
POSITION Object−space position
NORMAL Object−space normal
COLOR Primary color (float4)
COLOR0
DIFFUSE
COLOR1 Secondary color (float4)
SPECULAR
FOGCOORD Fog coordinate
TEXCOORD# Texture coordinate set #
UNIFORM INPUT SEMANTICS
to-be-written
perl v5.10.0 Cg Toolkit 3.0 708
HLSLV(Cg) Cg Profiles HLSLV(Cg)
OUTPUT SEMANTICS
Binding Semantics Name Corresponding Data
POSITION Clip−space position
HPOS
COLOR Front primary color
COLOR0
COL0
COL
COLOR1 Front secondary color
COL1
TEXCOORD# Texture coordinate set #
TEX#
FOGC Fog coordinate
FOG
PSIZE Point size
PSIZ
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL for vertexshaders. In general, the Cg
and HLSL standard libraries are very similar.
SEE ALSO
hlslf
perl v5.10.0 Cg Toolkit 3.0 709
HLSLF(Cg) Cg Profiles HLSLF(Cg)
NAME hlslf −Translation profile to DirectX 9’sHigh LevelShader Language for pixel shaders.
SYNOPSIS
hlslf
DESCRIPTION
This Direct3D profile translates Cg into DirectX 9’sHigh LevelShader Language (HLSL)for pixel shaders.
The compiler output for this profile conforms to the textual high-levellanguage defined by DirectX 9’s
High LevelShading Language. See:
http://msdn.microsoft.com/en−us/library/bb509561.aspx
The limitations of the hlslf profile depend on what HLSL profile to which the translated HLSL code is
compiled.
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
None.
DATA TYPES
In general, the Cg data types translate to the HLSL data types with the same name.
half NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting hlslf use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the hlslf profile correspond to the respectively named varying output
semantics of the vs_2_0 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
perl v5.10.0 Cg Toolkit 3.0 710
HLSLF(Cg) Cg Profiles HLSLF(Cg)
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
This profile is limited to standard library support available in HLSL.Ingeneral, the Cg and HLSL standard
libraries are very similar.
SEE ALSO
hlslv
perl v5.10.0 Cg Toolkit 3.0 711
VS_3_0(Cg) Cg Profiles VS_3_0(Cg)
NAME vs_3_0 −Direct3D Shader Model 3.0 vertexprofile for DirectX 9
SYNOPSIS
vs_3_0
DESCRIPTION
This Direct3D profile corresponds to the per-vertexfunctionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sVertexShader
3.0 shader format. See:
http://msdn.microsoft.com/en−us/library/bb172930.aspx
Data-dependent loops are allowed with a limit of 256 iterations maximum. Four levels of nesting are
allowed.
Conditional expressions can be supported with data-dependent branching.
Relative indexing of uniform arrays is not supported; use texture accesses instead.
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
None.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float float values in vs_3_0 require standard IEEE 754 single-precision floating-point encoding with a
sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
perl v5.10.0 Cg Toolkit 3.0 712
VS_3_0(Cg) Cg Profiles VS_3_0(Cg)
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Eight texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT7 Texture unit 7
OUTPUT SEMANTICS
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 LIBRARYISSUES
This profile may have limits on the number of dependent texture fetches.
SEE ALSO
ps_3_0
perl v5.10.0 Cg Toolkit 3.0 713
PS_3_0(Cg) Cg Profiles PS_3_0(Cg)
NAME ps_3_0 −Direct3D Shader Model 3.0 fragment profile for DirectX 9
SYNOPSIS
ps_3_0
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sPixel Shader
3.0 shader format. See:
http://msdn.microsoft.com/en−us/library/bb219845.aspx
Data-dependent loops are allowed with a limit of 256 iterations maximum. Four levels of nesting are
allowed.
Conditional expressions can be supported with data-dependent branching.
Relative indexing of uniform arrays is not supported; use texture accesses instead.
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
None.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float float values in ps_3_0 require standard IEEE 754 single-precision floating-point encoding with a
sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_3_0 profile correspond to the respectively named varying output
semantics of the vs_3_0 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
perl v5.10.0 Cg Toolkit 3.0 714
PS_3_0(Cg) Cg Profiles PS_3_0(Cg)
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
This profile may have limits on the number of dependent texture fetches.
SEE ALSO
vs_3_0
perl v5.10.0 Cg Toolkit 3.0 715
VS_2_X(Cg) Cg Profiles VS_2_X(Cg)
NAME vs_2_x −Direct3D Shader Model 2.0 Extended vertexprofile for DirectX 9
SYNOPSIS
vs_2_x
DESCRIPTION
This Direct3D profile corresponds to the per-vertexfunctionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sVertexShader
2.0 Extended shader format. See:
http://msdn.microsoft.com/en−us/library/bb172929.aspx
This profile supports static and structured dynamic flowcontrol.
3D API DEPENDENCIES
Requires Direct3D 9 support.
This profile generates code assuming the following Direct3D 9 Vertexshader capability bits are set:
D3DD3DPSHADERCAPS2_0_ARBITRARYSWIZZLE
D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS
D3DD3DPSHADERCAPS2_0_PREDICATION
D3DD3DPSHADERCAPS2_0_NODEPENDENTREADLIMIT
D3DD3DPSHADERCAPS2_0_NOTEXINSTRUCTIONLIMIT
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting vs_2_x use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
perl v5.10.0 Cg Toolkit 3.0 716
VS_2_X(Cg) Cg Profiles VS_2_X(Cg)
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Eight texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT7 Texture unit 7
OUTPUT SEMANTICS
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
perl v5.10.0 Cg Toolkit 3.0 717
VS_2_X(Cg) Cg Profiles VS_2_X(Cg)
BCOL1 Output backface secondary color
TEXCOORD0−TEXCOORD7, Output texture coordinates
TEX0−TEX7
CLP0−CL5 Output Clip distances
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
There are no restrictions on dependent texture reads (up to the instruction limit) for this profile.
SEE ALSO
ps_2_x, vs_2_0
perl v5.10.0 Cg Toolkit 3.0 718
PS_2_X(Cg) Cg Profiles PS_2_X(Cg)
NAME ps_2_x −Direct3D Shader Model 2.0 Extended fragment profile for DirectX 9
SYNOPSIS
ps_2_x
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sPixel Shader
2.0 Extended shader format. See:
http://msdn.microsoft.com/en−us/library/bb219844.aspx
This profile supports static and structured dynamic flowcontrol.
3D API DEPENDENCIES
Requires Direct3D 9 support.
This profile generates code assuming the following Direct3D 9 pixel shader capability bits are set:
D3DD3DPSHADERCAPS2_0_ARBITRARYSWIZZLE
D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS
D3DD3DPSHADERCAPS2_0_PREDICATION
D3DD3DPSHADERCAPS2_0_NODEPENDENTREADLIMIT
D3DD3DPSHADERCAPS2_0_NOTEXINSTRUCTIONLIMIT
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting ps_2_x use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_2_x profile correspond to the respectively named varying output
semantics of the vs_2_x profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
perl v5.10.0 Cg Toolkit 3.0 719
PS_2_X(Cg) Cg Profiles PS_2_X(Cg)
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
There are no restrictions on dependent texture reads (up to the instruction limit) for this profile.
perl v5.10.0 Cg Toolkit 3.0 720
PS_2_X(Cg) Cg Profiles PS_2_X(Cg)
SEE ALSO
vs_2_x, ps_2_0
perl v5.10.0 Cg Toolkit 3.0 721
VS_2_SW(Cg) Cg Profiles VS_2_SW(Cg)
NAME vs_2_sw −Direct3D Software Shader for Model 2.0 Extended vertexprofile
SYNOPSIS
vs_2_sw
DESCRIPTION
This Direct3D profile corresponds to the per-vertexfunctionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by the software version of
DirectX 9’sVertexShader 2.0 Extended shader format. See:
http://msdn.microsoft.com/en−us/library/bb172925.aspx
This profile is useful for debugging and prototyping.
3D API DEPENDENCIES
Requires support for software vertexprocessing and a reference device.
This profile generates code assuming the following Direct3D 9 Vertexshader capability bits are set:
D3DD3DPSHADERCAPS2_0_ARBITRARYSWIZZLE
D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS
D3DD3DPSHADERCAPS2_0_PREDICATION
D3DD3DPSHADERCAPS2_0_NODEPENDENTREADLIMIT
D3DD3DPSHADERCAPS2_0_NOTEXINSTRUCTIONLIMIT
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting vs_2_sw use standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
perl v5.10.0 Cg Toolkit 3.0 722
VS_2_SW(Cg) Cg Profiles VS_2_SW(Cg)
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Eight texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT7 Texture unit 7
OUTPUT SEMANTICS
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
perl v5.10.0 Cg Toolkit 3.0 723
VS_2_SW(Cg) Cg Profiles VS_2_SW(Cg)
BCOL1 Output backface secondary color
TEXCOORD0−TEXCOORD7, Output texture coordinates
TEX0−TEX7
CLP0−CL5 Output Clip distances
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
There are no restrictions on dependent texture reads (up to the instruction limit) for this profile.
SEE ALSO
ps_2_sw,vs_2_x
perl v5.10.0 Cg Toolkit 3.0 724
PS_2_SW(Cg) Cg Profiles PS_2_SW(Cg)
NAME ps_2_sw −Direct3D Software Shader for Model 2.0 Extended fragment profile
SYNOPSIS
ps_2_sw
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by the software version of
DirectX 9’sPixel Shader 2.0 Extended shader format. See:
http://msdn.microsoft.com/en−us/library/bb172925.aspx
This profile is useful for debugging and prototyping.
3D API DEPENDENCIES
Requires a reference device.
This profile generates code assuming the following Direct3D 9 pixel shader capability bits are set:
D3DD3DPSHADERCAPS2_0_ARBITRARYSWIZZLE
D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS
D3DD3DPSHADERCAPS2_0_PREDICATION
D3DD3DPSHADERCAPS2_0_NODEPENDENTREADLIMIT
D3DD3DPSHADERCAPS2_0_NOTEXINSTRUCTIONLIMIT
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting ps_2_sw use standard IEEE 754 single-precision floating-point
encoding with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called
s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_2_sw profile correspond to the respectively named varying output
semantics of the vs_2_sw profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
perl v5.10.0 Cg Toolkit 3.0 725
PS_2_SW(Cg) Cg Profiles PS_2_SW(Cg)
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
There are no restrictions on dependent texture reads (up to the instruction limit) for this profile.
perl v5.10.0 Cg Toolkit 3.0 726
PS_2_SW(Cg) Cg Profiles PS_2_SW(Cg)
SEE ALSO
vs_2_sw,ps_2_x
perl v5.10.0 Cg Toolkit 3.0 727
VS_2_0(Cg) Cg Profiles VS_2_0(Cg)
NAME vs_2_0 −Direct3D Shader Model 2.0 vertexprofile for DirectX 9
SYNOPSIS
vs_2_0
DESCRIPTION
This Direct3D profile corresponds to the per-vertexfunctionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sVertexShader
2.0 shader format. See:
http://msdn.microsoft.com/en−us/library/bb172928.aspx
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting vs_2_0 use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
TEX1 Input texture coordinate sets 1
TEXCOORD1
perl v5.10.0 Cg Toolkit 3.0 728
VS_2_0(Cg) Cg Profiles VS_2_0(Cg)
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Eight texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT7 Texture unit 7
OUTPUT SEMANTICS
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
perl v5.10.0 Cg Toolkit 3.0 729
VS_2_0(Cg) Cg Profiles VS_2_0(Cg)
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
This profile may have limits on the number of dependent texture fetches.
SEE ALSO
ps_2_0, vs_2_x
perl v5.10.0 Cg Toolkit 3.0 730
PS_2_0(Cg) Cg Profiles PS_2_0(Cg)
NAME ps_2_0 −Direct3D Shader Model 2.0 fragment profile for DirectX 9
SYNOPSIS
ps_2_0
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce FX (NV3x) for
DirectX 9.
The compiler output for this profile conforms to the textual assembly defined by DirectX 9’sPixel Shader
2.0 shader format. See:
http://msdn.microsoft.com/en−us/library/bb219843.aspx
3D API DEPENDENCIES
Requires Direct3D 9 support.
PROFILE OPTIONS
NumTemps=val
Number of 4−component vector temporaries the target implementation supports.
NumInstructionSlots=val
Number of instructions the target implementation supports.
MaxDrawBuffers=val
Number of drawbuffers or Multiple Render Targets (MRT)the target implementation supports.
DATA TYPES
half The half data type makes use of the Partial Precision instruction modifier to request less
precision.
NVIDIA GPUs may use half-precision floating-point when the Partial Precision instruction
modifier is specified. Half-precision floating-point is encoded with a sign bit, 10 mantissa bits,
and 5 exponent bits (biased by 16), sometimes called s10e5.
float The float data type corresponds to a floating-point representation with at least 24 bits.
NVIDIA GPUs supporting ps_2_0 use standard IEEE 754 single-precision floating-point encoding
with a sign bit, 23 mantissa bits, and 8 exponent bits (biased by 128), sometimes called s10e5.
Older ATIGPUs use 24−bit floating-point.
fixed The fixed data type is treated like half.
SEMANTICS
INPUT SEMANTICS
The varying input semantics in the ps_2_0 profile correspond to the respectively named varying output
semantics of the vs_2_0 profile.
Binding Semantics Name Corresponding Data
COLOR Input primary color
COLOR0
COL
COL0
COLOR1 Input secondary color
COL1
TEX0 Input texture coordinate sets 0
TEXCOORD0
perl v5.10.0 Cg Toolkit 3.0 731
PS_2_0(Cg) Cg Profiles PS_2_0(Cg)
TEX1 Input texture coordinate sets 1
TEXCOORD1
TEX2 Input texture coordinate sets 2
TEXCOORD2
TEX3 Input texture coordinate sets 3
TEXCOORD3
TEX4 Input texture coordinate sets 4
TEXCOORD4
TEX5 Input texture coordinate sets 5
TEXCOORD5
TEX6 Input texture coordinate sets 6
TEXCOORD6
TEX7 Input texture coordinate sets 7
TEXCOORD7
FOGP Input fog color (XYZ) and factor (W)
FOG
UNIFORM INPUT SEMANTICS
Sixteen texture units are supported:
Binding Semantic Name Corresponding Data
TEXUNIT0 Texture unit 0
TEXUNIT1 Texture unit 1
...
TEXUNIT15 Texture unit 15
OUTPUT SEMANTICS
COLOR Output color (float4)
COLOR0
COL0
COL
DEPTH Output depth (float)
DEPR
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
This profile may have limits on the number of dependent texture fetches.
SEE ALSO
vs_2_0, ps_2_x
perl v5.10.0 Cg Toolkit 3.0 732
VS_1_1(Cg) Cg Profiles VS_1_1(Cg)
NAME vs_1_1 −Direct3D Shader Model 1.1 vertexprofile for DirectX 8
SYNOPSIS
vs_1_1
DESCRIPTION
This Direct3D profile corresponds to the per-vertexfunctionality introduced by GeForce 2 (NV1x) for
DirectX 8.
The compiler output for this profile conforms to the textual assembly defined by DirectX 8’sVertexShader
1.1 shader format. See:
http://msdn.microsoft.com/en−us/library/bb172927.aspx
3D API DEPENDENCIES
Requires Direct3D 8 or 9 support.
PROFILE OPTIONS
to-be-written
DATA TYPES
to-be-written
SEMANTICS
INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
SEE ALSO
ps_1_3, ps_1_2, ps_1_1
perl v5.10.0 Cg Toolkit 3.0 733
PS_1_3(Cg) Cg Profiles PS_1_3(Cg)
NAME ps_1_3 −Direct3D Shader Model 1.3 fragment profile for DirectX 8
SYNOPSIS
ps_1_3
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce 3 (NV2x) for
DirectX 8.
The compiler output for this profile conforms to the textual assembly defined by DirectX 8’sPixel Shader
1.3 shader format. See:
http://msdn.microsoft.com/en−us/library/bb219842.aspx
3D API DEPENDENCIES
Requires Direct3D 8 or 9 support.
PROFILE OPTIONS
to-be-written
DATA TYPES
to-be-written
SEMANTICS
INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
SEE ALSO
vs_1_1, ps_1_2, ps_1_1
perl v5.10.0 Cg Toolkit 3.0 734
PS_1_2(Cg) Cg Profiles PS_1_2(Cg)
NAME ps_1_2 −Direct3D Shader Model 1.2 fragment profile for DirectX 8
SYNOPSIS
ps_1_2
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce 2 (NV1x) for
DirectX 8.
The compiler output for this profile conforms to the textual assembly defined by DirectX 8’sPixel Shader
1.2 shader format. See:
http://msdn.microsoft.com/en−us/library/bb219842.aspx
3D API DEPENDENCIES
Requires Direct3D 8 or 9 support.
PROFILE OPTIONS
to-be-written
DATA TYPES
to-be-written
SEMANTICS
INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
SEE ALSO
vs_1_1, ps_1_3, ps_1_1
perl v5.10.0 Cg Toolkit 3.0 735
PS_1_1(Cg) Cg Profiles PS_1_1(Cg)
NAME ps_1_1 −Direct3D Shader Model 1.1 fragment profile for DirectX 8
SYNOPSIS
ps_1_1
DESCRIPTION
This Direct3D profile corresponds to the per-fragment functionality introduced by GeForce 2 (NV1x) for
DirectX 8.
The compiler output for this profile conforms to the textual assembly defined by DirectX 8’sPixel Shader
1.1 shader format. See:
http://msdn.microsoft.com/en−us/library/bb219842.aspx
3D API DEPENDENCIES
Requires Direct3D 8 or 9 support.
PROFILE OPTIONS
to-be-written
DATA TYPES
to-be-written
SEMANTICS
INPUT SEMANTICS
to-be-written
UNIFORM INPUT SEMANTICS
to-be-written
STANDARD LIBRARYISSUES
Functions that compute partial derivativesare not supported.
SEE ALSO
vs_1_1, ps_1_3, ps_1_2
perl v5.10.0 Cg Toolkit 3.0 736
ABS(Cg) Cg Standard Library ABS(Cg)
NAME abs −returns absolute value of scalars and vectors.
SYNOPSIS
float abs(float a);
float1 abs(float1 a);
float2 abs(float2 a);
float3 abs(float3 a);
float4 abs(float4 a);
half abs(half a);
half1 abs(half1 a);
half2 abs(half2 a);
half3 abs(half3 a);
half4 abs(half4 a);
fixed abs(fixed a);
fixed1 abs(fixed1 a);
fixed2 abs(fixed2 a);
fixed3 abs(fixed3 a);
fixed4 abs(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the absolute value.
DESCRIPTION
Returns the absolute value of a scalar or vector.
Forvectors, the returned vector contains the absolute value of each element of the input vector.
REFERENCE IMPLEMENTATION
abs for a float scalar could be implemented likethis.
float abs(float a)
{
return max(−a, a);
}
PROFILE SUPPORT
abs is supported in all profiles.
Support in the fp20 is limited.
Consider abs to be free or extremely inexpensive.
SEE ALSO
max
perl v5.10.0 Cg Toolkit 3.0 737
ACOS(Cg) Cg Standard Library ACOS(Cg)
NAME acos −returns arccosine of scalars and vectors.
SYNOPSIS
float acos(float a);
float1 acos(float1 a);
float2 acos(float2 a);
float3 acos(float3 a);
float4 acos(float4 a);
half acos(half a);
half1 acos(half1 a);
half2 acos(half2 a);
half3 acos(half3 a);
half4 acos(half4 a);
fixed acos(fixed a);
fixed1 acos(fixed1 a);
fixed2 acos(fixed2 a);
fixed3 acos(fixed3 a);
fixed4 acos(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the arccosine.
DESCRIPTION
Returns the arccosine of ain the range [0,pi], expecting ato be in the range [−1,+1].
Forvectors, the returned vector contains the arccosine of each element of the input vector.
REFERENCE IMPLEMENTATION
acos for a float scalar could be implemented likethis.
// Handbook of Mathematical Functions
// M. Abramowitz and I.A. Stegun, Ed.
// Absolute error <= 6.7e−5
float acos(float x) {
float negate = float(x < 0);
x=abs(x);
float ret = −0.0187293;
ret = ret * x;
ret = ret + 0.0742610;
ret = ret * x;
ret = ret − 0.2121144;
ret = ret * x;
ret = ret + 1.5707288;
ret = ret * sqrt(1.0−x);
ret = ret − 2 * negate * ret;
return negate * 3.14159265358979 + ret;
}
PROFILE SUPPORT
acos is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
abs, asin, cos, sqrt
perl v5.10.0 Cg Toolkit 3.0 738
ALL(Cg) Cg Standard Library ALL(Cg)
NAME all −returns true if a boolean scalar or all components of a boolean vector are true.
SYNOPSIS
bool all(bool a);
bool all(bool1 a);
bool all(bool2 a);
bool all(bool3 a);
bool all(bool4 a);
PARAMETERS
aBoolean vector or scalar of which to determine if anycomponent is true.
DESCRIPTION
Returns true if a boolean scalar or all components of a boolean vector are true.
REFERENCE IMPLEMENTATION
all for a bool4 vector could be implemented likethis.
bool all(bool4 a)
{
return a.x && a.y && a.z && a.w;
}
PROFILE SUPPORT
all is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
any
perl v5.10.0 Cg Toolkit 3.0 739
ANY(Cg) Cg Standard Library ANY(Cg)
NAME any −returns true if a boolean scalar or anycomponent of a boolean vector is true.
SYNOPSIS
bool any(bool a);
bool any(bool1 a);
bool any(bool2 a);
bool any(bool3 a);
bool any(bool4 a);
PARAMETERS
aBoolean vector or scalar of which to determine if anycomponent is true.
DESCRIPTION
Returns true if a boolean scalar or anycomponent of a boolean vector is true.
REFERENCE IMPLEMENTATION
any for a bool4 vector could be implemented likethis.
bool any(bool4 a)
{
return a.x || a.y || a.z || a.w;
}
PROFILE SUPPORT
any is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
all
perl v5.10.0 Cg Toolkit 3.0 740
ASIN(Cg) Cg Standard Library ASIN(Cg)
NAME asin −returns arcsine of scalars and vectors.
SYNOPSIS
float asin(float a);
float1 asin(float1 a);
float2 asin(float2 a);
float3 asin(float3 a);
float4 asin(float4 a);
half asin(half a);
half1 asin(half1 a);
half2 asin(half2 a);
half3 asin(half3 a);
half4 asin(half4 a);
fixed asin(fixed a);
fixed1 asin(fixed1 a);
fixed2 asin(fixed2 a);
fixed3 asin(fixed3 a);
fixed4 asin(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the arcsine.
DESCRIPTION
Returns the arcsine of ain the range [−pi/2,+pi/2], expecting ato be in the range [−1,+1].
Forvectors, the returned vector contains the arcsine of each element of the input vector.
REFERENCE IMPLEMENTATION
asin for a float scalar could be implemented likethis.
// Handbook of Mathematical Functions
// M. Abramowitz and I.A. Stegun, Ed.
float asin(float x) {
float negate = float(x < 0);
x=abs(x);
float ret = −0.0187293;
ret *= x;
ret += 0.0742610;
ret *= x;
ret −= 0.2121144;
ret *= x;
ret += 1.5707288;
ret = 3.14159265358979*0.5 − sqrt(1.0 − x)*ret;
return ret − 2 * negate * ret;
}
PROFILE SUPPORT
asin is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
abs, acos, sin, sqrt
perl v5.10.0 Cg Toolkit 3.0 741
AT AN(Cg) Cg Standard Library AT AN(Cg)
NAME atan −returns arctangent of scalars and vectors.
SYNOPSIS
float atan(float a);
float1 atan(float1 a);
float2 atan(float2 a);
float3 atan(float3 a);
float4 atan(float4 a);
half atan(half a);
half1 atan(half1 a);
half2 atan(half2 a);
half3 atan(half3 a);
half4 atan(half4 a);
fixed atan(fixed a);
fixed1 atan(fixed1 a);
fixed2 atan(fixed2 a);
fixed3 atan(fixed3 a);
fixed4 atan(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the arctangent.
DESCRIPTION
Returns the arctangent of x in the range of −pi/2 to pi/2 radians.
Forvectors, the returned vector contains the arctangent of each element of the input vector.
REFERENCE IMPLEMENTATION
atan for a float scalar could be implemented likethis.
float atan(float x) {
return atan2(x, float(1));
}
atan2 is typically implemented as an approximation.
PROFILE SUPPORT
atan is supported in all profiles but fp20.
SEE ALSO
abs, acos, asin, atan2. sqrt, tan
perl v5.10.0 Cg Toolkit 3.0 742
AT AN2(Cg) Cg Standard Library AT AN2(Cg)
NAME atan2 −returns arctangent of scalars and vectors.
SYNOPSIS
float atan2(float y, float x);
float1 atan2(float1 y, float1 x);
float2 atan2(float2 y, float2 x);
float3 atan2(float3 y, float3 x);
float4 atan2(float4 y, float4 x);
half atan2(half y, half x);
half1 atan2(half1 y, half1 x);
half2 atan2(half2 y, half2 x);
half3 atan2(half3 y, half3 x);
half4 atan2(half4 y, half4 x);
fixed atan2(fixed y, fixed x);
fixed1 atan2(fixed1 y, fixed1 x);
fixed2 atan2(fixed2 y, fixed2 x);
fixed3 atan2(fixed3 y, fixed3 x);
fixed4 atan2(fixed4 y, fixed4 x);
PARAMETERS
yVector or scalar for numerator of ratio of which to determine the arctangent.
xVector or scalar of denominator of ratio of which to determine the arctangent.
DESCRIPTION
atan2 calculates the arctangent of y/x. atan2 is well defined for every point other than the origin, evenifx
equals 0 and y does not equal 0.
Forvectors, the returned vector contains the arctangent of each element of the input vector.
REFERENCE IMPLEMENTATION
atan2 for a float2 scalar could be implemented as an approximation likethis.
float2 atan2(float2 y, float2 x)
{
float2 t0, t1, t2, t3, t4;
t3 = abs(x);
t1 = abs(y);
t0 = max(t3, t1);
t1 = min(t3, t1);
t3 = float(1) / t0;
t3 = t1 * t3;
t4 = t3 * t3;
t0 = −float(0.013480470);
t0 = t0 * t4 + float(0.057477314);
t0 = t0 * t4 − float(0.121239071);
t0 = t0 * t4 + float(0.195635925);
t0 = t0 * t4 − float(0.332994597);
t0 = t0 * t4 + float(0.999995630);
t3 = t0 * t3;
t3 = (abs(y) > abs(x)) ? float(1.570796327) − t3 : t3;
t3 = (x < 0) ? float(3.141592654) − t3 : t3;
t3 = (y < 0) ? −t3 : t3;
perl v5.10.0 Cg Toolkit 3.0 743
AT AN2(Cg) Cg Standard Library AT AN2(Cg)
return t3;
}
PROFILE SUPPORT
atan2 is supported in all profiles but fp20.
SEE ALSO
abs, acos, asin, atan. sqrt, tan
perl v5.10.0 Cg Toolkit 3.0 744
CEIL(Cg) Cg Standard Library CEIL(Cg)
NAME ceil −returns smallest integer not less than a scalar or each vector component.
SYNOPSIS
float ceil(float a);
float1 ceil(float1 a);
float2 ceil(float2 a);
float3 ceil(float3 a);
float4 ceil(float4 a);
half ceil(half a);
half1 ceil(half1 a);
half2 ceil(half2 a);
half3 ceil(half3 a);
half4 ceil(half4 a);
fixed ceil(fixed a);
fixed1 ceil(fixed1 a);
fixed2 ceil(fixed2 a);
fixed3 ceil(fixed3 a);
fixed4 ceil(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the ceiling.
DESCRIPTION
Returns the ceiling or smallest integer not less than a scalar or each vector component.
REFERENCE IMPLEMENTATION
ceil for a float scalar could be implemented likethis.
float ceil(float v)
{
return −floor(−v);
}
PROFILE SUPPORT
ceil is supported in all profiles except fp20.
SEE ALSO
floor
perl v5.10.0 Cg Toolkit 3.0 745
CLAMP(Cg) Cg Standard Library CLAMP(Cg)
NAME clamp −returns smallest integer not less than a scalar or each vector component.
SYNOPSIS
float clamp(float x, float a, float b);
float1 clamp(float1 x, float1 a, float1 b);
float2 clamp(float2 x, float2 a, float2 b);
float3 clamp(float3 x, float3 a, float3 b);
float4 clamp(float4 x, float4 a, float4 b);
half clamp(half x, half a, half b);
half1 clamp(half1 x, half1 a, half1 b);
half2 clamp(half2 x, half2 a, half2 b);
half3 clamp(half3 x, half3 a, half3 b);
half4 clamp(half4 x, half4 a, half4 b);
fixed clamp(fixed x, fixed a, fixed b);
fixed1 clamp(fixed1 x, fixed1 a, fixed1 b);
fixed2 clamp(fixed2 x, fixed2 a, fixed2 b);
fixed3 clamp(fixed3 x, fixed3 a, fixed3 b);
fixed4 clamp(fixed4 x, fixed4 a, fixed4 b);
PARAMETERS
xVector or scalar to clamp.
aVector or scalar for bottom of clamp range.
bVector or scalar for top of clamp range.
DESCRIPTION
Returns xclamped to the range [a,b]asfollows:
•1)Returns aif xis less than a;else
•2)Returns bif xis greater than b;else
•3)Returns xotherwise.
Forvectors, the returned vector contains the clamped result of each element of the vector xclamped using
the respective element of vectors aand b.
REFERENCE IMPLEMENTATION
clamp for float scalars could be implemented likethis.
float clamp(float x, float a, float b)
{
return max(a, min(b, x));
}
PROFILE SUPPORT
clamp is supported in all profiles except fp20.
SEE ALSO
max, min, saturate
perl v5.10.0 Cg Toolkit 3.0 746
CLIP(Cg) Cg Standard Library CLIP(Cg)
NAME clip −conditionally kill a pixel before output
SYNOPSIS
void clip(float4 x);
void clip(float3 x);
void clip(float2 x);
void clip(float1 x);
void clip(float x);
PARAMETERS
xVector/scalar condition to clip on
DESCRIPTION
kills the current pixel output if anycomponent of the givenvector,orthe givenscalar,isneg ative
REFERENCE IMPLEMENTATION
clip is equivalent to
void clip(float4 x)
{
if (any(x < 0))
discard;
}
PROFILE SUPPORT
clip is supported in all pixel/fragment profiles.
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 747
COS(Cg) Cg Standard Library COS(Cg)
NAME cos −returns cosine of scalars and vectors.
SYNOPSIS
float cos(float a);
float1 cos(float1 a);
float2 cos(float2 a);
float3 cos(float3 a);
float4 cos(float4 a);
half cos(half a);
half1 cos(half1 a);
half2 cos(half2 a);
half3 cos(half3 a);
half4 cos(half4 a);
fixed cos(fixed a);
fixed1 cos(fixed1 a);
fixed2 cos(fixed2 a);
fixed3 cos(fixed3 a);
fixed4 cos(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the cosine.
DESCRIPTION
Returns the cosine of ain radians. The return value is in the range [−1,+1].
Forvectors, the returned vector contains the cosine of each element of the input vector.
REFERENCE IMPLEMENTATION
cos is best implemented as a native cosine instruction, howevercos for a float scalar could be implemented
by an approximation likethis.
cos(float a)
{
/* C simulation gives a max absolute error of less than 1.8e−7 */
const float4 c0 = float4( 0.0, 0.5,
1.0, 0.0 );
const float4 c1 = float4( 0.25, −9.0,
0.75, 0.159154943091 );
const float4 c2 = float4( 24.9808039603, −24.9808039603,
−60.1458091736, 60.1458091736 );
const float4 c3 = float4( 85.4537887573, −85.4537887573,
−64.9393539429, 64.9393539429 );
const float4 c4 = float4( 19.7392082214, −19.7392082214,
−1.0, 1.0 );
/* r0.x = cos(a) */
float3 r0, r1, r2;
r1.x = c1.w * a; // normalize input
r1.y = frac( r1.x ); // and extract fraction
r2.x = (float) ( r1.y < c1.x ); // range check: 0.0 to 0.25
r2.yz = (float2) ( r1.yy >= c1.yz ); // range check: 0.75 to 1.0
r2.y = dot( r2, c4.zwz ); // range check: 0.25 to 0.75
r0 = c0.xyz − r1.yyy; // range centering
r0 = r0 * r0;
perl v5.10.0 Cg Toolkit 3.0 748
COS(Cg) Cg Standard Library COS(Cg)
r1 = c2.xyx * r0 + c2.zwz; // start power series
r1 = r1 * r0 + c3.xyx;
r1 = r1 * r0 + c3.zwz;
r1 = r1 * r0 + c4.xyx;
r1 = r1 * r0 + c4.zwz;
r0.x = dot( r1, −r2 ); // range extract
return r0.x;
PROFILE SUPPORT
cos is fully supported in all profiles unless otherwise specified.
cos is supported via an approximation (shown above)inthe vs_1_1, vp20, and arbvp1 profiles.
cos is unsupported in the fp20, ps_1_1, ps_1_2, and ps_1_3 profiles.
SEE ALSO
acos, dot, frac, sin, sincos, tan
perl v5.10.0 Cg Toolkit 3.0 749
COSH(Cg) Cg Standard Library COSH(Cg)
NAME cosh −returns hyperbolic cosine of scalars and vectors.
SYNOPSIS
float cosh(float a);
float1 cosh(float1 a);
float2 cosh(float2 a);
float3 cosh(float3 a);
float4 cosh(float4 a);
half cosh(half a);
half1 cosh(half1 a);
half2 cosh(half2 a);
half3 cosh(half3 a);
half4 cosh(half4 a);
fixed cosh(fixed a);
fixed1 cosh(fixed1 a);
fixed2 cosh(fixed2 a);
fixed3 cosh(fixed3 a);
fixed4 cosh(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the hyperbolic cosine.
DESCRIPTION
Returns the hyperbolic cosine of a.
Forvectors, the returned vector contains the hyperbolic cosine of each element of the input vector.
REFERENCE IMPLEMENTATION
cosh for a scalar float could be implemented likethis.
float cosh(float x)
{
return 0.5 * (exp(x)+exp(−x));
}
PROFILE SUPPORT
cosh is supported in all profiles except fp20.
SEE ALSO
acos, cos, exp, sinh, tanh
perl v5.10.0 Cg Toolkit 3.0 750
CROSS(Cg) Cg Standard Library CROSS(Cg)
NAME cross −returns the cross product of twothree-component vectors
SYNOPSIS
float3 cross(float3 a, float3 b);
half3 cross(half3 a, half3 b);
fixed3 cross(fixed3 a, fixed3 b);
PARAMETERS
aThree-component vector.
bThree-component vector.
DESCRIPTION
Returns the cross product of three-component vectors aand b.The result is a three-component vector.
REFERENCE IMPLEMENTATION
cross for float3 vectors could be implemented this way:
float3 cross(float3 a, float3 b)
{
return a.yzx * b.zxy − a.zxy * b.yzx;
}
PROFILE SUPPORT
cross is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
dot
perl v5.10.0 Cg Toolkit 3.0 751
DDX(Cg) Cg Standard Library DDX(Cg)
NAME ddx −returns approximate partial derivative with respect to window-space X
SYNOPSIS
float ddx(float a);
float1 ddx(float1 a);
float2 ddx(float2 a);
float3 ddx(float3 a);
float4 ddx(float4 a);
half ddx(half a);
half1 ddx(half1 a);
half2 ddx(half2 a);
half3 ddx(half3 a);
half4 ddx(half4 a);
fixed ddx(fixed a);
fixed1 ddx(fixed1 a);
fixed2 ddx(fixed2 a);
fixed3 ddx(fixed3 a);
fixed4 ddx(fixed4 a);
PARAMETERS
aVector or scalar of which to approximate the partial derivative with respect to window-space X.
DESCRIPTION
Returns approximate partial derivative ofawith respect to the window-space (horizontal) xcoordinate.
Forvectors, the returned vector contains the approximate partial derivative ofeach element of the input
vector.
This function is only available in fragment program profiles (but not all of them).
The specific way the partial derivative iscomputed is implementation-dependent. Typically fragments are
rasterized in 2x2 arrangements of fragments (called quad-fragments) and the partial derivativesofa
variable is computed by differencing with the adjacent horizontal fragment in the quad-fragment.
The partial derivative computation may incorrect when ddx is used in control flowpaths where not all the
fragments within a quad-fragment have branched the same way.
The partial derivative computation may be less exact (wobbly) when the variable is computed based on
varying parameters interpolated with centroid interpolation.
REFERENCE IMPLEMENTATION
ddx is not expressible in Cg code.
PROFILE SUPPORT
ddx is supported only in fragment profiles. Vertexand geometry profiles lack the concept of window
space.
ddx is unsupported in the fp20, ps_1_1, ps_1_2, ps_1_3, and arbfp1 profiles.
SEE ALSO
ddy,fp30, fp40, fwidth, gp4fp
perl v5.10.0 Cg Toolkit 3.0 752
DDY(Cg) Cg Standard Library DDY(Cg)
NAME ddy −returns approximate partial derivative with respect to window-space Y
SYNOPSIS
float ddy(float a);
float1 ddy(float1 a);
float2 ddy(float2 a);
float3 ddy(float3 a);
float4 ddy(float4 a);
half ddy(half a);
half1 ddy(half1 a);
half2 ddy(half2 a);
half3 ddy(half3 a);
half4 ddy(half4 a);
fixed ddy(fixed a);
fixed1 ddy(fixed1 a);
fixed2 ddy(fixed2 a);
fixed3 ddy(fixed3 a);
fixed4 ddy(fixed4 a);
PARAMETERS
aVector or scalar of which to approximate the partial derivative with respect to window-space Y.
DESCRIPTION
Returns approximate partial derivative ofawith respect to the window-space (vertical) ycoordinate.
Forvectors, the returned vector contains the approximate partial derivative ofeach element of the input
vector.
This function is only available in fragment program profiles (but not all of them).
The specific way the partial derivative iscomputed is implementation-dependent. Typically fragments are
rasterized in 2x2 arrangements of fragments (called quad-fragments) and the partial derivativesofa
variable is computed by differencing with the adjacent horizontal fragment in the quad-fragment.
The partial derivative computation may incorrect when ddy is used in control flowpaths where not all the
fragments within a quad-fragment have branched the same way.
The partial derivative computation may be less exact (wobbly) when the variable is computed based on
varying parameters interpolated with centroid interpolation.
REFERENCE IMPLEMENTATION
ddy is not expressible in Cg code.
PROFILE SUPPORT
ddy is supported only in fragment profiles. Vertexand geometry profiles lack the concept of window
space.
ddy is unsupported in the fp20, ps_1_1, ps_1_2, ps_1_3, and arbfp1 profiles.
SEE ALSO
ddx, fp30, fp40, fwidth, gp4fp
perl v5.10.0 Cg Toolkit 3.0 753
DEGREES(Cg) Cg Standard Library DEGREES(Cg)
NAME degrees −converts values of scalars and vectors from radians to degrees
SYNOPSIS
float degrees(float a);
float1 degrees(float1 a);
float2 degrees(float2 a);
float3 degrees(float3 a);
float4 degrees(float4 a);
half degrees(half a);
half1 degrees(half1 a);
half2 degrees(half2 a);
half3 degrees(half3 a);
half4 degrees(half4 a);
fixed degrees(fixed a);
fixed1 degrees(fixed1 a);
fixed2 degrees(fixed2 a);
fixed3 degrees(fixed3 a);
fixed4 degrees(fixed4 a);
PARAMETERS
aVector or scalar of which to convert from radians to degrees.
DESCRIPTION
Returns the scalar or vector converted from radians to degrees.
Forvectors, the returned vector contains each element of the input vector converted from radians to
degrees.
REFERENCE IMPLEMENTATION
degrees for a float scalar could be implemented likethis.
float degrees(float a)
{
return 57.29577951 * a;
}
PROFILE SUPPORT
degrees is supported in all profiles except fp20.
SEE ALSO
cos, radians, sin, tan
perl v5.10.0 Cg Toolkit 3.0 754
DETERMINANT(Cg) Cg Standard Library DETERMINANT(Cg)
NAME determinant −returns the scalar determinant of a square matrix
SYNOPSIS
float determinant(float1x1 A);
float determinant(float2x2 A);
float determinant(float3x3 A);
float determinant(float4x4 A);
PARAMETERS
ASquare matrix of which to compute the determinant.
DESCRIPTION
Returns the determinant of the square matrix A.
REFERENCE IMPLEMENTATION
The various determinant functions can be implemented likethis:
float determinant(float1x1 A)
{
return A._m00;
}
float determinant(float2x2 A)
{
return A._m00*A._m11 − A._m01*A._m10;
}
float determinant(float3x3 A)
{
return dot(A._m00_m01_m02,
A._m11_m12_m10 * A._m22_m20_m21
−A._m12_m10_m11 * A._m21_m22_m20);
}
float determinant(float4x4 A) {
return dot(float4(1,−1,1,−1) * A._m00_m01_m02_m03,
A._m11_m12_m13_m10*( A._m22_m23_m20_m21*A._m33_m30_m31_m32
−A._m23_m20_m21_m22*A._m32_m33_m30_m31)
+A._m12_m13_m10_m11*( A._m23_m20_m21_m22*A._m31_m32_m33_m30
−A._m21_m22_m23_m20*A._m33_m30_m31_m32)
+A._m13_m10_m11_m12*( A._m21_m22_m23_m20*A._m32_m33_m30_m31
−A._m22_m23_m20_m21*A._m31_m32_m33_m30));
}
PROFILE SUPPORT
determinant is supported in all profiles. Howeverprofiles such as fp20 and ps_2_0 without native floating-
point will have problems computing the larger determinants and may have ranges issues computing even
small determinants.
SEE ALSO
mul, transpose
perl v5.10.0 Cg Toolkit 3.0 755
DISTANCE(Cg) Cg Standard Library DISTANCE(Cg)
NAME distance −return the Euclidean distance between twopoints
SYNOPSIS
float distance(float pt1, float pt2);
float distance(float1 pt1, float1 pt2);
float distance(float2 pt1, float2 pt2);
float distance(float3 pt1, float3 pt2);
float distance(float4 pt1, float4 pt2);
half distance(half pt1, half pt2);
half distance(half1 pt1, half1 pt2);
half distance(half2 pt1, half2 pt2);
half distance(half3 pt1, half3 pt2);
half distance(half4 pt1, half4 pt2);
fixed distance(fixed pt1, fixed pt2);
fixed distance(fixed1 pt1, fixed1 pt2);
fixed distance(fixed2 pt1, fixed2 pt2);
fixed distance(fixed3 pt1, fixed3 pt2);
fixed distance(fixed4 pt1, fixed4 pt2);
PARAMETERS
pt1 First point.
pt2 Second point.
DESCRIPTION
Returns the Euclidean distance from a first point pt1 to a second point pt2.
REFERENCE IMPLEMENTATION
distance for a float3 vector could be implemented likethis.
float distance(float3 pt1, float3 pt2)
{
float3 v = vt2 − pt1;
return sqrt(dot(v,v));
}
PROFILE SUPPORT
distance is supported in all profiles except fp20.
SEE ALSO
dot, length, normalize, sqrt
perl v5.10.0 Cg Toolkit 3.0 756
DOT(Cg) Cg Standard Library DOT(Cg)
NAME dot −returns the scalar dot product of twovectors
SYNOPSIS
float dot(float a, float b);
float1 dot(float1 a, float1 b);
float2 dot(float2 a, float2 b);
float3 dot(float3 a, float3 b);
float4 dot(float4 a, float4 b);
half dot(half a, half b);
half1 dot(half1 a, half1 b);
half2 dot(half2 a, half2 b);
half3 dot(half3 a, half3 b);
half4 dot(half4 a, half4 b);
fixed dot(fixed a, fixed b);
fixed1 dot(fixed1 a, fixed1 b);
fixed2 dot(fixed2 a, fixed2 b);
fixed3 dot(fixed3 a, fixed3 b);
fixed4 dot(fixed4 a, fixed4 b);
PARAMETERS
aFirst vector.
bSecond vector.
DESCRIPTION
Returns the scalar dot product of twosame-typed vectors aand b.
REFERENCE IMPLEMENTATION
dot for float4 vectors could be implemented this way:
float dot(float4 a, float4 b)
{
return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
}
PROFILE SUPPORT
dot is supported in all profiles.
The fixed3 dot product is very efficient in the fp20 and fp30 profiles.
The float3 and float4 dot products are very efficient in the vp20, vp30, vp40, arbvp1, fp30, fp40, and
arbfp1 profiles.
The float2 dot product is very efficient in the fp40 profile. In optimal circumstances, twotwo-component
dot products can sometimes be performed at the four-component and three-component dot product rate.
SEE ALSO
cross, lit, mul
perl v5.10.0 Cg Toolkit 3.0 757
EXP(Cg) Cg Standard Library EXP(Cg)
NAME exp −returns the base-e exponential of scalars and vectors
SYNOPSIS
float exp(float a);
float1 exp(float1 a);
float2 exp(float2 a);
float3 exp(float3 a);
float4 exp(float4 a);
half exp(half a);
half1 exp(half1 a);
half2 exp(half2 a);
half3 exp(half3 a);
half4 exp(half4 a);
fixed exp(fixed a);
fixed1 exp(fixed1 a);
fixed2 exp(fixed2 a);
fixed3 exp(fixed3 a);
fixed4 exp(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the base-e exponential. The value e is approximately
2.71828182845904523536.
DESCRIPTION
Returns the base-e exponential a.
Forvectors, the returned vector contains the base-e exponential of each element of the input vector.
REFERENCE IMPLEMENTATION
float3 exp(float3 a)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = exp(a[i]); // this is the ANSI C standard library exp()
}
return rv;
}
exp is typically implemented with either a native base−2 exponentional instruction or pow.
PROFILE SUPPORT
exp is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp2, log, pow
perl v5.10.0 Cg Toolkit 3.0 758
EXP2(Cg) Cg Standard Library EXP2(Cg)
NAME exp2 −returns the base−2 exponential of scalars and vectors
SYNOPSIS
float exp2(float a);
float1 exp2(float1 a);
float2 exp2(float2 a);
float3 exp2(float3 a);
float4 exp2(float4 a);
half exp2(half a);
half1 exp2(half1 a);
half2 exp2(half2 a);
half3 exp2(half3 a);
half4 exp2(half4 a);
fixed exp2(fixed a);
fixed1 exp2(fixed1 a);
fixed2 exp2(fixed2 a);
fixed3 exp2(fixed3 a);
fixed4 exp2(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the base−2 exponential.
DESCRIPTION
Returns the base−2 exponential a.
Forvectors, the returned vector contains the base−2 exponential of each element of the input vector.
REFERENCE IMPLEMENTATION
float3 exp2(float3 a)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = exp2(a[i]); // this is the ANSI C standard library exp2()
}
return rv;
}
exp2 is typically implemented with a native base−2 exponentional instruction.
PROFILE SUPPORT
exp2 is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp, log, pow
perl v5.10.0 Cg Toolkit 3.0 759
FA CEFORWARD(Cg) Cg Standard Library FA CEFORWARD(Cg)
NAME faceforward −returns a normal as-is if a vertex’seye-space position vector points in the opposite direction
of a geometric normal, otherwise return the negated version of the normal
SYNOPSIS
float faceforward(float N, float I, float Ng);
float1 faceforward(float1 N, float1 I, float1 Ng);
float2 faceforward(float2 N, float2 I, float2 Ng);
float3 faceforward(float3 N, float3 I, float3 Ng);
float4 faceforward(float4 N, float4 I, float4 Ng);
half faceforward(half N, half I, half Ng);
half1 faceforward(half1 N, half1 I, half1 Ng);
half2 faceforward(half2 N, half2 I, half2 Ng);
half3 faceforward(half3 N, half3 I, half3 Ng);
half4 faceforward(half4 N, half4 I, half4 Ng);
fixed faceforward(fixed N, fixed I, fixed Ng);
fixed1 faceforward(fixed1 N, fixed1 I, fixed1 Ng);
fixed2 faceforward(fixed2 N, fixed2 I, fixed2 Ng);
fixed3 faceforward(fixed3 N, fixed3 I, fixed3 Ng);
fixed4 faceforward(fixed4 N, fixed4 I, fixed4 Ng);
PARAMETERS
NPeturbed normal vector.
IIncidence vector (typically a direction vector from the eye to a vertex).
Ng Geometric normal vector (for some facet the peturbed normal belongs).
DESCRIPTION
Returns a (peturbed) normal as-is if a vertex’seye-space position vector points in the opposite direction of a
geometric normal, otherwise return the negated version of the (peturbed) normal
Mathematically,ifthe dot product of Iand Ng is negative,Nis returned unchanged; otherwise −Nis
returned.
This function is inspired by a RenderMan funciton of the same name though the RenderMan version has
only twoparameters.
REFERENCE IMPLEMENTATION
faceforward for float3 vectors could be implemented this way:
float3 faceforward( float3 N, float3 I, float Ng )
{
return dot(I, Ng) < 0 ? N : −N;
}
PROFILE SUPPORT
refract is supported in all profiles.
SEE ALSO
dot, reflect, refract, normalize
perl v5.10.0 Cg Toolkit 3.0 760
FLOATTOINTBITS(Cg) Cg Standard Library FLOATTOINTBITS(Cg)
NAME floatToIntBits −returns the 32−bit integer representation of an IEEE 754 floating-point scalar or vector
SYNOPSIS
int floatToIntBits(float x);
int1 floatToIntBits(float1 x);
int2 floatToIntBits(float2 x);
int3 floatToIntBits(float3 x);
int4 floatToIntBits(float4 x);
PARAMETERS
xFloating-point vector or scalar to cast to a scalar int or vector of ints.
DESCRIPTION
Returns a representation of the specified floating-point scalar value or vector values according to the IEEE
754 floating-point ‘‘single format’’bit layout.
Not-A-Number (NaN) floating-point values are cannonicalized to the integer value 0x7fc00000 regardless
of the specific NaN encoding. The sign bit of the NaN is discarded.
This function is based on Java’s jav e.lang.Float method of the same name. See:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Float.html
floatToIntBits requires instructions to be generated to cannonicalize NaN values so floatToIntBits is
typically more expensive than floatToRawIntBits.
REFERENCE IMPLEMENTATION
floatToIntBits operates consistent with the following ANSI Ccode:
int floatToIntBits(float x)
{
union {
float f; // assuming 32−bit IEEE 754 single−precision
int i; // assuming 32−bit 2's complement int
}u;
if (isnan(x)) {
return 0x7fc00000;
}else {
u.f = x;
return u.i;
}
}
PROFILE SUPPORT
floatToIntBits is supported by the gp4vp, gp4gp, and gp4vp profiles.
floatToIntBits is not supported by pre−G80 profiles.
SEE ALSO
ceil, floatToRawIntBits, floor,intBitsToFloat, round, trunc
perl v5.10.0 Cg Toolkit 3.0 761
FLOATTORAWINTBITS(Cg) Cg Standard Library FLOATTORAWINTBITS(Cg)
NAME floatToRawIntBits −returns the raw32−bit integer representation of an IEEE 754 floating-point scalar or
vector
SYNOPSIS
int floatToRawIntBits(float x);
int1 floatToRawIntBits(float1 x);
int2 floatToRawIntBits(float2 x);
int3 floatToRawIntBits(float3 x);
int4 floatToRawIntBits(float4 x);
PARAMETERS
xFloating-point vector or scalar to rawcast to a scalar int or vector of ints.
DESCRIPTION
Returns a representation of the specified floating-point scalar value or vector values according to the IEEE
754 floating-point ‘‘single format’’bit layout, preserving Not-a-Number (NaN) values.
This function is based on Java’s jav e.lang.Float method of the same name. See:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Float.html
The Cg compiler can typically optimize floatToRawIntBits so it has no instruction cost.
REFERENCE IMPLEMENTATION
floatToRawIntBits operates consistent with the following ANSI Ccode:
int floatToRawIntBits(float x)
{
union {
float f; // assuming 32−bit IEEE 754 single−precision
int i; // assuming 32−bit 2's complement int
}u;
u.f = x;
return u.i;
}
PROFILE SUPPORT
floatToRawIntBits is supported by the gp4vp, gp4gp, and gp4vp profiles.
floatToRawIntBits is not supported by pre−G80 profiles.
SEE ALSO
ceil, floatToIntBits, floor,intBitsToFloat, round, trunc
perl v5.10.0 Cg Toolkit 3.0 762
FLOOR(Cg) Cg Standard Library FLOOR(Cg)
NAME floor −returns largest integer not greater than a scalar or each vector component.
SYNOPSIS
float floor(float a);
float1 floor(float1 a);
float2 floor(float2 a);
float3 floor(float3 a);
float4 floor(float4 a);
half floor(half a);
half1 floor(half1 a);
half2 floor(half2 a);
half3 floor(half3 a);
half4 floor(half4 a);
fixed floor(fixed a);
fixed1 floor(fixed1 a);
fixed2 floor(fixed2 a);
fixed3 floor(fixed3 a);
fixed4 floor(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the floor.
DESCRIPTION
Returns the floor or largest integer not greater than a scalar or each vector component.
REFERENCE IMPLEMENTATION
floor for a float3 vector could be implemented likethis.
float3 floor(float3 v)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = v[i] − frac(v[i]);
}
return rv;
}
PROFILE SUPPORT
floor is supported in all profiles except fp20.
SEE ALSO
ceil, round
perl v5.10.0 Cg Toolkit 3.0 763
FMOD(Cg) Cg Standard Library FMOD(Cg)
NAME fmod −returns the remainder of x/ywith the same sign as x
SYNOPSIS
float fmod(float x, float y);
float1 fmod(float1 x, float1 y);
float2 fmod(float2 x, float2 y);
float3 fmod(float3 x, float3 y);
float4 fmod(float4 x, float4 y);
half fmod(half x, half y);
half1 fmod(half1 x, half1 y);
half2 fmod(half2 x, half2 y);
half3 fmod(half3 x, half3 y);
half4 fmod(half4 x, half4 y);
fixed fmod(fixed x, fixed y);
fixed1 fmod(fixed1 x, fixed1 y);
fixed2 fmod(fixed2 x, fixed2 y);
fixed3 fmod(fixed3 x, fixed3 y);
fixed4 fmod(fixed4 x, fixed4 y);
PARAMETERS
xVector or scalar numerator
yVector or scalar denominator
DESCRIPTION
fmod returns the remainder of xdivided by ywith the same sign as x.Ifyis zero, the result is
implementation-defined because of division by zero.
Forvectors, the returned vector contains the signed remainder of each element of the input vector.
REFERENCE IMPLEMENTATION
fmod for an float2 vector could be implemented as:
float2 fmod(float2 a, float2 b)
{
float2 c = frac(abs(a/b))*abs(b);
return (a < 0) ? −c : c; /* if ( a < 0 ) c = 0−c */
}
PROFILE SUPPORT
fmod is supported in all profiles but fp20.
SEE ALSO
abs, frac
perl v5.10.0 Cg Toolkit 3.0 764
FRAC(Cg) Cg Standard Library FRAC(Cg)
NAME frac −returns the fractional portion of a scalar or each vector component.
SYNOPSIS
float frac(float a);
float1 frac(float1 a);
float2 frac(float2 a);
float3 frac(float3 a);
float4 frac(float4 a);
half frac(half a);
half1 frac(half1 a);
half2 frac(half2 a);
half3 frac(half3 a);
half4 frac(half4 a);
fixed frac(fixed a);
fixed1 frac(fixed1 a);
fixed2 frac(fixed2 a);
fixed3 frac(fixed3 a);
fixed4 frac(fixed4 a);
PARAMETERS
aVector or scalar of which to return its fractional portion.
DESCRIPTION
Returns the fractional portion of a scalar or each vector component.
REFERENCE IMPLEMENTATION
frac for a float scalar could be implemented likethis.
float frac(float v)
{
return v − floor(v);
}
PROFILE SUPPORT
frac is supported in all profiles except fp20.
SEE ALSO
ceil, floor,round, trunc
perl v5.10.0 Cg Toolkit 3.0 765
FREXP(Cg) Cg Standard Library FREXP(Cg)
NAME frexp −splits scalars and vectors into normalized fraction and a power of 2
SYNOPSIS
float frexp(float x, out float e);
float1 frexp(float1 x, out float1 e);
float2 frexp(float2 x, out float2 e);
float3 frexp(float3 x, out float3 e);
float4 frexp(float4 x, out float4 e);
half frexp(half x, out half e);
half1 frexp(half1 x, out half1 e);
half2 frexp(half2 x, out half2 e);
half3 frexp(half3 x, out half3 e);
half4 frexp(half4 x, out half4 e);
fixed frexp(fixed x, out fixed e);
fixed1 frexp(fixed1 x, out fixed1 e);
fixed2 frexp(fixed2 x, out fixed2 e);
fixed3 frexp(fixed3 x, out fixed3 e);
fixed4 frexp(fixed4 x, out fixed4 e);
PARAMETERS
xVector or scalar of which to split.
eVector or scalar where the exponent of xis output.
DESCRIPTION
This function decomposes xinto twoparts: a mantissa between 0.5 and 1 (returned by the function) and an
exponent output as e.
If the value xis zero, both parts of the result are zero.
Forvectors, the returned vector contains the mantissa of each element of the input vector and the output
vector contains the exponent of each element of the input vector.
REFERENCE IMPLEMENTATION
The example belowisnot legalCgbecause it uses the & address-of operator not supported by Cg in order
to call the ANSI Cfrexp routine.
float3 frexp(float3 x, out float3 e)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
float eout;
rv[i] = frexp(a[i], &eout); // this is the ANSI C standard library frexp()
e[i] = eout;
}
return rv;
}
PROFILE SUPPORT
frexp is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
perl v5.10.0 Cg Toolkit 3.0 766
FREXP(Cg) Cg Standard Library FREXP(Cg)
SEE ALSO
exp2, log, pow
perl v5.10.0 Cg Toolkit 3.0 767
FWIDTH(Cg) Cg Standard Library FWIDTH(Cg)
NAME fwidth −returns sum of approximate window-space partial derivativesmagnitudes
SYNOPSIS
float fwidth(float a);
float1 fwidth(float1 a);
float2 fwidth(float2 a);
float3 fwidth(float3 a);
float4 fwidth(float4 a);
half fwidth(half a);
half1 fwidth(half1 a);
half2 fwidth(half2 a);
half3 fwidth(half3 a);
half4 fwidth(half4 a);
fixed fwidth(fixed a);
fixed1 fwidth(fixed1 a);
fixed2 fwidth(fixed2 a);
fixed3 fwidth(fixed3 a);
fixed4 fwidth(fixed4 a);
PARAMETERS
aVector or scalar of which to sum its approximate window-space partial derivative magnitudes.
with respect to window-space X and Y.
DESCRIPTION
Returns sum of the absolute values of each approximate partial derivative ofawith respect to both the
window-space (horizontal) xand (vertical) y) coordinate.
Forvectors, the returned vector contains the sum of partial derivative magnitudes of each element of the
input vector.
This function can be used to approximate the fragment width (hence the name ‘‘fwidth’’) for level-of-detail
computations dependent on change in window-space.
This function is only available in fragment program profiles (but not all of them).
The specific way the partial derivative iscomputed is implementation-dependent. Typically fragments are
rasterized in 2x2 arrangements of fragments (called quad-fragments) and the partial derivativesofa
variable is computed by differencing with the adjacent horizontal fragment in the quad-fragment.
The partial derivative computation may incorrect when fwidth is used in control flowpaths where not all
the fragments within a quad-fragment have branched the same way.
The partial derivative computation may be less exact (wobbly) when the variable is computed based on
varying parameters interpolated with centroid interpolation.
REFERENCE IMPLEMENTATION
fmod for float3 vectors could be implemented this way:
float3 fwidth(float3 a)
{
return abs(ddx(a)) + abs(ddy(a));
}
PROFILE SUPPORT
fwidth is supported only in fragment profiles. Vertexand geometry profiles lack the concept of window
space.
fwidth is unsupported in the fp20, ps_1_1, ps_1_2, ps_1_3, and arbfp1 profiles.
perl v5.10.0 Cg Toolkit 3.0 768
FWIDTH(Cg) Cg Standard Library FWIDTH(Cg)
SEE ALSO
ddx, ddy,fp30, fp40, gp4fp
POD ERRORS
Hey! The above document had some coding errors, which areexplained below:
Around line 40:
Unterminated I<...> sequence
perl v5.10.0 Cg Toolkit 3.0 769
INTBITSTOFLOAT(Cg) Cg Standard Library INTBITSTOFLOAT(Cg)
NAME intBitsToFloat −returns the float value corresponding to a givenbit represention.of a scalar int value or
vector of int values
SYNOPSIS
float intBitsToFloat(int x);
float1 intBitsToFloat(int1 x);
float2 intBitsToFloat(int2 x);
float3 intBitsToFloat(int3 x);
float4 intBitsToFloat(int4 x);
PARAMETERS
xInteger vector or scalar to rawcast to a scalar float or vector of floats
DESCRIPTION
Returns the IEEE 754 float scalar value or vector values corresponding to a given32−bit integer bit
represention for a scalar int value or vector of int values.
This function is based on Java’s jav e.lang.Float method of the same name. See:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Float.html
The Cg compiler can typically optimize intBitsToFloat so it has no instruction cost.
REFERENCE IMPLEMENTATION
intBitsToFloat operates consistent with the following ANSI Ccode:
float floatToRawIntBits(int x)
{
union {
float f; // assuming 32−bit IEEE 754 single−precision
int i; // assuming 32−bit 2's complement int
}u;
u.i = x;
return u.f;
}
PROFILE SUPPORT
intBitsToFloat is supported by the gp4vp, gp4gp, and gp4vp profiles.
intBitsToFloat is not supported by pre−G80 profiles.
SEE ALSO
ceil, floatToIntBits,floatToRawIntBits, floor,round, trunc
perl v5.10.0 Cg Toolkit 3.0 770
ISFINITE(Cg) Cg Standard Library ISFINITE(Cg)
NAME isfinite −test whether or not a scalar or each vector component is a finite value
SYNOPSIS
bool isfinite(float x);
bool1 isfinite(float1 x);
bool2 isfinite(float2 x);
bool3 isfinite(float3 x);
bool4 isfinite(float4 x);
bool isfinite(half x);
bool1 isfinite(half1 x);
bool2 isfinite(half2 x);
bool3 isfinite(half3 x);
bool4 isfinite(half4 x);
bool isfinite(fixed x);
bool1 isfinite(fixed1 x);
bool2 isfinite(fixed2 x);
bool3 isfinite(fixed3 x);
bool4 isfinite(fixed4 x);
PARAMETERS
xVector or scalar to test for finiteness.
DESCRIPTION
Returns whether or not a scalar or each vector component is a finite value. Infinity and not-a-number
(NaN) values are not finite.
REFERENCE IMPLEMENTATION
isfinite for float3 vectors could be implemented likethis.
bool3 isfinite(float3 s)
{
// By IEEE 754 rule, 2*Inf equals Inf
return (s == s) && ((s == 0) || (s != 2*s));
}
PROFILE SUPPORT
isfinite is supported in all profiles except fp20.
SEE ALSO
isinf, isnan
perl v5.10.0 Cg Toolkit 3.0 771
ISINF(Cg) Cg Standard Library ISINF(Cg)
NAME isinf −test whether or not a scalar or each vector component is infinite
SYNOPSIS
bool isinf(float x);
bool1 isinf(float1 x);
bool2 isinf(float2 x);
bool3 isinf(float3 x);
bool4 isinf(float4 x);
bool isinf(half x);
bool1 isinf(half1 x);
bool2 isinf(half2 x);
bool3 isinf(half3 x);
bool4 isinf(half4 x);
bool isinf(fixed x);
bool1 isinf(fixed1 x);
bool2 isinf(fixed2 x);
bool3 isinf(fixed3 x);
bool4 isinf(fixed4 x);
PARAMETERS
xVector or scalar to test if infinite.
DESCRIPTION
Returns whether or not a scalar or each vector component is a (negative orpositive)infinite value. Finite
and not-a-number (NaN) values are not infinite.
REFERENCE IMPLEMENTATION
isinf for float3 vectors could be implemented likethis.
bool3 isinf(float3 s)
{
// By IEEE 754 rule, 2*Inf equals Inf
return (2*s == s) && (s != 0);
}
PROFILE SUPPORT
isinf is supported in all profiles except fp20.
SEE ALSO
isfinite, isnan
perl v5.10.0 Cg Toolkit 3.0 772
ISNAN(Cg) Cg Standard Library ISNAN(Cg)
NAME isnan −test whether or not a scalar or each vector component is not-a-number
SYNOPSIS
bool isnan(float x);
bool1 isnan(float1 x);
bool2 isnan(float2 x);
bool3 isnan(float3 x);
bool4 isnan(float4 x);
bool isnan(half x);
bool1 isnan(half1 x);
bool2 isnan(half2 x);
bool3 isnan(half3 x);
bool4 isnan(half4 x);
bool isnan(fixed x);
bool1 isnan(fixed1 x);
bool2 isnan(fixed2 x);
bool3 isnan(fixed3 x);
bool4 isnan(fixed4 x);
PARAMETERS
xVector or scalar to test for being NaN.
DESCRIPTION
Returns whether or not a scalar or each vector component is not-a-number (NaN) Finite and infinite values
are not NaN.
REFERENCE IMPLEMENTATION
isnan for float3 vectors could be implemented likethis.
bool3 isnan(float3 s)
{
// By IEEE 754 rule, NaN is not equal to NaN
return s != s;
}
PROFILE SUPPORT
isnan is supported in all profiles except fp20.
SEE ALSO
isfinite, isinf
perl v5.10.0 Cg Toolkit 3.0 773
LDEXP(Cg) Cg Standard Library LDEXP(Cg)
NAME ldexp −returns xtimes 2 rained to n
SYNOPSIS
float ldexp(float x, float n);
float1 ldexp(float1 x, float1 n);
float2 ldexp(float2 x, float2 n);
float3 ldexp(float3 x, float3 n);
float4 ldexp(float4 x, float4 n);
half ldexp(half x, half n);
half1 ldexp(half1 x, half1 n);
half2 ldexp(half2 x, half2 n);
half3 ldexp(half3 x, half3 n);
half4 ldexp(half4 x, half4 n);
fixed ldexp(fixed x, fixed n);
fixed1 ldexp(fixed1 x, fixed1 n);
fixed2 ldexp(fixed2 x, fixed2 n);
fixed3 ldexp(fixed3 x, fixed3 n);
fixed4 ldexp(fixed4 x, fixed4 n);
PARAMETERS
xVector or scalar.
nVector or scalar for power with which to raise 2.
DESCRIPTION
ldexp returns xtimes 2 raised to the power n.
REFERENCE IMPLEMENTATION
ldexp for float2 vectors xand ncould be implemented as:
float2 ldexp(float2 x, float2 n)
{
return x * exp2(n);
}
PROFILE SUPPORT
ldexp is supported in all profiles but fp20.
SEE ALSO
exp2, modf, pow
perl v5.10.0 Cg Toolkit 3.0 774
LENGTH(Cg) Cg Standard Library LENGTH(Cg)
NAME length −return scalar Euclidean length of a vector
SYNOPSIS
float length(float v);
float length(float1 v);
float length(float2 v);
float length(float3 v);
float length(float4 v);
half length(half v);
half length(half1 v);
half length(half2 v);
half length(half3 v);
half length(half4 v);
fixed length(fixed v);
fixed length(fixed1 v);
fixed length(fixed2 v);
fixed length(fixed3 v);
fixed length(fixed4 v);
PARAMETERS
vVector of which to determine the length.
DESCRIPTION
Returns the Euclidean length of a vector.
REFERENCE IMPLEMENTATION
length for a float3 vector could be implemented likethis.
float length(float3 v)
{
return sqrt(dot(v,v));
}
PROFILE SUPPORT
length is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
max, normalize, sqrt, dot
perl v5.10.0 Cg Toolkit 3.0 775
LERP(Cg) Cg Standard Library LERP(Cg)
NAME lerp −returns linear interpolation of twoscalars or vectors based on a weight
SYNOPSIS
float lerp(float a, float b, float w);
float1 lerp(float1 a, float1 b, float1 w);
float2 lerp(float2 a, float2 b, float2 w);
float3 lerp(float3 a, float3 b, float3 w);
float4 lerp(float4 a, float4 b, float4 w);
float1 lerp(float1 a, float1 b, float w);
float2 lerp(float2 a, float2 b, float w);
float3 lerp(float3 a, float3 b, float w);
float4 lerp(float4 a, float4 b, float w);
half lerp(half a, half b, half w);
half1 lerp(half1 a, half1 b, half1 w);
half2 lerp(half2 a, half2 b, half2 w);
half3 lerp(half3 a, half3 b, half3 w);
half4 lerp(half4 a, half4 b, half4 w);
half1 lerp(half1 a, half1 b, half w);
half2 lerp(half2 a, half2 b, half w);
half3 lerp(half3 a, half3 b, half w);
half4 lerp(half4 a, half4 b, half w);
fixed lerp(fixed a, fixed b, fixed w);
fixed1 lerp(fixed1 a, fixed1 b, fixed1 w);
fixed2 lerp(fixed2 a, fixed2 b, fixed2 w);
fixed3 lerp(fixed3 a, fixed3 b, fixed3 w);
fixed4 lerp(fixed4 a, fixed4 b, fixed4 w);
fixed1 lerp(fixed1 a, fixed1 b, fixed w);
fixed2 lerp(fixed2 a, fixed2 b, fixed w);
fixed3 lerp(fixed3 a, fixed3 b, fixed w);
fixed4 lerp(fixed4 a, fixed4 b, fixed w);
PARAMETERS
aVector or scalar to weight; returned when wis zero.
bVector or scalar to weight; returned when wis one.
wVector or scalar weight.
DESCRIPTION
Returns the linear interpolation of aand bbased on weight w.
aand bare either both scalars or both vectors of the same length. The weight wmay be a scalar or a vector
of the same length as aand b.wcan be anyvalue (so is not restricted to be between zero and one); if whas
values outside the [0,1] range, it actually extrapolates.
lerp returns awhen wis zero and returns bwhen wis one.
REFERENCE IMPLEMENTATION
lerp for float3 vectors for aand band a float wcould be implemented likethis:
perl v5.10.0 Cg Toolkit 3.0 776
LERP(Cg) Cg Standard Library LERP(Cg)
float3 lerp(float3 a, float3 b, float w)
{
return a + w*(b−a);
}
PROFILE SUPPORT
lerp is supported in all profiles.
SEE ALSO
saturate, smoothstep, step
perl v5.10.0 Cg Toolkit 3.0 777
LIT(Cg) Cg Standard Library LIT(Cg)
NAME lit −computes lighting coefficients for ambient, diffuse, and specular lighting contributions
SYNOPSIS
float4 lit(float NdotL, float NdotH, float m);
half4 lit(half NdotL, half NdotH, half m);
fixed4 lit(fixed NdotL, fixed NdotH, fixed m);
PARAMETERS
NdotL The dot product of a normalized surface normal and a normalized light vector.
NdotH The dot product of a normalized surface normal and a normalized half-angle vector (for Blinn-
style specular) where the half-angle vector is the sum of the normalized viewvector and
normalized light vector.Alternatively,the dot product of a normlized light vector and a
normalized viewvector reflected by a normalized surface normal could be used (for Phong-style
specular).
mAspecular exponent, typically described as a measure of shininess. The larger the exponent, the
shinier the specular highlight, the smaller the exponent, the duller the specular highlight.
DESCRIPTION
The lit function is a helper function useful to compute lighting coefficients for ambient, diffuse, and
specular lighting contributions. The function efficiently maps to a native instruction for most GPUs.
lit returns a 4−component vector arranged as follows:
xThe ambient coefficient that is always 1.0.
yThe diffuse coefficient that is zero if NdotL is less than zero, and NdotL otherwise.
zThe specular coefficient that is zero if either NdotL or NdotH are less than zero, and otherwise
NdotH raised to the power m.
wAlways 1.0.
REFERENCE IMPLEMENTATION
lit accepting <float> parameters could be implemented this way:
float4 lit(float NdotL, float NdotH, float m)
{
float specular = (NdotL > 0) ? pow(max(0.0, NdotH), m);
return float4(1.0, max(0.0, NdotL), specular, 1.0);
}
PROFILE SUPPORT
lit is supported in all profiles.
SEE ALSO
dot, max, normalize, pow
perl v5.10.0 Cg Toolkit 3.0 778
LOG(Cg) Cg Standard Library LOG(Cg)
NAME log −returns the natural logarithm of scalars and vectors
SYNOPSIS
float log(float a);
float1 log(float1 a);
float2 log(float2 a);
float3 log(float3 a);
float4 log(float4 a);
half log(half a);
half1 log(half1 a);
half2 log(half2 a);
half3 log(half3 a);
half4 log(half4 a);
fixed log(fixed a);
fixed1 log(fixed1 a);
fixed2 log(fixed2 a);
fixed3 log(fixed3 a);
fixed4 log(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the natural logarithm.
DESCRIPTION
Returns the natural logarithm a.
Forvectors, the returned vector contains the natural logarithm of each element of the input vector.
REFERENCE IMPLEMENTATION
float3 log(float3 a)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = log(a[i]); // this is the ANSI C standard library log()
}
return rv;
}
log is typically implemented with a native base−2 logarithm instruction.
PROFILE SUPPORT
log is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp, log10, log2, pow
perl v5.10.0 Cg Toolkit 3.0 779
LOG10(Cg) Cg Standard Library LOG10(Cg)
NAME log10 −returns the base−10 logarithm of scalars and vectors
SYNOPSIS
float log10(float a);
float1 log10(float1 a);
float2 log10(float2 a);
float3 log10(float3 a);
float4 log10(float4 a);
half log10(half a);
half1 log10(half1 a);
half2 log10(half2 a);
half3 log10(half3 a);
half4 log10(half4 a);
fixed log10(fixed a);
fixed1 log10(fixed1 a);
fixed2 log10(fixed2 a);
fixed3 log10(fixed3 a);
fixed4 log10(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the base−10 logarithm.
DESCRIPTION
Returns the base−10 logarithm a.
Forvectors, the returned vector contains the base−10 logarithm of each element of the input vector.
REFERENCE IMPLEMENTATION
float3 log10(float3 a)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = log10(a[i]); // this is the ANSI C standard library log10()
}
return rv;
}
log10 is typically implemented with a native base−10 logarithm instruction.
PROFILE SUPPORT
log10 is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp, log, log2, pow
perl v5.10.0 Cg Toolkit 3.0 780
LOG2(Cg) Cg Standard Library LOG2(Cg)
NAME log2 −returns the base−2 logarithm of scalars and vectors
SYNOPSIS
float log2(float a);
float1 log2(float1 a);
float2 log2(float2 a);
float3 log2(float3 a);
float4 log2(float4 a);
half log2(half a);
half1 log2(half1 a);
half2 log2(half2 a);
half3 log2(half3 a);
half4 log2(half4 a);
fixed log2(fixed a);
fixed1 log2(fixed1 a);
fixed2 log2(fixed2 a);
fixed3 log2(fixed3 a);
fixed4 log2(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the base−2 logarithm.
DESCRIPTION
Returns the base−2 logarithm a.
Forvectors, the returned vector contains the base−2 logarithm of each element of the input vector.
REFERENCE IMPLEMENTATION
float3 log2(float3 a)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
rv[i] = log2(a[i]); // this is the ANSI C standard library log2()
}
return rv;
}
log2 is typically implemented with a native base−2 logarithm instruction.
PROFILE SUPPORT
log2 is fully supported in all profiles unless otherwise specified.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp, log, log10, pow
perl v5.10.0 Cg Toolkit 3.0 781
MAX(Cg) Cg Standard Library MAX(Cg)
NAME max −returns the maximum of twoscalars or each respective component of twovectors
SYNOPSIS
float max(float a, float b);
float1 max(float1 a, float1 b);
float2 max(float2 a, float2 b);
float3 max(float3 a, float3 b);
float4 max(float4 a, float4 b);
half max(half a, half b);
half1 max(half1 a, half1 b);
half2 max(half2 a, half2 b);
half3 max(half3 a, half3 b);
half4 max(half4 a, half4 b);
fixed max(fixed a, fixed b);
fixed1 max(fixed1 a, fixed1 b);
fixed2 max(fixed2 a, fixed2 b);
fixed3 max(fixed3 a, fixed3 b);
fixed4 max(fixed4 a, fixed4 b);
PARAMETERS
aScalar or vector.
bScalar or vector.
DESCRIPTION
Returns the maximum of twosame-typed scalars aand bor the respective components of twosame-typed
vectors aand b.The result is a three-component vector.
REFERENCE IMPLEMENTATION
max for float3 vectors could be implemented this way:
float3 max(float3 a, float3 b)
{
return float3(a.x > b.x ? a.x : b.x,
a.y > b.y ? a.y : b.y,
a.z > b.z ? a.z : b.z);
}
PROFILE SUPPORT
max is supported in all profiles. max is implemented as a compiler built-in.
Support in the fp20 is limited.
SEE ALSO
clamp, min
perl v5.10.0 Cg Toolkit 3.0 782
MIN(Cg) Cg Standard Library MIN(Cg)
NAME min −returns the minimum of twoscalars or each respective component of twovectors
SYNOPSIS
float min(float a, float b);
float1 min(float1 a, float1 b);
float2 min(float2 a, float2 b);
float3 min(float3 a, float3 b);
float4 min(float4 a, float4 b);
half min(half a, half b);
half1 min(half1 a, half1 b);
half2 min(half2 a, half2 b);
half3 min(half3 a, half3 b);
half4 min(half4 a, half4 b);
fixed min(fixed a, fixed b);
fixed1 min(fixed1 a, fixed1 b);
fixed2 min(fixed2 a, fixed2 b);
fixed3 min(fixed3 a, fixed3 b);
fixed4 min(fixed4 a, fixed4 b);
PARAMETERS
aScalar or vector.
bScalar or vector.
DESCRIPTION
Returns the minimum of twosame-typed scalars aand bor the respective components of twosame-typed
vectors aand b.The result is a three-component vector.
REFERENCE IMPLEMENTATION
min for float3 vectors could be implemented this way:
float3 min(float3 a, float3 b)
{
return float3(a.x < b.x ? a.x : b.x,
a.y < b.y ? a.y : b.y,
a.z < b.z ? a.z : b.z);
}
PROFILE SUPPORT
min is supported in all profiles. min is implemented as a compiler built-in.
Support in the fp20 is limited.
SEE ALSO
clamp, max
perl v5.10.0 Cg Toolkit 3.0 783
MODF(Cg) Cg Standard Library MODF(Cg)
NAME modf −decompose a float into integer and fractional parts
SYNOPSIS
float modf(float x, out float i);
float1 modf(float1 x, out float1 i);
float2 modf(float2 x, out float2 i);
float3 modf(float3 x, out float3 i);
float4 modf(float4 x, out float4 i);
half modf(half x, out half i);
half1 modf(half1 x, out half1 i);
half2 modf(half2 x, out half2 i);
half3 modf(half3 x, out half3 i);
half4 modf(half4 x, out half4 i);
fixed modf(fixed x, out fixed i);
fixed1 modf(fixed1 x, out fixed1 i);
fixed2 modf(fixed2 x, out fixed2 i);
fixed3 modf(fixed3 x, out fixed3 i);
fixed4 modf(fixed4 x, out fixed4 i);
PARAMETERS
xVector or scalar.
iVector or scalar for integer part of x.
DESCRIPTION
modf returns the integer and fractional parts of x.
REFERENCE IMPLEMENTATION
PROFILE SUPPORT
modf is supported in all profiles except fp20.
SEE ALSO
fmod, round
perl v5.10.0 Cg Toolkit 3.0 784
MUL(Cg) Cg Standard Library MUL(Cg)
NAME mul −multiply a matrix by a column vector,row vector by a matrix, or matrix by a matrix
SYNOPSIS
float4 mul(float4x4 M, float4 v);
float4 mul(float4x3 M, float3 v);
float4 mul(float4x2 M, float2 v);
float4 mul(float4x1 M, float1 v);
float3 mul(float3x4 M, float4 v);
float3 mul(float3x3 M, float3 v);
float3 mul(float3x2 M, float2 v);
float3 mul(float3x1 M, float1 v);
float2 mul(float2x4 M, float4 v);
float2 mul(float2x3 M, float3 v);
float2 mul(float2x2 M, float2 v);
float2 mul(float2x1 M, float1 v);
float1 mul(float1x4 M, float4 v);
float1 mul(float1x3 M, float3 v);
float1 mul(float1x2 M, float2 v);
float1 mul(float1x1 M, float1 v);
float4 mul(float4 v, float4x4 M);
float4 mul(float3 v, float3x4 M);
float4 mul(float2 v, float2x4 M);
float4 mul(float1 v, float1x4 M);
float3 mul(float4 v, float4x3 M);
float3 mul(float3 v, float3x3 M);
float3 mul(float2 v, float2x3 M);
float3 mul(float1 v, float1x3 M);
float2 mul(float4 v, float4x2 M);
float2 mul(float3 v, float3x2 M);
float2 mul(float2 v, float2x2 M);
float2 mul(float1 v, float1x2 M);
float1 mul(float4 v, float4x1 M);
float1 mul(float3 v, float3x1 M);
float1 mul(float2 v, float2x1 M);
float1 mul(float1 v, float1x1 M);
half4 mul(half4x4 M, half4 v);
half4 mul(half4x3 M, half3 v);
half4 mul(half4x2 M, half2 v);
half4 mul(half4x1 M, half1 v);
half3 mul(half3x4 M, half4 v);
half3 mul(half3x3 M, half3 v);
half3 mul(half3x2 M, half2 v);
half3 mul(half3x1 M, half1 v);
half2 mul(half2x4 M, half4 v);
half2 mul(half2x3 M, half3 v);
half2 mul(half2x2 M, half2 v);
half2 mul(half2x1 M, half1 v);
half1 mul(half1x4 M, half4 v);
half1 mul(half1x3 M, half3 v);
half1 mul(half1x2 M, half2 v);
half1 mul(half1x1 M, half1 v);
perl v5.10.0 Cg Toolkit 3.0 785
MUL(Cg) Cg Standard Library MUL(Cg)
half4 mul(half4 v, half4x4 M);
half4 mul(half3 v, half3x4 M);
half4 mul(half2 v, half2x4 M);
half4 mul(half1 v, half1x4 M);
half3 mul(half4 v, half4x3 M);
half3 mul(half3 v, half3x3 M);
half3 mul(half2 v, half2x3 M);
half3 mul(half1 v, half1x3 M);
half2 mul(half4 v, half4x2 M);
half2 mul(half3 v, half3x2 M);
half2 mul(half2 v, half2x2 M);
half2 mul(half1 v, half1x2 M);
half1 mul(half4 v, half4x1 M);
half1 mul(half3 v, half3x1 M);
half1 mul(half2 v, half2x1 M);
half1 mul(half1 v, half1x1 M);
fixed4 mul(fixed4x4 M, fixed4 v);
fixed4 mul(fixed4x3 M, fixed3 v);
fixed4 mul(fixed4x2 M, fixed2 v);
fixed4 mul(fixed4x1 M, fixed1 v);
fixed3 mul(fixed3x4 M, fixed4 v);
fixed3 mul(fixed3x3 M, fixed3 v);
fixed3 mul(fixed3x2 M, fixed2 v);
fixed3 mul(fixed3x1 M, fixed1 v);
fixed2 mul(fixed2x4 M, fixed4 v);
fixed2 mul(fixed2x3 M, fixed3 v);
fixed2 mul(fixed2x2 M, fixed2 v);
fixed2 mul(fixed2x1 M, fixed1 v);
fixed1 mul(fixed1x4 M, fixed4 v);
fixed1 mul(fixed1x3 M, fixed3 v);
fixed1 mul(fixed1x2 M, fixed2 v);
fixed1 mul(fixed1x1 M, fixed1 v);
fixed4 mul(fixed4 v, fixed4x4 M);
fixed4 mul(fixed3 v, fixed3x4 M);
fixed4 mul(fixed2 v, fixed2x4 M);
fixed4 mul(fixed1 v, fixed1x4 M);
fixed3 mul(fixed4 v, fixed4x3 M);
fixed3 mul(fixed3 v, fixed3x3 M);
fixed3 mul(fixed2 v, fixed2x3 M);
fixed3 mul(fixed1 v, fixed1x3 M);
fixed2 mul(fixed4 v, fixed4x2 M);
fixed2 mul(fixed3 v, fixed3x2 M);
fixed2 mul(fixed2 v, fixed2x2 M);
fixed2 mul(fixed1 v, fixed1x2 M);
fixed1 mul(fixed4 v, fixed4x1 M);
fixed1 mul(fixed3 v, fixed3x1 M);
fixed1 mul(fixed2 v, fixed2x1 M);
fixed1 mul(fixed1 v, fixed1x1 M);
float1x1 mul(float1x1 A, float1x1 B);
float1x2 mul(float1x1 A, float1x2 B);
float1x3 mul(float1x1 A, float1x3 B);
perl v5.10.0 Cg Toolkit 3.0 786
MUL(Cg) Cg Standard Library MUL(Cg)
float1x4 mul(float1x1 A, float1x4 B);
float1x1 mul(float1x2 A, float2x1 B);
float1x2 mul(float1x2 A, float2x2 B);
float1x3 mul(float1x2 A, float2x3 B);
float1x4 mul(float1x2 A, float2x4 B);
float1x1 mul(float1x3 A, float3x1 B);
float1x2 mul(float1x3 A, float3x2 B);
float1x3 mul(float1x3 A, float3x3 B);
float1x4 mul(float1x3 A, float3x4 B);
float1x1 mul(float1x4 A, float4x1 B);
float1x2 mul(float1x4 A, float4x2 B);
float1x3 mul(float1x4 A, float4x3 B);
float1x4 mul(float1x4 A, float4x4 B);
float2x1 mul(float2x1 A, float1x1 B);
float2x2 mul(float2x1 A, float1x2 B);
float2x3 mul(float2x1 A, float1x3 B);
float2x4 mul(float2x1 A, float1x4 B);
float2x1 mul(float2x2 A, float2x1 B);
float2x2 mul(float2x2 A, float2x2 B);
float2x3 mul(float2x2 A, float2x3 B);
float2x4 mul(float2x2 A, float2x4 B);
float2x1 mul(float2x3 A, float3x1 B);
float2x2 mul(float2x3 A, float3x2 B);
float2x3 mul(float2x3 A, float3x3 B);
float2x4 mul(float2x3 A, float3x4 B);
float2x1 mul(float2x4 A, float4x1 B);
float2x2 mul(float2x4 A, float4x2 B);
float2x3 mul(float2x4 A, float4x3 B);
float2x4 mul(float2x4 A, float4x4 B);
float3x1 mul(float3x1 A, float1x1 B);
float3x2 mul(float3x1 A, float1x2 B);
float3x3 mul(float3x1 A, float1x3 B);
float3x4 mul(float3x1 A, float1x4 B);
float3x1 mul(float3x2 A, float2x1 B);
float3x2 mul(float3x2 A, float2x2 B);
float3x3 mul(float3x2 A, float2x3 B);
float3x4 mul(float3x2 A, float2x4 B);
float3x1 mul(float3x3 A, float3x1 B);
float3x2 mul(float3x3 A, float3x2 B);
float3x3 mul(float3x3 A, float3x3 B);
float3x4 mul(float3x3 A, float3x4 B);
float3x1 mul(float3x4 A, float4x1 B);
float3x2 mul(float3x4 A, float4x2 B);
perl v5.10.0 Cg Toolkit 3.0 787
MUL(Cg) Cg Standard Library MUL(Cg)
float3x3 mul(float3x4 A, float4x3 B);
float3x4 mul(float3x4 A, float4x4 B);
float4x1 mul(float4x1 A, float1x1 B);
float4x2 mul(float4x1 A, float1x2 B);
float4x3 mul(float4x1 A, float1x3 B);
float4x4 mul(float4x1 A, float1x4 B);
float4x1 mul(float4x2 A, float2x1 B);
float4x2 mul(float4x2 A, float2x2 B);
float4x3 mul(float4x2 A, float2x3 B);
float4x4 mul(float4x2 A, float2x4 B);
float4x1 mul(float4x3 A, float3x1 B);
float4x2 mul(float4x3 A, float3x2 B);
float4x3 mul(float4x3 A, float3x3 B);
float4x4 mul(float4x3 A, float3x4 B);
float4x1 mul(float4x4 A, float4x1 B);
float4x2 mul(float4x4 A, float4x2 B);
float4x3 mul(float4x4 A, float4x3 B);
float4x4 mul(float4x4 A, float4x4 B);
PARAMETERS
MMatrix
vVector
AMatrix
BMatrix
DESCRIPTION
Returns the vector result of multiplying a matrix Mby a column vector v;arow vector vby a matrix M;ora
matrix Aby a second matrix B.
The following are algebrically equal (if not necessarily numerically equal):
mul(M,v) == mul(v, tranpose(M))
mul(v,M) == mul(tranpose(M), v)
REFERENCE IMPLEMENTATION
mul for a float4x3 matrix by a float3 column vector could be implemented this way:
float4 mul(float4x3 M, float3 v)
{
float4 r;
r.x = dot( M._m00_m01_m02, v );
r.y = dot( M._m10_m11_m12, v );
r.z = dot( M._m20_m21_m22, v );
r.w = dot( M._m30_m31_m32, v );
return r;
}
PROFILE SUPPORT
mul is supported in all profiles except the fp20, ps_1_1, ps_1_2, and ps_1_3 fragment profiles.
The fixed3 matrix-by-vector and vector-by-matrix multiplies are very efficient in the fp30 profile.
perl v5.10.0 Cg Toolkit 3.0 788
MUL(Cg) Cg Standard Library MUL(Cg)
SEE ALSO
cross, dot, transpose
perl v5.10.0 Cg Toolkit 3.0 789
NORMALIZE(Cg) Cg Standard Library NORMALIZE(Cg)
NAME normalize −normalizes a vector
SYNOPSIS
float normalize(float v);
float normalize(float1 v);
float normalize(float2 v);
float normalize(float3 v);
float normalize(float4 v);
half normalize(half v);
half normalize(half1 v);
half normalize(half2 v);
half normalize(half3 v);
half normalize(half4 v);
fixed normalize(fixed v);
fixed normalize(fixed1 v);
fixed normalize(fixed2 v);
fixed normalize(fixed3 v);
fixed normalize(fixed4 v);
PARAMETERS
vVector to normalize.
DESCRIPTION
Returns the normalized version of a vector,meaning a vector in the same direction as the original vector but
with a Euclidean length of one.
REFERENCE IMPLEMENTATION
normalize for a float3 vector could be implemented likethis.
float3 normalize(float3 v)
{
return rsqrt(dot(v,v))*v;
}
PROFILE SUPPORT
normalize is supported in all profiles except fp20.
SEE ALSO
distance, dot, length, rsqrt, sqrt
perl v5.10.0 Cg Toolkit 3.0 790
POW(Cg) Cg Standard Library POW(Cg)
NAME pow −returns x to the y−th power of scalars and vectors
SYNOPSIS
float pow(float x, float y);
float1 pow(float1 x, float1 y);
float2 pow(float2 x, float2 y);
float3 pow(float3 x, float3 y);
float4 pow(float4 x, float4 y);
half pow(half x, half y);
half1 pow(half1 x, half1 y);
half2 pow(half2 x, half2 y);
half3 pow(half3 x, half3 y);
half4 pow(half4 x, half4 y);
fixed pow(fixed x, fixed y);
fixed1 pow(fixed1 x, fixed1 y);
fixed2 pow(fixed2 x, fixed2 y);
fixed3 pow(fixed3 x, fixed3 y);
fixed4 pow(fixed4 x, fixed4 y);
PARAMETERS
xAbase value.
yThe power to raise the base.
DESCRIPTION
Returns xto the power y.
Forvectors, the returned vector contains the power of each element of the base vector raised to the
respective element of the exponent vector.
REFERENCE IMPLEMENTATION
pow for float3 vectors could be implemented this way:
float3 pow(float3 x, float3 y)
{
float3 rv;
for (int i=0; i<3; i++) {
rv[i] = exp(x[i] * log(y[i]));
}
return rv;
}
PROFILE SUPPORT
exp is supported in all profiles.
Support in the fp20 is limited to constant compile-time evaluation.
SEE ALSO
exp, lit, log, rsqrt, sqrt
perl v5.10.0 Cg Toolkit 3.0 791
RADIANS(Cg) Cg Standard Library RADIANS(Cg)
NAME radians −converts values of scalars and vectors from degrees to radians
SYNOPSIS
float radians(float a);
float1 radians(float1 a);
float2 radians(float2 a);
float3 radians(float3 a);
float4 radians(float4 a);
half radians(half a);
half1 radians(half1 a);
half2 radians(half2 a);
half3 radians(half3 a);
half4 radians(half4 a);
fixed radians(fixed a);
fixed1 radians(fixed1 a);
fixed2 radians(fixed2 a);
fixed3 radians(fixed3 a);
fixed4 radians(fixed4 a);
PARAMETERS
aVector or scalar of which to convert from degrees to radians.
DESCRIPTION
Returns the scalar or vector converted from degrees to radians.
Forvectors, the returned vector contains each element of the input vector converted from degrees to
radians.
REFERENCE IMPLEMENTATION
radians for a float scalar could be implemented likethis.
float radians(float a)
{
return 0.017453292 * a;
}
PROFILE SUPPORT
radians is supported in all profiles except fp20.
SEE ALSO
cos, degrees, sin, tan
perl v5.10.0 Cg Toolkit 3.0 792
REFLECT(Cg) Cg Standard Library REFLECT(Cg)
NAME reflect −returns the reflectiton vector givenanincidence vector and a normal vector.
SYNOPSIS
float reflect(float i, float n);
float2 reflect(float2 i, float2 n);
float3 reflect(float3 i, float3 n);
float4 reflect(float4 i, float4 n);
PARAMETERS
iIncidence vector.
nNormal vector.
DESCRIPTION
Returns the reflectiton vector givenanincidence vector iand a normal vector n.The resulting vector is the
identical number of components as the twoinput vectors.
The normal vector nshould be normalized. If nis normalized, the output vector will have the same length
as the input incidence vector i.
REFERENCE IMPLEMENTATION
reflect for float3 vectors could be implemented this way:
float3 reflect( float3 i, float3 n )
{
return i − 2.0 * n * dot(n,i);
}
PROFILE SUPPORT
reflect is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
dot, length, refract
perl v5.10.0 Cg Toolkit 3.0 793
REFRACT(Cg) Cg Standard Library REFRACT(Cg)
NAME refract −computes a refraction vector.
SYNOPSIS
fixed3 refract(fixed3 i, fixed3 n, fixed eta);
half3 refract(half3 i, half3 n, half eta);
float3 refract(float3 i, float3 n, float eta);
PARAMETERS
iIncidence vector.
nNormal vector.
eta Ratio of indices of refraction at the surface interface.
DESCRIPTION
Returns a refraction vector givenanincidence vector,anormal vector for a surface, and a ratio of indices of
refraction at the surface’sinterface.
The incidence vector iand normal vector nshould be normalized.
REFERENCE IMPLEMENTATION
reflect for float3 vectors could be implemented this way:
float3 refract( float3 i, float3 n, float eta )
{
float cosi = dot(−i, n);
float cost2 = 1.0f − eta * eta * (1.0f − cosi*cosi);
float3 t = eta*i + ((eta*cosi − sqrt(abs(cost2))) * n);
return t * (float3)(cost2 > 0);
}
PROFILE SUPPORT
refract is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
abs, cos, dot, reflect, sqrt
perl v5.10.0 Cg Toolkit 3.0 794
ROUND(Cg) Cg Standard Library ROUND(Cg)
NAME round −returns the rounded value of scalars or vectors
SYNOPSIS
float round(float a);
float1 round(float1 a);
float2 round(float2 a);
float3 round(float3 a);
float4 round(float4 a);
half round(half a);
half1 round(half1 a);
half2 round(half2 a);
half3 round(half3 a);
half4 round(half4 a);
fixed round(fixed a);
fixed1 round(fixed1 a);
fixed2 round(fixed2 a);
fixed3 round(fixed3 a);
fixed4 round(fixed4 a);
PARAMETERS
aScalar or vector.
DESCRIPTION
Returns the rounded value of a scalar or vector.
Forvectors, the returned vector contains the rounded value of each element of the input vector.
The round operation returns the nearest integer to the operand. The value returned by round() if the
fractional portion of the operand is 0.5 is profile dependent. On older profiles without built-in round()
support, round-to-nearest up rounding is used. On profiles newer than fp40/vp40, round-to-nearest evenis
used.
REFERENCE IMPLEMENTATION
round for float could be implemented this way:
// round−to−nearest even profiles
float round(float a)
{
float x = a + 0.5;
float f = floor(x);
float r;
if (x == f) {
if (a > 0)
r=f−fmod(f, 2);
else
r=f+fmod(f, 2);
}else
r=f;
return r;
}
// round−to−nearest up profiles
float round(float a)
{
return floor(x + 0.5);
}
perl v5.10.0 Cg Toolkit 3.0 795
ROUND(Cg) Cg Standard Library ROUND(Cg)
PROFILE SUPPORT
round is supported in all profiles except fp20.
SEE ALSO
ceil, floor,fmod, trunc
perl v5.10.0 Cg Toolkit 3.0 796
RSQRT(Cg) Cg Standard Library RSQRT(Cg)
NAME rsqrt −returns reciprocal square root of scalars and vectors.
SYNOPSIS
float rsqrt(float a);
float1 rsqrt(float1 a);
float2 rsqrt(float2 a);
float3 rsqrt(float3 a);
float4 rsqrt(float4 a);
half rsqrt(half a);
half1 rsqrt(half1 a);
half2 rsqrt(half2 a);
half3 rsqrt(half3 a);
half4 rsqrt(half4 a);
fixed rsqrt(fixed a);
fixed1 rsqrt(fixed1 a);
fixed2 rsqrt(fixed2 a);
fixed3 rsqrt(fixed3 a);
fixed4 rsqrt(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the reciprocal square root.
DESCRIPTION
Returns an approximation to the reciprocal square root of a.
Forvectors, the returned vector contains the reciprocal square root of each element of the input vector.
The reciprocal square root of zero is ideally infinity.The square root of negative values ideally returns NaN
(Not a Number).
REFERENCE IMPLEMENTATION
rsqrt is best implemented as a native reciprocal square root instruction, howeverrsqrt may be
implemented via a pow function:
float3 rsqrt(float3 a)
{
return pow(a, −0.5);
}
PROFILE SUPPORT
rsqrt is supported in all profiles unless otherwise specified. rsqrt is unsupported in the fp20 profile.
In certain profiles such as vp20, rsqrt computes the absolute value of aso negative values of awill not
return NaN.
SEE ALSO
normalize, pow, sqrt
perl v5.10.0 Cg Toolkit 3.0 797
SATURATE(Cg) Cg Standard Library SATURATE(Cg)
NAME saturate −returns smallest integer not less than a scalar or each vector component.
SYNOPSIS
float saturate(float x);
float1 saturate(float1 x);
float2 saturate(float2 x);
float3 saturate(float3 x);
float4 saturate(float4 x);
half saturate(half x);
half1 saturate(half1 x);
half2 saturate(half2 x);
half3 saturate(half3 x);
half4 saturate(half4 x);
fixed saturate(fixed x);
fixed1 saturate(fixed1 x);
fixed2 saturate(fixed2 x);
fixed3 saturate(fixed3 x);
fixed4 saturate(fixed4 x);
PARAMETERS
xVector or scalar to saturate.
DESCRIPTION
Returns xsaturated to the range [0,1] as follows:
•1)Returns 0 if xis less than 0; else
•2)Returns 1 if xis greater than 1; else
•3)Returns xotherwise.
Forvectors, the returned vector contains the saturated result of each element of the vector xsaturated to
[0,1].
REFERENCE IMPLEMENTATION
saturate for float scalars could be implemented likethis.
float saturate(float x)
{
return max(0, min(1, x));
}
PROFILE SUPPORT
saturate is supported in all profiles.
saturate is very efficient in the fp20, fp30, and fp40 profiles.
SEE ALSO
clamp, max, min
perl v5.10.0 Cg Toolkit 3.0 798
SIGN(Cg) Cg Standard Library SIGN(Cg)
NAME sign −returns sign of scalar or each vector component.
SYNOPSIS
float sign(float x);
float1 sign(float1 x);
float2 sign(float2 x);
float3 sign(float3 x);
float4 sign(float4 x);
half sign(half x);
half1 sign(half1 x);
half2 sign(half2 x);
half3 sign(half3 x);
half4 sign(half4 x);
fixed sign(fixed x);
fixed1 sign(fixed1 x);
fixed2 sign(fixed2 x);
fixed3 sign(fixed3 x);
fixed4 sign(fixed4 x);
PARAMETERS
xVector or scalar to determine its sign.
DESCRIPTION
Returns positive one, zero, or negative one for each of the components of xbased on the component’ssign.
•1)Returns −1 component if the respective component of xis negative.
•2)Returns 0 component if the respective component of xis zero.
•3)Returns 1 component if the respective component of xis positive.
•4)Ideally,NaN returns NaN.
REFERENCE IMPLEMENTATION
sign for float3 could be implemented likethis.
float3 sign(float x)
{
float3 val = a > 0;
return val − (a < 0);
}
PROFILE SUPPORT
sign is supported in all profiles except fp20.
sign is very efficient in the gp4vp, gp4gp, gp4fp, vp40, and vp30 profiles that support the native SSG
instruction.
SEE ALSO
max, min, saturate, step
perl v5.10.0 Cg Toolkit 3.0 799
SIN(Cg) Cg Standard Library SIN(Cg)
NAME sin −returns sine of scalars and vectors.
SYNOPSIS
float sin(float a);
float1 sin(float1 a);
float2 sin(float2 a);
float3 sin(float3 a);
float4 sin(float4 a);
half sin(half a);
half1 sin(half1 a);
half2 sin(half2 a);
half3 sin(half3 a);
half4 sin(half4 a);
fixed sin(fixed a);
fixed1 sin(fixed1 a);
fixed2 sin(fixed2 a);
fixed3 sin(fixed3 a);
fixed4 sin(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the sine.
DESCRIPTION
Returns the sine of ain radians. The return value is in the range [−1,+1].
Forvectors, the returned vector contains the sine of each element of the input vector.
REFERENCE IMPLEMENTATION
sin is best implemented as a native sine instruction, howeversin for a float scalar could be implemented by
an approximation likethis.
float sin(float a)
{
/* C simulation gives a max absolute error of less than 1.8e−7 */
float4 c0 = float4( 0.0, 0.5,
1.0, 0.0 );
float4 c1 = float4( 0.25, −9.0,
0.75, 0.159154943091 );
float4 c2 = float4( 24.9808039603, −24.9808039603,
−60.1458091736, 60.1458091736 );
float4 c3 = float4( 85.4537887573, −85.4537887573,
−64.9393539429, 64.9393539429 );
float4 c4 = float4( 19.7392082214, −19.7392082214,
−1.0, 1.0 );
/* r0.x = sin(a) */
float3 r0, r1, r2;
r1.x = c1.w * a − c1.x; // only difference from cos!
r1.y = frac( r1.x ); // and extract fraction
r2.x = (float) ( r1.y < c1.x ); // range check: 0.0 to 0.25
r2.yz = (float2) ( r1.yy >= c1.yz ); // range check: 0.75 to 1.0
r2.y = dot( r2, c4.zwz ); // range check: 0.25 to 0.75
r0 = c0.xyz − r1.yyy; // range centering
r0 = r0 * r0;
perl v5.10.0 Cg Toolkit 3.0 800
SIN(Cg) Cg Standard Library SIN(Cg)
r1 = c2.xyx * r0 + c2.zwz; // start power series
r1 = r1 * r0 + c3.xyx;
r1 = r1 * r0 + c3.zwz;
r1 = r1 * r0 + c4.xyx;
r1 = r1 * r0 + c4.zwz;
r0.x = dot( r1, −r2 ); // range extract
return r0.x;
}
PROFILE SUPPORT
sin is fully supported in all profiles unless otherwise specified.
sin is supported via an approximation (shown above)inthe vs_1_1, vp20, and arbvp1 profiles.
sin is unsupported in the fp20, ps_1_1, ps_1_2, and ps_1_3 profiles.
SEE ALSO
asin, cos, dot, frac, sincos, tan
perl v5.10.0 Cg Toolkit 3.0 801
SINCOS(Cg) Cg Standard Library SINCOS(Cg)
NAME sincos −returns sine of scalars and vectors.
SYNOPSIS
void sincos(float a, out float s, out float c);
void sincos(float1 a, out float1 s, out float1 c);
void sincos(float2 a, out float2 s, out float2 c);
void sincos(float3 a, out float3 s, out float3 c);
void sincos(float4 a, out float4 s, out float4 c);
void sincos(half a, out half s, out half c);
void sincos(half1 a, out half1 s, out half1 c);
void sincos(half2 a, out half2 s, out half2 c);
void sincos(half3 a, out half3 s, out half3 c);
void sincos(half4 a, out half4 s, out half4 c);
void sincos(fixed a, out fixed s, out fixed c);
void sincos(fixed1 a, out fixed1 s, out fixed1 c);
void sincos(fixed2 a, out fixed2 s, out fixed2 c);
void sincos(fixed3 a, out fixed3 s, out fixed3 c);
void sincos(fixed4 a, out fixed4 s, out fixed4 c);
PARAMETERS
aInput vector or scalar of which to determine the sine and cosine.
sOuput vector or scalar for sine results.
cOuput vector or scalar for cosine results.
DESCRIPTION
Outputs to sthe sine of ain radians, and outputs to cthe cosine of ain radians. The output values are in the
range [−1,+1].
Forvectors, the output vectors contains the sine or cosine respectively of each element of the input vector.
REFERENCE IMPLEMENTATION
sin is best implemented as a native sine instruction, howeversin for a float scalar could be implemented by
an approximation likethis.
void sincos(float3 a, out float3 s, float3 out c)
{
int i;
for (i=0; i<3; i++) {
s[i] = sin(a[i]);
c[i] = cos(a[i]);
}
}
PROFILE SUPPORT
sincos is fully supported in all profiles unless otherwise specified.
sincos is supported via an approximation (shown above)inthe vs_1_1, vp20, and arbvp1 profiles.
sincos is unsupported in the fp20, ps_1_1, ps_1_2, and ps_1_3 profiles.
SEE ALSO
cos, sin
perl v5.10.0 Cg Toolkit 3.0 802
SINH(Cg) Cg Standard Library SINH(Cg)
NAME sinh −returns hyperbolic sine of scalars and vectors.
SYNOPSIS
float sinh(float a);
float1 sinh(float1 a);
float2 sinh(float2 a);
float3 sinh(float3 a);
float4 sinh(float4 a);
half sinh(half a);
half1 sinh(half1 a);
half2 sinh(half2 a);
half3 sinh(half3 a);
half4 sinh(half4 a);
fixed sinh(fixed a);
fixed1 sinh(fixed1 a);
fixed2 sinh(fixed2 a);
fixed3 sinh(fixed3 a);
fixed4 sinh(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the hyperbolic sine.
DESCRIPTION
Returns the hyperbolic sine of a.
Forvectors, the returned vector contains the hyperbolic sine of each element of the input vector.
REFERENCE IMPLEMENTATION
sinh for a scalar float could be implemented likethis.
float sinh(float x)
{
return 0.5 * (exp(x)−exp(−x));
}
PROFILE SUPPORT
sinh is supported in all profiles except fp20.
SEE ALSO
acos, cos, cosh, exp, tanh
perl v5.10.0 Cg Toolkit 3.0 803
SMOOTHSTEP(Cg) Cg Standard Library SMOOTHSTEP(Cg)
NAME smoothstep −interpolate smoothly between twoinput values based on a third
SYNOPSIS
float smoothstep(float a, float b, float x);
float1 smoothstep(float1 a, float1 b, float1 x);
float2 smoothstep(float2 a, float2 b, float2 x);
float3 smoothstep(float3 a, float3 b, float3 x);
float4 smoothstep(float4 a, float4 b, float4 x);
half smoothstep(half a, half b, half x);
half1 smoothstep(half1 a, half1 b, half1 x);
half2 smoothstep(half2 a, half2 b, half2 x);
half3 smoothstep(half3 a, half3 b, half3 x);
half4 smoothstep(half4 a, half4 b, half4 x);
fixed smoothstep(fixed a, fixed b, fixed x);
fixed1 smoothstep(fixed1 a, fixed1 b, fixed1 x);
fixed2 smoothstep(fixed2 a, fixed2 b, fixed2 x);
fixed3 smoothstep(fixed3 a, fixed3 b, fixed3 x);
fixed4 smoothstep(fixed4 a, fixed4 b, fixed4 x);
PARAMETERS
aScalar or vector minimum reference value(s).
bScalar or vector minimum reference value(s).
xScalar or vector.
DESCRIPTION
Interpolates smoothly from 0to 1based on xcompared to aand b.
•1)Returns 0if <x < a < b>or<x a>b>>
•1)Returns 1if <x < b < a>or<x b>a>>
•3)Returns a value in the range [0,1] for the domain [a,b].
The slope of smoothstep(a,b,a) and smoothstep(a,b,b) is zero.
Forvectors, the returned vector contains the smooth interpolation of each element of the vector x.
REFERENCE IMPLEMENTATION
smoothstep for float scalars could be implemented this way:
float smoothstep(float a, float b, float x)
{
float t = saturate((x − a)/(b − a));
return t*t*(3.0 − (2.0*t));
}
PROFILE SUPPORT
smoothstep is supported in all profiles except fp20.
SEE ALSO
clamp, saturate, step
perl v5.10.0 Cg Toolkit 3.0 804
SQRT(Cg) Cg Standard Library SQRT(Cg)
NAME sqrt −returns square root of scalars and vectors.
SYNOPSIS
float sqrt(float a);
float1 sqrt(float1 a);
float2 sqrt(float2 a);
float3 sqrt(float3 a);
float4 sqrt(float4 a);
half sqrt(half a);
half1 sqrt(half1 a);
half2 sqrt(half2 a);
half3 sqrt(half3 a);
half4 sqrt(half4 a);
fixed sqrt(fixed a);
fixed1 sqrt(fixed1 a);
fixed2 sqrt(fixed2 a);
fixed3 sqrt(fixed3 a);
fixed4 sqrt(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the square root.
DESCRIPTION
Returns the square root of a.
Forvectors, the returned vector contains the square root of each element of the input vector.
The square root of zero is zero.
Ideally,the square root of negative values returns NaN (Not a Number).
sqrt often implemented as the reciprocal of a reciporcal squrare root approximation in older profiles.
REFERENCE IMPLEMENTATION
sqrt is best implemented as a native square root instruction, howeversqrt may be implemented via a rsqrt
function:
float3 sqrt(float3 a)
{
return 1.0 / rsqrt(a);
}
PROFILE SUPPORT
sqrt is fully supported in all profiles unless otherwise specified. sqrt is unsupported in the fp20 profile.
SEE ALSO
normalize, pow, rsqrt
perl v5.10.0 Cg Toolkit 3.0 805
STEP(Cg) Cg Standard Library STEP(Cg)
NAME step −implement a step function returning either zero or one
SYNOPSIS
float step(float a, float x);
float1 step(float1 a, float1 x);
float2 step(float2 a, float2 x);
float3 step(float3 a, float3 x);
float4 step(float4 a, float4 x);
half step(half a, half x);
half1 step(half1 a, half1 x);
half2 step(half2 a, half2 x);
half3 step(half3 a, half3 x);
half4 step(half4 a, half4 x);
fixed step(fixed a, fixed x);
fixed1 step(fixed1 a, fixed1 x);
fixed2 step(fixed2 a, fixed2 x);
fixed3 step(fixed3 a, fixed3 x);
fixed4 step(fixed4 a, fixed4 x);
PARAMETERS
aScalar or vector reference value.
xScalar or vector.
DESCRIPTION
Implements a step function returning one for each component of xthat is greater than or equal to the
corresponding component in the reference vector a,and zero otherwise.
REFERENCE IMPLEMENTATION
step for float3 vectors could be implemented this way:
float3 step(float3 a, float3 x)
{
return x >= a;
}
PROFILE SUPPORT
step is supported in all profiles.
Support in the fp20 is limited.
SEE ALSO
max, min, saturate, smoothstep
perl v5.10.0 Cg Toolkit 3.0 806
TAN(Cg) Cg Standard Library TAN(Cg)
NAME tan −returns tangent of scalars and vectors.
SYNOPSIS
float tan(float a);
float1 tan(float1 a);
float2 tan(float2 a);
float3 tan(float3 a);
float4 tan(float4 a);
half tan(half a);
half1 tan(half1 a);
half2 tan(half2 a);
half3 tan(half3 a);
half4 tan(half4 a);
fixed tan(fixed a);
fixed1 tan(fixed1 a);
fixed2 tan(fixed2 a);
fixed3 tan(fixed3 a);
fixed4 tan(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the tangent.
DESCRIPTION
Returns the tangent of ain radians.
Forvectors, the returned vector contains the tangent of each element of the input vector.
REFERENCE IMPLEMENTATION
tan can be implemented in terms of the sin and cos functions likethis:
float tan(float a) {
float s, c;
sincos(a, s, c);
return s / c;
}
PROFILE SUPPORT
tan is fully supported in all profiles unless otherwise specified.
tan is supported via approximations of sin and cos functions (see the respective sin and cos manual pages
for details) in the vs_1_1, vp20, and arbvp1 profiles.
tan is unsupported in the fp20, ps_1_1, ps_1_2, and ps_1_3 profiles.
SEE ALSO
atan, atan2, cos, dot, frac, sin, sincos
perl v5.10.0 Cg Toolkit 3.0 807
TANH(Cg) Cg Standard Library TANH(Cg)
NAME tanh −returns hyperbolic tangent of scalars and vectors.
SYNOPSIS
float tanh(float a);
float1 tanh(float1 a);
float2 tanh(float2 a);
float3 tanh(float3 a);
float4 tanh(float4 a);
half tanh(half a);
half1 tanh(half1 a);
half2 tanh(half2 a);
half3 tanh(half3 a);
half4 tanh(half4 a);
fixed tanh(fixed a);
fixed1 tanh(fixed1 a);
fixed2 tanh(fixed2 a);
fixed3 tanh(fixed3 a);
fixed4 tanh(fixed4 a);
PARAMETERS
aVector or scalar of which to determine the hyperbolic tangent.
DESCRIPTION
Returns the hyperbolic tangent of a.
Forvectors, the returned vector contains the hyperbolic tangent of each element of the input vector.
REFERENCE IMPLEMENTATION
tanh for a scalar float could be implemented likethis.
float tanh(float x)
{
float exp2x = exp(2*x);
return (exp2x − 1) / (exp2x + 1);
}
PROFILE SUPPORT
tanh is supported in all profiles except fp20.
SEE ALSO
atan, atan2, cosh, exp, sinh, tan
perl v5.10.0 Cg Toolkit 3.0 808
TEX1D(Cg) Cg Standard Library TEX1D(Cg)
NAME tex1D −performs a texture lookup in a given1Dsampler and, in some cases, a shadowcomparison. May
also use pre computed derivativesifthose are provided.
SYNOPSIS
float4 tex1D(sampler1D samp, float s)
float4 tex1D(sampler1D samp, float s, int texelOff)
float4 tex1D(sampler1D samp, float2 s)
float4 tex1D(sampler1D samp, float2 s, int texelOff)
float4 tex1D(sampler1D samp, float s, float dx, float dy)
float4 tex1D(sampler1D samp, float s, float dx, float dy, int texelOff)
float4 tex1D(sampler1D samp, float2 s, float dx, float dy)
float4 tex1D(sampler1D samp, float2 s, float dx, float dy, int texelOff)
int4 tex1D(isampler1D samp, float s);
int4 tex1D(isampler1D samp, float s, int texelOff);
int4 tex1D(isampler1D samp, float s, float dx, float dy)
int4 tex1D(isampler1D samp, float s, float dx, float dy, int texelOff)
unsigned int4 tex1D(usampler1D samp, float s);
unsigned int4 tex1D(usampler1D samp, float s, int texelOff);
unsigned int4 tex1D(usampler1D samp, float s, float dx, float dy)
unsigned int4 tex1D(usampler1D samp, float s, float dx, float dy,
int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. If an extra coordinate compared to the texture dimensionality
is present it is used to perform a shadowcomparison. The value used in the shadowcomparison is
always the last component of the coordinate vector.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,may use and derivativesdx and dy,also
may perform shadowcomparison and use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex1D is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with shadow
comparison are only supported in fp40 and newer profiles, variants with texeloffsets are only supported in
gp4 and newer profiles, variants with integer textures are also only supported in gp4 and newer profiles.
SEE ALSO
tex1Dbias, tex1Dlod, tex1Dproj
perl v5.10.0 Cg Toolkit 3.0 809
TEX1DARRAY(Cg) Cg Standard Library TEX1DARRAY(Cg)
NAME tex1DARRAY −performs a texture lookup in a givensampler array may use pre computed derivativesand,
in some cases, perform a shadowcomparison.
SYNOPSIS
float4 tex1DARRAY(sampler1DARRAY samp, float2 s)
float4 tex1DARRAY(sampler1DARRAY samp, float2 s, int texelOff)
float4 tex1DARRAY(sampler1DARRAY samp, float3 s)
float4 tex1DARRAY(sampler1DARRAY samp, float3 s, int texelOff)
float4 tex1DARRAY(sampler1DARRAY samp, float2 s, float dx, float dy)
float4 tex1DARRAY(sampler1DARRAY samp, float2 s, float dx, float dy,
int texelOff)
float4 tex1DARRAY(sampler1DARRAY samp, float3 s, float dx, float dy)
float4 tex1DARRAY(sampler1DARRAY samp, float3 s, float dx, float dy,
int texelOff)
int4 tex1DARRAY(isampler1DARRAY samp, float2 s)
int4 tex1DARRAY(isampler1DARRAY samp, float2 s, int texelOff)
int4 tex1DARRAY(isampler1DARRAY samp, float2 s, float dx, float dy)
int4 tex1DARRAY(isampler1DARRAY samp, float2 s, float dx, float dy,
int texelOff)
unsigned int4 tex1DARRAY(usampler1DARRAY samp, float2 s)
unsigned int4 tex1DARRAY(usampler1DARRAY samp, float2 s, int texelOff)
unsigned int4 tex1DARRAY(usampler1DARRAY samp, float2 s, float dx, float dy)
unsigned int4 tex1DARRAY(usampler1DARRAY samp, float2 s, float dx, float dy,
int texelOff)
PARAMETERS
samp Sampler array to look up.
sCoordinates to perform the lookup. The value used to select the layer is passed immediatelly after
the regular coordinates, if an extra coordinate is present it is used to perform a shadow
comparison.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the texture to be sampled is selected from
the layer specified in the coordinates. Also may use the derivativesdx and dy,the lookup may involvea
shadowcomparison and use texeloffset texelOff to compute the final texel.
PROFILE SUPPORT
tex1DARRAY is only supported in gp4 and newer profiles.
SEE ALSO
tex1DARRAYbias, tex1DARRAYlod
perl v5.10.0 Cg Toolkit 3.0 810
TEX1DARRAYBIAS(Cg) Cg Standard Library TEX1DARRAYBIAS(Cg)
NAME tex1DARRAYbias −performs a texture lookup with bias in a givensampler array.
SYNOPSIS
float4 tex1DARRAYbias(sampler1DARRAY samp, float4 s)
float4 tex1DARRAYbias(sampler1DARRAY samp, float4 s, int texelOff)
int4 tex1DARRAYbias(isampler1DARRAY samp, float4 s)
int4 tex1DARRAYbias(isampler1DARRAY samp, float4 s, int texelOff)
unsigned int4 tex1DARRAYbias(usampler1DARRAY samp, float4 s)
unsigned int4 tex1DARRAYbias(usampler1DARRAY samp, float4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup. The value used to select the layer should be passed in the
vector component right after the regular coordinates. The bias value should be passed as the last
component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s,the texture to be sampled is
selected from the layer specified in the coordinates.
PROFILE SUPPORT
tex1DARRAYbias is only supported in gp4 and newer profiles.
SEE ALSO
tex1DARRAY, tex1DARRAYlod
perl v5.10.0 Cg Toolkit 3.0 811
TEX1DARRAYCMPBIAS(Cg) Cg Standard Library TEX1DARRAYCMPBIAS(Cg)
NAME tex1DARRAYcmpbias −performs a texture lookup with shadowcompare and bias in a givensampler
array.
SYNOPSIS
float4 tex1DARRAYcmpbias(sampler1DARRAY samp, float4 s)
float4 tex1DARRAYcmpbias(sampler1DARRAY samp, float4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup. The value used to select the layer is the second coordinate,
the third is the value used in the shadowcomparison, the fourth corresponds to the bias value.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s,the texture to be sampled is
selected from the layer specified in the coordinates, the lookup involves a shadowcomparison and may use
texeloffset texelOff to compute the final texel.
PROFILE SUPPORT
tex1DARRAYcmpbias is only supported in gp4 and newer profiles.
SEE ALSO
tex1DARRAYbias, tex1DARRAYlod, tex1DARRAYcmplod
perl v5.10.0 Cg Toolkit 3.0 812
TEX1DARRAYCMPLOD(Cg) Cg Standard Library TEX1DARRAYCMPLOD(Cg)
NAME tex1DARRAYcmplod −performs a texture lookup with shadowcompare and a levelofdetail in a given
sampler array.
SYNOPSIS
float4 tex1DARRAYcmplod(sampler1DARRAY samp, float4 s)
float4 tex1DARRAYcmplod(sampler1DARRAY samp, float4 s, int texelOff)
samp Sampler array to look up.
sCoordinates to perform the lookup. The value used to select the layer is the second coordinate,
the third is the value used in the shadowcomparison, the fourth corresponds to the levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with levelofdetail in sampler samp using coordinates s,the texture to be
sampled is selected from the layer specified in the coordinates, the lookup involves a shadowcomparison
and may use texeloffset texelOff to compute the final texel.
PROFILE SUPPORT
tex1DARRAYcmplod is only supported in gp4 and newer profiles.
SEE ALSO
tex1DARRAYlod, tex1DARRAYbias, tex1DARRAYcmpbias
perl v5.10.0 Cg Toolkit 3.0 813
TEX1DARRAYFETCH(Cg) Cg Standard Library TEX1DARRAYFETCH(Cg)
NAME tex1DARRAYfetch −performs an unfiltered texture lookup in a givensampler array.
SYNOPSIS
float4 tex1DARRAYfetch(sampler1DARRAY samp, int4 s)
float4 tex1DARRAYfetch(sampler1DARRAY samp, int4 s, int texelOff)
int4 tex1DARRAYfetch(isampler1DARRAY samp, int4 s)
int4 tex1DARRAYfetch(isampler1DARRAY samp, int4 s, int texelOff)
unsigned int4 tex1DARRAYfetch(usampler1DARRAY samp, int4 s)
unsigned int4 tex1DARRAYfetch(usampler1DARRAY samp, int4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup, the layer is selected by the component right after the regular
coordinates, the levelofdetail is provided by the last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler array samp using coordinates s.The layer to be accessed is
selected by the component right after the regular coordinates, the levelofdetail is provided by the last
component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex1DARRAYfetch is only supported in gp4 and newer profiles.
SEE ALSO
tex1Dfetch
perl v5.10.0 Cg Toolkit 3.0 814
TEX1DARRAYLOD(Cg) Cg Standard Library TEX1DARRAYLOD(Cg)
NAME tex1DARRAYlod −1Dtexture array lookup with specified levelofdetail and optional texeloffset.
SYNOPSIS
float4 tex1DARRAYlod(sampler1DARRAY samp, float4 s)
float4 tex1DARRAYlod(sampler1DARRAY samp, float4 s, int texelOff)
int4 tex1DARRAYlod(isampler1DARRAY samp, float4 s)
int4 tex1DARRAYlod(isampler1DARRAY samp, float4 s, int texelOff)
unsigned int4 tex1DARRAYlod(usampler1DARRAY samp, float4 s)
unsigned int4 tex1DARRAYlod(usampler1DARRAY samp, float4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
s.x Coordinates to perform the lookup.
s.y Texture array layer.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s,the texture to
be sampled is selected from the layer specified in the coordinates.
PROFILE SUPPORT
tex1DARRAYlod is only supported in gp4 and newer profiles.
SEE ALSO
tex1DARRAY, tex1DARRAYbias
perl v5.10.0 Cg Toolkit 3.0 815
TEX1DARRAYPROJ(Cg) Cg Standard Library TEX1DARRAYPROJ(Cg)
NAME tex1DARRAYproj −performs a texture lookup with projection in a givensampler array.May perform a
shadowcomparison if argument for shadowcomparison is provided.
SYNOPSIS
float4 tex1DARRAYproj(sampler1DARRAY samp, float3 s)
float4 tex1DARRAYproj(sampler1DARRAY samp, float3 s, int texelOff)
float4 tex1DARRAYproj(sampler1DARRAY samp, float4 s)
float4 tex1DARRAYproj(sampler1DARRAY samp, float4 s, int texelOff)
int4 tex1DARRAYproj(isampler1DARRAY samp, float3 s)
int4 tex1DARRAYproj(isampler1DARRAY samp, float3 s, int texelOff)
unsigned int4 tex1DARRAYproj(usampler1DARRAY samp, float3 s)
unsgined int4 tex1DARRAYproj(usampler1DARRAY samp, float3 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup. The value used to select the layer should be passed as the
component right after the lookup coordinates. The value used in the projection should be passed
as the last component of the coordinate vector.The value used in the shadowcomparison, if
present, should be passed as the next-to-last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler array samp using coordinates s,the layer used in the lookup is first
selected using the coordinate component right after the regular coordinates. The coordinates used in the
lookup are then projected, that is, divided by the last component of the coordinate vector and them used in
the lookup. If an extra coordinate is present it is used to perform a shadowcomparison, the value used in
the shadowcomparison is always the next-to-last component in the coordinate vector.
PROFILE SUPPORT
tex1DARRAYproj is only supported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1Dproj
perl v5.10.0 Cg Toolkit 3.0 816
TEX1DARRAYSIZE(Cg) Cg Standard Library TEX1DARRAYSIZE(Cg)
NAME tex1DARRAYsize −returns the size of a giventexture array image for a givenlev elofdetail.
SYNOPSIS
int3 tex1DARRAYsize(sampler1DARRAY samp, int lod)
int3 tex1DARRAYsize(isampler1DARRAY samp, int lod)
int3 tex1DARRAYsize(usampler1DARRAY samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler array and a levelofdetail the size of one element of the corresponding texture array for a
givenlev elofdetail is returned as a result of the operation.
PROFILE SUPPORT
tex1DARRAYsize is only supported in gp4 and newer profiles.
SEE ALSO
tex1Dsize
perl v5.10.0 Cg Toolkit 3.0 817
TEX1DBIAS(Cg) Cg Standard Library TEX1DBIAS(Cg)
NAME tex1Dbias −1Dtexture lookup with bias and optional texeloffset.
SYNOPSIS
float4 tex1Dbias(sampler1D samp, float4 s)
float4 tex1Dbias(sampler1D samp, float4 s, int texelOff)
int4 tex1Dbias(isampler1D samp, float4 s)
int4 tex1Dbias(isampler1D samp, float4 s, int texelOff)
unsigned int4 tex1Dbias(usampler1D samp, float4 s)
unsigned int4 tex1Dbias(usampler1D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.x Coordinates to perform the lookup.
s.w Levelofdetail bias value.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s.Lev el-of-detail bias can be used
to artificially blur or sharpen the result of texture sampling.
PROFILE SUPPORT
tex1Dbias is supported in fragment profiles starting with fp30 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1Dlod, tex1Dcmpbias
perl v5.10.0 Cg Toolkit 3.0 818
TEX1DCMPBIAS(Cg) Cg Standard Library TEX1DCMPBIAS(Cg)
NAME tex1Dcmpbias −performs a texture lookup with bias and shadowcompare in a givensampler.
SYNOPSIS
float4 tex1Dcmpbias(sampler1D samp, float4 s)
float4 tex1Dcmpbias(sampler1D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the shadowcomparison should be passed
right after the normal coordinates. The bias value should be passed as the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with shadowcompare and bias in sampler samp using coordinates s.
PROFILE SUPPORT
tex1Dcmpbias is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles.
SEE ALSO
tex1Dcmplod, tex1Dbias
perl v5.10.0 Cg Toolkit 3.0 819
TEX1DCMPLOD(Cg) Cg Standard Library TEX1DCMPLOD(Cg)
NAME tex1Dcmplod −performs a texture lookup with a specified levelofdetail and a shadowcompare in a given
sampler.
SYNOPSIS
float4 tex1Dcmplod(sampler1D samp, float4 s)
float4 tex1Dcmplod(sampler1D samp, float4 s, int texelOff)
int4 tex1Dcmplod(isampler1D samp, float4 s)
int4 tex1Dcmplod(isampler1D samp, float4 s, int texelOff)
unsigned int4 tex1Dcmplod(usampler1D samp, float4 s)
unsigned int4 tex1Dcmplod(usampler1D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the shadowcomparison should be passed
right after the normal coordinates. The levelofdetail corresponds to the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with shadowcompare and a specified levelofdetail in sampler samp using
coordinates s.
PROFILE SUPPORT
tex1Dcmplod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex1Dlod, tex1Dcmpbias
perl v5.10.0 Cg Toolkit 3.0 820
TEX1DFETCH(Cg) Cg Standard Library TEX1DFETCH(Cg)
NAME tex1Dfetch −performs an unfiltered texture lookup in a givensampler.
SYNOPSIS
float4 tex1Dfetch(sampler1D samp, int4 s)
float4 tex1Dfetch(sampler1D samp, int4 s, int texelOff)
int4 tex1Dfetch(isampler1D samp, int4 s)
int4 tex1Dfetch(isampler1D samp, int4 s, int texelOff)
unsigned int4 tex1Dfetch(usampler1D samp, int4 s)
unsigned int4 tex1Dfetch(usampler1D samp, int4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The levelofdetail is stored in the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler samp using coordinates s.The levelofdetail is provided
by the last component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex1Dfetch is only supported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1DARRAYfetch
perl v5.10.0 Cg Toolkit 3.0 821
TEX1DLOD(Cg) Cg Standard Library TEX1DLOD(Cg)
NAME tex1Dlod −1Dtexture lookup with specified levelofdetail and optional texeloffset.
SYNOPSIS
float4 tex1Dlod(sampler1D samp, float4 s)
float4 tex1Dlod(sampler1D samp, float4 s, int texelOff)
int4 tex1Dlod(isampler1D samp, float4 s)
int4 tex1Dlod(isampler1D samp, float4 s, int texelOff)
unsigned int4 tex1Dlod(usampler1D samp, float4 s)
unsigned int4 tex1Dlod(usampler1D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.x Coordinates to perform the lookup.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s.
PROFILE SUPPORT
tex1Dlod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1Dbias, tex1Dcmplod
perl v5.10.0 Cg Toolkit 3.0 822
TEX1DPROJ(Cg) Cg Standard Library TEX1DPROJ(Cg)
NAME tex1Dproj −performs a texture lookup with projection in a givensampler.May perform a shadow
comparison if argument for shadowcomparison is provided.
SYNOPSIS
float4 tex1Dproj(sampler1D samp, float2 s)
float4 tex1Dproj(sampler1D samp, float2 s, int texelOff)
float4 tex1Dproj(sampler1D samp, float3 s)
float4 tex1Dproj(sampler1D samp, float3 s, int texelOff)
int4 tex1Dproj(isampler1D samp, float2 s)
int4 tex1Dproj(isampler1D samp, float2 s, int texelOff)
unsigned int4 tex1Dproj(usampler1D samp, float2 s)
unsgined int4 tex1Dproj(usampler1D samp, float2 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the projection should be passed as the last
component of the coordinate vector.The value used in the shadowcomparison, if present, should
be passed as the next-to-last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the coordinates used in the lookup are first
projected, that is, divided by the last component of the coordinate vector and them used in the lookup. If an
extra coordinate is present it is used to perform a shadowcomparison, the value used in the shadow
comparison is always the next-to-last component in the coordinate vector.
PROFILE SUPPORT
tex1Dproj is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in fp40 and newer profiles, variants with texeloffsets are only
supported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1DARRAYproj
perl v5.10.0 Cg Toolkit 3.0 823
TEX1DSIZE(Cg) Cg Standard Library TEX1DSIZE(Cg)
NAME tex1Dsize −returns the size of a giventexture image for a givenlev e lofdetail.
SYNOPSIS
int3 tex1Dsize(sampler1D samp, int lod)
int3 tex1Dsize(isampler1D samp, int lod)
int3 tex1Dsize(usampler1D samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size of the corresponding texture image is returned as the result of
the operation.
PROFILE SUPPORT
tex1Dsize is only supported in gp4 and newer profiles.
SEE ALSO
tex1D, tex1DARRAYsize
perl v5.10.0 Cg Toolkit 3.0 824
TEX2D(Cg) Cg Standard Library TEX2D(Cg)
NAME tex2D −performs a texture lookup in a given2Dsampler and, in some cases, a shadowcomparison. May
also use pre computed derivativesifthose are provided.
SYNOPSIS
float4 tex2D(sampler2D samp, float2 s)
float4 tex2D(sampler2D samp, float2 s, int texelOff)
float4 tex2D(sampler2D samp, float3 s)
float4 tex2D(sampler2D samp, float3 s, int texelOff)
float4 tex2D(sampler2D samp, float2 s, float2 dx, float2 dy)
float4 tex2D(sampler2D samp, float2 s, float2 dx, float2 dy, int texelOff)
float4 tex2D(sampler2D samp, float3 s, float2 dx, float2 dy)
float4 tex2D(sampler2D samp, float3 s, float2 dx, float2 dy, int texelOff)
int4 tex2D(isampler2D samp, float2 s)
int4 tex2D(isampler2D samp, float2 s, int texelOff)
int4 tex2D(isampler2D samp, float2 s, float2 dx, float2 dy)
int4 tex2D(isampler2D samp, float2 s, float2 dx, float2 dy, int texelOff)
unsigned int4 tex2D(usampler2D samp, float2 s)
unsigned int4 tex2D(usampler2D samp, float2 s, int texelOff)
unsigned int4 tex2D(usampler2D samp, float2 s, float2 dx, float2 dy)
unsigned int4 tex2D(usampler2D samp, float2 s, float2 dx, float2 dy,
int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. If an extra coordinate compared to the texture dimensionality
is present it is used to perform a shadowcomparison. The value used in the shadowcomparison is
always the last component of the coordinate vector.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,may use and derivativesdx and dy,also
may perform shadowcomparison and use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex2D is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with shadow
comparison are only supported in fp40 and newer profiles, variants with texeloffsets are only supported in
gp4 and newer profiles. Variants with integer textures are also only supported in gp4 and newer profiles.
SEE ALSO
tex2Dbias, tex2Dlod, tex2Dproj
perl v5.10.0 Cg Toolkit 3.0 825
TEX2DARRAY(Cg) Cg Standard Library TEX2DARRAY(Cg)
NAME tex2DARRAY −performs a texture lookup in a givensampler array may use pre computed derivativesand,
in some cases, perform a shadowcomparison.
SYNOPSIS
float4 tex2DARRAY(sampler2DARRAY samp, float3 s)
float4 tex2DARRAY(sampler2DARRAY samp, float3 s, int texelOff)
float4 tex2DARRAY(sampler2DARRAY samp, float4 s)
float4 tex2DARRAY(sampler2DARRAY samp, float4 s, int texelOff)
float4 tex2DARRAY(sampler2DARRAY samp, float3 s, float dx, float dy)
float4 tex2DARRAY(sampler2DARRAY samp, float3 s, float dx, float dy,
int texelOff)
float4 tex2DARRAY(sampler2DARRAY samp, float4 s, float dx, float dy)
float4 tex2DARRAY(sampler2DARRAY samp, float4 s, float dx, float dy,
int texelOff)
int4 tex2DARRAY(isampler2DARRAY samp, float3 s)
int4 tex2DARRAY(isampler2DARRAY samp, float3 s, int texelOff)
int4 tex2DARRAY(isampler2DARRAY samp, float3 s, float dx, float dy)
int4 tex2DARRAY(isampler2DARRAY samp, float3 s, float dx, float dy,
int texelOff)
unsigned int4 tex2DARRAY(usampler2DARRAY samp, float3 s)
unsigned int4 tex2DARRAY(usampler2DARRAY samp, float3 s, int texelOff)
unsigned int4 tex2DARRAY(usampler2DARRAY samp, float3 s, float dx, float dy)
unsigned int4 tex2DARRAY(usampler2DARRAY samp, float3 s, float dx, float dy,
int texelOff)
PARAMETERS
samp Sampler array to look up.
sCoordinates to perform the lookup. The value used to select the layer is passed immediatelly after
the regular coordinates, if an extra coordinate is present it is used to perform a shadow
comparison.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the texture to be sampled is selected from
the layer specified in the coordinates. Also may use the derivativesdx and dy,the lookup may involvea
shadowcomparison and use texeloffset texelOff to compute the final texel.
PROFILE SUPPORT
tex2DARRAY is only supported in gp4 and newer profiles.
SEE ALSO
tex2DARRAYbias, tex2DARRAYlod
perl v5.10.0 Cg Toolkit 3.0 826
TEX2DARRAYBIAS(Cg) Cg Standard Library TEX2DARRAYBIAS(Cg)
NAME tex2DARRAYbias −performs a texture lookup with bias in a givensampler array.
SYNOPSIS
float4 tex2DARRAYbias(sampler2DARRAY samp, float4 s)
float4 tex2DARRAYbias(sampler2DARRAY samp, float4 s, int texelOff)
int4 tex2DARRAYbias(isampler2DARRAY samp, float4 s)
int4 tex2DARRAYbias(isampler2DARRAY samp, float4 s, int texelOff)
unsigned int4 tex2DARRAYbias(usampler2DARRAY samp, float4 s)
unsigned int4 tex2DARRAYbias(usampler2DARRAY samp, float4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup. The value used to select the layer should be passed in the
vector component right after the regular coordinates. The bias value should be passed as the last
component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s,the texture to be sampled is
selected from the layer specified in the coordinates.
PROFILE SUPPORT
tex2DARRAYbias is only supported in gp4 and newer profiles.
SEE ALSO
tex2DARRAY, tex2DARRAYlod
perl v5.10.0 Cg Toolkit 3.0 827
TEX2DARRAYFETCH(Cg) Cg Standard Library TEX2DARRAYFETCH(Cg)
NAME tex2DARRAYfetch −performs an unfiltered texture lookup in a givensampler array.
SYNOPSIS
float4 tex2DARRAYfetch(sampler2DARRAY samp, int4 s)
float4 tex2DARRAYfetch(sampler2DARRAY samp, int4 s, int texelOff)
int4 tex2DARRAYfetch(isampler2DARRAY samp, int4 s)
int4 tex2DARRAYfetch(isampler2DARRAY samp, int4 s, int texelOff)
unsigned int4 tex2DARRAYfetch(usampler2DARRAY samp, int4 s)
unsigned int4 tex2DARRAYfetch(usampler2DARRAY samp, int4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup, the layer is selected by the component right after the regular
coordinates, the levelofdetail is provided by the last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler array samp using coordinates s.The layer to be accessed is
selected by the component right after the regular coordinates, the levelofdetail is provided by the last
component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex2DARRAYfetch is only supported in gp4 and newer profiles.
SEE ALSO
tex2Dfetch
perl v5.10.0 Cg Toolkit 3.0 828
TEX2DARRAYLOD(Cg) Cg Standard Library TEX2DARRAYLOD(Cg)
NAME tex2DARRAYlod −2Dtexture array lookup with specified levelofdetail.
SYNOPSIS
float4 tex2DARRAYlod(sampler2DARRAY samp, float4 s)
float4 tex2DARRAYlod(sampler2DARRAY samp, float4 s, int texelOff)
int4 tex2DARRAYlod(isampler2DARRAY samp, float4 s)
int4 tex2DARRAYlod(isampler2DARRAY samp, float4 s, int texelOff)
unsigned int4 tex2DARRAYlod(usampler2DARRAY samp, float4 s)
unsigned int4 tex2DARRAYlod(usampler2DARRAY samp, float4 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
s.xy Coordinates to perform the lookup.
s.z Texture array layer.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s,the texture to
be sampled is selected from the layer specified in the coordinates.
PROFILE SUPPORT
tex2DARRAYlod is only supported in gp4 and newer profiles.
SEE ALSO
tex2DARRAY, tex2DARRAYbias
perl v5.10.0 Cg Toolkit 3.0 829
TEX2DARRAYPROJ(Cg) Cg Standard Library TEX2DARRAYPROJ(Cg)
NAME tex2DARRAYproj −performs a texture lookup with projection in a givensampler array.
SYNOPSIS
float4 tex2DARRAYproj(sampler2DARRAY samp, float3 s)
float4 tex2DARRAYproj(sampler2DARRAY samp, float3 s, int texelOff)
int4 tex2DARRAYproj(isampler2DARRAY samp, float3 s)
int4 tex2DARRAYproj(isampler2DARRAY samp, float3 s, int texelOff)
unsigned int4 tex2DARRAYproj(usampler2DARRAY samp, float3 s)
unsigned int4 tex2DARRAYproj(usampler2DARRAY samp, float3 s, int texelOff)
PARAMETERS
samp Sampler array to lookup.
sCoordinates to perform the lookup. The value used to select the layer should be passed as the
component right after the lookup coordinates. The value used in the projection should be passed
as the last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler array samp using coordinates s,the layer used in the lookup is first
selected using the coordinate component right after the regular coordinates. The coordinates used in the
lookup are then projected, that is, divided by the last component of the coordinate vector and them used in
the lookup.
PROFILE SUPPORT
tex2DARRAYproj is only supported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2Dproj
perl v5.10.0 Cg Toolkit 3.0 830
TEX2DARRAYSIZE(Cg) Cg Standard Library TEX2DARRAYSIZE(Cg)
NAME tex2DARRAYsize −returns the size of a giventexture array image for a givenlev elofdetail.
SYNOPSIS
int3 tex2DARRAYsize(sampler2DARRAY samp, int lod)
int3 tex2DARRAYsize(isampler2DARRAY samp, int lod)
int3 tex2DARRAYsize(usampler2DARRAY samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler array and a levelofdetail the size of one element of the corresponding texture array for a
givenlev elofdetail is returned as a result of the operation.
PROFILE SUPPORT
tex2DARRAYsize is only supported in gp4 and newer profiles.
SEE ALSO
tex2Dsize
perl v5.10.0 Cg Toolkit 3.0 831
TEX2DBIAS(Cg) Cg Standard Library TEX2DBIAS(Cg)
NAME tex2Dbias −2Dtexture lookup with bias and optional texeloffset.
SYNOPSIS
float4 tex2Dbias(sampler2D samp, float4 s)
float4 tex2Dbias(sampler2D samp, float4 s, int texelOff)
int4 tex2Dbias(isampler2D samp, float4 s)
int4 tex2Dbias(isampler2D samp, float4 s, int texelOff)
unsigned int4 tex2Dbias(usampler2D samp, float4 s)
unsigned int4 tex2Dbias(usampler2D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.xy Coordinates to perform the lookup.
s.w Levelofdetail bias value.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s.Lev el-of-detail bias can be used
to artificially blur or sharpen the result of texture sampling.
PROFILE SUPPORT
tex2Dbias is supported in fragment profiles starting with fp30 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2Dlod, tex2Dcmpbias
perl v5.10.0 Cg Toolkit 3.0 832
TEX2DCMPBIAS(Cg) Cg Standard Library TEX2DCMPBIAS(Cg)
NAME tex2Dcmpbias −performs a texture lookup with bias and shadowcompare in a givensampler.
SYNOPSIS
float4 tex2Dcmpbias(sampler2D samp, float4 s)
float4 tex2Dcmpbias(sampler2D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the shadowcomparison should be passed
right after the normal coordinates. The bias value should be passed as the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with shadowcompare and bias in sampler samp using coordinates s.
PROFILE SUPPORT
tex2Dcmpbias is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles.
SEE ALSO
tex2Dcmplod, tex2Dbias
perl v5.10.0 Cg Toolkit 3.0 833
TEX2DCMPLOD(Cg) Cg Standard Library TEX2DCMPLOD(Cg)
NAME tex2Dcmplod −performs a texture lookup with a specified levelofdetail and a shadowcompare in a given
sampler.
SYNOPSIS
float4 tex2Dcmplod(sampler2D samp, float4 s)
float4 tex2Dcmplod(sampler2D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the shadowcomparison should be passed
right after the normal coordinates. The levelofdetail corresponds to the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with shadowcompare and a specified levelofdetail in sampler samp using
coordinates s.
PROFILE SUPPORT
tex2Dcmplod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles.
SEE ALSO
tex2Dlod, tex2Dcmpbias
perl v5.10.0 Cg Toolkit 3.0 834
TEX2DFETCH(Cg) Cg Standard Library TEX2DFETCH(Cg)
NAME tex2Dfetch −performs an unfiltered texture lookup in a givensampler.
SYNOPSIS
float4 tex2Dfetch(sampler2D samp, int4 s)
float4 tex2Dfetch(sampler2D samp, int4 s, int texelOff)
int4 tex2Dfetch(isampler2D samp, int4 s)
int4 tex2Dfetch(isampler2D samp, int4 s, int texelOff)
unsigned int4 tex2Dfetch(usampler2D samp, int4 s)
unsigned int4 tex2Dfetch(usampler2D samp, int4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The levelofdetail is stored in the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler samp using coordinates s.The levelofdetail is provided
by the last component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex2Dfetch is only supported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2DARRAYfetch
perl v5.10.0 Cg Toolkit 3.0 835
TEX2DLOD(Cg) Cg Standard Library TEX2DLOD(Cg)
NAME tex2Dlod −2Dtexture lookup with specified levelofdetail and optional texeloffset.
SYNOPSIS
float4 tex2Dlod(sampler2D samp, float4 s)
float4 tex2Dlod(sampler2D samp, float4 s, int texelOff)
int4 tex2Dlod(isampler2D samp, float4 s)
int4 tex2Dlod(isampler2D samp, float4 s, int texelOff)
unsigned int4 tex2Dlod(usampler2D samp, float4 s)
unsigned int4 tex2Dlod(usampler2D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.xy Coordinates to perform the lookup.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s.
PROFILE SUPPORT
tex2Dlod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2Dbias, tex2Dcmplod
perl v5.10.0 Cg Toolkit 3.0 836
TEX2DPROJ(Cg) Cg Standard Library TEX2DPROJ(Cg)
NAME tex2Dproj −performs a texture lookup with projection in a givensampler.May perform a shadow
comparison if argument for shadowcomparison is provided.
SYNOPSIS
float4 tex2Dproj(sampler2D samp, float3 s)
float4 tex2Dproj(sampler2D samp, float3 s, int texelOff)
float4 tex2Dproj(sampler2D samp, float4 s)
float4 tex2Dproj(sampler2D samp, float4 s, int texelOff)
int4 tex2Dproj(isampler2D samp, float3 s)
int4 tex2Dproj(isampler2D samp, float3 s, int texelOff)
unsigned int4 tex2Dproj(usampler2D samp, float3 s)
unsgined int4 tex2Dproj(usampler2D samp, float3 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the projection should be passed as the last
component of the coordinate vector.The value used in the shadowcomparison, if present, should
be passed as the next-to-last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the coordinates used in the lookup are first
projected, that is, divided by the last component of the coordinate vector and them used in the lookup. If an
extra coordinate is present it is used to perform a shadowcomparison, the value used in the shadow
comparison is always the next-to-last component in the coordinate vector.
PROFILE SUPPORT
tex2Dproj is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in fp40 and newer profiles, variants with texeloffsets are only
supported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2DARRAYproj
perl v5.10.0 Cg Toolkit 3.0 837
TEX2DSIZE(Cg) Cg Standard Library TEX2DSIZE(Cg)
NAME tex2Dsize −returns the size of a giventexture image for a givenlev e lofdetail.
SYNOPSIS
int3 tex2Dsize(sampler2D samp, int lod)
int3 tex2Dsize(isampler2D samp, int lod)
int3 tex2Dsize(usampler2D samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size of the corresponding texture image is returned as the result of
the operation.
PROFILE SUPPORT
tex2Dsize is only supported in gp4 and newer profiles.
SEE ALSO
tex2D, tex2DARRAYsize
perl v5.10.0 Cg Toolkit 3.0 838
TEX3D(Cg) Cg Standard Library TEX3D(Cg)
NAME tex3D −performs a texture lookup in a given3Dsampler.May also use pre computed derivativesifthose
are provided.
SYNOPSIS
float4 tex3D(sampler3D samp, float3 s)
float4 tex3D(sampler3D samp, float3 s, int texelOff)
float4 tex3D(sampler3D samp, float3 s, float3 dx, float3 dy)
float4 tex3D(sampler3D samp, float3 s, float3 dx, float3 dy, int texelOff)
int4 tex3D(isampler3D samp, float3 s)
int4 tex3D(isampler3D samp, float3 s, int texelOff)
int4 tex3D(isampler3D samp, float3 s, float3 dx, float3 dy)
int4 tex3D(isampler3D samp, float3 s, float3 dx, float3 dy, int texelOff)
unsigned int4 tex3D(usampler3D samp, float3 s)
unsigned int4 tex3D(usampler3D samp, float3 s, int texelOff)
unsigned int4 tex3D(usampler3D samp, float3 s, float3 dx, float3 dy)
unsigned int4 tex3D(usampler3D samp, float3 s, float3 dx, float3 dy,
int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,may use and derivativesdx and dy,also
may use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex3D is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with texel
offsets are only supported in gp4 and newer profiles. Variants with integer samplers are also only
suppported in gp4 and newer profiles.
SEE ALSO
tex3Dbias, tex3Dlod, tex3Dproj
perl v5.10.0 Cg Toolkit 3.0 839
TEX3DBIAS(Cg) Cg Standard Library TEX3DBIAS(Cg)
NAME tex3Dbias −3Dtexture lookup with bias and optional texeloffset.
SYNOPSIS
float4 tex3Dbias(sampler3D samp, float4 s)
float4 tex3Dbias(sampler3D samp, float4 s, int texelOff)
int4 tex3Dbias(isampler3D samp, float4 s)
int4 tex3Dbias(isampler3D samp, float4 s, int texelOff)
unsigned int4 tex3Dbias(usampler3D samp, float4 s)
unsigned int4 tex3Dbias(usampler3D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.xyz Coordinates to perform the lookup.
s.w Levelofdetail bias value.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s.Lev el-of-detail bias can be used
to artificially blur or sharpen the result of texture sampling.
PROFILE SUPPORT
tex3Dbias is supported in fragment profiles starting with fp30 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex3D, tex3Dlod
perl v5.10.0 Cg Toolkit 3.0 840
TEX3DFETCH(Cg) Cg Standard Library TEX3DFETCH(Cg)
NAME tex3Dfetch −performs an unfiltered texture lookup in a givensampler.
SYNOPSIS
float4 tex3Dfetch(sampler3D samp, int4 s)
float4 tex3Dfetch(sampler3D samp, int4 s, int texelOff)
int4 tex3Dfetch(isampler3D samp, int4 s)
int4 tex3Dfetch(isampler3D samp, int4 s, int texelOff)
unsigned int4 tex3Dfetch(usampler3D samp, int4 s)
unsigned int4 tex3Dfetch(usampler3D samp, int4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The levelofdetail is stored in the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler samp using coordinates s.The levelofdetail is provided
by the last component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
tex3Dfetch is only supported in gp4 and newer profiles.
SEE ALSO
tex3D
perl v5.10.0 Cg Toolkit 3.0 841
TEX3DLOD(Cg) Cg Standard Library TEX3DLOD(Cg)
NAME tex3Dlod −3Dtexture lookup with specified levelofdetail and optional texeloffset.
SYNOPSIS
float4 tex3Dlod(sampler3D samp, float4 s)
float4 tex3Dlod(sampler3D samp, float4 s, int texelOff)
int4 tex3Dlod(isampler3D samp, float4 s)
int4 tex3Dlod(isampler3D samp, float4 s, int texelOff)
unsigned int4 tex3Dlod(usampler3D samp, float4 s)
unsgined int4 tex3Dlod(usampler3D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.xyz Coordinates to perform the lookup.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s.
PROFILE SUPPORT
tex3Dlod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
tex3D, tex3Dbias
perl v5.10.0 Cg Toolkit 3.0 842
TEX3DPROJ(Cg) Cg Standard Library TEX3DPROJ(Cg)
NAME tex3Dproj −performs a texture lookup with projection in a givensampler.May perform a shadow
comparison if argument for shadowcomparison is provided.
SYNOPSIS
float4 tex3Dproj(sampler3D samp, float4 s)
float4 tex3Dproj(sampler3D samp, float4 s, int texelOff)
int4 tex3Dproj(isampler3D samp, float4 s)
int4 tex3Dproj(isampler3D samp, float4 s, int texelOff)
unsigned int4 tex3Dproj(usampler3D samp, float4 s)
unsigned int4 tex3Dproj(usampler3D samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the projection should be passed as the last
component of the coordinate vector.The value used in the shadowcomparison, if present, should
be passed as the next-to-last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the coordinates used in the lookup are first
projected, that is, divided by the last component of the coordinate vector and them used in the lookup. If an
extra coordinate is present it is used to perform a shadowcomparison, the value used in the shadow
comparison is always the next-to-last component in the coordinate vector.
PROFILE SUPPORT
tex3Dproj is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in fp40 and newer profiles, variants with texeloffsets are only
supported in gp4 and newer profiles.
SEE ALSO
tex3D
perl v5.10.0 Cg Toolkit 3.0 843
TEX3DSIZE(Cg) Cg Standard Library TEX3DSIZE(Cg)
NAME tex3Dsize −returns the size of a giventexture image for a givenlev e lofdetail.
SYNOPSIS
int3 tex3Dsize(sampler3D samp, int lod)
int3 tex3Dsize(isampler3D samp, int lod)
int3 tex3Dsize(usampler3D samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size of the corresponding texture image is returned as the result of
the operation.
PROFILE SUPPORT
tex3Dsize is only supported in gp4 and newer profiles.
SEE ALSO
tex3D
perl v5.10.0 Cg Toolkit 3.0 844
TEXBUF(Cg) Cg Standard Library TEXBUF(Cg)
NAME texBUF −performs an unfiltered texture lookup in a giventexture buffer sampler.
SYNOPSIS
float4 texBUF(samplerBUF samp, int s)
int4 texBUF(isamplerBUF samp, int s)
unsigned int4 texBUF(usamplerBUF samp, int s)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup.
DESCRIPTION
Performs an unfiltered texture lookup in texture buffer sampler samp using coordinates s.
Te x ture buffer samplers are created with the EXT_texture_buffer_object extension. See:
http://developer.download.nvidia.com/opengl/specs/GL_EXT_texture_buffer_object.txt
Te x ture buffer object samplers roughly correspond to the tbuffer functionality of DirectX 10.
PROFILE SUPPORT
texBUF is supported in gp4vp, gp4gp, and gp4fp profiles.
SEE ALSO
tex1D, texBUFsize
perl v5.10.0 Cg Toolkit 3.0 845
TEXBUFSIZE(Cg) Cg Standard Library TEXBUFSIZE(Cg)
NAME texBUFsize −returns the size of a giventexture image for a givenlev elofdetail.
SYNOPSIS
int3 texBUFsize(samplerBUF samp, int lod)
int3 texBUFsize(isamplerBUF samp, int lod)
int3 texBUFsize(usamplerBUF samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size (width in x,height in y,and depth in z)ofthe corresponding
texture buffer is returned as the result of the operation.
Because texture buffers lack mipmaps, the lod parameter is unused.
Te x ture buffer samplers are created with the EXT_texture_buffer_object extension. See:
http://developer.download.nvidia.com/opengl/specs/GL_EXT_texture_buffer_object.txt
Te x ture buffer object samplers roughly correspond to the tbuffer functionality of DirectX 10.
PROFILE SUPPORT
texBUF is supported in gp4vp, gp4gp, and gp4fp profiles.
SEE ALSO
tex1Dsize, texBUF
perl v5.10.0 Cg Toolkit 3.0 846
TEXCUBE(Cg) Cg Standard Library TEXCUBE(Cg)
NAME texCUBE −performs a texture lookup in a givenCUBE sampler and, in some cases, a shadowcomparison.
May also use pre computed derivativesifthose are provided.
SYNOPSIS
float4 texCUBE(samplerCUBE samp, float3 s)
float4 texCUBE(samplerCUBE samp, float4 s)
float4 texCUBE(samplerCUBE samp, float3 s, float3 dx, float3 dy)
float4 texCUBE(samplerCUBE samp, float4 s, float3 dx, float3 dy)
int4 texCUBE(isamplerCUBE samp, float3 s)
int4 texCUBE(isamplerCUBE samp, float3 s, float3 dx, float3 dy)
unsigned int4 texCUBE(usamplerCUBE samp, float3 s)
unsigned int4 texCUBE(usamplerCUBE samp, float3 s, float3 dx, float3 dy)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. If an extra coordinate compared to the texture dimensionality
is present it is used to perform a shadowcomparison. The value used in the shadowcomparison is
always the last component of the coordinate vector.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,may use and derivativesdx and dy,also
may perform shadowcomparison.
PROFILE SUPPORT
texCUBE is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
texCUBEbias, texCUBElod, texCUBEproj
perl v5.10.0 Cg Toolkit 3.0 847
TEXCUBEARRAY(Cg) Cg Standard Library TEXCUBEARRAY(Cg)
NAME texCUBEARRAY −cube array texture lookup with optional pre-computed derivatives.
SYNOPSIS
float4 texCUBEARRAY(samplerCUBEARRAY samp, float4 s)
float4 texCUBEARRAY(samplerCUBEARRAY samp, float4 s, float3 dx, float3 dy)
int4 texCUBEARRAY(isamplerCUBEARRAY samp, float4 s)
int4 texCUBEARRAY(isamplerCUBEARRAY samp, float4 s, float3 dx, float3 dy)
unsigned int4 texCUBEARRAY(usamplerCUBEARRAY samp, float4 s)
unsigned int4 texCUBEARRAY(usamplerCUBEARRAY samp, float4 s, float3 dx, float3 dy)
PARAMETERS
samp Cube array sampler array to look up.
s.xyz Coordinates to perform the lookup.
s.w Cube map array layer.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the texture to be sampled is selected from
the layer specified in the coordinates. Also may use the derivativesdx and dy.
PROFILE SUPPORT
texCUBEARRAY is only supported in gp4 and newer profiles.
SEE ALSO
texCUBEARRAYbias, texCUBEARRAYlod, texCUBEARRAYsize
perl v5.10.0 Cg Toolkit 3.0 848
TEXCUBEARRAYBIAS(Cg) Cg Standard Library TEXCUBEARRAYBIAS(Cg)
NAME texCUBEARRAYbias −cube array texture lookup with bias.
SYNOPSIS
float4 texCUBEARRAYbias(samplerCUBEARRAY samp, float4 s, float bias)
int4 texCUBEARRAYbias(isamplerCUBEARRAY samp, float4 s, float bias)
unsigned int4 texCUBEARRAYbias(usamplerCUBEARRAY samp, float4 s, float bias)
PARAMETERS
samp Cube array sampler array to look up.
s.xyz Coordinates to perform the lookup.
s.w Cube map array layer.
bias Levelofdetail bias.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the texture to be sampled is selected from
the layer specified in the coordinates. Level-of-detail bias can be used to artificially blur or sharpen the
result of texture sampling.
PROFILE SUPPORT
texCUBEARRAYbias is only supported in gp5 and newer profiles.
SEE ALSO
texCUBEARRAY, texCUBEARRAYlod
perl v5.10.0 Cg Toolkit 3.0 849
TEXCUBEARRAYLOD(Cg) Cg Standard Library TEXCUBEARRAYLOD(Cg)
NAME texCUBEARRAYlod −cube array texture lookup with specified levelofdetail.
SYNOPSIS
float4 texCUBEARRAYlod(samplerCUBEARRAY samp, float4 s, float lod)
int4 texCUBEARRAYlod(isamplerCUBEARRAY samp, float4 s, float lod)
unsigned int4 texCUBEARRAYlod(usamplerCUBEARRAY samp, float4 s, float lod)
PARAMETERS
samp Cube array sampler to look up.
s.xyz Coordinates to perform the lookup.
s.w Cube map array layer.
lod Levelofdetail.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the texture to be sampled is selected from
the layer specified in the coordinates.
PROFILE SUPPORT
texCUBEARRAYlod is only supported in gp5 and newer profiles.
SEE ALSO
texCUBEARRAY, texCUBEARRAYbias
perl v5.10.0 Cg Toolkit 3.0 850
TEXCUBEARRAYSIZE(Cg) Cg Standard Library TEXCUBEARRAYSIZE(Cg)
NAME texCUBEARRAYsize −returns the size of a giventexture array image for a givenlev elofdetail.
SYNOPSIS
int3 texCUBEARRAYsize(samplerCUBEARRAY samp, int lod)
int3 texCUBEARRAYsize(isamplerCUBEARRAY samp, int lod)
int3 texCUBEARRAYsize(usamplerCUBEARRAY samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler array and a levelofdetail the size of one element of the corresponding texture array for a
givenlev elofdetail is returned as a result of the operation.
PROFILE SUPPORT
texCUBEARRAYsize is only supported in gp4 and newer profiles.
SEE ALSO
texCUBEsize
perl v5.10.0 Cg Toolkit 3.0 851
TEXCUBEBIAS(Cg) Cg Standard Library TEXCUBEBIAS(Cg)
NAME texCUBEbias −cube texture lookup with bias.
SYNOPSIS
float4 texCUBEbias(samplerCUBE samp, float4 s)
int4 texCUBEbias(isamplerCUBE samp, float4 s)
unsigned int4 texCUBEbias(usamplerCUBE samp, float4 s)
PARAMETERS
samp Sampler to lookup.
s.xyz Coordinates to perform the lookup.
s.w Levelofdetail bias value.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s.
PROFILE SUPPORT
texCUBEbias is supported in fragment profiles starting with fp30 and in vertexprofiles starting with vp40.
Variants with integer samplers are only supported in gp4 and newer profiles.
SEE ALSO
texCUBElod
perl v5.10.0 Cg Toolkit 3.0 852
TEXCUBELOD(Cg) Cg Standard Library TEXCUBELOD(Cg)
NAME texCUBElod −cube texture lookup with specified levelofdetail.
SYNOPSIS
float4 texCUBElod(samplerCUBE samp, float4 s)
int4 texCUBElod(isamplerCUBE samp, float4 s)
unsigned int4 texCUBElod(usamplerCUBE samp, float4 s)
PARAMETERS
samp Sampler to lookup.
s.xyz Coordinates to perform the lookup.
s.w Levelofdetail.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s.
PROFILE SUPPORT
texCUBElod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with integer samplers are only supported in gp4 and newer profiles.
SEE ALSO
texCUBEbias
perl v5.10.0 Cg Toolkit 3.0 853
TEXCUBEPROJ(Cg) Cg Standard Library TEXCUBEPROJ(Cg)
NAME texCUBEproj −performs a texture lookup with projection in a givensampler.
SYNOPSIS
float4 texCUBEproj(samplerCUBE samp, float4 s)
int4 texCUBEproj(isamplerCUBE samp, float4 s)
unsigned int4 texCUBEproj(usamplerCUBE samp, float4 s)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the projection should be passed as the last
component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the coordinates used in the lookup are first
projected, that is, divided by the last component of the coordinate vector and them used in the lookup.
PROFILE SUPPORT
texCUBEproj is supported in all fragment profiles and all vertexprofiles starting with vp40. Variants with
integer samplers are only supported in gp4 and newer profiles.
SEE ALSO
texCUBE
perl v5.10.0 Cg Toolkit 3.0 854
TEXCUBESIZE(Cg) Cg Standard Library TEXCUBESIZE(Cg)
NAME texCUBEsize −returns the size of a giventexture image for a givenlev e lofdetail.
SYNOPSIS
int3 texCUBEsize(samplerCUBE samp, int lod)
int3 texCUBEsize(isamplerCUBE samp, int lod)
int3 texCUBEsize(usamplerCUBE samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size of the corresponding texture image is returned as the result of
the operation.
PROFILE SUPPORT
texCUBEsize is only supported in gp4 and newer profiles.
SEE ALSO
texCUBE
perl v5.10.0 Cg Toolkit 3.0 855
TEXRECT(Cg) Cg Standard Library TEXRECT(Cg)
NAME texRECT −performs a texture lookup in a givenRECT sampler and, in some cases, a shadowcomparison.
May also use pre computed derivativesifthose are provided.
SYNOPSIS
float4 texRECT(samplerRECT samp, float2 s)
float4 texRECT(samplerRECT samp, float2 s, int texelOff)
float4 texRECT(samplerRECT samp, float3 s)
float4 texRECT(samplerRECT samp, float3 s, int texelOff)
float4 texRECT(samplerRECT samp, float2 s, float2 dx, float2 dy)
float4 texRECT(samplerRECT samp, float2 s, float2 dx, float2 dy, int texelOff)
float4 texRECT(samplerRECT samp, float3 s, float2 dx, float2 dy)
float4 texRECT(samplerRECT samp, float3 s, float2 dx, float2 dy, int texelOff)
int4 texRECT(isamplerRECT samp, float2 s)
int4 texRECT(isamplerRECT samp, float2 s, int texelOff)
int4 texRECT(isamplerRECT samp, float2 s, float2 dx, float2 dy)
int4 texRECT(isamplerRECT samp, float2 s, float2 dx, float2 dy, int texelOff)
unsigned int4 texRECT(usamplerRECT samp, float2 s)
unsigned int4 texRECT(usamplerRECT samp, float2 s, int texelOff)
unsigned int4 texRECT(usamplerRECT samp, float2 s, float2 dx, float2 dy)
unsigned int4 texRECT(usamplerRECT samp, float2 s, float2 dx, float2 dy,
int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. If an extra coordinate compared to the texture dimensionality
is present it is used to perform a shadowcomparison. The value used in the shadowcomparison is
always the last component of the coordinate vector.
dx Pre computed derivative along the x axis.
dy Pre computed derivative along the y axis.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,may use and derivativesdx and dy,also
may perform shadowcomparison and use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
texRECT is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in fp40 and newer profiles, variants with texeloffsets are only
supported in gp4 and newer profiles. Variants with integer samplers are only supported in gp4 and newer
profiles.
SEE ALSO
texRECTbias, texRECTlod, texRECTproj
perl v5.10.0 Cg Toolkit 3.0 856
TEXRECTBIAS(Cg) Cg Standard Library TEXRECTBIAS(Cg)
NAME texRECTbias −rectangle texture lookup with bias and optional texeloffset.
SYNOPSIS
float4 texRECTbias(samplerRECT samp, float4 s)
float4 texRECTbias(samplerRECT samp, float4 s, int2 texelOff)
int4 texRECTbias(isamplerRECT samp, float4 s)
int4 texRECTbias(isamplerRECT samp, float4 s, int2 texelOff)
unsigned int4 texRECTbias(usamplerRECT samp, float4 s)
unsigned int4 texRECTbias(usamplerRECT samp, float4 s, int2 texelOff)
PARAMETERS
samp Sampler to lookup.
s.xy Coordinates to perform the lookup.
s.w Levelofdetail bias value.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with bias in sampler samp using coordinates s.
PROFILE SUPPORT
texRECTbias is supported in fragment profiles starting with fp30 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
texRECTlod, texRECTfetch
perl v5.10.0 Cg Toolkit 3.0 857
TEXRECTFETCH(Cg) Cg Standard Library TEXRECTFETCH(Cg)
NAME texRECTfetch −unfiltered rectangle texture lookup.
SYNOPSIS
float4 texRECTfetch(samplerRECT samp, int4 s)
float4 texRECTfetch(samplerRECT samp, int4 s, int2 texelOff)
int4 texRECTfetch(isamplerRECT samp, int4 s)
int4 texRECTfetch(isamplerRECT samp, int4 s, int2 texelOff)
unsigned int4 texRECTfetch(usamplerRECT samp, int4 s)
unsigned int4 texRECTfetch(usamplerRECT samp, int4 s, int2 texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The levelofdetail is stored in the last component of the
coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs an unfiltered texture lookup in sampler samp using coordinates s.The levelofdetail is provided
by the last component of the coordinate vector.May use texeloffset texelOff to compute final texel.
PROFILE SUPPORT
texRECTfetch is only supported in gp4 and newer profiles.
SEE ALSO
texRECTlod, texRECTbias, texRECT
perl v5.10.0 Cg Toolkit 3.0 858
TEXRECTLOD(Cg) Cg Standard Library TEXRECTLOD(Cg)
NAME texRECTlod −rectangle texture lookup with specified levelofdetail and optional texeloffset.
SYNOPSIS
float4 texRECTlod(samplerRECT samp, float4 s)
float4 texRECTlod(samplerRECT samp, float4 s, int texelOff)
int4 texRECTlod(isamplerRECT samp, float4 s)
int4 texRECTlod(isamplerRECT samp, float4 s, int texelOff)
unsigned int4 texRECTlod(usamplerRECT samp, float4 s)
unsigned int4 texRECTlod(usamplerRECT samp, float4 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
s.xyz Coordinates to perform the lookup.
s.w Levelofdetail.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup with a specified levelofdetail in sampler samp using coordinates s.
PROFILE SUPPORT
texRECTlod is supported in fragment profiles starting with fp40 and in vertexprofiles starting with vp40.
Variants with texelOff are only supported in gp4 and newer profiles. Variants with integer samplers are also
only suppported in gp4 and newer profiles.
SEE ALSO
texRECTbias, texRECTfetch
perl v5.10.0 Cg Toolkit 3.0 859
TEXRECTPROJ(Cg) Cg Standard Library TEXRECTPROJ(Cg)
NAME texRECTproj −performs a texture lookup with projection in a givensampler.May perform a shadow
comparison if argument for shadowcomparison is provided.
SYNOPSIS
float4 texRECTproj(samplerRECT samp, float3 s)
float4 texRECTproj(samplerRECT samp, float3 s, int texelOff)
float4 texRECTproj(samplerRECT samp, float4 s)
float4 texRECTproj(samplerRECT samp, float4 s, int texelOff)
int4 texRECTproj(isamplerRECT samp, float3 s)
int4 texRECTproj(isamplerRECT samp, float3 s, int texelOff)
unsigned int4 texRECTproj(usamplerRECT samp, float3 s)
unsigned int4 texRECTproj(usamplerRECT samp, float3 s, int texelOff)
PARAMETERS
samp Sampler to lookup.
sCoordinates to perform the lookup. The value used in the projection should be passed as the last
component of the coordinate vector.The value used in the shadowcomparison, if present, should
be passed as the next-to-last component of the coordinate vector.
texelOffOffset to be added to obtain the final texel.
DESCRIPTION
Performs a texture lookup in sampler samp using coordinates s,the coordinates used in the lookup are first
projected, that is, divided by the last component of the coordinate vector and them used in the lookup. If an
extra coordinate is present it is used to perform a shadowcomparison, the value used in the shadow
comparison is always the next-to-last component in the coordinate vector.
PROFILE SUPPORT
texRECTproj is supported in all fragment profiles and all vertexprofiles starting with vp40, variants with
shadowcomparison are only supported in fp40 and newer profiles, variants with texeloffsets are only
supported in gp4 and newer profiles.
SEE ALSO
texRECT
perl v5.10.0 Cg Toolkit 3.0 860
TEXRECTSIZE(Cg) Cg Standard Library TEXRECTSIZE(Cg)
NAME texRECTsize −returns the size of a giventexture image for a givenlev e lofdetail.
SYNOPSIS
int3 texRECTsize(samplerRECT samp, int lod)
int3 texRECTsize(isamplerRECT samp, int lod)
int3 texRECTsize(usamplerRECT samp, int lod)
PARAMETERS
samp Sampler to be queried for size.
lod Levelofdetail to obtain size.
DESCRIPTION
Givenasampler and a levelofdetail the size of the corresponding texture image is returned as the result of
the operation.
PROFILE SUPPORT
texRECTsize is only supported in gp4 and newer profiles.
SEE ALSO
texRECT
perl v5.10.0 Cg Toolkit 3.0 861
TRANSPOSE(Cg) Cg Standard Library TRANSPOSE(Cg)
NAME transpose −returns transpose matrix of a matrix
SYNOPSIS
float4x4 transpose(float4x4 A)
float3x4 transpose(float4x3 A)
float2x4 transpose(float4x2 A)
float1x4 transpose(float4x1 A)
float4x3 transpose(float3x4 A)
float3x3 transpose(float3x3 A)
float2x3 transpose(float3x2 A)
float1x3 transpose(float3x1 A)
float4x2 transpose(float2x4 A)
float3x2 transpose(float2x3 A)
float2x2 transpose(float2x2 A)
float1x2 transpose(float2x1 A)
float4x1 transpose(float1x4 A)
float3x1 transpose(float1x3 A)
float2x1 transpose(float1x2 A)
float1x1 transpose(float1x1 A)
PARAMETERS
AMatrix to tranpose.
DESCRIPTION
Returns the transpose of the matrix A.
REFERENCE IMPLEMENTATION
transpose for a float4x3 matrix can be implemented likethis:
float4x3 transpose(float3x4 A)
{
float4x3 C;
C[0] = A._m00_m10_m20;
C[1] = A._m01_m11_m21;
C[2] = A._m02_m12_m22;
C[3] = A._m03_m13_m23;
return C;
}
PROFILE SUPPORT
transpose is supported in all profiles.
SEE ALSO
determinant, mul
perl v5.10.0 Cg Toolkit 3.0 862
TRUNC(Cg) Cg Standard Library TRUNC(Cg)
NAME trunc −returns largest integer not greater than a scalar or each vector component.
SYNOPSIS
float trunc(float x);
float1 trunc(float1 x);
float2 trunc(float2 x);
float3 trunc(float3 x);
float4 trunc(float4 x);
half trunc(half x);
half1 trunc(half1 x);
half2 trunc(half2 x);
half3 trunc(half3 x);
half4 trunc(half4 x);
fixed trunc(fixed x);
fixed1 trunc(fixed1 x);
fixed2 trunc(fixed2 x);
fixed3 trunc(fixed3 x);
fixed4 trunc(fixed4 x);
PARAMETERS
xVector or scalar which to truncate.
DESCRIPTION
Returns the integral value nearest to but no larger in magnitude than x.
REFERENCE IMPLEMENTATION
trunc for a float3 vector could be implemented likethis.
float3 trunc(float3 v)
{
float3 rv;
int i;
for (i=0; i<3; i++) {
float x = v[i];
rv[i] = x < 0 ? −floor(−x) : floor(x);
}
return rv;
}
PROFILE SUPPORT
trunc is supported in all profiles except fp20.
SEE ALSO
ceil, floor,round
perl v5.10.0 Cg Toolkit 3.0 863
ADDRESSUI(CgFX) CgFX States ADDRESSUI(CgFX)
NAME AddressUi −3DAPI Utexture addressing mode for unit i
USAGEAddressU[i] = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Sets the Direct3D u−direction wrapping mode for texture unit i,where iis in the range 0−15. See sampler
state AddressU for details.
The standard reset callback sets the AddressU[i] state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressU, AddressVi, AddressWi
perl v5.10.0 Cg Toolkit 3.0 864
ADDRESSVI(CgFX) CgFX States ADDRESSVI(CgFX)
NAME AddressVi −3DAPI Vtexture addressing mode for unit i
USAGEAddressV[i] = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Sets the Direct3D v−direction wrapping mode for texture unit i,where iis in the range 0−15. See sampler
state AddressV for details.
The standard reset callback sets the AddressV[i] state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressV,AddressUi, AddressWi
perl v5.10.0 Cg Toolkit 3.0 865
ADDRESSWI(CgFX) CgFX States ADDRESSWI(CgFX)
NAME AddressWi −3DAPI Wtexture addressing mode for unit i
USAGEAddressW[i] = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Sets the Direct3D w−direction wrapping mode for texture unit i,where iis in the range 0−15. See sampler
state AddressW for details.
The standard reset callback sets the AddressW[i] state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressW,AddressUi, AddressVi
perl v5.10.0 Cg Toolkit 3.0 866
ALPHABLENDENABLE(CgFX) CgFX States ALPHABLENDENABLE(CgFX)
NAME AlphaBlendEnable −3DAPI alpha blend enable
USAGEAlphaBlendEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable alpha blending. See the GL_BLEND description on the OpenGL glEnable manual page for
details. See the D3DRS_ALPHABLENDENABLE render state description for DirectX 9.
The standard reset callback sets the AlphaBlendEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc, BlendFuncSeparate,
BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 867
ALPHAFUNC(CgFX) CgFX States ALPHAFUNC(CgFX)
NAME AlphaFunc −3DAPI alpha function
USAGEAlphaFunc = float(func) AlphaFunc = float2(func, ref)
VALID ENUMERANTS
func: Never, Less, LEqual, Equal, Greater,NotEqual, GEqual, Always
DESCRIPTION
Specify the alpha comparison function. See the OpenGL glAlphaFunc manual page for details. See the
D3DRS_ALPHAFUNC render state description for DirectX 9.
The standard reset callback sets the AlphaFunc state to float(Always) or float2(Always, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaOp, AlphaRef, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 868
ALPHAREF(CgFX) CgFX States ALPHAREF(CgFX)
NAME AlphaRef −3DAPI alpha ref
USAGEAlphaRef = float(ref)
VALID ENUMERANTS
ref: floating point value
DESCRIPTION
Specify the alpha reference value. See the OpenGL glAlphaFunc manual page for details. See the
D3DRS_ALPHAREF render state description for DirectX 9.
The standard reset callback sets the AlphaRef state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 869
ALPHATESTENABLE(CgFX) CgFX States ALPHATESTENABLE(CgFX)
NAME AlphaTestEnable −3DAPI alpha test enable
USAGEAlphaTestEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable alpha testing. See the GL_ALPHA_TEST description on the OpenGL glEnable manual page
for details. See the D3DRS_ALPHATESTENABLE render state description for DirectX 9.
The standard reset callback sets the AlphaTestEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef, ColorArg0,
ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 870
AMBIENT(CgFX) CgFX States AMBIENT(CgFX)
NAME Ambient −3DAPI ambient
USAGEAmbient = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the ambient intensity of the entire scene. See the GL_LIGHT_MODEL_AMBIENT description on the
OpenGL glLightModel manual page for details. See the D3DRS_AMBIENT render state description for
DirectX 9.
The standard reset callback sets the Ambient state to float4(0.2, 0.2, 0.2, 1.0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightModelAmbient
perl v5.10.0 Cg Toolkit 3.0 871
AMBIENTMATERIALSOURCE(CgFX) CgFX States AMBIENTMATERIALSOURCE(CgFX)
NAME AmbientMaterialSource −3DAPI ambient material source
USAGEAmbientMaterialSource = int(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable front and back ambient color material. See the GL_AMBIENT description on the OpenGL
glColorMaterial manual page for details. See the D3DRS_AMBIENTMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the AmbientMaterialSource state to int(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource, MaterialAmbient, MaterialDiffuse,
MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 872
AUTONORMALENABLE(CgFX) CgFX States AUTONORMALENABLE(CgFX)
NAME AutoNormalEnable −3DAPI auto normal enable
USAGEAutoNormalEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable automatic normal generation. See the GL_AUTO_NORMAL description on the OpenGL
glEnable manual page for details. See the D3DRS_NORMALIZENORMALS render state description for
DirectX 9.
The standard reset callback sets the AutoNormalEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
NormalizeEnable, RescaleNormalEnable, NormalizeNormals
perl v5.10.0 Cg Toolkit 3.0 873
BLENDCOLOR(CgFX) CgFX States BLENDCOLOR(CgFX)
NAME BlendColor −3DAPI blend color
USAGEBlendColor = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Set the blend color.See the OpenGL glBlendColor manual page for details. See the
D3DRS_BLENDFACTORrender state description for DirectX 9.
The standard reset callback sets the BlendColor state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendEquation, BlendEquationSeparate, BlendFunc, BlendFuncSeparate,
BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 874
BLENDENABLE(CgFX) CgFX States BLENDENABLE(CgFX)
NAME BlendEnable −3DAPI blend enable
USAGEBlendEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable color blending. See the GL_BLEND description on the OpenGL glEnable manual page for
details. See the D3DRS_ALPHABLENDENABLE render state description for DirectX 9.
The standard reset callback sets the BlendEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc, BlendFuncSeparate,
BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 875
BLENDEQUATION(CgFX) CgFX States BLENDEQUATION(CgFX)
NAME BlendEquation −3DAPI blend equation
USAGEBlendEquation = int(mode)
VALID ENUMERANTS
mode: FuncAdd, FuncSubtract, FuncReverseSubtract, Add, Subtract, ReverseSubtract, Min, Max, LogicOp
DESCRIPTION
Specify the RGB and alpha blend equation together.See the OpenGL glBlendEquation manual page for
details. See the D3DRS_BLENDOP render state description for DirectX 9.
The standard reset callback sets the BlendEquation state to int(Add).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquationSeparate, BlendFunc, BlendFuncSeparate,
BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 876
BLENDEQUATIONSEPARATE(CgFX) CgFX States BLENDEQUATIONSEPARATE(CgFX)
NAME BlendEquationSeparate −3DAPI blend equation separate
USAGEBlendEquationSeparate = int2(modeRGB, modeAlpha)
VALID ENUMERANTS
modeRGB, modeAlpha: FuncAdd, FuncSubtract, FuncReverseSubtract, Add, Subtract, ReverseSubtract,
Min, Max, LogicOp
DESCRIPTION
Specify the RGB and alpha blend equation separately.See the OpenGL glBlendEquationSeparate manual
page for details. See the D3DRS_BLENDOP render state description for DirectX 9.
The standard reset callback sets the BlendEquationSeparate state to int2(FuncAdd, FuncAdd).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendFunc, BlendFuncSeparate, BlendOp,
DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 877
BLENDFUNC(CgFX) CgFX States BLENDFUNC(CgFX)
NAME BlendFunc −3DAPI blend function
USAGEBlendFunc = int2(sfactor,dfactor)
VALID ENUMERANTS
sfactor,dfactor: Zero, One, DestColor,OneMinusDestColor,InvDestColor,SrcAlpha, OneMinusSrcAlpha,
InvSrcAlpha, DstAlpha, OneMinusDstAlpha, InvDestAlpha, SrcAlphaSaturate, SrcAlphaSat, SrcColor,
OneMinusSrcColor,InvSrcColor,ConstantColor,BlendFactor,OneMinusConstantColor,InvBlendFactor,
ConstantAlpha, OneMinusConstantAlpha
DESCRIPTION
Specify the source and destination blending functions. See the OpenGL glBlendFunc manual page for
details. See the D3DRS_SRCBLEND and D3DRS_DESTBLEND render state descriptions for DirectX 9.
The standard reset callback sets the BlendFunc state to int2(One, Zero).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend,
BlendOpAlpha, SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 878
BLENDFUNCSEPARATE(CgFX) CgFX States BLENDFUNCSEPARATE(CgFX)
NAME BlendFuncSeparate −3DAPI blend function separate
USAGEBlendFuncSeparate = int4(srcRGB, dstRGB, srcAlpha, dstAlpha)
VALID ENUMERANTS
srcRGB, dstRGB, srcAlpha, dstAlpha: Zero, One, DestColor,OneMinusDestColor,InvDestColor,
SrcAlpha, OneMinusSrcAlpha, InvSrcAlpha, DstAlpha, OneMinusDstAlpha, InvDestAlpha,
SrcAlphaSaturate, SrcAlphaSat, SrcColor,OneMinusSrcColor,InvSrcColor,ConstantColor,BlendFactor,
OneMinusConstantColor,InvBlendFactor,ConstantAlpha, OneMinusConstantAlpha
DESCRIPTION
Specify the source and destination blending functions. See the OpenGL glBlendFuncSeparate manual page
for details. See the D3DRS_SEPARATEALPHABLENDENABLE, D3DRS_SRCBLEND,
D3DRS_DESTBLEND, D3DRS_SRCBLENDALPHA, and D3DRS_DESTBLENDALPHA render state
descriptions for DirectX 9.
The standard reset callback sets the BlendFuncSeparate state to int4(One, Zero, One, Zero).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 879
BLENDOP(CgFX) CgFX States BLENDOP(CgFX)
NAME BlendOp −3DAPI blend operator
USAGEBlendOp = int(func)
VALID ENUMERANTS
func: FuncAdd, FuncSubtract, FuncReverseSubtract, Add, Subtract, ReverseSubtract, Min, Max, LogicOp
DESCRIPTION
Specify the blending equation. See the OpenGL glBlendEquation manual page for details. See the
D3DRS_BLENDOP render state description for DirectX 9.
The standard reset callback sets the BlendOp state to int(FuncAdd).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha,
SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 880
BLENDOPALPHA(CgFX) CgFX States BLENDOPALPHA(CgFX)
NAME BlendOpAlpha −3DAPI blend operator alpha
USAGEBlendOpAlpha = int(blendop)
VALID ENUMERANTS
blendop: Add, Subtract, RevSubtract, Min, Max
DESCRIPTION
Set the Direct3D separate alpha blending operation. See the D3DRS_BLENDOPALPHA render state
description for DirectX 9.
The standard reset callback sets the BlendOpAlpha state to int(Add).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BlendOp, AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate,
BlendFunc, BlendFuncSeparate, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend,
SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 881
BORDERCOLORI(CgFX) CgFX States BORDERCOLORI(CgFX)
NAME BorderColori −3DAPI texture border color
USAGEBorderColor[i] = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Set the Direct3D sampler border color for texture unit i,where iis in the range 0−15. See sampler state
BorderColor for details.
The standard reset callback sets the BorderColor[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BorderColor
perl v5.10.0 Cg Toolkit 3.0 882
CLEARCOLOR(CgFX) CgFX States CLEARCOLOR(CgFX)
NAME ClearColor −3DAPI clear color
USAGEClearColor = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the values used by to clear the color buffers. See the OpenGL glClearColor manual page for
details. See the D3DCLEAR_TARGET flag description for the IDirect3DDevice9::Clear method.
The standard reset callback sets the ClearColor state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, ClearStencil
perl v5.10.0 Cg Toolkit 3.0 883
CLEARDEPTH(CgFX) CgFX States CLEARDEPTH(CgFX)
NAME ClearDepth −3DAPI clear depth
USAGEClearDepth = float(z)
VALID ENUMERANTS
z: floating point value
DESCRIPTION
Specify the value used by to clear the depth buffer.See the OpenGL glClearDepth manual page for details.
See the D3DCLEAR_ZBUFFER flag description for the IDirect3DDevice9::Clear method.
The standard reset callback sets the ClearDepth state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearColor,ClearStencil
perl v5.10.0 Cg Toolkit 3.0 884
CLEARSTENCIL(CgFX) CgFX States CLEARSTENCIL(CgFX)
NAME ClearStencil −3DAPI clear stencil
USAGEClearStencil = int(val)
VALID ENUMERANTS
val: integer value
DESCRIPTION
Specify the value used by to clear the stencil buffer.See the OpenGL glClearStencil manual page for
details. See the D3DCLEAR_STENCIL flag description for the IDirect3DDevice9::Clear method.
The standard reset callback sets the ClearStencil state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask, StencilMaskSeparate,
StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, ClearColor,ClearDepth, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 885
CLIPPLANE(CgFX) CgFX States CLIPPLANE(CgFX)
NAME ClipPlane −3DAPI clip plane
USAGEClipPlane[i] = float4(a, b, c, d)
VALID ENUMERANTS
a, b, c, d: floating point values
DESCRIPTION
Specify an clip plane. See the OpenGL glClipPlane manual page for details. See the
IDirect3DDevice9::SetClipPlane method for details.
The standard reset callback sets the ClipPlane[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClipPlaneEnable, Clipping
perl v5.10.0 Cg Toolkit 3.0 886
CLIPPLANEENABLE(CgFX) CgFX States CLIPPLANEENABLE(CgFX)
NAME ClipPlaneEnable −3DAPI clip plane enable
USAGEClipPlaneEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable user-defined clipping planes. See the OpenGL glClipPlane manual page for details. See the
D3DRS_CLIPPLANEENABLE render state description for DirectX 9.
The standard reset callback sets the ClipPlaneEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClipPlane, Clipping
perl v5.10.0 Cg Toolkit 3.0 887
CLIPPING(CgFX) CgFX States CLIPPING(CgFX)
NAME Clipping −3DAPI clipping
USAGEClipping = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable Direct3D primitive clipping. See the D3DRS_CLIPPING render state description for
DirectX 9.
The standard reset callback sets the Clipping state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClipPlane, ClipPlaneEnable
perl v5.10.0 Cg Toolkit 3.0 888
COLORLOGICOPENABLE(CgFX) CgFX States COLORLOGICOPENABLE(CgFX)
NAME ColorLogicOpEnable −3DAPI color logic operation enable
USAGEColorLogicOpEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL logical pixel operations. See the GL_COLOR_LOGIC_OP description on the
OpenGL glEnable manual page for details.
The standard reset callback sets the ColorLogicOpEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LogicOp, LogicOpEnable
perl v5.10.0 Cg Toolkit 3.0 889
COLORMASK(CgFX) CgFX States COLORMASK(CgFX)
NAME ColorMask −3DAPI color mask
USAGEColorMask = bool4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:true, false
DESCRIPTION
Enable/disable writing to color components in the frame buffer.See the OpenGL glColorMask manual
page for details. See the D3DRS_COLORWRITEENABLE1 render state description for DirectX 9.
The standard reset callback sets the ColorMask state to bool4(true, true, true, true).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
DepthMask, StencilMask
perl v5.10.0 Cg Toolkit 3.0 890
COLORMATERIAL(CgFX) CgFX States COLORMATERIAL(CgFX)
NAME ColorMaterial −3DAPI color material
USAGEColorMaterial = int2(sides, mat)
VALID ENUMERANTS
sides: Front, Back, FrontAndBack mat: Emission, Emissive,Ambient, Diffuse, Specular,
AmbientAndDiffuse
DESCRIPTION
Specify which material parameters track the current color.See the OpenGL glColorMaterial manual page
for details. See the D3DRS_ALPHABLENDENABLE render state description for DirectX 9.
The standard reset callback sets the ColorMaterial state to int2(FrontAndBack, AmbientAndDiffuse).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, DiffuseMaterialSource, EmissiveMaterialSource, MaterialAmbient,
MaterialDiffuse, MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 891
COLORMATRIX(CgFX) CgFX States COLORMATRIX(CgFX)
NAME ColorMatrix −3DAPI color matrix
USAGEColorMatrix = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the color matrix. See the GL_COLOR description on the OpenGL glMatrixMode manual
page for details.
The standard reset callback sets the ColorMatrix state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension ARB_imaging.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ColorTransform
perl v5.10.0 Cg Toolkit 3.0 892
COLORTRANSFORM(CgFX) CgFX States COLORTRANSFORM(CgFX)
NAME ColorTransform −3DAPI color transform
USAGEColorTransform[i] = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the color matrix. See the GL_COLOR description on the OpenGL glMatrixMode manual
page for details.
The standard reset callback sets the ColorTransform[i] state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension ARB_imaging.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ColorMatrix
perl v5.10.0 Cg Toolkit 3.0 893
COLORVERTEX(CgFX) CgFX States COLORVERTEX(CgFX)
NAME ColorVertex −3DAPI color vertex
USAGEColorVertex=bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable material parameter tracking of the current color.See the GL_COLOR_MATERIAL
description on the OpenGL glEnable manual page for details. See the D3DRS_COLORVERTEX render
state description for DirectX 9.
The standard reset callback sets the ColorVertexstate to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorMaterial, AmbientMaterialSource, DiffuseMaterialSource, EmissiveMaterialSource,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 894
COLORWRITEENABLE(CgFX) CgFX States COLORWRITEENABLE(CgFX)
NAME ColorWriteEnable −3DAPI color write enable
USAGEColorWriteEnable = bool4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:true, false
DESCRIPTION
Enable/disable writing of frame buffer color components. See the OpenGL glColorMask manual page for
details. See the D3DRS_COLORWRITEENABLE render state description for DirectX 9.
The standard reset callback sets the ColorWriteEnable state to bool4(true, true, true, true).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BlendColor,ClearColor,ColorArg0, ColorArg1, ColorArg2, ColorLogicOpEnable, ColorMask,
ColorMaterial, ColorMatrix, ColorOp, ColorTransform, ColorVertex, ColorWriteEnable1,
ColorWriteEnable2, ColorWriteEnable3
perl v5.10.0 Cg Toolkit 3.0 895
COLORWRITEENABLE1(CgFX) CgFX States COLORWRITEENABLE1(CgFX)
NAME ColorWriteEnable1 −3DAPI color write enable1
USAGEColorWriteEnable1 = bool4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:true, false
DESCRIPTION
Enable/disable writing of frame buffer color components. See the D3DRS_COLORWRITEENABLE1
render state description for DirectX 9.
The standard reset callback sets the ColorWriteEnable1 state to bool4(true, true, true, true).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorWriteEnable, ColorWriteEnable2, ColorWriteEnable3, BlendColor,ClearColor,ColorArg0,
ColorArg1, ColorArg2, ColorLogicOpEnable, ColorMask, ColorMaterial, ColorMatrix, ColorOp,
ColorTransform, ColorVertex
perl v5.10.0 Cg Toolkit 3.0 896
COLORWRITEENABLE2(CgFX) CgFX States COLORWRITEENABLE2(CgFX)
NAME ColorWriteEnable2 −3DAPI color write enable2
USAGEColorWriteEnable2 = bool4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:true, false
DESCRIPTION
Enable/disable writing of frame buffer color components. See the D3DRS_COLORWRITEENABLE2
render state description for DirectX 9.
The standard reset callback sets the ColorWriteEnable2 state to bool4(true, true, true, true).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorWriteEnable, ColorWriteEnable1, ColorWriteEnable3, BlendColor,ClearColor,ColorArg0,
ColorArg1, ColorArg2, ColorLogicOpEnable, ColorMask, ColorMaterial, ColorMatrix, ColorOp,
ColorTransform, ColorVertex
perl v5.10.0 Cg Toolkit 3.0 897
COLORWRITEENABLE3(CgFX) CgFX States COLORWRITEENABLE3(CgFX)
NAME ColorWriteEnable3 −3DAPI color write enable3
USAGEColorWriteEnable3 = bool4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:true, false
DESCRIPTION
Enable/disable writing of frame buffer color components. See the D3DRS_COLORWRITEENABLE3
render state description for DirectX 9.
The standard reset callback sets the ColorWriteEnable3 state to bool4(true, true, true, true).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorWriteEnable, ColorWriteEnable1, ColorWriteEnable2, BlendColor,ClearColor,ColorArg0,
ColorArg1, ColorArg2, ColorLogicOpEnable, ColorMask, ColorMaterial, ColorMatrix, ColorOp,
ColorTransform, ColorVertex
perl v5.10.0 Cg Toolkit 3.0 898
CULLFACE(CgFX) CgFX States CULLFACE(CgFX)
NAME CullFace −3DAPI cull face
USAGECullFace = int(face)
VALID ENUMERANTS
face: Front, Back, FrontAndBack
DESCRIPTION
Specify orientation of candidates for facet culling. See the OpenGL glCullFace manual page for details.
The standard reset callback sets the CullFace state to int(Back).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CullFaceEnable, CullMode, FrontFace
perl v5.10.0 Cg Toolkit 3.0 899
CULLFACEENABLE(CgFX) CgFX States CULLFACEENABLE(CgFX)
NAME CullFaceEnable −3DAPI cull face enable
USAGECullFaceEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL face culling. See the GL_CULL_FACEdescription on the OpenGL glEnable
manual page for details.
The standard reset callback sets the CullFaceEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CullFace, CullMode, FrontFace
perl v5.10.0 Cg Toolkit 3.0 900
CULLMODE(CgFX) CgFX States CULLMODE(CgFX)
NAME CullMode −3DAPI cull mode
USAGECullMode = int(face)
VALID ENUMERANTS
face: Front, Back, FrontAndBack
DESCRIPTION
Specify orientation of candidates for facet culling. See the OpenGL glCullFace manual page for details.
The standard reset callback sets the CullMode state to int(Back).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CullFace, CullFaceEnable, FrontFace
perl v5.10.0 Cg Toolkit 3.0 901
DEPTHBIAS(CgFX) CgFX States DEPTHBIAS(CgFX)
NAME DepthBias −3DAPI depth bias
USAGEDepthBias = float(bias)
VALID ENUMERANTS
bias: floating point value
DESCRIPTION
Specify the constant offset used to compute a depth offset for polygons. See the units parameter
description on the OpenGL glPolygonOffset manual page for details. See the D3DRS_DEPTHBIAS
render state description for DirectX 9.
The standard reset callback sets the DepthBias state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
0penGL 1.1
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PolygonOffset, SlopScaleDepthBias
perl v5.10.0 Cg Toolkit 3.0 902
DEPTHBOUNDS(CgFX) CgFX States DEPTHBOUNDS(CgFX)
NAME DepthBounds −3DAPI depth bounds
USAGEDepthBounds = float2(zmin, zmax)
VALID ENUMERANTS
zmin, zmax: floating point values
DESCRIPTION
Specify the minimum and maximum values for depth bounds testing. See the OpenGL
EXT_depth_bounds_test specification for details.
The standard reset callback sets the DepthBounds state to float2(0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension EXT_depth_bounds_test.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
DepthBoundsEnable
perl v5.10.0 Cg Toolkit 3.0 903
DEPTHBOUNDSENABLE(CgFX) CgFX States DEPTHBOUNDSENABLE(CgFX)
NAME DepthBoundsEnable −3DAPI depth bounds enable
USAGEDepthBoundsEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL depth bounds testing. See the OpenGL EXT_depth_bounds_test specification for
details.
The standard reset callback sets the DepthBoundsEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension EXT_depth_bounds_test.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthClampEnable, DepthFunc, DepthMask, DepthRange,
DepthTestEnable, SlopScaleDepthBias
perl v5.10.0 Cg Toolkit 3.0 904
DEPTHCLAMPENABLE(CgFX) CgFX States DEPTHCLAMPENABLE(CgFX)
NAME DepthClampEnable −3DAPI depth clamp enable
USAGEDepthClampEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL depth clamping. See the OpenGL NV_depth_clamp specification for details.
The standard reset callback sets the DepthClampEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension NV_depth_clamp.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthFunc, DepthMask, DepthRange,
DepthTestEnable, SlopScaleDepthBias
perl v5.10.0 Cg Toolkit 3.0 905
DEPTHFUNC(CgFX) CgFX States DEPTHFUNC(CgFX)
NAME DepthFunc −3DAPI depth func
USAGEDepthFunc = int(func)
VALID ENUMERANTS
func: Never, Less, LEqual, LessEqual, Equal, Greater,NotEqual, GEqual, GreaterEqual, Always
DESCRIPTION
Specify the function used for depth buffer comparisons. See the OpenGL glDepthFunc manual page for
details. See the D3DRS_ZFUNC render state description for DirectX 9.
The standard reset callback sets the DepthFunc state to int(Less).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthTestEnable,
DepthMask, DepthRange, DepthTestEnable, SlopScaleDepthBias, ZEnable, ZFunc, ZWriteEnable
perl v5.10.0 Cg Toolkit 3.0 906
DEPTHMASK(CgFX) CgFX States DEPTHMASK(CgFX)
NAME DepthMask −3DAPI depth mask
USAGEDepthMask = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Specify whether the depth buffer is enabled for writing. See the OpenGL glDepthMask manual page for
details. See the D3DRS_ZWRITEENABLE render state description for DirectX 9.
The standard reset callback sets the DepthMask state to bool(true).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorMask, StencilMask
perl v5.10.0 Cg Toolkit 3.0 907
DEPTHRANGE(CgFX) CgFX States DEPTHRANGE(CgFX)
NAME DepthRange −3DAPI depth range
USAGEDepthRange = float2(near,far)
VALID ENUMERANTS
near,far: floating point values
DESCRIPTION
Specify the mapping of the near and far clipping planes to windowcoordinates. See the OpenGL
glDepthRange manual page for details. See the IDirect3DDevice9::SetViewport method for details.
The standard reset callback sets the DepthRange state to float2(0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthFunc, DepthMask,
DepthTestEnable
perl v5.10.0 Cg Toolkit 3.0 908
DEPTHTESTENABLE(CgFX) CgFX States DEPTHTESTENABLE(CgFX)
NAME DepthTestEnable −3DAPI depth test enable
USAGEDepthTestEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable depth testing. See the GL_DEPTH_TEST description on the OpenGL glEnable manual page
for details. See the D3DRS_ZENABLE render state description for DirectX 9.
The standard reset callback sets the DepthTestEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthFunc, DepthMask,
DepthRange, SlopScaleDepthBias, ZEnable, ZFunc, ZWriteEnable
perl v5.10.0 Cg Toolkit 3.0 909
DESTBLEND(CgFX) CgFX States DESTBLEND(CgFX)
NAME DestBlend −3DAPI dest blend
USAGEDestBlend = int(dfactor)
VALID ENUMERANTS
dfactor: Zero, One, DestColor,InvDestColor,SrcAlpha, InvSrcAlpha, DstAlpha, InvDestAlpha,
SrcAlphaSat, SrcColor,InvSrcColor,BlendFactor,InvBlendFactor
DESCRIPTION
Specify the destination blend factor.See the OpenGL glBlendFunc manual page for details. See the
D3DRS_DESTBLENDALPHA render state description for DirectX 9.
The standard reset callback sets the DestBlend state to int(Zero).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, IndexedVertexBlendEnable, SrcBlend, VertexBlend, BlendOpAlpha,
SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 910
DESTBLENDALPHA(CgFX) CgFX States DESTBLENDALPHA(CgFX)
NAME DestBlendAlpha −3DAPI destination alpha blending type
USAGEDestBlendAlpha = int(blend)
VALID ENUMERANTS
blend: Zero, One, DestColor,InvDestColor,SrcAlpha, InvSrcAlpha, DstAlpha, InvDestAlpha,
SrcAlphaSat, SrcColor,InvSrcColor,BlendFactor,InvBlendFactor
DESCRIPTION
Set the Direct3D separate alpha blending destination blend type. See the D3DRS_DESTBLENDALPHA
render state description for DirectX 9.
The standard reset callback sets the DestBlendAlpha state to int(Zero).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend,
BlendOpAlpha, SrcBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 911
DIFFUSEMATERIALSOURCE(CgFX) CgFX States DIFFUSEMATERIALSOURCE(CgFX)
NAME DiffuseMaterialSource −3DAPI diffuse material source
USAGEDiffuseMaterialSource = int(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable front and back diffuse color material. See the GL_DIFFUSE description on the OpenGL
glColorMaterial manual page for details. See the D3DRS_DIFFUSEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the DiffuseMaterialSource state to int(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, EmissiveMaterialSource, MaterialAmbient, MaterialDiffuse,
MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 912
DITHERENABLE(CgFX) CgFX States DITHERENABLE(CgFX)
NAME DitherEnable −3DAPI dither enable
USAGEDitherEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable dithering. See the GL_DITHER description on the OpenGL glEnable manual page for
details. See the D3DRS_DITHERENABLE render state description for DirectX 9.
The standard reset callback sets the DitherEnable state to bool(true).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearColor,ColorWriteEnable
perl v5.10.0 Cg Toolkit 3.0 913
EMISSIVEMATERIALSOURCE(CgFX) CgFX States EMISSIVEMATERIALSOURCE(CgFX)
NAME EmissiveMaterialSource −3DAPI emissive material source
USAGEEmissiveMaterialSource = int(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable front and back emmisive color material. See the GL_EMISSION description on the OpenGL
glColorMaterial manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the EmissiveMaterialSource state to int(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, MaterialAmbient, MaterialDiffuse,
MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 914
FILLMODE(CgFX) CgFX States FILLMODE(CgFX)
NAME FillMode −3DAPI fill mode
USAGEFillMode = int(mode)
VALID ENUMERANTS
mode: Solid, Wireframe, Point
DESCRIPTION
Specify the rasterization mode for front facing polygons. See the OpenGL glPolygonMode manual page
for details. See the D3DRS_FILLMODE render state description for DirectX 9.
The standard reset callback sets the FillMode state to int(Solid).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PolygonMode
perl v5.10.0 Cg Toolkit 3.0 915
FOGCOLOR(CgFX) CgFX States FOGCOLOR(CgFX)
NAME FogColor −3DAPI fog color
USAGEFogColor = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the fog color.See the GL_FOG_COLOR description on the OpenGL glFog manual page for details.
See the D3DRS_FOGCOLOR render state description for DirectX 9.
The standard reset callback sets the FogColor state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 916
FOGCOORDSRC(CgFX) CgFX States FOGCOORDSRC(CgFX)
NAME FogCoordSrc −3DAPI fog coord src
USAGEFogCoordSrc = int(src)
VALID ENUMERANTS
GL src: FragmentDepth, FogCoord D3D9 src: None, Exp, Exp2, Linear
DESCRIPTION
Specify whether to use fragment depth or a per-vertexfog coordinate in fog computations. See the
GL_FOG_COORDINATE_SOURCE_EXT description in the OpenGL EXT_fog_coord specification for
details. See the D3DRS_FOGVERTEXMODE render state description for DirectX 9.
The standard reset callback sets the FogCoordSrc state to int(FragmentDepth).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.4 or support for extension EXT_fog_coord.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 917
FOGDENSITY(CgFX) CgFX States FOGDENSITY(CgFX)
NAME FogDensity −3DAPI fog density
USAGEFogDensity = float(density)
VALID ENUMERANTS
density: floating point value
DESCRIPTION
Specify the fog density to use in exponential fog equations. See the GL_FOG_DENSITY description on the
OpenGL glFog manual page for details. See the D3DRS_FOGDENSITY render state description for
DirectX 9.
The standard reset callback sets the FogDensity state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 918
FOGDISTANCEMODE(CgFX) CgFX States FOGDISTANCEMODE(CgFX)
NAME FogDistanceMode −3DAPI fog distance mode
USAGEFogDistanceMode = int(mode)
VALID ENUMERANTS
mode: EyeRadial, EyePlane, EyePlaneAbsolute
DESCRIPTION
Specify howOpenGL computes the distance used when computing the fog factor.See the
GL_FOG_DISTANCE_MODE_NV description the OpenGL OpenGL NV_fog_distance specification for
details.
The standard reset callback sets the FogDistanceMode state to int(EyePlaneAbsolute).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension NV_fog_distance.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogEnable, FogEnd, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 919
FOGENABLE(CgFX) CgFX States FOGENABLE(CgFX)
NAME FogEnable −3DAPI fog enable
USAGEFogEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable fogging. See the GL_FOG description on the OpenGL glEnable manual page for details.
See the D3DRS_FOGENABLE render state description for DirectX 9.
The standard reset callback sets the FogEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnd, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 920
FOGEND(CgFX) CgFX States FOGEND(CgFX)
NAME FogEnd −3DAPI fog end
USAGEFogEnd = float(end)
VALID ENUMERANTS
end: floating point value
DESCRIPTION
Specify the far distance used in the linear fog equation. See the GL_FOG_END description on the OpenGL
glFog manual page for details. See the D3DRS_FOGEND render state description for DirectX 9.
The standard reset callback sets the FogEnd state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogMode, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 921
FOGMODE(CgFX) CgFX States FOGMODE(CgFX)
NAME FogMode −3DAPI fog mode
USAGEFogMode = int(mode)
VALID ENUMERANTS
mode: Linear,Exp, Exp2
DESCRIPTION
Specify the equation used to compute the fog blend factor.See the GL_FOG_MODE description on the
OpenGL glFog manual page for details. See the D3DRS_FOGTABLEMODE render state description for
DirectX 9.
The standard reset callback sets the FogMode state to int(Exp).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogStart, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 922
FOGSTART(CgFX) CgFX States FOGSTART(CgFX)
NAME FogStart −3DAPI fog start
USAGEFogStart = float(start)
VALID ENUMERANTS
start: floating point value
DESCRIPTION
Specify the near distance used in the linear fog equation. See the GL_FOG_START description on the
OpenGL glFog manual page for details. See the D3DRS_FOGSTARTrender state description for DirectX
9.
The standard reset callback sets the FogStart state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogTableMode,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 923
FOGTABLEMODE(CgFX) CgFX States FOGTABLEMODE(CgFX)
NAME FogTableMode −3DAPI fog table mode
USAGEFogTableMode = int(mode)
VALID ENUMERANTS
mode: Linear,Exp, Exp2
DESCRIPTION
Specify the equation used to compute the fog blend factor.See the GL_FOG_MODE description on the
OpenGL glFog manual page for details. See the D3DRS_FOGTABLEMODE render state description for
DirectX 9.
The standard reset callback sets the FogTableMode state to int(Exp).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart,
FogVertexMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 924
FOGVERTEXMODE(CgFX) CgFX States FOGVERTEXMODE(CgFX)
NAME FogVertexMode −3DAPI fog vertexmode
USAGEFogVertexMode = int(mode)
VALID ENUMERANTS
mode: None, Exp, Exp2, Linear
DESCRIPTION
Specify whether to use the fog coordinate or fragment depth as distance value in the fog computation.
See the GL_FOG_COORDINATE_SOURCE description on the OpenGL glFog manual page for details. See
the D3DRS_FOGVERTEXMODE render state description for DirectX 9.
The standard reset callback sets the FogVertexMode state to int(GL_FRAGMENT_DEPTH_EXT).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.4 or support for extension EXT_fog_coord.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart,
FogTableMode, RangeFogEnable
perl v5.10.0 Cg Toolkit 3.0 925
FRAGMENTENVPARAMETER(CgFX) CgFX States FRAGMENTENVPARAMETER(CgFX)
NAME FragmentEnvParameter −3DAPI fragment envparameter
USAGEFragmentEnvParameter[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Set fragment program environment parameter.See the OpenGL glProgramEnvParameter4fvARB manual
page for details.
The standard reset callback sets the FragmentEnvParameter[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter,PixelShaderConstant,
PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4
perl v5.10.0 Cg Toolkit 3.0 926
FRAGMENTLOCALPARAMETER(CgFX) CgFX States FRAGMENTLOCALPARAMETER(CgFX)
NAME FragmentLocalParameter −3DAPI fragment local parameter
USAGEFragmentLocalParameter[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Set fragment program local parameter.See the OpenGL glProgramLocalParameter4fvARB manual page
for details.
The standard reset callback sets the FragmentLocalParameter[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FragmentEnvParameter,VertexEnvParameter,VertexLocalParameter,PixelShaderConstant,
PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4
perl v5.10.0 Cg Toolkit 3.0 927
FRAGMENTPROGRAM(CgFX) CgFX States FRAGMENTPROGRAM(CgFX)
NAME FragmentProgram −3DAPI fragment program
USAGEFragmentProgram = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
prog: Null
DESCRIPTION
Compile a fragment program. See the specification of the OpenGL fragment profile for details. See the
specification of the Direct3D fragment shaders for details.
The standard reset callback sets the FragmentProgram state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram,
GeometryShader,PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader
perl v5.10.0 Cg Toolkit 3.0 928
FRONTFACE(CgFX) CgFX States FRONTFACE(CgFX)
NAME FrontFace −3DAPI front face
USAGEFrontFace = int(windingOrder)
VALID ENUMERANTS
windingOrder: CW,CCW
DESCRIPTION
Specifies the winding order for front-facing polygons. See the OpenGL glFrontFace manual page for
details.
The standard reset callback sets the FrontFace state to int(CCW).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CullFace, CullFaceEnable, CullMode
perl v5.10.0 Cg Toolkit 3.0 929
GEOMETRYPROGRAM(CgFX) CgFX States GEOMETRYPROGRAM(CgFX)
NAME GeometryProgram −3DAPI geometry program
USAGEGeometryProgram = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
prog: Null
DESCRIPTION
Compile a geometry program. See the specification of the OpenGL geomentry profile for details. See the
specification of the Direct3D 10 geomentry shaders for details.
The standard reset callback sets the GeometryProgram state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 10
SEE ALSO
FragmentProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram,
GeometryShader,PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader
perl v5.10.0 Cg Toolkit 3.0 930
GEOMETRYSHADER(CgFX) CgFX States GEOMETRYSHADER(CgFX)
NAME GeometryShader −3DAPI geometry shader
USAGEGeometryShader = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
shader: Null
DESCRIPTION
Compile a geometry shader.See the specification of the OpenGL geometry profile for details. See the
specification of the Direct3D 10 geometry shaders for details.
The standard reset callback sets the GeometryShader state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 10
SEE ALSO
PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader,FragmentProgram,
GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram
perl v5.10.0 Cg Toolkit 3.0 931
INDEXEDVERTEXBLENDENABLE(CgFX) CgFX States INDEXEDVERTEXBLENDENABLE(CgFX)
NAME IndexedVertexBlendEnable −3DAPI indexedvertexblend enable
USAGEIndexedVertexBlendEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable Direct3D indexedvertexblending. See the D3DRS_INDEXEDVERTEXBLENDENABLE
render state description for DirectX 9.
The standard reset callback sets the IndexedVertexBlendEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, SrcBlend, VertexBlend, BlendOpAlpha, SrcBlendAlpha,
DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 932
LASTPIXEL(CgFX) CgFX States LASTPIXEL(CgFX)
NAME LastPixel −3DAPI last pixel
USAGELastPixel = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable drawing of the last pixel in a line. See the D3DRS_LASTPIXEL render state description
for DirectX 9.
The standard reset callback sets the LastPixel state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FillMode, PolygonMode, DitherEnable
perl v5.10.0 Cg Toolkit 3.0 933
LIGHTAMBIENT(CgFX) CgFX States LIGHTAMBIENT(CgFX)
NAME LightAmbient −3DAPI light ambient
USAGELightAmbient[i] = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the ambient intensity of the light. See the GL_AMBIENT description on the OpenGL glLight
manual page for details. See the Ambient member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightAmbient[i] state to float4(0, 0, 0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation, LightDiffuse,
LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 934
LIGHTATTENUATION0(CgFX) CgFX States LIGHTATTENUATION0(CgFX)
NAME LightAttenuation0 −3DAPI light attenuation0
USAGELightAttenuation0[i] = float(constant_attenuation)
VALID ENUMERANTS
constant_attenuation: floating point value
DESCRIPTION
Specify the constant light attenuation factor.See the GL_CONSTANT_ATTENUATION description on the
OpenGL glLight manual page for details. See the Attenuation0 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightAttenuation0[i] state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation1, LightAttenuation2, LightConstantAttenuation, LightDiffuse,
LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 935
LIGHTATTENUATION1(CgFX) CgFX States LIGHTATTENUATION1(CgFX)
NAME LightAttenuation1 −3DAPI light attenuation1
USAGELightAttenuation1[i] = float(linear_attenuation)
VALID ENUMERANTS
linear_attenuation: floating point value
DESCRIPTION
Specify the linear light attenuation factor.See the GL_LINEAR_ATTENUATION description on the OpenGL
glLight manual page for details. See the Attenuation1 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightAttenuation1[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation2, LightConstantAttenuation, LightDiffuse,
LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 936
LIGHTATTENUATION2(CgFX) CgFX States LIGHTATTENUATION2(CgFX)
NAME LightAttenuation2 −3DAPI light attenuation2
USAGELightAttenuation2[i] = float(quadratic_attenuation)
VALID ENUMERANTS
quadratic_attenuation: floating point value
DESCRIPTION
Specify the quadratic light attenuation factor.See the GL_QUADRATIC_ATTENUATION description on the
OpenGL glLight manual page for details. See the Attenuation2 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightAttenuation2[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightConstantAttenuation, LightDiffuse,
LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 937
LIGHTCONSTANTATTENUATION(CgFX) CgFX States LIGHTCONSTANTATTENUATION(CgFX)
NAME LightConstantAttenuation −3DAPI light constant attenuation
USAGELightConstantAttenuation[i] = float(constant_attenuation)
VALID ENUMERANTS
constant_attenuation: floating point value
DESCRIPTION
Specify the constant light attenuation factor.See the GL_CONSTANT_ATTENUATION description on the
OpenGL glLight manual page for details. See the Attenuation0 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightConstantAttenuation[i] state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightDiffuse, LightDirection,
LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient, LightModelColorControl,
LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi, LightPosition,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 938
LIGHTDIFFUSE(CgFX) CgFX States LIGHTDIFFUSE(CgFX)
NAME LightDiffuse −3DAPI light diffuse
USAGELightDiffuse[i] = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the diffuse intensity of the light. See the GL_DIFFUSE description on the OpenGL glLight manual
page for details. See the Diffuse member of the D3DLIGHT9 argument to IDirect3DDevice9::SetLight
method.
The standard reset callback sets the LightDiffuse[i] state to float4(1, 1, 1, 1) when i is 0 and float4(0, 0, 0,
1) otherwise.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 939
LIGHTDIRECTION(CgFX) CgFX States LIGHTDIRECTION(CgFX)
NAME LightDirection −3DAPI light direction
USAGELightDirection[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Specify the lights direction. See the GL_SPOT_DIRECTION description on the OpenGL glLight manual
page for details. See the Direction member of the D3DLIGHT9 argument to IDirect3DDevice9::SetLight
method.
The standard reset callback sets the LightDirection[i] state to float4(0, 0, −1, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 940
LIGHTENABLE(CgFX) CgFX States LIGHTENABLE(CgFX)
NAME LightEnable −3DAPI light enable
USAGELightEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable a light for use in the lighting computations. See the GL_LIGHTidescription on the
OpenGL glEnable manual page for details. See the IDirect3DDevice9::SetLight method for details.
The standard reset callback sets the LightEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Lighting, LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2,
LightConstantAttenuation, LightDiffuse, LightDirection, LightFalloff, LightLinearAttenuation,
LightModelAmbient, LightModelColorControl, LightModelLocalViewerEnable,
LightModelTwoSideEnable, LightPhi, LightPosition, LightQuadraticAttenuation, LightRange,
LightSpecular,LightSpotCutoff, LightSpotDirection, LightSpotExponent, LightTheta, LightType,
LightingEnable
perl v5.10.0 Cg Toolkit 3.0 941
LIGHTFALLOFF(CgFX) CgFX States LIGHTFALLOFF(CgFX)
NAME LightFalloff −3DAPI light falloff
USAGELightFalloff[i] = float(angle)
VALID ENUMERANTS
angle: floating point value
DESCRIPTION
Specify the lights maximum spread angle. See the GL_SPOT_CUTOFF description on the OpenGL glLight
manual page for details. See the Falloffmember of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightFalloff[i] state to float(180).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 942
LIGHTLINEARATTENUATION(CgFX) CgFX States LIGHTLINEARATTENUATION(CgFX)
NAME LightLinearAttenuation −3DAPI light linear attenuation
USAGELightLinearAttenuation[i] = float(linear_attenuation)
VALID ENUMERANTS
linear_attenuation: floating point value
DESCRIPTION
Specify the linear light attenuation factor.See the GL_LINEAR_ATTENUATION description on the OpenGL
glLight manual page for details. See the Attenuation1 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightLinearAttenuation[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightModelAmbient, LightModelColorControl,
LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi, LightPosition,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 943
LIGHTMODELAMBIENT(CgFX) CgFX States LIGHTMODELAMBIENT(CgFX)
NAME LightModelAmbient −3DAPI light model ambient
USAGELightModelAmbient = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the ambient intensity of the entire scene. See the GL_LIGHT_MODEL_AMBIENT description on the
OpenGL glLightModel manual page for details. See the D3DRS_AMBIENT render state description for
DirectX 9.
The standard reset callback sets the LightModelAmbient state to float4(0.2, 0.2, 0.2, 1.0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Ambient, LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2,
LightConstantAttenuation, LightDiffuse, LightDirection, LightEnable, LightFalloff,
LightLinearAttenuation, LightModelColorControl, LightModelLocalViewerEnable,
LightModelTwoSideEnable, LightPhi, LightPosition, LightQuadraticAttenuation, LightRange,
LightSpecular,LightSpotCutoff, LightSpotDirection, LightSpotExponent, LightTheta, LightType,
LightingEnable
perl v5.10.0 Cg Toolkit 3.0 944
LIGHTMODELCOLORCONTROL(CgFX) CgFX States LIGHTMODELCOLORCONTROL(CgFX)
NAME LightModelColorControl −3DAPI light model color control
USAGELightModelColorControl = int(control)
VALID ENUMERANTS
control: SingleColor,SeparateSpecular
DESCRIPTION
Specify whether a separate specular color is generated during the lighting computations. See the
GL_LIGHT_MODEL_COLOR_CONTROL description on the OpenGL glLightModel manual page for details.
The standard reset callback sets the LightModelColorControl state to int(SingleColor).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.2 or support for extension EXT_separate_specular_color.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
SpecularEnable, LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2,
LightConstantAttenuation, LightDiffuse, LightDirection, LightEnable, LightFalloff,
LightLinearAttenuation, LightModelAmbient, LightModelLocalViewerEnable,
LightModelTwoSideEnable, LightPhi, LightPosition, LightQuadraticAttenuation, LightRange,
LightSpecular,LightSpotCutoff, LightSpotDirection, LightSpotExponent, LightTheta, LightType,
LightingEnable
perl v5.10.0 Cg Toolkit 3.0 945
LIGHTMODELLOCALVIEWERENABLE(CgFX) CgFX States LIGHTMODELLOCALVIEWERENABLE(CgFX)
NAME LightModelLocalViewerEnable −3DAPI light model local viewer enable
USAGELightModelLocalViewerEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable the OpenGL local viewer lighting model. See the GL_LIGHT_MODEL_LOCAL_VIEWER
description on the OpenGL glLightModel manual page for details.
The standard reset callback sets the LightModelLocalViewerEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelTwoSideEnable, LightPhi, LightPosition,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 946
LIGHTMODELTWOSIDEENABLE(CgFX) CgFX States LIGHTMODELTWOSIDEENABLE(CgFX)
NAME LightModelTwoSideEnable −3DAPI light model twoside enable
USAGELightModelTwoSideEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL two-sided lighting. See the GL_LIGHT_MODEL_TWO_SIDE description on the
OpenGL glLightModel manual page for details.
The standard reset callback sets the LightModelTwoSideEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightPhi, LightPosition,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 947
LIGHTPHI(CgFX) CgFX States LIGHTPHI(CgFX)
NAME LightPhi −3DAPI light phi
USAGELightPhi[i] = float(phi)
VALID ENUMERANTS
phi: floating point value
DESCRIPTION
Specify the outer edge of the spotlight’souter cone. See the Phi member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightPhi[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPosition,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 948
LIGHTPOSITION(CgFX) CgFX States LIGHTPOSITION(CgFX)
NAME LightPosition −3DAPI light position
USAGELightPosition[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Specify the lights position in object coordinates. See the GL_POSITION description on the OpenGL glLight
manual page for details. See the Position member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightPosition[i] state to float4(0, 0, 1, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 949
LIGHTQUADRATICATTENUATION(CgFX) CgFX States LIGHTQUADRATICATTENUATION(CgFX)
NAME LightQuadraticAttenuation −3DAPI light quadratic attenuation
USAGELightQuadraticAttenuation[i] = float(quadratic_attenuation)
VALID ENUMERANTS
quadratic_attenuation: floating point value
DESCRIPTION
Specify the quadric light attenuation factor.See the GL_QUADRATIC_ATTENUATION description on the
OpenGL glLight manual page for details. See the Attenuation2 member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightQuadraticAttenuation[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightRange, LightSpecular,LightSpotCutoff, LightSpotDirection, LightSpotExponent,
LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 950
LIGHTRANGE(CgFX) CgFX States LIGHTRANGE(CgFX)
NAME LightRange −3DAPI light range
USAGELightRange[i] = float(range)
VALID ENUMERANTS
range: floating point value
DESCRIPTION
Specify the maximum distance for which a light has anyeffect. See the Range member of the
D3DLIGHT9 argument to IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightRange[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightSpecular,LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 951
LIGHTSPECULAR(CgFX) CgFX States LIGHTSPECULAR(CgFX)
NAME LightSpecular −3DAPI light specular
USAGELightSpecular[i] = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the specular intensity of the light. See the GL_SPECULAR description on the OpenGL glLight
manual page for details. See the Specular member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightSpecular[i] state to float4(1, 1, 1, 1) when i is 0 and float4(0, 0, 0,
1) otherwise.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpotCutoff, LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 952
LIGHTSPOTCUTOFF(CgFX) CgFX States LIGHTSPOTCUTOFF(CgFX)
NAME LightSpotCutoff −3DAPI light spot cutoff
USAGELightSpotCutoff[i] = float(cutoff)
VALID ENUMERANTS
cutoff: floating point value
DESCRIPTION
Specify the lights maximum spread angle. See the GL_SPOT_CUTOFF description on the OpenGL glLight
manual page for details. See the Falloffmember of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightSpotCutoff[i] state to float(180).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotDirection,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 953
LIGHTSPOTDIRECTION(CgFX) CgFX States LIGHTSPOTDIRECTION(CgFX)
NAME LightSpotDirection −3DAPI light spot direction
USAGELightSpotDirection[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Specify the lights direction. See the GL_SPOT_DIRECTION description on the OpenGL glLight manual
page for details. See the Direction member of the D3DLIGHT9 argument to IDirect3DDevice9::SetLight
method.
The standard reset callback sets the LightSpotDirection[i] state to float4(0, 0, −1, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotExponent, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 954
LIGHTSPOTEXPONENT(CgFX) CgFX States LIGHTSPOTEXPONENT(CgFX)
NAME LightSpotExponent −3DAPI light spot exponent
USAGELightSpotExponent[i] = float(exp)
VALID ENUMERANTS
exp: floating point value
DESCRIPTION
Specify the lights intensity distribution. See the GL_SPOT_EXPONENT description on the OpenGL glLight
manual page for details.
The standard reset callback sets the LightSpotExponent[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightTheta, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 955
LIGHTTHETA(CgFX) CgFX States LIGHTTHETA(CgFX)
NAME LightTheta −3DAPI light theta
USAGELightTheta[i] = float(theta)
VALID ENUMERANTS
theta: floating point value
DESCRIPTION
Specify the angle in radians of a spotlight’sinner cone. See the Theta member of the D3DLIGHT9
argument to IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightTheta[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightType, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 956
LIGHTTYPE(CgFX) CgFX States LIGHTTYPE(CgFX)
NAME LightType −3DAPI light type
USAGELightType[i] = int(type)
VALID ENUMERANTS
type: integer value
DESCRIPTION
Specify the type of light source. See the Type member of the D3DLIGHT9 argument to
IDirect3DDevice9::SetLight method.
The standard reset callback sets the LightType[i] state to int(Point).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightingEnable
perl v5.10.0 Cg Toolkit 3.0 957
LIGHTING(CgFX) CgFX States LIGHTING(CgFX)
NAME Lighting −3DAPI light enable
USAGELighting = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable a light for use in the lighting computations. See the IDirect3DDevice9::SetLight method for
details.
The standard reset callback sets the Lighting state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightEnable, LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2,
LightConstantAttenuation, LightDiffuse, LightDirection, LightEnable, LightFalloff,
LightLinearAttenuation, LightModelAmbient, LightModelColorControl, LightModelLocalViewerEnable,
LightModelTwoSideEnable, LightPhi, LightPosition, LightQuadraticAttenuation, LightRange,
LightSpecular,LightSpotCutoff, LightSpotDirection, LightSpotExponent, LightTheta, LightType,
LightingEnable
perl v5.10.0 Cg Toolkit 3.0 958
LIGHTINGENABLE(CgFX) CgFX States LIGHTINGENABLE(CgFX)
NAME LightingEnable −3DAPI lighting enable
USAGELightingEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable lighting. See the GL_LIGHTING description on the OpenGL glEnable manual page for
details. See the D3DRS_LIGHTING render state description for DirectX 9.
The standard reset callback sets the LightingEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightAmbient, LightAttenuation0, LightAttenuation1, LightAttenuation2, LightConstantAttenuation,
LightDiffuse, LightDirection, LightEnable, LightFalloff, LightLinearAttenuation, LightModelAmbient,
LightModelColorControl, LightModelLocalViewerEnable, LightModelTwoSideEnable, LightPhi,
LightPosition, LightQuadraticAttenuation, LightRange, LightSpecular,LightSpotCutoff,
LightSpotDirection, LightSpotExponent, LightTheta, LightType
perl v5.10.0 Cg Toolkit 3.0 959
LINESMOOTHENABLE(CgFX) CgFX States LINESMOOTHENABLE(CgFX)
NAME LineSmoothEnable −3DAPI line smooth enable
USAGELineSmoothEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable antialiased line rendering. See the GL_LINE_SMOOTH description on the OpenGL glEnable
manual page for details. See the D3DRS_ANTIALIASEDLINEENABLE render state description for
DirectX 9.
The standard reset callback sets the LineSmoothEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointSmoothEnable, PolygonSmoothEnable, LineStipple, LineStippleEnable, LineWidth
perl v5.10.0 Cg Toolkit 3.0 960
LINESTIPPLE(CgFX) CgFX States LINESTIPPLE(CgFX)
NAME LineStipple −3DAPI line stipple
USAGELineStipple = int2(factor,pattern)
VALID ENUMERANTS
factor: integer value pattern: integer value
DESCRIPTION
Specify the line stippling factor and pattern. See the OpenGL glLineStipple manual page for details.
The standard reset callback sets the LineStipple state to int2(1, ˜0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LineStippleEnable, PolygonStippleEnable
perl v5.10.0 Cg Toolkit 3.0 961
LINESTIPPLEENABLE(CgFX) CgFX States LINESTIPPLEENABLE(CgFX)
NAME LineStippleEnable −3DAPI line stipple enable
USAGELineStippleEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL line stippling. See the GL_LINE_STIPPLE description on the OpenGL glEnable
manual page for details.
The standard reset callback sets the LineStippleEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LineSmoothEnable, LineStipple, LineWidth, PolygonStippleEnable
perl v5.10.0 Cg Toolkit 3.0 962
LINEWIDTH(CgFX) CgFX States LINEWIDTH(CgFX)
NAME LineWidth −3DAPI line width
USAGELineWidth = float(width)
VALID ENUMERANTS
width: floating point value
DESCRIPTION
Specify the width of rasterized lines. See the OpenGL glLineWidth manual page for details.
The standard reset callback sets the LineWidth state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointSize, PointSizeMax, PointSizeMin
perl v5.10.0 Cg Toolkit 3.0 963
LOCALVIEWER(CgFX) CgFX States LOCALVIEWER(CgFX)
NAME LocalViewer −3DAPI local viewer
USAGELocalViewer = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable computation of specular reflections using the local viewer model. See the
GL_LIGHT_MODEL_LOCAL_VIEWER description on the OpenGL glLightModel manual page for details.
See the D3DRS_LOCALVIEWER render state description for DirectX 9.
The standard reset callback sets the LocalViewer state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightModelLocalViewerEnable
perl v5.10.0 Cg Toolkit 3.0 964
LOGICOP(CgFX) CgFX States LOGICOP(CgFX)
NAME LogicOp −3DAPI logic op
USAGELogicOp = int(op)
VALID ENUMERANTS
op: Clear,And, AndReverse, Copy, AndInverted, Noop, Xor,Or, Nor,Equiv, Inv ert, OrReverse,
CopyInverted, Nand, Set
DESCRIPTION
Specify a logical pixel operation for fragment color and color buffer values. See the OpenGL glLogicOp
manual page for details.
The standard reset callback sets the LogicOp state to int(Copy).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ColorLogicOpEnable, LogicOpEnable
perl v5.10.0 Cg Toolkit 3.0 965
LOGICOPENABLE(CgFX) CgFX States LOGICOPENABLE(CgFX)
NAME LogicOpEnable −3DAPI logic op enable
USAGELogicOpEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL color logical operations. See the GL_COLOR_LOGIC_OP description on the
OpenGL glEnable manual page for details.
The standard reset callback sets the LogicOpEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
ColorLogicOpEnable, LogicOp
perl v5.10.0 Cg Toolkit 3.0 966
MAGFILTERI(CgFX) CgFX States MAGFILTERI(CgFX)
NAME MagFilteri −3DAPI mag filter
USAGEMagFilter[i] = int(type)
VALID ENUMERANTS
type: Point, Nearest, Linear
DESCRIPTION
Set the Direct3D sampler magnification filter type for texture unit i,where iis in the range 0−15. See
sampler state MagFilter for details.
The standard reset callback sets the MagFilter[i] state to int(Point).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MagFilter,GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 967
MATERIALAMBIENT(CgFX) CgFX States MATERIALAMBIENT(CgFX)
NAME MaterialAmbient −3DAPI material ambient
USAGEMaterialAmbient = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the materials ambient reflectance values. See the GL_AMBIENT description on the OpenGL
glMaterial manual page for details. See the D3DRS_AMBIENTMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the MaterialAmbient state to float4(0.2, 0.2, 0.2, 1.0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource, MaterialDiffuse,
MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 968
MATERIALDIFFUSE(CgFX) CgFX States MATERIALDIFFUSE(CgFX)
NAME MaterialDiffuse −3DAPI material diffuse
USAGEMaterialDiffuse = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the materials diffuse reflectance values. See the GL_DIFFUSE description on the OpenGL
glMaterial manual page for details. See the D3DRS_DIFFUSEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the MaterialDiffuse state to float4(0.8, 0.8, 0.8, 1.0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialEmission, MaterialEmissive,MaterialPower,MaterialShininess,
MaterialSpecular,SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 969
MATERIALEMISSION(CgFX) CgFX States MATERIALEMISSION(CgFX)
NAME MaterialEmission −3DAPI material emission
USAGEMaterialEmission = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the materials emmisive light intensity.See the GL_EMISSION description on the OpenGL
glMaterial manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the MaterialEmission state to float4(0, 0, 0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmissive,MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 970
MATERIALEMISSIVE(CgFX) CgFX States MATERIALEMISSIVE(CgFX)
NAME MaterialEmissive −3DAPI material emissive
USAGEMaterialEmissive = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the materials emmisive light intensity.See the GL_EMISSION description on the OpenGL
glMaterial manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the MaterialEmissive state to float4(0, 0, 0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmission, MaterialPower,MaterialShininess, MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 971
MATERIALPOWER(CgFX) CgFX States MATERIALPOWER(CgFX)
NAME MaterialPower −3DAPI material power
USAGEMaterialPower = float(shininess)
VALID ENUMERANTS
shininess: floating point value
DESCRIPTION
Specifies the materials specular exponent. See the GL_SHININESS description on the OpenGL glMaterial
manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state description for
DirectX 9.
The standard reset callback sets the MaterialPower state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmission, MaterialEmissive,MaterialShininess,
MaterialSpecular,SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 972
MATERIALSHININESS(CgFX) CgFX States MATERIALSHININESS(CgFX)
NAME MaterialShininess −3DAPI material shininess
USAGEMaterialShininess = float(shininess)
VALID ENUMERANTS
shininess: floating point value
DESCRIPTION
Specifies the materials specular exponent. See the GL_SHININESS description on the OpenGL glMaterial
manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state description for
DirectX 9.
The standard reset callback sets the MaterialShininess state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmission, MaterialEmissive,MaterialPower,MaterialSpecular,
SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 973
MATERIALSPECULAR(CgFX) CgFX States MATERIALSPECULAR(CgFX)
NAME MaterialSpecular −3DAPI material specular
USAGEMaterialSpecular = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the materials specular reflectance values. See the GL_SPECULAR description on the OpenGL
glMaterial manual page for details. See the D3DRS_EMISSIVEMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the MaterialSpecular state to float4(0, 0, 0, 1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmission, MaterialEmissive,MaterialPower,
MaterialShininess, SpecularMaterialSource
perl v5.10.0 Cg Toolkit 3.0 974
MAXANISOTROPYI(CgFX) CgFX States MAXANISOTROPYI(CgFX)
NAME MaxAnisotropyi −3DAPI max anisotropy
USAGEMaxAnisotropy[i] = int(max)
VALID ENUMERANTS
max: integer value
DESCRIPTION
Set the Direct3D maximum anisotropyvalue for texture unit i,where iis in the range 0−15. See sampler
state MaxAnisotropyfor details.
The standard reset callback sets the MaxAnisotropy[i] state to int (1).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MaxAnisotropy
perl v5.10.0 Cg Toolkit 3.0 975
MAXMIPLEVELI(CgFX) CgFX States MAXMIPLEVELI(CgFX)
NAME MaxMipLeveli −3DAPI max mip level
USAGEMaxMipLevel[i] = int(max)
VALID ENUMERANTS
max: integer value
DESCRIPTION
Set the Direct3D maximum mipmap lod indexfor texture unit i,where iis in the range 0−15. See sampler
state MaxMipLevelfor details.
The standard reset callback sets the MaxMipLevel[i] state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MaxMipLevel, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 976
MINFILTERI(CgFX) CgFX States MINFILTERI(CgFX)
NAME MinFilteri −3DAPI min filter
USAGEMinFilter[i] = int(type)
VALID ENUMERANTS
type: Anisotropic, GaussianQuad, Linear,LinearMipMapLinear,LinearMipMapNearest, Nearest,
NearestMipMapLinear,NearestMipMapNearest, None, Point, PyramidalQuad
DESCRIPTION
Set the Direct3D sampler minification filter type for texture unit i,where iis in the range 0−15. See
sampler state MinFilter for details.
The standard reset callback sets the MinFilter[i] state to int(Point).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MinFilter,GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 977
MIPFILTERI(CgFX) CgFX States MIPFILTERI(CgFX)
NAME MipFilteri −3DAPI mip filter
USAGEMipFilter[i] = int(type)
VALID ENUMERANTS
type: None, Point, Linear,Anisotropic, PyramidalQuad, GaussianQuad
DESCRIPTION
Set the Direct3D minification mipmap filter for texture unit i,where iis in the range 0−15. See sampler
state MipFilter for details.
The standard reset callback sets the MipFilter[i] state to int(None).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MipFilter,GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 978
MIPMAPLODBIASI(CgFX) CgFX States MIPMAPLODBIASI(CgFX)
NAME MipMapLodBiasi −3DAPI mip map lod bias
USAGEMipMapLodBias[i] = float(bias)
VALID ENUMERANTS
bias: floating point value
DESCRIPTION
Set the Direct3D mipmap lod bias. See the D3DSAMP_MIPMAPLODBIAS sampler state description for
DirectX 9.
The standard reset callback sets the MipMapLodBias[i] state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MipMapLodBias, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipFilter
perl v5.10.0 Cg Toolkit 3.0 979
MODELVIEWMATRIX(CgFX) CgFX States MODELVIEWMATRIX(CgFX)
NAME ModelViewMatrix −3DAPI model viewmatrix
USAGEModelViewMatrix = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the modelviewmatrix. See the GL_MODELVIEW description on the OpenGL
glMatrixMode manual page for details. See the description of the D3DTS_WORLD and D3DTS_VIEW
transform state types for the IDirect3DDevice9::SetTransform method.
The standard reset callback sets the ModelViewMatrix state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewTransform, ProjectionMatrix, ProjectionTransform, ViewTransform, WorldTransform
perl v5.10.0 Cg Toolkit 3.0 980
MODELVIEWTRANSFORM(CgFX) CgFX States MODELVIEWTRANSFORM(CgFX)
NAME ModelViewTransform −3DAPI model viewtransform
USAGEModelViewTransform = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the modelviewmatrix. See the GL_MODELVIEW description on the OpenGL
glMatrixMode manual page for details. See the description of the D3DTS_WORLD and D3DTS_VIEW
transform state types for the IDirect3DDevice9::SetTransform method.
The standard reset callback sets the ModelViewTransform state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewMatrix, ProjectionMatrix, ProjectionTransform, ViewTransform, WorldTransform
perl v5.10.0 Cg Toolkit 3.0 981
MULTISAMPLEANTIALIAS(CgFX) CgFX States MULTISAMPLEANTIALIAS(CgFX)
NAME MultiSampleAntialias −3DAPI multi sample antialias
USAGEMultiSampleAntialias = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable using multiple fragment samples to compute the final pixel color.See the
GL_MULTISAMPLE description on the OpenGL glEnable manual page for details. See the
D3DRS_MULTISAMPLEANTIALIAS render state description for DirectX 9.
The standard reset callback sets the MultiSampleAntialias state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.3 or support for extension ARB_multisample.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MultiSampleMask, MultisampleEnable, SampleAlphaToOneEnable, SampleCoverageEnable
perl v5.10.0 Cg Toolkit 3.0 982
MULTISAMPLEMASK(CgFX) CgFX States MULTISAMPLEMASK(CgFX)
NAME MultiSampleMask −3DAPI multisample mask
USAGEMultiSampleMask = int(mask)
VALID ENUMERANTS
mask: integer value
DESCRIPTION
Specify a bit mask for multisample render targets. See the D3DRS_MULTISAMPLEMASK render state
description for DirectX 9.
The standard reset callback sets the MultiSampleMask state to int(˜0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MultiSampleAntialias, MultisampleEnable, SampleAlphaToOneEnable, SampleCoverageEnable
perl v5.10.0 Cg Toolkit 3.0 983
MULTISAMPLEENABLE(CgFX) CgFX States MULTISAMPLEENABLE(CgFX)
NAME MultisampleEnable −3DAPI multisample enable
USAGEMultisampleEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable multisampling for antialiasing. See the GL_MULTISAMPLE_ARB description on the
OpenGL glEnable manual page for details. See the D3DRS_MULTISAMPLEANTIALIAS render state
description for DirectX 9.
The standard reset callback sets the MultisampleEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.3 or support for extension ARB_multisample.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MultiSampleAntialias, MultiSampleMask, SampleAlphaToCoverageEnable, SampleAlphaToOneEnable,
SampleCoverageEnable
perl v5.10.0 Cg Toolkit 3.0 984
NORMALIZEENABLE(CgFX) CgFX States NORMALIZEENABLE(CgFX)
NAME NormalizeEnable −3DAPI normalize enable
USAGENormalizeEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable automatic normalization of vertexnormals. See the GL_NORMALIZE description on the
OpenGL glEnable manual page for details. See the D3DRS_NORMALIZENORMALS render state
description for DirectX 9.
The standard reset callback sets the NormalizeEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AutoNormalEnable, RescaleNormalEnable, NormalizeNormals
perl v5.10.0 Cg Toolkit 3.0 985
NORMALIZENORMALS(CgFX) CgFX States NORMALIZENORMALS(CgFX)
NAME NormalizeNormals −3DAPI automatic normalization of normals
USAGENormalizeNormals = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable automatic normalization of vertexnormals. See the D3DRS_NORMALIZENORMALS render
state description for DirectX 9.
The standard reset callback sets the NormalizeNormals state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AutoNormalEnable, NormalizeEnable, RescaleNormalEnable
perl v5.10.0 Cg Toolkit 3.0 986
PATCHSEGMENTS(CgFX) CgFX States PATCHSEGMENTS(CgFX)
NAME PatchSegments −3DAPI patch segments
USAGEPatchSegments = float(mode)
VALID ENUMERANTS
mode: floating point value
DESCRIPTION
Enable/disable N−patches. See the IDirect3DDevice9::SetNPatchMode method for details.
The standard reset callback sets the PatchSegments state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 987
PIXELSHADER(CgFX) CgFX States PIXELSHADER(CgFX)
NAME PixelShader −3DAPI pixel shader
USAGEPixelShader = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
shader: Null
DESCRIPTION
Compile a pixel shader.See the specification of the OpenGL fragment profile for details. See the
specification of the Direct3D pixel shaders for details.
The standard reset callback sets the PixelShader state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
GeometryShader,TessellationControlShader,TessellationEvaluationShader,VertexShader,
FragmentProgram, GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram,
VertexProgram
perl v5.10.0 Cg Toolkit 3.0 988
PIXELSHADERCONSTANT(CgFX) CgFX States PIXELSHADERCONSTANT(CgFX)
NAME PixelShaderConstant −3DAPI pixel shader constant
USAGEPixelShaderConstant[i] = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 989
PIXELSHADERCONSTANT1(CgFX) CgFX States PIXELSHADERCONSTANT1(CgFX)
NAME PixelShaderConstant1 −3DAPI pixel shader constant1
USAGEPixelShaderConstant1[i] = float4(f1, f2, f3, f4)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 990
PIXELSHADERCONSTANT2(CgFX) CgFX States PIXELSHADERCONSTANT2(CgFX)
NAME PixelShaderConstant2 −3DAPI pixel shader constant2
USAGEPixelShaderConstant2[i] = float4x2(f1, f2, f3, f4, f5, f6, f7, f8)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 991
PIXELSHADERCONSTANT3(CgFX) CgFX States PIXELSHADERCONSTANT3(CgFX)
NAME PixelShaderConstant3 −3DAPI pixel shader constant3
USAGEPixelShaderConstant3[i] = float4x3(f1, f2, f3, f4, ... , f9, f10, f11, f12)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 992
PIXELSHADERCONSTANT4(CgFX) CgFX States PIXELSHADERCONSTANT4(CgFX)
NAME PixelShaderConstant4 −3DAPI pixel shader constant4
USAGEPixelShaderConstant4[i] = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 993
PIXELSHADERCONSTANTB(CgFX) CgFX States PIXELSHADERCONSTANTB(CgFX)
NAME PixelShaderConstantB −3DAPI pixel shader constantB
USAGEPixelShaderConstantB[i] = bool4(b1, b2, b3, b4)
VALID ENUMERANTS
bi: true, false
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantB method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 994
PIXELSHADERCONSTANTF(CgFX) CgFX States PIXELSHADERCONSTANTF(CgFX)
NAME PixelShaderConstantF −3DAPI pixel shader constantF
USAGEPixelShaderConstantF[i] = float4(f1, f2, f3, f4)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 995
PIXELSHADERCONSTANTI(CgFX) CgFX States PIXELSHADERCONSTANTI(CgFX)
NAME PixelShaderConstantI −3DAPI pixel shader constantI
USAGEPixelShaderConstantI[i] = int4(i1, i2, i3, i4)
VALID ENUMERANTS
ii: integer values
DESCRIPTION
Set a Direct3D pixel shader constant. See the IDirect3DDevice9::SetPixelShaderConstantI method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 996
POINTDISTANCEATTENUATION(CgFX) CgFX States POINTDISTANCEATTENUATION(CgFX)
NAME PointDistanceAttenuation −3DAPI point distance attenuation
USAGEPointDistanceAttenuation = float3(x, y,z)
VALID ENUMERANTS
x, y,z:floating point values
DESCRIPTION
Specify the coefficients used to scale the computed point size. See the
GL_POINT_DISTANCE_ATTENUATION description on the OpenGL glPointParameter manual page for
details.
The standard reset callback sets the PointDistanceAttenuation state to float3(1, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointFadeThresholdSize
perl v5.10.0 Cg Toolkit 3.0 997
POINTFADETHRESHOLDSIZE(CgFX) CgFX States POINTFADETHRESHOLDSIZE(CgFX)
NAME PointFadeThresholdSize −3DAPI point fade threshold size
USAGEPointFadeThresholdSize = float(size)
VALID ENUMERANTS
size: floating point value
DESCRIPTION
Specify the threshold to which point sizes are clamped. See the GL_POINT_FADE_THRESHOLD_SIZE
description on the OpenGL glPointParameter manual page for details.
The standard reset callback sets the PointFadeThresholdSize state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointDistanceAttenuation
perl v5.10.0 Cg Toolkit 3.0 998
POINTSCALEENABLE(CgFX) CgFX States POINTSCALEENABLE(CgFX)
NAME PointScaleEnable −3DAPI point scale enable
USAGEPointScaleEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable Direct3D camera space point scaling. See the D3DRS_POINTSCALEENABLE render
state description for DirectX 9.
The standard reset callback sets the PointScaleEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScale_A, PointScale_B, PointScale_C, PointSizeMax, PointSizeMin, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 999
POINTSCALE_A(CgFX) CgFX States POINTSCALE_A(CgFX)
NAME PointScale_A −3DAPI point scale A
USAGEPointScale_A = float(size)
VALID ENUMERANTS
size: floating point value
DESCRIPTION
Specify a distance-based size attenuation value for point primitives. See the D3DRS_POINTSCALE_A
render state description for DirectX 9.
The standard reset callback sets the PointScale_A state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_B, PointScale_C, PointSizeMax, PointSizeMin, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1000
POINTSCALE_B(CgFX) CgFX States POINTSCALE_B(CgFX)
NAME PointScale_B −3DAPI point scale B
USAGEPointScale_B = float(size)
VALID ENUMERANTS
size: floating point value
DESCRIPTION
Specify a distance-based size attenuation value for point primitives. See the D3DRS_POINTSCALE_B
render state description for DirectX 9.
The standard reset callback sets the PointScale_B state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_C, PointSizeMax, PointSizeMin, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1001
POINTSCALE_C(CgFX) CgFX States POINTSCALE_C(CgFX)
NAME PointScale_C −3DAPI point scale C
USAGEPointScale_C = float(size)
VALID ENUMERANTS
size: floating point value
DESCRIPTION
Specify a distance-based size attenuation value for point primitives. See the D3DRS_POINTSCALE_C
render state description for DirectX 9.
The standard reset callback sets the PointScale_C state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_B, PointSizeMax, PointSizeMin, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1002
POINTSIZE(CgFX) CgFX States POINTSIZE(CgFX)
NAME PointSize −3DAPI point size
USAGEPointSize = float(size)
VALID ENUMERANTS
size: floating point value
DESCRIPTION
Specify the diameter of rasterized points. See the OpenGL glPointSize manual page for details. See the
D3DRS_POINTSIZE render state description for DirectX 9.
The standard reset callback sets the PointSize state to float (1).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_B, PointScale_C, PointSizeMax, PointSizeMin,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1003
POINTSIZEMAX(CgFX) CgFX States POINTSIZEMAX(CgFX)
NAME PointSizeMax −3DAPI point size max
USAGEPointSizeMax = float(max)
VALID ENUMERANTS
max: floating point value
DESCRIPTION
Specify the maximum point size. See the GL_POINT_SIZE_MAX description on the OpenGL
glPointParameter manual page for details. See the D3DRS_POINTSIZE_MAX render state description for
DirectX 9.
The standard reset callback sets the PointSizeMax state to the maximum value returned by glGet for
parameter value GL_SMOOTH_POINT_SIZE_RANGE.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_B, PointScale_C, PointSizeMin, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1004
POINTSIZEMIN(CgFX) CgFX States POINTSIZEMIN(CgFX)
NAME PointSizeMin −3DAPI point size min
USAGEPointSizeMin = float(min)
VALID ENUMERANTS
min: floating point value
DESCRIPTION
Specify the minimum point size. See the GL_POINT_SIZE_MIN description on the OpenGL
glPointParameter manual page for details. See the D3DRS_POINTSIZE_MIN render state description for
DirectX 9.
The standard reset callback sets the PointSizeMin state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_B, PointScale_C, PointSizeMax, PointSize,
VertexProgramPointSizeEnable
perl v5.10.0 Cg Toolkit 3.0 1005
POINTSMOOTHENABLE(CgFX) CgFX States POINTSMOOTHENABLE(CgFX)
NAME PointSmoothEnable −3DAPI point smooth enable
USAGEPointSmoothEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL antialiased point rendering. See the GL_POINT_SMOOTH description on the
OpenGL glEnable manual page for details.
The standard reset callback sets the PointSmoothEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LineSmoothEnable, PolygonSmoothEnable
perl v5.10.0 Cg Toolkit 3.0 1006
POINTSPRITECOORDORIGIN(CgFX) CgFX States POINTSPRITECOORDORIGIN(CgFX)
NAME PointSpriteCoordOrigin −3DAPI point sprite coordinate origin
USAGEPointSpriteCoordOrigin = int(origin)
VALID ENUMERANTS
origin: LowerLeft, UpperLeft
DESCRIPTION
Specify the texture coordinate origin for point sprites. See the GL_POINT_SPRITE_COORD_ORIGIN
description on the OpenGL glPointParameter manual page for details.
The standard reset callback sets the PointSpriteCoordOrigin state to int(UpperLeft).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 2.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointSpriteCoordReplace, PointSpriteEnable, PointSpriteRMode
perl v5.10.0 Cg Toolkit 3.0 1007
POINTSPRITECOORDREPLACE(CgFX) CgFX States POINTSPRITECOORDREPLACE(CgFX)
NAME PointSpriteCoordReplace −3DAPI point sprite coordinate replace
USAGEPointSpriteCoordReplace[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Replace texture coordinates with point sprite texture coordinates. See the description of
GL_COORD_REPLACE_ARB in the OpenGL ARB_point_sprite specification for details.
The standard reset callback sets the PointSpriteCoordReplace[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension ARB_point_sprite.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointSpriteCoordOrigin, PointSpriteEnable, PointSpriteRMode
perl v5.10.0 Cg Toolkit 3.0 1008
POINTSPRITEENABLE(CgFX) CgFX States POINTSPRITEENABLE(CgFX)
NAME PointSpriteEnable −3DAPI point sprite enable
USAGEPointSpriteEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable texture coordinate computation for points. See the GL_POINT_SPRITE_ARB description on
the OpenGL glEnable manual page for details. See the D3DRS_POINTSPRITEENABLE render state
description for DirectX 9.
The standard reset callback sets the PointSpriteEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension ARB_point_sprite.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PointSpriteCoordOrigin, PointSpriteCoordReplace, PointSpriteRMode
perl v5.10.0 Cg Toolkit 3.0 1009
POINTSPRITERMODE(CgFX) CgFX States POINTSPRITERMODE(CgFX)
NAME PointSpriteRMode −3DAPI point sprite R mode
USAGEPointSpriteRMode = int(mode)
VALID ENUMERANTS
mode: Zero, S, R
DESCRIPTION
Specify tthe point sprite R coordinate mode. See the description of GL_POINT_SPRITE_R_MODE_NV in
the OpenGL NV_point_sprite specification for details.
The standard reset callback sets the PointSpriteRMode state to int(Zero).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension NV_point_sprite.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointSpriteCoordOrigin, PointSpriteCoordReplace, PointSpriteEnable
perl v5.10.0 Cg Toolkit 3.0 1010
POLYGONMODE(CgFX) CgFX States POLYGONMODE(CgFX)
NAME PolygonMode −3DAPI polygon mode
USAGEPolygonMode = int2(face, mode)
VALID ENUMERANTS
face: Front, Back, FrontAndBack mode: Point, Line, Fill, Solid, Wireframe
DESCRIPTION
Specify the polygon face rasterization mode. See the OpenGL glPolygonMode manual page for details.
See the D3DRS_FILLMODE render state description for DirectX 9.
The standard reset callback sets the PolygonMode state to int2(FrontAndBack, Fill).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FillMode
perl v5.10.0 Cg Toolkit 3.0 1011
POLYGONOFFSET(CgFX) CgFX States POLYGONOFFSET(CgFX)
NAME PolygonOffset −3DAPI polygon offset
USAGEPolygonOffset = float2(factor,units)
VALID ENUMERANTS
factor,units: floating point values
DESCRIPTION
Specify the scale factor and constant used to compute a depth offset for polygons. See the OpenGL
glPolygonOffset manual page for details.
The standard reset callback sets the PolygonOffset state to float2(0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
SlopScaleDepthBias, PolygonOffsetFillEnable, PolygonOffsetLineEnable, PolygonOffsetPointEnable
perl v5.10.0 Cg Toolkit 3.0 1012
POLYGONOFFSETFILLENABLE(CgFX) CgFX States POLYGONOFFSETFILLENABLE(CgFX)
NAME PolygonOffsetFillEnable −3DAPI polygon offset fill enable
USAGEPolygonOffsetFillEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL depth offsetting for polygons rendered as filled primitives. See the
GL_POLYGON_OFFSET_FILL description on the OpenGL glEnable manual page for details.
The standard reset callback sets the PolygonOffsetFillEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PolygonOffset, PolygonOffsetLineEnable, PolygonOffsetPointEnable
perl v5.10.0 Cg Toolkit 3.0 1013
POLYGONOFFSETLINEENABLE(CgFX) CgFX States POLYGONOFFSETLINEENABLE(CgFX)
NAME PolygonOffsetLineEnable −3DAPI polygon offset line enable
USAGEPolygonOffsetLineEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL depth offsetting for polygons rendered as line primitives. See the
GL_POLYGON_OFFSET_LINE description on the OpenGL glEnable manual page for details.
The standard reset callback sets the PolygonOffsetLineEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PolygonOffset, PolygonOffsetFillEnable, PolygonOffsetPointEnable
perl v5.10.0 Cg Toolkit 3.0 1014
POLYGONOFFSETPOINTENABLE(CgFX) CgFX States POLYGONOFFSETPOINTENABLE(CgFX)
NAME PolygonOffsetPointEnable −3DAPI polygon offset point enable
USAGEPolygonOffsetPointEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL depth offsetting for polygons rendered as point primitives. See the
GL_POLYGON_OFFSET_POINT description on the OpenGL glEnable manual page for details.
The standard reset callback sets the PolygonOffsetPointEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PolygonOffset, PolygonOffsetFillEnable, PolygonOffsetLineEnable
perl v5.10.0 Cg Toolkit 3.0 1015
POLYGONSMOOTHENABLE(CgFX) CgFX States POLYGONSMOOTHENABLE(CgFX)
NAME PolygonSmoothEnable −3DAPI polygon smooth enable
USAGEPolygonSmoothEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL antialiased rendering of polygons. See the GL_POLYGON_SMOOTH description on
the OpenGL glEnable manual page for details.
The standard reset callback sets the PolygonSmoothEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LineSmoothEnable, PointSmoothEnable
perl v5.10.0 Cg Toolkit 3.0 1016
POLYGONSTIPPLEENABLE(CgFX) CgFX States POLYGONSTIPPLEENABLE(CgFX)
NAME PolygonStippleEnable −3DAPI polygon stipple enable
USAGEPolygonStippleEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL polygon stippling. See the GL_POLYGON_STIPPLE description on the OpenGL
glEnable manual page for details.
The standard reset callback sets the PolygonStippleEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
LineStipple, LineStippleEnable
perl v5.10.0 Cg Toolkit 3.0 1017
PROJECTIONMATRIX(CgFX) CgFX States PROJECTIONMATRIX(CgFX)
NAME ProjectionMatrix −3DAPI projection matrix
USAGEProjectionMatrix = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the projection matrix. See the GL_PROJECTION description on the OpenGL
glMatrixMode manual page for details. See the description of the D3DTS_PROJECTION transform state
type for the IDirect3DDevice9::SetTransform method.
The standard reset callback sets the ProjectionMatrix state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewMatrix, ModelViewTransform, ProjectionTransform, ViewTransform, WorldTransform
perl v5.10.0 Cg Toolkit 3.0 1018
PROJECTIONTRANSFORM(CgFX) CgFX States PROJECTIONTRANSFORM(CgFX)
NAME ProjectionTransform −3DAPI projection transform
USAGEProjectionTransform = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the projection matrix. See the GL_PROJECTION description on the OpenGL
glMatrixMode manual page for details. See the description of the D3DTS_PROJECTION transform state
type for the IDirect3DDevice9::SetTransform method.
The standard reset callback sets the ProjectionTransform state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewMatrix, ModelViewTransform, ProjectionMatrix, ViewTransform, WorldTransform
perl v5.10.0 Cg Toolkit 3.0 1019
RANGEFOGENABLE(CgFX) CgFX States RANGEFOGENABLE(CgFX)
NAME RangeFogEnable −3DAPI range fog enable
USAGERangeFogEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable Direct3D range-based vertexfog. See the D3DRS_RANGEFOGENABLE render state
description for DirectX 9.
The standard reset callback sets the RangeFogEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FogColor,FogCoordSrc, FogDensity,FogDistanceMode, FogEnable, FogEnd, FogMode, FogStart,
FogTableMode, FogVertexMode
perl v5.10.0 Cg Toolkit 3.0 1020
RESCALENORMALENABLE(CgFX) CgFX States RESCALENORMALENABLE(CgFX)
NAME RescaleNormalEnable −3DAPI rescale normal enable
USAGERescaleNormalEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable rescaling of vertexnormal vectors by OpenGL. See the GL_RESCALE_NORMAL
description on the OpenGL glEnable manual page for details.
The standard reset callback sets the RescaleNormalEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.2 or support for extension EXT_rescale_normal.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
AutoNormalEnable, NormalizeEnable, NormalizeNormals
perl v5.10.0 Cg Toolkit 3.0 1021
SAMPLEALPHATOCOVERAGEENABLE(CgFX) CgFX States SAMPLEALPHATOCOVERAGEENABLE(CgFX)
NAME SampleAlphaToCoverageEnable −3DAPI sample alpha to coverage enable
USAGESampleAlphaToCoverageEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL alpha coverage sampling. See the GL_SAMPLE_ALPHA_TO_COVERAGE_ARB
description on the OpenGL glEnable manual page for details.
The standard reset callback sets the SampleAlphaToCoverageEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.3 or support for extension ARB_multisample.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
SampleAlphaToOneEnable, SampleCoverageEnable, MultiSampleAntialias, MultiSampleMask,
MultisampleEnable
perl v5.10.0 Cg Toolkit 3.0 1022
SAMPLEALPHATOONEENABLE(CgFX) CgFX States SAMPLEALPHATOONEENABLE(CgFX)
NAME SampleAlphaToOneEnable −3DAPI sample alpha to one enable
USAGESampleAlphaToOneEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL maximum coverage sampling. See the GL_SAMPLE_ALPHA_TO_ONE_ARB
description on the OpenGL glEnable manual page for details.
The standard reset callback sets the SampleAlphaToOneEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.3 or support for extension ARB_multisample.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
SampleAlphaToCoverageEnable, SampleCoverageEnable, MultiSampleAntialias, MultiSampleMask,
MultisampleEnable
perl v5.10.0 Cg Toolkit 3.0 1023
SAMPLECOVERAGEENABLE(CgFX) CgFX States SAMPLECOVERAGEENABLE(CgFX)
NAME SampleCoverageEnable −3DAPI sample coverage enable
USAGESampleCoverageEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL multisample coverage operations. See the GL_SAMPLE_COVERAGE_ARB
description on the OpenGL glEnable manual page for details.
The standard reset callback sets the SampleCoverageEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.3 or support for extension ARB_multisample.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
SampleAlphaToCoverageEnable, SampleAlphaToOneEnable, MultiSampleAntialias, MultiSampleMask,
MultisampleEnable
perl v5.10.0 Cg Toolkit 3.0 1024
SAMPLER(CgFX) CgFX States SAMPLER(CgFX)
NAME Sampler −3DAPI sampler
USAGESampler[i] = sampler(s)
VALID ENUMERANTS
s: sampler
DESCRIPTION
Set all Direct3D sampler states for sampler s.
The standard reset callback resets all states for sampler s.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture
perl v5.10.0 Cg Toolkit 3.0 1025
SCISSOR(CgFX) CgFX States SCISSOR(CgFX)
NAME Scissor −3DAPI scissor
USAGEScissor = int4(x, y,w,h)
VALID ENUMERANTS
x, y,w,h:integer values
DESCRIPTION
Specify the scissor box in windowcoordinates. See the OpenGL glScissor manual page for details. See the
description of the IDirect3DDevice9::SetScissorRect method for details
The standard reset callback sets the Scissor state to int4(0, 0, 10000, 10000).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ScissorTestEnable
perl v5.10.0 Cg Toolkit 3.0 1026
SCISSORTESTENABLE(CgFX) CgFX States SCISSORTESTENABLE(CgFX)
NAME ScissorTestEnable −3DAPI scissor test enable
USAGEScissorTestEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable scissor testing. See the GL_SCISSOR_TEST description on the OpenGL glEnable manual
page for details. See the D3DRS_SCISSORTESTENABLE render state description for DirectX 9.
The standard reset callback sets the ScissorTestEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Scissor
perl v5.10.0 Cg Toolkit 3.0 1027
SEPARATEALPHABLENDENABLE(CgFX) CgFX States SEPARATEALPHABLENDENABLE(CgFX)
NAME SeparateAlphaBlendEnable −3DAPI separate alpha blend enable
USAGESeparateAlphaBlendEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enables Direct3D’sseparate alpha blend mode. See the D3DRS_SEPARATEALPHABLENDENABLE
render state description for DirectX 9.
The standard reset callback sets the SeparateAlphaBlendEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend,
BlendOpAlpha, DestBlendAlpha, SrcBlendAlpha
perl v5.10.0 Cg Toolkit 3.0 1028
SHADEMODE(CgFX) CgFX States SHADEMODE(CgFX)
NAME ShadeMode −3DAPI shade mode
USAGEShadeMode = int(model)
VALID ENUMERANTS
model: Flat, Smooth, Gouraud, Phong
DESCRIPTION
Specify the shading model. See the OpenGL glShadeModel manual page for details. See the
D3DRS_SHADEMODE render state description for DirectX 9.
The standard reset callback sets the ShadeMode state to int(Smooth).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ShadeModel
perl v5.10.0 Cg Toolkit 3.0 1029
SHADEMODEL(CgFX) CgFX States SHADEMODEL(CgFX)
NAME ShadeModel −3DAPI shade model
USAGEShadeModel = int(model)
VALID ENUMERANTS
model: Flat, Smooth
DESCRIPTION
Specify the shading model. See the OpenGL glShadeModel manual page for details. See the
D3DRS_SHADEMODE render state description for DirectX 9.
The standard reset callback sets the ShadeModel state to int(Smooth).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ShadeMode
perl v5.10.0 Cg Toolkit 3.0 1030
SLOPSCALEDEPTHBIAS(CgFX) CgFX States SLOPSCALEDEPTHBIAS(CgFX)
NAME SlopScaleDepthBias −3DAPI slop scale depth bias
USAGESlopScaleDepthBias = float(factor)
VALID ENUMERANTS
factor: floating point value
DESCRIPTION
Specify the scale factor used to compute a depth offset for polygons. See the factor parameter description
on the OpenGL glPolygonOffset manual page for details. See the D3DRS_SLOPESCALEDEPTHBIAS
render state description for DirectX 9.
The standard reset callback sets the SlopScaleDepthBias state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PolygonOffset
perl v5.10.0 Cg Toolkit 3.0 1031
SPECULARENABLE(CgFX) CgFX States SPECULARENABLE(CgFX)
NAME SpecularEnable −3DAPI specular enable
USAGESpecularEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable Direct3D specular highlighting. See the D3DRS_SPECULARENABLE render state
description for DirectX 9.
The standard reset callback sets the SpecularEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
LightModelColorControl
perl v5.10.0 Cg Toolkit 3.0 1032
SPECULARMATERIALSOURCE(CgFX) CgFX States SPECULARMATERIALSOURCE(CgFX)
NAME SpecularMaterialSource −3DAPI specular material source
USAGESpecularMaterialSource = int(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable front and back specular color material. See the GL_SPECULAR description on the OpenGL
glColorMaterial manual page for details. See the D3DRS_SPECULARMATERIALSOURCE render state
description for DirectX 9.
The standard reset callback sets the SpecularMaterialSource state to int(AmbientAndDiffuse).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AmbientMaterialSource, ColorMaterial, DiffuseMaterialSource, EmissiveMaterialSource,
MaterialAmbient, MaterialDiffuse, MaterialEmission, MaterialEmissive,MaterialPower,
MaterialShininess, MaterialSpecular
perl v5.10.0 Cg Toolkit 3.0 1033
SRCBLEND(CgFX) CgFX States SRCBLEND(CgFX)
NAME SrcBlend −3DAPI src blend
USAGESrcBlend = int(sfactor)
VALID ENUMERANTS
sfactor: Zero, One, DestColor,InvDestColor,SrcAlpha, InvSrcAlpha, DstAlpha, InvDestAlpha,
SrcAlphaSat, SrcColor,InvSrcColor,BlendFactor,InvBlendFactor
DESCRIPTION
Specify the source blend factor.See the sfactor parameter description on the OpenGL glBlendFunc manual
page for details. See the D3DRS_SRCBLEND render state description for DirectX 9.
The standard reset callback sets the SrcBlend state to int(One).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, VertexBlend, BlendOpAlpha,
SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 1034
SRCBLENDALPHA(CgFX) CgFX States SRCBLENDALPHA(CgFX)
NAME SrcBlendAlpha −3DAPI source alpha blending type
USAGESrcBlendAlpha = int(blend)
VALID ENUMERANTS
blend: Zero, One, DestColor,InvDestColor,SrcAlpha, InvSrcAlpha, DstAlpha, InvDestAlpha,
SrcAlphaSat, SrcColor,InvSrcColor,BlendFactor,InvBlendFactor
DESCRIPTION
Set the Direct3D separate alpha blending source blend type. See the D3DRS_SRCBLENDALPHA render
state description for DirectX 9.
The standard reset callback sets the SrcBlendAlpha state to int(One).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, VertexBlend,
BlendOpAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 1035
STENCILENABLE(CgFX) CgFX States STENCILENABLE(CgFX)
NAME StencilEnable −3DAPI stencil enable
USAGEStencilEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable stencil testing. See the GL_STENCIL_TEST description on the OpenGL glEnable manual
page for details. See the D3DRS_STENCILENABLE render state description for DirectX 9.
The standard reset callback sets the StencilEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask, StencilMaskSeparate, StencilOp,
StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1036
STENCILFAIL(CgFX) CgFX States STENCILFAIL(CgFX)
NAME StencilFail −3DAPI stencil fail
USAGEStencilFail = int(sfail)
VALID ENUMERANTS
sfail: integer value
DESCRIPTION
Specify the action for stencil test failures. See the sfail parameter description on the OpenGL glStencilOp
manual page for details. See the D3DRS_STENCILFAIL render state description for DirectX 9.
The standard reset callback sets the StencilFail state to int(GL_KEEP).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFunc, StencilFuncSeparate, StencilMask, StencilMaskSeparate,
StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1037
STENCILFUNC(CgFX) CgFX States STENCILFUNC(CgFX)
NAME StencilFunc −3DAPI stencil func
USAGEStencilFunc = int(func) StencilFunc = int3(func, ref, mask)
VALID ENUMERANTS
func: Never, Less, LEqual, LessEqual, Equal, Greater,NotEqual, GEqual, GreaterEqual, Always ref:
integer value mask: integer value
DESCRIPTION
Specify the stencil test function. See the OpenGL glStencilFunc manual page for details. See the
D3DRS_STENCILFUNC render state description for DirectX 9.
The standard reset callback sets the StencilFunc state to int(Always) or int3(Always, 0, 0xFFFFFFFF).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFuncSeparate, StencilMask, StencilMaskSeparate,
StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1038
STENCILFUNCSEPARATE(CgFX) CgFX States STENCILFUNCSEPARATE(CgFX)
NAME StencilFuncSeparate −3DAPI stencil func separate
USAGEStencilFuncSeparate = int4(face, func, ref, mask)
VALID ENUMERANTS
face: Front, Back, FrontAndBack func: Never, Less, LEqual, Equal, Greater,NotEqual, GEqual, Always,
LessEqual, GreaterEqual ref: integer value mask: integer value
DESCRIPTION
Specify front and/or back stencil test functions. See the OpenGL glStencilFuncSeparate manual page for
details. See the D3DRS_STENCILFUNC, D3DRS_STENCILREF,D3DRS_STENCILMASK, and
D3DRS_CCW_STENCILFUNC render state descriptions for DirectX 9.
The standard reset callback sets the StencilFuncSeparate state to int4(GL_FRONT_AND_BACK,
GL_ALWA YS,00).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 2.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilMask, StencilMaskSeparate, StencilOp,
StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1039
STENCILMASK(CgFX) CgFX States STENCILMASK(CgFX)
NAME StencilMask −3DAPI stencil mask
USAGEStencilMask = int(mask)
VALID ENUMERANTS
mask: integer value
DESCRIPTION
Specify the stencil plane write mask. See the OpenGL glStencilMask manual page for details. See the
D3DRS_STENCILWRITEMASK render state description for DirectX 9.
The standard reset callback sets the StencilMask state to int(˜0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMaskSeparate,
StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, ColorMask, DepthMask, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1040
STENCILMASKSEPARATE(CgFX) CgFX States STENCILMASKSEPARATE(CgFX)
NAME StencilMaskSeparate −3DAPI stencil mask separate
USAGEStencilMaskSeparate = int2(face, mask)
VALID ENUMERANTS
face: Front, Back, FrontAndBack mask: integer value
DESCRIPTION
Specify front and/or back stencil plane write mask. See the OpenGL glStencilMaskSeparate manual page
for details. See the D3DRS_STENCILMASK render state description for DirectX 9.
The standard reset callback sets the StencilMaskSeparate state to int2(FrontAndBack, ˜0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 2.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask, StencilOp,
StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1041
STENCILOP(CgFX) CgFX States STENCILOP(CgFX)
NAME StencilOp −3DAPI stencil op
USAGEStencilOp = int3(sfail, dpfail, dppass)
VALID ENUMERANTS
sfail, dpfail, dppass: Keep, Zero, Replace, Incr,Decr,Inv e rt, IncrWrap, DecrWrap, IncrSat, DecrSat
DESCRIPTION
Specify actions for stencil and depth tests. See the OpenGL glStencilOp manual page for details. See the
D3DRS_STENCILFAIL, D3DRS_STENCILZFAIL, and D3DRS_STENCILPASS render state
descriptions for DirectX 9.
The standard reset callback sets the StencilOp state to int3(Keep, Keep, Keep).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable,
StencilTestTwoSideEnable, StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1042
STENCILOPSEPARATE(CgFX) CgFX States STENCILOPSEPARATE(CgFX)
NAME StencilOpSeparate −3DAPI stencil op separate
USAGEStencilOpSeparate = int4(face, sfail, dpfail, dppass)
VALID ENUMERANTS
face: Front, Back, FrontAndBack sfail, dpfail, dppass: Keep, Zero, Replace, Incr,Decr,Inv e rt, IncrWrap,
DecrWrap, IncrSat, DecrSat
DESCRIPTION
Specify actions for front and/or stencil and depth tests. See the OpenGL glStencilOpSeparate manual page
for details. See the D3DRS_STENCILFAIL, D3DRS_STENCILZFAIL, D3DRS_STENCILPASS,
D3DRS_CCW_STENCILFAIL, D3DRS_CCW_STENCILZFAIL, and D3DRS_CCW_STENCILPASS
render state descriptions for DirectX 9.
The standard reset callback sets the StencilOpSeparate state to int4(FrontAndBack, Keep, Keep, Keep).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 2.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilPass, StencilRef, StencilTestEnable, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1043
STENCILPASS(CgFX) CgFX States STENCILPASS(CgFX)
NAME StencilPass −3DAPI stencil pass
USAGEStencilPass = int(dppass)
VALID ENUMERANTS
dppass: integer value
DESCRIPTION
Specify action to takewhen both the stencil and depth tests pass. See the dppass parameter description on
the OpenGL glStencilOp manual page for details. See the D3DRS_STENCILPASS render state description
for DirectX 9.
The standard reset callback sets the StencilPass state to int(GL_KEEP).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilRef, StencilTestEnable,
StencilTestTwoSideEnable, StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1044
STENCILREF(CgFX) CgFX States STENCILREF(CgFX)
NAME StencilRef −3DAPI stencil ref
USAGEStencilRef = int(ref)
VALID ENUMERANTS
ref: integer value
DESCRIPTION
Specify the reference value for the stencil test. See the ref parameter description on the OpenGL
glStencilFunc manual page for details. See the D3DRS_STENCILREF render state description for DirectX
9.
The standard reset callback sets the StencilRef state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilPass, StencilTestEnable,
StencilTestTwoSideEnable, StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1045
STENCILTESTENABLE(CgFX) CgFX States STENCILTESTENABLE(CgFX)
NAME StencilTestEnable −3DAPI stencil test enable
USAGEStencilTestEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable stencil testing. See the GL_STENCIL_TEST description on the OpenGL glEnable manual
page for details. See the D3DRS_STENCILENABLE render state description for DirectX 9.
The standard reset callback sets the StencilTestEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestTwoSideEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1046
STENCILTESTTWOSIDEENABLE(CgFX) CgFX States STENCILTESTTWOSIDEENABLE(CgFX)
NAME StencilTestTwoSideEnable −3DAPI stencil test twoside enable
USAGEStencilTestTwoSideEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable two-sided stenciling. See the OpenGL EXT_stencil_two_side specification for details. See
the D3DRS_TWOSIDEDSTENCILMODE render state description for DirectX 9.
The standard reset callback sets the StencilTestTwoSideEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension EXT_stencil_two_side.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable,
StencilWriteMask, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1047
STENCILWRITEMASK(CgFX) CgFX States STENCILWRITEMASK(CgFX)
NAME StencilWriteMask −3DAPI stencil write mask
USAGEStencilWriteMask = int(mask)
VALID ENUMERANTS
mask: integer value
DESCRIPTION
Specify the stencil plane write mask. See the OpenGL glStencilMask manual page for details. See the
D3DRS_STENCILWRITEMASK render state description for DirectX 9.
The standard reset callback sets the StencilWriteMask state to int(˜0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable,
StencilTestTwoSideEnable, StencilZFail, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1048
STENCILZFAIL(CgFX) CgFX States STENCILZFAIL(CgFX)
NAME StencilZFail −3DAPI stencil Z fail
USAGEStencilZFail = int(dpfail)
VALID ENUMERANTS
dpfail: integer value
DESCRIPTION
Specifies action for when the stencil test passes but the depth test fails. See the dpfail parameter description
on the OpenGL glStencilOp manual page for details. See the D3DRS_STENCILZFAIL render state
description for DirectX 9.
The standard reset callback sets the StencilZFail state to int(GL_KEEP).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate, StencilMask,
StencilMaskSeparate, StencilOp, StencilOpSeparate, StencilPass, StencilRef, StencilTestEnable,
StencilTestTwoSideEnable, StencilWriteMask, TwoSidedStencilMode
perl v5.10.0 Cg Toolkit 3.0 1049
TESSELLATIONCONTROLPROGRAM(CgFX) CgFX States TESSELLATIONCONTROLPROGRAM(CgFX)
NAME TessellationControlProgram −3DAPI tessellation control program
USAGETessellationControlProgram = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
prog: Null
DESCRIPTION
Compile a tessellation control program. See the specification of the OpenGL tessellation control profile for
details. See the specification of the Direct3D 11 hull shaders for details.
The standard reset callback sets the TessellationControlProgram state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 11
SEE ALSO
FragmentProgram, GeometryProgram, TessellationEvaluationProgram, VertexProgram, GeometryShader,
PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader
perl v5.10.0 Cg Toolkit 3.0 1050
TESSELLATIONCONTROLSHADER(CgFX) CgFX States TESSELLATIONCONTROLSHADER(CgFX)
NAME TessellationControlShader −3DAPI tessellation control shader
USAGETessellationControlShader = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
shader: Null
DESCRIPTION
Compile a tessellation control shader.See the specification of the OpenGL tessellation control profile for
details. See the specification of the Direct3D 11 hull shaders for details.
The standard reset callback sets the TessellationControlShader state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 11
SEE ALSO
GeometryShader,PixelShader,TessellationEvaluationShader,VertexShader,FragmentProgram,
GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram
perl v5.10.0 Cg Toolkit 3.0 1051
TESSELLATIONEVALUATIONPROGRAM(CgFX)CgFX StatesTESSELLATIONEVALUATIONPROGRAM(CgFX)
NAME TessellationEvaluationProgram −3DAPI tessellation evaluation program
USAGETessellationEvaluationProgram = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
prog: Null
DESCRIPTION
Compile a tessellation evaluation program. See the specification of the OpenGL tessellation evaluation
profile for details. See the specification of the Direct3D 11 domain shaders for details.
The standard reset callback sets the TessellationEvaluationProgram state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 11
SEE ALSO
FragmentProgram, GeometryProgram, TessellationControlProgram, VertexProgram, GeometryShader,
PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader
perl v5.10.0 Cg Toolkit 3.0 1052
TESSELLATIONEVALUATIONSHADER(CgFX) CgFX States TESSELLATIONEVALUATIONSHADER(CgFX)
NAME TessellationEvaluationShader −3DAPI tessellation evaluation shader
USAGETessellationEvaluationShader = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
shader: Null
DESCRIPTION
Compile a tessellation evaluation shader.See the specification of the OpenGL tessellation evaluation
profile for details. See the specification of the Direct3D 11 domain shaders for details.
The standard reset callback sets the TessellationEvaluationShader state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 11
SEE ALSO
GeometryShader,PixelShader,TessellationControlShader,VertexShader,FragmentProgram,
GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram, VertexProgram
perl v5.10.0 Cg Toolkit 3.0 1053
TEXGENQENABLE(CgFX) CgFX States TEXGENQENABLE(CgFX)
NAME TexGenQEnable −3DAPI texgen Q enable
USAGETe xGenQEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL generation of the q texture coordinate. See the GL_TEXTURE_GEN_Q description
on the OpenGL glEnable manual page for details.
The standard reset callback sets the TexGenQEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenQEyePlane, TexGenQMode, TexGenQObjectPlane, TexGenREnable, TexGenSEnable,
Te x GenTEnable
perl v5.10.0 Cg Toolkit 3.0 1054
TEXGENQEYEPLANE(CgFX) CgFX States TEXGENQEYEPLANE(CgFX)
NAME TexGenQEyePlane −3DAPI texgen Q eye plane
USAGETe xGenQEyePlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the Q eye plane. See the GL_EYE_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenQEyePlane[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenQEnable, TexGenQMode, TexGenQObjectPlane, TexGenREyePlane, TexGenSEyePlane,
Te x GenTEyePlane
perl v5.10.0 Cg Toolkit 3.0 1055
TEXGENQMODE(CgFX) CgFX States TEXGENQMODE(CgFX)
NAME TexGenQMode −3DAPI texgen Q mode
USAGETe xGenQMode[i] = int(mode)
VALID ENUMERANTS
mode: ObjectLinear,EyeLinear,SphereMap, ReflectionMap, NormalMap
DESCRIPTION
Specify the Q texture coordinate generation mode. See the GL_TEXTURE_GEN_MODE description on the
OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenQMode[i] state to int(EyeLinear).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenQEnable, TexGenQEyePlane, TexGenQObjectPlane, TexGenRMode, TexGenSMode,
Te x GenTMode
perl v5.10.0 Cg Toolkit 3.0 1056
TEXGENQOBJECTPLANE(CgFX) CgFX States TEXGENQOBJECTPLANE(CgFX)
NAME TexGenQObjectPlane −3DAPI texgen Q object plane
USAGETe xGenQObjectPlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the Q object plane. See the GL_OBJECT_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenQObjectPlane[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenQEnable, TexGenQEyePlane, TexGenQMode, TexGenRObjectPlane, TexGenSObjectPlane,
Te x GenTObjectPlane
perl v5.10.0 Cg Toolkit 3.0 1057
TEXGENRENABLE(CgFX) CgFX States TEXGENRENABLE(CgFX)
NAME TexGenREnable −3DAPI texgen R enable
USAGETe xGenREnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL generation of the r texture coordinate. See the GL_TEXTURE_GEN_R description
on the OpenGL glEnable manual page for details.
The standard reset callback sets the TexGenREnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenREyePlane, TexGenRMode, TexGenRObjectPlane, TexGenQEnable, TexGenSEnable,
Te x GenTEnable
perl v5.10.0 Cg Toolkit 3.0 1058
TEXGENREYEPLANE(CgFX) CgFX States TEXGENREYEPLANE(CgFX)
NAME TexGenREyePlane −3DAPI texgen R eye plane
USAGETe xGenREyePlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the R eye plane. See the GL_EYE_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenREyePlane[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenREnable, TexGenRMode, TexGenRObjectPlane, TexGenQEyePlane, TexGenSEyePlane,
Te x GenTEyePlane
perl v5.10.0 Cg Toolkit 3.0 1059
TEXGENRMODE(CgFX) CgFX States TEXGENRMODE(CgFX)
NAME TexGenRMode −3DAPI texgen R mode
USAGETe xGenRMode[i] = int(mode)
VALID ENUMERANTS
mode: ObjectLinear,EyeLinear,SphereMap, ReflectionMap, NormalMap
DESCRIPTION
Specify the R texture coordinate generation mode. See the GL_TEXTURE_GEN_MODE description on the
OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenRMode[i] state to int(EyeLinear).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenREnable, TexGenREyePlane, TexGenRObjectPlane, TexGenQMode, TexGenSMode,
Te x GenTMode
perl v5.10.0 Cg Toolkit 3.0 1060
TEXGENROBJECTPLANE(CgFX) CgFX States TEXGENROBJECTPLANE(CgFX)
NAME TexGenRObjectPlane −3DAPI texgen R object plane
USAGETe xGenRObjectPlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the R object plane. See the GL_OBJECT_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenRObjectPlane[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenREnable, TexGenREyePlane, TexGenRMode, TexGenQObjectPlane, TexGenSObjectPlane,
Te x GenTObjectPlane
perl v5.10.0 Cg Toolkit 3.0 1061
TEXGENSENABLE(CgFX) CgFX States TEXGENSENABLE(CgFX)
NAME TexGenSEnable −3DAPI texgen S enable
USAGETe xGenSEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL generation of the s texture coordinate. See the GL_TEXTURE_GEN_S description
on the OpenGL glEnable manual page for details.
The standard reset callback sets the TexGenSEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenSEyePlane, TexGenSMode, TexGenSObjectPlane, TexGenQEnable, TexGenREnable,
Te x GenTEnable
perl v5.10.0 Cg Toolkit 3.0 1062
TEXGENSEYEPLANE(CgFX) CgFX States TEXGENSEYEPLANE(CgFX)
NAME TexGenSEyePlane −3DAPI texgen S eye plane
USAGETe xGenSEyePlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the S eye plane. See the GL_EYE_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenSEyePlane[i] state to float4(1, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenSEnable, TexGenSMode, TexGenSObjectPlane, TexGenQEyePlane, TexGenREyePlane,
Te x GenTEyePlane
perl v5.10.0 Cg Toolkit 3.0 1063
TEXGENSMODE(CgFX) CgFX States TEXGENSMODE(CgFX)
NAME TexGenSMode −3DAPI texgen S mode
USAGETe xGenSMode[i] = int(mode)
VALID ENUMERANTS
mode: ObjectLinear,EyeLinear,SphereMap, ReflectionMap, NormalMap
DESCRIPTION
Specify the S texture coordinate generation mode. See the GL_TEXTURE_GEN_MODE description on the
OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenSMode[i] state to int(EyeLinear).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenSEnable, TexGenSEyePlane, TexGenSObjectPlane, TexGenQMode, TexGenRMode,
Te x GenTMode
perl v5.10.0 Cg Toolkit 3.0 1064
TEXGENSOBJECTPLANE(CgFX) CgFX States TEXGENSOBJECTPLANE(CgFX)
NAME TexGenSObjectPlane −3DAPI texgen S object plane
USAGETe xGenSObjectPlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the S object plane. See the GL_OBJECT_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenSObjectPlane[i] state to float4(1, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenSEnable, TexGenSEyePlane, TexGenSMode, TexGenQObjectPlane, TexGenRObjectPlane,
Te x GenTObjectPlane
perl v5.10.0 Cg Toolkit 3.0 1065
TEXGENTENABLE(CgFX) CgFX States TEXGENTENABLE(CgFX)
NAME TexGenTEnable −3DAPI texgen T enable
USAGETe xGenTEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL generation of the t texture coordinate. See the GL_TEXTURE_GEN_T description
on the OpenGL glEnable manual page for details.
The standard reset callback sets the TexGenTEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenTEyePlane, TexGenTMode, TexGenTObjectPlane, TexGenQEnable, TexGenREnable,
Te x GenSEnable
perl v5.10.0 Cg Toolkit 3.0 1066
TEXGENTEYEPLANE(CgFX) CgFX States TEXGENTEYEPLANE(CgFX)
NAME TexGenTEyePlane −3DAPI texgen T eye plane
USAGETe xGenTEyePlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the T eye plane. See the GL_EYE_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenTEyePlane[i] state to float4(0, 1, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenTEnable, TexGenTMode, TexGenTObjectPlane, TexGenQEyePlane, TexGenREyePlane,
Te x GenSEyePlane
perl v5.10.0 Cg Toolkit 3.0 1067
TEXGENTMODE(CgFX) CgFX States TEXGENTMODE(CgFX)
NAME TexGenTMode −3DAPI texgen T mode
USAGETe xGenTMode[i] = int(mode)
VALID ENUMERANTS
mode: ObjectLinear,EyeLinear,SphereMap, ReflectionMap, NormalMap
DESCRIPTION
Specify the T texture coordinate generation mode. See the GL_TEXTURE_GEN_MODE description on the
OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenTMode[i] state to int(EyeLinear).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenTEnable, TexGenTEyePlane, TexGenTObjectPlane, TexGenQMode, TexGenRMode,
Te x GenSMode
perl v5.10.0 Cg Toolkit 3.0 1068
TEXGENTOBJECTPLANE(CgFX) CgFX States TEXGENTOBJECTPLANE(CgFX)
NAME TexGenTObjectPlane −3DAPI texgen T object plane
USAGETe xGenTObjectPlane[i] = float4(p1, p2, p3, p4)
VALID ENUMERANTS
p1, p2, p3, p4: floating point values
DESCRIPTION
Specify the texture coordinate generation parameters for the T object plane. See the GL_OBJECT_PLANE
description on the OpenGL glTexGen manual page for details.
The standard reset callback sets the TexGenTObjectPlane[i] state to float4(0, 1, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x GenTEnable, TexGenTEyePlane, TexGenTMode, TexGenQObjectPlane, TexGenRObjectPlane,
Te x GenSObjectPlane
perl v5.10.0 Cg Toolkit 3.0 1069
TEXTURE1D(CgFX) CgFX States TEXTURE1D(CgFX)
NAME Texture1D −3DAPI texture1D
USAGETe xture1D[i] = sampler1D(samp)
VALID ENUMERANTS
samp: sampler
DESCRIPTION
Specify the 1D texture to be used. See the GL_TEXTURE_1D description on the OpenGL glBindTexture
manual page for details. See the IDirect3DDevice9::SetTexture method for details.
The standard reset callback sets the Texture1D[i] state to sampler1D (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1070
TEXTURE1DENABLE(CgFX) CgFX States TEXTURE1DENABLE(CgFX)
NAME Texture1DEnable −3DAPI texture1D enable
USAGETe xture1DEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL one-dimensional texturing. See the GL_TEXTURE_1D description on the OpenGL
glEnable manual page for details.
The standard reset callback sets the Texture1DEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable, Texture1D,
Te x ture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1071
TEXTURE2D(CgFX) CgFX States TEXTURE2D(CgFX)
NAME Texture2D −3DAPI texture2D
USAGETe xture2D[i] = sampler2D(samp)
VALID ENUMERANTS
samp: sampler
DESCRIPTION
Specify the 2D texture to be used. See the GL_TEXTURE_2D description on the OpenGL glBindTexture
manual page for details. See the IDirect3DDevice9::SetTexture method for details.
The standard reset callback sets the Texture2D[i] state to sampler2D (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1072
TEXTURE2DENABLE(CgFX) CgFX States TEXTURE2DENABLE(CgFX)
NAME Texture2DEnable −3DAPI texture2D enable
USAGETe xture2DEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL two-dimensional texturing. See the GL_TEXTURE_2D description on the OpenGL
glEnable manual page for details.
The standard reset callback sets the Texture2DEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture1DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable, Texture1D,
Te x ture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1073
TEXTURE3D(CgFX) CgFX States TEXTURE3D(CgFX)
NAME Texture3D −3DAPI texture3D
USAGETe xture3D[i] = sampler3D(samp)
VALID ENUMERANTS
samp: sampler
DESCRIPTION
Specify the 3D texture to be used. See the GL_TEXTURE_3D description on the OpenGL glBindTexture
manual page for details. See the IDirect3DDevice9::SetTexture method for details.
The standard reset callback sets the Texture3D[i] state to sampler3D (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1074
TEXTURE3DENABLE(CgFX) CgFX States TEXTURE3DENABLE(CgFX)
NAME Texture3DEnable −3DAPI texture3D enable
USAGETe xture3DEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL three-dimensional texturing. See the GL_TEXTURE_3D description on the
OpenGL glEnable manual page for details.
The standard reset callback sets the Texture3DEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture1DEnable, Texture2DEnable, TextureCubeMapEnable, TextureRectangleEnable, Texture1D,
Te x ture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode,
Te x tureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1075
TEXTURECUBEMAP(CgFX) CgFX States TEXTURECUBEMAP(CgFX)
NAME TextureCubeMap −3DAPI texture cube map
USAGETe xtureCubeMap[i] = samplerCUBE(samp)
VALID ENUMERANTS
samp: sampler
DESCRIPTION
Specify the cube map texture to be used. See the GL_TEXTURE_CUBE_MAP description on the OpenGL
glBindTexture manual page for details. See the IDirect3DDevice9::SetTexture method for details.
The standard reset callback sets the TextureCubeMap[i] state to samplerCUBE (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureRectangle, TextureEnvColor,TextureEnvMode, TextureFactor,
Te x tureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,MaxMipLevel, MinFilter,
MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1076
TEXTURECUBEMAPENABLE(CgFX) CgFX States TEXTURECUBEMAPENABLE(CgFX)
NAME TextureCubeMapEnable −3DAPI texture cube map enable
USAGETe xtureCubeMapEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL cube-mapped texturing. See the GL_TEXTURE_CUBE_MAP_ARB description on
the OpenGL glEnable manual page for details.
The standard reset callback sets the TextureCubeMapEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureRectangleEnable, Texture1D, Texture2D,
Te x ture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode, TextureFactor,
Te x tureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,MaxMipLevel, MinFilter,
MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1077
TEXTUREENVCOLOR(CgFX) CgFX States TEXTUREENVCOLOR(CgFX)
NAME TextureEnvColor −3DAPI texture envcolor
USAGETe xtureEnvColor[i] = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Specify the color used for multiple-texture blending. See the GL_TEXTURE_ENV_COLOR description on
the OpenGL glTexEnvmanual page for details. See the D3DRS_TEXTUREFACTORrender state
description and the D3DTSS_COLORARG2 texture stage description for details.
The standard reset callback sets the TextureEnvColor[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvMode, TextureFactor,
Te x tureMatrix, TextureTransform, TextureTransformFlags
perl v5.10.0 Cg Toolkit 3.0 1078
TEXTUREENVMODE(CgFX) CgFX States TEXTUREENVMODE(CgFX)
NAME TextureEnvMode −3DAPI texture envmode
USAGETe xtureEnvMode[i] = int(mode)
VALID ENUMERANTS
mode: Modulate, Decal, Blend, Replace, Add
DESCRIPTION
Set the texture environment mode. See the GL_TEXTURE_ENV_MODE description on the OpenGL
glTexEnvmanual page for details. See the D3DTSS_COLOROP texture stage state description for DirectX
9.
The standard reset callback sets the TextureEnvMode[i] state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ColorOp, Texture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable,
Te x tureRectangleEnable, Texture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle,
Te x tureEnvColor,TextureFactor,TextureMatrix, TextureTransform, TextureTransformFlags, Texture,
MagFilter,MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1079
TEXTUREFACTOR(CgFX) CgFX States TEXTUREFACTOR(CgFX)
NAME TextureFactor −3DAPI texture factor
USAGETe xtureFactor = int(color)
VALID ENUMERANTS
color: integer value
DESCRIPTION
Specify the color used for multiple-texture blending. See the D3DRS_TEXTUREFACTORrender state
description for DirectX 9.
The standard reset callback sets the TextureFactor state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,
Te x tureEnvMode, TextureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,
MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1080
TEXTUREMATRIX(CgFX) CgFX States TEXTUREMATRIX(CgFX)
NAME TextureMatrix −3DAPI texture matrix
USAGETe xtureMatrix = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the texture matrix. See the GL_TEXTURE description on the OpenGL glMatrixMode
manual page for details. See the description of the D3DTS_TEXTUREi transform state type for the
IDirect3DDevice9::SetTransform method.
The standard reset callback sets the TextureMatrix state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,
Te x tureEnvMode, TextureFactor,TextureTransform, TextureTransformFlags
perl v5.10.0 Cg Toolkit 3.0 1081
TEXTURERECTANGLE(CgFX) CgFX States TEXTURERECTANGLE(CgFX)
NAME TextureRectangle −3DAPI texture rectangle
USAGETe xtureRectangle[i] = samplerRECT(samp)
VALID ENUMERANTS
samp: sampler
DESCRIPTION
Specify the rectangle texture to be used. See the GL_TEXTURE_RECTANGLE_NV description in the
OpenGL NV_texture_rectangle specification for details. See the IDirect3DDevice9::SetTexture method for
details.
The standard reset callback sets the TextureRectangle[i] state to samplerRECT (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureEnvColor,TextureEnvMode, TextureFactor,
Te x tureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,MaxMipLevel, MinFilter,
MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1082
TEXTURERECTANGLEENABLE(CgFX) CgFX States TEXTURERECTANGLEENABLE(CgFX)
NAME TextureRectangleEnable −3DAPI texture rectangle enable
USAGETe xtureRectangleEnable[i] = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL non-power-of-twotexturing. See the OpenGL NV_texture_rectangle specification
for details.
The standard reset callback sets the TextureRectangleEnable[i] state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, Texture1D, Texture2D,
Te x ture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,TextureEnvMode, TextureFactor,
Te x tureMatrix, TextureTransform, TextureTransformFlags, Texture, MagFilter,MaxMipLevel, MinFilter,
MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1083
TEXTURETRANSFORM(CgFX) CgFX States TEXTURETRANSFORM(CgFX)
NAME TextureTransform −3DAPI texture transform
USAGETe xtureTransform = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the texture matrix. See the GL_TEXTURE description on the OpenGL glMatrixMode
manual page for details. See the description of the D3DTS_TEXTUREi transform state type for the
IDirect3DDevice9::SetTransform method.
The standard reset callback sets the TextureTransform state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,
Te x tureEnvMode, TextureFactor,TextureMatrix, TextureTransformFlags
perl v5.10.0 Cg Toolkit 3.0 1084
TWEENFACTOR(CgFX) CgFX States TWEENFACTOR(CgFX)
NAME TweenFactor −3DAPI tween factor
USAGETweenFactor = float(factor)
VALID ENUMERANTS
factor: floating point value
DESCRIPTION
Specify the tween factor.See the D3DRS_TWEENFACTORrender state description for DirectX 9.
The standard reset callback sets the TweenFactor state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 1085
TWOSIDEDSTENCILMODE(CgFX) CgFX States TWOSIDEDSTENCILMODE(CgFX)
NAME Tw oSidedStencilMode −3DAPI twosided stencil mode
USAGETw oSidedStencilMode = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable Direct3D’stwo-sided stenciling. See the D3DRS_TWOSIDEDSTENCILMODE render state
description for DirectX 9.
The standard reset callback sets the TwoSidedStencilMode state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
StencilOpSeparate ClearStencil, StencilEnable, StencilFail, StencilFunc, StencilFuncSeparate,
StencilMask, StencilMaskSeparate, StencilOp, StencilPass, StencilRef, StencilTestEnable,
StencilTestTwoSideEnable, StencilWriteMask, StencilZFail
perl v5.10.0 Cg Toolkit 3.0 1086
VERTEXBLEND(CgFX) CgFX States VERTEXBLEND(CgFX)
NAME VertexBlend −3DAPI vertexblend
USAGEVertexBlend = int(num)
VALID ENUMERANTS
num: integer value
DESCRIPTION
Specify the number of matrices to use to perform geometry blending. See the D3DRS_VERTEXBLEND
render state description for DirectX 9.
The standard reset callback sets the VertexBlend state to int(Disable).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaBlendEnable, BlendEnable, BlendColor,BlendEquation, BlendEquationSeparate, BlendFunc,
BlendFuncSeparate, BlendOp, DestBlend, IndexedVertexBlendEnable, SrcBlend, BlendOpAlpha,
SrcBlendAlpha, DestBlendAlpha, SeparateAlphaBlendEnable
perl v5.10.0 Cg Toolkit 3.0 1087
VERTEXENVPARAMETER(CgFX) CgFX States VERTEXENVPARAMETER(CgFX)
NAME VertexEnvParameter −3DAPI vertexenv parameter
USAGEVertexEnvParameter[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Set vertexprogram environment parameter.See the OpenGL glProgramEnvParameter4fvARB manual
page for details.
The standard reset callback sets the VertexEnvParameter[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FragmentEnvParameter,FragmentLocalParameter,VertexLocalParameter,PixelShaderConstant,
PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4
perl v5.10.0 Cg Toolkit 3.0 1088
VERTEXLOCALPARAMETER(CgFX) CgFX States VERTEXLOCALPARAMETER(CgFX)
NAME VertexLocalParameter −3DAPI vertexlocal parameter
USAGEVertexLocalParameter[i] = float4(x, y,z,w)
VALID ENUMERANTS
x, y,z,w:floating point values
DESCRIPTION
Set vertexprogram local parameter.See the OpenGL glProgramLocalParameter4fvARB manual page for
details.
The standard reset callback sets the VertexLocalParameter[i] state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FragmentEnvParameter,FragmentLocalParameter,VertexEnvParameter,PixelShaderConstant,
PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3, PixelShaderConstant4,
PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI, VertexShaderConstant,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4
perl v5.10.0 Cg Toolkit 3.0 1089
VERTEXPROGRAM(CgFX) CgFX States VERTEXPROGRAM(CgFX)
NAME VertexProgram −3DAPI vertexprogram
USAGEVertexProgram = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
prog: Null
DESCRIPTION
Compile a vertexprogram. See the specification of the OpenGL vertexprofile for details. See the
specification of the Direct3D vertexshaders for details.
The standard reset callback sets the VertexProgram state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
FragmentProgram, GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram,
GeometryShader,PixelShader,TessellationControlShader,TessellationEvaluationShader,VertexShader
perl v5.10.0 Cg Toolkit 3.0 1090
VERTEXPROGRAMPOINTSIZEENABLE(CgFX)CgFX StatesVERTEXPROGRAMPOINTSIZEENABLE(CgFX)
NAME VertexProgramPointSizeEnable −3DAPI vertexprogram point size enable
USAGEVertexProgramPointSizeEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable using OpenGL shader builtin gl_PointSize in vertexshaders. See the
GL_VERTEX_PROGRAM_POINT_SIZE description on the OpenGL glEnable manual page for details.
The standard reset callback sets the VertexProgramPointSizeEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
PointScaleEnable, PointScale_A, PointScale_B, PointScale_C, PointSizeMax, PointSizeMin, PointSize
perl v5.10.0 Cg Toolkit 3.0 1091
VERTEXPROGRAMTWOSIDEENABLE(CgFX) CgFX States VERTEXPROGRAMTWOSIDEENABLE(CgFX)
NAME VertexProgramTwoSideEnable −3DAPI vertexprogram twoside enable
USAGEVertexProgramTwoSideEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable OpenGL vertexprogram color selection based on the polygon face direction. See the
GL_VERTEX_PROGRAM_TWO_SIDE description on the OpenGL glEnable manual page for details.
The standard reset callback sets the VertexProgramTwoSideEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
FrontFace
perl v5.10.0 Cg Toolkit 3.0 1092
VERTEXSHADER(CgFX) CgFX States VERTEXSHADER(CgFX)
NAME VertexShader −3DAPI vertexshader
USAGEVertexShader = compile profile ‘‘−po profileOption’’main(args);
VALID ENUMERANTS
shader: Null
DESCRIPTION
Compile a vertexshader.See the specification of the OpenGL vertexprofile for details. See the
specification of the Direct3D vertexshaders for details.
The standard reset callback sets the VertexShader state to program(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
GeometryShader,PixelShader,TessellationControlShader,TessellationEvaluationShader,
FragmentProgram, GeometryProgram, TessellationControlProgram, TessellationEvaluationProgram,
VertexProgram
perl v5.10.0 Cg Toolkit 3.0 1093
VERTEXSHADERCONSTANT(CgFX) CgFX States VERTEXSHADERCONSTANT(CgFX)
NAME VertexShaderConstant −3DAPI vertexshader constant
USAGEVertexShaderConstant[i] = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1094
VERTEXSHADERCONSTANT1(CgFX) CgFX States VERTEXSHADERCONSTANT1(CgFX)
NAME VertexShaderConstant1 −3DAPI vertexshader constant1
USAGEVertexShaderConstant1[i] = float4(f1, f2, f3, f4)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant2, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1095
VERTEXSHADERCONSTANT2(CgFX) CgFX States VERTEXSHADERCONSTANT2(CgFX)
NAME VertexShaderConstant2 −3DAPI vertexshader constant2
USAGEVertexShaderConstant2[i] = float4x2(f1, f2, f3, f4, f5, f6, f7, f8)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant3, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1096
VERTEXSHADERCONSTANT3(CgFX) CgFX States VERTEXSHADERCONSTANT3(CgFX)
NAME VertexShaderConstant3 −3DAPI vertexshader constant3
USAGEVertexShaderConstant3[i] = float4x3(f1, f2, f3, f4, .... , f9, f10, f11, f12)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstantB,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1097
VERTEXSHADERCONSTANTB(CgFX) CgFX States VERTEXSHADERCONSTANTB(CgFX)
NAME VertexShaderConstantB −3DAPI vertexshader constantB
USAGEVertexShaderConstantB[i] = bool4(b1, b2, b3, b4)
VALID ENUMERANTS
bi: true, false
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantB method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3,
VertexShaderConstantF,VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1098
VERTEXSHADERCONSTANTF(CgFX) CgFX States VERTEXSHADERCONSTANTF(CgFX)
NAME VertexShaderConstantF −3DAPI vertexshader constantF
USAGEVertexShaderConstantF[i] = float4(f1, f2, f3, f4)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3,
VertexShaderConstantB, VertexShaderConstantI, vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1099
VERTEXSHADERCONSTANTI(CgFX) CgFX States VERTEXSHADERCONSTANTI(CgFX)
NAME VertexShaderConstantI −3DAPI vertexshader constantI
USAGEVertexShaderConstantI[i] = int4(i1, i2, i3, i4)
VALID ENUMERANTS
ii: integer values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantI method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3,
VertexShaderConstantB, VertexShaderConstantF,vertexShaderConstant4, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1100
VIEWTRANSFORM(CgFX) CgFX States VIEWTRANSFORM(CgFX)
NAME ViewTransform −3DAPI viewtransform
USAGEViewTransform = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the viewmatrix. See the description of the D3DTS_VIEW transform state type for the
IDirect3DDevice9::SetTransform method.
The standard reset callback sets the ViewTransform state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewMatrix, ModelViewTransform, ProjectionMatrix, ProjectionTransform, WorldTransform
perl v5.10.0 Cg Toolkit 3.0 1101
WORLDTRANSFORM(CgFX) CgFX States WORLDTRANSFORM(CgFX)
NAME WorldTransform −3DAPI world transform
USAGEWorldTransform = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set the values of the world matrix. See the description of the D3DTS_WORLD transform state type for the
IDirect3DDevice9::SetTransform method.
The standard reset callback sets the WorldTransform state to the identity matrix.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ModelViewMatrix, ModelViewTransform, ProjectionMatrix, ProjectionTransform, ViewTransform
perl v5.10.0 Cg Toolkit 3.0 1102
WRAP0(CgFX) CgFX States WRAP0(CgFX)
NAME Wrap0 −3DAPI wrap0
USAGEWrap0 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 0. See the D3DRS_WRAP0 render state
description for DirectX 9.
The standard reset callback sets the Wrap0 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1103
WRAP1(CgFX) CgFX States WRAP1(CgFX)
NAME Wrap1 −3DAPI wrap1
USAGEWrap1 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 1. See the D3DRS_WRAP1 render state
description for DirectX 9.
The standard reset callback sets the Wrap1 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1104
WRAP10(CgFX) CgFX States WRAP10(CgFX)
NAME Wrap10 −3DAPI wrap10
USAGEWrap10 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 10. See the D3DRS_WRAP10 render state
description for DirectX 9.
The standard reset callback sets the Wrap10 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap11, Wrap12, Wrap13,
Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1105
WRAP11(CgFX) CgFX States WRAP11(CgFX)
NAME Wrap11 −3DAPI wrap11
USAGEWrap11 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 11. See the D3DRS_WRAP11 render state
description for DirectX 9.
The standard reset callback sets the Wrap11 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap12, Wrap13,
Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1106
WRAP12(CgFX) CgFX States WRAP12(CgFX)
NAME Wrap12 −3DAPI wrap12
USAGEWrap12 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 12. See the D3DRS_WRAP12 render state
description for DirectX 9.
The standard reset callback sets the Wrap12 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap13,
Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1107
WRAP13(CgFX) CgFX States WRAP13(CgFX)
NAME Wrap13 −3DAPI wrap13
USAGEWrap13 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 13. See the D3DRS_WRAP13 render state
description for DirectX 9.
The standard reset callback sets the Wrap13 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1108
WRAP14(CgFX) CgFX States WRAP14(CgFX)
NAME Wrap14 −3DAPI wrap14
USAGEWrap14 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 14. See the D3DRS_WRAP14 render state
description for DirectX 9.
The standard reset callback sets the Wrap14 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1109
WRAP15(CgFX) CgFX States WRAP15(CgFX)
NAME Wrap15 −3DAPI wrap15
USAGEWrap15 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 15. See the D3DRS_WRAP15 render state
description for DirectX 9.
The standard reset callback sets the Wrap15 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14
perl v5.10.0 Cg Toolkit 3.0 1110
WRAP2(CgFX) CgFX States WRAP2(CgFX)
NAME Wrap2 −3DAPI wrap2
USAGEWrap2 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 2. See the D3DRS_WRAP2 render state
description for DirectX 9.
The standard reset callback sets the Wrap2 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1111
WRAP3(CgFX) CgFX States WRAP3(CgFX)
NAME Wrap3 −3DAPI wrap3
USAGEWrap3 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 3. See the D3DRS_WRAP3 render state
description for DirectX 9.
The standard reset callback sets the Wrap3 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1112
WRAP4(CgFX) CgFX States WRAP4(CgFX)
NAME Wrap4 −3DAPI wrap4
USAGEWrap4 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 4. See the D3DRS_WRAP4 render state
description for DirectX 9.
The standard reset callback sets the Wrap4 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap5, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1113
WRAP5(CgFX) CgFX States WRAP5(CgFX)
NAME Wrap5 −3DAPI wrap5
USAGEWrap5 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 5. See the D3DRS_WRAP5 render state
description for DirectX 9.
The standard reset callback sets the Wrap5 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap6, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1114
WRAP6(CgFX) CgFX States WRAP6(CgFX)
NAME Wrap6 −3DAPI wrap6
USAGEWrap6 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 6. See the D3DRS_WRAP6 render state
description for DirectX 9.
The standard reset callback sets the Wrap6 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap7, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1115
WRAP7(CgFX) CgFX States WRAP7(CgFX)
NAME Wrap7 −3DAPI wrap7
USAGEWrap7 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 7. See the D3DRS_WRAP7 render state
description for DirectX 9.
The standard reset callback sets the Wrap7 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap8, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1116
WRAP8(CgFX) CgFX States WRAP8(CgFX)
NAME Wrap8 −3DAPI wrap8
USAGEWrap8 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 8. See the D3DRS_WRAP8 render state
description for DirectX 9.
The standard reset callback sets the Wrap8 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap9, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1117
WRAP9(CgFX) CgFX States WRAP9(CgFX)
NAME Wrap9 −3DAPI wrap9
USAGEWrap9 = int(flags)
VALID ENUMERANTS
flags: integer value
Anycombination of D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and
D3DWRAPCOORD_3. Setting flags to 0 disables texture wrapping in all directions.
DESCRIPTION
Set the Direct3D texture wrapping state for texture coordinate 9. See the D3DRS_WRAP9 render state
description for DirectX 9.
The standard reset callback sets the Wrap9 state to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Wrap0, Wrap1, Wrap2, Wrap3, Wrap4, Wrap5, Wrap6, Wrap7, Wrap8, Wrap10, Wrap11, Wrap12,
Wrap13, Wrap14, Wrap15
perl v5.10.0 Cg Toolkit 3.0 1118
ZENABLE(CgFX) CgFX States ZENABLE(CgFX)
NAME ZEnable −3DAPI Zenable
USAGEZEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Enable/disable depth testing. See the GL_DEPTH_TEST description on the OpenGL glEnable manual page
for details. See the D3DRS_ZENABLE render state description for DirectX 9.
The standard reset callback sets the ZEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthFunc, DepthMask,
DepthRange, DepthTestEnable, SlopScaleDepthBias, ZFunc, ZWriteEnable
perl v5.10.0 Cg Toolkit 3.0 1119
ZFUNC(CgFX) CgFX States ZFUNC(CgFX)
NAME ZFunc −3DAPI Zfunc
USAGEZFunc = int(func)
VALID ENUMERANTS
func: Never, Less, LEqual, LessEqual, Equal, Greater,NotEqual, GEqual, GreaterEqual, Always
DESCRIPTION
Specify the function used for depth buffer comparisons. See the OpenGL glDepthFunc manual page for
details. See the D3DRS_ZFUNC render state description for DirectX 9.
The standard reset callback sets the ZFunc state to int(Less).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthTestEnable,
DepthFunc, DepthMask, DepthRange, DepthTestEnable, SlopScaleDepthBias, ZEnable, ZWriteEnable
perl v5.10.0 Cg Toolkit 3.0 1120
ZWRITEENABLE(CgFX) CgFX States ZWRITEENABLE(CgFX)
NAME ZWriteEnable −3DAPI Zwrite enable
USAGEZWriteEnable = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Specify whether the depth buffer is enabled for writing. See the OpenGL glDepthMask manual page for
details. See the D3DRS_ZWRITEENABLE render state description for DirectX 9.
The standard reset callback sets the ZWriteEnable state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
ClearDepth, DepthBias, DepthBounds, DepthBoundsEnable, DepthClampEnable, DepthTestEnable,
DepthFunc, DepthMask, DepthRange, DepthTestEnable, SlopScaleDepthBias, ZEnable, ZFunc
perl v5.10.0 Cg Toolkit 3.0 1121
VERTEXSHADERCONSTANT4(CgFX) CgFX States VERTEXSHADERCONSTANT4(CgFX)
NAME vertexShaderConstant4 −3DAPI vertexshader constant4
USAGEvertexShaderConstant4[i] = float4x4(f1, f2, f3, f4, ... , f13, f14, f15, f16)
VALID ENUMERANTS
fi: floating point values
DESCRIPTION
Set a Direct3D vertexshader constant. See the IDirect3DDevice9::SetVertexShaderConstantF method for
details.
The standard reset callback does nothing.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
PixelShaderConstant, PixelShaderConstant1, PixelShaderConstant2, PixelShaderConstant3,
PixelShaderConstant4, PixelShaderConstantB, PixelShaderConstantF,PixelShaderConstantI,
VertexShaderConstant, VertexShaderConstant1, VertexShaderConstant2, VertexShaderConstant3,
VertexShaderConstantB, VertexShaderConstantF,VertexShaderConstantI, FragmentEnvParameter,
FragmentLocalParameter,VertexEnvParameter,VertexLocalParameter
perl v5.10.0 Cg Toolkit 3.0 1122
ADDRESSU(CgFX) CgFX Sampler States ADDRESSU(CgFX)
NAME AddressU −3DAPI Utexture addressing mode
USAGEAddressU = int(mode)
WrapS = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Set the Direct3D u−direction texture wrapping mode. See the D3DSAMP_ADDRESSU sampler state
description for DirectX 9.
Set the wrap parameter for texture coordinate S. See the GL_TEXTURE_WRAP_S description on the
OpenGL glTexParameter manual page for details.
The standard reset callback sets the AddressU or WrapS state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Clamp, Repeat, Wrap: OpenGL 1.0
ClampToEdge: OpenGL 1.2
Border,ClampToBorder: OpenGL 1.3
Mirror,MirroredRepeat: OpenGL 1.4
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce: support for extension
EXT_mirror_clamp.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressUi, AddressV,AddressW,WrapS, WrapT,WrapR
perl v5.10.0 Cg Toolkit 3.0 1123
ADDRESSV(CgFX) CgFX Sampler States ADDRESSV(CgFX)
NAME AddressV −3DAPI Vtexture addressing mode
USAGEAddressV = int(mode)
WrapT = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Set the Direct3D v−direction texture wrapping mode. See the D3DSAMP_ADDRESSV sampler state
description for DirectX 9.
Set the wrap parameter for texture coordinate T.See the GL_TEXTURE_WRAP_T description on the
OpenGL glTexParameter manual page for details.
The standard reset callback sets the AddressV or WrapT state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Clamp, Repeat, Wrap: OpenGL 1.0
ClampToEdge: OpenGL 1.2
Border,ClampToBorder: OpenGL 1.3
Mirror,MirroredRepeat: OpenGL 1.4
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce: support for extension
EXT_mirror_clamp.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressVi, AddressU, AddressW,WrapS, WrapT,WrapR
perl v5.10.0 Cg Toolkit 3.0 1124
ADDRESSW(CgFX) CgFX Sampler States ADDRESSW(CgFX)
NAME AddressW −3DAPI Wtexture addressing mode
USAGEAddressW = int(mode)
WrapR = int(mode)
VALID ENUMERANTS
mode: Repeat, Wrap, Clamp, ClampToEdge, ClampToBorder,Border,MirroredRepeat, Mirror,
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce
DESCRIPTION
Set the Direct3D w−direction texture wrapping mode. See the D3DSAMP_ADDRESSW sampler state
description for DirectX 9.
Set the wrap parameter for texture coordinate R. See the GL_TEXTURE_WRAP_R description on the
OpenGL glTexParameter manual page for details.
The standard reset callback sets the AddressW or WrapR state to int(Wrap).
OPENGL FUNCTIONALITY REQUIREMENTS
Clamp, Repeat, Wrap: OpenGL 1.0
ClampToEdge: OpenGL 1.2
Border,ClampToBorder: OpenGL 1.3
Mirror,MirroredRepeat: OpenGL 1.4
MirrorClamp, MirrorClampToEdge, MirrorClampToBorder,MirrorOnce: support for extension
EXT_mirror_clamp.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AddressWi, AddressU, AddressV,WrapS, WrapT,WrapR
perl v5.10.0 Cg Toolkit 3.0 1125
ALPHAARG0(CgFX) CgFX Sampler States ALPHAARG0(CgFX)
NAME AlphaArg0 −3DAPI AlphaArg0
USAGEAlphaArg0 = int(third)
VALID ENUMERANTS
third: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify the alpha channel selector operand for triadic operations. See the D3DTSS_ALPHAARG0 texture
stage state description for DirectX 9.
The standard reset callback sets the AlphaArg0 state to int(Current).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1126
ALPHAARG1(CgFX) CgFX Sampler States ALPHAARG1(CgFX)
NAME AlphaArg1 −3DAPI AlphaArg1
USAGEAlphaArg1 = int(first)
VALID ENUMERANTS
first: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify the first alpha argument for the stage. See the D3DTSS_ALPHAARG1 texture stage state
description for DirectX 9.
The standard reset callback sets the AlphaArg1 state to int(Texture).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1127
ALPHAARG2(CgFX) CgFX Sampler States ALPHAARG2(CgFX)
NAME AlphaArg2 −3DAPI AlphaArg2
USAGEAlphaArg2 = int(second)
VALID ENUMERANTS
second: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify the second alpha argument for the stage. See the D3DTSS_ALPHAARG2 texture stage state
description for DirectX 9.
The standard reset callback sets the AlphaArg2 state to int(Current).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1128
ALPHAOP(CgFX) CgFX Sampler States ALPHAOP(CgFX)
NAME AlphaOp −3DAPI alpha operator
USAGEAlphaOp = int(op)
VALID ENUMERANTS
op: Disable, SelectArg1, SelectArg2, Modulate, Modulate2x, Modulate4x, Add, AddSigned,
AddSigned2x, Subtract, AddSmooth, BlendDiffuseAlpha, BlendTextureAlpha, BlendFactorAlpha,
BlendTextureAlphaPM, BlendCurrentAlpha, PreModulate, ModulateAlpha_AddColor,
ModulateColor_AddAlpha, ModulateInvAlpha_AddColor,ModulateInvColor_AddAlpha,
BumpEnvMap, BumpEnvMapLuminance, DotProduct3, MultiplyAdd, Lerp
DESCRIPTION
Specify the alpha blending operation for this texture stage. See the D3DTSS_ALPHAOP texture stage state
description for DirectX 9.
The standard reset callback sets the AlphaOp state to int(SelectArg1) if iis zero and int(Disable) otherwise.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaRef, AlphaTestEnable,
ColorArg0, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1129
BORDERCOLOR(CgFX) CgFX Sampler States BORDERCOLOR(CgFX)
NAME BorderColor −3DAPI texture border color
USAGEBorderColor = float4(r,g,b,a)
VALID ENUMERANTS
r, g,b,a:floating point values
DESCRIPTION
Set the Direct3D sampler border color.See the GL_TEXTURE_BORDER_COLOR description on the
OpenGL glTexParameter manual page for details. See the D3DSAMP_BORDERCOLOR sampler state
description for DirectX 9.
The standard reset callback sets the BorderColor state to float4(0, 0, 0, 0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BorderColori
perl v5.10.0 Cg Toolkit 3.0 1130
BUMPENVLOFFSET(CgFX) CgFX Sampler States BUMPENVLOFFSET(CgFX)
NAME BumpEnvLOffset −3DAPI bump environment L offset
USAGEBumpEnvLOffset = float(offset)
VALID ENUMERANTS
offset: floating point value
DESCRIPTION
Specify the offset value for bump-map luminance. See the D3DTSS_BUMPENVLOFFSET texture stage
state description for DirectX 9.
The standard reset callback sets the BumpEnvLOffset state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvLScale, BumpEnvMat00, BumpEnvMat01, BumpEnvMat10, BumpEnvMat11
perl v5.10.0 Cg Toolkit 3.0 1131
BUMPENVLSCALE(CgFX) CgFX Sampler States BUMPENVLSCALE(CgFX)
NAME BumpEnvLScale −3DAPI bump environment L scale
USAGEBumpEnvLScale = float(scale)
VALID ENUMERANTS
scale: floating point value
DESCRIPTION
Specify the scale value for bump-map luminance. See the D3DTSS_BUMPENVLSCALE texture stage
state description for DirectX 9.
The standard reset callback sets the BumpEnvLScale state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvLOffset, BumpEnvMat00, BumpEnvMat01, BumpEnvMat10, BumpEnvMat11
perl v5.10.0 Cg Toolkit 3.0 1132
BUMPENVMAT00(CgFX) CgFX Sampler States BUMPENVMAT00(CgFX)
NAME BumpEnvMat00 −3DAPI bump environment mat00
USAGEBumpEnvMat00 = float(c00)
VALID ENUMERANTS
c00: floating point value
DESCRIPTION
Specify that this texture-stage state is a floating-point value for the [0][0] coefficient in a bump-mapping
matrix. See the D3DTSS_BUMPENVMAT00 texture stage state description for DirectX 9.
The standard reset callback sets the BumpEnvMat00 state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvMat01, BumpEnvMat10, BumpEnvMat11, BumpEnvLOffset, BumpEnvLScale
perl v5.10.0 Cg Toolkit 3.0 1133
BUMPENVMAT01(CgFX) CgFX Sampler States BUMPENVMAT01(CgFX)
NAME BumpEnvMat01 −3DAPI bump environment mat01
USAGEBumpEnvMat01 = float(c01)
VALID ENUMERANTS
c01: floating point value
DESCRIPTION
Specify that this texture-stage state is a floating-point value for the [0][1] coefficient in a bump-mapping
matrix. See the D3DTSS_BUMPENVMAT01 texture stage state description for DirectX 9.
The standard reset callback sets the BumpEnvMat01 state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvMat00, BumpEnvMat10, BumpEnvMat11, BumpEnvLOffset, BumpEnvLScale
perl v5.10.0 Cg Toolkit 3.0 1134
BUMPENVMAT10(CgFX) CgFX Sampler States BUMPENVMAT10(CgFX)
NAME BumpEnvMat10 −3DAPI bump environment mat10
USAGEBumpEnvMat10 = float(c10)
VALID ENUMERANTS
c10: floating point value
DESCRIPTION
Specify that this texture-stage state is a floating-point value for the [1][0] coefficient in a bump-mapping
matrix. See the D3DTSS_BUMPENVMAT10 texture stage state description for DirectX 9.
The standard reset callback sets the BumpEnvMat10 state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvMat00, BumpEnvMat01, BumpEnvMat11, BumpEnvLOffset, BumpEnvLScale
perl v5.10.0 Cg Toolkit 3.0 1135
BUMPENVMAT11(CgFX) CgFX Sampler States BUMPENVMAT11(CgFX)
NAME BumpEnvMat11 −3DAPI bump environment mat11
USAGEBumpEnvMat11 = float(c11)
VALID ENUMERANTS
c11: floating point value
DESCRIPTION
Specify that this texture-stage state is a floating-point value for the [1][1] coefficient in a bump-mapping
matrix. See the D3DTSS_BUMPENVMAT11 texture stage state description for DirectX 9.
The standard reset callback sets the BumpEnvMat11 state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
BumpEnvMat00, BumpEnvMat01, BumpEnvMat10, BumpEnvLOffset, BumpEnvLScale
perl v5.10.0 Cg Toolkit 3.0 1136
COLORARG0(CgFX) CgFX Sampler States COLORARG0(CgFX)
NAME ColorArg0 −3DAPI color arg0
USAGEColorArg0 = int(third)
VALID ENUMERANTS
third: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify settings for the third color operand for triadic operations. See the D3DTSS_COLORARG0 texture
stage state description for DirectX 9.
The standard reset callback sets the ColorArg0 state to int(Current).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef,
AlphaTestEnable, ColorArg1, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1137
COLORARG1(CgFX) CgFX Sampler States COLORARG1(CgFX)
NAME ColorArg1 −3DAPI color arg1
USAGEColorArg1 = int(first)
VALID ENUMERANTS
first: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify that this texture-stage state is the first color argument for the stage. See the
D3DTSS_COLORARG1 texture stage state description for DirectX 9.
The standard reset callback sets the ColorArg1 state to int(Texture).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef,
AlphaTestEnable, ColorArg0, ColorArg2, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1138
COLORARG2(CgFX) CgFX Sampler States COLORARG2(CgFX)
NAME ColorArg2 −3DAPI color arg2
USAGEColorArg2 = int(second)
VALID ENUMERANTS
second: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify that this texture-stage state is the second color argument for the stage. See the
D3DTSS_COLORARG2 texture stage state description for DirectX 9.
The standard reset callback sets the ColorArg2 state to int(Current).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp, AlphaRef,
AlphaTestEnable, ColorArg0, ColorArg1, ColorOp, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1139
COLOROP(CgFX) CgFX Sampler States COLOROP(CgFX)
NAME ColorOp −3DAPI color operation
USAGEColorOp = int(op)
VALID ENUMERANTS
op: Disable, SelectArg1, SelectArg2, Modulate, Modulate2x, Modulate4x, Add, AddSigned, AddSigned2x,
Subtract, AddSmooth, BlendDiffuseAlpha, BlendTextureAlpha, BlendFactorAlpha,
BlendTextureAlphaPM, BlendCurrentAlpha, PreModulate, ModulateAlpha_AddColor,
ModulateColor_AddAlpha, ModulateInvAlpha_AddColor,ModulateInvColor_AddAlpha, BumpEnvMap,
BumpEnvMapLuminance, DotProduct3, MultiplyAdd, Lerp
DESCRIPTION
Set the texture environment mode. See the GL_TEXTURE_ENV_MODE description on the OpenGL
glTexEnvmanual page for details. See the D3DTSS_COLOROP texture stage state description for DirectX
9.
The standard reset callback sets the ColorOp state to int(Modulate) or int(Disable).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x tureEnvMode, AlphaArg0, AlphaArg1, AlphaArg2, AlphaBlendEnable, AlphaFunc, AlphaOp,
AlphaRef, AlphaTestEnable, ColorArg0, ColorArg1, ColorArg2, BlendOpAlpha
perl v5.10.0 Cg Toolkit 3.0 1140
COMPAREFUNC(CgFX) CgFX Sampler States COMPAREFUNC(CgFX)
NAME CompareFunc −3DAPI compare function
USAGECompareFunc = int(func)
VALID ENUMERANTS
func: Never, Less, LEqual, Equal, Greater,NotEqual, GEqual, Always
DESCRIPTION
Specify the texture comparison function. See the GL_TEXTURE_COMPARE_FUNC description on the
OpenGL glTexParameter manual page, the GL_ARB_shadowextension, or EXT_shadow_funcs extension
for details.
The standard reset callback sets the CompareFunc state to float(LEqual).
OPENGL FUNCTIONALITY REQUIREMENTS
LEqual, GEqual: OpenGL 1.4 or support for extension GL_ARB_shadow.
all others: OpenGL 1.5 or support for extension GL_EXT_shadow_funcs.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CompareMode, DepthMode
perl v5.10.0 Cg Toolkit 3.0 1141
COMPAREMODE(CgFX) CgFX Sampler States COMPAREMODE(CgFX)
NAME CompareMode −3DAPI compare mode
USAGECompareMode = int(mode)
VALID ENUMERANTS
mode: None, CompareRToTe x ture
DESCRIPTION
Specify the texture comparison mode. See the GL_TEXTURE_COMPARE_MODE description on the
OpenGL glTexParameter manual page or the GL_ARB_shadowextension for details.
The standard reset callback sets the CompareMode state to float(None).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.4 or support for extension GL_ARB_shadow.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CompareFunc, DepthMode
perl v5.10.0 Cg Toolkit 3.0 1142
DEPTHMODE(CgFX) CgFX Sampler States DEPTHMODE(CgFX)
NAME DepthMode −3DAPI depth mode
USAGEDepthMode = int(mode)
VALID ENUMERANTS
mode: Alpha, Intensity,Luminance
DESCRIPTION
Specify the depth texture mode. See the GL_DEPTH_TEXTURE_MODE description on the OpenGL
glTexParameter manual page or the ARB_depth_texture extension for details.
The standard reset callback sets the DepthMode state to float(Luminance).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.4 or support for extension ARB_depth_texture.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
CompareFunc, CompareMode
perl v5.10.0 Cg Toolkit 3.0 1143
GENERATEMIPMAP(CgFX) CgFX Sampler States GENERATEMIPMAP(CgFX)
NAME GenerateMipmap −3DAPI texture mipmap generation
USAGEGenerateMipmap = bool(enable)
VALID ENUMERANTS
enable: true, false
DESCRIPTION
Set the OpenGL texture mipmap generation for the giventexture. See the GL_GENERATE_MIPMAP
description on the OpenGL glTexParameter manual page for details.
ForaTextureRectangle texture, this state has no effect.
The standard reset callback sets the GenerateMipmap state to bool(false).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.4 or support for extension SGIS_generate_mipmap.
DIRECT3D FUNCTIONALITY REQUIREMENTS
Not applicable.
SEE ALSO
Te x ture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable, Texture3D, Texture3DEnable,
Te x tureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,TextureRectangle,
Te x tureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1144
LODBIAS(CgFX) CgFX Sampler States LODBIAS(CgFX)
NAME LODBias −3DAPI mip map lod bias
DESCRIPTION
LODBias is an alias for MipMapLodBias.
SEE ALSO
MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1145
MAGFILTER(CgFX) CgFX Sampler States MAGFILTER(CgFX)
NAME MagFilter −3DAPI mag filter
USAGEMagFilter = int(type)
VALID ENUMERANTS
type: Point, Nearest, Linear
DESCRIPTION
Set the sampler magnification filter type. See the GL_TEXTURE_MAG_FILTER description on the OpenGL
glTexParameter manual page for details. See the D3DSAMP_MAGFILTER sampler state description for
DirectX 9.
The standard reset callback sets the MagFilter state to int(Point).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MagFilteri, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1146
MAXANISOTROPY(CgFX) CgFX Sampler States MAXANISOTROPY(CgFX)
NAME MaxAnisotropy −3DAPI max anisotropy
USAGEMaxAnisotropy=int(d3d_max)
MaxAnisotropy=float(gl_max)
VALID ENUMERANTS
d3d_max: integer value
gl_max: floating point value
DESCRIPTION
Set the maximum anisotropyvalue. See the D3DSAMP_MAXANISOTROPY sampler state description for
DirectX 9. See the description of GL_TEXTURE_MAX_ANISOTROPY_EXT in the OpenGL
EXT_texture_filter_anisotropic extension for details.
The standard reset callback sets the MaxAnisotropystate to int (1).
OPENGL FUNCTIONALITY REQUIREMENTS
Support for extension EXT_texture_filter_anisotropic.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MaxAnisotropyi
perl v5.10.0 Cg Toolkit 3.0 1147
MAXMIPLEVEL(CgFX) CgFX Sampler States MAXMIPLEVEL(CgFX)
NAME MaxMipLevel−3DAPI max mip level
USAGEMaxMipLevel=int(d3d_max)
MaxMipLevel=float(gl_max)
VALID ENUMERANTS
max: integer value
DESCRIPTION
Set the Direct3D maximum mipmap lod index. See the D3DSAMP_MAXMIPLEVEL sampler state
description for DirectX 9. See the GL_TEXTURE_MAX_LOD description on the OpenGL glTexParameter
manual page for details.
The standard reset callback sets the MaxMipLevelstate to int (0) for DirectX 9 and float(1000) for
OpenGL.
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MaxMipLeveli, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1148
MINFILTER(CgFX) CgFX Sampler States MINFILTER(CgFX)
NAME MinFilter −3DAPI min filter
USAGEMinFilter = int(type)
VALID ENUMERANTS
type: Anisotropic, GaussianQuad, Linear,LinearMipMapLinear,LinearMipMapNearest, Nearest,
NearestMipMapLinear,NearestMipMapNearest, None, Point, PyramidalQuad
Anisotropic, GaussianQuad, None, and PyramidalQuad are only supported on Direct3D.
DESCRIPTION
Set the Direct3D sampler minification filter type. See the D3DSAMP_MINFILTER sampler state
description for DirectX 9. See the GL_TEXTURE_MIN_FILTER description on the OpenGL glTexParameter
manual page for details.
The standard reset callback sets the MinFilter state to int(Point) on Direct3D and to
int(NearestMipMapLinear) on OpenGL.
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MinFilteri, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1149
MIPFILTER(CgFX) CgFX Sampler States MIPFILTER(CgFX)
NAME MipFilter −3DAPI mip filter
USAGEMipFilter = int(type)
VALID ENUMERANTS
type: None, Point, Linear,Anisotropic, PyramidalQuad, GaussianQuad
DESCRIPTION
Set the Direct3D minification mipmap filter.See the D3DSAMP_MIPFILTER sampler state description for
DirectX 9.
The standard reset callback sets the MipFilter state to int(None).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MipFilteri, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1150
MIPMAPLODBIAS(CgFX) CgFX Sampler States MIPMAPLODBIAS(CgFX)
NAME MipMapLodBias −3DAPI mip map lod bias
USAGEMipMapLodBias = float(bias)
VALID ENUMERANTS
bias: floating point value
DESCRIPTION
Set the Direct3D mipmap lod bias. See the D3DSAMP_MIPMAPLODBIAS sampler state description for
DirectX 9. See the GL_TEXTURE_LOD_BIAS_EXT description on the OpenGL glTexParameter manual
page for details.
The standard reset callback sets the MipMapLodBias state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
OpenGL 1.0
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
MipMapLodBiasi, GenerateMipmap, Texture, Texture1D, Texture1DEnable, Texture2D, Texture2DEnable,
Te x ture3D, Texture3DEnable, TextureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,
Te x tureRectangle, TextureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipFilter
perl v5.10.0 Cg Toolkit 3.0 1151
RESULTARG(CgFX) CgFX Sampler States RESULTARG(CgFX)
NAME ResultArg −3DAPI result arg
USAGEResultArg=int(reg)
VALID ENUMERANTS
reg: Constant, Current, Diffuse, SelectMask, Specular,Temp, Texture, TFactor
DESCRIPTION
Specify the destination register for the result of this stage. See the D3DTSS_RESULTARG texture stage
state description for DirectX 9.
The standard reset callback sets the ResultArgstate to int(Current).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 1152
SRGBTEXTURE(CgFX) CgFX Sampler States SRGBTEXTURE(CgFX)
NAME SRGBTexture −3DAPI gamma correction value
USAGESRGBTexture = float(tex)
VALID ENUMERANTS
tex: floating point value
DESCRIPTION
Specify whether gamma correction should be used. See the D3DSAMP_SRGBTEXTURE sampler state
description for DirectX 9.
The standard reset callback sets the SRGBTexture state to float (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 1153
TEXCOORDINDEX(CgFX) CgFX Sampler States TEXCOORDINDEX(CgFX)
NAME TexCoordIndex −3DAPI texcoord index
USAGETe xCoordIndex=int(index)
VALID ENUMERANTS
index: integer value
DESCRIPTION
Specify the indexofthe texture coordinate set to use with this texture stage. See the
D3DTSS_TEXCOORDINDEX texture stage state description for DirectX 9.
The standard reset callback sets the TexCoordIndexstate to int (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
perl v5.10.0 Cg Toolkit 3.0 1154
TEXTURE(CgFX) CgFX Sampler States TEXTURE(CgFX)
NAME Texture −3DAPI texture
USAGETe xture = texture(t)
VALID ENUMERANTS
t: integer value
DESCRIPTION
Specify the texture to be used. See the IDirect3DDevice9::SetTexture method for details.
The standard reset callback sets the Texture state to texture (0).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1D, Texture1DEnable, Texture2D, Texture2DEnable, Texture3D, Texture3DEnable,
Te x tureCubeMap, TextureCubeMapEnable, TextureEnvMode, TextureFactor,TextureRectangle,
Te x tureRectangleEnable, MagFilter,MaxMipLevel, MinFilter,MipFilter,MipMapLodBias
perl v5.10.0 Cg Toolkit 3.0 1155
TEXTURETRANSFORMFLAGS(CgFX) CgFX Sampler States TEXTURETRANSFORMFLAGS(CgFX)
NAME TextureTransformFlags −3DAPI texture transform flags
USAGETe xtureTransformFlags = int(flags)
VALID ENUMERANTS
flags: Disable, Count1, Count2, Count3, Count4, Projected
DESCRIPTION
Specify howtexture coordinates are transformed for this texture stage. See the
D3DTSS_TEXTURETRANSFORMFLAGS texture stage state description for DirectX 9.
The standard reset callback sets the TextureTransformFlags state to int(Disable).
OPENGL FUNCTIONALITY REQUIREMENTS
Not applicable.
DIRECT3D FUNCTIONALITY REQUIREMENTS
DirectX 9
SEE ALSO
Te x ture1DEnable, Texture2DEnable, Texture3DEnable, TextureCubeMapEnable, TextureRectangleEnable,
Te x ture1D, Texture2D, Texture3D, TextureCubeMap, TextureRectangle, TextureEnvColor,
Te x tureEnvMode, TextureFactor,TextureMatrix, TextureTransform
perl v5.10.0 Cg Toolkit 3.0 1156
WRAPR(CgFX) CgFX Sampler States WRAPR(CgFX)
NAME WrapR −3DAPI Wtexture addressing mode
DESCRIPTION
WrapR is an alias for AddressW.
SEE ALSO
AddressW
perl v5.10.0 Cg Toolkit 3.0 1157
WRAPS(CgFX) CgFX Sampler States WRAPS(CgFX)
NAME WrapS −3DAPI Utexture addressing mode
DESCRIPTION
WrapS is an alias for AddressU.
SEE ALSO
AddressU
perl v5.10.0 Cg Toolkit 3.0 1158
WRAPT(CgFX) CgFX Sampler States WRAPT(CgFX)
NAME WrapT −3DAPI Vtexture addressing mode
DESCRIPTION
WrapT is an alias for AddressV.
SEE ALSO
AddressV
perl v5.10.0 Cg Toolkit 3.0 1159

Navigation menu