1 /****************************************************************************
3 * Copyright (C) 2005 - 2013 by Vivante Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the license, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *****************************************************************************/
23 ** Include file the defines the front- and back-end compilers, as well as the
27 #ifndef __gc_hal_compiler_h_
28 #define __gc_hal_compiler_h_
31 #include "gc_hal_types.h"
32 #include "gc_hal_engine.h"
38 #ifndef GC_ENABLE_LOADTIME_OPT
39 #define GC_ENABLE_LOADTIME_OPT 1
42 #define TEMP_OPT_CONSTANT_TEXLD_COORD 1
44 #define TEMP_SHADER_PATCH 1
46 #define ADD_PRE_ROTATION_TO_VS 0
48 #define TEMP_INLINE_ALL_EXPANSION 1
49 /******************************* IR VERSION ******************/
50 #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1')
52 /******************************************************************************\
53 |******************************* SHADER LANGUAGE ******************************|
54 \******************************************************************************/
56 /* allocator/deallocator function pointer */
57 typedef gceSTATUS (*gctAllocatorFunc)(
59 OUT gctPOINTER * Memory
62 typedef gceSTATUS (*gctDeallocatorFunc)(
66 typedef gctBOOL (*compareFunc) (
71 typedef struct _gcsListNode gcsListNode;
78 typedef struct _gcsAllocator
80 gctAllocatorFunc allocate;
81 gctDeallocatorFunc deallocate;
84 /* simple map structure */
85 typedef struct _SimpleMap SimpleMap;
91 gcsAllocator *allocator;
95 /* SimpleMap Operations */
96 /* return -1 if not found, otherwise return the mapped value */
106 IN gcsAllocator * Allocator
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 :
112 * gcSimpleMap_AddNode(&theMap, key, val, allocator);
120 IN gcsAllocator * Allocator
123 /* gcsList data structure and related operations */
124 typedef struct _gcsList
129 gcsAllocator *allocator;
132 /* List operations */
136 IN gcsAllocator *allocator
142 IN gctAllocatorFunc Allocator,
143 OUT gcsListNode ** ListNode
156 IN compareFunc compare
168 IN gcsListNode * Node
171 /* link list structure for code list */
172 typedef gcsList gcsCodeList;
173 typedef gcsCodeList * gctCodeList;
174 typedef gcsListNode gcsCodeListNode;
176 /* Possible shader language opcodes. */
177 typedef enum _gcSL_OPCODE
190 gcSL_KILL, /* 0x0B */
191 gcSL_TEXLD, /* 0x0C */
192 gcSL_CALL, /* 0x0D */
194 gcSL_NORM, /* 0x0F */
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 */
212 gcSL_SIGN, /* 0x21 */
213 gcSL_STEP, /* 0x22 */
214 gcSL_SQRT, /* 0x23 */
215 gcSL_ACOS, /* 0x24 */
216 gcSL_ASIN, /* 0x25 */
217 gcSL_ATAN, /* 0x26 */
221 gcSL_FWIDTH, /* 0x2A */
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. */
271 gcSL_ADDSAT, /* 0x5C */ /* Integer only. */
272 gcSL_SUBSAT, /* 0x5D */ /* Integer only. */
273 gcSL_MULSAT, /* 0x5E */ /* Integer only. */
278 typedef enum _gcSL_FORMAT
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 */
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. */
299 /* Destination write enable bits. */
300 typedef enum _gcSL_ENABLE
302 gcSL_ENABLE_NONE = 0x0, /* none is enabled, error/uninitialized state */
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,
322 /* Possible indices. */
323 typedef enum _gcSL_INDEXED
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 */
333 /* Opcode conditions. */
334 typedef enum _gcSL_CONDITION
336 gcSL_ALWAYS, /* 0x0 */
337 gcSL_NOT_EQUAL, /* 0x1 */
338 gcSL_LESS_OR_EQUAL, /* 0x2 */
340 gcSL_EQUAL, /* 0x4 */
341 gcSL_GREATER, /* 0x5 */
342 gcSL_GREATER_OR_EQUAL, /* 0x6 */
346 gcSL_NOT_ZERO, /* 0xA */
350 /* Possible source operand types. */
351 typedef enum _gcSL_TYPE
355 gcSL_ATTRIBUTE, /* 0x2 */
356 gcSL_UNIFORM, /* 0x3 */
357 gcSL_SAMPLER, /* 0x4 */
358 gcSL_CONSTANT, /* 0x5 */
359 gcSL_OUTPUT, /* 0x6 */
360 gcSL_PHYSICAL, /* 0x7 */
364 /* Swizzle generator macro. */
365 #define gcmSWIZZLE(Component1, Component2, Component3, Component4) \
367 (gcSL_SWIZZLE_ ## Component1 << 0) | \
368 (gcSL_SWIZZLE_ ## Component2 << 2) | \
369 (gcSL_SWIZZLE_ ## Component3 << 4) | \
370 (gcSL_SWIZZLE_ ## Component4 << 6) \
373 #define gcmExtractSwizzle(Swizzle, Index) \
374 ((gcSL_SWIZZLE) ((((Swizzle) >> (Index * 2)) & 0x3)))
376 #define gcmComposeSwizzle(SwizzleX, SwizzleY, SwizzleZ, SwizzleW) \
378 ((SwizzleX) << 0) | \
379 ((SwizzleY) << 2) | \
380 ((SwizzleZ) << 4) | \
384 /* Possible swizzle values. */
385 typedef enum _gcSL_SWIZZLE
387 gcSL_SWIZZLE_X, /* 0x0 */
388 gcSL_SWIZZLE_Y, /* 0x1 */
389 gcSL_SWIZZLE_Z, /* 0x2 */
390 gcSL_SWIZZLE_W, /* 0x3 */
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),
415 gcSL_SWIZZLE_INVALID = 0x7FFFFFFF
419 typedef enum _gcSL_COMPONENT
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 */
428 #define gcmIsComponentEnabled(Enable, Component) (((Enable) & (1 << (Component))) != 0)
430 /******************************************************************************\
431 |*********************************** SHADERS **********************************|
432 \******************************************************************************/
435 typedef enum _gcSHADER_KIND {
436 gcSHADER_TYPE_UNKNOWN = 0,
437 gcSHADER_TYPE_VERTEX,
438 gcSHADER_TYPE_FRAGMENT,
440 gcSHADER_TYPE_PRECOMPILED,
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;
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;
463 /* Numbr of data transfers for Vertex Shader output. */
464 gctUINT32 vsOutputCount;
466 /* Flag whether the VS has point size or not. */
467 gctBOOL vsHasPointSize;
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;
478 gctUINT32 elementCount;
480 /* Component count. */
481 gctUINT32 componentCount;
483 /* Number of data transfers for Fragment Shader input. */
484 gctUINT32 fsInputCount;
486 /* Maximum number of temporary registers used in FS. */
489 /* Maximum number of temporary registers used in VS. */
492 /* Balance minimum. */
493 gctUINT32 balanceMin;
495 /* Balance maximum. */
496 gctUINT32 balanceMax;
498 /* Flag whether the PS outputs the depth value or not. */
499 gctBOOL psHasFragDepthOut;
501 /* Flag whether the ThreadWalker is in PS. */
502 gctBOOL threadWalkerInPS;
504 #if gcdALPHA_KILL_IN_SHADER
505 /* States to set when alpha kill is enabled. */
506 gctUINT32 killStateAddress;
507 gctUINT32 alphaKillStateValue;
508 gctUINT32 colorKillStateValue;
510 /* Shader instructiuon. */
511 gctUINT32 killInstructionAddress;
512 gctUINT32 alphaKillInstruction[3];
513 gctUINT32 colorKillInstruction[3];
516 #if TEMP_SHADER_PATCH
517 gctUINT32 pachedShaderIdentifier;
521 #if TEMP_SHADER_PATCH
522 #define INVALID_SHADER_IDENTIFIER 0xFFFFFFFF
525 /* gcSHADER_TYPE enumeration. */
526 typedef enum _gcSHADER_TYPE
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 */
568 gcSHADER_UINT_X1, /* 0x27 */
569 gcSHADER_UINT_X2, /* 0x28 */
570 gcSHADER_UINT_X3, /* 0x29 */
571 gcSHADER_UINT_X4, /* 0x2A */
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! */}
578 typedef enum _gcSHADER_TYPE_KIND
589 } gcSHADER_TYPE_KIND;
591 typedef struct _gcSHADER_TYPEINFO
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" */
601 extern gcSHADER_TYPEINFO gcvShaderTypeInfo[];
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)
609 #define gcmType_isMatrix(type) (gcmType_Rows(type) > 1)
611 typedef enum _gcSHADER_VAR_CATEGORY
613 gcSHADER_VAR_CATEGORY_NORMAL = 0, /* primitive type and its array */
614 gcSHADER_VAR_CATEGORY_STRUCT = 1 /* structure */
616 gcSHADER_VAR_CATEGORY;
618 typedef enum _gceTYPE_QUALIFIER
620 gcvTYPE_QUALIFIER_NONE = 0x0, /* unqualified */
621 gcvTYPE_QUALIFIER_VOLATILE = 0x1, /* volatile */
624 typedef gctUINT16 gctTYPE_QUALIFIER;
626 #if GC_ENABLE_LOADTIME_OPT
627 typedef struct _gcSHADER_TYPE_INFO
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;
637 extern gcSHADER_TYPE_INFO shader_type_info[];
639 enum gceLTCDumpOption {
640 gceLTC_DUMP_UNIFORM = 0x0001,
641 gceLTC_DUMP_EVALUATION = 0x0002,
642 gceLTC_DUMP_EXPESSION = 0x0004,
643 gceLTC_DUMP_COLLECTING = 0x0008,
646 gctBOOL gcDumpOption(gctINT Opt);
648 #endif /* GC_ENABLE_LOADTIME_OPT */
650 #define IS_MATRIX_TYPE(type) \
651 (((type >= gcSHADER_FLOAT_2X2) && (type <= gcSHADER_FLOAT_4X4)) || \
652 ((type >= gcSHADER_FLOAT_2X3) && (type <= gcSHADER_FLOAT_4X3)))
654 /* gcSHADER_PRECISION enumeration. */
655 typedef enum _gcSHADER_PRECISION
657 gcSHADER_PRECISION_DEFAULT, /* 0x00 */
658 gcSHADER_PRECISION_HIGH, /* 0x01 */
659 gcSHADER_PRECISION_MEDIUM, /* 0x02 */
660 gcSHADER_PRECISION_LOW, /* 0x03 */
665 typedef enum _gceSHADER_FLAGS
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,
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:
680 So here we append two instructions to the vertex shader.
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,
690 #if ADD_PRE_ROTATION_TO_VS
691 gcvSHADER_VS_PRE_ROTATION = 0x200,
694 #if TEMP_INLINE_ALL_EXPANSION
695 gcvSHADER_INLINE_ALL_EXPANSION = 0x200,
702 IN gctCONST_STRING VertexSource,
703 IN gctCONST_STRING FragmentSource,
704 OUT gctBOOL * clipW);
706 /*******************************************************************************
707 ** gcOptimizer Data Structures
708 *******************************************************************************/
709 typedef enum _gceSHADER_OPTIMIZATION
711 /* No optimization. */
712 gcvOPTIMIZATION_NONE,
714 /* Flow graph construction. */
715 gcvOPTIMIZATION_CONSTRUCTION = 1 << 0,
717 /* Dead code elimination. */
718 gcvOPTIMIZATION_DEAD_CODE = 1 << 1,
720 /* Redundant move instruction elimination. */
721 gcvOPTIMIZATION_REDUNDANT_MOVE = 1 << 2,
723 /* Inline expansion. */
724 gcvOPTIMIZATION_INLINE_EXPANSION = 1 << 3,
726 /* Constant propagation. */
727 gcvOPTIMIZATION_CONSTANT_PROPAGATION = 1 << 4,
729 /* Redundant bounds/checking elimination. */
730 gcvOPTIMIZATION_REDUNDANT_CHECKING = 1 << 5,
732 /* Loop invariant movement. */
733 gcvOPTIMIZATION_LOOP_INVARIANT = 1 << 6,
735 /* Induction variable removal. */
736 gcvOPTIMIZATION_INDUCTION_VARIABLE = 1 << 7,
738 /* Common subexpression elimination. */
739 gcvOPTIMIZATION_COMMON_SUBEXPRESSION = 1 << 8,
741 /* Control flow/banch optimization. */
742 gcvOPTIMIZATION_CONTROL_FLOW = 1 << 9,
744 /* Vector component operation merge. */
745 gcvOPTIMIZATION_VECTOR_INSTRUCTION_MERGE = 1 << 10,
747 /* Algebra simplificaton. */
748 gcvOPTIMIZATION_ALGEBRAIC_SIMPLIFICATION = 1 << 11,
750 /* Pattern matching and replacing. */
751 gcvOPTIMIZATION_PATTERN_MATCHING = 1 << 12,
753 /* Interprocedural constant propagation. */
754 gcvOPTIMIZATION_IP_CONSTANT_PROPAGATION = 1 << 13,
756 /* Interprecedural register optimization. */
757 gcvOPTIMIZATION_IP_REGISTRATION = 1 << 14,
759 /* Optimization option number. */
760 gcvOPTIMIZATION_OPTION_NUMBER = 1 << 15,
762 /* Loadtime constant. */
763 gcvOPTIMIZATION_LOADTIME_CONSTANT = 1 << 16,
765 /* MAD instruction optimization. */
766 gcvOPTIMIZATION_MAD_INSTRUCTION = 1 << 17,
768 /* Special optimization for LOAD SW workaround. */
769 gcvOPTIMIZATION_LOAD_SW_WORKAROUND = 1 << 18,
771 /* move code into conditional block if possile */
772 gcvOPTIMIZATION_CONDITIONALIZE = 1 << 19,
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
780 gcvOPTIMIZATION_POWER_OPTIMIZATION = 1 << 20,
782 /* optimize varying packing */
783 gcvOPTIMIZATION_VARYINGPACKING = 1 << 22,
785 #if TEMP_INLINE_ALL_EXPANSION
786 gcvOPTIMIZATION_INLINE_ALL_EXPANSION = 1 << 23,
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,
796 /* Optimization Unit Test flag. */
797 gcvOPTIMIZATION_UNIT_TEST = 1 << 31
799 gceSHADER_OPTIMIZATION;
801 typedef enum _gceOPTIMIZATION_VaryingPaking
803 gcvOPTIMIZATION_VARYINGPACKING_NONE = 0,
804 gcvOPTIMIZATION_VARYINGPACKING_NOSPLIT,
805 gcvOPTIMIZATION_VARYINGPACKING_SPLIT
806 } gceOPTIMIZATION_VaryingPaking;
808 typedef struct _gcOPTIMIZER_OPTION
810 gceSHADER_OPTIMIZATION optFlags;
812 /* debug & dump options:
814 VC_OPTION=-DUMP:SRC:OPT|:OPTV|:CG|:CGV:|ALL|ALLV
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
823 ALLV = SRC|OPT|OPTV|CG|CGV
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 */
831 /* Code generation */
835 VC_OPTION=-PACKVARYING:[0-2]|:T[-]m[,n]|:LshaderIdx,min,max
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
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]
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.);
853 gceOPTIMIZATION_VaryingPaking packVarying;
856 gctINT _loadBalanceShaderIdx;
857 gctINT _loadBalanceMin;
858 gctINT _loadBalanceMax;
860 /* Do not generate immdeiate
864 Force generate immediate even the machine model don't support it,
865 for testing purpose only
870 gctBOOL forceImmediate;
872 /* Power reduction mode options */
873 gctBOOL needPowerOptimization;
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
879 it can be enabled by environment variable:
881 VC_OPTION=-PATCH_TEXLD:M:N
883 (for each M texld, add N dummy texld)
885 gctINT patchEveryTEXLDs;
886 gctINT patchDummyTEXLDs;
888 /* Insert NOP after high power consumption instructions
890 VC_OPTION="-INSERTNOP:MUL:MULLO:DP3:DP4:SEENTEXLD"
893 gctBOOL insertNOPAfterMUL;
894 gctBOOL insertNOPAfterMULLO;
895 gctBOOL insertNOPAfterDP3;
896 gctBOOL insertNOPAfterDP4;
897 gctBOOL insertNOPOnlyWhenTexldSeen;
899 /* split MAD to MUL and ADD:
905 /* Convert vect3/vec4 operations to multiple vec2/vec1 operations
907 VC_OPTION=-SPLITVEC:MUL:MULLO:DP3:DP4
910 gctBOOL splitVec4MUL;
911 gctBOOL splitVec4MULLO;
912 gctBOOL splitVec4DP3;
913 gctBOOL splitVec4DP4;
915 /* turn/off features:
918 Note: n must be decimal number
922 /* inline level (default 2 at O1):
924 VC_OPTION=-INLINELEVEL:[0-3]
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
931 } gcOPTIMIZER_OPTION;
933 extern gcOPTIMIZER_OPTION theOptimizerOption;
934 #define gcmGetOptimizerOption() gcGetOptimizerOption()
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)
949 #define gcmOPT_SET_DUMP_SHADER_SRC(v) \
950 gcmGetOptimizerOption()->dumpShaderSource = (v)
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)
957 #define gcmOPT_NOIMMEDIATE() (gcmGetOptimizerOption()->noImmediate == gcvTRUE)
958 #define gcmOPT_FORCEIMMEDIATE() (gcmGetOptimizerOption()->forceImmediate == gcvTRUE)
960 #define gcmOPT_PACKVARYING() (gcmGetOptimizerOption()->packVarying)
961 #define gcmOPT_PACKVARYING_triageStart() (gcmGetOptimizerOption()->_triageStart)
962 #define gcmOPT_PACKVARYING_triageEnd() (gcmGetOptimizerOption()->_triageEnd)
964 #define gcmOPT_INLINELEVEL() (gcmGetOptimizerOption()->inlineLevel)
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)
978 #define gcmOPT_SetPackVarying(v) (gcmGetOptimizerOption()->packVarying = v)
980 #define FB_LIVERANGE_FIX1 0x0001
983 #define PredefinedDummySamplerId 8
985 /* Function argument qualifier */
986 typedef enum _gceINPUT_OUTPUT
994 /* Kernel function property flags. */
995 typedef enum _gcePROPERTY_FLAGS
997 gcvPROPERTY_REQD_WORK_GRP_SIZE = 0x01
999 gceKERNEL_FUNCTION_PROPERTY_FLAGS;
1001 /* Uniform flags. */
1002 typedef enum _gceUNIFORM_FLAGS
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,
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)
1029 typedef enum _gceVARIABLE_UPDATE_FLAGS
1031 gcvVARIABLE_UPDATE_NOUPDATE = 0,
1032 gcvVARIABLE_UPDATE_TEMPREG,
1033 gcvVARIABLE_UPDATE_TYPE_QUALIFIER,
1034 }gceVARIABLE_UPDATE_FLAGS;
1036 typedef struct _gcMACHINE_INST
1042 }gcMACHINE_INST, *gcMACHINE_INST_PTR;
1044 typedef struct _gcMACHINECODE
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;
1053 typedef enum NP2_ADDRESS_MODE
1055 NP2_ADDRESS_MODE_CLAMP = 0,
1056 NP2_ADDRESS_MODE_REPEAT = 1,
1057 NP2_ADDRESS_MODE_MIRROR = 2
1060 typedef struct _gcNPOT_PATCH_PARAM
1063 NP2_ADDRESS_MODE addressMode[3];
1064 gctINT texDimension; /* 2 or 3 */
1065 }gcNPOT_PATCH_PARAM, *gcNPOT_PATCH_PARAM_PTR;
1069 IN OUT gcOPTIMIZER_OPTION * Option
1073 gcSetOptimizerOption(
1074 IN gceSHADER_FLAGS Flags
1077 gcOPTIMIZER_OPTION *
1078 gcGetOptimizerOption();
1080 /*******************************************************************************
1081 ** gcSHADER_SetCompilerVersion
1083 ** Set the compiler version of a gcSHADER object.
1088 ** Pointer to gcSHADER object
1091 ** Pointer to a two word version
1094 gcSHADER_SetCompilerVersion(
1096 IN gctUINT32 *Version
1099 /*******************************************************************************
1100 ** gcSHADER_GetCompilerVersion
1102 ** Get the compiler version of a gcSHADER object.
1107 ** Pointer to a gcSHADER object.
1111 ** gctUINT32_PTR *CompilerVersion.
1112 ** Pointer to holder of returned compilerVersion pointer
1115 gcSHADER_GetCompilerVersion(
1117 OUT gctUINT32_PTR *CompilerVersion
1120 /*******************************************************************************
1123 ** Get the gcSHADER object's type.
1128 ** Pointer to a gcSHADER object.
1133 ** Pointer to return shader type.
1143 /*******************************************************************************
1144 ** gcSHADER_Construct
1145 ********************************************************************************
1147 ** Construct a new gcSHADER object.
1152 ** Pointer to an gcoHAL object.
1154 ** gctINT ShaderType
1155 ** Type of gcSHADER object to cerate. 'ShaderType' can be one of the
1158 ** gcSHADER_TYPE_VERTEX Vertex shader.
1159 ** gcSHADER_TYPE_FRAGMENT Fragment shader.
1163 ** gcSHADER * Shader
1164 ** Pointer to a variable receiving the gcSHADER object pointer.
1169 IN gctINT ShaderType,
1170 OUT gcSHADER * Shader
1173 /*******************************************************************************
1175 ********************************************************************************
1177 ** Destroy a gcSHADER object.
1182 ** Pointer to a gcSHADER object.
1193 /*******************************************************************************
1195 ********************************************************************************
1197 ** Copy a gcSHADER object.
1202 ** Pointer to a gcSHADER object.
1205 ** Pointer to a gcSHADER object that will be copied.
1217 /*******************************************************************************
1218 ** gcSHADER_LoadHeader
1220 ** Load a gcSHADER object from a binary buffer. The binary buffer is layed out
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;
1233 ** Pointer to a gcSHADER object.
1234 ** Shader type will be returned if type in shader object is not gcSHADER_TYPE_PRECOMPILED
1236 ** gctPOINTER Buffer
1237 ** Pointer to a binary buffer containing the shader data to load.
1239 ** gctSIZE_T BufferSize
1240 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
1247 gcSHADER_LoadHeader(
1249 IN gctPOINTER Buffer,
1250 IN gctSIZE_T BufferSize,
1251 OUT gctUINT32 * ShaderVersion
1254 /*******************************************************************************
1255 ** gcSHADER_LoadKernel
1257 ** Load a kernel function given by name into gcSHADER object
1262 ** Pointer to a gcSHADER object.
1264 ** gctSTRING KernelName
1265 ** Pointer to a kernel function name
1272 gcSHADER_LoadKernel(
1274 IN gctSTRING KernelName
1277 /*******************************************************************************
1279 ********************************************************************************
1281 ** Load a gcSHADER object from a binary buffer.
1286 ** Pointer to a gcSHADER object.
1288 ** gctPOINTER Buffer
1289 ** Pointer to a binary buffer containg the shader data to load.
1291 ** gctSIZE_T BufferSize
1292 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
1301 IN gctPOINTER Buffer,
1302 IN gctSIZE_T BufferSize
1305 /*******************************************************************************
1307 ********************************************************************************
1309 ** Save a gcSHADER object to a binary buffer.
1314 ** Pointer to a gcSHADER object.
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.
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.
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.
1335 IN gctPOINTER Buffer,
1336 IN OUT gctSIZE_T * BufferSize
1339 /*******************************************************************************
1341 ********************************************************************************
1343 ** Load a gcSHADER object from a binary buffer.
1348 ** Pointer to a gcSHADER object.
1350 ** gctPOINTER Buffer
1351 ** Pointer to a binary buffer containg the shader data to load.
1353 ** gctSIZE_T BufferSize
1354 ** Number of bytes inside the binary buffer pointed to by 'Buffer'.
1363 IN gctPOINTER Buffer,
1364 IN gctSIZE_T BufferSize
1367 /*******************************************************************************
1369 ********************************************************************************
1371 ** Save a gcSHADER object to a binary buffer.
1376 ** Pointer to a gcSHADER object.
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.
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.
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.
1397 IN gctPOINTER Buffer,
1398 IN OUT gctSIZE_T * BufferSize
1401 /*******************************************************************************
1402 ** gcSHADER_ReallocateAttributes
1404 ** Reallocate an array of pointers to gcATTRIBUTE objects.
1409 ** Pointer to a gcSHADER object.
1412 ** Array count to reallocate. 'Count' must be at least 1.
1415 gcSHADER_ReallocateAttributes(
1420 /*******************************************************************************
1421 ** gcSHADER_AddAttribute
1422 ********************************************************************************
1424 ** Add an attribute to a gcSHADER object.
1429 ** Pointer to a gcSHADER object.
1431 ** gctCONST_STRING Name
1432 ** Name of the attribute to add.
1434 ** gcSHADER_TYPE Type
1435 ** Type of the attribute to add.
1438 ** Array length of the attribute to add. 'Length' must be at least 1.
1440 ** gctBOOL IsTexture
1441 ** gcvTRUE if the attribute is used as a texture coordinate, gcvFALSE if not.
1445 ** gcATTRIBUTE * Attribute
1446 ** Pointer to a variable receiving the gcATTRIBUTE object pointer.
1449 gcSHADER_AddAttribute(
1451 IN gctCONST_STRING Name,
1452 IN gcSHADER_TYPE Type,
1453 IN gctSIZE_T Length,
1454 IN gctBOOL IsTexture,
1455 OUT gcATTRIBUTE * Attribute
1458 /*******************************************************************************
1459 ** gcSHADER_GetAttributeCount
1460 ********************************************************************************
1462 ** Get the number of attributes for this shader.
1467 ** Pointer to a gcSHADER object.
1471 ** gctSIZE_T * Count
1472 ** Pointer to a variable receiving the number of attributes.
1475 gcSHADER_GetAttributeCount(
1477 OUT gctSIZE_T * Count
1480 /*******************************************************************************
1481 ** gcSHADER_GetAttribute
1482 ********************************************************************************
1484 ** Get the gcATTRIBUTE object poniter for an indexed attribute for this shader.
1489 ** Pointer to a gcSHADER object.
1492 ** Index of the attribute to retrieve.
1496 ** gcATTRIBUTE * Attribute
1497 ** Pointer to a variable receiving the gcATTRIBUTE object pointer.
1500 gcSHADER_GetAttribute(
1503 OUT gcATTRIBUTE * Attribute
1506 /*******************************************************************************
1507 ** gcSHADER_ReallocateUniforms
1509 ** Reallocate an array of pointers to gcUNIFORM objects.
1514 ** Pointer to a gcSHADER object.
1517 ** Array count to reallocate. 'Count' must be at least 1.
1520 gcSHADER_ReallocateUniforms(
1525 /*******************************************************************************
1526 ** gcSHADER_AddUniform
1527 ********************************************************************************
1529 ** Add an uniform to a gcSHADER object.
1534 ** Pointer to a gcSHADER object.
1536 ** gctCONST_STRING Name
1537 ** Name of the uniform to add.
1539 ** gcSHADER_TYPE Type
1540 ** Type of the uniform to add.
1543 ** Array length of the uniform to add. 'Length' must be at least 1.
1547 ** gcUNIFORM * Uniform
1548 ** Pointer to a variable receiving the gcUNIFORM object pointer.
1551 gcSHADER_AddUniform(
1553 IN gctCONST_STRING Name,
1554 IN gcSHADER_TYPE Type,
1555 IN gctSIZE_T Length,
1556 OUT gcUNIFORM * Uniform
1560 /*******************************************************************************
1561 ** gcSHADER_AddUniformEx
1562 ********************************************************************************
1564 ** Add an uniform to a gcSHADER object.
1569 ** Pointer to a gcSHADER object.
1571 ** gctCONST_STRING Name
1572 ** Name of the uniform to add.
1574 ** gcSHADER_TYPE Type
1575 ** Type of the uniform to add.
1577 ** gcSHADER_PRECISION precision
1578 ** Precision of the uniform to add.
1581 ** Array length of the uniform to add. 'Length' must be at least 1.
1585 ** gcUNIFORM * Uniform
1586 ** Pointer to a variable receiving the gcUNIFORM object pointer.
1589 gcSHADER_AddUniformEx(
1591 IN gctCONST_STRING Name,
1592 IN gcSHADER_TYPE Type,
1593 IN gcSHADER_PRECISION precision,
1594 IN gctSIZE_T Length,
1595 OUT gcUNIFORM * Uniform
1598 /*******************************************************************************
1599 ** gcSHADER_AddUniformEx1
1600 ********************************************************************************
1602 ** Add an uniform to a gcSHADER object.
1607 ** Pointer to a gcSHADER object.
1609 ** gctCONST_STRING Name
1610 ** Name of the uniform to add.
1612 ** gcSHADER_TYPE Type
1613 ** Type of the uniform to add.
1615 ** gcSHADER_PRECISION precision
1616 ** Precision of the uniform to add.
1619 ** Array length of the uniform to add. 'Length' must be at least 1.
1621 ** gcSHADER_VAR_CATEGORY varCategory
1622 ** Variable category, normal or struct.
1624 ** gctUINT16 numStructureElement
1625 ** If struct, its element number.
1628 ** If struct, parent index in gcSHADER.variables.
1630 ** gctINT16 prevSibling
1631 ** If struct, previous sibling index in gcSHADER.variables.
1635 ** gcUNIFORM * Uniform
1636 ** Pointer to a variable receiving the gcUNIFORM object pointer.
1638 ** gctINT16* ThisUniformIndex
1639 ** Returned value about uniform index in gcSHADER.
1642 gcSHADER_AddUniformEx1(
1644 IN gctCONST_STRING Name,
1645 IN gcSHADER_TYPE Type,
1646 IN gcSHADER_PRECISION precision,
1647 IN gctSIZE_T Length,
1649 IN gcSHADER_VAR_CATEGORY varCategory,
1650 IN gctUINT16 numStructureElement,
1652 IN gctINT16 prevSibling,
1653 OUT gctINT16* ThisUniformIndex,
1654 OUT gcUNIFORM * Uniform
1657 /*******************************************************************************
1658 ** gcSHADER_GetUniformCount
1659 ********************************************************************************
1661 ** Get the number of uniforms for this shader.
1666 ** Pointer to a gcSHADER object.
1670 ** gctSIZE_T * Count
1671 ** Pointer to a variable receiving the number of uniforms.
1674 gcSHADER_GetUniformCount(
1676 OUT gctSIZE_T * Count
1679 /*******************************************************************************
1680 ** gcSHADER_GetUniform
1681 ********************************************************************************
1683 ** Get the gcUNIFORM object pointer for an indexed uniform for this shader.
1688 ** Pointer to a gcSHADER object.
1691 ** Index of the uniform to retrieve.
1695 ** gcUNIFORM * Uniform
1696 ** Pointer to a variable receiving the gcUNIFORM object pointer.
1699 gcSHADER_GetUniform(
1702 OUT gcUNIFORM * Uniform
1706 /*******************************************************************************
1707 ** gcSHADER_GetUniformIndexingRange
1708 ********************************************************************************
1710 ** Get the gcUNIFORM object pointer for an indexed uniform for this shader.
1715 ** Pointer to a gcSHADER object.
1717 ** gctINT uniformIndex
1718 ** Index of the start uniform.
1721 ** Offset to indexing.
1725 ** gctINT * LastUniformIndex
1726 ** Pointer to index of last uniform in indexing range.
1728 ** gctINT * OffsetUniformIndex
1729 ** Pointer to index of uniform that indexing at offset.
1731 ** gctINT * DeviationInOffsetUniform
1732 ** Pointer to offset in uniform picked up.
1735 gcSHADER_GetUniformIndexingRange(
1737 IN gctINT uniformIndex,
1739 OUT gctINT * LastUniformIndex,
1740 OUT gctINT * OffsetUniformIndex,
1741 OUT gctINT * DeviationInOffsetUniform
1744 /*******************************************************************************
1745 ** gcSHADER_GetKernelFucntion
1747 ** Get the gcKERNEL_FUNCTION object pointer for an indexed kernel function for this shader.
1752 ** Pointer to a gcSHADER object.
1755 ** Index of kernel function to retreive the name for.
1759 ** gcKERNEL_FUNCTION * KernelFunction
1760 ** Pointer to a variable receiving the gcKERNEL_FUNCTION object pointer.
1763 gcSHADER_GetKernelFunction(
1766 OUT gcKERNEL_FUNCTION * KernelFunction
1770 gcSHADER_GetKernelFunctionByName(
1772 IN gctSTRING KernelName,
1773 OUT gcKERNEL_FUNCTION * KernelFunction
1775 /*******************************************************************************
1776 ** gcSHADER_GetKernelFunctionCount
1778 ** Get the number of kernel functions for this shader.
1783 ** Pointer to a gcSHADER object.
1787 ** gctSIZE_T * Count
1788 ** Pointer to a variable receiving the number of kernel functions.
1791 gcSHADER_GetKernelFunctionCount(
1793 OUT gctSIZE_T * Count
1796 /*******************************************************************************
1797 ** gcSHADER_ReallocateOutputs
1799 ** Reallocate an array of pointers to gcOUTPUT objects.
1804 ** Pointer to a gcSHADER object.
1807 ** Array count to reallocate. 'Count' must be at least 1.
1810 gcSHADER_ReallocateOutputs(
1815 /*******************************************************************************
1816 ** gcSHADER_AddOutput
1817 ********************************************************************************
1819 ** Add an output to a gcSHADER object.
1824 ** Pointer to a gcSHADER object.
1826 ** gctCONST_STRING Name
1827 ** Name of the output to add.
1829 ** gcSHADER_TYPE Type
1830 ** Type of the output to add.
1833 ** Array length of the output to add. 'Length' must be at least 1.
1835 ** gctUINT16 TempRegister
1836 ** Temporary register index that holds the output value.
1845 IN gctCONST_STRING Name,
1846 IN gcSHADER_TYPE Type,
1847 IN gctSIZE_T Length,
1848 IN gctUINT16 TempRegister
1852 gcSHADER_AddOutputIndexed(
1854 IN gctCONST_STRING Name,
1856 IN gctUINT16 TempIndex
1859 /*******************************************************************************
1860 ** gcSHADER_GetOutputCount
1861 ********************************************************************************
1863 ** Get the number of outputs for this shader.
1868 ** Pointer to a gcSHADER object.
1872 ** gctSIZE_T * Count
1873 ** Pointer to a variable receiving the number of outputs.
1876 gcSHADER_GetOutputCount(
1878 OUT gctSIZE_T * Count
1881 /*******************************************************************************
1882 ** gcSHADER_GetOutput
1883 ********************************************************************************
1885 ** Get the gcOUTPUT object pointer for an indexed output for this shader.
1890 ** Pointer to a gcSHADER object.
1893 ** Index of output to retrieve.
1897 ** gcOUTPUT * Output
1898 ** Pointer to a variable receiving the gcOUTPUT object pointer.
1904 OUT gcOUTPUT * Output
1908 /*******************************************************************************
1909 ** gcSHADER_GetOutputByName
1910 ********************************************************************************
1912 ** Get the gcOUTPUT object pointer for this shader by output name.
1917 ** Pointer to a gcSHADER object.
1920 ** Name of output to retrieve.
1922 ** gctSIZE_T nameLength
1923 ** Length of name to retrieve
1927 ** gcOUTPUT * Output
1928 ** Pointer to a variable receiving the gcOUTPUT object pointer.
1931 gcSHADER_GetOutputByName(
1934 IN gctSIZE_T nameLength,
1935 OUT gcOUTPUT * Output
1938 /*******************************************************************************
1939 ** gcSHADER_ReallocateVariables
1941 ** Reallocate an array of pointers to gcVARIABLE objects.
1946 ** Pointer to a gcSHADER object.
1949 ** Array count to reallocate. 'Count' must be at least 1.
1952 gcSHADER_ReallocateVariables(
1957 /*******************************************************************************
1958 ** gcSHADER_AddVariable
1959 ********************************************************************************
1961 ** Add a variable to a gcSHADER object.
1966 ** Pointer to a gcSHADER object.
1968 ** gctCONST_STRING Name
1969 ** Name of the variable to add.
1971 ** gcSHADER_TYPE Type
1972 ** Type of the variable to add.
1975 ** Array length of the variable to add. 'Length' must be at least 1.
1977 ** gctUINT16 TempRegister
1978 ** Temporary register index that holds the variable value.
1985 gcSHADER_AddVariable(
1987 IN gctCONST_STRING Name,
1988 IN gcSHADER_TYPE Type,
1989 IN gctSIZE_T Length,
1990 IN gctUINT16 TempRegister
1994 /*******************************************************************************
1995 ** gcSHADER_AddVariableEx
1996 ********************************************************************************
1998 ** Add a variable to a gcSHADER object.
2003 ** Pointer to a gcSHADER object.
2005 ** gctCONST_STRING Name
2006 ** Name of the variable to add.
2008 ** gcSHADER_TYPE Type
2009 ** Type of the variable to add.
2012 ** Array length of the variable to add. 'Length' must be at least 1.
2014 ** gctUINT16 TempRegister
2015 ** Temporary register index that holds the variable value.
2017 ** gcSHADER_VAR_CATEGORY varCategory
2018 ** Variable category, normal or struct.
2020 ** gctUINT16 numStructureElement
2021 ** If struct, its element number.
2024 ** If struct, parent index in gcSHADER.variables.
2026 ** gctINT16 prevSibling
2027 ** If struct, previous sibling index in gcSHADER.variables.
2031 ** gctINT16* ThisVarIndex
2032 ** Returned value about variable index in gcSHADER.
2035 gcSHADER_AddVariableEx(
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,
2044 IN gctINT16 prevSibling,
2045 OUT gctINT16* ThisVarIndex
2048 /*******************************************************************************
2049 ** gcSHADER_UpdateVariable
2050 ********************************************************************************
2052 ** Update a variable to a gcSHADER object.
2057 ** Pointer to a gcSHADER object.
2060 ** Index of variable to retrieve.
2062 ** gceVARIABLE_UPDATE_FLAGS flag
2063 ** Flag which property of variable will be updated.
2066 ** New value to update.
2073 gcSHADER_UpdateVariable(
2076 IN gceVARIABLE_UPDATE_FLAGS flag,
2080 /*******************************************************************************
2081 ** gcSHADER_GetVariableCount
2082 ********************************************************************************
2084 ** Get the number of variables for this shader.
2089 ** Pointer to a gcSHADER object.
2093 ** gctSIZE_T * Count
2094 ** Pointer to a variable receiving the number of variables.
2097 gcSHADER_GetVariableCount(
2099 OUT gctSIZE_T * Count
2102 /*******************************************************************************
2103 ** gcSHADER_GetVariable
2104 ********************************************************************************
2106 ** Get the gcVARIABLE object pointer for an indexed variable for this shader.
2111 ** Pointer to a gcSHADER object.
2114 ** Index of variable to retrieve.
2118 ** gcVARIABLE * Variable
2119 ** Pointer to a variable receiving the gcVARIABLE object pointer.
2122 gcSHADER_GetVariable(
2125 OUT gcVARIABLE * Variable
2128 /*******************************************************************************
2129 ** gcSHADER_GetVariableIndexingRange
2130 ********************************************************************************
2132 ** Get the gcVARIABLE indexing range.
2137 ** Pointer to a gcSHADER object.
2139 ** gcVARIABLE variable
2143 ** Indicate whether maximum indexing range is queried
2148 ** Pointer to range start (temp register index).
2151 ** Pointer to range end (temp register index).
2154 gcSHADER_GetVariableIndexingRange(
2156 IN gcVARIABLE variable,
2162 /*******************************************************************************
2163 ** gcSHADER_AddOpcode
2164 ********************************************************************************
2166 ** Add an opcode to a gcSHADER object.
2171 ** Pointer to a gcSHADER object.
2173 ** gcSL_OPCODE Opcode
2176 ** gctUINT16 TempRegister
2177 ** Temporary register index that acts as the target of the opcode.
2180 ** Write enable bits for the temporary register that acts as the target
2183 ** gcSL_FORMAT Format
2184 ** Format of the temporary register.
2193 IN gcSL_OPCODE Opcode,
2194 IN gctUINT16 TempRegister,
2196 IN gcSL_FORMAT Format
2200 gcSHADER_AddOpcode2(
2202 IN gcSL_OPCODE Opcode,
2203 IN gcSL_CONDITION Condition,
2204 IN gctUINT16 TempRegister,
2206 IN gcSL_FORMAT Format
2209 /*******************************************************************************
2210 ** gcSHADER_AddOpcodeIndexed
2211 ********************************************************************************
2213 ** Add an opcode to a gcSHADER object that writes to an dynamically indexed
2219 ** Pointer to a gcSHADER object.
2221 ** gcSL_OPCODE Opcode
2224 ** gctUINT16 TempRegister
2225 ** Temporary register index that acts as the target of the opcode.
2228 ** Write enable bits for the temporary register that acts as the
2229 ** target of the opcode.
2231 ** gcSL_INDEXED Mode
2232 ** Location of the dynamic index inside the temporary register. Valid
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.
2240 ** gctUINT16 IndexRegister
2241 ** Temporary register index that holds the dynamic index.
2243 ** gcSL_FORMAT Format
2244 ** Format of the temporary register.
2251 gcSHADER_AddOpcodeIndexed(
2253 IN gcSL_OPCODE Opcode,
2254 IN gctUINT16 TempRegister,
2256 IN gcSL_INDEXED Mode,
2257 IN gctUINT16 IndexRegister,
2258 IN gcSL_FORMAT Format
2261 /*******************************************************************************
2262 ** gcSHADER_AddOpcodeConditionIndexed
2264 ** Add an opcode to a gcSHADER object that writes to an dynamically indexed
2270 ** Pointer to a gcSHADER object.
2272 ** gcSL_OPCODE Opcode
2275 ** gcSL_CONDITION Condition
2276 ** Condition to check.
2278 ** gctUINT16 TempRegister
2279 ** Temporary register index that acts as the target of the opcode.
2282 ** Write enable bits for the temporary register that acts as the
2283 ** target of the opcode.
2285 ** gcSL_INDEXED Indexed
2286 ** Location of the dynamic index inside the temporary register. Valid
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.
2294 ** gctUINT16 IndexRegister
2295 ** Temporary register index that holds the dynamic index.
2302 gcSHADER_AddOpcodeConditionIndexed(
2304 IN gcSL_OPCODE Opcode,
2305 IN gcSL_CONDITION Condition,
2306 IN gctUINT16 TempRegister,
2308 IN gcSL_INDEXED Indexed,
2309 IN gctUINT16 IndexRegister,
2310 IN gcSL_FORMAT Format
2313 /*******************************************************************************
2314 ** gcSHADER_AddOpcodeConditional
2315 ********************************************************************************
2317 ** Add an conditional opcode to a gcSHADER object.
2322 ** Pointer to a gcSHADER object.
2324 ** gcSL_OPCODE Opcode
2327 ** gcSL_CONDITION Condition
2328 ** Condition that needs to evaluate to gcvTRUE in order for the opcode to
2332 ** Target label if 'Condition' evaluates to gcvTRUE.
2339 gcSHADER_AddOpcodeConditional(
2341 IN gcSL_OPCODE Opcode,
2342 IN gcSL_CONDITION Condition,
2346 /*******************************************************************************
2347 ** gcSHADER_AddOpcodeConditionalFormatted
2349 ** Add an conditional jump or call opcode to a gcSHADER object.
2354 ** Pointer to a gcSHADER object.
2356 ** gcSL_OPCODE Opcode
2359 ** gcSL_CONDITION Condition
2360 ** Condition that needs to evaluate to gcvTRUE in order for the opcode to
2363 ** gcSL_FORMAT Format
2364 ** Format of conditional operands
2367 ** Target label if 'Condition' evaluates to gcvTRUE.
2374 gcSHADER_AddOpcodeConditionalFormatted(
2376 IN gcSL_OPCODE Opcode,
2377 IN gcSL_CONDITION Condition,
2378 IN gcSL_FORMAT Format,
2382 /*******************************************************************************
2383 ** gcSHADER_AddOpcodeConditionalFormattedEnable
2385 ** Add an conditional jump or call opcode to a gcSHADER object.
2390 ** Pointer to a gcSHADER object.
2392 ** gcSL_OPCODE Opcode
2395 ** gcSL_CONDITION Condition
2396 ** Condition that needs to evaluate to gcvTRUE in order for the opcode to
2399 ** gcSL_FORMAT Format
2400 ** Format of conditional operands
2403 ** Write enable value for the target of the opcode.
2406 ** Target label if 'Condition' evaluates to gcvTRUE.
2413 gcSHADER_AddOpcodeConditionalFormattedEnable(
2415 IN gcSL_OPCODE Opcode,
2416 IN gcSL_CONDITION Condition,
2417 IN gcSL_FORMAT Format,
2422 /*******************************************************************************
2423 ** gcSHADER_AddLabel
2424 ********************************************************************************
2426 ** Define a label at the current instruction of a gcSHADER object.
2431 ** Pointer to a gcSHADER object.
2446 /*******************************************************************************
2447 ** gcSHADER_AddSource
2448 ********************************************************************************
2450 ** Add a source operand to a gcSHADER object.
2455 ** Pointer to a gcSHADER object.
2458 ** Type of the source operand.
2460 ** gctUINT16 SourceIndex
2461 ** Index of the source operand.
2464 ** x, y, z, and w swizzle values packed into one 8-bit value.
2466 ** gcSL_FORMAT Format
2467 ** Format of the source operand.
2477 IN gctUINT16 SourceIndex,
2478 IN gctUINT8 Swizzle,
2479 IN gcSL_FORMAT Format
2482 /*******************************************************************************
2483 ** gcSHADER_AddSourceIndexed
2484 ********************************************************************************
2486 ** Add a dynamically indexed source operand to a gcSHADER object.
2491 ** Pointer to a gcSHADER object.
2494 ** Type of the source operand.
2496 ** gctUINT16 SourceIndex
2497 ** Index of the source operand.
2500 ** x, y, z, and w swizzle values packed into one 8-bit value.
2502 ** gcSL_INDEXED Mode
2503 ** Addressing mode for the index.
2505 ** gctUINT16 IndexRegister
2506 ** Temporary register index that holds the dynamic index.
2508 ** gcSL_FORMAT Format
2509 ** Format of the source operand.
2516 gcSHADER_AddSourceIndexed(
2519 IN gctUINT16 SourceIndex,
2520 IN gctUINT8 Swizzle,
2521 IN gcSL_INDEXED Mode,
2522 IN gctUINT16 IndexRegister,
2523 IN gcSL_FORMAT Format
2526 /*******************************************************************************
2527 ** gcSHADER_AddSourceAttribute
2528 ********************************************************************************
2530 ** Add an attribute as a source operand to a gcSHADER object.
2535 ** Pointer to a gcSHADER object.
2537 ** gcATTRIBUTE Attribute
2538 ** Pointer to a gcATTRIBUTE object.
2541 ** x, y, z, and w swizzle values packed into one 8-bit value.
2544 ** Static index into the attribute in case the attribute is a matrix
2552 gcSHADER_AddSourceAttribute(
2554 IN gcATTRIBUTE Attribute,
2555 IN gctUINT8 Swizzle,
2559 /*******************************************************************************
2560 ** gcSHADER_AddSourceAttributeIndexed
2561 ********************************************************************************
2563 ** Add an indexed attribute as a source operand to a gcSHADER object.
2568 ** Pointer to a gcSHADER object.
2570 ** gcATTRIBUTE Attribute
2571 ** Pointer to a gcATTRIBUTE object.
2574 ** x, y, z, and w swizzle values packed into one 8-bit value.
2577 ** Static index into the attribute in case the attribute is a matrix
2580 ** gcSL_INDEXED Mode
2581 ** Addressing mode of the dynamic index.
2583 ** gctUINT16 IndexRegister
2584 ** Temporary register index that holds the dynamic index.
2591 gcSHADER_AddSourceAttributeIndexed(
2593 IN gcATTRIBUTE Attribute,
2594 IN gctUINT8 Swizzle,
2596 IN gcSL_INDEXED Mode,
2597 IN gctUINT16 IndexRegister
2600 /*******************************************************************************
2601 ** gcSHADER_AddSourceUniform
2602 ********************************************************************************
2604 ** Add a uniform as a source operand to a gcSHADER object.
2609 ** Pointer to a gcSHADER object.
2611 ** gcUNIFORM Uniform
2612 ** Pointer to a gcUNIFORM object.
2615 ** x, y, z, and w swizzle values packed into one 8-bit value.
2618 ** Static index into the uniform in case the uniform is a matrix or
2626 gcSHADER_AddSourceUniform(
2628 IN gcUNIFORM Uniform,
2629 IN gctUINT8 Swizzle,
2633 /*******************************************************************************
2634 ** gcSHADER_AddSourceUniformIndexed
2635 ********************************************************************************
2637 ** Add an indexed uniform as a source operand to a gcSHADER object.
2642 ** Pointer to a gcSHADER object.
2644 ** gcUNIFORM Uniform
2645 ** Pointer to a gcUNIFORM object.
2648 ** x, y, z, and w swizzle values packed into one 8-bit value.
2651 ** Static index into the uniform in case the uniform is a matrix or
2654 ** gcSL_INDEXED Mode
2655 ** Addressing mode of the dynamic index.
2657 ** gctUINT16 IndexRegister
2658 ** Temporary register index that holds the dynamic index.
2665 gcSHADER_AddSourceUniformIndexed(
2667 IN gcUNIFORM Uniform,
2668 IN gctUINT8 Swizzle,
2670 IN gcSL_INDEXED Mode,
2671 IN gctUINT16 IndexRegister
2675 gcSHADER_AddSourceSamplerIndexed(
2677 IN gctUINT8 Swizzle,
2678 IN gcSL_INDEXED Mode,
2679 IN gctUINT16 IndexRegister
2683 gcSHADER_AddSourceAttributeFormatted(
2685 IN gcATTRIBUTE Attribute,
2686 IN gctUINT8 Swizzle,
2688 IN gcSL_FORMAT Format
2692 gcSHADER_AddSourceAttributeIndexedFormatted(
2694 IN gcATTRIBUTE Attribute,
2695 IN gctUINT8 Swizzle,
2697 IN gcSL_INDEXED Mode,
2698 IN gctUINT16 IndexRegister,
2699 IN gcSL_FORMAT Format
2703 gcSHADER_AddSourceUniformFormatted(
2705 IN gcUNIFORM Uniform,
2706 IN gctUINT8 Swizzle,
2708 IN gcSL_FORMAT Format
2712 gcSHADER_AddSourceUniformIndexedFormatted(
2714 IN gcUNIFORM Uniform,
2715 IN gctUINT8 Swizzle,
2717 IN gcSL_INDEXED Mode,
2718 IN gctUINT16 IndexRegister,
2719 IN gcSL_FORMAT Format
2723 gcSHADER_AddSourceSamplerIndexedFormatted(
2725 IN gctUINT8 Swizzle,
2726 IN gcSL_INDEXED Mode,
2727 IN gctUINT16 IndexRegister,
2728 IN gcSL_FORMAT Format
2731 /*******************************************************************************
2732 ** gcSHADER_AddSourceConstant
2733 ********************************************************************************
2735 ** Add a constant floating point value as a source operand to a gcSHADER
2741 ** Pointer to a gcSHADER object.
2743 ** gctFLOAT Constant
2744 ** Floating point constant.
2751 gcSHADER_AddSourceConstant(
2753 IN gctFLOAT Constant
2756 /*******************************************************************************
2757 ** gcSHADER_AddSourceConstantFormatted
2758 ********************************************************************************
2760 ** Add a constant value as a source operand to a gcSHADER
2766 ** Pointer to a gcSHADER object.
2769 ** Pointer to constant.
2771 ** gcSL_FORMAT Format
2778 gcSHADER_AddSourceConstantFormatted(
2781 IN gcSL_FORMAT Format
2784 /*******************************************************************************
2786 ********************************************************************************
2788 ** Pack a dynamically created gcSHADER object by trimming the allocated arrays
2789 ** and resolving all the labeling.
2794 ** Pointer to a gcSHADER object.
2805 /*******************************************************************************
2806 ** gcSHADER_SetOptimizationOption
2807 ********************************************************************************
2809 ** Set optimization option of a gcSHADER object.
2814 ** Pointer to a gcSHADER object.
2816 ** gctUINT OptimizationOption
2817 ** Optimization option. Can be one of the following:
2819 ** 0 - No optimization.
2820 ** 1 - Full optimization.
2821 ** Other value - For optimizer testing.
2828 gcSHADER_SetOptimizationOption(
2830 IN gctUINT OptimizationOption
2833 /*******************************************************************************
2834 ** gcSHADER_ReallocateFunctions
2836 ** Reallocate an array of pointers to gcFUNCTION objects.
2841 ** Pointer to a gcSHADER object.
2844 ** Array count to reallocate. 'Count' must be at least 1.
2847 gcSHADER_ReallocateFunctions(
2853 gcSHADER_AddFunction(
2855 IN gctCONST_STRING Name,
2856 OUT gcFUNCTION * Function
2860 gcSHADER_ReallocateKernelFunctions(
2866 gcSHADER_AddKernelFunction(
2868 IN gctCONST_STRING Name,
2869 OUT gcKERNEL_FUNCTION * KernelFunction
2873 gcSHADER_BeginFunction(
2875 IN gcFUNCTION Function
2879 gcSHADER_EndFunction(
2881 IN gcFUNCTION Function
2885 gcSHADER_BeginKernelFunction(
2887 IN gcKERNEL_FUNCTION KernelFunction
2891 gcSHADER_EndKernelFunction(
2893 IN gcKERNEL_FUNCTION KernelFunction,
2894 IN gctSIZE_T LocalMemorySize
2898 gcSHADER_SetMaxKernelFunctionArgs(
2900 IN gctUINT32 MaxKernelFunctionArgs
2903 /*******************************************************************************
2904 ** gcSHADER_SetConstantMemorySize
2906 ** Set the constant memory address space size of a gcSHADER object.
2911 ** Pointer to a gcSHADER object.
2913 ** gctSIZE_T ConstantMemorySize
2914 ** Constant memory size in bytes
2916 ** gctCHAR *ConstantMemoryBuffer
2917 ** Constant memory buffer
2920 gcSHADER_SetConstantMemorySize(
2922 IN gctSIZE_T ConstantMemorySize,
2923 IN gctCHAR * ConstantMemoryBuffer
2926 /*******************************************************************************
2927 ** gcSHADER_GetConstantMemorySize
2929 ** Set the constant memory address space size of a gcSHADER object.
2934 ** Pointer to a gcSHADER object.
2938 ** gctSIZE_T * ConstantMemorySize
2939 ** Pointer to a variable receiving constant memory size in bytes
2941 ** gctCHAR **ConstantMemoryBuffer.
2942 ** Pointer to a variable for returned shader constant memory buffer.
2945 gcSHADER_GetConstantMemorySize(
2947 OUT gctSIZE_T * ConstantMemorySize,
2948 OUT gctCHAR ** ConstantMemoryBuffer
2951 /*******************************************************************************
2952 ** gcSHADER_SetPrivateMemorySize
2954 ** Set the private memory address space size of a gcSHADER object.
2959 ** Pointer to a gcSHADER object.
2961 ** gctSIZE_T PrivateMemorySize
2962 ** Private memory size in bytes
2965 gcSHADER_SetPrivateMemorySize(
2967 IN gctSIZE_T PrivateMemorySize
2970 /*******************************************************************************
2971 ** gcSHADER_GetPrivateMemorySize
2973 ** Set the private memory address space size of a gcSHADER object.
2978 ** Pointer to a gcSHADER object.
2982 ** gctSIZE_T * PrivateMemorySize
2983 ** Pointer to a variable receiving private memory size in bytes
2986 gcSHADER_GetPrivateMemorySize(
2988 OUT gctSIZE_T * PrivateMemorySize
2991 /*******************************************************************************
2992 ** gcSHADER_SetLocalMemorySize
2994 ** Set the local memory address space size of a gcSHADER object.
2999 ** Pointer to a gcSHADER object.
3001 ** gctSIZE_T LocalMemorySize
3002 ** Local memory size in bytes
3005 gcSHADER_SetLocalMemorySize(
3007 IN gctSIZE_T LocalMemorySize
3010 /*******************************************************************************
3011 ** gcSHADER_GetLocalMemorySize
3013 ** Set the local memory address space size of a gcSHADER object.
3018 ** Pointer to a gcSHADER object.
3022 ** gctSIZE_T * LocalMemorySize
3023 ** Pointer to a variable receiving lcoal memory size in bytes
3026 gcSHADER_GetLocalMemorySize(
3028 OUT gctSIZE_T * LocalMemorySize
3032 /*******************************************************************************
3033 ** gcSHADER_CheckValidity
3035 ** Check validity for a gcSHADER object.
3040 ** Pointer to a gcSHADER object.
3044 gcSHADER_CheckValidity(
3048 #if gcdUSE_WCLIP_PATCH
3050 gcATTRIBUTE_IsPosition(
3051 IN gcATTRIBUTE Attribute,
3052 OUT gctBOOL * IsPosition
3056 /*******************************************************************************
3057 ** gcATTRIBUTE_GetType
3058 ********************************************************************************
3060 ** Get the type and array length of a gcATTRIBUTE object.
3064 ** gcATTRIBUTE Attribute
3065 ** Pointer to a gcATTRIBUTE object.
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.
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.
3080 gcATTRIBUTE_GetType(
3081 IN gcATTRIBUTE Attribute,
3082 OUT gcSHADER_TYPE * Type,
3083 OUT gctSIZE_T * ArrayLength
3086 /*******************************************************************************
3087 ** gcATTRIBUTE_GetName
3088 ********************************************************************************
3090 ** Get the name of a gcATTRIBUTE object.
3094 ** gcATTRIBUTE Attribute
3095 ** Pointer to a gcATTRIBUTE object.
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.
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.
3108 gcATTRIBUTE_GetName(
3109 IN gcATTRIBUTE Attribute,
3110 OUT gctSIZE_T * Length,
3111 OUT gctCONST_STRING * Name
3114 /*******************************************************************************
3115 ** gcATTRIBUTE_IsEnabled
3116 ********************************************************************************
3118 ** Query the enabled state of a gcATTRIBUTE object.
3122 ** gcATTRIBUTE Attribute
3123 ** Pointer to a gcATTRIBUTE object.
3127 ** gctBOOL * Enabled
3128 ** Pointer to a variable receiving the enabled state of the attribute.
3131 gcATTRIBUTE_IsEnabled(
3132 IN gcATTRIBUTE Attribute,
3133 OUT gctBOOL * Enabled
3136 /*******************************************************************************
3137 ** gcUNIFORM_GetType
3138 ********************************************************************************
3140 ** Get the type and array length of a gcUNIFORM object.
3144 ** gcUNIFORM Uniform
3145 ** Pointer to a gcUNIFORM object.
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.
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.
3161 IN gcUNIFORM Uniform,
3162 OUT gcSHADER_TYPE * Type,
3163 OUT gctSIZE_T * ArrayLength
3166 /*******************************************************************************
3167 ** gcUNIFORM_GetTypeEx
3168 ********************************************************************************
3170 ** Get the type and array length of a gcUNIFORM object.
3174 ** gcUNIFORM Uniform
3175 ** Pointer to a gcUNIFORM object.
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.
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.
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.
3194 gcUNIFORM_GetTypeEx(
3195 IN gcUNIFORM Uniform,
3196 OUT gcSHADER_TYPE * Type,
3197 OUT gcSHADER_PRECISION * Precision,
3198 OUT gctSIZE_T * ArrayLength
3201 /*******************************************************************************
3202 ** gcUNIFORM_GetFlags
3203 ********************************************************************************
3205 ** Get the flags of a gcUNIFORM object.
3209 ** gcUNIFORM Uniform
3210 ** Pointer to a gcUNIFORM object.
3214 ** gceUNIFORM_FLAGS * Flags
3215 ** Pointer to a variable receiving the flags of the uniform.
3220 IN gcUNIFORM Uniform,
3221 OUT gceUNIFORM_FLAGS * Flags
3224 /*******************************************************************************
3225 ** gcUNIFORM_SetFlags
3226 ********************************************************************************
3228 ** Set the flags of a gcUNIFORM object.
3232 ** gcUNIFORM Uniform
3233 ** Pointer to a gcUNIFORM object.
3235 ** gceUNIFORM_FLAGS Flags
3236 ** Flags of the uniform to be set.
3244 IN gcUNIFORM Uniform,
3245 IN gceUNIFORM_FLAGS Flags
3248 /*******************************************************************************
3249 ** gcUNIFORM_GetName
3250 ********************************************************************************
3252 ** Get the name of a gcUNIFORM object.
3256 ** gcUNIFORM Uniform
3257 ** Pointer to a gcUNIFORM object.
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.
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.
3271 IN gcUNIFORM Uniform,
3272 OUT gctSIZE_T * Length,
3273 OUT gctCONST_STRING * Name
3276 /*******************************************************************************
3277 ** gcUNIFORM_GetSampler
3278 ********************************************************************************
3280 ** Get the physical sampler number for a sampler gcUNIFORM object.
3284 ** gcUNIFORM Uniform
3285 ** Pointer to a gcUNIFORM object.
3289 ** gctUINT32 * Sampler
3290 ** Pointer to a variable receiving the physical sampler.
3293 gcUNIFORM_GetSampler(
3294 IN gcUNIFORM Uniform,
3295 OUT gctUINT32 * Sampler
3298 /*******************************************************************************
3299 ** gcUNIFORM_GetFormat
3301 ** Get the type and array length of a gcUNIFORM object.
3305 ** gcUNIFORM Uniform
3306 ** Pointer to a gcUNIFORM object.
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.
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.
3319 gcUNIFORM_GetFormat(
3320 IN gcUNIFORM Uniform,
3321 OUT gcSL_FORMAT * Format,
3322 OUT gctBOOL * IsPointer
3325 /*******************************************************************************
3326 ** gcUNIFORM_SetFormat
3328 ** Set the format and isPointer of a uniform.
3332 ** gcUNIFORM Uniform
3333 ** Pointer to a gcUNIFORM object.
3335 ** gcSL_FORMAT Format
3336 ** Format of element of the uniform shaderType.
3338 ** gctBOOL IsPointer
3339 ** Wheter the uniform is a pointer.
3346 gcUNIFORM_SetFormat(
3347 IN gcUNIFORM Uniform,
3348 IN gcSL_FORMAT Format,
3349 IN gctBOOL IsPointer
3352 /*******************************************************************************
3353 ** gcUNIFORM_SetValue
3354 ********************************************************************************
3356 ** Set the value of a uniform in integer.
3360 ** gcUNIFORM Uniform
3361 ** Pointer to a gcUNIFORM object.
3364 ** Number of entries to program if the uniform has been declared as an
3367 ** const gctINT * Value
3368 ** Pointer to a buffer holding the integer values for the uniform.
3376 IN gcUNIFORM Uniform,
3378 IN const gctINT * Value
3381 /*******************************************************************************
3382 ** gcUNIFORM_SetValueX
3383 ********************************************************************************
3385 ** Set the value of a uniform in fixed point.
3389 ** gcUNIFORM Uniform
3390 ** Pointer to a gcUNIFORM object.
3393 ** Number of entries to program if the uniform has been declared as an
3396 ** const gctFIXED_POINT * Value
3397 ** Pointer to a buffer holding the fixed point values for the uniform.
3404 gcUNIFORM_SetValueX(
3405 IN gcUNIFORM Uniform,
3407 IN gctFIXED_POINT * Value
3410 /*******************************************************************************
3411 ** gcUNIFORM_SetValueF
3412 ********************************************************************************
3414 ** Set the value of a uniform in floating point.
3418 ** gcUNIFORM Uniform
3419 ** Pointer to a gcUNIFORM object.
3422 ** Number of entries to program if the uniform has been declared as an
3425 ** const gctFLOAT * Value
3426 ** Pointer to a buffer holding the floating point values for the
3434 gcUNIFORM_SetValueF(
3435 IN gcUNIFORM Uniform,
3437 IN const gctFLOAT * Value
3440 /*******************************************************************************
3441 ** gcUNIFORM_GetModelViewProjMatrix
3442 ********************************************************************************
3444 ** Get the value of uniform modelViewProjMatrix ID if present.
3448 ** gcUNIFORM Uniform
3449 ** Pointer to a gcUNIFORM object.
3456 gcUNIFORM_GetModelViewProjMatrix(
3457 IN gcUNIFORM Uniform
3460 /*******************************************************************************
3462 ********************************************************************************
3464 ** Get the type and array length of a gcOUTPUT object.
3469 ** Pointer to a gcOUTPUT object.
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.
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.
3486 OUT gcSHADER_TYPE * Type,
3487 OUT gctSIZE_T * ArrayLength
3490 /*******************************************************************************
3491 ** gcOUTPUT_GetIndex
3492 ********************************************************************************
3494 ** Get the index of a gcOUTPUT object.
3499 ** Pointer to a gcOUTPUT object.
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
3514 /*******************************************************************************
3516 ********************************************************************************
3518 ** Get the name of a gcOUTPUT object.
3523 ** Pointer to a gcOUTPUT object.
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.
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.
3538 OUT gctSIZE_T * Length,
3539 OUT gctCONST_STRING * Name
3542 /*******************************************************************************
3543 *********************************************************** F U N C T I O N S **
3544 *******************************************************************************/
3546 /*******************************************************************************
3547 ** gcFUNCTION_ReallocateArguments
3549 ** Reallocate an array of gcsFUNCTION_ARGUMENT objects.
3553 ** gcFUNCTION Function
3554 ** Pointer to a gcFUNCTION object.
3557 ** Array count to reallocate. 'Count' must be at least 1.
3560 gcFUNCTION_ReallocateArguments(
3561 IN gcFUNCTION Function,
3566 gcFUNCTION_AddArgument(
3567 IN gcFUNCTION Function,
3568 IN gctUINT16 TempIndex,
3570 IN gctUINT8 Qualifier
3574 gcFUNCTION_GetArgument(
3575 IN gcFUNCTION Function,
3577 OUT gctUINT16_PTR Temp,
3578 OUT gctUINT8_PTR Enable,
3579 OUT gctUINT8_PTR Swizzle
3583 gcFUNCTION_GetLabel(
3584 IN gcFUNCTION Function,
3585 OUT gctUINT_PTR Label
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 /*******************************************************************************/
3593 gcKERNEL_FUNCTION_AddKernelFunctionProperties(
3594 IN gcKERNEL_FUNCTION KernelFunction,
3595 IN gctINT propertyType,
3596 IN gctSIZE_T propertySize,
3601 gcKERNEL_FUNCTION_GetPropertyCount(
3602 IN gcKERNEL_FUNCTION KernelFunction,
3603 OUT gctSIZE_T * Count
3607 gcKERNEL_FUNCTION_GetProperty(
3608 IN gcKERNEL_FUNCTION KernelFunction,
3610 OUT gctSIZE_T * propertySize,
3611 OUT gctINT * propertyType,
3612 OUT gctINT * propertyValues
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
3622 ** Reallocate an array of pointers to image sampler pair.
3626 ** gcKERNEL_FUNCTION KernelFunction
3627 ** Pointer to a gcKERNEL_FUNCTION object.
3630 ** Array count to reallocate. 'Count' must be at least 1.
3633 gcKERNEL_FUNCTION_ReallocateImageSamplers(
3634 IN gcKERNEL_FUNCTION KernelFunction,
3639 gcKERNEL_FUNCTION_AddImageSampler(
3640 IN gcKERNEL_FUNCTION KernelFunction,
3641 IN gctUINT8 ImageNum,
3642 IN gctBOOL IsConstantSamplerType,
3643 IN gctUINT32 SamplerType
3647 gcKERNEL_FUNCTION_GetImageSamplerCount(
3648 IN gcKERNEL_FUNCTION KernelFunction,
3649 OUT gctSIZE_T * Count
3653 gcKERNEL_FUNCTION_GetImageSampler(
3654 IN gcKERNEL_FUNCTION KernelFunction,
3656 OUT gctUINT8 *ImageNum,
3657 OUT gctBOOL *IsConstantSamplerType,
3658 OUT gctUINT32 *SamplerType
3661 /*******************************************************************************
3662 *********************************************K E R N E L F U N C T I O N S **
3663 *******************************************************************************/
3665 /*******************************************************************************
3666 ** gcKERNEL_FUNCTION_ReallocateArguments
3668 ** Reallocate an array of gcsFUNCTION_ARGUMENT objects.
3672 ** gcKERNEL_FUNCTION Function
3673 ** Pointer to a gcKERNEL_FUNCTION object.
3676 ** Array count to reallocate. 'Count' must be at least 1.
3679 gcKERNEL_FUNCTION_ReallocateArguments(
3680 IN gcKERNEL_FUNCTION Function,
3685 gcKERNEL_FUNCTION_AddArgument(
3686 IN gcKERNEL_FUNCTION Function,
3687 IN gctUINT16 TempIndex,
3689 IN gctUINT8 Qualifier
3693 gcKERNEL_FUNCTION_GetArgument(
3694 IN gcKERNEL_FUNCTION Function,
3696 OUT gctUINT16_PTR Temp,
3697 OUT gctUINT8_PTR Enable,
3698 OUT gctUINT8_PTR Swizzle
3702 gcKERNEL_FUNCTION_GetLabel(
3703 IN gcKERNEL_FUNCTION Function,
3704 OUT gctUINT_PTR Label
3708 gcKERNEL_FUNCTION_GetName(
3709 IN gcKERNEL_FUNCTION KernelFunction,
3710 OUT gctSIZE_T * Length,
3711 OUT gctCONST_STRING * Name
3715 gcKERNEL_FUNCTION_ReallocateUniformArguments(
3716 IN gcKERNEL_FUNCTION KernelFunction,
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
3730 gcKERNEL_FUNCTION_GetUniformArgumentCount(
3731 IN gcKERNEL_FUNCTION KernelFunction,
3732 OUT gctSIZE_T * Count
3736 gcKERNEL_FUNCTION_GetUniformArgument(
3737 IN gcKERNEL_FUNCTION KernelFunction,
3739 OUT gcUNIFORM * UniformArgument
3743 gcKERNEL_FUNCTION_SetCodeEnd(
3744 IN gcKERNEL_FUNCTION KernelFunction
3747 /*******************************************************************************
3749 ********************************************************************************
3751 ** Compile a shader.
3756 ** Pointer to an gcoHAL object.
3758 ** gctINT ShaderType
3759 ** Shader type to compile. Can be one of the following values:
3761 ** gcSHADER_TYPE_VERTEX
3762 ** Compile a vertex shader.
3764 ** gcSHADER_TYPE_FRAGMENT
3765 ** Compile a fragment shader.
3767 ** gctSIZE_T SourceSize
3768 ** Size of the source buffer in bytes.
3770 ** gctCONST_STRING Source
3771 ** Pointer to the buffer containing the shader source code.
3775 ** gcSHADER * Binary
3776 ** Pointer to a variable receiving the pointer to a gcSHADER object
3777 ** containg the compiled shader code.
3780 ** Pointer to a variable receiving a string pointer containging the
3786 IN gctINT ShaderType,
3787 IN gctSIZE_T SourceSize,
3788 IN gctCONST_STRING Source,
3789 OUT gcSHADER * Binary,
3793 /*******************************************************************************
3795 ********************************************************************************
3797 ** Optimize a shader.
3802 ** Pointer to a gcSHADER object holding information about the compiled
3806 ** Pointer to an open FILE object.
3814 /*******************************************************************************
3816 ********************************************************************************
3818 ** Link two shaders and generate a harwdare specific state buffer by compiling
3819 ** the compiler generated code through the resource allocator and code
3824 ** gcSHADER VertexShader
3825 ** Pointer to a gcSHADER object holding information about the compiled
3828 ** gcSHADER FragmentShader
3829 ** Pointer to a gcSHADER object holding information about the compiled
3832 ** gceSHADER_FLAGS Flags
3833 ** Compiler flags. Can be any of the following:
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.
3844 ** gctSIZE_T * StateBufferSize
3845 ** Pointer to a variable receicing the number of bytes in the buffer
3846 ** returned in 'StateBuffer'.
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.
3852 ** gcsHINT_PTR * Hints
3853 ** Pointer to a variable receiving a gcsHINT structure pointer that
3854 ** contains information required when loading the shader states.
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
3868 /*******************************************************************************
3870 ********************************************************************************
3872 ** Load a pre-compiled and pre-linked shader program into the hardware.
3877 ** Pointer to a gcoHAL object.
3879 ** gctSIZE_T StateBufferSize
3880 ** The number of bytes in the 'StateBuffer'.
3882 ** gctPOINTER StateBuffer
3883 ** Pointer to the states that make up the shader program.
3885 ** gcsHINT_PTR Hints
3886 ** Pointer to a gcsHINT structure that contains information required
3887 ** when loading the shader states.
3892 IN gctSIZE_T StateBufferSize,
3893 IN gctPOINTER StateBuffer,
3894 IN gcsHINT_PTR Hints
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,
3907 IN gctPOINTER pNativeStateBuffer,
3908 IN gctSIZE_T nativeStateBufferSize,
3909 IN gcsHINT_PTR pNativeHints,
3911 IN gctUINT32 Samplers,
3912 IN gctUINT32 *SamplerWrapS,
3913 IN gctUINT32 *SamplerWrapT
3915 /*******************************************************************************
3917 ********************************************************************************
3919 ** Save pre-compiled shaders and pre-linked programs to a binary file.
3923 ** gcSHADER VertexShader
3924 ** Pointer to vertex shader object.
3926 ** gcSHADER FragmentShader
3927 ** Pointer to fragment shader object.
3929 ** gctSIZE_T ProgramBufferSize
3930 ** Number of bytes in 'ProgramBuffer'.
3932 ** gctPOINTER ProgramBuffer
3933 ** Pointer to buffer containing the program states.
3935 ** gcsHINT_PTR Hints
3936 ** Pointer to HINTS structure for program states.
3940 ** gctPOINTER * Binary
3941 ** Pointer to a variable receiving the binary data to be saved.
3943 ** gctSIZE_T * BinarySize
3944 ** Pointer to a variable receiving the number of bytes inside 'Binary'.
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
3957 /*******************************************************************************
3959 ********************************************************************************
3961 ** Load pre-compiled shaders and pre-linked programs from a binary file.
3965 ** gctPOINTER Binary
3966 ** Pointer to the binary data loaded.
3968 ** gctSIZE_T BinarySize
3969 ** Number of bytes in 'Binary'.
3973 ** gcSHADER VertexShader
3974 ** Pointer to a vertex shader object.
3976 ** gcSHADER FragmentShader
3977 ** Pointer to a fragment shader object.
3979 ** gctSIZE_T * ProgramBufferSize
3980 ** Pointer to a variable receicing the number of bytes in the buffer
3981 ** returned in 'ProgramBuffer'.
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.
3987 ** gcsHINT_PTR * Hints
3988 ** Pointer to a variable receiving a gcsHINT structure pointer that
3989 ** contains information required when loading the shader states.
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
4002 /*******************************************************************************
4004 ********************************************************************************
4006 ** Compile a OpenCL kernel shader.
4011 ** Pointer to an gcoHAL object.
4013 ** gctSIZE_T SourceSize
4014 ** Size of the source buffer in bytes.
4016 ** gctCONST_STRING Source
4017 ** Pointer to the buffer containing the shader source code.
4021 ** gcSHADER * Binary
4022 ** Pointer to a variable receiving the pointer to a gcSHADER object
4023 ** containg the compiled shader code.
4026 ** Pointer to a variable receiving a string pointer containging the
4032 IN gctSIZE_T SourceSize,
4033 IN gctCONST_STRING Source,
4034 IN gctCONST_STRING Options,
4035 OUT gcSHADER * Binary,
4039 /*******************************************************************************
4041 ********************************************************************************
4043 ** Link OpenCL kernel and generate a harwdare specific state buffer by compiling
4044 ** the compiler generated code through the resource allocator and code
4050 ** Pointer to a gcSHADER object holding information about the compiled
4053 ** gceSHADER_FLAGS Flags
4054 ** Compiler flags. Can be any of the following:
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.
4065 ** gctSIZE_T * StateBufferSize
4066 ** Pointer to a variable receiving the number of bytes in the buffer
4067 ** returned in 'StateBuffer'.
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.
4073 ** gcsHINT_PTR * Hints
4074 ** Pointer to a variable receiving a gcsHINT structure pointer that
4075 ** contains information required when loading the shader states.
4080 IN gceSHADER_FLAGS Flags,
4081 OUT gctSIZE_T * StateBufferSize,
4082 OUT gctPOINTER * StateBuffer,
4083 OUT gcsHINT_PTR * Hints
4086 /*******************************************************************************
4088 ********************************************************************************
4090 ** Load a pre-compiled and pre-linked kernel program into the hardware.
4094 ** gctSIZE_T StateBufferSize
4095 ** The number of bytes in the 'StateBuffer'.
4097 ** gctPOINTER StateBuffer
4098 ** Pointer to the states that make up the shader program.
4100 ** gcsHINT_PTR Hints
4101 ** Pointer to a gcsHINT structure that contains information required
4102 ** when loading the shader states.
4106 IN gctSIZE_T StateBufferSize,
4107 IN gctPOINTER StateBuffer,
4108 IN gcsHINT_PTR Hints
4112 gcInvokeThreadWalker(
4113 IN gcsTHREAD_WALKER_INFO_PTR Info
4118 IN gcSHADER_TYPE Type,
4119 OUT gctINT * Components,
4121 OUT gctCONST_STRING * Name
4125 gcOPT_doVaryingPackingForShader(
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 */
4145 #endif /* VIVANTE_NO_3D */
4146 #endif /* __gc_hal_compiler_h_ */