[MESA]
authorJérôme Gardou <jerome.gardou@reactos.org>
Mon, 7 Oct 2013 13:53:08 +0000 (13:53 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Mon, 7 Oct 2013 13:53:08 +0000 (13:53 +0000)
 - leaner build part 13 of X
 - Get rid of shaders and programs support (with assorted extensions), ARB_multitexture and ATI_envmap_bumpmap extensions.
CORE-7499

svn path=/trunk/; revision=60576

486 files changed:
reactos/dll/opengl/mesa/src/CMakeLists.txt
reactos/dll/opengl/mesa/src/glsl/CMakeLists.txt [deleted file]
reactos/dll/opengl/mesa/src/glsl/Makefile.sources [deleted file]
reactos/dll/opengl/mesa/src/glsl/README [deleted file]
reactos/dll/opengl/mesa/src/glsl/SConscript [deleted file]
reactos/dll/opengl/mesa/src/glsl/TODO [deleted file]
reactos/dll/opengl/mesa/src/glsl/ast.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ast_expr.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ast_function.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ast_to_hir.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ast_type.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/builtin_stubs.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/builtin_types.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/builtin_variables.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/README [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-lex.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-lex.l [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-parse.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-parse.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp-parse.y [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/glcpp.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/pp.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/000-content-with-spaces.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/000-content-with-spaces.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/001-define.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/001-define.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/002-define-chain.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/002-define-chain.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/003-define-chain-reverse.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/004-define-recursive.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/004-define-recursive.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/005-define-composite-chain.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/005-define-composite-chain.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/007-define-composite-recursive.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/008-define-empty.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/008-define-empty.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/009-undef.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/009-undef.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/010-undef-re-define.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/010-undef-re-define.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/011-define-func-empty.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/011-define-func-empty.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/012-define-func-no-args.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/012-define-func-no-args.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/015-define-object-with-parens.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/016-define-func-1-arg.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/017-define-func-2-args.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/017-define-func-2-args.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/021-define-func-compose.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/021-define-func-compose.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/023-define-extra-whitespace.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/026-define-func-extra-newlines.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/032-define-func-self-recurse.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/033-define-func-self-compose.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/038-func-arg-with-commas.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/040-token-pasting.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/040-token-pasting.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/041-if-0.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/041-if-0.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/042-if-1.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/042-if-1.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/043-if-0-else.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/043-if-0-else.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/044-if-1-else.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/044-if-1-else.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/045-if-0-elif.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/045-if-0-elif.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/046-if-1-elsif.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/046-if-1-elsif.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/047-if-elif-else.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/047-if-elif-else.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/048-if-nested.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/048-if-nested.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/049-if-expression-precedence.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/050-if-defined.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/050-if-defined.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/051-if-relational.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/051-if-relational.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/052-if-bitwise.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/052-if-bitwise.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/053-if-divide-and-shift.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/054-if-with-macros.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/054-if-with-macros.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/056-macro-argument-with-comma.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/057-empty-arguments.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/057-empty-arguments.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/059-token-pasting-integer.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/062-if-0-skips-garbage.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/063-comments.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/063-comments.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/064-version.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/064-version.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/065-if-defined-parens.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/065-if-defined-parens.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/066-if-nospace-expression.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/068-accidental-pasting.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/068-accidental-pasting.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/069-repeated-argument.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/069-repeated-argument.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/071-punctuator.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/071-punctuator.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/072-token-pasting-same-line.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/073-if-in-ifdef.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/074-elif-undef.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/074-elif-undef.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/075-elif-elif-undef.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/076-elif-undef-nested.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/077-else-without-if.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/077-else-without-if.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/078-elif-without-if.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/078-elif-without-if.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/079-endif-without-if.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/079-endif-without-if.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/080-if-without-expression.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/080-if-without-expression.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/081-elif-without-expression.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/081-elif-without-expression.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/082-invalid-paste.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/082-invalid-paste.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/083-unterminated-if.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/083-unterminated-if.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/084-unbalanced-parentheses.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/085-incorrect-argument-count.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/086-reserved-macro-names.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/087-if-comments.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/087-if-comments.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/088-redefine-macro-legitimate.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/089-redefine-macro-error.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/089-redefine-macro-error.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/090-hash-error.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/090-hash-error.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/091-hash-line.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/091-hash-line.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/092-redefine-macro-error-2.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/092-redefine-macro-error-2.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/093-divide-by-zero.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/093-divide-by-zero.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/095-recursive-define.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/095-recursive-define.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/096-paste-twice.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/096-paste-twice.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/097-paste-with-non-function-macro.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/097-paste-with-non-function-macro.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/098-elif-undefined.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/098-elif-undefined.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/099-c99-example.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/099-c99-example.c.expected [deleted file]
reactos/dll/opengl/mesa/src/glsl/glcpp/tests/glcpp-test [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_lexer.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_lexer.ll [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_parser.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_parser.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_parser.yy [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_parser_extras.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_parser_extras.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_symbol_table.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_symbol_table.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_types.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/glsl_types.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/hir_field_selection.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_basic_block.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_basic_block.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_clone.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_constant_expression.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_expression_flattening.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_expression_flattening.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_function.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_function_can_inline.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_function_detect_recursion.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_function_inlining.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_hierarchical_visitor.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_hierarchical_visitor.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_hv_accept.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_import_prototypes.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_optimization.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_print_visitor.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_print_visitor.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_reader.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_reader.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_rvalue_visitor.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_rvalue_visitor.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_set_program_inouts.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_uniform.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_validate.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_variable_refcount.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_variable_refcount.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ir_visitor.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/link_functions.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/link_uniforms.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/linker.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/linker.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/list.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/loop_analysis.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/loop_analysis.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/loop_controls.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/loop_unroll.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_clip_distance.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_discard.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_if_to_cond_assign.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_instructions.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_jumps.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_mat_op_to_vec.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_noise.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_output_reads.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_texture_projection.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_variable_index_to_cond_assign.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_vec_index_to_cond_assign.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_vec_index_to_swizzle.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/lower_vector.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/main.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_algebraic.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_constant_folding.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_constant_propagation.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_constant_variable.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_copy_propagation.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_copy_propagation_elements.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_dead_code.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_dead_code_local.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_dead_functions.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_discard_simplification.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_function_inlining.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_if_simplification.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_noop_swizzle.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_redundant_jumps.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_structure_splitting.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_swizzle_swizzle.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/opt_tree_grafting.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/program.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/ralloc.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/ralloc.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/s_expression.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/s_expression.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/standalone_scaffolding.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/standalone_scaffolding.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/strtod.c [deleted file]
reactos/dll/opengl/mesa/src/glsl/strtod.h [deleted file]
reactos/dll/opengl/mesa/src/glsl/test.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/test_optpass.cpp [deleted file]
reactos/dll/opengl/mesa/src/glsl/test_optpass.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/CMakeLists.txt
reactos/dll/opengl/mesa/src/mesa/drivers/common/driverfuncs.c
reactos/dll/opengl/mesa/src/mesa/drivers/common/meta.c
reactos/dll/opengl/mesa/src/mesa/drivers/common/meta.h
reactos/dll/opengl/mesa/src/mesa/main/CMakeLists.txt
reactos/dll/opengl/mesa/src/mesa/main/api_arrayelt.c
reactos/dll/opengl/mesa/src/mesa/main/api_exec.c
reactos/dll/opengl/mesa/src/mesa/main/api_loopback.c
reactos/dll/opengl/mesa/src/mesa/main/api_validate.c
reactos/dll/opengl/mesa/src/mesa/main/arbprogram.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/arbprogram.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/attrib.c
reactos/dll/opengl/mesa/src/mesa/main/config.h
reactos/dll/opengl/mesa/src/mesa/main/context.c
reactos/dll/opengl/mesa/src/mesa/main/dd.h
reactos/dll/opengl/mesa/src/mesa/main/dispatch.h
reactos/dll/opengl/mesa/src/mesa/main/dlist.c
reactos/dll/opengl/mesa/src/mesa/main/drawpix.c
reactos/dll/opengl/mesa/src/mesa/main/enable.c
reactos/dll/opengl/mesa/src/mesa/main/eval.c
reactos/dll/opengl/mesa/src/mesa/main/extensions.c
reactos/dll/opengl/mesa/src/mesa/main/format_pack.c
reactos/dll/opengl/mesa/src/mesa/main/format_unpack.c
reactos/dll/opengl/mesa/src/mesa/main/formats.c
reactos/dll/opengl/mesa/src/mesa/main/formats.h
reactos/dll/opengl/mesa/src/mesa/main/get.c
reactos/dll/opengl/mesa/src/mesa/main/getstring.c
reactos/dll/opengl/mesa/src/mesa/main/hint.c
reactos/dll/opengl/mesa/src/mesa/main/image.c
reactos/dll/opengl/mesa/src/mesa/main/image.h
reactos/dll/opengl/mesa/src/mesa/main/matrix.c
reactos/dll/opengl/mesa/src/mesa/main/mtypes.h
reactos/dll/opengl/mesa/src/mesa/main/nvprogram.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/nvprogram.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/pack.c
reactos/dll/opengl/mesa/src/mesa/main/pack.h
reactos/dll/opengl/mesa/src/mesa/main/points.c
reactos/dll/opengl/mesa/src/mesa/main/rastpos.c
reactos/dll/opengl/mesa/src/mesa/main/shader_query.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/shaderapi.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/shaderapi.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/shaderobj.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/shaderobj.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/shared.c
reactos/dll/opengl/mesa/src/mesa/main/state.c
reactos/dll/opengl/mesa/src/mesa/main/state.h
reactos/dll/opengl/mesa/src/mesa/main/texenv.c
reactos/dll/opengl/mesa/src/mesa/main/texenv.h
reactos/dll/opengl/mesa/src/mesa/main/texformat.c
reactos/dll/opengl/mesa/src/mesa/main/texgen.c
reactos/dll/opengl/mesa/src/mesa/main/texgetimage.c
reactos/dll/opengl/mesa/src/mesa/main/teximage.c
reactos/dll/opengl/mesa/src/mesa/main/teximage.h
reactos/dll/opengl/mesa/src/mesa/main/texobj.c
reactos/dll/opengl/mesa/src/mesa/main/texparam.c
reactos/dll/opengl/mesa/src/mesa/main/texstate.c
reactos/dll/opengl/mesa/src/mesa/main/texstate.h
reactos/dll/opengl/mesa/src/mesa/main/texstorage.c
reactos/dll/opengl/mesa/src/mesa/main/texstore.c
reactos/dll/opengl/mesa/src/mesa/main/uniform_query.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/uniforms.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/uniforms.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/main/varray.c
reactos/dll/opengl/mesa/src/mesa/main/varray.h
reactos/dll/opengl/mesa/src/mesa/main/version.c
reactos/dll/opengl/mesa/src/mesa/main/version.h
reactos/dll/opengl/mesa/src/mesa/main/vtxfmt.c
reactos/dll/opengl/mesa/src/mesa/program/CMakeLists.txt [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/arbprogparse.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/arbprogparse.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/hash_table.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/hash_table.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/ir_to_mesa.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/ir_to_mesa.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/lex.yy.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/nvfragparse.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/nvfragparse.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/nvvertparse.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/nvvertparse.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_cache.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_cache.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_execute.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_execute.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_instruction.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_instruction.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_noise.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_noise.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_opt_constant_fold.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_optimize.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_optimize.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_parameter.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_parameter.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_parameter_layout.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_parameter_layout.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_print.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_print.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_statevars.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/prog_statevars.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_lexer.l [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_parse.tab.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_parse.tab.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_parse.y [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_parse_extra.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/program_parser.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/programopt.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/programopt.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/register_allocate.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/register_allocate.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/sampler.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/sampler.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/string_to_uint_map.cpp [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/symbol_table.c [deleted file]
reactos/dll/opengl/mesa/src/mesa/program/symbol_table.h [deleted file]
reactos/dll/opengl/mesa/src/mesa/swrast/s_aaline.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_aalinetemp.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_aatriangle.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_context.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_context.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_drawpix.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_feedback.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_lines.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_points.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_span.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_span.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_texcombine.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_texfetch.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_texfetch_tmp.h
reactos/dll/opengl/mesa/src/mesa/swrast/s_texfilter.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_texture.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_triangle.c
reactos/dll/opengl/mesa/src/mesa/swrast/s_tritemp.h
reactos/dll/opengl/mesa/src/mesa/swrast/swrast.h
reactos/dll/opengl/mesa/src/mesa/swrast_setup/ss_context.c
reactos/dll/opengl/mesa/src/mesa/swrast_setup/ss_triangle.c
reactos/dll/opengl/mesa/src/mesa/swrast_setup/ss_tritmp.h
reactos/dll/opengl/mesa/src/mesa/swrast_setup/swrast_setup.h
reactos/dll/opengl/mesa/src/mesa/tnl/t_context.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_context.h
reactos/dll/opengl/mesa/src/mesa/tnl/t_draw.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_pipeline.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_rasterpos.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_fog.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_light.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_normals.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_points.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_texgen.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_texmat.c
reactos/dll/opengl/mesa/src/mesa/tnl/t_vb_vertex.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_attrib.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_attrib_tmp.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_context.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_context.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec.h
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec_api.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec_array.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec_draw.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_exec_eval.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_noop.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_rebase.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_save.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_save_api.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_save_draw.c
reactos/dll/opengl/mesa/src/mesa/vbo/vbo_split_copy.c
reactos/dll/opengl/mesa/src/mesa/x86/gen_matypes.c
reactos/dll/opengl/opengl32/CMakeLists.txt

diff --git a/reactos/dll/opengl/mesa/src/glsl/CMakeLists.txt b/reactos/dll/opengl/mesa/src/glsl/CMakeLists.txt
deleted file mode 100644 (file)
index fde70ec..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-
-set_cpp(WITH_STL)
-
-# From Sconscript
-include_directories(
-    ../mapi
-    ../mesa
-    .
-    glcpp
-    ../../generated/glsl)
-
-list(APPEND SOURCE
-# generated files
-    ../../generated/glsl/glcpp/glcpp-lex.c
-    ../../generated/glsl/glcpp/glcpp-parse.c
-    ../../generated/glsl/glsl_lexer.cpp
-    ../../generated/glsl/glsl_parser.cpp
-    ../../generated/glsl/builtin_function.cpp
-# Regular files
-    strtod.c
-    ralloc.c
-    glcpp/pp.c
-    ast_expr.cpp
-    ast_function.cpp
-    ast_to_hir.cpp
-    ast_type.cpp
-    builtin_variables.cpp
-    glsl_parser_extras.cpp
-    glsl_types.cpp
-    glsl_symbol_table.cpp
-    hir_field_selection.cpp
-    ir_basic_block.cpp
-    ir_clone.cpp
-    ir_constant_expression.cpp
-    ir.cpp
-    ir_expression_flattening.cpp
-    ir_function_can_inline.cpp
-    ir_function_detect_recursion.cpp
-    ir_function.cpp
-    ir_hierarchical_visitor.cpp
-    ir_hv_accept.cpp
-    ir_import_prototypes.cpp
-    ir_print_visitor.cpp
-    ir_reader.cpp
-    ir_rvalue_visitor.cpp
-    ir_set_program_inouts.cpp
-    ir_validate.cpp
-    ir_variable_refcount.cpp
-    linker.cpp
-    link_functions.cpp
-    link_uniforms.cpp
-    loop_analysis.cpp
-    loop_controls.cpp
-    loop_unroll.cpp
-    lower_clip_distance.cpp
-    lower_discard.cpp
-    lower_if_to_cond_assign.cpp
-    lower_instructions.cpp
-    lower_jumps.cpp
-    lower_mat_op_to_vec.cpp
-    lower_noise.cpp
-    lower_texture_projection.cpp
-    lower_variable_index_to_cond_assign.cpp
-    lower_vec_index_to_cond_assign.cpp
-    lower_vec_index_to_swizzle.cpp
-    lower_vector.cpp
-    lower_output_reads.cpp
-    opt_algebraic.cpp
-    opt_constant_folding.cpp
-    opt_constant_propagation.cpp
-    opt_constant_variable.cpp
-    opt_copy_propagation.cpp
-    opt_copy_propagation_elements.cpp
-    opt_dead_code.cpp
-    opt_dead_code_local.cpp
-    opt_dead_functions.cpp
-    opt_discard_simplification.cpp
-    opt_function_inlining.cpp
-    opt_if_simplification.cpp
-    opt_noop_swizzle.cpp
-    opt_redundant_jumps.cpp
-    opt_structure_splitting.cpp
-    opt_swizzle_swizzle.cpp
-    opt_tree_grafting.cpp
-    s_expression.cpp)
-
-# this is just a helper library, don't include it in the all target
-add_library(mesa_glsl STATIC EXCLUDE_FROM_ALL ${SOURCE})
diff --git a/reactos/dll/opengl/mesa/src/glsl/Makefile.sources b/reactos/dll/opengl/mesa/src/glsl/Makefile.sources
deleted file mode 100644 (file)
index 5e80af2..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# shared source lists for Makefile, SConscript, and Android.mk
-
-# libglcpp
-
-LIBGLCPP_SOURCES := \
-       glcpp/pp.c
-
-LIBGLCPP_GENERATED_SOURCES := \
-       glcpp/glcpp-lex.c \
-       glcpp/glcpp-parse.c
-
-# libglsl
-
-LIBGLSL_SOURCES := \
-       strtod.c \
-       ralloc.c
-
-LIBGLSL_CXX_SOURCES := \
-       ast_expr.cpp \
-       ast_function.cpp \
-       ast_to_hir.cpp \
-       ast_type.cpp \
-       builtin_variables.cpp \
-       glsl_parser_extras.cpp \
-       glsl_types.cpp \
-       glsl_symbol_table.cpp \
-       hir_field_selection.cpp \
-       ir_basic_block.cpp \
-       ir_clone.cpp \
-       ir_constant_expression.cpp \
-       ir.cpp \
-       ir_expression_flattening.cpp \
-       ir_function_can_inline.cpp \
-       ir_function_detect_recursion.cpp \
-       ir_function.cpp \
-       ir_hierarchical_visitor.cpp \
-       ir_hv_accept.cpp \
-       ir_import_prototypes.cpp \
-       ir_print_visitor.cpp \
-       ir_reader.cpp \
-       ir_rvalue_visitor.cpp \
-       ir_set_program_inouts.cpp \
-       ir_validate.cpp \
-       ir_variable_refcount.cpp \
-       linker.cpp \
-       link_functions.cpp \
-       link_uniforms.cpp \
-       loop_analysis.cpp \
-       loop_controls.cpp \
-       loop_unroll.cpp \
-       lower_clip_distance.cpp \
-       lower_discard.cpp \
-       lower_if_to_cond_assign.cpp \
-       lower_instructions.cpp \
-       lower_jumps.cpp \
-       lower_mat_op_to_vec.cpp \
-       lower_noise.cpp \
-       lower_texture_projection.cpp \
-       lower_variable_index_to_cond_assign.cpp \
-       lower_vec_index_to_cond_assign.cpp \
-       lower_vec_index_to_swizzle.cpp \
-       lower_vector.cpp \
-       lower_output_reads.cpp \
-       opt_algebraic.cpp \
-       opt_constant_folding.cpp \
-       opt_constant_propagation.cpp \
-       opt_constant_variable.cpp \
-       opt_copy_propagation.cpp \
-       opt_copy_propagation_elements.cpp \
-       opt_dead_code.cpp \
-       opt_dead_code_local.cpp \
-       opt_dead_functions.cpp \
-       opt_discard_simplification.cpp \
-       opt_function_inlining.cpp \
-       opt_if_simplification.cpp \
-       opt_noop_swizzle.cpp \
-       opt_redundant_jumps.cpp \
-       opt_structure_splitting.cpp \
-       opt_swizzle_swizzle.cpp \
-       opt_tree_grafting.cpp \
-       s_expression.cpp
-
-# glsl_compiler
-
-GLSL_COMPILER_CXX_SOURCES := \
-       standalone_scaffolding.cpp \
-       main.cpp
-
-# builtin_compiler
-#
-# This is built before libglsl to generate builtin_funciton.cpp for libglsl.
-# For this to work, a dummy version of builtin_function.cpp,
-# builtin_stubs.cpp, is used.
-
-BUILTIN_COMPILER_CXX_SOURCES := \
-       builtin_stubs.cpp
-
-BUILTIN_COMPILER_GENERATED_CXX_SOURCES := \
-       glsl_lexer.cpp \
-       glsl_parser.cpp
-
-# libglsl generated sources
-LIBGLSL_GENERATED_CXX_SOURCES := \
-       $(BUILTIN_COMPILER_GENERATED_CXX_SOURCES) \
-       builtin_function.cpp
diff --git a/reactos/dll/opengl/mesa/src/glsl/README b/reactos/dll/opengl/mesa/src/glsl/README
deleted file mode 100644 (file)
index dd80a53..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-Welcome to Mesa's GLSL compiler.  A brief overview of how things flow:
-
-1) lex and yacc-based preprocessor takes the incoming shader string
-and produces a new string containing the preprocessed shader.  This
-takes care of things like #if, #ifdef, #define, and preprocessor macro
-invocations.  Note that #version, #extension, and some others are
-passed straight through.  See glcpp/*
-
-2) lex and yacc-based parser takes the preprocessed string and
-generates the AST (abstract syntax tree).  Almost no checking is
-performed in this stage.  See glsl_lexer.lpp and glsl_parser.ypp.
-
-3) The AST is converted to "HIR".  This is the intermediate
-representation of the compiler.  Constructors are generated, function
-calls are resolved to particular function signatures, and all the
-semantic checking is performed.  See ast_*.cpp for the conversion, and
-ir.h for the IR structures.
-
-4) The driver (Mesa, or main.cpp for the standalone binary) performs
-optimizations.  These include copy propagation, dead code elimination,
-constant folding, and others.  Generally the driver will call
-optimizations in a loop, as each may open up opportunities for other
-optimizations to do additional work.  See most files called ir_*.cpp
-
-5) linking is performed.  This does checking to ensure that the
-outputs of the vertex shader match the inputs of the fragment shader,
-and assigns locations to uniforms, attributes, and varyings.  See
-linker.cpp.
-
-6) The driver may perform additional optimization at this point, as
-for example dead code elimination previously couldn't remove functions
-or global variable usage when we didn't know what other code would be
-linked in.
-
-7) The driver performs code generation out of the IR, taking a linked
-shader program and producing a compiled program for each stage.  See
-ir_to_mesa.cpp for Mesa IR code generation.
-
-FAQ:
-
-Q: What is HIR versus IR versus LIR?
-
-A: The idea behind the naming was that ast_to_hir would produce a
-high-level IR ("HIR"), with things like matrix operations, structure
-assignments, etc., present.  A series of lowering passes would occur
-that do things like break matrix multiplication into a series of dot
-products/MADs, make structure assignment be a series of assignment of
-components, flatten if statements into conditional moves, and such,
-producing a low level IR ("LIR").
-
-However, it now appears that each driver will have different
-requirements from a LIR.  A 915-generation chipset wants all functions
-inlined, all loops unrolled, all ifs flattened, no variable array
-accesses, and matrix multiplication broken down.  The Mesa IR backend
-for swrast would like matrices and structure assignment broken down,
-but it can support function calls and dynamic branching.  A 965 vertex
-shader IR backend could potentially even handle some matrix operations
-without breaking them down, but the 965 fragment shader IR backend
-would want to break to have (almost) all operations down channel-wise
-and perform optimization on that.  As a result, there's no single
-low-level IR that will make everyone happy.  So that usage has fallen
-out of favor, and each driver will perform a series of lowering passes
-to take the HIR down to whatever restrictions it wants to impose
-before doing codegen.
-
-Q: How is the IR structured?
-
-A: The best way to get started seeing it would be to run the
-standalone compiler against a shader:
-
-./glsl_compiler --dump-lir \
-       ~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag
-
-So for example one of the ir_instructions in main() contains:
-
-(assign (constant bool (1)) (var_ref litColor)  (expression vec3 * (var_ref Surf
-aceColor) (var_ref __retval) ) )
-
-Or more visually:
-                     (assign)
-                 /       |        \
-        (var_ref)  (expression *)  (constant bool 1)
-         /          /           \
-(litColor)      (var_ref)    (var_ref)
-                  /                  \
-           (SurfaceColor)          (__retval)
-
-which came from:
-
-litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0);
-
-(the max call is not represented in this expression tree, as it was a
-function call that got inlined but not brought into this expression
-tree)
-
-Each of those nodes is a subclass of ir_instruction.  A particular
-ir_instruction instance may only appear once in the whole IR tree with
-the exception of ir_variables, which appear once as variable
-declarations:
-
-(declare () vec3 normDelta)
-
-and multiple times as the targets of variable dereferences:
-...
-(assign (constant bool (1)) (var_ref __retval) (expression float dot
- (var_ref normDelta) (var_ref LightDir) ) )
-...
-(assign (constant bool (1)) (var_ref __retval) (expression vec3 -
- (var_ref LightDir) (expression vec3 * (constant float (2.000000))
- (expression vec3 * (expression float dot (var_ref normDelta) (var_ref
- LightDir) ) (var_ref normDelta) ) ) ) )
-...
-
-Each node has a type.  Expressions may involve several different types:
-(declare (uniform ) mat4 gl_ModelViewMatrix)
-((assign (constant bool (1)) (var_ref constructor_tmp) (expression
- vec4 * (var_ref gl_ModelViewMatrix) (var_ref gl_Vertex) ) )
-
-An expression tree can be arbitrarily deep, and the compiler tries to
-keep them structured like that so that things like algebraic
-optimizations ((color * 1.0 == color) and ((mat1 * mat2) * vec == mat1
-* (mat2 * vec))) or recognizing operation patterns for code generation
-(vec1 * vec2 + vec3 == mad(vec1, vec2, vec3)) are easier.  This comes
-at the expense of additional trickery in implementing some
-optimizations like CSE where one must navigate an expression tree.
-
-Q: Why no SSA representation?
-
-A: Converting an IR tree to SSA form makes dead code elmimination,
-common subexpression elimination, and many other optimizations much
-easier.  However, in our primarily vector-based language, there's some
-major questions as to how it would work.  Do we do SSA on the scalar
-or vector level?  If we do it at the vector level, we're going to end
-up with many different versions of the variable when encountering code
-like:
-
-(assign (constant bool (1)) (swiz x (var_ref __retval) ) (var_ref a) ) 
-(assign (constant bool (1)) (swiz y (var_ref __retval) ) (var_ref b) ) 
-(assign (constant bool (1)) (swiz z (var_ref __retval) ) (var_ref c) ) 
-
-If every masked update of a component relies on the previous value of
-the variable, then we're probably going to be quite limited in our
-dead code elimination wins, and recognizing common expressions may
-just not happen.  On the other hand, if we operate channel-wise, then
-we'll be prone to optimizing the operation on one of the channels at
-the expense of making its instruction flow different from the other
-channels, and a vector-based GPU would end up with worse code than if
-we didn't optimize operations on that channel!
-
-Once again, it appears that our optimization requirements are driven
-significantly by the target architecture.  For now, targeting the Mesa
-IR backend, SSA does not appear to be that important to producing
-excellent code, but we do expect to do some SSA-based optimizations
-for the 965 fragment shader backend when that is developed.
-
-Q: How should I expand instructions that take multiple backend instructions?
-
-Sometimes you'll have to do the expansion in your code generation --
-see, for example, ir_to_mesa.cpp's handling of ir_unop_sqrt.  However,
-in many cases you'll want to do a pass over the IR to convert
-non-native instructions to a series of native instructions.  For
-example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because
-Mesa IR (and many hardware backends) only have a reciprocal
-instruction, not a divide.  Implementing non-native instructions this
-way gives the chance for constant folding to occur, so (a / 2.0)
-becomes (a * 0.5) after codegen instead of (a * (1.0 / 2.0))
-
-Q: How shoud I handle my special hardware instructions with respect to IR?
-
-Our current theory is that if multiple targets have an instruction for
-some operation, then we should probably be able to represent that in
-the IR.  Generally this is in the form of an ir_{bin,un}op expression
-type.  For example, we initially implemented fract() using (a -
-floor(a)), but both 945 and 965 have instructions to give that result,
-and it would also simplify the implementation of mod(), so
-ir_unop_fract was added.  The following areas need updating to add a
-new expression type:
-
-ir.h (new enum)
-ir.cpp:get_num_operands() (used for ir_reader)
-ir.cpp:operator_strs (used for ir_reader)
-ir_constant_expression.cpp (you probably want to be able to constant fold)
-ir_validate.cpp (check users have the right types)
-
-You may also need to update the backends if they will see the new expr type:
-
-../mesa/shaders/ir_to_mesa.cpp
-
-You can then use the new expression from builtins (if all backends
-would rather see it), or scan the IR and convert to use your new
-expression type (see ir_mod_to_fract, for example).
-
-Q: How is memory management handled in the compiler?
-
-The hierarchical memory allocator "talloc" developed for the Samba
-project is used, so that things like optimization passes don't have to
-worry about their garbage collection so much.  It has a few nice
-features, including low performance overhead and good debugging
-support that's trivially available.
-
-Generally, each stage of the compile creates a talloc context and
-allocates its memory out of that or children of it.  At the end of the
-stage, the pieces still live are stolen to a new context and the old
-one freed, or the whole context is kept for use by the next stage.
-
-For IR transformations, a temporary context is used, then at the end
-of all transformations, reparent_ir reparents all live nodes under the
-shader's IR list, and the old context full of dead nodes is freed.
-When developing a single IR transformation pass, this means that you
-want to allocate instruction nodes out of the temporary context, so if
-it becomes dead it doesn't live on as the child of a live node.  At
-the moment, optimization passes aren't passed that temporary context,
-so they find it by calling talloc_parent() on a nearby IR node.  The
-talloc_parent() call is expensive, so many passes will cache the
-result of the first talloc_parent().  Cleaning up all the optimization
-passes to take a context argument and not call talloc_parent() is left
-as an exercise.
-
-Q: What is the file naming convention in this directory?
-
-Initially, there really wasn't one.  We have since adopted one:
-
- - Files that implement code lowering passes should be named lower_*
-   (e.g., lower_noise.cpp).
- - Files that implement optimization passes should be named opt_*.
- - Files that implement a class that is used throught the code should
-   take the name of that class (e.g., ir_hierarchical_visitor.cpp).
- - Files that contain code not fitting in one of the previous
-   categories should have a sensible name (e.g., glsl_parser.ypp).
diff --git a/reactos/dll/opengl/mesa/src/glsl/SConscript b/reactos/dll/opengl/mesa/src/glsl/SConscript
deleted file mode 100644 (file)
index b8154d6..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-import common
-
-Import('*')
-
-from sys import executable as python_cmd
-
-env = env.Clone()
-
-env.Prepend(CPPPATH = [
-    '#include',
-    '#src/mapi',
-    '#src/mesa',
-    '#src/glsl',
-    '#src/glsl/glcpp',
-])
-
-# Make glcpp/glcpp-parse.h and glsl_parser.h reacheable from the include path
-env.Append(CPPPATH = [Dir('.').abspath])
-
-env.Append(YACCFLAGS = '-d')
-
-parser_env = env.Clone()
-parser_env.Append(YACCFLAGS = [
-    '--defines=%s' % File('glsl_parser.h').abspath,
-    '-p', '_mesa_glsl_',
-])
-
-glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
-glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
-glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
-glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
-
-# common generated sources
-glsl_sources = [
-    glcpp_lexer,
-    glcpp_parser[0],
-    glsl_lexer,
-    glsl_parser[0],
-] 
-
-# parse Makefile.sources
-source_lists = env.ParseSourceList('Makefile.sources')
-
-# add non-generated sources
-for l in ('LIBGLCPP_SOURCES', 'LIBGLSL_SOURCES', 'LIBGLSL_CXX_SOURCES'):
-    glsl_sources += source_lists[l]
-
-if env['msvc']:
-    env.Prepend(CPPPATH = ['#/src/getopt'])
-    env.PrependUnique(LIBS = [getopt])
-
-if env['crosscompile'] and not env['embedded']:
-    Import('builtin_glsl_function')
-else:
-    # Copy these files to avoid generation object files into src/mesa/program
-    env.Prepend(CPPPATH = ['#src/mesa/program'])
-    env.Command('hash_table.c', '#src/mesa/program/hash_table.c', Copy('$TARGET', '$SOURCE'))
-    env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
-
-    compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_SOURCES'])
-
-    mesa_objs = env.StaticObject([
-        'hash_table.c',
-        'symbol_table.c',
-    ])
-
-    compiler_objs += mesa_objs
-
-    builtin_compiler = env.Program(
-        target = 'builtin_compiler',
-        source = compiler_objs + glsl_sources + \
-            source_lists['BUILTIN_COMPILER_CXX_SOURCES'],
-    )
-
-    # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll
-    # depends on glsl_parser.h
-    env.Depends(builtin_compiler, glsl_parser)
-
-    builtin_glsl_function = env.CodeGenerate(
-        target = 'builtin_function.cpp',
-        script = 'builtins/tools/generate_builtins.py',
-        source = builtin_compiler,
-        command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
-    )
-
-    env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
-
-    Export('builtin_glsl_function')
-
-    if env['hostonly']:
-        Return()
-
-
-glsl_sources += builtin_glsl_function
-
-glsl = env.ConvenienceLibrary(
-    target = 'glsl',
-    source = glsl_sources,
-)
-
-# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
-# glsl_parser.h
-env.Depends(glsl, glsl_parser)
-
-Export('glsl')
-
-# Skip building these programs as they will cause SCons error "Two environments
-# with different actions were specified for the same target"
-if env['crosscompile'] or env['embedded']:
-    Return()
-
-env = env.Clone()
-
-if env['platform'] == 'windows':
-    env.PrependUnique(LIBS = [
-        'user32',
-    ])
-
-env.Prepend(LIBS = [glsl])
-
-glsl2 = env.Program(
-    target = 'glsl2',
-    source = compiler_objs,
-)
-env.Alias('glsl2', glsl2)
-
-glcpp = env.Program(
-    target = 'glcpp/glcpp',
-    source = ['glcpp/glcpp.c'] + mesa_objs,
-)
-env.Alias('glcpp', glcpp)
diff --git a/reactos/dll/opengl/mesa/src/glsl/TODO b/reactos/dll/opengl/mesa/src/glsl/TODO
deleted file mode 100644 (file)
index c99d7e1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-- Detect code paths in non-void functions that don't reach a return statement
-
-- Improve handling of constants and their initializers.  Constant initializers
-  should never generate any code.  This is trival for scalar constants.  It is
-  also trivial for arrays, matrices, and vectors that are accessed with
-  constant index values.  For others it is more complicated.  Perhaps these
-  cases should be silently converted to uniforms?
-
-- Implement support for ir_binop_dot in ir_algebraic.cpp.  Perform
-  transformations such as "dot(v, vec3(0.0, 1.0, 0.0))" -> v.y.
-
-- Track source locations throughout the IR.  There are currently several
-  places where we cannot emit line numbers for errors (and currently emit 0:0)
-  because we've "lost" the line number information.  This is particularly
-  noticeable at link time.
-
-1.30 features:
-
-- Implement AST-to-HIR conversion of switch-statements
-  - switch
-  - case
-  - Update break to correcly handle mixed nexting of switch-statements
-    and loops.
-
-- Implement support for gl_ClipDistance.  This is non-trivial because
-  gl_ClipDistance is exposed as a float[8], but all hardware actually
-  implements it as vec4[2].
\ No newline at end of file
diff --git a/reactos/dll/opengl/mesa/src/glsl/ast.h b/reactos/dll/opengl/mesa/src/glsl/ast.h
deleted file mode 100644 (file)
index a01aac0..0000000
+++ /dev/null
@@ -1,804 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright © 2009 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#pragma once
-#ifndef AST_H
-#define AST_H
-
-#include "list.h"
-#include "glsl_parser_extras.h"
-
-struct _mesa_glsl_parse_state;
-
-struct YYLTYPE;
-
-/**
- * \defgroup AST Abstract syntax tree node definitions
- *
- * An abstract syntax tree is generated by the parser.  This is a fairly
- * direct representation of the gramma derivation for the source program.
- * No symantic checking is done during the generation of the AST.  Only
- * syntactic checking is done.  Symantic checking is performed by a later
- * stage that converts the AST to a more generic intermediate representation.
- *
- *@{
- */
-/**
- * Base class of all abstract syntax tree nodes
- */
-class ast_node {
-public:
-   /* Callers of this ralloc-based new need not call delete. It's
-    * easier to just ralloc_free 'ctx' (or any of its ancestors). */
-   static void* operator new(size_t size, void *ctx)
-   {
-      void *node;
-
-      node = rzalloc_size(ctx, size);
-      assert(node != NULL);
-
-      return node;
-   }
-
-   /* If the user *does* call delete, that's OK, we will just
-    * ralloc_free in that case. */
-   static void operator delete(void *table)
-   {
-      ralloc_free(table);
-   }
-
-   /**
-    * Print an AST node in something approximating the original GLSL code
-    */
-   virtual void print(void) const;
-
-   /**
-    * Convert the AST node to the high-level intermediate representation
-    */
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   /**
-    * Retrieve the source location of an AST node
-    *
-    * This function is primarily used to get the source position of an AST node
-    * into a form that can be passed to \c _mesa_glsl_error.
-    *
-    * \sa _mesa_glsl_error, ast_node::set_location
-    */
-   struct YYLTYPE get_location(void) const
-   {
-      struct YYLTYPE locp;
-
-      locp.source = this->location.source;
-      locp.first_line = this->location.line;
-      locp.first_column = this->location.column;
-      locp.last_line = locp.first_line;
-      locp.last_column = locp.first_column;
-
-      return locp;
-   }
-
-   /**
-    * Set the source location of an AST node from a parser location
-    *
-    * \sa ast_node::get_location
-    */
-   void set_location(const struct YYLTYPE &locp)
-   {
-      this->location.source = locp.source;
-      this->location.line = locp.first_line;
-      this->location.column = locp.first_column;
-   }
-
-   /**
-    * Source location of the AST node.
-    */
-   struct {
-      unsigned source;    /**< GLSL source number. */
-      unsigned line;      /**< Line number within the source string. */
-      unsigned column;    /**< Column in the line. */
-   } location;
-
-   exec_node link;
-
-protected:
-   /**
-    * The only constructor is protected so that only derived class objects can
-    * be created.
-    */
-   ast_node(void);
-};
-
-
-/**
- * Operators for AST expression nodes.
- */
-enum ast_operators {
-   ast_assign,
-   ast_plus,        /**< Unary + operator. */
-   ast_neg,
-   ast_add,
-   ast_sub,
-   ast_mul,
-   ast_div,
-   ast_mod,
-   ast_lshift,
-   ast_rshift,
-   ast_less,
-   ast_greater,
-   ast_lequal,
-   ast_gequal,
-   ast_equal,
-   ast_nequal,
-   ast_bit_and,
-   ast_bit_xor,
-   ast_bit_or,
-   ast_bit_not,
-   ast_logic_and,
-   ast_logic_xor,
-   ast_logic_or,
-   ast_logic_not,
-
-   ast_mul_assign,
-   ast_div_assign,
-   ast_mod_assign,
-   ast_add_assign,
-   ast_sub_assign,
-   ast_ls_assign,
-   ast_rs_assign,
-   ast_and_assign,
-   ast_xor_assign,
-   ast_or_assign,
-
-   ast_conditional,
-
-   ast_pre_inc,
-   ast_pre_dec,
-   ast_post_inc,
-   ast_post_dec,
-   ast_field_selection,
-   ast_array_index,
-
-   ast_function_call,
-
-   ast_identifier,
-   ast_int_constant,
-   ast_uint_constant,
-   ast_float_constant,
-   ast_bool_constant,
-
-   ast_sequence
-};
-
-/**
- * Representation of any sort of expression.
- */
-class ast_expression : public ast_node {
-public:
-   ast_expression(int oper, ast_expression *,
-                 ast_expression *, ast_expression *);
-
-   ast_expression(const char *identifier) :
-      oper(ast_identifier)
-   {
-      subexpressions[0] = NULL;
-      subexpressions[1] = NULL;
-      subexpressions[2] = NULL;
-      primary_expression.identifier = (char *) identifier;
-      this->non_lvalue_description = NULL;
-   }
-
-   static const char *operator_string(enum ast_operators op);
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   virtual void print(void) const;
-
-   enum ast_operators oper;
-
-   ast_expression *subexpressions[3];
-
-   union {
-      char *identifier;
-      int int_constant;
-      float float_constant;
-      unsigned uint_constant;
-      int bool_constant;
-   } primary_expression;
-
-
-   /**
-    * List of expressions for an \c ast_sequence or parameters for an
-    * \c ast_function_call
-    */
-   exec_list expressions;
-
-   /**
-    * For things that can't be l-values, this describes what it is.
-    *
-    * This text is used by the code that generates IR for assignments to
-    * detect and emit useful messages for assignments to some things that
-    * can't be l-values.  For example, pre- or post-incerement expressions.
-    *
-    * \note
-    * This pointer may be \c NULL.
-    */
-   const char *non_lvalue_description;
-};
-
-class ast_expression_bin : public ast_expression {
-public:
-   ast_expression_bin(int oper, ast_expression *, ast_expression *);
-
-   virtual void print(void) const;
-};
-
-/**
- * Subclass of expressions for function calls
- */
-class ast_function_expression : public ast_expression {
-public:
-   ast_function_expression(ast_expression *callee)
-      : ast_expression(ast_function_call, callee,
-                      NULL, NULL),
-       cons(false)
-   {
-      /* empty */
-   }
-
-   ast_function_expression(class ast_type_specifier *type)
-      : ast_expression(ast_function_call, (ast_expression *) type,
-                      NULL, NULL),
-       cons(true)
-   {
-      /* empty */
-   }
-
-   bool is_constructor() const
-   {
-      return cons;
-   }
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-private:
-   /**
-    * Is this function call actually a constructor?
-    */
-   bool cons;
-};
-
-
-/**
- * Number of possible operators for an ast_expression
- *
- * This is done as a define instead of as an additional value in the enum so
- * that the compiler won't generate spurious messages like "warning:
- * enumeration value ‘ast_num_operators’ not handled in switch"
- */
-#define AST_NUM_OPERATORS (ast_sequence + 1)
-
-
-class ast_compound_statement : public ast_node {
-public:
-   ast_compound_statement(int new_scope, ast_node *statements);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   int new_scope;
-   exec_list statements;
-};
-
-class ast_declaration : public ast_node {
-public:
-   ast_declaration(char *identifier, int is_array, ast_expression *array_size,
-                  ast_expression *initializer);
-   virtual void print(void) const;
-
-   char *identifier;
-   
-   int is_array;
-   ast_expression *array_size;
-
-   ast_expression *initializer;
-};
-
-
-enum {
-   ast_precision_none = 0, /**< Absence of precision qualifier. */
-   ast_precision_high,
-   ast_precision_medium,
-   ast_precision_low
-};
-
-struct ast_type_qualifier {
-   union {
-      struct {
-        unsigned invariant:1;
-        unsigned constant:1;
-        unsigned attribute:1;
-        unsigned varying:1;
-        unsigned in:1;
-        unsigned out:1;
-        unsigned centroid:1;
-        unsigned uniform:1;
-        unsigned smooth:1;
-        unsigned flat:1;
-        unsigned noperspective:1;
-
-         /** \name Layout qualifiers for GL_AMD_conservative_depth */
-         /** \{ */
-         unsigned depth_any:1;
-         unsigned depth_greater:1;
-         unsigned depth_less:1;
-         unsigned depth_unchanged:1;
-         /** \} */
-      }
-      /** \brief Set of flags, accessed by name. */
-      q;
-
-      /** \brief Set of flags, accessed as a bitmask. */
-      unsigned i;
-   } flags;
-
-   /**
-    * Return true if and only if an interpolation qualifier is present.
-    */
-   bool has_interpolation() const;
-
-   /**
-    * \brief Return string representation of interpolation qualifier.
-    *
-    * If an interpolation qualifier is present, then return that qualifier's
-    * string representation. Otherwise, return null. For example, if the
-    * noperspective bit is set, then this returns "noperspective".
-    *
-    * If multiple interpolation qualifiers are somehow present, then the
-    * returned string is undefined but not null.
-    */
-   const char *interpolation_string() const;
-};
-
-class ast_struct_specifier : public ast_node {
-public:
-   ast_struct_specifier(char *identifier, ast_node *declarator_list);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   char *name;
-   exec_list declarations;
-};
-
-
-enum ast_types {
-   ast_void,
-   ast_float,
-   ast_int,
-   ast_uint,
-   ast_bool,
-   ast_vec2,
-   ast_vec3,
-   ast_vec4,
-   ast_bvec2,
-   ast_bvec3,
-   ast_bvec4,
-   ast_ivec2,
-   ast_ivec3,
-   ast_ivec4,
-   ast_uvec2,
-   ast_uvec3,
-   ast_uvec4,
-   ast_mat2,
-   ast_mat2x3,
-   ast_mat2x4,
-   ast_mat3x2,
-   ast_mat3,
-   ast_mat3x4,
-   ast_mat4x2,
-   ast_mat4x3,
-   ast_mat4,
-   ast_sampler1d,
-   ast_sampler2d,
-   ast_sampler2drect,
-   ast_sampler3d,
-   ast_samplercube,
-   ast_samplerexternaloes,
-   ast_sampler1dshadow,
-   ast_sampler2dshadow,
-   ast_sampler2drectshadow,
-   ast_samplercubeshadow,
-   ast_sampler1darray,
-   ast_sampler2darray,
-   ast_sampler1darrayshadow,
-   ast_sampler2darrayshadow,
-   ast_isampler1d,
-   ast_isampler2d,
-   ast_isampler3d,
-   ast_isamplercube,
-   ast_isampler1darray,
-   ast_isampler2darray,
-   ast_usampler1d,
-   ast_usampler2d,
-   ast_usampler3d,
-   ast_usamplercube,
-   ast_usampler1darray,
-   ast_usampler2darray,
-
-   ast_struct,
-   ast_type_name
-};
-
-
-class ast_type_specifier : public ast_node {
-public:
-   ast_type_specifier(int specifier);
-
-   /** Construct a type specifier from a type name */
-   ast_type_specifier(const char *name) 
-      : type_specifier(ast_type_name), type_name(name), structure(NULL),
-       is_array(false), array_size(NULL), precision(ast_precision_none),
-       is_precision_statement(false)
-   {
-      /* empty */
-   }
-
-   /** Construct a type specifier from a structure definition */
-   ast_type_specifier(ast_struct_specifier *s)
-      : type_specifier(ast_struct), type_name(s->name), structure(s),
-       is_array(false), array_size(NULL), precision(ast_precision_none),
-       is_precision_statement(false)
-   {
-      /* empty */
-   }
-
-   const struct glsl_type *glsl_type(const char **name,
-                                    struct _mesa_glsl_parse_state *state)
-      const;
-
-   virtual void print(void) const;
-
-   ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
-
-   enum ast_types type_specifier;
-
-   const char *type_name;
-   ast_struct_specifier *structure;
-
-   int is_array;
-   ast_expression *array_size;
-
-   unsigned precision:2;
-
-   bool is_precision_statement;
-};
-
-
-class ast_fully_specified_type : public ast_node {
-public:
-   virtual void print(void) const;
-   bool has_qualifiers() const;
-
-   ast_type_qualifier qualifier;
-   ast_type_specifier *specifier;
-};
-
-
-class ast_declarator_list : public ast_node {
-public:
-   ast_declarator_list(ast_fully_specified_type *);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_fully_specified_type *type;
-   exec_list declarations;
-
-   /**
-    * Special flag for vertex shader "invariant" declarations.
-    *
-    * Vertex shaders can contain "invariant" variable redeclarations that do
-    * not include a type.  For example, "invariant gl_Position;".  This flag
-    * is used to note these cases when no type is specified.
-    */
-   int invariant;
-};
-
-
-class ast_parameter_declarator : public ast_node {
-public:
-   ast_parameter_declarator()
-   {
-      this->identifier = NULL;
-      this->is_array = false;
-      this->array_size = 0;
-   }
-
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_fully_specified_type *type;
-   char *identifier;
-   int is_array;
-   ast_expression *array_size;
-
-   static void parameters_to_hir(exec_list *ast_parameters,
-                                bool formal, exec_list *ir_parameters,
-                                struct _mesa_glsl_parse_state *state);
-
-private:
-   /** Is this parameter declaration part of a formal parameter list? */
-   bool formal_parameter;
-
-   /**
-    * Is this parameter 'void' type?
-    *
-    * This field is set by \c ::hir.
-    */
-   bool is_void;
-};
-
-
-class ast_function : public ast_node {
-public:
-   ast_function(void);
-
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_fully_specified_type *return_type;
-   char *identifier;
-
-   exec_list parameters;
-
-private:
-   /**
-    * Is this prototype part of the function definition?
-    *
-    * Used by ast_function_definition::hir to process the parameters, etc.
-    * of the function.
-    *
-    * \sa ::hir
-    */
-   bool is_definition;
-
-   /**
-    * Function signature corresponding to this function prototype instance
-    *
-    * Used by ast_function_definition::hir to process the parameters, etc.
-    * of the function.
-    *
-    * \sa ::hir
-    */
-   class ir_function_signature *signature;
-
-   friend class ast_function_definition;
-};
-
-
-class ast_expression_statement : public ast_node {
-public:
-   ast_expression_statement(ast_expression *);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_expression *expression;
-};
-
-
-class ast_case_label : public ast_node {
-public:
-   ast_case_label(ast_expression *test_value);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   /**
-    * An test value of NULL means 'default'.
-    */
-   ast_expression *test_value;
-};
-
-
-class ast_case_label_list : public ast_node {
-public:
-   ast_case_label_list(void);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   /**
-    * A list of case labels.
-    */
-   exec_list labels;
-};
-
-
-class ast_case_statement : public ast_node {
-public:
-   ast_case_statement(ast_case_label_list *labels);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_case_label_list *labels;
-
-   /**
-    * A list of statements.
-    */
-   exec_list stmts;
-};
-
-
-class ast_case_statement_list : public ast_node {
-public:
-   ast_case_statement_list(void);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   /**
-    * A list of cases.
-    */
-   exec_list cases;
-};
-
-
-class ast_switch_body : public ast_node {
-public:
-   ast_switch_body(ast_case_statement_list *stmts);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_case_statement_list *stmts;
-};
-
-
-class ast_selection_statement : public ast_node {
-public:
-   ast_selection_statement(ast_expression *condition,
-                          ast_node *then_statement,
-                          ast_node *else_statement);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_expression *condition;
-   ast_node *then_statement;
-   ast_node *else_statement;
-};
-
-
-class ast_switch_statement : public ast_node {
-public:
-   ast_switch_statement(ast_expression *test_expression,
-                       ast_node *body);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_expression *test_expression;
-   ast_node *body;
-
-protected:
-   void test_to_hir(exec_list *, struct _mesa_glsl_parse_state *);
-};
-
-class ast_iteration_statement : public ast_node {
-public:
-   ast_iteration_statement(int mode, ast_node *init, ast_node *condition,
-                          ast_expression *rest_expression, ast_node *body);
-
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
-
-   enum ast_iteration_modes {
-      ast_for,
-      ast_while,
-      ast_do_while
-   } mode;
-   
-
-   ast_node *init_statement;
-   ast_node *condition;
-   ast_expression *rest_expression;
-
-   ast_node *body;
-
-private:
-   /**
-    * Generate IR from the condition of a loop
-    *
-    * This is factored out of ::hir because some loops have the condition
-    * test at the top (for and while), and others have it at the end (do-while).
-    */
-   void condition_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *);
-};
-
-
-class ast_jump_statement : public ast_node {
-public:
-   ast_jump_statement(int mode, ast_expression *return_value);
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   enum ast_jump_modes {
-      ast_continue,
-      ast_break,
-      ast_return,
-      ast_discard
-   } mode;
-
-   ast_expression *opt_return_value;
-};
-
-
-class ast_function_definition : public ast_node {
-public:
-   virtual void print(void) const;
-
-   virtual ir_rvalue *hir(exec_list *instructions,
-                         struct _mesa_glsl_parse_state *state);
-
-   ast_function *prototype;
-   ast_compound_statement *body;
-};
-/*@}*/
-
-extern void
-_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state);
-
-extern ir_rvalue *
-_mesa_ast_field_selection_to_hir(const ast_expression *expr,
-                                exec_list *instructions,
-                                struct _mesa_glsl_parse_state *state);
-
-void
-emit_function(_mesa_glsl_parse_state *state, ir_function *f);
-
-#endif /* AST_H */
diff --git a/reactos/dll/opengl/mesa/src/glsl/ast_expr.cpp b/reactos/dll/opengl/mesa/src/glsl/ast_expr.cpp
deleted file mode 100644 (file)
index e624d11..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#include <assert.h>
-#include "ast.h"
-
-const char *
-ast_expression::operator_string(enum ast_operators op)
-{
-   static const char *const operators[] = {
-      "=",
-      "+",
-      "-",
-      "+",
-      "-",
-      "*",
-      "/",
-      "%",
-      "<<",
-      ">>",
-      "<",
-      ">",
-      "<=",
-      ">=",
-      "==",
-      "!=",
-      "&",
-      "^",
-      "|",
-      "~",
-      "&&",
-      "^^",
-      "||",
-      "!",
-
-      "*=",
-      "/=",
-      "%=",
-      "+=",
-      "-=",
-      "<<=",
-      ">>=",
-      "&=",
-      "^=",
-      "|=",
-
-      "?:",
-
-      "++",
-      "--",
-      "++",
-      "--",
-      ".",
-   };
-
-   assert((unsigned int)op < sizeof(operators) / sizeof(operators[0]));
-
-   return operators[op];
-}
-
-
-ast_expression_bin::ast_expression_bin(int oper, ast_expression *ex0,
-                                      ast_expression *ex1) :
-   ast_expression(oper, ex0, ex1, NULL)
-{
-   assert((oper >= ast_plus) && (oper <= ast_logic_not));
-}
-
-
-void
-ast_expression_bin::print(void) const
-{
-   subexpressions[0]->print();
-   printf("%s ", operator_string(oper));
-   subexpressions[1]->print();
-}
diff --git a/reactos/dll/opengl/mesa/src/glsl/ast_function.cpp b/reactos/dll/opengl/mesa/src/glsl/ast_function.cpp
deleted file mode 100644 (file)
index a796110..0000000
+++ /dev/null
@@ -1,1506 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include "glsl_symbol_table.h"
-#include "ast.h"
-#include "glsl_types.h"
-#include "ir.h"
-#include "main/core.h" /* for MIN2 */
-
-static ir_rvalue *
-convert_component(ir_rvalue *src, const glsl_type *desired_type);
-
-bool
-apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
-                          struct _mesa_glsl_parse_state *state);
-
-static unsigned
-process_parameters(exec_list *instructions, exec_list *actual_parameters,
-                  exec_list *parameters,
-                  struct _mesa_glsl_parse_state *state)
-{
-   unsigned count = 0;
-
-   foreach_list (n, parameters) {
-      ast_node *const ast = exec_node_data(ast_node, n, link);
-      ir_rvalue *result = ast->hir(instructions, state);
-
-      ir_constant *const constant = result->constant_expression_value();
-      if (constant != NULL)
-        result = constant;
-
-      actual_parameters->push_tail(result);
-      count++;
-   }
-
-   return count;
-}
-
-
-/**
- * Generate a source prototype for a function signature
- *
- * \param return_type Return type of the function.  May be \c NULL.
- * \param name        Name of the function.
- * \param parameters  List of \c ir_instruction nodes representing the
- *                    parameter list for the function.  This may be either a
- *                    formal (\c ir_variable) or actual (\c ir_rvalue)
- *                    parameter list.  Only the type is used.
- *
- * \return
- * A ralloced string representing the prototype of the function.
- */
-char *
-prototype_string(const glsl_type *return_type, const char *name,
-                exec_list *parameters)
-{
-   char *str = NULL;
-
-   if (return_type != NULL)
-      str = ralloc_asprintf(NULL, "%s ", return_type->name);
-
-   ralloc_asprintf_append(&str, "%s(", name);
-
-   const char *comma = "";
-   foreach_list(node, parameters) {
-      const ir_instruction *const param = (ir_instruction *) node;
-
-      ralloc_asprintf_append(&str, "%s%s", comma, param->type->name);
-      comma = ", ";
-   }
-
-   ralloc_strcat(&str, ")");
-   return str;
-}
-
-/**
- * If a function call is generated, \c call_ir will point to it on exit.
- * Otherwise \c call_ir will be set to \c NULL.
- */
-static ir_rvalue *
-generate_call(exec_list *instructions, ir_function_signature *sig,
-             YYLTYPE *loc, exec_list *actual_parameters,
-             ir_call **call_ir,
-             struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   exec_list post_call_conversions;
-
-   *call_ir = NULL;
-
-   /* Verify that 'out' and 'inout' actual parameters are lvalues.  This
-    * isn't done in ir_function::matching_signature because that function
-    * cannot generate the necessary diagnostics.
-    *
-    * Also, validate that 'const_in' formal parameters (an extension of our
-    * IR) correspond to ir_constant actual parameters.
-    *
-    * Also, perform implicit conversion of arguments.  Note: to implicitly
-    * convert out parameters, we need to place them in a temporary
-    * variable, and do the conversion after the call takes place.  Since we
-    * haven't emitted the call yet, we'll place the post-call conversions
-    * in a temporary exec_list, and emit them later.
-    */
-   exec_list_iterator actual_iter = actual_parameters->iterator();
-   exec_list_iterator formal_iter = sig->parameters.iterator();
-
-   while (actual_iter.has_next()) {
-      ir_rvalue *actual = (ir_rvalue *) actual_iter.get();
-      ir_variable *formal = (ir_variable *) formal_iter.get();
-
-      assert(actual != NULL);
-      assert(formal != NULL);
-
-      if (formal->mode == ir_var_const_in && !actual->as_constant()) {
-        _mesa_glsl_error(loc, state,
-                         "parameter `%s' must be a constant expression",
-                         formal->name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-      if ((formal->mode == ir_var_out)
-         || (formal->mode == ir_var_inout)) {
-        const char *mode = NULL;
-        switch (formal->mode) {
-        case ir_var_out:   mode = "out";   break;
-        case ir_var_inout: mode = "inout"; break;
-        default:           assert(false);  break;
-        }
-        /* FIXME: 'loc' is incorrect (as of 2011-01-21). It is always
-         * FIXME: 0:0(0).
-         */
-        if (actual->variable_referenced()
-            && actual->variable_referenced()->read_only) {
-           _mesa_glsl_error(loc, state,
-                            "function parameter '%s %s' references the "
-                            "read-only variable '%s'",
-                            mode, formal->name,
-                            actual->variable_referenced()->name);
-
-        } else if (!actual->is_lvalue()) {
-           _mesa_glsl_error(loc, state,
-                            "function parameter '%s %s' is not an lvalue",
-                            mode, formal->name);
-        }
-      }
-
-      if (formal->type->is_numeric() || formal->type->is_boolean()) {
-        switch (formal->mode) {
-        case ir_var_const_in:
-        case ir_var_in: {
-           ir_rvalue *converted
-              = convert_component(actual, formal->type);
-           actual->replace_with(converted);
-           break;
-        }
-        case ir_var_out:
-           if (actual->type != formal->type) {
-              /* To convert an out parameter, we need to create a
-               * temporary variable to hold the value before conversion,
-               * and then perform the conversion after the function call
-               * returns.
-               *
-               * This has the effect of transforming code like this:
-               *
-               *   void f(out int x);
-               *   float value;
-               *   f(value);
-               *
-               * Into IR that's equivalent to this:
-               *
-               *   void f(out int x);
-               *   float value;
-               *   int out_parameter_conversion;
-               *   f(out_parameter_conversion);
-               *   value = float(out_parameter_conversion);
-               */
-              ir_variable *tmp =
-                 new(ctx) ir_variable(formal->type,
-                                      "out_parameter_conversion",
-                                      ir_var_temporary);
-              instructions->push_tail(tmp);
-              ir_dereference_variable *deref_tmp_1
-                 = new(ctx) ir_dereference_variable(tmp);
-              ir_dereference_variable *deref_tmp_2
-                 = new(ctx) ir_dereference_variable(tmp);
-              ir_rvalue *converted_tmp
-                 = convert_component(deref_tmp_1, actual->type);
-              ir_assignment *assignment
-                 = new(ctx) ir_assignment(actual, converted_tmp);
-              post_call_conversions.push_tail(assignment);
-              actual->replace_with(deref_tmp_2);
-           }
-           break;
-        case ir_var_inout:
-           /* Inout parameters should never require conversion, since that
-            * would require an implicit conversion to exist both to and
-            * from the formal parameter type, and there are no
-            * bidirectional implicit conversions.
-            */
-           assert (actual->type == formal->type);
-           break;
-        default:
-           assert (!"Illegal formal parameter mode");
-           break;
-        }
-      }
-
-      actual_iter.next();
-      formal_iter.next();
-   }
-
-   /* Always insert the call in the instruction stream, and return a deref
-    * of its return val if it returns a value, since we don't know if
-    * the rvalue is going to be assigned to anything or not.
-    *
-    * Also insert any out parameter conversions after the call.
-    */
-   ir_call *call = new(ctx) ir_call(sig, actual_parameters);
-   ir_dereference_variable *deref;
-   if (!sig->return_type->is_void()) {
-      /* If the function call is a constant expression, don't
-       * generate the instructions to call it; just generate an
-       * ir_constant representing the constant value.
-       *
-       * Function calls can only be constant expressions starting
-       * in GLSL 1.20.
-       */
-      if (state->language_version >= 120) {
-        ir_constant *const_val = call->constant_expression_value();
-        if (const_val) {
-           return const_val;
-        }
-      }
-
-      ir_variable *var;
-
-      var = new(ctx) ir_variable(sig->return_type,
-                                ralloc_asprintf(ctx, "%s_retval",
-                                                sig->function_name()),
-                                ir_var_temporary);
-      instructions->push_tail(var);
-
-      deref = new(ctx) ir_dereference_variable(var);
-      ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL);
-      instructions->push_tail(assign);
-      *call_ir = call;
-
-      deref = new(ctx) ir_dereference_variable(var);
-   } else {
-      instructions->push_tail(call);
-      *call_ir = call;
-      deref = NULL;
-   }
-   instructions->append_list(&post_call_conversions);
-   return deref;
-}
-
-static ir_rvalue *
-match_function_by_name(exec_list *instructions, const char *name,
-                      YYLTYPE *loc, exec_list *actual_parameters,
-                      ir_call **call_ir,
-                      struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   ir_function *f = state->symbols->get_function(name);
-   ir_function_signature *local_sig = NULL;
-   ir_function_signature *sig = NULL;
-
-   /* Is the function hidden by a record type constructor? */
-   if (state->symbols->get_type(name))
-      goto done; /* no match */
-
-   /* Is the function hidden by a variable (impossible in 1.10)? */
-   if (state->language_version != 110 && state->symbols->get_variable(name))
-      goto done; /* no match */
-
-   if (f != NULL) {
-      /* Look for a match in the local shader.  If exact, we're done. */
-      bool is_exact = false;
-      sig = local_sig = f->matching_signature(actual_parameters, &is_exact);
-      if (is_exact)
-        goto done;
-
-      if (f->has_user_signature()) {
-        /* In desktop GL, the presence of a user-defined signature hides any
-         * built-in signatures, so we must ignore them.  In contrast, in ES2
-         * user-defined signatures add new overloads, so we must proceed.
-         */
-        goto done;
-      }
-   }
-
-   /* Local shader has no exact candidates; check the built-ins. */
-   _mesa_glsl_initialize_functions(state);
-   for (unsigned i = 0; i < state->num_builtins_to_link; i++) {
-      ir_function *builtin =
-        state->builtins_to_link[i]->symbols->get_function(name);
-      if (builtin == NULL)
-        continue;
-
-      bool is_exact = false;
-      ir_function_signature *builtin_sig =
-        builtin->matching_signature(actual_parameters, &is_exact);
-
-      if (builtin_sig == NULL)
-        continue;
-
-      /* If the built-in signature is exact, we can stop. */
-      if (is_exact) {
-        sig = builtin_sig;
-        goto done;
-      }
-
-      if (sig == NULL) {
-        /* We found an inexact match, which is better than nothing.  However,
-         * we should keep searching for an exact match.
-         */
-        sig = builtin_sig;
-      }
-   }
-
-done:
-   if (sig != NULL) {
-      /* If the match is from a linked built-in shader, import the prototype. */
-      if (sig != local_sig) {
-        if (f == NULL) {
-           f = new(ctx) ir_function(name);
-           state->symbols->add_global_function(f);
-           emit_function(state, f);
-        }
-        f->add_signature(sig->clone_prototype(f, NULL));
-      }
-
-      /* Finally, generate a call instruction. */
-      return generate_call(instructions, sig, loc, actual_parameters,
-                          call_ir, state);
-   } else {
-      char *str = prototype_string(NULL, name, actual_parameters);
-
-      _mesa_glsl_error(loc, state, "no matching function for call to `%s'",
-                      str);
-      ralloc_free(str);
-
-      const char *prefix = "candidates are: ";
-
-      for (int i = -1; i < (int) state->num_builtins_to_link; i++) {
-        glsl_symbol_table *syms = i >= 0 ? state->builtins_to_link[i]->symbols
-                                         : state->symbols;
-        f = syms->get_function(name);
-        if (f == NULL)
-           continue;
-
-        foreach_list (node, &f->signatures) {
-           ir_function_signature *sig = (ir_function_signature *) node;
-
-           str = prototype_string(sig->return_type, f->name, &sig->parameters);
-           _mesa_glsl_error(loc, state, "%s%s", prefix, str);
-           ralloc_free(str);
-
-           prefix = "                ";
-        }
-
-      }
-
-      return ir_call::get_error_instruction(ctx);
-   }
-}
-
-
-/**
- * Perform automatic type conversion of constructor parameters
- *
- * This implements the rules in the "Conversion and Scalar Constructors"
- * section (GLSL 1.10 section 5.4.1), not the "Implicit Conversions" rules.
- */
-static ir_rvalue *
-convert_component(ir_rvalue *src, const glsl_type *desired_type)
-{
-   void *ctx = ralloc_parent(src);
-   const unsigned a = desired_type->base_type;
-   const unsigned b = src->type->base_type;
-   ir_expression *result = NULL;
-
-   if (src->type->is_error())
-      return src;
-
-   assert(a <= GLSL_TYPE_BOOL);
-   assert(b <= GLSL_TYPE_BOOL);
-
-   if (a == b)
-      return src;
-
-   switch (a) {
-   case GLSL_TYPE_UINT:
-      switch (b) {
-      case GLSL_TYPE_INT:
-        result = new(ctx) ir_expression(ir_unop_i2u, src);
-        break;
-      case GLSL_TYPE_FLOAT:
-        result = new(ctx) ir_expression(ir_unop_i2u,
-                 new(ctx) ir_expression(ir_unop_f2i, src));
-        break;
-      case GLSL_TYPE_BOOL:
-        result = new(ctx) ir_expression(ir_unop_i2u,
-                 new(ctx) ir_expression(ir_unop_b2i, src));
-        break;
-      }
-      break;
-   case GLSL_TYPE_INT:
-      switch (b) {
-      case GLSL_TYPE_UINT:
-        result = new(ctx) ir_expression(ir_unop_u2i, src);
-        break;
-      case GLSL_TYPE_FLOAT:
-        result = new(ctx) ir_expression(ir_unop_f2i, src);
-        break;
-      case GLSL_TYPE_BOOL:
-        result = new(ctx) ir_expression(ir_unop_b2i, src);
-        break;
-      }
-      break;
-   case GLSL_TYPE_FLOAT:
-      switch (b) {
-      case GLSL_TYPE_UINT:
-        result = new(ctx) ir_expression(ir_unop_u2f, desired_type, src, NULL);
-        break;
-      case GLSL_TYPE_INT:
-        result = new(ctx) ir_expression(ir_unop_i2f, desired_type, src, NULL);
-        break;
-      case GLSL_TYPE_BOOL:
-        result = new(ctx) ir_expression(ir_unop_b2f, desired_type, src, NULL);
-        break;
-      }
-      break;
-   case GLSL_TYPE_BOOL:
-      switch (b) {
-      case GLSL_TYPE_UINT:
-        result = new(ctx) ir_expression(ir_unop_i2b,
-                 new(ctx) ir_expression(ir_unop_u2i, src));
-        break;
-      case GLSL_TYPE_INT:
-        result = new(ctx) ir_expression(ir_unop_i2b, desired_type, src, NULL);
-        break;
-      case GLSL_TYPE_FLOAT:
-        result = new(ctx) ir_expression(ir_unop_f2b, desired_type, src, NULL);
-        break;
-      }
-      break;
-   }
-
-   assert(result != NULL);
-   assert(result->type == desired_type);
-
-   /* Try constant folding; it may fold in the conversion we just added. */
-   ir_constant *const constant = result->constant_expression_value();
-   return (constant != NULL) ? (ir_rvalue *) constant : (ir_rvalue *) result;
-}
-
-/**
- * Dereference a specific component from a scalar, vector, or matrix
- */
-static ir_rvalue *
-dereference_component(ir_rvalue *src, unsigned component)
-{
-   void *ctx = ralloc_parent(src);
-   assert(component < src->type->components());
-
-   /* If the source is a constant, just create a new constant instead of a
-    * dereference of the existing constant.
-    */
-   ir_constant *constant = src->as_constant();
-   if (constant)
-      return new(ctx) ir_constant(constant, component);
-
-   if (src->type->is_scalar()) {
-      return src;
-   } else if (src->type->is_vector()) {
-      return new(ctx) ir_swizzle(src, component, 0, 0, 0, 1);
-   } else {
-      assert(src->type->is_matrix());
-
-      /* Dereference a row of the matrix, then call this function again to get
-       * a specific element from that row.
-       */
-      const int c = component / src->type->column_type()->vector_elements;
-      const int r = component % src->type->column_type()->vector_elements;
-      ir_constant *const col_index = new(ctx) ir_constant(c);
-      ir_dereference *const col = new(ctx) ir_dereference_array(src, col_index);
-
-      col->type = src->type->column_type();
-
-      return dereference_component(col, r);
-   }
-
-   assert(!"Should not get here.");
-   return NULL;
-}
-
-
-static ir_rvalue *
-process_array_constructor(exec_list *instructions,
-                         const glsl_type *constructor_type,
-                         YYLTYPE *loc, exec_list *parameters,
-                         struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   /* Array constructors come in two forms: sized and unsized.  Sized array
-    * constructors look like 'vec4[2](a, b)', where 'a' and 'b' are vec4
-    * variables.  In this case the number of parameters must exactly match the
-    * specified size of the array.
-    *
-    * Unsized array constructors look like 'vec4[](a, b)', where 'a' and 'b'
-    * are vec4 variables.  In this case the size of the array being constructed
-    * is determined by the number of parameters.
-    *
-    * From page 52 (page 58 of the PDF) of the GLSL 1.50 spec:
-    *
-    *    "There must be exactly the same number of arguments as the size of
-    *    the array being constructed. If no size is present in the
-    *    constructor, then the array is explicitly sized to the number of
-    *    arguments provided. The arguments are assigned in order, starting at
-    *    element 0, to the elements of the constructed array. Each argument
-    *    must be the same type as the element type of the array, or be a type
-    *    that can be converted to the element type of the array according to
-    *    Section 4.1.10 "Implicit Conversions.""
-    */
-   exec_list actual_parameters;
-   const unsigned parameter_count =
-      process_parameters(instructions, &actual_parameters, parameters, state);
-
-   if ((parameter_count == 0)
-       || ((constructor_type->length != 0)
-          && (constructor_type->length != parameter_count))) {
-      const unsigned min_param = (constructor_type->length == 0)
-        ? 1 : constructor_type->length;
-
-      _mesa_glsl_error(loc, state, "array constructor must have %s %u "
-                      "parameter%s",
-                      (constructor_type->length != 0) ? "at least" : "exactly",
-                      min_param, (min_param <= 1) ? "" : "s");
-      return ir_call::get_error_instruction(ctx);
-   }
-
-   if (constructor_type->length == 0) {
-      constructor_type =
-        glsl_type::get_array_instance(constructor_type->element_type(),
-                                      parameter_count);
-      assert(constructor_type != NULL);
-      assert(constructor_type->length == parameter_count);
-   }
-
-   bool all_parameters_are_constant = true;
-
-   /* Type cast each parameter and, if possible, fold constants. */
-   foreach_list_safe(n, &actual_parameters) {
-      ir_rvalue *ir = (ir_rvalue *) n;
-      ir_rvalue *result = ir;
-
-      /* Apply implicit conversions (not the scalar constructor rules!). See
-       * the spec quote above. */
-      if (constructor_type->element_type()->is_float()) {
-        const glsl_type *desired_type =
-           glsl_type::get_instance(GLSL_TYPE_FLOAT,
-                                   ir->type->vector_elements,
-                                   ir->type->matrix_columns);
-        if (result->type->can_implicitly_convert_to(desired_type)) {
-           /* Even though convert_component() implements the constructor
-            * conversion rules (not the implicit conversion rules), its safe
-            * to use it here because we already checked that the implicit
-            * conversion is legal.
-            */
-           result = convert_component(ir, desired_type);
-        }
-      }
-
-      if (result->type != constructor_type->element_type()) {
-        _mesa_glsl_error(loc, state, "type error in array constructor: "
-                         "expected: %s, found %s",
-                         constructor_type->element_type()->name,
-                         result->type->name);
-      }
-
-      /* Attempt to convert the parameter to a constant valued expression.
-       * After doing so, track whether or not all the parameters to the
-       * constructor are trivially constant valued expressions.
-       */
-      ir_rvalue *const constant = result->constant_expression_value();
-
-      if (constant != NULL)
-         result = constant;
-      else
-         all_parameters_are_constant = false;
-
-      ir->replace_with(result);
-   }
-
-   if (all_parameters_are_constant)
-      return new(ctx) ir_constant(constructor_type, &actual_parameters);
-
-   ir_variable *var = new(ctx) ir_variable(constructor_type, "array_ctor",
-                                          ir_var_temporary);
-   instructions->push_tail(var);
-
-   int i = 0;
-   foreach_list(node, &actual_parameters) {
-      ir_rvalue *rhs = (ir_rvalue *) node;
-      ir_rvalue *lhs = new(ctx) ir_dereference_array(var,
-                                                    new(ctx) ir_constant(i));
-
-      ir_instruction *assignment = new(ctx) ir_assignment(lhs, rhs, NULL);
-      instructions->push_tail(assignment);
-
-      i++;
-   }
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-/**
- * Try to convert a record constructor to a constant expression
- */
-static ir_constant *
-constant_record_constructor(const glsl_type *constructor_type,
-                           exec_list *parameters, void *mem_ctx)
-{
-   foreach_list(node, parameters) {
-      ir_constant *constant = ((ir_instruction *) node)->as_constant();
-      if (constant == NULL)
-        return NULL;
-      node->replace_with(constant);
-   }
-
-   return new(mem_ctx) ir_constant(constructor_type, parameters);
-}
-
-
-/**
- * Determine if a list consists of a single scalar r-value
- */
-bool
-single_scalar_parameter(exec_list *parameters)
-{
-   const ir_rvalue *const p = (ir_rvalue *) parameters->head;
-   assert(((ir_rvalue *)p)->as_rvalue() != NULL);
-
-   return (p->type->is_scalar() && p->next->is_tail_sentinel());
-}
-
-
-/**
- * Generate inline code for a vector constructor
- *
- * The generated constructor code will consist of a temporary variable
- * declaration of the same type as the constructor.  A sequence of assignments
- * from constructor parameters to the temporary will follow.
- *
- * \return
- * An \c ir_dereference_variable of the temprorary generated in the constructor
- * body.
- */
-ir_rvalue *
-emit_inline_vector_constructor(const glsl_type *type,
-                              exec_list *instructions,
-                              exec_list *parameters,
-                              void *ctx)
-{
-   assert(!parameters->is_empty());
-
-   ir_variable *var = new(ctx) ir_variable(type, "vec_ctor", ir_var_temporary);
-   instructions->push_tail(var);
-
-   /* There are two kinds of vector constructors.
-    *
-    *  - Construct a vector from a single scalar by replicating that scalar to
-    *    all components of the vector.
-    *
-    *  - Construct a vector from an arbirary combination of vectors and
-    *    scalars.  The components of the constructor parameters are assigned
-    *    to the vector in order until the vector is full.
-    */
-   const unsigned lhs_components = type->components();
-   if (single_scalar_parameter(parameters)) {
-      ir_rvalue *first_param = (ir_rvalue *)parameters->head;
-      ir_rvalue *rhs = new(ctx) ir_swizzle(first_param, 0, 0, 0, 0,
-                                          lhs_components);
-      ir_dereference_variable *lhs = new(ctx) ir_dereference_variable(var);
-      const unsigned mask = (1U << lhs_components) - 1;
-
-      assert(rhs->type == lhs->type);
-
-      ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask);
-      instructions->push_tail(inst);
-   } else {
-      unsigned base_component = 0;
-      unsigned base_lhs_component = 0;
-      ir_constant_data data;
-      unsigned constant_mask = 0, constant_components = 0;
-
-      memset(&data, 0, sizeof(data));
-
-      foreach_list(node, parameters) {
-        ir_rvalue *param = (ir_rvalue *) node;
-        unsigned rhs_components = param->type->components();
-
-        /* Do not try to assign more components to the vector than it has!
-         */
-        if ((rhs_components + base_lhs_component) > lhs_components) {
-           rhs_components = lhs_components - base_lhs_component;
-        }
-
-        const ir_constant *const c = param->as_constant();
-        if (c != NULL) {
-           for (unsigned i = 0; i < rhs_components; i++) {
-              switch (c->type->base_type) {
-              case GLSL_TYPE_UINT:
-                 data.u[i + base_component] = c->get_uint_component(i);
-                 break;
-              case GLSL_TYPE_INT:
-                 data.i[i + base_component] = c->get_int_component(i);
-                 break;
-              case GLSL_TYPE_FLOAT:
-                 data.f[i + base_component] = c->get_float_component(i);
-                 break;
-              case GLSL_TYPE_BOOL:
-                 data.b[i + base_component] = c->get_bool_component(i);
-                 break;
-              default:
-                 assert(!"Should not get here.");
-                 break;
-              }
-           }
-
-           /* Mask of fields to be written in the assignment.
-            */
-           constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component;
-           constant_components += rhs_components;
-
-           base_component += rhs_components;
-        }
-        /* Advance the component index by the number of components
-         * that were just assigned.
-         */
-        base_lhs_component += rhs_components;
-      }
-
-      if (constant_mask != 0) {
-        ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
-        const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type,
-                                                            constant_components,
-                                                            1);
-        ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data);
-
-        ir_instruction *inst =
-           new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask);
-        instructions->push_tail(inst);
-      }
-
-      base_component = 0;
-      foreach_list(node, parameters) {
-        ir_rvalue *param = (ir_rvalue *) node;
-        unsigned rhs_components = param->type->components();
-
-        /* Do not try to assign more components to the vector than it has!
-         */
-        if ((rhs_components + base_component) > lhs_components) {
-           rhs_components = lhs_components - base_component;
-        }
-
-        const ir_constant *const c = param->as_constant();
-        if (c == NULL) {
-           /* Mask of fields to be written in the assignment.
-            */
-           const unsigned write_mask = ((1U << rhs_components) - 1)
-              << base_component;
-
-           ir_dereference *lhs = new(ctx) ir_dereference_variable(var);
-
-           /* Generate a swizzle so that LHS and RHS sizes match.
-            */
-           ir_rvalue *rhs =
-              new(ctx) ir_swizzle(param, 0, 1, 2, 3, rhs_components);
-
-           ir_instruction *inst =
-              new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
-           instructions->push_tail(inst);
-        }
-
-        /* Advance the component index by the number of components that were
-         * just assigned.
-         */
-        base_component += rhs_components;
-      }
-   }
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-/**
- * Generate assignment of a portion of a vector to a portion of a matrix column
- *
- * \param src_base  First component of the source to be used in assignment
- * \param column    Column of destination to be assiged
- * \param row_base  First component of the destination column to be assigned
- * \param count     Number of components to be assigned
- *
- * \note
- * \c src_base + \c count must be less than or equal to the number of components
- * in the source vector.
- */
-ir_instruction *
-assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base,
-                       ir_rvalue *src, unsigned src_base, unsigned count,
-                       void *mem_ctx)
-{
-   ir_constant *col_idx = new(mem_ctx) ir_constant(column);
-   ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx);
-
-   assert(column_ref->type->components() >= (row_base + count));
-   assert(src->type->components() >= (src_base + count));
-
-   /* Generate a swizzle that extracts the number of components from the source
-    * that are to be assigned to the column of the matrix.
-    */
-   if (count < src->type->vector_elements) {
-      src = new(mem_ctx) ir_swizzle(src,
-                                   src_base + 0, src_base + 1,
-                                   src_base + 2, src_base + 3,
-                                   count);
-   }
-
-   /* Mask of fields to be written in the assignment.
-    */
-   const unsigned write_mask = ((1U << count) - 1) << row_base;
-
-   return new(mem_ctx) ir_assignment(column_ref, src, NULL, write_mask);
-}
-
-
-/**
- * Generate inline code for a matrix constructor
- *
- * The generated constructor code will consist of a temporary variable
- * declaration of the same type as the constructor.  A sequence of assignments
- * from constructor parameters to the temporary will follow.
- *
- * \return
- * An \c ir_dereference_variable of the temprorary generated in the constructor
- * body.
- */
-ir_rvalue *
-emit_inline_matrix_constructor(const glsl_type *type,
-                              exec_list *instructions,
-                              exec_list *parameters,
-                              void *ctx)
-{
-   assert(!parameters->is_empty());
-
-   ir_variable *var = new(ctx) ir_variable(type, "mat_ctor", ir_var_temporary);
-   instructions->push_tail(var);
-
-   /* There are three kinds of matrix constructors.
-    *
-    *  - Construct a matrix from a single scalar by replicating that scalar to
-    *    along the diagonal of the matrix and setting all other components to
-    *    zero.
-    *
-    *  - Construct a matrix from an arbirary combination of vectors and
-    *    scalars.  The components of the constructor parameters are assigned
-    *    to the matrix in colum-major order until the matrix is full.
-    *
-    *  - Construct a matrix from a single matrix.  The source matrix is copied
-    *    to the upper left portion of the constructed matrix, and the remaining
-    *    elements take values from the identity matrix.
-    */
-   ir_rvalue *const first_param = (ir_rvalue *) parameters->head;
-   if (single_scalar_parameter(parameters)) {
-      /* Assign the scalar to the X component of a vec4, and fill the remaining
-       * components with zero.
-       */
-      ir_variable *rhs_var =
-        new(ctx) ir_variable(glsl_type::vec4_type, "mat_ctor_vec",
-                             ir_var_temporary);
-      instructions->push_tail(rhs_var);
-
-      ir_constant_data zero;
-      zero.f[0] = 0.0;
-      zero.f[1] = 0.0;
-      zero.f[2] = 0.0;
-      zero.f[3] = 0.0;
-
-      ir_instruction *inst =
-        new(ctx) ir_assignment(new(ctx) ir_dereference_variable(rhs_var),
-                               new(ctx) ir_constant(rhs_var->type, &zero),
-                               NULL);
-      instructions->push_tail(inst);
-
-      ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-      inst = new(ctx) ir_assignment(rhs_ref, first_param, NULL, 0x01);
-      instructions->push_tail(inst);
-
-      /* Assign the temporary vector to each column of the destination matrix
-       * with a swizzle that puts the X component on the diagonal of the
-       * matrix.  In some cases this may mean that the X component does not
-       * get assigned into the column at all (i.e., when the matrix has more
-       * columns than rows).
-       */
-      static const unsigned rhs_swiz[4][4] = {
-        { 0, 1, 1, 1 },
-        { 1, 0, 1, 1 },
-        { 1, 1, 0, 1 },
-        { 1, 1, 1, 0 }
-      };
-
-      const unsigned cols_to_init = MIN2(type->matrix_columns,
-                                        type->vector_elements);
-      for (unsigned i = 0; i < cols_to_init; i++) {
-        ir_constant *const col_idx = new(ctx) ir_constant(i);
-        ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
-
-        ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-        ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, rhs_swiz[i],
-                                                   type->vector_elements);
-
-        inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
-        instructions->push_tail(inst);
-      }
-
-      for (unsigned i = cols_to_init; i < type->matrix_columns; i++) {
-        ir_constant *const col_idx = new(ctx) ir_constant(i);
-        ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx);
-
-        ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var);
-        ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, 1, 1, 1, 1,
-                                                   type->vector_elements);
-
-        inst = new(ctx) ir_assignment(col_ref, rhs, NULL);
-        instructions->push_tail(inst);
-      }
-   } else if (first_param->type->is_matrix()) {
-      /* From page 50 (56 of the PDF) of the GLSL 1.50 spec:
-       *
-       *     "If a matrix is constructed from a matrix, then each component
-       *     (column i, row j) in the result that has a corresponding
-       *     component (column i, row j) in the argument will be initialized
-       *     from there. All other components will be initialized to the
-       *     identity matrix. If a matrix argument is given to a matrix
-       *     constructor, it is an error to have any other arguments."
-       */
-      assert(first_param->next->is_tail_sentinel());
-      ir_rvalue *const src_matrix = first_param;
-
-      /* If the source matrix is smaller, pre-initialize the relavent parts of
-       * the destination matrix to the identity matrix.
-       */
-      if ((src_matrix->type->matrix_columns < var->type->matrix_columns)
-         || (src_matrix->type->vector_elements < var->type->vector_elements)) {
-
-        /* If the source matrix has fewer rows, every column of the destination
-         * must be initialized.  Otherwise only the columns in the destination
-         * that do not exist in the source must be initialized.
-         */
-        unsigned col =
-           (src_matrix->type->vector_elements < var->type->vector_elements)
-           ? 0 : src_matrix->type->matrix_columns;
-
-        const glsl_type *const col_type = var->type->column_type();
-        for (/* empty */; col < var->type->matrix_columns; col++) {
-           ir_constant_data ident;
-
-           ident.f[0] = 0.0;
-           ident.f[1] = 0.0;
-           ident.f[2] = 0.0;
-           ident.f[3] = 0.0;
-
-           ident.f[col] = 1.0;
-
-           ir_rvalue *const rhs = new(ctx) ir_constant(col_type, &ident);
-
-           ir_rvalue *const lhs =
-              new(ctx) ir_dereference_array(var, new(ctx) ir_constant(col));
-
-           ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL);
-           instructions->push_tail(inst);
-        }
-      }
-
-      /* Assign columns from the source matrix to the destination matrix.
-       *
-       * Since the parameter will be used in the RHS of multiple assignments,
-       * generate a temporary and copy the paramter there.
-       */
-      ir_variable *const rhs_var =
-        new(ctx) ir_variable(first_param->type, "mat_ctor_mat",
-                             ir_var_temporary);
-      instructions->push_tail(rhs_var);
-
-      ir_dereference *const rhs_var_ref =
-        new(ctx) ir_dereference_variable(rhs_var);
-      ir_instruction *const inst =
-        new(ctx) ir_assignment(rhs_var_ref, first_param, NULL);
-      instructions->push_tail(inst);
-
-      const unsigned last_row = MIN2(src_matrix->type->vector_elements,
-                                    var->type->vector_elements);
-      const unsigned last_col = MIN2(src_matrix->type->matrix_columns,
-                                    var->type->matrix_columns);
-
-      unsigned swiz[4] = { 0, 0, 0, 0 };
-      for (unsigned i = 1; i < last_row; i++)
-        swiz[i] = i;
-
-      const unsigned write_mask = (1U << last_row) - 1;
-
-      for (unsigned i = 0; i < last_col; i++) {
-        ir_dereference *const lhs =
-           new(ctx) ir_dereference_array(var, new(ctx) ir_constant(i));
-        ir_rvalue *const rhs_col =
-           new(ctx) ir_dereference_array(rhs_var, new(ctx) ir_constant(i));
-
-        /* If one matrix has columns that are smaller than the columns of the
-         * other matrix, wrap the column access of the larger with a swizzle
-         * so that the LHS and RHS of the assignment have the same size (and
-         * therefore have the same type).
-         *
-         * It would be perfectly valid to unconditionally generate the
-         * swizzles, this this will typically result in a more compact IR tree.
-         */
-        ir_rvalue *rhs;
-        if (lhs->type->vector_elements != rhs_col->type->vector_elements) {
-           rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row);
-        } else {
-           rhs = rhs_col;
-        }
-
-        ir_instruction *inst =
-           new(ctx) ir_assignment(lhs, rhs, NULL, write_mask);
-        instructions->push_tail(inst);
-      }
-   } else {
-      const unsigned cols = type->matrix_columns;
-      const unsigned rows = type->vector_elements;
-      unsigned col_idx = 0;
-      unsigned row_idx = 0;
-
-      foreach_list (node, parameters) {
-        ir_rvalue *const rhs = (ir_rvalue *) node;
-        const unsigned components_remaining_this_column = rows - row_idx;
-        unsigned rhs_components = rhs->type->components();
-        unsigned rhs_base = 0;
-
-        /* Since the parameter might be used in the RHS of two assignments,
-         * generate a temporary and copy the paramter there.
-         */
-        ir_variable *rhs_var =
-           new(ctx) ir_variable(rhs->type, "mat_ctor_vec", ir_var_temporary);
-        instructions->push_tail(rhs_var);
-
-        ir_dereference *rhs_var_ref =
-           new(ctx) ir_dereference_variable(rhs_var);
-        ir_instruction *inst = new(ctx) ir_assignment(rhs_var_ref, rhs, NULL);
-        instructions->push_tail(inst);
-
-        /* Assign the current parameter to as many components of the matrix
-         * as it will fill.
-         *
-         * NOTE: A single vector parameter can span two matrix columns.  A
-         * single vec4, for example, can completely fill a mat2.
-         */
-        if (rhs_components >= components_remaining_this_column) {
-           const unsigned count = MIN2(rhs_components,
-                                       components_remaining_this_column);
-
-           rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-           ir_instruction *inst = assign_to_matrix_column(var, col_idx,
-                                                          row_idx,
-                                                          rhs_var_ref, 0,
-                                                          count, ctx);
-           instructions->push_tail(inst);
-
-           rhs_base = count;
-
-           col_idx++;
-           row_idx = 0;
-        }
-
-        /* If there is data left in the parameter and components left to be
-         * set in the destination, emit another assignment.  It is possible
-         * that the assignment could be of a vec4 to the last element of the
-         * matrix.  In this case col_idx==cols, but there is still data
-         * left in the source parameter.  Obviously, don't emit an assignment
-         * to data outside the destination matrix.
-         */
-        if ((col_idx < cols) && (rhs_base < rhs_components)) {
-           const unsigned count = rhs_components - rhs_base;
-
-           rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var);
-
-           ir_instruction *inst = assign_to_matrix_column(var, col_idx,
-                                                          row_idx,
-                                                          rhs_var_ref,
-                                                          rhs_base,
-                                                          count, ctx);
-           instructions->push_tail(inst);
-
-           row_idx += count;
-        }
-      }
-   }
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-ir_rvalue *
-emit_inline_record_constructor(const glsl_type *type,
-                              exec_list *instructions,
-                              exec_list *parameters,
-                              void *mem_ctx)
-{
-   ir_variable *const var =
-      new(mem_ctx) ir_variable(type, "record_ctor", ir_var_temporary);
-   ir_dereference_variable *const d = new(mem_ctx) ir_dereference_variable(var);
-
-   instructions->push_tail(var);
-
-   exec_node *node = parameters->head;
-   for (unsigned i = 0; i < type->length; i++) {
-      assert(!node->is_tail_sentinel());
-
-      ir_dereference *const lhs =
-        new(mem_ctx) ir_dereference_record(d->clone(mem_ctx, NULL),
-                                           type->fields.structure[i].name);
-
-      ir_rvalue *const rhs = ((ir_instruction *) node)->as_rvalue();
-      assert(rhs != NULL);
-
-      ir_instruction *const assign = new(mem_ctx) ir_assignment(lhs, rhs, NULL);
-
-      instructions->push_tail(assign);
-      node = node->next;
-   }
-
-   return d;
-}
-
-
-ir_rvalue *
-ast_function_expression::hir(exec_list *instructions,
-                            struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   /* There are three sorts of function calls.
-    *
-    * 1. constructors - The first subexpression is an ast_type_specifier.
-    * 2. methods - Only the .length() method of array types.
-    * 3. functions - Calls to regular old functions.
-    *
-    * Method calls are actually detected when the ast_field_selection
-    * expression is handled.
-    */
-   if (is_constructor()) {
-      const ast_type_specifier *type = (ast_type_specifier *) subexpressions[0];
-      YYLTYPE loc = type->get_location();
-      const char *name;
-
-      const glsl_type *const constructor_type = type->glsl_type(& name, state);
-
-      /* constructor_type can be NULL if a variable with the same name as the
-       * structure has come into scope.
-       */
-      if (constructor_type == NULL) {
-        _mesa_glsl_error(& loc, state, "unknown type `%s' (structure name "
-                         "may be shadowed by a variable with the same name)",
-                         type->type_name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-
-      /* Constructors for samplers are illegal.
-       */
-      if (constructor_type->is_sampler()) {
-        _mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'",
-                         constructor_type->name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-      if (constructor_type->is_array()) {
-        if (state->language_version <= 110) {
-           _mesa_glsl_error(& loc, state,
-                            "array constructors forbidden in GLSL 1.10");
-           return ir_call::get_error_instruction(ctx);
-        }
-
-        return process_array_constructor(instructions, constructor_type,
-                                         & loc, &this->expressions, state);
-      }
-
-
-      /* There are two kinds of constructor call.  Constructors for built-in
-       * language types, such as mat4 and vec2, are free form.  The only
-       * requirement is that the parameters must provide enough values of the
-       * correct scalar type.  Constructors for arrays and structures must
-       * have the exact number of parameters with matching types in the
-       * correct order.  These constructors follow essentially the same type
-       * matching rules as functions.
-       */
-      if (constructor_type->is_record()) {
-        exec_list actual_parameters;
-
-        process_parameters(instructions, &actual_parameters,
-                           &this->expressions, state);
-
-        exec_node *node = actual_parameters.head;
-        for (unsigned i = 0; i < constructor_type->length; i++) {
-           ir_rvalue *ir = (ir_rvalue *) node;
-
-           if (node->is_tail_sentinel()) {
-              _mesa_glsl_error(&loc, state,
-                               "insufficient parameters to constructor "
-                               "for `%s'",
-                               constructor_type->name);
-              return ir_call::get_error_instruction(ctx);
-           }
-
-           if (apply_implicit_conversion(constructor_type->fields.structure[i].type,
-                                         ir, state)) {
-              node->replace_with(ir);
-           } else {
-              _mesa_glsl_error(&loc, state,
-                               "parameter type mismatch in constructor "
-                               "for `%s.%s' (%s vs %s)",
-                               constructor_type->name,
-                               constructor_type->fields.structure[i].name,
-                               ir->type->name,
-                               constructor_type->fields.structure[i].type->name);
-              return ir_call::get_error_instruction(ctx);;
-           }
-
-           node = node->next;
-        }
-
-        if (!node->is_tail_sentinel()) {
-           _mesa_glsl_error(&loc, state, "too many parameters in constructor "
-                            "for `%s'", constructor_type->name);
-           return ir_call::get_error_instruction(ctx);
-        }
-
-        ir_rvalue *const constant =
-           constant_record_constructor(constructor_type, &actual_parameters,
-                                       state);
-
-        return (constant != NULL)
-           ? constant
-           : emit_inline_record_constructor(constructor_type, instructions,
-                                            &actual_parameters, state);
-      }
-
-      if (!constructor_type->is_numeric() && !constructor_type->is_boolean())
-        return ir_call::get_error_instruction(ctx);
-
-      /* Total number of components of the type being constructed. */
-      const unsigned type_components = constructor_type->components();
-
-      /* Number of components from parameters that have actually been
-       * consumed.  This is used to perform several kinds of error checking.
-       */
-      unsigned components_used = 0;
-
-      unsigned matrix_parameters = 0;
-      unsigned nonmatrix_parameters = 0;
-      exec_list actual_parameters;
-
-      foreach_list (n, &this->expressions) {
-        ast_node *ast = exec_node_data(ast_node, n, link);
-        ir_rvalue *result = ast->hir(instructions, state)->as_rvalue();
-
-        /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
-         *
-         *    "It is an error to provide extra arguments beyond this
-         *    last used argument."
-         */
-        if (components_used >= type_components) {
-           _mesa_glsl_error(& loc, state, "too many parameters to `%s' "
-                            "constructor",
-                            constructor_type->name);
-           return ir_call::get_error_instruction(ctx);
-        }
-
-        if (!result->type->is_numeric() && !result->type->is_boolean()) {
-           _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
-                            "non-numeric data type",
-                            constructor_type->name);
-           return ir_call::get_error_instruction(ctx);
-        }
-
-        /* Count the number of matrix and nonmatrix parameters.  This
-         * is used below to enforce some of the constructor rules.
-         */
-        if (result->type->is_matrix())
-           matrix_parameters++;
-        else
-           nonmatrix_parameters++;
-
-        actual_parameters.push_tail(result);
-        components_used += result->type->components();
-      }
-
-      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "It is an error to construct matrices from other matrices. This
-       *    is reserved for future use."
-       */
-      if (state->language_version == 110 && matrix_parameters > 0
-         && constructor_type->is_matrix()) {
-        _mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
-                         "matrix in GLSL 1.10",
-                         constructor_type->name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-      /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec:
-       *
-       *    "If a matrix argument is given to a matrix constructor, it is
-       *    an error to have any other arguments."
-       */
-      if ((matrix_parameters > 0)
-         && ((matrix_parameters + nonmatrix_parameters) > 1)
-         && constructor_type->is_matrix()) {
-        _mesa_glsl_error(& loc, state, "for matrix `%s' constructor, "
-                         "matrix must be only parameter",
-                         constructor_type->name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-      /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "In these cases, there must be enough components provided in the
-       *    arguments to provide an initializer for every component in the
-       *    constructed value."
-       */
-      if (components_used < type_components && components_used != 1
-         && matrix_parameters == 0) {
-        _mesa_glsl_error(& loc, state, "too few components to construct "
-                         "`%s'",
-                         constructor_type->name);
-        return ir_call::get_error_instruction(ctx);
-      }
-
-      /* Later, we cast each parameter to the same base type as the
-       * constructor.  Since there are no non-floating point matrices, we
-       * need to break them up into a series of column vectors.
-       */
-      if (constructor_type->base_type != GLSL_TYPE_FLOAT) {
-        foreach_list_safe(n, &actual_parameters) {
-           ir_rvalue *matrix = (ir_rvalue *) n;
-
-           if (!matrix->type->is_matrix())
-              continue;
-
-           /* Create a temporary containing the matrix. */
-           ir_variable *var = new(ctx) ir_variable(matrix->type, "matrix_tmp",
-                                                   ir_var_temporary);
-           instructions->push_tail(var);
-           instructions->push_tail(new(ctx) ir_assignment(new(ctx)
-              ir_dereference_variable(var), matrix, NULL));
-           var->constant_value = matrix->constant_expression_value();
-
-           /* Replace the matrix with dereferences of its columns. */
-           for (int i = 0; i < matrix->type->matrix_columns; i++) {
-              matrix->insert_before(new (ctx) ir_dereference_array(var,
-                 new(ctx) ir_constant(i)));
-           }
-           matrix->remove();
-        }
-      }
-
-      bool all_parameters_are_constant = true;
-
-      /* Type cast each parameter and, if possible, fold constants.*/
-      foreach_list_safe(n, &actual_parameters) {
-        ir_rvalue *ir = (ir_rvalue *) n;
-
-        const glsl_type *desired_type =
-           glsl_type::get_instance(constructor_type->base_type,
-                                   ir->type->vector_elements,
-                                   ir->type->matrix_columns);
-        ir_rvalue *result = convert_component(ir, desired_type);
-
-        /* Attempt to convert the parameter to a constant valued expression.
-         * After doing so, track whether or not all the parameters to the
-         * constructor are trivially constant valued expressions.
-         */
-        ir_rvalue *const constant = result->constant_expression_value();
-
-        if (constant != NULL)
-           result = constant;
-        else
-           all_parameters_are_constant = false;
-
-        if (result != ir) {
-           ir->replace_with(result);
-        }
-      }
-
-      /* If all of the parameters are trivially constant, create a
-       * constant representing the complete collection of parameters.
-       */
-      if (all_parameters_are_constant) {
-        return new(ctx) ir_constant(constructor_type, &actual_parameters);
-      } else if (constructor_type->is_scalar()) {
-        return dereference_component((ir_rvalue *) actual_parameters.head,
-                                     0);
-      } else if (constructor_type->is_vector()) {
-        return emit_inline_vector_constructor(constructor_type,
-                                              instructions,
-                                              &actual_parameters,
-                                              ctx);
-      } else {
-        assert(constructor_type->is_matrix());
-        return emit_inline_matrix_constructor(constructor_type,
-                                              instructions,
-                                              &actual_parameters,
-                                              ctx);
-      }
-   } else {
-      const ast_expression *id = subexpressions[0];
-      YYLTYPE loc = id->get_location();
-      exec_list actual_parameters;
-
-      process_parameters(instructions, &actual_parameters, &this->expressions,
-                        state);
-
-      ir_call *call = NULL;
-      ir_rvalue *const value =
-        match_function_by_name(instructions,
-                               id->primary_expression.identifier,
-                               &loc, &actual_parameters, &call, state);
-
-      if (call != NULL) {
-        /* If a function was found, make sure that none of the 'out' or 'inout'
-         * parameters violate the extra l-value rules.
-         */
-        ir_function_signature *f = call->get_callee();
-        assert(f != NULL);
-
-        exec_node *formal_node = f->parameters.head;
-
-        foreach_list (actual_node, &this->expressions) {
-           /* Both parameter lists had better be the same length!
-            */
-           assert(!actual_node->is_tail_sentinel());
-
-           const ir_variable *const formal_parameter =
-              (ir_variable *) formal_node;
-           const ast_expression *const actual_parameter =
-              exec_node_data(ast_expression, actual_node, link);
-
-           if ((formal_parameter->mode == ir_var_out
-                || formal_parameter->mode == ir_var_inout)
-               && actual_parameter->non_lvalue_description != NULL) {
-              YYLTYPE loc = actual_parameter->get_location();
-
-              _mesa_glsl_error(&loc, state,
-                               "function parameter '%s %s' references a %s",
-                               (formal_parameter->mode == ir_var_out)
-                               ? "out" : "inout",
-                               formal_parameter->name,
-                               actual_parameter->non_lvalue_description);
-              return ir_call::get_error_instruction(ctx);
-           }
-
-           /* Only advance the formal_node pointer here because the
-            * foreach_list business already advances actual_node.
-            */
-           formal_node = formal_node->next;
-        }
-      }
-
-      return value;
-   }
-
-   return ir_call::get_error_instruction(ctx);
-}
diff --git a/reactos/dll/opengl/mesa/src/glsl/ast_to_hir.cpp b/reactos/dll/opengl/mesa/src/glsl/ast_to_hir.cpp
deleted file mode 100644 (file)
index 020766b..0000000
+++ /dev/null
@@ -1,3830 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file ast_to_hir.c
- * Convert abstract syntax to to high-level intermediate reprensentation (HIR).
- *
- * During the conversion to HIR, the majority of the symantic checking is
- * preformed on the program.  This includes:
- *
- *    * Symbol table management
- *    * Type checking
- *    * Function binding
- *
- * The majority of this work could be done during parsing, and the parser could
- * probably generate HIR directly.  However, this results in frequent changes
- * to the parser code.  Since we do not assume that every system this complier
- * is built on will have Flex and Bison installed, we have to store the code
- * generated by these tools in our version control system.  In other parts of
- * the system we've seen problems where a parser was changed but the generated
- * code was not committed, merge conflicts where created because two developers
- * had slightly different versions of Bison installed, etc.
- *
- * I have also noticed that running Bison generated parsers in GDB is very
- * irritating.  When you get a segfault on '$$ = $1->foo', you can't very
- * well 'print $1' in GDB.
- *
- * As a result, my preference is to put as little C code as possible in the
- * parser (and lexer) sources.
- */
-
-#include "main/core.h" /* for struct gl_extensions */
-#include "glsl_symbol_table.h"
-#include "glsl_parser_extras.h"
-#include "ast.h"
-#include "glsl_types.h"
-#include "program/hash_table.h"
-#include "ir.h"
-
-void
-_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
-{
-   _mesa_glsl_initialize_variables(instructions, state);
-
-   state->symbols->language_version = state->language_version;
-
-   state->current_function = NULL;
-
-   state->toplevel_ir = instructions;
-
-   /* Section 4.2 of the GLSL 1.20 specification states:
-    * "The built-in functions are scoped in a scope outside the global scope
-    *  users declare global variables in.  That is, a shader's global scope,
-    *  available for user-defined functions and global variables, is nested
-    *  inside the scope containing the built-in functions."
-    *
-    * Since built-in functions like ftransform() access built-in variables,
-    * it follows that those must be in the outer scope as well.
-    *
-    * We push scope here to create this nesting effect...but don't pop.
-    * This way, a shader's globals are still in the symbol table for use
-    * by the linker.
-    */
-   state->symbols->push_scope();
-
-   foreach_list_typed (ast_node, ast, link, & state->translation_unit)
-      ast->hir(instructions, state);
-
-   detect_recursion_unlinked(state, instructions);
-
-   state->toplevel_ir = NULL;
-}
-
-
-/**
- * If a conversion is available, convert one operand to a different type
- *
- * The \c from \c ir_rvalue is converted "in place".
- *
- * \param to     Type that the operand it to be converted to
- * \param from   Operand that is being converted
- * \param state  GLSL compiler state
- *
- * \return
- * If a conversion is possible (or unnecessary), \c true is returned.
- * Otherwise \c false is returned.
- */
-bool
-apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
-                         struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   if (to->base_type == from->type->base_type)
-      return true;
-
-   /* This conversion was added in GLSL 1.20.  If the compilation mode is
-    * GLSL 1.10, the conversion is skipped.
-    */
-   if (state->language_version < 120)
-      return false;
-
-   /* From page 27 (page 33 of the PDF) of the GLSL 1.50 spec:
-    *
-    *    "There are no implicit array or structure conversions. For
-    *    example, an array of int cannot be implicitly converted to an
-    *    array of float. There are no implicit conversions between
-    *    signed and unsigned integers."
-    */
-   /* FINISHME: The above comment is partially a lie.  There is int/uint
-    * FINISHME: conversion for immediate constants.
-    */
-   if (!to->is_float() || !from->type->is_numeric())
-      return false;
-
-   /* Convert to a floating point type with the same number of components
-    * as the original type - i.e. int to float, not int to vec4.
-    */
-   to = glsl_type::get_instance(GLSL_TYPE_FLOAT, from->type->vector_elements,
-                               from->type->matrix_columns);
-
-   switch (from->type->base_type) {
-   case GLSL_TYPE_INT:
-      from = new(ctx) ir_expression(ir_unop_i2f, to, from, NULL);
-      break;
-   case GLSL_TYPE_UINT:
-      from = new(ctx) ir_expression(ir_unop_u2f, to, from, NULL);
-      break;
-   case GLSL_TYPE_BOOL:
-      from = new(ctx) ir_expression(ir_unop_b2f, to, from, NULL);
-      break;
-   default:
-      assert(0);
-   }
-
-   return true;
-}
-
-
-static const struct glsl_type *
-arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b,
-                      bool multiply,
-                      struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-   const glsl_type *type_a = value_a->type;
-   const glsl_type *type_b = value_b->type;
-
-   /* From GLSL 1.50 spec, page 56:
-    *
-    *    "The arithmetic binary operators add (+), subtract (-),
-    *    multiply (*), and divide (/) operate on integer and
-    *    floating-point scalars, vectors, and matrices."
-    */
-   if (!type_a->is_numeric() || !type_b->is_numeric()) {
-      _mesa_glsl_error(loc, state,
-                      "Operands to arithmetic operators must be numeric");
-      return glsl_type::error_type;
-   }
-
-
-   /*    "If one operand is floating-point based and the other is
-    *    not, then the conversions from Section 4.1.10 "Implicit
-    *    Conversions" are applied to the non-floating-point-based operand."
-    */
-   if (!apply_implicit_conversion(type_a, value_b, state)
-       && !apply_implicit_conversion(type_b, value_a, state)) {
-      _mesa_glsl_error(loc, state,
-                      "Could not implicitly convert operands to "
-                      "arithmetic operator");
-      return glsl_type::error_type;
-   }
-   type_a = value_a->type;
-   type_b = value_b->type;
-
-   /*    "If the operands are integer types, they must both be signed or
-    *    both be unsigned."
-    *
-    * From this rule and the preceeding conversion it can be inferred that
-    * both types must be GLSL_TYPE_FLOAT, or GLSL_TYPE_UINT, or GLSL_TYPE_INT.
-    * The is_numeric check above already filtered out the case where either
-    * type is not one of these, so now the base types need only be tested for
-    * equality.
-    */
-   if (type_a->base_type != type_b->base_type) {
-      _mesa_glsl_error(loc, state,
-                      "base type mismatch for arithmetic operator");
-      return glsl_type::error_type;
-   }
-
-   /*    "All arithmetic binary operators result in the same fundamental type
-    *    (signed integer, unsigned integer, or floating-point) as the
-    *    operands they operate on, after operand type conversion. After
-    *    conversion, the following cases are valid
-    *
-    *    * The two operands are scalars. In this case the operation is
-    *      applied, resulting in a scalar."
-    */
-   if (type_a->is_scalar() && type_b->is_scalar())
-      return type_a;
-
-   /*   "* One operand is a scalar, and the other is a vector or matrix.
-    *      In this case, the scalar operation is applied independently to each
-    *      component of the vector or matrix, resulting in the same size
-    *      vector or matrix."
-    */
-   if (type_a->is_scalar()) {
-      if (!type_b->is_scalar())
-        return type_b;
-   } else if (type_b->is_scalar()) {
-      return type_a;
-   }
-
-   /* All of the combinations of <scalar, scalar>, <vector, scalar>,
-    * <scalar, vector>, <scalar, matrix>, and <matrix, scalar> have been
-    * handled.
-    */
-   assert(!type_a->is_scalar());
-   assert(!type_b->is_scalar());
-
-   /*   "* The two operands are vectors of the same size. In this case, the
-    *      operation is done component-wise resulting in the same size
-    *      vector."
-    */
-   if (type_a->is_vector() && type_b->is_vector()) {
-      if (type_a == type_b) {
-        return type_a;
-      } else {
-        _mesa_glsl_error(loc, state,
-                         "vector size mismatch for arithmetic operator");
-        return glsl_type::error_type;
-      }
-   }
-
-   /* All of the combinations of <scalar, scalar>, <vector, scalar>,
-    * <scalar, vector>, <scalar, matrix>, <matrix, scalar>, and
-    * <vector, vector> have been handled.  At least one of the operands must
-    * be matrix.  Further, since there are no integer matrix types, the base
-    * type of both operands must be float.
-    */
-   assert(type_a->is_matrix() || type_b->is_matrix());
-   assert(type_a->base_type == GLSL_TYPE_FLOAT);
-   assert(type_b->base_type == GLSL_TYPE_FLOAT);
-
-   /*   "* The operator is add (+), subtract (-), or divide (/), and the
-    *      operands are matrices with the same number of rows and the same
-    *      number of columns. In this case, the operation is done component-
-    *      wise resulting in the same size matrix."
-    *    * The operator is multiply (*), where both operands are matrices or
-    *      one operand is a vector and the other a matrix. A right vector
-    *      operand is treated as a column vector and a left vector operand as a
-    *      row vector. In all these cases, it is required that the number of
-    *      columns of the left operand is equal to the number of rows of the
-    *      right operand. Then, the multiply (*) operation does a linear
-    *      algebraic multiply, yielding an object that has the same number of
-    *      rows as the left operand and the same number of columns as the right
-    *      operand. Section 5.10 "Vector and Matrix Operations" explains in
-    *      more detail how vectors and matrices are operated on."
-    */
-   if (! multiply) {
-      if (type_a == type_b)
-        return type_a;
-   } else {
-      if (type_a->is_matrix() && type_b->is_matrix()) {
-        /* Matrix multiply.  The columns of A must match the rows of B.  Given
-         * the other previously tested constraints, this means the vector type
-         * of a row from A must be the same as the vector type of a column from
-         * B.
-         */
-        if (type_a->row_type() == type_b->column_type()) {
-           /* The resulting matrix has the number of columns of matrix B and
-            * the number of rows of matrix A.  We get the row count of A by
-            * looking at the size of a vector that makes up a column.  The
-            * transpose (size of a row) is done for B.
-            */
-           const glsl_type *const type =
-              glsl_type::get_instance(type_a->base_type,
-                                      type_a->column_type()->vector_elements,
-                                      type_b->row_type()->vector_elements);
-           assert(type != glsl_type::error_type);
-
-           return type;
-        }
-      } else if (type_a->is_matrix()) {
-        /* A is a matrix and B is a column vector.  Columns of A must match
-         * rows of B.  Given the other previously tested constraints, this
-         * means the vector type of a row from A must be the same as the
-         * vector the type of B.
-         */
-        if (type_a->row_type() == type_b) {
-           /* The resulting vector has a number of elements equal to
-            * the number of rows of matrix A. */
-           const glsl_type *const type =
-              glsl_type::get_instance(type_a->base_type,
-                                      type_a->column_type()->vector_elements,
-                                      1);
-           assert(type != glsl_type::error_type);
-
-           return type;
-        }
-      } else {
-        assert(type_b->is_matrix());
-
-        /* A is a row vector and B is a matrix.  Columns of A must match rows
-         * of B.  Given the other previously tested constraints, this means
-         * the type of A must be the same as the vector type of a column from
-         * B.
-         */
-        if (type_a == type_b->column_type()) {
-           /* The resulting vector has a number of elements equal to
-            * the number of columns of matrix B. */
-           const glsl_type *const type =
-              glsl_type::get_instance(type_a->base_type,
-                                      type_b->row_type()->vector_elements,
-                                      1);
-           assert(type != glsl_type::error_type);
-
-           return type;
-        }
-      }
-
-      _mesa_glsl_error(loc, state, "size mismatch for matrix multiplication");
-      return glsl_type::error_type;
-   }
-
-
-   /*    "All other cases are illegal."
-    */
-   _mesa_glsl_error(loc, state, "type mismatch");
-   return glsl_type::error_type;
-}
-
-
-static const struct glsl_type *
-unary_arithmetic_result_type(const struct glsl_type *type,
-                            struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-   /* From GLSL 1.50 spec, page 57:
-    *
-    *    "The arithmetic unary operators negate (-), post- and pre-increment
-    *     and decrement (-- and ++) operate on integer or floating-point
-    *     values (including vectors and matrices). All unary operators work
-    *     component-wise on their operands. These result with the same type
-    *     they operated on."
-    */
-   if (!type->is_numeric()) {
-      _mesa_glsl_error(loc, state,
-                      "Operands to arithmetic operators must be numeric");
-      return glsl_type::error_type;
-   }
-
-   return type;
-}
-
-/**
- * \brief Return the result type of a bit-logic operation.
- *
- * If the given types to the bit-logic operator are invalid, return
- * glsl_type::error_type.
- *
- * \param type_a Type of LHS of bit-logic op
- * \param type_b Type of RHS of bit-logic op
- */
-static const struct glsl_type *
-bit_logic_result_type(const struct glsl_type *type_a,
-                      const struct glsl_type *type_b,
-                      ast_operators op,
-                      struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-    if (state->language_version < 130) {
-       _mesa_glsl_error(loc, state, "bit operations require GLSL 1.30");
-       return glsl_type::error_type;
-    }
-
-    /* From page 50 (page 56 of PDF) of GLSL 1.30 spec:
-     *
-     *     "The bitwise operators and (&), exclusive-or (^), and inclusive-or
-     *     (|). The operands must be of type signed or unsigned integers or
-     *     integer vectors."
-     */
-    if (!type_a->is_integer()) {
-       _mesa_glsl_error(loc, state, "LHS of `%s' must be an integer",
-                         ast_expression::operator_string(op));
-       return glsl_type::error_type;
-    }
-    if (!type_b->is_integer()) {
-       _mesa_glsl_error(loc, state, "RHS of `%s' must be an integer",
-                        ast_expression::operator_string(op));
-       return glsl_type::error_type;
-    }
-
-    /*     "The fundamental types of the operands (signed or unsigned) must
-     *     match,"
-     */
-    if (type_a->base_type != type_b->base_type) {
-       _mesa_glsl_error(loc, state, "operands of `%s' must have the same "
-                        "base type", ast_expression::operator_string(op));
-       return glsl_type::error_type;
-    }
-
-    /*     "The operands cannot be vectors of differing size." */
-    if (type_a->is_vector() &&
-        type_b->is_vector() &&
-        type_a->vector_elements != type_b->vector_elements) {
-       _mesa_glsl_error(loc, state, "operands of `%s' cannot be vectors of "
-                        "different sizes", ast_expression::operator_string(op));
-       return glsl_type::error_type;
-    }
-
-    /*     "If one operand is a scalar and the other a vector, the scalar is
-     *     applied component-wise to the vector, resulting in the same type as
-     *     the vector. The fundamental types of the operands [...] will be the
-     *     resulting fundamental type."
-     */
-    if (type_a->is_scalar())
-        return type_b;
-    else
-        return type_a;
-}
-
-static const struct glsl_type *
-modulus_result_type(const struct glsl_type *type_a,
-                   const struct glsl_type *type_b,
-                   struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-   if (state->language_version < 130) {
-      _mesa_glsl_error(loc, state,
-                       "operator '%%' is reserved in %s",
-                       state->version_string);
-      return glsl_type::error_type;
-   }
-
-   /* From GLSL 1.50 spec, page 56:
-    *    "The operator modulus (%) operates on signed or unsigned integers or
-    *    integer vectors. The operand types must both be signed or both be
-    *    unsigned."
-    */
-   if (!type_a->is_integer()) {
-      _mesa_glsl_error(loc, state, "LHS of operator %% must be an integer.");
-      return glsl_type::error_type;
-   }
-   if (!type_b->is_integer()) {
-      _mesa_glsl_error(loc, state, "RHS of operator %% must be an integer.");
-      return glsl_type::error_type;
-   }
-   if (type_a->base_type != type_b->base_type) {
-      _mesa_glsl_error(loc, state,
-                      "operands of %% must have the same base type");
-      return glsl_type::error_type;
-   }
-
-   /*    "The operands cannot be vectors of differing size. If one operand is
-    *    a scalar and the other vector, then the scalar is applied component-
-    *    wise to the vector, resulting in the same type as the vector. If both
-    *    are vectors of the same size, the result is computed component-wise."
-    */
-   if (type_a->is_vector()) {
-      if (!type_b->is_vector()
-         || (type_a->vector_elements == type_b->vector_elements))
-        return type_a;
-   } else
-      return type_b;
-
-   /*    "The operator modulus (%) is not defined for any other data types
-    *    (non-integer types)."
-    */
-   _mesa_glsl_error(loc, state, "type mismatch");
-   return glsl_type::error_type;
-}
-
-
-static const struct glsl_type *
-relational_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b,
-                      struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-   const glsl_type *type_a = value_a->type;
-   const glsl_type *type_b = value_b->type;
-
-   /* From GLSL 1.50 spec, page 56:
-    *    "The relational operators greater than (>), less than (<), greater
-    *    than or equal (>=), and less than or equal (<=) operate only on
-    *    scalar integer and scalar floating-point expressions."
-    */
-   if (!type_a->is_numeric()
-       || !type_b->is_numeric()
-       || !type_a->is_scalar()
-       || !type_b->is_scalar()) {
-      _mesa_glsl_error(loc, state,
-                      "Operands to relational operators must be scalar and "
-                      "numeric");
-      return glsl_type::error_type;
-   }
-
-   /*    "Either the operands' types must match, or the conversions from
-    *    Section 4.1.10 "Implicit Conversions" will be applied to the integer
-    *    operand, after which the types must match."
-    */
-   if (!apply_implicit_conversion(type_a, value_b, state)
-       && !apply_implicit_conversion(type_b, value_a, state)) {
-      _mesa_glsl_error(loc, state,
-                      "Could not implicitly convert operands to "
-                      "relational operator");
-      return glsl_type::error_type;
-   }
-   type_a = value_a->type;
-   type_b = value_b->type;
-
-   if (type_a->base_type != type_b->base_type) {
-      _mesa_glsl_error(loc, state, "base type mismatch");
-      return glsl_type::error_type;
-   }
-
-   /*    "The result is scalar Boolean."
-    */
-   return glsl_type::bool_type;
-}
-
-/**
- * \brief Return the result type of a bit-shift operation.
- *
- * If the given types to the bit-shift operator are invalid, return
- * glsl_type::error_type.
- *
- * \param type_a Type of LHS of bit-shift op
- * \param type_b Type of RHS of bit-shift op
- */
-static const struct glsl_type *
-shift_result_type(const struct glsl_type *type_a,
-                  const struct glsl_type *type_b,
-                  ast_operators op,
-                  struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
-{
-   if (state->language_version < 130) {
-      _mesa_glsl_error(loc, state, "bit operations require GLSL 1.30");
-      return glsl_type::error_type;
-   }
-
-   /* From page 50 (page 56 of the PDF) of the GLSL 1.30 spec:
-    *
-    *     "The shift operators (<<) and (>>). For both operators, the operands
-    *     must be signed or unsigned integers or integer vectors. One operand
-    *     can be signed while the other is unsigned."
-    */
-   if (!type_a->is_integer()) {
-      _mesa_glsl_error(loc, state, "LHS of operator %s must be an integer or "
-              "integer vector", ast_expression::operator_string(op));
-     return glsl_type::error_type;
-
-   }
-   if (!type_b->is_integer()) {
-      _mesa_glsl_error(loc, state, "RHS of operator %s must be an integer or "
-              "integer vector", ast_expression::operator_string(op));
-     return glsl_type::error_type;
-   }
-
-   /*     "If the first operand is a scalar, the second operand has to be
-    *     a scalar as well."
-    */
-   if (type_a->is_scalar() && !type_b->is_scalar()) {
-      _mesa_glsl_error(loc, state, "If the first operand of %s is scalar, the "
-              "second must be scalar as well",
-              ast_expression::operator_string(op));
-     return glsl_type::error_type;
-   }
-
-   /* If both operands are vectors, check that they have same number of
-    * elements.
-    */
-   if (type_a->is_vector() &&
-      type_b->is_vector() &&
-      type_a->vector_elements != type_b->vector_elements) {
-      _mesa_glsl_error(loc, state, "Vector operands to operator %s must "
-              "have same number of elements",
-              ast_expression::operator_string(op));
-     return glsl_type::error_type;
-   }
-
-   /*     "In all cases, the resulting type will be the same type as the left
-    *     operand."
-    */
-   return type_a;
-}
-
-/**
- * Validates that a value can be assigned to a location with a specified type
- *
- * Validates that \c rhs can be assigned to some location.  If the types are
- * not an exact match but an automatic conversion is possible, \c rhs will be
- * converted.
- *
- * \return
- * \c NULL if \c rhs cannot be assigned to a location with type \c lhs_type.
- * Otherwise the actual RHS to be assigned will be returned.  This may be
- * \c rhs, or it may be \c rhs after some type conversion.
- *
- * \note
- * In addition to being used for assignments, this function is used to
- * type-check return values.
- */
-ir_rvalue *
-validate_assignment(struct _mesa_glsl_parse_state *state,
-                   const glsl_type *lhs_type, ir_rvalue *rhs,
-                   bool is_initializer)
-{
-   /* If there is already some error in the RHS, just return it.  Anything
-    * else will lead to an avalanche of error message back to the user.
-    */
-   if (rhs->type->is_error())
-      return rhs;
-
-   /* If the types are identical, the assignment can trivially proceed.
-    */
-   if (rhs->type == lhs_type)
-      return rhs;
-
-   /* If the array element types are the same and the size of the LHS is zero,
-    * the assignment is okay for initializers embedded in variable
-    * declarations.
-    *
-    * Note: Whole-array assignments are not permitted in GLSL 1.10, but this
-    * is handled by ir_dereference::is_lvalue.
-    */
-   if (is_initializer && lhs_type->is_array() && rhs->type->is_array()
-       && (lhs_type->element_type() == rhs->type->element_type())
-       && (lhs_type->array_size() == 0)) {
-      return rhs;
-   }
-
-   /* Check for implicit conversion in GLSL 1.20 */
-   if (apply_implicit_conversion(lhs_type, rhs, state)) {
-      if (rhs->type == lhs_type)
-        return rhs;
-   }
-
-   return NULL;
-}
-
-static void
-mark_whole_array_access(ir_rvalue *access)
-{
-   ir_dereference_variable *deref = access->as_dereference_variable();
-
-   if (deref && deref->var) {
-      deref->var->max_array_access = deref->type->length - 1;
-   }
-}
-
-ir_rvalue *
-do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
-             const char *non_lvalue_description,
-             ir_rvalue *lhs, ir_rvalue *rhs, bool is_initializer,
-             YYLTYPE lhs_loc)
-{
-   void *ctx = state;
-   bool error_emitted = (lhs->type->is_error() || rhs->type->is_error());
-
-   if (!error_emitted) {
-      if (non_lvalue_description != NULL) {
-         _mesa_glsl_error(&lhs_loc, state,
-                          "assignment to %s",
-                         non_lvalue_description);
-        error_emitted = true;
-      } else if (lhs->variable_referenced() != NULL
-                && lhs->variable_referenced()->read_only) {
-         _mesa_glsl_error(&lhs_loc, state,
-                          "assignment to read-only variable '%s'",
-                          lhs->variable_referenced()->name);
-         error_emitted = true;
-
-      } else if (state->language_version <= 110 && lhs->type->is_array()) {
-        /* From page 32 (page 38 of the PDF) of the GLSL 1.10 spec:
-         *
-         *    "Other binary or unary expressions, non-dereferenced
-         *     arrays, function names, swizzles with repeated fields,
-         *     and constants cannot be l-values."
-         */
-        _mesa_glsl_error(&lhs_loc, state, "whole array assignment is not "
-                         "allowed in GLSL 1.10 or GLSL ES 1.00.");
-        error_emitted = true;
-      } else if (!lhs->is_lvalue()) {
-        _mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment");
-        error_emitted = true;
-      }
-   }
-
-   ir_rvalue *new_rhs =
-      validate_assignment(state, lhs->type, rhs, is_initializer);
-   if (new_rhs == NULL) {
-      _mesa_glsl_error(& lhs_loc, state, "type mismatch");
-   } else {
-      rhs = new_rhs;
-
-      /* If the LHS array was not declared with a size, it takes it size from
-       * the RHS.  If the LHS is an l-value and a whole array, it must be a
-       * dereference of a variable.  Any other case would require that the LHS
-       * is either not an l-value or not a whole array.
-       */
-      if (lhs->type->array_size() == 0) {
-        ir_dereference *const d = lhs->as_dereference();
-
-        assert(d != NULL);
-
-        ir_variable *const var = d->variable_referenced();
-
-        assert(var != NULL);
-
-        if (var->max_array_access >= unsigned(rhs->type->array_size())) {
-           /* FINISHME: This should actually log the location of the RHS. */
-           _mesa_glsl_error(& lhs_loc, state, "array size must be > %u due to "
-                            "previous access",
-                            var->max_array_access);
-        }
-
-        var->type = glsl_type::get_array_instance(lhs->type->element_type(),
-                                                  rhs->type->array_size());
-        d->type = var->type;
-      }
-      mark_whole_array_access(rhs);
-      mark_whole_array_access(lhs);
-   }
-
-   /* Most callers of do_assignment (assign, add_assign, pre_inc/dec,
-    * but not post_inc) need the converted assigned value as an rvalue
-    * to handle things like:
-    *
-    * i = j += 1;
-    *
-    * So we always just store the computed value being assigned to a
-    * temporary and return a deref of that temporary.  If the rvalue
-    * ends up not being used, the temp will get copy-propagated out.
-    */
-   ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
-                                          ir_var_temporary);
-   ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
-   instructions->push_tail(var);
-   instructions->push_tail(new(ctx) ir_assignment(deref_var,
-                                                 rhs,
-                                                 NULL));
-   deref_var = new(ctx) ir_dereference_variable(var);
-
-   if (!error_emitted)
-      instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var, NULL));
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-static ir_rvalue *
-get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue)
-{
-   void *ctx = ralloc_parent(lvalue);
-   ir_variable *var;
-
-   var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp",
-                             ir_var_temporary);
-   instructions->push_tail(var);
-   var->mode = ir_var_auto;
-
-   instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
-                                                 lvalue, NULL));
-
-   return new(ctx) ir_dereference_variable(var);
-}
-
-
-ir_rvalue *
-ast_node::hir(exec_list *instructions,
-             struct _mesa_glsl_parse_state *state)
-{
-   (void) instructions;
-   (void) state;
-
-   return NULL;
-}
-
-static ir_rvalue *
-do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
-{
-   int join_op;
-   ir_rvalue *cmp = NULL;
-
-   if (operation == ir_binop_all_equal)
-      join_op = ir_binop_logic_and;
-   else
-      join_op = ir_binop_logic_or;
-
-   switch (op0->type->base_type) {
-   case GLSL_TYPE_FLOAT:
-   case GLSL_TYPE_UINT:
-   case GLSL_TYPE_INT:
-   case GLSL_TYPE_BOOL:
-      return new(mem_ctx) ir_expression(operation, op0, op1);
-
-   case GLSL_TYPE_ARRAY: {
-      for (unsigned int i = 0; i < op0->type->length; i++) {
-        ir_rvalue *e0, *e1, *result;
-
-        e0 = new(mem_ctx) ir_dereference_array(op0->clone(mem_ctx, NULL),
-                                               new(mem_ctx) ir_constant(i));
-        e1 = new(mem_ctx) ir_dereference_array(op1->clone(mem_ctx, NULL),
-                                               new(mem_ctx) ir_constant(i));
-        result = do_comparison(mem_ctx, operation, e0, e1);
-
-        if (cmp) {
-           cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
-        } else {
-           cmp = result;
-        }
-      }
-
-      mark_whole_array_access(op0);
-      mark_whole_array_access(op1);
-      break;
-   }
-
-   case GLSL_TYPE_STRUCT: {
-      for (unsigned int i = 0; i < op0->type->length; i++) {
-        ir_rvalue *e0, *e1, *result;
-        const char *field_name = op0->type->fields.structure[i].name;
-
-        e0 = new(mem_ctx) ir_dereference_record(op0->clone(mem_ctx, NULL),
-                                                field_name);
-        e1 = new(mem_ctx) ir_dereference_record(op1->clone(mem_ctx, NULL),
-                                                field_name);
-        result = do_comparison(mem_ctx, operation, e0, e1);
-
-        if (cmp) {
-           cmp = new(mem_ctx) ir_expression(join_op, cmp, result);
-        } else {
-           cmp = result;
-        }
-      }
-      break;
-   }
-
-   case GLSL_TYPE_ERROR:
-   case GLSL_TYPE_VOID:
-   case GLSL_TYPE_SAMPLER:
-      /* I assume a comparison of a struct containing a sampler just
-       * ignores the sampler present in the type.
-       */
-      break;
-
-   default:
-      assert(!"Should not get here.");
-      break;
-   }
-
-   if (cmp == NULL)
-      cmp = new(mem_ctx) ir_constant(true);
-
-   return cmp;
-}
-
-/* For logical operations, we want to ensure that the operands are
- * scalar booleans.  If it isn't, emit an error and return a constant
- * boolean to avoid triggering cascading error messages.
- */
-ir_rvalue *
-get_scalar_boolean_operand(exec_list *instructions,
-                          struct _mesa_glsl_parse_state *state,
-                          ast_expression *parent_expr,
-                          int operand,
-                          const char *operand_name,
-                          bool *error_emitted)
-{
-   ast_expression *expr = parent_expr->subexpressions[operand];
-   void *ctx = state;
-   ir_rvalue *val = expr->hir(instructions, state);
-
-   if (val->type->is_boolean() && val->type->is_scalar())
-      return val;
-
-   if (!*error_emitted) {
-      YYLTYPE loc = expr->get_location();
-      _mesa_glsl_error(&loc, state, "%s of `%s' must be scalar boolean",
-                      operand_name,
-                      parent_expr->operator_string(parent_expr->oper));
-      *error_emitted = true;
-   }
-
-   return new(ctx) ir_constant(true);
-}
-
-/**
- * If name refers to a builtin array whose maximum allowed size is less than
- * size, report an error and return true.  Otherwise return false.
- */
-static bool
-check_builtin_array_max_size(const char *name, unsigned size,
-                             YYLTYPE loc, struct _mesa_glsl_parse_state *state)
-{
-   if ((strcmp("gl_TexCoord", name) == 0)
-       && (size > state->Const.MaxTextureCoords)) {
-      /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
-       *
-       *     "The size [of gl_TexCoord] can be at most
-       *     gl_MaxTextureCoords."
-       */
-      _mesa_glsl_error(&loc, state, "`gl_TexCoord' array size cannot "
-                       "be larger than gl_MaxTextureCoords (%u)\n",
-                       state->Const.MaxTextureCoords);
-      return true;
-   } else if (strcmp("gl_ClipDistance", name) == 0
-              && size > state->Const.MaxClipPlanes) {
-      /* From section 7.1 (Vertex Shader Special Variables) of the
-       * GLSL 1.30 spec:
-       *
-       *   "The gl_ClipDistance array is predeclared as unsized and
-       *   must be sized by the shader either redeclaring it with a
-       *   size or indexing it only with integral constant
-       *   expressions. ... The size can be at most
-       *   gl_MaxClipDistances."
-       */
-      _mesa_glsl_error(&loc, state, "`gl_ClipDistance' array size cannot "
-                       "be larger than gl_MaxClipDistances (%u)\n",
-                       state->Const.MaxClipPlanes);
-      return true;
-   }
-   return false;
-}
-
-/**
- * Create the constant 1, of a which is appropriate for incrementing and
- * decrementing values of the given GLSL type.  For example, if type is vec4,
- * this creates a constant value of 1.0 having type float.
- *
- * If the given type is invalid for increment and decrement operators, return
- * a floating point 1--the error will be detected later.
- */
-static ir_rvalue *
-constant_one_for_inc_dec(void *ctx, const glsl_type *type)
-{
-   switch (type->base_type) {
-   case GLSL_TYPE_UINT:
-      return new(ctx) ir_constant((unsigned) 1);
-   case GLSL_TYPE_INT:
-      return new(ctx) ir_constant(1);
-   default:
-   case GLSL_TYPE_FLOAT:
-      return new(ctx) ir_constant(1.0f);
-   }
-}
-
-ir_rvalue *
-ast_expression::hir(exec_list *instructions,
-                   struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   static const int operations[AST_NUM_OPERATORS] = {
-      -1,               /* ast_assign doesn't convert to ir_expression. */
-      -1,               /* ast_plus doesn't convert to ir_expression. */
-      ir_unop_neg,
-      ir_binop_add,
-      ir_binop_sub,
-      ir_binop_mul,
-      ir_binop_div,
-      ir_binop_mod,
-      ir_binop_lshift,
-      ir_binop_rshift,
-      ir_binop_less,
-      ir_binop_greater,
-      ir_binop_lequal,
-      ir_binop_gequal,
-      ir_binop_all_equal,
-      ir_binop_any_nequal,
-      ir_binop_bit_and,
-      ir_binop_bit_xor,
-      ir_binop_bit_or,
-      ir_unop_bit_not,
-      ir_binop_logic_and,
-      ir_binop_logic_xor,
-      ir_binop_logic_or,
-      ir_unop_logic_not,
-
-      /* Note: The following block of expression types actually convert
-       * to multiple IR instructions.
-       */
-      ir_binop_mul,     /* ast_mul_assign */
-      ir_binop_div,     /* ast_div_assign */
-      ir_binop_mod,     /* ast_mod_assign */
-      ir_binop_add,     /* ast_add_assign */
-      ir_binop_sub,     /* ast_sub_assign */
-      ir_binop_lshift,  /* ast_ls_assign */
-      ir_binop_rshift,  /* ast_rs_assign */
-      ir_binop_bit_and, /* ast_and_assign */
-      ir_binop_bit_xor, /* ast_xor_assign */
-      ir_binop_bit_or,  /* ast_or_assign */
-
-      -1,               /* ast_conditional doesn't convert to ir_expression. */
-      ir_binop_add,     /* ast_pre_inc. */
-      ir_binop_sub,     /* ast_pre_dec. */
-      ir_binop_add,     /* ast_post_inc. */
-      ir_binop_sub,     /* ast_post_dec. */
-      -1,               /* ast_field_selection doesn't conv to ir_expression. */
-      -1,               /* ast_array_index doesn't convert to ir_expression. */
-      -1,               /* ast_function_call doesn't conv to ir_expression. */
-      -1,               /* ast_identifier doesn't convert to ir_expression. */
-      -1,               /* ast_int_constant doesn't convert to ir_expression. */
-      -1,               /* ast_uint_constant doesn't conv to ir_expression. */
-      -1,               /* ast_float_constant doesn't conv to ir_expression. */
-      -1,               /* ast_bool_constant doesn't conv to ir_expression. */
-      -1,               /* ast_sequence doesn't convert to ir_expression. */
-   };
-   ir_rvalue *result = NULL;
-   ir_rvalue *op[3];
-   const struct glsl_type *type; /* a temporary variable for switch cases */
-   bool error_emitted = false;
-   YYLTYPE loc;
-
-   loc = this->get_location();
-
-   switch (this->oper) {
-   case ast_assign: {
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0], op[1], false,
-                            this->subexpressions[0]->get_location());
-      error_emitted = result->type->is_error();
-      break;
-   }
-
-   case ast_plus:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-
-      type = unary_arithmetic_result_type(op[0]->type, state, & loc);
-
-      error_emitted = type->is_error();
-
-      result = op[0];
-      break;
-
-   case ast_neg:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-
-      type = unary_arithmetic_result_type(op[0]->type, state, & loc);
-
-      error_emitted = type->is_error();
-
-      result = new(ctx) ir_expression(operations[this->oper], type,
-                                     op[0], NULL);
-      break;
-
-   case ast_add:
-   case ast_sub:
-   case ast_mul:
-   case ast_div:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      type = arithmetic_result_type(op[0], op[1],
-                                   (this->oper == ast_mul),
-                                   state, & loc);
-      error_emitted = type->is_error();
-
-      result = new(ctx) ir_expression(operations[this->oper], type,
-                                     op[0], op[1]);
-      break;
-
-   case ast_mod:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      type = modulus_result_type(op[0]->type, op[1]->type, state, & loc);
-
-      assert(operations[this->oper] == ir_binop_mod);
-
-      result = new(ctx) ir_expression(operations[this->oper], type,
-                                     op[0], op[1]);
-      error_emitted = type->is_error();
-      break;
-
-   case ast_lshift:
-   case ast_rshift:
-       if (state->language_version < 130) {
-          _mesa_glsl_error(&loc, state, "operator %s requires GLSL 1.30",
-              operator_string(this->oper));
-          error_emitted = true;
-       }
-
-       op[0] = this->subexpressions[0]->hir(instructions, state);
-       op[1] = this->subexpressions[1]->hir(instructions, state);
-       type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
-                                &loc);
-       result = new(ctx) ir_expression(operations[this->oper], type,
-                                       op[0], op[1]);
-       error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-       break;
-
-   case ast_less:
-   case ast_greater:
-   case ast_lequal:
-   case ast_gequal:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      type = relational_result_type(op[0], op[1], state, & loc);
-
-      /* The relational operators must either generate an error or result
-       * in a scalar boolean.  See page 57 of the GLSL 1.50 spec.
-       */
-      assert(type->is_error()
-            || ((type->base_type == GLSL_TYPE_BOOL)
-                && type->is_scalar()));
-
-      result = new(ctx) ir_expression(operations[this->oper], type,
-                                     op[0], op[1]);
-      error_emitted = type->is_error();
-      break;
-
-   case ast_nequal:
-   case ast_equal:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      /* From page 58 (page 64 of the PDF) of the GLSL 1.50 spec:
-       *
-       *    "The equality operators equal (==), and not equal (!=)
-       *    operate on all types. They result in a scalar Boolean. If
-       *    the operand types do not match, then there must be a
-       *    conversion from Section 4.1.10 "Implicit Conversions"
-       *    applied to one operand that can make them match, in which
-       *    case this conversion is done."
-       */
-      if ((!apply_implicit_conversion(op[0]->type, op[1], state)
-          && !apply_implicit_conversion(op[1]->type, op[0], state))
-         || (op[0]->type != op[1]->type)) {
-        _mesa_glsl_error(& loc, state, "operands of `%s' must have the same "
-                         "type", (this->oper == ast_equal) ? "==" : "!=");
-        error_emitted = true;
-      } else if ((state->language_version <= 110)
-                && (op[0]->type->is_array() || op[1]->type->is_array())) {
-        _mesa_glsl_error(& loc, state, "array comparisons forbidden in "
-                         "GLSL 1.10");
-        error_emitted = true;
-      }
-
-      if (error_emitted) {
-        result = new(ctx) ir_constant(false);
-      } else {
-        result = do_comparison(ctx, operations[this->oper], op[0], op[1]);
-        assert(result->type == glsl_type::bool_type);
-      }
-      break;
-
-   case ast_bit_and:
-   case ast_bit_xor:
-   case ast_bit_or:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-      type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
-                                   state, &loc);
-      result = new(ctx) ir_expression(operations[this->oper], type,
-                                     op[0], op[1]);
-      error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-      break;
-
-   case ast_bit_not:
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-
-      if (state->language_version < 130) {
-        _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30");
-        error_emitted = true;
-      }
-
-      if (!op[0]->type->is_integer()) {
-        _mesa_glsl_error(&loc, state, "operand of `~' must be an integer");
-        error_emitted = true;
-      }
-
-      type = error_emitted ? glsl_type::error_type : op[0]->type;
-      result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL);
-      break;
-
-   case ast_logic_and: {
-      exec_list rhs_instructions;
-      op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
-                                        "LHS", &error_emitted);
-      op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
-                                        "RHS", &error_emitted);
-
-      ir_constant *op0_const = op[0]->constant_expression_value();
-      if (op0_const) {
-        if (op0_const->value.b[0]) {
-           instructions->append_list(&rhs_instructions);
-           result = op[1];
-        } else {
-           result = op0_const;
-        }
-        type = glsl_type::bool_type;
-      } else {
-        ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
-                                                      "and_tmp",
-                                                      ir_var_temporary);
-        instructions->push_tail(tmp);
-
-        ir_if *const stmt = new(ctx) ir_if(op[0]);
-        instructions->push_tail(stmt);
-
-        stmt->then_instructions.append_list(&rhs_instructions);
-        ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, op[1], NULL);
-        stmt->then_instructions.push_tail(then_assign);
-
-        ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, new(ctx) ir_constant(false), NULL);
-        stmt->else_instructions.push_tail(else_assign);
-
-        result = new(ctx) ir_dereference_variable(tmp);
-        type = tmp->type;
-      }
-      break;
-   }
-
-   case ast_logic_or: {
-      exec_list rhs_instructions;
-      op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
-                                        "LHS", &error_emitted);
-      op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
-                                        "RHS", &error_emitted);
-
-      ir_constant *op0_const = op[0]->constant_expression_value();
-      if (op0_const) {
-        if (op0_const->value.b[0]) {
-           result = op0_const;
-        } else {
-           result = op[1];
-        }
-        type = glsl_type::bool_type;
-      } else {
-        ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
-                                                      "or_tmp",
-                                                      ir_var_temporary);
-        instructions->push_tail(tmp);
-
-        ir_if *const stmt = new(ctx) ir_if(op[0]);
-        instructions->push_tail(stmt);
-
-        ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, new(ctx) ir_constant(true), NULL);
-        stmt->then_instructions.push_tail(then_assign);
-
-        stmt->else_instructions.append_list(&rhs_instructions);
-        ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, op[1], NULL);
-        stmt->else_instructions.push_tail(else_assign);
-
-        result = new(ctx) ir_dereference_variable(tmp);
-        type = tmp->type;
-      }
-      break;
-   }
-
-   case ast_logic_xor:
-      /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "The logical binary operators and (&&), or ( | | ), and
-       *     exclusive or (^^). They operate only on two Boolean
-       *     expressions and result in a Boolean expression."
-       */
-      op[0] = get_scalar_boolean_operand(instructions, state, this, 0, "LHS",
-                                        &error_emitted);
-      op[1] = get_scalar_boolean_operand(instructions, state, this, 1, "RHS",
-                                        &error_emitted);
-
-      result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
-                                     op[0], op[1]);
-      break;
-
-   case ast_logic_not:
-      op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
-                                        "operand", &error_emitted);
-
-      result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
-                                     op[0], NULL);
-      break;
-
-   case ast_mul_assign:
-   case ast_div_assign:
-   case ast_add_assign:
-   case ast_sub_assign: {
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      type = arithmetic_result_type(op[0], op[1],
-                                   (this->oper == ast_mul_assign),
-                                   state, & loc);
-
-      ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
-                                                  op[0], op[1]);
-
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0]->clone(ctx, NULL), temp_rhs, false,
-                            this->subexpressions[0]->get_location());
-      error_emitted = (op[0]->type->is_error());
-
-      /* GLSL 1.10 does not allow array assignment.  However, we don't have to
-       * explicitly test for this because none of the binary expression
-       * operators allow array operands either.
-       */
-
-      break;
-   }
-
-   case ast_mod_assign: {
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-
-      type = modulus_result_type(op[0]->type, op[1]->type, state, & loc);
-
-      assert(operations[this->oper] == ir_binop_mod);
-
-      ir_rvalue *temp_rhs;
-      temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
-                                       op[0], op[1]);
-
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0]->clone(ctx, NULL), temp_rhs, false,
-                            this->subexpressions[0]->get_location());
-      error_emitted = type->is_error();
-      break;
-   }
-
-   case ast_ls_assign:
-   case ast_rs_assign: {
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-      type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
-                               &loc);
-      ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
-                                                   type, op[0], op[1]);
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0]->clone(ctx, NULL), temp_rhs, false,
-                             this->subexpressions[0]->get_location());
-      error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-      break;
-   }
-
-   case ast_and_assign:
-   case ast_xor_assign:
-   case ast_or_assign: {
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = this->subexpressions[1]->hir(instructions, state);
-      type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
-                                   state, &loc);
-      ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
-                                                   type, op[0], op[1]);
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0]->clone(ctx, NULL), temp_rhs, false,
-                             this->subexpressions[0]->get_location());
-      error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-      break;
-   }
-
-   case ast_conditional: {
-      /* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec:
-       *
-       *    "The ternary selection operator (?:). It operates on three
-       *    expressions (exp1 ? exp2 : exp3). This operator evaluates the
-       *    first expression, which must result in a scalar Boolean."
-       */
-      op[0] = get_scalar_boolean_operand(instructions, state, this, 0,
-                                        "condition", &error_emitted);
-
-      /* The :? operator is implemented by generating an anonymous temporary
-       * followed by an if-statement.  The last instruction in each branch of
-       * the if-statement assigns a value to the anonymous temporary.  This
-       * temporary is the r-value of the expression.
-       */
-      exec_list then_instructions;
-      exec_list else_instructions;
-
-      op[1] = this->subexpressions[1]->hir(&then_instructions, state);
-      op[2] = this->subexpressions[2]->hir(&else_instructions, state);
-
-      /* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec:
-       *
-       *     "The second and third expressions can be any type, as
-       *     long their types match, or there is a conversion in
-       *     Section 4.1.10 "Implicit Conversions" that can be applied
-       *     to one of the expressions to make their types match. This
-       *     resulting matching type is the type of the entire
-       *     expression."
-       */
-      if ((!apply_implicit_conversion(op[1]->type, op[2], state)
-          && !apply_implicit_conversion(op[2]->type, op[1], state))
-         || (op[1]->type != op[2]->type)) {
-        YYLTYPE loc = this->subexpressions[1]->get_location();
-
-        _mesa_glsl_error(& loc, state, "Second and third operands of ?: "
-                         "operator must have matching types.");
-        error_emitted = true;
-        type = glsl_type::error_type;
-      } else {
-        type = op[1]->type;
-      }
-
-      /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
-       *
-       *    "The second and third expressions must be the same type, but can
-       *    be of any type other than an array."
-       */
-      if ((state->language_version <= 110) && type->is_array()) {
-        _mesa_glsl_error(& loc, state, "Second and third operands of ?: "
-                         "operator must not be arrays.");
-        error_emitted = true;
-      }
-
-      ir_constant *cond_val = op[0]->constant_expression_value();
-      ir_constant *then_val = op[1]->constant_expression_value();
-      ir_constant *else_val = op[2]->constant_expression_value();
-
-      if (then_instructions.is_empty()
-         && else_instructions.is_empty()
-         && (cond_val != NULL) && (then_val != NULL) && (else_val != NULL)) {
-        result = (cond_val->value.b[0]) ? then_val : else_val;
-      } else {
-        ir_variable *const tmp =
-           new(ctx) ir_variable(type, "conditional_tmp", ir_var_temporary);
-        instructions->push_tail(tmp);
-
-        ir_if *const stmt = new(ctx) ir_if(op[0]);
-        instructions->push_tail(stmt);
-
-        then_instructions.move_nodes_to(& stmt->then_instructions);
-        ir_dereference *const then_deref =
-           new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, op[1], NULL);
-        stmt->then_instructions.push_tail(then_assign);
-
-        else_instructions.move_nodes_to(& stmt->else_instructions);
-        ir_dereference *const else_deref =
-           new(ctx) ir_dereference_variable(tmp);
-        ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, op[2], NULL);
-        stmt->else_instructions.push_tail(else_assign);
-
-        result = new(ctx) ir_dereference_variable(tmp);
-      }
-      break;
-   }
-
-   case ast_pre_inc:
-   case ast_pre_dec: {
-      this->non_lvalue_description = (this->oper == ast_pre_inc)
-        ? "pre-increment operation" : "pre-decrement operation";
-
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
-
-      type = arithmetic_result_type(op[0], op[1], false, state, & loc);
-
-      ir_rvalue *temp_rhs;
-      temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
-                                       op[0], op[1]);
-
-      result = do_assignment(instructions, state,
-                            this->subexpressions[0]->non_lvalue_description,
-                            op[0]->clone(ctx, NULL), temp_rhs, false,
-                            this->subexpressions[0]->get_location());
-      error_emitted = op[0]->type->is_error();
-      break;
-   }
-
-   case ast_post_inc:
-   case ast_post_dec: {
-      this->non_lvalue_description = (this->oper == ast_post_inc)
-        ? "post-increment operation" : "post-decrement operation";
-      op[0] = this->subexpressions[0]->hir(instructions, state);
-      op[1] = constant_one_for_inc_dec(ctx, op[0]->type);
-
-      error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-
-      type = arithmetic_result_type(op[0], op[1], false, state, & loc);
-
-      ir_rvalue *temp_rhs;
-      temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
-                                       op[0], op[1]);
-
-      /* Get a temporary of a copy of the lvalue before it's modified.
-       * This may get thrown away later.
-       */
-      result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
-
-      (void)do_assignment(instructions, state,
-                         this->subexpressions[0]->non_lvalue_description,
-                         op[0]->clone(ctx, NULL), temp_rhs, false,
-                         this->subexpressions[0]->get_location());
-
-      error_emitted = op[0]->type->is_error();
-      break;
-   }
-
-   case ast_field_selection:
-      result = _mesa_ast_field_selection_to_hir(this, instructions, state);
-      break;
-
-   case ast_array_index: {
-      YYLTYPE index_loc = subexpressions[1]->get_location();
-
-      op[0] = subexpressions[0]->hir(instructions, state);
-      op[1] = subexpressions[1]->hir(instructions, state);
-
-      error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
-
-      ir_rvalue *const array = op[0];
-
-      result = new(ctx) ir_dereference_array(op[0], op[1]);
-
-      /* Do not use op[0] after this point.  Use array.
-       */
-      op[0] = NULL;
-
-
-      if (error_emitted)
-        break;
-
-      if (!array->type->is_array()
-         && !array->type->is_matrix()
-         && !array->type->is_vector()) {
-        _mesa_glsl_error(& index_loc, state,
-                         "cannot dereference non-array / non-matrix / "
-                         "non-vector");
-        error_emitted = true;
-      }
-
-      if (!op[1]->type->is_integer()) {
-        _mesa_glsl_error(& index_loc, state,
-                         "array index must be integer type");
-        error_emitted = true;
-      } else if (!op[1]->type->is_scalar()) {
-        _mesa_glsl_error(& index_loc, state,
-                         "array index must be scalar");
-        error_emitted = true;
-      }
-
-      /* If the array index is a constant expression and the array has a
-       * declared size, ensure that the access is in-bounds.  If the array
-       * index is not a constant expression, ensure that the array has a
-       * declared size.
-       */
-      ir_constant *const const_index = op[1]->constant_expression_value();
-      if (const_index != NULL) {
-        const int idx = const_index->value.i[0];
-        const char *type_name;
-        unsigned bound = 0;
-
-        if (array->type->is_matrix()) {
-           type_name = "matrix";
-        } else if (array->type->is_vector()) {
-           type_name = "vector";
-        } else {
-           type_name = "array";
-        }
-
-        /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec:
-         *
-         *    "It is illegal to declare an array with a size, and then
-         *    later (in the same shader) index the same array with an
-         *    integral constant expression greater than or equal to the
-         *    declared size. It is also illegal to index an array with a
-         *    negative constant expression."
-         */
-        if (array->type->is_matrix()) {
-           if (array->type->row_type()->vector_elements <= idx) {
-              bound = array->type->row_type()->vector_elements;
-           }
-        } else if (array->type->is_vector()) {
-           if (array->type->vector_elements <= idx) {
-              bound = array->type->vector_elements;
-           }
-        } else {
-           if ((array->type->array_size() > 0)
-               && (array->type->array_size() <= idx)) {
-              bound = array->type->array_size();
-           }
-        }
-
-        if (bound > 0) {
-           _mesa_glsl_error(& loc, state, "%s index must be < %u",
-                            type_name, bound);
-           error_emitted = true;
-        } else if (idx < 0) {
-           _mesa_glsl_error(& loc, state, "%s index must be >= 0",
-                            type_name);
-           error_emitted = true;
-        }
-
-        if (array->type->is_array()) {
-           /* If the array is a variable dereference, it dereferences the
-            * whole array, by definition.  Use this to get the variable.
-            *
-            * FINISHME: Should some methods for getting / setting / testing
-            * FINISHME: array access limits be added to ir_dereference?
-            */
-           ir_variable *const v = array->whole_variable_referenced();
-           if ((v != NULL) && (unsigned(idx) > v->max_array_access)) {
-              v->max_array_access = idx;
-
-               /* Check whether this access will, as a side effect, implicitly
-                * cause the size of a built-in array to be too large.
-                */
-               if (check_builtin_array_max_size(v->name, idx+1, loc, state))
-                  error_emitted = true;
-            }
-        }
-      } else if (array->type->array_size() == 0) {
-        _mesa_glsl_error(&loc, state, "unsized array index must be constant");
-      } else {
-        if (array->type->is_array()) {
-           /* whole_variable_referenced can return NULL if the array is a
-            * member of a structure.  In this case it is safe to not update
-            * the max_array_access field because it is never used for fields
-            * of structures.
-            */
-           ir_variable *v = array->whole_variable_referenced();
-           if (v != NULL)
-              v->max_array_access = array->type->array_size() - 1;
-        }
-      }
-
-      /* From page 23 (29 of the PDF) of the GLSL 1.30 spec:
-       *
-       *    "Samplers aggregated into arrays within a shader (using square
-       *    brackets [ ]) can only be indexed with integral constant
-       *    expressions [...]."
-       *
-       * This restriction was added in GLSL 1.30.  Shaders using earlier version
-       * of the language should not be rejected by the compiler front-end for
-       * using this construct.  This allows useful things such as using a loop
-       * counter as the index to an array of samplers.  If the loop in unrolled,
-       * the code should compile correctly.  Instead, emit a warning.
-       */
-      if (array->type->is_array() &&
-          array->type->element_type()->is_sampler() &&
-          const_index == NULL) {
-
-        if (state->language_version == 100) {
-           _mesa_glsl_warning(&loc, state,
-                              "sampler arrays indexed with non-constant "
-                              "expressions is optional in GLSL ES 1.00");
-        } else if (state->language_version < 130) {
-           _mesa_glsl_warning(&loc, state,
-                              "sampler arrays indexed with non-constant "
-                              "expressions is forbidden in GLSL 1.30 and "
-                              "later");
-        } else {
-           _mesa_glsl_error(&loc, state,
-                            "sampler arrays indexed with non-constant "
-                            "expressions is forbidden in GLSL 1.30 and "
-                            "later");
-           error_emitted = true;
-        }
-      }
-
-      if (error_emitted)
-        result->type = glsl_type::error_type;
-
-      break;
-   }
-
-   case ast_function_call:
-      /* Should *NEVER* get here.  ast_function_call should always be handled
-       * by ast_function_expression::hir.
-       */
-      assert(0);
-      break;
-
-   case ast_identifier: {
-      /* ast_identifier can appear several places in a full abstract syntax
-       * tree.  This particular use must be at location specified in the grammar
-       * as 'variable_identifier'.
-       */
-      ir_variable *var = 
-        state->symbols->get_variable(this->primary_expression.identifier);
-
-      result = new(ctx) ir_dereference_variable(var);
-
-      if (var != NULL) {
-        var->used = true;
-      } else {
-        _mesa_glsl_error(& loc, state, "`%s' undeclared",
-                         this->primary_expression.identifier);
-
-        error_emitted = true;
-      }
-      break;
-   }
-
-   case ast_int_constant:
-      result = new(ctx) ir_constant(this->primary_expression.int_constant);
-      break;
-
-   case ast_uint_constant:
-      result = new(ctx) ir_constant(this->primary_expression.uint_constant);
-      break;
-
-   case ast_float_constant:
-      result = new(ctx) ir_constant(this->primary_expression.float_constant);
-      break;
-
-   case ast_bool_constant:
-      result = new(ctx) ir_constant(bool(this->primary_expression.bool_constant));
-      break;
-
-   case ast_sequence: {
-      /* It should not be possible to generate a sequence in the AST without
-       * any expressions in it.
-       */
-      assert(!this->expressions.is_empty());
-
-      /* The r-value of a sequence is the last expression in the sequence.  If
-       * the other expressions in the sequence do not have side-effects (and
-       * therefore add instructions to the instruction list), they get dropped
-       * on the floor.
-       */
-      exec_node *previous_tail_pred = NULL;
-      YYLTYPE previous_operand_loc = loc;
-
-      foreach_list_typed (ast_node, ast, link, &this->expressions) {
-        /* If one of the operands of comma operator does not generate any
-         * code, we want to emit a warning.  At each pass through the loop
-         * previous_tail_pred will point to the last instruction in the
-         * stream *before* processing the previous operand.  Naturally,
-         * instructions->tail_pred will point to the last instruction in the
-         * stream *after* processing the previous operand.  If the two
-         * pointers match, then the previous operand had no effect.
-         *
-         * The warning behavior here differs slightly from GCC.  GCC will
-         * only emit a warning if none of the left-hand operands have an
-         * effect.  However, it will emit a warning for each.  I believe that
-         * there are some cases in C (especially with GCC extensions) where
-         * it is useful to have an intermediate step in a sequence have no
-         * effect, but I don't think these cases exist in GLSL.  Either way,
-         * it would be a giant hassle to replicate that behavior.
-         */
-        if (previous_tail_pred == instructions->tail_pred) {
-           _mesa_glsl_warning(&previous_operand_loc, state,
-                              "left-hand operand of comma expression has "
-                              "no effect");
-        }
-
-        /* tail_pred is directly accessed instead of using the get_tail()
-         * method for performance reasons.  get_tail() has extra code to
-         * return NULL when the list is empty.  We don't care about that
-         * here, so using tail_pred directly is fine.
-         */
-        previous_tail_pred = instructions->tail_pred;
-        previous_operand_loc = ast->get_location();
-
-        result = ast->hir(instructions, state);
-      }
-
-      /* Any errors should have already been emitted in the loop above.
-       */
-      error_emitted = true;
-      break;
-   }
-   }
-   type = NULL; /* use result->type, not type. */
-   assert(result != NULL);
-
-   if (result->type->is_error() && !error_emitted)
-      _mesa_glsl_error(& loc, state, "type mismatch");
-
-   return result;
-}
-
-
-ir_rvalue *
-ast_expression_statement::hir(exec_list *instructions,
-                             struct _mesa_glsl_parse_state *state)
-{
-   /* It is possible to have expression statements that don't have an
-    * expression.  This is the solitary semicolon:
-    *
-    * for (i = 0; i < 5; i++)
-    *     ;
-    *
-    * In this case the expression will be NULL.  Test for NULL and don't do
-    * anything in that case.
-    */
-   if (expression != NULL)
-      expression->hir(instructions, state);
-
-   /* Statements do not have r-values.
-    */
-   return NULL;
-}
-
-
-ir_rvalue *
-ast_compound_statement::hir(exec_list *instructions,
-                           struct _mesa_glsl_parse_state *state)
-{
-   if (new_scope)
-      state->symbols->push_scope();
-
-   foreach_list_typed (ast_node, ast, link, &this->statements)
-      ast->hir(instructions, state);
-
-   if (new_scope)
-      state->symbols->pop_scope();
-
-   /* Compound statements do not have r-values.
-    */
-   return NULL;
-}
-
-
-static const glsl_type *
-process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size,
-                  struct _mesa_glsl_parse_state *state)
-{
-   unsigned length = 0;
-
-   /* From page 19 (page 25) of the GLSL 1.20 spec:
-    *
-    *     "Only one-dimensional arrays may be declared."
-    */
-   if (base->is_array()) {
-      _mesa_glsl_error(loc, state,
-                      "invalid array of `%s' (only one-dimensional arrays "
-                      "may be declared)",
-                      base->name);
-      return glsl_type::error_type;
-   }
-
-   if (array_size != NULL) {
-      exec_list dummy_instructions;
-      ir_rvalue *const ir = array_size->hir(& dummy_instructions, state);
-      YYLTYPE loc = array_size->get_location();
-
-      if (ir != NULL) {
-        if (!ir->type->is_integer()) {
-           _mesa_glsl_error(& loc, state, "array size must be integer type");
-        } else if (!ir->type->is_scalar()) {
-           _mesa_glsl_error(& loc, state, "array size must be scalar type");
-        } else {
-           ir_constant *const size = ir->constant_expression_value();
-
-           if (size == NULL) {
-              _mesa_glsl_error(& loc, state, "array size must be a "
-                               "constant valued expression");
-           } else if (size->value.i[0] <= 0) {
-              _mesa_glsl_error(& loc, state, "array size must be > 0");
-           } else {
-              assert(size->type == ir->type);
-              length = size->value.u[0];
-
-               /* If the array size is const (and we've verified that
-                * it is) then no instructions should have been emitted
-                * when we converted it to HIR.  If they were emitted,
-                * then either the array size isn't const after all, or
-                * we are emitting unnecessary instructions.
-                */
-               assert(dummy_instructions.is_empty());
-           }
-        }
-      }
-   }
-
-   return glsl_type::get_array_instance(base, length);
-}
-
-
-const glsl_type *
-ast_type_specifier::glsl_type(const char **name,
-                             struct _mesa_glsl_parse_state *state) const
-{
-   const struct glsl_type *type;
-
-   type = state->symbols->get_type(this->type_name);
-   *name = this->type_name;
-
-   if (this->is_array) {
-      YYLTYPE loc = this->get_location();
-      type = process_array_type(&loc, type, this->array_size, state);
-   }
-
-   return type;
-}
-
-
-static void
-apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
-                                ir_variable *var,
-                                struct _mesa_glsl_parse_state *state,
-                                YYLTYPE *loc)
-{
-   if (qual->flags.q.invariant) {
-      if (var->used) {
-        _mesa_glsl_error(loc, state,
-                         "variable `%s' may not be redeclared "
-                         "`invariant' after being used",
-                         var->name);
-      } else {
-        var->invariant = 1;
-      }
-   }
-
-   if (qual->flags.q.constant || qual->flags.q.attribute
-       || qual->flags.q.uniform
-       || (qual->flags.q.varying && (state->target == fragment_shader)))
-      var->read_only = 1;
-
-   if (qual->flags.q.centroid)
-      var->centroid = 1;
-
-   if (qual->flags.q.attribute && state->target != vertex_shader) {
-      var->type = glsl_type::error_type;
-      _mesa_glsl_error(loc, state,
-                      "`attribute' variables may not be declared in the "
-                      "%s shader",
-                      _mesa_glsl_shader_target_name(state->target));
-   }
-
-   /* From page 25 (page 31 of the PDF) of the GLSL 1.10 spec:
-    *
-    *     "The varying qualifier can be used only with the data types
-    *     float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
-    *     these."
-    */
-   if (qual->flags.q.varying) {
-      const glsl_type *non_array_type;
-
-      if (var->type && var->type->is_array())
-        non_array_type = var->type->fields.array;
-      else
-        non_array_type = var->type;
-
-      if (non_array_type && non_array_type->base_type != GLSL_TYPE_FLOAT) {
-        var->type = glsl_type::error_type;
-        _mesa_glsl_error(loc, state,
-                         "varying variables must be of base type float");
-      }
-   }
-
-   /* If there is no qualifier that changes the mode of the variable, leave
-    * the setting alone.
-    */
-   if (qual->flags.q.in && qual->flags.q.out)
-      var->mode = ir_var_inout;
-   else if (qual->flags.q.attribute || qual->flags.q.in
-           || (qual->flags.q.varying && (state->target == fragment_shader)))
-      var->mode = ir_var_in;
-   else if (qual->flags.q.out
-           || (qual->flags.q.varying && (state->target == vertex_shader)))
-      var->mode = ir_var_out;
-   else if (qual->flags.q.uniform)
-      var->mode = ir_var_uniform;
-
-   if (state->all_invariant && (state->current_function == NULL)) {
-      switch (state->target) {
-      case vertex_shader:
-        if (var->mode == ir_var_out)
-           var->invariant = true;
-        break;
-      case fragment_shader:
-        if (var->mode == ir_var_in)
-           var->invariant = true;
-        break;
-      }
-   }
-
-   if (qual->flags.q.flat)
-      var->interpolation = INTERP_QUALIFIER_FLAT;
-   else if (qual->flags.q.noperspective)
-      var->interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
-   else if (qual->flags.q.smooth)
-      var->interpolation = INTERP_QUALIFIER_SMOOTH;
-   else
-      var->interpolation = INTERP_QUALIFIER_NONE;
-
-   if (var->interpolation != INTERP_QUALIFIER_NONE &&
-       !(state->target == vertex_shader && var->mode == ir_var_out) &&
-       !(state->target == fragment_shader && var->mode == ir_var_in)) {
-      const char *qual_string = NULL;
-      switch (var->interpolation) {
-      case INTERP_QUALIFIER_FLAT:
-        qual_string = "flat";
-        break;
-      case INTERP_QUALIFIER_NOPERSPECTIVE:
-        qual_string = "noperspective";
-        break;
-      case INTERP_QUALIFIER_SMOOTH:
-        qual_string = "smooth";
-        break;
-      }
-
-      _mesa_glsl_error(loc, state,
-                      "interpolation qualifier `%s' can only be applied to "
-                      "vertex shader outputs and fragment shader inputs.",
-                      qual_string);
-
-   }
-
-   /* Layout qualifiers for gl_FragDepth, which are enabled by extension
-    * AMD_conservative_depth.
-    */
-   int depth_layout_count = qual->flags.q.depth_any
-      + qual->flags.q.depth_greater
-      + qual->flags.q.depth_less
-      + qual->flags.q.depth_unchanged;
-   if (depth_layout_count > 0
-       && !state->AMD_conservative_depth_enable
-       && !state->ARB_conservative_depth_enable) {
-       _mesa_glsl_error(loc, state,
-                        "extension GL_AMD_conservative_depth or "
-                        "GL_ARB_conservative_depth must be enabled "
-                       "to use depth layout qualifiers");
-   } else if (depth_layout_count > 0
-              && strcmp(var->name, "gl_FragDepth") != 0) {
-       _mesa_glsl_error(loc, state,
-                        "depth layout qualifiers can be applied only to "
-                        "gl_FragDepth");
-   } else if (depth_layout_count > 1
-              && strcmp(var->name, "gl_FragDepth") == 0) {
-      _mesa_glsl_error(loc, state,
-                       "at most one depth layout qualifier can be applied to "
-                       "gl_FragDepth");
-   }
-   if (qual->flags.q.depth_any)
-      var->depth_layout = ir_depth_layout_any;
-   else if (qual->flags.q.depth_greater)
-      var->depth_layout = ir_depth_layout_greater;
-   else if (qual->flags.q.depth_less)
-      var->depth_layout = ir_depth_layout_less;
-   else if (qual->flags.q.depth_unchanged)
-       var->depth_layout = ir_depth_layout_unchanged;
-   else
-       var->depth_layout = ir_depth_layout_none;
-}
-
-/**
- * Get the variable that is being redeclared by this declaration
- *
- * Semantic checks to verify the validity of the redeclaration are also
- * performed.  If semantic checks fail, compilation error will be emitted via
- * \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned.
- *
- * \returns
- * A pointer to an existing variable in the current scope if the declaration
- * is a redeclaration, \c NULL otherwise.
- */
-ir_variable *
-get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,
-                             struct _mesa_glsl_parse_state *state)
-{
-   /* Check if this declaration is actually a re-declaration, either to
-    * resize an array or add qualifiers to an existing variable.
-    *
-    * This is allowed for variables in the current scope, or when at
-    * global scope (for built-ins in the implicit outer scope).
-    */
-   ir_variable *earlier = state->symbols->get_variable(decl->identifier);
-   if (earlier == NULL ||
-       (state->current_function != NULL &&
-       !state->symbols->name_declared_this_scope(decl->identifier))) {
-      return NULL;
-   }
-
-
-   YYLTYPE loc = decl->get_location();
-
-   /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,
-    *
-    * "It is legal to declare an array without a size and then
-    *  later re-declare the same name as an array of the same
-    *  type and specify a size."
-    */
-   if ((earlier->type->array_size() == 0)
-       && var->type->is_array()
-       && (var->type->element_type() == earlier->type->element_type())) {
-      /* FINISHME: This doesn't match the qualifiers on the two
-       * FINISHME: declarations.  It's not 100% clear whether this is
-       * FINISHME: required or not.
-       */
-
-      const unsigned size = unsigned(var->type->array_size());
-      check_builtin_array_max_size(var->name, size, loc, state);
-      if ((size > 0) && (size <= earlier->max_array_access)) {
-        _mesa_glsl_error(& loc, state, "array size must be > %u due to "
-                         "previous access",
-                         earlier->max_array_access);
-      }
-
-      earlier->type = var->type;
-      delete var;
-      var = NULL;
-   } else if (state->language_version >= 130
-             && (strcmp(var->name, "gl_FrontColor") == 0
-                 || strcmp(var->name, "gl_BackColor") == 0
-                 || strcmp(var->name, "gl_FrontSecondaryColor") == 0
-                 || strcmp(var->name, "gl_BackSecondaryColor") == 0
-                 || strcmp(var->name, "gl_Color") == 0
-                 || strcmp(var->name, "gl_SecondaryColor") == 0)
-             && earlier->type == var->type
-             && earlier->mode == var->mode) {
-      earlier->interpolation = var->interpolation;
-
-      /* Layout qualifiers for gl_FragDepth. */
-   } else if ((state->AMD_conservative_depth_enable ||
-               state->ARB_conservative_depth_enable)
-             && strcmp(var->name, "gl_FragDepth") == 0
-             && earlier->type == var->type
-             && earlier->mode == var->mode) {
-
-      /** From the AMD_conservative_depth spec:
-       *     Within any shader, the first redeclarations of gl_FragDepth
-       *     must appear before any use of gl_FragDepth.
-       */
-      if (earlier->used) {
-        _mesa_glsl_error(&loc, state,
-                         "the first redeclaration of gl_FragDepth "
-                         "must appear before any use of gl_FragDepth");
-      }
-
-      /* Prevent inconsistent redeclaration of depth layout qualifier. */
-      if (earlier->depth_layout != ir_depth_layout_none
-         && earlier->depth_layout != var->depth_layout) {
-        _mesa_glsl_error(&loc, state,
-                         "gl_FragDepth: depth layout is declared here "
-                         "as '%s, but it was previously declared as "
-                         "'%s'",
-                         depth_layout_string(var->depth_layout),
-                         depth_layout_string(earlier->depth_layout));
-      }
-
-      earlier->depth_layout = var->depth_layout;
-
-   } else {
-      _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier);
-   }
-
-   return earlier;
-}
-
-/**
- * Generate the IR for an initializer in a variable declaration
- */
-ir_rvalue *
-process_initializer(ir_variable *var, ast_declaration *decl,
-                   ast_fully_specified_type *type,
-                   exec_list *initializer_instructions,
-                   struct _mesa_glsl_parse_state *state)
-{
-   ir_rvalue *result = NULL;
-
-   YYLTYPE initializer_loc = decl->initializer->get_location();
-
-   /* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
-    *
-    *    "All uniform variables are read-only and are initialized either
-    *    directly by an application via API commands, or indirectly by
-    *    OpenGL."
-    */
-   if ((state->language_version <= 110)
-       && (var->mode == ir_var_uniform)) {
-      _mesa_glsl_error(& initializer_loc, state,
-                      "cannot initialize uniforms in GLSL 1.10");
-   }
-
-   if (var->type->is_sampler()) {
-      _mesa_glsl_error(& initializer_loc, state,
-                      "cannot initialize samplers");
-   }
-
-   if ((var->mode == ir_var_in) && (state->current_function == NULL)) {
-      _mesa_glsl_error(& initializer_loc, state,
-                      "cannot initialize %s shader input / %s",
-                      _mesa_glsl_shader_target_name(state->target),
-                      (state->target == vertex_shader)
-                      ? "attribute" : "varying");
-   }
-
-   ir_dereference *const lhs = new(state) ir_dereference_variable(var);
-   ir_rvalue *rhs = decl->initializer->hir(initializer_instructions,
-                                          state);
-
-   /* Calculate the constant value if this is a const or uniform
-    * declaration.
-    */
-   if (type->qualifier.flags.q.constant
-       || type->qualifier.flags.q.uniform) {
-      ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs, true);
-      if (new_rhs != NULL) {
-        rhs = new_rhs;
-
-        ir_constant *constant_value = rhs->constant_expression_value();
-        if (!constant_value) {
-           _mesa_glsl_error(& initializer_loc, state,
-                            "initializer of %s variable `%s' must be a "
-                            "constant expression",
-                            (type->qualifier.flags.q.constant)
-                            ? "const" : "uniform",
-                            decl->identifier);
-           if (var->type->is_numeric()) {
-              /* Reduce cascading errors. */
-              var->constant_value = ir_constant::zero(state, var->type);
-           }
-        } else {
-           rhs = constant_value;
-           var->constant_value = constant_value;
-        }
-      } else {
-        _mesa_glsl_error(&initializer_loc, state,
-                         "initializer of type %s cannot be assigned to "
-                         "variable of type %s",
-                         rhs->type->name, var->type->name);
-        if (var->type->is_numeric()) {
-           /* Reduce cascading errors. */
-           var->constant_value = ir_constant::zero(state, var->type);
-        }
-      }
-   }
-
-   if (rhs && !rhs->type->is_error()) {
-      bool temp = var->read_only;
-      if (type->qualifier.flags.q.constant)
-        var->read_only = false;
-
-      /* Never emit code to initialize a uniform.
-       */
-      const glsl_type *initializer_type;
-      if (!type->qualifier.flags.q.uniform) {
-        result = do_assignment(initializer_instructions, state,
-                               NULL,
-                               lhs, rhs, true,
-                               type->get_location());
-        initializer_type = result->type;
-      } else
-        initializer_type = rhs->type;
-
-      var->constant_initializer = rhs->constant_expression_value();
-      var->has_initializer = true;
-
-      /* If the declared variable is an unsized array, it must inherrit
-       * its full type from the initializer.  A declaration such as
-       *
-       *     uniform float a[] = float[](1.0, 2.0, 3.0, 3.0);
-       *
-       * becomes
-       *
-       *     uniform float a[4] = float[](1.0, 2.0, 3.0, 3.0);
-       *
-       * The assignment generated in the if-statement (below) will also
-       * automatically handle this case for non-uniforms.
-       *
-       * If the declared variable is not an array, the types must
-       * already match exactly.  As a result, the type assignment
-       * here can be done unconditionally.  For non-uniforms the call
-       * to do_assignment can change the type of the initializer (via
-       * the implicit conversion rules).  For uniforms the initializer
-       * must be a constant expression, and the type of that expression
-       * was validated above.
-       */
-      var->type = initializer_type;
-
-      var->read_only = temp;
-   }
-
-   return result;
-}
-
-ir_rvalue *
-ast_declarator_list::hir(exec_list *instructions,
-                        struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-   const struct glsl_type *decl_type;
-   const char *type_name = NULL;
-   ir_rvalue *result = NULL;
-   YYLTYPE loc = this->get_location();
-
-   /* From page 46 (page 52 of the PDF) of the GLSL 1.50 spec:
-    *
-    *     "To ensure that a particular output variable is invariant, it is
-    *     necessary to use the invariant qualifier. It can either be used to
-    *     qualify a previously declared variable as being invariant
-    *
-    *         invariant gl_Position; // make existing gl_Position be invariant"
-    *
-    * In these cases the parser will set the 'invariant' flag in the declarator
-    * list, and the type will be NULL.
-    */
-   if (this->invariant) {
-      assert(this->type == NULL);
-
-      if (state->current_function != NULL) {
-        _mesa_glsl_error(& loc, state,
-                         "All uses of `invariant' keyword must be at global "
-                         "scope\n");
-      }
-
-      foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
-        assert(!decl->is_array);
-        assert(decl->array_size == NULL);
-        assert(decl->initializer == NULL);
-
-        ir_variable *const earlier =
-           state->symbols->get_variable(decl->identifier);
-        if (earlier == NULL) {
-           _mesa_glsl_error(& loc, state,
-                            "Undeclared variable `%s' cannot be marked "
-                            "invariant\n", decl->identifier);
-        } else if ((state->target == vertex_shader)
-              && (earlier->mode != ir_var_out)) {
-           _mesa_glsl_error(& loc, state,
-                            "`%s' cannot be marked invariant, vertex shader "
-                            "outputs only\n", decl->identifier);
-        } else if ((state->target == fragment_shader)
-              && (earlier->mode != ir_var_in)) {
-           _mesa_glsl_error(& loc, state,
-                            "`%s' cannot be marked invariant, fragment shader "
-                            "inputs only\n", decl->identifier);
-        } else if (earlier->used) {
-           _mesa_glsl_error(& loc, state,
-                            "variable `%s' may not be redeclared "
-                            "`invariant' after being used",
-                            earlier->name);
-        } else {
-           earlier->invariant = true;
-        }
-      }
-
-      /* Invariant redeclarations do not have r-values.
-       */
-      return NULL;
-   }
-
-   assert(this->type != NULL);
-   assert(!this->invariant);
-
-   /* The type specifier may contain a structure definition.  Process that
-    * before any of the variable declarations.
-    */
-   (void) this->type->specifier->hir(instructions, state);
-
-   decl_type = this->type->specifier->glsl_type(& type_name, state);
-   if (this->declarations.is_empty()) {
-      /* If there is no structure involved in the program text, there are two
-       * possible scenarios:
-       *
-       * - The program text contained something like 'vec4;'.  This is an
-       *   empty declaration.  It is valid but weird.  Emit a warning.
-       *
-       * - The program text contained something like 'S;' and 'S' is not the
-       *   name of a known structure type.  This is both invalid and weird.
-       *   Emit an error.
-       *
-       * Note that if decl_type is NULL and there is a structure involved,
-       * there must have been some sort of error with the structure.  In this
-       * case we assume that an error was already generated on this line of
-       * code for the structure.  There is no need to generate an additional,
-       * confusing error.
-       */
-      assert(this->type->specifier->structure == NULL || decl_type != NULL
-            || state->error);
-      if (this->type->specifier->structure == NULL) {
-        if (decl_type != NULL) {
-           _mesa_glsl_warning(&loc, state, "empty declaration");
-        } else {
-           _mesa_glsl_error(&loc, state,
-                            "invalid type `%s' in empty declaration",
-                            type_name);
-        }
-      }
-   }
-
-   foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
-      const struct glsl_type *var_type;
-      ir_variable *var;
-
-      /* FINISHME: Emit a warning if a variable declaration shadows a
-       * FINISHME: declaration at a higher scope.
-       */
-
-      if ((decl_type == NULL) || decl_type->is_void()) {
-        if (type_name != NULL) {
-           _mesa_glsl_error(& loc, state,
-                            "invalid type `%s' in declaration of `%s'",
-                            type_name, decl->identifier);
-        } else {
-           _mesa_glsl_error(& loc, state,
-                            "invalid type in declaration of `%s'",
-                            decl->identifier);
-        }
-        continue;
-      }
-
-      if (decl->is_array) {
-        var_type = process_array_type(&loc, decl_type, decl->array_size,
-                                      state);
-        if (var_type->is_error())
-           continue;
-      } else {
-        var_type = decl_type;
-      }
-
-      var = new(ctx) ir_variable(var_type, decl->identifier, ir_var_auto);
-
-      /* From page 22 (page 28 of the PDF) of the GLSL 1.10 specification;
-       *
-       *     "Global variables can only use the qualifiers const,
-       *     attribute, uni form, or varying. Only one may be
-       *     specified.
-       *
-       *     Local variables can only use the qualifier const."
-       *
-       * This is relaxed in GLSL 1.30.  It is also relaxed by any extension
-       * that adds the 'layout' keyword.
-       */
-      if (state->language_version < 130) {
-        if (this->type->qualifier.flags.q.out) {
-           _mesa_glsl_error(& loc, state,
-                            "`out' qualifier in declaration of `%s' "
-                            "only valid for function parameters in %s.",
-                            decl->identifier, state->version_string);
-        }
-        if (this->type->qualifier.flags.q.in) {
-           _mesa_glsl_error(& loc, state,
-                            "`in' qualifier in declaration of `%s' "
-                            "only valid for function parameters in %s.",
-                            decl->identifier, state->version_string);
-        }
-        /* FINISHME: Test for other invalid qualifiers. */
-      }
-
-      apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
-                                      & loc);
-
-      if (this->type->qualifier.flags.q.invariant) {
-        if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
-                                                  var->mode == ir_var_inout)) {
-           /* FINISHME: Note that this doesn't work for invariant on
-            * a function signature outval
-            */
-           _mesa_glsl_error(& loc, state,
-                            "`%s' cannot be marked invariant, vertex shader "
-                            "outputs only\n", var->name);
-        } else if ((state->target == fragment_shader) &&
-                   !(var->mode == ir_var_in || var->mode == ir_var_inout)) {
-           /* FINISHME: Note that this doesn't work for invariant on
-            * a function signature inval
-            */
-           _mesa_glsl_error(& loc, state,
-                            "`%s' cannot be marked invariant, fragment shader "
-                            "inputs only\n", var->name);
-        }
-      }
-
-      if (state->current_function != NULL) {
-        const char *mode = NULL;
-        const char *extra = "";
-
-        /* There is no need to check for 'inout' here because the parser will
-         * only allow that in function parameter lists.
-         */
-        if (this->type->qualifier.flags.q.attribute) {
-           mode = "attribute";
-        } else if (this->type->qualifier.flags.q.uniform) {
-           mode = "uniform";
-        } else if (this->type->qualifier.flags.q.varying) {
-           mode = "varying";
-        } else if (this->type->qualifier.flags.q.in) {
-           mode = "in";
-           extra = " or in function parameter list";
-        } else if (this->type->qualifier.flags.q.out) {
-           mode = "out";
-           extra = " or in function parameter list";
-        }
-
-        if (mode) {
-           _mesa_glsl_error(& loc, state,
-                            "%s variable `%s' must be declared at "
-                            "global scope%s",
-                            mode, var->name, extra);
-        }
-      } else if (var->mode == ir_var_in) {
-         var->read_only = true;
-
-        if (state->target == vertex_shader) {
-           bool error_emitted = false;
-
-           /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
-            *
-            *    "Vertex shader inputs can only be float, floating-point
-            *    vectors, matrices, signed and unsigned integers and integer
-            *    vectors. Vertex shader inputs can also form arrays of these
-            *    types, but not structures."
-            *
-            * From page 31 (page 27 of the PDF) of the GLSL 1.30 spec:
-            *
-            *    "Vertex shader inputs can only be float, floating-point
-            *    vectors, matrices, signed and unsigned integers and integer
-            *    vectors. They cannot be arrays or structures."
-            *
-            * From page 23 (page 29 of the PDF) of the GLSL 1.20 spec:
-            *
-            *    "The attribute qualifier can be used only with float,
-            *    floating-point vectors, and matrices. Attribute variables
-            *    cannot be declared as arrays or structures."
-            */
-           const glsl_type *check_type = var->type->is_array()
-              ? var->type->fields.array : var->type;
-
-           switch (check_type->base_type) {
-           case GLSL_TYPE_FLOAT:
-              break;
-           case GLSL_TYPE_UINT:
-           case GLSL_TYPE_INT:
-              if (state->language_version > 120)
-                 break;
-              /* FALLTHROUGH */
-           default:
-              _mesa_glsl_error(& loc, state,
-                               "vertex shader input / attribute cannot have "
-                               "type %s`%s'",
-                               var->type->is_array() ? "array of " : "",
-                               check_type->name);
-              error_emitted = true;
-           }
-
-           if (!error_emitted && (state->language_version <= 130)
-               && var->type->is_array()) {
-              _mesa_glsl_error(& loc, state,
-                               "vertex shader input / attribute cannot have "
-                               "array type");
-              error_emitted = true;
-           }
-        }
-      }
-
-      /* Integer vertex outputs must be qualified with 'flat'.
-       *
-       * From section 4.3.6 of the GLSL 1.30 spec:
-       *    "If a vertex output is a signed or unsigned integer or integer
-       *    vector, then it must be qualified with the interpolation qualifier
-       *    flat."
-       */
-      if (state->language_version >= 130
-          && state->target == vertex_shader
-          && state->current_function == NULL
-          && var->type->is_integer()
-          && var->mode == ir_var_out
-          && var->interpolation != INTERP_QUALIFIER_FLAT) {
-
-         _mesa_glsl_error(&loc, state, "If a vertex output is an integer, "
-                          "then it must be qualified with 'flat'");
-      }
-
-
-      /* Interpolation qualifiers cannot be applied to 'centroid' and
-       * 'centroid varying'.
-       *
-       * From page 29 (page 35 of the PDF) of the GLSL 1.30 spec:
-       *    "interpolation qualifiers may only precede the qualifiers in,
-       *    centroid in, out, or centroid out in a declaration. They do not apply
-       *    to the deprecated storage qualifiers varying or centroid varying."
-       */
-      if (state->language_version >= 130
-          && this->type->qualifier.has_interpolation()
-          && this->type->qualifier.flags.q.varying) {
-
-         const char *i = this->type->qualifier.interpolation_string();
-         assert(i != NULL);
-         const char *s;
-         if (this->type->qualifier.flags.q.centroid)
-            s = "centroid varying";
-         else
-            s = "varying";
-
-         _mesa_glsl_error(&loc, state,
-                          "qualifier '%s' cannot be applied to the "
-                          "deprecated storage qualifier '%s'", i, s);
-      }
-
-
-      /* Interpolation qualifiers can only apply to vertex shader outputs and
-       * fragment shader inputs.
-       *
-       * From page 29 (page 35 of the PDF) of the GLSL 1.30 spec:
-       *    "Outputs from a vertex shader (out) and inputs to a fragment
-       *    shader (in) can be further qualified with one or more of these
-       *    interpolation qualifiers"
-       */
-      if (state->language_version >= 130
-          && this->type->qualifier.has_interpolation()) {
-
-         const char *i = this->type->qualifier.interpolation_string();
-         assert(i != NULL);
-
-         switch (state->target) {
-         case vertex_shader:
-            if (this->type->qualifier.flags.q.in) {
-               _mesa_glsl_error(&loc, state,