cgGLGetContextOptimalOptions
Keywords: cgGLGetContextOptimalOptions, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgGLGetContextOptimalOptions - get the best set of compiler options for a profile

> ## Synopsis

>     #include <Cg/cgGL.h>

>     char const ** cgGLGetContextOptimalOptions( CGcontext context, CGprofile profile );

> ## Parameters

> contest
>   The context scope for profile-specific options.
> 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 in context.

> Returns NULL if profile isn't supported by the current driver or GPU.

> ## Description

> cgGLGetContextOptimalOptions returns the best set of compiler options for a given profile 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 cgGLGetContextOptimalOptions is called with the same values of context and profile.

> The application does not need to destroy the returned strings.

> ## Examples

>     char const ** ppOptions = cgGLGetContextOptimalOptions(context, 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

> CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

> ## History

> cgGLGetContextOptimalOptions was introduced in Cg 3.1.

> cgGLGetContextOptimalOptions replaces cgGLGetOptimalOptions.

> ## See Also

> cgGLSetContextOptimalOptions, cgGLGetLatestProfile, cgCreateProgram, cgCreateProgramFromFile