]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h
ENGR00240988: gpu: copy gpu-viv driver from 3.5.7 kernel
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_compiler.h
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2013 by Vivante Corp.
4 *
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.
9 *
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.
14 *
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.
18 *
19 *****************************************************************************/
20
21
22 /*
23 **      Include file the defines the front- and back-end compilers, as well as the
24 **      objects they use.
25 */
26
27 #ifndef __gc_hal_compiler_h_
28 #define __gc_hal_compiler_h_
29
30 #ifndef VIVANTE_NO_3D
31 #include "gc_hal_types.h"
32 #include "gc_hal_engine.h"
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #ifndef GC_ENABLE_LOADTIME_OPT
39 #define GC_ENABLE_LOADTIME_OPT           1
40 #endif
41
42 #define TEMP_OPT_CONSTANT_TEXLD_COORD    1
43
44 #define TEMP_SHADER_PATCH                1
45
46 #define ADD_PRE_ROTATION_TO_VS           0
47
48 #define TEMP_INLINE_ALL_EXPANSION            1
49 /******************************* IR VERSION ******************/
50 #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1')
51
52 /******************************************************************************\
53 |******************************* SHADER LANGUAGE ******************************|
54 \******************************************************************************/
55
56     /* allocator/deallocator function pointer */
57 typedef gceSTATUS (*gctAllocatorFunc)(
58     IN gctSIZE_T Bytes,
59     OUT gctPOINTER * Memory
60     );
61
62 typedef gceSTATUS (*gctDeallocatorFunc)(
63     IN gctPOINTER Memory
64     );
65
66 typedef gctBOOL (*compareFunc) (
67      IN void *    data,
68      IN void *    key
69      );
70
71 typedef struct _gcsListNode gcsListNode;
72 struct _gcsListNode
73 {
74     gcsListNode *       next;
75     void *              data;
76 };
77
78 typedef struct _gcsAllocator
79 {
80     gctAllocatorFunc    allocate;
81     gctDeallocatorFunc  deallocate;
82 } gcsAllocator;
83
84 /* simple map structure */
85 typedef struct _SimpleMap SimpleMap;
86 struct _SimpleMap
87 {
88     gctUINT32     key;
89     gctUINT32     val;
90     SimpleMap    *next;
91     gcsAllocator *allocator;
92
93 };
94
95 /* SimpleMap Operations */
96 /* return -1 if not found, otherwise return the mapped value */
97 gctUINT32
98 gcSimpleMap_Find(
99      IN SimpleMap *Map,
100      IN gctUINT32    Key
101      );
102
103 gceSTATUS
104 gcSimpleMap_Destory(
105      IN SimpleMap *    Map,
106      IN gcsAllocator * Allocator
107      );
108
109 /* Add a pair <Key, Val> to the Map head, the user should be aware that the
110  * map pointer is always changed when adding a new node :
111  *
112  *   gcSimpleMap_AddNode(&theMap, key, val, allocator);
113  *
114  */
115 gceSTATUS
116 gcSimpleMap_AddNode(
117      IN SimpleMap **   Map,
118      IN gctUINT32      Key,
119      IN gctUINT32      Val,
120      IN gcsAllocator * Allocator
121      );
122
123 /* gcsList data structure and related operations */
124 typedef struct _gcsList
125 {
126     gcsListNode  *head;
127     gcsListNode  *tail;
128     gctINT        count;
129     gcsAllocator *allocator;
130 } gcsList;
131
132 /* List operations */
133 void
134 gcList_Init(
135     IN gcsList *list,
136     IN gcsAllocator *allocator
137     );
138
139 gceSTATUS
140 gcList_CreateNode(
141     IN void *             Data,
142     IN gctAllocatorFunc   Allocator,
143     OUT gcsListNode **    ListNode
144     );
145
146 gceSTATUS
147 gcList_Clean(
148     IN gcsList *          List,
149     IN gctBOOL            FreeData
150     );
151
152 gcsListNode *
153 gcList_FindNode(
154     IN gcsList *      List,
155     IN void *         Key,
156     IN compareFunc    compare
157     );
158
159 gceSTATUS
160 gcList_AddNode(
161     IN gcsList *          List,
162     IN void *             Data
163     );
164
165 gceSTATUS
166 gcList_RemoveNode(
167     IN gcsList *          List,
168     IN gcsListNode *      Node
169     );
170
171 /*  link list structure for code list */
172 typedef gcsList gcsCodeList;
173 typedef gcsCodeList * gctCodeList;
174 typedef gcsListNode gcsCodeListNode;
175
176 /* Possible shader language opcodes. */
177 typedef enum _gcSL_OPCODE
178 {
179         gcSL_NOP,                                                       /* 0x00 */
180         gcSL_MOV,                                                       /* 0x01 */
181         gcSL_SAT,                                                       /* 0x02 */
182         gcSL_DP3,                                                       /* 0x03 */
183         gcSL_DP4,                                                       /* 0x04 */
184         gcSL_ABS,                                                       /* 0x05 */
185         gcSL_JMP,                                                       /* 0x06 */
186         gcSL_ADD,                                                       /* 0x07 */
187         gcSL_MUL,                                                       /* 0x08 */
188         gcSL_RCP,                                                       /* 0x09 */
189         gcSL_SUB,                                                       /* 0x0A */
190         gcSL_KILL,                                                      /* 0x0B */
191         gcSL_TEXLD,                                                     /* 0x0C */
192         gcSL_CALL,                                                      /* 0x0D */
193         gcSL_RET,                                                       /* 0x0E */
194         gcSL_NORM,                                                      /* 0x0F */
195         gcSL_MAX,                                                       /* 0x10 */
196         gcSL_MIN,                                                       /* 0x11 */
197         gcSL_POW,                                                       /* 0x12 */
198         gcSL_RSQ,                                                       /* 0x13 */
199         gcSL_LOG,                                                       /* 0x14 */
200         gcSL_FRAC,                                                      /* 0x15 */
201         gcSL_FLOOR,                                                     /* 0x16 */
202         gcSL_CEIL,                                                      /* 0x17 */
203         gcSL_CROSS,                                                     /* 0x18 */
204         gcSL_TEXLDP,                                            /* 0x19 */
205         gcSL_TEXBIAS,                                           /* 0x1A */
206         gcSL_TEXGRAD,                                           /* 0x1B */
207         gcSL_TEXLOD,                                            /* 0x1C */
208         gcSL_SIN,                                                       /* 0x1D */
209         gcSL_COS,                                                       /* 0x1E */
210         gcSL_TAN,                                                       /* 0x1F */
211         gcSL_EXP,                                                       /* 0x20 */
212         gcSL_SIGN,                                                      /* 0x21 */
213         gcSL_STEP,                                                      /* 0x22 */
214         gcSL_SQRT,                                                      /* 0x23 */
215         gcSL_ACOS,                                                      /* 0x24 */
216         gcSL_ASIN,                                                      /* 0x25 */
217         gcSL_ATAN,                                                      /* 0x26 */
218         gcSL_SET,                                                       /* 0x27 */
219         gcSL_DSX,                                                       /* 0x28 */
220         gcSL_DSY,                                                       /* 0x29 */
221         gcSL_FWIDTH,                                            /* 0x2A */
222         gcSL_DIV,                                               /* 0x2B */
223         gcSL_MOD,                                               /* 0x2C */
224         gcSL_AND_BITWISE,                                       /* 0x2D */
225         gcSL_OR_BITWISE,                                        /* 0x2E */
226         gcSL_XOR_BITWISE,                                       /* 0x2F */
227         gcSL_NOT_BITWISE,                                       /* 0x30 */
228         gcSL_LSHIFT,                                            /* 0x31 */
229         gcSL_RSHIFT,                                            /* 0x32 */
230         gcSL_ROTATE,                                            /* 0x33 */
231         gcSL_BITSEL,                                            /* 0x34 */
232         gcSL_LEADZERO,                                          /* 0x35 */
233         gcSL_LOAD,                                                      /* 0x36 */
234         gcSL_STORE,                                                     /* 0x37 */
235         gcSL_BARRIER,                                           /* 0x38 */
236         gcSL_STORE1,                                            /* 0x39 */
237         gcSL_ATOMADD,                                           /* 0x3A */
238         gcSL_ATOMSUB,                                           /* 0x3B */
239         gcSL_ATOMXCHG,                                          /* 0x3C */
240         gcSL_ATOMCMPXCHG,                                       /* 0x3D */
241         gcSL_ATOMMIN,                                           /* 0x3E */
242         gcSL_ATOMMAX,                                           /* 0x3F */
243         gcSL_ATOMOR,                                            /* 0x40 */
244         gcSL_ATOMAND,                                           /* 0x41 */
245         gcSL_ATOMXOR,                                           /* 0x42 */
246         /*gcSL_UNUSED,                                           0x43 */
247         /*gcSL_UNUSED,                                           0x44 */
248         /*gcSL_UNUSED,                                           0x45 */
249         /*gcSL_UNUSED,                                           0x46 */
250         /*gcSL_UNUSED,                                           0x47 */
251         /*gcSL_UNUSED,                                           0x48 */
252         /*gcSL_UNUSED,                                           0x49 */
253         /*gcSL_UNUSED,                                           0x4A */
254         /*gcSL_UNUSED,                                           0x4B */
255         /*gcSL_UNUSED,                                           0x4C */
256         /*gcSL_UNUSED,                                           0x4D */
257         /*gcSL_UNUSED,                                           0x4E */
258         /*gcSL_UNUSED,                                           0x4F */
259         /*gcSL_UNUSED,                                           0x50 */
260         /*gcSL_UNUSED,                                           0x51 */
261         /*gcSL_UNUSED,                                           0x52 */
262         gcSL_ADDLO = 0x53,                                      /* 0x53 */  /* Float only. */
263         gcSL_MULLO,                                                     /* 0x54 */  /* Float only. */
264         gcSL_CONV,                                                      /* 0x55 */
265         gcSL_GETEXP,                                            /* 0x56 */
266         gcSL_GETMANT,                                           /* 0x57 */
267         gcSL_MULHI,                                                     /* 0x58 */  /* Integer only. */
268         gcSL_CMP,                                                       /* 0x59 */
269         gcSL_I2F,                                                       /* 0x5A */
270         gcSL_F2I,                                                       /* 0x5B */
271         gcSL_ADDSAT,                                            /* 0x5C */  /* Integer only. */
272         gcSL_SUBSAT,                                            /* 0x5D */  /* Integer only. */
273         gcSL_MULSAT,                                            /* 0x5E */  /* Integer only. */
274         gcSL_MAXOPCODE
275 }
276 gcSL_OPCODE;
277
278 typedef enum _gcSL_FORMAT
279 {
280         gcSL_FLOAT = 0,                                         /* 0 */
281         gcSL_INTEGER = 1,                                   /* 1 */
282         gcSL_INT32 = 1,                                     /* 1 */
283         gcSL_BOOLEAN = 2,                                       /* 2 */
284         gcSL_UINT32 = 3,                                        /* 3 */
285         gcSL_INT8,                                                  /* 4 */
286         gcSL_UINT8,                                                 /* 5 */
287         gcSL_INT16,                                                 /* 6 */
288         gcSL_UINT16,                                            /* 7 */
289         gcSL_INT64,                                                 /* 8 */     /* Reserved for future enhancement. */
290         gcSL_UINT64,                                            /* 9 */     /* Reserved for future enhancement. */
291         gcSL_INT128,                                        /* 10 */    /* Reserved for future enhancement. */
292         gcSL_UINT128,                                           /* 11 */    /* Reserved for future enhancement. */
293         gcSL_FLOAT16,                                       /* 12 */
294         gcSL_FLOAT64,                                           /* 13 */    /* Reserved for future enhancement. */
295         gcSL_FLOAT128,                                          /* 14 */    /* Reserved for future enhancement. */
296 }
297 gcSL_FORMAT;
298
299 /* Destination write enable bits. */
300 typedef enum _gcSL_ENABLE
301 {
302     gcSL_ENABLE_NONE                    = 0x0,     /* none is enabled, error/uninitialized state */
303         gcSL_ENABLE_X                                           = 0x1,
304         gcSL_ENABLE_Y                                           = 0x2,
305         gcSL_ENABLE_Z                                           = 0x4,
306         gcSL_ENABLE_W                                           = 0x8,
307         /* Combinations. */
308         gcSL_ENABLE_XY                                          = gcSL_ENABLE_X | gcSL_ENABLE_Y,
309         gcSL_ENABLE_XYZ                                         = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_Z,
310         gcSL_ENABLE_XYZW                                        = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_Z | gcSL_ENABLE_W,
311         gcSL_ENABLE_XYW                                         = gcSL_ENABLE_X | gcSL_ENABLE_Y | gcSL_ENABLE_W,
312         gcSL_ENABLE_XZ                                          = gcSL_ENABLE_X | gcSL_ENABLE_Z,
313         gcSL_ENABLE_XZW                                         = gcSL_ENABLE_X | gcSL_ENABLE_Z | gcSL_ENABLE_W,
314         gcSL_ENABLE_XW                                          = gcSL_ENABLE_X | gcSL_ENABLE_W,
315         gcSL_ENABLE_YZ                                          = gcSL_ENABLE_Y | gcSL_ENABLE_Z,
316         gcSL_ENABLE_YZW                                         = gcSL_ENABLE_Y | gcSL_ENABLE_Z | gcSL_ENABLE_W,
317         gcSL_ENABLE_YW                                          = gcSL_ENABLE_Y | gcSL_ENABLE_W,
318         gcSL_ENABLE_ZW                                          = gcSL_ENABLE_Z | gcSL_ENABLE_W,
319 }
320 gcSL_ENABLE;
321
322 /* Possible indices. */
323 typedef enum _gcSL_INDEXED
324 {
325         gcSL_NOT_INDEXED,                                       /* 0 */
326         gcSL_INDEXED_X,                                         /* 1 */
327         gcSL_INDEXED_Y,                                         /* 2 */
328         gcSL_INDEXED_Z,                                         /* 3 */
329         gcSL_INDEXED_W,                                         /* 4 */
330 }
331 gcSL_INDEXED;
332
333 /* Opcode conditions. */
334 typedef enum _gcSL_CONDITION
335 {
336         gcSL_ALWAYS,                                            /* 0x0 */
337         gcSL_NOT_EQUAL,                                         /* 0x1 */
338         gcSL_LESS_OR_EQUAL,                                     /* 0x2 */
339         gcSL_LESS,                                                      /* 0x3 */
340         gcSL_EQUAL,                                                     /* 0x4 */
341         gcSL_GREATER,                                           /* 0x5 */
342         gcSL_GREATER_OR_EQUAL,                          /* 0x6 */
343         gcSL_AND,                                                       /* 0x7 */
344         gcSL_OR,                                                        /* 0x8 */
345         gcSL_XOR,                                                       /* 0x9 */
346     gcSL_NOT_ZERO,                      /* 0xA */
347 }
348 gcSL_CONDITION;
349
350 /* Possible source operand types. */
351 typedef enum _gcSL_TYPE
352 {
353         gcSL_NONE,                                                      /* 0x0 */
354         gcSL_TEMP,                                                      /* 0x1 */
355         gcSL_ATTRIBUTE,                                         /* 0x2 */
356         gcSL_UNIFORM,                                           /* 0x3 */
357         gcSL_SAMPLER,                                           /* 0x4 */
358         gcSL_CONSTANT,                                          /* 0x5 */
359         gcSL_OUTPUT,                                            /* 0x6 */
360         gcSL_PHYSICAL,                                          /* 0x7 */
361 }
362 gcSL_TYPE;
363
364 /* Swizzle generator macro. */
365 #define gcmSWIZZLE(Component1, Component2, Component3, Component4) \
366 ( \
367         (gcSL_SWIZZLE_ ## Component1 << 0) | \
368         (gcSL_SWIZZLE_ ## Component2 << 2) | \
369         (gcSL_SWIZZLE_ ## Component3 << 4) | \
370         (gcSL_SWIZZLE_ ## Component4 << 6)   \
371 )
372
373 #define gcmExtractSwizzle(Swizzle, Index) \
374     ((gcSL_SWIZZLE) ((((Swizzle) >> (Index * 2)) & 0x3)))
375
376 #define gcmComposeSwizzle(SwizzleX, SwizzleY, SwizzleZ, SwizzleW) \
377 ( \
378         ((SwizzleX) << 0) | \
379         ((SwizzleY) << 2) | \
380         ((SwizzleZ) << 4) | \
381         ((SwizzleW) << 6)   \
382 )
383
384 /* Possible swizzle values. */
385 typedef enum _gcSL_SWIZZLE
386 {
387         gcSL_SWIZZLE_X,                                         /* 0x0 */
388         gcSL_SWIZZLE_Y,                                         /* 0x1 */
389         gcSL_SWIZZLE_Z,                                         /* 0x2 */
390         gcSL_SWIZZLE_W,                                         /* 0x3 */
391         /* Combinations. */
392         gcSL_SWIZZLE_XXXX = gcmSWIZZLE(X, X, X, X),
393         gcSL_SWIZZLE_YYYY = gcmSWIZZLE(Y, Y, Y, Y),
394         gcSL_SWIZZLE_ZZZZ = gcmSWIZZLE(Z, Z, Z, Z),
395         gcSL_SWIZZLE_WWWW = gcmSWIZZLE(W, W, W, W),
396         gcSL_SWIZZLE_XYYY = gcmSWIZZLE(X, Y, Y, Y),
397         gcSL_SWIZZLE_XZZZ = gcmSWIZZLE(X, Z, Z, Z),
398         gcSL_SWIZZLE_XWWW = gcmSWIZZLE(X, W, W, W),
399         gcSL_SWIZZLE_YZZZ = gcmSWIZZLE(Y, Z, Z, Z),
400         gcSL_SWIZZLE_YWWW = gcmSWIZZLE(Y, W, W, W),
401         gcSL_SWIZZLE_ZWWW = gcmSWIZZLE(Z, W, W, W),
402         gcSL_SWIZZLE_XYZZ = gcmSWIZZLE(X, Y, Z, Z),
403         gcSL_SWIZZLE_XYWW = gcmSWIZZLE(X, Y, W, W),
404         gcSL_SWIZZLE_XZWW = gcmSWIZZLE(X, Z, W, W),
405         gcSL_SWIZZLE_YZWW = gcmSWIZZLE(Y, Z, W, W),
406         gcSL_SWIZZLE_XXYZ = gcmSWIZZLE(X, X, Y, Z),
407         gcSL_SWIZZLE_XYZW = gcmSWIZZLE(X, Y, Z, W),
408         gcSL_SWIZZLE_XYXY = gcmSWIZZLE(X, Y, X, Y),
409         gcSL_SWIZZLE_YYZZ = gcmSWIZZLE(Y, Y, Z, Z),
410         gcSL_SWIZZLE_YYWW = gcmSWIZZLE(Y, Y, W, W),
411         gcSL_SWIZZLE_ZZZW = gcmSWIZZLE(Z, Z, Z, W),
412         gcSL_SWIZZLE_XZZW = gcmSWIZZLE(X, Z, Z, W),
413         gcSL_SWIZZLE_YYZW = gcmSWIZZLE(Y, Y, Z, W),
414
415     gcSL_SWIZZLE_INVALID = 0x7FFFFFFF
416 }
417 gcSL_SWIZZLE;
418
419 typedef enum _gcSL_COMPONENT
420 {
421         gcSL_COMPONENT_X,               /* 0x0 */
422         gcSL_COMPONENT_Y,               /* 0x1 */
423         gcSL_COMPONENT_Z,               /* 0x2 */
424         gcSL_COMPONENT_W,               /* 0x3 */
425     gcSL_COMPONENT_COUNT            /* 0x4 */
426 } gcSL_COMPONENT;
427
428 #define gcmIsComponentEnabled(Enable, Component) (((Enable) & (1 << (Component))) != 0)
429
430 /******************************************************************************\
431 |*********************************** SHADERS **********************************|
432 \******************************************************************************/
433
434 /* Shader types. */
435 typedef enum _gcSHADER_KIND {
436     gcSHADER_TYPE_UNKNOWN = 0,
437     gcSHADER_TYPE_VERTEX,
438     gcSHADER_TYPE_FRAGMENT,
439     gcSHADER_TYPE_CL,
440     gcSHADER_TYPE_PRECOMPILED,
441     gcSHADER_KIND_COUNT
442 } gcSHADER_KIND;
443
444 typedef enum _gcGL_DRIVER_VERSION {
445     gcGL_DRIVER_ES11,    /* OpenGL ES 1.1 */
446     gcGL_DRIVER_ES20,    /* OpenGL ES 2.0 */
447     gcGL_DRIVER_ES30     /* OpenGL ES 3.0 */
448 } gcGL_DRIVER_VERSION;
449
450 /* gcSHADER objects. */
451 typedef struct _gcSHADER *              gcSHADER;
452 typedef struct _gcATTRIBUTE *                   gcATTRIBUTE;
453 typedef struct _gcUNIFORM *             gcUNIFORM;
454 typedef struct _gcOUTPUT *              gcOUTPUT;
455 typedef struct _gcsFUNCTION *                   gcFUNCTION;
456 typedef struct _gcsKERNEL_FUNCTION *    gcKERNEL_FUNCTION;
457 typedef struct _gcsHINT *               gcsHINT_PTR;
458 typedef struct _gcSHADER_PROFILER *     gcSHADER_PROFILER;
459 typedef struct _gcVARIABLE *                    gcVARIABLE;
460
461 struct _gcsHINT
462 {
463     /* Numbr of data transfers for Vertex Shader output. */
464     gctUINT32   vsOutputCount;
465
466     /* Flag whether the VS has point size or not. */
467     gctBOOL     vsHasPointSize;
468
469 #if gcdUSE_WCLIP_PATCH
470     /* Flag whether the VS gl_position.z depends on gl_position.w
471        it's a hint for wclipping */
472     gctBOOL     vsPositionZDependsOnW;
473 #endif
474
475     gctBOOL     clipW;
476
477     /* Element count. */
478     gctUINT32   elementCount;
479
480     /* Component count. */
481     gctUINT32   componentCount;
482
483     /* Number of data transfers for Fragment Shader input. */
484     gctUINT32   fsInputCount;
485
486     /* Maximum number of temporary registers used in FS. */
487     gctUINT32   fsMaxTemp;
488
489         /* Maximum number of temporary registers used in VS. */
490         gctUINT32   vsMaxTemp;
491
492     /* Balance minimum. */
493     gctUINT32   balanceMin;
494
495     /* Balance maximum. */
496     gctUINT32   balanceMax;
497
498     /* Flag whether the PS outputs the depth value or not. */
499     gctBOOL     psHasFragDepthOut;
500
501         /* Flag whether the ThreadWalker is in PS. */
502         gctBOOL         threadWalkerInPS;
503
504 #if gcdALPHA_KILL_IN_SHADER
505     /* States to set when alpha kill is enabled. */
506     gctUINT32   killStateAddress;
507     gctUINT32   alphaKillStateValue;
508     gctUINT32   colorKillStateValue;
509
510     /* Shader instructiuon. */
511     gctUINT32   killInstructionAddress;
512     gctUINT32   alphaKillInstruction[3];
513     gctUINT32   colorKillInstruction[3];
514 #endif
515
516 #if TEMP_SHADER_PATCH
517         gctUINT32       pachedShaderIdentifier;
518 #endif
519 };
520
521 #if TEMP_SHADER_PATCH
522 #define INVALID_SHADER_IDENTIFIER 0xFFFFFFFF
523 #endif
524
525 /* gcSHADER_TYPE enumeration. */
526 typedef enum _gcSHADER_TYPE
527 {
528     gcSHADER_FLOAT_X1   = 0,        /* 0x00 */
529     gcSHADER_FLOAT_X2,                          /* 0x01 */
530         gcSHADER_FLOAT_X3,                              /* 0x02 */
531         gcSHADER_FLOAT_X4,                              /* 0x03 */
532         gcSHADER_FLOAT_2X2,                             /* 0x04 */
533         gcSHADER_FLOAT_3X3,                             /* 0x05 */
534         gcSHADER_FLOAT_4X4,                             /* 0x06 */
535         gcSHADER_BOOLEAN_X1,                    /* 0x07 */
536         gcSHADER_BOOLEAN_X2,                    /* 0x08 */
537         gcSHADER_BOOLEAN_X3,                    /* 0x09 */
538         gcSHADER_BOOLEAN_X4,                    /* 0x0A */
539         gcSHADER_INTEGER_X1,                    /* 0x0B */
540         gcSHADER_INTEGER_X2,                    /* 0x0C */
541         gcSHADER_INTEGER_X3,                    /* 0x0D */
542         gcSHADER_INTEGER_X4,                    /* 0x0E */
543         gcSHADER_SAMPLER_1D,                    /* 0x0F */
544         gcSHADER_SAMPLER_2D,                    /* 0x10 */
545         gcSHADER_SAMPLER_3D,                    /* 0x11 */
546         gcSHADER_SAMPLER_CUBIC,                 /* 0x12 */
547         gcSHADER_FIXED_X1,                              /* 0x13 */
548         gcSHADER_FIXED_X2,                              /* 0x14 */
549         gcSHADER_FIXED_X3,                              /* 0x15 */
550         gcSHADER_FIXED_X4,                              /* 0x16 */
551         gcSHADER_IMAGE_2D,                              /* 0x17 */  /* For OCL. */
552         gcSHADER_IMAGE_3D,                              /* 0x18 */  /* For OCL. */
553         gcSHADER_SAMPLER,                               /* 0x19 */  /* For OCL. */
554         gcSHADER_FLOAT_2X3,                             /* 0x1A */
555         gcSHADER_FLOAT_2X4,                             /* 0x1B */
556         gcSHADER_FLOAT_3X2,                             /* 0x1C */
557         gcSHADER_FLOAT_3X4,                             /* 0x1D */
558         gcSHADER_FLOAT_4X2,                             /* 0x1E */
559         gcSHADER_FLOAT_4X3,                             /* 0x1F */
560         gcSHADER_ISAMPLER_2D,                   /* 0x20 */
561         gcSHADER_ISAMPLER_3D,                   /* 0x21 */
562         gcSHADER_ISAMPLER_CUBIC,                /* 0x22 */
563         gcSHADER_USAMPLER_2D,                   /* 0x23 */
564         gcSHADER_USAMPLER_3D,                   /* 0x24 */
565         gcSHADER_USAMPLER_CUBIC,                /* 0x25 */
566         gcSHADER_SAMPLER_EXTERNAL_OES,          /* 0x26 */
567
568         gcSHADER_UINT_X1,                       /* 0x27 */
569         gcSHADER_UINT_X2,                       /* 0x28 */
570         gcSHADER_UINT_X3,                       /* 0x29 */
571         gcSHADER_UINT_X4,                       /* 0x2A */
572
573     gcSHADER_UNKONWN_TYPE,      /* do not add type after this */
574     gcSHADER_TYPE_COUNT         /* must to change gcvShaderTypeInfo at the
575                                  * same time if you add any new type! */}
576 gcSHADER_TYPE;
577
578 typedef enum _gcSHADER_TYPE_KIND
579 {
580     gceTK_UNKOWN,
581     gceTK_FLOAT,
582     gceTK_INT,
583     gceTK_UINT,
584     gceTK_BOOL,
585     gceTK_FIXED,
586     gceTK_SAMPLER,
587     gceTK_IMAGE,
588     gceTK_OTHER
589 } gcSHADER_TYPE_KIND;
590
591 typedef struct _gcSHADER_TYPEINFO
592 {
593     gcSHADER_TYPE      type;              /* e.g. gcSHADER_FLOAT_2X4 */
594     gctINT             components;        /* e.g. 4 components       */
595     gctINT             rows;              /* e.g. 2 rows             */
596     gcSHADER_TYPE      componentType;     /* e.g. gcSHADER_FLOAT_X4  */
597     gcSHADER_TYPE_KIND kind;              /* e.g. gceTK_FLOAT */
598     gctCONST_STRING    name;              /* e.g. "FLOAT_2X4" */
599 } gcSHADER_TYPEINFO;
600
601 extern gcSHADER_TYPEINFO gcvShaderTypeInfo[];
602
603 #define gcmType_Comonents(Type)    (gcvShaderTypeInfo[Type].components)
604 #define gcmType_Rows(Type)         (gcvShaderTypeInfo[Type].rows)
605 #define gcmType_ComonentType(Type) (gcvShaderTypeInfo[Type].componentType)
606 #define gcmType_Kind(Type)         (gcvShaderTypeInfo[Type].kind)
607 #define gcmType_Name(Type)         (gcvShaderTypeInfo[Type].name)
608
609 #define gcmType_isMatrix(type) (gcmType_Rows(type) > 1)
610
611 typedef enum _gcSHADER_VAR_CATEGORY
612 {
613     gcSHADER_VAR_CATEGORY_NORMAL  =  0, /* primitive type and its array */
614     gcSHADER_VAR_CATEGORY_STRUCT  =  1  /* structure */
615 }
616 gcSHADER_VAR_CATEGORY;
617
618 typedef enum _gceTYPE_QUALIFIER
619 {
620     gcvTYPE_QUALIFIER_NONE         = 0x0, /* unqualified */
621     gcvTYPE_QUALIFIER_VOLATILE     = 0x1, /* volatile */
622 }gceTYPE_QUALIFIER;
623
624 typedef gctUINT16  gctTYPE_QUALIFIER;
625
626 #if GC_ENABLE_LOADTIME_OPT
627 typedef struct _gcSHADER_TYPE_INFO
628 {
629     gcSHADER_TYPE    type;        /* eg. gcSHADER_FLOAT_2X3 is the type */
630     gctCONST_STRING  name;        /* the name of the type: "gcSHADER_FLOAT_2X3" */
631     gcSHADER_TYPE    baseType;    /* its base type is gcSHADER_FLOAT_2 */
632     gctINT           components;  /* it has 2 components */
633     gctINT           rows;        /* and 3 rows */
634     gctINT           size;        /* the size in byte */
635 } gcSHADER_TYPE_INFO;
636
637 extern gcSHADER_TYPE_INFO shader_type_info[];
638
639 enum gceLTCDumpOption {
640     gceLTC_DUMP_UNIFORM      = 0x0001,
641     gceLTC_DUMP_EVALUATION   = 0x0002,
642     gceLTC_DUMP_EXPESSION    = 0x0004,
643     gceLTC_DUMP_COLLECTING   = 0x0008,
644 };
645
646 gctBOOL gcDumpOption(gctINT Opt);
647
648 #endif /* GC_ENABLE_LOADTIME_OPT */
649
650 #define IS_MATRIX_TYPE(type) \
651     (((type >= gcSHADER_FLOAT_2X2) && (type <= gcSHADER_FLOAT_4X4)) || \
652      ((type >= gcSHADER_FLOAT_2X3) && (type <= gcSHADER_FLOAT_4X3)))
653
654 /* gcSHADER_PRECISION enumeration. */
655 typedef enum _gcSHADER_PRECISION
656 {
657         gcSHADER_PRECISION_DEFAULT,                             /* 0x00 */
658         gcSHADER_PRECISION_HIGH,                                /* 0x01 */
659         gcSHADER_PRECISION_MEDIUM,                              /* 0x02 */
660         gcSHADER_PRECISION_LOW,                             /* 0x03 */
661 }
662 gcSHADER_PRECISION;
663
664 /* Shader flags. */
665 typedef enum _gceSHADER_FLAGS
666 {
667     gcvSHADER_NO_OPTIMIZATION           = 0x00,
668         gcvSHADER_DEAD_CODE                                     = 0x01,
669         gcvSHADER_RESOURCE_USAGE                        = 0x02,
670         gcvSHADER_OPTIMIZER                                     = 0x04,
671         gcvSHADER_USE_GL_Z                                      = 0x08,
672     /*
673         The GC family of GPU cores model GC860 and under require the Z
674         to be from 0 <= z <= w.
675         However, OpenGL specifies the Z to be from -w <= z <= w.  So we
676         have to a conversion here:
677
678             z = (z + w) / 2.
679
680         So here we append two instructions to the vertex shader.
681     */
682         gcvSHADER_USE_GL_POSITION                       = 0x10,
683         gcvSHADER_USE_GL_FACE                           = 0x20,
684         gcvSHADER_USE_GL_POINT_COORD            = 0x40,
685         gcvSHADER_LOADTIME_OPTIMIZER            = 0x80,
686 #if gcdALPHA_KILL_IN_SHADER
687     gcvSHADER_USE_ALPHA_KILL            = 0x100,
688 #endif
689
690 #if ADD_PRE_ROTATION_TO_VS
691     gcvSHADER_VS_PRE_ROTATION           = 0x200,
692 #endif
693
694 #if TEMP_INLINE_ALL_EXPANSION
695     gcvSHADER_INLINE_ALL_EXPANSION      = 0x200,
696 #endif
697 }
698 gceSHADER_FLAGS;
699
700 gceSTATUS
701 gcSHADER_CheckClipW(
702     IN gctCONST_STRING VertexSource,
703     IN gctCONST_STRING FragmentSource,
704     OUT gctBOOL * clipW);
705
706 /*******************************************************************************
707 **                                                      gcOptimizer Data Structures
708 *******************************************************************************/
709 typedef enum _gceSHADER_OPTIMIZATION
710 {
711     /*  No optimization. */
712         gcvOPTIMIZATION_NONE,
713
714     /*  Flow graph construction. */
715         gcvOPTIMIZATION_CONSTRUCTION                = 1 << 0,
716
717     /*  Dead code elimination. */
718         gcvOPTIMIZATION_DEAD_CODE                   = 1 << 1,
719
720     /*  Redundant move instruction elimination. */
721         gcvOPTIMIZATION_REDUNDANT_MOVE              = 1 << 2,
722
723     /*  Inline expansion. */
724         gcvOPTIMIZATION_INLINE_EXPANSION            = 1 << 3,
725
726     /*  Constant propagation. */
727         gcvOPTIMIZATION_CONSTANT_PROPAGATION        = 1 << 4,
728
729     /*  Redundant bounds/checking elimination. */
730         gcvOPTIMIZATION_REDUNDANT_CHECKING          = 1 << 5,
731
732     /*  Loop invariant movement. */
733         gcvOPTIMIZATION_LOOP_INVARIANT              = 1 << 6,
734
735     /*  Induction variable removal. */
736         gcvOPTIMIZATION_INDUCTION_VARIABLE          = 1 << 7,
737
738     /*  Common subexpression elimination. */
739         gcvOPTIMIZATION_COMMON_SUBEXPRESSION        = 1 << 8,
740
741     /*  Control flow/banch optimization. */
742         gcvOPTIMIZATION_CONTROL_FLOW                = 1 << 9,
743
744     /*  Vector component operation merge. */
745         gcvOPTIMIZATION_VECTOR_INSTRUCTION_MERGE    = 1 << 10,
746
747     /*  Algebra simplificaton. */
748         gcvOPTIMIZATION_ALGEBRAIC_SIMPLIFICATION    = 1 << 11,
749
750     /*  Pattern matching and replacing. */
751         gcvOPTIMIZATION_PATTERN_MATCHING            = 1 << 12,
752
753     /*  Interprocedural constant propagation. */
754         gcvOPTIMIZATION_IP_CONSTANT_PROPAGATION     = 1 << 13,
755
756     /*  Interprecedural register optimization. */
757         gcvOPTIMIZATION_IP_REGISTRATION             = 1 << 14,
758
759     /*  Optimization option number. */
760         gcvOPTIMIZATION_OPTION_NUMBER               = 1 << 15,
761
762         /*  Loadtime constant. */
763     gcvOPTIMIZATION_LOADTIME_CONSTANT           = 1 << 16,
764
765     /*  MAD instruction optimization. */
766         gcvOPTIMIZATION_MAD_INSTRUCTION             = 1 << 17,
767
768     /*  Special optimization for LOAD SW workaround. */
769         gcvOPTIMIZATION_LOAD_SW_WORKAROUND          = 1 << 18,
770
771     /* move code into conditional block if possile */
772         gcvOPTIMIZATION_CONDITIONALIZE              = 1 << 19,
773
774     /* expriemental: power optimization mode
775         1. add extra dummy texld to tune performance
776         2. insert NOP after high power instrucitons
777         3. split high power vec3/vec4 instruciton to vec2/vec1 operation
778         4. ...
779      */
780         gcvOPTIMIZATION_POWER_OPTIMIZATION           = 1 << 20,
781
782     /* optimize varying packing */
783     gcvOPTIMIZATION_VARYINGPACKING              = 1 << 22,
784
785 #if TEMP_INLINE_ALL_EXPANSION
786         gcvOPTIMIZATION_INLINE_ALL_EXPANSION        = 1 << 23,
787 #endif
788
789     /*  Full optimization. */
790     /*  Note that gcvOPTIMIZATION_LOAD_SW_WORKAROUND is off. */
791         gcvOPTIMIZATION_FULL                        = 0x7FFFFFFF &
792                                                   ~gcvOPTIMIZATION_LOAD_SW_WORKAROUND &
793                                                   ~gcvOPTIMIZATION_INLINE_ALL_EXPANSION &
794                                                   ~gcvOPTIMIZATION_POWER_OPTIMIZATION,
795
796         /* Optimization Unit Test flag. */
797     gcvOPTIMIZATION_UNIT_TEST                   = 1 << 31
798 }
799 gceSHADER_OPTIMIZATION;
800
801 typedef enum _gceOPTIMIZATION_VaryingPaking
802 {
803     gcvOPTIMIZATION_VARYINGPACKING_NONE = 0,
804     gcvOPTIMIZATION_VARYINGPACKING_NOSPLIT,
805     gcvOPTIMIZATION_VARYINGPACKING_SPLIT
806 } gceOPTIMIZATION_VaryingPaking;
807
808 typedef struct _gcOPTIMIZER_OPTION
809 {
810     gceSHADER_OPTIMIZATION     optFlags;
811
812     /* debug & dump options:
813
814          VC_OPTION=-DUMP:SRC:OPT|:OPTV|:CG|:CGV:|ALL|ALLV
815
816          SRC:  dump shader source code
817          OPT:  dump incoming and final IR
818          OPTV: dump result IR in each optimization phase
819          CG:   dump generated machine code
820          CGV:  dump BE tree and optimization detail
821
822          ALL = SRC|OPT|CG
823          ALLV = SRC|OPT|OPTV|CG|CGV
824      */
825     gctBOOL     dumpShaderSource;      /* dump shader source code */
826     gctBOOL     dumpOptimizer;         /* dump incoming and final IR */
827     gctBOOL     dumpOptimizerVerbose;  /* dump result IR in each optimization phase */
828     gctBOOL     dumpBEGenertedCode;    /* dump generated machine code */
829     gctBOOL     dumpBEVerbose;         /* dump BE tree and optimization detail */
830
831     /* Code generation */
832
833     /* Varying Packing:
834
835           VC_OPTION=-PACKVARYING:[0-2]|:T[-]m[,n]|:LshaderIdx,min,max
836
837           0: turn off varying packing
838           1: pack varyings, donot split any varying
839           2: pack varyings, may split to make fully packed output
840
841           Tm:    only packing shader pair which vertex shader id is m
842           Tm,n:  only packing shader pair which vertex shader id
843                    is in range of [m, n]
844           T-m:   do not packing shader pair which vertex shader id is m
845           T-m,n: do not packing shader pair which vertex shader id
846                    is in range of [m, n]
847
848           LshaderIdx,min,max : set  load balance (min, max) for shaderIdx
849                                if shaderIdx is -1, all shaders are impacted
850                                newMin = origMin * (min/100.);
851                                newMax = origMax * (max/100.);
852      */
853     gceOPTIMIZATION_VaryingPaking    packVarying;
854     gctINT                           _triageStart;
855     gctINT                           _triageEnd;
856     gctINT                           _loadBalanceShaderIdx;
857     gctINT                           _loadBalanceMin;
858     gctINT                           _loadBalanceMax;
859
860     /* Do not generate immdeiate
861
862           VC_OPTION=-NOIMM
863
864        Force generate immediate even the machine model don't support it,
865        for testing purpose only
866
867           VC_OPTION=-FORCEIMM
868      */
869     gctBOOL     noImmediate;
870     gctBOOL     forceImmediate;
871
872     /* Power reduction mode options */
873     gctBOOL   needPowerOptimization;
874
875     /* Patch TEXLD instruction by adding dummy texld
876        (can be used to tune GPU power usage):
877          for every TEXLD we seen, add n dummy TEXLD
878
879         it can be enabled by environment variable:
880
881           VC_OPTION=-PATCH_TEXLD:M:N
882
883         (for each M texld, add N dummy texld)
884      */
885     gctINT      patchEveryTEXLDs;
886     gctINT      patchDummyTEXLDs;
887
888     /* Insert NOP after high power consumption instructions
889
890          VC_OPTION="-INSERTNOP:MUL:MULLO:DP3:DP4:SEENTEXLD"
891      */
892     gctBOOL     insertNOP;
893     gctBOOL     insertNOPAfterMUL;
894     gctBOOL     insertNOPAfterMULLO;
895     gctBOOL     insertNOPAfterDP3;
896     gctBOOL     insertNOPAfterDP4;
897     gctBOOL     insertNOPOnlyWhenTexldSeen;
898
899     /* split MAD to MUL and ADD:
900
901          VC_OPTION=-SPLITMAD
902      */
903     gctBOOL     splitMAD;
904
905     /* Convert vect3/vec4 operations to multiple vec2/vec1 operations
906
907          VC_OPTION=-SPLITVEC:MUL:MULLO:DP3:DP4
908      */
909     gctBOOL     splitVec;
910     gctBOOL     splitVec4MUL;
911     gctBOOL     splitVec4MULLO;
912     gctBOOL     splitVec4DP3;
913     gctBOOL     splitVec4DP4;
914
915     /* turn/off features:
916
917           VC_OPTION=-F:n,[0|1]
918           Note: n must be decimal number
919      */
920     gctUINT     featureBits;
921
922     /* inline level (default 2 at O1):
923
924           VC_OPTION=-INLINELEVEL:[0-3]
925              0:  no inline
926              1:  only inline the function only called once or small function
927              2:  inline functions be called less than 5 times or medium size function
928              3:  inline everything possible
929      */
930     gctUINT     inlineLevel;
931 } gcOPTIMIZER_OPTION;
932
933 extern gcOPTIMIZER_OPTION theOptimizerOption;
934 #define gcmGetOptimizerOption() gcGetOptimizerOption()
935
936 #define gcmOPT_DUMP_SHADER_SRC()         \
937              (gcmGetOptimizerOption()->dumpShaderSource != 0)
938 #define gcmOPT_DUMP_OPTIMIZER()          \
939              (gcmGetOptimizerOption()->dumpOptimizer != 0 || \
940               gcmOPT_DUMP_OPTIMIZER_VERBOSE() )
941 #define gcmOPT_DUMP_OPTIMIZER_VERBOSE()  \
942              (gcmGetOptimizerOption()->dumpOptimizerVerbose != 0)
943 #define gcmOPT_DUMP_CODEGEN()            \
944              (gcmGetOptimizerOption()->dumpBEGenertedCode != 0 || \
945               gcmOPT_DUMP_CODEGEN_VERBOSE() )
946 #define gcmOPT_DUMP_CODEGEN_VERBOSE()    \
947              (gcmGetOptimizerOption()->dumpBEVerbose != 0)
948
949 #define gcmOPT_SET_DUMP_SHADER_SRC(v)   \
950              gcmGetOptimizerOption()->dumpShaderSource = (v)
951
952 #define gcmOPT_PATCH_TEXLD()  (gcmGetOptimizerOption()->patchDummyTEXLDs != 0)
953 #define gcmOPT_INSERT_NOP()   (gcmGetOptimizerOption()->insertNOP == gcvTRUE)
954 #define gcmOPT_SPLITMAD()     (gcmGetOptimizerOption()->splitMAD == gcvTRUE)
955 #define gcmOPT_SPLITVEC()     (gcmGetOptimizerOption()->splitVec == gcvTRUE)
956
957 #define gcmOPT_NOIMMEDIATE()  (gcmGetOptimizerOption()->noImmediate == gcvTRUE)
958 #define gcmOPT_FORCEIMMEDIATE()  (gcmGetOptimizerOption()->forceImmediate == gcvTRUE)
959
960 #define gcmOPT_PACKVARYING()     (gcmGetOptimizerOption()->packVarying)
961 #define gcmOPT_PACKVARYING_triageStart()   (gcmGetOptimizerOption()->_triageStart)
962 #define gcmOPT_PACKVARYING_triageEnd()     (gcmGetOptimizerOption()->_triageEnd)
963
964 #define gcmOPT_INLINELEVEL()     (gcmGetOptimizerOption()->inlineLevel)
965
966 /* Setters */
967 #define gcmOPT_SetPatchTexld(m,n) (gcmGetOptimizerOption()->patchEveryTEXLDs = (m),\
968                                    gcmGetOptimizerOption()->patchDummyTEXLDs = (n))
969 #define gcmOPT_SetSplitVecMUL() (gcmGetOptimizerOption()->splitVec = gcvTRUE, \
970                                  gcmGetOptimizerOption()->splitVec4MUL = gcvTRUE)
971 #define gcmOPT_SetSplitVecMULLO() (gcmGetOptimizerOption()->splitVec = gcvTRUE, \
972                                   gcmGetOptimizerOption()->splitVec4MULLO = gcvTRUE)
973 #define gcmOPT_SetSplitVecDP3() (gcmGetOptimizerOption()->splitVec = gcvTRUE, \
974                                  gcmGetOptimizerOption()->splitVec4DP3 = gcvTRUE)
975 #define gcmOPT_SetSplitVecDP4() (gcmGetOptimizerOption()->splitVec = gcvTRUE, \
976                                  gcmGetOptimizerOption()->splitVec4DP4 = gcvTRUE)
977
978 #define gcmOPT_SetPackVarying(v)     (gcmGetOptimizerOption()->packVarying = v)
979
980 #define FB_LIVERANGE_FIX1     0x0001
981
982
983 #define PredefinedDummySamplerId       8
984
985 /* Function argument qualifier */
986 typedef enum _gceINPUT_OUTPUT
987 {
988         gcvFUNCTION_INPUT,
989         gcvFUNCTION_OUTPUT,
990         gcvFUNCTION_INOUT
991 }
992 gceINPUT_OUTPUT;
993
994 /* Kernel function property flags. */
995 typedef enum _gcePROPERTY_FLAGS
996 {
997         gcvPROPERTY_REQD_WORK_GRP_SIZE  = 0x01
998 }
999 gceKERNEL_FUNCTION_PROPERTY_FLAGS;
1000
1001 /* Uniform flags. */
1002 typedef enum _gceUNIFORM_FLAGS
1003 {
1004         gcvUNIFORM_KERNEL_ARG                   = 0x01,
1005         gcvUNIFORM_KERNEL_ARG_LOCAL             = 0x02,
1006         gcvUNIFORM_KERNEL_ARG_SAMPLER           = 0x04,
1007         gcvUNIFORM_LOCAL_ADDRESS_SPACE          = 0x08,
1008         gcvUNIFORM_PRIVATE_ADDRESS_SPACE        = 0x10,
1009         gcvUNIFORM_CONSTANT_ADDRESS_SPACE       = 0x20,
1010         gcvUNIFORM_GLOBAL_SIZE                  = 0x40,
1011         gcvUNIFORM_LOCAL_SIZE                   = 0x80,
1012         gcvUNIFORM_NUM_GROUPS                   = 0x100,
1013         gcvUNIFORM_GLOBAL_OFFSET                = 0x200,
1014         gcvUNIFORM_WORK_DIM                     = 0x400,
1015         gcvUNIFORM_KERNEL_ARG_CONSTANT          = 0x800,
1016         gcvUNIFORM_KERNEL_ARG_LOCAL_MEM_SIZE    = 0x1000,
1017         gcvUNIFORM_KERNEL_ARG_PRIVATE           = 0x2000,
1018         gcvUNIFORM_LOADTIME_CONSTANT            = 0x4000,
1019     gcvUNIFORM_IS_ARRAY                 = 0x8000,
1020 }
1021 gceUNIFORM_FLAGS;
1022
1023 #define gcdUNIFORM_KERNEL_ARG_MASK  (gcvUNIFORM_KERNEL_ARG         | \
1024                                      gcvUNIFORM_KERNEL_ARG_LOCAL   | \
1025                                                                          gcvUNIFORM_KERNEL_ARG_SAMPLER | \
1026                                                                          gcvUNIFORM_KERNEL_ARG_PRIVATE | \
1027                                                                          gcvUNIFORM_KERNEL_ARG_CONSTANT)
1028
1029 typedef enum _gceVARIABLE_UPDATE_FLAGS
1030 {
1031     gcvVARIABLE_UPDATE_NOUPDATE = 0,
1032     gcvVARIABLE_UPDATE_TEMPREG,
1033     gcvVARIABLE_UPDATE_TYPE_QUALIFIER,
1034 }gceVARIABLE_UPDATE_FLAGS;
1035
1036 typedef struct _gcMACHINE_INST
1037 {
1038     gctUINT        state0;
1039     gctUINT        state1;
1040     gctUINT        state2;
1041     gctUINT        state3;
1042 }gcMACHINE_INST, *gcMACHINE_INST_PTR;
1043
1044 typedef struct _gcMACHINECODE
1045 {
1046     gcMACHINE_INST_PTR   pCode;          /* machine code  */
1047     gctUINT              instCount;      /* 128-bit count */
1048     gctUINT              maxConstRegNo;
1049     gctUINT              maxTempRegNo;
1050     gctUINT              endPCOfMainRoutine;
1051 }gcMACHINECODE, *gcMACHINECODE_PTR;
1052
1053 typedef enum NP2_ADDRESS_MODE
1054 {
1055     NP2_ADDRESS_MODE_CLAMP  = 0,
1056     NP2_ADDRESS_MODE_REPEAT = 1,
1057     NP2_ADDRESS_MODE_MIRROR = 2
1058 }NP2_ADDRESS_MODE;
1059
1060 typedef struct _gcNPOT_PATCH_PARAM
1061 {
1062     gctINT               samplerSlot;
1063     NP2_ADDRESS_MODE     addressMode[3];
1064     gctINT               texDimension;    /* 2 or 3 */
1065 }gcNPOT_PATCH_PARAM, *gcNPOT_PATCH_PARAM_PTR;
1066
1067 void
1068 gcGetOptionFromEnv(
1069     IN OUT gcOPTIMIZER_OPTION * Option
1070     );
1071
1072 void
1073 gcSetOptimizerOption(
1074     IN gceSHADER_FLAGS Flags
1075     );
1076
1077 gcOPTIMIZER_OPTION *
1078 gcGetOptimizerOption();
1079
1080 /*******************************************************************************
1081 **  gcSHADER_SetCompilerVersion
1082 **
1083 **  Set the compiler version of a gcSHADER object.
1084 **
1085 **  INPUT:
1086 **
1087 **      gcSHADER Shader
1088 **          Pointer to gcSHADER object
1089 **
1090 **      gctINT *Version
1091 **          Pointer to a two word version
1092 */
1093 gceSTATUS
1094 gcSHADER_SetCompilerVersion(
1095     IN gcSHADER Shader,
1096     IN gctUINT32 *Version
1097     );
1098
1099 /*******************************************************************************
1100 **  gcSHADER_GetCompilerVersion
1101 **
1102 **  Get the compiler version of a gcSHADER object.
1103 **
1104 **  INPUT:
1105 **
1106 **      gcSHADER Shader
1107 **          Pointer to a gcSHADER object.
1108 **
1109 **  OUTPUT:
1110 **
1111 **      gctUINT32_PTR *CompilerVersion.
1112 **          Pointer to holder of returned compilerVersion pointer
1113 */
1114 gceSTATUS
1115 gcSHADER_GetCompilerVersion(
1116     IN gcSHADER Shader,
1117     OUT gctUINT32_PTR *CompilerVersion
1118     );
1119
1120 /*******************************************************************************
1121 **  gcSHADER_GetType
1122 **
1123 **  Get the gcSHADER object's type.
1124 **
1125 **  INPUT:
1126 **
1127 **      gcSHADER Shader
1128 **          Pointer to a gcSHADER object.
1129 **
1130 **  OUTPUT:
1131 **
1132 **      gctINT *Type.
1133 **          Pointer to return shader type.
1134 */
1135 gceSTATUS
1136 gcSHADER_GetType(
1137     IN gcSHADER Shader,
1138     OUT gctINT *Type
1139     );
1140
1141 gctUINT
1142 gcSHADER_NextId();
1143 /*******************************************************************************
1144 **                             gcSHADER_Construct
1145 ********************************************************************************
1146 **
1147 **      Construct a new gcSHADER object.
1148 **
1149 **      INPUT:
1150 **
1151 **              gcoOS Hal
1152 **                      Pointer to an gcoHAL object.
1153 **
1154 **              gctINT ShaderType
1155 **                      Type of gcSHADER object to cerate.  'ShaderType' can be one of the
1156 **                      following:
1157 **
1158 **                              gcSHADER_TYPE_VERTEX    Vertex shader.
1159 **                              gcSHADER_TYPE_FRAGMENT  Fragment shader.
1160 **
1161 **      OUTPUT:
1162 **
1163 **              gcSHADER * Shader
1164 **                      Pointer to a variable receiving the gcSHADER object pointer.
1165 */
1166 gceSTATUS
1167 gcSHADER_Construct(
1168         IN gcoHAL Hal,
1169         IN gctINT ShaderType,
1170         OUT gcSHADER * Shader
1171         );
1172
1173 /*******************************************************************************
1174 **                              gcSHADER_Destroy
1175 ********************************************************************************
1176 **
1177 **      Destroy a gcSHADER object.
1178 **
1179 **      INPUT:
1180 **
1181 **              gcSHADER Shader
1182 **                      Pointer to a gcSHADER object.
1183 **
1184 **      OUTPUT:
1185 **
1186 **              Nothing.
1187 */
1188 gceSTATUS
1189 gcSHADER_Destroy(
1190         IN gcSHADER Shader
1191         );
1192
1193 /*******************************************************************************
1194 **                              gcSHADER_Copy
1195 ********************************************************************************
1196 **
1197 **      Copy a gcSHADER object.
1198 **
1199 **      INPUT:
1200 **
1201 **              gcSHADER Shader
1202 **                      Pointer to a gcSHADER object.
1203 **
1204 **      gcSHADER Source
1205 **          Pointer to a gcSHADER object that will be copied.
1206 **
1207 **      OUTPUT:
1208 **
1209 **              Nothing.
1210 */
1211 gceSTATUS
1212 gcSHADER_Copy(
1213         IN gcSHADER Shader,
1214         IN gcSHADER Source
1215         );
1216
1217 /*******************************************************************************
1218 **  gcSHADER_LoadHeader
1219 **
1220 **  Load a gcSHADER object from a binary buffer.  The binary buffer is layed out
1221 **  as follows:
1222 **      // Six word header
1223 **      // Signature, must be 'S','H','D','R'.
1224 **      gctINT8             signature[4];
1225 **      gctUINT32           binFileVersion;
1226 **      gctUINT32           compilerVersion[2];
1227 **      gctUINT32           gcSLVersion;
1228 **      gctUINT32           binarySize;
1229 **
1230 **  INPUT:
1231 **
1232 **      gcSHADER Shader
1233 **          Pointer to a gcSHADER object.
1234 **          Shader type will be returned if type in shader object is not gcSHADER_TYPE_PRECOMPILED
1235 **
1236 **      gctPOINTER Buffer
1237 **          Pointer to a binary buffer containing the shader data to load.
1238 **
1239 **      gctSIZE_T BufferSize
1240 **          Number of bytes inside the binary buffer pointed to by 'Buffer'.
1241 **
1242 **  OUTPUT:
1243 **      nothing
1244 **
1245 */
1246 gceSTATUS
1247 gcSHADER_LoadHeader(
1248     IN gcSHADER Shader,
1249     IN gctPOINTER Buffer,
1250     IN gctSIZE_T BufferSize,
1251     OUT gctUINT32 * ShaderVersion
1252     );
1253
1254 /*******************************************************************************
1255 **  gcSHADER_LoadKernel
1256 **
1257 **  Load a kernel function given by name into gcSHADER object
1258 **
1259 **  INPUT:
1260 **
1261 **      gcSHADER Shader
1262 **          Pointer to a gcSHADER object.
1263 **
1264 **      gctSTRING KernelName
1265 **          Pointer to a kernel function name
1266 **
1267 **  OUTPUT:
1268 **      nothing
1269 **
1270 */
1271 gceSTATUS
1272 gcSHADER_LoadKernel(
1273     IN gcSHADER Shader,
1274     IN gctSTRING KernelName
1275     );
1276
1277 /*******************************************************************************
1278 **                                gcSHADER_Load
1279 ********************************************************************************
1280 **
1281 **      Load a gcSHADER object from a binary buffer.
1282 **
1283 **      INPUT:
1284 **
1285 **              gcSHADER Shader
1286 **                      Pointer to a gcSHADER object.
1287 **
1288 **              gctPOINTER Buffer
1289 **                      Pointer to a binary buffer containg the shader data to load.
1290 **
1291 **              gctSIZE_T BufferSize
1292 **                      Number of bytes inside the binary buffer pointed to by 'Buffer'.
1293 **
1294 **      OUTPUT:
1295 **
1296 **              Nothing.
1297 */
1298 gceSTATUS
1299 gcSHADER_Load(
1300         IN gcSHADER Shader,
1301         IN gctPOINTER Buffer,
1302         IN gctSIZE_T BufferSize
1303         );
1304
1305 /*******************************************************************************
1306 **                                gcSHADER_Save
1307 ********************************************************************************
1308 **
1309 **      Save a gcSHADER object to a binary buffer.
1310 **
1311 **      INPUT:
1312 **
1313 **              gcSHADER Shader
1314 **                      Pointer to a gcSHADER object.
1315 **
1316 **              gctPOINTER Buffer
1317 **                      Pointer to a binary buffer to be used as storage for the gcSHADER
1318 **                      object.  If 'Buffer' is gcvNULL, the gcSHADER object will not be saved,
1319 **                      but the number of bytes required to hold the binary output for the
1320 **                      gcSHADER object will be returned.
1321 **
1322 **              gctSIZE_T * BufferSize
1323 **                      Pointer to a variable holding the number of bytes allocated in
1324 **                      'Buffer'.  Only valid if 'Buffer' is not gcvNULL.
1325 **
1326 **      OUTPUT:
1327 **
1328 **              gctSIZE_T * BufferSize
1329 **                      Pointer to a variable receiving the number of bytes required to hold
1330 **                      the binary form of the gcSHADER object.
1331 */
1332 gceSTATUS
1333 gcSHADER_Save(
1334         IN gcSHADER Shader,
1335         IN gctPOINTER Buffer,
1336         IN OUT gctSIZE_T * BufferSize
1337         );
1338
1339 /*******************************************************************************
1340 **                                gcSHADER_LoadEx
1341 ********************************************************************************
1342 **
1343 **      Load a gcSHADER object from a binary buffer.
1344 **
1345 **      INPUT:
1346 **
1347 **              gcSHADER Shader
1348 **                      Pointer to a gcSHADER object.
1349 **
1350 **              gctPOINTER Buffer
1351 **                      Pointer to a binary buffer containg the shader data to load.
1352 **
1353 **              gctSIZE_T BufferSize
1354 **                      Number of bytes inside the binary buffer pointed to by 'Buffer'.
1355 **
1356 **      OUTPUT:
1357 **
1358 **              Nothing.
1359 */
1360 gceSTATUS
1361 gcSHADER_LoadEx(
1362         IN gcSHADER Shader,
1363         IN gctPOINTER Buffer,
1364         IN gctSIZE_T BufferSize
1365         );
1366
1367 /*******************************************************************************
1368 **                                gcSHADER_SaveEx
1369 ********************************************************************************
1370 **
1371 **      Save a gcSHADER object to a binary buffer.
1372 **
1373 **      INPUT:
1374 **
1375 **              gcSHADER Shader
1376 **                      Pointer to a gcSHADER object.
1377 **
1378 **              gctPOINTER Buffer
1379 **                      Pointer to a binary buffer to be used as storage for the gcSHADER
1380 **                      object.  If 'Buffer' is gcvNULL, the gcSHADER object will not be saved,
1381 **                      but the number of bytes required to hold the binary output for the
1382 **                      gcSHADER object will be returned.
1383 **
1384 **              gctSIZE_T * BufferSize
1385 **                      Pointer to a variable holding the number of bytes allocated in
1386 **                      'Buffer'.  Only valid if 'Buffer' is not gcvNULL.
1387 **
1388 **      OUTPUT:
1389 **
1390 **              gctSIZE_T * BufferSize
1391 **                      Pointer to a variable receiving the number of bytes required to hold
1392 **                      the binary form of the gcSHADER object.
1393 */
1394 gceSTATUS
1395 gcSHADER_SaveEx(
1396         IN gcSHADER Shader,
1397         IN gctPOINTER Buffer,
1398         IN OUT gctSIZE_T * BufferSize
1399         );
1400
1401 /*******************************************************************************
1402 **  gcSHADER_ReallocateAttributes
1403 **
1404 **  Reallocate an array of pointers to gcATTRIBUTE objects.
1405 **
1406 **  INPUT:
1407 **
1408 **      gcSHADER Shader
1409 **          Pointer to a gcSHADER object.
1410 **
1411 **      gctSIZE_T Count
1412 **          Array count to reallocate.  'Count' must be at least 1.
1413 */
1414 gceSTATUS
1415 gcSHADER_ReallocateAttributes(
1416     IN gcSHADER Shader,
1417     IN gctSIZE_T Count
1418     );
1419
1420 /*******************************************************************************
1421 **                                                        gcSHADER_AddAttribute
1422 ********************************************************************************
1423 **
1424 **      Add an attribute to a gcSHADER object.
1425 **
1426 **      INPUT:
1427 **
1428 **              gcSHADER Shader
1429 **                      Pointer to a gcSHADER object.
1430 **
1431 **              gctCONST_STRING Name
1432 **                      Name of the attribute to add.
1433 **
1434 **              gcSHADER_TYPE Type
1435 **                      Type of the attribute to add.
1436 **
1437 **              gctSIZE_T Length
1438 **                      Array length of the attribute to add.  'Length' must be at least 1.
1439 **
1440 **              gctBOOL IsTexture
1441 **                      gcvTRUE if the attribute is used as a texture coordinate, gcvFALSE if not.
1442 **
1443 **      OUTPUT:
1444 **
1445 **              gcATTRIBUTE * Attribute
1446 **                      Pointer to a variable receiving the gcATTRIBUTE object pointer.
1447 */
1448 gceSTATUS
1449 gcSHADER_AddAttribute(
1450         IN gcSHADER Shader,
1451         IN gctCONST_STRING Name,
1452         IN gcSHADER_TYPE Type,
1453         IN gctSIZE_T Length,
1454         IN gctBOOL IsTexture,
1455         OUT gcATTRIBUTE * Attribute
1456         );
1457
1458 /*******************************************************************************
1459 **                         gcSHADER_GetAttributeCount
1460 ********************************************************************************
1461 **
1462 **      Get the number of attributes for this shader.
1463 **
1464 **      INPUT:
1465 **
1466 **              gcSHADER Shader
1467 **                      Pointer to a gcSHADER object.
1468 **
1469 **      OUTPUT:
1470 **
1471 **              gctSIZE_T * Count
1472 **                      Pointer to a variable receiving the number of attributes.
1473 */
1474 gceSTATUS
1475 gcSHADER_GetAttributeCount(
1476         IN gcSHADER Shader,
1477         OUT gctSIZE_T * Count
1478         );
1479
1480 /*******************************************************************************
1481 **                            gcSHADER_GetAttribute
1482 ********************************************************************************
1483 **
1484 **      Get the gcATTRIBUTE object poniter for an indexed attribute for this shader.
1485 **
1486 **      INPUT:
1487 **
1488 **              gcSHADER Shader
1489 **                      Pointer to a gcSHADER object.
1490 **
1491 **              gctUINT Index
1492 **                      Index of the attribute to retrieve.
1493 **
1494 **      OUTPUT:
1495 **
1496 **              gcATTRIBUTE * Attribute
1497 **                      Pointer to a variable receiving the gcATTRIBUTE object pointer.
1498 */
1499 gceSTATUS
1500 gcSHADER_GetAttribute(
1501         IN gcSHADER Shader,
1502         IN gctUINT Index,
1503         OUT gcATTRIBUTE * Attribute
1504         );
1505
1506 /*******************************************************************************
1507 **  gcSHADER_ReallocateUniforms
1508 **
1509 **  Reallocate an array of pointers to gcUNIFORM objects.
1510 **
1511 **  INPUT:
1512 **
1513 **      gcSHADER Shader
1514 **          Pointer to a gcSHADER object.
1515 **
1516 **      gctSIZE_T Count
1517 **          Array count to reallocate.  'Count' must be at least 1.
1518 */
1519 gceSTATUS
1520 gcSHADER_ReallocateUniforms(
1521     IN gcSHADER Shader,
1522     IN gctSIZE_T Count
1523     );
1524
1525 /*******************************************************************************
1526 **                                                         gcSHADER_AddUniform
1527 ********************************************************************************
1528 **
1529 **      Add an uniform to a gcSHADER object.
1530 **
1531 **      INPUT:
1532 **
1533 **              gcSHADER Shader
1534 **                      Pointer to a gcSHADER object.
1535 **
1536 **              gctCONST_STRING Name
1537 **                      Name of the uniform to add.
1538 **
1539 **              gcSHADER_TYPE Type
1540 **                      Type of the uniform to add.
1541 **
1542 **              gctSIZE_T Length
1543 **                      Array length of the uniform to add.  'Length' must be at least 1.
1544 **
1545 **      OUTPUT:
1546 **
1547 **              gcUNIFORM * Uniform
1548 **                      Pointer to a variable receiving the gcUNIFORM object pointer.
1549 */
1550 gceSTATUS
1551 gcSHADER_AddUniform(
1552         IN gcSHADER Shader,
1553         IN gctCONST_STRING Name,
1554         IN gcSHADER_TYPE Type,
1555         IN gctSIZE_T Length,
1556         OUT gcUNIFORM * Uniform
1557         );
1558
1559
1560 /*******************************************************************************
1561 **                                                         gcSHADER_AddUniformEx
1562 ********************************************************************************
1563 **
1564 **      Add an uniform to a gcSHADER object.
1565 **
1566 **      INPUT:
1567 **
1568 **              gcSHADER Shader
1569 **                      Pointer to a gcSHADER object.
1570 **
1571 **              gctCONST_STRING Name
1572 **                      Name of the uniform to add.
1573 **
1574 **              gcSHADER_TYPE Type
1575 **                      Type of the uniform to add.
1576 **
1577 **      gcSHADER_PRECISION precision
1578 **          Precision of the uniform to add.
1579 **
1580 **              gctSIZE_T Length
1581 **                      Array length of the uniform to add.  'Length' must be at least 1.
1582 **
1583 **      OUTPUT:
1584 **
1585 **              gcUNIFORM * Uniform
1586 **                      Pointer to a variable receiving the gcUNIFORM object pointer.
1587 */
1588 gceSTATUS
1589 gcSHADER_AddUniformEx(
1590         IN gcSHADER Shader,
1591         IN gctCONST_STRING Name,
1592         IN gcSHADER_TYPE Type,
1593     IN gcSHADER_PRECISION precision,
1594         IN gctSIZE_T Length,
1595         OUT gcUNIFORM * Uniform
1596         );
1597
1598 /*******************************************************************************
1599 **                                                         gcSHADER_AddUniformEx1
1600 ********************************************************************************
1601 **
1602 **      Add an uniform to a gcSHADER object.
1603 **
1604 **      INPUT:
1605 **
1606 **              gcSHADER Shader
1607 **                      Pointer to a gcSHADER object.
1608 **
1609 **              gctCONST_STRING Name
1610 **                      Name of the uniform to add.
1611 **
1612 **              gcSHADER_TYPE Type
1613 **                      Type of the uniform to add.
1614 **
1615 **      gcSHADER_PRECISION precision
1616 **          Precision of the uniform to add.
1617 **
1618 **              gctSIZE_T Length
1619 **                      Array length of the uniform to add.  'Length' must be at least 1.
1620 **
1621 **      gcSHADER_VAR_CATEGORY varCategory
1622 **          Variable category, normal or struct.
1623 **
1624 **      gctUINT16 numStructureElement
1625 **          If struct, its element number.
1626 **
1627 **      gctINT16 parent
1628 **          If struct, parent index in gcSHADER.variables.
1629 **
1630 **      gctINT16 prevSibling
1631 **          If struct, previous sibling index in gcSHADER.variables.
1632 **
1633 **      OUTPUT:
1634 **
1635 **              gcUNIFORM * Uniform
1636 **                      Pointer to a variable receiving the gcUNIFORM object pointer.
1637 **
1638 **      gctINT16* ThisUniformIndex
1639 **          Returned value about uniform index in gcSHADER.
1640 */
1641 gceSTATUS
1642 gcSHADER_AddUniformEx1(
1643         IN gcSHADER Shader,
1644         IN gctCONST_STRING Name,
1645         IN gcSHADER_TYPE Type,
1646     IN gcSHADER_PRECISION precision,
1647         IN gctSIZE_T Length,
1648     IN gctINT    IsArray,
1649     IN gcSHADER_VAR_CATEGORY varCategory,
1650     IN gctUINT16 numStructureElement,
1651     IN gctINT16 parent,
1652     IN gctINT16 prevSibling,
1653     OUT gctINT16* ThisUniformIndex,
1654         OUT gcUNIFORM * Uniform
1655         );
1656
1657 /*******************************************************************************
1658 **                          gcSHADER_GetUniformCount
1659 ********************************************************************************
1660 **
1661 **      Get the number of uniforms for this shader.
1662 **
1663 **      INPUT:
1664 **
1665 **              gcSHADER Shader
1666 **                      Pointer to a gcSHADER object.
1667 **
1668 **      OUTPUT:
1669 **
1670 **              gctSIZE_T * Count
1671 **                      Pointer to a variable receiving the number of uniforms.
1672 */
1673 gceSTATUS
1674 gcSHADER_GetUniformCount(
1675         IN gcSHADER Shader,
1676         OUT gctSIZE_T * Count
1677         );
1678
1679 /*******************************************************************************
1680 **                             gcSHADER_GetUniform
1681 ********************************************************************************
1682 **
1683 **      Get the gcUNIFORM object pointer for an indexed uniform for this shader.
1684 **
1685 **      INPUT:
1686 **
1687 **              gcSHADER Shader
1688 **                      Pointer to a gcSHADER object.
1689 **
1690 **              gctUINT Index
1691 **                      Index of the uniform to retrieve.
1692 **
1693 **      OUTPUT:
1694 **
1695 **              gcUNIFORM * Uniform
1696 **                      Pointer to a variable receiving the gcUNIFORM object pointer.
1697 */
1698 gceSTATUS
1699 gcSHADER_GetUniform(
1700         IN gcSHADER Shader,
1701         IN gctUINT Index,
1702         OUT gcUNIFORM * Uniform
1703         );
1704
1705
1706 /*******************************************************************************
1707 **                             gcSHADER_GetUniformIndexingRange
1708 ********************************************************************************
1709 **
1710 **      Get the gcUNIFORM object pointer for an indexed uniform for this shader.
1711 **
1712 **      INPUT:
1713 **
1714 **              gcSHADER Shader
1715 **                      Pointer to a gcSHADER object.
1716 **
1717 **              gctINT uniformIndex
1718 **                      Index of the start uniform.
1719 **
1720 **              gctINT offset
1721 **                      Offset to indexing.
1722 **
1723 **      OUTPUT:
1724 **
1725 **              gctINT * LastUniformIndex
1726 **                      Pointer to index of last uniform in indexing range.
1727 **
1728 **              gctINT * OffsetUniformIndex
1729 **                      Pointer to index of uniform that indexing at offset.
1730 **
1731 **              gctINT * DeviationInOffsetUniform
1732 **                      Pointer to offset in uniform picked up.
1733 */
1734 gceSTATUS
1735 gcSHADER_GetUniformIndexingRange(
1736         IN gcSHADER Shader,
1737         IN gctINT uniformIndex,
1738     IN gctINT offset,
1739         OUT gctINT * LastUniformIndex,
1740     OUT gctINT * OffsetUniformIndex,
1741     OUT gctINT * DeviationInOffsetUniform
1742         );
1743
1744 /*******************************************************************************
1745 **  gcSHADER_GetKernelFucntion
1746 **
1747 **  Get the gcKERNEL_FUNCTION object pointer for an indexed kernel function for this shader.
1748 **
1749 **  INPUT:
1750 **
1751 **      gcSHADER Shader
1752 **          Pointer to a gcSHADER object.
1753 **
1754 **      gctUINT Index
1755 **          Index of kernel function to retreive the name for.
1756 **
1757 **  OUTPUT:
1758 **
1759 **      gcKERNEL_FUNCTION * KernelFunction
1760 **          Pointer to a variable receiving the gcKERNEL_FUNCTION object pointer.
1761 */
1762 gceSTATUS
1763 gcSHADER_GetKernelFunction(
1764     IN gcSHADER Shader,
1765     IN gctUINT Index,
1766     OUT gcKERNEL_FUNCTION * KernelFunction
1767     );
1768
1769 gceSTATUS
1770 gcSHADER_GetKernelFunctionByName(
1771         IN gcSHADER Shader,
1772     IN gctSTRING KernelName,
1773     OUT gcKERNEL_FUNCTION * KernelFunction
1774     );
1775 /*******************************************************************************
1776 **  gcSHADER_GetKernelFunctionCount
1777 **
1778 **  Get the number of kernel functions for this shader.
1779 **
1780 **  INPUT:
1781 **
1782 **      gcSHADER Shader
1783 **          Pointer to a gcSHADER object.
1784 **
1785 **  OUTPUT:
1786 **
1787 **      gctSIZE_T * Count
1788 **          Pointer to a variable receiving the number of kernel functions.
1789 */
1790 gceSTATUS
1791 gcSHADER_GetKernelFunctionCount(
1792     IN gcSHADER Shader,
1793     OUT gctSIZE_T * Count
1794     );
1795
1796 /*******************************************************************************
1797 **  gcSHADER_ReallocateOutputs
1798 **
1799 **  Reallocate an array of pointers to gcOUTPUT objects.
1800 **
1801 **  INPUT:
1802 **
1803 **      gcSHADER Shader
1804 **          Pointer to a gcSHADER object.
1805 **
1806 **      gctSIZE_T Count
1807 **          Array count to reallocate.  'Count' must be at least 1.
1808 */
1809 gceSTATUS
1810 gcSHADER_ReallocateOutputs(
1811     IN gcSHADER Shader,
1812     IN gctSIZE_T Count
1813     );
1814
1815 /*******************************************************************************
1816 **                                                         gcSHADER_AddOutput
1817 ********************************************************************************
1818 **
1819 **      Add an output to a gcSHADER object.
1820 **
1821 **      INPUT:
1822 **
1823 **              gcSHADER Shader
1824 **                      Pointer to a gcSHADER object.
1825 **
1826 **              gctCONST_STRING Name
1827 **                      Name of the output to add.
1828 **
1829 **              gcSHADER_TYPE Type
1830 **                      Type of the output to add.
1831 **
1832 **              gctSIZE_T Length
1833 **                      Array length of the output to add.  'Length' must be at least 1.
1834 **
1835 **              gctUINT16 TempRegister
1836 **                      Temporary register index that holds the output value.
1837 **
1838 **      OUTPUT:
1839 **
1840 **              Nothing.
1841 */
1842 gceSTATUS
1843 gcSHADER_AddOutput(
1844         IN gcSHADER Shader,
1845         IN gctCONST_STRING Name,
1846         IN gcSHADER_TYPE Type,
1847         IN gctSIZE_T Length,
1848         IN gctUINT16 TempRegister
1849         );
1850
1851 gceSTATUS
1852 gcSHADER_AddOutputIndexed(
1853         IN gcSHADER Shader,
1854         IN gctCONST_STRING Name,
1855         IN gctSIZE_T Index,
1856         IN gctUINT16 TempIndex
1857         );
1858
1859 /*******************************************************************************
1860 **                                                       gcSHADER_GetOutputCount
1861 ********************************************************************************
1862 **
1863 **      Get the number of outputs for this shader.
1864 **
1865 **      INPUT:
1866 **
1867 **              gcSHADER Shader
1868 **                      Pointer to a gcSHADER object.
1869 **
1870 **      OUTPUT:
1871 **
1872 **              gctSIZE_T * Count
1873 **                      Pointer to a variable receiving the number of outputs.
1874 */
1875 gceSTATUS
1876 gcSHADER_GetOutputCount(
1877         IN gcSHADER Shader,
1878         OUT gctSIZE_T * Count
1879         );
1880
1881 /*******************************************************************************
1882 **                                                         gcSHADER_GetOutput
1883 ********************************************************************************
1884 **
1885 **      Get the gcOUTPUT object pointer for an indexed output for this shader.
1886 **
1887 **      INPUT:
1888 **
1889 **              gcSHADER Shader
1890 **                      Pointer to a gcSHADER object.
1891 **
1892 **              gctUINT Index
1893 **                      Index of output to retrieve.
1894 **
1895 **      OUTPUT:
1896 **
1897 **              gcOUTPUT * Output
1898 **                      Pointer to a variable receiving the gcOUTPUT object pointer.
1899 */
1900 gceSTATUS
1901 gcSHADER_GetOutput(
1902         IN gcSHADER Shader,
1903         IN gctUINT Index,
1904         OUT gcOUTPUT * Output
1905         );
1906
1907
1908 /*******************************************************************************
1909 **                                                         gcSHADER_GetOutputByName
1910 ********************************************************************************
1911 **
1912 **      Get the gcOUTPUT object pointer for this shader by output name.
1913 **
1914 **      INPUT:
1915 **
1916 **              gcSHADER Shader
1917 **                      Pointer to a gcSHADER object.
1918 **
1919 **              gctSTRING name
1920 **                      Name of output to retrieve.
1921 **
1922 **      gctSIZE_T nameLength
1923 **          Length of name to retrieve
1924 **
1925 **      OUTPUT:
1926 **
1927 **              gcOUTPUT * Output
1928 **                      Pointer to a variable receiving the gcOUTPUT object pointer.
1929 */
1930 gceSTATUS
1931 gcSHADER_GetOutputByName(
1932         IN gcSHADER Shader,
1933         IN gctSTRING name,
1934     IN gctSIZE_T nameLength,
1935         OUT gcOUTPUT * Output
1936         );
1937
1938 /*******************************************************************************
1939 **  gcSHADER_ReallocateVariables
1940 **
1941 **  Reallocate an array of pointers to gcVARIABLE objects.
1942 **
1943 **  INPUT:
1944 **
1945 **      gcSHADER Shader
1946 **          Pointer to a gcSHADER object.
1947 **
1948 **      gctSIZE_T Count
1949 **          Array count to reallocate.  'Count' must be at least 1.
1950 */
1951 gceSTATUS
1952 gcSHADER_ReallocateVariables(
1953     IN gcSHADER Shader,
1954     IN gctSIZE_T Count
1955     );
1956
1957 /*******************************************************************************
1958 **                                                         gcSHADER_AddVariable
1959 ********************************************************************************
1960 **
1961 **      Add a variable to a gcSHADER object.
1962 **
1963 **      INPUT:
1964 **
1965 **              gcSHADER Shader
1966 **                      Pointer to a gcSHADER object.
1967 **
1968 **              gctCONST_STRING Name
1969 **                      Name of the variable to add.
1970 **
1971 **              gcSHADER_TYPE Type
1972 **                      Type of the variable to add.
1973 **
1974 **              gctSIZE_T Length
1975 **                      Array length of the variable to add.  'Length' must be at least 1.
1976 **
1977 **              gctUINT16 TempRegister
1978 **                      Temporary register index that holds the variable value.
1979 **
1980 **      OUTPUT:
1981 **
1982 **              Nothing.
1983 */
1984 gceSTATUS
1985 gcSHADER_AddVariable(
1986         IN gcSHADER Shader,
1987         IN gctCONST_STRING Name,
1988         IN gcSHADER_TYPE Type,
1989         IN gctSIZE_T Length,
1990         IN gctUINT16 TempRegister
1991         );
1992
1993
1994 /*******************************************************************************
1995 **  gcSHADER_AddVariableEx
1996 ********************************************************************************
1997 **
1998 **  Add a variable to a gcSHADER object.
1999 **
2000 **  INPUT:
2001 **
2002 **      gcSHADER Shader
2003 **          Pointer to a gcSHADER object.
2004 **
2005 **      gctCONST_STRING Name
2006 **          Name of the variable to add.
2007 **
2008 **      gcSHADER_TYPE Type
2009 **          Type of the variable to add.
2010 **
2011 **      gctSIZE_T Length
2012 **          Array length of the variable to add.  'Length' must be at least 1.
2013 **
2014 **      gctUINT16 TempRegister
2015 **          Temporary register index that holds the variable value.
2016 **
2017 **      gcSHADER_VAR_CATEGORY varCategory
2018 **          Variable category, normal or struct.
2019 **
2020 **      gctUINT16 numStructureElement
2021 **          If struct, its element number.
2022 **
2023 **      gctINT16 parent
2024 **          If struct, parent index in gcSHADER.variables.
2025 **
2026 **      gctINT16 prevSibling
2027 **          If struct, previous sibling index in gcSHADER.variables.
2028 **
2029 **  OUTPUT:
2030 **
2031 **      gctINT16* ThisVarIndex
2032 **          Returned value about variable index in gcSHADER.
2033 */
2034 gceSTATUS
2035 gcSHADER_AddVariableEx(
2036     IN gcSHADER Shader,
2037     IN gctCONST_STRING Name,
2038     IN gcSHADER_TYPE Type,
2039     IN gctSIZE_T Length,
2040     IN gctUINT16 TempRegister,
2041     IN gcSHADER_VAR_CATEGORY varCategory,
2042     IN gctUINT16 numStructureElement,
2043     IN gctINT16 parent,
2044     IN gctINT16 prevSibling,
2045     OUT gctINT16* ThisVarIndex
2046     );
2047
2048 /*******************************************************************************
2049 **  gcSHADER_UpdateVariable
2050 ********************************************************************************
2051 **
2052 **  Update a variable to a gcSHADER object.
2053 **
2054 **  INPUT:
2055 **
2056 **              gcSHADER Shader
2057 **                      Pointer to a gcSHADER object.
2058 **
2059 **              gctUINT Index
2060 **                      Index of variable to retrieve.
2061 **
2062 **              gceVARIABLE_UPDATE_FLAGS flag
2063 **                      Flag which property of variable will be updated.
2064 **
2065 **      gctUINT newValue
2066 **          New value to update.
2067 **
2068 **  OUTPUT:
2069 **
2070 **      Nothing.
2071 */
2072 gceSTATUS
2073 gcSHADER_UpdateVariable(
2074     IN gcSHADER Shader,
2075     IN gctUINT Index,
2076     IN gceVARIABLE_UPDATE_FLAGS flag,
2077     IN gctUINT newValue
2078     );
2079
2080 /*******************************************************************************
2081 **                                                       gcSHADER_GetVariableCount
2082 ********************************************************************************
2083 **
2084 **      Get the number of variables for this shader.
2085 **
2086 **      INPUT:
2087 **
2088 **              gcSHADER Shader
2089 **                      Pointer to a gcSHADER object.
2090 **
2091 **      OUTPUT:
2092 **
2093 **              gctSIZE_T * Count
2094 **                      Pointer to a variable receiving the number of variables.
2095 */
2096 gceSTATUS
2097 gcSHADER_GetVariableCount(
2098         IN gcSHADER Shader,
2099         OUT gctSIZE_T * Count
2100         );
2101
2102 /*******************************************************************************
2103 **                                                         gcSHADER_GetVariable
2104 ********************************************************************************
2105 **
2106 **      Get the gcVARIABLE object pointer for an indexed variable for this shader.
2107 **
2108 **      INPUT:
2109 **
2110 **              gcSHADER Shader
2111 **                      Pointer to a gcSHADER object.
2112 **
2113 **              gctUINT Index
2114 **                      Index of variable to retrieve.
2115 **
2116 **      OUTPUT:
2117 **
2118 **              gcVARIABLE * Variable
2119 **                      Pointer to a variable receiving the gcVARIABLE object pointer.
2120 */
2121 gceSTATUS
2122 gcSHADER_GetVariable(
2123         IN gcSHADER Shader,
2124         IN gctUINT Index,
2125         OUT gcVARIABLE * Variable
2126         );
2127
2128 /*******************************************************************************
2129 **                                                         gcSHADER_GetVariableIndexingRange
2130 ********************************************************************************
2131 **
2132 **      Get the gcVARIABLE indexing range.
2133 **
2134 **      INPUT:
2135 **
2136 **              gcSHADER Shader
2137 **                      Pointer to a gcSHADER object.
2138 **
2139 **              gcVARIABLE variable
2140 **                      Start variable.
2141 **
2142 **              gctBOOL whole
2143 **                      Indicate whether maximum indexing range is queried
2144 **
2145 **      OUTPUT:
2146 **
2147 **              gctUINT *Start
2148 **                      Pointer to range start (temp register index).
2149 **
2150 **              gctUINT *End
2151 **                      Pointer to range end (temp register index).
2152 */
2153 gceSTATUS
2154 gcSHADER_GetVariableIndexingRange(
2155         IN gcSHADER Shader,
2156     IN gcVARIABLE variable,
2157     IN gctBOOL whole,
2158     OUT gctUINT *Start,
2159     OUT gctUINT *End
2160         );
2161
2162 /*******************************************************************************
2163 **                                                         gcSHADER_AddOpcode
2164 ********************************************************************************
2165 **
2166 **      Add an opcode to a gcSHADER object.
2167 **
2168 **      INPUT:
2169 **
2170 **              gcSHADER Shader
2171 **                      Pointer to a gcSHADER object.
2172 **
2173 **              gcSL_OPCODE Opcode
2174 **                      Opcode to add.
2175 **
2176 **              gctUINT16 TempRegister
2177 **                      Temporary register index that acts as the target of the opcode.
2178 **
2179 **              gctUINT8 Enable
2180 **                      Write enable bits for the temporary register that acts as the target
2181 **                      of the opcode.
2182 **
2183 **              gcSL_FORMAT Format
2184 **                      Format of the temporary register.
2185 **
2186 **      OUTPUT:
2187 **
2188 **              Nothing.
2189 */
2190 gceSTATUS
2191 gcSHADER_AddOpcode(
2192         IN gcSHADER Shader,
2193         IN gcSL_OPCODE Opcode,
2194         IN gctUINT16 TempRegister,
2195         IN gctUINT8 Enable,
2196         IN gcSL_FORMAT Format
2197         );
2198
2199 gceSTATUS
2200 gcSHADER_AddOpcode2(
2201         IN gcSHADER Shader,
2202         IN gcSL_OPCODE Opcode,
2203         IN gcSL_CONDITION Condition,
2204         IN gctUINT16 TempRegister,
2205         IN gctUINT8 Enable,
2206         IN gcSL_FORMAT Format
2207         );
2208
2209 /*******************************************************************************
2210 **                                                      gcSHADER_AddOpcodeIndexed
2211 ********************************************************************************
2212 **
2213 **      Add an opcode to a gcSHADER object that writes to an dynamically indexed
2214 **      target.
2215 **
2216 **      INPUT:
2217 **
2218 **              gcSHADER Shader
2219 **                      Pointer to a gcSHADER object.
2220 **
2221 **              gcSL_OPCODE Opcode
2222 **                      Opcode to add.
2223 **
2224 **              gctUINT16 TempRegister
2225 **                      Temporary register index that acts as the target of the opcode.
2226 **
2227 **              gctUINT8 Enable
2228 **                      Write enable bits  for the temporary register that acts as the
2229 **                      target of the opcode.
2230 **
2231 **              gcSL_INDEXED Mode
2232 **                      Location of the dynamic index inside the temporary register.  Valid
2233 **                      values can be:
2234 **
2235 **                              gcSL_INDEXED_X - Use x component of the temporary register.
2236 **                              gcSL_INDEXED_Y - Use y component of the temporary register.
2237 **                              gcSL_INDEXED_Z - Use z component of the temporary register.
2238 **                              gcSL_INDEXED_W - Use w component of the temporary register.
2239 **
2240 **              gctUINT16 IndexRegister
2241 **                      Temporary register index that holds the dynamic index.
2242 **
2243 **              gcSL_FORMAT Format
2244 **                      Format of the temporary register.
2245 **
2246 **      OUTPUT:
2247 **
2248 **              Nothing.
2249 */
2250 gceSTATUS
2251 gcSHADER_AddOpcodeIndexed(
2252         IN gcSHADER Shader,
2253         IN gcSL_OPCODE Opcode,
2254         IN gctUINT16 TempRegister,
2255         IN gctUINT8 Enable,
2256         IN gcSL_INDEXED Mode,
2257         IN gctUINT16 IndexRegister,
2258         IN gcSL_FORMAT Format
2259         );
2260
2261 /*******************************************************************************
2262 **  gcSHADER_AddOpcodeConditionIndexed
2263 **
2264 **  Add an opcode to a gcSHADER object that writes to an dynamically indexed
2265 **  target.
2266 **
2267 **  INPUT:
2268 **
2269 **      gcSHADER Shader
2270 **          Pointer to a gcSHADER object.
2271 **
2272 **      gcSL_OPCODE Opcode
2273 **          Opcode to add.
2274 **
2275 **      gcSL_CONDITION Condition
2276 **          Condition to check.
2277 **
2278 **      gctUINT16 TempRegister
2279 **          Temporary register index that acts as the target of the opcode.
2280 **
2281 **      gctUINT8 Enable
2282 **          Write enable bits  for the temporary register that acts as the
2283 **          target of the opcode.
2284 **
2285 **      gcSL_INDEXED Indexed
2286 **          Location of the dynamic index inside the temporary register.  Valid
2287 **          values can be:
2288 **
2289 **              gcSL_INDEXED_X - Use x component of the temporary register.
2290 **              gcSL_INDEXED_Y - Use y component of the temporary register.
2291 **              gcSL_INDEXED_Z - Use z component of the temporary register.
2292 **              gcSL_INDEXED_W - Use w component of the temporary register.
2293 **
2294 **      gctUINT16 IndexRegister
2295 **          Temporary register index that holds the dynamic index.
2296 **
2297 **  OUTPUT:
2298 **
2299 **      Nothing.
2300 */
2301 gceSTATUS
2302 gcSHADER_AddOpcodeConditionIndexed(
2303     IN gcSHADER Shader,
2304     IN gcSL_OPCODE Opcode,
2305     IN gcSL_CONDITION Condition,
2306     IN gctUINT16 TempRegister,
2307     IN gctUINT8 Enable,
2308     IN gcSL_INDEXED Indexed,
2309     IN gctUINT16 IndexRegister,
2310     IN gcSL_FORMAT Format
2311     );
2312
2313 /*******************************************************************************
2314 **                                                gcSHADER_AddOpcodeConditional
2315 ********************************************************************************
2316 **
2317 **      Add an conditional opcode to a gcSHADER object.
2318 **
2319 **      INPUT:
2320 **
2321 **              gcSHADER Shader
2322 **                      Pointer to a gcSHADER object.
2323 **
2324 **              gcSL_OPCODE Opcode
2325 **                      Opcode to add.
2326 **
2327 **              gcSL_CONDITION Condition
2328 **                      Condition that needs to evaluate to gcvTRUE in order for the opcode to
2329 **                      execute.
2330 **
2331 **              gctUINT Label
2332 **                      Target label if 'Condition' evaluates to gcvTRUE.
2333 **
2334 **      OUTPUT:
2335 **
2336 **              Nothing.
2337 */
2338 gceSTATUS
2339 gcSHADER_AddOpcodeConditional(
2340         IN gcSHADER Shader,
2341         IN gcSL_OPCODE Opcode,
2342         IN gcSL_CONDITION Condition,
2343         IN gctUINT Label
2344         );
2345
2346 /*******************************************************************************
2347 **  gcSHADER_AddOpcodeConditionalFormatted
2348 **
2349 **  Add an conditional jump or call opcode to a gcSHADER object.
2350 **
2351 **  INPUT:
2352 **
2353 **      gcSHADER Shader
2354 **          Pointer to a gcSHADER object.
2355 **
2356 **      gcSL_OPCODE Opcode
2357 **          Opcode to add.
2358 **
2359 **      gcSL_CONDITION Condition
2360 **          Condition that needs to evaluate to gcvTRUE in order for the opcode to
2361 **          execute.
2362 **
2363 **      gcSL_FORMAT Format
2364 **          Format of conditional operands
2365 **
2366 **      gctUINT Label
2367 **          Target label if 'Condition' evaluates to gcvTRUE.
2368 **
2369 **  OUTPUT:
2370 **
2371 **      Nothing.
2372 */
2373 gceSTATUS
2374 gcSHADER_AddOpcodeConditionalFormatted(
2375     IN gcSHADER Shader,
2376     IN gcSL_OPCODE Opcode,
2377     IN gcSL_CONDITION Condition,
2378     IN gcSL_FORMAT Format,
2379     IN gctUINT Label
2380     );
2381
2382 /*******************************************************************************
2383 **  gcSHADER_AddOpcodeConditionalFormattedEnable
2384 **
2385 **  Add an conditional jump or call opcode to a gcSHADER object.
2386 **
2387 **  INPUT:
2388 **
2389 **      gcSHADER Shader
2390 **          Pointer to a gcSHADER object.
2391 **
2392 **      gcSL_OPCODE Opcode
2393 **          Opcode to add.
2394 **
2395 **      gcSL_CONDITION Condition
2396 **          Condition that needs to evaluate to gcvTRUE in order for the opcode to
2397 **          execute.
2398 **
2399 **      gcSL_FORMAT Format
2400 **          Format of conditional operands
2401 **
2402 **      gctUINT8 Enable
2403 **          Write enable value for the target of the opcode.
2404 **
2405 **      gctUINT Label
2406 **          Target label if 'Condition' evaluates to gcvTRUE.
2407 **
2408 **  OUTPUT:
2409 **
2410 **      Nothing.
2411 */
2412 gceSTATUS
2413 gcSHADER_AddOpcodeConditionalFormattedEnable(
2414     IN gcSHADER Shader,
2415     IN gcSL_OPCODE Opcode,
2416     IN gcSL_CONDITION Condition,
2417     IN gcSL_FORMAT Format,
2418     IN gctUINT8 Enable,
2419     IN gctUINT Label
2420     );
2421
2422 /*******************************************************************************
2423 **                                                              gcSHADER_AddLabel
2424 ********************************************************************************
2425 **
2426 **      Define a label at the current instruction of a gcSHADER object.
2427 **
2428 **      INPUT:
2429 **
2430 **              gcSHADER Shader
2431 **                      Pointer to a gcSHADER object.
2432 **
2433 **              gctUINT Label
2434 **                      Label to define.
2435 **
2436 **      OUTPUT:
2437 **
2438 **              Nothing.
2439 */
2440 gceSTATUS
2441 gcSHADER_AddLabel(
2442         IN gcSHADER Shader,
2443         IN gctUINT Label
2444         );
2445
2446 /*******************************************************************************
2447 **                                                         gcSHADER_AddSource
2448 ********************************************************************************
2449 **
2450 **      Add a source operand to a gcSHADER object.
2451 **
2452 **      INPUT:
2453 **
2454 **              gcSHADER Shader
2455 **                      Pointer to a gcSHADER object.
2456 **
2457 **              gcSL_TYPE Type
2458 **                      Type of the source operand.
2459 **
2460 **              gctUINT16 SourceIndex
2461 **                      Index of the source operand.
2462 **
2463 **              gctUINT8 Swizzle
2464 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2465 **
2466 **              gcSL_FORMAT Format
2467 **                      Format of the source operand.
2468 **
2469 **      OUTPUT:
2470 **
2471 **              Nothing.
2472 */
2473 gceSTATUS
2474 gcSHADER_AddSource(
2475         IN gcSHADER Shader,
2476         IN gcSL_TYPE Type,
2477         IN gctUINT16 SourceIndex,
2478         IN gctUINT8 Swizzle,
2479         IN gcSL_FORMAT Format
2480         );
2481
2482 /*******************************************************************************
2483 **                                                      gcSHADER_AddSourceIndexed
2484 ********************************************************************************
2485 **
2486 **      Add a dynamically indexed source operand to a gcSHADER object.
2487 **
2488 **      INPUT:
2489 **
2490 **              gcSHADER Shader
2491 **                      Pointer to a gcSHADER object.
2492 **
2493 **              gcSL_TYPE Type
2494 **                      Type of the source operand.
2495 **
2496 **              gctUINT16 SourceIndex
2497 **                      Index of the source operand.
2498 **
2499 **              gctUINT8 Swizzle
2500 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2501 **
2502 **              gcSL_INDEXED Mode
2503 **                      Addressing mode for the index.
2504 **
2505 **              gctUINT16 IndexRegister
2506 **                      Temporary register index that holds the dynamic index.
2507 **
2508 **              gcSL_FORMAT Format
2509 **                      Format of the source operand.
2510 **
2511 **      OUTPUT:
2512 **
2513 **              Nothing.
2514 */
2515 gceSTATUS
2516 gcSHADER_AddSourceIndexed(
2517         IN gcSHADER Shader,
2518         IN gcSL_TYPE Type,
2519         IN gctUINT16 SourceIndex,
2520         IN gctUINT8 Swizzle,
2521         IN gcSL_INDEXED Mode,
2522         IN gctUINT16 IndexRegister,
2523         IN gcSL_FORMAT Format
2524         );
2525
2526 /*******************************************************************************
2527 **                                                 gcSHADER_AddSourceAttribute
2528 ********************************************************************************
2529 **
2530 **      Add an attribute as a source operand to a gcSHADER object.
2531 **
2532 **      INPUT:
2533 **
2534 **              gcSHADER Shader
2535 **                      Pointer to a gcSHADER object.
2536 **
2537 **              gcATTRIBUTE Attribute
2538 **                      Pointer to a gcATTRIBUTE object.
2539 **
2540 **              gctUINT8 Swizzle
2541 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2542 **
2543 **              gctINT Index
2544 **                      Static index into the attribute in case the attribute is a matrix
2545 **                      or array.
2546 **
2547 **      OUTPUT:
2548 **
2549 **              Nothing.
2550 */
2551 gceSTATUS
2552 gcSHADER_AddSourceAttribute(
2553         IN gcSHADER Shader,
2554         IN gcATTRIBUTE Attribute,
2555         IN gctUINT8 Swizzle,
2556         IN gctINT Index
2557         );
2558
2559 /*******************************************************************************
2560 **                                                 gcSHADER_AddSourceAttributeIndexed
2561 ********************************************************************************
2562 **
2563 **      Add an indexed attribute as a source operand to a gcSHADER object.
2564 **
2565 **      INPUT:
2566 **
2567 **              gcSHADER Shader
2568 **                      Pointer to a gcSHADER object.
2569 **
2570 **              gcATTRIBUTE Attribute
2571 **                      Pointer to a gcATTRIBUTE object.
2572 **
2573 **              gctUINT8 Swizzle
2574 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2575 **
2576 **              gctINT Index
2577 **                      Static index into the attribute in case the attribute is a matrix
2578 **                      or array.
2579 **
2580 **              gcSL_INDEXED Mode
2581 **                      Addressing mode of the dynamic index.
2582 **
2583 **              gctUINT16 IndexRegister
2584 **                      Temporary register index that holds the dynamic index.
2585 **
2586 **      OUTPUT:
2587 **
2588 **              Nothing.
2589 */
2590 gceSTATUS
2591 gcSHADER_AddSourceAttributeIndexed(
2592         IN gcSHADER Shader,
2593         IN gcATTRIBUTE Attribute,
2594         IN gctUINT8 Swizzle,
2595         IN gctINT Index,
2596         IN gcSL_INDEXED Mode,
2597         IN gctUINT16 IndexRegister
2598         );
2599
2600 /*******************************************************************************
2601 **                                                      gcSHADER_AddSourceUniform
2602 ********************************************************************************
2603 **
2604 **      Add a uniform as a source operand to a gcSHADER object.
2605 **
2606 **      INPUT:
2607 **
2608 **              gcSHADER Shader
2609 **                      Pointer to a gcSHADER object.
2610 **
2611 **              gcUNIFORM Uniform
2612 **                      Pointer to a gcUNIFORM object.
2613 **
2614 **              gctUINT8 Swizzle
2615 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2616 **
2617 **              gctINT Index
2618 **                      Static index into the uniform in case the uniform is a matrix or
2619 **                      array.
2620 **
2621 **      OUTPUT:
2622 **
2623 **              Nothing.
2624 */
2625 gceSTATUS
2626 gcSHADER_AddSourceUniform(
2627         IN gcSHADER Shader,
2628         IN gcUNIFORM Uniform,
2629         IN gctUINT8 Swizzle,
2630         IN gctINT Index
2631         );
2632
2633 /*******************************************************************************
2634 **                                              gcSHADER_AddSourceUniformIndexed
2635 ********************************************************************************
2636 **
2637 **      Add an indexed uniform as a source operand to a gcSHADER object.
2638 **
2639 **      INPUT:
2640 **
2641 **              gcSHADER Shader
2642 **                      Pointer to a gcSHADER object.
2643 **
2644 **              gcUNIFORM Uniform
2645 **                      Pointer to a gcUNIFORM object.
2646 **
2647 **              gctUINT8 Swizzle
2648 **                      x, y, z, and w swizzle values packed into one 8-bit value.
2649 **
2650 **              gctINT Index
2651 **                      Static index into the uniform in case the uniform is a matrix or
2652 **                      array.
2653 **
2654 **              gcSL_INDEXED Mode
2655 **                      Addressing mode of the dynamic index.
2656 **
2657 **              gctUINT16 IndexRegister
2658 **                      Temporary register index that holds the dynamic index.
2659 **
2660 **      OUTPUT:
2661 **
2662 **              Nothing.
2663 */
2664 gceSTATUS
2665 gcSHADER_AddSourceUniformIndexed(
2666         IN gcSHADER Shader,
2667         IN gcUNIFORM Uniform,
2668         IN gctUINT8 Swizzle,
2669         IN gctINT Index,
2670         IN gcSL_INDEXED Mode,
2671         IN gctUINT16 IndexRegister
2672         );
2673
2674 gceSTATUS
2675 gcSHADER_AddSourceSamplerIndexed(
2676         IN gcSHADER Shader,
2677         IN gctUINT8 Swizzle,
2678         IN gcSL_INDEXED Mode,
2679         IN gctUINT16 IndexRegister
2680         );
2681
2682 gceSTATUS
2683 gcSHADER_AddSourceAttributeFormatted(
2684     IN gcSHADER Shader,
2685     IN gcATTRIBUTE Attribute,
2686     IN gctUINT8 Swizzle,
2687     IN gctINT Index,
2688     IN gcSL_FORMAT Format
2689     );
2690
2691 gceSTATUS
2692 gcSHADER_AddSourceAttributeIndexedFormatted(
2693     IN gcSHADER Shader,
2694     IN gcATTRIBUTE Attribute,
2695     IN gctUINT8 Swizzle,
2696     IN gctINT Index,
2697     IN gcSL_INDEXED Mode,
2698     IN gctUINT16 IndexRegister,
2699     IN gcSL_FORMAT Format
2700     );
2701
2702 gceSTATUS
2703 gcSHADER_AddSourceUniformFormatted(
2704     IN gcSHADER Shader,
2705     IN gcUNIFORM Uniform,
2706     IN gctUINT8 Swizzle,
2707     IN gctINT Index,
2708     IN gcSL_FORMAT Format
2709     );
2710
2711 gceSTATUS
2712 gcSHADER_AddSourceUniformIndexedFormatted(
2713     IN gcSHADER Shader,
2714     IN gcUNIFORM Uniform,
2715     IN gctUINT8 Swizzle,
2716     IN gctINT Index,
2717     IN gcSL_INDEXED Mode,
2718     IN gctUINT16 IndexRegister,
2719     IN gcSL_FORMAT Format
2720     );
2721
2722 gceSTATUS
2723 gcSHADER_AddSourceSamplerIndexedFormatted(
2724     IN gcSHADER Shader,
2725     IN gctUINT8 Swizzle,
2726     IN gcSL_INDEXED Mode,
2727     IN gctUINT16 IndexRegister,
2728     IN gcSL_FORMAT Format
2729     );
2730
2731 /*******************************************************************************
2732 **                                                 gcSHADER_AddSourceConstant
2733 ********************************************************************************
2734 **
2735 **      Add a constant floating point value as a source operand to a gcSHADER
2736 **      object.
2737 **
2738 **      INPUT:
2739 **
2740 **              gcSHADER Shader
2741 **                      Pointer to a gcSHADER object.
2742 **
2743 **              gctFLOAT Constant
2744 **                      Floating point constant.
2745 **
2746 **      OUTPUT:
2747 **
2748 **              Nothing.
2749 */
2750 gceSTATUS
2751 gcSHADER_AddSourceConstant(
2752         IN gcSHADER Shader,
2753         IN gctFLOAT Constant
2754         );
2755
2756 /*******************************************************************************
2757 **                                         gcSHADER_AddSourceConstantFormatted
2758 ********************************************************************************
2759 **
2760 **      Add a constant value as a source operand to a gcSHADER
2761 **      object.
2762 **
2763 **      INPUT:
2764 **
2765 **              gcSHADER Shader
2766 **                      Pointer to a gcSHADER object.
2767 **
2768 **              void * Constant
2769 **                      Pointer to constant.
2770 **
2771 **              gcSL_FORMAT Format
2772 **
2773 **      OUTPUT:
2774 **
2775 **              Nothing.
2776 */
2777 gceSTATUS
2778 gcSHADER_AddSourceConstantFormatted(
2779         IN gcSHADER Shader,
2780         IN void *Constant,
2781         IN gcSL_FORMAT Format
2782         );
2783
2784 /*******************************************************************************
2785 **                                                                gcSHADER_Pack
2786 ********************************************************************************
2787 **
2788 **      Pack a dynamically created gcSHADER object by trimming the allocated arrays
2789 **      and resolving all the labeling.
2790 **
2791 **      INPUT:
2792 **
2793 **              gcSHADER Shader
2794 **                      Pointer to a gcSHADER object.
2795 **
2796 **      OUTPUT:
2797 **
2798 **              Nothing.
2799 */
2800 gceSTATUS
2801 gcSHADER_Pack(
2802         IN gcSHADER Shader
2803         );
2804
2805 /*******************************************************************************
2806 **                                                              gcSHADER_SetOptimizationOption
2807 ********************************************************************************
2808 **
2809 **      Set optimization option of a gcSHADER object.
2810 **
2811 **      INPUT:
2812 **
2813 **              gcSHADER Shader
2814 **                      Pointer to a gcSHADER object.
2815 **
2816 **              gctUINT OptimizationOption
2817 **                      Optimization option.  Can be one of the following:
2818 **
2819 **                              0                                               - No optimization.
2820 **                              1                                               - Full optimization.
2821 **                              Other value                             - For optimizer testing.
2822 **
2823 **      OUTPUT:
2824 **
2825 **              Nothing.
2826 */
2827 gceSTATUS
2828 gcSHADER_SetOptimizationOption(
2829         IN gcSHADER Shader,
2830         IN gctUINT OptimizationOption
2831         );
2832
2833 /*******************************************************************************
2834 **  gcSHADER_ReallocateFunctions
2835 **
2836 **  Reallocate an array of pointers to gcFUNCTION objects.
2837 **
2838 **  INPUT:
2839 **
2840 **      gcSHADER Shader
2841 **          Pointer to a gcSHADER object.
2842 **
2843 **      gctSIZE_T Count
2844 **          Array count to reallocate.  'Count' must be at least 1.
2845 */
2846 gceSTATUS
2847 gcSHADER_ReallocateFunctions(
2848     IN gcSHADER Shader,
2849     IN gctSIZE_T Count
2850     );
2851
2852 gceSTATUS
2853 gcSHADER_AddFunction(
2854         IN gcSHADER Shader,
2855         IN gctCONST_STRING Name,
2856         OUT gcFUNCTION * Function
2857         );
2858
2859 gceSTATUS
2860 gcSHADER_ReallocateKernelFunctions(
2861     IN gcSHADER Shader,
2862     IN gctSIZE_T Count
2863     );
2864
2865 gceSTATUS
2866 gcSHADER_AddKernelFunction(
2867         IN gcSHADER Shader,
2868         IN gctCONST_STRING Name,
2869         OUT gcKERNEL_FUNCTION * KernelFunction
2870         );
2871
2872 gceSTATUS
2873 gcSHADER_BeginFunction(
2874         IN gcSHADER Shader,
2875         IN gcFUNCTION Function
2876         );
2877
2878 gceSTATUS
2879 gcSHADER_EndFunction(
2880         IN gcSHADER Shader,
2881         IN gcFUNCTION Function
2882         );
2883
2884 gceSTATUS
2885 gcSHADER_BeginKernelFunction(
2886         IN gcSHADER Shader,
2887         IN gcKERNEL_FUNCTION KernelFunction
2888         );
2889
2890 gceSTATUS
2891 gcSHADER_EndKernelFunction(
2892         IN gcSHADER Shader,
2893         IN gcKERNEL_FUNCTION KernelFunction,
2894         IN gctSIZE_T LocalMemorySize
2895         );
2896
2897 gceSTATUS
2898 gcSHADER_SetMaxKernelFunctionArgs(
2899     IN gcSHADER Shader,
2900     IN gctUINT32 MaxKernelFunctionArgs
2901     );
2902
2903 /*******************************************************************************
2904 **  gcSHADER_SetConstantMemorySize
2905 **
2906 **  Set the constant memory address space size of a gcSHADER object.
2907 **
2908 **  INPUT:
2909 **
2910 **      gcSHADER Shader
2911 **          Pointer to a gcSHADER object.
2912 **
2913 **      gctSIZE_T ConstantMemorySize
2914 **          Constant memory size in bytes
2915 **
2916 **      gctCHAR *ConstantMemoryBuffer
2917 **          Constant memory buffer
2918 */
2919 gceSTATUS
2920 gcSHADER_SetConstantMemorySize(
2921     IN gcSHADER Shader,
2922     IN gctSIZE_T ConstantMemorySize,
2923     IN gctCHAR * ConstantMemoryBuffer
2924     );
2925
2926 /*******************************************************************************
2927 **  gcSHADER_GetConstantMemorySize
2928 **
2929 **  Set the constant memory address space size of a gcSHADER object.
2930 **
2931 **  INPUT:
2932 **
2933 **      gcSHADER Shader
2934 **          Pointer to a gcSHADER object.
2935 **
2936 **  OUTPUT:
2937 **
2938 **      gctSIZE_T * ConstantMemorySize
2939 **          Pointer to a variable receiving constant memory size in bytes
2940 **
2941 **      gctCHAR **ConstantMemoryBuffer.
2942 **          Pointer to a variable for returned shader constant memory buffer.
2943 */
2944 gceSTATUS
2945 gcSHADER_GetConstantMemorySize(
2946     IN gcSHADER Shader,
2947     OUT gctSIZE_T * ConstantMemorySize,
2948     OUT gctCHAR ** ConstantMemoryBuffer
2949     );
2950
2951 /*******************************************************************************
2952 **  gcSHADER_SetPrivateMemorySize
2953 **
2954 **  Set the private memory address space size of a gcSHADER object.
2955 **
2956 **  INPUT:
2957 **
2958 **      gcSHADER Shader
2959 **          Pointer to a gcSHADER object.
2960 **
2961 **      gctSIZE_T PrivateMemorySize
2962 **          Private memory size in bytes
2963 */
2964 gceSTATUS
2965 gcSHADER_SetPrivateMemorySize(
2966     IN gcSHADER Shader,
2967     IN gctSIZE_T PrivateMemorySize
2968     );
2969
2970 /*******************************************************************************
2971 **  gcSHADER_GetPrivateMemorySize
2972 **
2973 **  Set the private memory address space size of a gcSHADER object.
2974 **
2975 **  INPUT:
2976 **
2977 **      gcSHADER Shader
2978 **          Pointer to a gcSHADER object.
2979 **
2980 **  OUTPUT:
2981 **
2982 **      gctSIZE_T * PrivateMemorySize
2983 **          Pointer to a variable receiving private memory size in bytes
2984 */
2985 gceSTATUS
2986 gcSHADER_GetPrivateMemorySize(
2987     IN gcSHADER Shader,
2988     OUT gctSIZE_T * PrivateMemorySize
2989     );
2990
2991 /*******************************************************************************
2992 **  gcSHADER_SetLocalMemorySize
2993 **
2994 **  Set the local memory address space size of a gcSHADER object.
2995 **
2996 **  INPUT:
2997 **
2998 **      gcSHADER Shader
2999 **          Pointer to a gcSHADER object.
3000 **
3001 **      gctSIZE_T LocalMemorySize
3002 **          Local memory size in bytes
3003 */
3004 gceSTATUS
3005 gcSHADER_SetLocalMemorySize(
3006     IN gcSHADER Shader,
3007     IN gctSIZE_T LocalMemorySize
3008     );
3009
3010 /*******************************************************************************
3011 **  gcSHADER_GetLocalMemorySize
3012 **
3013 **  Set the local memory address space size of a gcSHADER object.
3014 **
3015 **  INPUT:
3016 **
3017 **      gcSHADER Shader
3018 **          Pointer to a gcSHADER object.
3019 **
3020 **  OUTPUT:
3021 **
3022 **      gctSIZE_T * LocalMemorySize
3023 **          Pointer to a variable receiving lcoal memory size in bytes
3024 */
3025 gceSTATUS
3026 gcSHADER_GetLocalMemorySize(
3027     IN gcSHADER Shader,
3028     OUT gctSIZE_T * LocalMemorySize
3029     );
3030
3031
3032 /*******************************************************************************
3033 **  gcSHADER_CheckValidity
3034 **
3035 **  Check validity for a gcSHADER object.
3036 **
3037 **  INPUT:
3038 **
3039 **      gcSHADER Shader
3040 **          Pointer to a gcSHADER object.
3041 **
3042 */
3043 gceSTATUS
3044 gcSHADER_CheckValidity(
3045     IN gcSHADER Shader
3046     );
3047
3048 #if gcdUSE_WCLIP_PATCH
3049 gceSTATUS
3050 gcATTRIBUTE_IsPosition(
3051         IN gcATTRIBUTE Attribute,
3052         OUT gctBOOL * IsPosition
3053         );
3054 #endif
3055
3056 /*******************************************************************************
3057 **                             gcATTRIBUTE_GetType
3058 ********************************************************************************
3059 **
3060 **      Get the type and array length of a gcATTRIBUTE object.
3061 **
3062 **      INPUT:
3063 **
3064 **              gcATTRIBUTE Attribute
3065 **                      Pointer to a gcATTRIBUTE object.
3066 **
3067 **      OUTPUT:
3068 **
3069 **              gcSHADER_TYPE * Type
3070 **                      Pointer to a variable receiving the type of the attribute.  'Type'
3071 **                      can be gcvNULL, in which case no type will be returned.
3072 **
3073 **              gctSIZE_T * ArrayLength
3074 **                      Pointer to a variable receiving the length of the array if the
3075 **                      attribute was declared as an array.  If the attribute was not
3076 **                      declared as an array, the array length will be 1.  'ArrayLength' can
3077 **                      be gcvNULL, in which case no array length will be returned.
3078 */
3079 gceSTATUS
3080 gcATTRIBUTE_GetType(
3081         IN gcATTRIBUTE Attribute,
3082         OUT gcSHADER_TYPE * Type,
3083         OUT gctSIZE_T * ArrayLength
3084         );
3085
3086 /*******************************************************************************
3087 **                            gcATTRIBUTE_GetName
3088 ********************************************************************************
3089 **
3090 **      Get the name of a gcATTRIBUTE object.
3091 **
3092 **      INPUT:
3093 **
3094 **              gcATTRIBUTE Attribute
3095 **                      Pointer to a gcATTRIBUTE object.
3096 **
3097 **      OUTPUT:
3098 **
3099 **              gctSIZE_T * Length
3100 **                      Pointer to a variable receiving the length of the attribute name.
3101 **                      'Length' can be gcvNULL, in which case no length will be returned.
3102 **
3103 **              gctCONST_STRING * Name
3104 **                      Pointer to a variable receiving the pointer to the attribute name.
3105 **                      'Name' can be gcvNULL, in which case no name will be returned.
3106 */
3107 gceSTATUS
3108 gcATTRIBUTE_GetName(
3109         IN gcATTRIBUTE Attribute,
3110         OUT gctSIZE_T * Length,
3111         OUT gctCONST_STRING * Name
3112         );
3113
3114 /*******************************************************************************
3115 **                            gcATTRIBUTE_IsEnabled
3116 ********************************************************************************
3117 **
3118 **      Query the enabled state of a gcATTRIBUTE object.
3119 **
3120 **      INPUT:
3121 **
3122 **              gcATTRIBUTE Attribute
3123 **                      Pointer to a gcATTRIBUTE object.
3124 **
3125 **      OUTPUT:
3126 **
3127 **              gctBOOL * Enabled
3128 **                      Pointer to a variable receiving the enabled state of the attribute.
3129 */
3130 gceSTATUS
3131 gcATTRIBUTE_IsEnabled(
3132         IN gcATTRIBUTE Attribute,
3133         OUT gctBOOL * Enabled
3134         );
3135
3136 /*******************************************************************************
3137 **                              gcUNIFORM_GetType
3138 ********************************************************************************
3139 **
3140 **      Get the type and array length of a gcUNIFORM object.
3141 **
3142 **      INPUT:
3143 **
3144 **              gcUNIFORM Uniform
3145 **                      Pointer to a gcUNIFORM object.
3146 **
3147 **      OUTPUT:
3148 **
3149 **              gcSHADER_TYPE * Type
3150 **                      Pointer to a variable receiving the type of the uniform.  'Type' can
3151 **                      be gcvNULL, in which case no type will be returned.
3152 **
3153 **              gctSIZE_T * ArrayLength
3154 **                      Pointer to a variable receiving the length of the array if the
3155 **                      uniform was declared as an array.  If the uniform was not declared
3156 **                      as an array, the array length will be 1.  'ArrayLength' can be gcvNULL,
3157 **                      in which case no array length will be returned.
3158 */
3159 gceSTATUS
3160 gcUNIFORM_GetType(
3161         IN gcUNIFORM Uniform,
3162         OUT gcSHADER_TYPE * Type,
3163         OUT gctSIZE_T * ArrayLength
3164         );
3165
3166 /*******************************************************************************
3167 **                              gcUNIFORM_GetTypeEx
3168 ********************************************************************************
3169 **
3170 **      Get the type and array length of a gcUNIFORM object.
3171 **
3172 **      INPUT:
3173 **
3174 **              gcUNIFORM Uniform
3175 **                      Pointer to a gcUNIFORM object.
3176 **
3177 **      OUTPUT:
3178 **
3179 **              gcSHADER_TYPE * Type
3180 **                      Pointer to a variable receiving the type of the uniform.  'Type' can
3181 **                      be gcvNULL, in which case no type will be returned.
3182 **
3183 **              gcSHADER_PRECISION * Precision
3184 **                      Pointer to a variable receiving the precision of the uniform.  'Precision' can
3185 **                      be gcvNULL, in which case no type will be returned.
3186 **
3187 **              gctSIZE_T * ArrayLength
3188 **                      Pointer to a variable receiving the length of the array if the
3189 **                      uniform was declared as an array.  If the uniform was not declared
3190 **                      as an array, the array length will be 1.  'ArrayLength' can be gcvNULL,
3191 **                      in which case no array length will be returned.
3192 */
3193 gceSTATUS
3194 gcUNIFORM_GetTypeEx(
3195         IN gcUNIFORM Uniform,
3196         OUT gcSHADER_TYPE * Type,
3197     OUT gcSHADER_PRECISION * Precision,
3198         OUT gctSIZE_T * ArrayLength
3199         );
3200
3201 /*******************************************************************************
3202 **                              gcUNIFORM_GetFlags
3203 ********************************************************************************
3204 **
3205 **      Get the flags of a gcUNIFORM object.
3206 **
3207 **      INPUT:
3208 **
3209 **              gcUNIFORM Uniform
3210 **                      Pointer to a gcUNIFORM object.
3211 **
3212 **      OUTPUT:
3213 **
3214 **              gceUNIFORM_FLAGS * Flags
3215 **                      Pointer to a variable receiving the flags of the uniform.
3216 **
3217 */
3218 gceSTATUS
3219 gcUNIFORM_GetFlags(
3220         IN gcUNIFORM Uniform,
3221         OUT gceUNIFORM_FLAGS * Flags
3222         );
3223
3224 /*******************************************************************************
3225 **                              gcUNIFORM_SetFlags
3226 ********************************************************************************
3227 **
3228 **      Set the flags of a gcUNIFORM object.
3229 **
3230 **      INPUT:
3231 **
3232 **              gcUNIFORM Uniform
3233 **                      Pointer to a gcUNIFORM object.
3234 **
3235 **              gceUNIFORM_FLAGS Flags
3236 **                      Flags of the uniform to be set.
3237 **
3238 **      OUTPUT:
3239 **                      Nothing.
3240 **
3241 */
3242 gceSTATUS
3243 gcUNIFORM_SetFlags(
3244         IN gcUNIFORM Uniform,
3245         IN gceUNIFORM_FLAGS Flags
3246         );
3247
3248 /*******************************************************************************
3249 **                              gcUNIFORM_GetName
3250 ********************************************************************************
3251 **
3252 **      Get the name of a gcUNIFORM object.
3253 **
3254 **      INPUT:
3255 **
3256 **              gcUNIFORM Uniform
3257 **                      Pointer to a gcUNIFORM object.
3258 **
3259 **      OUTPUT:
3260 **
3261 **              gctSIZE_T * Length
3262 **                      Pointer to a variable receiving the length of the uniform name.
3263 **                      'Length' can be gcvNULL, in which case no length will be returned.
3264 **
3265 **              gctCONST_STRING * Name
3266 **                      Pointer to a variable receiving the pointer to the uniform name.
3267 **                      'Name' can be gcvNULL, in which case no name will be returned.
3268 */
3269 gceSTATUS
3270 gcUNIFORM_GetName(
3271         IN gcUNIFORM Uniform,
3272         OUT gctSIZE_T * Length,
3273         OUT gctCONST_STRING * Name
3274         );
3275
3276 /*******************************************************************************
3277 **                              gcUNIFORM_GetSampler
3278 ********************************************************************************
3279 **
3280 **      Get the physical sampler number for a sampler gcUNIFORM object.
3281 **
3282 **      INPUT:
3283 **
3284 **              gcUNIFORM Uniform
3285 **                      Pointer to a gcUNIFORM object.
3286 **
3287 **      OUTPUT:
3288 **
3289 **              gctUINT32 * Sampler
3290 **                      Pointer to a variable receiving the physical sampler.
3291 */
3292 gceSTATUS
3293 gcUNIFORM_GetSampler(
3294         IN gcUNIFORM Uniform,
3295         OUT gctUINT32 * Sampler
3296         );
3297
3298 /*******************************************************************************
3299 **  gcUNIFORM_GetFormat
3300 **
3301 **  Get the type and array length of a gcUNIFORM object.
3302 **
3303 **  INPUT:
3304 **
3305 **      gcUNIFORM Uniform
3306 **          Pointer to a gcUNIFORM object.
3307 **
3308 **  OUTPUT:
3309 **
3310 **      gcSL_FORMAT * Format
3311 **          Pointer to a variable receiving the format of element of the uniform.
3312 **          'Type' can be gcvNULL, in which case no type will be returned.
3313 **
3314 **      gctBOOL * IsPointer
3315 **          Pointer to a variable receiving the state wheter the uniform is a pointer.
3316 **          'IsPointer' can be gcvNULL, in which case no array length will be returned.
3317 */
3318 gceSTATUS
3319 gcUNIFORM_GetFormat(
3320     IN gcUNIFORM Uniform,
3321     OUT gcSL_FORMAT * Format,
3322     OUT gctBOOL * IsPointer
3323     );
3324
3325 /*******************************************************************************
3326 **  gcUNIFORM_SetFormat
3327 **
3328 **  Set the format and isPointer of a uniform.
3329 **
3330 **  INPUT:
3331 **
3332 **      gcUNIFORM Uniform
3333 **          Pointer to a gcUNIFORM object.
3334 **
3335 **      gcSL_FORMAT Format
3336 **          Format of element of the uniform shaderType.
3337 **
3338 **      gctBOOL IsPointer
3339 **          Wheter the uniform is a pointer.
3340 **
3341 **  OUTPUT:
3342 **
3343 **      Nothing.
3344 */
3345 gceSTATUS
3346 gcUNIFORM_SetFormat(
3347     IN gcUNIFORM Uniform,
3348     IN gcSL_FORMAT Format,
3349     IN gctBOOL IsPointer
3350     );
3351
3352 /*******************************************************************************
3353 **                                                         gcUNIFORM_SetValue
3354 ********************************************************************************
3355 **
3356 **      Set the value of a uniform in integer.
3357 **
3358 **      INPUT:
3359 **
3360 **              gcUNIFORM Uniform
3361 **                      Pointer to a gcUNIFORM object.
3362 **
3363 **              gctSIZE_T Count
3364 **                      Number of entries to program if the uniform has been declared as an
3365 **                      array.
3366 **
3367 **              const gctINT * Value
3368 **                      Pointer to a buffer holding the integer values for the uniform.
3369 **
3370 **      OUTPUT:
3371 **
3372 **              Nothing.
3373 */
3374 gceSTATUS
3375 gcUNIFORM_SetValue(
3376         IN gcUNIFORM Uniform,
3377         IN gctSIZE_T Count,
3378         IN const gctINT * Value
3379         );
3380
3381 /*******************************************************************************
3382 **                                                         gcUNIFORM_SetValueX
3383 ********************************************************************************
3384 **
3385 **      Set the value of a uniform in fixed point.
3386 **
3387 **      INPUT:
3388 **
3389 **              gcUNIFORM Uniform
3390 **                      Pointer to a gcUNIFORM object.
3391 **
3392 **              gctSIZE_T Count
3393 **                      Number of entries to program if the uniform has been declared as an
3394 **                      array.
3395 **
3396 **              const gctFIXED_POINT * Value
3397 **                      Pointer to a buffer holding the fixed point values for the uniform.
3398 **
3399 **      OUTPUT:
3400 **
3401 **              Nothing.
3402 */
3403 gceSTATUS
3404 gcUNIFORM_SetValueX(
3405         IN gcUNIFORM Uniform,
3406         IN gctSIZE_T Count,
3407         IN gctFIXED_POINT * Value
3408         );
3409
3410 /*******************************************************************************
3411 **                                                         gcUNIFORM_SetValueF
3412 ********************************************************************************
3413 **
3414 **      Set the value of a uniform in floating point.
3415 **
3416 **      INPUT:
3417 **
3418 **              gcUNIFORM Uniform
3419 **                      Pointer to a gcUNIFORM object.
3420 **
3421 **              gctSIZE_T Count
3422 **                      Number of entries to program if the uniform has been declared as an
3423 **                      array.
3424 **
3425 **              const gctFLOAT * Value
3426 **                      Pointer to a buffer holding the floating point values for the
3427 **                      uniform.
3428 **
3429 **      OUTPUT:
3430 **
3431 **              Nothing.
3432 */
3433 gceSTATUS
3434 gcUNIFORM_SetValueF(
3435         IN gcUNIFORM Uniform,
3436         IN gctSIZE_T Count,
3437         IN const gctFLOAT * Value
3438         );
3439
3440 /*******************************************************************************
3441 **                                               gcUNIFORM_GetModelViewProjMatrix
3442 ********************************************************************************
3443 **
3444 **      Get the value of uniform modelViewProjMatrix ID if present.
3445 **
3446 **      INPUT:
3447 **
3448 **              gcUNIFORM Uniform
3449 **                      Pointer to a gcUNIFORM object.
3450 **
3451 **      OUTPUT:
3452 **
3453 **              Nothing.
3454 */
3455 gctUINT
3456 gcUNIFORM_GetModelViewProjMatrix(
3457     IN gcUNIFORM Uniform
3458     );
3459
3460 /*******************************************************************************
3461 **                                                              gcOUTPUT_GetType
3462 ********************************************************************************
3463 **
3464 **      Get the type and array length of a gcOUTPUT object.
3465 **
3466 **      INPUT:
3467 **
3468 **              gcOUTPUT Output
3469 **                      Pointer to a gcOUTPUT object.
3470 **
3471 **      OUTPUT:
3472 **
3473 **              gcSHADER_TYPE * Type
3474 **                      Pointer to a variable receiving the type of the output.  'Type' can
3475 **                      be gcvNULL, in which case no type will be returned.
3476 **
3477 **              gctSIZE_T * ArrayLength
3478 **                      Pointer to a variable receiving the length of the array if the
3479 **                      output was declared as an array.  If the output was not declared
3480 **                      as an array, the array length will be 1.  'ArrayLength' can be gcvNULL,
3481 **                      in which case no array length will be returned.
3482 */
3483 gceSTATUS
3484 gcOUTPUT_GetType(
3485         IN gcOUTPUT Output,
3486         OUT gcSHADER_TYPE * Type,
3487         OUT gctSIZE_T * ArrayLength
3488         );
3489
3490 /*******************************************************************************
3491 **                                                         gcOUTPUT_GetIndex
3492 ********************************************************************************
3493 **
3494 **      Get the index of a gcOUTPUT object.
3495 **
3496 **      INPUT:
3497 **
3498 **              gcOUTPUT Output
3499 **                      Pointer to a gcOUTPUT object.
3500 **
3501 **      OUTPUT:
3502 **
3503 **              gctUINT * Index
3504 **                      Pointer to a variable receiving the temporary register index of the
3505 **                      output.  'Index' can be gcvNULL,. in which case no index will be
3506 **                      returned.
3507 */
3508 gceSTATUS
3509 gcOUTPUT_GetIndex(
3510         IN gcOUTPUT Output,
3511         OUT gctUINT * Index
3512         );
3513
3514 /*******************************************************************************
3515 **                                                              gcOUTPUT_GetName
3516 ********************************************************************************
3517 **
3518 **      Get the name of a gcOUTPUT object.
3519 **
3520 **      INPUT:
3521 **
3522 **              gcOUTPUT Output
3523 **                      Pointer to a gcOUTPUT object.
3524 **
3525 **      OUTPUT:
3526 **
3527 **              gctSIZE_T * Length
3528 **                      Pointer to a variable receiving the length of the output name.
3529 **                      'Length' can be gcvNULL, in which case no length will be returned.
3530 **
3531 **              gctCONST_STRING * Name
3532 **                      Pointer to a variable receiving the pointer to the output name.
3533 **                      'Name' can be gcvNULL, in which case no name will be returned.
3534 */
3535 gceSTATUS
3536 gcOUTPUT_GetName(
3537         IN gcOUTPUT Output,
3538         OUT gctSIZE_T * Length,
3539         OUT gctCONST_STRING * Name
3540         );
3541
3542 /*******************************************************************************
3543 *********************************************************** F U N C T I O N S **
3544 *******************************************************************************/
3545
3546 /*******************************************************************************
3547 **  gcFUNCTION_ReallocateArguments
3548 **
3549 **  Reallocate an array of gcsFUNCTION_ARGUMENT objects.
3550 **
3551 **  INPUT:
3552 **
3553 **      gcFUNCTION Function
3554 **          Pointer to a gcFUNCTION object.
3555 **
3556 **      gctSIZE_T Count
3557 **          Array count to reallocate.  'Count' must be at least 1.
3558 */
3559 gceSTATUS
3560 gcFUNCTION_ReallocateArguments(
3561     IN gcFUNCTION Function,
3562     IN gctSIZE_T Count
3563     );
3564
3565 gceSTATUS
3566 gcFUNCTION_AddArgument(
3567         IN gcFUNCTION Function,
3568         IN gctUINT16 TempIndex,
3569         IN gctUINT8 Enable,
3570         IN gctUINT8 Qualifier
3571         );
3572
3573 gceSTATUS
3574 gcFUNCTION_GetArgument(
3575         IN gcFUNCTION Function,
3576         IN gctUINT16 Index,
3577         OUT gctUINT16_PTR Temp,
3578         OUT gctUINT8_PTR Enable,
3579         OUT gctUINT8_PTR Swizzle
3580         );
3581
3582 gceSTATUS
3583 gcFUNCTION_GetLabel(
3584         IN gcFUNCTION Function,
3585         OUT gctUINT_PTR Label
3586         );
3587
3588 /*******************************************************************************
3589 ************************* K E R N E L    P R O P E R T Y    F U N C T I O N S **
3590 *******************************************************************************/
3591 /*******************************************************************************/
3592 gceSTATUS
3593 gcKERNEL_FUNCTION_AddKernelFunctionProperties(
3594             IN gcKERNEL_FUNCTION KernelFunction,
3595                 IN gctINT propertyType,
3596                 IN gctSIZE_T propertySize,
3597                 IN gctINT * values
3598                 );
3599
3600 gceSTATUS
3601 gcKERNEL_FUNCTION_GetPropertyCount(
3602     IN gcKERNEL_FUNCTION KernelFunction,
3603     OUT gctSIZE_T * Count
3604     );
3605
3606 gceSTATUS
3607 gcKERNEL_FUNCTION_GetProperty(
3608     IN gcKERNEL_FUNCTION KernelFunction,
3609     IN gctUINT Index,
3610         OUT gctSIZE_T * propertySize,
3611         OUT gctINT * propertyType,
3612         OUT gctINT * propertyValues
3613     );
3614
3615
3616 /*******************************************************************************
3617 *******************************I M A G E   S A M P L E R    F U N C T I O N S **
3618 *******************************************************************************/
3619 /*******************************************************************************
3620 **  gcKERNEL_FUNCTION_ReallocateImageSamplers
3621 **
3622 **  Reallocate an array of pointers to image sampler pair.
3623 **
3624 **  INPUT:
3625 **
3626 **      gcKERNEL_FUNCTION KernelFunction
3627 **          Pointer to a gcKERNEL_FUNCTION object.
3628 **
3629 **      gctSIZE_T Count
3630 **          Array count to reallocate.  'Count' must be at least 1.
3631 */
3632 gceSTATUS
3633 gcKERNEL_FUNCTION_ReallocateImageSamplers(
3634     IN gcKERNEL_FUNCTION KernelFunction,
3635     IN gctSIZE_T Count
3636     );
3637
3638 gceSTATUS
3639 gcKERNEL_FUNCTION_AddImageSampler(
3640     IN gcKERNEL_FUNCTION KernelFunction,
3641     IN gctUINT8 ImageNum,
3642     IN gctBOOL IsConstantSamplerType,
3643     IN gctUINT32 SamplerType
3644     );
3645
3646 gceSTATUS
3647 gcKERNEL_FUNCTION_GetImageSamplerCount(
3648     IN gcKERNEL_FUNCTION KernelFunction,
3649     OUT gctSIZE_T * Count
3650     );
3651
3652 gceSTATUS
3653 gcKERNEL_FUNCTION_GetImageSampler(
3654     IN gcKERNEL_FUNCTION KernelFunction,
3655     IN gctUINT Index,
3656     OUT gctUINT8 *ImageNum,
3657     OUT gctBOOL *IsConstantSamplerType,
3658     OUT gctUINT32 *SamplerType
3659     );
3660
3661 /*******************************************************************************
3662 *********************************************K E R N E L    F U N C T I O N S **
3663 *******************************************************************************/
3664
3665 /*******************************************************************************
3666 **  gcKERNEL_FUNCTION_ReallocateArguments
3667 **
3668 **  Reallocate an array of gcsFUNCTION_ARGUMENT objects.
3669 **
3670 **  INPUT:
3671 **
3672 **      gcKERNEL_FUNCTION Function
3673 **          Pointer to a gcKERNEL_FUNCTION object.
3674 **
3675 **      gctSIZE_T Count
3676 **          Array count to reallocate.  'Count' must be at least 1.
3677 */
3678 gceSTATUS
3679 gcKERNEL_FUNCTION_ReallocateArguments(
3680     IN gcKERNEL_FUNCTION Function,
3681     IN gctSIZE_T Count
3682     );
3683
3684 gceSTATUS
3685 gcKERNEL_FUNCTION_AddArgument(
3686         IN gcKERNEL_FUNCTION Function,
3687         IN gctUINT16 TempIndex,
3688         IN gctUINT8 Enable,
3689         IN gctUINT8 Qualifier
3690         );
3691
3692 gceSTATUS
3693 gcKERNEL_FUNCTION_GetArgument(
3694         IN gcKERNEL_FUNCTION Function,
3695         IN gctUINT16 Index,
3696         OUT gctUINT16_PTR Temp,
3697         OUT gctUINT8_PTR Enable,
3698         OUT gctUINT8_PTR Swizzle
3699         );
3700
3701 gceSTATUS
3702 gcKERNEL_FUNCTION_GetLabel(
3703         IN gcKERNEL_FUNCTION Function,
3704         OUT gctUINT_PTR Label
3705         );
3706
3707 gceSTATUS
3708 gcKERNEL_FUNCTION_GetName(
3709     IN gcKERNEL_FUNCTION KernelFunction,
3710     OUT gctSIZE_T * Length,
3711     OUT gctCONST_STRING * Name
3712     );
3713
3714 gceSTATUS
3715 gcKERNEL_FUNCTION_ReallocateUniformArguments(
3716     IN gcKERNEL_FUNCTION KernelFunction,
3717     IN gctSIZE_T Count
3718     );
3719
3720 gceSTATUS
3721 gcKERNEL_FUNCTION_AddUniformArgument(
3722     IN gcKERNEL_FUNCTION KernelFunction,
3723     IN gctCONST_STRING Name,
3724     IN gcSHADER_TYPE Type,
3725     IN gctSIZE_T Length,
3726     OUT gcUNIFORM * UniformArgument
3727     );
3728
3729 gceSTATUS
3730 gcKERNEL_FUNCTION_GetUniformArgumentCount(
3731     IN gcKERNEL_FUNCTION KernelFunction,
3732     OUT gctSIZE_T * Count
3733     );
3734
3735 gceSTATUS
3736 gcKERNEL_FUNCTION_GetUniformArgument(
3737     IN gcKERNEL_FUNCTION KernelFunction,
3738     IN gctUINT Index,
3739     OUT gcUNIFORM * UniformArgument
3740     );
3741
3742 gceSTATUS
3743 gcKERNEL_FUNCTION_SetCodeEnd(
3744     IN gcKERNEL_FUNCTION KernelFunction
3745     );
3746
3747 /*******************************************************************************
3748 **                              gcCompileShader
3749 ********************************************************************************
3750 **
3751 **      Compile a shader.
3752 **
3753 **      INPUT:
3754 **
3755 **              gcoOS Hal
3756 **                      Pointer to an gcoHAL object.
3757 **
3758 **              gctINT ShaderType
3759 **                      Shader type to compile.  Can be one of the following values:
3760 **
3761 **                              gcSHADER_TYPE_VERTEX
3762 **                                      Compile a vertex shader.
3763 **
3764 **                              gcSHADER_TYPE_FRAGMENT
3765 **                                      Compile a fragment shader.
3766 **
3767 **              gctSIZE_T SourceSize
3768 **                      Size of the source buffer in bytes.
3769 **
3770 **              gctCONST_STRING Source
3771 **                      Pointer to the buffer containing the shader source code.
3772 **
3773 **      OUTPUT:
3774 **
3775 **              gcSHADER * Binary
3776 **                      Pointer to a variable receiving the pointer to a gcSHADER object
3777 **                      containg the compiled shader code.
3778 **
3779 **              gctSTRING * Log
3780 **                      Pointer to a variable receiving a string pointer containging the
3781 **                      compile log.
3782 */
3783 gceSTATUS
3784 gcCompileShader(
3785         IN gcoHAL Hal,
3786         IN gctINT ShaderType,
3787         IN gctSIZE_T SourceSize,
3788         IN gctCONST_STRING Source,
3789         OUT gcSHADER * Binary,
3790         OUT gctSTRING * Log
3791         );
3792
3793 /*******************************************************************************
3794 **                              gcOptimizeShader
3795 ********************************************************************************
3796 **
3797 **      Optimize a shader.
3798 **
3799 **      INPUT:
3800 **
3801 **              gcSHADER Shader
3802 **                      Pointer to a gcSHADER object holding information about the compiled
3803 **                      shader.
3804 **
3805 **              gctFILE LogFile
3806 **                      Pointer to an open FILE object.
3807 */
3808 gceSTATUS
3809 gcOptimizeShader(
3810         IN gcSHADER Shader,
3811         IN gctFILE LogFile
3812         );
3813
3814 /*******************************************************************************
3815 **                                gcLinkShaders
3816 ********************************************************************************
3817 **
3818 **      Link two shaders and generate a harwdare specific state buffer by compiling
3819 **      the compiler generated code through the resource allocator and code
3820 **      generator.
3821 **
3822 **      INPUT:
3823 **
3824 **              gcSHADER VertexShader
3825 **                      Pointer to a gcSHADER object holding information about the compiled
3826 **                      vertex shader.
3827 **
3828 **              gcSHADER FragmentShader
3829 **                      Pointer to a gcSHADER object holding information about the compiled
3830 **                      fragment shader.
3831 **
3832 **              gceSHADER_FLAGS Flags
3833 **                      Compiler flags.  Can be any of the following:
3834 **
3835 **                              gcvSHADER_DEAD_CODE       - Dead code elimination.
3836 **                              gcvSHADER_RESOURCE_USAGE  - Resource usage optimizaion.
3837 **                              gcvSHADER_OPTIMIZER       - Full optimization.
3838 **                              gcvSHADER_USE_GL_Z        - Use OpenGL ES Z coordinate.
3839 **                              gcvSHADER_USE_GL_POSITION - Use OpenGL ES gl_Position.
3840 **                              gcvSHADER_USE_GL_FACE     - Use OpenGL ES gl_FaceForward.
3841 **
3842 **      OUTPUT:
3843 **
3844 **              gctSIZE_T * StateBufferSize
3845 **                      Pointer to a variable receicing the number of bytes in the buffer
3846 **                      returned in 'StateBuffer'.
3847 **
3848 **              gctPOINTER * StateBuffer
3849 **                      Pointer to a variable receiving a buffer pointer that contains the
3850 **                      states required to download the shaders into the hardware.
3851 **
3852 **              gcsHINT_PTR * Hints
3853 **                      Pointer to a variable receiving a gcsHINT structure pointer that
3854 **                      contains information required when loading the shader states.
3855 */
3856 gceSTATUS
3857 gcLinkShaders(
3858         IN gcSHADER VertexShader,
3859         IN gcSHADER FragmentShader,
3860         IN gceSHADER_FLAGS Flags,
3861         OUT gctSIZE_T * StateBufferSize,
3862         OUT gctPOINTER * StateBuffer,
3863         OUT gcsHINT_PTR * Hints,
3864     OUT gcMACHINECODE_PTR *ppVsMachineCode,
3865     OUT gcMACHINECODE_PTR *ppFsMachineCode
3866         );
3867
3868 /*******************************************************************************
3869 **                                gcLoadShaders
3870 ********************************************************************************
3871 **
3872 **      Load a pre-compiled and pre-linked shader program into the hardware.
3873 **
3874 **      INPUT:
3875 **
3876 **              gcoHAL Hal
3877 **                      Pointer to a gcoHAL object.
3878 **
3879 **              gctSIZE_T StateBufferSize
3880 **                      The number of bytes in the 'StateBuffer'.
3881 **
3882 **              gctPOINTER StateBuffer
3883 **                      Pointer to the states that make up the shader program.
3884 **
3885 **              gcsHINT_PTR Hints
3886 **                      Pointer to a gcsHINT structure that contains information required
3887 **                      when loading the shader states.
3888 */
3889 gceSTATUS
3890 gcLoadShaders(
3891         IN gcoHAL Hal,
3892         IN gctSIZE_T StateBufferSize,
3893         IN gctPOINTER StateBuffer,
3894         IN gcsHINT_PTR Hints
3895         );
3896
3897 gceSTATUS
3898 gcRecompileShaders(
3899     IN gcoHAL Hal,
3900     IN gcMACHINECODE_PTR pVsMachineCode,
3901     IN gcMACHINECODE_PTR pPsMachineCode,
3902     /*Recompile variables*/
3903     IN OUT gctPOINTER *ppRecompileStateBuffer,
3904     IN OUT gctSIZE_T *pRecompileStateBufferSize,
3905     IN OUT gcsHINT_PTR *ppRecompileHints,
3906     /* natvie state*/
3907     IN gctPOINTER pNativeStateBuffer,
3908     IN gctSIZE_T nativeStateBufferSize,
3909     IN gcsHINT_PTR pNativeHints,
3910     /* npt info */
3911     IN gctUINT32 Samplers,
3912     IN gctUINT32 *SamplerWrapS,
3913     IN gctUINT32 *SamplerWrapT
3914     );
3915 /*******************************************************************************
3916 **                                gcSaveProgram
3917 ********************************************************************************
3918 **
3919 **      Save pre-compiled shaders and pre-linked programs to a binary file.
3920 **
3921 **      INPUT:
3922 **
3923 **              gcSHADER VertexShader
3924 **                      Pointer to vertex shader object.
3925 **
3926 **              gcSHADER FragmentShader
3927 **                      Pointer to fragment shader object.
3928 **
3929 **              gctSIZE_T ProgramBufferSize
3930 **                      Number of bytes in 'ProgramBuffer'.
3931 **
3932 **              gctPOINTER ProgramBuffer
3933 **                      Pointer to buffer containing the program states.
3934 **
3935 **              gcsHINT_PTR Hints
3936 **                      Pointer to HINTS structure for program states.
3937 **
3938 **      OUTPUT:
3939 **
3940 **              gctPOINTER * Binary
3941 **                      Pointer to a variable receiving the binary data to be saved.
3942 **
3943 **              gctSIZE_T * BinarySize
3944 **                      Pointer to a variable receiving the number of bytes inside 'Binary'.
3945 */
3946 gceSTATUS
3947 gcSaveProgram(
3948         IN gcSHADER VertexShader,
3949         IN gcSHADER FragmentShader,
3950         IN gctSIZE_T ProgramBufferSize,
3951         IN gctPOINTER ProgramBuffer,
3952         IN gcsHINT_PTR Hints,
3953         OUT gctPOINTER * Binary,
3954         OUT gctSIZE_T * BinarySize
3955         );
3956
3957 /*******************************************************************************
3958 **                                gcLoadProgram
3959 ********************************************************************************
3960 **
3961 **      Load pre-compiled shaders and pre-linked programs from a binary file.
3962 **
3963 **      INPUT:
3964 **
3965 **              gctPOINTER Binary
3966 **                      Pointer to the binary data loaded.
3967 **
3968 **              gctSIZE_T BinarySize
3969 **                      Number of bytes in 'Binary'.
3970 **
3971 **      OUTPUT:
3972 **
3973 **              gcSHADER VertexShader
3974 **                      Pointer to a vertex shader object.
3975 **
3976 **              gcSHADER FragmentShader
3977 **                      Pointer to a fragment shader object.
3978 **
3979 **              gctSIZE_T * ProgramBufferSize
3980 **                      Pointer to a variable receicing the number of bytes in the buffer
3981 **                      returned in 'ProgramBuffer'.
3982 **
3983 **              gctPOINTER * ProgramBuffer
3984 **                      Pointer to a variable receiving a buffer pointer that contains the
3985 **                      states required to download the shaders into the hardware.
3986 **
3987 **              gcsHINT_PTR * Hints
3988 **                      Pointer to a variable receiving a gcsHINT structure pointer that
3989 **                      contains information required when loading the shader states.
3990 */
3991 gceSTATUS
3992 gcLoadProgram(
3993         IN gctPOINTER Binary,
3994         IN gctSIZE_T BinarySize,
3995         OUT gcSHADER VertexShader,
3996         OUT gcSHADER FragmentShader,
3997         OUT gctSIZE_T * ProgramBufferSize,
3998         OUT gctPOINTER * ProgramBuffer,
3999         OUT gcsHINT_PTR * Hints
4000         );
4001
4002 /*******************************************************************************
4003 **                              gcCompileKernel
4004 ********************************************************************************
4005 **
4006 **      Compile a OpenCL kernel shader.
4007 **
4008 **      INPUT:
4009 **
4010 **              gcoOS Hal
4011 **                      Pointer to an gcoHAL object.
4012 **
4013 **              gctSIZE_T SourceSize
4014 **                      Size of the source buffer in bytes.
4015 **
4016 **              gctCONST_STRING Source
4017 **                      Pointer to the buffer containing the shader source code.
4018 **
4019 **      OUTPUT:
4020 **
4021 **              gcSHADER * Binary
4022 **                      Pointer to a variable receiving the pointer to a gcSHADER object
4023 **                      containg the compiled shader code.
4024 **
4025 **              gctSTRING * Log
4026 **                      Pointer to a variable receiving a string pointer containging the
4027 **                      compile log.
4028 */
4029 gceSTATUS
4030 gcCompileKernel(
4031         IN gcoHAL Hal,
4032         IN gctSIZE_T SourceSize,
4033         IN gctCONST_STRING Source,
4034         IN gctCONST_STRING Options,
4035         OUT gcSHADER * Binary,
4036         OUT gctSTRING * Log
4037         );
4038
4039 /*******************************************************************************
4040 **                                gcLinkKernel
4041 ********************************************************************************
4042 **
4043 **      Link OpenCL kernel and generate a harwdare specific state buffer by compiling
4044 **      the compiler generated code through the resource allocator and code
4045 **      generator.
4046 **
4047 **      INPUT:
4048 **
4049 **              gcSHADER Kernel
4050 **                      Pointer to a gcSHADER object holding information about the compiled
4051 **                      OpenCL kernel.
4052 **
4053 **              gceSHADER_FLAGS Flags
4054 **                      Compiler flags.  Can be any of the following:
4055 **
4056 **                              gcvSHADER_DEAD_CODE       - Dead code elimination.
4057 **                              gcvSHADER_RESOURCE_USAGE  - Resource usage optimizaion.
4058 **                              gcvSHADER_OPTIMIZER       - Full optimization.
4059 **                              gcvSHADER_USE_GL_Z        - Use OpenGL ES Z coordinate.
4060 **                              gcvSHADER_USE_GL_POSITION - Use OpenGL ES gl_Position.
4061 **                              gcvSHADER_USE_GL_FACE     - Use OpenGL ES gl_FaceForward.
4062 **
4063 **      OUTPUT:
4064 **
4065 **              gctSIZE_T * StateBufferSize
4066 **                      Pointer to a variable receiving the number of bytes in the buffer
4067 **                      returned in 'StateBuffer'.
4068 **
4069 **              gctPOINTER * StateBuffer
4070 **                      Pointer to a variable receiving a buffer pointer that contains the
4071 **                      states required to download the shaders into the hardware.
4072 **
4073 **              gcsHINT_PTR * Hints
4074 **                      Pointer to a variable receiving a gcsHINT structure pointer that
4075 **                      contains information required when loading the shader states.
4076 */
4077 gceSTATUS
4078 gcLinkKernel(
4079         IN gcSHADER Kernel,
4080         IN gceSHADER_FLAGS Flags,
4081         OUT gctSIZE_T * StateBufferSize,
4082         OUT gctPOINTER * StateBuffer,
4083         OUT gcsHINT_PTR * Hints
4084         );
4085
4086 /*******************************************************************************
4087 **                                gcLoadKernel
4088 ********************************************************************************
4089 **
4090 **  Load a pre-compiled and pre-linked kernel program into the hardware.
4091 **
4092 **  INPUT:
4093 **
4094 **      gctSIZE_T StateBufferSize
4095 **          The number of bytes in the 'StateBuffer'.
4096 **
4097 **      gctPOINTER StateBuffer
4098 **          Pointer to the states that make up the shader program.
4099 **
4100 **      gcsHINT_PTR Hints
4101 **          Pointer to a gcsHINT structure that contains information required
4102 **          when loading the shader states.
4103 */
4104 gceSTATUS
4105 gcLoadKernel(
4106     IN gctSIZE_T StateBufferSize,
4107     IN gctPOINTER StateBuffer,
4108     IN gcsHINT_PTR Hints
4109     );
4110
4111 gceSTATUS
4112 gcInvokeThreadWalker(
4113     IN gcsTHREAD_WALKER_INFO_PTR Info
4114     );
4115
4116 void
4117 gcTYPE_GetTypeInfo(
4118     IN gcSHADER_TYPE      Type,
4119     OUT gctINT *          Components,
4120     OUT gctINT *          Rows,
4121     OUT gctCONST_STRING * Name
4122     );
4123
4124 gctBOOL
4125 gcOPT_doVaryingPackingForShader(
4126         IN gcSHADER Shader
4127     );
4128
4129 gceSTATUS
4130 gcSHADER_PatchNPOTForMachineCode(
4131     IN     gcSHADER_KIND          shaderType,
4132     IN     gcMACHINECODE_PTR      pMachineCode,
4133     IN     gcNPOT_PATCH_PARAM_PTR pPatchParam,
4134     IN     gctUINT                countOfPatchParam,
4135     IN     gctUINT                hwSupportedInstCount,
4136     OUT    gctPOINTER*            ppCmdBuffer,
4137     OUT    gctUINT32*             pByteSizeOfCmdBuffer,
4138     IN OUT gcsHINT_PTR            pHints /* User needs copy original hints to this one, then passed this one in */
4139     );
4140
4141 #ifdef __cplusplus
4142 }
4143 #endif
4144
4145 #endif /* VIVANTE_NO_3D */
4146 #endif /* __gc_hal_compiler_h_ */