VR-Vantage 3.0 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cg.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2002-2010, NVIDIA Corporation.
4  *
5  *
6  *
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.
12  *
13  *
14  *
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.
30  *
31  *
32  *
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.
38  *
39  *
40  *
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.
49  *
50  */
51 
52 
53 #ifndef _cg_h
54 #define _cg_h
55 
56 /*************************************************************************/
57 /*** CG Run-Time Library API ***/
58 /*************************************************************************/
59 
60 #define CG_VERSION_NUM 2200
61 
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 */
76 
77 /* Set up CG_API for Win32 dllexport or gcc visibility */
78 
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
94 
95 #ifndef CGENTRY
96 # ifdef _WIN32
97 # define CGENTRY __cdecl
98 # else
99 # define CGENTRY
100 # endif
101 #endif
102 
103 /*************************************************************************/
104 /*** Data types and enumerants ***/
105 /*************************************************************************/
106 
107 typedef int CGbool;
108 
109 #define CG_FALSE ((CGbool)0)
110 #define CG_TRUE ((CGbool)1)
111 
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;
124 
125 
128 typedef enum
129  {
134 
136 #define CG_DATATYPE_MACRO(name, compiler_name, enum_name, base_name, ncols, nrows, pc) \
137  enum_name ,
138 
139 #include <Cg/cg_datatypes.h>
140 #undef CG_DATATYPE_MACRO
141 
143  } CGtype;
144 
145 typedef enum
146  {
147 # define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\
148  enum_int,addressable,param_type) \
149  enum_name = enum_int,
150 
151 #include <Cg/cg_bindlocations.h>
152 
154  } CGresource;
155 
156 typedef enum
157  {
160 
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)
165 
166 #include <Cg/cg_profiles.h>
167 
169  } CGprofile;
170 
171 typedef enum
172  {
173 #define CG_ERROR_MACRO(code, enum_name, message) \
174  enum_name = code,
175 #include <Cg/cg_errors.h>
176 
178  } CGerror;
179 
180 typedef enum
181  {
182 #define CG_ENUM_MACRO(enum_name, enum_val) \
183  enum_name = enum_val,
184 #include <Cg/cg_enums.h>
185 
187  } CGenum;
188 
191 typedef enum
192  {
201 
204 
205 typedef enum
206 {
213 
215 } CGdomain;
216 
217 typedef enum
218 {
224 
227 
228 typedef enum
229 {
239 
241 } CGbufferusage;
242 
243 #ifdef __cplusplus
244 extern "C" {
245 #endif
246 
249 typedef void (CGENTRY * CGerrorHandlerFunc)(CGcontext ctx, CGerror err, void *data);
250 typedef void (CGENTRY * CGIncludeCallbackFunc)(CGcontext ctx, const char *filename);
251 
252 /*************************************************************************/
253 /*** Functions ***/
254 /*************************************************************************/
255 
256 #ifndef CG_EXPLICIT
257 
258 /*** Library policy functions ***/
259 
264 
265 /*** Context functions ***/
266 
270 CG_API const char * CGENTRY cgGetLastListing(CGcontext ctx);
271 CG_API void CGENTRY cgSetLastListing(CGhandle handle, const char *listing);
274 CG_API void CGENTRY cgSetParameterSettingMode(CGcontext ctx, CGenum parameterSettingMode);
276 
277 /*** Inclusion ***/
278 
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);
283 
284 /*** Program functions ***/
285 
287  CGenum program_type,
288  const char *program,
289  CGprofile profile,
290  const char *entry,
291  const char **args);
293  CGenum program_type,
294  const char *program_file,
295  CGprofile profile,
296  const char *entry,
297  const char **args);
300 
305 
310 CG_API char const * const * CGENTRY cgGetProgramOptions(CGprogram prog);
317 
318 /*** Parameter functions ***/
319 
322  CGtype type,
323  int length);
325  CGtype type,
326  int dim,
327  const int *lengths);
332 
335 
338  CGenum name_space,
339  const char *name);
340 
345 
348  const char *name);
349 
351 
355 CG_API int CGENTRY cgGetArraySize(CGparameter param, int dimension);
359 
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);
401 
405 
407 CG_API void CGENTRY cgSetParameterSemantic(CGparameter param, const char *semantic);
408 
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);
413  float x,
414  float y,
415  float z,
416  float w);
418 CG_API void CGENTRY cgSetParameter2d(CGparameter param, double x, double y);
420  double x,
421  double y,
422  double z);
424  double x,
425  double y,
426  double z,
427  double w);
430 CG_API void CGENTRY cgSetParameter3i(CGparameter param, int x, int y, int z);
432  int x,
433  int y,
434  int z,
435  int w);
436 
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);
449 
456 
463 
465 
467 
468 /*** Type Functions ***/
469 
471 CG_API CGtype CGENTRY cgGetType(const char *type_string);
472 
474 
477 
480 
483 
484 /*** Resource Functions ***/
485 
486 CG_API const char * CGENTRY cgGetResourceString(CGresource resource);
487 CG_API CGresource CGENTRY cgGetResource(const char *resource_string);
488 
489 /*** Enum Functions ***/
490 
491 CG_API const char * CGENTRY cgGetEnumString(CGenum en);
492 CG_API CGenum CGENTRY cgGetEnum(const char *enum_string);
493 
494 /*** Profile Functions ***/
495 
496 CG_API const char * CGENTRY cgGetProfileString(CGprofile profile);
497 CG_API CGprofile CGENTRY cgGetProfile(const char *profile_string);
502 
503 /*** ParameterClass Functions ***/
504 
507 
508 /*** Domain Functions ***/
509 
510 CG_API const char * CGENTRY cgGetDomainString(CGdomain domain);
511 CG_API CGdomain CGENTRY cgGetDomain(const char *domain_string);
513 
514 /*** Error Functions ***/
515 
518 CG_API const char * CGENTRY cgGetErrorString(CGerror error);
519 CG_API const char * CGENTRY cgGetLastErrorString(CGerror *error);
524 
525 /*** Misc Functions ***/
526 
527 CG_API const char * CGENTRY cgGetString(CGenum sname);
528 
529 
530 /*** CgFX Functions ***/
531 
532 CG_API CGeffect CGENTRY cgCreateEffect(CGcontext, const char *code, const char **args);
534  const char **args);
539 
542 
544  CGprofile profile,
545  const char *entry,
546  const char **args);
547 
556 
561 CG_API const char * CGENTRY cgGetPassName(CGpass);
564 
567 
577 
586 
589 
591 
594 
596 CG_API CGstate CGENTRY cgCreateArrayState(CGcontext, const char *name, CGtype, int nelems);
598  CGstatecallback validate);
606 CG_API const char * CGENTRY cgGetStateName(CGstate);
611 CG_API void CGENTRY cgAddStateEnumerant(CGstate, const char *name, int value);
612 
617 
621 
626 
633 
639 
641 
644 
645 CG_API const float * CGENTRY cgGetFloatAnnotationValues(CGannotation, int *nvalues);
646 CG_API const int * CGENTRY cgGetIntAnnotationValues(CGannotation, int *nvalues);
648 CG_API const char * const * CGENTRY cgGetStringAnnotationValues(CGannotation, int *nvalues);
650 CG_API const int * CGENTRY cgGetBooleanAnnotationValues(CGannotation, int *nvalues);
651 
654 
655 CG_API void CGENTRY cgEvaluateProgram(CGprogram, float *, int ncomps, int nx, int ny, int nz);
656 
657 /*** Cg 1.5 Additions ***/
658 
660 CG_API const char * CGENTRY cgGetEffectName(CGeffect);
663 
665 
668 
670 
674 
682 
686 
692 
697 
699 CG_API const char * CGENTRY cgGetStateEnumerant(CGstate, int index, int* value);
702 
704 
707 CG_API CGbool CGENTRY cgGetTypeSizes(CGtype type, int *nrows, int *ncols);
708 CG_API void CGENTRY cgGetMatrixSize(CGtype type, int *nrows, int *ncols);
709 
712 CG_API CGprogram CGENTRY cgCombinePrograms( int n, const CGprogram *exeList );
714 CG_API CGprogram CGENTRY cgCombinePrograms3( const CGprogram exe1, const CGprogram exe2, const CGprogram exe3 );
717 
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 );
722 
728 
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);
733 
741 
742 #endif
743 
744 #ifdef __cplusplus
745 }
746 #endif
747 
748 #ifdef CG_APIENTRY_DEFINED
749 # undef CG_APIENTRY_DEFINED
750 # undef APIENTRY
751 #endif
752 
753 #ifdef CG_WINGDIAPI_DEFINED
754 # undef CG_WINGDIAPI_DEFINED
755 # undef WINGDIAPI
756 #endif
757 
758 #endif


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)