private static extern CgEnum cgSetLockingPolicy(CgEnum lockingPolicy);
/// <summary> /// <para>cgSetParameterSettingMode controls the behavior of the context when setting parameters.</para> /// <para>With deferred param setting, the corresponding 3D API param is not immediately updated by cgSetParameter commands.</para> /// <para>If the application does not need to access these 3D API param values, then this mode allows improved performance by avoiding unnecessary 3D API calls.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgSetParameterSettingMode was introduced in Cg 2.0.</para> /// </summary> /// <param name="context">The context in which to set the param setting mode.</param> /// <param name="parameterSettingMode">The mode to which context will be set. Must be one of the following :</param> public static void SetParameterSettingMode(CgContext context, CgEnum parameterSettingMode) { cgSetParameterSettingMode(context, parameterSettingMode); }
/// <summary> /// <para>cgSetSemanticCasePolicy allows an application to change the semantic case policy used by the Cg library.</para> /// <para>A policy of CG_FORCE_UPPER_CASE_POLICY means that semantic strings returned by cgGetParameterSemantic will have been converted to all upper-case letters.</para> /// <para>This is the default policy for the library.</para> /// <para>If the policy is changed to CG_UNCHANGED_CASE_POLICY no case coversion will be done to the semantic strings.</para> /// <para>ERROR: CG_INVALID_ENUMERANT_ERROR is generated if casePolicy is not CG_FORCE_UPPER_CASE_POLICY or CG_UNCHANGED_CASE_POLICY.</para> /// <para>VERSION: cgSetSemanticCasePolicy was introduced in Cg 2.0.</para> /// </summary> /// <param name="casePolicy">n enumerant describing the desired semantic case policy for the library. The following enumerants are allowed: CG_FORCE_UPPER_CASE_POLICY, CG_UNCHANGED_CASE_POLICY</param> /// <returns>Returns the previous semantic case policy, or CG_UNKNOWN if an error occurs.</returns> public static CgEnum SetSemanticCasePolicy(CgEnum casePolicy) { return cgSetSemanticCasePolicy(casePolicy); }
/// <summary> /// <para>cgGetString returns an informative string depending on the enum.</para> /// <para>Currently there is only one valid enumerant that may be passed in. CG_VERSION - Returns the version string of the Cg runtime and compiler.</para> /// <para>ERROR: CG_INVALID_ENUMERANT_ERROR is generated if enum is not CG_VERSION.</para> /// <para>VERSION: cgGetString was introduced in Cg 1.2.</para> /// </summary> /// <param name="sname">An enumerant describing the string to be returned.</param> /// <returns>Returns the string associtated with enum. Returns NULL in the event of an error.</returns> public static string GetString(CgEnum sname) { return Marshal.PtrToStringAnsi(cgGetString(sname)); }
/// <summary> /// <para>cgCreateObjFromFile creates a new CGobj which is a source source object similar to a.</para> /// <para>obj or.</para> /// <para>o in C/C++ programming where various forms of data can be extracted.</para> /// <para>This can be used, for example, to create user defined data types from a Cg source string.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgCreateObjFromFile was introduced in Cg 2.0.</para> /// </summary> /// <param name="context">The context to which the new object will be added. </param> /// <param name="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.</param> /// <param name="source_file">Name of a file containing source or object code. See program_type for more information. </param> /// <param name="profile">The profile enumerant for the program.</param> /// <param name="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.</param> /// <returns>Returns a CGobj handle on success. Returns NULL if an error occurs.</returns> public static CgObj CreateObjFromFile(CgContext context, CgEnum program_type, [In]string source_file, CgProfile profile, [In]string[] args) { return cgCreateObjFromFile(context, program_type, source_file, profile, args); }
public static unsafe double* GetParameterValues(CgParameter param, CgEnum value_type, int* nvalues) { return cgGetParameterValues(param, value_type, nvalues); }
/// <summary> /// <para>cgGetProfileProperty returns property information about the given profile.</para> /// <para>ERROR: 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, or CG_IS_GLSL_PROFILE</para> /// <para>VERSION: cgGetProfileProperty was introduced in Cg 2.2.</para> /// </summary> /// <param name="profile">The profile to query.</param> /// <param name="query">An enumerant describing the property to be queried. The following enumerants are allowed:</param> /// <returns>Returns CG_TRUE if profile holds the property expressed by query. Returns CG_FALSE otherwise.</returns> public static CgBool GetProfileProperty(CgProfile profile, CgEnum query) { return cgGetProfileProperty(profile, query); }
private static extern IntPtr cgGetEnumString(CgEnum en);
private static extern CgParameter cgGetFirstParameter(CgProgram prog, CgEnum name_space);
private static extern CgEnum cgSetSemanticCasePolicy(CgEnum casePolicy);
private static extern CgProgram cgCreateProgramFromFile(CgContext context, CgEnum program_type, [In] string program_file, CgProfile profile, [In] string entry, [In] string[] args);
private static extern void cgSetParameterVariability(CgParameter param, CgEnum vary);
private static extern void cgSetParameterSettingMode(CgContext context, CgEnum parameterSettingMode);
private static extern CgObj cgCreateObjFromFile(CgContext context, CgEnum program_type, [In] string source_file, CgProfile profile, [In] string[] args);
/// <summary> /// <para>cgGetFirstParameter returns the first top-level param in a program.</para> /// <para>cgGetFirstParameter is used for recursing through all parameters in a program.</para> /// <para>See cgGetNextParameter for more information on param traversal.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgGetFirstParameter was introduced in Cg 1.1.</para> /// </summary> /// <param name="program">The program from which to retrieve the first param.</param> /// <param name="name_space">Specifies the param namespace through which to iterate. Currently CG_PROGRAM and CG_GLOBAL are supported.</param> /// <returns>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.</returns> public static CgParameter GetFirstParameter(CgProgram program, CgEnum name_space) { return cgGetFirstParameter(program, name_space); }
private static extern CgParameter cgGetNamedProgramParameter(CgProgram program, CgEnum name_space, [In] string name);
/// <summary> /// <para>cgGetNamedProgramParameter is essentially identical to cgGetNamedParameter except it limits the search of the param to the name space specified by name_space.</para> /// <para>ERROR: CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.</para> /// <para>VERSION: cgGetNamedProgramParameter was introduced in Cg 1.2.</para> /// </summary> /// <param name="program">The program from which to retrieve the param.</param> /// <param name="name_space">Specifies the namespace of the param to iterate through. Currently CG_PROGRAM and CG_GLOBAL are supported.</param> /// <param name="name">Specifies the name of the param to retrieve.</param> /// <returns>Returns the named param from the program. Returns NULL if the program has no param corresponding to name.</returns> public static CgParameter GetNamedProgramParameter(CgProgram program, CgEnum name_space, string name) { return cgGetNamedProgramParameter(program, name_space, name); }
private static unsafe extern double* cgGetParameterValues(CgParameter param, CgEnum value_type, int* nvalues);
public static double[] GetParameterValues(CgParameter param, CgEnum value_type, [In]int[] nvalues) { return cgGetParameterValues(param, value_type, nvalues); }
private static extern double[] cgGetParameterValues(CgParameter param, CgEnum value_type, [In] int[] nvalues);
/// <summary> /// <para>cgGetProgramString allows the application to retrieve program strings that have been set via functions that modify program state.</para> /// <para>ERROR: 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, or CG_COMPILED_PROGRAM.</para> /// <para>VERSION: cgGetProgramString was introduced in Cg 1.1.</para> /// </summary> /// <param name="program">The program to query.</param> /// <param name="sourceType">Specifies the string to retrieve. enum can be one of CG_PROGRAM_SOURCE, CG_PROGRAM_ENTRY, CG_PROGRAM_PROFILE, or CG_COMPILED_PROGRAM.</param> /// <returns>Returns a NULL-terminated string based on the value of enum. Returns an empty string if an error occurs.</returns> public static string GetProgramString(CgProgram program, CgEnum sourceType) { return Marshal.PtrToStringAnsi(cgGetProgramString(program, sourceType)); }
private static extern CgBool cgGetProfileProperty(CgProfile profile, CgEnum query);
/// <summary> /// <para>cgSetAutoCompile sets the auto compile mode for a given context.</para> /// <para>By default, programs are immediately recompiled when they enter an uncompiled state.</para> /// <para>This may happen for a variety of reasons including :.</para> /// <para>ERROR: 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, or CG_COMPILE_LAZY.</para> /// <para>VERSION: cgSetAutoCompile was introduced in Cg 1.2.</para> /// </summary> /// <param name="context">The context.</param> /// <param name="autoCompileMode">The auto-compile mode to which to set context. Must be one of the following :</param> public static void SetAutoCompile(CgContext context, CgEnum autoCompileMode) { cgSetAutoCompile(context, autoCompileMode); }
private static extern IntPtr cgGetProgramString(CgProgram program, CgEnum sourceType);
/// <summary> /// <para>cgSetLockingPolicy allows an application to change the locking policy used by the Cg library.</para> /// <para>The default policy is CG_THREAD_SAFE_POLICY, meaning a lock is used to serialize access to the library by mulitiple threads.</para> /// <para>Single threaded applications can change this policy to CG_NO_LOCKS_POLICY to avoid the overhead associated with this lock.</para> /// <para>Multithreaded applications should never change this policy.</para> /// <para>ERROR: CG_INVALID_ENUMERANT_ERROR is generated if lockingPolicy is not CG_NO_LOCKS_POLICY or CG_THREAD_SAFE_POLICY.</para> /// <para>VERSION: cgSetLockingPolicy was introduced in Cg 2.0.</para> /// </summary> /// <param name="lockingPolicy">An enumerant describing the desired locking policy for the library. The following enumerants are allowed: CG_THREAD_SAFE_POLICY, CG_NO_LOCKS_POLICY</param> /// <returns>Returns the previous locking policy, or CG_UNKNOWN if an error occurs.</returns> public static CgEnum SetLockingPolicy(CgEnum lockingPolicy) { return cgSetLockingPolicy(lockingPolicy); }
private static extern IntPtr cgGetString(CgEnum sname);
/// <summary> /// <para>cgSetParameterVariability allows the application to change the variability of a param.</para> /// <para>ERROR: CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid param. 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 param 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 param.</para> /// <para>VERSION: cgSetParameterVariability was introduced in Cg 1.2.</para> /// </summary> /// <param name="param">The parameter.</param> /// <param name="vary">The variability to which param will be set.</param> public static void SetParameterVariability(CgParameter param, CgEnum vary) { cgSetParameterVariability(param, vary); }
/// <summary> /// <para>cgGetEnumString returns the name string associated with an enumerant.</para> /// <para>It's primary use to print debugging information.</para> /// <para>ERROR: None.</para> /// <para>VERSION: cgGetEnumString was introduced in Cg 1.2.</para> /// </summary> /// <param name="en">The enumerant.</param> /// <returns>Returns the string representation of the enumerant enum. Returns NULL if enum is not a valid Cg enumerant.</returns> public static string GetEnumString(CgEnum en) { return Marshal.PtrToStringAnsi(cgGetEnumString(en)); }
/// <summary> /// <para>cgCreateProgramFromFile generates a new CgProgram object and adds it to the specified Cg context.</para> /// <para>ERROR: 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.</para> /// <para>VERSION: cgCreateProgramFromFile was introduced in Cg 1.1.</para> /// </summary> /// <param name="context">The context to which the new program will be added.</param> /// <param name="program_type">An enumerant describing the contents of the program_file. 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.</param> /// <param name="program_file">Name of a file containing source or object code. See program_type for more information. </param> /// <param name="profile">The profile enumerant for the program. </param> /// <param name="entry">The entry point to the program in the Cg source. If NULL, the entry point defaults to "main". </param> /// <param name="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.</param> /// <returns>Returns a CgProgram handle on success. Returns NULL if an error occurs.</returns> public static CgProgram CreateProgramFromFile(CgContext context, CgEnum program_type, [In]string program_file, CgProfile profile, [In]string entry, string[] args) { return cgCreateProgramFromFile(context, program_type, program_file, profile, entry, args); }
private static extern void cgSetAutoCompile(CgContext context, CgEnum autoCompileMode);