private static extern void cgAddStateEnumerant(CgState state, [In] string name, int value);
/// <summary> /// <para>cgAddStateEnumerant associates a given named integer enumerant value with a state definition.</para> /// <para>When that state is later used in a pass in an effect file, the value of the state assignment can optionally be given by providing a named enumerant defined with cgAddStateEnumerant.</para> /// <para>The state assignment will then take on the value provided when the enumerant was defined.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgAddStateEnumerant was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state to which to associate the name and value.</param> /// <param name="name">The name of the enumerant.</param> /// <param name="value">The value of the enumerant.</param> public static void AddStateEnumerant(CgState state, [In]string name, int value) { cgAddStateEnumerant(state, name, value); }
/// <summary> /// <para>cgCreateStateAssignment creates a state assignment for the specified pass.</para> /// <para>The new state assignment is appended to the pass' existing list of state assignments.</para> /// <para>If the state is actually a state array, the created state assignment is created for array index zero.</para> /// <para>Use cgCreateStateAssignmentIndex to create state assignments for other indices of an array state.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgCreateStateAssignment was introduced in Cg 1.5.</para> /// </summary> /// <param name="pass">The pass in which to create the state assignment.</param> /// <param name="state">The state used to create the state assignment.</param> /// <returns>Returns the handle to the created state assignment. Returns NULL if an error occurs.</returns> public static CgStateAssignment CreateStateAssignment(CgPass pass, CgState state) { return cgCreateStateAssignment(pass, state); }
/// <summary> /// <para>cgGetStateValidateCallback returns the callback function used for validating the state when the given state is encountered in a pass in a technique.</para> /// <para>See cgSetStateCallbacks and cgCallStateValidateCallback for more information.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetStateValidateCallback was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state from which to retrieve the callback.</param> /// <returns>Returns a pointer to the state validateting callback function. Returns NULL if state is not a valid state or if it has no callback.</returns> public static StateCallbackDelegate GetStateValidateCallback(CgState state) { return cgGetStateValidateCallback(state); }
/// <summary> /// <para>cgSetStateCallbacks sets the three callback functions for a state definition.</para> /// <para>These functions are later called when the state a particular state assignment based on this state must be set, reset, or validated.</para> /// <para>Any of the callback functions may be specified as NULL.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgSetStateCallbacks was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state handle.</param> /// <param name="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.</param> /// <param name="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.</param> /// <param name="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.</param> public static void SetStateCallbacks(CgState state, StateCallbackDelegate set, StateCallbackDelegate reset, StateCallbackDelegate validate) { cgSetStateCallbacks(state, set, reset, validate); }
/// <summary> /// <para>cgGetStateEnumerantValue retrieves the enumerant value associated with a given enumerant name from the specified state.</para> /// <para>ERROR: 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, if name is NULL, or if name points to an empty string.</para> /// <para>VERSION: cgGetStateEnumerantValue was introduced in Cg 1.5.</para> /// </summary> /// <param name="state">The state from which to retrieve the value associated with name.</param> /// <param name="name">The enumerant name for which to retrieve the associated value from state.</param> /// <returns>Returns the enumerant value associated with name. Returns -1 if an error occurs.</returns> public static int GetStateEnumerantValue(CgState state, [In]string name) { return cgGetStateEnumerantValue(state, name); }
/// <summary> /// <para>cgGetStateName allows the application to retrieve the name of a state defined in a Cg context.</para> /// <para>This name can be used later to retrieve the state from the context using cgGetNamedState.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetStateName was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state.</param> /// <returns>Returns the NULL-terminated name string for the state. Returns NULL if state is invalid.</returns> public static string GetStateName(CgState state) { return cgGetStateName(state); }
private static extern int cgGetStateEnumerantValue(CgState state, [In] string name);
private static extern CgProfile cgGetStateLatestProfile(CgState state);
private static extern string cgGetStateEnumerant(CgState state, int index, out int value);
private static extern string cgGetStateEnumerantName(CgState state, int value);
private static extern CgContext cgGetStateContext(CgState state);
private static extern int cgGetNumStateEnumerants(CgState state);
private static extern CgState cgGetNextState(CgState state);
/// <summary> /// <para>cgGetStateEnumerant allows the application to retrieve the enumerant name and value associated with a CGstate at a specified index location.</para> /// <para>The number of enumerants assocated with a state can be discovered using cgGetNumStateEnumerants.</para> /// <para>ERROR: 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 0 or index is greater than or equal to the number of enumerants associated with state.</para> /// <para>VERSION: cgGetStateEnumerant was introduced in Cg 2.2.</para> /// </summary> /// <param name="state">The state from which to retrieve an enumerant name and value.</param> /// <param name="index">The index for the enumerant in state.</param> /// <param name="value">Pointer to integer where the enumerant value will be stored.</param> /// <returns>Returns the NULL-terminated enumerant name string associated with state at position index. The enumerant value is returned via the value param. Returns NULL if an error occurs. value will be 0.</returns> public static string GetStateEnumerant(CgState state, int index, out int value) { return cgGetStateEnumerant(state, index, out value); }
private static extern string cgGetStateName(CgState state);
/// <summary> /// <para>cgGetStateEnumerantName returns the enumerant name associated with a given enumerant value from a specified state.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgGetStateEnumerantName was introduced in Cg 1.5.</para> /// </summary> /// <param name="state">The state from which to retrieve an enumerant name.</param> /// <param name="value">The enumerant value for which to retrieve the associated name.</param> /// <returns>Returns the NULL-terminated enumerant name string associated with the given enumerant value in state. Returns NULL if an error occurs.</returns> public static string GetStateEnumerantName(CgState state, int value) { return cgGetStateEnumerantName(state, value); }
private static extern StateCallbackDelegate cgGetStateResetCallback(CgState state);
/// <summary> /// <para>cgGetStateLatestProfile gets the specified state's designated latest profile for states of type CG_PROGRAM_TYPE.</para> /// <para>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.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetStateLatestProfile was introduced in Cg 2.2.</para> /// </summary> /// <param name="state">The state handle.</param> /// <returns>Returns the designated latest profile if state is of type CG_PROGRAM_TYPE. Returns CG_PROFILE_UNKNOWN otherwise.</returns> public static CgProfile GetStateLatestProfile(CgState state) { return cgGetStateLatestProfile(state); }
private static extern CgType cgGetStateType(CgState state);
/// <summary> /// <para>cgGetStateType returns the type of a state that was previously defined via cgCreateState, cgCreateArrayState, cgCreateSamplerState, or cgCreateArraySamplerState.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetStateType was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state from which to retrieve the type.</param> /// <returns>Returns the CGtype of the given state.</returns> public static CgType GetStateType(CgState state) { return cgGetStateType(state); }
private static extern StateCallbackDelegate cgGetStateValidateCallback(CgState state);
/// <summary> /// <para>cgIsState returns CG_TRUE if state references a valid state, CG_FALSE otherwise.</para> /// <para>VERSION: cgIsState was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The state handle to check.</param> /// <returns>Returns CG_TRUE if state references a valid state. Returns CG_FALSE otherwise.</returns> public static CgBool IsState(CgState state) { return cgIsState(state); }
/// <summary> /// <para>The states within a context can be iterated over using cgGetNextState.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetNextState was introduced in Cg 1.4.</para> /// </summary> /// <param name="state">The current state.</param> /// <returns>Returns the next state in the context's internal sequence of states. Returns NULL when state is the last state in the context.</returns> public static CgState GetNextState(CgState state) { return cgGetNextState(state); }
/// <summary> /// <para>cgSetStateLatestProfile sets the specified state's designated latest profile for states of type CG_PROGRAM_TYPE.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgSetStateLatestProfile was introduced in Cg 2.2.</para> /// </summary> /// <param name="state">The state handle.</param> /// <param name="profile">The profile to designate as the state's latest profile.</param> public static void SetStateLatestProfile(CgState state, CgProfile profile) { cgSetStateLatestProfile(state, profile); }
/// <summary> /// <para>cgGetNumStateEnumerants returns the number of enumerants associated with a given CGstate.</para> /// <para>Enumerants can be added to a CGstate using cgAddStateEnumerant.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetNumStateEnumerants was introduced in Cg 2.2.</para> /// </summary> /// <param name="state">The state from which to retrieve the number of associated enumerants.</param> /// <returns>Returns the number of enumerants associated with state. Returns 0 if an error occurs.</returns> public static int GetNumStateEnumerants(CgState state) { return cgGetNumStateEnumerants(state); }
/// <summary> /// <para>cgCreateSamplerStateAssignment creates a new state assignment for the given state and sampler param.</para> /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgCreateSamplerStateAssignment was introduced in Cg 1.5.</para> /// </summary> /// <param name="param">The sampler param to which the new state assignment will be associated.</param> /// <param name="state">The state for which to create the new state assignment.</param> /// <returns>Returns the handle to the created sampler state assignment.</returns> public static CgStateAssignment CreateSamplerStateAssignment(CgParameter param, CgState state) { return cgCreateSamplerStateAssignment(param, state); }
/// <summary> /// <para>cgGetStateContext allows the application to retrieve the context of a state. This is the context used to create the state with cgCreateState.</para> /// <para>ERROR: CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.</para> /// <para>VERSION: cgGetStateContext was introduced in Cg 1.5. </para> /// </summary> /// <param name="state">The state.</param> /// <returns>Returns the context to which state belongs. Returns NULL if an error occurs.</returns> public static CgContext GetStateContext(CgState state) { return cgGetStateContext(state); }
/// <summary> /// <para>cgCreateStateAssignmentIndex creates a state assignment for the specified pass.</para> /// <para>The new state assignment is appended to the pass's existing list of state assignments.</para> /// <para>The state assignment is for the given index of for the specified array state.</para> /// <para>ERROR: 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 or index is greater than or equal the number of elements for the state array, no error is generated but NULL is returned.</para> /// <para>VERSION: cgCreateStateAssignmentIndex was introduced in Cg 1.5.</para> /// </summary> /// <param name="pass">The pass in which to create the state assignment.</param> /// <param name="state">The state array used to create the state assignment.</param> /// <param name="index">The index for the state array.</param> /// <returns>Returns the new state assignment handle. Returns NULL if an error occurs.</returns> public static CgStateAssignment CreateStateAssignmentIndex(CgPass pass, CgState state, int index) { return cgCreateStateAssignmentIndex(pass, state, index); }
private static extern CgStateAssignment cgCreateStateAssignmentIndex(CgPass pass, CgState state, int index);