Name
cgGetParameterBaseResource - get a parameter's base 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 given parameter.
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. For example, if a given parameter has
a resource of CG_ATTR7, it's base resource would be CG_ATTR0. Only
parameters with resources whose name ends with a number will have a base resource.
For all other parameters the undefined resource CG_UNDEFINED will be returned.
The numerical portion of the resource may be retrieved with
cgGetParameterResourceIndex.
For example, if the resource
for a given parameter is CG_ATTR7,
cgGetParameterResourceIndex will
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 was introduced in Cg 1.1.
See Also
cgGetParameterResource,
cgGetParameterResourceIndex,
cgGetResourceString
|