ENGR00156850 gpu-viv: add gpu-viv driver source
[wandboard.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_compiler.h
blob9db51b5ae77dbb469ed6bbb8bba893e951935f2b
1 /****************************************************************************
3 * Copyright (C) 2005 - 2011 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
25 ** Include file the defines the front- and back-end compilers, as well as the
26 ** objects they use.
29 #ifndef __gc_hal_compiler_h_
30 #define __gc_hal_compiler_h_
32 #ifndef VIVANTE_NO_3D
33 #include "gc_hal_types.h"
34 #include "gc_hal_engine.h"
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /******************************* IR VERSION ******************/
41 #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1')
43 /******************************************************************************\
44 |******************************* SHADER LANGUAGE ******************************|
45 \******************************************************************************/
47 /* Possible shader language opcodes. */
48 typedef enum _gcSL_OPCODE
50 gcSL_NOP, /* 0x00 */
51 gcSL_MOV, /* 0x01 */
52 gcSL_SAT, /* 0x02 */
53 gcSL_DP3, /* 0x03 */
54 gcSL_DP4, /* 0x04 */
55 gcSL_ABS, /* 0x05 */
56 gcSL_JMP, /* 0x06 */
57 gcSL_ADD, /* 0x07 */
58 gcSL_MUL, /* 0x08 */
59 gcSL_RCP, /* 0x09 */
60 gcSL_SUB, /* 0x0A */
61 gcSL_KILL, /* 0x0B */
62 gcSL_TEXLD, /* 0x0C */
63 gcSL_CALL, /* 0x0D */
64 gcSL_RET, /* 0x0E */
65 gcSL_NORM, /* 0x0F */
66 gcSL_MAX, /* 0x10 */
67 gcSL_MIN, /* 0x11 */
68 gcSL_POW, /* 0x12 */
69 gcSL_RSQ, /* 0x13 */
70 gcSL_LOG, /* 0x14 */
71 gcSL_FRAC, /* 0x15 */
72 gcSL_FLOOR, /* 0x16 */
73 gcSL_CEIL, /* 0x17 */
74 gcSL_CROSS, /* 0x18 */
75 gcSL_TEXLDP, /* 0x19 */
76 gcSL_TEXBIAS, /* 0x1A */
77 gcSL_TEXGRAD, /* 0x1B */
78 gcSL_TEXLOD, /* 0x1C */
79 gcSL_SIN, /* 0x1D */
80 gcSL_COS, /* 0x1E */
81 gcSL_TAN, /* 0x1F */
82 gcSL_EXP, /* 0x20 */
83 gcSL_SIGN, /* 0x21 */
84 gcSL_STEP, /* 0x22 */
85 gcSL_SQRT, /* 0x23 */
86 gcSL_ACOS, /* 0x24 */
87 gcSL_ASIN, /* 0x25 */
88 gcSL_ATAN, /* 0x26 */
89 gcSL_SET, /* 0x27 */
90 gcSL_DSX, /* 0x28 */
91 gcSL_DSY, /* 0x29 */
92 gcSL_FWIDTH, /* 0x2A */
93 gcSL_DIV, /* 0x2B */
94 gcSL_MOD, /* 0x2C */
95 gcSL_AND_BITWISE, /* 0x2D */
96 gcSL_OR_BITWISE, /* 0x2E */
97 gcSL_XOR_BITWISE, /* 0x2F */
98 gcSL_NOT_BITWISE, /* 0x30 */
99 gcSL_LSHIFT, /* 0x31 */
100 gcSL_RSHIFT, /* 0x32 */
101 gcSL_ROTATE, /* 0x33 */
102 gcSL_BITSEL, /* 0x34 */
103 gcSL_LEADZERO, /* 0x35 */
104 gcSL_LOAD, /* 0x36 */
105 gcSL_STORE, /* 0x37 */
106 gcSL_BARRIER, /* 0x38 */
107 gcSL_SIN_CL, /* 0x39 */
108 gcSL_COS_CL, /* 0x3A */
109 gcSL_TAN_CL, /* 0x3B */
110 gcSL_ACOS_CL, /* 0x3C */
111 gcSL_ASIN_CL, /* 0x3D */
112 gcSL_ATAN_CL, /* 0x3E */
113 gcSL_SINH_CL, /* 0x3F */
114 gcSL_COSH_CL, /* 0x40 */
115 gcSL_TANH_CL, /* 0x41 */
116 gcSL_ASINH_CL, /* 0x42 */
117 gcSL_ACOSH_CL, /* 0x43 */
118 gcSL_ATANH_CL, /* 0x44 */
119 gcSL_SINPI_CL, /* 0x45 */
120 gcSL_COSPI_CL, /* 0x46 */
121 gcSL_TANPI_CL, /* 0x47 */
122 gcSL_ASINPI_CL, /* 0x48 */
123 gcSL_ACOSPI_CL, /* 0x49 */
124 gcSL_ATANPI_CL, /* 0x4A */
125 gcSL_ATAN2_CL, /* 0x4B */
126 gcSL_ATAN2PI_CL, /* 0x4C */
127 gcSL_POW_CL, /* 0x4D */
128 gcSL_RSQ_CL, /* 0x4E */
129 gcSL_LOG_CL, /* 0x4F */
130 gcSL_EXP_CL, /* 0x50 */
131 gcSL_SQRT_CL, /* 0x51 */
132 gcSL_CBRT_CL, /* 0x52 */
133 gcSL_ADDLO, /* 0x53 */ /* Float only. */
134 gcSL_MULLO, /* 0x54 */ /* Float only. */
135 gcSL_CONV, /* 0x55 */
136 gcSL_GETEXP, /* 0x56 */
137 gcSL_GETMANT, /* 0x57 */
138 gcSL_MULHI, /* 0x58 */ /* Integer only. */
139 gcSL_CMP, /* 0x59 */
140 gcSL_I2F, /* 0x5A */
141 gcSL_F2I, /* 0x5B */
142 gcSL_ADDSAT, /* 0x5C */ /* Integer only. */
143 gcSL_SUBSAT, /* 0x5D */ /* Integer only. */
144 gcSL_MULSAT, /* 0x5E */ /* Integer only. */
146 gcSL_OPCODE;
148 typedef enum _gcSL_FORMAT
150 gcSL_FLOAT = 0, /* 0 */
151 gcSL_INTEGER = 1, /* 1 */
152 gcSL_INT32 = 1, /* 1 */
153 gcSL_BOOLEAN = 2, /* 2 */
154 gcSL_UINT32 = 3, /* 3 */
155 gcSL_INT8, /* 4 */
156 gcSL_UINT8, /* 5 */
157 gcSL_INT16, /* 6 */
158 gcSL_UINT16, /* 7 */
159 gcSL_INT64, /* 8 */ /* Reserved for future enhancement. */
160 gcSL_UINT64, /* 9 */ /* Reserved for future enhancement. */
161 gcSL_INT128, /* 10 */ /* Reserved for future enhancement. */
162 gcSL_UINT128, /* 11 */ /* Reserved for future enhancement. */
163 gcSL_FLOAT16, /* 12 */
164 gcSL_FLOAT64, /* 13 */ /* Reserved for future enhancement. */
165 gcSL_FLOAT128, /* 14 */ /* Reserved for future enhancement. */
167 gcSL_FORMAT;
169 /* Destination write enable bits. */
170 typedef enum _gcSL_ENABLE
172 gcSL_ENABLE_X = 0x1,
173 gcSL_ENABLE_Y = 0x2,
174 gcSL_ENABLE_Z = 0x4,
175 gcSL_ENABLE_W = 0x8,
176 /* Combinations. */
177 gcSL_ENABLE_XY = gcSL_ENABLE_X | gcSL_ENABLE_Y,
178 gcSL_ENABLE_XYZ = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_Z,
179 gcSL_ENABLE_XYZW = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_Z | gcSL_ENABLE_W,
180 gcSL_ENABLE_XYW = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_W,
181 gcSL_ENABLE_XZ = gcSL_ENABLE_X | gcSL_ENABLE_Z,
182 gcSL_ENABLE_XZW = gcSL_ENABLE_X | gcSL_ENABLE_Z | gcSL_ENABLE_W,
183 gcSL_ENABLE_XW = gcSL_ENABLE_X | gcSL_ENABLE_W,
184 gcSL_ENABLE_YZ = gcSL_ENABLE_Y | gcSL_ENABLE_Z,
185 gcSL_ENABLE_YZW = gcSL_ENABLE_Y | gcSL_ENABLE_Z | gcSL_ENABLE_W,
186 gcSL_ENABLE_YW = gcSL_ENABLE_Y | gcSL_ENABLE_W,
187 gcSL_ENABLE_ZW = gcSL_ENABLE_Z | gcSL_ENABLE_W,
189 gcSL_ENABLE;
191 /* Possible indices. */
192 typedef enum _gcSL_INDEXED
194 gcSL_NOT_INDEXED, /* 0 */
195 gcSL_INDEXED_X, /* 1 */
196 gcSL_INDEXED_Y, /* 2 */
197 gcSL_INDEXED_Z, /* 3 */
198 gcSL_INDEXED_W, /* 4 */
200 gcSL_INDEXED;
202 /* Opcode conditions. */
203 typedef enum _gcSL_CONDITION
205 gcSL_ALWAYS, /* 0x0 */
206 gcSL_NOT_EQUAL, /* 0x1 */
207 gcSL_LESS_OR_EQUAL, /* 0x2 */
208 gcSL_LESS, /* 0x3 */
209 gcSL_EQUAL, /* 0x4 */
210 gcSL_GREATER, /* 0x5 */
211 gcSL_GREATER_OR_EQUAL, /* 0x6 */
212 gcSL_AND, /* 0x7 */
213 gcSL_OR, /* 0x8 */
214 gcSL_XOR, /* 0x9 */
215 gcSL_NOT_ZERO, /* 0xA */
217 gcSL_CONDITION;
219 /* Possible source operand types. */
220 typedef enum _gcSL_TYPE
222 gcSL_NONE, /* 0x0 */
223 gcSL_TEMP, /* 0x1 */
224 gcSL_ATTRIBUTE, /* 0x2 */
225 gcSL_UNIFORM, /* 0x3 */
226 gcSL_SAMPLER, /* 0x4 */
227 gcSL_CONSTANT, /* 0x5 */
228 gcSL_OUTPUT, /* 0x6 */
229 gcSL_PHYSICAL, /* 0x7 */
231 gcSL_TYPE;
233 /* Swizzle generator macro. */
234 #define gcmSWIZZLE(Component1, Component2, Component3, Component4) \
236 (gcSL_SWIZZLE_ ## Component1 << 0) | \
237 (gcSL_SWIZZLE_ ## Component2 << 2) | \
238 (gcSL_SWIZZLE_ ## Component3 << 4) | \
239 (gcSL_SWIZZLE_ ## Component4 << 6) \
242 /* Possible swizzle values. */
243 typedef enum _gcSL_SWIZZLE
245 gcSL_SWIZZLE_X, /* 0x0 */
246 gcSL_SWIZZLE_Y, /* 0x1 */
247 gcSL_SWIZZLE_Z, /* 0x2 */
248 gcSL_SWIZZLE_W, /* 0x3 */
249 /* Combinations. */
250 gcSL_SWIZZLE_XXXX = gcmSWIZZLE(X, X, X, X),
251 gcSL_SWIZZLE_YYYY = gcmSWIZZLE(Y, Y, Y, Y),
252 gcSL_SWIZZLE_ZZZZ = gcmSWIZZLE(Z, Z, Z, Z),
253 gcSL_SWIZZLE_WWWW = gcmSWIZZLE(W, W, W, W),
254 gcSL_SWIZZLE_XYYY = gcmSWIZZLE(X, Y, Y, Y),
255 gcSL_SWIZZLE_XZZZ = gcmSWIZZLE(X, Z, Z, Z),
256 gcSL_SWIZZLE_XWWW = gcmSWIZZLE(X, W, W, W),
257 gcSL_SWIZZLE_YZZZ = gcmSWIZZLE(Y, Z, Z, Z),
258 gcSL_SWIZZLE_YWWW = gcmSWIZZLE(Y, W, W, W),
259 gcSL_SWIZZLE_ZWWW = gcmSWIZZLE(Z, W, W, W),
260 gcSL_SWIZZLE_XYZZ = gcmSWIZZLE(X, Y, Z, Z),
261 gcSL_SWIZZLE_XYWW = gcmSWIZZLE(X, Y, W, W),
262 gcSL_SWIZZLE_XZWW = gcmSWIZZLE(X, Z, W, W),
263 gcSL_SWIZZLE_YZWW = gcmSWIZZLE(Y, Z, W, W),
264 gcSL_SWIZZLE_XXYZ = gcmSWIZZLE(X, X, Y, Z),
265 gcSL_SWIZZLE_XYZW = gcmSWIZZLE(X, Y, Z, W),
266 gcSL_SWIZZLE_XYXY = gcmSWIZZLE(X, Y, X, Y),
268 gcSL_SWIZZLE_INVALID = 0x7FFFFFFF
270 gcSL_SWIZZLE;
273 /******************************************************************************\
274 |*********************************** SHADERS **********************************|
275 \******************************************************************************/
277 /* Shader types. */
278 #define gcSHADER_TYPE_UNKNOWN 0
279 #define gcSHADER_TYPE_VERTEX 1
280 #define gcSHADER_TYPE_FRAGMENT 2
281 #define gcSHADER_TYPE_CL 3
282 #define gcSHADER_TYPE_PRECOMPILED 4
284 #define gcm
285 /* gcSHADER objects. */
286 typedef struct _gcSHADER * gcSHADER;
287 typedef struct _gcATTRIBUTE * gcATTRIBUTE;
288 typedef struct _gcUNIFORM * gcUNIFORM;
289 typedef struct _gcOUTPUT * gcOUTPUT;
290 typedef struct _gcsFUNCTION * gcFUNCTION;
291 typedef struct _gcsKERNEL_FUNCTION * gcKERNEL_FUNCTION;
292 typedef struct _gcsHINT * gcsHINT_PTR;
293 typedef struct _gcSHADER_PROFILER * gcSHADER_PROFILER;
294 typedef struct _gcVARIABLE * gcVARIABLE;
296 struct _gcsHINT
298 /* Numbr of data transfers for Vertex Shader output. */
299 gctUINT32 vsOutputCount;
301 /* Flag whether the VS has point size or not. */
302 gctBOOL vsHasPointSize;
304 /* Element count. */
305 gctUINT32 elementCount;
307 /* Component count. */
308 gctUINT32 componentCount;
310 /* Number of data transfers for Fragment Shader input. */
311 gctUINT32 fsInputCount;
313 /* Maximum number of temporary registers used in FS. */
314 gctUINT32 fsMaxTemp;
316 /* Maximum number of temporary registers used in VS. */
317 gctUINT32 vsMaxTemp;
319 /* Balance minimum. */
320 gctUINT32 balanceMin;
322 /* Balance maximum. */
323 gctUINT32 balanceMax;
325 /* Flag whether the PS outputs the depth value or not. */
326 gctBOOL psHasFragDepthOut;
328 /* Flag whether the ThreadWalker is in PS. */
329 gctBOOL threadWalkerInPS;
333 /* gcSHADER_TYPE enumeration. */
334 typedef enum _gcSHADER_TYPE
336 gcSHADER_FLOAT_X1, /* 0x00 */
337 gcSHADER_FLOAT_X2, /* 0x01 */
338 gcSHADER_FLOAT_X3, /* 0x02 */
339 gcSHADER_FLOAT_X4, /* 0x03 */
340 gcSHADER_FLOAT_2X2, /* 0x04 */
341 gcSHADER_FLOAT_3X3, /* 0x05 */
342 gcSHADER_FLOAT_4X4, /* 0x06 */
343 gcSHADER_BOOLEAN_X1, /* 0x07 */
344 gcSHADER_BOOLEAN_X2, /* 0x08 */
345 gcSHADER_BOOLEAN_X3, /* 0x09 */
346 gcSHADER_BOOLEAN_X4, /* 0x0A */
347 gcSHADER_INTEGER_X1, /* 0x0B */
348 gcSHADER_INTEGER_X2, /* 0x0C */
349 gcSHADER_INTEGER_X3, /* 0x0D */
350 gcSHADER_INTEGER_X4, /* 0x0E */
351 gcSHADER_SAMPLER_1D, /* 0x0F */
352 gcSHADER_SAMPLER_2D, /* 0x10 */
353 gcSHADER_SAMPLER_3D, /* 0x11 */
354 gcSHADER_SAMPLER_CUBIC, /* 0x12 */
355 gcSHADER_FIXED_X1, /* 0x13 */
356 gcSHADER_FIXED_X2, /* 0x14 */
357 gcSHADER_FIXED_X3, /* 0x15 */
358 gcSHADER_FIXED_X4, /* 0x16 */
359 gcSHADER_IMAGE_2D, /* 0x17 */ /* For OCL. */
360 gcSHADER_IMAGE_3D, /* 0x18 */ /* For OCL. */
361 gcSHADER_SAMPLER, /* 0x19 */ /* For OCL. */
362 gcSHADER_FLOAT_2X3, /* 0x1A */
363 gcSHADER_FLOAT_2X4, /* 0x1B */
364 gcSHADER_FLOAT_3X2, /* 0x1C */
365 gcSHADER_FLOAT_3X4, /* 0x1D */
366 gcSHADER_FLOAT_4X2, /* 0x1E */
367 gcSHADER_FLOAT_4X3, /* 0x1F */
368 gcSHADER_ISAMPLER_2D, /* 0x20 */
369 gcSHADER_ISAMPLER_3D, /* 0x21 */
370 gcSHADER_ISAMPLER_CUBIC, /* 0x22 */
371 gcSHADER_USAMPLER_2D, /* 0x23 */
372 gcSHADER_USAMPLER_3D, /* 0x24 */
373 gcSHADER_USAMPLER_CUBIC, /* 0x25 */
374 gcSHADER_SAMPLER_EXTERNAL_OES, /* 0x26 */
377 gcSHADER_TYPE;
379 /* Shader flags. */
380 typedef enum _gceSHADER_FLAGS
382 gcvSHADER_DEAD_CODE = 0x01,
383 gcvSHADER_RESOURCE_USAGE = 0x02,
384 gcvSHADER_OPTIMIZER = 0x04,
385 gcvSHADER_USE_GL_Z = 0x08,
386 gcvSHADER_USE_GL_POSITION = 0x10,
387 gcvSHADER_USE_GL_FACE = 0x20,
388 gcvSHADER_USE_GL_POINT_COORD = 0x40,
390 gceSHADER_FLAGS;
392 /* Function argument qualifier */
393 typedef enum _gceINPUT_OUTPUT
395 gcvFUNCTION_INPUT,
396 gcvFUNCTION_OUTPUT,
397 gcvFUNCTION_INOUT
399 gceINPUT_OUTPUT;
401 /* Kernel function property flags. */
402 typedef enum _gcePROPERTY_FLAGS
404 gcvPROPERTY_REQD_WORK_GRP_SIZE = 0x01
406 gceKERNEL_FUNCTION_PROPERTY_FLAGS;
408 /* Uniform flags. */
409 typedef enum _gceUNIFORM_FLAGS
411 gcvUNIFORM_KERNEL_ARG = 0x01,
412 gcvUNIFORM_KERNEL_ARG_LOCAL = 0x02,
413 gcvUNIFORM_KERNEL_ARG_SAMPLER = 0x04,
414 gcvUNIFORM_LOCAL_ADDRESS_SPACE = 0x08,
415 gcvUNIFORM_PRIVATE_ADDRESS_SPACE = 0x10,
416 gcvUNIFORM_CONSTANT_ADDRESS_SPACE = 0x20,
417 gcvUNIFORM_GLOBAL_SIZE = 0x40,
418 gcvUNIFORM_LOCAL_SIZE = 0x80,
419 gcvUNIFORM_NUM_GROUPS = 0x100,
420 gcvUNIFORM_GLOBAL_OFFSET = 0x200,
421 gcvUNIFORM_WORK_DIM = 0x400,
422 gcvUNIFORM_KERNEL_ARG_CONSTANT = 0x800,
424 gceUNIFORM_FLAGS;
426 #define gcdUNIFORM_KERNEL_ARG_MASK (gcvUNIFORM_KERNEL_ARG | \
427 gcvUNIFORM_KERNEL_ARG_LOCAL | \
428 gcvUNIFORM_KERNEL_ARG_SAMPLER | \
429 gcvUNIFORM_KERNEL_ARG_CONSTANT)
431 /*******************************************************************************
432 ** gcSHADER_SetCompilerVersion
434 ** Set the compiler version of a gcSHADER object.
436 ** INPUT:
438 ** gcSHADER Shader
439 ** Pointer to gcSHADER object
441 ** gctINT *Version
442 ** Pointer to a two word version
444 gceSTATUS
445 gcSHADER_SetCompilerVersion(
446 IN gcSHADER Shader,
447 IN gctUINT32 *Version
450 /*******************************************************************************
451 ** gcSHADER_GetCompilerVersion
453 ** Get the compiler version of a gcSHADER object.
455 ** INPUT:
457 ** gcSHADER Shader
458 ** Pointer to a gcSHADER object.
460 ** OUTPUT:
462 ** gctUINT32_PTR *CompilerVersion.
463 ** Pointer to holder of returned compilerVersion pointer
465 gceSTATUS
466 gcSHADER_GetCompilerVersion(
467 IN gcSHADER Shader,
468 OUT gctUINT32_PTR *CompilerVersion
471 /*******************************************************************************
472 ** gcSHADER_GetType
474 ** Get the gcSHADER object's type.
476 ** INPUT:
478 ** gcSHADER Shader
479 ** Pointer to a gcSHADER object.
481 ** OUTPUT:
483 ** gctINT *Type.
484 ** Pointer to return shader type.
486 gceSTATUS
487 gcSHADER_GetType(
488 IN gcSHADER Shader,
489 OUT gctINT *Type
491 /*******************************************************************************
492 ** gcSHADER_Construct
493 ********************************************************************************
495 ** Construct a new gcSHADER object.
497 ** INPUT:
499 ** gcoOS Hal
500 ** Pointer to an gcoHAL object.
502 ** gctINT ShaderType
503 ** Type of gcSHADER object to cerate. 'ShaderType' can be one of the
504 ** following:
506 ** gcSHADER_TYPE_VERTEX Vertex shader.
507 ** gcSHADER_TYPE_FRAGMENT Fragment shader.
509 ** OUTPUT:
511 ** gcSHADER * Shader
512 ** Pointer to a variable receiving the gcSHADER object pointer.
514 gceSTATUS
515 gcSHADER_Construct(
516 IN gcoHAL Hal,
517 IN gctINT ShaderType,
518 OUT gcSHADER * Shader
521 /*******************************************************************************
522 ** gcSHADER_Destroy
523 ********************************************************************************
525 ** Destroy a gcSHADER object.
527 ** INPUT:
529 ** gcSHADER Shader
530 ** Pointer to a gcSHADER object.
532 ** OUTPUT:
534 ** Nothing.
536 gceSTATUS
537 gcSHADER_Destroy(
538 IN gcSHADER Shader
541 /*******************************************************************************
542 ** gcSHADER_Copy
543 ********************************************************************************
545 ** Copy a gcSHADER object.
547 ** INPUT:
549 ** gcSHADER Shader
550 ** Pointer to a gcSHADER object.
552 ** gcSHADER Source
553 ** Pointer to a gcSHADER object that will be copied.
555 ** OUTPUT:
557 ** Nothing.
559 gceSTATUS
560 gcSHADER_Copy(
561 IN gcSHADER Shader,
562 IN gcSHADER Source
565 /*******************************************************************************
566 ** gcSHADER_LoadHeader
568 ** Load a gcSHADER object from a binary buffer. The binary buffer is layed out
569 ** as follows:
570 ** // Six word header
571 ** // Signature, must be 'S','H','D','R'.
572 ** gctINT8 signature[4];
573 ** gctUINT32 binFileVersion;
574 ** gctUINT32 compilerVersion[2];
575 ** gctUINT32 gcSLVersion;
576 ** gctUINT32 binarySize;
578 ** INPUT:
580 ** gcSHADER Shader
581 ** Pointer to a gcSHADER object.
582 ** Shader type will be returned if type in shader object is not gcSHADER_TYPE_PRECOMPILED
584 ** gctPOINTER Buffer
585 ** Pointer to a binary buffer containing the shader data to load.
587 ** gctSIZE_T BufferSize
588 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
590 ** OUTPUT:
591 ** nothing
594 gceSTATUS
595 gcSHADER_LoadHeader(
596 IN gcSHADER Shader,
597 IN gctPOINTER Buffer,
598 IN gctSIZE_T BufferSize
601 /*******************************************************************************
602 ** gcSHADER_LoadKernel
604 ** Load a kernel function given by name into gcSHADER object
606 ** INPUT:
608 ** gcSHADER Shader
609 ** Pointer to a gcSHADER object.
611 ** gctSTRING KernelName
612 ** Pointer to a kernel function name
614 ** OUTPUT:
615 ** nothing
618 gceSTATUS
619 gcSHADER_LoadKernel(
620 IN gcSHADER Shader,
621 IN gctSTRING KernelName
624 /*******************************************************************************
625 ** gcSHADER_Load
626 ********************************************************************************
628 ** Load a gcSHADER object from a binary buffer.
630 ** INPUT:
632 ** gcSHADER Shader
633 ** Pointer to a gcSHADER object.
635 ** gctPOINTER Buffer
636 ** Pointer to a binary buffer containg the shader data to load.
638 ** gctSIZE_T BufferSize
639 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
641 ** OUTPUT:
643 ** Nothing.
645 gceSTATUS
646 gcSHADER_Load(
647 IN gcSHADER Shader,
648 IN gctPOINTER Buffer,
649 IN gctSIZE_T BufferSize
652 /*******************************************************************************
653 ** gcSHADER_Save
654 ********************************************************************************
656 ** Save a gcSHADER object to a binary buffer.
658 ** INPUT:
660 ** gcSHADER Shader
661 ** Pointer to a gcSHADER object.
663 ** gctPOINTER Buffer
664 ** Pointer to a binary buffer to be used as storage for the gcSHADER
665 ** object. If 'Buffer' is gcvNULL, the gcSHADER object will not be saved,
666 ** but the number of bytes required to hold the binary output for the
667 ** gcSHADER object will be returned.
669 ** gctSIZE_T * BufferSize
670 ** Pointer to a variable holding the number of bytes allocated in
671 ** 'Buffer'. Only valid if 'Buffer' is not gcvNULL.
673 ** OUTPUT:
675 ** gctSIZE_T * BufferSize
676 ** Pointer to a variable receiving the number of bytes required to hold
677 ** the binary form of the gcSHADER object.
679 gceSTATUS
680 gcSHADER_Save(
681 IN gcSHADER Shader,
682 IN gctPOINTER Buffer,
683 IN OUT gctSIZE_T * BufferSize
686 /*******************************************************************************
687 ** gcSHADER_LoadEx
688 ********************************************************************************
690 ** Load a gcSHADER object from a binary buffer.
692 ** INPUT:
694 ** gcSHADER Shader
695 ** Pointer to a gcSHADER object.
697 ** gctPOINTER Buffer
698 ** Pointer to a binary buffer containg the shader data to load.
700 ** gctSIZE_T BufferSize
701 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
703 ** OUTPUT:
705 ** Nothing.
707 gceSTATUS
708 gcSHADER_LoadEx(
709 IN gcSHADER Shader,
710 IN gctPOINTER Buffer,
711 IN gctSIZE_T BufferSize
714 /*******************************************************************************
715 ** gcSHADER_SaveEx
716 ********************************************************************************
718 ** Save a gcSHADER object to a binary buffer.
720 ** INPUT:
722 ** gcSHADER Shader
723 ** Pointer to a gcSHADER object.
725 ** gctPOINTER Buffer
726 ** Pointer to a binary buffer to be used as storage for the gcSHADER
727 ** object. If 'Buffer' is gcvNULL, the gcSHADER object will not be saved,
728 ** but the number of bytes required to hold the binary output for the
729 ** gcSHADER object will be returned.
731 ** gctSIZE_T * BufferSize
732 ** Pointer to a variable holding the number of bytes allocated in
733 ** 'Buffer'. Only valid if 'Buffer' is not gcvNULL.
735 ** OUTPUT:
737 ** gctSIZE_T * BufferSize
738 ** Pointer to a variable receiving the number of bytes required to hold
739 ** the binary form of the gcSHADER object.
741 gceSTATUS
742 gcSHADER_SaveEx(
743 IN gcSHADER Shader,
744 IN gctPOINTER Buffer,
745 IN OUT gctSIZE_T * BufferSize
748 /*******************************************************************************
749 ** gcSHADER_ReallocateAttributes
751 ** Reallocate an array of pointers to gcATTRIBUTE objects.
753 ** INPUT:
755 ** gcSHADER Shader
756 ** Pointer to a gcSHADER object.
758 ** gctSIZE_T Count
759 ** Array count to reallocate. 'Count' must be at least 1.
761 gceSTATUS
762 gcSHADER_ReallocateAttributes(
763 IN gcSHADER Shader,
764 IN gctSIZE_T Count
767 /*******************************************************************************
768 ** gcSHADER_AddAttribute
769 ********************************************************************************
771 ** Add an attribute to a gcSHADER object.
773 ** INPUT:
775 ** gcSHADER Shader
776 ** Pointer to a gcSHADER object.
778 ** gctCONST_STRING Name
779 ** Name of the attribute to add.
781 ** gcSHADER_TYPE Type
782 ** Type of the attribute to add.
784 ** gctSIZE_T Length
785 ** Array length of the attribute to add. 'Length' must be at least 1.
787 ** gctBOOL IsTexture
788 ** gcvTRUE if the attribute is used as a texture coordinate, gcvFALSE if not.
790 ** OUTPUT:
792 ** gcATTRIBUTE * Attribute
793 ** Pointer to a variable receiving the gcATTRIBUTE object pointer.
795 gceSTATUS
796 gcSHADER_AddAttribute(
797 IN gcSHADER Shader,
798 IN gctCONST_STRING Name,
799 IN gcSHADER_TYPE Type,
800 IN gctSIZE_T Length,
801 IN gctBOOL IsTexture,
802 OUT gcATTRIBUTE * Attribute
805 /*******************************************************************************
806 ** gcSHADER_GetAttributeCount
807 ********************************************************************************
809 ** Get the number of attributes for this shader.
811 ** INPUT:
813 ** gcSHADER Shader
814 ** Pointer to a gcSHADER object.
816 ** OUTPUT:
818 ** gctSIZE_T * Count
819 ** Pointer to a variable receiving the number of attributes.
821 gceSTATUS
822 gcSHADER_GetAttributeCount(
823 IN gcSHADER Shader,
824 OUT gctSIZE_T * Count
827 /*******************************************************************************
828 ** gcSHADER_GetAttribute
829 ********************************************************************************
831 ** Get the gcATTRIBUTE object poniter for an indexed attribute for this shader.
833 ** INPUT:
835 ** gcSHADER Shader
836 ** Pointer to a gcSHADER object.
838 ** gctUINT Index
839 ** Index of the attribute to retrieve.
841 ** OUTPUT:
843 ** gcATTRIBUTE * Attribute
844 ** Pointer to a variable receiving the gcATTRIBUTE object pointer.
846 gceSTATUS
847 gcSHADER_GetAttribute(
848 IN gcSHADER Shader,
849 IN gctUINT Index,
850 OUT gcATTRIBUTE * Attribute
853 /*******************************************************************************
854 ** gcSHADER_ReallocateUniforms
856 ** Reallocate an array of pointers to gcUNIFORM objects.
858 ** INPUT:
860 ** gcSHADER Shader
861 ** Pointer to a gcSHADER object.
863 ** gctSIZE_T Count
864 ** Array count to reallocate. 'Count' must be at least 1.
866 gceSTATUS
867 gcSHADER_ReallocateUniforms(
868 IN gcSHADER Shader,
869 IN gctSIZE_T Count
872 /*******************************************************************************
873 ** gcSHADER_AddUniform
874 ********************************************************************************
876 ** Add an uniform to a gcSHADER object.
878 ** INPUT:
880 ** gcSHADER Shader
881 ** Pointer to a gcSHADER object.
883 ** gctCONST_STRING Name
884 ** Name of the uniform to add.
886 ** gcSHADER_TYPE Type
887 ** Type of the uniform to add.
889 ** gctSIZE_T Length
890 ** Array length of the uniform to add. 'Length' must be at least 1.
892 ** OUTPUT:
894 ** gcUNIFORM * Uniform
895 ** Pointer to a variable receiving the gcUNIFORM object pointer.
897 gceSTATUS
898 gcSHADER_AddUniform(
899 IN gcSHADER Shader,
900 IN gctCONST_STRING Name,
901 IN gcSHADER_TYPE Type,
902 IN gctSIZE_T Length,
903 OUT gcUNIFORM * Uniform
906 /*******************************************************************************
907 ** gcSHADER_GetUniformCount
908 ********************************************************************************
910 ** Get the number of uniforms for this shader.
912 ** INPUT:
914 ** gcSHADER Shader
915 ** Pointer to a gcSHADER object.
917 ** OUTPUT:
919 ** gctSIZE_T * Count
920 ** Pointer to a variable receiving the number of uniforms.
922 gceSTATUS
923 gcSHADER_GetUniformCount(
924 IN gcSHADER Shader,
925 OUT gctSIZE_T * Count
928 /*******************************************************************************
929 ** gcSHADER_GetUniform
930 ********************************************************************************
932 ** Get the gcUNIFORM object pointer for an indexed uniform for this shader.
934 ** INPUT:
936 ** gcSHADER Shader
937 ** Pointer to a gcSHADER object.
939 ** gctUINT Index
940 ** Index of the uniform to retrieve.
942 ** OUTPUT:
944 ** gcUNIFORM * Uniform
945 ** Pointer to a variable receiving the gcUNIFORM object pointer.
947 gceSTATUS
948 gcSHADER_GetUniform(
949 IN gcSHADER Shader,
950 IN gctUINT Index,
951 OUT gcUNIFORM * Uniform
954 /*******************************************************************************
955 ** gcSHADER_GetKernelFucntion
957 ** Get the gcKERNEL_FUNCTION object pointer for an indexed kernel function for this shader.
959 ** INPUT:
961 ** gcSHADER Shader
962 ** Pointer to a gcSHADER object.
964 ** gctUINT Index
965 ** Index of kernel function to retreive the name for.
967 ** OUTPUT:
969 ** gcKERNEL_FUNCTION * KernelFunction
970 ** Pointer to a variable receiving the gcKERNEL_FUNCTION object pointer.
972 gceSTATUS
973 gcSHADER_GetKernelFunction(
974 IN gcSHADER Shader,
975 IN gctUINT Index,
976 OUT gcKERNEL_FUNCTION * KernelFunction
979 gceSTATUS
980 gcSHADER_GetKernelFunctionByName(
981 IN gcSHADER Shader,
982 IN gctSTRING KernelName,
983 OUT gcKERNEL_FUNCTION * KernelFunction
985 /*******************************************************************************
986 ** gcSHADER_GetKernelFunctionCount
988 ** Get the number of kernel functions for this shader.
990 ** INPUT:
992 ** gcSHADER Shader
993 ** Pointer to a gcSHADER object.
995 ** OUTPUT:
997 ** gctSIZE_T * Count
998 ** Pointer to a variable receiving the number of kernel functions.
1000 gceSTATUS
1001 gcSHADER_GetKernelFunctionCount(
1002 IN gcSHADER Shader,
1003 OUT gctSIZE_T * Count
1006 /*******************************************************************************
1007 ** gcSHADER_ReallocateOutputs
1009 ** Reallocate an array of pointers to gcOUTPUT objects.
1011 ** INPUT:
1013 ** gcSHADER Shader
1014 ** Pointer to a gcSHADER object.
1016 ** gctSIZE_T Count
1017 ** Array count to reallocate. 'Count' must be at least 1.
1019 gceSTATUS
1020 gcSHADER_ReallocateOutputs(
1021 IN gcSHADER Shader,
1022 IN gctSIZE_T Count
1025 /*******************************************************************************
1026 ** gcSHADER_AddOutput
1027 ********************************************************************************
1029 ** Add an output to a gcSHADER object.
1031 ** INPUT:
1033 ** gcSHADER Shader
1034 ** Pointer to a gcSHADER object.
1036 ** gctCONST_STRING Name
1037 ** Name of the output to add.
1039 ** gcSHADER_TYPE Type
1040 ** Type of the output to add.
1042 ** gctSIZE_T Length
1043 ** Array length of the output to add. 'Length' must be at least 1.
1045 ** gctUINT16 TempRegister
1046 ** Temporary register index that holds the output value.
1048 ** OUTPUT:
1050 ** Nothing.
1052 gceSTATUS
1053 gcSHADER_AddOutput(
1054 IN gcSHADER Shader,
1055 IN gctCONST_STRING Name,
1056 IN gcSHADER_TYPE Type,
1057 IN gctSIZE_T Length,
1058 IN gctUINT16 TempRegister
1061 gceSTATUS
1062 gcSHADER_AddOutputIndexed(
1063 IN gcSHADER Shader,
1064 IN gctCONST_STRING Name,
1065 IN gctSIZE_T Index,
1066 IN gctUINT16 TempIndex
1069 /*******************************************************************************
1070 ** gcSHADER_GetOutputCount
1071 ********************************************************************************
1073 ** Get the number of outputs for this shader.
1075 ** INPUT:
1077 ** gcSHADER Shader
1078 ** Pointer to a gcSHADER object.
1080 ** OUTPUT:
1082 ** gctSIZE_T * Count
1083 ** Pointer to a variable receiving the number of outputs.
1085 gceSTATUS
1086 gcSHADER_GetOutputCount(
1087 IN gcSHADER Shader,
1088 OUT gctSIZE_T * Count
1091 /*******************************************************************************
1092 ** gcSHADER_GetOutput
1093 ********************************************************************************
1095 ** Get the gcOUTPUT object pointer for an indexed output for this shader.
1097 ** INPUT:
1099 ** gcSHADER Shader
1100 ** Pointer to a gcSHADER object.
1102 ** gctUINT Index
1103 ** Index of output to retrieve.
1105 ** OUTPUT:
1107 ** gcOUTPUT * Output
1108 ** Pointer to a variable receiving the gcOUTPUT object pointer.
1110 gceSTATUS
1111 gcSHADER_GetOutput(
1112 IN gcSHADER Shader,
1113 IN gctUINT Index,
1114 OUT gcOUTPUT * Output
1117 /*******************************************************************************
1118 ** gcSHADER_ReallocateVariables
1120 ** Reallocate an array of pointers to gcVARIABLE objects.
1122 ** INPUT:
1124 ** gcSHADER Shader
1125 ** Pointer to a gcSHADER object.
1127 ** gctSIZE_T Count
1128 ** Array count to reallocate. 'Count' must be at least 1.
1130 gceSTATUS
1131 gcSHADER_ReallocateVariables(
1132 IN gcSHADER Shader,
1133 IN gctSIZE_T Count
1136 /*******************************************************************************
1137 ** gcSHADER_AddVariable
1138 ********************************************************************************
1140 ** Add a variable to a gcSHADER object.
1142 ** INPUT:
1144 ** gcSHADER Shader
1145 ** Pointer to a gcSHADER object.
1147 ** gctCONST_STRING Name
1148 ** Name of the variable to add.
1150 ** gcSHADER_TYPE Type
1151 ** Type of the variable to add.
1153 ** gctSIZE_T Length
1154 ** Array length of the variable to add. 'Length' must be at least 1.
1156 ** gctUINT16 TempRegister
1157 ** Temporary register index that holds the variable value.
1159 ** OUTPUT:
1161 ** Nothing.
1163 gceSTATUS
1164 gcSHADER_AddVariable(
1165 IN gcSHADER Shader,
1166 IN gctCONST_STRING Name,
1167 IN gcSHADER_TYPE Type,
1168 IN gctSIZE_T Length,
1169 IN gctUINT16 TempRegister
1172 /*******************************************************************************
1173 ** gcSHADER_GetVariableCount
1174 ********************************************************************************
1176 ** Get the number of variables for this shader.
1178 ** INPUT:
1180 ** gcSHADER Shader
1181 ** Pointer to a gcSHADER object.
1183 ** OUTPUT:
1185 ** gctSIZE_T * Count
1186 ** Pointer to a variable receiving the number of variables.
1188 gceSTATUS
1189 gcSHADER_GetVariableCount(
1190 IN gcSHADER Shader,
1191 OUT gctSIZE_T * Count
1194 /*******************************************************************************
1195 ** gcSHADER_GetVariable
1196 ********************************************************************************
1198 ** Get the gcVARIABLE object pointer for an indexed variable for this shader.
1200 ** INPUT:
1202 ** gcSHADER Shader
1203 ** Pointer to a gcSHADER object.
1205 ** gctUINT Index
1206 ** Index of variable to retrieve.
1208 ** OUTPUT:
1210 ** gcVARIABLE * Variable
1211 ** Pointer to a variable receiving the gcVARIABLE object pointer.
1213 gceSTATUS
1214 gcSHADER_GetVariable(
1215 IN gcSHADER Shader,
1216 IN gctUINT Index,
1217 OUT gcVARIABLE * Variable
1220 /*******************************************************************************
1221 ** gcSHADER_AddOpcode
1222 ********************************************************************************
1224 ** Add an opcode to a gcSHADER object.
1226 ** INPUT:
1228 ** gcSHADER Shader
1229 ** Pointer to a gcSHADER object.
1231 ** gcSL_OPCODE Opcode
1232 ** Opcode to add.
1234 ** gctUINT16 TempRegister
1235 ** Temporary register index that acts as the target of the opcode.
1237 ** gctUINT8 Enable
1238 ** Write enable bits for the temporary register that acts as the target
1239 ** of the opcode.
1241 ** gcSL_FORMAT Format
1242 ** Format of the temporary register.
1244 ** OUTPUT:
1246 ** Nothing.
1248 gceSTATUS
1249 gcSHADER_AddOpcode(
1250 IN gcSHADER Shader,
1251 IN gcSL_OPCODE Opcode,
1252 IN gctUINT16 TempRegister,
1253 IN gctUINT8 Enable,
1254 IN gcSL_FORMAT Format
1257 gceSTATUS
1258 gcSHADER_AddOpcode2(
1259 IN gcSHADER Shader,
1260 IN gcSL_OPCODE Opcode,
1261 IN gcSL_CONDITION Condition,
1262 IN gctUINT16 TempRegister,
1263 IN gctUINT8 Enable,
1264 IN gcSL_FORMAT Format
1267 /*******************************************************************************
1268 ** gcSHADER_AddOpcodeIndexed
1269 ********************************************************************************
1271 ** Add an opcode to a gcSHADER object that writes to an dynamically indexed
1272 ** target.
1274 ** INPUT:
1276 ** gcSHADER Shader
1277 ** Pointer to a gcSHADER object.
1279 ** gcSL_OPCODE Opcode
1280 ** Opcode to add.
1282 ** gctUINT16 TempRegister
1283 ** Temporary register index that acts as the target of the opcode.
1285 ** gctUINT8 Enable
1286 ** Write enable bits for the temporary register that acts as the
1287 ** target of the opcode.
1289 ** gcSL_INDEXED Mode
1290 ** Location of the dynamic index inside the temporary register. Valid
1291 ** values can be:
1293 ** gcSL_INDEXED_X - Use x component of the temporary register.
1294 ** gcSL_INDEXED_Y - Use y component of the temporary register.
1295 ** gcSL_INDEXED_Z - Use z component of the temporary register.
1296 ** gcSL_INDEXED_W - Use w component of the temporary register.
1298 ** gctUINT16 IndexRegister
1299 ** Temporary register index that holds the dynamic index.
1301 ** gcSL_FORMAT Format
1302 ** Format of the temporary register.
1304 ** OUTPUT:
1306 ** Nothing.
1308 gceSTATUS
1309 gcSHADER_AddOpcodeIndexed(
1310 IN gcSHADER Shader,
1311 IN gcSL_OPCODE Opcode,
1312 IN gctUINT16 TempRegister,
1313 IN gctUINT8 Enable,
1314 IN gcSL_INDEXED Mode,
1315 IN gctUINT16 IndexRegister,
1316 IN gcSL_FORMAT Format
1319 /*******************************************************************************
1320 ** gcSHADER_AddOpcodeConditionIndexed
1322 ** Add an opcode to a gcSHADER object that writes to an dynamically indexed
1323 ** target.
1325 ** INPUT:
1327 ** gcSHADER Shader
1328 ** Pointer to a gcSHADER object.
1330 ** gcSL_OPCODE Opcode
1331 ** Opcode to add.
1333 ** gcSL_CONDITION Condition
1334 ** Condition to check.
1336 ** gctUINT16 TempRegister
1337 ** Temporary register index that acts as the target of the opcode.
1339 ** gctUINT8 Enable
1340 ** Write enable bits for the temporary register that acts as the
1341 ** target of the opcode.
1343 ** gcSL_INDEXED Indexed
1344 ** Location of the dynamic index inside the temporary register. Valid
1345 ** values can be:
1347 ** gcSL_INDEXED_X - Use x component of the temporary register.
1348 ** gcSL_INDEXED_Y - Use y component of the temporary register.
1349 ** gcSL_INDEXED_Z - Use z component of the temporary register.
1350 ** gcSL_INDEXED_W - Use w component of the temporary register.
1352 ** gctUINT16 IndexRegister
1353 ** Temporary register index that holds the dynamic index.
1355 ** OUTPUT:
1357 ** Nothing.
1359 gceSTATUS
1360 gcSHADER_AddOpcodeConditionIndexed(
1361 IN gcSHADER Shader,
1362 IN gcSL_OPCODE Opcode,
1363 IN gcSL_CONDITION Condition,
1364 IN gctUINT16 TempRegister,
1365 IN gctUINT8 Enable,
1366 IN gcSL_INDEXED Indexed,
1367 IN gctUINT16 IndexRegister,
1368 IN gcSL_FORMAT Format
1371 /*******************************************************************************
1372 ** gcSHADER_AddOpcodeConditional
1373 ********************************************************************************
1375 ** Add an conditional opcode to a gcSHADER object.
1377 ** INPUT:
1379 ** gcSHADER Shader
1380 ** Pointer to a gcSHADER object.
1382 ** gcSL_OPCODE Opcode
1383 ** Opcode to add.
1385 ** gcSL_CONDITION Condition
1386 ** Condition that needs to evaluate to gcvTRUE in order for the opcode to
1387 ** execute.
1389 ** gctUINT Label
1390 ** Target label if 'Condition' evaluates to gcvTRUE.
1392 ** OUTPUT:
1394 ** Nothing.
1396 gceSTATUS
1397 gcSHADER_AddOpcodeConditional(
1398 IN gcSHADER Shader,
1399 IN gcSL_OPCODE Opcode,
1400 IN gcSL_CONDITION Condition,
1401 IN gctUINT Label
1404 /*******************************************************************************
1405 ** gcSHADER_AddOpcodeConditionalFormatted
1407 ** Add an conditional jump or call opcode to a gcSHADER object.
1409 ** INPUT:
1411 ** gcSHADER Shader
1412 ** Pointer to a gcSHADER object.
1414 ** gcSL_OPCODE Opcode
1415 ** Opcode to add.
1417 ** gcSL_CONDITION Condition
1418 ** Condition that needs to evaluate to gcvTRUE in order for the opcode to
1419 ** execute.
1421 ** gcSL_FORMAT Format
1422 ** Format of conditional operands
1424 ** gctUINT Label
1425 ** Target label if 'Condition' evaluates to gcvTRUE.
1427 ** OUTPUT:
1429 ** Nothing.
1431 gceSTATUS
1432 gcSHADER_AddOpcodeConditionalFormatted(
1433 IN gcSHADER Shader,
1434 IN gcSL_OPCODE Opcode,
1435 IN gcSL_CONDITION Condition,
1436 IN gcSL_FORMAT Format,
1437 IN gctUINT Label
1440 /*******************************************************************************
1441 ** gcSHADER_AddLabel
1442 ********************************************************************************
1444 ** Define a label at the current instruction of a gcSHADER object.
1446 ** INPUT:
1448 ** gcSHADER Shader
1449 ** Pointer to a gcSHADER object.
1451 ** gctUINT Label
1452 ** Label to define.
1454 ** OUTPUT:
1456 ** Nothing.
1458 gceSTATUS
1459 gcSHADER_AddLabel(
1460 IN gcSHADER Shader,
1461 IN gctUINT Label
1464 /*******************************************************************************
1465 ** gcSHADER_AddSource
1466 ********************************************************************************
1468 ** Add a source operand to a gcSHADER object.
1470 ** INPUT:
1472 ** gcSHADER Shader
1473 ** Pointer to a gcSHADER object.
1475 ** gcSL_TYPE Type
1476 ** Type of the source operand.
1478 ** gctUINT16 SourceIndex
1479 ** Index of the source operand.
1481 ** gctUINT8 Swizzle
1482 ** x, y, z, and w swizzle values packed into one 8-bit value.
1484 ** gcSL_FORMAT Format
1485 ** Format of the source operand.
1487 ** OUTPUT:
1489 ** Nothing.
1491 gceSTATUS
1492 gcSHADER_AddSource(
1493 IN gcSHADER Shader,
1494 IN gcSL_TYPE Type,
1495 IN gctUINT16 SourceIndex,
1496 IN gctUINT8 Swizzle,
1497 IN gcSL_FORMAT Format
1500 /*******************************************************************************
1501 ** gcSHADER_AddSourceIndexed
1502 ********************************************************************************
1504 ** Add a dynamically indexed source operand to a gcSHADER object.
1506 ** INPUT:
1508 ** gcSHADER Shader
1509 ** Pointer to a gcSHADER object.
1511 ** gcSL_TYPE Type
1512 ** Type of the source operand.
1514 ** gctUINT16 SourceIndex
1515 ** Index of the source operand.
1517 ** gctUINT8 Swizzle
1518 ** x, y, z, and w swizzle values packed into one 8-bit value.
1520 ** gcSL_INDEXED Mode
1521 ** Addressing mode for the index.
1523 ** gctUINT16 IndexRegister
1524 ** Temporary register index that holds the dynamic index.
1526 ** gcSL_FORMAT Format
1527 ** Format of the source operand.
1529 ** OUTPUT:
1531 ** Nothing.
1533 gceSTATUS
1534 gcSHADER_AddSourceIndexed(
1535 IN gcSHADER Shader,
1536 IN gcSL_TYPE Type,
1537 IN gctUINT16 SourceIndex,
1538 IN gctUINT8 Swizzle,
1539 IN gcSL_INDEXED Mode,
1540 IN gctUINT16 IndexRegister,
1541 IN gcSL_FORMAT Format
1544 /*******************************************************************************
1545 ** gcSHADER_AddSourceAttribute
1546 ********************************************************************************
1548 ** Add an attribute as a source operand to a gcSHADER object.
1550 ** INPUT:
1552 ** gcSHADER Shader
1553 ** Pointer to a gcSHADER object.
1555 ** gcATTRIBUTE Attribute
1556 ** Pointer to a gcATTRIBUTE object.
1558 ** gctUINT8 Swizzle
1559 ** x, y, z, and w swizzle values packed into one 8-bit value.
1561 ** gctINT Index
1562 ** Static index into the attribute in case the attribute is a matrix
1563 ** or array.
1565 ** OUTPUT:
1567 ** Nothing.
1569 gceSTATUS
1570 gcSHADER_AddSourceAttribute(
1571 IN gcSHADER Shader,
1572 IN gcATTRIBUTE Attribute,
1573 IN gctUINT8 Swizzle,
1574 IN gctINT Index
1577 /*******************************************************************************
1578 ** gcSHADER_AddSourceAttributeIndexed
1579 ********************************************************************************
1581 ** Add an indexed attribute as a source operand to a gcSHADER object.
1583 ** INPUT:
1585 ** gcSHADER Shader
1586 ** Pointer to a gcSHADER object.
1588 ** gcATTRIBUTE Attribute
1589 ** Pointer to a gcATTRIBUTE object.
1591 ** gctUINT8 Swizzle
1592 ** x, y, z, and w swizzle values packed into one 8-bit value.
1594 ** gctINT Index
1595 ** Static index into the attribute in case the attribute is a matrix
1596 ** or array.
1598 ** gcSL_INDEXED Mode
1599 ** Addressing mode of the dynamic index.
1601 ** gctUINT16 IndexRegister
1602 ** Temporary register index that holds the dynamic index.
1604 ** OUTPUT:
1606 ** Nothing.
1608 gceSTATUS
1609 gcSHADER_AddSourceAttributeIndexed(
1610 IN gcSHADER Shader,
1611 IN gcATTRIBUTE Attribute,
1612 IN gctUINT8 Swizzle,
1613 IN gctINT Index,
1614 IN gcSL_INDEXED Mode,
1615 IN gctUINT16 IndexRegister
1618 /*******************************************************************************
1619 ** gcSHADER_AddSourceUniform
1620 ********************************************************************************
1622 ** Add a uniform as a source operand to a gcSHADER object.
1624 ** INPUT:
1626 ** gcSHADER Shader
1627 ** Pointer to a gcSHADER object.
1629 ** gcUNIFORM Uniform
1630 ** Pointer to a gcUNIFORM object.
1632 ** gctUINT8 Swizzle
1633 ** x, y, z, and w swizzle values packed into one 8-bit value.
1635 ** gctINT Index
1636 ** Static index into the uniform in case the uniform is a matrix or
1637 ** array.
1639 ** OUTPUT:
1641 ** Nothing.
1643 gceSTATUS
1644 gcSHADER_AddSourceUniform(
1645 IN gcSHADER Shader,
1646 IN gcUNIFORM Uniform,
1647 IN gctUINT8 Swizzle,
1648 IN gctINT Index
1651 /*******************************************************************************
1652 ** gcSHADER_AddSourceUniformIndexed
1653 ********************************************************************************
1655 ** Add an indexed uniform as a source operand to a gcSHADER object.
1657 ** INPUT:
1659 ** gcSHADER Shader
1660 ** Pointer to a gcSHADER object.
1662 ** gcUNIFORM Uniform
1663 ** Pointer to a gcUNIFORM object.
1665 ** gctUINT8 Swizzle
1666 ** x, y, z, and w swizzle values packed into one 8-bit value.
1668 ** gctINT Index
1669 ** Static index into the uniform in case the uniform is a matrix or
1670 ** array.
1672 ** gcSL_INDEXED Mode
1673 ** Addressing mode of the dynamic index.
1675 ** gctUINT16 IndexRegister
1676 ** Temporary register index that holds the dynamic index.
1678 ** OUTPUT:
1680 ** Nothing.
1682 gceSTATUS
1683 gcSHADER_AddSourceUniformIndexed(
1684 IN gcSHADER Shader,
1685 IN gcUNIFORM Uniform,
1686 IN gctUINT8 Swizzle,
1687 IN gctINT Index,
1688 IN gcSL_INDEXED Mode,
1689 IN gctUINT16 IndexRegister
1692 gceSTATUS
1693 gcSHADER_AddSourceSamplerIndexed(
1694 IN gcSHADER Shader,
1695 IN gctUINT8 Swizzle,
1696 IN gcSL_INDEXED Mode,
1697 IN gctUINT16 IndexRegister
1700 gceSTATUS
1701 gcSHADER_AddSourceAttributeFormatted(
1702 IN gcSHADER Shader,
1703 IN gcATTRIBUTE Attribute,
1704 IN gctUINT8 Swizzle,
1705 IN gctINT Index,
1706 IN gcSL_FORMAT Format
1709 gceSTATUS
1710 gcSHADER_AddSourceAttributeIndexedFormatted(
1711 IN gcSHADER Shader,
1712 IN gcATTRIBUTE Attribute,
1713 IN gctUINT8 Swizzle,
1714 IN gctINT Index,
1715 IN gcSL_INDEXED Mode,
1716 IN gctUINT16 IndexRegister,
1717 IN gcSL_FORMAT Format
1720 gceSTATUS
1721 gcSHADER_AddSourceUniformFormatted(
1722 IN gcSHADER Shader,
1723 IN gcUNIFORM Uniform,
1724 IN gctUINT8 Swizzle,
1725 IN gctINT Index,
1726 IN gcSL_FORMAT Format
1729 gceSTATUS
1730 gcSHADER_AddSourceUniformIndexedFormatted(
1731 IN gcSHADER Shader,
1732 IN gcUNIFORM Uniform,
1733 IN gctUINT8 Swizzle,
1734 IN gctINT Index,
1735 IN gcSL_INDEXED Mode,
1736 IN gctUINT16 IndexRegister,
1737 IN gcSL_FORMAT Format
1740 gceSTATUS
1741 gcSHADER_AddSourceSamplerIndexedFormatted(
1742 IN gcSHADER Shader,
1743 IN gctUINT8 Swizzle,
1744 IN gcSL_INDEXED Mode,
1745 IN gctUINT16 IndexRegister,
1746 IN gcSL_FORMAT Format
1749 /*******************************************************************************
1750 ** gcSHADER_AddSourceConstant
1751 ********************************************************************************
1753 ** Add a constant floating point value as a source operand to a gcSHADER
1754 ** object.
1756 ** INPUT:
1758 ** gcSHADER Shader
1759 ** Pointer to a gcSHADER object.
1761 ** gctFLOAT Constant
1762 ** Floating point constant.
1764 ** OUTPUT:
1766 ** Nothing.
1768 gceSTATUS
1769 gcSHADER_AddSourceConstant(
1770 IN gcSHADER Shader,
1771 IN gctFLOAT Constant
1774 /*******************************************************************************
1775 ** gcSHADER_AddSourceConstantFormatted
1776 ********************************************************************************
1778 ** Add a constant value as a source operand to a gcSHADER
1779 ** object.
1781 ** INPUT:
1783 ** gcSHADER Shader
1784 ** Pointer to a gcSHADER object.
1786 ** void * Constant
1787 ** Pointer to constant.
1789 ** gcSL_FORMAT Format
1791 ** OUTPUT:
1793 ** Nothing.
1795 gceSTATUS
1796 gcSHADER_AddSourceConstantFormatted(
1797 IN gcSHADER Shader,
1798 IN void *Constant,
1799 IN gcSL_FORMAT Format
1802 /*******************************************************************************
1803 ** gcSHADER_Pack
1804 ********************************************************************************
1806 ** Pack a dynamically created gcSHADER object by trimming the allocated arrays
1807 ** and resolving all the labeling.
1809 ** INPUT:
1811 ** gcSHADER Shader
1812 ** Pointer to a gcSHADER object.
1814 ** OUTPUT:
1816 ** Nothing.
1818 gceSTATUS
1819 gcSHADER_Pack(
1820 IN gcSHADER Shader
1823 /*******************************************************************************
1824 ** gcSHADER_SetOptimizationOption
1825 ********************************************************************************
1827 ** Set optimization option of a gcSHADER object.
1829 ** INPUT:
1831 ** gcSHADER Shader
1832 ** Pointer to a gcSHADER object.
1834 ** gctUINT OptimizationOption
1835 ** Optimization option. Can be one of the following:
1837 ** 0 - No optimization.
1838 ** 1 - Full optimization.
1839 ** Other value - For optimizer testing.
1841 ** OUTPUT:
1843 ** Nothing.
1845 gceSTATUS
1846 gcSHADER_SetOptimizationOption(
1847 IN gcSHADER Shader,
1848 IN gctUINT OptimizationOption
1851 /*******************************************************************************
1852 ** gcSHADER_ReallocateFunctions
1854 ** Reallocate an array of pointers to gcFUNCTION objects.
1856 ** INPUT:
1858 ** gcSHADER Shader
1859 ** Pointer to a gcSHADER object.
1861 ** gctSIZE_T Count
1862 ** Array count to reallocate. 'Count' must be at least 1.
1864 gceSTATUS
1865 gcSHADER_ReallocateFunctions(
1866 IN gcSHADER Shader,
1867 IN gctSIZE_T Count
1870 gceSTATUS
1871 gcSHADER_AddFunction(
1872 IN gcSHADER Shader,
1873 IN gctCONST_STRING Name,
1874 OUT gcFUNCTION * Function
1877 gceSTATUS
1878 gcSHADER_ReallocateKernelFunctions(
1879 IN gcSHADER Shader,
1880 IN gctSIZE_T Count
1883 gceSTATUS
1884 gcSHADER_AddKernelFunction(
1885 IN gcSHADER Shader,
1886 IN gctCONST_STRING Name,
1887 OUT gcKERNEL_FUNCTION * KernelFunction
1890 gceSTATUS
1891 gcSHADER_BeginFunction(
1892 IN gcSHADER Shader,
1893 IN gcFUNCTION Function
1896 gceSTATUS
1897 gcSHADER_EndFunction(
1898 IN gcSHADER Shader,
1899 IN gcFUNCTION Function
1902 gceSTATUS
1903 gcSHADER_BeginKernelFunction(
1904 IN gcSHADER Shader,
1905 IN gcKERNEL_FUNCTION KernelFunction
1908 gceSTATUS
1909 gcSHADER_EndKernelFunction(
1910 IN gcSHADER Shader,
1911 IN gcKERNEL_FUNCTION KernelFunction,
1912 IN gctSIZE_T LocalMemorySize
1915 gceSTATUS
1916 gcSHADER_SetMaxKernelFunctionArgs(
1917 IN gcSHADER Shader,
1918 IN gctUINT32 MaxKernelFunctionArgs
1921 /*******************************************************************************
1922 ** gcSHADER_SetConstantMemorySize
1924 ** Set the constant memory address space size of a gcSHADER object.
1926 ** INPUT:
1928 ** gcSHADER Shader
1929 ** Pointer to a gcSHADER object.
1931 ** gctSIZE_T ConstantMemorySize
1932 ** Constant memory size in bytes
1934 ** gctCHAR *ConstantMemoryBuffer
1935 ** Constant memory buffer
1937 gceSTATUS
1938 gcSHADER_SetConstantMemorySize(
1939 IN gcSHADER Shader,
1940 IN gctSIZE_T ConstantMemorySize,
1941 IN gctCHAR * ConstantMemoryBuffer
1944 /*******************************************************************************
1945 ** gcSHADER_GetConstantMemorySize
1947 ** Set the constant memory address space size of a gcSHADER object.
1949 ** INPUT:
1951 ** gcSHADER Shader
1952 ** Pointer to a gcSHADER object.
1954 ** OUTPUT:
1956 ** gctSIZE_T * ConstantMemorySize
1957 ** Pointer to a variable receiving constant memory size in bytes
1959 ** gctCHAR **ConstantMemoryBuffer.
1960 ** Pointer to a variable for returned shader constant memory buffer.
1962 gceSTATUS
1963 gcSHADER_GetConstantMemorySize(
1964 IN gcSHADER Shader,
1965 OUT gctSIZE_T * ConstantMemorySize,
1966 OUT gctCHAR ** ConstantMemoryBuffer
1969 /*******************************************************************************
1970 ** gcSHADER_SetPrivateMemorySize
1972 ** Set the private memory address space size of a gcSHADER object.
1974 ** INPUT:
1976 ** gcSHADER Shader
1977 ** Pointer to a gcSHADER object.
1979 ** gctSIZE_T PrivateMemorySize
1980 ** Private memory size in bytes
1982 gceSTATUS
1983 gcSHADER_SetPrivateMemorySize(
1984 IN gcSHADER Shader,
1985 IN gctSIZE_T PrivateMemorySize
1988 /*******************************************************************************
1989 ** gcSHADER_GetPrivateMemorySize
1991 ** Set the private memory address space size of a gcSHADER object.
1993 ** INPUT:
1995 ** gcSHADER Shader
1996 ** Pointer to a gcSHADER object.
1998 ** OUTPUT:
2000 ** gctSIZE_T * PrivateMemorySize
2001 ** Pointer to a variable receiving private memory size in bytes
2003 gceSTATUS
2004 gcSHADER_GetPrivateMemorySize(
2005 IN gcSHADER Shader,
2006 OUT gctSIZE_T * PrivateMemorySize
2009 /*******************************************************************************
2010 ** gcSHADER_SetLocalMemorySize
2012 ** Set the local memory address space size of a gcSHADER object.
2014 ** INPUT:
2016 ** gcSHADER Shader
2017 ** Pointer to a gcSHADER object.
2019 ** gctSIZE_T LocalMemorySize
2020 ** Local memory size in bytes
2022 gceSTATUS
2023 gcSHADER_SetLocalMemorySize(
2024 IN gcSHADER Shader,
2025 IN gctSIZE_T LocalMemorySize
2028 /*******************************************************************************
2029 ** gcSHADER_GetLocalMemorySize
2031 ** Set the local memory address space size of a gcSHADER object.
2033 ** INPUT:
2035 ** gcSHADER Shader
2036 ** Pointer to a gcSHADER object.
2038 ** OUTPUT:
2040 ** gctSIZE_T * LocalMemorySize
2041 ** Pointer to a variable receiving lcoal memory size in bytes
2043 gceSTATUS
2044 gcSHADER_GetLocalMemorySize(
2045 IN gcSHADER Shader,
2046 OUT gctSIZE_T * LocalMemorySize
2049 /*******************************************************************************
2050 ** gcATTRIBUTE_GetType
2051 ********************************************************************************
2053 ** Get the type and array length of a gcATTRIBUTE object.
2055 ** INPUT:
2057 ** gcATTRIBUTE Attribute
2058 ** Pointer to a gcATTRIBUTE object.
2060 ** OUTPUT:
2062 ** gcSHADER_TYPE * Type
2063 ** Pointer to a variable receiving the type of the attribute. 'Type'
2064 ** can be gcvNULL, in which case no type will be returned.
2066 ** gctSIZE_T * ArrayLength
2067 ** Pointer to a variable receiving the length of the array if the
2068 ** attribute was declared as an array. If the attribute was not
2069 ** declared as an array, the array length will be 1. 'ArrayLength' can
2070 ** be gcvNULL, in which case no array length will be returned.
2072 gceSTATUS
2073 gcATTRIBUTE_GetType(
2074 IN gcATTRIBUTE Attribute,
2075 OUT gcSHADER_TYPE * Type,
2076 OUT gctSIZE_T * ArrayLength
2079 /*******************************************************************************
2080 ** gcATTRIBUTE_GetName
2081 ********************************************************************************
2083 ** Get the name of a gcATTRIBUTE object.
2085 ** INPUT:
2087 ** gcATTRIBUTE Attribute
2088 ** Pointer to a gcATTRIBUTE object.
2090 ** OUTPUT:
2092 ** gctSIZE_T * Length
2093 ** Pointer to a variable receiving the length of the attribute name.
2094 ** 'Length' can be gcvNULL, in which case no length will be returned.
2096 ** gctCONST_STRING * Name
2097 ** Pointer to a variable receiving the pointer to the attribute name.
2098 ** 'Name' can be gcvNULL, in which case no name will be returned.
2100 gceSTATUS
2101 gcATTRIBUTE_GetName(
2102 IN gcATTRIBUTE Attribute,
2103 OUT gctSIZE_T * Length,
2104 OUT gctCONST_STRING * Name
2107 /*******************************************************************************
2108 ** gcATTRIBUTE_IsEnabled
2109 ********************************************************************************
2111 ** Query the enabled state of a gcATTRIBUTE object.
2113 ** INPUT:
2115 ** gcATTRIBUTE Attribute
2116 ** Pointer to a gcATTRIBUTE object.
2118 ** OUTPUT:
2120 ** gctBOOL * Enabled
2121 ** Pointer to a variable receiving the enabled state of the attribute.
2123 gceSTATUS
2124 gcATTRIBUTE_IsEnabled(
2125 IN gcATTRIBUTE Attribute,
2126 OUT gctBOOL * Enabled
2129 /*******************************************************************************
2130 ** gcUNIFORM_GetType
2131 ********************************************************************************
2133 ** Get the type and array length of a gcUNIFORM object.
2135 ** INPUT:
2137 ** gcUNIFORM Uniform
2138 ** Pointer to a gcUNIFORM object.
2140 ** OUTPUT:
2142 ** gcSHADER_TYPE * Type
2143 ** Pointer to a variable receiving the type of the uniform. 'Type' can
2144 ** be gcvNULL, in which case no type will be returned.
2146 ** gctSIZE_T * ArrayLength
2147 ** Pointer to a variable receiving the length of the array if the
2148 ** uniform was declared as an array. If the uniform was not declared
2149 ** as an array, the array length will be 1. 'ArrayLength' can be gcvNULL,
2150 ** in which case no array length will be returned.
2152 gceSTATUS
2153 gcUNIFORM_GetType(
2154 IN gcUNIFORM Uniform,
2155 OUT gcSHADER_TYPE * Type,
2156 OUT gctSIZE_T * ArrayLength
2159 /*******************************************************************************
2160 ** gcUNIFORM_GetFlags
2161 ********************************************************************************
2163 ** Get the flags of a gcUNIFORM object.
2165 ** INPUT:
2167 ** gcUNIFORM Uniform
2168 ** Pointer to a gcUNIFORM object.
2170 ** OUTPUT:
2172 ** gceUNIFORM_FLAGS * Flags
2173 ** Pointer to a variable receiving the flags of the uniform.
2176 gceSTATUS
2177 gcUNIFORM_GetFlags(
2178 IN gcUNIFORM Uniform,
2179 OUT gceUNIFORM_FLAGS * Flags
2182 /*******************************************************************************
2183 ** gcUNIFORM_SetFlags
2184 ********************************************************************************
2186 ** Set the flags of a gcUNIFORM object.
2188 ** INPUT:
2190 ** gcUNIFORM Uniform
2191 ** Pointer to a gcUNIFORM object.
2193 ** gceUNIFORM_FLAGS Flags
2194 ** Flags of the uniform to be set.
2196 ** OUTPUT:
2197 ** Nothing.
2200 gceSTATUS
2201 gcUNIFORM_SetFlags(
2202 IN gcUNIFORM Uniform,
2203 IN gceUNIFORM_FLAGS Flags
2206 /*******************************************************************************
2207 ** gcUNIFORM_GetName
2208 ********************************************************************************
2210 ** Get the name of a gcUNIFORM object.
2212 ** INPUT:
2214 ** gcUNIFORM Uniform
2215 ** Pointer to a gcUNIFORM object.
2217 ** OUTPUT:
2219 ** gctSIZE_T * Length
2220 ** Pointer to a variable receiving the length of the uniform name.
2221 ** 'Length' can be gcvNULL, in which case no length will be returned.
2223 ** gctCONST_STRING * Name
2224 ** Pointer to a variable receiving the pointer to the uniform name.
2225 ** 'Name' can be gcvNULL, in which case no name will be returned.
2227 gceSTATUS
2228 gcUNIFORM_GetName(
2229 IN gcUNIFORM Uniform,
2230 OUT gctSIZE_T * Length,
2231 OUT gctCONST_STRING * Name
2234 /*******************************************************************************
2235 ** gcUNIFORM_GetSampler
2236 ********************************************************************************
2238 ** Get the physical sampler number for a sampler gcUNIFORM object.
2240 ** INPUT:
2242 ** gcUNIFORM Uniform
2243 ** Pointer to a gcUNIFORM object.
2245 ** OUTPUT:
2247 ** gctUINT32 * Sampler
2248 ** Pointer to a variable receiving the physical sampler.
2250 gceSTATUS
2251 gcUNIFORM_GetSampler(
2252 IN gcUNIFORM Uniform,
2253 OUT gctUINT32 * Sampler
2256 /*******************************************************************************
2257 ** gcUNIFORM_GetFormat
2259 ** Get the type and array length of a gcUNIFORM object.
2261 ** INPUT:
2263 ** gcUNIFORM Uniform
2264 ** Pointer to a gcUNIFORM object.
2266 ** OUTPUT:
2268 ** gcSL_FORMAT * Format
2269 ** Pointer to a variable receiving the format of element of the uniform.
2270 ** 'Type' can be gcvNULL, in which case no type will be returned.
2272 ** gctBOOL * IsPointer
2273 ** Pointer to a variable receiving the state wheter the uniform is a pointer.
2274 ** 'IsPointer' can be gcvNULL, in which case no array length will be returned.
2276 gceSTATUS
2277 gcUNIFORM_GetFormat(
2278 IN gcUNIFORM Uniform,
2279 OUT gcSL_FORMAT * Format,
2280 OUT gctBOOL * IsPointer
2283 /*******************************************************************************
2284 ** gcUNIFORM_SetFormat
2286 ** Set the format and isPointer of a uniform.
2288 ** INPUT:
2290 ** gcUNIFORM Uniform
2291 ** Pointer to a gcUNIFORM object.
2293 ** gcSL_FORMAT Format
2294 ** Format of element of the uniform shaderType.
2296 ** gctBOOL IsPointer
2297 ** Wheter the uniform is a pointer.
2299 ** OUTPUT:
2301 ** Nothing.
2303 gceSTATUS
2304 gcUNIFORM_SetFormat(
2305 IN gcUNIFORM Uniform,
2306 IN gcSL_FORMAT Format,
2307 IN gctBOOL IsPointer
2310 /*******************************************************************************
2311 ** gcUNIFORM_SetValue
2312 ********************************************************************************
2314 ** Set the value of a uniform in integer.
2316 ** INPUT:
2318 ** gcUNIFORM Uniform
2319 ** Pointer to a gcUNIFORM object.
2321 ** gctSIZE_T Count
2322 ** Number of entries to program if the uniform has been declared as an
2323 ** array.
2325 ** const gctINT * Value
2326 ** Pointer to a buffer holding the integer values for the uniform.
2328 ** OUTPUT:
2330 ** Nothing.
2332 gceSTATUS
2333 gcUNIFORM_SetValue(
2334 IN gcUNIFORM Uniform,
2335 IN gctSIZE_T Count,
2336 IN const gctINT * Value
2339 /*******************************************************************************
2340 ** gcUNIFORM_SetValueX
2341 ********************************************************************************
2343 ** Set the value of a uniform in fixed point.
2345 ** INPUT:
2347 ** gcUNIFORM Uniform
2348 ** Pointer to a gcUNIFORM object.
2350 ** gctSIZE_T Count
2351 ** Number of entries to program if the uniform has been declared as an
2352 ** array.
2354 ** const gctFIXED_POINT * Value
2355 ** Pointer to a buffer holding the fixed point values for the uniform.
2357 ** OUTPUT:
2359 ** Nothing.
2361 gceSTATUS
2362 gcUNIFORM_SetValueX(
2363 IN gcUNIFORM Uniform,
2364 IN gctSIZE_T Count,
2365 IN gctFIXED_POINT * Value
2368 /*******************************************************************************
2369 ** gcUNIFORM_SetValueF
2370 ********************************************************************************
2372 ** Set the value of a uniform in floating point.
2374 ** INPUT:
2376 ** gcUNIFORM Uniform
2377 ** Pointer to a gcUNIFORM object.
2379 ** gctSIZE_T Count
2380 ** Number of entries to program if the uniform has been declared as an
2381 ** array.
2383 ** const gctFLOAT * Value
2384 ** Pointer to a buffer holding the floating point values for the
2385 ** uniform.
2387 ** OUTPUT:
2389 ** Nothing.
2391 gceSTATUS
2392 gcUNIFORM_SetValueF(
2393 IN gcUNIFORM Uniform,
2394 IN gctSIZE_T Count,
2395 IN const gctFLOAT * Value
2398 /*******************************************************************************
2399 ** gcOUTPUT_GetType
2400 ********************************************************************************
2402 ** Get the type and array length of a gcOUTPUT object.
2404 ** INPUT:
2406 ** gcOUTPUT Output
2407 ** Pointer to a gcOUTPUT object.
2409 ** OUTPUT:
2411 ** gcSHADER_TYPE * Type
2412 ** Pointer to a variable receiving the type of the output. 'Type' can
2413 ** be gcvNULL, in which case no type will be returned.
2415 ** gctSIZE_T * ArrayLength
2416 ** Pointer to a variable receiving the length of the array if the
2417 ** output was declared as an array. If the output was not declared
2418 ** as an array, the array length will be 1. 'ArrayLength' can be gcvNULL,
2419 ** in which case no array length will be returned.
2421 gceSTATUS
2422 gcOUTPUT_GetType(
2423 IN gcOUTPUT Output,
2424 OUT gcSHADER_TYPE * Type,
2425 OUT gctSIZE_T * ArrayLength
2428 /*******************************************************************************
2429 ** gcOUTPUT_GetIndex
2430 ********************************************************************************
2432 ** Get the index of a gcOUTPUT object.
2434 ** INPUT:
2436 ** gcOUTPUT Output
2437 ** Pointer to a gcOUTPUT object.
2439 ** OUTPUT:
2441 ** gctUINT * Index
2442 ** Pointer to a variable receiving the temporary register index of the
2443 ** output. 'Index' can be gcvNULL,. in which case no index will be
2444 ** returned.
2446 gceSTATUS
2447 gcOUTPUT_GetIndex(
2448 IN gcOUTPUT Output,
2449 OUT gctUINT * Index
2452 /*******************************************************************************
2453 ** gcOUTPUT_GetName
2454 ********************************************************************************
2456 ** Get the name of a gcOUTPUT object.
2458 ** INPUT:
2460 ** gcOUTPUT Output
2461 ** Pointer to a gcOUTPUT object.
2463 ** OUTPUT:
2465 ** gctSIZE_T * Length
2466 ** Pointer to a variable receiving the length of the output name.
2467 ** 'Length' can be gcvNULL, in which case no length will be returned.
2469 ** gctCONST_STRING * Name
2470 ** Pointer to a variable receiving the pointer to the output name.
2471 ** 'Name' can be gcvNULL, in which case no name will be returned.
2473 gceSTATUS
2474 gcOUTPUT_GetName(
2475 IN gcOUTPUT Output,
2476 OUT gctSIZE_T * Length,
2477 OUT gctCONST_STRING * Name
2480 /*******************************************************************************
2481 *********************************************************** F U N C T I O N S **
2482 *******************************************************************************/
2484 /*******************************************************************************
2485 ** gcFUNCTION_ReallocateArguments
2487 ** Reallocate an array of gcsFUNCTION_ARGUMENT objects.
2489 ** INPUT:
2491 ** gcFUNCTION Function
2492 ** Pointer to a gcFUNCTION object.
2494 ** gctSIZE_T Count
2495 ** Array count to reallocate. 'Count' must be at least 1.
2497 gceSTATUS
2498 gcFUNCTION_ReallocateArguments(
2499 IN gcFUNCTION Function,
2500 IN gctSIZE_T Count
2503 gceSTATUS
2504 gcFUNCTION_AddArgument(
2505 IN gcFUNCTION Function,
2506 IN gctUINT16 TempIndex,
2507 IN gctUINT8 Enable,
2508 IN gctUINT8 Qualifier
2511 gceSTATUS
2512 gcFUNCTION_GetArgument(
2513 IN gcFUNCTION Function,
2514 IN gctUINT16 Index,
2515 OUT gctUINT16_PTR Temp,
2516 OUT gctUINT8_PTR Enable,
2517 OUT gctUINT8_PTR Swizzle
2520 gceSTATUS
2521 gcFUNCTION_GetLabel(
2522 IN gcFUNCTION Function,
2523 OUT gctUINT_PTR Label
2526 /*******************************************************************************
2527 ************************* K E R N E L P R O P E R T Y F U N C T I O N S **
2528 *******************************************************************************/
2529 /*******************************************************************************/
2530 gceSTATUS
2531 gcKERNEL_FUNCTION_AddKernelFunctionProperties(
2532 IN gcKERNEL_FUNCTION KernelFunction,
2533 IN gctINT propertyType,
2534 IN gctSIZE_T propertySize,
2535 IN gctINT * values
2538 gceSTATUS
2539 gcKERNEL_FUNCTION_GetPropertyCount(
2540 IN gcKERNEL_FUNCTION KernelFunction,
2541 OUT gctSIZE_T * Count
2544 gceSTATUS
2545 gcKERNEL_FUNCTION_GetProperty(
2546 IN gcKERNEL_FUNCTION KernelFunction,
2547 IN gctUINT Index,
2548 OUT gctSIZE_T * propertySize,
2549 OUT gctINT * propertyType,
2550 OUT gctINT * propertyValues
2554 /*******************************************************************************
2555 *******************************I M A G E S A M P L E R F U N C T I O N S **
2556 *******************************************************************************/
2557 /*******************************************************************************
2558 ** gcKERNEL_FUNCTION_ReallocateImageSamplers
2560 ** Reallocate an array of pointers to image sampler pair.
2562 ** INPUT:
2564 ** gcKERNEL_FUNCTION KernelFunction
2565 ** Pointer to a gcKERNEL_FUNCTION object.
2567 ** gctSIZE_T Count
2568 ** Array count to reallocate. 'Count' must be at least 1.
2570 gceSTATUS
2571 gcKERNEL_FUNCTION_ReallocateImageSamplers(
2572 IN gcKERNEL_FUNCTION KernelFunction,
2573 IN gctSIZE_T Count
2576 gceSTATUS
2577 gcKERNEL_FUNCTION_AddImageSampler(
2578 IN gcKERNEL_FUNCTION KernelFunction,
2579 IN gctUINT8 ImageNum,
2580 IN gctBOOL IsConstantSamplerType,
2581 IN gctUINT32 SamplerType
2584 gceSTATUS
2585 gcKERNEL_FUNCTION_GetImageSamplerCount(
2586 IN gcKERNEL_FUNCTION KernelFunction,
2587 OUT gctSIZE_T * Count
2590 gceSTATUS
2591 gcKERNEL_FUNCTION_GetImageSampler(
2592 IN gcKERNEL_FUNCTION KernelFunction,
2593 IN gctUINT Index,
2594 OUT gctUINT8 *ImageNum,
2595 OUT gctBOOL *IsConstantSamplerType,
2596 OUT gctUINT32 *SamplerType
2599 /*******************************************************************************
2600 *********************************************K E R N E L F U N C T I O N S **
2601 *******************************************************************************/
2603 /*******************************************************************************
2604 ** gcKERNEL_FUNCTION_ReallocateArguments
2606 ** Reallocate an array of gcsFUNCTION_ARGUMENT objects.
2608 ** INPUT:
2610 ** gcKERNEL_FUNCTION Function
2611 ** Pointer to a gcKERNEL_FUNCTION object.
2613 ** gctSIZE_T Count
2614 ** Array count to reallocate. 'Count' must be at least 1.
2616 gceSTATUS
2617 gcKERNEL_FUNCTION_ReallocateArguments(
2618 IN gcKERNEL_FUNCTION Function,
2619 IN gctSIZE_T Count
2622 gceSTATUS
2623 gcKERNEL_FUNCTION_AddArgument(
2624 IN gcKERNEL_FUNCTION Function,
2625 IN gctUINT16 TempIndex,
2626 IN gctUINT8 Enable,
2627 IN gctUINT8 Qualifier
2630 gceSTATUS
2631 gcKERNEL_FUNCTION_GetArgument(
2632 IN gcKERNEL_FUNCTION Function,
2633 IN gctUINT16 Index,
2634 OUT gctUINT16_PTR Temp,
2635 OUT gctUINT8_PTR Enable,
2636 OUT gctUINT8_PTR Swizzle
2639 gceSTATUS
2640 gcKERNEL_FUNCTION_GetLabel(
2641 IN gcKERNEL_FUNCTION Function,
2642 OUT gctUINT_PTR Label
2645 gceSTATUS
2646 gcKERNEL_FUNCTION_GetName(
2647 IN gcKERNEL_FUNCTION KernelFunction,
2648 OUT gctSIZE_T * Length,
2649 OUT gctCONST_STRING * Name
2652 gceSTATUS
2653 gcKERNEL_FUNCTION_ReallocateUniformArguments(
2654 IN gcKERNEL_FUNCTION KernelFunction,
2655 IN gctSIZE_T Count
2658 gceSTATUS
2659 gcKERNEL_FUNCTION_AddUniformArgument(
2660 IN gcKERNEL_FUNCTION KernelFunction,
2661 IN gctCONST_STRING Name,
2662 IN gcSHADER_TYPE Type,
2663 IN gctSIZE_T Length,
2664 OUT gcUNIFORM * UniformArgument
2667 gceSTATUS
2668 gcKERNEL_FUNCTION_GetUniformArgumentCount(
2669 IN gcKERNEL_FUNCTION KernelFunction,
2670 OUT gctSIZE_T * Count
2673 gceSTATUS
2674 gcKERNEL_FUNCTION_GetUniformArgument(
2675 IN gcKERNEL_FUNCTION KernelFunction,
2676 IN gctUINT Index,
2677 OUT gcUNIFORM * UniformArgument
2680 gceSTATUS
2681 gcKERNEL_FUNCTION_SetCodeEnd(
2682 IN gcKERNEL_FUNCTION KernelFunction
2685 /*******************************************************************************
2686 ** gcCompileShader
2687 ********************************************************************************
2689 ** Compile a shader.
2691 ** INPUT:
2693 ** gcoOS Hal
2694 ** Pointer to an gcoHAL object.
2696 ** gctINT ShaderType
2697 ** Shader type to compile. Can be one of the following values:
2699 ** gcSHADER_TYPE_VERTEX
2700 ** Compile a vertex shader.
2702 ** gcSHADER_TYPE_FRAGMENT
2703 ** Compile a fragment shader.
2705 ** gctSIZE_T SourceSize
2706 ** Size of the source buffer in bytes.
2708 ** gctCONST_STRING Source
2709 ** Pointer to the buffer containing the shader source code.
2711 ** OUTPUT:
2713 ** gcSHADER * Binary
2714 ** Pointer to a variable receiving the pointer to a gcSHADER object
2715 ** containg the compiled shader code.
2717 ** gctSTRING * Log
2718 ** Pointer to a variable receiving a string pointer containging the
2719 ** compile log.
2721 gceSTATUS
2722 gcCompileShader(
2723 IN gcoHAL Hal,
2724 IN gctINT ShaderType,
2725 IN gctSIZE_T SourceSize,
2726 IN gctCONST_STRING Source,
2727 OUT gcSHADER * Binary,
2728 OUT gctSTRING * Log
2731 /*******************************************************************************
2732 ** gcOptimizeShader
2733 ********************************************************************************
2735 ** Optimize a shader.
2737 ** INPUT:
2739 ** gcSHADER Shader
2740 ** Pointer to a gcSHADER object holding information about the compiled
2741 ** shader.
2743 ** gctFILE LogFile
2744 ** Pointer to an open FILE object.
2746 gceSTATUS
2747 gcOptimizeShader(
2748 IN gcSHADER Shader,
2749 IN gctFILE LogFile
2752 /*******************************************************************************
2753 ** gcLinkShaders
2754 ********************************************************************************
2756 ** Link two shaders and generate a harwdare specific state buffer by compiling
2757 ** the compiler generated code through the resource allocator and code
2758 ** generator.
2760 ** INPUT:
2762 ** gcSHADER VertexShader
2763 ** Pointer to a gcSHADER object holding information about the compiled
2764 ** vertex shader.
2766 ** gcSHADER FragmentShader
2767 ** Pointer to a gcSHADER object holding information about the compiled
2768 ** fragment shader.
2770 ** gceSHADER_FLAGS Flags
2771 ** Compiler flags. Can be any of the following:
2773 ** gcvSHADER_DEAD_CODE - Dead code elimination.
2774 ** gcvSHADER_RESOURCE_USAGE - Resource usage optimizaion.
2775 ** gcvSHADER_OPTIMIZER - Full optimization.
2776 ** gcvSHADER_USE_GL_Z - Use OpenGL ES Z coordinate.
2777 ** gcvSHADER_USE_GL_POSITION - Use OpenGL ES gl_Position.
2778 ** gcvSHADER_USE_GL_FACE - Use OpenGL ES gl_FaceForward.
2780 ** OUTPUT:
2782 ** gctSIZE_T * StateBufferSize
2783 ** Pointer to a variable receicing the number of bytes in the buffer
2784 ** returned in 'StateBuffer'.
2786 ** gctPOINTER * StateBuffer
2787 ** Pointer to a variable receiving a buffer pointer that contains the
2788 ** states required to download the shaders into the hardware.
2790 ** gcsHINT_PTR * Hints
2791 ** Pointer to a variable receiving a gcsHINT structure pointer that
2792 ** contains information required when loading the shader states.
2794 gceSTATUS
2795 gcLinkShaders(
2796 IN gcSHADER VertexShader,
2797 IN gcSHADER FragmentShader,
2798 IN gceSHADER_FLAGS Flags,
2799 OUT gctSIZE_T * StateBufferSize,
2800 OUT gctPOINTER * StateBuffer,
2801 OUT gcsHINT_PTR * Hints
2804 /*******************************************************************************
2805 ** gcLoadShaders
2806 ********************************************************************************
2808 ** Load a pre-compiled and pre-linked shader program into the hardware.
2810 ** INPUT:
2812 ** gcoHAL Hal
2813 ** Pointer to a gcoHAL object.
2815 ** gctSIZE_T StateBufferSize
2816 ** The number of bytes in the 'StateBuffer'.
2818 ** gctPOINTER StateBuffer
2819 ** Pointer to the states that make up the shader program.
2821 ** gcsHINT_PTR Hints
2822 ** Pointer to a gcsHINT structure that contains information required
2823 ** when loading the shader states.
2825 gceSTATUS
2826 gcLoadShaders(
2827 IN gcoHAL Hal,
2828 IN gctSIZE_T StateBufferSize,
2829 IN gctPOINTER StateBuffer,
2830 IN gcsHINT_PTR Hints
2833 /*******************************************************************************
2834 ** gcSaveProgram
2835 ********************************************************************************
2837 ** Save pre-compiled shaders and pre-linked programs to a binary file.
2839 ** INPUT:
2841 ** gcSHADER VertexShader
2842 ** Pointer to vertex shader object.
2844 ** gcSHADER FragmentShader
2845 ** Pointer to fragment shader object.
2847 ** gctSIZE_T ProgramBufferSize
2848 ** Number of bytes in 'ProgramBuffer'.
2850 ** gctPOINTER ProgramBuffer
2851 ** Pointer to buffer containing the program states.
2853 ** gcsHINT_PTR Hints
2854 ** Pointer to HINTS structure for program states.
2856 ** OUTPUT:
2858 ** gctPOINTER * Binary
2859 ** Pointer to a variable receiving the binary data to be saved.
2861 ** gctSIZE_T * BinarySize
2862 ** Pointer to a variable receiving the number of bytes inside 'Binary'.
2864 gceSTATUS
2865 gcSaveProgram(
2866 IN gcSHADER VertexShader,
2867 IN gcSHADER FragmentShader,
2868 IN gctSIZE_T ProgramBufferSize,
2869 IN gctPOINTER ProgramBuffer,
2870 IN gcsHINT_PTR Hints,
2871 OUT gctPOINTER * Binary,
2872 OUT gctSIZE_T * BinarySize
2875 /*******************************************************************************
2876 ** gcLoadProgram
2877 ********************************************************************************
2879 ** Load pre-compiled shaders and pre-linked programs from a binary file.
2881 ** INPUT:
2883 ** gctPOINTER Binary
2884 ** Pointer to the binary data loaded.
2886 ** gctSIZE_T BinarySize
2887 ** Number of bytes in 'Binary'.
2889 ** OUTPUT:
2891 ** gcSHADER VertexShader
2892 ** Pointer to a vertex shader object.
2894 ** gcSHADER FragmentShader
2895 ** Pointer to a fragment shader object.
2897 ** gctSIZE_T * ProgramBufferSize
2898 ** Pointer to a variable receicing the number of bytes in the buffer
2899 ** returned in 'ProgramBuffer'.
2901 ** gctPOINTER * ProgramBuffer
2902 ** Pointer to a variable receiving a buffer pointer that contains the
2903 ** states required to download the shaders into the hardware.
2905 ** gcsHINT_PTR * Hints
2906 ** Pointer to a variable receiving a gcsHINT structure pointer that
2907 ** contains information required when loading the shader states.
2909 gceSTATUS
2910 gcLoadProgram(
2911 IN gctPOINTER Binary,
2912 IN gctSIZE_T BinarySize,
2913 OUT gcSHADER VertexShader,
2914 OUT gcSHADER FragmentShader,
2915 OUT gctSIZE_T * ProgramBufferSize,
2916 OUT gctPOINTER * ProgramBuffer,
2917 OUT gcsHINT_PTR * Hints
2920 /*******************************************************************************
2921 ** gcCompileKernel
2922 ********************************************************************************
2924 ** Compile a OpenCL kernel shader.
2926 ** INPUT:
2928 ** gcoOS Hal
2929 ** Pointer to an gcoHAL object.
2931 ** gctSIZE_T SourceSize
2932 ** Size of the source buffer in bytes.
2934 ** gctCONST_STRING Source
2935 ** Pointer to the buffer containing the shader source code.
2937 ** OUTPUT:
2939 ** gcSHADER * Binary
2940 ** Pointer to a variable receiving the pointer to a gcSHADER object
2941 ** containg the compiled shader code.
2943 ** gctSTRING * Log
2944 ** Pointer to a variable receiving a string pointer containging the
2945 ** compile log.
2947 gceSTATUS
2948 gcCompileKernel(
2949 IN gcoHAL Hal,
2950 IN gctSIZE_T SourceSize,
2951 IN gctCONST_STRING Source,
2952 IN gctCONST_STRING Options,
2953 OUT gcSHADER * Binary,
2954 OUT gctSTRING * Log
2957 /*******************************************************************************
2958 ** gcLinkKernel
2959 ********************************************************************************
2961 ** Link OpenCL kernel and generate a harwdare specific state buffer by compiling
2962 ** the compiler generated code through the resource allocator and code
2963 ** generator.
2965 ** INPUT:
2967 ** gcSHADER Kernel
2968 ** Pointer to a gcSHADER object holding information about the compiled
2969 ** OpenCL kernel.
2971 ** gceSHADER_FLAGS Flags
2972 ** Compiler flags. Can be any of the following:
2974 ** gcvSHADER_DEAD_CODE - Dead code elimination.
2975 ** gcvSHADER_RESOURCE_USAGE - Resource usage optimizaion.
2976 ** gcvSHADER_OPTIMIZER - Full optimization.
2977 ** gcvSHADER_USE_GL_Z - Use OpenGL ES Z coordinate.
2978 ** gcvSHADER_USE_GL_POSITION - Use OpenGL ES gl_Position.
2979 ** gcvSHADER_USE_GL_FACE - Use OpenGL ES gl_FaceForward.
2981 ** OUTPUT:
2983 ** gctSIZE_T * StateBufferSize
2984 ** Pointer to a variable receiving the number of bytes in the buffer
2985 ** returned in 'StateBuffer'.
2987 ** gctPOINTER * StateBuffer
2988 ** Pointer to a variable receiving a buffer pointer that contains the
2989 ** states required to download the shaders into the hardware.
2991 ** gcsHINT_PTR * Hints
2992 ** Pointer to a variable receiving a gcsHINT structure pointer that
2993 ** contains information required when loading the shader states.
2995 gceSTATUS
2996 gcLinkKernel(
2997 IN gcSHADER Kernel,
2998 IN gceSHADER_FLAGS Flags,
2999 OUT gctSIZE_T * StateBufferSize,
3000 OUT gctPOINTER * StateBuffer,
3001 OUT gcsHINT_PTR * Hints
3004 /*******************************************************************************
3005 ** gcLoadKernel
3006 ********************************************************************************
3008 ** Load a pre-compiled and pre-linked kernel program into the hardware.
3010 ** INPUT:
3012 ** gctSIZE_T StateBufferSize
3013 ** The number of bytes in the 'StateBuffer'.
3015 ** gctPOINTER StateBuffer
3016 ** Pointer to the states that make up the shader program.
3018 ** gcsHINT_PTR Hints
3019 ** Pointer to a gcsHINT structure that contains information required
3020 ** when loading the shader states.
3022 gceSTATUS
3023 gcLoadKernel(
3024 IN gctSIZE_T StateBufferSize,
3025 IN gctPOINTER StateBuffer,
3026 IN gcsHINT_PTR Hints
3029 gceSTATUS
3030 gcInvokeThreadWalker(
3031 IN gcsTHREAD_WALKER_INFO_PTR Info
3034 #ifdef __cplusplus
3036 #endif
3038 #endif /* VIVANTE_NO_3D */
3039 #endif /* __gc_hal_compiler_h_ */