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 any state assignment fails validation, or if an error occurs.

DESCRIPTION

cgValidateTechnique iterates over all 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 was introduced in Cg 1.4.

SEE ALSO

cgCallStateValidateCallback, cgSetStateCallbacks