2 * Mesa 3-D graphics library
5 * Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
6 * Copyright (C) 2008 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * \file slang_builtin.c
28 * Resolve built-in uniform vars.
32 #include "main/imports.h"
33 #include "main/mtypes.h"
34 #include "shader/program.h"
35 #include "shader/prog_instruction.h"
36 #include "shader/prog_parameter.h"
37 #include "shader/prog_statevars.h"
38 #include "shader/slang/slang_ir.h"
39 #include "shader/slang/slang_emit.h"
40 #include "shader/slang/slang_builtin.h"
43 /** special state token (see below) */
44 #define STATE_ARRAY ((gl_state_index) 0xfffff)
48 * Lookup GL state given a variable name, 0, 1 or 2 indexes and a field.
49 * Allocate room for the state in the given param list and return position
51 * Yes, this is kind of ugly, but it works.
54 lookup_statevar(const char *var
, GLint index1
, GLint index2
, const char *field
,
56 struct gl_program_parameter_list
*paramList
)
59 * NOTE: The ARB_vertex_program extension specified that matrices get
60 * loaded in registers in row-major order. With GLSL, we want column-
61 * major order. So, we need to transpose all matrices here...
65 gl_state_index matrix
;
66 gl_state_index modifier
;
68 { "gl_ModelViewMatrix", STATE_MODELVIEW_MATRIX
, STATE_MATRIX_TRANSPOSE
},
69 { "gl_ModelViewMatrixInverse", STATE_MODELVIEW_MATRIX
, STATE_MATRIX_INVTRANS
},
70 { "gl_ModelViewMatrixTranspose", STATE_MODELVIEW_MATRIX
, 0 },
71 { "gl_ModelViewMatrixInverseTranspose", STATE_MODELVIEW_MATRIX
, STATE_MATRIX_INVERSE
},
73 { "gl_ProjectionMatrix", STATE_PROJECTION_MATRIX
, STATE_MATRIX_TRANSPOSE
},
74 { "gl_ProjectionMatrixInverse", STATE_PROJECTION_MATRIX
, STATE_MATRIX_INVTRANS
},
75 { "gl_ProjectionMatrixTranspose", STATE_PROJECTION_MATRIX
, 0 },
76 { "gl_ProjectionMatrixInverseTranspose", STATE_PROJECTION_MATRIX
, STATE_MATRIX_INVERSE
},
78 { "gl_ModelViewProjectionMatrix", STATE_MVP_MATRIX
, STATE_MATRIX_TRANSPOSE
},
79 { "gl_ModelViewProjectionMatrixInverse", STATE_MVP_MATRIX
, STATE_MATRIX_INVTRANS
},
80 { "gl_ModelViewProjectionMatrixTranspose", STATE_MVP_MATRIX
, 0 },
81 { "gl_ModelViewProjectionMatrixInverseTranspose", STATE_MVP_MATRIX
, STATE_MATRIX_INVERSE
},
83 { "gl_TextureMatrix", STATE_TEXTURE_MATRIX
, STATE_MATRIX_TRANSPOSE
},
84 { "gl_TextureMatrixInverse", STATE_TEXTURE_MATRIX
, STATE_MATRIX_INVTRANS
},
85 { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX
, 0 },
86 { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX
, STATE_MATRIX_INVERSE
},
88 { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX
, STATE_MATRIX_INVERSE
},
92 gl_state_index tokens
[STATE_LENGTH
];
94 GLboolean isMatrix
= GL_FALSE
;
96 for (i
= 0; i
< STATE_LENGTH
; i
++) {
99 *swizzleOut
= SWIZZLE_NOOP
;
101 /* first, look if var is a pre-defined matrix */
102 for (i
= 0; matrices
[i
].name
; i
++) {
103 if (strcmp(var
, matrices
[i
].name
) == 0) {
104 tokens
[0] = matrices
[i
].matrix
;
105 /* tokens[1], [2] and [3] filled below */
106 tokens
[4] = matrices
[i
].modifier
;
113 if (tokens
[0] == STATE_TEXTURE_MATRIX
) {
114 /* texture_matrix[index1][index2] */
115 tokens
[1] = index1
>= 0 ? index1
: 0; /* which texture matrix */
116 index1
= index2
; /* move matrix row value to index1 */
119 /* index1 is unused: prevent extra addition at end of function */
123 else if (strcmp(var
, "gl_DepthRange") == 0) {
124 tokens
[0] = STATE_DEPTH_RANGE
;
125 if (strcmp(field
, "near") == 0) {
126 *swizzleOut
= SWIZZLE_XXXX
;
128 else if (strcmp(field
, "far") == 0) {
129 *swizzleOut
= SWIZZLE_YYYY
;
131 else if (strcmp(field
, "diff") == 0) {
132 *swizzleOut
= SWIZZLE_ZZZZ
;
138 else if (strcmp(var
, "gl_ClipPlane") == 0) {
141 tokens
[0] = STATE_CLIPPLANE
;
144 else if (strcmp(var
, "gl_Point") == 0) {
145 if (strcmp(field
, "size") == 0) {
146 tokens
[0] = STATE_POINT_SIZE
;
147 *swizzleOut
= SWIZZLE_XXXX
;
149 else if (strcmp(field
, "sizeMin") == 0) {
150 tokens
[0] = STATE_POINT_SIZE
;
151 *swizzleOut
= SWIZZLE_YYYY
;
153 else if (strcmp(field
, "sizeMax") == 0) {
154 tokens
[0] = STATE_POINT_SIZE
;
155 *swizzleOut
= SWIZZLE_ZZZZ
;
157 else if (strcmp(field
, "fadeThresholdSize") == 0) {
158 tokens
[0] = STATE_POINT_SIZE
;
159 *swizzleOut
= SWIZZLE_WWWW
;
161 else if (strcmp(field
, "distanceConstantAttenuation") == 0) {
162 tokens
[0] = STATE_POINT_ATTENUATION
;
163 *swizzleOut
= SWIZZLE_XXXX
;
165 else if (strcmp(field
, "distanceLinearAttenuation") == 0) {
166 tokens
[0] = STATE_POINT_ATTENUATION
;
167 *swizzleOut
= SWIZZLE_YYYY
;
169 else if (strcmp(field
, "distanceQuadraticAttenuation") == 0) {
170 tokens
[0] = STATE_POINT_ATTENUATION
;
171 *swizzleOut
= SWIZZLE_ZZZZ
;
177 else if (strcmp(var
, "gl_FrontMaterial") == 0 ||
178 strcmp(var
, "gl_BackMaterial") == 0) {
179 tokens
[0] = STATE_MATERIAL
;
180 if (strcmp(var
, "gl_FrontMaterial") == 0)
184 if (strcmp(field
, "emission") == 0) {
185 tokens
[2] = STATE_EMISSION
;
187 else if (strcmp(field
, "ambient") == 0) {
188 tokens
[2] = STATE_AMBIENT
;
190 else if (strcmp(field
, "diffuse") == 0) {
191 tokens
[2] = STATE_DIFFUSE
;
193 else if (strcmp(field
, "specular") == 0) {
194 tokens
[2] = STATE_SPECULAR
;
196 else if (strcmp(field
, "shininess") == 0) {
197 tokens
[2] = STATE_SHININESS
;
198 *swizzleOut
= SWIZZLE_XXXX
;
204 else if (strcmp(var
, "gl_LightSource") == 0) {
205 if (!field
|| index1
< 0)
208 tokens
[0] = STATE_LIGHT
;
211 if (strcmp(field
, "ambient") == 0) {
212 tokens
[2] = STATE_AMBIENT
;
214 else if (strcmp(field
, "diffuse") == 0) {
215 tokens
[2] = STATE_DIFFUSE
;
217 else if (strcmp(field
, "specular") == 0) {
218 tokens
[2] = STATE_SPECULAR
;
220 else if (strcmp(field
, "position") == 0) {
221 tokens
[2] = STATE_POSITION
;
223 else if (strcmp(field
, "halfVector") == 0) {
224 tokens
[2] = STATE_HALF_VECTOR
;
226 else if (strcmp(field
, "spotDirection") == 0) {
227 tokens
[2] = STATE_SPOT_DIRECTION
;
229 else if (strcmp(field
, "spotCosCutoff") == 0) {
230 tokens
[2] = STATE_SPOT_DIRECTION
;
231 *swizzleOut
= SWIZZLE_WWWW
;
233 else if (strcmp(field
, "spotCutoff") == 0) {
234 tokens
[2] = STATE_SPOT_CUTOFF
;
235 *swizzleOut
= SWIZZLE_XXXX
;
237 else if (strcmp(field
, "spotExponent") == 0) {
238 tokens
[2] = STATE_ATTENUATION
;
239 *swizzleOut
= SWIZZLE_WWWW
;
241 else if (strcmp(field
, "constantAttenuation") == 0) {
242 tokens
[2] = STATE_ATTENUATION
;
243 *swizzleOut
= SWIZZLE_XXXX
;
245 else if (strcmp(field
, "linearAttenuation") == 0) {
246 tokens
[2] = STATE_ATTENUATION
;
247 *swizzleOut
= SWIZZLE_YYYY
;
249 else if (strcmp(field
, "quadraticAttenuation") == 0) {
250 tokens
[2] = STATE_ATTENUATION
;
251 *swizzleOut
= SWIZZLE_ZZZZ
;
257 else if (strcmp(var
, "gl_LightModel") == 0) {
258 if (strcmp(field
, "ambient") == 0) {
259 tokens
[0] = STATE_LIGHTMODEL_AMBIENT
;
265 else if (strcmp(var
, "gl_FrontLightModelProduct") == 0) {
266 if (strcmp(field
, "sceneColor") == 0) {
267 tokens
[0] = STATE_LIGHTMODEL_SCENECOLOR
;
274 else if (strcmp(var
, "gl_BackLightModelProduct") == 0) {
275 if (strcmp(field
, "sceneColor") == 0) {
276 tokens
[0] = STATE_LIGHTMODEL_SCENECOLOR
;
283 else if (strcmp(var
, "gl_FrontLightProduct") == 0 ||
284 strcmp(var
, "gl_BackLightProduct") == 0) {
285 if (index1
< 0 || !field
)
288 tokens
[0] = STATE_LIGHTPROD
;
289 tokens
[1] = index1
; /* light number */
290 if (strcmp(var
, "gl_FrontLightProduct") == 0) {
291 tokens
[2] = 0; /* front */
294 tokens
[2] = 1; /* back */
296 if (strcmp(field
, "ambient") == 0) {
297 tokens
[3] = STATE_AMBIENT
;
299 else if (strcmp(field
, "diffuse") == 0) {
300 tokens
[3] = STATE_DIFFUSE
;
302 else if (strcmp(field
, "specular") == 0) {
303 tokens
[3] = STATE_SPECULAR
;
309 else if (strcmp(var
, "gl_TextureEnvColor") == 0) {
312 tokens
[0] = STATE_TEXENV_COLOR
;
315 else if (strcmp(var
, "gl_EyePlaneS") == 0) {
318 tokens
[0] = STATE_TEXGEN
;
319 tokens
[1] = index1
; /* tex unit */
320 tokens
[2] = STATE_TEXGEN_EYE_S
;
322 else if (strcmp(var
, "gl_EyePlaneT") == 0) {
325 tokens
[0] = STATE_TEXGEN
;
326 tokens
[1] = index1
; /* tex unit */
327 tokens
[2] = STATE_TEXGEN_EYE_T
;
329 else if (strcmp(var
, "gl_EyePlaneR") == 0) {
332 tokens
[0] = STATE_TEXGEN
;
333 tokens
[1] = index1
; /* tex unit */
334 tokens
[2] = STATE_TEXGEN_EYE_R
;
336 else if (strcmp(var
, "gl_EyePlaneQ") == 0) {
339 tokens
[0] = STATE_TEXGEN
;
340 tokens
[1] = index1
; /* tex unit */
341 tokens
[2] = STATE_TEXGEN_EYE_Q
;
343 else if (strcmp(var
, "gl_ObjectPlaneS") == 0) {
346 tokens
[0] = STATE_TEXGEN
;
347 tokens
[1] = index1
; /* tex unit */
348 tokens
[2] = STATE_TEXGEN_OBJECT_S
;
350 else if (strcmp(var
, "gl_ObjectPlaneT") == 0) {
353 tokens
[0] = STATE_TEXGEN
;
354 tokens
[1] = index1
; /* tex unit */
355 tokens
[2] = STATE_TEXGEN_OBJECT_T
;
357 else if (strcmp(var
, "gl_ObjectPlaneR") == 0) {
360 tokens
[0] = STATE_TEXGEN
;
361 tokens
[1] = index1
; /* tex unit */
362 tokens
[2] = STATE_TEXGEN_OBJECT_R
;
364 else if (strcmp(var
, "gl_ObjectPlaneQ") == 0) {
367 tokens
[0] = STATE_TEXGEN
;
368 tokens
[1] = index1
; /* tex unit */
369 tokens
[2] = STATE_TEXGEN_OBJECT_Q
;
371 else if (strcmp(var
, "gl_Fog") == 0) {
372 if (strcmp(field
, "color") == 0) {
373 tokens
[0] = STATE_FOG_COLOR
;
375 else if (strcmp(field
, "density") == 0) {
376 tokens
[0] = STATE_FOG_PARAMS
;
377 *swizzleOut
= SWIZZLE_XXXX
;
379 else if (strcmp(field
, "start") == 0) {
380 tokens
[0] = STATE_FOG_PARAMS
;
381 *swizzleOut
= SWIZZLE_YYYY
;
383 else if (strcmp(field
, "end") == 0) {
384 tokens
[0] = STATE_FOG_PARAMS
;
385 *swizzleOut
= SWIZZLE_ZZZZ
;
387 else if (strcmp(field
, "scale") == 0) {
388 tokens
[0] = STATE_FOG_PARAMS
;
389 *swizzleOut
= SWIZZLE_WWWW
;
400 /* load all four columns of matrix */
403 for (j
= 0; j
< 4; j
++) {
404 tokens
[2] = tokens
[3] = j
; /* jth row of matrix */
405 pos
[j
] = _mesa_add_state_reference(paramList
, tokens
);
409 return pos
[0] + index1
;
412 /* allocate a single register */
413 GLint pos
= _mesa_add_state_reference(paramList
, tokens
);
422 * Given a variable name and datatype, emit uniform/constant buffer
423 * entries which will store that state variable.
424 * For example, if name="gl_LightSource" we'll emit 64 state variable
425 * vectors/references and return position where that data starts. This will
426 * allow run-time array indexing into the light source array.
428 * Note that this is a recursive function.
430 * \return -1 if error, else index of start of data in the program parameter list
433 emit_statevars(const char *name
, int array_len
,
434 const slang_type_specifier
*type
,
435 gl_state_index tokens
[STATE_LENGTH
],
436 struct gl_program_parameter_list
*paramList
)
438 if (type
->type
== SLANG_SPEC_ARRAY
) {
440 assert(array_len
> 0);
441 if (strcmp(name
, "gl_ClipPlane") == 0) {
442 tokens
[0] = STATE_CLIPPLANE
;
444 else if (strcmp(name
, "gl_LightSource") == 0) {
445 tokens
[0] = STATE_LIGHT
;
447 else if (strcmp(name
, "gl_FrontLightProduct") == 0) {
448 tokens
[0] = STATE_LIGHTPROD
;
449 tokens
[2] = 0; /* front */
451 else if (strcmp(name
, "gl_BackLightProduct") == 0) {
452 tokens
[0] = STATE_LIGHTPROD
;
453 tokens
[2] = 1; /* back */
455 else if (strcmp(name
, "gl_TextureEnvColor") == 0) {
456 tokens
[0] = STATE_TEXENV_COLOR
;
458 else if (strcmp(name
, "gl_EyePlaneS") == 0) {
459 tokens
[0] = STATE_TEXGEN
;
460 tokens
[2] = STATE_TEXGEN_EYE_S
;
462 else if (strcmp(name
, "gl_EyePlaneT") == 0) {
463 tokens
[0] = STATE_TEXGEN
;
464 tokens
[2] = STATE_TEXGEN_EYE_T
;
466 else if (strcmp(name
, "gl_EyePlaneR") == 0) {
467 tokens
[0] = STATE_TEXGEN
;
468 tokens
[2] = STATE_TEXGEN_EYE_R
;
470 else if (strcmp(name
, "gl_EyePlaneQ") == 0) {
471 tokens
[0] = STATE_TEXGEN
;
472 tokens
[2] = STATE_TEXGEN_EYE_Q
;
474 else if (strcmp(name
, "gl_ObjectPlaneS") == 0) {
475 tokens
[0] = STATE_TEXGEN
;
476 tokens
[2] = STATE_TEXGEN_OBJECT_S
;
478 else if (strcmp(name
, "gl_ObjectPlaneT") == 0) {
479 tokens
[0] = STATE_TEXGEN
;
480 tokens
[2] = STATE_TEXGEN_OBJECT_T
;
482 else if (strcmp(name
, "gl_ObjectPlaneR") == 0) {
483 tokens
[0] = STATE_TEXGEN
;
484 tokens
[2] = STATE_TEXGEN_OBJECT_R
;
486 else if (strcmp(name
, "gl_ObjectPlaneQ") == 0) {
487 tokens
[0] = STATE_TEXGEN
;
488 tokens
[2] = STATE_TEXGEN_OBJECT_Q
;
491 return -1; /* invalid array name */
493 for (i
= 0; i
< array_len
; i
++) {
496 p
= emit_statevars(NULL
, 0, type
->_array
, tokens
, paramList
);
502 else if (type
->type
== SLANG_SPEC_STRUCT
) {
503 const slang_variable_scope
*fields
= type
->_struct
->fields
;
505 for (i
= 0; i
< fields
->num_variables
; i
++) {
506 const slang_variable
*var
= fields
->variables
[i
];
507 GLint p
= emit_statevars(var
->a_name
, 0, &var
->type
.specifier
,
516 assert(type
->type
== SLANG_SPEC_VEC4
||
517 type
->type
== SLANG_SPEC_VEC3
||
518 type
->type
== SLANG_SPEC_VEC2
||
519 type
->type
== SLANG_SPEC_FLOAT
||
520 type
->type
== SLANG_SPEC_IVEC4
||
521 type
->type
== SLANG_SPEC_IVEC3
||
522 type
->type
== SLANG_SPEC_IVEC2
||
523 type
->type
== SLANG_SPEC_INT
);
527 if (tokens
[0] == STATE_LIGHT
)
529 else if (tokens
[0] == STATE_LIGHTPROD
)
532 return -1; /* invalid array name */
534 if (strcmp(name
, "ambient") == 0) {
535 tokens
[t
] = STATE_AMBIENT
;
537 else if (strcmp(name
, "diffuse") == 0) {
538 tokens
[t
] = STATE_DIFFUSE
;
540 else if (strcmp(name
, "specular") == 0) {
541 tokens
[t
] = STATE_SPECULAR
;
543 else if (strcmp(name
, "position") == 0) {
544 tokens
[t
] = STATE_POSITION
;
546 else if (strcmp(name
, "halfVector") == 0) {
547 tokens
[t
] = STATE_HALF_VECTOR
;
549 else if (strcmp(name
, "spotDirection") == 0) {
550 tokens
[t
] = STATE_SPOT_DIRECTION
; /* xyz components */
552 else if (strcmp(name
, "spotCosCutoff") == 0) {
553 tokens
[t
] = STATE_SPOT_DIRECTION
; /* w component */
556 else if (strcmp(name
, "constantAttenuation") == 0) {
557 tokens
[t
] = STATE_ATTENUATION
; /* x component */
559 else if (strcmp(name
, "linearAttenuation") == 0) {
560 tokens
[t
] = STATE_ATTENUATION
; /* y component */
562 else if (strcmp(name
, "quadraticAttenuation") == 0) {
563 tokens
[t
] = STATE_ATTENUATION
; /* z component */
565 else if (strcmp(name
, "spotExponent") == 0) {
566 tokens
[t
] = STATE_ATTENUATION
; /* w = spot exponent */
569 else if (strcmp(name
, "spotCutoff") == 0) {
570 tokens
[t
] = STATE_SPOT_CUTOFF
; /* x component */
574 return -1; /* invalid field name */
578 pos
= _mesa_add_state_reference(paramList
, tokens
);
587 * Unroll the named built-in uniform variable into a sequence of state
588 * vars in the given parameter list.
591 alloc_state_var_array(const slang_variable
*var
,
592 struct gl_program_parameter_list
*paramList
)
594 gl_state_index tokens
[STATE_LENGTH
];
598 /* Initialize the state tokens array. This is very important.
599 * When we call _mesa_add_state_reference() it'll searches the parameter
600 * list to see if the given statevar token sequence is already present.
601 * This is normally a good thing since it prevents redundant values in the
604 * But when we're building arrays of state this can be bad. For example,
605 * consider this fragment of GLSL code:
606 * foo = gl_LightSource[3].diffuse;
608 * bar = gl_LightSource[i].diffuse;
610 * When we unroll the gl_LightSource array (for "bar") we want to re-emit
611 * gl_LightSource[3].diffuse and not re-use the first instance (from "foo")
612 * since that would upset the array layout. We handle this situation by
613 * setting the last token in the state var token array to the special
615 * This token will only be set for array state. We can hijack the last
616 * element in the array for this since it's never used for light, clipplane
617 * or texture env array state.
619 for (i
= 0; i
< STATE_LENGTH
; i
++)
621 tokens
[STATE_LENGTH
- 1] = STATE_ARRAY
;
623 pos
= emit_statevars(var
->a_name
, var
->array_len
, &var
->type
.specifier
,
632 * Allocate storage for a pre-defined uniform (a GL state variable).
633 * As a memory-saving optimization, we try to only allocate storage for
634 * state vars that are actually used.
636 * Arrays such as gl_LightSource are handled specially. For an expression
637 * like "gl_LightSource[2].diffuse", we can allocate a single uniform/constant
638 * slot and return the index. In this case, we return direct=TRUE.
640 * Buf for something like "gl_LightSource[i].diffuse" we don't know the value
641 * of 'i' at compile time so we need to "unroll" the gl_LightSource array
642 * into a consecutive sequence of uniform/constant slots so it can be indexed
643 * at runtime. In this case, we return direct=FALSE.
645 * Currently, all pre-defined uniforms are in one of these forms:
652 * \return -1 upon error, else position in paramList of the state variable/data
655 _slang_alloc_statevar(slang_ir_node
*n
,
656 struct gl_program_parameter_list
*paramList
,
659 slang_ir_node
*n0
= n
;
660 const char *field
= NULL
;
661 GLint index1
= -1, index2
= -1;
666 if (n
->Opcode
== IR_FIELD
) {
671 if (n
->Opcode
== IR_ELEMENT
) {
672 if (n
->Children
[1]->Opcode
== IR_FLOAT
) {
673 index1
= (GLint
) n
->Children
[1]->Value
[0];
681 if (n
->Opcode
== IR_ELEMENT
) {
682 /* XXX can only handle constant indexes for now */
683 if (n
->Children
[1]->Opcode
== IR_FLOAT
) {
684 /* two-dimensional array index: mat[i][j] */
686 index1
= (GLint
) n
->Children
[1]->Value
[0];
694 assert(n
->Opcode
== IR_VAR
);
697 const char *var
= (const char *) n
->Var
->a_name
;
699 lookup_statevar(var
, index1
, index2
, field
, &swizzle
, paramList
);
701 /* newly resolved storage for the statevar/constant/uniform */
702 n0
->Store
->File
= PROGRAM_STATE_VAR
;
703 n0
->Store
->Index
= pos
;
704 n0
->Store
->Swizzle
= swizzle
;
705 n0
->Store
->Parent
= NULL
;
711 return alloc_state_var_array(n
->Var
, paramList
);