NetPlay: some code cleanup, added a stop button (sometimes works), host can now chang...
[dolphin.git] / Externals / Cg / cg.h
blob701d26e7d06ec99cdf39bdbb73b603bc4d91ac40
1 /*
3 * Copyright (c) 2002-2010, NVIDIA Corporation.
7 * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
8 * of your agreement to the following terms, and your use, installation,
9 * modification or redistribution of this NVIDIA software constitutes
10 * acceptance of these terms. If you do not agree with these terms, please do
11 * not use, install, modify or redistribute this NVIDIA software.
15 * In consideration of your agreement to abide by the following terms, and
16 * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
17 * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
18 * Software"), to use, reproduce, modify and redistribute the NVIDIA
19 * Software, with or without modifications, in source and/or binary forms;
20 * provided that if you redistribute the NVIDIA Software, you must retain the
21 * copyright notice of NVIDIA, this notice and the following text and
22 * disclaimers in all such redistributions of the NVIDIA Software. Neither the
23 * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
24 * to endorse or promote products derived from the NVIDIA Software without
25 * specific prior written permission from NVIDIA. Except as expressly stated
26 * in this notice, no other rights or licenses express or implied, are granted
27 * by NVIDIA herein, including but not limited to any patent rights that may be
28 * infringed by your derivative works or by other works in which the NVIDIA
29 * Software may be incorporated. No hardware is licensed hereunder.
33 * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
34 * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
35 * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
36 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
37 * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
41 * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
42 * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
43 * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
44 * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
45 * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
46 * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
47 * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
48 * OF THE POSSIBILITY OF SUCH DAMAGE.
53 #ifndef _cg_h
54 #define _cg_h
56 /*************************************************************************/
57 /*** CG Run-Time Library API ***/
58 /*************************************************************************/
60 #define CG_VERSION_NUM 2200
62 #ifdef _WIN32
63 # ifndef APIENTRY /* From Win32's <windef.h> */
64 # define CG_APIENTRY_DEFINED
65 # if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
66 # define APIENTRY __stdcall
67 # else
68 # define APIENTRY
69 # endif
70 # endif
71 # ifndef WINGDIAPI /* From Win32's <wingdi.h> and <winnt.h> */
72 # define CG_WINGDIAPI_DEFINED
73 # define WINGDIAPI __declspec(dllimport)
74 # endif
75 #endif /* _WIN32 */
77 /* Set up CG_API for Win32 dllexport or gcc visibility */
79 #ifndef CG_API
80 # ifdef CG_EXPORTS
81 # ifdef _WIN32
82 # define CG_API __declspec(dllexport)
83 # elif defined(__GNUC__) && __GNUC__>=4
84 # define CG_API __attribute__ ((visibility("default")))
85 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
86 # define CG_API __global
87 # else
88 # define CG_API
89 # endif
90 # else
91 # define CG_API
92 # endif
93 #endif
95 #ifndef CGENTRY
96 # ifdef _WIN32
97 # define CGENTRY __cdecl
98 # else
99 # define CGENTRY
100 # endif
101 #endif
103 /*************************************************************************/
104 /*** Data types and enumerants ***/
105 /*************************************************************************/
107 typedef int CGbool;
109 #define CG_FALSE ((CGbool)0)
110 #define CG_TRUE ((CGbool)1)
112 typedef struct _CGcontext *CGcontext;
113 typedef struct _CGprogram *CGprogram;
114 typedef struct _CGparameter *CGparameter;
115 typedef struct _CGobj *CGobj;
116 typedef struct _CGbuffer *CGbuffer;
117 typedef struct _CGeffect *CGeffect;
118 typedef struct _CGtechnique *CGtechnique;
119 typedef struct _CGpass *CGpass;
120 typedef struct _CGstate *CGstate;
121 typedef struct _CGstateassignment *CGstateassignment;
122 typedef struct _CGannotation *CGannotation;
123 typedef void *CGhandle;
126 /*!!! PREPROCESS BEGIN */
128 typedef enum
130 CG_UNKNOWN_TYPE,
131 CG_STRUCT,
132 CG_ARRAY,
133 CG_TYPELESS_STRUCT,
135 CG_TYPE_START_ENUM = 1024,
136 #define CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, ncols, nrows, pc) \
137 enum_name ,
139 #include <Cg/cg_datatypes.h>
140 #undef CG_DATATYPE_MACRO
142 CG_TYPE_MAX
143 } CGtype;
145 typedef enum
147 # define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\
148 enum_int,addressable,param_type) \
149 enum_name = enum_int,
151 #include <Cg/cg_bindlocations.h>
153 CG_UNDEFINED = 3256
154 } CGresource;
156 typedef enum
158 CG_PROFILE_START = 6144,
159 CG_PROFILE_UNKNOWN,
161 #define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \
162 CG_PROFILE_##compiler_id_caps = int_id,
163 #define CG_PROFILE_ALIAS(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \
164 CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile)
166 #include <Cg/cg_profiles.h>
168 CG_PROFILE_MAX = 7100
169 } CGprofile;
171 typedef enum
173 #define CG_ERROR_MACRO(code, enum_name, message) \
174 enum_name = code,
175 #include <Cg/cg_errors.h>
177 CG_ERROR_MAX
178 } CGerror;
180 typedef enum
182 #define CG_ENUM_MACRO(enum_name, enum_val) \
183 enum_name = enum_val,
184 #include <Cg/cg_enums.h>
186 CG_ENUM_MAX
187 } CGenum;
189 /*!!! PREPROCESS END */
191 typedef enum
193 CG_PARAMETERCLASS_UNKNOWN = 0,
194 CG_PARAMETERCLASS_SCALAR,
195 CG_PARAMETERCLASS_VECTOR,
196 CG_PARAMETERCLASS_MATRIX,
197 CG_PARAMETERCLASS_STRUCT,
198 CG_PARAMETERCLASS_ARRAY,
199 CG_PARAMETERCLASS_SAMPLER,
200 CG_PARAMETERCLASS_OBJECT,
202 CG_PARAMETERCLASS_MAX
203 } CGparameterclass;
205 typedef enum
207 CG_UNKNOWN_DOMAIN = 0,
208 CG_FIRST_DOMAIN = 1,
209 CG_VERTEX_DOMAIN = 1,
210 CG_FRAGMENT_DOMAIN,
211 CG_GEOMETRY_DOMAIN,
212 CG_NUMBER_OF_DOMAINS,
214 CG_DOMAIN_MAX
215 } CGdomain;
217 typedef enum
219 CG_MAP_READ = 0,
220 CG_MAP_WRITE,
221 CG_MAP_READ_WRITE,
222 CG_MAP_WRITE_DISCARD,
223 CG_MAP_WRITE_NO_OVERWRITE,
225 CG_MAP_MAX
226 } CGbufferaccess;
228 typedef enum
230 CG_BUFFER_USAGE_STREAM_DRAW = 0,
231 CG_BUFFER_USAGE_STREAM_READ,
232 CG_BUFFER_USAGE_STREAM_COPY,
233 CG_BUFFER_USAGE_STATIC_DRAW,
234 CG_BUFFER_USAGE_STATIC_READ,
235 CG_BUFFER_USAGE_STATIC_COPY,
236 CG_BUFFER_USAGE_DYNAMIC_DRAW,
237 CG_BUFFER_USAGE_DYNAMIC_READ,
238 CG_BUFFER_USAGE_DYNAMIC_COPY,
240 CG_BUFFER_USAGE_MAX
241 } CGbufferusage;
243 #ifdef __cplusplus
244 extern "C" {
245 #endif
247 typedef CGbool (CGENTRY * CGstatecallback)(CGstateassignment);
248 typedef void (CGENTRY * CGerrorCallbackFunc)(void);
249 typedef void (CGENTRY * CGerrorHandlerFunc)(CGcontext ctx, CGerror err, void *data);
250 typedef void (CGENTRY * CGIncludeCallbackFunc)(CGcontext ctx, const char *filename);
252 /*************************************************************************/
253 /*** Functions ***/
254 /*************************************************************************/
256 #ifndef CG_EXPLICIT
258 /*** Library policy functions ***/
260 CG_API CGenum CGENTRY cgSetLockingPolicy(CGenum lockingPolicy);
261 CG_API CGenum CGENTRY cgGetLockingPolicy(void);
262 CG_API CGenum CGENTRY cgSetSemanticCasePolicy(CGenum casePolicy);
263 CG_API CGenum CGENTRY cgGetSemanticCasePolicy(void);
265 /*** Context functions ***/
267 CG_API CGcontext CGENTRY cgCreateContext(void);
268 CG_API void CGENTRY cgDestroyContext(CGcontext ctx);
269 CG_API CGbool CGENTRY cgIsContext(CGcontext ctx);
270 CG_API const char * CGENTRY cgGetLastListing(CGcontext ctx);
271 CG_API void CGENTRY cgSetLastListing(CGhandle handle, const char *listing);
272 CG_API void CGENTRY cgSetAutoCompile(CGcontext ctx, CGenum flag);
273 CG_API CGenum CGENTRY cgGetAutoCompile(CGcontext ctx);
274 CG_API void CGENTRY cgSetParameterSettingMode(CGcontext ctx, CGenum parameterSettingMode);
275 CG_API CGenum CGENTRY cgGetParameterSettingMode(CGcontext ctx);
277 /*** Inclusion ***/
279 CG_API void CGENTRY cgSetCompilerIncludeString(CGcontext ctx, const char *name, const char *source);
280 CG_API void CGENTRY cgSetCompilerIncludeFile(CGcontext ctx, const char *name, const char *filename);
281 CG_API void CGENTRY cgSetCompilerIncludeCallback(CGcontext ctx, CGIncludeCallbackFunc func);
282 CG_API CGIncludeCallbackFunc CGENTRY cgGetCompilerIncludeCallback(CGcontext ctx);
284 /*** Program functions ***/
286 CG_API CGprogram CGENTRY cgCreateProgram(CGcontext ctx,
287 CGenum program_type,
288 const char *program,
289 CGprofile profile,
290 const char *entry,
291 const char **args);
292 CG_API CGprogram CGENTRY cgCreateProgramFromFile(CGcontext ctx,
293 CGenum program_type,
294 const char *program_file,
295 CGprofile profile,
296 const char *entry,
297 const char **args);
298 CG_API CGprogram CGENTRY cgCopyProgram(CGprogram program);
299 CG_API void CGENTRY cgDestroyProgram(CGprogram program);
301 CG_API CGprogram CGENTRY cgGetFirstProgram(CGcontext ctx);
302 CG_API CGprogram CGENTRY cgGetNextProgram(CGprogram current);
303 CG_API CGcontext CGENTRY cgGetProgramContext(CGprogram prog);
304 CG_API CGbool CGENTRY cgIsProgram(CGprogram program);
306 CG_API void CGENTRY cgCompileProgram(CGprogram program);
307 CG_API CGbool CGENTRY cgIsProgramCompiled(CGprogram program);
308 CG_API const char * CGENTRY cgGetProgramString(CGprogram prog, CGenum pname);
309 CG_API CGprofile CGENTRY cgGetProgramProfile(CGprogram prog);
310 CG_API char const * const * CGENTRY cgGetProgramOptions(CGprogram prog);
311 CG_API void CGENTRY cgSetProgramProfile(CGprogram prog, CGprofile profile);
312 CG_API CGenum CGENTRY cgGetProgramInput(CGprogram program);
313 CG_API CGenum CGENTRY cgGetProgramOutput(CGprogram program);
314 CG_API void CGENTRY cgSetPassProgramParameters(CGprogram);
315 CG_API void CGENTRY cgUpdateProgramParameters(CGprogram program);
316 CG_API void CGENTRY cgUpdatePassParameters(CGpass pass);
318 /*** Parameter functions ***/
320 CG_API CGparameter CGENTRY cgCreateParameter(CGcontext ctx, CGtype type);
321 CG_API CGparameter CGENTRY cgCreateParameterArray(CGcontext ctx,
322 CGtype type,
323 int length);
324 CG_API CGparameter CGENTRY cgCreateParameterMultiDimArray(CGcontext ctx,
325 CGtype type,
326 int dim,
327 const int *lengths);
328 CG_API void CGENTRY cgDestroyParameter(CGparameter param);
329 CG_API void CGENTRY cgConnectParameter(CGparameter from, CGparameter to);
330 CG_API void CGENTRY cgDisconnectParameter(CGparameter param);
331 CG_API CGparameter CGENTRY cgGetConnectedParameter(CGparameter param);
333 CG_API int CGENTRY cgGetNumConnectedToParameters(CGparameter param);
334 CG_API CGparameter CGENTRY cgGetConnectedToParameter(CGparameter param, int index);
336 CG_API CGparameter CGENTRY cgGetNamedParameter(CGprogram prog, const char *name);
337 CG_API CGparameter CGENTRY cgGetNamedProgramParameter(CGprogram prog,
338 CGenum name_space,
339 const char *name);
341 CG_API CGparameter CGENTRY cgGetFirstParameter(CGprogram prog, CGenum name_space);
342 CG_API CGparameter CGENTRY cgGetNextParameter(CGparameter current);
343 CG_API CGparameter CGENTRY cgGetFirstLeafParameter(CGprogram prog, CGenum name_space);
344 CG_API CGparameter CGENTRY cgGetNextLeafParameter(CGparameter current);
346 CG_API CGparameter CGENTRY cgGetFirstStructParameter(CGparameter param);
347 CG_API CGparameter CGENTRY cgGetNamedStructParameter(CGparameter param,
348 const char *name);
350 CG_API CGparameter CGENTRY cgGetFirstDependentParameter(CGparameter param);
352 CG_API CGparameter CGENTRY cgGetArrayParameter(CGparameter aparam, int index);
353 CG_API int CGENTRY cgGetArrayDimension(CGparameter param);
354 CG_API CGtype CGENTRY cgGetArrayType(CGparameter param);
355 CG_API int CGENTRY cgGetArraySize(CGparameter param, int dimension);
356 CG_API int CGENTRY cgGetArrayTotalSize(CGparameter param);
357 CG_API void CGENTRY cgSetArraySize(CGparameter param, int size);
358 CG_API void CGENTRY cgSetMultiDimArraySize(CGparameter param, const int *sizes);
360 CG_API CGprogram CGENTRY cgGetParameterProgram(CGparameter param);
361 CG_API CGcontext CGENTRY cgGetParameterContext(CGparameter param);
362 CG_API CGbool CGENTRY cgIsParameter(CGparameter param);
363 CG_API const char * CGENTRY cgGetParameterName(CGparameter param);
364 CG_API CGtype CGENTRY cgGetParameterType(CGparameter param);
365 CG_API CGtype CGENTRY cgGetParameterBaseType(CGparameter param);
366 CG_API CGparameterclass CGENTRY cgGetParameterClass(CGparameter param);
367 CG_API int CGENTRY cgGetParameterRows(CGparameter param);
368 CG_API int CGENTRY cgGetParameterColumns(CGparameter param);
369 CG_API CGtype CGENTRY cgGetParameterNamedType(CGparameter param);
370 CG_API const char * CGENTRY cgGetParameterSemantic(CGparameter param);
371 CG_API CGresource CGENTRY cgGetParameterResource(CGparameter param);
372 CG_API CGresource CGENTRY cgGetParameterBaseResource(CGparameter param);
373 CG_API unsigned long CGENTRY cgGetParameterResourceIndex(CGparameter param);
374 CG_API CGenum CGENTRY cgGetParameterVariability(CGparameter param);
375 CG_API CGenum CGENTRY cgGetParameterDirection(CGparameter param);
376 CG_API CGbool CGENTRY cgIsParameterReferenced(CGparameter param);
377 CG_API CGbool CGENTRY cgIsParameterUsed(CGparameter param, CGhandle handle);
378 CG_API const double * CGENTRY cgGetParameterValues(CGparameter param,
379 CGenum value_type,
380 int *nvalues);
381 CG_API void CGENTRY cgSetParameterValuedr(CGparameter param, int n, const double *vals);
382 CG_API void CGENTRY cgSetParameterValuedc(CGparameter param, int n, const double *vals);
383 CG_API void CGENTRY cgSetParameterValuefr(CGparameter param, int n, const float *vals);
384 CG_API void CGENTRY cgSetParameterValuefc(CGparameter param, int n, const float *vals);
385 CG_API void CGENTRY cgSetParameterValueir(CGparameter param, int n, const int *vals);
386 CG_API void CGENTRY cgSetParameterValueic(CGparameter param, int n, const int *vals);
387 CG_API int CGENTRY cgGetParameterValuedr(CGparameter param, int n, double *vals);
388 CG_API int CGENTRY cgGetParameterValuedc(CGparameter param, int n, double *vals);
389 CG_API int CGENTRY cgGetParameterValuefr(CGparameter param, int n, float *vals);
390 CG_API int CGENTRY cgGetParameterValuefc(CGparameter param, int n, float *vals);
391 CG_API int CGENTRY cgGetParameterValueir(CGparameter param, int n, int *vals);
392 CG_API int CGENTRY cgGetParameterValueic(CGparameter param, int n, int *vals);
393 CG_API int CGENTRY cgGetParameterDefaultValuedr(CGparameter param, int n, double *vals);
394 CG_API int CGENTRY cgGetParameterDefaultValuedc(CGparameter param, int n, double *vals);
395 CG_API int CGENTRY cgGetParameterDefaultValuefr(CGparameter param, int n, float *vals);
396 CG_API int CGENTRY cgGetParameterDefaultValuefc(CGparameter param, int n, float *vals);
397 CG_API int CGENTRY cgGetParameterDefaultValueir(CGparameter param, int n, int *vals);
398 CG_API int CGENTRY cgGetParameterDefaultValueic(CGparameter param, int n, int *vals);
399 CG_API const char * CGENTRY cgGetStringParameterValue(CGparameter param);
400 CG_API void CGENTRY cgSetStringParameterValue(CGparameter param, const char *str);
402 CG_API int CGENTRY cgGetParameterOrdinalNumber(CGparameter param);
403 CG_API CGbool CGENTRY cgIsParameterGlobal(CGparameter param);
404 CG_API int CGENTRY cgGetParameterIndex(CGparameter param);
406 CG_API void CGENTRY cgSetParameterVariability(CGparameter param, CGenum vary);
407 CG_API void CGENTRY cgSetParameterSemantic(CGparameter param, const char *semantic);
409 CG_API void CGENTRY cgSetParameter1f(CGparameter param, float x);
410 CG_API void CGENTRY cgSetParameter2f(CGparameter param, float x, float y);
411 CG_API void CGENTRY cgSetParameter3f(CGparameter param, float x, float y, float z);
412 CG_API void CGENTRY cgSetParameter4f(CGparameter param,
413 float x,
414 float y,
415 float z,
416 float w);
417 CG_API void CGENTRY cgSetParameter1d(CGparameter param, double x);
418 CG_API void CGENTRY cgSetParameter2d(CGparameter param, double x, double y);
419 CG_API void CGENTRY cgSetParameter3d(CGparameter param,
420 double x,
421 double y,
422 double z);
423 CG_API void CGENTRY cgSetParameter4d(CGparameter param,
424 double x,
425 double y,
426 double z,
427 double w);
428 CG_API void CGENTRY cgSetParameter1i(CGparameter param, int x);
429 CG_API void CGENTRY cgSetParameter2i(CGparameter param, int x, int y);
430 CG_API void CGENTRY cgSetParameter3i(CGparameter param, int x, int y, int z);
431 CG_API void CGENTRY cgSetParameter4i(CGparameter param,
432 int x,
433 int y,
434 int z,
435 int w);
437 CG_API void CGENTRY cgSetParameter1iv(CGparameter param, const int *v);
438 CG_API void CGENTRY cgSetParameter2iv(CGparameter param, const int *v);
439 CG_API void CGENTRY cgSetParameter3iv(CGparameter param, const int *v);
440 CG_API void CGENTRY cgSetParameter4iv(CGparameter param, const int *v);
441 CG_API void CGENTRY cgSetParameter1fv(CGparameter param, const float *v);
442 CG_API void CGENTRY cgSetParameter2fv(CGparameter param, const float *v);
443 CG_API void CGENTRY cgSetParameter3fv(CGparameter param, const float *v);
444 CG_API void CGENTRY cgSetParameter4fv(CGparameter param, const float *v);
445 CG_API void CGENTRY cgSetParameter1dv(CGparameter param, const double *v);
446 CG_API void CGENTRY cgSetParameter2dv(CGparameter param, const double *v);
447 CG_API void CGENTRY cgSetParameter3dv(CGparameter param, const double *v);
448 CG_API void CGENTRY cgSetParameter4dv(CGparameter param, const double *v);
450 CG_API void CGENTRY cgSetMatrixParameterir(CGparameter param, const int *matrix);
451 CG_API void CGENTRY cgSetMatrixParameterdr(CGparameter param, const double *matrix);
452 CG_API void CGENTRY cgSetMatrixParameterfr(CGparameter param, const float *matrix);
453 CG_API void CGENTRY cgSetMatrixParameteric(CGparameter param, const int *matrix);
454 CG_API void CGENTRY cgSetMatrixParameterdc(CGparameter param, const double *matrix);
455 CG_API void CGENTRY cgSetMatrixParameterfc(CGparameter param, const float *matrix);
457 CG_API void CGENTRY cgGetMatrixParameterir(CGparameter param, int *matrix);
458 CG_API void CGENTRY cgGetMatrixParameterdr(CGparameter param, double *matrix);
459 CG_API void CGENTRY cgGetMatrixParameterfr(CGparameter param, float *matrix);
460 CG_API void CGENTRY cgGetMatrixParameteric(CGparameter param, int *matrix);
461 CG_API void CGENTRY cgGetMatrixParameterdc(CGparameter param, double *matrix);
462 CG_API void CGENTRY cgGetMatrixParameterfc(CGparameter param, float *matrix);
464 CG_API CGenum CGENTRY cgGetMatrixParameterOrder(CGparameter param);
466 CG_API CGparameter CGENTRY cgGetNamedSubParameter(CGparameter param, const char *name);
468 /*** Type Functions ***/
470 CG_API const char * CGENTRY cgGetTypeString(CGtype type);
471 CG_API CGtype CGENTRY cgGetType(const char *type_string);
473 CG_API CGtype CGENTRY cgGetNamedUserType(CGhandle handle, const char *name);
475 CG_API int CGENTRY cgGetNumUserTypes(CGhandle handle);
476 CG_API CGtype CGENTRY cgGetUserType(CGhandle handle, int index);
478 CG_API int CGENTRY cgGetNumParentTypes(CGtype type);
479 CG_API CGtype CGENTRY cgGetParentType(CGtype type, int index);
481 CG_API CGbool CGENTRY cgIsParentType(CGtype parent, CGtype child);
482 CG_API CGbool CGENTRY cgIsInterfaceType(CGtype type);
484 /*** Resource Functions ***/
486 CG_API const char * CGENTRY cgGetResourceString(CGresource resource);
487 CG_API CGresource CGENTRY cgGetResource(const char *resource_string);
489 /*** Enum Functions ***/
491 CG_API const char * CGENTRY cgGetEnumString(CGenum en);
492 CG_API CGenum CGENTRY cgGetEnum(const char *enum_string);
494 /*** Profile Functions ***/
496 CG_API const char * CGENTRY cgGetProfileString(CGprofile profile);
497 CG_API CGprofile CGENTRY cgGetProfile(const char *profile_string);
498 CG_API int CGENTRY cgGetNumSupportedProfiles(void);
499 CG_API CGprofile CGENTRY cgGetSupportedProfile(int index);
500 CG_API CGbool CGENTRY cgIsProfileSupported(CGprofile profile);
501 CG_API CGbool CGENTRY cgGetProfileProperty(CGprofile profile, CGenum query);
503 /*** ParameterClass Functions ***/
505 CG_API const char * CGENTRY cgGetParameterClassString(CGparameterclass pc);
506 CG_API CGparameterclass CGENTRY cgGetParameterClassEnum(const char * pString);
508 /*** Domain Functions ***/
510 CG_API const char * CGENTRY cgGetDomainString(CGdomain domain);
511 CG_API CGdomain CGENTRY cgGetDomain(const char *domain_string);
512 CG_API CGdomain CGENTRY cgGetProgramDomain(CGprogram program);
514 /*** Error Functions ***/
516 CG_API CGerror CGENTRY cgGetError(void);
517 CG_API CGerror CGENTRY cgGetFirstError(void);
518 CG_API const char * CGENTRY cgGetErrorString(CGerror error);
519 CG_API const char * CGENTRY cgGetLastErrorString(CGerror *error);
520 CG_API void CGENTRY cgSetErrorCallback(CGerrorCallbackFunc func);
521 CG_API CGerrorCallbackFunc CGENTRY cgGetErrorCallback(void);
522 CG_API void CGENTRY cgSetErrorHandler(CGerrorHandlerFunc func, void *data);
523 CG_API CGerrorHandlerFunc CGENTRY cgGetErrorHandler(void **data);
525 /*** Misc Functions ***/
527 CG_API const char * CGENTRY cgGetString(CGenum sname);
530 /*** CgFX Functions ***/
532 CG_API CGeffect CGENTRY cgCreateEffect(CGcontext, const char *code, const char **args);
533 CG_API CGeffect CGENTRY cgCreateEffectFromFile(CGcontext, const char *filename,
534 const char **args);
535 CG_API CGeffect CGENTRY cgCopyEffect(CGeffect effect);
536 CG_API void CGENTRY cgDestroyEffect(CGeffect);
537 CG_API CGcontext CGENTRY cgGetEffectContext(CGeffect);
538 CG_API CGbool CGENTRY cgIsEffect(CGeffect effect);
540 CG_API CGeffect CGENTRY cgGetFirstEffect(CGcontext);
541 CG_API CGeffect CGENTRY cgGetNextEffect(CGeffect);
543 CG_API CGprogram CGENTRY cgCreateProgramFromEffect(CGeffect effect,
544 CGprofile profile,
545 const char *entry,
546 const char **args);
548 CG_API CGtechnique CGENTRY cgGetFirstTechnique(CGeffect);
549 CG_API CGtechnique CGENTRY cgGetNextTechnique(CGtechnique);
550 CG_API CGtechnique CGENTRY cgGetNamedTechnique(CGeffect, const char *name);
551 CG_API const char * CGENTRY cgGetTechniqueName(CGtechnique);
552 CG_API CGbool CGENTRY cgIsTechnique(CGtechnique);
553 CG_API CGbool CGENTRY cgValidateTechnique(CGtechnique);
554 CG_API CGbool CGENTRY cgIsTechniqueValidated(CGtechnique);
555 CG_API CGeffect CGENTRY cgGetTechniqueEffect(CGtechnique);
557 CG_API CGpass CGENTRY cgGetFirstPass(CGtechnique);
558 CG_API CGpass CGENTRY cgGetNamedPass(CGtechnique, const char *name);
559 CG_API CGpass CGENTRY cgGetNextPass(CGpass);
560 CG_API CGbool CGENTRY cgIsPass(CGpass);
561 CG_API const char * CGENTRY cgGetPassName(CGpass);
562 CG_API CGtechnique CGENTRY cgGetPassTechnique(CGpass);
563 CG_API CGprogram CGENTRY cgGetPassProgram(CGpass pass, CGdomain domain);
565 CG_API void CGENTRY cgSetPassState(CGpass);
566 CG_API void CGENTRY cgResetPassState(CGpass);
568 CG_API CGstateassignment CGENTRY cgGetFirstStateAssignment(CGpass);
569 CG_API CGstateassignment CGENTRY cgGetNamedStateAssignment(CGpass, const char *name);
570 CG_API CGstateassignment CGENTRY cgGetNextStateAssignment(CGstateassignment);
571 CG_API CGbool CGENTRY cgIsStateAssignment(CGstateassignment);
572 CG_API CGbool CGENTRY cgCallStateSetCallback(CGstateassignment);
573 CG_API CGbool CGENTRY cgCallStateValidateCallback(CGstateassignment);
574 CG_API CGbool CGENTRY cgCallStateResetCallback(CGstateassignment);
575 CG_API CGpass CGENTRY cgGetStateAssignmentPass(CGstateassignment);
576 CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentParameter(CGstateassignment);
578 CG_API const float * CGENTRY cgGetFloatStateAssignmentValues(CGstateassignment, int *nVals);
579 CG_API const int * CGENTRY cgGetIntStateAssignmentValues(CGstateassignment, int *nVals);
580 CG_API const CGbool * CGENTRY cgGetBoolStateAssignmentValues(CGstateassignment, int *nVals);
581 CG_API const char * CGENTRY cgGetStringStateAssignmentValue(CGstateassignment);
582 CG_API CGprogram CGENTRY cgGetProgramStateAssignmentValue(CGstateassignment);
583 CG_API CGparameter CGENTRY cgGetTextureStateAssignmentValue(CGstateassignment);
584 CG_API CGparameter CGENTRY cgGetSamplerStateAssignmentValue(CGstateassignment);
585 CG_API int CGENTRY cgGetStateAssignmentIndex(CGstateassignment);
587 CG_API int CGENTRY cgGetNumDependentStateAssignmentParameters(CGstateassignment);
588 CG_API CGparameter CGENTRY cgGetDependentStateAssignmentParameter(CGstateassignment, int index);
590 CG_API CGparameter CGENTRY cgGetConnectedStateAssignmentParameter(CGstateassignment);
592 CG_API CGstate CGENTRY cgGetStateAssignmentState(CGstateassignment);
593 CG_API CGstate CGENTRY cgGetSamplerStateAssignmentState(CGstateassignment);
595 CG_API CGstate CGENTRY cgCreateState(CGcontext, const char *name, CGtype);
596 CG_API CGstate CGENTRY cgCreateArrayState(CGcontext, const char *name, CGtype, int nelems);
597 CG_API void CGENTRY cgSetStateCallbacks(CGstate, CGstatecallback set, CGstatecallback reset,
598 CGstatecallback validate);
599 CG_API void CGENTRY cgSetStateLatestProfile(CGstate, CGprofile);
600 CG_API CGstatecallback CGENTRY cgGetStateSetCallback(CGstate);
601 CG_API CGstatecallback CGENTRY cgGetStateResetCallback(CGstate);
602 CG_API CGstatecallback CGENTRY cgGetStateValidateCallback(CGstate);
603 CG_API CGprofile CGENTRY cgGetStateLatestProfile(CGstate);
604 CG_API CGcontext CGENTRY cgGetStateContext(CGstate);
605 CG_API CGtype CGENTRY cgGetStateType(CGstate);
606 CG_API const char * CGENTRY cgGetStateName(CGstate);
607 CG_API CGstate CGENTRY cgGetNamedState(CGcontext, const char *name);
608 CG_API CGstate CGENTRY cgGetFirstState(CGcontext);
609 CG_API CGstate CGENTRY cgGetNextState(CGstate);
610 CG_API CGbool CGENTRY cgIsState(CGstate);
611 CG_API void CGENTRY cgAddStateEnumerant(CGstate, const char *name, int value);
613 CG_API CGstate CGENTRY cgCreateSamplerState(CGcontext, const char *name, CGtype);
614 CG_API CGstate CGENTRY cgCreateArraySamplerState(CGcontext, const char *name, CGtype, int nelems);
615 CG_API CGstate CGENTRY cgGetNamedSamplerState(CGcontext, const char *name);
616 CG_API CGstate CGENTRY cgGetFirstSamplerState(CGcontext);
618 CG_API CGstateassignment CGENTRY cgGetFirstSamplerStateAssignment(CGparameter);
619 CG_API CGstateassignment CGENTRY cgGetNamedSamplerStateAssignment(CGparameter, const char *);
620 CG_API void CGENTRY cgSetSamplerState(CGparameter);
622 CG_API CGparameter CGENTRY cgGetNamedEffectParameter(CGeffect, const char *);
623 CG_API CGparameter CGENTRY cgGetFirstLeafEffectParameter(CGeffect);
624 CG_API CGparameter CGENTRY cgGetFirstEffectParameter(CGeffect);
625 CG_API CGparameter CGENTRY cgGetEffectParameterBySemantic(CGeffect, const char *);
627 CG_API CGannotation CGENTRY cgGetFirstTechniqueAnnotation(CGtechnique);
628 CG_API CGannotation CGENTRY cgGetFirstPassAnnotation(CGpass);
629 CG_API CGannotation CGENTRY cgGetFirstParameterAnnotation(CGparameter);
630 CG_API CGannotation CGENTRY cgGetFirstProgramAnnotation(CGprogram);
631 CG_API CGannotation CGENTRY cgGetFirstEffectAnnotation(CGeffect);
632 CG_API CGannotation CGENTRY cgGetNextAnnotation(CGannotation);
634 CG_API CGannotation CGENTRY cgGetNamedTechniqueAnnotation(CGtechnique, const char *);
635 CG_API CGannotation CGENTRY cgGetNamedPassAnnotation(CGpass, const char *);
636 CG_API CGannotation CGENTRY cgGetNamedParameterAnnotation(CGparameter, const char *);
637 CG_API CGannotation CGENTRY cgGetNamedProgramAnnotation(CGprogram, const char *);
638 CG_API CGannotation CGENTRY cgGetNamedEffectAnnotation(CGeffect, const char *);
640 CG_API CGbool CGENTRY cgIsAnnotation(CGannotation);
642 CG_API const char * CGENTRY cgGetAnnotationName(CGannotation);
643 CG_API CGtype CGENTRY cgGetAnnotationType(CGannotation);
645 CG_API const float * CGENTRY cgGetFloatAnnotationValues(CGannotation, int *nvalues);
646 CG_API const int * CGENTRY cgGetIntAnnotationValues(CGannotation, int *nvalues);
647 CG_API const char * CGENTRY cgGetStringAnnotationValue(CGannotation);
648 CG_API const char * const * CGENTRY cgGetStringAnnotationValues(CGannotation, int *nvalues);
649 CG_API const CGbool * CGENTRY cgGetBoolAnnotationValues(CGannotation, int *nvalues);
650 CG_API const int * CGENTRY cgGetBooleanAnnotationValues(CGannotation, int *nvalues);
652 CG_API int CGENTRY cgGetNumDependentAnnotationParameters(CGannotation);
653 CG_API CGparameter CGENTRY cgGetDependentAnnotationParameter(CGannotation, int index);
655 CG_API void CGENTRY cgEvaluateProgram(CGprogram, float *, int ncomps, int nx, int ny, int nz);
657 /*** Cg 1.5 Additions ***/
659 CG_API CGbool CGENTRY cgSetEffectName(CGeffect, const char *name);
660 CG_API const char * CGENTRY cgGetEffectName(CGeffect);
661 CG_API CGeffect CGENTRY cgGetNamedEffect(CGcontext, const char *name);
662 CG_API CGparameter CGENTRY cgCreateEffectParameter(CGeffect, const char *name, CGtype);
664 CG_API CGtechnique CGENTRY cgCreateTechnique(CGeffect, const char *name);
666 CG_API CGparameter CGENTRY cgCreateEffectParameterArray(CGeffect, const char *name, CGtype type, int length);
667 CG_API CGparameter CGENTRY cgCreateEffectParameterMultiDimArray(CGeffect, const char *name, CGtype type, int dim, const int *lengths);
669 CG_API CGpass CGENTRY cgCreatePass(CGtechnique, const char *name);
671 CG_API CGstateassignment CGENTRY cgCreateStateAssignment(CGpass, CGstate);
672 CG_API CGstateassignment CGENTRY cgCreateStateAssignmentIndex(CGpass, CGstate, int index);
673 CG_API CGstateassignment CGENTRY cgCreateSamplerStateAssignment(CGparameter, CGstate);
675 CG_API CGbool CGENTRY cgSetFloatStateAssignment(CGstateassignment, float);
676 CG_API CGbool CGENTRY cgSetIntStateAssignment(CGstateassignment, int);
677 CG_API CGbool CGENTRY cgSetBoolStateAssignment(CGstateassignment, CGbool);
678 CG_API CGbool CGENTRY cgSetStringStateAssignment(CGstateassignment, const char *);
679 CG_API CGbool CGENTRY cgSetProgramStateAssignment(CGstateassignment, CGprogram);
680 CG_API CGbool CGENTRY cgSetSamplerStateAssignment(CGstateassignment, CGparameter);
681 CG_API CGbool CGENTRY cgSetTextureStateAssignment(CGstateassignment, CGparameter);
683 CG_API CGbool CGENTRY cgSetFloatArrayStateAssignment(CGstateassignment, const float *vals);
684 CG_API CGbool CGENTRY cgSetIntArrayStateAssignment(CGstateassignment, const int *vals);
685 CG_API CGbool CGENTRY cgSetBoolArrayStateAssignment(CGstateassignment, const CGbool *vals);
687 CG_API CGannotation CGENTRY cgCreateTechniqueAnnotation(CGtechnique, const char *name, CGtype);
688 CG_API CGannotation CGENTRY cgCreatePassAnnotation(CGpass, const char *name, CGtype);
689 CG_API CGannotation CGENTRY cgCreateParameterAnnotation(CGparameter, const char *name, CGtype);
690 CG_API CGannotation CGENTRY cgCreateProgramAnnotation(CGprogram, const char *name, CGtype);
691 CG_API CGannotation CGENTRY cgCreateEffectAnnotation(CGeffect, const char *name, CGtype);
693 CG_API CGbool CGENTRY cgSetIntAnnotation(CGannotation, int value);
694 CG_API CGbool CGENTRY cgSetFloatAnnotation(CGannotation, float value);
695 CG_API CGbool CGENTRY cgSetBoolAnnotation(CGannotation, CGbool value);
696 CG_API CGbool CGENTRY cgSetStringAnnotation(CGannotation, const char *value);
698 CG_API int CGENTRY cgGetNumStateEnumerants(CGstate);
699 CG_API const char * CGENTRY cgGetStateEnumerant(CGstate, int index, int* value);
700 CG_API const char * CGENTRY cgGetStateEnumerantName(CGstate, int value);
701 CG_API int CGENTRY cgGetStateEnumerantValue(CGstate, const char *name);
703 CG_API CGeffect CGENTRY cgGetParameterEffect(CGparameter param);
705 CG_API CGparameterclass CGENTRY cgGetTypeClass(CGtype type);
706 CG_API CGtype CGENTRY cgGetTypeBase(CGtype type);
707 CG_API CGbool CGENTRY cgGetTypeSizes(CGtype type, int *nrows, int *ncols);
708 CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols);
710 CG_API int CGENTRY cgGetNumProgramDomains( CGprogram program );
711 CG_API CGdomain CGENTRY cgGetProfileDomain( CGprofile profile );
712 CG_API CGprogram CGENTRY cgCombinePrograms( int n, const CGprogram *exeList );
713 CG_API CGprogram CGENTRY cgCombinePrograms2( const CGprogram exe1, const CGprogram exe2 );
714 CG_API CGprogram CGENTRY cgCombinePrograms3( const CGprogram exe1, const CGprogram exe2, const CGprogram exe3 );
715 CG_API CGprofile CGENTRY cgGetProgramDomainProfile(CGprogram program, int index);
716 CG_API CGprogram CGENTRY cgGetProgramDomainProgram(CGprogram program, int index);
718 /*** CGobj Functions ***/
719 CG_API CGobj CGENTRY cgCreateObj( CGcontext context, CGenum program_type, const char *source, CGprofile profile, const char **args );
720 CG_API CGobj CGENTRY cgCreateObjFromFile( CGcontext context, CGenum program_type, const char *source_file, CGprofile profile, const char **args );
721 CG_API void CGENTRY cgDestroyObj( CGobj obj );
723 CG_API long CGENTRY cgGetParameterResourceSize(CGparameter);
724 CG_API CGtype CGENTRY cgGetParameterResourceType(CGparameter);
725 CG_API const char* CGENTRY cgGetParameterResourceName(CGparameter param);
726 CG_API int CGENTRY cgGetParameterBufferIndex(CGparameter);
727 CG_API int CGENTRY cgGetParameterBufferOffset(CGparameter);
729 CG_API CGbuffer CGENTRY cgCreateBuffer(CGcontext, int size, const void *data, CGbufferusage bufferUsage);
730 CG_API void CGENTRY cgSetBufferData(CGbuffer, int size, const void *data);
731 CG_API void CGENTRY cgSetBufferSubData(CGbuffer, int offset, int size, const void *data);
732 CG_API void CGENTRY cgSetProgramBuffer(CGprogram program, int bufferIndex, CGbuffer buffer);
734 CG_API void * CGENTRY cgMapBuffer(CGbuffer buffer, CGbufferaccess access);
735 CG_API void CGENTRY cgUnmapBuffer(CGbuffer buffer);
736 CG_API void CGENTRY cgDestroyBuffer(CGbuffer buffer);
737 CG_API CGbuffer CGENTRY cgGetProgramBuffer(CGprogram, int bufferIndex);
738 CG_API int CGENTRY cgGetBufferSize(CGbuffer);
739 CG_API int CGENTRY cgGetProgramBufferMaxSize(CGprofile profile);
740 CG_API int CGENTRY cgGetProgramBufferMaxIndex(CGprofile profile);
742 #endif
744 #ifdef __cplusplus
746 #endif
748 #ifdef CG_APIENTRY_DEFINED
749 # undef CG_APIENTRY_DEFINED
750 # undef APIENTRY
751 #endif
753 #ifdef CG_WINGDIAPI_DEFINED
754 # undef CG_WINGDIAPI_DEFINED
755 # undef WINGDIAPI
756 #endif
758 #endif