1 | /*
|
---|
2 | *
|
---|
3 | * Copyright (c) 2002, 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 NVIDIAs 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 | #define CG_VERSION_1_2 1
|
---|
58 | #define CG_VERSION_NUM 1200
|
---|
59 |
|
---|
60 |
|
---|
61 | //
|
---|
62 | // This #define foreces the old API for now. This will be removed soon, but
|
---|
63 | // the user will still have the ability to enable it.
|
---|
64 | //
|
---|
65 | // #define CG_DEPRECATED_1_1_API 1
|
---|
66 |
|
---|
67 | // Set up for either Win32 import/export/lib.
|
---|
68 | #ifndef CGDLL_API
|
---|
69 | #ifdef WIN32
|
---|
70 | #ifdef CGDLL_EXPORTS
|
---|
71 | #define CGDLL_API __declspec(dllexport)
|
---|
72 | #elif defined (CG_LIB)
|
---|
73 | #define CGDLL_API
|
---|
74 | #else
|
---|
75 | #define CGDLL_API __declspec(dllimport)
|
---|
76 | #endif
|
---|
77 | #else
|
---|
78 | #define CGDLL_API
|
---|
79 | #endif
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | /*************************************************************************/
|
---|
83 | /*** CG Run-Time Library API ***/
|
---|
84 | /*************************************************************************/
|
---|
85 |
|
---|
86 | /*************************************************************************/
|
---|
87 | /*** Data types and enumerants ***/
|
---|
88 | /*************************************************************************/
|
---|
89 |
|
---|
90 | typedef int CGbool;
|
---|
91 |
|
---|
92 | #define CG_FALSE ((CGbool)0)
|
---|
93 | #define CG_TRUE ((CGbool)1)
|
---|
94 |
|
---|
95 | typedef struct _CGcontext *CGcontext;
|
---|
96 | typedef struct _CGprogram *CGprogram;
|
---|
97 | typedef struct _CGparameter *CGparameter;
|
---|
98 |
|
---|
99 |
|
---|
100 | //!!! PREPROCESS BEGIN
|
---|
101 |
|
---|
102 | typedef enum
|
---|
103 | {
|
---|
104 | CG_UNKNOWN_TYPE,
|
---|
105 | CG_STRUCT,
|
---|
106 | CG_ARRAY,
|
---|
107 |
|
---|
108 | CG_TYPE_START_ENUM = 1024,
|
---|
109 | # define CG_DATATYPE_MACRO(name, compiler_name, enum_name, ncols, nrows) \
|
---|
110 | enum_name ,
|
---|
111 |
|
---|
112 | #include <Cg/cg_datatypes.h>
|
---|
113 |
|
---|
114 | } CGtype;
|
---|
115 |
|
---|
116 | typedef enum
|
---|
117 | {
|
---|
118 | # define CG_BINDLOCATION_MACRO(name,enum_name,compiler_name,\
|
---|
119 | enum_int,addressable,param_type) \
|
---|
120 | enum_name = enum_int,
|
---|
121 |
|
---|
122 | #include <Cg/cg_bindlocations.h>
|
---|
123 |
|
---|
124 | CG_UNDEFINED,
|
---|
125 |
|
---|
126 | } CGresource;
|
---|
127 |
|
---|
128 | typedef enum
|
---|
129 | {
|
---|
130 | CG_PROFILE_START = 6144,
|
---|
131 | CG_PROFILE_UNKNOWN,
|
---|
132 |
|
---|
133 | # define CG_PROFILE_MACRO(name, compiler_id, compiler_id_caps, compiler_opt,int_id,vertex_profile) \
|
---|
134 | CG_PROFILE_##compiler_id_caps = int_id,
|
---|
135 |
|
---|
136 | #include <Cg/cg_profiles.h>
|
---|
137 |
|
---|
138 | CG_PROFILE_MAX = 7100,
|
---|
139 | } CGprofile;
|
---|
140 |
|
---|
141 | typedef enum
|
---|
142 | {
|
---|
143 | # define CG_ERROR_MACRO(code, enum_name, message) \
|
---|
144 | enum_name = code,
|
---|
145 | # include <Cg/cg_errors.h>
|
---|
146 | } CGerror;
|
---|
147 |
|
---|
148 | //!!! PREPROCESS END
|
---|
149 |
|
---|
150 | typedef enum
|
---|
151 | {
|
---|
152 | # define CG_ENUM_MACRO(enum_name, enum_val) \
|
---|
153 | enum_name = enum_val,
|
---|
154 | # include <Cg/cg_enums.h>
|
---|
155 | } CGenum;
|
---|
156 |
|
---|
157 | #include <stdarg.h>
|
---|
158 |
|
---|
159 | #ifdef __cplusplus
|
---|
160 | extern "C" {
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | typedef void (*CGerrorCallbackFunc)(void);
|
---|
164 |
|
---|
165 | /*************************************************************************/
|
---|
166 | /*** Functions ***/
|
---|
167 | /*************************************************************************/
|
---|
168 |
|
---|
169 | #ifndef CG_EXPLICIT
|
---|
170 |
|
---|
171 | /*** Context functions ***/
|
---|
172 |
|
---|
173 | CGDLL_API CGcontext cgCreateContext(void);
|
---|
174 | CGDLL_API void cgDestroyContext(CGcontext ctx);
|
---|
175 | CGDLL_API CGbool cgIsContext(CGcontext ctx);
|
---|
176 | CGDLL_API const char *cgGetLastListing(CGcontext ctx);
|
---|
177 | CGDLL_API void cgSetAutoCompile(CGcontext ctx, CGenum flag);
|
---|
178 |
|
---|
179 | /*** Program functions ***/
|
---|
180 | CGDLL_API CGprogram cgCreateProgram(CGcontext ctx,
|
---|
181 | CGenum program_type,
|
---|
182 | const char *program,
|
---|
183 | CGprofile profile,
|
---|
184 | const char *entry,
|
---|
185 | const char **args);
|
---|
186 | CGDLL_API CGprogram cgCreateProgramFromFile(CGcontext ctx,
|
---|
187 | CGenum program_type,
|
---|
188 | const char *program_file,
|
---|
189 | CGprofile profile,
|
---|
190 | const char *entry,
|
---|
191 | const char **args);
|
---|
192 | CGDLL_API CGprogram cgCopyProgram(CGprogram program);
|
---|
193 | CGDLL_API void cgDestroyProgram(CGprogram program);
|
---|
194 |
|
---|
195 | CGDLL_API CGprogram cgGetFirstProgram(CGcontext ctx);
|
---|
196 | CGDLL_API CGprogram cgGetNextProgram(CGprogram current);
|
---|
197 | CGDLL_API CGcontext cgGetProgramContext(CGprogram prog);
|
---|
198 | CGDLL_API CGbool cgIsProgram(CGprogram program);
|
---|
199 |
|
---|
200 | CGDLL_API void cgCompileProgram(CGprogram program);
|
---|
201 | CGDLL_API CGbool cgIsProgramCompiled(CGprogram program);
|
---|
202 | CGDLL_API const char *cgGetProgramString(CGprogram prog, CGenum pname);
|
---|
203 | CGDLL_API CGprofile cgGetProgramProfile(CGprogram prog);
|
---|
204 |
|
---|
205 | /*** Parameter functions ***/
|
---|
206 |
|
---|
207 | CGDLL_API CGparameter cgCreateParameter(CGcontext ctx, CGtype type);
|
---|
208 | CGDLL_API CGparameter cgCreateParameterArray(CGcontext ctx,
|
---|
209 | CGtype type,
|
---|
210 | int length);
|
---|
211 | CGDLL_API CGparameter cgCreateParameterMultiDimArray(CGcontext ctx,
|
---|
212 | CGtype type,
|
---|
213 | int dim,
|
---|
214 | const int *lengths);
|
---|
215 | CGDLL_API void cgDestroyParameter(CGparameter param);
|
---|
216 | CGDLL_API void cgConnectParameter(CGparameter from, CGparameter to);
|
---|
217 | CGDLL_API void cgDisconnectParameter(CGparameter param);
|
---|
218 | CGDLL_API CGparameter cgGetConnectedParameter(CGparameter param);
|
---|
219 |
|
---|
220 | CGDLL_API int cgGetNumConnectedToParameters(CGparameter param);
|
---|
221 | CGDLL_API CGparameter cgGetConnectedToParameter(CGparameter param, int index);
|
---|
222 |
|
---|
223 | CGDLL_API CGparameter cgGetNamedParameter(CGprogram prog, const char *name);
|
---|
224 | CGDLL_API CGparameter cgGetNamedProgramParameter(CGprogram prog,
|
---|
225 | CGenum name_space,
|
---|
226 | const char *name);
|
---|
227 |
|
---|
228 | CGDLL_API CGparameter cgGetFirstParameter(CGprogram prog, CGenum name_space);
|
---|
229 | CGDLL_API CGparameter cgGetNextParameter(CGparameter current);
|
---|
230 | CGDLL_API CGparameter cgGetFirstLeafParameter(CGprogram prog, CGenum name_space);
|
---|
231 | CGDLL_API CGparameter cgGetNextLeafParameter(CGparameter current);
|
---|
232 |
|
---|
233 | CGDLL_API CGparameter cgGetFirstStructParameter(CGparameter param);
|
---|
234 | CGDLL_API CGparameter cgGetNamedStructParameter(CGparameter param,
|
---|
235 | const char *name);
|
---|
236 |
|
---|
237 | CGDLL_API CGparameter cgGetFirstDependentParameter(CGparameter param);
|
---|
238 |
|
---|
239 | CGDLL_API CGparameter cgGetArrayParameter(CGparameter aparam, int index);
|
---|
240 | CGDLL_API int cgGetArrayDimension(CGparameter param);
|
---|
241 | CGDLL_API CGtype cgGetArrayType(CGparameter param);
|
---|
242 | CGDLL_API int cgGetArraySize(CGparameter param, int dimension);
|
---|
243 | CGDLL_API void cgSetArraySize(CGparameter param, int size);
|
---|
244 | CGDLL_API void cgSetMultiDimArraySize(CGparameter param, const int *sizes);
|
---|
245 |
|
---|
246 | CGDLL_API CGprogram cgGetParameterProgram(CGparameter param);
|
---|
247 | CGDLL_API CGcontext cgGetParameterContext(CGparameter param);
|
---|
248 | CGDLL_API CGbool cgIsParameter(CGparameter param);
|
---|
249 | CGDLL_API const char *cgGetParameterName(CGparameter param);
|
---|
250 | CGDLL_API CGtype cgGetParameterType(CGparameter param);
|
---|
251 | CGDLL_API CGtype cgGetParameterNamedType(CGparameter param);
|
---|
252 | CGDLL_API const char *cgGetParameterSemantic(CGparameter param);
|
---|
253 | CGDLL_API CGresource cgGetParameterResource(CGparameter param);
|
---|
254 | CGDLL_API CGresource cgGetParameterBaseResource(CGparameter param);
|
---|
255 | CGDLL_API unsigned long cgGetParameterResourceIndex(CGparameter param);
|
---|
256 | CGDLL_API CGenum cgGetParameterVariability(CGparameter param);
|
---|
257 | CGDLL_API CGenum cgGetParameterDirection(CGparameter param);
|
---|
258 | CGDLL_API CGbool cgIsParameterReferenced(CGparameter param);
|
---|
259 | CGDLL_API const double *cgGetParameterValues(CGparameter param,
|
---|
260 | CGenum value_type,
|
---|
261 | int *nvalues);
|
---|
262 | CGDLL_API int cgGetParameterOrdinalNumber(CGparameter param);
|
---|
263 | CGDLL_API CGbool cgIsParameterGlobal(CGparameter param);
|
---|
264 | CGDLL_API int cgGetParameterIndex(CGparameter param);
|
---|
265 |
|
---|
266 | CGDLL_API void cgSetParameterVariability(CGparameter param, CGenum vary);
|
---|
267 | CGDLL_API void cgSetParameterSemantic(CGparameter param, const char *semantic);
|
---|
268 |
|
---|
269 |
|
---|
270 | CGDLL_API void cgSetParameter1f(CGparameter param, float x);
|
---|
271 | CGDLL_API void cgSetParameter2f(CGparameter param, float x, float y);
|
---|
272 | CGDLL_API void cgSetParameter3f(CGparameter param, float x, float y, float z);
|
---|
273 | CGDLL_API void cgSetParameter4f(CGparameter param,
|
---|
274 | float x,
|
---|
275 | float y,
|
---|
276 | float z,
|
---|
277 | float w);
|
---|
278 | CGDLL_API void cgSetParameter1d(CGparameter param, double x);
|
---|
279 | CGDLL_API void cgSetParameter2d(CGparameter param, double x, double y);
|
---|
280 | CGDLL_API void cgSetParameter3d(CGparameter param,
|
---|
281 | double x,
|
---|
282 | double y,
|
---|
283 | double z);
|
---|
284 | CGDLL_API void cgSetParameter4d(CGparameter param,
|
---|
285 | double x,
|
---|
286 | double y,
|
---|
287 | double z,
|
---|
288 | double w);
|
---|
289 |
|
---|
290 |
|
---|
291 | CGDLL_API void cgSetParameter1fv(CGparameter param, const float *v);
|
---|
292 | CGDLL_API void cgSetParameter2fv(CGparameter param, const float *v);
|
---|
293 | CGDLL_API void cgSetParameter3fv(CGparameter param, const float *v);
|
---|
294 | CGDLL_API void cgSetParameter4fv(CGparameter param, const float *v);
|
---|
295 | CGDLL_API void cgSetParameter1dv(CGparameter param, const double *v);
|
---|
296 | CGDLL_API void cgSetParameter2dv(CGparameter param, const double *v);
|
---|
297 | CGDLL_API void cgSetParameter3dv(CGparameter param, const double *v);
|
---|
298 | CGDLL_API void cgSetParameter4dv(CGparameter param, const double *v);
|
---|
299 |
|
---|
300 | CGDLL_API void cgSetMatrixParameterdr(CGparameter param, const double *matrix);
|
---|
301 | CGDLL_API void cgSetMatrixParameterfr(CGparameter param, const float *matrix);
|
---|
302 | CGDLL_API void cgSetMatrixParameterdc(CGparameter param, const double *matrix);
|
---|
303 | CGDLL_API void cgSetMatrixParameterfc(CGparameter param, const float *matrix);
|
---|
304 |
|
---|
305 |
|
---|
306 | /*** Type Functions ***/
|
---|
307 |
|
---|
308 | CGDLL_API const char *cgGetTypeString(CGtype type);
|
---|
309 | CGDLL_API CGtype cgGetType(const char *type_string);
|
---|
310 |
|
---|
311 | CGDLL_API CGtype cgGetNamedUserType(CGprogram program, const char *name);
|
---|
312 |
|
---|
313 | CGDLL_API int cgGetNumUserTypes(CGprogram program);
|
---|
314 | CGDLL_API CGtype cgGetUserType(CGprogram program, int index);
|
---|
315 |
|
---|
316 | CGDLL_API int cgGetNumParentTypes(CGtype type);
|
---|
317 | CGDLL_API CGtype cgGetParentType(CGtype type, int index);
|
---|
318 |
|
---|
319 | CGDLL_API CGbool cgIsParentType(CGtype parent, CGtype child);
|
---|
320 | CGDLL_API CGbool cgIsInterfaceType(CGtype type);
|
---|
321 |
|
---|
322 | /*** Resource Functions ***/
|
---|
323 |
|
---|
324 | CGDLL_API const char *cgGetResourceString(CGresource resource);
|
---|
325 | CGDLL_API CGresource cgGetResource(const char *resource_string);
|
---|
326 |
|
---|
327 | /*** Enum Functions ***/
|
---|
328 |
|
---|
329 | CGDLL_API const char *cgGetEnumString(CGenum en);
|
---|
330 | CGDLL_API CGenum cgGetEnum(const char *enum_string);
|
---|
331 |
|
---|
332 | /*** Profile Functions ***/
|
---|
333 |
|
---|
334 | CGDLL_API const char *cgGetProfileString(CGprofile profile);
|
---|
335 | CGDLL_API CGprofile cgGetProfile(const char *profile_string);
|
---|
336 |
|
---|
337 | /*** Error Functions ***/
|
---|
338 |
|
---|
339 | CGDLL_API CGerror cgGetError(void);
|
---|
340 | CGDLL_API const char *cgGetErrorString(CGerror error);
|
---|
341 | CGDLL_API const char *cgGetLastErrorString(CGerror *error);
|
---|
342 | CGDLL_API void cgSetErrorCallback(CGerrorCallbackFunc func);
|
---|
343 | CGDLL_API CGerrorCallbackFunc cgGetErrorCallback(void);
|
---|
344 |
|
---|
345 | /*** Misc Functions ***/
|
---|
346 |
|
---|
347 | CGDLL_API const char *cgGetString(CGenum sname);
|
---|
348 |
|
---|
349 |
|
---|
350 | /*** Support for deprecated Cg 1.1 API ***/
|
---|
351 |
|
---|
352 | CGDLL_API CGparameter cgGetNextParameter_depr1_1(CGparameter current);
|
---|
353 | CGDLL_API CGparameter cgGetNextLeafParameter_depr1_1(CGparameter current);
|
---|
354 |
|
---|
355 | #ifdef CG_DEPRECATED_1_1_API
|
---|
356 |
|
---|
357 | #define cgGetNextParameter cgGetNextParameter_depr1_1
|
---|
358 | #define cgGetNextLeafParameter cgGetNextLeafParameter_depr1_1
|
---|
359 |
|
---|
360 | #endif
|
---|
361 |
|
---|
362 | #endif
|
---|
363 |
|
---|
364 | #ifdef __cplusplus
|
---|
365 | }
|
---|
366 | #endif
|
---|
367 |
|
---|
368 |
|
---|
369 | #endif
|
---|