From 29285882676388aacff123e8bdf025904abf8ea9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:32:15 -0700 Subject: glsl2: Move the compiler to the subdirectory it will live in in Mesa. --- src/glsl/.dir-locals.el | 3 + src/glsl/.gitignore | 25 + src/glsl/Makefile.am | 79 + src/glsl/TODO | 84 + src/glsl/ast.h | 651 +++ src/glsl/ast_expr.cpp | 96 + src/glsl/ast_function.cpp | 751 +++ src/glsl/ast_to_hir.cpp | 2453 ++++++++++ src/glsl/ast_type.cpp | 110 + src/glsl/autogen.sh | 12 + src/glsl/builtin_function.cpp | 5080 ++++++++++++++++++++ src/glsl/builtin_types.h | 268 ++ src/glsl/builtin_variables.h | 93 + src/glsl/builtins/110/abs | 21 + src/glsl/builtins/110/all | 16 + src/glsl/builtins/110/any | 16 + src/glsl/builtins/110/asin | 112 + src/glsl/builtins/110/atan | 154 + src/glsl/builtins/110/ceil | 21 + src/glsl/builtins/110/clamp | 62 + src/glsl/builtins/110/cos | 21 + src/glsl/builtins/110/cross | 17 + src/glsl/builtins/110/degrees | 21 + src/glsl/builtins/110/distance | 33 + src/glsl/builtins/110/dot | 25 + src/glsl/builtins/110/equal | 61 + src/glsl/builtins/110/exp | 21 + src/glsl/builtins/110/exp2 | 21 + src/glsl/builtins/110/faceforward | 37 + src/glsl/builtins/110/floor | 21 + src/glsl/builtins/110/fract | 34 + src/glsl/builtins/110/greaterThan | 61 + src/glsl/builtins/110/greaterThanEqual | 61 + src/glsl/builtins/110/inversesqrt | 21 + src/glsl/builtins/110/length | 21 + src/glsl/builtins/110/lessThan | 61 + src/glsl/builtins/110/lessThanEqual | 61 + src/glsl/builtins/110/log | 21 + src/glsl/builtins/110/log2 | 21 + src/glsl/builtins/110/matrixCompMult | 32 + src/glsl/builtins/110/max | 64 + src/glsl/builtins/110/min | 64 + src/glsl/builtins/110/mix | 50 + src/glsl/builtins/110/mod | 64 + src/glsl/builtins/110/noise_fake | 76 + src/glsl/builtins/110/normalize | 21 + src/glsl/builtins/110/not | 16 + src/glsl/builtins/110/notEqual | 61 + src/glsl/builtins/110/pow | 25 + src/glsl/builtins/110/radians | 21 + src/glsl/builtins/110/reflect | 58 + src/glsl/builtins/110/refract | 102 + src/glsl/builtins/110/sign | 34 + src/glsl/builtins/110/sin | 21 + src/glsl/builtins/110/smoothstep | 224 + src/glsl/builtins/110/sqrt | 21 + src/glsl/builtins/110/step | 68 + src/glsl/builtins/110/tan | 21 + src/glsl/builtins/110/textures | 213 + src/glsl/builtins/110_fs/derivatives | 73 + src/glsl/builtins/110_fs/textures | 113 + src/glsl/builtins/110_vs/ftransform | 7 + src/glsl/builtins/120/matrixCompMult | 61 + src/glsl/builtins/120/outerProduct | 92 + src/glsl/builtins/120/transpose | 139 + src/glsl/builtins/130/clamp | 123 + src/glsl/builtins/130/cosh | 30 + src/glsl/builtins/130/equal | 31 + src/glsl/builtins/130/greaterThan | 31 + src/glsl/builtins/130/greaterThanEqual | 31 + src/glsl/builtins/130/lessThan | 31 + src/glsl/builtins/130/lessThanEqual | 31 + src/glsl/builtins/130/max | 127 + src/glsl/builtins/130/min | 127 + src/glsl/builtins/130/notEqual | 31 + src/glsl/builtins/130/sign | 34 + src/glsl/builtins/130/sinh | 30 + src/glsl/builtins/130/tanh | 42 + src/glsl/builtins/130/texelFetch | 107 + src/glsl/builtins/130/texture | 110 + src/glsl/builtins/130/textureGrad | 147 + src/glsl/builtins/130/textureLod | 128 + src/glsl/builtins/130/textureProj | 92 + src/glsl/builtins/130/textureProjGrad | 122 + src/glsl/builtins/130/textureProjLod | 107 + src/glsl/builtins/130_fs/texture | 128 + src/glsl/builtins/130_fs/textureProj | 107 + src/glsl/builtins/ARB_texture_rectangle/textures | 16 + src/glsl/builtins/EXT_texture_array/textures | 59 + src/glsl/builtins/EXT_texture_array_fs/textures | 27 + src/glsl/builtins/tools/generate_builtins.pl | 123 + .../builtins/tools/generate_matrixCompMultGLSL.py | 28 + .../builtins/tools/generate_outerProductGLSL.py | 23 + src/glsl/builtins/tools/generate_transposeGLSL.py | 28 + src/glsl/builtins/tools/texture_builtins.py | 298 ++ src/glsl/configure.ac | 69 + src/glsl/glcpp/.gitignore | 11 + src/glsl/glcpp/Makefile.am | 46 + src/glsl/glcpp/README | 30 + src/glsl/glcpp/glcpp-lex.l | 257 + src/glsl/glcpp/glcpp-parse.y | 1611 +++++++ src/glsl/glcpp/glcpp.c | 88 + src/glsl/glcpp/glcpp.h | 224 + src/glsl/glcpp/hash_table.c | 159 + src/glsl/glcpp/hash_table.h | 125 + src/glsl/glcpp/main/imports.h | 6 + src/glsl/glcpp/main/simple_list.h | 235 + src/glsl/glcpp/pp.c | 155 + src/glsl/glcpp/tests/000-content-with-spaces.c | 1 + .../glcpp/tests/000-content-with-spaces.c.expected | 2 + src/glsl/glcpp/tests/001-define.c | 2 + src/glsl/glcpp/tests/001-define.c.expected | 3 + src/glsl/glcpp/tests/002-define-chain.c | 3 + src/glsl/glcpp/tests/002-define-chain.c.expected | 4 + src/glsl/glcpp/tests/003-define-chain-reverse.c | 3 + .../tests/003-define-chain-reverse.c.expected | 4 + src/glsl/glcpp/tests/004-define-recursive.c | 6 + .../glcpp/tests/004-define-recursive.c.expected | 7 + src/glsl/glcpp/tests/005-define-composite-chain.c | 3 + .../tests/005-define-composite-chain.c.expected | 4 + .../tests/006-define-composite-chain-reverse.c | 3 + .../006-define-composite-chain-reverse.c.expected | 4 + .../glcpp/tests/007-define-composite-recursive.c | 6 + .../007-define-composite-recursive.c.expected | 7 + src/glsl/glcpp/tests/008-define-empty.c | 2 + src/glsl/glcpp/tests/008-define-empty.c.expected | 3 + src/glsl/glcpp/tests/009-undef.c | 4 + src/glsl/glcpp/tests/009-undef.c.expected | 5 + src/glsl/glcpp/tests/010-undef-re-define.c | 6 + .../glcpp/tests/010-undef-re-define.c.expected | 7 + src/glsl/glcpp/tests/011-define-func-empty.c | 2 + .../glcpp/tests/011-define-func-empty.c.expected | 3 + src/glsl/glcpp/tests/012-define-func-no-args.c | 2 + .../glcpp/tests/012-define-func-no-args.c.expected | 3 + .../glcpp/tests/013-define-func-1-arg-unused.c | 2 + .../tests/013-define-func-1-arg-unused.c.expected | 3 + .../glcpp/tests/014-define-func-2-arg-unused.c | 2 + .../tests/014-define-func-2-arg-unused.c.expected | 3 + .../glcpp/tests/015-define-object-with-parens.c | 4 + .../tests/015-define-object-with-parens.c.expected | 5 + src/glsl/glcpp/tests/016-define-func-1-arg.c | 2 + .../glcpp/tests/016-define-func-1-arg.c.expected | 3 + src/glsl/glcpp/tests/017-define-func-2-args.c | 2 + .../glcpp/tests/017-define-func-2-args.c.expected | 3 + .../tests/018-define-func-macro-as-parameter.c | 3 + .../018-define-func-macro-as-parameter.c.expected | 4 + src/glsl/glcpp/tests/019-define-func-1-arg-multi.c | 2 + .../tests/019-define-func-1-arg-multi.c.expected | 3 + src/glsl/glcpp/tests/020-define-func-2-arg-multi.c | 2 + .../tests/020-define-func-2-arg-multi.c.expected | 3 + src/glsl/glcpp/tests/021-define-func-compose.c | 3 + .../glcpp/tests/021-define-func-compose.c.expected | 4 + .../glcpp/tests/022-define-func-arg-with-parens.c | 2 + .../022-define-func-arg-with-parens.c.expected | 3 + src/glsl/glcpp/tests/023-define-extra-whitespace.c | 8 + .../tests/023-define-extra-whitespace.c.expected | 9 + .../tests/024-define-chain-to-self-recursion.c | 3 + .../024-define-chain-to-self-recursion.c.expected | 4 + src/glsl/glcpp/tests/025-func-macro-as-non-macro.c | 2 + .../tests/025-func-macro-as-non-macro.c.expected | 3 + .../glcpp/tests/026-define-func-extra-newlines.c | 6 + .../026-define-func-extra-newlines.c.expected | 4 + .../glcpp/tests/027-define-chain-obj-to-func.c | 3 + .../tests/027-define-chain-obj-to-func.c.expected | 4 + .../glcpp/tests/028-define-chain-obj-to-non-func.c | 3 + .../028-define-chain-obj-to-non-func.c.expected | 4 + .../tests/029-define-chain-obj-to-func-with-args.c | 3 + ...9-define-chain-obj-to-func-with-args.c.expected | 4 + .../tests/030-define-chain-obj-to-func-compose.c | 4 + ...030-define-chain-obj-to-func-compose.c.expected | 5 + .../tests/031-define-chain-func-to-func-compose.c | 4 + ...31-define-chain-func-to-func-compose.c.expected | 5 + .../glcpp/tests/032-define-func-self-recurse.c | 2 + .../tests/032-define-func-self-recurse.c.expected | 3 + .../glcpp/tests/033-define-func-self-compose.c | 2 + .../tests/033-define-func-self-compose.c.expected | 3 + .../tests/034-define-func-self-compose-non-func.c | 2 + ...34-define-func-self-compose-non-func.c.expected | 3 + ...nc-self-compose-non-func-multi-token-argument.c | 2 + ...ompose-non-func-multi-token-argument.c.expected | 3 + ...36-define-func-non-macro-multi-token-argument.c | 3 + ...-func-non-macro-multi-token-argument.c.expected | 4 + .../glcpp/tests/037-finalize-unexpanded-macro.c | 3 + .../tests/037-finalize-unexpanded-macro.c.expected | 4 + src/glsl/glcpp/tests/038-func-arg-with-commas.c | 2 + .../tests/038-func-arg-with-commas.c.expected | 3 + .../tests/039-func-arg-obj-macro-with-comma.c | 3 + .../039-func-arg-obj-macro-with-comma.c.expected | 4 + src/glsl/glcpp/tests/040-token-pasting.c | 2 + src/glsl/glcpp/tests/040-token-pasting.c.expected | 3 + src/glsl/glcpp/tests/041-if-0.c | 5 + src/glsl/glcpp/tests/041-if-0.c.expected | 6 + src/glsl/glcpp/tests/042-if-1.c | 5 + src/glsl/glcpp/tests/042-if-1.c.expected | 6 + src/glsl/glcpp/tests/043-if-0-else.c | 7 + src/glsl/glcpp/tests/043-if-0-else.c.expected | 8 + src/glsl/glcpp/tests/044-if-1-else.c | 7 + src/glsl/glcpp/tests/044-if-1-else.c.expected | 8 + src/glsl/glcpp/tests/045-if-0-elif.c | 11 + src/glsl/glcpp/tests/045-if-0-elif.c.expected | 12 + src/glsl/glcpp/tests/046-if-1-elsif.c | 11 + src/glsl/glcpp/tests/046-if-1-elsif.c.expected | 12 + src/glsl/glcpp/tests/047-if-elif-else.c | 11 + src/glsl/glcpp/tests/047-if-elif-else.c.expected | 12 + src/glsl/glcpp/tests/048-if-nested.c | 11 + src/glsl/glcpp/tests/048-if-nested.c.expected | 12 + .../glcpp/tests/049-if-expression-precedence.c | 5 + .../tests/049-if-expression-precedence.c.expected | 6 + src/glsl/glcpp/tests/050-if-defined.c | 17 + src/glsl/glcpp/tests/050-if-defined.c.expected | 18 + src/glsl/glcpp/tests/051-if-relational.c | 35 + src/glsl/glcpp/tests/051-if-relational.c.expected | 36 + src/glsl/glcpp/tests/052-if-bitwise.c | 20 + src/glsl/glcpp/tests/052-if-bitwise.c.expected | 21 + src/glsl/glcpp/tests/053-if-divide-and-shift.c | 15 + .../glcpp/tests/053-if-divide-and-shift.c.expected | 16 + src/glsl/glcpp/tests/054-if-with-macros.c | 34 + src/glsl/glcpp/tests/054-if-with-macros.c.expected | 35 + .../055-define-chain-obj-to-func-parens-in-text.c | 3 + ...ine-chain-obj-to-func-parens-in-text.c.expected | 4 + .../glcpp/tests/056-macro-argument-with-comma.c | 4 + .../tests/056-macro-argument-with-comma.c.expected | 5 + src/glsl/glcpp/tests/057-empty-arguments.c | 6 + .../glcpp/tests/057-empty-arguments.c.expected | 7 + .../tests/058-token-pasting-empty-arguments.c | 5 + .../058-token-pasting-empty-arguments.c.expected | 6 + src/glsl/glcpp/tests/059-token-pasting-integer.c | 4 + .../tests/059-token-pasting-integer.c.expected | 5 + .../060-left-paren-in-macro-right-paren-in-text.c | 3 + ...t-paren-in-macro-right-paren-in-text.c.expected | 4 + .../tests/061-define-chain-obj-to-func-multi.c | 5 + .../061-define-chain-obj-to-func-multi.c.expected | 6 + src/glsl/glcpp/tests/062-if-0-skips-garbage.c | 5 + .../glcpp/tests/062-if-0-skips-garbage.c.expected | 6 + src/glsl/glcpp/tests/063-comments.c | 20 + src/glsl/glcpp/tests/063-comments.c.expected | 14 + src/glsl/glcpp/tests/064-version.c | 2 + src/glsl/glcpp/tests/064-version.c.expected | 3 + src/glsl/glcpp/tests/065-if-defined-parens.c | 17 + .../glcpp/tests/065-if-defined-parens.c.expected | 18 + src/glsl/glcpp/tests/071-punctuator.c | 1 + src/glsl/glcpp/tests/071-punctuator.c.expected | 2 + src/glsl/glcpp/tests/072-token-pasting-same-line.c | 2 + .../tests/072-token-pasting-same-line.c.expected | 3 + src/glsl/glcpp/tests/099-c99-example.c | 17 + src/glsl/glcpp/tests/099-c99-example.c.expected | 17 + src/glsl/glcpp/tests/glcpp-test | 7 + src/glsl/glcpp/xtalloc.c | 99 + src/glsl/glsl_lexer.lpp | 336 ++ src/glsl/glsl_parser.ypp | 1444 ++++++ src/glsl/glsl_parser_extras.cpp | 621 +++ src/glsl/glsl_parser_extras.h | 139 + src/glsl/glsl_symbol_table.h | 163 + src/glsl/glsl_types.cpp | 773 +++ src/glsl/glsl_types.h | 445 ++ src/glsl/hash_table.c | 159 + src/glsl/hash_table.h | 125 + src/glsl/hir_field_selection.cpp | 81 + src/glsl/ir.cpp | 818 ++++ src/glsl/ir.h | 1178 +++++ src/glsl/ir_basic_block.cpp | 144 + src/glsl/ir_basic_block.h | 28 + src/glsl/ir_clone.cpp | 287 ++ src/glsl/ir_constant_expression.cpp | 671 +++ src/glsl/ir_constant_folding.cpp | 229 + src/glsl/ir_constant_variable.cpp | 156 + src/glsl/ir_copy_propagation.cpp | 256 + src/glsl/ir_dead_code.cpp | 219 + src/glsl/ir_dead_code_local.cpp | 223 + src/glsl/ir_expression_flattening.cpp | 172 + src/glsl/ir_expression_flattening.h | 38 + src/glsl/ir_function.cpp | 225 + src/glsl/ir_function_can_inline.cpp | 71 + src/glsl/ir_function_inlining.cpp | 272 ++ src/glsl/ir_function_inlining.h | 30 + src/glsl/ir_hierarchical_visitor.cpp | 284 ++ src/glsl/ir_hierarchical_visitor.h | 162 + src/glsl/ir_hv_accept.cpp | 348 ++ src/glsl/ir_if_simplification.cpp | 84 + src/glsl/ir_optimization.h | 41 + src/glsl/ir_print_visitor.cpp | 373 ++ src/glsl/ir_print_visitor.h | 81 + src/glsl/ir_reader.cpp | 1053 ++++ src/glsl/ir_reader.h | 34 + src/glsl/ir_swizzle_swizzle.cpp | 93 + src/glsl/ir_to_mesa.cpp | 1211 +++++ src/glsl/ir_validate.cpp | 104 + src/glsl/ir_variable.cpp | 345 ++ src/glsl/ir_vec_index_to_swizzle.cpp | 158 + src/glsl/ir_visitor.h | 66 + src/glsl/linker.cpp | 871 ++++ src/glsl/list.h | 403 ++ src/glsl/main.cpp | 256 + src/glsl/main/imports.h | 6 + src/glsl/main/mtypes.h | 270 ++ src/glsl/main/simple_list.h | 235 + src/glsl/mesa/shader/prog_instruction.c | 363 ++ src/glsl/mesa/shader/prog_instruction.h | 437 ++ src/glsl/mesa/shader/prog_print.c | 1089 +++++ src/glsl/mesa/shader/prog_print.h | 98 + src/glsl/program.h | 155 + src/glsl/s_expression.cpp | 131 + src/glsl/s_expression.h | 142 + src/glsl/symbol_table.c | 413 ++ src/glsl/symbol_table.h | 66 + src/glsl/tests/array-01.glsl | 3 + src/glsl/tests/array-02.glsl | 3 + src/glsl/tests/array-03.glsl | 3 + src/glsl/tests/array-04.glsl | 2 + src/glsl/tests/array-05.glsl | 2 + src/glsl/tests/array-06.glsl | 2 + src/glsl/tests/array-07.glsl | 2 + src/glsl/tests/array-08.glsl | 2 + src/glsl/tests/array-09.glsl | 9 + src/glsl/tests/array-10.glsl | 11 + src/glsl/tests/array-11.glsl | 9 + src/glsl/tests/array-12.glsl | 11 + src/glsl/tests/array-13.glsl | 11 + src/glsl/tests/attribute-01.glsl | 7 + src/glsl/tests/attribute-02.glsl | 7 + src/glsl/tests/attribute-03.glsl | 7 + src/glsl/tests/attribute-04.glsl | 7 + src/glsl/tests/attribute-05.glsl | 7 + src/glsl/tests/attribute-06.glsl | 7 + src/glsl/tests/attribute-07.glsl | 7 + src/glsl/tests/attribute-08.glsl | 7 + src/glsl/tests/attribute-09.glsl | 7 + src/glsl/tests/attribute-10.glsl | 8 + src/glsl/tests/attribute-11.glsl | 8 + src/glsl/tests/condition-01.glsl | 8 + src/glsl/tests/condition-02.glsl | 8 + src/glsl/tests/condition-03.glsl | 8 + src/glsl/tests/condition-04.glsl | 8 + src/glsl/tests/condition-05.glsl | 13 + src/glsl/tests/constructor-01.glsl | 6 + src/glsl/tests/constructor-02.glsl | 7 + src/glsl/tests/constructor-03.glsl | 12 + src/glsl/tests/constructor-04.glsl | 14 + src/glsl/tests/constructor-05.glsl | 13 + src/glsl/tests/constructor-06.glsl | 13 + src/glsl/tests/constructor-07.glsl | 13 + src/glsl/tests/constructor-08.glsl | 13 + src/glsl/tests/constructor-09.glsl | 26 + src/glsl/tests/function-01.glsl | 16 + src/glsl/tests/function-02.glsl | 16 + src/glsl/tests/function-03.glsl | 16 + src/glsl/tests/function-04.glsl | 15 + src/glsl/tests/function-05.glsl | 26 + src/glsl/tests/if-01.glsl | 11 + src/glsl/tests/if-02.glsl | 11 + src/glsl/tests/if-03.glsl | 11 + src/glsl/tests/if-04.glsl | 11 + src/glsl/tests/matrix-01.glsl | 6 + src/glsl/tests/matrix-02.glsl | 6 + src/glsl/tests/matrix-03.glsl | 6 + src/glsl/tests/matrix-04.glsl | 6 + src/glsl/tests/matrix-05.glsl | 6 + src/glsl/tests/matrix-06.glsl | 6 + src/glsl/tests/matrix-07.glsl | 27 + src/glsl/tests/matrix-08.glsl | 19 + src/glsl/tests/matrix-09.glsl | 11 + src/glsl/tests/matrix-10.glsl | 12 + src/glsl/tests/parameters-01.glsl | 11 + src/glsl/tests/parameters-02.glsl | 11 + src/glsl/tests/parameters-03.glsl | 9 + src/glsl/tests/qualifier-01.glsl | 3 + src/glsl/tests/qualifier-02.glsl | 2 + src/glsl/tests/qualifier-03.glsl | 2 + src/glsl/tests/qualifier-04.glsl | 3 + src/glsl/tests/qualifier-05.glsl | 3 + src/glsl/tests/qualifier-06.glsl | 7 + src/glsl/tests/qualifier-07.glsl | 7 + src/glsl/tests/swiz-01.glsl | 11 + src/glsl/tests/swiz-02.glsl | 11 + src/glsl/tests/void-01.glsl | 2 + 375 files changed, 38147 insertions(+) create mode 100644 src/glsl/.dir-locals.el create mode 100644 src/glsl/.gitignore create mode 100644 src/glsl/Makefile.am create mode 100644 src/glsl/TODO create mode 100644 src/glsl/ast.h create mode 100644 src/glsl/ast_expr.cpp create mode 100644 src/glsl/ast_function.cpp create mode 100644 src/glsl/ast_to_hir.cpp create mode 100644 src/glsl/ast_type.cpp create mode 100755 src/glsl/autogen.sh create mode 100644 src/glsl/builtin_function.cpp create mode 100644 src/glsl/builtin_types.h create mode 100644 src/glsl/builtin_variables.h create mode 100644 src/glsl/builtins/110/abs create mode 100644 src/glsl/builtins/110/all create mode 100644 src/glsl/builtins/110/any create mode 100644 src/glsl/builtins/110/asin create mode 100644 src/glsl/builtins/110/atan create mode 100644 src/glsl/builtins/110/ceil create mode 100644 src/glsl/builtins/110/clamp create mode 100644 src/glsl/builtins/110/cos create mode 100644 src/glsl/builtins/110/cross create mode 100644 src/glsl/builtins/110/degrees create mode 100644 src/glsl/builtins/110/distance create mode 100644 src/glsl/builtins/110/dot create mode 100644 src/glsl/builtins/110/equal create mode 100644 src/glsl/builtins/110/exp create mode 100644 src/glsl/builtins/110/exp2 create mode 100644 src/glsl/builtins/110/faceforward create mode 100644 src/glsl/builtins/110/floor create mode 100644 src/glsl/builtins/110/fract create mode 100644 src/glsl/builtins/110/greaterThan create mode 100644 src/glsl/builtins/110/greaterThanEqual create mode 100644 src/glsl/builtins/110/inversesqrt create mode 100644 src/glsl/builtins/110/length create mode 100644 src/glsl/builtins/110/lessThan create mode 100644 src/glsl/builtins/110/lessThanEqual create mode 100644 src/glsl/builtins/110/log create mode 100644 src/glsl/builtins/110/log2 create mode 100644 src/glsl/builtins/110/matrixCompMult create mode 100644 src/glsl/builtins/110/max create mode 100644 src/glsl/builtins/110/min create mode 100644 src/glsl/builtins/110/mix create mode 100644 src/glsl/builtins/110/mod create mode 100644 src/glsl/builtins/110/noise_fake create mode 100644 src/glsl/builtins/110/normalize create mode 100644 src/glsl/builtins/110/not create mode 100644 src/glsl/builtins/110/notEqual create mode 100644 src/glsl/builtins/110/pow create mode 100644 src/glsl/builtins/110/radians create mode 100644 src/glsl/builtins/110/reflect create mode 100644 src/glsl/builtins/110/refract create mode 100644 src/glsl/builtins/110/sign create mode 100644 src/glsl/builtins/110/sin create mode 100644 src/glsl/builtins/110/smoothstep create mode 100644 src/glsl/builtins/110/sqrt create mode 100644 src/glsl/builtins/110/step create mode 100644 src/glsl/builtins/110/tan create mode 100644 src/glsl/builtins/110/textures create mode 100644 src/glsl/builtins/110_fs/derivatives create mode 100644 src/glsl/builtins/110_fs/textures create mode 100644 src/glsl/builtins/110_vs/ftransform create mode 100644 src/glsl/builtins/120/matrixCompMult create mode 100644 src/glsl/builtins/120/outerProduct create mode 100644 src/glsl/builtins/120/transpose create mode 100644 src/glsl/builtins/130/clamp create mode 100644 src/glsl/builtins/130/cosh create mode 100644 src/glsl/builtins/130/equal create mode 100644 src/glsl/builtins/130/greaterThan create mode 100644 src/glsl/builtins/130/greaterThanEqual create mode 100644 src/glsl/builtins/130/lessThan create mode 100644 src/glsl/builtins/130/lessThanEqual create mode 100644 src/glsl/builtins/130/max create mode 100644 src/glsl/builtins/130/min create mode 100644 src/glsl/builtins/130/notEqual create mode 100644 src/glsl/builtins/130/sign create mode 100644 src/glsl/builtins/130/sinh create mode 100644 src/glsl/builtins/130/tanh create mode 100644 src/glsl/builtins/130/texelFetch create mode 100644 src/glsl/builtins/130/texture create mode 100644 src/glsl/builtins/130/textureGrad create mode 100644 src/glsl/builtins/130/textureLod create mode 100644 src/glsl/builtins/130/textureProj create mode 100644 src/glsl/builtins/130/textureProjGrad create mode 100644 src/glsl/builtins/130/textureProjLod create mode 100644 src/glsl/builtins/130_fs/texture create mode 100644 src/glsl/builtins/130_fs/textureProj create mode 100644 src/glsl/builtins/ARB_texture_rectangle/textures create mode 100644 src/glsl/builtins/EXT_texture_array/textures create mode 100644 src/glsl/builtins/EXT_texture_array_fs/textures create mode 100755 src/glsl/builtins/tools/generate_builtins.pl create mode 100755 src/glsl/builtins/tools/generate_matrixCompMultGLSL.py create mode 100755 src/glsl/builtins/tools/generate_outerProductGLSL.py create mode 100755 src/glsl/builtins/tools/generate_transposeGLSL.py create mode 100755 src/glsl/builtins/tools/texture_builtins.py create mode 100644 src/glsl/configure.ac create mode 100644 src/glsl/glcpp/.gitignore create mode 100644 src/glsl/glcpp/Makefile.am create mode 100644 src/glsl/glcpp/README create mode 100644 src/glsl/glcpp/glcpp-lex.l create mode 100644 src/glsl/glcpp/glcpp-parse.y create mode 100644 src/glsl/glcpp/glcpp.c create mode 100644 src/glsl/glcpp/glcpp.h create mode 100644 src/glsl/glcpp/hash_table.c create mode 100644 src/glsl/glcpp/hash_table.h create mode 100644 src/glsl/glcpp/main/imports.h create mode 100644 src/glsl/glcpp/main/simple_list.h create mode 100644 src/glsl/glcpp/pp.c create mode 100644 src/glsl/glcpp/tests/000-content-with-spaces.c create mode 100644 src/glsl/glcpp/tests/000-content-with-spaces.c.expected create mode 100644 src/glsl/glcpp/tests/001-define.c create mode 100644 src/glsl/glcpp/tests/001-define.c.expected create mode 100644 src/glsl/glcpp/tests/002-define-chain.c create mode 100644 src/glsl/glcpp/tests/002-define-chain.c.expected create mode 100644 src/glsl/glcpp/tests/003-define-chain-reverse.c create mode 100644 src/glsl/glcpp/tests/003-define-chain-reverse.c.expected create mode 100644 src/glsl/glcpp/tests/004-define-recursive.c create mode 100644 src/glsl/glcpp/tests/004-define-recursive.c.expected create mode 100644 src/glsl/glcpp/tests/005-define-composite-chain.c create mode 100644 src/glsl/glcpp/tests/005-define-composite-chain.c.expected create mode 100644 src/glsl/glcpp/tests/006-define-composite-chain-reverse.c create mode 100644 src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected create mode 100644 src/glsl/glcpp/tests/007-define-composite-recursive.c create mode 100644 src/glsl/glcpp/tests/007-define-composite-recursive.c.expected create mode 100644 src/glsl/glcpp/tests/008-define-empty.c create mode 100644 src/glsl/glcpp/tests/008-define-empty.c.expected create mode 100644 src/glsl/glcpp/tests/009-undef.c create mode 100644 src/glsl/glcpp/tests/009-undef.c.expected create mode 100644 src/glsl/glcpp/tests/010-undef-re-define.c create mode 100644 src/glsl/glcpp/tests/010-undef-re-define.c.expected create mode 100644 src/glsl/glcpp/tests/011-define-func-empty.c create mode 100644 src/glsl/glcpp/tests/011-define-func-empty.c.expected create mode 100644 src/glsl/glcpp/tests/012-define-func-no-args.c create mode 100644 src/glsl/glcpp/tests/012-define-func-no-args.c.expected create mode 100644 src/glsl/glcpp/tests/013-define-func-1-arg-unused.c create mode 100644 src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected create mode 100644 src/glsl/glcpp/tests/014-define-func-2-arg-unused.c create mode 100644 src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected create mode 100644 src/glsl/glcpp/tests/015-define-object-with-parens.c create mode 100644 src/glsl/glcpp/tests/015-define-object-with-parens.c.expected create mode 100644 src/glsl/glcpp/tests/016-define-func-1-arg.c create mode 100644 src/glsl/glcpp/tests/016-define-func-1-arg.c.expected create mode 100644 src/glsl/glcpp/tests/017-define-func-2-args.c create mode 100644 src/glsl/glcpp/tests/017-define-func-2-args.c.expected create mode 100644 src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c create mode 100644 src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected create mode 100644 src/glsl/glcpp/tests/019-define-func-1-arg-multi.c create mode 100644 src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected create mode 100644 src/glsl/glcpp/tests/020-define-func-2-arg-multi.c create mode 100644 src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected create mode 100644 src/glsl/glcpp/tests/021-define-func-compose.c create mode 100644 src/glsl/glcpp/tests/021-define-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/022-define-func-arg-with-parens.c create mode 100644 src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected create mode 100644 src/glsl/glcpp/tests/023-define-extra-whitespace.c create mode 100644 src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected create mode 100644 src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c create mode 100644 src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected create mode 100644 src/glsl/glcpp/tests/025-func-macro-as-non-macro.c create mode 100644 src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected create mode 100644 src/glsl/glcpp/tests/026-define-func-extra-newlines.c create mode 100644 src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected create mode 100644 src/glsl/glcpp/tests/027-define-chain-obj-to-func.c create mode 100644 src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected create mode 100644 src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c create mode 100644 src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected create mode 100644 src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c create mode 100644 src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected create mode 100644 src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c create mode 100644 src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c create mode 100644 src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected create mode 100644 src/glsl/glcpp/tests/032-define-func-self-recurse.c create mode 100644 src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected create mode 100644 src/glsl/glcpp/tests/033-define-func-self-compose.c create mode 100644 src/glsl/glcpp/tests/033-define-func-self-compose.c.expected create mode 100644 src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c create mode 100644 src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected create mode 100644 src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c create mode 100644 src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected create mode 100644 src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c create mode 100644 src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected create mode 100644 src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c create mode 100644 src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected create mode 100644 src/glsl/glcpp/tests/038-func-arg-with-commas.c create mode 100644 src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected create mode 100644 src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c create mode 100644 src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected create mode 100644 src/glsl/glcpp/tests/040-token-pasting.c create mode 100644 src/glsl/glcpp/tests/040-token-pasting.c.expected create mode 100644 src/glsl/glcpp/tests/041-if-0.c create mode 100644 src/glsl/glcpp/tests/041-if-0.c.expected create mode 100644 src/glsl/glcpp/tests/042-if-1.c create mode 100644 src/glsl/glcpp/tests/042-if-1.c.expected create mode 100644 src/glsl/glcpp/tests/043-if-0-else.c create mode 100644 src/glsl/glcpp/tests/043-if-0-else.c.expected create mode 100644 src/glsl/glcpp/tests/044-if-1-else.c create mode 100644 src/glsl/glcpp/tests/044-if-1-else.c.expected create mode 100644 src/glsl/glcpp/tests/045-if-0-elif.c create mode 100644 src/glsl/glcpp/tests/045-if-0-elif.c.expected create mode 100644 src/glsl/glcpp/tests/046-if-1-elsif.c create mode 100644 src/glsl/glcpp/tests/046-if-1-elsif.c.expected create mode 100644 src/glsl/glcpp/tests/047-if-elif-else.c create mode 100644 src/glsl/glcpp/tests/047-if-elif-else.c.expected create mode 100644 src/glsl/glcpp/tests/048-if-nested.c create mode 100644 src/glsl/glcpp/tests/048-if-nested.c.expected create mode 100644 src/glsl/glcpp/tests/049-if-expression-precedence.c create mode 100644 src/glsl/glcpp/tests/049-if-expression-precedence.c.expected create mode 100644 src/glsl/glcpp/tests/050-if-defined.c create mode 100644 src/glsl/glcpp/tests/050-if-defined.c.expected create mode 100644 src/glsl/glcpp/tests/051-if-relational.c create mode 100644 src/glsl/glcpp/tests/051-if-relational.c.expected create mode 100644 src/glsl/glcpp/tests/052-if-bitwise.c create mode 100644 src/glsl/glcpp/tests/052-if-bitwise.c.expected create mode 100644 src/glsl/glcpp/tests/053-if-divide-and-shift.c create mode 100644 src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected create mode 100644 src/glsl/glcpp/tests/054-if-with-macros.c create mode 100644 src/glsl/glcpp/tests/054-if-with-macros.c.expected create mode 100644 src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c create mode 100644 src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected create mode 100644 src/glsl/glcpp/tests/056-macro-argument-with-comma.c create mode 100644 src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected create mode 100644 src/glsl/glcpp/tests/057-empty-arguments.c create mode 100644 src/glsl/glcpp/tests/057-empty-arguments.c.expected create mode 100644 src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c create mode 100644 src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected create mode 100644 src/glsl/glcpp/tests/059-token-pasting-integer.c create mode 100644 src/glsl/glcpp/tests/059-token-pasting-integer.c.expected create mode 100644 src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c create mode 100644 src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected create mode 100644 src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c create mode 100644 src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected create mode 100644 src/glsl/glcpp/tests/062-if-0-skips-garbage.c create mode 100644 src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected create mode 100644 src/glsl/glcpp/tests/063-comments.c create mode 100644 src/glsl/glcpp/tests/063-comments.c.expected create mode 100644 src/glsl/glcpp/tests/064-version.c create mode 100644 src/glsl/glcpp/tests/064-version.c.expected create mode 100644 src/glsl/glcpp/tests/065-if-defined-parens.c create mode 100644 src/glsl/glcpp/tests/065-if-defined-parens.c.expected create mode 100644 src/glsl/glcpp/tests/071-punctuator.c create mode 100644 src/glsl/glcpp/tests/071-punctuator.c.expected create mode 100644 src/glsl/glcpp/tests/072-token-pasting-same-line.c create mode 100644 src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected create mode 100644 src/glsl/glcpp/tests/099-c99-example.c create mode 100644 src/glsl/glcpp/tests/099-c99-example.c.expected create mode 100755 src/glsl/glcpp/tests/glcpp-test create mode 100644 src/glsl/glcpp/xtalloc.c create mode 100644 src/glsl/glsl_lexer.lpp create mode 100644 src/glsl/glsl_parser.ypp create mode 100644 src/glsl/glsl_parser_extras.cpp create mode 100644 src/glsl/glsl_parser_extras.h create mode 100644 src/glsl/glsl_symbol_table.h create mode 100644 src/glsl/glsl_types.cpp create mode 100644 src/glsl/glsl_types.h create mode 100644 src/glsl/hash_table.c create mode 100644 src/glsl/hash_table.h create mode 100644 src/glsl/hir_field_selection.cpp create mode 100644 src/glsl/ir.cpp create mode 100644 src/glsl/ir.h create mode 100644 src/glsl/ir_basic_block.cpp create mode 100644 src/glsl/ir_basic_block.h create mode 100644 src/glsl/ir_clone.cpp create mode 100644 src/glsl/ir_constant_expression.cpp create mode 100644 src/glsl/ir_constant_folding.cpp create mode 100644 src/glsl/ir_constant_variable.cpp create mode 100644 src/glsl/ir_copy_propagation.cpp create mode 100644 src/glsl/ir_dead_code.cpp create mode 100644 src/glsl/ir_dead_code_local.cpp create mode 100644 src/glsl/ir_expression_flattening.cpp create mode 100644 src/glsl/ir_expression_flattening.h create mode 100644 src/glsl/ir_function.cpp create mode 100644 src/glsl/ir_function_can_inline.cpp create mode 100644 src/glsl/ir_function_inlining.cpp create mode 100644 src/glsl/ir_function_inlining.h create mode 100644 src/glsl/ir_hierarchical_visitor.cpp create mode 100644 src/glsl/ir_hierarchical_visitor.h create mode 100644 src/glsl/ir_hv_accept.cpp create mode 100644 src/glsl/ir_if_simplification.cpp create mode 100644 src/glsl/ir_optimization.h create mode 100644 src/glsl/ir_print_visitor.cpp create mode 100644 src/glsl/ir_print_visitor.h create mode 100644 src/glsl/ir_reader.cpp create mode 100644 src/glsl/ir_reader.h create mode 100644 src/glsl/ir_swizzle_swizzle.cpp create mode 100644 src/glsl/ir_to_mesa.cpp create mode 100644 src/glsl/ir_validate.cpp create mode 100644 src/glsl/ir_variable.cpp create mode 100644 src/glsl/ir_vec_index_to_swizzle.cpp create mode 100644 src/glsl/ir_visitor.h create mode 100644 src/glsl/linker.cpp create mode 100644 src/glsl/list.h create mode 100644 src/glsl/main.cpp create mode 100644 src/glsl/main/imports.h create mode 100644 src/glsl/main/mtypes.h create mode 100644 src/glsl/main/simple_list.h create mode 100644 src/glsl/mesa/shader/prog_instruction.c create mode 100644 src/glsl/mesa/shader/prog_instruction.h create mode 100644 src/glsl/mesa/shader/prog_print.c create mode 100644 src/glsl/mesa/shader/prog_print.h create mode 100644 src/glsl/program.h create mode 100644 src/glsl/s_expression.cpp create mode 100644 src/glsl/s_expression.h create mode 100644 src/glsl/symbol_table.c create mode 100644 src/glsl/symbol_table.h create mode 100644 src/glsl/tests/array-01.glsl create mode 100644 src/glsl/tests/array-02.glsl create mode 100644 src/glsl/tests/array-03.glsl create mode 100644 src/glsl/tests/array-04.glsl create mode 100644 src/glsl/tests/array-05.glsl create mode 100644 src/glsl/tests/array-06.glsl create mode 100644 src/glsl/tests/array-07.glsl create mode 100644 src/glsl/tests/array-08.glsl create mode 100644 src/glsl/tests/array-09.glsl create mode 100644 src/glsl/tests/array-10.glsl create mode 100644 src/glsl/tests/array-11.glsl create mode 100644 src/glsl/tests/array-12.glsl create mode 100644 src/glsl/tests/array-13.glsl create mode 100644 src/glsl/tests/attribute-01.glsl create mode 100644 src/glsl/tests/attribute-02.glsl create mode 100644 src/glsl/tests/attribute-03.glsl create mode 100644 src/glsl/tests/attribute-04.glsl create mode 100644 src/glsl/tests/attribute-05.glsl create mode 100644 src/glsl/tests/attribute-06.glsl create mode 100644 src/glsl/tests/attribute-07.glsl create mode 100644 src/glsl/tests/attribute-08.glsl create mode 100644 src/glsl/tests/attribute-09.glsl create mode 100644 src/glsl/tests/attribute-10.glsl create mode 100644 src/glsl/tests/attribute-11.glsl create mode 100644 src/glsl/tests/condition-01.glsl create mode 100644 src/glsl/tests/condition-02.glsl create mode 100644 src/glsl/tests/condition-03.glsl create mode 100644 src/glsl/tests/condition-04.glsl create mode 100644 src/glsl/tests/condition-05.glsl create mode 100644 src/glsl/tests/constructor-01.glsl create mode 100644 src/glsl/tests/constructor-02.glsl create mode 100644 src/glsl/tests/constructor-03.glsl create mode 100644 src/glsl/tests/constructor-04.glsl create mode 100644 src/glsl/tests/constructor-05.glsl create mode 100644 src/glsl/tests/constructor-06.glsl create mode 100644 src/glsl/tests/constructor-07.glsl create mode 100644 src/glsl/tests/constructor-08.glsl create mode 100644 src/glsl/tests/constructor-09.glsl create mode 100644 src/glsl/tests/function-01.glsl create mode 100644 src/glsl/tests/function-02.glsl create mode 100644 src/glsl/tests/function-03.glsl create mode 100644 src/glsl/tests/function-04.glsl create mode 100644 src/glsl/tests/function-05.glsl create mode 100644 src/glsl/tests/if-01.glsl create mode 100644 src/glsl/tests/if-02.glsl create mode 100644 src/glsl/tests/if-03.glsl create mode 100644 src/glsl/tests/if-04.glsl create mode 100644 src/glsl/tests/matrix-01.glsl create mode 100644 src/glsl/tests/matrix-02.glsl create mode 100644 src/glsl/tests/matrix-03.glsl create mode 100644 src/glsl/tests/matrix-04.glsl create mode 100644 src/glsl/tests/matrix-05.glsl create mode 100644 src/glsl/tests/matrix-06.glsl create mode 100644 src/glsl/tests/matrix-07.glsl create mode 100644 src/glsl/tests/matrix-08.glsl create mode 100644 src/glsl/tests/matrix-09.glsl create mode 100644 src/glsl/tests/matrix-10.glsl create mode 100644 src/glsl/tests/parameters-01.glsl create mode 100644 src/glsl/tests/parameters-02.glsl create mode 100644 src/glsl/tests/parameters-03.glsl create mode 100644 src/glsl/tests/qualifier-01.glsl create mode 100644 src/glsl/tests/qualifier-02.glsl create mode 100644 src/glsl/tests/qualifier-03.glsl create mode 100644 src/glsl/tests/qualifier-04.glsl create mode 100644 src/glsl/tests/qualifier-05.glsl create mode 100644 src/glsl/tests/qualifier-06.glsl create mode 100644 src/glsl/tests/qualifier-07.glsl create mode 100644 src/glsl/tests/swiz-01.glsl create mode 100644 src/glsl/tests/swiz-02.glsl create mode 100644 src/glsl/tests/void-01.glsl (limited to 'src/glsl') diff --git a/src/glsl/.dir-locals.el b/src/glsl/.dir-locals.el new file mode 100644 index 0000000000..be19e29a5a --- /dev/null +++ b/src/glsl/.dir-locals.el @@ -0,0 +1,3 @@ +((c-mode . ((c-basic-offset . 3))) + (c++-mode . ((c-basic-offset . 3))) +) diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore new file mode 100644 index 0000000000..376aaeda13 --- /dev/null +++ b/src/glsl/.gitignore @@ -0,0 +1,25 @@ +.deps +COPYING +INSTALL +Makefile.in +aclocal.m4 +autom4te.cache +config.* +configure +depcomp +ylwrap +install-sh +missing +stamp-h1 +libtool +ltmain.sh +Makefile +*.o +*~ +glsl_lexer.cpp +glsl_parser.output +glsl_parser.cpp +glsl_parser.h +glsl +mesa_codegen.cpp +mesa_codegen.h diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am new file mode 100644 index 0000000000..c34f7d8abf --- /dev/null +++ b/src/glsl/Makefile.am @@ -0,0 +1,79 @@ +# Copyright © 2010 Intel Corporation +# All Rights Reserved. +# +# 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 +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL +# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS 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. + +AUTOMAKE_OPTIONS = foreign +AM_CPPFLAGS = -I mesa + +SUBDIRS = glcpp + +bin_PROGRAMS = glsl + +glsl_LDADD = ./glcpp/libglcpp.la +glsl_LDFLAGS = @LDFLAGS@ $(talloc_LIBS) +glsl_SOURCES = \ + main.cpp \ + builtin_types.h \ + symbol_table.c hash_table.c glsl_types.cpp \ + glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \ + ast_expr.cpp ast_to_hir.cpp ast_function.cpp ast_type.cpp \ + ir.cpp hir_field_selection.cpp builtin_function.cpp \ + ir_print_visitor.cpp ir_variable.cpp ir_function.cpp \ + ir_basic_block.cpp \ + ir_basic_block.h \ + ir_clone.cpp \ + ir_constant_expression.cpp \ + ir_constant_folding.cpp \ + ir_constant_variable.cpp \ + ir_copy_propagation.cpp \ + ir_copy_propagation.h \ + ir_dead_code.cpp \ + ir_dead_code.h \ + ir_dead_code_local.cpp \ + ir_expression_flattening.cpp \ + ir_function_can_inline.cpp \ + ir_function_inlining.cpp \ + ir_if_simplification.cpp \ + ir_optimization.h \ + ir_reader.cpp s_expression.cpp \ + ir_hv_accept.cpp \ + ir_hierarchical_visitor.h \ + ir_hierarchical_visitor.cpp \ + ir_swizzle_swizzle.cpp \ + ir_to_mesa.cpp \ + ir_to_mesa.h \ + ir_validate.cpp \ + ir_vec_index_to_swizzle.cpp \ + linker.cpp \ + mesa/shader/prog_instruction.c \ + mesa/shader/prog_instruction.h \ + mesa/shader/prog_print.c \ + mesa/shader/prog_print.h + +BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp +CLEANFILES = $(BUILT_SOURCES) + +builtin_function.cpp: builtins/*/* + ./builtins/tools/generate_builtins.pl > builtin_function.cpp +glsl_parser.h: glsl_parser.cpp + +.lpp.cpp: + $(LEXCOMPILE) --outfile="$@" $< diff --git a/src/glsl/TODO b/src/glsl/TODO new file mode 100644 index 0000000000..193cfc767d --- /dev/null +++ b/src/glsl/TODO @@ -0,0 +1,84 @@ +- Implement AST-to-HIR conversion of discard instructions. + +- Handle constant expressions of (matrix {+,-,*,/} scalar) + +- Handle constant expressions of (vector {+,-,*,/} scalar) + +- Handle constant expressions of (matrix * vector) + +- Handle constant expressions of (matrix * matrix) + +- Handle currently unsupported constant expression types + - ir_unop_sign + - ir_unop_exp2 + - ir_unop_log2 + - ir_unop_u2f + - ir_unop_trunc + - ir_unop_ceil + - ir_unop_floor + - ir_unop_sin + - ir_unop_cos + - ir_binop_dot + - ir_binop_min + - ir_binop_max + - ir_binop_pow + +- Handle constant expressions of (struct == struct) + +- Handle constant expressions of (struct != struct) + +- Add support to ir_constant for array constants Arrays can only be + - declared 'const' in GLSL 1.20+. This is because there are no + array constructors in GLSL 1.10, and any variable declared as + 'const' must have an initializer. + +- Handle constant expressions of (array == array) + +- Handle constant expressions of (array != array) + +- Treat built-in functions with constant parameters as constant expressions. + - Rewrite all built-in functions return a single expression. + - Modify the HIR generator for functions to automatically inline built-in + functions durning translation. + - Care must be taken to handle both the 1.10 rules and the 1.20+ rules. In + 1.10, built-in functions cannot be constant expressions. + +- Detect non-void functions that lack a return statement + +- Detect return statements with a type not matching the funciton's + return type. + +- Handle over-riding built-in functions + - Is the overload per-compilation unit or per-linked shader? + +- Handle redeclaration of built-in variables + - Handle addition of qualifiers such as 'invariant' or 'centroid'. + - Handle resizing of arrays. + - Other? We'll have to look at the spec. + +- 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? + +1.30 features: + +- Implement AST-to-HIR conversion of bit-shift operators. + +- Implement AST-to-HIR conversion of bit-wise {&,|,^,!} operators. + +- Implement AST-to-HIR conversion of switch-statements + - switch + - case + - Update break to correcly handle mixed nexting of switch-statements + and loops. + +- Handle currently unsupported constant expression types + - ir_unop_bit_not + - ir_binop_mod + - ir_binop_lshift + - ir_binop_rshift + - ir_binop_bit_and + - ir_binop_bit_xor + - ir_binop_bit_or diff --git a/src/glsl/ast.h b/src/glsl/ast.h new file mode 100644 index 0000000000..de300e719c --- /dev/null +++ b/src/glsl/ast.h @@ -0,0 +1,651 @@ +/* -*- 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 ir_instruction; +struct _mesa_glsl_parse_state; + +struct YYLTYPE; + +class ast_node { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *table) + { + talloc_free(table); + } + + virtual void print(void) const; + 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; + } + + struct { + unsigned source; + unsigned line; + unsigned column; + } location; + + exec_node link; + +protected: + ast_node(void); +}; + + +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 +}; + +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; + } + + 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; +}; + +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_high = 0, /**< Default precision. */ + ast_precision_medium, + ast_precision_low +}; + +struct ast_type_qualifier { + 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; +}; + +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_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_high) + { + /* 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_high) + { + /* 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; +}; + + +class ast_fully_specified_type : public ast_node { +public: + virtual void print(void) 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: + 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_declaration_statement : public ast_node { +public: + ast_declaration_statement(void); + + enum { + ast_function, + ast_declaration, + ast_precision + } mode; + + union { + class ast_function *function; + ast_declarator_list *declarator; + ast_type_specifier *type; + ast_node *node; + } declaration; +}; + + +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: + + /** + * An expression of NULL means 'default'. + */ + ast_expression *expression; +}; + +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_expression *expression; + exec_list statements; +}; + +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 struct ir_rvalue * +_mesa_ast_field_selection_to_hir(const struct ast_expression *expr, + exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +#endif /* AST_H */ diff --git a/src/glsl/ast_expr.cpp b/src/glsl/ast_expr.cpp new file mode 100644 index 0000000000..4e83decb92 --- /dev/null +++ b/src/glsl/ast_expr.cpp @@ -0,0 +1,96 @@ +/* + * 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 +#include +#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/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp new file mode 100644 index 0000000000..761af00b95 --- /dev/null +++ b/src/glsl/ast_function.cpp @@ -0,0 +1,751 @@ +/* + * 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" + +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; +} + + +static ir_rvalue * +process_call(exec_list *instructions, ir_function *f, + YYLTYPE *loc, exec_list *actual_parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + + const ir_function_signature *sig = + f->matching_signature(actual_parameters); + + /* The instructions param will be used when the FINISHMEs below are done */ + (void) instructions; + + if (sig != 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. + */ + 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_out) + || (formal->mode == ir_var_inout)) { + if (! actual->is_lvalue()) { + /* FINISHME: Log a better diagnostic here. There is no way + * FINISHME: to tell the user which parameter is invalid. + */ + _mesa_glsl_error(loc, state, "`%s' parameter is not lvalue", + (formal->mode == ir_var_out) ? "out" : "inout"); + } + } + + actual_iter.next(); + formal_iter.next(); + } + + /* FINISHME: The list of actual parameters needs to be modified to + * FINISHME: include any necessary conversions. + */ + return new(ctx) ir_call(sig, actual_parameters); + } else { + /* FINISHME: Log a better error message here. G++ will show the types + * FINISHME: of the actual parameters and the set of candidate + * FINISHME: functions. A different error should also be logged when + * FINISHME: multiple functions match. + */ + _mesa_glsl_error(loc, state, "no matching function for call to `%s'", + f->name); + return ir_call::get_error_instruction(ctx); + } +} + + +static ir_rvalue * +match_function_by_name(exec_list *instructions, const char *name, + YYLTYPE *loc, exec_list *actual_parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + ir_function *f = state->symbols->get_function(name); + + if (f == NULL) { + _mesa_glsl_error(loc, state, "function `%s' undeclared", name); + return ir_call::get_error_instruction(ctx); + } + + /* Once we've determined that the function being called might exist, try + * to find an overload of the function that matches the parameters. + */ + return process_call(instructions, f, loc, actual_parameters, state); +} + + +/** + * Perform automatic type conversion of constructor parameters + */ +static ir_rvalue * +convert_component(ir_rvalue *src, const glsl_type *desired_type) +{ + void *ctx = talloc_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) || (src->type->is_integer() && desired_type->is_integer())) + return src; + + switch (a) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + if (b == GLSL_TYPE_FLOAT) + result = new(ctx) ir_expression(ir_unop_f2i, desired_type, src, NULL); + else { + assert(b == GLSL_TYPE_BOOL); + result = new(ctx) ir_expression(ir_unop_b2i, desired_type, src, NULL); + } + 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: { + ir_constant *zero = NULL; + + switch (b) { + case GLSL_TYPE_UINT: zero = new(ctx) ir_constant(unsigned(0)); break; + case GLSL_TYPE_INT: zero = new(ctx) ir_constant(int(0)); break; + case GLSL_TYPE_FLOAT: zero = new(ctx) ir_constant(0.0f); break; + } + + result = new(ctx) ir_expression(ir_binop_nequal, desired_type, src, zero); + } + } + + assert(result != NULL); + + 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 = talloc_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 = talloc_parent(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(state, + constructor_type->element_type(), + parameter_count); + assert(constructor_type != NULL); + assert(constructor_type->length == parameter_count); + } + + ir_function *f = state->symbols->get_function(constructor_type->name); + + /* If the constructor for this type of array does not exist, generate the + * prototype and add it to the symbol table. + */ + if (f == NULL) { + f = constructor_type->generate_constructor(state->symbols); + } + + ir_rvalue *const r = + process_call(instructions, f, loc, &actual_parameters, state); + + assert(r != NULL); + assert(r->type->is_error() || (r->type == constructor_type)); + + return r; +} + + +/** + * Try to convert a record constructor to a constant expression + */ +static ir_constant * +constant_record_constructor(const glsl_type *constructor_type, + YYLTYPE *loc, exec_list *parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + bool all_parameters_are_constant = true; + + exec_node *node = parameters->head; + for (unsigned i = 0; i < constructor_type->length; i++) { + ir_instruction *ir = (ir_instruction *) node; + + if (node->is_tail_sentinal()) { + _mesa_glsl_error(loc, state, + "insufficient parameters to constructor for `%s'", + constructor_type->name); + return NULL; + } + + if (ir->type != constructor_type->fields.structure[i].type) { + _mesa_glsl_error(loc, state, + "parameter type mismatch in constructor for `%s' " + " (%s vs %s)", + constructor_type->name, + ir->type->name, + constructor_type->fields.structure[i].type->name); + return NULL; + } + + if (ir->as_constant() == NULL) + all_parameters_are_constant = false; + + node = node->next; + } + + if (!all_parameters_are_constant) + return NULL; + + return new(ctx) ir_constant(constructor_type, parameters); +} + + +/** + * Generate data for a constant matrix constructor w/a single scalar parameter + * + * Matrix constructors in GLSL can be passed a single scalar of the + * approriate type. In these cases, the resulting matrix is the identity + * matrix multipled by the specified scalar. This function generates data for + * that matrix. + * + * \param type Type of the desired matrix. + * \param initializer Scalar value used to initialize the matrix diagonal. + * \param data Location to store the resulting matrix. + */ +void +generate_constructor_matrix(const glsl_type *type, ir_constant *initializer, + ir_constant_data *data) +{ + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < type->components(); i++) + data->u[i] = 0; + + for (unsigned i = 0; i < type->matrix_columns; i++) { + /* The array offset of the ith row and column of the matrix. + */ + const unsigned idx = (i * type->vector_elements) + i; + + data->u[idx] = initializer->value.u[0]; + } + break; + + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < type->components(); i++) + data->f[i] = 0; + + for (unsigned i = 0; i < type->matrix_columns; i++) { + /* The array offset of the ith row and column of the matrix. + */ + const unsigned idx = (i * type->vector_elements) + i; + + data->f[idx] = initializer->value.f[0]; + } + + break; + + default: + assert(!"Should not get here."); + break; + } +} + + +/** + * Generate data for a constant vector constructor w/a single scalar parameter + * + * Vector constructors in GLSL can be passed a single scalar of the + * approriate type. In these cases, the resulting vector contains the specified + * value in all components. This function generates data for that vector. + * + * \param type Type of the desired vector. + * \param initializer Scalar value used to initialize the vector. + * \param data Location to store the resulting vector data. + */ +void +generate_constructor_vector(const glsl_type *type, ir_constant *initializer, + ir_constant_data *data) +{ + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < type->components(); i++) + data->u[i] = initializer->value.u[0]; + + break; + + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < type->components(); i++) + data->f[i] = initializer->value.f[0]; + + break; + + case GLSL_TYPE_BOOL: + for (unsigned i = 0; i < type->components(); i++) + data->b[i] = initializer->value.b[0]; + + break; + + default: + assert(!"Should not get here."); + break; + } +} + + +ir_rvalue * +ast_function_expression::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + /* There are three sorts of function calls. + * + * 1. contstructors - 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); + + + /* 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_numeric() || constructor_type->is_boolean()) { + /* Constructing a numeric type has a couple steps. First all values + * passed to the constructor are broken into individual parameters + * and type converted to the base type of the thing being constructed. + * + * At that point we have some number of values that match the base + * type of the thing being constructed. Now the constructor can be + * treated like a function call. Each numeric type has a small set + * of constructor functions. The set of new parameters will either + * match one of those functions or the original constructor is + * invalid. + */ + const glsl_type *const base_type = constructor_type->get_base_type(); + + /* 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; + + bool all_parameters_are_constant = true; + + /* This handles invalid constructor calls such as 'vec4 v = vec4();' + */ + if (this->expressions.is_empty()) { + _mesa_glsl_error(& loc, state, "too few components to construct " + "`%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + foreach_list (n, &this->expressions) { + ast_node *ast = exec_node_data(ast_node, n, link); + ir_rvalue *result = + ast->hir(instructions, state)->as_rvalue(); + ir_variable *result_var = NULL; + + /* 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; + + /* 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++; + + /* We can't use the same instruction node in the multiple + * swizzle dereferences that happen, so assign it to a + * variable and deref that. Plus it saves computation for + * complicated expressions and handles + * glsl-vs-constructor-call.shader_test. + */ + if (result->type->components() >= 1 && !result->as_constant()) { + result_var = new(ctx) ir_variable(result->type, + "constructor_tmp"); + ir_dereference_variable *lhs; + + lhs = new(ctx) ir_dereference_variable(result_var); + instructions->push_tail(new(ctx) ir_assignment(lhs, + result, NULL)); + } + + /* Process each of the components of the parameter. Dereference + * each component individually, perform any type conversions, and + * add it to the parameter list for the constructor. + */ + for (unsigned i = 0; i < result->type->components(); i++) { + if (components_used >= type_components) + break; + + ir_rvalue *component; + + if (result_var) { + ir_dereference *d = new(ctx) ir_dereference_variable(result_var); + component = dereference_component(d, i); + } else { + component = dereference_component(result, i); + } + component = convert_component(component, base_type); + + /* All cases that could result in component->type being the + * error type should have already been caught above. + */ + assert(component->type == base_type); + + if (component->as_constant() == NULL) + all_parameters_are_constant = false; + + /* Don't actually generate constructor calls for scalars. + * Instead, do the usual component selection and conversion, + * and return the single component. + */ + if (constructor_type->is_scalar()) + return component; + + actual_parameters.push_tail(component); + components_used++; + } + } + + /* 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)) { + _mesa_glsl_error(& loc, state, "too few components to construct " + "`%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + ir_function *f = state->symbols->get_function(constructor_type->name); + if (f == NULL) { + _mesa_glsl_error(& loc, state, "no constructor for type `%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + const ir_function_signature *sig = + f->matching_signature(& actual_parameters); + if (sig != NULL) { + /* If all of the parameters are trivially constant, create a + * constant representing the complete collection of parameters. + */ + if (all_parameters_are_constant) { + if (components_used >= type_components) + return new(ctx) ir_constant(sig->return_type, + & actual_parameters); + + assert(sig->return_type->is_vector() + || sig->return_type->is_matrix()); + + /* Constructors with exactly one component are special for + * vectors and matrices. For vectors it causes all elements of + * the vector to be filled with the value. For matrices it + * causes the matrix to be filled with 0 and the diagonal to be + * filled with the value. + */ + ir_constant_data data; + ir_constant *const initializer = + (ir_constant *) actual_parameters.head; + if (sig->return_type->is_matrix()) + generate_constructor_matrix(sig->return_type, initializer, + &data); + else + generate_constructor_vector(sig->return_type, initializer, + &data); + + return new(ctx) ir_constant(sig->return_type, &data); + } else + return new(ctx) ir_call(sig, & actual_parameters); + } else { + /* FINISHME: Log a better error message here. G++ will show the + * FINSIHME: types of the actual parameters and the set of + * FINSIHME: candidate functions. A different error should also be + * FINSIHME: logged when multiple functions match. + */ + _mesa_glsl_error(& loc, state, "no matching constructor for `%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + } + + return ir_call::get_error_instruction(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); + + const glsl_type *const type = + state->symbols->get_type(id->primary_expression.identifier); + + if ((type != NULL) && type->is_record()) { + ir_constant *constant = + constant_record_constructor(type, &loc, &actual_parameters, state); + + if (constant != NULL) + return constant; + } + + return match_function_by_name(instructions, + id->primary_expression.identifier, & loc, + &actual_parameters, state); + } + + return ir_call::get_error_instruction(ctx); +} diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp new file mode 100644 index 0000000000..33eb27533f --- /dev/null +++ b/src/glsl/ast_to_hir.cpp @@ -0,0 +1,2453 @@ +/* + * 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/imports.h" +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "ast.h" +#include "glsl_types.h" +#include "ir.h" + +void +_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) +{ + _mesa_glsl_initialize_variables(instructions, state); + _mesa_glsl_initialize_constructors(instructions, state); + _mesa_glsl_initialize_functions(instructions, state); + + state->current_function = NULL; + + foreach_list_typed (ast_node, ast, link, & state->translation_unit) + ast->hir(instructions, state); +} + + +/** + * 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. + */ +static bool +apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(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; + + 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 , , + * , , and 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 , , + * , , , and + * 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) + return type_b; + } 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()) + return type_a; + } + + _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; +} + + +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) +{ + /* 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() || !type_b->is_integer() + || (type_a->base_type != type_b->base_type)) { + _mesa_glsl_error(loc, state, "type mismatch"); + 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; +} + + +/** + * 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) +{ + const glsl_type *rhs_type = rhs->type; + + /* 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. + * + * Note: Whole-array assignments are not permitted in GLSL 1.10, but this + * is handled by ir_dereference::is_lvalue. + */ + if (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)) { + rhs_type = rhs->type; + if (rhs_type == lhs_type) + return rhs; + } + + return NULL; +} + +ir_rvalue * +do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, + ir_rvalue *lhs, ir_rvalue *rhs, + YYLTYPE lhs_loc) +{ + void *ctx = talloc_parent(state); + bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); + + if (!error_emitted) { + /* FINISHME: This does not handle 'foo.bar.a.b.c[5].d = 5' */ + 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); + 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(state, + lhs->type->element_type(), + rhs->type->array_size()); + } + } + + /* 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_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); + + instructions->push_tail(new(ctx) ir_assignment(lhs, + deref_var, + NULL)); + + return new(ctx) ir_dereference_variable(var); +} + + +/** + * Generate a new temporary and add its declaration to the instruction stream + */ +static ir_variable * +generate_temporary(const glsl_type *type, exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + char *name = (char *) malloc(sizeof(char) * 13); + + snprintf(name, 13, "tmp_%08X", state->temp_index); + state->temp_index++; + + ir_variable *const var = new(ctx) ir_variable(type, name); + instructions->push_tail(var); + + return var; +} + + +static ir_rvalue * +get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) +{ + void *ctx = talloc_parent(lvalue); + ir_variable *var; + + /* FINISHME: Give unique names to the temporaries. */ + var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp"); + var->mode = ir_var_auto; + + instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), + lvalue, NULL)); + + /* Once we've created this temporary, mark it read only so it's no + * longer considered an lvalue. + */ + var->read_only = true; + + 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; +} + + +ir_rvalue * +ast_expression::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(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_equal, + ir_binop_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[2]; + const struct glsl_type *type = glsl_type::error_type; + 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, op[0], op[1], + this->subexpressions[0]->get_location()); + error_emitted = result->type->is_error(); + type = result->type; + break; + } + + case ast_plus: + op[0] = this->subexpressions[0]->hir(instructions, state); + + error_emitted = op[0]->type->is_error(); + if (type->is_error()) + op[0]->type = type; + + 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: + _mesa_glsl_error(& loc, state, "FINISHME: implement bit-shift operators"); + error_emitted = true; + 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; + } + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], op[1]); + type = glsl_type::bool_type; + + assert(result->type == glsl_type::bool_type); + break; + + case ast_bit_and: + case ast_bit_xor: + case ast_bit_or: + case ast_bit_not: + _mesa_glsl_error(& loc, state, "FINISHME: implement bit-wise operators"); + error_emitted = true; + break; + + case ast_logic_and: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "LHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_constant *op0_const = op[0]->constant_expression_value(); + if (op0_const) { + if (op0_const->value.b[0]) { + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + result = op[1]; + } else { + result = op0_const; + } + type = glsl_type::bool_type; + } else { + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + + op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_variable *const tmp = generate_temporary(glsl_type::bool_type, + instructions, state); + + 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: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "LHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_constant *op0_const = op[0]->constant_expression_value(); + if (op0_const) { + if (op0_const->value.b[0]) { + result = op0_const; + } else { + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + result = op[1]; + } + type = glsl_type::bool_type; + } else { + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + + ir_variable *const tmp = generate_temporary(glsl_type::bool_type, + instructions, state); + + op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + 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); + + 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: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], op[1]); + type = glsl_type::bool_type; + break; + + case ast_logic_not: + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, + "operand of `!' must be scalar boolean"); + error_emitted = true; + } + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], NULL); + type = glsl_type::bool_type; + 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, + (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + 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); + + struct ir_rvalue *temp_rhs; + temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, + (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = type->is_error(); + break; + } + + case ast_ls_assign: + case ast_rs_assign: + _mesa_glsl_error(& loc, state, + "FINISHME: implement bit-shift assignment operators"); + error_emitted = true; + break; + + case ast_and_assign: + case ast_xor_assign: + case ast_or_assign: + _mesa_glsl_error(& loc, state, + "FINISHME: implement logic assignment operators"); + error_emitted = true; + break; + + case ast_conditional: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + /* 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." + */ + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "?: condition must be scalar boolean"); + error_emitted = true; + } + + /* 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; + } + + 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 = generate_temporary(type, + instructions, state); + + 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: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new(ctx) ir_constant(1.0f); + else + op[1] = new(ctx) ir_constant(1); + + type = arithmetic_result_type(op[0], op[1], false, state, & loc); + + struct ir_rvalue *temp_rhs; + temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, + (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } + + case ast_post_inc: + case ast_post_dec: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new(ctx) ir_constant(1.0f); + else + op[1] = new(ctx) ir_constant(1); + + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + + type = arithmetic_result_type(op[0], op[1], false, state, & loc); + + struct 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, (ir_rvalue *)op[0]->clone(NULL)); + + (void)do_assignment(instructions, state, + (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + this->subexpressions[0]->get_location()); + + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } + + case ast_field_selection: + result = _mesa_ast_field_selection_to_hir(this, instructions, state); + type = result->type; + 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; + } + } + + if (error_emitted) + result->type = glsl_type::error_type; + + type = result->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) { + type = result->type; + } else { + _mesa_glsl_error(& loc, state, "`%s' undeclared", + this->primary_expression.identifier); + + error_emitted = true; + } + break; + } + + case ast_int_constant: + type = glsl_type::int_type; + result = new(ctx) ir_constant(this->primary_expression.int_constant); + break; + + case ast_uint_constant: + type = glsl_type::uint_type; + result = new(ctx) ir_constant(this->primary_expression.uint_constant); + break; + + case ast_float_constant: + type = glsl_type::float_type; + result = new(ctx) ir_constant(this->primary_expression.float_constant); + break; + + case ast_bool_constant: + type = glsl_type::bool_type; + 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. + */ + foreach_list_typed (ast_node, ast, link, &this->expressions) + result = ast->hir(instructions, state); + + type = result->type; + + /* Any errors should have already been emitted in the loop above. + */ + error_emitted = true; + break; + } + } + + if (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(const glsl_type *base, ast_node *array_size, + struct _mesa_glsl_parse_state *state) +{ + unsigned length = 0; + + /* FINISHME: Reject delcarations of multidimensional arrays. */ + + if (array_size != NULL) { + exec_list dummy_instructions; + ir_rvalue *const ir = array_size->hir(& dummy_instructions, state); + YYLTYPE loc = array_size->get_location(); + + /* FINISHME: Verify that the grammar forbids side-effects in array + * FINISHME: sizes. i.e., 'vec4 [x = 12] data' + */ + assert(dummy_instructions.is_empty()); + + 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]; + } + } + } + } + + return glsl_type::get_array_instance(state, 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; + + if ((this->type_specifier == ast_struct) && (this->type_name == NULL)) { + /* FINISHME: Handle annonymous structures. */ + type = NULL; + } else { + type = state->symbols->get_type(this->type_name); + *name = this->type_name; + + if (this->is_array) { + type = process_array_type(type, this->array_size, state); + } + } + + return type; +} + + +static void +apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, + struct ir_variable *var, + struct _mesa_glsl_parse_state *state, + YYLTYPE *loc) +{ + if (qual->invariant) + var->invariant = 1; + + /* FINISHME: Mark 'in' variables at global scope as read-only. */ + if (qual->constant || qual->attribute || qual->uniform + || (qual->varying && (state->target == fragment_shader))) + var->read_only = 1; + + if (qual->centroid) + var->centroid = 1; + + if (qual->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->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 (qual->in && qual->out) + var->mode = ir_var_inout; + else if (qual->attribute || qual->in + || (qual->varying && (state->target == fragment_shader))) + var->mode = ir_var_in; + else if (qual->out || (qual->varying && (state->target == vertex_shader))) + var->mode = ir_var_out; + else if (qual->uniform) + var->mode = ir_var_uniform; + else + var->mode = ir_var_auto; + + if (qual->uniform) + var->shader_in = true; + + /* Any 'in' or 'inout' variables at global scope must be marked as being + * shader inputs. Likewise, any 'out' or 'inout' variables at global scope + * must be marked as being shader outputs. + */ + if (state->current_function == NULL) { + switch (var->mode) { + case ir_var_in: + case ir_var_uniform: + var->shader_in = true; + break; + case ir_var_out: + var->shader_out = true; + break; + case ir_var_inout: + var->shader_in = true; + var->shader_out = true; + break; + default: + break; + } + } + + if (qual->flat) + var->interpolation = ir_var_flat; + else if (qual->noperspective) + var->interpolation = ir_var_noperspective; + else + var->interpolation = ir_var_smooth; + + if (var->type->is_array() && (state->language_version >= 120)) { + var->array_lvalue = true; + } +} + + +ir_rvalue * +ast_declarator_list::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + const struct glsl_type *decl_type; + const char *type_name = NULL; + ir_rvalue *result = NULL; + YYLTYPE loc = this->get_location(); + + /* The type specifier may contain a structure definition. Process that + * before any of the variable declarations. + */ + (void) this->type->specifier->hir(instructions, state); + + /* FINISHME: Handle vertex shader "invariant" declarations that do not + * FINISHME: include a type. These re-declare built-in variables to be + * FINISHME: invariant. + */ + + decl_type = this->type->specifier->glsl_type(& type_name, state); + if (this->declarations.is_empty()) { + /* There are only two valid cases where the declaration list can be + * empty. + * + * 1. The declaration is setting the default precision of a built-in + * type (e.g., 'precision highp vec4;'). + * + * 2. Adding 'invariant' to an existing vertex shader output. + */ + + if (this->type->qualifier.invariant) { + } else if (decl_type != NULL) { + } else { + _mesa_glsl_error(& loc, state, "incomplete declaration"); + } + } + + foreach_list_typed (ast_declaration, decl, link, &this->declarations) { + const struct glsl_type *var_type; + struct 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(decl_type, decl->array_size, state); + } else { + var_type = decl_type; + } + + var = new(ctx) ir_variable(var_type, decl->identifier); + + /* 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. + */ + if (state->language_version < 120) { + if (this->type->qualifier.out) { + _mesa_glsl_error(& loc, state, + "`out' qualifier in declaration of `%s' " + "only valid for function parameters in GLSL 1.10.", + decl->identifier); + } + if (this->type->qualifier.in) { + _mesa_glsl_error(& loc, state, + "`in' qualifier in declaration of `%s' " + "only valid for function parameters in GLSL 1.10.", + decl->identifier); + } + /* FINISHME: Test for other invalid qualifiers. */ + } + + apply_type_qualifier_to_variable(& this->type->qualifier, var, state, + & loc); + + /* Attempt to add the variable to the symbol table. If this fails, it + * means the variable has already been declared at this scope. Arrays + * fudge this rule a little bit. + * + * 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 (state->symbols->name_declared_this_scope(decl->identifier)) { + ir_variable *const earlier = + state->symbols->get_variable(decl->identifier); + + if ((earlier != NULL) + && (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. + */ + + if (var->type->array_size() <= (int)earlier->max_array_access) { + YYLTYPE loc = this->get_location(); + + _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 { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "`%s' redeclared", + decl->identifier); + } + + continue; + } + + /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, + * + * "Identifiers starting with "gl_" are reserved for use by + * OpenGL, and may not be declared in a shader as either a + * variable or a function." + */ + if (strncmp(decl->identifier, "gl_", 3) == 0) { + /* FINISHME: This should only trigger if we're not redefining + * FINISHME: a builtin (to add a qualifier, for example). + */ + _mesa_glsl_error(& loc, state, + "identifier `%s' uses reserved `gl_' prefix", + decl->identifier); + } + + instructions->push_tail(var); + + 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.attribute) { + mode = "attribute"; + } else if (this->type->qualifier.uniform) { + mode = "uniform"; + } else if (this->type->qualifier.varying) { + mode = "varying"; + } else if (this->type->qualifier.in) { + mode = "in"; + extra = " or in function parameter list"; + } else if (this->type->qualifier.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) { + 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; + } + } + } + + if (decl->initializer != 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(ctx) ir_dereference_variable(var); + ir_rvalue *rhs = decl->initializer->hir(instructions, state); + + /* Calculate the constant value if this is a const or uniform + * declaration. + */ + if (this->type->qualifier.constant || this->type->qualifier.uniform) { + 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", + (this->type->qualifier.constant) + ? "const" : "uniform", + decl->identifier); + } else { + rhs = constant_value; + var->constant_value = constant_value; + } + } + + if (rhs && !rhs->type->is_error()) { + bool temp = var->read_only; + if (this->type->qualifier.constant) + var->read_only = false; + + /* Never emit code to initialize a uniform. + */ + if (!this->type->qualifier.uniform) + result = do_assignment(instructions, state, lhs, rhs, + this->get_location()); + var->read_only = temp; + } + } + + /* From page 23 (page 29 of the PDF) of the GLSL 1.10 spec: + * + * "It is an error to write to a const variable outside of + * its declaration, so they must be initialized when + * declared." + */ + if (this->type->qualifier.constant && decl->initializer == NULL) { + _mesa_glsl_error(& loc, state, + "const declaration of `%s' must be initialized"); + } + + /* Add the vairable to the symbol table after processing the initializer. + * This differs from most C-like languages, but it follows the GLSL + * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 + * spec: + * + * "Within a declaration, the scope of a name starts immediately + * after the initializer if present or immediately after the name + * being declared if not." + */ + const bool added_variable = + state->symbols->add_variable(decl->identifier, var); + assert(added_variable); + } + + + /* Generally, variable declarations do not have r-values. However, + * one is used for the declaration in + * + * while (bool b = some_condition()) { + * ... + * } + * + * so we return the rvalue from the last seen declaration here. + */ + return result; +} + + +ir_rvalue * +ast_parameter_declarator::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + const struct glsl_type *type; + const char *name = NULL; + YYLTYPE loc = this->get_location(); + + type = this->type->specifier->glsl_type(& name, state); + + if (type == NULL) { + if (name != NULL) { + _mesa_glsl_error(& loc, state, + "invalid type `%s' in declaration of `%s'", + name, this->identifier); + } else { + _mesa_glsl_error(& loc, state, + "invalid type in declaration of `%s'", + this->identifier); + } + + type = glsl_type::error_type; + } + + /* From page 62 (page 68 of the PDF) of the GLSL 1.50 spec: + * + * "Functions that accept no input arguments need not use void in the + * argument list because prototypes (or definitions) are required and + * therefore there is no ambiguity when an empty argument list "( )" is + * declared. The idiom "(void)" as a parameter list is provided for + * convenience." + * + * Placing this check here prevents a void parameter being set up + * for a function, which avoids tripping up checks for main taking + * parameters and lookups of an unnamed symbol. + */ + if (type->is_void()) { + if (this->identifier != NULL) + _mesa_glsl_error(& loc, state, + "named parameter cannot have type `void'"); + + is_void = true; + return NULL; + } + + if (formal_parameter && (this->identifier == NULL)) { + _mesa_glsl_error(& loc, state, "formal parameter lacks a name"); + return NULL; + } + + is_void = false; + ir_variable *var = new(ctx) ir_variable(type, this->identifier); + + /* FINISHME: Handle array declarations. Note that this requires + * FINISHME: complete handling of constant expressions. + */ + + /* Apply any specified qualifiers to the parameter declaration. Note that + * for function parameters the default mode is 'in'. + */ + apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc); + if (var->mode == ir_var_auto) + var->mode = ir_var_in; + + instructions->push_tail(var); + + /* Parameter declarations do not have r-values. + */ + return NULL; +} + + +void +ast_parameter_declarator::parameters_to_hir(exec_list *ast_parameters, + bool formal, + exec_list *ir_parameters, + _mesa_glsl_parse_state *state) +{ + ast_parameter_declarator *void_param = NULL; + unsigned count = 0; + + foreach_list_typed (ast_parameter_declarator, param, link, ast_parameters) { + param->formal_parameter = formal; + param->hir(ir_parameters, state); + + if (param->is_void) + void_param = param; + + count++; + } + + if ((void_param != NULL) && (count > 1)) { + YYLTYPE loc = void_param->get_location(); + + _mesa_glsl_error(& loc, state, + "`void' parameter must be only parameter"); + } +} + + +ir_rvalue * +ast_function::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + ir_function *f = NULL; + ir_function_signature *sig = NULL; + exec_list hir_parameters; + + + /* Convert the list of function parameters to HIR now so that they can be + * used below to compare this function's signature with previously seen + * signatures for functions with the same name. + */ + ast_parameter_declarator::parameters_to_hir(& this->parameters, + is_definition, + & hir_parameters, state); + + const char *return_type_name; + const glsl_type *return_type = + this->return_type->specifier->glsl_type(& return_type_name, state); + + assert(return_type != NULL); + + /* Verify that this function's signature either doesn't match a previously + * seen signature for a function with the same name, or, if a match is found, + * that the previously seen signature does not have an associated definition. + */ + const char *const name = identifier; + f = state->symbols->get_function(name); + if (f != NULL) { + ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); + if (sig != NULL) { + const char *badvar = sig->qualifiers_match(&hir_parameters); + if (badvar != NULL) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(&loc, state, "function `%s' parameter `%s' " + "qualifiers don't match prototype", name, badvar); + } + + if (sig->return_type != return_type) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(&loc, state, "function `%s' return type doesn't " + "match prototype", name); + } + + if (is_definition && sig->is_defined) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "function `%s' redefined", name); + sig = NULL; + } + } + } else if (state->symbols->name_declared_this_scope(name)) { + /* This function name shadows a non-function use of the same name. + */ + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "function name `%s' conflicts with " + "non-function", name); + sig = NULL; + } else { + f = new(ctx) ir_function(name); + state->symbols->add_function(f->name, f); + + /* Emit the new function header */ + instructions->push_tail(f); + } + + /* Verify the return type of main() */ + if (strcmp(name, "main") == 0) { + if (! return_type->is_void()) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "main() must return void"); + } + + if (!hir_parameters.is_empty()) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "main() must not take any parameters"); + } + } + + /* Finish storing the information about this new function in its signature. + */ + if (sig == NULL) { + sig = new(ctx) ir_function_signature(return_type); + f->add_signature(sig); + } + + sig->replace_parameters(&hir_parameters); + signature = sig; + + /* Function declarations (prototypes) do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_function_definition::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + prototype->is_definition = true; + prototype->hir(instructions, state); + + ir_function_signature *signature = prototype->signature; + + assert(state->current_function == NULL); + state->current_function = signature; + + /* Duplicate parameters declared in the prototype as concrete variables. + * Add these to the symbol table. + */ + state->symbols->push_scope(); + foreach_iter(exec_list_iterator, iter, signature->parameters) { + ir_variable *const var = ((ir_instruction *) iter.get())->as_variable(); + + assert(var != NULL); + + /* The only way a parameter would "exist" is if two parameters have + * the same name. + */ + if (state->symbols->name_declared_this_scope(var->name)) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name); + } else { + state->symbols->add_variable(var->name, var); + } + } + + /* Convert the body of the function to HIR. */ + this->body->hir(&signature->body, state); + signature->is_defined = true; + + state->symbols->pop_scope(); + + assert(state->current_function == signature); + state->current_function = NULL; + + /* Function definitions do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_jump_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + + switch (mode) { + case ast_return: { + ir_return *inst; + assert(state->current_function); + + if (opt_return_value) { + if (state->current_function->return_type->base_type == + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return` with a value, in function `%s' " + "returning void", + state->current_function->function_name()); + } + + ir_expression *const ret = (ir_expression *) + opt_return_value->hir(instructions, state); + assert(ret != NULL); + + /* FINISHME: Make sure the type of the return value matches the return + * FINISHME: type of the enclosing function. + */ + + inst = new(ctx) ir_return(ret); + } else { + if (state->current_function->return_type->base_type != + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return' with no value, in function %s returning " + "non-void", + state->current_function->function_name()); + } + inst = new(ctx) ir_return; + } + + instructions->push_tail(inst); + break; + } + + case ast_discard: + /* FINISHME: discard support */ + if (state->target != fragment_shader) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`discard' may only appear in a fragment shader"); + } + break; + + case ast_break: + case ast_continue: + /* FINISHME: Handle switch-statements. They cannot contain 'continue', + * FINISHME: and they use a different IR instruction for 'break'. + */ + /* FINISHME: Correctly handle the nesting. If a switch-statement is + * FINISHME: inside a loop, a 'continue' is valid and will bind to the + * FINISHME: loop. + */ + if (state->loop_or_switch_nesting == NULL) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`%s' may only appear in a loop", + (mode == ast_break) ? "break" : "continue"); + } else { + ir_loop *const loop = state->loop_or_switch_nesting->as_loop(); + + if (loop != NULL) { + ir_loop_jump *const jump = + new(ctx) ir_loop_jump((mode == ast_break) + ? ir_loop_jump::jump_break + : ir_loop_jump::jump_continue); + instructions->push_tail(jump); + } + } + + break; + } + + /* Jump instructions do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_selection_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + + ir_rvalue *const condition = this->condition->hir(instructions, state); + + /* From page 66 (page 72 of the PDF) of the GLSL 1.50 spec: + * + * "Any expression whose type evaluates to a Boolean can be used as the + * conditional expression bool-expression. Vector types are not accepted + * as the expression to if." + * + * The checks are separated so that higher quality diagnostics can be + * generated for cases where both rules are violated. + */ + if (!condition->type->is_boolean() || !condition->type->is_scalar()) { + YYLTYPE loc = this->condition->get_location(); + + _mesa_glsl_error(& loc, state, "if-statement condition must be scalar " + "boolean"); + } + + ir_if *const stmt = new(ctx) ir_if(condition); + + if (then_statement != NULL) + then_statement->hir(& stmt->then_instructions, state); + + if (else_statement != NULL) + else_statement->hir(& stmt->else_instructions, state); + + instructions->push_tail(stmt); + + /* if-statements do not have r-values. + */ + return NULL; +} + + +void +ast_iteration_statement::condition_to_hir(ir_loop *stmt, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + + if (condition != NULL) { + ir_rvalue *const cond = + condition->hir(& stmt->body_instructions, state); + + if ((cond == NULL) + || !cond->type->is_boolean() || !cond->type->is_scalar()) { + YYLTYPE loc = condition->get_location(); + + _mesa_glsl_error(& loc, state, + "loop condition must be scalar boolean"); + } else { + /* As the first code in the loop body, generate a block that looks + * like 'if (!condition) break;' as the loop termination condition. + */ + ir_rvalue *const not_cond = + new(ctx) ir_expression(ir_unop_logic_not, glsl_type::bool_type, cond, + NULL); + + ir_if *const if_stmt = new(ctx) ir_if(not_cond); + + ir_jump *const break_stmt = + new(ctx) ir_loop_jump(ir_loop_jump::jump_break); + + if_stmt->then_instructions.push_tail(break_stmt); + stmt->body_instructions.push_tail(if_stmt); + } + } +} + + +ir_rvalue * +ast_iteration_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + + /* For-loops and while-loops start a new scope, but do-while loops do not. + */ + if (mode != ast_do_while) + state->symbols->push_scope(); + + if (init_statement != NULL) + init_statement->hir(instructions, state); + + ir_loop *const stmt = new(ctx) ir_loop(); + instructions->push_tail(stmt); + + /* Track the current loop and / or switch-statement nesting. + */ + ir_instruction *const nesting = state->loop_or_switch_nesting; + state->loop_or_switch_nesting = stmt; + + if (mode != ast_do_while) + condition_to_hir(stmt, state); + + if (body != NULL) + body->hir(& stmt->body_instructions, state); + + if (rest_expression != NULL) + rest_expression->hir(& stmt->body_instructions, state); + + if (mode == ast_do_while) + condition_to_hir(stmt, state); + + if (mode != ast_do_while) + state->symbols->pop_scope(); + + /* Restore previous nesting before returning. + */ + state->loop_or_switch_nesting = nesting; + + /* Loops do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_type_specifier::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (this->structure != NULL) + return this->structure->hir(instructions, state); + + return NULL; +} + + +ir_rvalue * +ast_struct_specifier::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + unsigned decl_count = 0; + + /* Make an initial pass over the list of structure fields to determine how + * many there are. Each element in this list is an ast_declarator_list. + * This means that we actually need to count the number of elements in the + * 'declarations' list in each of the elements. + */ + foreach_list_typed (ast_declarator_list, decl_list, link, + &this->declarations) { + foreach_list_const (decl_ptr, & decl_list->declarations) { + decl_count++; + } + } + + + /* Allocate storage for the structure fields and process the field + * declarations. As the declarations are processed, try to also convert + * the types to HIR. This ensures that structure definitions embedded in + * other structure definitions are processed. + */ + glsl_struct_field *const fields = (glsl_struct_field *) + malloc(sizeof(*fields) * decl_count); + + unsigned i = 0; + foreach_list_typed (ast_declarator_list, decl_list, link, + &this->declarations) { + const char *type_name; + + decl_list->type->specifier->hir(instructions, state); + + const glsl_type *decl_type = + decl_list->type->specifier->glsl_type(& type_name, state); + + foreach_list_typed (ast_declaration, decl, link, + &decl_list->declarations) { + const struct glsl_type *const field_type = + (decl->is_array) + ? process_array_type(decl_type, decl->array_size, state) + : decl_type; + + fields[i].type = (field_type != NULL) + ? field_type : glsl_type::error_type; + fields[i].name = decl->identifier; + i++; + } + } + + assert(i == decl_count); + + const char *name; + if (this->name == NULL) { + static unsigned anon_count = 1; + char buf[32]; + + snprintf(buf, sizeof(buf), "#anon_struct_%04x", anon_count); + anon_count++; + + name = strdup(buf); + } else { + name = this->name; + } + + glsl_type *t = new(ctx) glsl_type(fields, decl_count, name); + + YYLTYPE loc = this->get_location(); + if (!state->symbols->add_type(name, t)) { + _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name); + } else { + /* This logic is a bit tricky. It is an error to declare a structure at + * global scope if there is also a function with the same name. + */ + if ((state->current_function == NULL) + && (state->symbols->get_function(name) != NULL)) { + _mesa_glsl_error(& loc, state, "name `%s' previously defined", name); + } else { + t->generate_constructor(state->symbols); + } + + const glsl_type **s = (const glsl_type **) + realloc(state->user_structures, + sizeof(state->user_structures[0]) * + (state->num_user_structures + 1)); + if (s != NULL) { + s[state->num_user_structures] = t; + state->user_structures = s; + state->num_user_structures++; + } + } + + /* Structure type definitions do not have r-values. + */ + return NULL; +} diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp new file mode 100644 index 0000000000..cb0852bb77 --- /dev/null +++ b/src/glsl/ast_type.cpp @@ -0,0 +1,110 @@ +/* + * 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 +#include "ast.h" +#include "symbol_table.h" + +void +ast_type_specifier::print(void) const +{ + if (type_specifier == ast_struct) { + structure->print(); + } else { + printf("%s ", type_name); + } + + if (is_array) { + printf("[ "); + + if (array_size) { + array_size->print(); + } + + printf("] "); + } +} + +ast_type_specifier::ast_type_specifier(int specifier) + : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), + is_array(false), array_size(NULL), precision(ast_precision_high) +{ + static const char *const names[] = { + "void", + "float", + "int", + "uint", + "bool", + "vec2", + "vec3", + "vec4", + "bvec2", + "bvec3", + "bvec4", + "ivec2", + "ivec3", + "ivec4", + "uvec2", + "uvec3", + "uvec4", + "mat2", + "mat2x3", + "mat2x4", + "mat3x2", + "mat3", + "mat3x4", + "mat4x2", + "mat4x3", + "mat4", + "sampler1D", + "sampler2D", + "sampler2DRect", + "sampler3D", + "samplerCube", + "sampler1DShadow", + "sampler2DShadow", + "sampler2DRectShadow", + "samplerCubeShadow", + "sampler1DArray", + "sampler2DArray", + "sampler1DArrayShadow", + "sampler2DArrayShadow", + "isampler1D", + "isampler2D", + "isampler3D", + "isamplerCube", + "isampler1DArray", + "isampler2DArray", + "usampler1D", + "usampler2D", + "usampler3D", + "usamplerCube", + "usampler1DArray", + "usampler2DArray", + + NULL, /* ast_struct */ + NULL /* ast_type_name */ + }; + + type_name = names[specifier]; +} diff --git a/src/glsl/autogen.sh b/src/glsl/autogen.sh new file mode 100755 index 0000000000..904cd6746c --- /dev/null +++ b/src/glsl/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp new file mode 100644 index 0000000000..d248388a1a --- /dev/null +++ b/src/glsl/builtin_function.cpp @@ -0,0 +1,5080 @@ +/* DO NOT MODIFY - automatically generated by generate_builtins.pl */ +/* + * 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 +#include "glsl_parser_extras.h" +#include "ir_reader.h" + +void +read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, + const char **functions, unsigned count) +{ + if (st->error) + return; + + for (unsigned i = 0; i < count; i++) { + _mesa_glsl_read_ir(st, instructions, functions[i]); + + if (st->error) { + printf("error reading builtin: %.35s ...\n", functions[i]); + return; + } + } +} + +/* 110 builtins */ + +static const char *builtins_110_abs = { + "((function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float abs (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 abs (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 abs (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 abs (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_all = { + "((function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_any = { + "((function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_asin = { + "((function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float *\n" + " (expression float -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression float sqrt\n" + " (expression float -\n" + " (constant float (1.0))\n" + " (expression float abs (var_ref x)))))\n" + " (expression float +\n" + " (constant float (1.5707288))\n" + " (expression float *\n" + " (expression float abs (var_ref x))\n" + " (expression float +\n" + " (constant float (-0.2121144))\n" + " (expression float *\n" + " (constant float (0.0742610))\n" + " (expression float abs (var_ref x))))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 *\n" + " (expression float -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec2 sqrt\n" + " (expression vec2 -\n" + " (constant float (1.0))\n" + " (expression vec2 abs (var_ref x)))))\n" + " (expression vec2 +\n" + " (constant float (1.5707288))\n" + " (expression vec2 *\n" + " (expression vec2 abs (var_ref x))\n" + " (expression vec2 +\n" + " (constant float (-0.2121144))\n" + " (expression vec2 *\n" + " (constant float (0.0742610))\n" + " (expression vec2 abs (var_ref x))))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 *\n" + " (expression vec3 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec3 sqrt\n" + " (expression vec3 -\n" + " (constant float (1.0))\n" + " (expression vec3 abs (var_ref x)))))\n" + " (expression vec3 +\n" + " (constant float (1.5707288))\n" + " (expression vec3 *\n" + " (expression vec3 abs (var_ref x))\n" + " (expression vec3 +\n" + " (constant float (-0.2121144))\n" + " (expression vec3 *\n" + " (constant float (0.0742610))\n" + " (expression vec3 abs (var_ref x))))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 *\n" + " (expression vec4 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec4 sqrt\n" + " (expression vec4 -\n" + " (constant float (1.0))\n" + " (expression vec4 abs (var_ref x)))))\n" + " (expression vec4 +\n" + " (constant float (1.5707288))\n" + " (expression vec4 *\n" + " (expression vec4 abs (var_ref x))\n" + " (expression vec4 +\n" + " (constant float (-0.2121144))\n" + " (expression vec4 *\n" + " (constant float (0.0742610))\n" + " (expression vec4 abs (var_ref x))))))))))\n" + ")\n" + "\n" + " (function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + "))\n" +}; + +static const char *builtins_110_atan = { + "((function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (call asin ((expression float *\n" + " (var_ref x)\n" + " (expression float rsq\n" + " (expression float +\n" + " (expression float *\n" + " (var_ref x)\n" + " (var_ref x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ((return (call asin ((expression vec2 *\n" + " (var_ref y_over_x)\n" + " (expression vec2 rsq\n" + " (expression vec2 +\n" + " (expression vec2 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ((return (call asin ((expression vec3 *\n" + " (var_ref y_over_x)\n" + " (expression vec3 rsq\n" + " (expression vec3 +\n" + " (expression vec3 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ((return (call asin ((expression vec4 *\n" + " (var_ref y_over_x)\n" + " (expression vec4 rsq\n" + " (expression vec4 +\n" + " (expression vec4 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ((declare () float r)\n" + " (if (expression bool >\n" + " (expression float abs (var_ref x))\n" + " (constant float (.0001)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r) (call atan ((expression float /\n" + " (var_ref y)\n" + " (var_ref x)))))\n" + " (if (expression bool <\n" + " (var_ref x)\n" + " (constant float (0.0)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r)\n" + " (expression float +\n" + " (var_ref r)\n" + " (expression float *\n" + " (expression int sign (var_ref y))\n" + " (constant float (3.1415926))))))\n" + " ()))\n" + " ())\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 r)\n" + " (if (expression bool >\n" + " (expression vec2 abs (var_ref x))\n" + " (constant float (.0001)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r) (call atan ((expression vec2 /\n" + " (var_ref y)\n" + " (var_ref x)))))\n" + " (if (expression bool <\n" + " (var_ref x)\n" + " (constant float (0.0)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r)\n" + " (expression vec2 +\n" + " (var_ref r)\n" + " (expression vec2 *\n" + " (expression int sign (var_ref y))\n" + " (constant float (3.1415926))))))\n" + " ()))\n" + " ())\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 r)\n" + " (if (expression bool >\n" + " (expression vec3 abs (var_ref x))\n" + " (constant float (.0001)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r) (call atan ((expression vec3 /\n" + " (var_ref y)\n" + " (var_ref x)))))\n" + " (if (expression bool <\n" + " (var_ref x)\n" + " (constant float (0.0)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r)\n" + " (expression vec3 +\n" + " (var_ref r)\n" + " (expression vec3 *\n" + " (expression int sign (var_ref y))\n" + " (constant float (3.1415926))))))\n" + " ()))\n" + " ())\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 r)\n" + " (if (expression bool >\n" + " (expression vec4 abs (var_ref x))\n" + " (constant float (.0001)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r) (call atan ((expression vec4 /\n" + " (var_ref y)\n" + " (var_ref x)))))\n" + " (if (expression bool <\n" + " (var_ref x)\n" + " (constant float (0.0)))\n" + " ((assign (constant bool (1))\n" + " (var_ref r)\n" + " (expression vec4 +\n" + " (var_ref r)\n" + " (expression vec4 *\n" + " (expression int sign (var_ref y))\n" + " (constant float (3.1415926))))))\n" + " ()))\n" + " ())\n" + " (return (var_ref r))))\n" + "\n" + "))\n" +}; + +static const char *builtins_110_ceil = { + "((function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float ceil (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 ceil (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_clamp = { + "((function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((declare () vec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((declare () vec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((declare () vec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result)) (expression vec4 max (expression vec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_110_cos = { + "((function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float cos (var_ref angle)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 cos (var_ref angle)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 cos (var_ref angle)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 cos (var_ref angle)))))\n" + "))\n" +}; + +static const char *builtins_110_cross = { + "((function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1)))\n" + " (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1)))\n" + " (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1)))\n" + " (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0)))))\n" + " (return (var_ref t))))\n" + "))\n" +}; + +static const char *builtins_110_degrees = { + "((function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" + "))\n" +}; + +static const char *builtins_110_distance = { + "((function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ((declare () float p)\n" + " (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ((declare () vec2 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ((declare () vec3 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ((declare () vec4 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "))\n" +}; + +static const char *builtins_110_dot = { + "((function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_equal = { + "((function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_exp = { + "((function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_exp2 = { + "((function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp2 (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_faceforward = { + "((function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression float neg (var_ref N)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec2 neg (var_ref N)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec3 neg (var_ref N)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec4 neg (var_ref N)))))))\n" + "))\n" +}; + +static const char *builtins_110_floor = { + "((function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float floor (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 floor (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 floor (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 floor (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_fract = { + "((function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float - (var_ref x) (expression float floor (var_ref x))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x)))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float - (swiz w (var_ref x)) (expression float floor (swiz w (var_ref x)))))\n" + " (return (var_ref t))))\n" + "))\n" + "\n" +}; + +static const char *builtins_110_greaterThan = { + "((function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_greaterThanEqual = { + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_inversesqrt = { + "((function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float rsq (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 rsq (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_length = { + "((function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_lessThan = { + "((function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_lessThanEqual = { + "((function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_log = { + "((function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_log2 = { + "((function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log2 (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_matrixCompMult = { + "((function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ((declare () mat2 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ((declare () mat3 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ((declare () mat4 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" + "(return (var_ref z))))\n" + "))\n" + "\n" +}; + +static const char *builtins_110_max = { + "((function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression float max (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_110_min = { + "((function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression float min (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_110_mix = { + "((function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "))\n" +}; + +static const char *builtins_110_mod = { + "((function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((declare () vec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression float % (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_110_noise_fake = { + "((function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant float (0)))))\n" + " )\n" + "\n" + " (function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec2 (0 0)))))\n" + " )\n" + "\n" + " (function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " )\n" + "\n" + " (function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " )\n" + ")\n" +}; + +static const char *builtins_110_normalize = { + "((function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "))\n" +}; + +static const char *builtins_110_not = { + "((function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bvec2 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bvec3 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bvec4 ! (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_notEqual = { + "((function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_pow = { + "((function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_radians = { + "((function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" + "))\n" +}; + +static const char *builtins_110_reflect = { + "((function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float i)\n" + " (declare (in) float n))\n" + " ((return (expression float -\n" + " (var_ref i)\n" + " (expression float *\n" + " (constant float (2.0))\n" + " (expression float *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n))\n" + " ((return (expression vec2 -\n" + " (var_ref i)\n" + " (expression vec2 *\n" + " (constant float (2.0))\n" + " (expression vec2 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n))\n" + " ((return (expression vec3 -\n" + " (var_ref i)\n" + " (expression vec3 *\n" + " (constant float (2.0))\n" + " (expression vec3 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n))\n" + " ((return (expression vec4 -\n" + " (var_ref i)\n" + " (expression vec4 *\n" + " (constant float (2.0))\n" + " (expression vec4 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + "))\n" +}; + +static const char *builtins_110_refract = { + "((function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float i)\n" + " (declare (in) float n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant float (0.0))))\n" + " ((return (expression float -\n" + " (expression float * (var_ref eta) (var_ref i))\n" + " (expression float *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec2 (0.0 0.0))))\n" + " ((return (expression vec2 -\n" + " (expression vec2 * (var_ref eta) (var_ref i))\n" + " (expression vec2 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec3 (0.0 0.0))))\n" + " ((return (expression vec3 -\n" + " (expression vec3 * (var_ref eta) (var_ref i))\n" + " (expression vec3 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec4 (0.0 0.0))))\n" + " ((return (expression vec4 -\n" + " (expression vec4 * (var_ref eta) (var_ref i))\n" + " (expression vec4 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + "))\n" +}; + +static const char *builtins_110_sign = { + "((function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float sign (var_ref x)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float sign (swiz w (var_ref x))))\n" + " (return (var_ref t))))\n" + "))\n" + "\n" +}; + +static const char *builtins_110_sin = { + "((function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float sin (var_ref angle)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 sin (var_ref angle)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 sin (var_ref angle)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 sin (var_ref angle)))))\n" + "))\n" +}; + +static const char *builtins_110_smoothstep = { + "((function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ((declare () float t)\n" + "\n" + " (assign (constant bool (1)) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (declare () vec2 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (declare () vec3 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (declare () vec4 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz w (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (declare () vec2 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (declare () vec3 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (declare () vec4 retval)\n" + "\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz w (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz w (var_ref x)) (swiz w (var_ref edge0))) (expression float - (swiz w (var_ref edge1)) (swiz w (var_ref edge0))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + "))\n" + "\n" +}; + +static const char *builtins_110_sqrt = { + "((function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 sqrt (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_step = { + "((function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "))\n" + "\n" +}; + +static const char *builtins_110_tan = { + "((function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" + "))\n" +}; + +static const char *builtins_110_textures = { + "((function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + ")\n" + " (function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + ")\n" + " (function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + ")\n" + " (function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + ")\n" + " (function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + "\n" + ")\n" + " (function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + ")\n" + " (function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + "\n" + ")\n" + " (function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_110 [] = { + builtins_110_abs, + builtins_110_all, + builtins_110_any, + builtins_110_asin, + builtins_110_atan, + builtins_110_ceil, + builtins_110_clamp, + builtins_110_cos, + builtins_110_cross, + builtins_110_degrees, + builtins_110_distance, + builtins_110_dot, + builtins_110_equal, + builtins_110_exp, + builtins_110_exp2, + builtins_110_faceforward, + builtins_110_floor, + builtins_110_fract, + builtins_110_greaterThan, + builtins_110_greaterThanEqual, + builtins_110_inversesqrt, + builtins_110_length, + builtins_110_lessThan, + builtins_110_lessThanEqual, + builtins_110_log, + builtins_110_log2, + builtins_110_matrixCompMult, + builtins_110_max, + builtins_110_min, + builtins_110_mix, + builtins_110_mod, + builtins_110_noise_fake, + builtins_110_normalize, + builtins_110_not, + builtins_110_notEqual, + builtins_110_pow, + builtins_110_radians, + builtins_110_reflect, + builtins_110_refract, + builtins_110_sign, + builtins_110_sin, + builtins_110_smoothstep, + builtins_110_sqrt, + builtins_110_step, + builtins_110_tan, + builtins_110_textures, +}; + +/* 110_fs builtins */ + +static const char *builtins_110_fs_derivatives = { + "((function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float dFdx (var_ref p)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdx (var_ref p)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdx (var_ref p)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdx (var_ref p)))))\n" + " )\n" + "\n" + " (function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float dFdy (var_ref p)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdy (var_ref p)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdy (var_ref p)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdy (var_ref p)))))\n" + " )\n" + "\n" + " (function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float +\n" + " (expression float abs (expression float dFdx (var_ref p)))\n" + " (expression float abs (expression float dFdy (var_ref p)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 +\n" + " (expression vec2 abs (expression vec2 dFdx (var_ref p)))\n" + " (expression vec2 abs (expression vec2 dFdy (var_ref p)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 +\n" + " (expression vec3 abs (expression vec3 dFdx (var_ref p)))\n" + " (expression vec3 abs (expression vec3 dFdy (var_ref p)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 +\n" + " (expression vec4 abs (expression vec4 dFdx (var_ref p)))\n" + " (expression vec4 abs (expression vec4 dFdy (var_ref p)))))))\n" + "))\n" +}; + +static const char *builtins_110_fs_textures = { + "((function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + ")\n" + " (function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + ")\n" + " (function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + ")\n" + " (function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_110_fs [] = { + builtins_110_fs_derivatives, + builtins_110_fs_textures, +}; + +/* 110_vs builtins */ + +static const char *builtins_110_vs_ftransform = { + "((function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ((return (expression vec4 *\n" + " (var_ref gl_ModelViewProjectionMatrix)\n" + " (var_ref gl_Vertex)))))\n" + "))\n" +}; + +static const char *functions_for_110_vs [] = { + builtins_110_vs_ftransform, +}; + +/* 120 builtins */ + +static const char *builtins_120_matrixCompMult = { + "((function matrixCompMult\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ((declare () mat2x3 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ((declare () mat3x2 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ((declare () mat2x4 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ((declare () mat4x2 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ((declare () mat3x4 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ((declare () mat4x3 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" + "(return (var_ref z))))\n" + "))\n" +}; + +static const char *builtins_120_outerProduct = { + "((function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat2x3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat2x4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat3x2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat3x4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat4x2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat4x3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u)))) \n" + "(return (var_ref m))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u)))) \n" + "(return (var_ref m))))\n" + "))\n" + "\n" +}; + +static const char *builtins_120_transpose = { + "((function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ((declare () mat2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ((declare () mat3x2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ((declare () mat4x2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ((declare () mat2x3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ((declare () mat3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ((declare () mat4x3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ((declare () mat2x4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ((declare () mat3x4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ((declare () mat4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" + ")\n" + "\n" + ")\n" + "\n" +}; + +static const char *functions_for_120 [] = { + builtins_120_matrixCompMult, + builtins_120_outerProduct, + builtins_120_transpose, +}; + +/* 130 builtins */ + +static const char *builtins_130_clamp = { + "((function clamp\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1)\n" + " (declare (in) ivec2 arg2))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1)\n" + " (declare (in) ivec3 arg2))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1)\n" + " (declare (in) ivec4 arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((declare () ivec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((declare () ivec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((declare () ivec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1)\n" + " (declare (in) uvec2 arg2))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1)\n" + " (declare (in) uvec3 arg2))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1)\n" + " (declare (in) uvec4 arg2))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((declare () uvec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((declare () uvec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((declare () uvec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_130_cosh = { + "((function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" +}; + +static const char *builtins_130_equal = { + "((function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_greaterThan = { + "((function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_greaterThanEqual = { + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_lessThan = { + "((function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_lessThanEqual = { + "((function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_max = { + "((function max\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression int max (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression uint max (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_130_min = { + "((function min\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((declare () ivec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression int min (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec2 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec3 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((declare () uvec4 result)\n" + " (assign (constant bool (1)) (swiz x (var_ref result))\n" + " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz y (var_ref result))\n" + " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz z (var_ref result))\n" + " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n" + " (assign (constant bool (1)) (swiz w (var_ref result))\n" + " (expression uint min (swiz w (var_ref arg0)) (var_ref arg1)))\n" + " (return (var_ref result))))\n" + "))\n" +}; + +static const char *builtins_130_notEqual = { + "((function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_sign = { + "((function sign\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ((return (expression int / (var_ref x) (expression int abs (var_ref x))))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ((declare () ivec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ((declare () ivec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ((declare () ivec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression int sign (swiz w (var_ref x))))\n" + " (return (var_ref t))))\n" + "))\n" + "\n" +}; + +static const char *builtins_130_sinh = { + "((function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" +}; + +static const char *builtins_130_tanh = { + "((function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float /\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 /\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 /\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 /\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" +}; + +static const char *builtins_130_texelFetch = { + "((function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_texture = { + "((function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_textureGrad = { + "((function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + ")\n" + ")\n" +}; + +static const char *builtins_130_textureLod = { + "((function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_textureProj = { + "((function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_textureProjGrad = { + "((function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_textureProjLod = { + "((function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_130 [] = { + builtins_130_clamp, + builtins_130_cosh, + builtins_130_equal, + builtins_130_greaterThan, + builtins_130_greaterThanEqual, + builtins_130_lessThan, + builtins_130_lessThanEqual, + builtins_130_max, + builtins_130_min, + builtins_130_notEqual, + builtins_130_sign, + builtins_130_sinh, + builtins_130_tanh, + builtins_130_texelFetch, + builtins_130_texture, + builtins_130_textureGrad, + builtins_130_textureLod, + builtins_130_textureProj, + builtins_130_textureProjGrad, + builtins_130_textureProjLod, +}; + +/* 130_fs builtins */ + +static const char *builtins_130_fs_texture = { + "((function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" +}; + +static const char *builtins_130_fs_textureProj = { + "((function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_130_fs [] = { + builtins_130_fs_texture, + builtins_130_fs_textureProj, +}; + +/* ARB_texture_rectangle builtins */ + +static const char *builtins_ARB_texture_rectangle_textures = { + "((function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_ARB_texture_rectangle [] = { + builtins_ARB_texture_rectangle_textures, +}; + +/* EXT_texture_array builtins */ + +static const char *builtins_EXT_texture_array_textures = { + "((function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function texture1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + ")\n" + " (function texture2DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + ")\n" + " (function shadow1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + ")\n" + " (function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_EXT_texture_array [] = { + builtins_EXT_texture_array_textures, +}; + +/* EXT_texture_array_fs builtins */ + +static const char *builtins_EXT_texture_array_fs_textures = { + "((function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + ")\n" + " (function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" +}; + +static const char *functions_for_EXT_texture_array_fs [] = { + builtins_EXT_texture_array_fs_textures, +}; + +void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (state->language_version >= 110) + read_builtins(state, instructions, + functions_for_110, + sizeof(functions_for_110) / sizeof(const char *)); + + if (state->target == fragment_shader && state->language_version >= 110) + read_builtins(state, instructions, + functions_for_110_fs, + sizeof(functions_for_110_fs) / sizeof(const char *)); + + if (state->target == vertex_shader && state->language_version >= 110) + read_builtins(state, instructions, + functions_for_110_vs, + sizeof(functions_for_110_vs) / sizeof(const char *)); + + if (state->language_version >= 120) + read_builtins(state, instructions, + functions_for_120, + sizeof(functions_for_120) / sizeof(const char *)); + + if (state->language_version >= 130) + read_builtins(state, instructions, + functions_for_130, + sizeof(functions_for_130) / sizeof(const char *)); + + if (state->target == fragment_shader && state->language_version >= 130) + read_builtins(state, instructions, + functions_for_130_fs, + sizeof(functions_for_130_fs) / sizeof(const char *)); + + if (state->ARB_texture_rectangle_enable) + read_builtins(state, instructions, + functions_for_ARB_texture_rectangle, + sizeof(functions_for_ARB_texture_rectangle) / sizeof(const char *)); + + if (state->EXT_texture_array_enable) + read_builtins(state, instructions, + functions_for_EXT_texture_array, + sizeof(functions_for_EXT_texture_array) / sizeof(const char *)); + + if (state->target == fragment_shader && state->EXT_texture_array_enable) + read_builtins(state, instructions, + functions_for_EXT_texture_array_fs, + sizeof(functions_for_EXT_texture_array_fs) / sizeof(const char *)); + +} diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h new file mode 100644 index 0000000000..48202f5645 --- /dev/null +++ b/src/glsl/builtin_types.h @@ -0,0 +1,268 @@ +/* + * 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. + */ + +#ifndef Elements +#define Elements(x) (sizeof(x)/sizeof(*(x))) +#endif + +static const struct glsl_type _error_type = + glsl_type(GLSL_TYPE_ERROR, 0, 0, ""); + +static const struct glsl_type void_type = + glsl_type(GLSL_TYPE_VOID, 0, 0, "void"); + +const glsl_type *const glsl_type::error_type = & _error_type; + +/** \name Core built-in types + * + * These types exist in all versions of GLSL. + */ +/*@{*/ + +static const struct glsl_type builtin_core_types[] = { + glsl_type( GLSL_TYPE_BOOL, 1, 1, "bool"), + glsl_type( GLSL_TYPE_BOOL, 2, 1, "bvec2"), + glsl_type( GLSL_TYPE_BOOL, 3, 1, "bvec3"), + glsl_type( GLSL_TYPE_BOOL, 4, 1, "bvec4"), + glsl_type( GLSL_TYPE_INT, 1, 1, "int"), + glsl_type( GLSL_TYPE_INT, 2, 1, "ivec2"), + glsl_type( GLSL_TYPE_INT, 3, 1, "ivec3"), + glsl_type( GLSL_TYPE_INT, 4, 1, "ivec4"), + glsl_type( GLSL_TYPE_FLOAT, 1, 1, "float"), + glsl_type( GLSL_TYPE_FLOAT, 2, 1, "vec2"), + glsl_type( GLSL_TYPE_FLOAT, 3, 1, "vec3"), + glsl_type( GLSL_TYPE_FLOAT, 4, 1, "vec4"), + glsl_type( GLSL_TYPE_FLOAT, 2, 2, "mat2"), + glsl_type( GLSL_TYPE_FLOAT, 3, 3, "mat3"), + glsl_type( GLSL_TYPE_FLOAT, 4, 4, "mat4"), + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT, "sampler1D"), + glsl_type( GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT, "sampler1DShadow"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT, "sampler2D"), + glsl_type( GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT, "sampler2DShadow"), + glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT, "sampler3D"), + glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT, "samplerCube"), +}; + +const glsl_type *const glsl_type::bool_type = & builtin_core_types[0]; +const glsl_type *const glsl_type::int_type = & builtin_core_types[4]; +const glsl_type *const glsl_type::ivec4_type = & builtin_core_types[7]; +const glsl_type *const glsl_type::float_type = & builtin_core_types[8]; +const glsl_type *const glsl_type::vec2_type = & builtin_core_types[9]; +const glsl_type *const glsl_type::vec3_type = & builtin_core_types[10]; +const glsl_type *const glsl_type::vec4_type = & builtin_core_types[11]; +const glsl_type *const glsl_type::mat2_type = & builtin_core_types[12]; +const glsl_type *const glsl_type::mat3_type = & builtin_core_types[13]; +const glsl_type *const glsl_type::mat4_type = & builtin_core_types[14]; +/*@}*/ + +/** \name GLSL structures that have not been deprecated. + */ +/*@{*/ + +static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = { + { glsl_type::float_type, "near" }, + { glsl_type::float_type, "far" }, + { glsl_type::float_type, "diff" }, +}; + +static const struct glsl_type builtin_structure_types[] = { + glsl_type(gl_DepthRangeParameters_fields, + Elements(gl_DepthRangeParameters_fields), + "gl_DepthRangeParameters"), +}; +/*@}*/ + +/** \name GLSL 1.00 / 1.10 structures that are deprecated in GLSL 1.30 + */ +/*@{*/ + +static const struct glsl_struct_field gl_PointParameters_fields[] = { + { glsl_type::float_type, "size" }, + { glsl_type::float_type, "sizeMin" }, + { glsl_type::float_type, "sizeMax" }, + { glsl_type::float_type, "fadeThresholdSize" }, + { glsl_type::float_type, "distanceConstantAttenuation" }, + { glsl_type::float_type, "distanceLinearAttenuation" }, + { glsl_type::float_type, "distanceQuadraticAttenuation" }, +}; + +static const struct glsl_struct_field gl_MaterialParameters_fields[] = { + { glsl_type::vec4_type, "emission" }, + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, + { glsl_type::float_type, "shininess" }, +}; + +static const struct glsl_struct_field gl_LightSourceParameters_fields[] = { + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, + { glsl_type::vec4_type, "position" }, + { glsl_type::vec4_type, "halfVector" }, + { glsl_type::vec3_type, "spotDirection" }, + { glsl_type::float_type, "spotExponent" }, + { glsl_type::float_type, "spotCutoff" }, + { glsl_type::float_type, "spotCosCutoff" }, + { glsl_type::float_type, "constantAttenuation" }, + { glsl_type::float_type, "linearAttenuation" }, + { glsl_type::float_type, "quadraticAttenuation" }, +}; + +static const struct glsl_struct_field gl_LightModelParameters_fields[] = { + { glsl_type::vec4_type, "ambient" }, +}; + +static const struct glsl_struct_field gl_LightModelProducts_fields[] = { + { glsl_type::vec4_type, "sceneColor" }, +}; + +static const struct glsl_struct_field gl_LightProducts_fields[] = { + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, +}; + +static const struct glsl_struct_field gl_FogParameters_fields[] = { + { glsl_type::vec4_type, "color" }, + { glsl_type::float_type, "density" }, + { glsl_type::float_type, "start" }, + { glsl_type::float_type, "end" }, + { glsl_type::float_type, "scale" }, +}; + +static const struct glsl_type builtin_110_deprecated_structure_types[] = { + glsl_type(gl_PointParameters_fields, + Elements(gl_PointParameters_fields), + "gl_PointParameters"), + glsl_type(gl_MaterialParameters_fields, + Elements(gl_MaterialParameters_fields), + "gl_MaterialParameters"), + glsl_type(gl_LightSourceParameters_fields, + Elements(gl_LightSourceParameters_fields), + "gl_LightSourceParameters"), + glsl_type(gl_LightModelParameters_fields, + Elements(gl_LightModelParameters_fields), + "gl_LightModelParameters"), + glsl_type(gl_LightModelProducts_fields, + Elements(gl_LightModelProducts_fields), + "gl_LightModelProducts"), + glsl_type(gl_LightProducts_fields, + Elements(gl_LightProducts_fields), + "gl_LightProducts"), + glsl_type(gl_FogParameters_fields, + Elements(gl_FogParameters_fields), + "gl_FogParameters"), +}; +/*@}*/ + +/** \name Types added in GLSL 1.20 + */ +/*@{*/ + +static const struct glsl_type builtin_120_types[] = { + glsl_type( GLSL_TYPE_FLOAT, 3, 2, "mat2x3"), + glsl_type( GLSL_TYPE_FLOAT, 4, 2, "mat2x4"), + glsl_type( GLSL_TYPE_FLOAT, 2, 3, "mat3x2"), + glsl_type( GLSL_TYPE_FLOAT, 4, 3, "mat3x4"), + glsl_type( GLSL_TYPE_FLOAT, 2, 4, "mat4x2"), + glsl_type( GLSL_TYPE_FLOAT, 3, 4, "mat4x3"), +}; +const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0]; +const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1]; +const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2]; +const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3]; +const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4]; +const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5]; +/*@}*/ + +/** \name Types added in GLSL 1.30 + */ +/*@{*/ + +static const struct glsl_type builtin_130_types[] = { + glsl_type( GLSL_TYPE_UINT, 1, 1, "uint"), + glsl_type( GLSL_TYPE_UINT, 2, 1, "uvec2"), + glsl_type( GLSL_TYPE_UINT, 3, 1, "uvec3"), + glsl_type( GLSL_TYPE_UINT, 4, 1, "uvec4"), + + /* 1D and 2D texture arrays */ + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"), + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"), + glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"), + glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), + + /* cube shadow samplers */ + glsl_type(GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"), + + /* signed and unsigned integer samplers */ + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"), + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"), + glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"), + glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"), + glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"), + glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"), +}; + +const glsl_type *const glsl_type::uint_type = & builtin_130_types[0]; +const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3]; +/*@}*/ + +/** \name Sampler types added by GL_ARB_texture_rectangle + */ +/*@{*/ + +static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { + glsl_type(GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"), + glsl_type(GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"), +}; +/*@}*/ + +/** \name Sampler types added by GL_EXT_texture_array + */ +/*@{*/ + +static const struct glsl_type builtin_EXT_texture_array_types[] = { + glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), +}; +/*@}*/ + +/** \name Sampler types added by GL_EXT_texture_buffer_object + */ +/*@{*/ + +static const struct glsl_type builtin_EXT_texture_buffer_object_types[] = { + glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"), + glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"), + glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"), +}; +/*@}*/ diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h new file mode 100644 index 0000000000..77f2fe5502 --- /dev/null +++ b/src/glsl/builtin_variables.h @@ -0,0 +1,93 @@ +/* + * 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 "main/mtypes.h" + +struct builtin_variable { + enum ir_variable_mode mode; + int slot; + const char *type; + const char *name; +}; + +static const builtin_variable builtin_core_vs_variables[] = { + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, + { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, +}; + +static const builtin_variable builtin_core_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, + { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, +}; + +static const builtin_variable builtin_110_deprecated_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, + { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_110_deprecated_vs_variables[] = { + { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, + { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, + { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, + { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, + { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, + { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, + { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, + { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, + { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, + { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, + { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, + { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_ClipVertex" }, + { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_130_vs_variables[] = { + { ir_var_in, -1, "int", "gl_VertexID" }, +}; + +static const builtin_variable builtin_110_deprecated_uniforms[] = { + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, + { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "float", "gl_NormalScale" }, +}; + diff --git a/src/glsl/builtins/110/abs b/src/glsl/builtins/110/abs new file mode 100644 index 0000000000..904845307c --- /dev/null +++ b/src/glsl/builtins/110/abs @@ -0,0 +1,21 @@ +((function abs + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float abs (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 abs (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 abs (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 abs (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/all b/src/glsl/builtins/110/all new file mode 100644 index 0000000000..2cac0dfb68 --- /dev/null +++ b/src/glsl/builtins/110/all @@ -0,0 +1,16 @@ +((function all + (signature bool + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/110/any b/src/glsl/builtins/110/any new file mode 100644 index 0000000000..f10e8a7b47 --- /dev/null +++ b/src/glsl/builtins/110/any @@ -0,0 +1,16 @@ +((function any + (signature bool + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/110/asin b/src/glsl/builtins/110/asin new file mode 100644 index 0000000000..fe93337bff --- /dev/null +++ b/src/glsl/builtins/110/asin @@ -0,0 +1,112 @@ +((function asin + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * + (expression float - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression float sqrt + (expression float - + (constant float (1.0)) + (expression float abs (var_ref x))))) + (expression float + + (constant float (1.5707288)) + (expression float * + (expression float abs (var_ref x)) + (expression float + + (constant float (-0.2121144)) + (expression float * + (constant float (0.0742610)) + (expression float abs (var_ref x)))))))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * + (expression float - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec2 sqrt + (expression vec2 - + (constant float (1.0)) + (expression vec2 abs (var_ref x))))) + (expression vec2 + + (constant float (1.5707288)) + (expression vec2 * + (expression vec2 abs (var_ref x)) + (expression vec2 + + (constant float (-0.2121144)) + (expression vec2 * + (constant float (0.0742610)) + (expression vec2 abs (var_ref x)))))))))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * + (expression vec3 - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec3 sqrt + (expression vec3 - + (constant float (1.0)) + (expression vec3 abs (var_ref x))))) + (expression vec3 + + (constant float (1.5707288)) + (expression vec3 * + (expression vec3 abs (var_ref x)) + (expression vec3 + + (constant float (-0.2121144)) + (expression vec3 * + (constant float (0.0742610)) + (expression vec3 abs (var_ref x)))))))))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * + (expression vec4 - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec4 sqrt + (expression vec4 - + (constant float (1.0)) + (expression vec4 abs (var_ref x))))) + (expression vec4 + + (constant float (1.5707288)) + (expression vec4 * + (expression vec4 abs (var_ref x)) + (expression vec4 + + (constant float (-0.2121144)) + (expression vec4 * + (constant float (0.0742610)) + (expression vec4 abs (var_ref x)))))))))) +) + + (function acos + (signature float + (parameters + (declare (in) float x)) + ((return (expression float - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) +)) diff --git a/src/glsl/builtins/110/atan b/src/glsl/builtins/110/atan new file mode 100644 index 0000000000..e5542350b5 --- /dev/null +++ b/src/glsl/builtins/110/atan @@ -0,0 +1,154 @@ +((function atan + (signature float + (parameters + (declare (in) float x)) + ((return (call asin ((expression float * + (var_ref x) + (expression float rsq + (expression float + + (expression float * + (var_ref x) + (var_ref x)) + (constant float (1.0)))))))))) + + (signature vec2 + (parameters + (declare (in) vec2 y_over_x)) + ((return (call asin ((expression vec2 * + (var_ref y_over_x) + (expression vec2 rsq + (expression vec2 + + (expression vec2 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature vec3 + (parameters + (declare (in) vec3 y_over_x)) + ((return (call asin ((expression vec3 * + (var_ref y_over_x) + (expression vec3 rsq + (expression vec3 + + (expression vec3 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature vec4 + (parameters + (declare (in) vec4 y_over_x)) + ((return (call asin ((expression vec4 * + (var_ref y_over_x) + (expression vec4 rsq + (expression vec4 + + (expression vec4 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature float + (parameters + (declare (in) float y) + (declare (in) float x)) + ((declare () float r) + (if (expression bool > + (expression float abs (var_ref x)) + (constant float (.0001))) + ((assign (constant bool (1)) + (var_ref r) (call atan ((expression float / + (var_ref y) + (var_ref x))))) + (if (expression bool < + (var_ref x) + (constant float (0.0))) + ((assign (constant bool (1)) + (var_ref r) + (expression float + + (var_ref r) + (expression float * + (expression int sign (var_ref y)) + (constant float (3.1415926)))))) + ())) + ()) + (return (var_ref r)))) + + (signature vec2 + (parameters + (declare (in) vec2 y) + (declare (in) vec2 x)) + ((declare () vec2 r) + (if (expression bool > + (expression vec2 abs (var_ref x)) + (constant float (.0001))) + ((assign (constant bool (1)) + (var_ref r) (call atan ((expression vec2 / + (var_ref y) + (var_ref x))))) + (if (expression bool < + (var_ref x) + (constant float (0.0))) + ((assign (constant bool (1)) + (var_ref r) + (expression vec2 + + (var_ref r) + (expression vec2 * + (expression int sign (var_ref y)) + (constant float (3.1415926)))))) + ())) + ()) + (return (var_ref r)))) + + (signature vec3 + (parameters + (declare (in) vec3 y) + (declare (in) vec3 x)) + ((declare () vec3 r) + (if (expression bool > + (expression vec3 abs (var_ref x)) + (constant float (.0001))) + ((assign (constant bool (1)) + (var_ref r) (call atan ((expression vec3 / + (var_ref y) + (var_ref x))))) + (if (expression bool < + (var_ref x) + (constant float (0.0))) + ((assign (constant bool (1)) + (var_ref r) + (expression vec3 + + (var_ref r) + (expression vec3 * + (expression int sign (var_ref y)) + (constant float (3.1415926)))))) + ())) + ()) + (return (var_ref r)))) + + (signature vec4 + (parameters + (declare (in) vec4 y) + (declare (in) vec4 x)) + ((declare () vec4 r) + (if (expression bool > + (expression vec4 abs (var_ref x)) + (constant float (.0001))) + ((assign (constant bool (1)) + (var_ref r) (call atan ((expression vec4 / + (var_ref y) + (var_ref x))))) + (if (expression bool < + (var_ref x) + (constant float (0.0))) + ((assign (constant bool (1)) + (var_ref r) + (expression vec4 + + (var_ref r) + (expression vec4 * + (expression int sign (var_ref y)) + (constant float (3.1415926)))))) + ())) + ()) + (return (var_ref r)))) + +)) diff --git a/src/glsl/builtins/110/ceil b/src/glsl/builtins/110/ceil new file mode 100644 index 0000000000..a26a775049 --- /dev/null +++ b/src/glsl/builtins/110/ceil @@ -0,0 +1,21 @@ +((function ceil + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float ceil (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 ceil (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 ceil (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 ceil (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/clamp b/src/glsl/builtins/110/clamp new file mode 100644 index 0000000000..94c8e5ed16 --- /dev/null +++ b/src/glsl/builtins/110/clamp @@ -0,0 +1,62 @@ +((function clamp + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) vec2 arg2)) + ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) vec3 arg2)) + ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) vec4 arg2)) + ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((declare () vec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((declare () vec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((declare () vec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) (expression vec4 max (expression vec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/110/cos b/src/glsl/builtins/110/cos new file mode 100644 index 0000000000..88f266eccb --- /dev/null +++ b/src/glsl/builtins/110/cos @@ -0,0 +1,21 @@ +((function cos + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float cos (var_ref angle))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression vec2 cos (var_ref angle))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression vec3 cos (var_ref angle))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression vec4 cos (var_ref angle))))) +)) diff --git a/src/glsl/builtins/110/cross b/src/glsl/builtins/110/cross new file mode 100644 index 0000000000..deb2f952bf --- /dev/null +++ b/src/glsl/builtins/110/cross @@ -0,0 +1,17 @@ +((function cross + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1))) + (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0))))) + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1))) + (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0))))) + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1))) + (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0))))) + (return (var_ref t)))) +)) diff --git a/src/glsl/builtins/110/degrees b/src/glsl/builtins/110/degrees new file mode 100644 index 0000000000..dc0d7b9e20 --- /dev/null +++ b/src/glsl/builtins/110/degrees @@ -0,0 +1,21 @@ +((function degrees + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (constant float (57.295780)))))) +)) diff --git a/src/glsl/builtins/110/distance b/src/glsl/builtins/110/distance new file mode 100644 index 0000000000..a2309c484f --- /dev/null +++ b/src/glsl/builtins/110/distance @@ -0,0 +1,33 @@ +((function distance + (signature float + (parameters + (declare (in) float p0) + (declare (in) float p1)) + ((declare () float p) + (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec2 p0) + (declare (in) vec2 p1)) + ((declare () vec2 p) + (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec3 p0) + (declare (in) vec3 p1)) + ((declare () vec3 p) + (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec4 p0) + (declare (in) vec4 p1)) + ((declare () vec4 p) + (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) +)) diff --git a/src/glsl/builtins/110/dot b/src/glsl/builtins/110/dot new file mode 100644 index 0000000000..a91a6d2c56 --- /dev/null +++ b/src/glsl/builtins/110/dot @@ -0,0 +1,25 @@ +((function dot + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/110/equal b/src/glsl/builtins/110/equal new file mode 100644 index 0000000000..ae7ddc53bd --- /dev/null +++ b/src/glsl/builtins/110/equal @@ -0,0 +1,61 @@ +((function equal + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/exp b/src/glsl/builtins/110/exp new file mode 100644 index 0000000000..a73bd6a7f8 --- /dev/null +++ b/src/glsl/builtins/110/exp @@ -0,0 +1,21 @@ +((function exp + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float exp (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 exp (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 exp (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 exp (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/exp2 b/src/glsl/builtins/110/exp2 new file mode 100644 index 0000000000..a842d3fe65 --- /dev/null +++ b/src/glsl/builtins/110/exp2 @@ -0,0 +1,21 @@ +((function exp2 + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float exp2 (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 exp2 (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 exp2 (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 exp2 (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/faceforward b/src/glsl/builtins/110/faceforward new file mode 100644 index 0000000000..d170397238 --- /dev/null +++ b/src/glsl/builtins/110/faceforward @@ -0,0 +1,37 @@ +((function faceforward + (signature float + (parameters + (declare (in) float N) + (declare (in) float I) + (declare (in) float Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression float neg (var_ref N))))))) + + (signature vec2 + (parameters + (declare (in) vec2 N) + (declare (in) vec2 I) + (declare (in) vec2 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec2 neg (var_ref N))))))) + + (signature vec3 + (parameters + (declare (in) vec3 N) + (declare (in) vec3 I) + (declare (in) vec3 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec3 neg (var_ref N))))))) + + (signature vec4 + (parameters + (declare (in) vec4 N) + (declare (in) vec4 I) + (declare (in) vec4 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec4 neg (var_ref N))))))) +)) diff --git a/src/glsl/builtins/110/floor b/src/glsl/builtins/110/floor new file mode 100644 index 0000000000..8dd8052799 --- /dev/null +++ b/src/glsl/builtins/110/floor @@ -0,0 +1,21 @@ +((function floor + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float floor (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 floor (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 floor (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 floor (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/fract b/src/glsl/builtins/110/fract new file mode 100644 index 0000000000..3995bfaf3f --- /dev/null +++ b/src/glsl/builtins/110/fract @@ -0,0 +1,34 @@ +((function fract + (signature float + (parameters + (declare (in) float x)) + ((return (expression float - (var_ref x) (expression float floor (var_ref x)))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x))))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x))))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float - (swiz w (var_ref x)) (expression float floor (swiz w (var_ref x))))) + (return (var_ref t)))) +)) + diff --git a/src/glsl/builtins/110/greaterThan b/src/glsl/builtins/110/greaterThan new file mode 100644 index 0000000000..ae03030e49 --- /dev/null +++ b/src/glsl/builtins/110/greaterThan @@ -0,0 +1,61 @@ +((function greaterThan + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/greaterThanEqual b/src/glsl/builtins/110/greaterThanEqual new file mode 100644 index 0000000000..204d5fd143 --- /dev/null +++ b/src/glsl/builtins/110/greaterThanEqual @@ -0,0 +1,61 @@ +((function greaterThanEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/inversesqrt b/src/glsl/builtins/110/inversesqrt new file mode 100644 index 0000000000..5b66d2b369 --- /dev/null +++ b/src/glsl/builtins/110/inversesqrt @@ -0,0 +1,21 @@ +((function inversesqrt + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float rsq (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 rsq (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 rsq (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 rsq (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/length b/src/glsl/builtins/110/length new file mode 100644 index 0000000000..89ff7f3ef1 --- /dev/null +++ b/src/glsl/builtins/110/length @@ -0,0 +1,21 @@ +((function length + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec2 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec3 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec4 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/110/lessThan b/src/glsl/builtins/110/lessThan new file mode 100644 index 0000000000..5c4254165c --- /dev/null +++ b/src/glsl/builtins/110/lessThan @@ -0,0 +1,61 @@ +((function lessThan + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/lessThanEqual b/src/glsl/builtins/110/lessThanEqual new file mode 100644 index 0000000000..ccb955b8a7 --- /dev/null +++ b/src/glsl/builtins/110/lessThanEqual @@ -0,0 +1,61 @@ +((function lessThanEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/log b/src/glsl/builtins/110/log new file mode 100644 index 0000000000..d168abb5a7 --- /dev/null +++ b/src/glsl/builtins/110/log @@ -0,0 +1,21 @@ +((function log + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float log (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 log (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 log (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 log (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/log2 b/src/glsl/builtins/110/log2 new file mode 100644 index 0000000000..b96c6276f0 --- /dev/null +++ b/src/glsl/builtins/110/log2 @@ -0,0 +1,21 @@ +((function log2 + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float log2 (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 log2 (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 log2 (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 log2 (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/matrixCompMult b/src/glsl/builtins/110/matrixCompMult new file mode 100644 index 0000000000..cb5a2cb1f7 --- /dev/null +++ b/src/glsl/builtins/110/matrixCompMult @@ -0,0 +1,32 @@ +((function matrixCompMult + (signature mat2 + (parameters + (declare (in) mat2 x) + (declare (in) mat2 y)) + ((declare () mat2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat3 + (parameters + (declare (in) mat3 x) + (declare (in) mat3 y)) + ((declare () mat3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat4 + (parameters + (declare (in) mat4 x) + (declare (in) mat4 y)) + ((declare () mat4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) +)) + diff --git a/src/glsl/builtins/110/max b/src/glsl/builtins/110/max new file mode 100644 index 0000000000..c05545f3d9 --- /dev/null +++ b/src/glsl/builtins/110/max @@ -0,0 +1,64 @@ +((function max + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float max (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((declare () vec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((declare () vec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float max (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((declare () vec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float max (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression float max (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/110/min b/src/glsl/builtins/110/min new file mode 100644 index 0000000000..31e7948940 --- /dev/null +++ b/src/glsl/builtins/110/min @@ -0,0 +1,64 @@ +((function min + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float min (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((declare () vec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((declare () vec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float min (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((declare () vec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float min (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression float min (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/110/mix b/src/glsl/builtins/110/mix new file mode 100644 index 0000000000..032f29e5fa --- /dev/null +++ b/src/glsl/builtins/110/mix @@ -0,0 +1,50 @@ +((function mix + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) vec2 arg2)) + ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) vec3 arg2)) + ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) vec4 arg2)) + ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) float arg2)) + ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) float arg2)) + ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) float arg2)) + ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) +)) diff --git a/src/glsl/builtins/110/mod b/src/glsl/builtins/110/mod new file mode 100644 index 0000000000..9e08bbc7ef --- /dev/null +++ b/src/glsl/builtins/110/mod @@ -0,0 +1,64 @@ +((function mod + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float % (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((declare () vec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((declare () vec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float % (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((declare () vec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression float % (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression float % (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/110/noise_fake b/src/glsl/builtins/110/noise_fake new file mode 100644 index 0000000000..bcfb17b04b --- /dev/null +++ b/src/glsl/builtins/110/noise_fake @@ -0,0 +1,76 @@ +((function noise1 + (signature float + (parameters + (declare (in) float x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec2 x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec3 x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec4 x)) + ((return (constant float (0))))) + ) + + (function noise2 + (signature vec2 + (parameters + (declare (in) float x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec3 x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec4 x)) + ((return (constant vec2 (0 0))))) + ) + + (function noise3 + (signature vec3 + (parameters + (declare (in) float x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec2 x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec4 x)) + ((return (constant vec3 (0 0 0))))) + ) + + (function noise4 + (signature vec4 + (parameters + (declare (in) float x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec2 x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec3 x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (constant vec4 (0 0 0 0))))) + ) +) diff --git a/src/glsl/builtins/110/normalize b/src/glsl/builtins/110/normalize new file mode 100644 index 0000000000..be88a9830d --- /dev/null +++ b/src/glsl/builtins/110/normalize @@ -0,0 +1,21 @@ +((function normalize + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) +)) diff --git a/src/glsl/builtins/110/not b/src/glsl/builtins/110/not new file mode 100644 index 0000000000..b696b06557 --- /dev/null +++ b/src/glsl/builtins/110/not @@ -0,0 +1,16 @@ +((function not + (signature bvec2 + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bvec2 ! (var_ref arg0))))) + + (signature bvec3 + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bvec3 ! (var_ref arg0))))) + + (signature bvec4 + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bvec4 ! (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/notEqual b/src/glsl/builtins/110/notEqual new file mode 100644 index 0000000000..c87efa317f --- /dev/null +++ b/src/glsl/builtins/110/notEqual @@ -0,0 +1,61 @@ +((function notEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/110/pow b/src/glsl/builtins/110/pow new file mode 100644 index 0000000000..a61bc4418e --- /dev/null +++ b/src/glsl/builtins/110/pow @@ -0,0 +1,25 @@ +((function pow + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float pow (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 pow (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 pow (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 pow (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/110/radians b/src/glsl/builtins/110/radians new file mode 100644 index 0000000000..6a0f5d2e21 --- /dev/null +++ b/src/glsl/builtins/110/radians @@ -0,0 +1,21 @@ +((function radians + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (constant float (0.017453)))))) +)) diff --git a/src/glsl/builtins/110/reflect b/src/glsl/builtins/110/reflect new file mode 100644 index 0000000000..8238fdc93f --- /dev/null +++ b/src/glsl/builtins/110/reflect @@ -0,0 +1,58 @@ +((function reflect + (signature float + (parameters + (declare (in) float i) + (declare (in) float n)) + ((return (expression float - + (var_ref i) + (expression float * + (constant float (2.0)) + (expression float * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec2 + (parameters + (declare (in) vec2 i) + (declare (in) vec2 n)) + ((return (expression vec2 - + (var_ref i) + (expression vec2 * + (constant float (2.0)) + (expression vec2 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec3 + (parameters + (declare (in) vec3 i) + (declare (in) vec3 n)) + ((return (expression vec3 - + (var_ref i) + (expression vec3 * + (constant float (2.0)) + (expression vec3 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec4 + (parameters + (declare (in) vec4 i) + (declare (in) vec4 n)) + ((return (expression vec4 - + (var_ref i) + (expression vec4 * + (constant float (2.0)) + (expression vec4 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + +)) diff --git a/src/glsl/builtins/110/refract b/src/glsl/builtins/110/refract new file mode 100644 index 0000000000..e9b1475294 --- /dev/null +++ b/src/glsl/builtins/110/refract @@ -0,0 +1,102 @@ +((function refract + (signature float + (parameters + (declare (in) float i) + (declare (in) float n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant float (0.0)))) + ((return (expression float - + (expression float * (var_ref eta) (var_ref i)) + (expression float * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec2 + (parameters + (declare (in) vec2 i) + (declare (in) vec2 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec2 (0.0 0.0)))) + ((return (expression vec2 - + (expression vec2 * (var_ref eta) (var_ref i)) + (expression vec2 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec3 + (parameters + (declare (in) vec3 i) + (declare (in) vec3 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec3 (0.0 0.0)))) + ((return (expression vec3 - + (expression vec3 * (var_ref eta) (var_ref i)) + (expression vec3 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec4 + (parameters + (declare (in) vec4 i) + (declare (in) vec4 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec4 (0.0 0.0)))) + ((return (expression vec4 - + (expression vec4 * (var_ref eta) (var_ref i)) + (expression vec4 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + +)) diff --git a/src/glsl/builtins/110/sign b/src/glsl/builtins/110/sign new file mode 100644 index 0000000000..7d540de405 --- /dev/null +++ b/src/glsl/builtins/110/sign @@ -0,0 +1,34 @@ +((function sign + (signature float + (parameters + (declare (in) float x)) + ((return (expression float sign (var_ref x))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x)))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x)))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float sign (swiz w (var_ref x)))) + (return (var_ref t)))) +)) + diff --git a/src/glsl/builtins/110/sin b/src/glsl/builtins/110/sin new file mode 100644 index 0000000000..e6009d8ef1 --- /dev/null +++ b/src/glsl/builtins/110/sin @@ -0,0 +1,21 @@ +((function sin + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float sin (var_ref angle))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression vec2 sin (var_ref angle))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression vec3 sin (var_ref angle))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression vec4 sin (var_ref angle))))) +)) diff --git a/src/glsl/builtins/110/smoothstep b/src/glsl/builtins/110/smoothstep new file mode 100644 index 0000000000..b4255ba78f --- /dev/null +++ b/src/glsl/builtins/110/smoothstep @@ -0,0 +1,224 @@ +((function smoothstep + (signature float + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) float x)) + ((declare () float t) + + (assign (constant bool (1)) (var_ref t) + (expression float max + (expression float min + (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t)))))))) + + (signature vec2 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec2 x)) + ((declare () vec2 t) + (declare () vec2 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + (return (var_ref retval)) + )) + + (signature vec3 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec3 x)) + ((declare () vec3 t) + (declare () vec3 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + (return (var_ref retval)) + )) + + + (signature vec4 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec4 x)) + ((declare () vec4 t) + (declare () vec4 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + + (assign (constant bool (1)) (swiz w (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) + (return (var_ref retval)) + )) + + (signature vec2 + (parameters + (declare (in) vec2 edge0) + (declare (in) vec2 edge1) + (declare (in) vec2 x)) + ((declare () vec2 t) + (declare () vec2 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + (return (var_ref retval)) + )) + + (signature vec3 + (parameters + (declare (in) vec3 edge0) + (declare (in) vec3 edge1) + (declare (in) vec3 x)) + ((declare () vec3 t) + (declare () vec3 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + (return (var_ref retval)) + )) + + + (signature vec4 + (parameters + (declare (in) vec4 edge0) + (declare (in) vec4 edge1) + (declare (in) vec4 x)) + ((declare () vec4 t) + (declare () vec4 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + + (assign (constant bool (1)) (swiz w (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz w (var_ref x)) (swiz w (var_ref edge0))) (expression float - (swiz w (var_ref edge1)) (swiz w (var_ref edge0)))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) + (return (var_ref retval)) + )) + +)) + diff --git a/src/glsl/builtins/110/sqrt b/src/glsl/builtins/110/sqrt new file mode 100644 index 0000000000..0302d164ae --- /dev/null +++ b/src/glsl/builtins/110/sqrt @@ -0,0 +1,21 @@ +((function sqrt + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float sqrt (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 sqrt (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 sqrt (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 sqrt (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/110/step b/src/glsl/builtins/110/step new file mode 100644 index 0000000000..1cc2b51f8f --- /dev/null +++ b/src/glsl/builtins/110/step @@ -0,0 +1,68 @@ +((function step + (signature float + (parameters + (declare (in) float edge) + (declare (in) float x)) + ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge)))))) + + (signature vec2 + (parameters + (declare (in) float edge) + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) float edge) + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) float edge) + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec2 + (parameters + (declare (in) vec2 edge) + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) vec3 edge) + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge))))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) vec4 edge) + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge))))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge))))) + (return (var_ref t)))) +)) + diff --git a/src/glsl/builtins/110/tan b/src/glsl/builtins/110/tan new file mode 100644 index 0000000000..3e04892a76 --- /dev/null +++ b/src/glsl/builtins/110/tan @@ -0,0 +1,21 @@ +((function tan + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle)))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression float / (expression float sin (var_ref angle)) (expression vec2 cos (var_ref angle)))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression float / (expression float sin (var_ref angle)) (expression vec3 cos (var_ref angle)))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression float / (expression float sin (var_ref angle)) (expression vec4 cos (var_ref angle)))))) +)) diff --git a/src/glsl/builtins/110/textures b/src/glsl/builtins/110/textures new file mode 100644 index 0000000000..c81b7e8ad4 --- /dev/null +++ b/src/glsl/builtins/110/textures @@ -0,0 +1,213 @@ +((function texture1D + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function texture1DLod + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function texture1DProj + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + +) + (function texture1DProjLod + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + +) + (function texture2D + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) +(function texture2DLod + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function texture2DProj + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + +) + (function texture2DProjLod + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + +) + (function texture3D + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function texture3DLod + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function texture3DProj + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + +) + (function texture3DProjLod + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + +) + (function textureCube + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function textureCubeLod + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function shadow1D + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) + +) + (function shadow1DLod + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) + +) + (function shadow1DProj + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) )))) + +) + (function shadow1DProjLod + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) )))) + +) + (function shadow2D + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) + +) + (function shadow2DLod + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) + +) + (function shadow2DProj + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) )))) + +) + (function shadow2DProjLod + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) )))) + +)) diff --git a/src/glsl/builtins/110_fs/derivatives b/src/glsl/builtins/110_fs/derivatives new file mode 100644 index 0000000000..b79852ee1f --- /dev/null +++ b/src/glsl/builtins/110_fs/derivatives @@ -0,0 +1,73 @@ +((function dFdx + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdx (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdx (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdx (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdx (var_ref p))))) + ) + + (function dFdy + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdy (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdy (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdy (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdy (var_ref p))))) + ) + + (function fwidth + (signature float + (parameters + (declare (in) float p)) + ((return (expression float + + (expression float abs (expression float dFdx (var_ref p))) + (expression float abs (expression float dFdy (var_ref p))))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 + + (expression vec2 abs (expression vec2 dFdx (var_ref p))) + (expression vec2 abs (expression vec2 dFdy (var_ref p))))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 + + (expression vec3 abs (expression vec3 dFdx (var_ref p))) + (expression vec3 abs (expression vec3 dFdy (var_ref p))))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 + + (expression vec4 abs (expression vec4 dFdx (var_ref p))) + (expression vec4 abs (expression vec4 dFdy (var_ref p))))))) +)) diff --git a/src/glsl/builtins/110_fs/textures b/src/glsl/builtins/110_fs/textures new file mode 100644 index 0000000000..38f3787e9e --- /dev/null +++ b/src/glsl/builtins/110_fs/textures @@ -0,0 +1,113 @@ +((function texture1D + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function texture1DProj + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + +) + (function texture2D + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function texture2DProj + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + +) + (function texture3D + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function texture3DProj + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + +) + (function textureCube + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function shadow1D + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) + +) + (function shadow1DProj + (signature vec4 + (parameters + (declare (in) sampler1DShadow sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) )))) + +) + (function shadow2D + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) + +) + (function shadow2DProj + (signature vec4 + (parameters + (declare (in) sampler2DShadow sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) )))) + +)) diff --git a/src/glsl/builtins/110_vs/ftransform b/src/glsl/builtins/110_vs/ftransform new file mode 100644 index 0000000000..3a5e8ccecf --- /dev/null +++ b/src/glsl/builtins/110_vs/ftransform @@ -0,0 +1,7 @@ +((function ftransform + (signature vec4 + (parameters) + ((return (expression vec4 * + (var_ref gl_ModelViewProjectionMatrix) + (var_ref gl_Vertex))))) +)) diff --git a/src/glsl/builtins/120/matrixCompMult b/src/glsl/builtins/120/matrixCompMult new file mode 100644 index 0000000000..69331e2652 --- /dev/null +++ b/src/glsl/builtins/120/matrixCompMult @@ -0,0 +1,61 @@ +((function matrixCompMult + (signature mat2x3 + (parameters + (declare (in) mat2x3 x) + (declare (in) mat2x3 y)) + ((declare () mat2x3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat3x2 + (parameters + (declare (in) mat3x2 x) + (declare (in) mat3x2 y)) + ((declare () mat3x2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat2x4 + (parameters + (declare (in) mat2x4 x) + (declare (in) mat2x4 y)) + ((declare () mat2x4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat4x2 + (parameters + (declare (in) mat4x2 x) + (declare (in) mat4x2 y)) + ((declare () mat4x2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) + + (signature mat3x4 + (parameters + (declare (in) mat3x4 x) + (declare (in) mat3x4 y)) + ((declare () mat3x4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat4x3 + (parameters + (declare (in) mat4x3 x) + (declare (in) mat4x3 y)) + ((declare () mat4x3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) +)) diff --git a/src/glsl/builtins/120/outerProduct b/src/glsl/builtins/120/outerProduct new file mode 100644 index 0000000000..b401ba0233 --- /dev/null +++ b/src/glsl/builtins/120/outerProduct @@ -0,0 +1,92 @@ +((function outerProduct + (signature mat2 + (parameters + (declare (in) vec2 u) + (declare (in) vec2 v)) + ((declare () mat2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) +(return (var_ref m)))) + + (signature mat2x3 + (parameters + (declare (in) vec2 u) + (declare (in) vec3 v)) + ((declare () mat2x3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) +(return (var_ref m)))) + + (signature mat2x4 + (parameters + (declare (in) vec2 u) + (declare (in) vec4 v)) + ((declare () mat2x4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) +(return (var_ref m)))) + + (signature mat3x2 + (parameters + (declare (in) vec3 u) + (declare (in) vec2 v)) + ((declare () mat3x2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) +(return (var_ref m)))) + + (signature mat3 + (parameters + (declare (in) vec3 u) + (declare (in) vec3 v)) + ((declare () mat3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) +(return (var_ref m)))) + + (signature mat3x4 + (parameters + (declare (in) vec3 u) + (declare (in) vec4 v)) + ((declare () mat3x4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) +(return (var_ref m)))) + + (signature mat4x2 + (parameters + (declare (in) vec4 u) + (declare (in) vec2 v)) + ((declare () mat4x2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u)))) +(return (var_ref m)))) + + (signature mat4x3 + (parameters + (declare (in) vec4 u) + (declare (in) vec3 v)) + ((declare () mat4x3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u)))) +(return (var_ref m)))) + + (signature mat4 + (parameters + (declare (in) vec4 u) + (declare (in) vec4 v)) + ((declare () mat4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u)))) +(return (var_ref m)))) +)) + diff --git a/src/glsl/builtins/120/transpose b/src/glsl/builtins/120/transpose new file mode 100644 index 0000000000..416a0ee467 --- /dev/null +++ b/src/glsl/builtins/120/transpose @@ -0,0 +1,139 @@ +((function transpose + (signature mat2 + (parameters + (declare (in) mat2 m)) + ((declare () mat2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat3x2 + (parameters + (declare (in) mat2x3 m)) + ((declare () mat3x2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat4x2 + (parameters + (declare (in) mat2x4 m)) + ((declare () mat4x2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat2x3 + (parameters + (declare (in) mat3x2 m)) + ((declare () mat2x3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat3 + (parameters + (declare (in) mat3 m)) + ((declare () mat3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat4x3 + (parameters + (declare (in) mat3x4 m)) + ((declare () mat4x3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat2x4 + (parameters + (declare (in) mat4x2 m)) + ((declare () mat2x4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) + + (signature mat3x4 + (parameters + (declare (in) mat4x3 m)) + ((declare () mat3x4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) + + (signature mat4 + (parameters + (declare (in) mat4 m)) + ((declare () mat4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) +) + +) + diff --git a/src/glsl/builtins/130/clamp b/src/glsl/builtins/130/clamp new file mode 100644 index 0000000000..3aed22c20d --- /dev/null +++ b/src/glsl/builtins/130/clamp @@ -0,0 +1,123 @@ +((function clamp + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1) + (declare (in) ivec2 arg2)) + ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1) + (declare (in) ivec3 arg2)) + ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1) + (declare (in) ivec4 arg2)) + ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((declare () ivec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((declare () ivec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((declare () ivec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1) + (declare (in) uvec2 arg2)) + ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1) + (declare (in) uvec3 arg2)) + ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1) + (declare (in) uvec4 arg2)) + ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((declare () uvec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((declare () uvec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((declare () uvec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/130/cosh b/src/glsl/builtins/130/cosh new file mode 100644 index 0000000000..45e0ae427d --- /dev/null +++ b/src/glsl/builtins/130/cosh @@ -0,0 +1,30 @@ +((function cosh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * (constant float (0.5)) + (expression float + + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * (constant vec2 (0.5)) + (expression vec2 + + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * (constant vec3 (0.5)) + (expression vec3 + + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * (constant vec4 (0.5)) + (expression vec4 + + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/130/equal b/src/glsl/builtins/130/equal new file mode 100644 index 0000000000..079c3e97fb --- /dev/null +++ b/src/glsl/builtins/130/equal @@ -0,0 +1,31 @@ +((function equal + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/greaterThan b/src/glsl/builtins/130/greaterThan new file mode 100644 index 0000000000..a9fb7b3a43 --- /dev/null +++ b/src/glsl/builtins/130/greaterThan @@ -0,0 +1,31 @@ +((function greaterThan + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/greaterThanEqual b/src/glsl/builtins/130/greaterThanEqual new file mode 100644 index 0000000000..293c93c7cc --- /dev/null +++ b/src/glsl/builtins/130/greaterThanEqual @@ -0,0 +1,31 @@ +((function greaterThanEqual + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/lessThan b/src/glsl/builtins/130/lessThan new file mode 100644 index 0000000000..d9f693fd63 --- /dev/null +++ b/src/glsl/builtins/130/lessThan @@ -0,0 +1,31 @@ +((function lessThan + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/lessThanEqual b/src/glsl/builtins/130/lessThanEqual new file mode 100644 index 0000000000..494411b869 --- /dev/null +++ b/src/glsl/builtins/130/lessThanEqual @@ -0,0 +1,31 @@ +((function lessThanEqual + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/max b/src/glsl/builtins/130/max new file mode 100644 index 0000000000..45a6089c9f --- /dev/null +++ b/src/glsl/builtins/130/max @@ -0,0 +1,127 @@ +((function max + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1)) + ((return (expression int max (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1)) + ((declare () ivec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1)) + ((declare () ivec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression int max (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1)) + ((declare () ivec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression int max (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression int max (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1)) + ((return (expression uint max (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1)) + ((declare () uvec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1)) + ((declare () uvec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression uint max (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1)) + ((declare () uvec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression uint max (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression uint max (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/130/min b/src/glsl/builtins/130/min new file mode 100644 index 0000000000..d98ec1e79d --- /dev/null +++ b/src/glsl/builtins/130/min @@ -0,0 +1,127 @@ +((function min + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1)) + ((return (expression int min (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1)) + ((declare () ivec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1)) + ((declare () ivec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression int min (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1)) + ((declare () ivec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression int min (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression int min (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1)) + ((return (expression uint min (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1)) + ((declare () uvec2 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1)) + ((declare () uvec3 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression uint min (swiz z (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1)) + ((declare () uvec4 result) + (assign (constant bool (1)) (swiz x (var_ref result)) + (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz y (var_ref result)) + (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz z (var_ref result)) + (expression uint min (swiz z (var_ref arg0)) (var_ref arg1))) + (assign (constant bool (1)) (swiz w (var_ref result)) + (expression uint min (swiz w (var_ref arg0)) (var_ref arg1))) + (return (var_ref result)))) +)) diff --git a/src/glsl/builtins/130/notEqual b/src/glsl/builtins/130/notEqual new file mode 100644 index 0000000000..81e6376bd9 --- /dev/null +++ b/src/glsl/builtins/130/notEqual @@ -0,0 +1,31 @@ +((function notEqual + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/130/sign b/src/glsl/builtins/130/sign new file mode 100644 index 0000000000..0bdc0e09d2 --- /dev/null +++ b/src/glsl/builtins/130/sign @@ -0,0 +1,34 @@ +((function sign + (signature int + (parameters + (declare (in) int x)) + ((return (expression int / (var_ref x) (expression int abs (var_ref x)))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 x)) + ((declare () ivec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) + (return (var_ref t)))) + + (signature ivec3 + (parameters + (declare (in) ivec3 x)) + ((declare () ivec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x)))) + (return (var_ref t)))) + + (signature ivec4 + (parameters + (declare (in) ivec4 x)) + ((declare () ivec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x)))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression int sign (swiz w (var_ref x)))) + (return (var_ref t)))) +)) + diff --git a/src/glsl/builtins/130/sinh b/src/glsl/builtins/130/sinh new file mode 100644 index 0000000000..7ad4f58e20 --- /dev/null +++ b/src/glsl/builtins/130/sinh @@ -0,0 +1,30 @@ +((function sinh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * (constant float (0.5)) + (expression float - + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * (constant vec2 (0.5)) + (expression vec2 - + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * (constant vec3 (0.5)) + (expression vec3 - + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * (constant vec4 (0.5)) + (expression vec4 - + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/130/tanh b/src/glsl/builtins/130/tanh new file mode 100644 index 0000000000..3b7271bf77 --- /dev/null +++ b/src/glsl/builtins/130/tanh @@ -0,0 +1,42 @@ +((function tanh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float / + (expression float - + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))) + (expression float + + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 / + (expression vec2 - + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))) + (expression vec2 + + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 / + (expression vec3 - + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))) + (expression vec3 + + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 / + (expression vec4 - + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))) + (expression vec4 + + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/130/texelFetch b/src/glsl/builtins/130/texelFetch new file mode 100644 index 0000000000..d51ce65a89 --- /dev/null +++ b/src/glsl/builtins/130/texelFetch @@ -0,0 +1,107 @@ +((function texelFetch + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) int P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) int P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) int P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1DArray sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1DArray sampler) + (declare (in) ivec2 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2DArray sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2DArray sampler) + (declare (in) ivec3 P) + (declare (in) int lod) ) + ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) + +)) diff --git a/src/glsl/builtins/130/texture b/src/glsl/builtins/130/texture new file mode 100644 index 0000000000..b170b58309 --- /dev/null +++ b/src/glsl/builtins/130/texture @@ -0,0 +1,110 @@ +((function texture + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) float P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) float P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isamplerCube sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usamplerCube sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isampler1DArray sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usampler1DArray sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature ivec4 + (parameters + (declare (in) isampler2DArray sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + + (signature uvec4 + (parameters + (declare (in) usampler2DArray sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +)) diff --git a/src/glsl/builtins/130/textureGrad b/src/glsl/builtins/130/textureGrad new file mode 100644 index 0000000000..0ef428c224 --- /dev/null +++ b/src/glsl/builtins/130/textureGrad @@ -0,0 +1,147 @@ +((function textureGrad + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) float P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) float P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isamplerCube sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usamplerCube sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) + +) +) diff --git a/src/glsl/builtins/130/textureLod b/src/glsl/builtins/130/textureLod new file mode 100644 index 0000000000..7d7059d848 --- /dev/null +++ b/src/glsl/builtins/130/textureLod @@ -0,0 +1,128 @@ +((function textureLod + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) float P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) float P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isamplerCube sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usamplerCube sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +)) diff --git a/src/glsl/builtins/130/textureProj b/src/glsl/builtins/130/textureProj new file mode 100644 index 0000000000..40ea1c2af6 --- /dev/null +++ b/src/glsl/builtins/130/textureProj @@ -0,0 +1,92 @@ +((function textureProj + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) + +)) diff --git a/src/glsl/builtins/130/textureProjGrad b/src/glsl/builtins/130/textureProjGrad new file mode 100644 index 0000000000..a0142c5e68 --- /dev/null +++ b/src/glsl/builtins/130/textureProjGrad @@ -0,0 +1,122 @@ +((function textureLod + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec2 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec2 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec4 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec4 P) + (declare (in) float dPdx) + (declare (in) float dPdy) ) + ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec3 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec3 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec4 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec4 P) + (declare (in) vec2 dPdx) + (declare (in) vec2 dPdy) ) + ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec4 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec4 P) + (declare (in) vec3 dPdx) + (declare (in) vec3 dPdy) ) + ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) + +)) diff --git a/src/glsl/builtins/130/textureProjLod b/src/glsl/builtins/130/textureProjLod new file mode 100644 index 0000000000..9f4ce1b493 --- /dev/null +++ b/src/glsl/builtins/130/textureProjLod @@ -0,0 +1,107 @@ +((function textureLod + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec4 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) + +)) diff --git a/src/glsl/builtins/130_fs/texture b/src/glsl/builtins/130_fs/texture new file mode 100644 index 0000000000..0de981397f --- /dev/null +++ b/src/glsl/builtins/130_fs/texture @@ -0,0 +1,128 @@ +((function texture + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) float P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) float P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) float P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) samplerCube sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isamplerCube sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usamplerCube sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +)) diff --git a/src/glsl/builtins/130_fs/textureProj b/src/glsl/builtins/130_fs/textureProj new file mode 100644 index 0000000000..b1d8f0a2f3 --- /dev/null +++ b/src/glsl/builtins/130_fs/textureProj @@ -0,0 +1,107 @@ +((function textureProj + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler1D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler1D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler1D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler2D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler2D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler2D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature vec4 + (parameters + (declare (in) sampler3D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature ivec4 + (parameters + (declare (in) isampler3D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + + (signature uvec4 + (parameters + (declare (in) usampler3D sampler) + (declare (in) vec4 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) + +)) diff --git a/src/glsl/builtins/ARB_texture_rectangle/textures b/src/glsl/builtins/ARB_texture_rectangle/textures new file mode 100644 index 0000000000..161d8c4a54 --- /dev/null +++ b/src/glsl/builtins/ARB_texture_rectangle/textures @@ -0,0 +1,16 @@ +((function texture2DRect + (signature vec4 + (parameters + (declare (in) sampler2DRect sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function shadow2DRect + (signature vec4 + (parameters + (declare (in) sampler2DRectShadow sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) + +)) diff --git a/src/glsl/builtins/EXT_texture_array/textures b/src/glsl/builtins/EXT_texture_array/textures new file mode 100644 index 0000000000..8a91f90140 --- /dev/null +++ b/src/glsl/builtins/EXT_texture_array/textures @@ -0,0 +1,59 @@ +((function texture1DArray + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function texture1DArrayLod + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function texture2DArray + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) + +) + (function texture2DArrayLod + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) + +) + (function shadow1DArray + (signature vec4 + (parameters + (declare (in) sampler1DArrayShadow sampler) + (declare (in) vec3 P) ) + ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) + +) + (function shadow1DArrayLod + (signature vec4 + (parameters + (declare (in) sampler1DArrayShadow sampler) + (declare (in) vec3 P) + (declare (in) float lod) ) + ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) + +) + (function shadow2DArray + (signature vec4 + (parameters + (declare (in) sampler2DArrayShadow sampler) + (declare (in) vec4 P) ) + ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) )))) + +)) diff --git a/src/glsl/builtins/EXT_texture_array_fs/textures b/src/glsl/builtins/EXT_texture_array_fs/textures new file mode 100644 index 0000000000..74e184387a --- /dev/null +++ b/src/glsl/builtins/EXT_texture_array_fs/textures @@ -0,0 +1,27 @@ +((function texture1DArray + (signature vec4 + (parameters + (declare (in) sampler1DArray sampler) + (declare (in) vec2 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function texture2DArray + (signature vec4 + (parameters + (declare (in) sampler2DArray sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) + +) + (function shadow1DArray + (signature vec4 + (parameters + (declare (in) sampler1DArrayShadow sampler) + (declare (in) vec3 P) + (declare (in) float bias) ) + ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) + +)) diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl new file mode 100755 index 0000000000..8b640ab8ff --- /dev/null +++ b/src/glsl/builtins/tools/generate_builtins.pl @@ -0,0 +1,123 @@ +#!/usr/bin/env perl + +sub process_version { + my ($version) = @_; + my @vars; + print "/* $version builtins */\n\n"; + + my @files = ; + foreach $file (@files) { + push(@vars, process_file($file)); + } + + print "static const char *functions_for_$version [] = {\n"; + foreach $var (@vars) { + print " $var,\n"; + } + print "};\n\n" +} + +sub process_file { + my ($file) = @_; + + # Change from builtins/110/foo to builtins_110_foo + my $var = $file; $var =~ s!/!_!g; + + print "static const char *$var = {\n"; + open SRC, "<", "$file" or die $!; + while () { + s/\\/\\\\/g; + s/\"/\\\"/g; + s/\n/\\n/g; + print " \"$_\"\n"; + } + print "};\n\n"; + close SRC or die $!; + return $var; +} + +print << 'EOF'; +/* DO NOT MODIFY - automatically generated by generate_builtins.pl */ +/* + * 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 +#include "glsl_parser_extras.h" +#include "ir_reader.h" + +void +read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, + const char **functions, unsigned count) +{ + if (st->error) + return; + + for (unsigned i = 0; i < count; i++) { + _mesa_glsl_read_ir(st, instructions, functions[i]); + + if (st->error) { + printf("error reading builtin: %.35s ...\n", functions[i]); + return; + } + } +} + +EOF + +@versions = sort(); +foreach $version (@versions) { + $version =~ s!builtins/!!g; + process_version($version); +} + +print << 'EOF'; +void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ +EOF + +foreach $version_xs (@versions) { + $check = ""; + if ($version_xs =~ /_vs/) { + $check = "state->target == vertex_shader && "; + } elsif ($version_xs =~ /_fs/) { + $check = "state->target == fragment_shader && "; + } + $version = $version_xs; + $version =~ s/_[vf]s//g; + + if ($version =~ /^[1-9][0-9][0-9]/) { + $check = "${check}state->language_version >= $version"; + } else { + # Not a version...an extension name + $check = "${check}state->${version}_enable"; + } + print " if ($check)\n"; + print " read_builtins(state, instructions,\n"; + print " functions_for_$version_xs,\n"; + print " sizeof(functions_for_$version_xs) / "; + print "sizeof(const char *));\n\n" +} + +print "}\n"; diff --git a/src/glsl/builtins/tools/generate_matrixCompMultGLSL.py b/src/glsl/builtins/tools/generate_matrixCompMultGLSL.py new file mode 100755 index 0000000000..391ad110d3 --- /dev/null +++ b/src/glsl/builtins/tools/generate_matrixCompMultGLSL.py @@ -0,0 +1,28 @@ +#!/usr/bin/python + +def gen_matrix(x, y = 0): + if y == 0: + y = x + type = "mat" + str(x) + if x != y: + type = type + "x" + str(y) + print type + " matrixCompMult(" + type + " x, " + type + " y)\n{" + print " " + type + " z;" + + for i in range(x): + print " z[" + str(i) + "] = x[" + str(i) + "] * y[" + str(i) + "];" + print " return z;\n}" + +print "#version 120" +# 1.10 +gen_matrix(2) +gen_matrix(3) +gen_matrix(4) + +# 1.20 +gen_matrix(2,3) # mat2x3 means 2 columns, 3 rows +gen_matrix(3,2) +gen_matrix(2,4) +gen_matrix(4,2) +gen_matrix(3,4) +gen_matrix(4,3) diff --git a/src/glsl/builtins/tools/generate_outerProductGLSL.py b/src/glsl/builtins/tools/generate_outerProductGLSL.py new file mode 100755 index 0000000000..48fb72197c --- /dev/null +++ b/src/glsl/builtins/tools/generate_outerProductGLSL.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +def gen(x, y): + type = "mat" + str(x) + if x != y: + type = type + "x" + str(y) + print type + " outerProduct(vec" + str(x) + " u, vec" + str(y) + " v)\n{" + print " " + type + " m;" + + for i in range(x): + print " m[" + str(i) + "] = v * u[" + str(i) + "];" + print " return m;\n}" + +print "#version 120" +gen(2,2) +gen(2,3) # mat2x3 means 2 columns, 3 rows +gen(2,4) +gen(3,2) +gen(3,3) +gen(3,4) +gen(4,2) +gen(4,3) +gen(4,4) diff --git a/src/glsl/builtins/tools/generate_transposeGLSL.py b/src/glsl/builtins/tools/generate_transposeGLSL.py new file mode 100755 index 0000000000..8f669ce983 --- /dev/null +++ b/src/glsl/builtins/tools/generate_transposeGLSL.py @@ -0,0 +1,28 @@ +#!/usr/bin/python + +def gen(x, y): + origtype = "mat" + str(x) + trantype = "mat" + str(y) + if x != y: + origtype = origtype + "x" + str(y) + trantype = trantype + "x" + str(x) + print trantype + " transpose(" + origtype + " m)\n{" + print " " + trantype + " t;" + + # The obvious implementation of transpose + for i in range(x): + for j in range(y): + print " t[" + str(j) + "][" + str(i) + "] =", + print "m[" + str(i) + "][" + str(j) + "];" + print " return t;\n}" + +print "#version 120" +gen(2,2) +gen(2,3) # mat2x3 means 2 columns, 3 rows +gen(2,4) +gen(3,2) +gen(3,3) +gen(3,4) +gen(4,2) +gen(4,3) +gen(4,4) diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py new file mode 100755 index 0000000000..23d5314916 --- /dev/null +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -0,0 +1,298 @@ +#!/usr/bin/python + +from os import path +import sys + +def vec_type(g, size): + if size == 1: + if g == "i": + return "int" + elif g == "u": + return "uint" + return "float" + return g + "vec" + str(size) + +# Get the base dimension - i.e. sampler3D gives 3 +# Array samplers also get +1 here since the layer is really an extra coordinate +def get_coord_dim(sampler_type): + if sampler_type[0].isdigit(): + coord_dim = int(sampler_type[0]) + elif sampler_type.startswith("Cube"): + coord_dim = 3 + else: + assert False ("coord_dim: invalid sampler_type: " + sampler_type) + + if sampler_type.find("Array") != -1: + coord_dim += 1 + return coord_dim + +# Get the number of extra vector components (i.e. shadow comparitor) +def get_extra_dim(sampler_type, use_proj, unused_fields): + extra_dim = unused_fields + if sampler_type.find("Shadow") != -1: + extra_dim += 1 + if use_proj: + extra_dim += 1 + return extra_dim + +def generate_sigs(g, tex_inst, sampler_type, use_proj = False, unused_fields = 0): + coord_dim = get_coord_dim(sampler_type) + extra_dim = get_extra_dim(sampler_type, use_proj, unused_fields) + + # Print parameters + print " (signature " + g + "vec4" + print " (parameters" + print " (declare (in) " + g + "sampler" + sampler_type + " sampler)" + print " (declare (in) " + vec_type("i" if tex_inst == "txf" else "", coord_dim + extra_dim) + " P)", + if tex_inst == "txb": + print "\n (declare (in) float bias)", + elif tex_inst == "txl": + print "\n (declare (in) float lod)", + elif tex_inst == "txf": + print "\n (declare (in) int lod)", + elif tex_inst == "txd": + grad_type = vec_type("", coord_dim) + print "\n (declare (in) " + grad_type + " dPdx)", + print "\n (declare (in) " + grad_type + " dPdy)", + + print ")\n ((return (" + tex_inst + " (var_ref sampler)", + + # Coordinate + if extra_dim > 0: + print "(swiz " + "xyzw"[:coord_dim] + " (var_ref P))", + else: + print "(var_ref P)", + + # Offset + print "(0 0 0)", + + if tex_inst != "txf": + # Projective divisor + if use_proj: + print "(swiz " + "xyzw"[coord_dim + extra_dim-1] + " (var_ref P))", + else: + print "1", + + # Shadow comparitor + if sampler_type == "2DArrayShadow": # a special case: + print "(swiz w (var_ref P))", # ...array layer is z; shadow is w + elif sampler_type.endswith("Shadow"): + print "(swiz z (var_ref P))", + else: + print "()", + + # Bias/explicit LOD/gradient: + if tex_inst == "txb": + print "(var_ref bias)", + elif tex_inst == "txl" or tex_inst == "txf": + print "(var_ref lod)", + elif tex_inst == "txd": + print "((var_ref dPdx) (var_ref dPdy))", + print "))))\n" + +def generate_fiu_sigs(tex_inst, sampler_type, use_proj = False, unused_fields = 0): + generate_sigs("", tex_inst, sampler_type, use_proj, unused_fields) + generate_sigs("i", tex_inst, sampler_type, use_proj, unused_fields) + generate_sigs("u", tex_inst, sampler_type, use_proj, unused_fields) + +builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..") + +with open(path.join(builtins_dir, "130", "texture"), 'w') as sys.stdout: + print "((function texture" + generate_fiu_sigs("tex", "1D") + generate_fiu_sigs("tex", "2D") + generate_fiu_sigs("tex", "3D") + generate_fiu_sigs("tex", "Cube") + generate_fiu_sigs("tex", "1DArray") + generate_fiu_sigs("tex", "2DArray") + print "))" + +# txb variants are only allowed within a fragment shader (GLSL 1.30 p. 86) +with open(path.join(builtins_dir, "130_fs", "texture"), 'w') as sys.stdout: + print "((function texture" + generate_fiu_sigs("txb", "1D") + generate_fiu_sigs("txb", "2D") + generate_fiu_sigs("txb", "3D") + generate_fiu_sigs("txb", "Cube") + generate_fiu_sigs("txb", "1DArray") + generate_fiu_sigs("txb", "2DArray") + print "))" + +with open(path.join(builtins_dir, "130", "textureProj"), 'w') as sys.stdout: + print "((function textureProj" + generate_fiu_sigs("tex", "1D", True) + generate_fiu_sigs("tex", "1D", True, 2) + generate_fiu_sigs("tex", "2D", True) + generate_fiu_sigs("tex", "2D", True, 1) + generate_fiu_sigs("tex", "3D", True) + print "))" + +with open(path.join(builtins_dir, "130_fs", "textureProj"), 'w') as sys.stdout: + print "((function textureProj" + generate_fiu_sigs("txb", "1D", True) + generate_fiu_sigs("txb", "1D", True, 2) + generate_fiu_sigs("txb", "2D", True) + generate_fiu_sigs("txb", "2D", True, 1) + generate_fiu_sigs("txb", "3D", True) + print "))" + +with open(path.join(builtins_dir, "130", "textureLod"), 'w') as sys.stdout: + print "((function textureLod" + generate_fiu_sigs("txl", "1D") + generate_fiu_sigs("txl", "2D") + generate_fiu_sigs("txl", "3D") + generate_fiu_sigs("txl", "Cube") + generate_fiu_sigs("txl", "1DArray") + generate_fiu_sigs("txl", "2DArray") + print "))" + +with open(path.join(builtins_dir, "130", "texelFetch"), 'w') as sys.stdout: + print "((function texelFetch" + generate_fiu_sigs("txf", "1D") + generate_fiu_sigs("txf", "2D") + generate_fiu_sigs("txf", "3D") + generate_fiu_sigs("txf", "1DArray") + generate_fiu_sigs("txf", "2DArray") + print "))" + +with open(path.join(builtins_dir, "130", "textureProjLod"), 'w') as sys.stdout: + print "((function textureLod" + generate_fiu_sigs("txl", "1D", True) + generate_fiu_sigs("txl", "1D", True, 2) + generate_fiu_sigs("txl", "2D", True) + generate_fiu_sigs("txl", "2D", True, 1) + generate_fiu_sigs("txl", "3D", True) + print "))" + +with open(path.join(builtins_dir, "130", "textureGrad"), 'w') as sys.stdout: + print "((function textureGrad" + generate_fiu_sigs("txd", "1D") + generate_fiu_sigs("txd", "2D") + generate_fiu_sigs("txd", "3D") + generate_fiu_sigs("txd", "Cube") + generate_fiu_sigs("txd", "1DArray") + generate_fiu_sigs("txd", "2DArray") + print ")\n)" + +with open(path.join(builtins_dir, "130", "textureProjGrad"), 'w') as sys.stdout: + print "((function textureLod" + generate_fiu_sigs("txd", "1D", True) + generate_fiu_sigs("txd", "1D", True, 2) + generate_fiu_sigs("txd", "2D", True) + generate_fiu_sigs("txd", "2D", True, 1) + generate_fiu_sigs("txd", "3D", True) + print "))" + +# ARB_texture_rectangle extension +with open(path.join(builtins_dir, "ARB_texture_rectangle", "textures"), 'w') as sys.stdout: + print "((function texture2DRect" + generate_sigs("", "tex", "2DRect") + print ")\n (function shadow2DRect" + generate_sigs("", "tex", "2DRectShadow") + print "))" + +# EXT_texture_array extension +with open(path.join(builtins_dir, "EXT_texture_array", "textures"), 'w') as sys.stdout: + print "((function texture1DArray" + generate_sigs("", "tex", "1DArray") + print ")\n (function texture1DArrayLod" + generate_sigs("", "txl", "1DArray") + print ")\n (function texture2DArray" + generate_sigs("", "tex", "2DArray") + print ")\n (function texture2DArrayLod" + generate_sigs("", "txl", "2DArray") + print ")\n (function shadow1DArray" + generate_sigs("", "tex", "1DArrayShadow") + print ")\n (function shadow1DArrayLod" + generate_sigs("", "txl", "1DArrayShadow") + print ")\n (function shadow2DArray" + generate_sigs("", "tex", "2DArrayShadow") + print "))" + +with open(path.join(builtins_dir, "EXT_texture_array_fs", "textures"), 'w') as sys.stdout: + print "((function texture1DArray" + generate_sigs("", "txb", "1DArray") # MOVE TO _fs + print ")\n (function texture2DArray" + generate_sigs("", "txb", "2DArray") # MOVE TO _fs + print ")\n (function shadow1DArray" + generate_sigs("", "txb", "1DArrayShadow") + print "))" + +# Deprecated (110/120 style) functions with silly names: +with open(path.join(builtins_dir, "110", "textures"), 'w') as sys.stdout: + print "((function texture1D" + generate_sigs("", "tex", "1D") + print ")\n (function texture1DLod" + generate_sigs("", "txl", "1D") + print ")\n (function texture1DProj" + generate_sigs("", "tex", "1D", True) + generate_sigs("", "tex", "1D", True, 2) + print ")\n (function texture1DProjLod" + generate_sigs("", "txl", "1D", True) + generate_sigs("", "txl", "1D", True, 2) + print ")\n (function texture2D" + generate_sigs("", "tex", "2D") + print ")\n(function texture2DLod" + generate_sigs("", "txl", "2D") + print ")\n (function texture2DProj" + generate_sigs("", "tex", "2D", True) + generate_sigs("", "tex", "2D", True, 1) + print ")\n (function texture2DProjLod" + generate_sigs("", "txl", "2D", True) + generate_sigs("", "txl", "2D", True, 1) + print ")\n (function texture3D" + generate_sigs("", "tex", "3D") + print ")\n (function texture3DLod" + generate_sigs("", "txl", "3D") + print ")\n (function texture3DProj" + generate_sigs("", "tex", "3D", True) + print ")\n (function texture3DProjLod" + generate_sigs("", "txl", "3D", True) + print ")\n (function textureCube" + generate_sigs("", "tex", "Cube") + print ")\n (function textureCubeLod" + generate_sigs("", "txl", "Cube") + print ")\n (function shadow1D" + generate_sigs("", "tex", "1DShadow", False, 1) + print ")\n (function shadow1DLod" + generate_sigs("", "txl", "1DShadow", False, 1) + print ")\n (function shadow1DProj" + generate_sigs("", "tex", "1DShadow", True, 1) + print ")\n (function shadow1DProjLod" + generate_sigs("", "txl", "1DShadow", True, 1) + print ")\n (function shadow2D" + generate_sigs("", "tex", "2DShadow") + print ")\n (function shadow2DLod" + generate_sigs("", "txl", "2DShadow") + print ")\n (function shadow2DProj" + generate_sigs("", "tex", "2DShadow", True) + print ")\n (function shadow2DProjLod" + generate_sigs("", "txl", "2DShadow", True) + print "))" + +with open(path.join(builtins_dir, "110_fs", "textures"), 'w') as sys.stdout: + print "((function texture1D" + generate_sigs("", "txb", "1D") + print ")\n (function texture1DProj" + generate_sigs("", "txb", "1D", True) + generate_sigs("", "txb", "1D", True, 2) + print ")\n (function texture2D" + generate_sigs("", "txb", "2D") + print ")\n (function texture2DProj" + generate_sigs("", "txb", "2D", True) + generate_sigs("", "txb", "2D", True, 1) + print ")\n (function texture3D" + generate_sigs("", "txb", "3D") + print ")\n (function texture3DProj" + generate_sigs("", "txb", "3D", True) + print ")\n (function textureCube" + generate_sigs("", "txb", "Cube") + print ")\n (function shadow1D" + generate_sigs("", "txb", "1DShadow", False, 1) + print ")\n (function shadow1DProj" + generate_sigs("", "txb", "1DShadow", True, 1) + print ")\n (function shadow2D" + generate_sigs("", "txb", "2DShadow") + print ")\n (function shadow2DProj" + generate_sigs("", "txb", "2DShadow", True) + print "))" diff --git a/src/glsl/configure.ac b/src/glsl/configure.ac new file mode 100644 index 0000000000..73ce67de3d --- /dev/null +++ b/src/glsl/configure.ac @@ -0,0 +1,69 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT(glsl, XXXXX, idr@freedesktop.org, glsl) +AC_CONFIG_SRCDIR([Makefile.am]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_FILES([glcpp/Makefile]) + +AM_INIT_AUTOMAKE +LT_INIT + +AM_MAINTAINER_MODE + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_MAKE_SET +AC_PROG_YACC +AC_PROG_LEX + +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Checks for libraries. + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. +AC_HEADER_STDC + +AH_TOP([#ifndef GLSL_CONFIG_H +#define GLSL_CONFIG_H]) +AH_BOTTOM([#endif /* GLSL_CONFIG_H */]) + +PKG_CHECK_MODULES([talloc], [talloc >= 2.0]) + +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [use debug compiler flags and macros @<:@default=disabled@:>@])], + [enable_debug="$enableval"], + [enable_debug=no] +) +if test "x$enable_debug" = xyes; then + DEFINES="$DEFINES -DDEBUG" + if test "x$GCC" = xyes; then + # Remove any -g or -O flags from the command line + CFLAGS=[`echo $CFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`] + CFLAGS="$CFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2" + fi + if test "x$GXX" = xyes; then + # Remove any -g flags from the command line + CXXFLAGS=[`echo $CXXFLAGS | sed 's/-g[^ \t]*[ \t]*//g;s/-O[^ \t]*[ \t]*//g'`] + CXXFLAGS="$CXXFLAGS -O0 -ggdb3 -fstack-protector -D_FORTIFY_SOURCE=2" + fi +fi + +if test "x$GXX" = xyes ; then + WARN="-Wall -Wextra -Wunsafe-loop-optimizations -Wstack-protector" +else + WARN="" +fi + +CFLAGS="$CFLAGS $WARN" +CXXFLAGS="$CXXFLAGS $WARN" +YFLAGS="-d -v" + +AC_OUTPUT([Makefile]) diff --git a/src/glsl/glcpp/.gitignore b/src/glsl/glcpp/.gitignore new file mode 100644 index 0000000000..c158dc8b86 --- /dev/null +++ b/src/glsl/glcpp/.gitignore @@ -0,0 +1,11 @@ +glcpp +glcpp-lex.c +glcpp-parse.c +glcpp-parse.h +glcpp-parse.output +*.o +*.lo +*.la +.libs +*~ +tests/*.out diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am new file mode 100644 index 0000000000..a49fd615cd --- /dev/null +++ b/src/glsl/glcpp/Makefile.am @@ -0,0 +1,46 @@ +# Copyright © 2010 Intel Corporation +# All Rights Reserved. +# +# 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 +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL +# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS 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. + +noinst_LTLIBRARIES = libglcpp.la +libglcpp_la_SOURCES = \ + glcpp-lex.l \ + glcpp-parse.y \ + glcpp.h \ + hash_table.c \ + pp.c \ + xtalloc.c + +BUILT_SOURCES = glcpp-parse.h glcpp-parse.c glcpp-lex.c +CLEANFILES = $(BUILT_SOURCES) + +glcpp-parse.h: glcpp-parse.c + +bin_PROGRAMS = glcpp +glcpp_LDADD = libglcpp.la +glcpp_LDFLAGS = @LDFLAGS@ $(talloc_LIBS) +glcpp_SOURCES = glcpp.c + +.l.c: + $(LEXCOMPILE) --outfile="$@" $< + +test: glcpp + @(cd tests; ./glcpp-test) diff --git a/src/glsl/glcpp/README b/src/glsl/glcpp/README new file mode 100644 index 0000000000..ab42a3ffe1 --- /dev/null +++ b/src/glsl/glcpp/README @@ -0,0 +1,30 @@ +glcpp -- GLSL "C" preprocessor + +This is a simple preprocessor designed to provide the preprocessing +needs of the GLSL language. The requirements for this preprocessor are +specified in the GLSL 1.30 specification availble from: + +http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.08.pdf + +This specification is not precise on some semantics, (for example, +#define and #if), defining these merely "as is standard for C++ +preprocessors". To fill in these details, I've been using the C99 +standard (for which I had a convenient copy) as available from: + +http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf + +Known limitations +----------------- +Macro invocations cannot include embedded newlines. + +The __LINE__, __FILE__, and __VERSION__ macros are not yet supported. + +The argument of the 'defined' operator cannot yet include enclosing +parentheses. + +The #error, #pragma, #extension, #version, and #line macros are not +yet supported. + +A file that ends with a function-like macro name as the last +non-whitespace token will result in a parse error, (where it should be +passed through as is). \ No newline at end of file diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l new file mode 100644 index 0000000000..afddd7ddb3 --- /dev/null +++ b/src/glsl/glcpp/glcpp-lex.l @@ -0,0 +1,257 @@ +%{ +/* + * 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 +#include + +#include "glcpp.h" +#include "glcpp-parse.h" + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno; \ + yycolumn += yyleng; \ + } while(0); +%} + +%option bison-bridge bison-locations reentrant noyywrap +%option extra-type="glcpp_parser_t *" +%option prefix="glcpp_" +%option stack + +%x DONE COMMENT + +SPACE [[:space:]] +NONSPACE [^[:space:]] +NEWLINE [\n] +HSPACE [ \t] +HASH ^{HSPACE}*#{HSPACE}* +IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]* +PUNCTUATION [][(){}.&*~!/%<>^|;,=+-] +OTHER [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+ + +DECIMAL_INTEGER [1-9][0-9]*[uU]? +OCTAL_INTEGER 0[0-7]*[uU]? +HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? + +%% + + /* Single-line comments */ +"//"[^\n]*\n { + yylineno++; + yycolumn = 0; + return NEWLINE; +} + + /* Multi-line comments */ +"/*" { yy_push_state(COMMENT, yyscanner); } +[^*\n]* +[^*\n]*\n { yylineno++; yycolumn = 0; } +"*"+[^*/\n]* +"*"+[^*/\n]*\n { yylineno++; yycolumn = 0; } +"*"+"/" { + yy_pop_state(yyscanner); + if (yyextra->space_tokens) + return SPACE; +} + + /* glcpp doesn't handle #extension, #version, or #pragma directives. + * Simply pass them through to the main compiler's lexer/parser. */ +{HASH}(extension|version|pragma)[^\n]+ { + yylval->str = xtalloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + return OTHER; +} + +{HASH}ifdef/.*\n { + yyextra->space_tokens = 0; + return HASH_IFDEF; +} + +{HASH}ifndef/.*\n { + yyextra->space_tokens = 0; + return HASH_IFNDEF; +} + +{HASH}if{HSPACE}/.*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IF; +} + +{HASH}elif/.*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_ELIF; +} + +{HASH}else/.*\n { + yyextra->space_tokens = 0; + return HASH_ELSE; +} + +{HASH}endif/.*\n { + yyextra->space_tokens = 0; + return HASH_ENDIF; +} + + /* When skipping (due to an #if 0 or similar) consume anything + * up to a newline. We do this less priroty than any + * #if-related directive (#if, #elif, #else, #endif), but with + * more priority than any other directive or token to avoid + * any side-effects from skipped content. + * + * We use the lexing_if flag to avoid skipping any part of an + * if conditional expression. */ +[^\n]+/\n { + /* Since this rule always matches, YY_USER_ACTION gets called for it, + * wrongly incrementing yycolumn. We undo that effect here. */ + yycolumn -= yyleng; + if (yyextra->lexing_if || + yyextra->skip_stack == NULL || + yyextra->skip_stack->type == SKIP_NO_SKIP) + { + REJECT; + } +} + +{HASH}define{HSPACE}+/{IDENTIFIER}"(" { + yyextra->space_tokens = 0; + return HASH_DEFINE_FUNC; +} + +{HASH}define { + yyextra->space_tokens = 0; + return HASH_DEFINE_OBJ; +} + +{HASH}undef { + yyextra->space_tokens = 0; + return HASH_UNDEF; +} + +{HASH} { + yyextra->space_tokens = 0; + return HASH; +} + +{DECIMAL_INTEGER} { + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +{OCTAL_INTEGER} { + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +{HEXADECIMAL_INTEGER} { + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +"<<" { + return LEFT_SHIFT; +} + +">>" { + return RIGHT_SHIFT; +} + +"<=" { + return LESS_OR_EQUAL; +} + +">=" { + return GREATER_OR_EQUAL; +} + +"==" { + return EQUAL; +} + +"!=" { + return NOT_EQUAL; +} + +"&&" { + return AND; +} + +"||" { + return OR; +} + +"##" { + return PASTE; +} + +"defined" { + return DEFINED; +} + +{IDENTIFIER} { + yylval->str = xtalloc_strdup (yyextra, yytext); + return IDENTIFIER; +} + +{PUNCTUATION} { + return yytext[0]; +} + +{OTHER}+ { + yylval->str = xtalloc_strdup (yyextra, yytext); + return OTHER; +} + +{HSPACE}+ { + if (yyextra->space_tokens) { + return SPACE; + } +} + +\n { + yyextra->lexing_if = 0; + yylineno++; + yycolumn = 0; + return NEWLINE; +} + + /* Handle missing newline at EOF. */ +<> { + BEGIN DONE; /* Don't keep matching this rule forever. */ + yyextra->lexing_if = 0; + return NEWLINE; +} + +%% + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) +{ + yy_scan_string(shader, parser->scanner); +} diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y new file mode 100644 index 0000000000..6beac18c65 --- /dev/null +++ b/src/glsl/glcpp/glcpp-parse.y @@ -0,0 +1,1611 @@ +%{ +/* + * 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 +#include +#include +#include + +#include "glcpp.h" + +#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) +#define glcpp_printf(stream, fmt, args...) \ + stream = talloc_asprintf_append(stream, fmt, args) + +static void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); + +static void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + token_list_t *replacements); + +static void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + string_list_t *parameters, + token_list_t *replacements); + +static string_list_t * +_string_list_create (void *ctx); + +static void +_string_list_append_item (string_list_t *list, const char *str); + +static int +_string_list_contains (string_list_t *list, const char *member, int *index); + +static int +_string_list_length (string_list_t *list); + +static argument_list_t * +_argument_list_create (void *ctx); + +static void +_argument_list_append (argument_list_t *list, token_list_t *argument); + +static int +_argument_list_length (argument_list_t *list); + +static token_list_t * +_argument_list_member_at (argument_list_t *list, int index); + +/* Note: This function talloc_steal()s the str pointer. */ +static token_t * +_token_create_str (void *ctx, int type, char *str); + +static token_t * +_token_create_ival (void *ctx, int type, int ival); + +static token_list_t * +_token_list_create (void *ctx); + +/* Note: This function adds a talloc_reference() to token. + * + * You may want to talloc_unlink any current reference if you no + * longer need it. */ +static void +_token_list_append (token_list_t *list, token_t *token); + +static void +_token_list_append_list (token_list_t *list, token_list_t *tail); + +static active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker); + +static active_list_t * +_active_list_pop (active_list_t *list); + +int +_active_list_contains (active_list_t *list, const char *identifier); + +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition); + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition); + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc); + +#define yylex glcpp_parser_lex + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); + +%} + +%pure-parser +%error-verbose +%locations + +%parse-param {glcpp_parser_t *parser} +%lex-param {glcpp_parser_t *parser} + +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE +%token PASTE +%type expression INTEGER operator SPACE +%type IDENTIFIER INTEGER_STRING OTHER +%type identifier_list +%type preprocessing_token conditional_token +%type pp_tokens replacement_list text_line conditional_tokens +%left OR +%left AND +%left '|' +%left '^' +%left '&' +%left EQUAL NOT_EQUAL +%left '<' '>' LESS_OR_EQUAL GREATER_OR_EQUAL +%left LEFT_SHIFT RIGHT_SHIFT +%left '+' '-' +%left '*' '/' '%' +%right UNARY + +%% + +input: + /* empty */ +| input line +; + +line: + control_line { + glcpp_print(parser->output, "\n"); + } +| text_line { + _glcpp_parser_print_expanded_token_list (parser, $1); + glcpp_print(parser->output, "\n"); + talloc_free ($1); + } +| expanded_line +| HASH non_directive +; + +expanded_line: + IF_EXPANDED expression NEWLINE { + _glcpp_parser_skip_stack_push_if (parser, & @1, $2); + } +| ELIF_EXPANDED expression NEWLINE { + _glcpp_parser_skip_stack_change_if (parser, & @1, "elif", $2); + } +; + +control_line: + HASH_DEFINE_OBJ IDENTIFIER replacement_list NEWLINE { + _define_object_macro (parser, & @2, $2, $3); + } +| HASH_DEFINE_FUNC IDENTIFIER '(' ')' replacement_list NEWLINE { + _define_function_macro (parser, & @2, $2, NULL, $5); + } +| HASH_DEFINE_FUNC IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE { + _define_function_macro (parser, & @2, $2, $4, $6); + } +| HASH_UNDEF IDENTIFIER NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + if (macro) { + /* XXX: Need hash table to support a real way + * to remove an element rather than prefixing + * a new node with data of NULL like this. */ + hash_table_insert (parser->defines, NULL, $2); + talloc_free (macro); + } + talloc_free ($2); + } +| HASH_IF conditional_tokens NEWLINE { + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, IF_EXPANDED, IF_EXPANDED); + _token_list_append (expanded, token); + talloc_unlink (parser, token); + _glcpp_parser_expand_token_list (parser, $2); + _token_list_append_list (expanded, $2); + glcpp_parser_lex_from (parser, expanded); + } +| HASH_IFDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + talloc_free ($2); + _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); + } +| HASH_IFNDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + talloc_free ($2); + _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); + } +| HASH_ELIF conditional_tokens NEWLINE { + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, ELIF_EXPANDED, ELIF_EXPANDED); + _token_list_append (expanded, token); + talloc_unlink (parser, token); + _glcpp_parser_expand_token_list (parser, $2); + _token_list_append_list (expanded, $2); + glcpp_parser_lex_from (parser, expanded); + } +| HASH_ELIF NEWLINE { + /* #elif without an expression results in a warning if the + * condition doesn't matter (we just handled #if 1 or such) + * but an error otherwise. */ + if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) { + parser->skip_stack->type = SKIP_TO_ENDIF; + glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); + } else { + glcpp_error(& @1, parser, "#elif needs an expression"); + } + } +| HASH_ELSE NEWLINE { + _glcpp_parser_skip_stack_change_if (parser, & @1, "else", 1); + } +| HASH_ENDIF NEWLINE { + _glcpp_parser_skip_stack_pop (parser, & @1); + } +| HASH NEWLINE +; + +expression: + INTEGER_STRING { + if (strlen ($1) >= 3 && strncmp ($1, "0x", 2) == 0) { + $$ = strtoll ($1 + 2, NULL, 16); + } else if ($1[0] == '0') { + $$ = strtoll ($1, NULL, 8); + } else { + $$ = strtoll ($1, NULL, 10); + } + } +| INTEGER { + $$ = $1; + } +| expression OR expression { + $$ = $1 || $3; + } +| expression AND expression { + $$ = $1 && $3; + } +| expression '|' expression { + $$ = $1 | $3; + } +| expression '^' expression { + $$ = $1 ^ $3; + } +| expression '&' expression { + $$ = $1 & $3; + } +| expression NOT_EQUAL expression { + $$ = $1 != $3; + } +| expression EQUAL expression { + $$ = $1 == $3; + } +| expression GREATER_OR_EQUAL expression { + $$ = $1 >= $3; + } +| expression LESS_OR_EQUAL expression { + $$ = $1 <= $3; + } +| expression '>' expression { + $$ = $1 > $3; + } +| expression '<' expression { + $$ = $1 < $3; + } +| expression RIGHT_SHIFT expression { + $$ = $1 >> $3; + } +| expression LEFT_SHIFT expression { + $$ = $1 << $3; + } +| expression '-' expression { + $$ = $1 - $3; + } +| expression '+' expression { + $$ = $1 + $3; + } +| expression '%' expression { + $$ = $1 % $3; + } +| expression '/' expression { + $$ = $1 / $3; + } +| expression '*' expression { + $$ = $1 * $3; + } +| '!' expression %prec UNARY { + $$ = ! $2; + } +| '~' expression %prec UNARY { + $$ = ~ $2; + } +| '-' expression %prec UNARY { + $$ = - $2; + } +| '+' expression %prec UNARY { + $$ = + $2; + } +| '(' expression ')' { + $$ = $2; + } +; + +identifier_list: + IDENTIFIER { + $$ = _string_list_create (parser); + _string_list_append_item ($$, $1); + talloc_steal ($$, $1); + } +| identifier_list ',' IDENTIFIER { + $$ = $1; + _string_list_append_item ($$, $3); + talloc_steal ($$, $3); + } +; + +text_line: + NEWLINE { $$ = NULL; } +| pp_tokens NEWLINE +; + +non_directive: + pp_tokens NEWLINE { + yyerror (& @1, parser, "Invalid tokens after #"); + } +; + +replacement_list: + /* empty */ { $$ = NULL; } +| pp_tokens +; + +junk: + /* empty */ +| pp_tokens { + glcpp_warning(&@1, parser, "extra tokens at end of directive"); + } +; + +conditional_token: + /* Handle "defined" operator */ + DEFINED IDENTIFIER { + int v = hash_table_find (parser->defines, $2) ? 1 : 0; + $$ = _token_create_ival (parser, INTEGER, v); + } +| DEFINED '(' IDENTIFIER ')' { + int v = hash_table_find (parser->defines, $3) ? 1 : 0; + $$ = _token_create_ival (parser, INTEGER, v); + } +| preprocessing_token +; + +conditional_tokens: + /* Exactly the same as pp_tokens, but using conditional_token */ + conditional_token { + parser->space_tokens = 1; + $$ = _token_list_create (parser); + _token_list_append ($$, $1); + talloc_unlink (parser, $1); + } +| conditional_tokens conditional_token { + $$ = $1; + _token_list_append ($$, $2); + talloc_unlink (parser, $2); + } +; + +pp_tokens: + preprocessing_token { + parser->space_tokens = 1; + $$ = _token_list_create (parser); + _token_list_append ($$, $1); + talloc_unlink (parser, $1); + } +| pp_tokens preprocessing_token { + $$ = $1; + _token_list_append ($$, $2); + talloc_unlink (parser, $2); + } +; + +preprocessing_token: + IDENTIFIER { + $$ = _token_create_str (parser, IDENTIFIER, $1); + $$->location = yylloc; + } +| INTEGER_STRING { + $$ = _token_create_str (parser, INTEGER_STRING, $1); + $$->location = yylloc; + } +| operator { + $$ = _token_create_ival (parser, $1, $1); + $$->location = yylloc; + } +| OTHER { + $$ = _token_create_str (parser, OTHER, $1); + $$->location = yylloc; + } +| SPACE { + $$ = _token_create_ival (parser, SPACE, SPACE); + $$->location = yylloc; + } +; + +operator: + '[' { $$ = '['; } +| ']' { $$ = ']'; } +| '(' { $$ = '('; } +| ')' { $$ = ')'; } +| '{' { $$ = '{'; } +| '}' { $$ = '}'; } +| '.' { $$ = '.'; } +| '&' { $$ = '&'; } +| '*' { $$ = '*'; } +| '+' { $$ = '+'; } +| '-' { $$ = '-'; } +| '~' { $$ = '~'; } +| '!' { $$ = '!'; } +| '/' { $$ = '/'; } +| '%' { $$ = '%'; } +| LEFT_SHIFT { $$ = LEFT_SHIFT; } +| RIGHT_SHIFT { $$ = RIGHT_SHIFT; } +| '<' { $$ = '<'; } +| '>' { $$ = '>'; } +| LESS_OR_EQUAL { $$ = LESS_OR_EQUAL; } +| GREATER_OR_EQUAL { $$ = GREATER_OR_EQUAL; } +| EQUAL { $$ = EQUAL; } +| NOT_EQUAL { $$ = NOT_EQUAL; } +| '^' { $$ = '^'; } +| '|' { $$ = '|'; } +| AND { $$ = AND; } +| OR { $$ = OR; } +| ';' { $$ = ';'; } +| ',' { $$ = ','; } +| '=' { $$ = '='; } +| PASTE { $$ = PASTE; } +| DEFINED { $$ = DEFINED; } +; + +%% + +string_list_t * +_string_list_create (void *ctx) +{ + string_list_t *list; + + list = xtalloc (ctx, string_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_string_list_append_item (string_list_t *list, const char *str) +{ + string_node_t *node; + + node = xtalloc (list, string_node_t); + node->str = xtalloc_strdup (node, str); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_string_list_contains (string_list_t *list, const char *member, int *index) +{ + string_node_t *node; + int i; + + if (list == NULL) + return 0; + + for (i = 0, node = list->head; node; i++, node = node->next) { + if (strcmp (node->str, member) == 0) { + if (index) + *index = i; + return 1; + } + } + + return 0; +} + +int +_string_list_length (string_list_t *list) +{ + int length = 0; + string_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +argument_list_t * +_argument_list_create (void *ctx) +{ + argument_list_t *list; + + list = xtalloc (ctx, argument_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_argument_list_append (argument_list_t *list, token_list_t *argument) +{ + argument_node_t *node; + + node = xtalloc (list, argument_node_t); + node->argument = argument; + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_argument_list_length (argument_list_t *list) +{ + int length = 0; + argument_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +token_list_t * +_argument_list_member_at (argument_list_t *list, int index) +{ + argument_node_t *node; + int i; + + if (list == NULL) + return NULL; + + node = list->head; + for (i = 0; i < index; i++) { + node = node->next; + if (node == NULL) + break; + } + + if (node) + return node->argument; + + return NULL; +} + +/* Note: This function talloc_steal()s the str pointer. */ +token_t * +_token_create_str (void *ctx, int type, char *str) +{ + token_t *token; + + token = xtalloc (ctx, token_t); + token->type = type; + token->value.str = talloc_steal (token, str); + + return token; +} + +token_t * +_token_create_ival (void *ctx, int type, int ival) +{ + token_t *token; + + token = xtalloc (ctx, token_t); + token->type = type; + token->value.ival = ival; + + return token; +} + +token_list_t * +_token_list_create (void *ctx) +{ + token_list_t *list; + + list = xtalloc (ctx, token_list_t); + list->head = NULL; + list->tail = NULL; + list->non_space_tail = NULL; + + return list; +} + +void +_token_list_append (token_list_t *list, token_t *token) +{ + token_node_t *node; + + node = xtalloc (list, token_node_t); + node->token = xtalloc_reference (list, token); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; + if (token->type != SPACE) + list->non_space_tail = node; +} + +void +_token_list_append_list (token_list_t *list, token_list_t *tail) +{ + if (tail == NULL || tail->head == NULL) + return; + + if (list->head == NULL) { + list->head = tail->head; + } else { + list->tail->next = tail->head; + } + + list->tail = tail->tail; + list->non_space_tail = tail->non_space_tail; +} + +token_list_t * +_token_list_copy (void *ctx, token_list_t *other) +{ + token_list_t *copy; + token_node_t *node; + + if (other == NULL) + return NULL; + + copy = _token_list_create (ctx); + for (node = other->head; node; node = node->next) + _token_list_append (copy, node->token); + + return copy; +} + +void +_token_list_trim_trailing_space (token_list_t *list) +{ + token_node_t *tail, *next; + + if (list->non_space_tail) { + tail = list->non_space_tail->next; + list->non_space_tail->next = NULL; + list->tail = list->non_space_tail; + + while (tail) { + next = tail->next; + talloc_free (tail); + tail = next; + } + } +} + +static void +_token_print (char **out, token_t *token) +{ + if (token->type < 256) { + glcpp_printf (*out, "%c", token->type); + return; + } + + switch (token->type) { + case INTEGER: + glcpp_printf (*out, "%" PRIxMAX, token->value.ival); + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + glcpp_print (*out, token->value.str); + break; + case SPACE: + glcpp_print (*out, " "); + break; + case LEFT_SHIFT: + glcpp_print (*out, "<<"); + break; + case RIGHT_SHIFT: + glcpp_print (*out, ">>"); + break; + case LESS_OR_EQUAL: + glcpp_print (*out, "<="); + break; + case GREATER_OR_EQUAL: + glcpp_print (*out, ">="); + break; + case EQUAL: + glcpp_print (*out, "=="); + break; + case NOT_EQUAL: + glcpp_print (*out, "!="); + break; + case AND: + glcpp_print (*out, "&&"); + break; + case OR: + glcpp_print (*out, "||"); + break; + case PASTE: + glcpp_print (*out, "##"); + break; + case COMMA_FINAL: + glcpp_print (*out, ","); + break; + case PLACEHOLDER: + /* Nothing to print. */ + break; + default: + assert(!"Error: Don't know how to print token."); + break; + } +} + +/* Return a new token (talloc()ed off of 'token') formed by pasting + * 'token' and 'other'. Note that this function may return 'token' or + * 'other' directly rather than allocating anything new. + * + * Caution: Only very cursory error-checking is performed to see if + * the final result is a valid single token. */ +static token_t * +_token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) +{ + token_t *combined = NULL; + + /* Pasting a placeholder onto anything makes no change. */ + if (other->type == PLACEHOLDER) + return token; + + /* When 'token' is a placeholder, just return 'other'. */ + if (token->type == PLACEHOLDER) + return other; + + /* A very few single-character punctuators can be combined + * with another to form a multi-character punctuator. */ + switch (token->type) { + case '<': + if (other->type == '<') + combined = _token_create_ival (token, LEFT_SHIFT, LEFT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, LESS_OR_EQUAL, LESS_OR_EQUAL); + break; + case '>': + if (other->type == '>') + combined = _token_create_ival (token, RIGHT_SHIFT, RIGHT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, GREATER_OR_EQUAL, GREATER_OR_EQUAL); + break; + case '=': + if (other->type == '=') + combined = _token_create_ival (token, EQUAL, EQUAL); + break; + case '!': + if (other->type == '=') + combined = _token_create_ival (token, NOT_EQUAL, NOT_EQUAL); + break; + case '&': + if (other->type == '&') + combined = _token_create_ival (token, AND, AND); + break; + case '|': + if (other->type == '|') + combined = _token_create_ival (token, OR, OR); + break; + } + + if (combined != NULL) { + /* Inherit the location from the first token */ + combined->location = token->location; + return combined; + } + + /* Two string-valued tokens can usually just be mashed + * together. + * + * XXX: This isn't actually legitimate. Several things here + * should result in a diagnostic since the result cannot be a + * valid, single pre-processing token. For example, pasting + * "123" and "abc" is not legal, but we don't catch that + * here. */ + if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) && + (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING)) + { + char *str; + + str = xtalloc_asprintf (token, "%s%s", + token->value.str, other->value.str); + combined = _token_create_str (token, token->type, str); + combined->location = token->location; + return combined; + } + + glcpp_error (&token->location, parser, ""); + glcpp_print (parser->info_log, "Pasting \""); + _token_print (&parser->info_log, token); + glcpp_print (parser->info_log, "\" and \""); + _token_print (&parser->info_log, other); + glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + + return token; +} + +static void +_token_list_print (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + if (list == NULL) + return; + + for (node = list->head; node; node = node->next) + _token_print (&parser->output, node->token); +} + +void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) +{ + glcpp_error(locp, parser, "%s", error); +} + +glcpp_parser_t * +glcpp_parser_create (void) +{ + glcpp_parser_t *parser; + + parser = xtalloc (NULL, glcpp_parser_t); + + glcpp_lex_init_extra (parser, &parser->scanner); + parser->defines = hash_table_ctor (32, hash_table_string_hash, + hash_table_string_compare); + parser->active = NULL; + parser->lexing_if = 0; + parser->space_tokens = 1; + parser->newline_as_space = 0; + parser->in_control_line = 0; + parser->paren_count = 0; + + parser->skip_stack = NULL; + + parser->lex_from_list = NULL; + parser->lex_from_node = NULL; + + parser->output = talloc_strdup(parser, ""); + parser->info_log = talloc_strdup(parser, ""); + parser->error = 0; + + return parser; +} + +int +glcpp_parser_parse (glcpp_parser_t *parser) +{ + return yyparse (parser); +} + +void +glcpp_parser_destroy (glcpp_parser_t *parser) +{ + if (parser->skip_stack) + glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + glcpp_lex_destroy (parser->scanner); + hash_table_dtor (parser->defines); + talloc_free (parser); +} + +typedef enum function_status +{ + FUNCTION_STATUS_SUCCESS, + FUNCTION_NOT_A_FUNCTION, + FUNCTION_UNBALANCED_PARENTHESES +} function_status_t; + +/* Find a set of function-like macro arguments by looking for a + * balanced set of parentheses. + * + * When called, 'node' should be the opening-parenthesis token, (or + * perhaps preceeding SPACE tokens). Upon successful return *last will + * be the last consumed node, (corresponding to the closing right + * parenthesis). + * + * Return values: + * + * FUNCTION_STATUS_SUCCESS: + * + * Successfully parsed a set of function arguments. + * + * FUNCTION_NOT_A_FUNCTION: + * + * Macro name not followed by a '('. This is not an error, but + * simply that the macro name should be treated as a non-macro. + * + * FUNCTION_UNBALANCED_PARENTHESES + * + * Macro name is not followed by a balanced set of parentheses. + */ +static function_status_t +_arguments_parse (argument_list_t *arguments, + token_node_t *node, + token_node_t **last) +{ + token_list_t *argument; + int paren_count; + + node = node->next; + + /* Ignore whitespace before first parenthesis. */ + while (node && node->token->type == SPACE) + node = node->next; + + if (node == NULL || node->token->type != '(') + return FUNCTION_NOT_A_FUNCTION; + + node = node->next; + + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + + for (paren_count = 1; node; node = node->next) { + if (node->token->type == '(') + { + paren_count++; + } + else if (node->token->type == ')') + { + paren_count--; + if (paren_count == 0) + break; + } + + if (node->token->type == ',' && + paren_count == 1) + { + _token_list_trim_trailing_space (argument); + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + } + else { + if (argument->head == NULL) { + /* Don't treat initial whitespace as + * part of the arguement. */ + if (node->token->type == SPACE) + continue; + } + _token_list_append (argument, node->token); + } + } + + if (paren_count) + return FUNCTION_UNBALANCED_PARENTHESES; + + *last = node; + + return FUNCTION_STATUS_SUCCESS; +} + +/* This is a helper function that's essentially part of the + * implementation of _glcpp_parser_expand_node. It shouldn't be called + * except for by that function. + * + * Returns NULL if node is a simple token with no expansion, (that is, + * although 'node' corresponds to an identifier defined as a + * function-like macro, it is not followed with a parenthesized + * argument list). + * + * Compute the complete expansion of node (which is a function-like + * macro) and subsequent nodes which are arguments. + * + * Returns the token list that results from the expansion and sets + * *last to the last node in the list that was consumed by the + * expansion. Specificallty, *last will be set as follows: as the + * token of the closing right parenthesis. + */ +static token_list_t * +_glcpp_parser_expand_function (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) + +{ + macro_t *macro; + const char *identifier; + argument_list_t *arguments; + function_status_t status; + token_list_t *substituted; + int parameter_index; + + identifier = node->token->value.str; + + macro = hash_table_find (parser->defines, identifier); + + assert (macro->is_function); + + arguments = _argument_list_create (parser); + status = _arguments_parse (arguments, node, last); + + switch (status) { + case FUNCTION_STATUS_SUCCESS: + break; + case FUNCTION_NOT_A_FUNCTION: + return NULL; + case FUNCTION_UNBALANCED_PARENTHESES: + glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier); + return NULL; + } + + if (macro->replacements == NULL) { + talloc_free (arguments); + return _token_list_create (parser); + } + + if (! ((_argument_list_length (arguments) == + _string_list_length (macro->parameters)) || + (_string_list_length (macro->parameters) == 0 && + _argument_list_length (arguments) == 1 && + arguments->head->argument->head == NULL))) + { + glcpp_error (&node->token->location, parser, + "Error: macro %s invoked with %d arguments (expected %d)\n", + identifier, + _argument_list_length (arguments), + _string_list_length (macro->parameters)); + return NULL; + } + + /* Perform argument substitution on the replacement list. */ + substituted = _token_list_create (arguments); + + for (node = macro->replacements->head; node; node = node->next) + { + if (node->token->type == IDENTIFIER && + _string_list_contains (macro->parameters, + node->token->value.str, + ¶meter_index)) + { + token_list_t *argument; + argument = _argument_list_member_at (arguments, + parameter_index); + /* Before substituting, we expand the argument + * tokens, or append a placeholder token for + * an empty argument. */ + if (argument->head) { + _glcpp_parser_expand_token_list (parser, + argument); + _token_list_append_list (substituted, argument); + } else { + token_t *new_token; + + new_token = _token_create_ival (substituted, + PLACEHOLDER, + PLACEHOLDER); + _token_list_append (substituted, new_token); + } + } else { + _token_list_append (substituted, node->token); + } + } + + /* After argument substitution, and before further expansion + * below, implement token pasting. */ + + _token_list_trim_trailing_space (substituted); + + node = substituted->head; + while (node) + { + token_node_t *next_non_space; + + /* Look ahead for a PASTE token, skipping space. */ + next_non_space = node->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) + break; + + if (next_non_space->token->type != PASTE) { + node = next_non_space; + continue; + } + + /* Now find the next non-space token after the PASTE. */ + next_non_space = next_non_space->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) { + yyerror (&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n"); + return NULL; + } + + node->token = _token_paste (parser, node->token, next_non_space->token); + node->next = next_non_space->next; + if (next_non_space == substituted->tail) + substituted->tail = node; + + node = node->next; + } + + substituted->non_space_tail = substituted->tail; + + return substituted; +} + +/* Compute the complete expansion of node, (and subsequent nodes after + * 'node' in the case that 'node' is a function-like macro and + * subsequent nodes are arguments). + * + * Returns NULL if node is a simple token with no expansion. + * + * Otherwise, returns the token list that results from the expansion + * and sets *last to the last node in the list that was consumed by + * the expansion. Specificallty, *last will be set as follows: + * + * As 'node' in the case of object-like macro expansion. + * + * As the token of the closing right parenthesis in the case of + * function-like macro expansion. + */ +static token_list_t * +_glcpp_parser_expand_node (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) +{ + token_t *token = node->token; + const char *identifier; + macro_t *macro; + + /* We only expand identifiers */ + if (token->type != IDENTIFIER) { + /* We change any COMMA into a COMMA_FINAL to prevent + * it being mistaken for an argument separator + * later. */ + if (token->type == ',') { + token->type = COMMA_FINAL; + token->value.ival = COMMA_FINAL; + } + + return NULL; + } + + /* Look up this identifier in the hash table. */ + identifier = token->value.str; + macro = hash_table_find (parser->defines, identifier); + + /* Not a macro, so no expansion needed. */ + if (macro == NULL) + return NULL; + + /* Finally, don't expand this macro if we're already actively + * expanding it, (to avoid infinite recursion). */ + if (_active_list_contains (parser->active, identifier)) { + /* We change the token type here from IDENTIFIER to + * OTHER to prevent any future expansion of this + * unexpanded token. */ + char *str; + token_list_t *expansion; + token_t *final; + + str = xtalloc_strdup (parser, token->value.str); + final = _token_create_str (parser, OTHER, str); + expansion = _token_list_create (parser); + _token_list_append (expansion, final); + *last = node; + return expansion; + } + + if (! macro->is_function) + { + *last = node; + + if (macro->replacements == NULL) + return _token_list_create (parser); + + return _token_list_copy (parser, macro->replacements); + } + + return _glcpp_parser_expand_function (parser, node, last); +} + +/* Push a new identifier onto the active list, returning the new list. + * + * Here, 'marker' is the token node that appears in the list after the + * expansion of 'identifier'. That is, when the list iterator begins + * examinging 'marker', then it is time to pop this node from the + * active stack. + */ +active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker) +{ + active_list_t *node; + + node = xtalloc (list, active_list_t); + node->identifier = xtalloc_strdup (node, identifier); + node->marker = marker; + node->next = list; + + return node; +} + +active_list_t * +_active_list_pop (active_list_t *list) +{ + active_list_t *node = list; + + if (node == NULL) + return NULL; + + node = list->next; + talloc_free (list); + + return node; +} + +int +_active_list_contains (active_list_t *list, const char *identifier) +{ + active_list_t *node; + + if (list == NULL) + return 0; + + for (node = list; node; node = node->next) + if (strcmp (node->identifier, identifier) == 0) + return 1; + + return 0; +} + +/* Walk over the token list replacing nodes with their expansion. + * Whenever nodes are expanded the walking will walk over the new + * nodes, continuing to expand as necessary. The results are placed in + * 'list' itself; + */ +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + token_node_t *node_prev; + token_node_t *node, *last = NULL; + token_list_t *expansion; + + if (list == NULL) + return; + + _token_list_trim_trailing_space (list); + + node_prev = NULL; + node = list->head; + + while (node) { + + while (parser->active && parser->active->marker == node) + parser->active = _active_list_pop (parser->active); + + /* Find the expansion for node, which will replace all + * nodes from node to last, inclusive. */ + expansion = _glcpp_parser_expand_node (parser, node, &last); + if (expansion) { + token_node_t *n; + + for (n = node; n != last->next; n = n->next) + while (parser->active && + parser->active->marker == n) + { + parser->active = _active_list_pop (parser->active); + } + + parser->active = _active_list_push (parser->active, + node->token->value.str, + last->next); + + /* Splice expansion into list, supporting a + * simple deletion if the expansion is + * empty. */ + if (expansion->head) { + if (node_prev) + node_prev->next = expansion->head; + else + list->head = expansion->head; + expansion->tail->next = last->next; + if (last == list->tail) + list->tail = expansion->tail; + } else { + if (node_prev) + node_prev->next = last->next; + else + list->head = last->next; + if (last == list->tail) + list->tail = NULL; + } + } else { + node_prev = node; + } + node = node_prev ? node_prev->next : list->head; + } + + while (parser->active) + parser->active = _active_list_pop (parser->active); + + list->non_space_tail = list->tail; +} + +void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + if (list == NULL) + return; + + _glcpp_parser_expand_token_list (parser, list); + + _token_list_trim_trailing_space (list); + + _token_list_print (parser, list); +} + +void +_check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, + const char *identifier) +{ + /* According to the GLSL specification, macro names starting with "__" + * or "GL_" are reserved for future use. So, don't allow them. + */ + if (strncmp(identifier, "__", 2) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n"); + } + if (strncmp(identifier, "GL_", 3) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n"); + } +} + +void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + token_list_t *replacements) +{ + macro_t *macro; + + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = xtalloc (parser, macro_t); + + macro->is_function = 0; + macro->parameters = NULL; + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + hash_table_insert (parser->defines, macro, identifier); +} + +void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + string_list_t *parameters, + token_list_t *replacements) +{ + macro_t *macro; + + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = xtalloc (parser, macro_t); + + macro->is_function = 1; + macro->parameters = talloc_steal (macro, parameters); + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + hash_table_insert (parser->defines, macro, identifier); +} + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) +{ + token_node_t *node; + int ret; + + if (parser->lex_from_list == NULL) { + ret = glcpp_lex (yylval, yylloc, parser->scanner); + + /* XXX: This ugly block of code exists for the sole + * purpose of converting a NEWLINE token into a SPACE + * token, but only in the case where we have seen a + * function-like macro name, but have not yet seen its + * closing parenthesis. + * + * There's perhaps a more compact way to do this with + * mid-rule actions in the grammar. + * + * I'm definitely not pleased with the complexity of + * this code here. + */ + if (parser->newline_as_space) + { + if (ret == '(') { + parser->paren_count++; + } else if (ret == ')') { + parser->paren_count--; + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } else if (ret == NEWLINE) { + ret = SPACE; + } else if (ret != SPACE) { + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } + } + else if (parser->in_control_line) + { + if (ret == NEWLINE) + parser->in_control_line = 0; + } + else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC || + ret == HASH_UNDEF || ret == HASH_IF || + ret == HASH_IFDEF || ret == HASH_IFNDEF || + ret == HASH_ELIF || ret == HASH_ELSE || + ret == HASH_ENDIF || ret == HASH) + { + parser->in_control_line = 1; + } + else if (ret == IDENTIFIER) + { + macro_t *macro; + macro = hash_table_find (parser->defines, + yylval->str); + if (macro && macro->is_function) { + parser->newline_as_space = 1; + parser->paren_count = 0; + } + } + + return ret; + } + + node = parser->lex_from_node; + + if (node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + return NEWLINE; + } + + *yylval = node->token->value; + ret = node->token->type; + + parser->lex_from_node = node->next; + + return ret; +} + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + assert (parser->lex_from_list == NULL); + + /* Copy list, eliminating any space tokens. */ + parser->lex_from_list = _token_list_create (parser); + + for (node = list->head; node; node = node->next) { + if (node->token->type == SPACE) + continue; + _token_list_append (parser->lex_from_list, node->token); + } + + talloc_free (list); + + parser->lex_from_node = parser->lex_from_list->head; + + /* It's possible the list consisted of nothing but whitespace. */ + if (parser->lex_from_node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + } +} + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition) +{ + skip_type_t current = SKIP_NO_SKIP; + skip_node_t *node; + + if (parser->skip_stack) + current = parser->skip_stack->type; + + node = xtalloc (parser, skip_node_t); + node->loc = *loc; + + if (current == SKIP_NO_SKIP) { + if (condition) + node->type = SKIP_NO_SKIP; + else + node->type = SKIP_TO_ELSE; + } else { + node->type = SKIP_TO_ENDIF; + } + + node->next = parser->skip_stack; + parser->skip_stack = node; +} + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition) +{ + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "%s without #if\n", type); + return; + } + + if (parser->skip_stack->type == SKIP_TO_ELSE) { + if (condition) + parser->skip_stack->type = SKIP_NO_SKIP; + } else { + parser->skip_stack->type = SKIP_TO_ENDIF; + } +} + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) +{ + skip_node_t *node; + + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "#endif without #if\n"); + return; + } + + node = parser->skip_stack; + parser->skip_stack = node->next; + talloc_free (node); +} diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c new file mode 100644 index 0000000000..cc87e14950 --- /dev/null +++ b/src/glsl/glcpp/glcpp.c @@ -0,0 +1,88 @@ +/* + * 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 +#include +#include +#include +#include "glcpp.h" + +extern int yydebug; + +static char * +load_text_file(void *ctx, const char *file_name) +{ + char *text = NULL; + struct stat st; + ssize_t total_read = 0; + int fd = file_name == NULL ? STDIN_FILENO : open(file_name, O_RDONLY); + + if (fd < 0) { + return NULL; + } + + if (fstat(fd, & st) == 0) { + text = (char *) talloc_size(ctx, st.st_size + 1); + if (text != NULL) { + do { + ssize_t bytes = read(fd, text + total_read, + st.st_size - total_read); + if (bytes < 0) { + text = NULL; + break; + } + + if (bytes == 0) { + break; + } + + total_read += bytes; + } while (total_read < st.st_size); + + text[total_read] = '\0'; + } + } + + close(fd); + + return text; +} + +int +preprocess(void *talloc_ctx, const char **shader, char **info_log); + +int +main (void) +{ + void *ctx = talloc(NULL, void*); + const char *shader = load_text_file(ctx, NULL); + char *info_log = talloc_strdup(ctx, ""); + int ret = preprocess(ctx, &shader, &info_log); + + printf("%s", shader); + fprintf(stderr, "%s", info_log); + + talloc_free(ctx); + + return ret; +} diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h new file mode 100644 index 0000000000..2cfa98d2b1 --- /dev/null +++ b/src/glsl/glcpp/glcpp.h @@ -0,0 +1,224 @@ +/* + * 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. + */ + +#ifndef GLCPP_H +#define GLCPP_H + +#include + +#include + +#include "hash_table.h" + +#define yyscan_t void* + +/* Some data types used for parser values. */ + +typedef struct string_node { + const char *str; + struct string_node *next; +} string_node_t; + +typedef struct string_list { + string_node_t *head; + string_node_t *tail; +} string_list_t; + +typedef struct token token_t; +typedef struct token_list token_list_t; + +typedef union YYSTYPE +{ + intmax_t ival; + char *str; + string_list_t *string_list; + token_t *token; + token_list_t *token_list; +} YYSTYPE; + +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 + +typedef struct YYLTYPE { + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 + +struct token { + int type; + YYSTYPE value; + YYLTYPE location; +}; + +typedef struct token_node { + token_t *token; + struct token_node *next; +} token_node_t; + +struct token_list { + token_node_t *head; + token_node_t *tail; + token_node_t *non_space_tail; +}; + +typedef struct argument_node { + token_list_t *argument; + struct argument_node *next; +} argument_node_t; + +typedef struct argument_list { + argument_node_t *head; + argument_node_t *tail; +} argument_list_t; + +typedef struct glcpp_parser glcpp_parser_t; + +typedef enum { + TOKEN_CLASS_IDENTIFIER, + TOKEN_CLASS_IDENTIFIER_FINALIZED, + TOKEN_CLASS_FUNC_MACRO, + TOKEN_CLASS_OBJ_MACRO +} token_class_t; + +token_class_t +glcpp_parser_classify_token (glcpp_parser_t *parser, + const char *identifier, + int *parameter_index); + +typedef struct { + int is_function; + string_list_t *parameters; + const char *identifier; + token_list_t *replacements; +} macro_t; + +typedef struct expansion_node { + macro_t *macro; + token_node_t *replacements; + struct expansion_node *next; +} expansion_node_t; + +typedef enum skip_type { + SKIP_NO_SKIP, + SKIP_TO_ELSE, + SKIP_TO_ENDIF +} skip_type_t; + +typedef struct skip_node { + skip_type_t type; + YYLTYPE loc; /* location of the initial #if/#elif/... */ + struct skip_node *next; +} skip_node_t; + +typedef struct active_list { + const char *identifier; + token_node_t *marker; + struct active_list *next; +} active_list_t; + +struct glcpp_parser { + yyscan_t scanner; + struct hash_table *defines; + active_list_t *active; + int lexing_if; + int space_tokens; + int newline_as_space; + int in_control_line; + int paren_count; + skip_node_t *skip_stack; + token_list_t *lex_from_list; + token_node_t *lex_from_node; + char *output; + char *info_log; + int error; +}; + +glcpp_parser_t * +glcpp_parser_create (void); + +int +glcpp_parser_parse (glcpp_parser_t *parser); + +void +glcpp_parser_destroy (glcpp_parser_t *parser); + +int +preprocess(void *talloc_ctx, const char **shader, char **info_log); + +/* Functions for writing to the info log */ + +void +glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...); + +void +glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...); + +/* Generated by glcpp-lex.l to glcpp-lex.c */ + +int +glcpp_lex_init_extra (glcpp_parser_t *parser, yyscan_t* scanner); + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader); + +int +glcpp_lex (YYSTYPE *lvalp, YYLTYPE *llocp, yyscan_t scanner); + +int +glcpp_lex_destroy (yyscan_t scanner); + +/* Generated by glcpp-parse.y to glcpp-parse.c */ + +int +yyparse (glcpp_parser_t *parser); + +/* xtalloc - wrappers around talloc to check for out-of-memory */ + +#define xtalloc(ctx, type) (type *)xtalloc_named_const(ctx, sizeof(type), #type) + +#define xtalloc_size(ctx, size) xtalloc_named_const(ctx, size, __location__) + +void * +xtalloc_named_const (const void *context, size_t size, const char *name); + +char * +xtalloc_strdup (const void *t, const char *p); + +char * +xtalloc_strndup (const void *t, const char *p, size_t n); + +char * +xtalloc_asprintf (const void *t, const char *fmt, ...); + +void * +_xtalloc_reference_loc (const void *context, + const void *ptr, const char *location); + +#define xtalloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_xtalloc_reference_loc((ctx),(ptr), __location__) + +#endif diff --git a/src/glsl/glcpp/hash_table.c b/src/glsl/glcpp/hash_table.c new file mode 100644 index 0000000000..e89a2564d7 --- /dev/null +++ b/src/glsl/glcpp/hash_table.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2008 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 hash_table.c + * \brief Implementation of a generic, opaque hash table data type. + * + * \author Ian Romanick + */ + +#include "main/imports.h" +#include "main/simple_list.h" +#include "hash_table.h" + +struct node { + struct node *next; + struct node *prev; +}; + +struct hash_table { + hash_func_t hash; + hash_compare_func_t compare; + + unsigned num_buckets; + struct node buckets[1]; +}; + + +struct hash_node { + struct node link; + const void *key; + void *data; +}; + + +struct hash_table * +hash_table_ctor(unsigned num_buckets, hash_func_t hash, + hash_compare_func_t compare) +{ + struct hash_table *ht; + unsigned i; + + + if (num_buckets < 16) { + num_buckets = 16; + } + + ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) + * sizeof(ht->buckets[0]))); + if (ht != NULL) { + ht->hash = hash; + ht->compare = compare; + ht->num_buckets = num_buckets; + + for (i = 0; i < num_buckets; i++) { + make_empty_list(& ht->buckets[i]); + } + } + + return ht; +} + + +void +hash_table_dtor(struct hash_table *ht) +{ + hash_table_clear(ht); + _mesa_free(ht); +} + + +void +hash_table_clear(struct hash_table *ht) +{ + struct node *node; + struct node *temp; + unsigned i; + + + for (i = 0; i < ht->num_buckets; i++) { + foreach_s(node, temp, & ht->buckets[i]) { + remove_from_list(node); + _mesa_free(node); + } + + assert(is_empty_list(& ht->buckets[i])); + } +} + + +void * +hash_table_find(struct hash_table *ht, const void *key) +{ + const unsigned hash_value = (*ht->hash)(key); + const unsigned bucket = hash_value % ht->num_buckets; + struct node *node; + + foreach(node, & ht->buckets[bucket]) { + struct hash_node *hn = (struct hash_node *) node; + + if ((*ht->compare)(hn->key, key) == 0) { + return hn->data; + } + } + + return NULL; +} + + +void +hash_table_insert(struct hash_table *ht, void *data, const void *key) +{ + const unsigned hash_value = (*ht->hash)(key); + const unsigned bucket = hash_value % ht->num_buckets; + struct hash_node *node; + + node = _mesa_calloc(sizeof(*node)); + + node->data = data; + node->key = key; + + insert_at_head(& ht->buckets[bucket], & node->link); +} + + +unsigned +hash_table_string_hash(const void *key) +{ + const char *str = (const char *) key; + unsigned hash = 5381; + + + while (*str != '\0') { + hash = (hash * 33) + *str; + str++; + } + + return hash; +} diff --git a/src/glsl/glcpp/hash_table.h b/src/glsl/glcpp/hash_table.h new file mode 100644 index 0000000000..b9dd343dee --- /dev/null +++ b/src/glsl/glcpp/hash_table.h @@ -0,0 +1,125 @@ +/* + * Copyright © 2008 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 hash_table.h + * \brief Implementation of a generic, opaque hash table data type. + * + * \author Ian Romanick + */ + +#ifndef HASH_TABLE_H +#define HASH_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct hash_table; + +typedef unsigned (*hash_func_t)(const void *key); +typedef int (*hash_compare_func_t)(const void *key1, const void *key2); + +/** + * Hash table constructor + * + * Creates a hash table with the specified number of buckets. The supplied + * \c hash and \c compare routines are used when adding elements to the table + * and when searching for elements in the table. + * + * \param num_buckets Number of buckets (bins) in the hash table. + * \param hash Function used to compute hash value of input keys. + * \param compare Function used to compare keys. + */ +extern struct hash_table *hash_table_ctor(unsigned num_buckets, + hash_func_t hash, hash_compare_func_t compare); + + +/** + * Release all memory associated with a hash table + * + * \warning + * This function cannot release memory occupied either by keys or data. + */ +extern void hash_table_dtor(struct hash_table *ht); + + +/** + * Flush all entries from a hash table + * + * \param ht Table to be cleared of its entries. + */ +extern void hash_table_clear(struct hash_table *ht); + + +/** + * Search a hash table for a specific element + * + * \param ht Table to be searched + * \param key Key of the desired element + * + * \return + * The \c data value supplied to \c hash_table_insert when the element with + * the matching key was added. If no matching key exists in the table, + * \c NULL is returned. + */ +extern void *hash_table_find(struct hash_table *ht, const void *key); + + +/** + * Add an element to a hash table + */ +extern void hash_table_insert(struct hash_table *ht, void *data, + const void *key); + + +/** + * Compute hash value of a string + * + * Computes the hash value of a string using the DJB2 algorithm developed by + * Professor Daniel J. Bernstein. It was published on comp.lang.c once upon + * a time. I was unable to find the original posting in the archives. + * + * \param key Pointer to a NUL terminated string to be hashed. + * + * \sa hash_table_string_compare + */ +extern unsigned hash_table_string_hash(const void *key); + + +/** + * Compare two strings used as keys + * + * This is just a macro wrapper around \c strcmp. + * + * \sa hash_table_string_hash + */ +#define hash_table_string_compare ((hash_compare_func_t) strcmp) + +#ifdef __cplusplus +}; +#endif + +#endif /* HASH_TABLE_H */ diff --git a/src/glsl/glcpp/main/imports.h b/src/glsl/glcpp/main/imports.h new file mode 100644 index 0000000000..d2197342c0 --- /dev/null +++ b/src/glsl/glcpp/main/imports.h @@ -0,0 +1,6 @@ +#include +#include + +#define _mesa_malloc(x) malloc(x) +#define _mesa_free(x) free(x) +#define _mesa_calloc(x) calloc(1,x) diff --git a/src/glsl/glcpp/main/simple_list.h b/src/glsl/glcpp/main/simple_list.h new file mode 100644 index 0000000000..5ef39e14cc --- /dev/null +++ b/src/glsl/glcpp/main/simple_list.h @@ -0,0 +1,235 @@ +/** + * \file simple_list.h + * Simple macros for type-safe, intrusive lists. + * + * Intended to work with a list sentinal which is created as an empty + * list. Insert & delete are O(1). + * + * \author + * (C) 1997, Keith Whitwell + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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. + */ + + +#ifndef _SIMPLE_LIST_H +#define _SIMPLE_LIST_H + +struct simple_node { + struct simple_node *next; + struct simple_node *prev; +}; + +/** + * Remove an element from list. + * + * \param elem element to remove. + */ +#define remove_from_list(elem) \ +do { \ + (elem)->next->prev = (elem)->prev; \ + (elem)->prev->next = (elem)->next; \ +} while (0) + +/** + * Insert an element to the list head. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_head(list, elem) \ +do { \ + (elem)->prev = list; \ + (elem)->next = (list)->next; \ + (list)->next->prev = elem; \ + (list)->next = elem; \ +} while(0) + +/** + * Insert an element to the list tail. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_tail(list, elem) \ +do { \ + (elem)->next = list; \ + (elem)->prev = (list)->prev; \ + (list)->prev->next = elem; \ + (list)->prev = elem; \ +} while(0) + +/** + * Move an element to the list head. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_head(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_head(list, elem); \ +} while (0) + +/** + * Move an element to the list tail. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_tail(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_tail(list, elem); \ +} while (0) + +/** + * Consatinate a cyclic list to a list + * + * Appends the sequence of nodes starting with \c tail to the list \c head. + * A "cyclic list" is a list that does not have a sentinal node. This means + * that the data pointed to by \c tail is an actual node, not a dataless + * sentinal. Note that if \c tail constist of a single node, this macro + * behaves identically to \c insert_at_tail + * + * \param head Head of the list to be appended to. This may or may not + * be a cyclic list. + * \param tail Head of the cyclic list to be appended to \c head. + * \param temp Temporary \c simple_list used by the macro + * + * \sa insert_at_tail + */ +#define concat_list_and_cycle(head, tail, temp) \ +do { \ + (head)->prev->next = (tail); \ + (tail)->prev->next = (head); \ + (temp) = (head)->prev; \ + (head)->prev = (tail)->prev; \ + (tail)->prev = (temp); \ +} while (0) + +#define concat_list(head, next_list) \ +do { \ + (next_list)->next->prev = (head)->prev; \ + (next_list)->prev->next = (head); \ + (head)->prev->next = (next_list)->next; \ + (head)->prev = (next_list)->prev; \ +} while (0) + +/** + * Make a empty list empty. + * + * \param sentinal list (sentinal element). + */ +#define make_empty_list(sentinal) \ +do { \ + (sentinal)->next = sentinal; \ + (sentinal)->prev = sentinal; \ +} while (0) + +/** + * Get list first element. + * + * \param list list. + * + * \return pointer to first element. + */ +#define first_elem(list) ((list)->next) + +/** + * Get list last element. + * + * \param list list. + * + * \return pointer to last element. + */ +#define last_elem(list) ((list)->prev) + +/** + * Get next element. + * + * \param elem element. + * + * \return pointer to next element. + */ +#define next_elem(elem) ((elem)->next) + +/** + * Get previous element. + * + * \param elem element. + * + * \return pointer to previous element. + */ +#define prev_elem(elem) ((elem)->prev) + +/** + * Test whether element is at end of the list. + * + * \param list list. + * \param elem element. + * + * \return non-zero if element is at end of list, or zero otherwise. + */ +#define at_end(list, elem) ((elem) == (list)) + +/** + * Test if a list is empty. + * + * \param list list. + * + * \return non-zero if list empty, or zero otherwise. + */ +#define is_empty_list(list) ((list)->next == (list)) + +/** + * Walk through the elements of a list. + * + * \param ptr pointer to the current element. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach(ptr, list) \ + for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) + +/** + * Walk through the elements of a list. + * + * Same as #foreach but lets you unlink the current value during a list + * traversal. Useful for freeing a list, element by element. + * + * \param ptr pointer to the current element. + * \param t temporary pointer. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach_s(ptr, t, list) \ + for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) + +#endif diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c new file mode 100644 index 0000000000..a25b7b72a6 --- /dev/null +++ b/src/glsl/glcpp/pp.c @@ -0,0 +1,155 @@ +/* + * 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 +#include +#include "glcpp.h" + +void +glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) +{ + parser->error = 1; + parser->info_log = talloc_asprintf_append(parser->info_log, + "%u:%u(%u): " + "preprocessor error: ", + locp->source, + locp->first_line, + locp->first_column); + va_list ap; + va_start(ap, fmt); + parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + va_end(ap); + parser->info_log = talloc_strdup_append(parser->info_log, "\n"); +} + +void +glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) +{ + parser->info_log = talloc_asprintf_append(parser->info_log, + "%u:%u(%u): " + "preprocessor warning: ", + locp->source, + locp->first_line, + locp->first_column); + va_list ap; + va_start(ap, fmt); + parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + va_end(ap); + parser->info_log = talloc_strdup_append(parser->info_log, "\n"); +} + +/* Searches backwards for '^ *#' from a given starting point. */ +static int +in_directive(const char *shader, const char *ptr) +{ + assert(ptr >= shader); + + /* Search backwards for '#'. If we find a \n first, it doesn't count */ + for (; ptr >= shader && *ptr != '#'; ptr--) { + if (*ptr == '\n') + return 0; + } + if (ptr >= shader) { + /* Found '#'...look for spaces preceded by a newline */ + for (ptr--; ptr >= shader && isblank(*ptr); ptr--); + // FIXME: I don't think the '\n' case can happen + if (ptr < shader || *ptr == '\n') + return 1; + } + return 0; +} + +/* Remove any line continuation characters in preprocessing directives. + * However, ignore any in GLSL code, as "There is no line continuation + * character" (1.30 page 9) in GLSL. + */ +static char * +remove_line_continuations(glcpp_parser_t *ctx, const char *shader) +{ + int in_continued_line = 0; + int extra_newlines = 0; + char *clean = talloc_strdup(ctx, ""); + const char *search_start = shader; + const char *newline; + while ((newline = strchr(search_start, '\n')) != NULL) { + const char *backslash = NULL; + /* Find the preceding '\', if it exists */ + if (newline[-1] == '\\') { + backslash = newline - 1; + } else if (newline[-1] == '\r' && newline[-2] == '\\') { + backslash = newline - 2; + } + /* Double backslashes don't count (the backslash is escaped) */ + if (backslash != NULL && backslash[-1] == '\\') { + backslash = NULL; + } + + if (backslash != NULL) { + /* We found a line continuation, but do we care? */ + if (!in_continued_line) { + if (in_directive(shader, backslash)) { + in_continued_line = 1; + extra_newlines = 0; + } + } + if (in_continued_line) { + /* Copy everything before the \ */ + clean = talloc_strndup_append(clean, shader, backslash - shader); + shader = newline + 1; + extra_newlines++; + } + } else if (in_continued_line) { + /* Copy everything up to and including the \n */ + clean = talloc_strndup_append(clean, shader, newline - shader + 1); + shader = newline + 1; + /* Output extra newlines to make line numbers match */ + for (; extra_newlines > 0; extra_newlines--) + clean = talloc_strdup_append(clean, "\n"); + in_continued_line = 0; + } + search_start = newline + 1; + } + clean = talloc_strdup_append(clean, shader); + return clean; +} + +extern int +preprocess(void *talloc_ctx, const char **shader, char **info_log) +{ + int errors; + glcpp_parser_t *parser = glcpp_parser_create (); + *shader = remove_line_continuations(parser, *shader); + + glcpp_lex_set_source_string (parser, *shader); + + glcpp_parser_parse (parser); + + *info_log = talloc_strdup_append(*info_log, parser->info_log); + + talloc_steal(talloc_ctx, parser->output); + *shader = parser->output; + + errors = parser->error; + glcpp_parser_destroy (parser); + return errors; +} diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c b/src/glsl/glcpp/tests/000-content-with-spaces.c new file mode 100644 index 0000000000..696cb3a74f --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c @@ -0,0 +1 @@ +this is four tokens diff --git a/src/glsl/glcpp/tests/000-content-with-spaces.c.expected b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected new file mode 100644 index 0000000000..83f7834d54 --- /dev/null +++ b/src/glsl/glcpp/tests/000-content-with-spaces.c.expected @@ -0,0 +1,2 @@ +this is four tokens + diff --git a/src/glsl/glcpp/tests/001-define.c b/src/glsl/glcpp/tests/001-define.c new file mode 100644 index 0000000000..cbf2fee0e7 --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c @@ -0,0 +1,2 @@ +#define foo 1 +foo diff --git a/src/glsl/glcpp/tests/001-define.c.expected b/src/glsl/glcpp/tests/001-define.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/001-define.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/002-define-chain.c b/src/glsl/glcpp/tests/002-define-chain.c new file mode 100644 index 0000000000..87d75c6875 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/002-define-chain.c.expected b/src/glsl/glcpp/tests/002-define-chain.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/002-define-chain.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c b/src/glsl/glcpp/tests/003-define-chain-reverse.c new file mode 100644 index 0000000000..a18b724eca --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/003-define-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/004-define-recursive.c b/src/glsl/glcpp/tests/004-define-recursive.c new file mode 100644 index 0000000000..2ac56ea3dc --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c @@ -0,0 +1,6 @@ +#define foo bar +#define bar baz +#define baz foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/004-define-recursive.c.expected b/src/glsl/glcpp/tests/004-define-recursive.c.expected new file mode 100644 index 0000000000..4d2698b7a7 --- /dev/null +++ b/src/glsl/glcpp/tests/004-define-recursive.c.expected @@ -0,0 +1,7 @@ + + + +foo +bar +baz + diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c b/src/glsl/glcpp/tests/005-define-composite-chain.c new file mode 100644 index 0000000000..f5521df968 --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c @@ -0,0 +1,3 @@ +#define foo 1 +#define bar a foo +bar diff --git a/src/glsl/glcpp/tests/005-define-composite-chain.c.expected b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected new file mode 100644 index 0000000000..c67358f4f6 --- /dev/null +++ b/src/glsl/glcpp/tests/005-define-composite-chain.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c new file mode 100644 index 0000000000..4bb91a1221 --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c @@ -0,0 +1,3 @@ +#define bar a foo +#define foo 1 +bar diff --git a/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected new file mode 100644 index 0000000000..c67358f4f6 --- /dev/null +++ b/src/glsl/glcpp/tests/006-define-composite-chain-reverse.c.expected @@ -0,0 +1,4 @@ + + +a 1 + diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c b/src/glsl/glcpp/tests/007-define-composite-recursive.c new file mode 100644 index 0000000000..5784565bdf --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c @@ -0,0 +1,6 @@ +#define foo a bar +#define bar b baz +#define baz c foo +foo +bar +baz diff --git a/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected new file mode 100644 index 0000000000..30fe4dc1f6 --- /dev/null +++ b/src/glsl/glcpp/tests/007-define-composite-recursive.c.expected @@ -0,0 +1,7 @@ + + + +a b c foo +b c a bar +c a b baz + diff --git a/src/glsl/glcpp/tests/008-define-empty.c b/src/glsl/glcpp/tests/008-define-empty.c new file mode 100644 index 0000000000..b1bd17ec21 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c @@ -0,0 +1,2 @@ +#define foo +foo diff --git a/src/glsl/glcpp/tests/008-define-empty.c.expected b/src/glsl/glcpp/tests/008-define-empty.c.expected new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/src/glsl/glcpp/tests/008-define-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/009-undef.c b/src/glsl/glcpp/tests/009-undef.c new file mode 100644 index 0000000000..3fc1fb4424 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c @@ -0,0 +1,4 @@ +#define foo 1 +foo +#undef foo +foo diff --git a/src/glsl/glcpp/tests/009-undef.c.expected b/src/glsl/glcpp/tests/009-undef.c.expected new file mode 100644 index 0000000000..03a7061af0 --- /dev/null +++ b/src/glsl/glcpp/tests/009-undef.c.expected @@ -0,0 +1,5 @@ + +1 + +foo + diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c b/src/glsl/glcpp/tests/010-undef-re-define.c new file mode 100644 index 0000000000..32ff73798b --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c @@ -0,0 +1,6 @@ +#define foo 1 +foo +#undef foo +foo +#define foo 2 +foo diff --git a/src/glsl/glcpp/tests/010-undef-re-define.c.expected b/src/glsl/glcpp/tests/010-undef-re-define.c.expected new file mode 100644 index 0000000000..f4f7efdc2b --- /dev/null +++ b/src/glsl/glcpp/tests/010-undef-re-define.c.expected @@ -0,0 +1,7 @@ + +1 + +foo + +2 + diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c b/src/glsl/glcpp/tests/011-define-func-empty.c new file mode 100644 index 0000000000..d9ce13c228 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c @@ -0,0 +1,2 @@ +#define foo() +foo() diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/glsl/glcpp/tests/011-define-func-empty.c.expected new file mode 100644 index 0000000000..b28b04f643 --- /dev/null +++ b/src/glsl/glcpp/tests/011-define-func-empty.c.expected @@ -0,0 +1,3 @@ + + + diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c b/src/glsl/glcpp/tests/012-define-func-no-args.c new file mode 100644 index 0000000000..c2bb730b11 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c @@ -0,0 +1,2 @@ +#define foo() bar +foo() diff --git a/src/glsl/glcpp/tests/012-define-func-no-args.c.expected b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected new file mode 100644 index 0000000000..0353767297 --- /dev/null +++ b/src/glsl/glcpp/tests/012-define-func-no-args.c.expected @@ -0,0 +1,3 @@ + +bar + diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c new file mode 100644 index 0000000000..f78fb8b118 --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x) 1 +foo(bar) diff --git a/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/013-define-func-1-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c new file mode 100644 index 0000000000..11feb2624b --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c @@ -0,0 +1,2 @@ +#define foo(x,y) 1 +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected new file mode 100644 index 0000000000..878fd15d6f --- /dev/null +++ b/src/glsl/glcpp/tests/014-define-func-2-arg-unused.c.expected @@ -0,0 +1,3 @@ + +1 + diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c b/src/glsl/glcpp/tests/015-define-object-with-parens.c new file mode 100644 index 0000000000..558da9c617 --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c @@ -0,0 +1,4 @@ +#define foo ()1 +foo() +#define bar ()2 +bar() diff --git a/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected new file mode 100644 index 0000000000..d6f8cb9dc6 --- /dev/null +++ b/src/glsl/glcpp/tests/015-define-object-with-parens.c.expected @@ -0,0 +1,5 @@ + +()1() + +()2() + diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c b/src/glsl/glcpp/tests/016-define-func-1-arg.c new file mode 100644 index 0000000000..a2e2404c7c --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c @@ -0,0 +1,2 @@ +#define foo(x) ((x)+1) +foo(bar) diff --git a/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected new file mode 100644 index 0000000000..7f1828a3c6 --- /dev/null +++ b/src/glsl/glcpp/tests/016-define-func-1-arg.c.expected @@ -0,0 +1,3 @@ + +((bar)+1) + diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c b/src/glsl/glcpp/tests/017-define-func-2-args.c new file mode 100644 index 0000000000..c725383527 --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c @@ -0,0 +1,2 @@ +#define foo(x,y) ((x)*(y)) +foo(bar,baz) diff --git a/src/glsl/glcpp/tests/017-define-func-2-args.c.expected b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected new file mode 100644 index 0000000000..9f341dac00 --- /dev/null +++ b/src/glsl/glcpp/tests/017-define-func-2-args.c.expected @@ -0,0 +1,3 @@ + +((bar)*(baz)) + diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c new file mode 100644 index 0000000000..668130b8f9 --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c @@ -0,0 +1,3 @@ +#define x 0 +#define foo(x) x +foo(1) diff --git a/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected new file mode 100644 index 0000000000..43d484d713 --- /dev/null +++ b/src/glsl/glcpp/tests/018-define-func-macro-as-parameter.c.expected @@ -0,0 +1,4 @@ + + +1 + diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c new file mode 100644 index 0000000000..c4e62b2550 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(this is more than one word) diff --git a/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected new file mode 100644 index 0000000000..4314fc88d8 --- /dev/null +++ b/src/glsl/glcpp/tests/019-define-func-1-arg-multi.c.expected @@ -0,0 +1,3 @@ + +(this is more than one word) + diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c new file mode 100644 index 0000000000..3049ad1546 --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c @@ -0,0 +1,2 @@ +#define foo(x,y) x,two fish,red fish,y +foo(one fish, blue fish) diff --git a/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected new file mode 100644 index 0000000000..5648e4fb9d --- /dev/null +++ b/src/glsl/glcpp/tests/020-define-func-2-arg-multi.c.expected @@ -0,0 +1,3 @@ + +one fish,two fish,red fish,blue fish + diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c b/src/glsl/glcpp/tests/021-define-func-compose.c new file mode 100644 index 0000000000..21ddd0e65f --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c @@ -0,0 +1,3 @@ +#define bar(x) (1+(x)) +#define foo(y) (2*(y)) +foo(bar(3)) diff --git a/src/glsl/glcpp/tests/021-define-func-compose.c.expected b/src/glsl/glcpp/tests/021-define-func-compose.c.expected new file mode 100644 index 0000000000..1d62105de4 --- /dev/null +++ b/src/glsl/glcpp/tests/021-define-func-compose.c.expected @@ -0,0 +1,4 @@ + + +(2*((1+(3)))) + diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c new file mode 100644 index 0000000000..c20d73a4a2 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c @@ -0,0 +1,2 @@ +#define foo(x) (x) +foo(argument(including parens)for the win) diff --git a/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected new file mode 100644 index 0000000000..66c1658175 --- /dev/null +++ b/src/glsl/glcpp/tests/022-define-func-arg-with-parens.c.expected @@ -0,0 +1,3 @@ + +(argument(including parens)for the win) + diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c b/src/glsl/glcpp/tests/023-define-extra-whitespace.c new file mode 100644 index 0000000000..7ebfed6516 --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c @@ -0,0 +1,8 @@ +#define noargs() 1 +# define onearg(foo) foo + # define twoargs( x , y ) x y + # define threeargs( a , b , c ) a b c +noargs ( ) +onearg ( 2 ) +twoargs ( 3 , 4 ) +threeargs ( 5 , 6 , 7 ) diff --git a/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected new file mode 100644 index 0000000000..573829c2d6 --- /dev/null +++ b/src/glsl/glcpp/tests/023-define-extra-whitespace.c.expected @@ -0,0 +1,9 @@ + + + + +1 +2 +3 4 +5 6 7 + diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c new file mode 100644 index 0000000000..e788adce30 --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c @@ -0,0 +1,3 @@ +#define foo foo +#define bar foo +bar diff --git a/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected new file mode 100644 index 0000000000..ad955fce6e --- /dev/null +++ b/src/glsl/glcpp/tests/024-define-chain-to-self-recursion.c.expected @@ -0,0 +1,4 @@ + + +foo + diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c new file mode 100644 index 0000000000..b433671d1b --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo bar diff --git a/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected new file mode 100644 index 0000000000..960f44511a --- /dev/null +++ b/src/glsl/glcpp/tests/025-func-macro-as-non-macro.c.expected @@ -0,0 +1,3 @@ + +foo bar + diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c new file mode 100644 index 0000000000..0d83740530 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c @@ -0,0 +1,6 @@ +#define foo(a) bar + +foo +( +1 +) diff --git a/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected new file mode 100644 index 0000000000..f0888f21b9 --- /dev/null +++ b/src/glsl/glcpp/tests/026-define-func-extra-newlines.c.expected @@ -0,0 +1,4 @@ + + +bar + diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c new file mode 100644 index 0000000000..5ccb52caba --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure() +foo diff --git a/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/027-define-chain-obj-to-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c new file mode 100644 index 0000000000..44962a7187 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c @@ -0,0 +1,3 @@ +#define success() failure +#define foo success +foo diff --git a/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/028-define-chain-obj-to-non-func.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c new file mode 100644 index 0000000000..261f7d28fc --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c @@ -0,0 +1,3 @@ +#define bar(failure) failure +#define foo bar(success) +foo diff --git a/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/029-define-chain-obj-to-func-with-args.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c new file mode 100644 index 0000000000..e56fbefd62 --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo bar(baz(success)) +foo diff --git a/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/030-define-chain-obj-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c new file mode 100644 index 0000000000..3f4c8744df --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c @@ -0,0 +1,4 @@ +#define baz(failure) failure +#define bar(failure) failure +#define foo() bar(baz(success)) +foo() diff --git a/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/031-define-chain-func-to-func-compose.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c b/src/glsl/glcpp/tests/032-define-func-self-recurse.c new file mode 100644 index 0000000000..b3ac70f499 --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(3) diff --git a/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected new file mode 100644 index 0000000000..541d44db7a --- /dev/null +++ b/src/glsl/glcpp/tests/032-define-func-self-recurse.c.expected @@ -0,0 +1,3 @@ + +foo(2*(3)) + diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c b/src/glsl/glcpp/tests/033-define-func-self-compose.c new file mode 100644 index 0000000000..f65e48286c --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c @@ -0,0 +1,2 @@ +#define foo(a) foo(2*(a)) +foo(foo(3)) diff --git a/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected new file mode 100644 index 0000000000..6ea6905d80 --- /dev/null +++ b/src/glsl/glcpp/tests/033-define-func-self-compose.c.expected @@ -0,0 +1,3 @@ + +foo(2*(foo(2*(3)))) + diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c new file mode 100644 index 0000000000..209a5f7e07 --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(foo) diff --git a/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected new file mode 100644 index 0000000000..24823b1b67 --- /dev/null +++ b/src/glsl/glcpp/tests/034-define-func-self-compose-non-func.c.expected @@ -0,0 +1,3 @@ + +foo + diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c new file mode 100644 index 0000000000..c307fbe830 --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c @@ -0,0 +1,2 @@ +#define foo(bar) bar +foo(1+foo) diff --git a/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected new file mode 100644 index 0000000000..137a9ea2db --- /dev/null +++ b/src/glsl/glcpp/tests/035-define-func-self-compose-non-func-multi-token-argument.c.expected @@ -0,0 +1,3 @@ + +1+foo + diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c new file mode 100644 index 0000000000..b21ff33673 --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c @@ -0,0 +1,3 @@ +#define bar success +#define foo(x) x +foo(more bar) diff --git a/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected new file mode 100644 index 0000000000..ff6360bfe4 --- /dev/null +++ b/src/glsl/glcpp/tests/036-define-func-non-macro-multi-token-argument.c.expected @@ -0,0 +1,4 @@ + + +more success + diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c new file mode 100644 index 0000000000..b3a2f37f1b --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c @@ -0,0 +1,3 @@ +#define expand(x) expand(x once) +#define foo(x) x +foo(expand(just)) diff --git a/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected new file mode 100644 index 0000000000..cbadee848a --- /dev/null +++ b/src/glsl/glcpp/tests/037-finalize-unexpanded-macro.c.expected @@ -0,0 +1,4 @@ + + +expand(just once) + diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c b/src/glsl/glcpp/tests/038-func-arg-with-commas.c new file mode 100644 index 0000000000..1407c7d6e3 --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c @@ -0,0 +1,2 @@ +#define foo(x) success +foo(argument (with,embedded , commas) -- tricky) diff --git a/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected new file mode 100644 index 0000000000..5a28fb3b66 --- /dev/null +++ b/src/glsl/glcpp/tests/038-func-arg-with-commas.c.expected @@ -0,0 +1,3 @@ + +success + diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c new file mode 100644 index 0000000000..0f7fe632b5 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c @@ -0,0 +1,3 @@ +#define foo(a) (a) +#define bar two,words +foo(bar) diff --git a/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected new file mode 100644 index 0000000000..b73869d023 --- /dev/null +++ b/src/glsl/glcpp/tests/039-func-arg-obj-macro-with-comma.c.expected @@ -0,0 +1,4 @@ + + +(two,words) + diff --git a/src/glsl/glcpp/tests/040-token-pasting.c b/src/glsl/glcpp/tests/040-token-pasting.c new file mode 100644 index 0000000000..caab3ba736 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c @@ -0,0 +1,2 @@ +#define paste(a,b) a ## b +paste(one , token) diff --git a/src/glsl/glcpp/tests/040-token-pasting.c.expected b/src/glsl/glcpp/tests/040-token-pasting.c.expected new file mode 100644 index 0000000000..36f6699253 --- /dev/null +++ b/src/glsl/glcpp/tests/040-token-pasting.c.expected @@ -0,0 +1,3 @@ + +onetoken + diff --git a/src/glsl/glcpp/tests/041-if-0.c b/src/glsl/glcpp/tests/041-if-0.c new file mode 100644 index 0000000000..2cab677d3e --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c @@ -0,0 +1,5 @@ +success_1 +#if 0 +failure +#endif +success_2 diff --git a/src/glsl/glcpp/tests/041-if-0.c.expected b/src/glsl/glcpp/tests/041-if-0.c.expected new file mode 100644 index 0000000000..3800024c6f --- /dev/null +++ b/src/glsl/glcpp/tests/041-if-0.c.expected @@ -0,0 +1,6 @@ +success_1 + + + +success_2 + diff --git a/src/glsl/glcpp/tests/042-if-1.c b/src/glsl/glcpp/tests/042-if-1.c new file mode 100644 index 0000000000..874a25cf41 --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c @@ -0,0 +1,5 @@ +success_1 +#if 1 +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/042-if-1.c.expected b/src/glsl/glcpp/tests/042-if-1.c.expected new file mode 100644 index 0000000000..e591044adb --- /dev/null +++ b/src/glsl/glcpp/tests/042-if-1.c.expected @@ -0,0 +1,6 @@ +success_1 + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/043-if-0-else.c b/src/glsl/glcpp/tests/043-if-0-else.c new file mode 100644 index 0000000000..323351f9db --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c @@ -0,0 +1,7 @@ +success_1 +#if 0 +failure +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/043-if-0-else.c.expected b/src/glsl/glcpp/tests/043-if-0-else.c.expected new file mode 100644 index 0000000000..ee9e677096 --- /dev/null +++ b/src/glsl/glcpp/tests/043-if-0-else.c.expected @@ -0,0 +1,8 @@ +success_1 + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/044-if-1-else.c b/src/glsl/glcpp/tests/044-if-1-else.c new file mode 100644 index 0000000000..28dfc25c6f --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c @@ -0,0 +1,7 @@ +success_1 +#if 1 +success_2 +#else +failure +#endif +success_3 diff --git a/src/glsl/glcpp/tests/044-if-1-else.c.expected b/src/glsl/glcpp/tests/044-if-1-else.c.expected new file mode 100644 index 0000000000..129f5c8542 --- /dev/null +++ b/src/glsl/glcpp/tests/044-if-1-else.c.expected @@ -0,0 +1,8 @@ +success_1 + +success_2 + + + +success_3 + diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c b/src/glsl/glcpp/tests/045-if-0-elif.c new file mode 100644 index 0000000000..e50f686d46 --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 1 +success_3 +#elif 1 +failure_3 +#endif +success_4 diff --git a/src/glsl/glcpp/tests/045-if-0-elif.c.expected b/src/glsl/glcpp/tests/045-if-0-elif.c.expected new file mode 100644 index 0000000000..97a11b4472 --- /dev/null +++ b/src/glsl/glcpp/tests/045-if-0-elif.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + +success_3 + + + +success_4 + diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c b/src/glsl/glcpp/tests/046-if-1-elsif.c new file mode 100644 index 0000000000..130515a01e --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c @@ -0,0 +1,11 @@ +success_1 +#if 1 +success_2 +#elif 0 +failure_1 +#elif 1 +failure_2 +#elif 0 +failure_3 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/046-if-1-elsif.c.expected b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected new file mode 100644 index 0000000000..b928b917e3 --- /dev/null +++ b/src/glsl/glcpp/tests/046-if-1-elsif.c.expected @@ -0,0 +1,12 @@ +success_1 + +success_2 + + + + + + + +success_3 + diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c b/src/glsl/glcpp/tests/047-if-elif-else.c new file mode 100644 index 0000000000..e8f0838a9e --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#elif 0 +failure_2 +#elif 0 +failure_3 +#else +success_2 +#endif +success_3 diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c.expected b/src/glsl/glcpp/tests/047-if-elif-else.c.expected new file mode 100644 index 0000000000..e5b53a3fa5 --- /dev/null +++ b/src/glsl/glcpp/tests/047-if-elif-else.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + +success_2 + +success_3 + diff --git a/src/glsl/glcpp/tests/048-if-nested.c b/src/glsl/glcpp/tests/048-if-nested.c new file mode 100644 index 0000000000..fc4679c3be --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c @@ -0,0 +1,11 @@ +success_1 +#if 0 +failure_1 +#if 1 +failure_2 +#else +failure_3 +#endif +failure_4 +#endif +success_2 diff --git a/src/glsl/glcpp/tests/048-if-nested.c.expected b/src/glsl/glcpp/tests/048-if-nested.c.expected new file mode 100644 index 0000000000..c61fd0b315 --- /dev/null +++ b/src/glsl/glcpp/tests/048-if-nested.c.expected @@ -0,0 +1,12 @@ +success_1 + + + + + + + + + +success_2 + diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c b/src/glsl/glcpp/tests/049-if-expression-precedence.c new file mode 100644 index 0000000000..833ea03882 --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c @@ -0,0 +1,5 @@ +#if 1 + 2 * 3 + - (25 % 17 - + 1) +failure with operator precedence +#else +success +#endif diff --git a/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected new file mode 100644 index 0000000000..569debb0bb --- /dev/null +++ b/src/glsl/glcpp/tests/049-if-expression-precedence.c.expected @@ -0,0 +1,6 @@ + + + +success + + diff --git a/src/glsl/glcpp/tests/050-if-defined.c b/src/glsl/glcpp/tests/050-if-defined.c new file mode 100644 index 0000000000..34f0f95140 --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c @@ -0,0 +1,17 @@ +#if defined foo +failure_1 +#else +success_1 +#endif +#define foo +#if defined foo +success_2 +#else +failure_2 +#endif +#undef foo +#if defined foo +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/050-if-defined.c.expected b/src/glsl/glcpp/tests/050-if-defined.c.expected new file mode 100644 index 0000000000..3f01955ee4 --- /dev/null +++ b/src/glsl/glcpp/tests/050-if-defined.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/051-if-relational.c b/src/glsl/glcpp/tests/051-if-relational.c new file mode 100644 index 0000000000..c3db488e0d --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c @@ -0,0 +1,35 @@ +#if 3 < 2 +failure_1 +#else +success_1 +#endif + +#if 3 >= 2 +success_2 +#else +failure_2 +#endif + +#if 2 + 3 <= 5 +success_3 +#else +failure_3 +#endif + +#if 3 - 2 == 1 +success_3 +#else +failure_3 +#endif + +#if 1 > 3 +failure_4 +#else +success_4 +#endif + +#if 1 != 5 +success_5 +#else +failure_5 +#endif diff --git a/src/glsl/glcpp/tests/051-if-relational.c.expected b/src/glsl/glcpp/tests/051-if-relational.c.expected new file mode 100644 index 0000000000..d2b76f1457 --- /dev/null +++ b/src/glsl/glcpp/tests/051-if-relational.c.expected @@ -0,0 +1,36 @@ + + + +success_1 + + + +success_2 + + + + + +success_3 + + + + + +success_3 + + + + + + + +success_4 + + + +success_5 + + + + diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c b/src/glsl/glcpp/tests/052-if-bitwise.c new file mode 100644 index 0000000000..2d8e45eb61 --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c @@ -0,0 +1,20 @@ +#if (0xaaaaaaaa | 0x55555555) != 4294967295 +failure_1 +#else +success_1 +#endif +#if (0x12345678 ^ 0xfdecba98) == 4023971040 +success_2 +#else +failure_2 +#endif +#if (~ 0xdeadbeef) != -3735928560 +failure_3 +#else +success_3 +#endif +#if (0667 & 0733) == 403 +success_4 +#else +failure_4 +#endif diff --git a/src/glsl/glcpp/tests/052-if-bitwise.c.expected b/src/glsl/glcpp/tests/052-if-bitwise.c.expected new file mode 100644 index 0000000000..bb5d92e8d9 --- /dev/null +++ b/src/glsl/glcpp/tests/052-if-bitwise.c.expected @@ -0,0 +1,21 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + +success_4 + + + + diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c b/src/glsl/glcpp/tests/053-if-divide-and-shift.c new file mode 100644 index 0000000000..d24c54a88d --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c @@ -0,0 +1,15 @@ +#if (15 / 2) != 7 +failure_1 +#else +success_1 +#endif +#if (1 << 12) == 4096 +success_2 +#else +failure_2 +#endif +#if (31762 >> 8) != 124 +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected new file mode 100644 index 0000000000..f97e93673c --- /dev/null +++ b/src/glsl/glcpp/tests/053-if-divide-and-shift.c.expected @@ -0,0 +1,16 @@ + + + +success_1 + + +success_2 + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c b/src/glsl/glcpp/tests/054-if-with-macros.c new file mode 100644 index 0000000000..3da79a0d96 --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c @@ -0,0 +1,34 @@ +#define one 1 +#define two 2 +#define three 3 +#define five 5 +#if five < two +failure_1 +#else +success_1 +#endif +#if three >= two +success_2 +#else +failure_2 +#endif +#if two + three <= five +success_3 +#else +failure_3 +#endif +#if five - two == three +success_4 +#else +failure_4 +#endif +#if one > three +failure_5 +#else +success_5 +#endif +#if one != five +success_6 +#else +failure_6 +#endif diff --git a/src/glsl/glcpp/tests/054-if-with-macros.c.expected b/src/glsl/glcpp/tests/054-if-with-macros.c.expected new file mode 100644 index 0000000000..27ea496962 --- /dev/null +++ b/src/glsl/glcpp/tests/054-if-with-macros.c.expected @@ -0,0 +1,35 @@ + + + + + + + +success_1 + + +success_2 + + + + +success_3 + + + + +success_4 + + + + + + +success_5 + + +success_6 + + + + diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c new file mode 100644 index 0000000000..00f2c2346d --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c @@ -0,0 +1,3 @@ +#define failure() success +#define foo failure +foo() diff --git a/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected new file mode 100644 index 0000000000..aef762e1e6 --- /dev/null +++ b/src/glsl/glcpp/tests/055-define-chain-obj-to-func-parens-in-text.c.expected @@ -0,0 +1,4 @@ + + +success + diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c new file mode 100644 index 0000000000..58701d1f25 --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c @@ -0,0 +1,4 @@ +#define bar with,embedded,commas +#define function(x) success +#define foo function +foo(bar) diff --git a/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected new file mode 100644 index 0000000000..729bdd15f8 --- /dev/null +++ b/src/glsl/glcpp/tests/056-macro-argument-with-comma.c.expected @@ -0,0 +1,5 @@ + + + +success + diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c b/src/glsl/glcpp/tests/057-empty-arguments.c new file mode 100644 index 0000000000..6140232865 --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c @@ -0,0 +1,6 @@ +#define zero() success +zero() +#define one(x) success +one() +#define two(x,y) success +two(,) diff --git a/src/glsl/glcpp/tests/057-empty-arguments.c.expected b/src/glsl/glcpp/tests/057-empty-arguments.c.expected new file mode 100644 index 0000000000..4e3aad5217 --- /dev/null +++ b/src/glsl/glcpp/tests/057-empty-arguments.c.expected @@ -0,0 +1,7 @@ + +success + +success + +success + diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c new file mode 100644 index 0000000000..8ac260c76b --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c @@ -0,0 +1,5 @@ +#define paste(x,y) x ## y +paste(a,b) +paste(a,) +paste(,b) +paste(,) diff --git a/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected new file mode 100644 index 0000000000..a1c34e5c1f --- /dev/null +++ b/src/glsl/glcpp/tests/058-token-pasting-empty-arguments.c.expected @@ -0,0 +1,6 @@ + +ab +a +b + + diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c b/src/glsl/glcpp/tests/059-token-pasting-integer.c new file mode 100644 index 0000000000..37b895a423 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c @@ -0,0 +1,4 @@ +#define paste(x,y) x ## y +paste(1,2) +paste(1,000) +paste(identifier,2) diff --git a/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected new file mode 100644 index 0000000000..f1a2cd21c1 --- /dev/null +++ b/src/glsl/glcpp/tests/059-token-pasting-integer.c.expected @@ -0,0 +1,5 @@ + +12 +1000 +identifier2 + diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c new file mode 100644 index 0000000000..ed80ea879c --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c @@ -0,0 +1,3 @@ +#define double(a) a*2 +#define foo double( +foo 5) diff --git a/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected new file mode 100644 index 0000000000..c1f0d24a14 --- /dev/null +++ b/src/glsl/glcpp/tests/060-left-paren-in-macro-right-paren-in-text.c.expected @@ -0,0 +1,4 @@ + + +5*2 + diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c new file mode 100644 index 0000000000..6dbfd1f62d --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c @@ -0,0 +1,5 @@ +#define foo(x) success +#define bar foo +#define baz bar +#define joe baz +joe (failure) diff --git a/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected new file mode 100644 index 0000000000..111f7d1063 --- /dev/null +++ b/src/glsl/glcpp/tests/061-define-chain-obj-to-func-multi.c.expected @@ -0,0 +1,6 @@ + + + + +success + diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c new file mode 100644 index 0000000000..d9e439bb89 --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c @@ -0,0 +1,5 @@ +#define foo(a,b) +#if 0 +foo(bar) +foo( +#endif diff --git a/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/062-if-0-skips-garbage.c.expected @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/glsl/glcpp/tests/063-comments.c b/src/glsl/glcpp/tests/063-comments.c new file mode 100644 index 0000000000..e641d2f0f9 --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c @@ -0,0 +1,20 @@ +/* this is a comment */ +// so is this +// */ +f = g/**//h; +/*//*/l(); +m = n//**/o ++ p; +/* this +comment spans +multiple lines and +contains *** stars +and slashes / *** / +and other stuff. +****/ +more code here +/* Test that /* nested + comments */ +are not treated like comments. +/*/ this is a comment */ +/*/*/ diff --git a/src/glsl/glcpp/tests/063-comments.c.expected b/src/glsl/glcpp/tests/063-comments.c.expected new file mode 100644 index 0000000000..ed4feedd45 --- /dev/null +++ b/src/glsl/glcpp/tests/063-comments.c.expected @@ -0,0 +1,14 @@ + + + +f = g /h; + l(); +m = n ++ p; + +more code here + +are not treated like comments. + + + diff --git a/src/glsl/glcpp/tests/064-version.c b/src/glsl/glcpp/tests/064-version.c new file mode 100644 index 0000000000..21326481b8 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c @@ -0,0 +1,2 @@ +#version 130 +#define FOO diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected new file mode 100644 index 0000000000..3af71113c8 --- /dev/null +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -0,0 +1,3 @@ +#version 130 + + diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c b/src/glsl/glcpp/tests/065-if-defined-parens.c new file mode 100644 index 0000000000..48aa0f8c3e --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c @@ -0,0 +1,17 @@ +#if defined(foo) +failure_1 +#else +success_1 +#endif +#define foo +#if defined ( foo ) +success_2 +#else +failure_2 +#endif +#undef foo +#if defined (foo) +failure_3 +#else +success_3 +#endif diff --git a/src/glsl/glcpp/tests/065-if-defined-parens.c.expected b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected new file mode 100644 index 0000000000..3f01955ee4 --- /dev/null +++ b/src/glsl/glcpp/tests/065-if-defined-parens.c.expected @@ -0,0 +1,18 @@ + + + +success_1 + + + +success_2 + + + + + + + +success_3 + + diff --git a/src/glsl/glcpp/tests/071-punctuator.c b/src/glsl/glcpp/tests/071-punctuator.c new file mode 100644 index 0000000000..959d682598 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c @@ -0,0 +1 @@ +a = b diff --git a/src/glsl/glcpp/tests/071-punctuator.c.expected b/src/glsl/glcpp/tests/071-punctuator.c.expected new file mode 100644 index 0000000000..fee253b745 --- /dev/null +++ b/src/glsl/glcpp/tests/071-punctuator.c.expected @@ -0,0 +1,2 @@ +a = b + diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c b/src/glsl/glcpp/tests/072-token-pasting-same-line.c new file mode 100644 index 0000000000..e421e9d5e2 --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c @@ -0,0 +1,2 @@ +#define paste(x) success_ ## x +paste(1) paste(2) paste(3) diff --git a/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected new file mode 100644 index 0000000000..c780b43d70 --- /dev/null +++ b/src/glsl/glcpp/tests/072-token-pasting-same-line.c.expected @@ -0,0 +1,3 @@ + +success_1 success_2 success_3 + diff --git a/src/glsl/glcpp/tests/099-c99-example.c b/src/glsl/glcpp/tests/099-c99-example.c new file mode 100644 index 0000000000..d1976b1f26 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c @@ -0,0 +1,17 @@ +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +g(x +(3,4)-w) | h 5) & m + (f)^m(m); +p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,)}; diff --git a/src/glsl/glcpp/tests/099-c99-example.c.expected b/src/glsl/glcpp/tests/099-c99-example.c.expected new file mode 100644 index 0000000000..19be750555 --- /dev/null +++ b/src/glsl/glcpp/tests/099-c99-example.c.expected @@ -0,0 +1,17 @@ + + + + + + + + + + + + + +f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); +int i[] = { 1, 23, 4, 5, }; + diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test new file mode 100755 index 0000000000..396f6e175e --- /dev/null +++ b/src/glsl/glcpp/tests/glcpp-test @@ -0,0 +1,7 @@ +#!/bin/sh + +for test in *.c; do + echo "Testing $test" + ../glcpp < $test > $test.out + diff -u $test.expected $test.out +done diff --git a/src/glsl/glcpp/xtalloc.c b/src/glsl/glcpp/xtalloc.c new file mode 100644 index 0000000000..656ac2d6cb --- /dev/null +++ b/src/glsl/glcpp/xtalloc.c @@ -0,0 +1,99 @@ +/* + * 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 + +void * +xtalloc_named_const (const void *context, size_t size, const char *name) +{ + void *ret; + + ret = talloc_named_const (context, size, name); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + return ret; +} + +char * +xtalloc_strdup (const void *t, const char *p) +{ + char *ret; + + ret = talloc_strdup (t, p); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + return ret; +} + +char * +xtalloc_strndup (const void *t, const char *p, size_t n) +{ + char *ret; + + ret = talloc_strndup (t, p, n); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + return ret; +} + +char * +xtalloc_asprintf (const void *t, const char *fmt, ...) +{ + va_list ap; + char *ret; + + va_start(ap, fmt); + + ret = talloc_vasprintf(t, fmt, ap); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + va_end(ap); + return ret; +} + +void * +_xtalloc_reference_loc (const void *context, + const void *ptr, const char *location) +{ + void *ret; + + ret = _talloc_reference_loc (context, ptr, location); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + return ret; +} diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp new file mode 100644 index 0000000000..fa439f1278 --- /dev/null +++ b/src/glsl/glsl_lexer.lpp @@ -0,0 +1,336 @@ +%{ +/* + * Copyright © 2008, 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. + */ +#include +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno + 1; \ + yycolumn += yyleng; \ + } while(0); + +%} + +%option bison-bridge bison-locations reentrant noyywrap +%option nounput noyy_top_state +%option never-interactive +%option prefix="_mesa_glsl_" +%option extra-type="struct _mesa_glsl_parse_state *" + +%x PP + +DEC_INT [1-9][0-9]* +HEX_INT 0[xX][0-9a-fA-F]+ +OCT_INT 0[0-7]* +INT ({DEC_INT}|{HEX_INT}|{OCT_INT}) +SPC [ \t]* +SPCP [ \t]+ +HASH ^{SPC}#{SPC} +%% + +[ \r\t]+ ; + + /* Preprocessor tokens. */ +^[ \t]*#[ \t]*$ ; +^[ \t]*#[ \t]*version { BEGIN PP; return VERSION; } +^[ \t]*#[ \t]*extension { BEGIN PP; return EXTENSION; } +{HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); + } +{HASH}line{SPCP}{INT}{SPC}$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + } +^[ \t]*#[ \t]*pragma { BEGIN PP; return PRAGMA; } +\/\/[^\n]* { } +[ \t\r]* { } +: return COLON; +[_a-zA-Z][_a-zA-Z0-9]* { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } +[1-9][0-9]* { + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } +\n { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } + +\n { yylineno++; yycolumn = 0; } + +attribute return ATTRIBUTE; +const return CONST; +bool return BOOL; +float return FLOAT; +int return INT; + +break return BREAK; +continue return CONTINUE; +do return DO; +while return WHILE; +else return ELSE; +for return FOR; +if return IF; +discard return DISCARD; +return return RETURN; + +bvec2 return BVEC2; +bvec3 return BVEC3; +bvec4 return BVEC4; +ivec2 return IVEC2; +ivec3 return IVEC3; +ivec4 return IVEC4; +vec2 return VEC2; +vec3 return VEC3; +vec4 return VEC4; +mat2 return MAT2; +mat3 return MAT3; +mat4 return MAT4; +mat2x2 return MAT2X2; +mat2x3 return MAT2X3; +mat2x4 return MAT2X4; +mat3x2 return MAT3X2; +mat3x3 return MAT3X3; +mat3x4 return MAT3X4; +mat4x2 return MAT4X2; +mat4x3 return MAT4X3; +mat4x4 return MAT4X4; + +in return IN; +out return OUT; +inout return INOUT; +uniform return UNIFORM; +varying return VARYING; +centroid { + if (yyextra->language_version >= 120) { + return CENTROID; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } +invariant { + if (yyextra->language_version >= 120) { + return INVARIANT; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + +flat { + if (yyextra->language_version >= 130) { + return FLAT; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } +smooth { + if (yyextra->language_version >= 130) { + return SMOOTH; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } +noperspective { + if (yyextra->language_version >= 130) { + return NOPERSPECTIVE; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + +sampler1D return SAMPLER1D; +sampler2D return SAMPLER2D; +sampler3D return SAMPLER3D; +samplerCube return SAMPLERCUBE; +sampler1DShadow return SAMPLER1DSHADOW; +sampler2DShadow return SAMPLER2DSHADOW; + +struct return STRUCT; +void return VOID; + +\+\+ return INC_OP; +-- return DEC_OP; +\<= return LE_OP; +>= return GE_OP; +== return EQ_OP; +!= return NE_OP; +&& return AND_OP; +\|\| return OR_OP; +"^^" return XOR_OP; + +\*= return MUL_ASSIGN; +\/= return DIV_ASSIGN; +\+= return ADD_ASSIGN; +\%= return MOD_ASSIGN; +\<\<= return LEFT_ASSIGN; +>>= return RIGHT_ASSIGN; +&= return AND_ASSIGN; +^= return XOR_ASSIGN; +\|= return OR_ASSIGN; +-= return SUB_ASSIGN; + +[1-9][0-9]* { + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } +0[xX][0-9a-fA-F]+ { + yylval->n = strtol(yytext + 2, NULL, 16); + return INTCONSTANT; + } +0[0-7]* { + yylval->n = strtol(yytext + 2, NULL, 8); + return INTCONSTANT; + } + +[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +[0-9]+\.([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +[0-9]+[eE][+-]?[0-9]+[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + +true { + yylval->n = 1; + return BOOLCONSTANT; + } +false { + yylval->n = 0; + return BOOLCONSTANT; + } + + + /* Reserved words in GLSL 1.10. */ +asm return ASM; +class return CLASS; +union return UNION; +enum return ENUM; +typedef return TYPEDEF; +template return TEMPLATE; +this return THIS; +packed return PACKED; +goto return GOTO; +switch return SWITCH; +default return DEFAULT; +inline return INLINE; +noinline return NOINLINE; +volatile return VOLATILE; +public return PUBLIC; +static return STATIC; +extern return EXTERN; +external return EXTERNAL; +interface return INTERFACE; +long return LONG; +short return SHORT; +double return DOUBLE; +half return HALF; +fixed return FIXED; +unsigned return UNSIGNED; +input return INPUT; +output return OUTPUT; +hvec2 return HVEC2; +hvec3 return HVEC3; +hvec4 return HVEC4; +dvec2 return DVEC2; +dvec3 return DVEC3; +dvec4 return DVEC4; +fvec2 return FVEC2; +fvec3 return FVEC3; +fvec4 return FVEC4; +sampler2DRect return SAMPLER2DRECT; +sampler3DRect return SAMPLER3DRECT; +sampler2DRectShadow return SAMPLER2DRECTSHADOW; +sizeof return SIZEOF; +cast return CAST; +namespace return NAMESPACE; +using return USING; + + /* Additional reserved words in GLSL 1.20. */ +lowp return LOWP; +mediump return MEDIUMP; +highp return HIGHP; +precision return PRECISION; + +[_a-zA-Z][_a-zA-Z0-9]* { + struct _mesa_glsl_parse_state *state = yyextra; + void *ctx = talloc_parent(state); + yylval->identifier = talloc_strdup(ctx, yytext); + return IDENTIFIER; + } + +. { return yytext[0]; } + +%% + +void +_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) +{ + yylex_init_extra(state, & state->scanner); + yy_scan_string(string, state->scanner); +} + +void +_mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state) +{ + yylex_destroy(state->scanner); +} diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp new file mode 100644 index 0000000000..4132495f40 --- /dev/null +++ b/src/glsl/glsl_parser.ypp @@ -0,0 +1,1444 @@ +%{ +/* + * Copyright © 2008, 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. + */ +#include +#include +#include +#include + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" + +#define YYLEX_PARAM state->scanner + +%} + +%pure-parser +%locations +%error-verbose + +%lex-param {void *scanner} +%parse-param {struct _mesa_glsl_parse_state *state} +%name-prefix "_mesa_glsl_" + +%union { + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + struct ast_node *node; + struct ast_type_specifier *type_specifier; + struct ast_fully_specified_type *fully_specified_type; + struct ast_function *function; + struct ast_parameter_declarator *parameter_declarator; + struct ast_function_definition *function_definition; + struct ast_compound_statement *compound_statement; + struct ast_expression *expression; + struct ast_declarator_list *declarator_list; + struct ast_struct_specifier *struct_specifier; + struct ast_declaration *declaration; + + struct { + struct ast_node *cond; + struct ast_expression *rest; + } for_rest_statement; +} + +%token ATTRIBUTE CONST BOOL FLOAT INT UINT +%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT +%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 +%token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT UNIFORM VARYING +%token NOPERSPECTIVE FLAT SMOOTH +%token MAT2X2 MAT2X3 MAT2X4 +%token MAT3X2 MAT3X3 MAT3X4 +%token MAT4X2 MAT4X3 MAT4X4 +%token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW +%token SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW +%token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D +%token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token STRUCT VOID WHILE +%token IDENTIFIER +%token FLOATCONSTANT +%token INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token FIELD_SELECTION +%token LEFT_OP RIGHT_OP +%token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP +%token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN +%token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN +%token SUB_ASSIGN +%token INVARIANT +%token LOWP MEDIUMP HIGHP PRECISION + +%token VERSION EXTENSION LINE PRAGMA COLON EOL INTERFACE OUTPUT + + /* Reserved words that are not actually used in the grammar. + */ +%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED GOTO +%token INLINE NOINLINE VOLATILE PUBLIC STATIC EXTERN EXTERNAL +%token LONG SHORT DOUBLE HALF FIXED UNSIGNED INPUT OUPTUT +%token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4 +%token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW +%token SIZEOF CAST NAMESPACE USING + +%type variable_identifier +%type statement +%type statement_list +%type simple_statement +%type statement_matched +%type statement_unmatched +%type precision_qualifier +%type type_qualifier +%type storage_qualifier +%type interpolation_qualifier +%type type_specifier +%type type_specifier_no_prec +%type type_specifier_nonarray +%type basic_type_specifier_nonarray +%type fully_specified_type +%type function_prototype +%type function_header +%type function_header_with_parameters +%type function_declarator +%type parameter_declarator +%type parameter_declaration +%type parameter_qualifier +%type parameter_type_qualifier +%type parameter_type_specifier +%type function_definition +%type compound_statement_no_new_scope +%type compound_statement +%type statement_no_new_scope +%type expression_statement +%type expression +%type primary_expression +%type assignment_expression +%type conditional_expression +%type logical_or_expression +%type logical_xor_expression +%type logical_and_expression +%type inclusive_or_expression +%type exclusive_or_expression +%type and_expression +%type equality_expression +%type relational_expression +%type shift_expression +%type additive_expression +%type multiplicative_expression +%type unary_expression +%type constant_expression +%type integer_expression +%type postfix_expression +%type function_call_header_with_parameters +%type function_call_header_no_parameters +%type function_call_header +%type function_call_generic +%type function_call_or_method +%type function_call +%type assignment_operator +%type unary_operator +%type function_identifier +%type external_declaration +%type init_declarator_list +%type single_declaration +%type initializer +%type declaration +%type declaration_statement +%type jump_statement +%type struct_specifier +%type struct_declaration_list +%type struct_declaration +%type struct_declarator +%type struct_declarator_list +%type selection_statement_matched +%type selection_statement_unmatched +%type iteration_statement +%type condition +%type conditionopt +%type for_init_statement +%type for_rest_statement +%% + +translation_unit: + version_statement extension_statement_list + { + _mesa_glsl_initialize_types(state); + } + external_declaration_list + ; + +version_statement: + /* blank - no #version specified */ + { + state->language_version = 110; + } + | VERSION INTCONSTANT EOL + { + switch ($2) { + case 110: + case 120: + case 130: + /* FINISHME: Check against implementation support versions. */ + state->language_version = $2; + break; + default: + _mesa_glsl_error(& @2, state, "Shading language version" + "%u is not supported\n", $2); + break; + } + } + ; + +extension_statement_list: + + | extension_statement_list extension_statement + ; + +extension_statement: + EXTENSION IDENTIFIER COLON IDENTIFIER EOL + { + if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) { + YYERROR; + } + } + ; + +external_declaration_list: + external_declaration + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ($1 != NULL) + state->translation_unit.push_tail(& $1->link); + } + | external_declaration_list external_declaration + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ($2 != NULL) + state->translation_unit.push_tail(& $2->link); + } + ; + +variable_identifier: + IDENTIFIER + ; + +primary_expression: + variable_identifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.identifier = $1; + } + | INTCONSTANT + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.int_constant = $1; + } + | UINTCONSTANT + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.uint_constant = $1; + } + | FLOATCONSTANT + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.float_constant = $1; + } + | BOOLCONSTANT + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.bool_constant = $1; + } + | '(' expression ')' + { + $$ = $2; + } + ; + +postfix_expression: + primary_expression + | postfix_expression '[' integer_expression ']' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_array_index, $1, $3, NULL); + $$->set_location(yylloc); + } + | function_call + { + /* Function call parameters used to be stored as a circular list in + * subexpressions[1]. They are now stored as a regular list in + * expressions. This assertion validates that the old code was + * correctly converted. It can eventually be removed. + */ + assert($1->subexpressions[1] == NULL); + $$ = $1; + } + | postfix_expression '.' IDENTIFIER + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_field_selection, $1, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.identifier = $3; + } + | postfix_expression INC_OP + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_post_inc, $1, NULL, NULL); + $$->set_location(yylloc); + } + | postfix_expression DEC_OP + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_post_dec, $1, NULL, NULL); + $$->set_location(yylloc); + } + ; + +integer_expression: + expression + ; + +function_call: + function_call_or_method + ; + +function_call_or_method: + function_call_generic + | postfix_expression '.' function_call_generic + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_field_selection, $1, $3, NULL); + $$->set_location(yylloc); + } + ; + +function_call_generic: + function_call_header_with_parameters ')' + | function_call_header_no_parameters ')' + ; + +function_call_header_no_parameters: + function_call_header VOID + | function_call_header + ; + +function_call_header_with_parameters: + function_call_header assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $2->link); + } + | function_call_header_with_parameters ',' assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $3->link); + } + ; + + // Grammar Note: Constructors look like functions, but lexical + // analysis recognized most of them as keywords. They are now + // recognized through "type_specifier". +function_call_header: + function_identifier '(' + ; + +function_identifier: + type_specifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_function_expression($1); + $$->set_location(yylloc); + } + | IDENTIFIER + { + void *ctx = talloc_parent(state); + ast_expression *callee = new(ctx) ast_expression($1); + $$ = new(ctx) ast_function_expression(callee); + $$->set_location(yylloc); + } + | FIELD_SELECTION + { + void *ctx = talloc_parent(state); + ast_expression *callee = new(ctx) ast_expression($1); + $$ = new(ctx) ast_function_expression(callee); + $$->set_location(yylloc); + } + ; + + // Grammar Note: No traditional style type casts. +unary_expression: + postfix_expression + | INC_OP unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_pre_inc, $2, NULL, NULL); + $$->set_location(yylloc); + } + | DEC_OP unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_pre_dec, $2, NULL, NULL); + $$->set_location(yylloc); + } + | unary_operator unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression($1, $2, NULL, NULL); + $$->set_location(yylloc); + } + ; + + // Grammar Note: No '*' or '&' unary ops. Pointers are not supported. +unary_operator: + '+' { $$ = ast_plus; } + | '-' { $$ = ast_neg; } + | '!' { $$ = ast_logic_not; } + | '~' { $$ = ast_bit_not; } + ; + +multiplicative_expression: + unary_expression + | multiplicative_expression '*' unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_mul, $1, $3); + $$->set_location(yylloc); + } + | multiplicative_expression '/' unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_div, $1, $3); + $$->set_location(yylloc); + } + | multiplicative_expression '%' unary_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_mod, $1, $3); + $$->set_location(yylloc); + } + ; + +additive_expression: + multiplicative_expression + | additive_expression '+' multiplicative_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_add, $1, $3); + $$->set_location(yylloc); + } + | additive_expression '-' multiplicative_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_sub, $1, $3); + $$->set_location(yylloc); + } + ; + +shift_expression: + additive_expression + | shift_expression LEFT_OP additive_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_lshift, $1, $3); + $$->set_location(yylloc); + } + | shift_expression RIGHT_OP additive_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_rshift, $1, $3); + $$->set_location(yylloc); + } + ; + +relational_expression: + shift_expression + | relational_expression '<' shift_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_less, $1, $3); + $$->set_location(yylloc); + } + | relational_expression '>' shift_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_greater, $1, $3); + $$->set_location(yylloc); + } + | relational_expression LE_OP shift_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_lequal, $1, $3); + $$->set_location(yylloc); + } + | relational_expression GE_OP shift_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_gequal, $1, $3); + $$->set_location(yylloc); + } + ; + +equality_expression: + relational_expression + | equality_expression EQ_OP relational_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_equal, $1, $3); + $$->set_location(yylloc); + } + | equality_expression NE_OP relational_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_nequal, $1, $3); + $$->set_location(yylloc); + } + ; + +and_expression: + equality_expression + | and_expression '&' equality_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); + $$->set_location(yylloc); + } + ; + +exclusive_or_expression: + and_expression + | exclusive_or_expression '^' and_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_bit_xor, $1, $3); + $$->set_location(yylloc); + } + ; + +inclusive_or_expression: + exclusive_or_expression + | inclusive_or_expression '|' exclusive_or_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_and_expression: + inclusive_or_expression + | logical_and_expression AND_OP inclusive_or_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_logic_and, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_xor_expression: + logical_and_expression + | logical_xor_expression XOR_OP logical_and_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_logic_xor, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_or_expression: + logical_xor_expression + | logical_or_expression OR_OP logical_xor_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_bin(ast_logic_or, $1, $3); + $$->set_location(yylloc); + } + ; + +conditional_expression: + logical_or_expression + | logical_or_expression '?' expression ':' assignment_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression(ast_conditional, $1, $3, $5); + $$->set_location(yylloc); + } + ; + +assignment_expression: + conditional_expression + | unary_expression assignment_operator assignment_expression + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression($2, $1, $3, NULL); + $$->set_location(yylloc); + } + ; + +assignment_operator: + '=' { $$ = ast_assign; } + | MUL_ASSIGN { $$ = ast_mul_assign; } + | DIV_ASSIGN { $$ = ast_div_assign; } + | MOD_ASSIGN { $$ = ast_mod_assign; } + | ADD_ASSIGN { $$ = ast_add_assign; } + | SUB_ASSIGN { $$ = ast_sub_assign; } + | LEFT_ASSIGN { $$ = ast_ls_assign; } + | RIGHT_ASSIGN { $$ = ast_rs_assign; } + | AND_ASSIGN { $$ = ast_and_assign; } + | XOR_ASSIGN { $$ = ast_xor_assign; } + | OR_ASSIGN { $$ = ast_or_assign; } + ; + +expression: + assignment_expression + { + $$ = $1; + } + | expression ',' assignment_expression + { + void *ctx = talloc_parent(state); + if ($1->oper != ast_sequence) { + $$ = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->expressions.push_tail(& $1->link); + } else { + $$ = $1; + } + + $$->expressions.push_tail(& $3->link); + } + ; + +constant_expression: + conditional_expression + ; + +declaration: + function_prototype ';' + { + $$ = $1; + } + | init_declarator_list ';' + { + $$ = $1; + } + | PRECISION precision_qualifier type_specifier_no_prec ';' + { + if (($3->type_specifier != ast_float) + && ($3->type_specifier != ast_int)) { + _mesa_glsl_error(& @3, state, "global precision qualifier can " + "only be applied to `int' or `float'\n"); + YYERROR; + } + + $$ = NULL; /* FINISHME */ + } + ; + +function_prototype: + function_declarator ')' + ; + +function_declarator: + function_header + | function_header_with_parameters + ; + +function_header_with_parameters: + function_header parameter_declaration + { + $$ = $1; + $$->parameters.push_tail(& $2->link); + } + | function_header_with_parameters ',' parameter_declaration + { + $$ = $1; + $$->parameters.push_tail(& $3->link); + } + ; + +function_header: + fully_specified_type IDENTIFIER '(' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_function(); + $$->set_location(yylloc); + $$->return_type = $1; + $$->identifier = $2; + } + ; + +parameter_declarator: + type_specifier IDENTIFIER + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->set_location(yylloc); + $$->type->specifier = $1; + $$->identifier = $2; + } + | type_specifier IDENTIFIER '[' constant_expression ']' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->set_location(yylloc); + $$->type->specifier = $1; + $$->identifier = $2; + $$->is_array = true; + $$->array_size = $4; + } + ; + +parameter_declaration: + parameter_type_qualifier parameter_qualifier parameter_declarator + { + $1.i |= $2.i; + + $$ = $3; + $$->type->qualifier = $1.q; + } + | parameter_qualifier parameter_declarator + { + $$ = $2; + $$->type->qualifier = $1.q; + } + | parameter_type_qualifier parameter_qualifier parameter_type_specifier + { + void *ctx = talloc_parent(state); + $1.i |= $2.i; + + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->qualifier = $1.q; + $$->type->specifier = $3; + } + | parameter_qualifier parameter_type_specifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->qualifier = $1.q; + $$->type->specifier = $2; + } + ; + +parameter_qualifier: + /* empty */ { $$.i = 0; } + | IN { $$.i = 0; $$.q.in = 1; } + | OUT { $$.i = 0; $$.q.out = 1; } + | INOUT { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } + ; + +parameter_type_specifier: + type_specifier + ; + +init_declarator_list: + single_declaration + | init_declarator_list ',' IDENTIFIER + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' ']' + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, $7); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, $8); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, $5); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + ; + + // Grammar Note: No 'enum', or 'typedef'. +single_declaration: + fully_specified_type + { + void *ctx = talloc_parent(state); + if ($1->specifier->type_specifier != ast_struct) { + _mesa_glsl_error(& @1, state, "empty declaration list\n"); + YYERROR; + } else { + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + } + } + | fully_specified_type IDENTIFIER + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' ']' + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' constant_expression ']' + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' ']' '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, $6); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' constant_expression ']' '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, $7); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | INVARIANT IDENTIFIER // Vertex only. + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + + $$ = new(ctx) ast_declarator_list(NULL); + $$->set_location(yylloc); + $$->invariant = true; + + $$->declarations.push_tail(&decl->link); + } + ; + +fully_specified_type: + type_specifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_fully_specified_type(); + $$->set_location(yylloc); + $$->specifier = $1; + } + | type_qualifier type_specifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_fully_specified_type(); + $$->set_location(yylloc); + $$->qualifier = $1.q; + $$->specifier = $2; + } + ; + +interpolation_qualifier: + SMOOTH { $$.i = 0; $$.q.smooth = 1; } + | FLAT { $$.i = 0; $$.q.flat = 1; } + | NOPERSPECTIVE { $$.i = 0; $$.q.noperspective = 1; } + ; + +parameter_type_qualifier: + CONST { $$.i = 0; $$.q.constant = 1; } + ; + +type_qualifier: + storage_qualifier + | interpolation_qualifier type_qualifier + { + $$.i = $1.i | $2.i; + } + | INVARIANT type_qualifier + { + $$ = $2; + $$.q.invariant = 1; + } + ; + +storage_qualifier: + CONST { $$.i = 0; $$.q.constant = 1; } + | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } + | VARYING { $$.i = 0; $$.q.varying = 1; } + | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } + | IN { $$.i = 0; $$.q.in = 1; } + | OUT { $$.i = 0; $$.q.out = 1; } + | CENTROID IN { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } + | CENTROID OUT { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } + | UNIFORM { $$.i = 0; $$.q.uniform = 1; } + ; + +type_specifier: + type_specifier_no_prec + | precision_qualifier type_specifier_no_prec + { + $$ = $2; + $$->precision = $1; + } + ; + +type_specifier_no_prec: + type_specifier_nonarray + | type_specifier_nonarray '[' ']' + { + $$ = $1; + $$->is_array = true; + $$->array_size = NULL; + } + | type_specifier_nonarray '[' constant_expression ']' + { + $$ = $1; + $$->is_array = true; + $$->array_size = $3; + } + ; + +type_specifier_nonarray: + basic_type_specifier_nonarray + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + | struct_specifier + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + | IDENTIFIER + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + ; + +basic_type_specifier_nonarray: + VOID { $$ = ast_void; } + | FLOAT { $$ = ast_float; } + | INT { $$ = ast_int; } + | UINT { $$ = ast_uint; } + | BOOL { $$ = ast_bool; } + | VEC2 { $$ = ast_vec2; } + | VEC3 { $$ = ast_vec3; } + | VEC4 { $$ = ast_vec4; } + | BVEC2 { $$ = ast_bvec2; } + | BVEC3 { $$ = ast_bvec3; } + | BVEC4 { $$ = ast_bvec4; } + | IVEC2 { $$ = ast_ivec2; } + | IVEC3 { $$ = ast_ivec3; } + | IVEC4 { $$ = ast_ivec4; } + | UVEC2 { $$ = ast_uvec2; } + | UVEC3 { $$ = ast_uvec3; } + | UVEC4 { $$ = ast_uvec4; } + | MAT2 { $$ = ast_mat2; } + | MAT3 { $$ = ast_mat3; } + | MAT4 { $$ = ast_mat4; } + | MAT2X2 { $$ = ast_mat2; } + | MAT2X3 { $$ = ast_mat2x3; } + | MAT2X4 { $$ = ast_mat2x4; } + | MAT3X2 { $$ = ast_mat3x2; } + | MAT3X3 { $$ = ast_mat3; } + | MAT3X4 { $$ = ast_mat3x4; } + | MAT4X2 { $$ = ast_mat4x2; } + | MAT4X3 { $$ = ast_mat4x3; } + | MAT4X4 { $$ = ast_mat4; } + | SAMPLER1D { $$ = ast_sampler1d; } + | SAMPLER2D { $$ = ast_sampler2d; } + | SAMPLER2DRECT { $$ = ast_sampler2drect; } + | SAMPLER3D { $$ = ast_sampler3d; } + | SAMPLERCUBE { $$ = ast_samplercube; } + | SAMPLER1DSHADOW { $$ = ast_sampler1dshadow; } + | SAMPLER2DSHADOW { $$ = ast_sampler2dshadow; } + | SAMPLER2DRECTSHADOW { $$ = ast_sampler2drectshadow; } + | SAMPLERCUBESHADOW { $$ = ast_samplercubeshadow; } + | SAMPLER1DARRAY { $$ = ast_sampler1darray; } + | SAMPLER2DARRAY { $$ = ast_sampler2darray; } + | SAMPLER1DARRAYSHADOW { $$ = ast_sampler1darrayshadow; } + | SAMPLER2DARRAYSHADOW { $$ = ast_sampler2darrayshadow; } + | ISAMPLER1D { $$ = ast_isampler1d; } + | ISAMPLER2D { $$ = ast_isampler2d; } + | ISAMPLER3D { $$ = ast_isampler3d; } + | ISAMPLERCUBE { $$ = ast_isamplercube; } + | ISAMPLER1DARRAY { $$ = ast_isampler1darray; } + | ISAMPLER2DARRAY { $$ = ast_isampler2darray; } + | USAMPLER1D { $$ = ast_usampler1d; } + | USAMPLER2D { $$ = ast_usampler2d; } + | USAMPLER3D { $$ = ast_usampler3d; } + | USAMPLERCUBE { $$ = ast_usamplercube; } + | USAMPLER1DARRAY { $$ = ast_usampler1darray; } + | USAMPLER2DARRAY { $$ = ast_usampler2darray; } + ; + +precision_qualifier: + HIGHP { + if (state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_high; + } + | MEDIUMP { + if (state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_medium; + } + | LOWP { + if (state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_low; + } + ; + +struct_specifier: + STRUCT IDENTIFIER '{' struct_declaration_list '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_struct_specifier($2, $4); + $$->set_location(yylloc); + } + | STRUCT '{' struct_declaration_list '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_struct_specifier(NULL, $3); + $$->set_location(yylloc); + } + ; + +struct_declaration_list: + struct_declaration + { + $$ = (struct ast_node *) $1; + $1->link.self_link(); + } + | struct_declaration_list struct_declaration + { + $$ = (struct ast_node *) $1; + $$->link.insert_before(& $2->link); + } + ; + +struct_declaration: + type_specifier struct_declarator_list ';' + { + void *ctx = talloc_parent(state); + ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); + type->set_location(yylloc); + + type->specifier = $1; + $$ = new(ctx) ast_declarator_list(type); + $$->set_location(yylloc); + + $$->declarations.push_degenerate_list_at_head(& $2->link); + } + ; + +struct_declarator_list: + struct_declarator + { + $$ = $1; + $1->link.self_link(); + } + | struct_declarator_list ',' struct_declarator + { + $$ = $1; + $$->link.insert_before(& $3->link); + } + ; + +struct_declarator: + IDENTIFIER + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_declaration($1, false, NULL, NULL); + $$->set_location(yylloc); + } + | IDENTIFIER '[' constant_expression ']' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_declaration($1, true, $3, NULL); + $$->set_location(yylloc); + } + ; + +initializer: + assignment_expression + ; + +declaration_statement: + declaration + ; + + // Grammar Note: labeled statements for SWITCH only; 'goto' is not + // supported. +statement: + statement_matched + | statement_unmatched + ; + +statement_matched: + compound_statement { $$ = (struct ast_node *) $1; } + | simple_statement + ; + +statement_unmatched: + selection_statement_unmatched + ; + +simple_statement: + declaration_statement + | expression_statement + | selection_statement_matched + | switch_statement { $$ = NULL; } + | case_label { $$ = NULL; } + | iteration_statement + | jump_statement + ; + +compound_statement: + '{' '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_compound_statement(true, NULL); + $$->set_location(yylloc); + } + | '{' statement_list '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_compound_statement(true, $2); + $$->set_location(yylloc); + } + ; + +statement_no_new_scope: + compound_statement_no_new_scope { $$ = (struct ast_node *) $1; } + | simple_statement + ; + +compound_statement_no_new_scope: + '{' '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_compound_statement(false, NULL); + $$->set_location(yylloc); + } + | '{' statement_list '}' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_compound_statement(false, $2); + $$->set_location(yylloc); + } + ; + +statement_list: + statement + { + if ($1 == NULL) { + _mesa_glsl_error(& @1, state, " statement\n"); + assert($1 != NULL); + } + + $$ = $1; + $$->link.self_link(); + } + | statement_list statement + { + if ($2 == NULL) { + _mesa_glsl_error(& @2, state, " statement\n"); + assert($2 != NULL); + } + $$ = $1; + $$->link.insert_before(& $2->link); + } + ; + +expression_statement: + ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_statement(NULL); + $$->set_location(yylloc); + } + | expression ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_expression_statement($1); + $$->set_location(yylloc); + } + ; + +selection_statement_matched: + IF '(' expression ')' statement_matched ELSE statement_matched + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_selection_statement($3, $5, $7); + $$->set_location(yylloc); + } + ; + +selection_statement_unmatched: + IF '(' expression ')' statement_matched + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_selection_statement($3, $5, NULL); + $$->set_location(yylloc); + } + | IF '(' expression ')' statement_unmatched + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_selection_statement($3, $5, NULL); + $$->set_location(yylloc); + } + | IF '(' expression ')' statement_matched ELSE statement_unmatched + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_selection_statement($3, $5, $7); + $$->set_location(yylloc); + } + ; + +condition: + expression + { + $$ = (struct ast_node *) $1; + } + | fully_specified_type IDENTIFIER '=' initializer + { + void *ctx = talloc_parent(state); + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + ast_declarator_list *declarator = new(ctx) ast_declarator_list($1); + decl->set_location(yylloc); + declarator->set_location(yylloc); + + declarator->declarations.push_tail(&decl->link); + $$ = declarator; + } + ; + +switch_statement: + SWITCH '(' expression ')' compound_statement + ; + +case_label: + CASE expression ':' + | DEFAULT ':' + ; + +iteration_statement: + WHILE '(' condition ')' statement_no_new_scope + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, + NULL, $3, NULL, $5); + $$->set_location(yylloc); + } + | DO statement WHILE '(' expression ')' ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, + NULL, $5, NULL, $2); + $$->set_location(yylloc); + } + | FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, + $3, $4.cond, $4.rest, $6); + $$->set_location(yylloc); + } + ; + +for_init_statement: + expression_statement + | declaration_statement + ; + +conditionopt: + condition + | /* empty */ + { + $$ = NULL; + } + ; + +for_rest_statement: + conditionopt ';' + { + $$.cond = $1; + $$.rest = NULL; + } + | conditionopt ';' expression + { + $$.cond = $1; + $$.rest = $3; + } + ; + + // Grammar Note: No 'goto'. Gotos are not supported. +jump_statement: + CONTINUE ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); + $$->set_location(yylloc); + } + | BREAK ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); + $$->set_location(yylloc); + } + | RETURN ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); + $$->set_location(yylloc); + } + | RETURN expression ';' + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, $2); + $$->set_location(yylloc); + } + | DISCARD ';' // Fragment shader only. + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); + $$->set_location(yylloc); + } + ; + +external_declaration: + function_definition { $$ = $1; } + | declaration { $$ = $1; } + ; + +function_definition: + function_prototype compound_statement_no_new_scope + { + void *ctx = talloc_parent(state); + $$ = new(ctx) ast_function_definition(); + $$->set_location(yylloc); + $$->prototype = $1; + $$->body = $2; + } + ; diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp new file mode 100644 index 0000000000..1d16ef55f5 --- /dev/null +++ b/src/glsl/glsl_parser_extras.cpp @@ -0,0 +1,621 @@ +/* + * Copyright © 2008, 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. + */ +#include +#include +#include +#include + +extern "C" { +#include +} + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" + +const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) +{ + switch (target) { + case vertex_shader: return "vertex"; + case fragment_shader: return "fragment"; + case geometry_shader: return "geometry"; + case ir_shader: break; + } + + assert(!"Should not get here."); +} + + +void +_mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...) +{ + va_list ap; + + state->error = true; + + assert(state->info_log != NULL); + state->info_log = talloc_asprintf_append(state->info_log, + "%u:%u(%u): error: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); +} + + +void +_mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...) +{ + va_list ap; + + assert(state->info_log != NULL); + state->info_log = talloc_asprintf_append(state->info_log, + "%u:%u(%u): warning: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); +} + + +bool +_mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, + const char *behavior, YYLTYPE *behavior_locp, + _mesa_glsl_parse_state *state) +{ + enum { + extension_disable, + extension_enable, + extension_require, + extension_warn + } ext_mode; + + if (strcmp(behavior, "warn") == 0) { + ext_mode = extension_warn; + } else if (strcmp(behavior, "require") == 0) { + ext_mode = extension_require; + } else if (strcmp(behavior, "enable") == 0) { + ext_mode = extension_enable; + } else if (strcmp(behavior, "disable") == 0) { + ext_mode = extension_disable; + } else { + _mesa_glsl_error(behavior_locp, state, + "Unknown extension behavior `%s'", + behavior); + return false; + } + + bool unsupported = false; + + if (strcmp(name, "all") == 0) { + if ((ext_mode == extension_enable) || (ext_mode == extension_require)) { + _mesa_glsl_error(name_locp, state, "Cannot %s all extensions", + (ext_mode == extension_enable) + ? "enable" : "require"); + return false; + } + } else if (strcmp(name, "GL_ARB_draw_buffers") == 0) { + /* This extension is only supported in fragment shaders. + */ + if (state->target != fragment_shader) { + unsupported = true; + } else { + state->ARB_draw_buffers_enable = (ext_mode != extension_disable); + state->ARB_draw_buffers_warn = (ext_mode == extension_warn); + } + } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) { + state->ARB_texture_rectangle_enable = (ext_mode != extension_disable); + state->ARB_texture_rectangle_warn = (ext_mode == extension_warn); + } else { + unsupported = true; + } + + if (unsupported) { + static const char *const fmt = "extension `%s' unsupported in %s shader"; + + if (ext_mode == extension_require) { + _mesa_glsl_error(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); + return false; + } else { + _mesa_glsl_warning(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); + } + } + + return true; +} + +void +_mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q) +{ + if (q->constant) + printf("const "); + + if (q->invariant) + printf("invariant "); + + if (q->attribute) + printf("attribute "); + + if (q->varying) + printf("varying "); + + if (q->in && q->out) + printf("inout "); + else { + if (q->in) + printf("in "); + + if (q->out) + printf("out "); + } + + if (q->centroid) + printf("centroid "); + if (q->uniform) + printf("uniform "); + if (q->smooth) + printf("smooth "); + if (q->flat) + printf("flat "); + if (q->noperspective) + printf("noperspective "); +} + + +void +ast_node::print(void) const +{ + printf("unhandled node "); +} + + +ast_node::ast_node(void) +{ + /* empty */ +} + + +static void +ast_opt_array_size_print(bool is_array, const ast_expression *array_size) +{ + if (is_array) { + printf("[ "); + + if (array_size) + array_size->print(); + + printf("] "); + } +} + + +void +ast_compound_statement::print(void) const +{ + printf("{\n"); + + foreach_list_const(n, &this->statements) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf("}\n"); +} + + +ast_compound_statement::ast_compound_statement(int new_scope, + ast_node *statements) +{ + this->new_scope = new_scope; + + if (statements != NULL) { + this->statements.push_degenerate_list_at_head(&statements->link); + } +} + + +void +ast_expression::print(void) const +{ + switch (oper) { + case ast_assign: + case ast_mul_assign: + case ast_div_assign: + case ast_mod_assign: + case ast_add_assign: + case ast_sub_assign: + case ast_ls_assign: + case ast_rs_assign: + case ast_and_assign: + case ast_xor_assign: + case ast_or_assign: + subexpressions[0]->print(); + printf("%s ", operator_string(oper)); + subexpressions[1]->print(); + break; + + case ast_field_selection: + subexpressions[0]->print(); + printf(". %s ", primary_expression.identifier); + break; + + case ast_plus: + case ast_neg: + case ast_bit_not: + case ast_logic_not: + case ast_pre_inc: + case ast_pre_dec: + printf("%s ", operator_string(oper)); + subexpressions[0]->print(); + break; + + case ast_post_inc: + case ast_post_dec: + subexpressions[0]->print(); + printf("%s ", operator_string(oper)); + break; + + case ast_conditional: + subexpressions[0]->print(); + printf("? "); + subexpressions[1]->print(); + printf(": "); + subexpressions[1]->print(); + break; + + case ast_array_index: + subexpressions[0]->print(); + printf("[ "); + subexpressions[1]->print(); + printf("] "); + break; + + case ast_function_call: { + subexpressions[0]->print(); + printf("( "); + + foreach_list_const (n, &this->expressions) { + if (n != this->expressions.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf(") "); + break; + } + + case ast_identifier: + printf("%s ", primary_expression.identifier); + break; + + case ast_int_constant: + printf("%d ", primary_expression.int_constant); + break; + + case ast_uint_constant: + printf("%u ", primary_expression.uint_constant); + break; + + case ast_float_constant: + printf("%f ", primary_expression.float_constant); + break; + + case ast_bool_constant: + printf("%s ", + primary_expression.bool_constant + ? "true" : "false"); + break; + + case ast_sequence: { + printf("( "); + foreach_list_const(n, & this->expressions) { + if (n != this->expressions.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf(") "); + break; + } + + default: + assert(0); + break; + } +} + +ast_expression::ast_expression(int oper, + ast_expression *ex0, + ast_expression *ex1, + ast_expression *ex2) +{ + this->oper = ast_operators(oper); + this->subexpressions[0] = ex0; + this->subexpressions[1] = ex1; + this->subexpressions[2] = ex2; +} + + +void +ast_expression_statement::print(void) const +{ + if (expression) + expression->print(); + + printf("; "); +} + + +ast_expression_statement::ast_expression_statement(ast_expression *ex) : + expression(ex) +{ + /* empty */ +} + + +void +ast_function::print(void) const +{ + return_type->print(); + printf(" %s (", identifier); + + foreach_list_const(n, & this->parameters) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf(")"); +} + + +ast_function::ast_function(void) + : is_definition(false), signature(NULL) +{ + /* empty */ +} + + +void +ast_fully_specified_type::print(void) const +{ + _mesa_ast_type_qualifier_print(& qualifier); + specifier->print(); +} + + +void +ast_parameter_declarator::print(void) const +{ + type->print(); + if (identifier) + printf("%s ", identifier); + ast_opt_array_size_print(is_array, array_size); +} + + +void +ast_function_definition::print(void) const +{ + prototype->print(); + body->print(); +} + + +void +ast_declaration::print(void) const +{ + printf("%s ", identifier); + ast_opt_array_size_print(is_array, array_size); + + if (initializer) { + printf("= "); + initializer->print(); + } +} + + +ast_declaration::ast_declaration(char *identifier, int is_array, + ast_expression *array_size, + ast_expression *initializer) +{ + this->identifier = identifier; + this->is_array = is_array; + this->array_size = array_size; + this->initializer = initializer; +} + + +void +ast_declarator_list::print(void) const +{ + assert(type || invariant); + + if (type) + type->print(); + else + printf("invariant "); + + foreach_list_const (ptr, & this->declarations) { + if (ptr != this->declarations.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, ptr, link); + ast->print(); + } + + printf("; "); +} + + +ast_declarator_list::ast_declarator_list(ast_fully_specified_type *type) +{ + this->type = type; +} + +void +ast_jump_statement::print(void) const +{ + switch (mode) { + case ast_continue: + printf("continue; "); + break; + case ast_break: + printf("break; "); + break; + case ast_return: + printf("return "); + if (opt_return_value) + opt_return_value->print(); + + printf("; "); + break; + case ast_discard: + printf("discard; "); + break; + } +} + + +ast_jump_statement::ast_jump_statement(int mode, ast_expression *return_value) +{ + this->mode = ast_jump_modes(mode); + + if (mode == ast_return) + opt_return_value = return_value; +} + + +void +ast_selection_statement::print(void) const +{ + printf("if ( "); + condition->print(); + printf(") "); + + then_statement->print(); + + if (else_statement) { + printf("else "); + else_statement->print(); + } + +} + + +ast_selection_statement::ast_selection_statement(ast_expression *condition, + ast_node *then_statement, + ast_node *else_statement) +{ + this->condition = condition; + this->then_statement = then_statement; + this->else_statement = else_statement; +} + + +void +ast_iteration_statement::print(void) const +{ + switch (mode) { + case ast_for: + printf("for( "); + if (init_statement) + init_statement->print(); + printf("; "); + + if (condition) + condition->print(); + printf("; "); + + if (rest_expression) + rest_expression->print(); + printf(") "); + + body->print(); + break; + + case ast_while: + printf("while ( "); + if (condition) + condition->print(); + printf(") "); + body->print(); + break; + + case ast_do_while: + printf("do "); + body->print(); + printf("while ( "); + if (condition) + condition->print(); + printf("); "); + break; + } +} + + +ast_iteration_statement::ast_iteration_statement(int mode, + ast_node *init, + ast_node *condition, + ast_expression *rest_expression, + ast_node *body) +{ + this->mode = ast_iteration_modes(mode); + this->init_statement = init; + this->condition = condition; + this->rest_expression = rest_expression; + this->body = body; +} + + +void +ast_struct_specifier::print(void) const +{ + printf("struct %s { ", name); + foreach_list_const(n, &this->declarations) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf("} "); +} + + +ast_struct_specifier::ast_struct_specifier(char *identifier, + ast_node *declarator_list) +{ + name = identifier; + this->declarations.push_degenerate_list_at_head(&declarator_list->link); +} diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h new file mode 100644 index 0000000000..cfe02e3b0c --- /dev/null +++ b/src/glsl/glsl_parser_extras.h @@ -0,0 +1,139 @@ +/* + * 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. + */ + +#pragma once +#ifndef GLSL_PARSER_EXTRAS_H +#define GLSL_PARSER_EXTRAS_H + +#include +#include "glsl_symbol_table.h" + +enum _mesa_glsl_parser_targets { + vertex_shader, + geometry_shader, + fragment_shader, + ir_shader +}; + +struct _mesa_glsl_parse_state { + void *scanner; + exec_list translation_unit; + glsl_symbol_table *symbols; + + unsigned language_version; + enum _mesa_glsl_parser_targets target; + + /** + * During AST to IR conversion, pointer to current IR function + * + * Will be \c NULL whenever the AST to IR conversion is not inside a + * function definition. + */ + class ir_function_signature *current_function; + + /** Was there an error during compilation? */ + bool error; + + /** Index of last generated anonymous temporary. */ + unsigned temp_index; + + /** Loop or switch statement containing the current instructions. */ + class ir_instruction *loop_or_switch_nesting; + + /** List of structures defined in user code. */ + const glsl_type **user_structures; + unsigned num_user_structures; + + char *info_log; + + /** + * \name Enable bits for GLSL extensions + */ + /*@{*/ + unsigned ARB_draw_buffers_enable:1; + unsigned ARB_draw_buffers_warn:1; + unsigned ARB_texture_rectangle_enable:1; + unsigned ARB_texture_rectangle_warn:1; + unsigned EXT_texture_array_enable:1; + unsigned EXT_texture_array_warn:1; + /*@}*/ +}; + +typedef struct YYLTYPE { + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 + +extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...); + +/** + * Emit a warning to the shader log + * + * \sa _mesa_glsl_error + */ +extern void _mesa_glsl_warning(const YYLTYPE *locp, + _mesa_glsl_parse_state *state, + const char *fmt, ...); + +extern "C" { +extern int preprocess(void *ctx, const char **shader, char **info_log); +} + +extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, + const char *string); + +extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state); + +union YYSTYPE; +extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc, + void *scanner); + +extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *); + +/** + * Process elements of the #extension directive + * + * \return + * If \c name and \c behavior are valid, \c true is returned. Otherwise + * \c false is returned. + */ +extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, + const char *behavior, + YYLTYPE *behavior_locp, + _mesa_glsl_parse_state *state); + +/** + * Get the textual name of the specified shader target + */ +extern const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target); + +void do_ir_to_mesa(exec_list *instructions); + +#endif /* GLSL_PARSER_EXTRAS_H */ diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h new file mode 100644 index 0000000000..ae2fd3f4f1 --- /dev/null +++ b/src/glsl/glsl_symbol_table.h @@ -0,0 +1,163 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef GLSL_SYMBOL_TABLE +#define GLSL_SYMBOL_TABLE + +#include + +#include "symbol_table.h" +#include "ir.h" +#include "glsl_types.h" + +/** + * Facade class for _mesa_symbol_table + * + * Wraps the existing \c _mesa_symbol_table data structure to enforce some + * type safe and some symbol table invariants. + */ +class glsl_symbol_table { +private: + enum glsl_symbol_name_space { + glsl_variable_name_space = 0, + glsl_type_name_space = 1, + glsl_function_name_space = 2 + }; + + static int + _glsl_symbol_table_destructor (glsl_symbol_table *table) + { + table->~glsl_symbol_table(); + + return 0; + } + +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *table; + + table = talloc_size(ctx, size); + assert(table != NULL); + + talloc_set_destructor(table, (int (*)(void*)) _glsl_symbol_table_destructor); + + return table; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. Here, C++ will have already called the + * destructor so tell talloc not to do that again. */ + static void operator delete(void *table) + { + talloc_set_destructor(table, NULL); + talloc_free(table); + } + + glsl_symbol_table() + { + table = _mesa_symbol_table_ctor(); + } + + ~glsl_symbol_table() + { + _mesa_symbol_table_dtor(table); + } + + void push_scope() + { + _mesa_symbol_table_push_scope(table); + } + + void pop_scope() + { + _mesa_symbol_table_pop_scope(table); + } + + /** + * Determine whether a name was declared at the current scope + */ + bool name_declared_this_scope(const char *name) + { + return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; + } + + /** + * \name Methods to add symbols to the table + * + * There is some temptation to rename all these functions to \c add_symbol + * or similar. However, this breaks symmetry with the getter functions and + * reduces the clarity of the intention of code that uses these methods. + */ + /*@{*/ + bool add_variable(const char *name, ir_variable *v) + { + return _mesa_symbol_table_add_symbol(table, glsl_variable_name_space, + name, v) == 0; + } + + bool add_type(const char *name, const glsl_type *t) + { + return _mesa_symbol_table_add_symbol(table, glsl_type_name_space, + name, (void *) t) == 0; + } + + bool add_function(const char *name, ir_function *f) + { + return _mesa_symbol_table_add_symbol(table, glsl_function_name_space, + name, f) == 0; + } + /*@}*/ + + /** + * \name Methods to get symbols from the table + */ + /*@{*/ + ir_variable *get_variable(const char *name) + { + return (ir_variable *) + _mesa_symbol_table_find_symbol(table, glsl_variable_name_space, name); + } + + glsl_type *get_type(const char *name) + { + return (glsl_type *) + _mesa_symbol_table_find_symbol(table, glsl_type_name_space, name); + } + + ir_function *get_function(const char *name) + { + return (ir_function *) + _mesa_symbol_table_find_symbol(table, glsl_function_name_space, name); + } + /*@}*/ + +private: + struct _mesa_symbol_table *table; +}; + +#endif /* GLSL_SYMBOL_TABLE */ diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp new file mode 100644 index 0000000000..bef267fa6b --- /dev/null +++ b/src/glsl/glsl_types.cpp @@ -0,0 +1,773 @@ +/* + * 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. + */ + +#include +#include +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" +#include "builtin_types.h" +#include "hash_table.h" + + +hash_table *glsl_type::array_types = NULL; + +static void +add_types_to_symbol_table(glsl_symbol_table *symtab, + const struct glsl_type *types, + unsigned num_types, bool warn) +{ + (void) warn; + + for (unsigned i = 0; i < num_types; i++) { + symtab->add_type(types[i].name, & types[i]); + } +} + + +static void +generate_110_types(glsl_symbol_table *symtab) +{ + add_types_to_symbol_table(symtab, builtin_core_types, + Elements(builtin_core_types), + false); + add_types_to_symbol_table(symtab, builtin_structure_types, + Elements(builtin_structure_types), + false); + add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types, + Elements(builtin_110_deprecated_structure_types), + false); + add_types_to_symbol_table(symtab, & void_type, 1, false); +} + + +static void +generate_120_types(glsl_symbol_table *symtab) +{ + generate_110_types(symtab); + + add_types_to_symbol_table(symtab, builtin_120_types, + Elements(builtin_120_types), false); +} + + +static void +generate_130_types(glsl_symbol_table *symtab) +{ + generate_120_types(symtab); + + add_types_to_symbol_table(symtab, builtin_130_types, + Elements(builtin_130_types), false); +} + + +static void +generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, bool warn) +{ + add_types_to_symbol_table(symtab, builtin_ARB_texture_rectangle_types, + Elements(builtin_ARB_texture_rectangle_types), + warn); +} + + +static void +generate_EXT_texture_array_types(glsl_symbol_table *symtab, bool warn) +{ + add_types_to_symbol_table(symtab, builtin_EXT_texture_array_types, + Elements(builtin_EXT_texture_array_types), + warn); +} + + +void +_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) +{ + switch (state->language_version) { + case 110: + generate_110_types(state->symbols); + break; + case 120: + generate_120_types(state->symbols); + break; + case 130: + generate_130_types(state->symbols); + break; + default: + /* error */ + break; + } + + if (state->ARB_texture_rectangle_enable) { + generate_ARB_texture_rectangle_types(state->symbols, + state->ARB_texture_rectangle_warn); + } + + if (state->EXT_texture_array_enable && state->language_version < 130) { + // These are already included in 130; don't create twice. + generate_EXT_texture_array_types(state->symbols, + state->EXT_texture_array_warn); + } +} + + +const glsl_type *glsl_type::get_base_type() const +{ + switch (base_type) { + case GLSL_TYPE_UINT: + return uint_type; + case GLSL_TYPE_INT: + return int_type; + case GLSL_TYPE_FLOAT: + return float_type; + case GLSL_TYPE_BOOL: + return bool_type; + default: + return error_type; + } +} + + +ir_function * +glsl_type::generate_constructor(glsl_symbol_table *symtab) const +{ + void *ctx = symtab; + + /* Generate the function name and add it to the symbol table. + */ + ir_function *const f = new(ctx) ir_function(name); + + bool added = symtab->add_function(name, f); + assert(added); + + ir_function_signature *const sig = new(ctx) ir_function_signature(this); + f->add_signature(sig); + + ir_variable **declarations = + (ir_variable **) malloc(sizeof(ir_variable *) * this->length); + for (unsigned i = 0; i < length; i++) { + char *const param_name = (char *) malloc(10); + + snprintf(param_name, 10, "p%08X", i); + + ir_variable *var = (this->base_type == GLSL_TYPE_ARRAY) + ? new(ctx) ir_variable(fields.array, param_name) + : new(ctx) ir_variable(fields.structure[i].type, param_name); + + var->mode = ir_var_in; + declarations[i] = var; + sig->parameters.push_tail(var); + } + + /* Generate the body of the constructor. The body assigns each of the + * parameters to a portion of a local variable called __retval that has + * the same type as the constructor. After initializing __retval, + * __retval is returned. + */ + ir_variable *retval = new(ctx) ir_variable(this, "__retval"); + sig->body.push_tail(retval); + + for (unsigned i = 0; i < length; i++) { + ir_dereference *const lhs = (this->base_type == GLSL_TYPE_ARRAY) + ? (ir_dereference *) new(ctx) ir_dereference_array(retval, + new(ctx) ir_constant(i)) + : (ir_dereference *) new(ctx) ir_dereference_record(retval, + fields.structure[i].name); + + ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[i]); + ir_instruction *const assign = new(ctx) ir_assignment(lhs, rhs, NULL); + + sig->body.push_tail(assign); + } + + free(declarations); + + ir_dereference *const retref = new(ctx) ir_dereference_variable(retval); + ir_instruction *const inst = new(ctx) ir_return(retref); + sig->body.push_tail(inst); + + return f; +} + + +/** + * Generate the function intro for a constructor + * + * \param type Data type to be constructed + * \param count Number of parameters to this concrete constructor. Most + * types have at least two constructors. One will take a + * single scalar parameter and the other will take "N" + * scalar parameters. + * \param parameters Storage for the list of parameters. These are + * typically stored in an \c ir_function_signature. + * \param declarations Pointers to the variable declarations for the function + * parameters. These are used later to avoid having to use + * the symbol table. + */ +static ir_function_signature * +generate_constructor_intro(void *ctx, + const glsl_type *type, unsigned parameter_count, + ir_variable **declarations) +{ + /* Names of parameters used in vector and matrix constructors + */ + static const char *const names[] = { + "a", "b", "c", "d", "e", "f", "g", "h", + "i", "j", "k", "l", "m", "n", "o", "p", + }; + + assert(parameter_count <= Elements(names)); + + const glsl_type *const parameter_type = type->get_base_type(); + + ir_function_signature *const signature = new(ctx) ir_function_signature(type); + + for (unsigned i = 0; i < parameter_count; i++) { + ir_variable *var = new(ctx) ir_variable(parameter_type, names[i]); + + var->mode = ir_var_in; + signature->parameters.push_tail(var); + + declarations[i] = var; + } + + ir_variable *retval = new(ctx) ir_variable(type, "__retval"); + signature->body.push_tail(retval); + + declarations[16] = retval; + return signature; +} + + +/** + * Generate the body of a vector constructor that takes a single scalar + */ +static void +generate_vec_body_from_scalar(void *ctx, + exec_list *instructions, + ir_variable **declarations) +{ + ir_instruction *inst; + + /* Generate a single assignment of the parameter to __retval.x and return + * __retval.xxxx for however many vector components there are. + */ + ir_dereference *const lhs_ref = + new(ctx) ir_dereference_variable(declarations[16]); + ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[0]); + + ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, 0, 0, 0, 0, 1); + + inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + + ir_dereference *const retref = new(ctx) ir_dereference_variable(declarations[16]); + + ir_swizzle *retval = new(ctx) ir_swizzle(retref, 0, 0, 0, 0, + declarations[16]->type->vector_elements); + + inst = new(ctx) ir_return(retval); + instructions->push_tail(inst); +} + + +/** + * Generate the body of a vector constructor that takes multiple scalars + */ +static void +generate_vec_body_from_N_scalars(void *ctx, + exec_list *instructions, + ir_variable **declarations) +{ + ir_instruction *inst; + const glsl_type *const vec_type = declarations[16]->type; + + /* Generate an assignment of each parameter to a single component of + * __retval.x and return __retval. + */ + for (unsigned i = 0; i < vec_type->vector_elements; i++) { + ir_dereference *const lhs_ref = + new(ctx) ir_dereference_variable(declarations[16]); + ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[i]); + + ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, i, 0, 0, 0, 1); + + inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + } + + ir_dereference *retval = new(ctx) ir_dereference_variable(declarations[16]); + + inst = new(ctx) ir_return(retval); + instructions->push_tail(inst); +} + + +/** + * Generate the body of a matrix constructor that takes a single scalar + */ +static void +generate_mat_body_from_scalar(void *ctx, + exec_list *instructions, + ir_variable **declarations) +{ + ir_instruction *inst; + + /* Generate an assignment of the parameter to the X component of a + * temporary vector. Set the remaining fields of the vector to 0. The + * size of the vector is equal to the number of rows of the matrix. + * + * Set each column of the matrix to a successive "rotation" of the + * temporary vector. This fills the matrix with 0s, but writes the single + * scalar along the matrix's diagonal. + * + * For a mat4x3, this is equivalent to: + * + * vec3 tmp; + * mat4x3 __retval; + * tmp.x = a; + * tmp.y = 0.0; + * tmp.z = 0.0; + * __retval[0] = tmp.xyy; + * __retval[1] = tmp.yxy; + * __retval[2] = tmp.yyx; + * __retval[3] = tmp.yyy; + */ + const glsl_type *const column_type = declarations[16]->type->column_type(); + const glsl_type *const row_type = declarations[16]->type->row_type(); + + ir_variable *const column = new(ctx) ir_variable(column_type, "v"); + + instructions->push_tail(column); + + ir_dereference *const lhs_ref = new(ctx) ir_dereference_variable(column); + ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[0]); + + ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, 0, 0, 0, 0, 1); + + inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + + for (unsigned i = 1; i < column_type->vector_elements; i++) { + ir_dereference *const lhs_ref = new(ctx) ir_dereference_variable(column); + ir_constant *const zero = new(ctx) ir_constant(0.0f); + + ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, i, 0, 0, 0, 1); + + inst = new(ctx) ir_assignment(lhs, zero, NULL); + instructions->push_tail(inst); + } + + + for (unsigned i = 0; i < row_type->vector_elements; i++) { + static const unsigned swiz[] = { 1, 1, 1, 0, 1, 1, 1 }; + ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(column); + + /* This will be .xyyy when i=0, .yxyy when i=1, etc. + */ + ir_swizzle *rhs = new(ctx) ir_swizzle(rhs_ref, swiz[3 - i], swiz[4 - i], + swiz[5 - i], swiz[6 - i], + column_type->vector_elements); + + ir_constant *const idx = new(ctx) ir_constant(int(i)); + ir_dereference *const lhs = + new(ctx) ir_dereference_array(declarations[16], idx); + + inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + } + + ir_dereference *const retval = new(ctx) ir_dereference_variable(declarations[16]); + inst = new(ctx) ir_return(retval); + instructions->push_tail(inst); +} + + +/** + * Generate the body of a vector constructor that takes multiple scalars + */ +static void +generate_mat_body_from_N_scalars(void *ctx, + exec_list *instructions, + ir_variable **declarations) +{ + ir_instruction *inst; + const glsl_type *const row_type = declarations[16]->type->row_type(); + const glsl_type *const column_type = declarations[16]->type->column_type(); + + /* Generate an assignment of each parameter to a single component of + * of a particular column of __retval and return __retval. + */ + for (unsigned i = 0; i < column_type->vector_elements; i++) { + for (unsigned j = 0; j < row_type->vector_elements; j++) { + ir_constant *row_index = new(ctx) ir_constant(int(i)); + ir_dereference *const row_access = + new(ctx) ir_dereference_array(declarations[16], row_index); + + ir_swizzle *component_access = new(ctx) ir_swizzle(row_access, + j, 0, 0, 0, 1); + + const unsigned param = (i * row_type->vector_elements) + j; + ir_dereference *const rhs = + new(ctx) ir_dereference_variable(declarations[param]); + + inst = new(ctx) ir_assignment(component_access, rhs, NULL); + instructions->push_tail(inst); + } + } + + ir_dereference *retval = new(ctx) ir_dereference_variable(declarations[16]); + + inst = new(ctx) ir_return(retval); + instructions->push_tail(inst); +} + + +/** + * Generate the constructors for a set of GLSL types + * + * Constructor implementations are added to \c instructions, and the symbols + * are added to \c symtab. + */ +static void +generate_constructor(glsl_symbol_table *symtab, const struct glsl_type *types, + unsigned num_types, exec_list *instructions) +{ + void *ctx = symtab; + ir_variable *declarations[17]; + + for (unsigned i = 0; i < num_types; i++) { + /* Only numeric and boolean vectors and matrices get constructors here. + * Structures need to be handled elsewhere. It is expected that scalar + * constructors are never actually called, so they are not generated. + */ + if (!types[i].is_numeric() && !types[i].is_boolean()) + continue; + + if (types[i].is_scalar()) + continue; + + /* Generate the function block, add it to the symbol table, and emit it. + */ + ir_function *const f = new(ctx) ir_function(types[i].name); + + bool added = symtab->add_function(types[i].name, f); + assert(added); + + instructions->push_tail(f); + + /* Each type has several basic constructors. The total number of forms + * depends on the derived type. + * + * Vectors: 1 scalar, N scalars + * Matrices: 1 scalar, NxM scalars + * + * Several possible types of constructors are not included in this list. + * + * Scalar constructors are not included. The expectation is that the + * IR generator won't actually generate these as constructor calls. The + * expectation is that it will just generate the necessary type + * conversion. + * + * Matrix contructors from matrices are also not included. The + * expectation is that the IR generator will generate a call to the + * appropriate from-scalars constructor. + */ + ir_function_signature *const sig = + generate_constructor_intro(ctx, &types[i], 1, declarations); + f->add_signature(sig); + + if (types[i].is_vector()) { + generate_vec_body_from_scalar(ctx, &sig->body, declarations); + + ir_function_signature *const vec_sig = + generate_constructor_intro(ctx, + &types[i], types[i].vector_elements, + declarations); + f->add_signature(vec_sig); + + generate_vec_body_from_N_scalars(ctx, &vec_sig->body, declarations); + } else { + assert(types[i].is_matrix()); + + generate_mat_body_from_scalar(ctx, &sig->body, declarations); + + ir_function_signature *const mat_sig = + generate_constructor_intro(ctx, + &types[i], + (types[i].vector_elements + * types[i].matrix_columns), + declarations); + f->add_signature(mat_sig); + + generate_mat_body_from_N_scalars(ctx, &mat_sig->body, declarations); + } + } +} + + +void +generate_110_constructors(glsl_symbol_table *symtab, exec_list *instructions) +{ + generate_constructor(symtab, builtin_core_types, + Elements(builtin_core_types), instructions); +} + + +void +generate_120_constructors(glsl_symbol_table *symtab, exec_list *instructions) +{ + generate_110_constructors(symtab, instructions); + + generate_constructor(symtab, builtin_120_types, + Elements(builtin_120_types), instructions); +} + + +void +generate_130_constructors(glsl_symbol_table *symtab, exec_list *instructions) +{ + generate_120_constructors(symtab, instructions); + + generate_constructor(symtab, builtin_130_types, + Elements(builtin_130_types), instructions); +} + + +void +_mesa_glsl_initialize_constructors(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + switch (state->language_version) { + case 110: + generate_110_constructors(state->symbols, instructions); + break; + case 120: + generate_120_constructors(state->symbols, instructions); + break; + case 130: + generate_130_constructors(state->symbols, instructions); + break; + default: + /* error */ + break; + } +} + + +glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) : + base_type(GLSL_TYPE_ARRAY), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(0), matrix_columns(0), + name(NULL), length(length) +{ + this->fields.array = array; + + /* Allow a maximum of 10 characters for the array size. This is enough + * for 32-bits of ~0. The extra 3 are for the '[', ']', and terminating + * NUL. + */ + const unsigned name_length = strlen(array->name) + 10 + 3; + char *const n = (char *) talloc_size(ctx, name_length); + + if (length == 0) + snprintf(n, name_length, "%s[]", array->name); + else + snprintf(n, name_length, "%s[%u]", array->name, length); + + this->name = n; +} + + +const glsl_type * +glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns) +{ + if (base_type == GLSL_TYPE_VOID) + return &void_type; + + if ((rows < 1) || (rows > 4) || (columns < 1) || (columns > 4)) + return error_type; + + /* Treat GLSL vectors as Nx1 matrices. + */ + if (columns == 1) { + switch (base_type) { + case GLSL_TYPE_UINT: + return uint_type + (rows - 1); + case GLSL_TYPE_INT: + return int_type + (rows - 1); + case GLSL_TYPE_FLOAT: + return float_type + (rows - 1); + case GLSL_TYPE_BOOL: + return bool_type + (rows - 1); + default: + return error_type; + } + } else { + if ((base_type != GLSL_TYPE_FLOAT) || (rows == 1)) + return error_type; + + /* GLSL matrix types are named mat{COLUMNS}x{ROWS}. Only the following + * combinations are valid: + * + * 1 2 3 4 + * 1 + * 2 x x x + * 3 x x x + * 4 x x x + */ +#define IDX(c,r) (((c-1)*3) + (r-1)) + + switch (IDX(columns, rows)) { + case IDX(2,2): return mat2_type; + case IDX(2,3): return mat2x3_type; + case IDX(2,4): return mat2x4_type; + case IDX(3,2): return mat3x2_type; + case IDX(3,3): return mat3_type; + case IDX(3,4): return mat3x4_type; + case IDX(4,2): return mat4x2_type; + case IDX(4,3): return mat4x3_type; + case IDX(4,4): return mat4_type; + default: return error_type; + } + } + + assert(!"Should not get here."); + return error_type; +} + + +int +glsl_type::array_key_compare(const void *a, const void *b) +{ + const glsl_type *const key1 = (glsl_type *) a; + const glsl_type *const key2 = (glsl_type *) b; + + /* Return zero is the types match (there is zero difference) or non-zero + * otherwise. + */ + return ((key1->fields.array == key2->fields.array) + && (key1->length == key2->length)) ? 0 : 1; +} + + +unsigned +glsl_type::array_key_hash(const void *a) +{ + const glsl_type *const key = (glsl_type *) a; + + const struct { + const glsl_type *t; + unsigned l; + char nul; + } hash_key = { + key->fields.array, + key->length, + '\0' + }; + + return hash_table_string_hash(& hash_key); +} + + +const glsl_type * +glsl_type::get_array_instance(void *ctx, const glsl_type *base, + unsigned array_size) +{ + const glsl_type key(ctx, base, array_size); + + if (array_types == NULL) { + array_types = hash_table_ctor(64, array_key_hash, array_key_compare); + } + + const glsl_type *t = (glsl_type *) hash_table_find(array_types, & key); + if (t == NULL) { + t = new(ctx) glsl_type(ctx, base, array_size); + + hash_table_insert(array_types, (void *) t, t); + } + + assert(t->base_type == GLSL_TYPE_ARRAY); + assert(t->length == array_size); + assert(t->fields.array == base); + + return t; +} + + +const glsl_type * +glsl_type::field_type(const char *name) const +{ + if (this->base_type != GLSL_TYPE_STRUCT) + return error_type; + + for (unsigned i = 0; i < this->length; i++) { + if (strcmp(name, this->fields.structure[i].name) == 0) + return this->fields.structure[i].type; + } + + return error_type; +} + + +int +glsl_type::field_index(const char *name) const +{ + if (this->base_type != GLSL_TYPE_STRUCT) + return -1; + + for (unsigned i = 0; i < this->length; i++) { + if (strcmp(name, this->fields.structure[i].name) == 0) + return i; + } + + return -1; +} + + +unsigned +glsl_type::component_slots() const +{ + switch (this->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + return this->components(); + + case GLSL_TYPE_STRUCT: { + unsigned size = 0; + + for (unsigned i = 0; i < this->length; i++) + size += this->fields.structure[i].type->component_slots(); + + return size; + } + + case GLSL_TYPE_ARRAY: + return this->length * this->fields.array->component_slots(); + + default: + return 0; + } +} diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h new file mode 100644 index 0000000000..39e6ac970a --- /dev/null +++ b/src/glsl/glsl_types.h @@ -0,0 +1,445 @@ +/* -*- 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 GLSL_TYPES_H +#define GLSL_TYPES_H + +#include +#include + +extern "C" { +#include +} + +#define GLSL_TYPE_UINT 0 +#define GLSL_TYPE_INT 1 +#define GLSL_TYPE_FLOAT 2 +#define GLSL_TYPE_BOOL 3 +#define GLSL_TYPE_SAMPLER 4 +#define GLSL_TYPE_STRUCT 5 +#define GLSL_TYPE_ARRAY 6 +#define GLSL_TYPE_FUNCTION 7 +#define GLSL_TYPE_VOID 8 +#define GLSL_TYPE_ERROR 9 + +enum glsl_sampler_dim { + GLSL_SAMPLER_DIM_1D = 0, + GLSL_SAMPLER_DIM_2D, + GLSL_SAMPLER_DIM_3D, + GLSL_SAMPLER_DIM_CUBE, + GLSL_SAMPLER_DIM_RECT, + GLSL_SAMPLER_DIM_BUF +}; + + +struct glsl_type { + unsigned base_type:4; + + unsigned sampler_dimensionality:3; + unsigned sampler_shadow:1; + unsigned sampler_array:1; + unsigned sampler_type:2; /**< Type of data returned using this sampler. + * only \c GLSL_TYPE_FLOAT, \c GLSL_TYPE_INT, + * and \c GLSL_TYPE_UINT are valid. + */ + + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *type; + + type = talloc_size(ctx, size); + assert(type != NULL); + + return type; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *type) + { + talloc_free(type); + } + + /** + * \name Vector and matrix element counts + * + * For scalars, each of these values will be 1. For non-numeric types + * these will be 0. + */ + /*@{*/ + unsigned vector_elements:3; /**< 1, 2, 3, or 4 vector elements. */ + unsigned matrix_columns:3; /**< 1, 2, 3, or 4 matrix columns. */ + /*@}*/ + + /** + * Name of the data type + * + * This may be \c NULL for anonymous structures, for arrays, or for + * function types. + */ + const char *name; + + /** + * For \c GLSL_TYPE_ARRAY, this is the length of the array. For + * \c GLSL_TYPE_STRUCT, it is the number of elements in the structure and + * the number of values pointed to by \c fields.structure (below). + * + * For \c GLSL_TYPE_FUNCTION, it is the number of parameters to the + * function. The return value from a function is implicitly the first + * parameter. The types of the parameters are stored in + * \c fields.parameters (below). + */ + unsigned length; + + /** + * Subtype of composite data types. + */ + union { + const struct glsl_type *array; /**< Type of array elements. */ + const struct glsl_type *parameters; /**< Parameters to function. */ + const struct glsl_struct_field *structure;/**< List of struct fields. */ + } fields; + + + /** + * \name Pointers to various public type singletons + */ + /*@{*/ + static const glsl_type *const error_type; + static const glsl_type *const int_type; + static const glsl_type *const ivec4_type; + static const glsl_type *const uint_type; + static const glsl_type *const uvec4_type; + static const glsl_type *const float_type; + static const glsl_type *const vec2_type; + static const glsl_type *const vec3_type; + static const glsl_type *const vec4_type; + static const glsl_type *const bool_type; + static const glsl_type *const mat2_type; + static const glsl_type *const mat2x3_type; + static const glsl_type *const mat2x4_type; + static const glsl_type *const mat3x2_type; + static const glsl_type *const mat3_type; + static const glsl_type *const mat3x4_type; + static const glsl_type *const mat4x2_type; + static const glsl_type *const mat4x3_type; + static const glsl_type *const mat4_type; + /*@}*/ + + + glsl_type(unsigned base_type, unsigned vector_elements, + unsigned matrix_columns, const char *name) : + base_type(base_type), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(vector_elements), matrix_columns(matrix_columns), + name(name), + length(0) + { + /* Neither dimension is zero or both dimensions are zero. + */ + assert((vector_elements == 0) == (matrix_columns == 0)); + memset(& fields, 0, sizeof(fields)); + } + + glsl_type(enum glsl_sampler_dim dim, bool shadow, bool array, + unsigned type, const char *name) : + base_type(GLSL_TYPE_SAMPLER), + sampler_dimensionality(dim), sampler_shadow(shadow), + sampler_array(array), sampler_type(type), + vector_elements(0), matrix_columns(0), + name(name), + length(0) + { + memset(& fields, 0, sizeof(fields)); + } + + glsl_type(const glsl_struct_field *fields, unsigned num_fields, + const char *name) : + base_type(GLSL_TYPE_STRUCT), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(0), matrix_columns(0), + name(name), + length(num_fields) + { + this->fields.structure = fields; + } + + /** + * For numeric and boolean derrived types returns the basic scalar type + * + * If the type is a numeric or boolean scalar, vector, or matrix type, + * this function gets the scalar type of the individual components. For + * all other types, including arrays of numeric or boolean types, the + * error type is returned. + */ + const glsl_type *get_base_type() const; + + /** + * Query the type of elements in an array + * + * \return + * Pointer to the type of elements in the array for array types, or \c NULL + * for non-array types. + */ + const glsl_type *element_type() const + { + return is_array() ? fields.array : NULL; + } + + /** + * Get the instance of a built-in scalar, vector, or matrix type + */ + static const glsl_type *get_instance(unsigned base_type, unsigned rows, + unsigned columns); + + /** + * Get the instance of an array type + */ + static const glsl_type *get_array_instance(void *ctx, + const glsl_type *base, + unsigned elements); + + /** + * Generate the constructor for this type and add it to the symbol table + */ + class ir_function *generate_constructor(class glsl_symbol_table *) const; + + /** + * Query the total number of scalars that make up a scalar, vector or matrix + */ + unsigned components() const + { + return vector_elements * matrix_columns; + } + + /** + * Calculate the number of components slots required to hold this type + * + * This is used to determine how many uniform or varying locations a type + * might occupy. + */ + unsigned component_slots() const; + + + /** + * Query whether or not a type is a scalar (non-vector and non-matrix). + */ + bool is_scalar() const + { + return (vector_elements == 1) + && (base_type >= GLSL_TYPE_UINT) + && (base_type <= GLSL_TYPE_BOOL); + } + + /** + * Query whether or not a type is a vector + */ + bool is_vector() const + { + return (vector_elements > 1) + && (matrix_columns == 1) + && (base_type >= GLSL_TYPE_UINT) + && (base_type <= GLSL_TYPE_BOOL); + } + + /** + * Query whether or not a type is a matrix + */ + bool is_matrix() const + { + /* GLSL only has float matrices. */ + return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT); + } + + /** + * Query whether or not a type is a non-array numeric type + */ + bool is_numeric() const + { + return (base_type >= GLSL_TYPE_UINT) && (base_type <= GLSL_TYPE_FLOAT); + } + + /** + * Query whether or not a type is an integral type + */ + bool is_integer() const + { + return (base_type == GLSL_TYPE_UINT) || (base_type == GLSL_TYPE_INT); + } + + /** + * Query whether or not a type is a float type + */ + bool is_float() const + { + return base_type == GLSL_TYPE_FLOAT; + } + + /** + * Query whether or not a type is a non-array boolean type + */ + bool is_boolean() const + { + return base_type == GLSL_TYPE_BOOL; + } + + /** + * Query whether or not a type is a sampler + */ + bool is_sampler() const + { + return base_type == GLSL_TYPE_SAMPLER; + } + + /** + * Query whether or not a type is an array + */ + bool is_array() const + { + return base_type == GLSL_TYPE_ARRAY; + } + + /** + * Query whether or not a type is a record + */ + bool is_record() const + { + return base_type == GLSL_TYPE_STRUCT; + } + + /** + * Query whether or not a type is the void type singleton. + */ + bool is_void() const + { + return base_type == GLSL_TYPE_VOID; + } + + /** + * Query whether or not a type is the error type singleton. + */ + bool is_error() const + { + return base_type == GLSL_TYPE_ERROR; + } + + /** + * Query the full type of a matrix row + * + * \return + * If the type is not a matrix, \c glsl_type::error_type is returned. + * Otherwise a type matching the rows of the matrix is returned. + */ + const glsl_type *row_type() const + { + return is_matrix() + ? get_instance(base_type, matrix_columns, 1) + : error_type; + } + + /** + * Query the full type of a matrix column + * + * \return + * If the type is not a matrix, \c glsl_type::error_type is returned. + * Otherwise a type matching the columns of the matrix is returned. + */ + const glsl_type *column_type() const + { + return is_matrix() + ? get_instance(base_type, vector_elements, 1) + : error_type; + } + + + /** + * Get the type of a structure field + * + * \return + * Pointer to the type of the named field. If the type is not a structure + * or the named field does not exist, \c glsl_type::error_type is returned. + */ + const glsl_type *field_type(const char *name) const; + + + /** + * Get the location of a filed within a record type + */ + int field_index(const char *name) const; + + + /** + * Query the number of elements in an array type + * + * \return + * The number of elements in the array for array types or -1 for non-array + * types. If the number of elements in the array has not yet been declared, + * zero is returned. + */ + int array_size() const + { + return is_array() ? length : -1; + } + +private: + /** + * Constructor for array types + */ + glsl_type(void *ctx, const glsl_type *array, unsigned length); + + /** Hash table containing the known array types. */ + static struct hash_table *array_types; + + static int array_key_compare(const void *a, const void *b); + static unsigned array_key_hash(const void *key); +}; + +struct glsl_struct_field { + const struct glsl_type *type; + const char *name; +}; + +struct _mesa_glsl_parse_state; + +#ifdef __cplusplus +extern "C" { +#endif + +extern void +_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); + +extern void +_mesa_glsl_initialize_constructors(struct exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +#ifdef __cplusplus +} +#endif + +#endif /* GLSL_TYPES_H */ diff --git a/src/glsl/hash_table.c b/src/glsl/hash_table.c new file mode 100644 index 0000000000..e89a2564d7 --- /dev/null +++ b/src/glsl/hash_table.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2008 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 hash_table.c + * \brief Implementation of a generic, opaque hash table data type. + * + * \author Ian Romanick + */ + +#include "main/imports.h" +#include "main/simple_list.h" +#include "hash_table.h" + +struct node { + struct node *next; + struct node *prev; +}; + +struct hash_table { + hash_func_t hash; + hash_compare_func_t compare; + + unsigned num_buckets; + struct node buckets[1]; +}; + + +struct hash_node { + struct node link; + const void *key; + void *data; +}; + + +struct hash_table * +hash_table_ctor(unsigned num_buckets, hash_func_t hash, + hash_compare_func_t compare) +{ + struct hash_table *ht; + unsigned i; + + + if (num_buckets < 16) { + num_buckets = 16; + } + + ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) + * sizeof(ht->buckets[0]))); + if (ht != NULL) { + ht->hash = hash; + ht->compare = compare; + ht->num_buckets = num_buckets; + + for (i = 0; i < num_buckets; i++) { + make_empty_list(& ht->buckets[i]); + } + } + + return ht; +} + + +void +hash_table_dtor(struct hash_table *ht) +{ + hash_table_clear(ht); + _mesa_free(ht); +} + + +void +hash_table_clear(struct hash_table *ht) +{ + struct node *node; + struct node *temp; + unsigned i; + + + for (i = 0; i < ht->num_buckets; i++) { + foreach_s(node, temp, & ht->buckets[i]) { + remove_from_list(node); + _mesa_free(node); + } + + assert(is_empty_list(& ht->buckets[i])); + } +} + + +void * +hash_table_find(struct hash_table *ht, const void *key) +{ + const unsigned hash_value = (*ht->hash)(key); + const unsigned bucket = hash_value % ht->num_buckets; + struct node *node; + + foreach(node, & ht->buckets[bucket]) { + struct hash_node *hn = (struct hash_node *) node; + + if ((*ht->compare)(hn->key, key) == 0) { + return hn->data; + } + } + + return NULL; +} + + +void +hash_table_insert(struct hash_table *ht, void *data, const void *key) +{ + const unsigned hash_value = (*ht->hash)(key); + const unsigned bucket = hash_value % ht->num_buckets; + struct hash_node *node; + + node = _mesa_calloc(sizeof(*node)); + + node->data = data; + node->key = key; + + insert_at_head(& ht->buckets[bucket], & node->link); +} + + +unsigned +hash_table_string_hash(const void *key) +{ + const char *str = (const char *) key; + unsigned hash = 5381; + + + while (*str != '\0') { + hash = (hash * 33) + *str; + str++; + } + + return hash; +} diff --git a/src/glsl/hash_table.h b/src/glsl/hash_table.h new file mode 100644 index 0000000000..b9dd343dee --- /dev/null +++ b/src/glsl/hash_table.h @@ -0,0 +1,125 @@ +/* + * Copyright © 2008 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 hash_table.h + * \brief Implementation of a generic, opaque hash table data type. + * + * \author Ian Romanick + */ + +#ifndef HASH_TABLE_H +#define HASH_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct hash_table; + +typedef unsigned (*hash_func_t)(const void *key); +typedef int (*hash_compare_func_t)(const void *key1, const void *key2); + +/** + * Hash table constructor + * + * Creates a hash table with the specified number of buckets. The supplied + * \c hash and \c compare routines are used when adding elements to the table + * and when searching for elements in the table. + * + * \param num_buckets Number of buckets (bins) in the hash table. + * \param hash Function used to compute hash value of input keys. + * \param compare Function used to compare keys. + */ +extern struct hash_table *hash_table_ctor(unsigned num_buckets, + hash_func_t hash, hash_compare_func_t compare); + + +/** + * Release all memory associated with a hash table + * + * \warning + * This function cannot release memory occupied either by keys or data. + */ +extern void hash_table_dtor(struct hash_table *ht); + + +/** + * Flush all entries from a hash table + * + * \param ht Table to be cleared of its entries. + */ +extern void hash_table_clear(struct hash_table *ht); + + +/** + * Search a hash table for a specific element + * + * \param ht Table to be searched + * \param key Key of the desired element + * + * \return + * The \c data value supplied to \c hash_table_insert when the element with + * the matching key was added. If no matching key exists in the table, + * \c NULL is returned. + */ +extern void *hash_table_find(struct hash_table *ht, const void *key); + + +/** + * Add an element to a hash table + */ +extern void hash_table_insert(struct hash_table *ht, void *data, + const void *key); + + +/** + * Compute hash value of a string + * + * Computes the hash value of a string using the DJB2 algorithm developed by + * Professor Daniel J. Bernstein. It was published on comp.lang.c once upon + * a time. I was unable to find the original posting in the archives. + * + * \param key Pointer to a NUL terminated string to be hashed. + * + * \sa hash_table_string_compare + */ +extern unsigned hash_table_string_hash(const void *key); + + +/** + * Compare two strings used as keys + * + * This is just a macro wrapper around \c strcmp. + * + * \sa hash_table_string_hash + */ +#define hash_table_string_compare ((hash_compare_func_t) strcmp) + +#ifdef __cplusplus +}; +#endif + +#endif /* HASH_TABLE_H */ diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp new file mode 100644 index 0000000000..e2efff60d3 --- /dev/null +++ b/src/glsl/hir_field_selection.cpp @@ -0,0 +1,81 @@ +/* + * 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 "ir.h" +#include "main/imports.h" +#include "symbol_table.h" +#include "glsl_parser_extras.h" +#include "ast.h" +#include "glsl_types.h" + +struct ir_rvalue * +_mesa_ast_field_selection_to_hir(const ast_expression *expr, + exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = talloc_parent(state); + ir_rvalue *result = NULL; + ir_rvalue *op; + + op = expr->subexpressions[0]->hir(instructions, state); + + /* There are two kinds of field selection. There is the selection of a + * specific field from a structure, and there is the selection of a + * swizzle / mask from a vector. Which is which is determined entirely + * by the base type of the thing to which the field selection operator is + * being applied. + */ + YYLTYPE loc = expr->get_location(); + if (op->type->is_error()) { + /* silently propagate the error */ + } else if (op->type->is_vector()) { + ir_swizzle *swiz = ir_swizzle::create(op, + expr->primary_expression.identifier, + op->type->vector_elements); + if (swiz != NULL) { + result = swiz; + } else { + /* FINISHME: Logging of error messages should be moved into + * FINISHME: ir_swizzle::create. This allows the generation of more + * FINISHME: specific error messages. + */ + _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'", + expr->primary_expression.identifier); + } + } else if (op->type->base_type == GLSL_TYPE_STRUCT) { + result = new(ctx) ir_dereference_record(op, + expr->primary_expression.identifier); + + if (result->type->is_error()) { + _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " + "structure", + expr->primary_expression.identifier); + } + } else { + _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " + "non-structure / non-vector.", + expr->primary_expression.identifier); + } + + return result ? result : ir_call::get_error_instruction(ctx); +} diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp new file mode 100644 index 0000000000..2756752ba4 --- /dev/null +++ b/src/glsl/ir.cpp @@ -0,0 +1,818 @@ +/* + * 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 +#include "main/imports.h" +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, + ir_rvalue *condition) +{ + this->lhs = lhs; + this->rhs = rhs; + this->condition = condition; +} + + +ir_expression::ir_expression(int op, const struct glsl_type *type, + ir_rvalue *op0, ir_rvalue *op1) +{ + this->type = type; + this->operation = ir_expression_operation(op); + this->operands[0] = op0; + this->operands[1] = op1; +} + +unsigned int +ir_expression::get_num_operands(ir_expression_operation op) +{ +/* Update ir_print_visitor.cpp when updating this list. */ + const int num_operands[] = { + 1, /* ir_unop_bit_not */ + 1, /* ir_unop_logic_not */ + 1, /* ir_unop_neg */ + 1, /* ir_unop_abs */ + 1, /* ir_unop_sign */ + 1, /* ir_unop_rcp */ + 1, /* ir_unop_rsq */ + 1, /* ir_unop_sqrt */ + 1, /* ir_unop_exp */ + 1, /* ir_unop_log */ + 1, /* ir_unop_exp2 */ + 1, /* ir_unop_log2 */ + 1, /* ir_unop_f2i */ + 1, /* ir_unop_i2f */ + 1, /* ir_unop_f2b */ + 1, /* ir_unop_b2f */ + 1, /* ir_unop_i2b */ + 1, /* ir_unop_b2i */ + 1, /* ir_unop_u2f */ + + 1, /* ir_unop_trunc */ + 1, /* ir_unop_ceil */ + 1, /* ir_unop_floor */ + + 1, /* ir_unop_sin */ + 1, /* ir_unop_cos */ + + 1, /* ir_unop_dFdx */ + 1, /* ir_unop_dFdy */ + + 2, /* ir_binop_add */ + 2, /* ir_binop_sub */ + 2, /* ir_binop_mul */ + 2, /* ir_binop_div */ + 2, /* ir_binop_mod */ + + 2, /* ir_binop_less */ + 2, /* ir_binop_greater */ + 2, /* ir_binop_lequal */ + 2, /* ir_binop_gequal */ + 2, /* ir_binop_equal */ + 2, /* ir_binop_nequal */ + + 2, /* ir_binop_lshift */ + 2, /* ir_binop_rshift */ + 2, /* ir_binop_bit_and */ + 2, /* ir_binop_bit_xor */ + 2, /* ir_binop_bit_or */ + + 2, /* ir_binop_logic_and */ + 2, /* ir_binop_logic_xor */ + 2, /* ir_binop_logic_or */ + + 2, /* ir_binop_dot */ + 2, /* ir_binop_min */ + 2, /* ir_binop_max */ + + 2, /* ir_binop_pow */ + }; + + assert(sizeof(num_operands) / sizeof(num_operands[0]) == ir_binop_pow + 1); + + return num_operands[op]; +} + +static const char *const operator_strs[] = { + "~", + "!", + "neg", + "abs", + "sign", + "rcp", + "rsq", + "sqrt", + "exp", + "log", + "exp2", + "log2", + "f2i", + "i2f", + "f2b", + "b2f", + "i2b", + "b2i", + "u2f", + "trunc", + "ceil", + "floor", + "sin", + "cos", + "dFdx", + "dFdy", + "+", + "-", + "*", + "/", + "%", + "<", + ">", + "<=", + ">=", + "==", + "!=", + "<<", + ">>", + "&", + "^", + "|", + "&&", + "^^", + "||", + "dot", + "min", + "max", + "pow", +}; + +const char *ir_expression::operator_string() +{ + assert((unsigned int) operation <= + sizeof(operator_strs) / sizeof(operator_strs[0])); + return operator_strs[operation]; +} + +ir_expression_operation +ir_expression::get_operator(const char *str) +{ + const int operator_count = sizeof(operator_strs) / sizeof(operator_strs[0]); + for (int op = 0; op < operator_count; op++) { + if (strcmp(str, operator_strs[op]) == 0) + return (ir_expression_operation) op; + } + return (ir_expression_operation) -1; +} + +ir_constant::ir_constant() +{ + /* empty */ +} + +ir_constant::ir_constant(const struct glsl_type *type, + const ir_constant_data *data) +{ + assert((type->base_type >= GLSL_TYPE_UINT) + && (type->base_type <= GLSL_TYPE_BOOL)); + + this->type = type; + memcpy(& this->value, data, sizeof(this->value)); +} + +ir_constant::ir_constant(float f) +{ + this->type = glsl_type::float_type; + this->value.f[0] = f; +} + +ir_constant::ir_constant(unsigned int u) +{ + this->type = glsl_type::uint_type; + this->value.u[0] = u; +} + +ir_constant::ir_constant(int i) +{ + this->type = glsl_type::int_type; + this->value.i[0] = i; +} + +ir_constant::ir_constant(bool b) +{ + this->type = glsl_type::bool_type; + this->value.b[0] = b; +} + +ir_constant::ir_constant(const ir_constant *c, unsigned i) +{ + this->type = c->type->get_base_type(); + + switch (this->type->base_type) { + case GLSL_TYPE_UINT: this->value.u[0] = c->value.u[i]; break; + case GLSL_TYPE_INT: this->value.i[0] = c->value.i[i]; break; + case GLSL_TYPE_FLOAT: this->value.f[0] = c->value.f[i]; break; + case GLSL_TYPE_BOOL: this->value.b[0] = c->value.b[i]; break; + default: assert(!"Should not get here."); break; + } +} + +ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) +{ + this->type = type; + + /* FINISHME: Support array types. */ + assert(type->is_scalar() || type->is_vector() || type->is_matrix() + || type->is_record()); + + /* If the constant is a record, the types of each of the entries in + * value_list must be a 1-for-1 match with the structure components. Each + * entry must also be a constant. Just move the nodes from the value_list + * to the list in the ir_constant. + */ + /* FINISHME: Should there be some type checking and / or assertions here? */ + /* FINISHME: Should the new constant take ownership of the nodes from + * FINISHME: value_list, or should it make copies? + */ + if (type->is_record()) { + value_list->move_nodes_to(& this->components); + return; + } + + + ir_constant *value = (ir_constant *) (value_list->head); + + /* Use each component from each entry in the value_list to initialize one + * component of the constant being constructed. + */ + for (unsigned i = 0; i < type->components(); /* empty */) { + assert(value->as_constant() != NULL); + assert(!value->is_tail_sentinal()); + + for (unsigned j = 0; j < value->type->components(); j++) { + switch (type->base_type) { + case GLSL_TYPE_UINT: + this->value.u[i] = value->get_uint_component(j); + break; + case GLSL_TYPE_INT: + this->value.i[i] = value->get_int_component(j); + break; + case GLSL_TYPE_FLOAT: + this->value.f[i] = value->get_float_component(j); + break; + case GLSL_TYPE_BOOL: + this->value.b[i] = value->get_bool_component(j); + break; + default: + /* FINISHME: What to do? Exceptions are not the answer. + */ + break; + } + + i++; + if (i >= type->components()) + break; + } + + value = (ir_constant *) value->next; + } +} + +bool +ir_constant::get_bool_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i] != 0; + case GLSL_TYPE_INT: return this->value.i[i] != 0; + case GLSL_TYPE_FLOAT: return ((int)this->value.f[i]) != 0; + case GLSL_TYPE_BOOL: return this->value.b[i]; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return false; +} + +float +ir_constant::get_float_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return (float) this->value.u[i]; + case GLSL_TYPE_INT: return (float) this->value.i[i]; + case GLSL_TYPE_FLOAT: return this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1.0 : 0.0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0.0; +} + +int +ir_constant::get_int_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i]; + case GLSL_TYPE_INT: return this->value.i[i]; + case GLSL_TYPE_FLOAT: return (int) this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1 : 0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0; +} + +unsigned +ir_constant::get_uint_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i]; + case GLSL_TYPE_INT: return this->value.i[i]; + case GLSL_TYPE_FLOAT: return (unsigned) this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1 : 0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0; +} + + +ir_constant * +ir_constant::get_record_field(const char *name) +{ + int idx = this->type->field_index(name); + + if (idx < 0) + return NULL; + + if (this->components.is_empty()) + return NULL; + + exec_node *node = this->components.head; + for (int i = 0; i < idx; i++) { + node = node->next; + + /* If the end of the list is encountered before the element matching the + * requested field is found, return NULL. + */ + if (node->is_tail_sentinal()) + return NULL; + } + + return (ir_constant *) node; +} + + +bool +ir_constant::has_value(const ir_constant *c) const +{ + if (this->type != c->type) + return false; + + /* FINISHME: This will probably also handle constant arrays as soon as those + * FINISHME: are supported. + */ + if (this->type->base_type == GLSL_TYPE_STRUCT) { + const exec_node *a_node = this->components.head; + const exec_node *b_node = c->components.head; + + while (!a_node->is_tail_sentinal()) { + assert(!b_node->is_tail_sentinal()); + + const ir_constant *const a_field = (ir_constant *) a_node; + const ir_constant *const b_field = (ir_constant *) b_node; + + if (!a_field->has_value(b_field)) + return false; + + a_node = a_node->next; + b_node = b_node->next; + } + + return true; + } + + for (unsigned i = 0; i < this->type->components(); i++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + if (this->value.u[i] != c->value.u[i]) + return false; + break; + case GLSL_TYPE_INT: + if (this->value.i[i] != c->value.i[i]) + return false; + break; + case GLSL_TYPE_FLOAT: + if (this->value.f[i] != c->value.f[i]) + return false; + break; + case GLSL_TYPE_BOOL: + if (this->value.b[i] != c->value.b[i]) + return false; + break; + default: + assert(!"Should not get here."); + return false; + } + } + + return true; +} + +ir_dereference_variable::ir_dereference_variable(ir_variable *var) +{ + this->var = var; + this->type = (var != NULL) ? var->type : glsl_type::error_type; +} + + +ir_dereference_array::ir_dereference_array(ir_rvalue *value, + ir_rvalue *array_index) +{ + this->array_index = array_index; + this->set_array(value); +} + + +ir_dereference_array::ir_dereference_array(ir_variable *var, + ir_rvalue *array_index) +{ + void *ctx = talloc_parent(var); + + this->array_index = array_index; + this->set_array(new(ctx) ir_dereference_variable(var)); +} + + +void +ir_dereference_array::set_array(ir_rvalue *value) +{ + this->array = value; + this->type = glsl_type::error_type; + + if (this->array != NULL) { + const glsl_type *const vt = this->array->type; + + if (vt->is_array()) { + type = vt->element_type(); + } else if (vt->is_matrix()) { + type = vt->column_type(); + } else if (vt->is_vector()) { + type = vt->get_base_type(); + } + } +} + + +ir_dereference_record::ir_dereference_record(ir_rvalue *value, + const char *field) +{ + this->record = value; + this->field = field; + this->type = (this->record != NULL) + ? this->record->type->field_type(field) : glsl_type::error_type; +} + + +ir_dereference_record::ir_dereference_record(ir_variable *var, + const char *field) +{ + void *ctx = talloc_parent(var); + + this->record = new(ctx) ir_dereference_variable(var); + this->field = field; + this->type = (this->record != NULL) + ? this->record->type->field_type(field) : glsl_type::error_type; +} + + +bool +ir_dereference::is_lvalue() +{ + ir_variable *var = this->variable_referenced(); + + /* Every l-value derference chain eventually ends in a variable. + */ + if ((var == NULL) || var->read_only) + return false; + + if (this->type->is_array() && !var->array_lvalue) + return false; + + return true; +} + + +const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf" }; + +const char *ir_texture::opcode_string() +{ + assert((unsigned int) op <= + sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0])); + return tex_opcode_strs[op]; +} + +ir_texture_opcode +ir_texture::get_opcode(const char *str) +{ + const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]); + for (int op = 0; op < count; op++) { + if (strcmp(str, tex_opcode_strs[op]) == 0) + return (ir_texture_opcode) op; + } + return (ir_texture_opcode) -1; +} + + +void +ir_texture::set_sampler(ir_dereference *sampler) +{ + assert(sampler != NULL); + this->sampler = sampler; + + switch (sampler->type->sampler_type) { + case GLSL_TYPE_FLOAT: + this->type = glsl_type::vec4_type; + break; + case GLSL_TYPE_INT: + this->type = glsl_type::ivec4_type; + break; + case GLSL_TYPE_UINT: + this->type = glsl_type::uvec4_type; + break; + } +} + + +ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, + unsigned w, unsigned count) + : val(val) +{ + assert((count >= 1) && (count <= 4)); + + const unsigned dup_mask = 0 + | ((count > 1) ? ((1U << y) & ((1U << x) )) : 0) + | ((count > 2) ? ((1U << z) & ((1U << x) | (1U << y) )) : 0) + | ((count > 3) ? ((1U << w) & ((1U << x) | (1U << y) | (1U << z))) : 0); + + assert(x <= 3); + assert(y <= 3); + assert(z <= 3); + assert(w <= 3); + + mask.x = x; + mask.y = y; + mask.z = z; + mask.w = w; + mask.num_components = count; + mask.has_duplicates = dup_mask != 0; + + /* Based on the number of elements in the swizzle and the base type + * (i.e., float, int, unsigned, or bool) of the vector being swizzled, + * generate the type of the resulting value. + */ + type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1); +} + +ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) +{ + this->val = val; + this->mask = mask; + this->type = glsl_type::get_instance(val->type->base_type, + mask.num_components, 1); +} + +#define X 1 +#define R 5 +#define S 9 +#define I 13 + +ir_swizzle * +ir_swizzle::create(ir_rvalue *val, const char *str, unsigned vector_length) +{ + void *ctx = talloc_parent(val); + + /* For each possible swizzle character, this table encodes the value in + * \c idx_map that represents the 0th element of the vector. For invalid + * swizzle characters (e.g., 'k'), a special value is used that will allow + * detection of errors. + */ + static const unsigned char base_idx[26] = { + /* a b c d e f g h i j k l m */ + R, R, I, I, I, I, R, I, I, I, I, I, I, + /* n o p q r s t u v w x y z */ + I, I, S, S, R, S, S, I, I, X, X, X, X + }; + + /* Each valid swizzle character has an entry in the previous table. This + * table encodes the base index encoded in the previous table plus the actual + * index of the swizzle character. When processing swizzles, the first + * character in the string is indexed in the previous table. Each character + * in the string is indexed in this table, and the value found there has the + * value form the first table subtracted. The result must be on the range + * [0,3]. + * + * For example, the string "wzyx" will get X from the first table. Each of + * the charcaters will get X+3, X+2, X+1, and X+0 from this table. After + * subtraction, the swizzle values are { 3, 2, 1, 0 }. + * + * The string "wzrg" will get X from the first table. Each of the characters + * will get X+3, X+2, R+0, and R+1 from this table. After subtraction, the + * swizzle values are { 3, 2, 4, 5 }. Since 4 and 5 are outside the range + * [0,3], the error is detected. + */ + static const unsigned char idx_map[26] = { + /* a b c d e f g h i j k l m */ + R+3, R+2, 0, 0, 0, 0, R+1, 0, 0, 0, 0, 0, 0, + /* n o p q r s t u v w x y z */ + 0, 0, S+2, S+3, R+0, S+0, S+1, 0, 0, X+3, X+0, X+1, X+2 + }; + + int swiz_idx[4] = { 0, 0, 0, 0 }; + unsigned i; + + + /* Validate the first character in the swizzle string and look up the base + * index value as described above. + */ + if ((str[0] < 'a') || (str[0] > 'z')) + return NULL; + + const unsigned base = base_idx[str[0] - 'a']; + + + for (i = 0; (i < 4) && (str[i] != '\0'); i++) { + /* Validate the next character, and, as described above, convert it to a + * swizzle index. + */ + if ((str[i] < 'a') || (str[i] > 'z')) + return NULL; + + swiz_idx[i] = idx_map[str[i] - 'a'] - base; + if ((swiz_idx[i] < 0) || (swiz_idx[i] >= (int) vector_length)) + return NULL; + } + + if (str[i] != '\0') + return NULL; + + return new(ctx) ir_swizzle(val, swiz_idx[0], swiz_idx[1], swiz_idx[2], + swiz_idx[3], i); +} + +#undef X +#undef R +#undef S +#undef I + +ir_variable * +ir_swizzle::variable_referenced() +{ + return this->val->variable_referenced(); +} + +ir_variable::ir_variable(const struct glsl_type *type, const char *name) + : max_array_access(0), read_only(false), centroid(false), invariant(false), + shader_in(false), shader_out(false), + mode(ir_var_auto), interpolation(ir_var_smooth), array_lvalue(false) +{ + this->type = type; + this->name = name; + this->location = -1; + this->warn_extension = NULL; + this->constant_value = NULL; + + if (type && type->base_type == GLSL_TYPE_SAMPLER) + this->read_only = true; +} + + +const char * +ir_variable::interpolation_string() const +{ + if (!this->shader_in && !this->shader_out) + return ""; + + switch (this->interpolation) { + case ir_var_smooth: return "smooth"; + case ir_var_flat: return "flat"; + case ir_var_noperspective: return "noperspective"; + } + + assert(!"Should not get here."); + return ""; +} + + +unsigned +ir_variable::component_slots() const +{ + /* FINISHME: Sparsely accessed arrays require fewer slots. */ + return this->type->component_slots(); +} + + +ir_function_signature::ir_function_signature(const glsl_type *return_type) + : return_type(return_type), is_defined(false) +{ + /* empty */ +} + + +const char * +ir_function_signature::qualifiers_match(exec_list *params) +{ + exec_list_iterator iter_a = parameters.iterator(); + exec_list_iterator iter_b = params->iterator(); + + /* check that the qualifiers match. */ + while (iter_a.has_next()) { + ir_variable *a = (ir_variable *)iter_a.get(); + ir_variable *b = (ir_variable *)iter_b.get(); + + if (a->read_only != b->read_only || + a->mode != b->mode || + a->interpolation != b->interpolation || + a->centroid != b->centroid) { + + /* parameter a's qualifiers don't match */ + return a->name; + } + + iter_a.next(); + iter_b.next(); + } + return NULL; +} + + +void +ir_function_signature::replace_parameters(exec_list *new_params) +{ + /* Destroy all of the previous parameter information. If the previous + * parameter information comes from the function prototype, it may either + * specify incorrect parameter names or not have names at all. + */ + foreach_iter(exec_list_iterator, iter, parameters) { + assert(((ir_instruction *) iter.get())->as_variable() != NULL); + + iter.remove(); + } + + new_params->move_nodes_to(¶meters); +} + + +ir_function::ir_function(const char *name) + : name(name) +{ + /* empty */ +} + + +ir_call * +ir_call::get_error_instruction(void *ctx) +{ + ir_call *call = new(ctx) ir_call; + + call->type = glsl_type::error_type; + return call; +} + +void +visit_exec_list(exec_list *list, ir_visitor *visitor) +{ + foreach_iter(exec_list_iterator, iter, *list) { + ((ir_instruction *)iter.get())->accept(visitor); + } +} + diff --git a/src/glsl/ir.h b/src/glsl/ir.h new file mode 100644 index 0000000000..3d2c7ff5cf --- /dev/null +++ b/src/glsl/ir.h @@ -0,0 +1,1178 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef IR_H +#define IR_H + +#include +#include + +extern "C" { +#include +} + +#include "list.h" +#include "ir_visitor.h" +#include "ir_hierarchical_visitor.h" + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + +struct ir_program { + void *bong_hits; +}; + +/** + * Base class of all IR instructions + */ +class ir_instruction : public exec_node { +public: + const struct glsl_type *type; + + class ir_constant *constant_expression_value(); + + /** ir_print_visitor helper for debugging. */ + void print(void) const; + + virtual void accept(ir_visitor *) = 0; + virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0; + virtual ir_instruction *clone(struct hash_table *ht) const = 0; + + /** + * \name IR instruction downcast functions + * + * These functions either cast the object to a derived class or return + * \c NULL if the object's type does not match the specified derived class. + * Additional downcast functions will be added as needed. + */ + /*@{*/ + virtual class ir_variable * as_variable() { return NULL; } + virtual class ir_function * as_function() { return NULL; } + virtual class ir_dereference * as_dereference() { return NULL; } + virtual class ir_dereference_array * as_dereference_array() { return NULL; } + virtual class ir_rvalue * as_rvalue() { return NULL; } + virtual class ir_loop * as_loop() { return NULL; } + virtual class ir_assignment * as_assignment() { return NULL; } + virtual class ir_call * as_call() { return NULL; } + virtual class ir_return * as_return() { return NULL; } + virtual class ir_if * as_if() { return NULL; } + virtual class ir_swizzle * as_swizzle() { return NULL; } + virtual class ir_constant * as_constant() { return NULL; } + /*@}*/ + +protected: + ir_instruction() + { + /* empty */ + } +}; + + +class ir_rvalue : public ir_instruction { +public: + virtual ir_rvalue * as_rvalue() + { + return this; + } + + virtual bool is_lvalue() + { + return false; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return NULL; + } + + + /** + * If an r-value is a reference to a whole variable, get that variable + * + * \return + * Pointer to a variable that is completely dereferenced by the r-value. If + * the r-value is not a dereference or the dereference does not access the + * entire variable (i.e., it's just one array element, struct field), \c NULL + * is returned. + */ + virtual ir_variable *whole_variable_referenced() + { + return NULL; + } + +protected: + ir_rvalue() + { + /* empty */ + } +}; + + +enum ir_variable_mode { + ir_var_auto = 0, + ir_var_uniform, + ir_var_in, + ir_var_out, + ir_var_inout +}; + +enum ir_variable_interpolation { + ir_var_smooth = 0, + ir_var_flat, + ir_var_noperspective +}; + + +class ir_variable : public ir_instruction { +public: + ir_variable(const struct glsl_type *, const char *); + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual ir_variable *as_variable() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + + /** + * Get the string value for the interpolation qualifier + * + * \return + * If none of \c shader_in or \c shader_out is set, an empty string will + * be returned. Otherwise the string that would be used in a shader to + * specify \c mode will be returned. + */ + const char *interpolation_string() const; + + /** + * Calculate the number of slots required to hold this variable + * + * This is used to determine how many uniform or varying locations a variable + * occupies. The count is in units of floating point components. + */ + unsigned component_slots() const; + + const char *name; + + /** + * Highest element accessed with a constant expression array index + * + * Not used for non-array variables. + */ + unsigned max_array_access; + + unsigned read_only:1; + unsigned centroid:1; + unsigned invariant:1; + /** If the variable is initialized outside of the scope of the shader */ + unsigned shader_in:1; + /** + * If the variable value is later used outside of the scope of the shader. + */ + unsigned shader_out:1; + + unsigned mode:3; + unsigned interpolation:2; + + /** + * Flag that the whole array is assignable + * + * In GLSL 1.20 and later whole arrays are assignable (and comparable for + * equality). This flag enables this behavior. + */ + unsigned array_lvalue:1; + + /** + * Storage location of the base of this variable + * + * The precise meaning of this field depends on the nature of the variable. + * + * - Vertex shader input: one of the values from \c gl_vert_attrib. + * - Vertex shader output: one of the values from \c gl_vert_result. + * - Fragment shader input: one of the values from \c gl_frag_attrib. + * - Fragment shader output: one of the values from \c gl_frag_result. + * - Uniforms: Per-stage uniform slot number. + * - Other: This field is not currently used. + * + * If the variable is a uniform, shader input, or shader output, and the + * slot has not been assigned, the value will be -1. + */ + int location; + + /** + * Emit a warning if this variable is accessed. + */ + const char *warn_extension; + + /** + * Value assigned in the initializer of a variable declared "const" + */ + ir_constant *constant_value; +}; + + +/*@{*/ +/** + * The representation of a function instance; may be the full definition or + * simply a prototype. + */ +class ir_function_signature : public ir_instruction { + /* An ir_function_signature will be part of the list of signatures in + * an ir_function. + */ +public: + ir_function_signature(const glsl_type *return_type); + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get the name of the function for which this is a signature + */ + const char *function_name() const; + + /** + * Check whether the qualifiers match between this signature's parameters + * and the supplied parameter list. If not, returns the name of the first + * parameter with mismatched qualifiers (for use in error messages). + */ + const char *qualifiers_match(exec_list *params); + + /** + * Replace the current parameter list with the given one. This is useful + * if the current information came from a prototype, and either has invalid + * or missing parameter names. + */ + void replace_parameters(exec_list *new_params); + + /** + * Function return type. + * + * \note This discards the optional precision qualifier. + */ + const struct glsl_type *return_type; + + /** + * List of ir_variable of function parameters. + * + * This represents the storage. The paramaters passed in a particular + * call will be in ir_call::actual_paramaters. + */ + struct exec_list parameters; + + /** Whether or not this function has a body (which may be empty). */ + unsigned is_defined:1; + + /** Body of instructions in the function. */ + struct exec_list body; + +private: + /** Function of which this signature is one overload. */ + class ir_function *function; + + friend class ir_function; +}; + + +/** + * Header for tracking multiple overloaded functions with the same name. + * Contains a list of ir_function_signatures representing each of the + * actual functions. + */ +class ir_function : public ir_instruction { +public: + ir_function(const char *name); + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual ir_function *as_function() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + void add_signature(ir_function_signature *sig) + { + sig->function = this; + signatures.push_tail(sig); + } + + /** + * Get an iterator for the set of function signatures + */ + exec_list_iterator iterator() + { + return signatures.iterator(); + } + + /** + * Find a signature that matches a set of actual parameters, taking implicit + * conversions into account. + */ + const ir_function_signature *matching_signature(exec_list *actual_param); + + /** + * Find a signature that exactly matches a set of actual parameters without + * any implicit type conversions. + */ + ir_function_signature *exact_matching_signature(exec_list *actual_ps); + + /** + * Name of the function. + */ + const char *name; + +private: + /** + * List of ir_function_signature for each overloaded function with this name. + */ + struct exec_list signatures; +}; + +inline const char *ir_function_signature::function_name() const +{ + return function->name; +} +/*@}*/ + + +/** + * IR instruction representing high-level if-statements + */ +class ir_if : public ir_instruction { +public: + ir_if(ir_rvalue *condition) + : condition(condition) + { + /* empty */ + } + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual ir_if *as_if() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *condition; + /** List of ir_instruction for the body of the then branch */ + exec_list then_instructions; + /** List of ir_instruction for the body of the else branch */ + exec_list else_instructions; +}; + + +/** + * IR instruction representing a high-level loop structure. + */ +class ir_loop : public ir_instruction { +public: + ir_loop() : from(NULL), to(NULL), increment(NULL), counter(NULL) + { + /* empty */ + } + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + virtual ir_loop *as_loop() + { + return this; + } + + /** + * Get an iterator for the instructions of the loop body + */ + exec_list_iterator iterator() + { + return body_instructions.iterator(); + } + + /** List of ir_instruction that make up the body of the loop. */ + exec_list body_instructions; + + /** + * \name Loop counter and controls + */ + /*@{*/ + ir_rvalue *from; + ir_rvalue *to; + ir_rvalue *increment; + ir_variable *counter; + /*@}*/ +}; + + +class ir_assignment : public ir_rvalue { +public: + ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + virtual ir_assignment * as_assignment() + { + return this; + } + + /** + * Left-hand side of the assignment. + */ + ir_rvalue *lhs; + + /** + * Value being assigned + */ + ir_rvalue *rhs; + + /** + * Optional condition for the assignment. + */ + ir_rvalue *condition; +}; + +/* Update ir_expression::num_operands() and operator_strs when + * updating this list. + */ +enum ir_expression_operation { + ir_unop_bit_not, + ir_unop_logic_not, + ir_unop_neg, + ir_unop_abs, + ir_unop_sign, + ir_unop_rcp, + ir_unop_rsq, + ir_unop_sqrt, + ir_unop_exp, + ir_unop_log, + ir_unop_exp2, + ir_unop_log2, + ir_unop_f2i, /**< Float-to-integer conversion. */ + ir_unop_i2f, /**< Integer-to-float conversion. */ + ir_unop_f2b, /**< Float-to-boolean conversion */ + ir_unop_b2f, /**< Boolean-to-float conversion */ + ir_unop_i2b, /**< int-to-boolean conversion */ + ir_unop_b2i, /**< Boolean-to-int conversion */ + ir_unop_u2f, /**< Unsigned-to-float conversion. */ + + /** + * \name Unary floating-point rounding operations. + */ + /*@{*/ + ir_unop_trunc, + ir_unop_ceil, + ir_unop_floor, + /*@}*/ + + /** + * \name Trigonometric operations. + */ + /*@{*/ + ir_unop_sin, + ir_unop_cos, + /*@}*/ + + /** + * \name Partial derivatives. + */ + /*@{*/ + ir_unop_dFdx, + ir_unop_dFdy, + /*@}*/ + + ir_binop_add, + ir_binop_sub, + ir_binop_mul, + ir_binop_div, + ir_binop_mod, + + /** + * \name Binary comparison operators + */ + /*@{*/ + ir_binop_less, + ir_binop_greater, + ir_binop_lequal, + ir_binop_gequal, + ir_binop_equal, + ir_binop_nequal, + /*@}*/ + + /** + * \name Bit-wise binary operations. + */ + /*@{*/ + ir_binop_lshift, + ir_binop_rshift, + ir_binop_bit_and, + ir_binop_bit_xor, + ir_binop_bit_or, + /*@}*/ + + ir_binop_logic_and, + ir_binop_logic_xor, + ir_binop_logic_or, + + ir_binop_dot, + ir_binop_min, + ir_binop_max, + + ir_binop_pow +}; + +class ir_expression : public ir_rvalue { +public: + ir_expression(int op, const struct glsl_type *type, + ir_rvalue *, ir_rvalue *); + + virtual ir_instruction *clone(struct hash_table *ht) const; + + static unsigned int get_num_operands(ir_expression_operation); + unsigned int get_num_operands() const + { + return get_num_operands(operation); + } + + /** + * Return a string representing this expression's operator. + */ + const char *operator_string(); + + /** + * Do a reverse-lookup to translate the given string into an operator. + */ + static ir_expression_operation get_operator(const char *); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_expression_operation operation; + ir_rvalue *operands[2]; +}; + + +/** + * IR instruction representing a function call + */ +class ir_call : public ir_rvalue { +public: + ir_call(const ir_function_signature *callee, exec_list *actual_parameters) + : callee(callee) + { + assert(callee->return_type != NULL); + type = callee->return_type; + actual_parameters->move_nodes_to(& this->actual_parameters); + } + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual ir_call *as_call() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get a generic ir_call object when an error occurs + * + * Any allocation will be performed with 'ctx' as talloc owner. + */ + static ir_call *get_error_instruction(void *ctx); + + /** + * Get an iterator for the set of acutal parameters + */ + exec_list_iterator iterator() + { + return actual_parameters.iterator(); + } + + /** + * Get the name of the function being called. + */ + const char *callee_name() const + { + return callee->function_name(); + } + + const ir_function_signature *get_callee() + { + return callee; + } + + /** + * Generates an inline version of the function before @ir, + * returning the return value of the function. + */ + ir_rvalue *generate_inline(ir_instruction *ir); + +private: + ir_call() + : callee(NULL) + { + /* empty */ + } + + const ir_function_signature *callee; + + /* List of ir_rvalue of paramaters passed in this call. */ + exec_list actual_parameters; +}; + + +/** + * \name Jump-like IR instructions. + * + * These include \c break, \c continue, \c return, and \c discard. + */ +/*@{*/ +class ir_jump : public ir_instruction { +protected: + ir_jump() + { + /* empty */ + } +}; + +class ir_return : public ir_jump { +public: + ir_return() + : value(NULL) + { + /* empty */ + } + + ir_return(ir_rvalue *value) + : value(value) + { + /* empty */ + } + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual ir_return *as_return() + { + return this; + } + + ir_rvalue *get_value() const + { + return value; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *value; +}; + + +/** + * Jump instructions used inside loops + * + * These include \c break and \c continue. The \c break within a loop is + * different from the \c break within a switch-statement. + * + * \sa ir_switch_jump + */ +class ir_loop_jump : public ir_jump { +public: + enum jump_mode { + jump_break, + jump_continue + }; + + ir_loop_jump(jump_mode mode) + { + this->mode = mode; + this->loop = loop; + } + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + bool is_break() const + { + return mode == jump_break; + } + + bool is_continue() const + { + return mode == jump_continue; + } + + /** Mode selector for the jump instruction. */ + enum jump_mode mode; +private: + /** Loop containing this break instruction. */ + ir_loop *loop; +}; +/*@}*/ + + +/** + * Texture sampling opcodes used in ir_texture + */ +enum ir_texture_opcode { + ir_tex, /* Regular texture look-up */ + ir_txb, /* Texture look-up with LOD bias */ + ir_txl, /* Texture look-up with explicit LOD */ + ir_txd, /* Texture look-up with partial derivatvies */ + ir_txf /* Texel fetch with explicit LOD */ +}; + + +/** + * IR instruction to sample a texture + * + * The specific form of the IR instruction depends on the \c mode value + * selected from \c ir_texture_opcodes. In the printed IR, these will + * appear as: + * + * Texel offset + * | Projection divisor + * | | Shadow comparitor + * | | | + * v v v + * (tex (sampler) (coordinate) (0 0 0) (1) ( )) + * (txb (sampler) (coordinate) (0 0 0) (1) ( ) (bias)) + * (txl (sampler) (coordinate) (0 0 0) (1) ( ) (lod)) + * (txd (sampler) (coordinate) (0 0 0) (1) ( ) (dPdx dPdy)) + * (txf (sampler) (coordinate) (0 0 0) (lod)) + */ +class ir_texture : public ir_rvalue { +public: + ir_texture(enum ir_texture_opcode op) + : op(op), projector(NULL), shadow_comparitor(NULL) + { + /* empty */ + } + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Return a string representing the ir_texture_opcode. + */ + const char *opcode_string(); + + /** Set the sampler and infer the type. */ + void set_sampler(ir_dereference *sampler); + + /** + * Do a reverse-lookup to translate a string into an ir_texture_opcode. + */ + static ir_texture_opcode get_opcode(const char *); + + enum ir_texture_opcode op; + + /** Sampler to use for the texture access. */ + ir_dereference *sampler; + + /** Texture coordinate to sample */ + ir_rvalue *coordinate; + + /** + * Value used for projective divide. + * + * If there is no projective divide (the common case), this will be + * \c NULL. Optimization passes should check for this to point to a constant + * of 1.0 and replace that with \c NULL. + */ + ir_rvalue *projector; + + /** + * Coordinate used for comparison on shadow look-ups. + * + * If there is no shadow comparison, this will be \c NULL. For the + * \c ir_txf opcode, this *must* be \c NULL. + */ + ir_rvalue *shadow_comparitor; + + /** Explicit texel offsets. */ + signed char offsets[3]; + + union { + ir_rvalue *lod; /**< Floating point LOD */ + ir_rvalue *bias; /**< Floating point LOD bias */ + struct { + ir_rvalue *dPdx; /**< Partial derivative of coordinate wrt X */ + ir_rvalue *dPdy; /**< Partial derivative of coordinate wrt Y */ + } grad; + } lod_info; +}; + + +struct ir_swizzle_mask { + unsigned x:2; + unsigned y:2; + unsigned z:2; + unsigned w:2; + + /** + * Number of components in the swizzle. + */ + unsigned num_components:3; + + /** + * Does the swizzle contain duplicate components? + * + * L-value swizzles cannot contain duplicate components. + */ + unsigned has_duplicates:1; +}; + + +class ir_swizzle : public ir_rvalue { +public: + ir_swizzle(ir_rvalue *, unsigned x, unsigned y, unsigned z, unsigned w, + unsigned count); + ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask); + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual ir_swizzle *as_swizzle() + { + return this; + } + + /** + * Construct an ir_swizzle from the textual representation. Can fail. + */ + static ir_swizzle *create(ir_rvalue *, const char *, unsigned vector_length); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + bool is_lvalue() + { + return val->is_lvalue() && !mask.has_duplicates; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced(); + + ir_rvalue *val; + ir_swizzle_mask mask; +}; + + +class ir_dereference : public ir_rvalue { +public: + virtual ir_dereference *as_dereference() + { + return this; + } + + bool is_lvalue(); + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() = 0; +}; + + +class ir_dereference_variable : public ir_dereference { +public: + ir_dereference_variable(ir_variable *var); + + virtual ir_instruction *clone(struct hash_table *) const; + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->var; + } + + virtual ir_variable *whole_variable_referenced() + { + /* ir_dereference_variable objects always dereference the entire + * variable. However, if this dereference is dereferenced by anything + * else, the complete deferefernce chain is not a whole-variable + * dereference. This method should only be called on the top most + * ir_rvalue in a dereference chain. + */ + return this->var; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Object being dereferenced. + */ + ir_variable *var; +}; + + +class ir_dereference_array : public ir_dereference { +public: + ir_dereference_array(ir_rvalue *value, ir_rvalue *array_index); + + ir_dereference_array(ir_variable *var, ir_rvalue *array_index); + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual ir_dereference_array *as_dereference_array() + { + return this; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->array->variable_referenced(); + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *array; + ir_rvalue *array_index; + +private: + void set_array(ir_rvalue *value); +}; + + +class ir_dereference_record : public ir_dereference { +public: + ir_dereference_record(ir_rvalue *value, const char *field); + + ir_dereference_record(ir_variable *var, const char *field); + + virtual ir_instruction *clone(struct hash_table *) const; + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->record->variable_referenced(); + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *record; + const char *field; +}; + + +/** + * Data stored in an ir_constant + */ +union ir_constant_data { + unsigned u[16]; + int i[16]; + float f[16]; + bool b[16]; +}; + + +class ir_constant : public ir_rvalue { +public: + ir_constant(const struct glsl_type *type, const ir_constant_data *data); + ir_constant(bool b); + ir_constant(unsigned int u); + ir_constant(int i); + ir_constant(float f); + + /** + * Construct an ir_constant from a list of ir_constant values + */ + ir_constant(const struct glsl_type *type, exec_list *values); + + /** + * Construct an ir_constant from a scalar component of another ir_constant + * + * The new \c ir_constant inherits the type of the component from the + * source constant. + * + * \note + * In the case of a matrix constant, the new constant is a scalar, \b not + * a vector. + */ + ir_constant(const ir_constant *c, unsigned i); + + virtual ir_instruction *clone(struct hash_table *) const; + + virtual ir_constant *as_constant() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get a particular component of a constant as a specific type + * + * This is useful, for example, to get a value from an integer constant + * as a float or bool. This appears frequently when constructors are + * called with all constant parameters. + */ + /*@{*/ + bool get_bool_component(unsigned i) const; + float get_float_component(unsigned i) const; + int get_int_component(unsigned i) const; + unsigned get_uint_component(unsigned i) const; + /*@}*/ + + ir_constant *get_record_field(const char *name); + + /** + * Determine whether a constant has the same value as another constant + */ + bool has_value(const ir_constant *) const; + + /** + * Value of the constant. + * + * The field used to back the values supplied by the constant is determined + * by the type associated with the \c ir_instruction. Constants may be + * scalars, vectors, or matrices. + */ + union ir_constant_data value; + + exec_list components; + +private: + /** + * Parameterless constructor only used by the clone method + */ + ir_constant(void); +}; + +void +visit_exec_list(exec_list *list, ir_visitor *visitor); + +void validate_ir_tree(exec_list *instructions); + +extern void +_mesa_glsl_initialize_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +extern void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +#endif /* IR_H */ diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp new file mode 100644 index 0000000000..f9953ea42d --- /dev/null +++ b/src/glsl/ir_basic_block.cpp @@ -0,0 +1,144 @@ +/* + * 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 ir_basic_block.cpp + * + * Basic block analysis of instruction streams. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_basic_block.h" +#include "glsl_types.h" + +class ir_has_call_visitor : public ir_hierarchical_visitor { +public: + ir_has_call_visitor() + { + has_call = false; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + (void) ir; + has_call = true; + return visit_stop; + } + + bool has_call; +}; + +/** + * Calls a user function for every basic block in the instruction stream. + * + * Basic block analysis is pretty easy in our IR thanks to the lack of + * unstructured control flow. We've got: + * + * ir_loop (for () {}, while () {}, do {} while ()) + * ir_loop_jump ( + * ir_if () {} + * ir_return + * ir_call() + * + * Note that the basic blocks returned by this don't encompass all + * operations performed by the program -- for example, if conditions + * don't get returned, nor do the assignments that will be generated + * for ir_call parameters. + */ +void call_for_basic_blocks(exec_list *instructions, + void (*callback)(ir_instruction *first, + ir_instruction *last, + void *data), + void *data) +{ + ir_instruction *leader = NULL; + ir_instruction *last = NULL; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_if *ir_if; + ir_loop *ir_loop; + ir_function *ir_function; + + if (!leader) + leader = ir; + + if ((ir_if = ir->as_if())) { + callback(leader, ir, data); + leader = NULL; + + call_for_basic_blocks(&ir_if->then_instructions, callback, data); + call_for_basic_blocks(&ir_if->else_instructions, callback, data); + } else if ((ir_loop = ir->as_loop())) { + callback(leader, ir, data); + leader = NULL; + call_for_basic_blocks(&ir_loop->body_instructions, callback, data); + } else if (ir->as_return() || ir->as_call()) { + callback(leader, ir, data); + leader = NULL; + } else if ((ir_function = ir->as_function())) { + /* A function definition doesn't interrupt our basic block + * since execution doesn't go into it. We should process the + * bodies of its signatures for BBs, though. + * + * Note that we miss an opportunity for producing more + * maximal BBs between the instructions that precede main() + * and the body of main(). Perhaps those instructions ought + * to live inside of main(). + */ + foreach_iter(exec_list_iterator, fun_iter, *ir_function) { + ir_function_signature *ir_sig; + + ir_sig = (ir_function_signature *)fun_iter.get(); + + call_for_basic_blocks(&ir_sig->body, callback, data); + } + } else if (ir->as_assignment()) { + ir_has_call_visitor v; + + /* If there's a call in the expression tree being assigned, + * then that ends the BB too. + * + * The assumption is that any consumer of the basic block + * walker is fine with the fact that the call is somewhere in + * the tree even if portions of the tree may be evaluated + * after the call. + * + * A consumer that has an issue with this could not process + * the last instruction of the basic block. If doing so, + * expression flattener may be useful before using the basic + * block finder to get more maximal basic blocks out. + */ + ir->accept(&v); + if (v.has_call) { + callback(leader, ir, data); + leader = NULL; + } + } + last = ir; + } + if (leader) { + callback(leader, last, data); + } +} diff --git a/src/glsl/ir_basic_block.h b/src/glsl/ir_basic_block.h new file mode 100644 index 0000000000..dbd678b5c4 --- /dev/null +++ b/src/glsl/ir_basic_block.h @@ -0,0 +1,28 @@ +/* + * 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. + */ + +void call_for_basic_blocks(exec_list *instructions, + void (*callback)(ir_instruction *first, + ir_instruction *last, + void *data), + void *data); diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp new file mode 100644 index 0000000000..84176383fc --- /dev/null +++ b/src/glsl/ir_clone.cpp @@ -0,0 +1,287 @@ +/* + * 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 +#include "ir.h" +#include "glsl_types.h" +#include "hash_table.h" + +/** + * Duplicate an IR variable + * + * \note + * This will probably be made \c virtual and moved to the base class + * eventually. + */ +ir_instruction * +ir_variable::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_variable *var = new(ctx) ir_variable(type, name); + + var->max_array_access = this->max_array_access; + var->read_only = this->read_only; + var->centroid = this->centroid; + var->invariant = this->invariant; + var->mode = this->mode; + var->interpolation = this->interpolation; + + if (ht) { + hash_table_insert(ht, var, (void *)const_cast(this)); + } + + return var; +} + +ir_instruction * +ir_swizzle::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + return new(ctx) ir_swizzle((ir_rvalue *)this->val->clone(ht), this->mask); +} + +ir_instruction * +ir_return::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_rvalue *new_value = NULL; + + if (this->value) + new_value = (ir_rvalue *)this->value->clone(ht); + + return new(ctx) ir_return(new_value); +} + +ir_instruction * +ir_loop_jump::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + (void)ht; + + return new(ctx) ir_loop_jump(this->mode); +} + +ir_instruction * +ir_if::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_if *new_if = new(ctx) ir_if((ir_rvalue *)this->condition->clone(ht)); + + foreach_iter(exec_list_iterator, iter, this->then_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_if->then_instructions.push_tail(ir->clone(ht)); + } + + foreach_iter(exec_list_iterator, iter, this->else_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_if->else_instructions.push_tail(ir->clone(ht)); + } + + return new_if; +} + +ir_instruction * +ir_loop::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_loop *new_loop = new(ctx) ir_loop(); + + if (this->from) + new_loop->from = (ir_rvalue *)this->from->clone(ht); + if (this->to) + new_loop->to = (ir_rvalue *)this->to->clone(ht); + if (this->increment) + new_loop->increment = (ir_rvalue *)this->increment->clone(ht); + new_loop->counter = counter; + + foreach_iter(exec_list_iterator, iter, this->body_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_loop->body_instructions.push_tail(ir->clone(ht)); + } + + return new_loop; +} + +ir_instruction * +ir_call::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + exec_list new_parameters; + + foreach_iter(exec_list_iterator, iter, this->actual_parameters) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_parameters.push_tail(ir->clone(ht)); + } + + return new(ctx) ir_call(this->callee, &new_parameters); +} + +ir_instruction * +ir_expression::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_rvalue *op[2] = {NULL, NULL}; + unsigned int i; + + for (i = 0; i < get_num_operands(); i++) { + op[i] = (ir_rvalue *)this->operands[i]->clone(ht); + } + + return new(ctx) ir_expression(this->operation, this->type, op[0], op[1]); +} + +ir_instruction * +ir_dereference_variable::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_variable *new_var; + + if (ht) { + new_var = (ir_variable *)hash_table_find(ht, this->var); + if (!new_var) + new_var = this->var; + } else { + new_var = this->var; + } + + return new(ctx) ir_dereference_variable(new_var); +} + +ir_instruction * +ir_dereference_array::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + return new(ctx) ir_dereference_array((ir_rvalue *)this->array->clone(ht), + (ir_rvalue *)this->array_index->clone(ht)); +} + +ir_instruction * +ir_dereference_record::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + return new(ctx) ir_dereference_record((ir_rvalue *)this->record->clone(ht), + this->field); +} + +ir_instruction * +ir_texture::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_texture *new_tex = new(ctx) ir_texture(this->op); + + new_tex->sampler = (ir_dereference *)this->sampler->clone(ht); + new_tex->coordinate = (ir_rvalue *)this->coordinate->clone(ht); + if (this->projector) + new_tex->projector = (ir_rvalue *)this->projector->clone(ht); + if (this->shadow_comparitor) { + new_tex->shadow_comparitor = + (ir_rvalue *)this->shadow_comparitor->clone(ht); + } + + for (int i = 0; i < 3; i++) + new_tex->offsets[i] = this->offsets[i]; + + switch (this->op) { + case ir_tex: + break; + case ir_txb: + new_tex->lod_info.bias = (ir_rvalue *)this->lod_info.bias->clone(ht); + break; + case ir_txl: + case ir_txf: + new_tex->lod_info.lod = (ir_rvalue *)this->lod_info.lod->clone(ht); + break; + case ir_txd: + new_tex->lod_info.grad.dPdx = + (ir_rvalue *)this->lod_info.grad.dPdx->clone(ht); + new_tex->lod_info.grad.dPdy = + (ir_rvalue *)this->lod_info.grad.dPdy->clone(ht); + break; + } + + return new_tex; +} + +ir_instruction * +ir_assignment::clone(struct hash_table *ht) const +{ + ir_rvalue *new_condition = NULL; + + if (this->condition) + new_condition = (ir_rvalue *)this->condition->clone(ht); + + void *ctx = talloc_parent(this); + return new(ctx) ir_assignment((ir_rvalue *)this->lhs->clone(ht), + (ir_rvalue *)this->rhs->clone(ht), + new_condition); +} + +ir_instruction * +ir_function::clone(struct hash_table *ht) const +{ + (void)ht; + /* FINISHME */ + abort(); +} + +ir_instruction * +ir_function_signature::clone(struct hash_table *ht) const +{ + (void)ht; + /* FINISHME */ + abort(); +} + +ir_instruction * +ir_constant::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + (void)ht; + + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + return new(ctx) ir_constant(this->type, &this->value); + + case GLSL_TYPE_STRUCT: { + ir_constant *c = new(ctx) ir_constant; + + c->type = this->type; + for (exec_node *node = this->components.head + ; !node->is_tail_sentinal() + ; node = node->next) { + ir_constant *const orig = (ir_constant *) node; + + c->components.push_tail(orig->clone(NULL)); + } + + return c; + } + + default: + assert(!"Should not get here."); break; + return NULL; + } +} diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp new file mode 100644 index 0000000000..3408f5256a --- /dev/null +++ b/src/glsl/ir_constant_expression.cpp @@ -0,0 +1,671 @@ +/* + * 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 ir_constant_expression.cpp + * Evaluate and process constant valued expressions + * + * In GLSL, constant valued expressions are used in several places. These + * must be processed and evaluated very early in the compilation process. + * + * * Sizes of arrays + * * Initializers for uniforms + * * Initializers for \c const variables + */ + +#include +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +/** + * Visitor class for evaluating constant expressions + */ +class ir_constant_visitor : public ir_visitor { +public: + ir_constant_visitor() + : value(NULL) + { + /* empty */ + } + + virtual ~ir_constant_visitor() + { + /* empty */ + } + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_texture *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_if *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + /*@}*/ + + /** + * Value of the constant expression. + * + * \note + * This field will be \c NULL if the expression is not constant valued. + */ + /* FINIHSME: This cannot hold values for constant arrays or structures. */ + ir_constant *value; +}; + + +ir_constant * +ir_instruction::constant_expression_value() +{ + ir_constant_visitor visitor; + + this->accept(& visitor); + return visitor.value; +} + + +void +ir_constant_visitor::visit(ir_variable *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_function_signature *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_function *ir) +{ + (void) ir; + value = NULL; +} + +void +ir_constant_visitor::visit(ir_expression *ir) +{ + value = NULL; + ir_constant *op[2]; + unsigned int operand, c; + ir_constant_data data; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + op[operand] = ir->operands[operand]->constant_expression_value(); + if (!op[operand]) + return; + } + + switch (ir->operation) { + case ir_unop_logic_not: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) + data.b[c] = !op[0]->value.b[c]; + break; + + case ir_unop_f2i: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.i[c] = op[0]->value.f[c]; + } + break; + case ir_unop_i2f: + assert(op[0]->type->base_type == GLSL_TYPE_UINT || + op[0]->type->base_type == GLSL_TYPE_INT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + if (op[0]->type->base_type == GLSL_TYPE_INT) + data.f[c] = op[0]->value.i[c]; + else + data.f[c] = op[0]->value.u[c]; + } + break; + case ir_unop_b2f: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = op[0]->value.b[c] ? 1.0 : 0.0; + } + break; + case ir_unop_f2b: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.b[c] = bool(op[0]->value.f[c]); + } + break; + case ir_unop_b2i: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.u[c] = op[0]->value.b[c] ? 1 : 0; + } + break; + case ir_unop_i2b: + assert(op[0]->type->is_integer()); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.b[c] = bool(op[0]->value.u[c]); + } + break; + + case ir_unop_neg: + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = -op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = -op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = -op[0]->value.f[c]; + break; + default: + assert(0); + } + } + break; + + case ir_unop_abs: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c]; + if (data.i[c] < 0) + data.i[c] = -data.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = fabs(op[0]->value.f[c]); + break; + default: + assert(0); + } + } + break; + + case ir_unop_rcp: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + if (op[0]->value.u[c] != 0.0) + data.u[c] = 1 / op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + if (op[0]->value.i[c] != 0.0) + data.i[c] = 1 / op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + if (op[0]->value.f[c] != 0.0) + data.f[c] = 1.0 / op[0]->value.f[c]; + break; + default: + assert(0); + } + } + break; + + case ir_unop_rsq: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = 1.0 / sqrtf(op[0]->value.f[c]); + } + break; + + case ir_unop_sqrt: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = sqrtf(op[0]->value.f[c]); + } + break; + + case ir_unop_exp: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = expf(op[0]->value.f[c]); + } + break; + + case ir_unop_log: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = logf(op[0]->value.f[c]); + } + break; + + case ir_unop_dFdx: + case ir_unop_dFdy: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = 0.0; + } + break; + + case ir_binop_add: + if (ir->operands[0]->type == ir->operands[1]->type) { + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c] + op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c] + op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] + op[1]->value.f[c]; + break; + default: + assert(0); + } + } + } else + /* FINISHME: Support operations with non-equal types. */ + return; + + break; + case ir_binop_sub: + if (ir->operands[0]->type == ir->operands[1]->type) { + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c] - op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c] - op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] - op[1]->value.f[c]; + break; + default: + assert(0); + } + } + } else + /* FINISHME: Support operations with non-equal types. */ + return; + + break; + case ir_binop_mul: + if (ir->operands[0]->type == ir->operands[1]->type && + !ir->operands[0]->type->is_matrix()) { + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c] * op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c] * op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]; + break; + default: + assert(0); + } + } + } else + /* FINISHME: Support operations with non-equal types. */ + return; + + break; + case ir_binop_div: + if (ir->operands[0]->type == ir->operands[1]->type) { + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c] / op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c] / op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] / op[1]->value.f[c]; + break; + default: + assert(0); + } + } + } else + /* FINISHME: Support operations with non-equal types. */ + return; + + break; + case ir_binop_logic_and: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] && op[1]->value.b[c]; + break; + case ir_binop_logic_xor: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c]; + break; + case ir_binop_logic_or: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (c = 0; c < ir->operands[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] || op[1]->value.b[c]; + break; + + case ir_binop_less: + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] < op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] < op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] < op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_greater: + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] > op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] > op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] > op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_lequal: + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_gequal: + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + + case ir_binop_equal: + data.b[0] = true; + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c]; + break; + case GLSL_TYPE_BOOL: + data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c]; + break; + default: + assert(0); + } + } + break; + case ir_binop_nequal: + data.b[0] = false; + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c]; + break; + case GLSL_TYPE_BOOL: + data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c]; + break; + default: + assert(0); + } + } + break; + + default: + /* FINISHME: Should handle all expression types. */ + return; + } + + void *ctx = talloc_parent(ir); + this->value = new(ctx) ir_constant(ir->type, &data); +} + + +void +ir_constant_visitor::visit(ir_texture *ir) +{ + // FINISHME: Do stuff with texture lookups + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_swizzle *ir) +{ + ir_constant *v = ir->val->constant_expression_value(); + + this->value = NULL; + + if (v != NULL) { + ir_constant_data data; + + const unsigned swiz_idx[4] = { + ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w + }; + + for (unsigned i = 0; i < ir->mask.num_components; i++) { + switch (v->type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: data.u[i] = v->value.u[swiz_idx[i]]; break; + case GLSL_TYPE_FLOAT: data.f[i] = v->value.f[swiz_idx[i]]; break; + case GLSL_TYPE_BOOL: data.b[i] = v->value.b[swiz_idx[i]]; break; + default: assert(!"Should not get here."); break; + } + } + + void *ctx = talloc_parent(ir); + this->value = new(ctx) ir_constant(ir->type, &data); + } +} + + +void +ir_constant_visitor::visit(ir_dereference_variable *ir) +{ + value = NULL; + + ir_variable *var = ir->variable_referenced(); + if (var && var->constant_value) + value = (ir_constant *)var->constant_value->clone(NULL); +} + + +void +ir_constant_visitor::visit(ir_dereference_array *ir) +{ + void *ctx = talloc_parent(ir); + ir_constant *array = ir->array->constant_expression_value(); + ir_constant *idx = ir->array_index->constant_expression_value(); + + this->value = NULL; + + if ((array != NULL) && (idx != NULL)) { + if (array->type->is_matrix()) { + /* Array access of a matrix results in a vector. + */ + const unsigned column = idx->value.u[0]; + + const glsl_type *const column_type = array->type->column_type(); + + /* Offset in the constant matrix to the first element of the column + * to be extracted. + */ + const unsigned mat_idx = column * column_type->vector_elements; + + ir_constant_data data; + + switch (column_type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < column_type->vector_elements; i++) + data.u[i] = array->value.u[mat_idx + i]; + + break; + + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < column_type->vector_elements; i++) + data.f[i] = array->value.f[mat_idx + i]; + + break; + + default: + assert(!"Should not get here."); + break; + } + + this->value = new(ctx) ir_constant(column_type, &data); + } else if (array->type->is_vector()) { + const unsigned component = idx->value.u[0]; + + this->value = new(ctx) ir_constant(array, component); + } else { + /* FINISHME: Handle access of constant arrays. */ + } + } +} + + +void +ir_constant_visitor::visit(ir_dereference_record *ir) +{ + ir_constant *v = ir->record->constant_expression_value(); + + this->value = (v != NULL) ? v->get_record_field(ir->field) : NULL; +} + + +void +ir_constant_visitor::visit(ir_assignment *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_constant *ir) +{ + value = ir; +} + + +void +ir_constant_visitor::visit(ir_call *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_return *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_if *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_loop *ir) +{ + (void) ir; + value = NULL; +} + + +void +ir_constant_visitor::visit(ir_loop_jump *ir) +{ + (void) ir; + value = NULL; +} diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp new file mode 100644 index 0000000000..342d027bbe --- /dev/null +++ b/src/glsl/ir_constant_folding.cpp @@ -0,0 +1,229 @@ +/* + * 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 ir_constant_folding.cpp + * Replace constant-valued expressions with references to constant values. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_constant_folding_visitor : public ir_visitor { +public: + ir_constant_folding_visitor() + { + /* empty */ + } + + virtual ~ir_constant_folding_visitor() + { + /* empty */ + } + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_texture *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_if *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + /*@}*/ +}; + +void +ir_constant_folding_visitor::visit(ir_variable *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_function_signature *ir) +{ + visit_exec_list(&ir->body, this); +} + + +void +ir_constant_folding_visitor::visit(ir_function *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_function_signature *const sig = (ir_function_signature *) iter.get(); + sig->accept(this); + } +} + +void +ir_constant_folding_visitor::visit(ir_expression *ir) +{ + ir_constant *op[2]; + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + op[operand] = ir->operands[operand]->constant_expression_value(); + if (op[operand]) { + ir->operands[operand] = op[operand]; + } else { + ir->operands[operand]->accept(this); + } + } +} + + +void +ir_constant_folding_visitor::visit(ir_texture *ir) +{ + // FINISHME: Do stuff with texture lookups + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_swizzle *ir) +{ + ir->val->accept(this); +} + + +void +ir_constant_folding_visitor::visit(ir_dereference_variable *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_dereference_array *ir) +{ + ir_constant *const_val = + ir->array_index->constant_expression_value(); + + if (const_val) + ir->array_index = const_val; + else + ir->array_index->accept(this); + + ir->array->accept(this); +} + + +void +ir_constant_folding_visitor::visit(ir_dereference_record *ir) +{ + ir->record->accept(this); +} + + +void +ir_constant_folding_visitor::visit(ir_assignment *ir) +{ + ir_constant *const_val = ir->rhs->constant_expression_value(); + if (const_val) + ir->rhs = const_val; + else + ir->rhs->accept(this); +} + + +void +ir_constant_folding_visitor::visit(ir_constant *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_call *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_return *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_if *ir) +{ + ir_constant *const_val = ir->condition->constant_expression_value(); + if (const_val) + ir->condition = const_val; + else + ir->condition->accept(this); + + visit_exec_list(&ir->then_instructions, this); + visit_exec_list(&ir->else_instructions, this); +} + + +void +ir_constant_folding_visitor::visit(ir_loop *ir) +{ + (void) ir; +} + + +void +ir_constant_folding_visitor::visit(ir_loop_jump *ir) +{ + (void) ir; +} + +bool +do_constant_folding(exec_list *instructions) +{ + ir_constant_folding_visitor constant_folding; + + visit_exec_list(instructions, &constant_folding); + + /* FINISHME: Return real progress. */ + return false; +} diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp new file mode 100644 index 0000000000..ef5e1e418e --- /dev/null +++ b/src/glsl/ir_constant_variable.cpp @@ -0,0 +1,156 @@ +/* + * 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 ir_constant_variable.cpp + * + * Marks variables assigned a single constant value over the course + * of the program as constant. + * + * The goal here is to trigger further constant folding and then dead + * code elimination. This is common with vector/matrix constructors + * and calls to builtin functions. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +struct assignment_entry { + exec_node link; + int assignment_count; + ir_variable *var; + ir_constant *constval; +}; + +class ir_constant_variable_visitor : public ir_hierarchical_visitor { +public: + virtual ir_visitor_status visit_enter(ir_assignment *); + + exec_list list; +}; + +static struct assignment_entry * +get_assignment_entry(ir_variable *var, exec_list *list) +{ + struct assignment_entry *entry; + + foreach_list_typed(struct assignment_entry, entry, link, list) { + if (entry->var == var) + return entry; + } + + entry = (struct assignment_entry *)calloc(1, sizeof(*entry)); + entry->var = var; + list->push_head(&entry->link); + return entry; +} + +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_assignment *ir) +{ + ir_constant *constval; + struct assignment_entry *entry; + + entry = get_assignment_entry(ir->lhs->variable_referenced(), &this->list); + assert(entry); + entry->assignment_count++; + + /* If it's already constant, don't do the work. */ + if (entry->var->constant_value) + return visit_continue; + + /* OK, now find if we actually have all the right conditions for + * this to be a constant value assigned to the var. + */ + if (ir->condition) { + constval = ir->condition->constant_expression_value(); + if (!constval || !constval->value.b[0]) + return visit_continue; + } + + ir_variable *var = ir->lhs->whole_variable_referenced(); + if (!var) + return visit_continue; + + constval = ir->rhs->constant_expression_value(); + if (!constval) + return visit_continue; + + /* Mark this entry as having a constant assignment (if the + * assignment count doesn't go >1). do_constant_variable will fix + * up the variable with the constant value later. + */ + entry->constval = constval; + + return visit_continue; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_constant_variable(exec_list *instructions) +{ + bool progress = false; + ir_constant_variable_visitor v; + + v.run(instructions); + + while (!v.list.is_empty()) { + + struct assignment_entry *entry; + entry = exec_node_data(struct assignment_entry, v.list.head, link); + + if (entry->assignment_count == 1 && entry->constval) { + entry->var->constant_value = entry->constval; + progress = true; + } + entry->link.remove(); + free(entry); + } + + return progress; +} + +bool +do_constant_variable_unlinked(exec_list *instructions) +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *f = ir->as_function(); + if (f) { + foreach_iter(exec_list_iterator, sigiter, *f) { + ir_function_signature *sig = + (ir_function_signature *) sigiter.get(); + if (do_constant_variable(&sig->body)) + progress = true; + } + } + } + + return progress; +} diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp new file mode 100644 index 0000000000..46ef6679d9 --- /dev/null +++ b/src/glsl/ir_copy_propagation.cpp @@ -0,0 +1,256 @@ +/* + * 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 ir_copy_propagation.cpp + * + * Moves usage of recently-copied variables to the previous copy of + * the variable within basic blocks. + * + * This should reduce the number of MOV instructions in the generated + * programs unless copy propagation is also done on the LIR, and may + * help anyway by triggering other optimizations that live in the HIR. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class acp_entry : public exec_node +{ +public: + acp_entry(ir_variable *lhs, ir_variable *rhs) + { + assert(lhs); + assert(rhs); + this->lhs = lhs; + this->rhs = rhs; + } + + ir_variable *lhs; + ir_variable *rhs; +}; + +class ir_copy_propagation_visitor : public ir_hierarchical_visitor { +public: + ir_copy_propagation_visitor(exec_list *acp) + { + progress = false; + in_lhs = false; + this->acp = acp; + } + + virtual ir_visitor_status visit(class ir_dereference_variable *); + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_if *); + + /** List of acp_entry */ + exec_list *acp; + bool progress; + + /** Currently in the LHS of an assignment? */ + bool in_lhs; +}; + + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_loop *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_assignment *ir) +{ + (void) ir; + this->in_lhs = true; + return visit_continue; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + +/** + * Replaces dereferences of ACP RHS variables with ACP LHS variables. + * + * This is where the actual copy propagation occurs. Note that the + * rewriting of ir_dereference means that the ir_dereference instance + * must not be shared by multiple IR operations! + */ +ir_visitor_status +ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) +{ + /* Ignores the LHS. Don't want to rewrite the LHS to point at some + * other storage! + */ + if (this->in_lhs) { + this->in_lhs = false; + return visit_continue; + } + + ir_variable *var = ir->variable_referenced(); + + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (var == entry->lhs) { + ir->var = entry->rhs; + this->progress = true; + break; + } + } + + return visit_continue; +} + + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_call *ir) +{ + (void)ir; + + /* Note, if we were to do copy propagation to parameters of calls, we'd + * have to be careful about out params. + */ + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + + /* Do not traverse into the body of the if-statement since that is a + * different basic block. + */ + return visit_continue_with_parent; +} + +static bool +propagate_copies(ir_instruction *ir, exec_list *acp) +{ + ir_copy_propagation_visitor v(acp); + + ir->accept(&v); + + return v.progress; +} + +static void +kill_invalidated_copies(ir_assignment *ir, exec_list *acp) +{ + ir_variable *var = ir->lhs->variable_referenced(); + assert(var != NULL); + + foreach_iter(exec_list_iterator, iter, *acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (entry->lhs == var || entry->rhs == var) { + entry->remove(); + } + } +} + +/** + * Adds an entry to the available copy list if it's a plain assignment + * of a variable to a variable. + */ +static void +add_copy(ir_assignment *ir, exec_list *acp) +{ + void *ctx = talloc_parent(ir); + acp_entry *entry; + + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + return; + } + + ir_variable *lhs_var = ir->lhs->whole_variable_referenced(); + ir_variable *rhs_var = ir->rhs->whole_variable_referenced(); + + if ((lhs_var != NULL) && (rhs_var != NULL)) { + entry = new(ctx) acp_entry(lhs_var, rhs_var); + acp->push_tail(entry); + } +} + +static void +copy_propagation_basic_block(ir_instruction *first, + ir_instruction *last, + void *data) +{ + ir_instruction *ir; + /* List of avaialble_copy */ + exec_list acp; + bool *out_progress = (bool *)data; + bool progress = false; + + for (ir = first;; ir = (ir_instruction *)ir->next) { + ir_assignment *ir_assign = ir->as_assignment(); + + progress = propagate_copies(ir, &acp) || progress; + + if (ir_assign) { + kill_invalidated_copies(ir_assign, &acp); + + add_copy(ir_assign, &acp); + } + if (ir == last) + break; + } + *out_progress = progress; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_copy_propagation(exec_list *instructions) +{ + bool progress = false; + + call_for_basic_blocks(instructions, copy_propagation_basic_block, &progress); + + return progress; +} diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp new file mode 100644 index 0000000000..8821304682 --- /dev/null +++ b/src/glsl/ir_dead_code.cpp @@ -0,0 +1,219 @@ +/* + * 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 ir_dead_code.cpp + * + * Eliminates dead assignments and variable declarations from the code. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var) + { + this->var = var; + assign = NULL; + referenced_count = 0; + assigned_count = 0; + declaration = false; + } + + ir_variable *var; /* The key: the variable's pointer. */ + ir_assignment *assign; /* An assignment to the variable, if any */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned referenced_count; + + /** Number of times the variable is assignmened. */ + unsigned assigned_count; + + bool declaration; /* If the variable had a decl in the instruction stream */ +}; + +class ir_dead_code_visitor : public ir_hierarchical_visitor { +public: + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + + virtual ir_visitor_status visit_enter(ir_function *); + virtual ir_visitor_status visit_leave(ir_assignment *); + + variable_entry *get_variable_entry(ir_variable *var); + + bool (*predicate)(ir_instruction *ir); + ir_instruction *base_ir; + + /* List of variable_entry */ + exec_list variable_list; +}; + + +variable_entry * +ir_dead_code_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) + return entry; + } + + void *ctx = talloc_parent(var); + + variable_entry *entry = new(ctx) variable_entry(var); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_dead_code_visitor::visit(ir_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir); + if (entry) + entry->declaration = true; + + return visit_continue; +} + + +ir_visitor_status +ir_dead_code_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->variable_referenced(); + variable_entry *entry = this->get_variable_entry(var); + + if (entry) + entry->referenced_count++; + + return visit_continue; +} + + +ir_visitor_status +ir_dead_code_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_dead_code_visitor::visit_leave(ir_assignment *ir) +{ + variable_entry *entry; + entry = this->get_variable_entry(ir->lhs->variable_referenced()); + if (entry) { + entry->assigned_count++; + if (entry->assign == NULL) + entry->assign = ir; + } + + return visit_continue; +} + + +/** + * Do a dead code pass over instructions and everything that instructions + * references. + * + * Note that this will remove assignments to globals, so it is not suitable + * for usage on an unlinked instruction stream. + */ +bool +do_dead_code(exec_list *instructions) +{ + ir_dead_code_visitor v; + bool progress = false; + + v.run(instructions); + + foreach_iter(exec_list_iterator, iter, v.variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + + /* Since each assignment is a reference, the refereneced count must be + * greater than or equal to the assignment count. If they are equal, + * then all of the references are assignments, and the variable is + * dead. + * + * Note that if the variable is neither assigned nor referenced, both + * counts will be zero and will be caught by the equality test. + */ + assert(entry->referenced_count >= entry->assigned_count); + + if ((entry->referenced_count > entry->assigned_count) + || !entry->declaration) + continue; + + if (entry->assign) { + /* Remove a single dead assignment to the variable we found. + * Don't do so if it's a shader output, though. + */ + if (!entry->var->shader_out) { + entry->assign->remove(); + progress = true; + } + } else { + /* If there are no assignments or references to the variable left, + * then we can remove its declaration. + */ + entry->var->remove(); + progress = true; + } + } + return progress; +} + +/** + * Does a dead code pass on the functions present in the instruction stream. + * + * This is suitable for use while the program is not linked, as it will + * ignore variable declarations (and the assignments to them) for variables + * with global scope. + */ +bool +do_dead_code_unlinked(exec_list *instructions) +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *f = ir->as_function(); + if (f) { + foreach_iter(exec_list_iterator, sigiter, *f) { + ir_function_signature *sig = + (ir_function_signature *) sigiter.get(); + if (do_dead_code(&sig->body)) + progress = true; + } + } + } + + return progress; +} diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp new file mode 100644 index 0000000000..e01877077c --- /dev/null +++ b/src/glsl/ir_dead_code_local.cpp @@ -0,0 +1,223 @@ +/* + * 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 ir_dead_code_local.cpp + * + * Eliminates local dead assignments from the code. + * + * This operates on basic blocks, tracking assignments and finding if + * they're used before the variable is completely reassigned. + * + * Compare this to ir_dead_code.cpp, which operates globally looking + * for assignments to variables that are never read. + */ + +#include "ir.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +static bool debug = false; + +class assignment_entry : public exec_node +{ +public: + assignment_entry(ir_variable *lhs, ir_instruction *ir) + { + assert(lhs); + assert(ir); + this->lhs = lhs; + this->ir = ir; + } + + ir_variable *lhs; + ir_instruction *ir; +}; + +class kill_for_derefs_visitor : public ir_hierarchical_visitor { +public: + kill_for_derefs_visitor(exec_list *assignments) + { + this->assignments = assignments; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + ir_variable *const var = ir->variable_referenced(); + + foreach_iter(exec_list_iterator, iter, *this->assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + if (entry->lhs == var) { + if (debug) + printf("kill %s\n", entry->lhs->name); + entry->remove(); + } + } + + return visit_continue; + } + +private: + exec_list *assignments; +}; + +class array_index_visit : public ir_hierarchical_visitor { +public: + array_index_visit(ir_hierarchical_visitor *v) + { + this->visitor = v; + } + + virtual ir_visitor_status visit_enter(class ir_dereference_array *ir) + { + ir->array_index->accept(visitor); + return visit_continue; + } + + static void run(ir_instruction *ir, ir_hierarchical_visitor *v) + { + array_index_visit top_visit(v); + ir->accept(& top_visit); + } + + ir_hierarchical_visitor *visitor; +}; + + +/** + * Adds an entry to the available copy list if it's a plain assignment + * of a variable to a variable. + */ +static bool +process_assignment(ir_assignment *ir, exec_list *assignments) +{ + void *ctx = talloc_parent(ir); + ir_variable *var = NULL; + bool progress = false; + kill_for_derefs_visitor v(assignments); + + /* Kill assignment entries for things used to produce this assignment. */ + ir->rhs->accept(&v); + if (ir->condition) { + ir->condition->accept(&v); + } + + /* Kill assignment enties used as array indices. + */ + array_index_visit::run(ir->lhs, &v); + var = ir->lhs->variable_referenced(); + assert(var); + + bool always_assign = true; + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + always_assign = false; + } + + /* Now, check if we did a whole-variable assignment. */ + if (always_assign && (ir->lhs->whole_variable_referenced() != NULL)) { + /* We did a whole-variable assignment. So, any instruction in + * the assignment list with the same LHS is dead. + */ + if (debug) + printf("looking for %s to remove\n", var->name); + foreach_iter(exec_list_iterator, iter, *assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + if (entry->lhs == var) { + if (debug) + printf("removing %s\n", var->name); + entry->ir->remove(); + entry->remove(); + progress = true; + } + } + } + + /* Add this instruction to the assignment list. */ + assignment_entry *entry = new(ctx) assignment_entry(var, ir); + assignments->push_tail(entry); + + if (debug) { + printf("add %s\n", var->name); + + printf("current entries\n"); + foreach_iter(exec_list_iterator, iter, *assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + printf(" %s\n", entry->lhs->name); + } + } + + return progress; +} + +static void +dead_code_local_basic_block(ir_instruction *first, + ir_instruction *last, + void *data) +{ + ir_instruction *ir, *ir_next; + /* List of avaialble_copy */ + exec_list assignments; + bool *out_progress = (bool *)data; + bool progress = false; + + /* Safe looping, since process_assignment */ + for (ir = first, ir_next = (ir_instruction *)first->next;; + ir = ir_next, ir_next = (ir_instruction *)ir->next) { + ir_assignment *ir_assign = ir->as_assignment(); + + if (debug) { + ir->print(); + printf("\n"); + } + + if (ir_assign) { + progress = process_assignment(ir_assign, &assignments) || progress; + } else { + kill_for_derefs_visitor kill(&assignments); + ir->accept(&kill); + } + + if (ir == last) + break; + } + *out_progress = progress; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_dead_code_local(exec_list *instructions) +{ + bool progress = false; + + call_for_basic_blocks(instructions, dead_code_local_basic_block, &progress); + + return progress; +} diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp new file mode 100644 index 0000000000..5ba24e390b --- /dev/null +++ b/src/glsl/ir_expression_flattening.cpp @@ -0,0 +1,172 @@ +/* + * 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 ir_expression_flattening.cpp + * + * Takes the leaves of expression trees and makes them dereferences of + * assignments of the leaves to temporaries, according to a predicate. + * + * This is used for automatic function inlining, where we want to take + * an expression containing a call and move the call out to its own + * assignment so that we can inline it at the appropriate place in the + * instruction stream. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +class ir_expression_flattening_visitor : public ir_hierarchical_visitor { +public: + ir_expression_flattening_visitor(ir_instruction *base_ir, + bool (*predicate)(ir_instruction *ir)) + { + this->base_ir = base_ir; + this->predicate = predicate; + } + + virtual ~ir_expression_flattening_visitor() + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit_enter(ir_if *); + virtual ir_visitor_status visit_enter(ir_loop *); + virtual ir_visitor_status visit_leave(ir_expression *); + virtual ir_visitor_status visit_leave(ir_swizzle *); + + bool (*predicate)(ir_instruction *ir); + ir_instruction *base_ir; +}; + +void +do_expression_flattening(exec_list *instructions, + bool (*predicate)(ir_instruction *ir)) +{ + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + ir_expression_flattening_visitor v(ir, predicate); + ir->accept(&v); + } +} + + +static ir_rvalue * +operand_to_temp(ir_instruction *base_ir, ir_rvalue *ir) +{ + void *ctx = talloc_parent(base_ir); + ir_variable *var; + ir_assignment *assign; + + var = new(ctx) ir_variable(ir->type, "flattening_tmp"); + base_ir->insert_before(var); + + assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), + ir, + NULL); + base_ir->insert_before(assign); + + return new(ctx) ir_dereference_variable(var); +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_enter(ir_function_signature *ir) +{ + do_expression_flattening(&ir->body, this->predicate); + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_enter(ir_loop *ir) +{ + do_expression_flattening(&ir->body_instructions, this->predicate); + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + + do_expression_flattening(&ir->then_instructions, this->predicate); + do_expression_flattening(&ir->else_instructions, this->predicate); + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_leave(ir_expression *ir) +{ + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + /* If the operand matches the predicate, then we'll assign its + * value to a temporary and deref the temporary as the operand. + */ + if (this->predicate(ir->operands[operand])) { + ir->operands[operand] = operand_to_temp(base_ir, + ir->operands[operand]); + } + } + + return visit_continue; +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_leave(ir_swizzle *ir) +{ + if (this->predicate(ir->val)) { + ir->val = operand_to_temp(this->base_ir, ir->val); + } + + return visit_continue; +} + +ir_visitor_status +ir_expression_flattening_visitor::visit_enter(ir_call *ir) +{ + /* FINISHME: Why not process the call parameters? (Same behavior as original + * FINISHME: code.) + */ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_expression_flattening_visitor::visit_enter(ir_return *ir) +{ + /* FINISHME: Why not process the return value? (Same behavior as original + * FINISHME: code.) + */ + (void) ir; + return visit_continue_with_parent; +} diff --git a/src/glsl/ir_expression_flattening.h b/src/glsl/ir_expression_flattening.h new file mode 100644 index 0000000000..2eda159000 --- /dev/null +++ b/src/glsl/ir_expression_flattening.h @@ -0,0 +1,38 @@ +/* + * 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 ir_expression_flattening.h + * + * Takes the leaves of expression trees and makes them dereferences of + * assignments of the leaves to temporaries, according to a predicate. + * + * This is used for automatic function inlining, where we want to take + * an expression containing a call and move the call out to its own + * assignment so that we can inline it at the appropriate place in the + * instruction stream. + */ + +void do_expression_flattening(exec_list *instructions, + bool (*predicate)(ir_instruction *ir)); diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp new file mode 100644 index 0000000000..5db93f67fb --- /dev/null +++ b/src/glsl/ir_function.cpp @@ -0,0 +1,225 @@ +/* + * 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_types.h" +#include "ir.h" + +int +type_compare(const glsl_type *a, const glsl_type *b) +{ + /* If the types are the same, they trivially match. + */ + if (a == b) + return 0; + + switch (a->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + /* There is no implicit conversion to or from integer types or bool. + */ + if ((a->is_integer() != b->is_integer()) + || (a->is_boolean() != b->is_boolean())) + return -1; + + /* FALLTHROUGH */ + + case GLSL_TYPE_FLOAT: + if ((a->vector_elements != b->vector_elements) + || (a->matrix_columns != b->matrix_columns)) + return -1; + + return 1; + + case GLSL_TYPE_SAMPLER: + case GLSL_TYPE_STRUCT: + /* Samplers and structures must match exactly. + */ + return -1; + + case GLSL_TYPE_ARRAY: + if ((b->base_type != GLSL_TYPE_ARRAY) + || (a->length != b->length)) + return -1; + + /* From GLSL 1.50 spec, page 27 (page 33 of the PDF): + * "There are no implicit array or structure conversions." + * + * If the comparison of the array element types detects that a conversion + * would be required, the array types do not match. + */ + return (type_compare(a->fields.array, b->fields.array) == 0) ? 0 : -1; + + case GLSL_TYPE_FUNCTION: + case GLSL_TYPE_VOID: + case GLSL_TYPE_ERROR: + default: + /* These are all error conditions. It is invalid for a parameter to + * a function to be declared as error, void, or a function. + */ + return -1; + } + + /* This point should be unreachable. + */ + assert(0); +} + + +static int +parameter_lists_match(exec_list *list_a, exec_list *list_b) +{ + exec_list_iterator iter_a = list_a->iterator(); + exec_list_iterator iter_b = list_b->iterator(); + int total_score = 0; + + for (/* empty */ ; iter_a.has_next(); iter_a.next(), iter_b.next()) { + /* If all of the parameters from the other parameter list have been + * exhausted, the lists have different length and, by definition, + * do not match. + */ + if (!iter_b.has_next()) + return -1; + + + const ir_variable *const param = (ir_variable *) iter_a.get(); + const ir_instruction *const actual = (ir_instruction *) iter_b.get(); + + /* Determine whether or not the types match. If the types are an + * exact match, the match score is zero. If the types don't match + * but the actual parameter can be coerced to the type of the declared + * parameter, the match score is one. + */ + int score; + switch ((enum ir_variable_mode)(param->mode)) { + case ir_var_auto: + case ir_var_uniform: + /* These are all error conditions. It is invalid for a parameter to + * a function to be declared as auto (not in, out, or inout) or + * as uniform. + */ + assert(0); + return -1; + + case ir_var_in: + score = type_compare(param->type, actual->type); + break; + + case ir_var_out: + score = type_compare(actual->type, param->type); + break; + + case ir_var_inout: + /* Since there are no bi-directional automatic conversions (e.g., + * there is int -> float but no float -> int), inout parameters must + * be exact matches. + */ + score = (type_compare(actual->type, param->type) == 0) ? 0 : -1; + break; + } + + if (score < 0) + return -1; + + total_score += score; + } + + /* If all of the parameters from the other parameter list have been + * exhausted, the lists have different length and, by definition, do not + * match. + */ + if (iter_b.has_next()) + return -1; + + return total_score; +} + + +const ir_function_signature * +ir_function::matching_signature(exec_list *actual_parameters) +{ + ir_function_signature *match = NULL; + + foreach_iter(exec_list_iterator, iter, signatures) { + ir_function_signature *const sig = + (ir_function_signature *) iter.get(); + + const int score = parameter_lists_match(& sig->parameters, + actual_parameters); + + if (score == 0) + return sig; + + if (score > 0) { + if (match != NULL) + return NULL; + + match = sig; + } + } + + return match; +} + + +static bool +parameter_lists_match_exact(exec_list *list_a, exec_list *list_b) +{ + exec_list_iterator iter_a = list_a->iterator(); + exec_list_iterator iter_b = list_b->iterator(); + + while (iter_a.has_next() && iter_b.has_next()) { + ir_variable *a = (ir_variable *)iter_a.get(); + ir_variable *b = (ir_variable *)iter_b.get(); + + /* If the types of the parameters do not match, the parameters lists + * are different. + */ + if (a->type != b->type) + return false; + + iter_a.next(); + iter_b.next(); + } + + /* Unless both lists are exhausted, they differ in length and, by + * definition, do not match. + */ + if (iter_a.has_next() != iter_b.has_next()) + return false; + + return true; +} + +ir_function_signature * +ir_function::exact_matching_signature(exec_list *actual_parameters) +{ + foreach_iter(exec_list_iterator, iter, signatures) { + ir_function_signature *const sig = + (ir_function_signature *) iter.get(); + + if (parameter_lists_match_exact(&sig->parameters, actual_parameters)) + return sig; + } + return NULL; +} diff --git a/src/glsl/ir_function_can_inline.cpp b/src/glsl/ir_function_can_inline.cpp new file mode 100644 index 0000000000..8bb8e0d9ed --- /dev/null +++ b/src/glsl/ir_function_can_inline.cpp @@ -0,0 +1,71 @@ +/* + * 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 ir_function_can_inline.cpp + * + * Determines if we can inline a function call using ir_function_inlining.cpp. + * + * The primary restriction is that we can't return from the function + * other than as the last instruction. We could potentially work + * around this for some constructs by flattening control flow and + * moving the return to the end, or by using breaks from a do {} while + * (0) loop surrounding the function body. + */ + +#include "ir.h" + +class ir_function_can_inline_visitor : public ir_hierarchical_visitor { +public: + ir_function_can_inline_visitor() + { + this->num_returns = 0; + } + + virtual ir_visitor_status visit_enter(ir_return *); + + int num_returns; +}; + +ir_visitor_status +ir_function_can_inline_visitor::visit_enter(ir_return *ir) +{ + (void) ir; + this->num_returns++; + return visit_continue; +} + +bool +can_inline(ir_call *call) +{ + ir_function_can_inline_visitor v; + const ir_function_signature *callee = call->get_callee(); + + v.run((exec_list *) &callee->body); + + ir_instruction *last = (ir_instruction *)callee->body.get_tail(); + if (last && !last->as_return()) + v.num_returns++; + + return v.num_returns == 1; +} diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp new file mode 100644 index 0000000000..e55780c940 --- /dev/null +++ b/src/glsl/ir_function_inlining.cpp @@ -0,0 +1,272 @@ +/* + * 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 ir_function_inlining.cpp + * + * Replaces calls to functions with the body of the function. + */ + +#include +#include "ir.h" +#include "ir_visitor.h" +#include "ir_function_inlining.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" +#include "hash_table.h" + +class ir_function_inlining_visitor : public ir_hierarchical_visitor { +public: + ir_function_inlining_visitor() + { + progress = false; + } + + virtual ~ir_function_inlining_visitor() + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_texture *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + + bool progress; +}; + + +unsigned int hash_func(const void *key) +{ + return (unsigned int)(uintptr_t)key; +} + +int hash_compare_func(const void *key1, const void *key2) +{ + return key1 == key2 ? 0 : 1; +} + +bool +automatic_inlining_predicate(ir_instruction *ir) +{ + ir_call *call = ir->as_call(); + + if (call && can_inline(call)) + return true; + + return false; +} + +bool +do_function_inlining(exec_list *instructions) +{ + ir_function_inlining_visitor v; + + do_expression_flattening(instructions, automatic_inlining_predicate); + + v.run(instructions); + + return v.progress; +} + +static void +replace_return_with_assignment(ir_instruction *ir, void *data) +{ + void *ctx = talloc_parent(ir); + ir_variable *retval = (ir_variable *)data; + ir_return *ret = ir->as_return(); + + if (ret) { + if (ret->value) { + ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval); + ret->insert_before(new(ctx) ir_assignment(lhs, ret->value, NULL)); + ret->remove(); + } else { + /* un-valued return has to be the last return, or we shouldn't + * have reached here. (see can_inline()). + */ + assert(!ret->next->is_tail_sentinal()); + } + } +} + +ir_rvalue * +ir_call::generate_inline(ir_instruction *next_ir) +{ + void *ctx = talloc_parent(this); + ir_variable **parameters; + int num_parameters; + int i; + ir_variable *retval = NULL; + struct hash_table *ht; + + ht = hash_table_ctor(0, hash_func, hash_compare_func); + + num_parameters = 0; + foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters) + num_parameters++; + + parameters = new ir_variable *[num_parameters]; + + /* Generate storage for the return value. */ + if (this->callee->return_type) { + retval = new(ctx) ir_variable(this->callee->return_type, "__retval"); + next_ir->insert_before(retval); + } + + /* Generate the declarations for the parameters to our inlined code, + * and set up the mapping of real function body variables to ours. + */ + i = 0; + exec_list_iterator sig_param_iter = this->callee->parameters.iterator(); + exec_list_iterator param_iter = this->actual_parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); + ir_rvalue *param = (ir_rvalue *) param_iter.get(); + + /* Generate a new variable for the parameter. */ + parameters[i] = (ir_variable *)sig_param->clone(ht); + parameters[i]->mode = ir_var_auto; + next_ir->insert_before(parameters[i]); + + /* Move the actual param into our param variable if it's an 'in' type. */ + if (sig_param->mode == ir_var_in || + sig_param->mode == ir_var_inout) { + ir_assignment *assign; + + assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]), + param, NULL); + next_ir->insert_before(assign); + } + + sig_param_iter.next(); + param_iter.next(); + } + + /* Generate the inlined body of the function. */ + foreach_iter(exec_list_iterator, iter, callee->body) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_instruction *new_ir = ir->clone(ht); + + next_ir->insert_before(new_ir); + visit_tree(new_ir, replace_return_with_assignment, retval); + } + + /* Copy back the value of any 'out' parameters from the function body + * variables to our own. + */ + i = 0; + param_iter = this->actual_parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + ir_instruction *const param = (ir_instruction *) param_iter.get(); + + /* Move our param variable into the actual param if it's an 'out' type. */ + if (parameters[i]->mode == ir_var_out || + parameters[i]->mode == ir_var_inout) { + ir_assignment *assign; + + assign = new(ctx) ir_assignment(param->as_rvalue(), + new(ctx) ir_dereference_variable(parameters[i]), + NULL); + next_ir->insert_before(assign); + } + + param_iter.next(); + } + + delete [] parameters; + + hash_table_dtor(ht); + + if (retval) + return new(ctx) ir_dereference_variable(retval); + else + return NULL; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_expression *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_return *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_texture *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_swizzle *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_call *ir) +{ + if (can_inline(ir)) { + (void) ir->generate_inline(ir); + ir->remove(); + this->progress = true; + } + + return visit_continue; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_assignment *ir) +{ + ir_call *call = ir->rhs->as_call(); + if (!call || !can_inline(call)) + return visit_continue; + + /* generates the parameter setup, function body, and returns the return + * value of the function + */ + ir_rvalue *rhs = call->generate_inline(ir); + assert(rhs); + + ir->rhs = rhs; + this->progress = true; + + return visit_continue; +} diff --git a/src/glsl/ir_function_inlining.h b/src/glsl/ir_function_inlining.h new file mode 100644 index 0000000000..6db011bbca --- /dev/null +++ b/src/glsl/ir_function_inlining.h @@ -0,0 +1,30 @@ +/* + * 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 ir_function_inlining.h + * + * Replaces calls to functions with the body of the function. + */ + +bool can_inline(ir_call *call); diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp new file mode 100644 index 0000000000..0d520b127f --- /dev/null +++ b/src/glsl/ir_hierarchical_visitor.cpp @@ -0,0 +1,284 @@ +/* + * 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 "ir.h" +#include "ir_hierarchical_visitor.h" + +ir_hierarchical_visitor::ir_hierarchical_visitor() +{ + this->callback = NULL; + this->data = NULL; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_variable *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_constant *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_loop_jump *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_dereference_variable *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_loop *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_loop *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_function_signature *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_function_signature *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_function *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_function *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_expression *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_expression *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_texture *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_texture *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_swizzle *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_swizzle *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_assignment *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_assignment *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_call *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_call *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_return *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_return *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_if *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_if *ir) +{ + (void) ir; + return visit_continue; +} + +void +ir_hierarchical_visitor::run(exec_list *instructions) +{ + foreach_list(n, instructions) { + ir_instruction *ir = (ir_instruction *) n; + + if (ir->accept(this) != visit_continue) + break; + } +} + + +void +visit_tree(ir_instruction *ir, + void (*callback)(class ir_instruction *ir, void *data), + void *data) +{ + ir_hierarchical_visitor v; + + v.callback = callback; + v.data = data; + + ir->accept(&v); +} diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h new file mode 100644 index 0000000000..8b9e49dab1 --- /dev/null +++ b/src/glsl/ir_hierarchical_visitor.h @@ -0,0 +1,162 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef IR_HIERARCHICAL_VISITOR_H +#define IR_HIERARCHICAL_VISITOR_H + +/** + * Enumeration values returned by visit methods to guide processing + */ +enum ir_visitor_status { + visit_continue, /**< Continue visiting as normal. */ + visit_continue_with_parent, /**< Don't visit siblings, continue w/parent. */ + visit_stop /**< Stop visiting immediately. */ +}; + + +/** + * Base class of hierarchical visitors of IR instruction trees + * + * Hierarchical visitors differ from traditional visitors in a couple of + * important ways. Rather than having a single \c visit method for each + * subclass in the composite, there are three kinds of visit methods. + * Leaf-node classes have a traditional \c visit method. Internal-node + * classes have a \c visit_enter method, which is invoked just before + * processing child nodes, and a \c visit_leave method which is invoked just + * after processing child nodes. + * + * In addition, each visit method and the \c accept methods in the composite + * have a return value which guides the navigation. Any of the visit methods + * can choose to continue visiting the tree as normal (by returning \c + * visit_continue), terminate visiting any further nodes immediately (by + * returning \c visit_stop), or stop visiting sibling nodes (by returning \c + * visit_continue_with_parent). + * + * These two changes combine to allow nagivation of children to be implemented + * in the composite's \c accept method. The \c accept method for a leaf-node + * class will simply call the \c visit method, as usual, and pass its return + * value on. The \c accept method for internal-node classes will call the \c + * visit_enter method, call the \c accpet method of each child node, and, + * finally, call the \c visit_leave method. If any of these return a value + * other that \c visit_continue, the correct action must be taken. + * + * The final benefit is that the hierarchical visitor base class need not be + * abstract. Default implementations of every \c visit, \c visit_enter, and + * \c visit_leave method can be provided. By default each of these methods + * simply returns \c visit_continue. This allows a significant reduction in + * derived class code. + * + * For more information about hierarchical visitors, see: + * + * http://c2.com/cgi/wiki?HierarchicalVisitorPattern + * http://c2.com/cgi/wiki?HierarchicalVisitorDiscussion + */ + +class ir_hierarchical_visitor { +public: + ir_hierarchical_visitor(); + + /** + * \name Visit methods for leaf-node classes + */ + /*@{*/ + virtual ir_visitor_status visit(class ir_variable *); + virtual ir_visitor_status visit(class ir_constant *); + virtual ir_visitor_status visit(class ir_loop_jump *); + + /** + * ir_dereference_variable isn't technically a leaf, but it is treated as a + * leaf here for a couple reasons. By not automatically visiting the one + * child ir_variable node from the ir_dereference_variable, ir_variable + * nodes can always be handled as variable declarations. Code that used + * non-hierarchical visitors had to set an "in a dereference" flag to + * determine how to handle an ir_variable. By forcing the visitor to + * handle the ir_variable within the ir_dereference_variable visitor, this + * kludge can be avoided. + * + * In addition, I can envision no use for having separate enter and leave + * methods. Anything that could be done in the enter and leave methods + * that couldn't just be done in the visit method. + */ + virtual ir_visitor_status visit(class ir_dereference_variable *); + /*@}*/ + + /** + * \name Visit methods for internal-node classes + */ + /*@{*/ + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_leave(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_leave(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_leave(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_expression *); + virtual ir_visitor_status visit_leave(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_texture *); + virtual ir_visitor_status visit_leave(class ir_texture *); + virtual ir_visitor_status visit_enter(class ir_swizzle *); + virtual ir_visitor_status visit_leave(class ir_swizzle *); + virtual ir_visitor_status visit_enter(class ir_dereference_array *); + virtual ir_visitor_status visit_leave(class ir_dereference_array *); + virtual ir_visitor_status visit_enter(class ir_dereference_record *); + virtual ir_visitor_status visit_leave(class ir_dereference_record *); + virtual ir_visitor_status visit_enter(class ir_assignment *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_leave(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_return *); + virtual ir_visitor_status visit_leave(class ir_return *); + virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_leave(class ir_if *); + /*@}*/ + + + /** + * Utility function to process a linked list of instructions with a visitor + */ + void run(struct exec_list *instructions); + + /** + * Callback function that is invoked on entry to each node visited. + * + * \warning + * Visitor classes derived from \c ir_hierarchical_visitor \b may \b not + * invoke this function. This can be used, for example, to cause the + * callback to be invoked on every node type execpt one. + */ + void (*callback)(class ir_instruction *ir, void *data); + + /** + * Extra data parameter passed to the per-node callback function + */ + void *data; +}; + +void visit_tree(ir_instruction *ir, + void (*callback)(class ir_instruction *ir, void *data), + void *data); + +#endif /* IR_HIERARCHICAL_VISITOR_H */ diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp new file mode 100644 index 0000000000..f936b3500e --- /dev/null +++ b/src/glsl/ir_hv_accept.cpp @@ -0,0 +1,348 @@ +/* + * 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 "ir.h" + +/** + * \file ir_hv_accept.cpp + * Implementations of all hierarchical visitor accept methods for IR + * instructions. + */ + +/** + * Process a list of nodes using a hierarchical vistor + * + * \warning + * This function will operate correctly if a node being processed is removed + * from list. However, if nodes are added to the list after the node being + * processed, some of the added noded may not be processed. + */ +static ir_visitor_status +visit_list_elements(ir_hierarchical_visitor *v, exec_list *l) +{ + exec_node *next; + + for (exec_node *n = l->head; n->next != NULL; n = next) { + next = n->next; + + ir_instruction *const ir = (ir_instruction *) n; + ir_visitor_status s = ir->accept(v); + + if (s != visit_continue) + return s; + } + + return visit_continue; +} + + +ir_visitor_status +ir_variable::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_loop::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->body_instructions); + if (s == visit_stop) + return s; + + if (s != visit_continue_with_parent) { + if (this->from) { + s = this->from->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->to) { + s = this->to->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->increment) { + s = this->increment->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + } + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_loop_jump::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_function_signature::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->body); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_function::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->signatures); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_expression::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + for (unsigned i = 0; i < this->get_num_operands(); i++) { + switch (this->operands[i]->accept(v)) { + case visit_continue: + break; + + case visit_continue_with_parent: + // I wish for Java's labeled break-statement here. + goto done; + + case visit_stop: + return s; + } + } + +done: + return v->visit_leave(this); +} + +ir_visitor_status +ir_texture::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->sampler->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->coordinate->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->projector) { + s = this->projector->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->shadow_comparitor) { + s = this->shadow_comparitor->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + switch (this->op) { + case ir_tex: + break; + case ir_txb: + s = this->lod_info.bias->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + case ir_txl: + case ir_txf: + s = this->lod_info.lod->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + case ir_txd: + s = this->lod_info.grad.dPdx->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->lod_info.grad.dPdy->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + } + + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_swizzle::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->val->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_dereference_variable::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_dereference_array::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->array_index->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->array->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_dereference_record::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->record->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_assignment::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->lhs->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->rhs->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->condition) + s = this->condition->accept(v); + + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_constant::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_call::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->actual_parameters); + if (s == visit_stop) + return s; + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_return::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + ir_rvalue *val = this->get_value(); + if (val) { + s = val->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_if::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->condition->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (s != visit_continue_with_parent) { + s = visit_list_elements(v, &this->then_instructions); + if (s == visit_stop) + return s; + } + + if (s != visit_continue_with_parent) { + s = visit_list_elements(v, &this->else_instructions); + if (s == visit_stop) + return s; + } + + return v->visit_leave(this); +} diff --git a/src/glsl/ir_if_simplification.cpp b/src/glsl/ir_if_simplification.cpp new file mode 100644 index 0000000000..6882ef72b9 --- /dev/null +++ b/src/glsl/ir_if_simplification.cpp @@ -0,0 +1,84 @@ +/* + * 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 ir_function_inlining.cpp + * + * Moves constant branches of if statements out to the surrounding + * instruction stream. + */ + +#include "ir.h" + +class ir_if_simplification_visitor : public ir_hierarchical_visitor { +public: + ir_if_simplification_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_if *); + + bool made_progress; +}; + +bool +do_if_simplification(exec_list *instructions) +{ + ir_if_simplification_visitor v; + + v.run(instructions); + return v.made_progress; +} + + +ir_visitor_status +ir_if_simplification_visitor::visit_leave(ir_if *ir) +{ + /* FINISHME: Ideally there would be a way to note that the condition results + * FINISHME: in a constant before processing both of the other subtrees. + * FINISHME: This can probably be done with some flags, but it would take + * FINISHME: some work to get right. + */ + ir_constant *condition_constant = ir->condition->constant_expression_value(); + if (condition_constant) { + /* Move the contents of the one branch of the conditional + * that matters out. + */ + if (condition_constant->value.b[0]) { + foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + ir->insert_before(then_ir); + } + } else { + foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + ir->insert_before(else_ir); + } + } + ir->remove(); + this->made_progress = true; + } + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h new file mode 100644 index 0000000000..432a33458c --- /dev/null +++ b/src/glsl/ir_optimization.h @@ -0,0 +1,41 @@ +/* + * 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 ir_dead_code.h + * + * Prototypes for optimization passes to be called by the compiler and drivers. + */ + +bool do_constant_folding(exec_list *instructions); +bool do_constant_variable(exec_list *instructions); +bool do_constant_variable_unlinked(exec_list *instructions); +bool do_copy_propagation(exec_list *instructions); +bool do_dead_code(exec_list *instructions); +bool do_dead_code_local(exec_list *instructions); +bool do_dead_code_unlinked(exec_list *instructions); +bool do_function_inlining(exec_list *instructions); +bool do_if_simplification(exec_list *instructions); +bool do_swizzle_swizzle(exec_list *instructions); +bool do_vec_index_to_swizzle(exec_list *instructions); diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp new file mode 100644 index 0000000000..be5a843f67 --- /dev/null +++ b/src/glsl/ir_print_visitor.cpp @@ -0,0 +1,373 @@ +/* + * 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 "ir_print_visitor.h" +#include "glsl_types.h" +#include "glsl_parser_extras.h" + +static void print_type(const glsl_type *t); + +void +ir_instruction::print(void) const +{ + ir_instruction *deconsted = const_cast(this); + + ir_print_visitor v; + deconsted->accept(&v); +} + +void +_mesa_print_ir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0; i < state->num_user_structures; i++) { + const glsl_type *const s = state->user_structures[i]; + + printf("(structure (%s) (%s@%p) (%u) (\n", + s->name, s->name, s, s->length); + + for (unsigned j = 0; j < s->length; j++) { + printf("\t(("); + print_type(s->fields.structure[j].type); + printf(")(%s))\n", s->fields.structure[j].name); + } + + printf(")\n"); + } + + printf("(\n"); + foreach_iter(exec_list_iterator, iter, *instructions) { + ((ir_instruction *)iter.get())->print(); + printf("\n"); + } + printf("\n)"); +} + +static void +print_type(const glsl_type *t) +{ + if (t->base_type == GLSL_TYPE_ARRAY) { + printf("(array "); + print_type(t->fields.array); + printf(" %u)", t->length); + } else if ((t->base_type == GLSL_TYPE_STRUCT) + && (strncmp("gl_", t->name, 3) != 0)) { + printf("%s@%p", t->name, t); + } else { + printf("%s", t->name); + } +} + + +void ir_print_visitor::visit(ir_variable *ir) +{ + printf("(declare "); + + const char *const cent = (ir->centroid) ? "centroid " : ""; + const char *const inv = (ir->invariant) ? "invariant " : ""; + const char *const mode[] = { "", "uniform ", "in ", "out ", "inout " }; + const char *const interp[] = { "", "flat", "noperspective" }; + + printf("(%s%s%s%s) ", + cent, inv, mode[ir->mode], interp[ir->interpolation]); + + print_type(ir->type); + printf(" %s@%p)", ir->name, ir); +} + + +void ir_print_visitor::visit(ir_function_signature *ir) +{ + printf("(signature "); + print_type(ir->return_type); + printf("\n (parameters\n"); + foreach_iter(exec_list_iterator, iter, ir->parameters) { + ir_variable *const inst = (ir_variable *) iter.get(); + + inst->accept(this); + printf("\n"); + } + printf(" )\n("); + + foreach_iter(exec_list_iterator, iter, ir->body) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + printf("\n"); + } + printf("))\n"); +} + + +void ir_print_visitor::visit(ir_function *ir) +{ + printf("(function %s\n", ir->name); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_function_signature *const sig = (ir_function_signature *) iter.get(); + + sig->accept(this); + printf("\n"); + } + + printf(")\n"); +} + + +void ir_print_visitor::visit(ir_expression *ir) +{ + printf("(expression "); + + print_type(ir->type); + + printf(" %s ", ir->operator_string()); + + if (ir->operands[0]) + ir->operands[0]->accept(this); + + if (ir->operands[1]) + ir->operands[1]->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_texture *ir) +{ + printf("(%s ", ir->opcode_string()); + + ir->sampler->accept(this); + printf(" "); + + ir->coordinate->accept(this); + + printf(" (%d %d %d) ", ir->offsets[0], ir->offsets[1], ir->offsets[2]); + + if (ir->op != ir_txf) { + if (ir->projector) + ir->projector->accept(this); + else + printf("1"); + + if (ir->shadow_comparitor) { + printf(" "); + ir->shadow_comparitor->accept(this); + } else { + printf(" ()"); + } + } + + printf(" "); + switch (ir->op) + { + case ir_tex: + break; + case ir_txb: + ir->lod_info.bias->accept(this); + break; + case ir_txl: + case ir_txf: + ir->lod_info.lod->accept(this); + break; + case ir_txd: + printf("("); + ir->lod_info.grad.dPdx->accept(this); + printf(" "); + ir->lod_info.grad.dPdy->accept(this); + printf(")"); + break; + }; + printf(")"); +} + + +void ir_print_visitor::visit(ir_swizzle *ir) +{ + const unsigned swiz[4] = { + ir->mask.x, + ir->mask.y, + ir->mask.z, + ir->mask.w, + }; + + printf("(swiz "); + for (unsigned i = 0; i < ir->mask.num_components; i++) { + printf("%c", "xyzw"[swiz[i]]); + } + printf(" "); + ir->val->accept(this); + printf(")"); +} + + +void ir_print_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *var = ir->variable_referenced(); + printf("(var_ref %s@%p) ", var->name, var); +} + + +void ir_print_visitor::visit(ir_dereference_array *ir) +{ + printf("(array_ref "); + ir->array->accept(this); + ir->array_index->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_dereference_record *ir) +{ + printf("(record_ref "); + ir->record->accept(this); + printf(" %s) ", ir->field); +} + + +void ir_print_visitor::visit(ir_assignment *ir) +{ + printf("(assign "); + + if (ir->condition) + ir->condition->accept(this); + else + printf("(constant bool (1))"); + + printf(" "); + + ir->lhs->accept(this); + + printf(" "); + + ir->rhs->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_constant *ir) +{ + const glsl_type *const base_type = ir->type->get_base_type(); + + printf("(constant "); + print_type(ir->type); + printf(" ("); + + for (unsigned i = 0; i < ir->type->components(); i++) { + if (i != 0) + printf(", "); + + switch (base_type->base_type) { + case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; + case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; + case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; + case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; + default: assert(0); + } + } + printf(")) "); +} + + +void +ir_print_visitor::visit(ir_call *ir) +{ + printf("(call %s (", ir->callee_name()); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + } + printf("))\n"); +} + + +void +ir_print_visitor::visit(ir_return *ir) +{ + printf("(return"); + + ir_rvalue *const value = ir->get_value(); + if (value) { + printf(" "); + value->accept(this); + } + + printf(")"); +} + + +void +ir_print_visitor::visit(ir_if *ir) +{ + printf("(if "); + ir->condition->accept(this); + + printf("(\n"); + foreach_iter(exec_list_iterator, iter, ir->then_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + printf("\n"); + } + printf(")\n"); + + printf("(\n"); + foreach_iter(exec_list_iterator, iter, ir->else_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + printf("\n"); + } + printf("))\n"); +} + + +void +ir_print_visitor::visit(ir_loop *ir) +{ + printf("(loop ("); + if (ir->counter != NULL) + ir->counter->accept(this); + printf(") ("); + if (ir->from != NULL) + ir->from->accept(this); + printf(") ("); + if (ir->to != NULL) + ir->to->accept(this); + printf(") ("); + if (ir->increment != NULL) + ir->increment->accept(this); + printf(") (\n"); + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + printf("\n"); + } + printf("))\n"); +} + + +void +ir_print_visitor::visit(ir_loop_jump *ir) +{ + printf("%s", ir->is_break() ? "break" : "continue"); +} diff --git a/src/glsl/ir_print_visitor.h b/src/glsl/ir_print_visitor.h new file mode 100644 index 0000000000..e97b823522 --- /dev/null +++ b/src/glsl/ir_print_visitor.h @@ -0,0 +1,81 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef IR_PRINT_VISITOR_H +#define IR_PRINT_VISITOR_H + +#include "ir.h" +#include "ir_visitor.h" + +extern void _mesa_print_ir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +/** + * Abstract base class of visitors of IR instruction trees + */ +class ir_print_visitor : public ir_visitor { +public: + ir_print_visitor() + : deref_depth(0) + { + /* empty */ + } + + virtual ~ir_print_visitor() + { + /* empty */ + } + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_texture *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_if *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + /*@}*/ + +private: + int deref_depth; +}; + +#endif /* IR_PRINT_VISITOR_H */ diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp new file mode 100644 index 0000000000..7383c42cbc --- /dev/null +++ b/src/glsl/ir_reader.cpp @@ -0,0 +1,1053 @@ +/* + * 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 + +extern "C" { +#include +} + +#include "ir_reader.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" +#include "s_expression.h" + +static void ir_read_error(_mesa_glsl_parse_state *, s_expression *, + const char *fmt, ...); +static const glsl_type *read_type(_mesa_glsl_parse_state *, s_expression *); + +static void scan_for_prototypes(_mesa_glsl_parse_state *, exec_list *, + s_expression *); +static ir_function *read_function(_mesa_glsl_parse_state *, s_list *, + bool skip_body); +static void read_function_sig(_mesa_glsl_parse_state *, ir_function *, + s_list *, bool skip_body); + +static void read_instructions(_mesa_glsl_parse_state *, exec_list *, + s_expression *, ir_loop *); +static ir_instruction *read_instruction(_mesa_glsl_parse_state *, + s_expression *, ir_loop *); +static ir_variable *read_declaration(_mesa_glsl_parse_state *, s_list *); +static ir_if *read_if(_mesa_glsl_parse_state *, s_list *, ir_loop *); +static ir_loop *read_loop(_mesa_glsl_parse_state *st, s_list *list); +static ir_return *read_return(_mesa_glsl_parse_state *, s_list *); + +static ir_rvalue *read_rvalue(_mesa_glsl_parse_state *, s_expression *); +static ir_assignment *read_assignment(_mesa_glsl_parse_state *, s_list *); +static ir_expression *read_expression(_mesa_glsl_parse_state *, s_list *); +static ir_call *read_call(_mesa_glsl_parse_state *, s_list *); +static ir_swizzle *read_swizzle(_mesa_glsl_parse_state *, s_list *); +static ir_constant *read_constant(_mesa_glsl_parse_state *, s_list *); +static ir_texture *read_texture(_mesa_glsl_parse_state *, s_list *); + +static ir_dereference *read_dereference(_mesa_glsl_parse_state *, + s_expression *); +static ir_dereference *read_var_ref(_mesa_glsl_parse_state *, s_list *); +static ir_dereference *read_array_ref(_mesa_glsl_parse_state *, s_list *); +static ir_dereference *read_record_ref(_mesa_glsl_parse_state *, s_list *); + +void +_mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, + const char *src) +{ + void *ctx = talloc_parent(state); + s_expression *expr = s_expression::read_expression(ctx, src); + if (expr == NULL) { + ir_read_error(state, NULL, "couldn't parse S-Expression."); + return; + } + + scan_for_prototypes(state, instructions, expr); + if (state->error) + return; + + read_instructions(state, instructions, expr, NULL); +} + +static void +ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr, + const char *fmt, ...) +{ + va_list ap; + + state->error = true; + + state->info_log = talloc_strdup_append(state->info_log, "error: "); + + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); + + if (expr != NULL) { + state->info_log = talloc_strdup_append(state->info_log, + "...in this context:\n "); + expr->print(); + state->info_log = talloc_strdup_append(state->info_log, "\n\n"); + } +} + +static const glsl_type * +read_type(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list != NULL) { + s_symbol *type_sym = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (type_sym == NULL) { + ir_read_error(st, expr, "expected type (array ...) or (struct ...)"); + return NULL; + } + if (strcmp(type_sym->value(), "array") == 0) { + if (list->length() != 3) { + ir_read_error(st, expr, "expected type (array )"); + return NULL; + } + + // Read base type + s_expression *base_expr = (s_expression*) type_sym->next; + const glsl_type *base_type = read_type(st, base_expr); + if (base_type == NULL) { + ir_read_error(st, NULL, "when reading base type of array"); + return NULL; + } + + // Read array size + s_int *size = SX_AS_INT(base_expr->next); + if (size == NULL) { + ir_read_error(st, expr, "found non-integer array size"); + return NULL; + } + + return glsl_type::get_array_instance(st, base_type, size->value()); + } else if (strcmp(type_sym->value(), "struct") == 0) { + assert(false); // FINISHME + } else { + ir_read_error(st, expr, "expected (array ...) or (struct ...); " + "found (%s ...)", type_sym->value()); + return NULL; + } + } + + s_symbol *type_sym = SX_AS_SYMBOL(expr); + if (type_sym == NULL) { + ir_read_error(st, expr, "expected (symbol or list)"); + return NULL; + } + + const glsl_type *type = st->symbols->get_type(type_sym->value()); + if (type == NULL) + ir_read_error(st, expr, "invalid type: %s", type_sym->value()); + + return type; +} + + +static void +scan_for_prototypes(_mesa_glsl_parse_state *st, exec_list *instructions, + s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL) { + ir_read_error(st, expr, "Expected ( ...); found an atom."); + return; + } + + foreach_iter(exec_list_iterator, it, list->subexpressions) { + s_list *sub = SX_AS_LIST(it.get()); + if (sub == NULL) + continue; // not a (function ...); ignore it. + + s_symbol *tag = SX_AS_SYMBOL(sub->subexpressions.get_head()); + if (tag == NULL || strcmp(tag->value(), "function") != 0) + continue; // not a (function ...); ignore it. + + ir_function *f = read_function(st, sub, true); + if (f == NULL) + return; + instructions->push_tail(f); + } +} + +static ir_function * +read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) +{ + void *ctx = talloc_parent(st); + if (list->length() < 3) { + ir_read_error(st, list, "Expected (function (signature ...) ...)"); + return NULL; + } + + s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next); + if (name == NULL) { + ir_read_error(st, list, "Expected (function ...)"); + return NULL; + } + + ir_function *f = st->symbols->get_function(name->value()); + if (f == NULL) { + f = new(ctx) ir_function(name->value()); + bool added = st->symbols->add_function(name->value(), f); + assert(added); + } + + exec_list_iterator it = list->subexpressions.iterator(); + it.next(); // skip "function" tag + it.next(); // skip function name + for (/* nothing */; it.has_next(); it.next()) { + s_list *siglist = SX_AS_LIST(it.get()); + if (siglist == NULL) { + ir_read_error(st, list, "Expected (function (signature ...) ...)"); + return NULL; + } + + s_symbol *tag = SX_AS_SYMBOL(siglist->subexpressions.get_head()); + if (tag == NULL || strcmp(tag->value(), "signature") != 0) { + ir_read_error(st, siglist, "Expected (signature ...)"); + return NULL; + } + + read_function_sig(st, f, siglist, skip_body); + } + return f; +} + +static void +read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, + bool skip_body) +{ + void *ctx = talloc_parent(st); + if (list->length() != 4) { + ir_read_error(st, list, "Expected (signature (parameters ...) " + "( ...))"); + return; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *return_type = read_type(st, type_expr); + if (return_type == NULL) + return; + + s_list *paramlist = SX_AS_LIST(type_expr->next); + s_list *body_list = SX_AS_LIST(paramlist->next); + if (paramlist == NULL || body_list == NULL) { + ir_read_error(st, list, "Expected (signature (parameters ...) " + "( ...))"); + return; + } + s_symbol *paramtag = SX_AS_SYMBOL(paramlist->subexpressions.get_head()); + if (paramtag == NULL || strcmp(paramtag->value(), "parameters") != 0) { + ir_read_error(st, paramlist, "Expected (parameters ...)"); + return; + } + + // Read the parameters list into a temporary place. + exec_list hir_parameters; + st->symbols->push_scope(); + + exec_list_iterator it = paramlist->subexpressions.iterator(); + for (it.next() /* skip "parameters" */; it.has_next(); it.next()) { + s_list *decl = SX_AS_LIST(it.get()); + ir_variable *var = read_declaration(st, decl); + if (var == NULL) + return; + + hir_parameters.push_tail(var); + } + + ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); + if (sig != NULL) { + const char *badvar = sig->qualifiers_match(&hir_parameters); + if (badvar != NULL) { + ir_read_error(st, list, "function `%s' parameter `%s' qualifiers " + "don't match prototype", f->name, badvar); + return; + } + + if (sig->return_type != return_type) { + ir_read_error(st, list, "function `%s' return type doesn't " + "match prototype", f->name); + return; + } + } else { + sig = new(ctx) ir_function_signature(return_type); + f->add_signature(sig); + } + + sig->replace_parameters(&hir_parameters); + + if (!skip_body) { + if (sig->is_defined) { + ir_read_error(st, list, "function %s redefined", f->name); + return; + } + read_instructions(st, &sig->body, body_list, NULL); + sig->is_defined = true; + } + + st->symbols->pop_scope(); +} + +static void +read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions, + s_expression *expr, ir_loop *loop_ctx) +{ + // Read in a list of instructions + s_list *list = SX_AS_LIST(expr); + if (list == NULL) { + ir_read_error(st, expr, "Expected ( ...); found an atom."); + return; + } + + foreach_iter(exec_list_iterator, it, list->subexpressions) { + s_expression *sub = (s_expression*) it.get(); + ir_instruction *ir = read_instruction(st, sub, loop_ctx); + if (ir == NULL) { + ir_read_error(st, sub, "Invalid instruction.\n"); + return; + } + instructions->push_tail(ir); + } +} + + +static ir_instruction * +read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, + ir_loop *loop_ctx) +{ + void *ctx = talloc_parent(st); + s_symbol *symbol = SX_AS_SYMBOL(expr); + if (symbol != NULL) { + if (strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL) + return new(ctx) ir_loop_jump(ir_loop_jump::jump_break); + if (strcmp(symbol->value(), "continue") == 0 && loop_ctx != NULL) + return new(ctx) ir_loop_jump(ir_loop_jump::jump_continue); + } + + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) + return NULL; + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (tag == NULL) { + ir_read_error(st, expr, "expected instruction tag"); + return NULL; + } + + ir_instruction *inst = NULL; + if (strcmp(tag->value(), "declare") == 0) { + inst = read_declaration(st, list); + } else if (strcmp(tag->value(), "if") == 0) { + inst = read_if(st, list, loop_ctx); + } else if (strcmp(tag->value(), "loop") == 0) { + inst = read_loop(st, list); + } else if (strcmp(tag->value(), "return") == 0) { + inst = read_return(st, list); + } else if (strcmp(tag->value(), "function") == 0) { + inst = read_function(st, list, false); + } else { + inst = read_rvalue(st, list); + if (inst == NULL) + ir_read_error(st, NULL, "when reading instruction"); + } + return inst; +} + + +static ir_variable * +read_declaration(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 4) { + ir_read_error(st, list, "expected (declare () " + ")"); + return NULL; + } + + s_list *quals = SX_AS_LIST(list->subexpressions.head->next); + if (quals == NULL) { + ir_read_error(st, list, "expected a list of variable qualifiers"); + return NULL; + } + + s_expression *type_expr = (s_expression*) quals->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + s_symbol *var_name = SX_AS_SYMBOL(type_expr->next); + if (var_name == NULL) { + ir_read_error(st, list, "expected variable name, found non-symbol"); + return NULL; + } + + ir_variable *var = new(ctx) ir_variable(type, var_name->value()); + + foreach_iter(exec_list_iterator, it, quals->subexpressions) { + s_symbol *qualifier = SX_AS_SYMBOL(it.get()); + if (qualifier == NULL) { + ir_read_error(st, list, "qualifier list must contain only symbols"); + delete var; + return NULL; + } + + // FINISHME: Check for duplicate/conflicting qualifiers. + if (strcmp(qualifier->value(), "centroid") == 0) { + var->centroid = 1; + } else if (strcmp(qualifier->value(), "invariant") == 0) { + var->invariant = 1; + } else if (strcmp(qualifier->value(), "uniform") == 0) { + var->mode = ir_var_uniform; + } else if (strcmp(qualifier->value(), "auto") == 0) { + var->mode = ir_var_auto; + } else if (strcmp(qualifier->value(), "in") == 0) { + var->mode = ir_var_in; + } else if (strcmp(qualifier->value(), "out") == 0) { + var->mode = ir_var_out; + } else if (strcmp(qualifier->value(), "inout") == 0) { + var->mode = ir_var_inout; + } else if (strcmp(qualifier->value(), "smooth") == 0) { + var->interpolation = ir_var_smooth; + } else if (strcmp(qualifier->value(), "flat") == 0) { + var->interpolation = ir_var_flat; + } else if (strcmp(qualifier->value(), "noperspective") == 0) { + var->interpolation = ir_var_noperspective; + } else { + ir_read_error(st, list, "unknown qualifier: %s", qualifier->value()); + delete var; + return NULL; + } + } + + // Add the variable to the symbol table + st->symbols->add_variable(var_name->value(), var); + + return var; +} + + +static ir_if * +read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx) +{ + void *ctx = talloc_parent(st); + if (list->length() != 4) { + ir_read_error(st, list, "expected (if ( ...) " + "( ...))"); + return NULL; + } + + s_expression *cond_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *condition = read_rvalue(st, cond_expr); + if (condition == NULL) { + ir_read_error(st, NULL, "when reading condition of (if ...)"); + return NULL; + } + + s_expression *then_expr = (s_expression*) cond_expr->next; + s_expression *else_expr = (s_expression*) then_expr->next; + + ir_if *iff = new(ctx) ir_if(condition); + + read_instructions(st, &iff->then_instructions, then_expr, loop_ctx); + read_instructions(st, &iff->else_instructions, else_expr, loop_ctx); + if (st->error) { + delete iff; + iff = NULL; + } + return iff; +} + + +static ir_loop * +read_loop(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 6) { + ir_read_error(st, list, "expected (loop " + " )"); + return NULL; + } + + s_expression *count_expr = (s_expression*) list->subexpressions.head->next; + s_expression *from_expr = (s_expression*) count_expr->next; + s_expression *to_expr = (s_expression*) from_expr->next; + s_expression *inc_expr = (s_expression*) to_expr->next; + s_expression *body_expr = (s_expression*) inc_expr->next; + + // FINISHME: actually read the count/from/to fields. + + ir_loop *loop = new(ctx) ir_loop; + read_instructions(st, &loop->body_instructions, body_expr, loop); + if (st->error) { + delete loop; + loop = NULL; + } + return loop; +} + + +static ir_return * +read_return(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 2) { + ir_read_error(st, list, "expected (return )"); + return NULL; + } + + s_expression *expr = (s_expression*) list->subexpressions.head->next; + + ir_rvalue *retval = read_rvalue(st, expr); + if (retval == NULL) { + ir_read_error(st, NULL, "when reading return value"); + return NULL; + } + + return new(ctx) ir_return(retval); +} + + +static ir_rvalue * +read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) + return NULL; + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (tag == NULL) { + ir_read_error(st, expr, "expected rvalue tag"); + return NULL; + } + + ir_rvalue *rvalue = read_dereference(st, list); + if (rvalue != NULL || st->error) + return rvalue; + else if (strcmp(tag->value(), "swiz") == 0) { + rvalue = read_swizzle(st, list); + } else if (strcmp(tag->value(), "assign") == 0) { + rvalue = read_assignment(st, list); + } else if (strcmp(tag->value(), "expression") == 0) { + rvalue = read_expression(st, list); + } else if (strcmp(tag->value(), "call") == 0) { + rvalue = read_call(st, list); + } else if (strcmp(tag->value(), "constant") == 0) { + rvalue = read_constant(st, list); + } else { + rvalue = read_texture(st, list); + if (rvalue == NULL && !st->error) + ir_read_error(st, expr, "unrecognized rvalue tag: %s", tag->value()); + } + + return rvalue; +} + +static ir_assignment * +read_assignment(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 4) { + ir_read_error(st, list, "expected (assign )"); + return NULL; + } + + s_expression *cond_expr = (s_expression*) list->subexpressions.head->next; + s_expression *lhs_expr = (s_expression*) cond_expr->next; + s_expression *rhs_expr = (s_expression*) lhs_expr->next; + + // FINISHME: Deal with "true" condition + ir_rvalue *condition = read_rvalue(st, cond_expr); + if (condition == NULL) { + ir_read_error(st, NULL, "when reading condition of assignment"); + return NULL; + } + + ir_rvalue *lhs = read_rvalue(st, lhs_expr); + if (lhs == NULL) { + ir_read_error(st, NULL, "when reading left-hand side of assignment"); + return NULL; + } + + ir_rvalue *rhs = read_rvalue(st, rhs_expr); + if (rhs == NULL) { + ir_read_error(st, NULL, "when reading right-hand side of assignment"); + return NULL; + } + + return new(ctx) ir_assignment(lhs, rhs, condition); +} + +static ir_call * +read_call(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 3) { + ir_read_error(st, list, "expected (call ( ...))"); + return NULL; + } + + s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next); + s_list *params = SX_AS_LIST(name->next); + if (name == NULL || params == NULL) { + ir_read_error(st, list, "expected (call ( ...))"); + return NULL; + } + + exec_list parameters; + + foreach_iter(exec_list_iterator, it, params->subexpressions) { + s_expression *expr = (s_expression*) it.get(); + ir_rvalue *param = read_rvalue(st, expr); + if (param == NULL) { + ir_read_error(st, list, "when reading parameter to function call"); + return NULL; + } + parameters.push_tail(param); + } + + ir_function *f = st->symbols->get_function(name->value()); + if (f == NULL) { + ir_read_error(st, list, "found call to undefined function %s", + name->value()); + return NULL; + } + + const ir_function_signature *callee = f->matching_signature(¶meters); + if (callee == NULL) { + ir_read_error(st, list, "couldn't find matching signature for function " + "%s", name->value()); + return NULL; + } + + return new(ctx) ir_call(callee, ¶meters); +} + +static ir_expression * +read_expression(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + const unsigned list_length = list->length(); + if (list_length < 4) { + ir_read_error(st, list, "expected (expression " + " [])"); + return NULL; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + /* Read the operator */ + s_symbol *op_sym = SX_AS_SYMBOL(type_expr->next); + if (op_sym == NULL) { + ir_read_error(st, list, "expected operator, found non-symbol"); + return NULL; + } + + ir_expression_operation op = ir_expression::get_operator(op_sym->value()); + if (op == (ir_expression_operation) -1) { + ir_read_error(st, list, "invalid operator: %s", op_sym->value()); + return NULL; + } + + /* Now that we know the operator, check for the right number of operands */ + if (ir_expression::get_num_operands(op) == 2) { + if (list_length != 5) { + ir_read_error(st, list, "expected (expression %s " + " )", op_sym->value()); + return NULL; + } + } else { + if (list_length != 4) { + ir_read_error(st, list, "expected (expression %s )", + op_sym->value()); + return NULL; + } + } + + s_expression *exp1 = (s_expression*) (op_sym->next); + ir_rvalue *arg1 = read_rvalue(st, exp1); + if (arg1 == NULL) { + ir_read_error(st, NULL, "when reading first operand of %s", + op_sym->value()); + return NULL; + } + + ir_rvalue *arg2 = NULL; + if (ir_expression::get_num_operands(op) == 2) { + s_expression *exp2 = (s_expression*) (exp1->next); + arg2 = read_rvalue(st, exp2); + if (arg2 == NULL) { + ir_read_error(st, NULL, "when reading second operand of %s", + op_sym->value()); + return NULL; + } + } + + return new(ctx) ir_expression(op, type, arg1, arg2); +} + +static ir_swizzle * +read_swizzle(_mesa_glsl_parse_state *st, s_list *list) +{ + if (list->length() != 3) { + ir_read_error(st, list, "expected (swiz )"); + return NULL; + } + + s_symbol *swiz = SX_AS_SYMBOL(list->subexpressions.head->next); + if (swiz == NULL) { + ir_read_error(st, list, "expected a valid swizzle; found non-symbol"); + return NULL; + } + + if (strlen(swiz->value()) > 4) { + ir_read_error(st, list, "expected a valid swizzle; found %s", + swiz->value()); + return NULL; + } + + s_expression *sub = (s_expression*) swiz->next; + if (sub == NULL) { + ir_read_error(st, list, "expected rvalue: (swizzle %s )", + swiz->value()); + return NULL; + } + + ir_rvalue *rvalue = read_rvalue(st, sub); + if (rvalue == NULL) + return NULL; + + ir_swizzle *ir = ir_swizzle::create(rvalue, swiz->value(), + rvalue->type->vector_elements); + if (ir == NULL) + ir_read_error(st, list, "invalid swizzle"); + + return ir; +} + +static ir_constant * +read_constant(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 3) { + ir_read_error(st, list, "expected (constant ( ... ))"); + return NULL; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + s_list *values = SX_AS_LIST(type_expr->next); + if (values == NULL) { + ir_read_error(st, list, "expected (constant ( ... ))"); + return NULL; + } + + const glsl_type *const base_type = type->get_base_type(); + + ir_constant_data data; + + // Read in list of values (at most 16). + int k = 0; + foreach_iter(exec_list_iterator, it, values->subexpressions) { + if (k >= 16) { + ir_read_error(st, values, "expected at most 16 numbers"); + return NULL; + } + + s_expression *expr = (s_expression*) it.get(); + + if (base_type->base_type == GLSL_TYPE_FLOAT) { + s_number *value = SX_AS_NUMBER(expr); + if (value == NULL) { + ir_read_error(st, values, "expected numbers"); + return NULL; + } + data.f[k] = value->fvalue(); + } else { + s_int *value = SX_AS_INT(expr); + if (value == NULL) { + ir_read_error(st, values, "expected integers"); + return NULL; + } + + switch (base_type->base_type) { + case GLSL_TYPE_UINT: { + data.u[k] = value->value(); + break; + } + case GLSL_TYPE_INT: { + data.i[k] = value->value(); + break; + } + case GLSL_TYPE_BOOL: { + data.b[k] = value->value(); + break; + } + default: + ir_read_error(st, values, "unsupported constant type"); + return NULL; + } + } + ++k; + } + + return new(ctx) ir_constant(type, &data); +} + +static ir_dereference * +read_dereference(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) + return NULL; + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head); + assert(tag != NULL); + + if (strcmp(tag->value(), "var_ref") == 0) + return read_var_ref(st, list); + if (strcmp(tag->value(), "array_ref") == 0) + return read_array_ref(st, list); + if (strcmp(tag->value(), "record_ref") == 0) + return read_record_ref(st, list); + return NULL; +} + +static ir_dereference * +read_var_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 2) { + ir_read_error(st, list, "expected (var_ref )"); + return NULL; + } + s_symbol *var_name = SX_AS_SYMBOL(list->subexpressions.head->next); + if (var_name == NULL) { + ir_read_error(st, list, "expected (var_ref )"); + return NULL; + } + + ir_variable *var = st->symbols->get_variable(var_name->value()); + if (var == NULL) { + ir_read_error(st, list, "undeclared variable: %s", var_name->value()); + return NULL; + } + + return new(ctx) ir_dereference_variable(var); +} + +static ir_dereference * +read_array_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 3) { + ir_read_error(st, list, "expected (array_ref )"); + return NULL; + } + + s_expression *subj_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *subject = read_rvalue(st, subj_expr); + if (subject == NULL) { + ir_read_error(st, NULL, "when reading the subject of an array_ref"); + return NULL; + } + + s_expression *idx_expr = (s_expression*) subj_expr->next; + ir_rvalue *idx = read_rvalue(st, idx_expr); + return new(ctx) ir_dereference_array(subject, idx); +} + +static ir_dereference * +read_record_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + if (list->length() != 3) { + ir_read_error(st, list, "expected (record_ref )"); + return NULL; + } + + s_expression *subj_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *subject = read_rvalue(st, subj_expr); + if (subject == NULL) { + ir_read_error(st, NULL, "when reading the subject of a record_ref"); + return NULL; + } + + s_symbol *field = SX_AS_SYMBOL(subj_expr->next); + if (field == NULL) { + ir_read_error(st, list, "expected (record_ref ... )"); + return NULL; + } + return new(ctx) ir_dereference_record(subject, field->value()); +} + +static bool +valid_texture_list_length(ir_texture_opcode op, s_list *list) +{ + unsigned required_length = 7; + if (op == ir_txf) + required_length = 5; + else if (op == ir_tex) + required_length = 6; + + return list->length() == required_length; +} + +static ir_texture * +read_texture(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = talloc_parent(st); + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head); + assert(tag != NULL); + + ir_texture_opcode op = ir_texture::get_opcode(tag->value()); + if (op == (ir_texture_opcode) -1) + return NULL; + + if (!valid_texture_list_length(op, list)) { + ir_read_error(st, NULL, "invalid list size in (%s ...)", tag->value()); + return NULL; + } + + ir_texture *tex = new(ctx) ir_texture(op); + + // Read sampler (must be a deref) + s_expression *sampler_expr = (s_expression *) tag->next; + ir_dereference *sampler = read_dereference(st, sampler_expr); + if (sampler == NULL) { + ir_read_error(st, NULL, "when reading sampler in (%s ...)", tag->value()); + return NULL; + } + tex->set_sampler(sampler); + + // Read coordinate (any rvalue) + s_expression *coordinate_expr = (s_expression *) sampler_expr->next; + tex->coordinate = read_rvalue(st, coordinate_expr); + if (tex->coordinate == NULL) { + ir_read_error(st, NULL, "when reading coordinate in (%s ...)", + tag->value()); + return NULL; + } + + // Read texel offset, i.e. (0 0 0) + s_list *offset_list = SX_AS_LIST(coordinate_expr->next); + if (offset_list == NULL || offset_list->length() != 3) { + ir_read_error(st, offset_list, "expected ( )"); + return NULL; + } + s_int *offset_x = SX_AS_INT(offset_list->subexpressions.head); + s_int *offset_y = SX_AS_INT(offset_x->next); + s_int *offset_z = SX_AS_INT(offset_y->next); + if (offset_x == NULL || offset_y == NULL || offset_z == NULL) { + ir_read_error(st, offset_list, "expected ( )"); + return NULL; + } + tex->offsets[0] = offset_x->value(); + tex->offsets[1] = offset_y->value(); + tex->offsets[2] = offset_z->value(); + + if (op == ir_txf) { + s_expression *lod_expr = (s_expression *) offset_list->next; + tex->lod_info.lod = read_rvalue(st, lod_expr); + if (tex->lod_info.lod == NULL) { + ir_read_error(st, NULL, "when reading LOD in (txf ...)"); + return NULL; + } + } else { + s_expression *proj_expr = (s_expression *) offset_list->next; + s_int *proj_as_int = SX_AS_INT(proj_expr); + if (proj_as_int && proj_as_int->value() == 1) { + tex->projector = NULL; + } else { + tex->projector = read_rvalue(st, proj_expr); + if (tex->projector == NULL) { + ir_read_error(st, NULL, "when reading projective divide in (%s ..)", + tag->value()); + return NULL; + } + } + + s_list *shadow_list = SX_AS_LIST(proj_expr->next); + if (shadow_list == NULL) { + ir_read_error(st, NULL, "shadow comparitor must be a list"); + return NULL; + } + if (shadow_list->subexpressions.is_empty()) { + tex->shadow_comparitor= NULL; + } else { + tex->shadow_comparitor = read_rvalue(st, shadow_list); + if (tex->shadow_comparitor == NULL) { + ir_read_error(st, NULL, "when reading shadow comparitor in (%s ..)", + tag->value()); + return NULL; + } + } + s_expression *lod_expr = (s_expression *) shadow_list->next; + + switch (op) { + case ir_txb: + tex->lod_info.bias = read_rvalue(st, lod_expr); + if (tex->lod_info.bias == NULL) { + ir_read_error(st, NULL, "when reading LOD bias in (txb ...)"); + return NULL; + } + break; + case ir_txl: + tex->lod_info.lod = read_rvalue(st, lod_expr); + if (tex->lod_info.lod == NULL) { + ir_read_error(st, NULL, "when reading LOD in (txl ...)"); + return NULL; + } + break; + case ir_txd: { + s_list *lod_list = SX_AS_LIST(lod_expr); + if (lod_list->length() != 2) { + ir_read_error(st, lod_expr, "expected (dPdx dPdy) in (txd ...)"); + return NULL; + } + s_expression *dx_expr = (s_expression *) lod_list->subexpressions.head; + s_expression *dy_expr = (s_expression *) dx_expr->next; + + tex->lod_info.grad.dPdx = read_rvalue(st, dx_expr); + if (tex->lod_info.grad.dPdx == NULL) { + ir_read_error(st, NULL, "when reading dPdx in (txd ...)"); + return NULL; + } + tex->lod_info.grad.dPdy = read_rvalue(st, dy_expr); + if (tex->lod_info.grad.dPdy == NULL) { + ir_read_error(st, NULL, "when reading dPdy in (txd ...)"); + return NULL; + } + break; + } + default: + // tex doesn't have any extra parameters and txf was handled earlier. + break; + }; + } + return tex; +} diff --git a/src/glsl/ir_reader.h b/src/glsl/ir_reader.h new file mode 100644 index 0000000000..b6afdc81ab --- /dev/null +++ b/src/glsl/ir_reader.h @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef IR_READER_H +#define IR_READER_H + +#include "ir.h" + +void _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, + const char *src); + +#endif /* IR_READER_H */ diff --git a/src/glsl/ir_swizzle_swizzle.cpp b/src/glsl/ir_swizzle_swizzle.cpp new file mode 100644 index 0000000000..0ffb4fa313 --- /dev/null +++ b/src/glsl/ir_swizzle_swizzle.cpp @@ -0,0 +1,93 @@ +/* + * 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 ir_swizzle_swizzle.cpp + * + * Eliminates the second swizzle in a swizzle chain. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor { +public: + ir_swizzle_swizzle_visitor() + { + progress = false; + } + + virtual ir_visitor_status visit_enter(ir_swizzle *); + + bool progress; +}; + +ir_visitor_status +ir_swizzle_swizzle_visitor::visit_enter(ir_swizzle *ir) +{ + int mask2[4]; + + ir_swizzle *swiz2 = ir->val->as_swizzle(); + if (!swiz2) + return visit_continue; + + memset(&mask2, 0, sizeof(mask2)); + if (swiz2->mask.num_components >= 1) + mask2[0] = swiz2->mask.x; + if (swiz2->mask.num_components >= 2) + mask2[1] = swiz2->mask.y; + if (swiz2->mask.num_components >= 3) + mask2[2] = swiz2->mask.z; + if (swiz2->mask.num_components >= 4) + mask2[3] = swiz2->mask.w; + + if (ir->mask.num_components >= 1) + ir->mask.x = mask2[ir->mask.x]; + if (ir->mask.num_components >= 2) + ir->mask.y = mask2[ir->mask.y]; + if (ir->mask.num_components >= 3) + ir->mask.z = mask2[ir->mask.z]; + if (ir->mask.num_components >= 4) + ir->mask.w = mask2[ir->mask.w]; + + ir->val = swiz2->val; + + this->progress = true; + + return visit_continue; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_swizzle_swizzle(exec_list *instructions) +{ + ir_swizzle_swizzle_visitor v; + + v.run(instructions); + + return v.progress; +} diff --git a/src/glsl/ir_to_mesa.cpp b/src/glsl/ir_to_mesa.cpp new file mode 100644 index 0000000000..26449c5a5c --- /dev/null +++ b/src/glsl/ir_to_mesa.cpp @@ -0,0 +1,1211 @@ +/* + * 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 ir_to_mesa.cpp + * + * Translates the IR to ARB_fragment_program text if possible, + * printing the result + */ + +#include +#include "ir.h" +#include "ir_visitor.h" +#include "ir_print_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +extern "C" { +#include "shader/prog_instruction.h" +#include "shader/prog_print.h" +} + +/** + * This struct is a corresponding struct to Mesa prog_src_register, with + * wider fields. + */ +typedef struct ir_to_mesa_src_reg { + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ + int negate; /**< NEGATE_XYZW mask from mesa */ + bool reladdr; /**< Register index should be offset by address reg. */ +} ir_to_mesa_src_reg; + +typedef struct ir_to_mesa_dst_reg { + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ +} ir_to_mesa_dst_reg; + +extern ir_to_mesa_src_reg ir_to_mesa_undef; + +class ir_to_mesa_instruction : public exec_node { +public: + enum prog_opcode op; + ir_to_mesa_dst_reg dst_reg; + ir_to_mesa_src_reg src_reg[3]; + /** Pointer to the ir source this tree came from for debugging */ + ir_instruction *ir; +}; + +class temp_entry : public exec_node { +public: + temp_entry(ir_variable *var, int file, int index) + : file(file), index(index), var(var) + { + /* empty */ + } + + int file; + int index; + ir_variable *var; /* variable that maps to this, if any */ +}; + +class ir_to_mesa_visitor : public ir_visitor { +public: + ir_to_mesa_visitor(); + + int next_temp; + int next_constant; + int next_uniform; + + temp_entry *find_variable_storage(ir_variable *var); + + ir_to_mesa_src_reg get_temp(const glsl_type *type); + + struct ir_to_mesa_src_reg src_reg_for_float(float val); + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_texture *); + virtual void visit(ir_if *); + /*@}*/ + + struct ir_to_mesa_src_reg result; + + /** List of temp_entry */ + exec_list variable_storage; + + /** List of ir_to_mesa_instruction */ + exec_list instructions; + + ir_to_mesa_instruction *ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + ir_to_mesa_instruction *ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1); + + ir_to_mesa_instruction *ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2); + + void ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + /* talloc context (the ) */ + void *ctx; +}; + +ir_to_mesa_src_reg ir_to_mesa_undef = { + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, false, +}; + +ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP +}; + +ir_to_mesa_dst_reg ir_to_mesa_address_reg = { + PROGRAM_ADDRESS, 0, WRITEMASK_X +}; + +static int swizzle_for_size(int size) +{ + int size_swizzles[4] = { + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W), + }; + + return size_swizzles[size - 1]; +} + +/* This list should match up with builtin_variables.h */ +static const struct { + const char *name; + int file; + int index; +} builtin_var_to_mesa_reg[] = { + /* core_vs */ + {"gl_Position", PROGRAM_OUTPUT, VERT_RESULT_HPOS}, + {"gl_PointSize", PROGRAM_OUTPUT, VERT_RESULT_PSIZ}, + + /* core_fs */ + {"gl_FragCoord", PROGRAM_INPUT, FRAG_ATTRIB_WPOS}, + {"gl_FrontFacing", PROGRAM_INPUT, FRAG_ATTRIB_FACE}, + {"gl_FragColor", PROGRAM_OUTPUT, FRAG_ATTRIB_COL0}, + {"gl_FragDepth", PROGRAM_UNDEFINED, FRAG_ATTRIB_WPOS}, /* FINISHME: WPOS.z */ + + /* 110_deprecated_fs */ + {"gl_Color", PROGRAM_INPUT, FRAG_ATTRIB_COL0}, + {"gl_SecondaryColor", PROGRAM_INPUT, FRAG_ATTRIB_COL1}, + {"gl_FogFragCoord", PROGRAM_INPUT, FRAG_ATTRIB_FOGC}, + {"gl_TexCoord", PROGRAM_INPUT, FRAG_ATTRIB_TEX0}, /* array */ + + /* 110_deprecated_vs */ + {"gl_Vertex", PROGRAM_INPUT, VERT_ATTRIB_POS}, + {"gl_Normal", PROGRAM_INPUT, VERT_ATTRIB_NORMAL}, + {"gl_Color", PROGRAM_INPUT, VERT_ATTRIB_COLOR0}, + {"gl_SecondaryColor", PROGRAM_INPUT, VERT_ATTRIB_COLOR1}, + {"gl_MultiTexCoord0", PROGRAM_INPUT, VERT_ATTRIB_TEX0}, + {"gl_MultiTexCoord1", PROGRAM_INPUT, VERT_ATTRIB_TEX1}, + {"gl_MultiTexCoord2", PROGRAM_INPUT, VERT_ATTRIB_TEX2}, + {"gl_MultiTexCoord3", PROGRAM_INPUT, VERT_ATTRIB_TEX3}, + {"gl_MultiTexCoord4", PROGRAM_INPUT, VERT_ATTRIB_TEX4}, + {"gl_MultiTexCoord5", PROGRAM_INPUT, VERT_ATTRIB_TEX5}, + {"gl_MultiTexCoord6", PROGRAM_INPUT, VERT_ATTRIB_TEX6}, + {"gl_MultiTexCoord7", PROGRAM_INPUT, VERT_ATTRIB_TEX7}, + {"gl_TexCoord", PROGRAM_OUTPUT, VERT_RESULT_TEX0}, /* array */ + {"gl_FogCoord", PROGRAM_INPUT, VERT_RESULT_FOGC}, + /*{"gl_ClipVertex", PROGRAM_OUTPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ + {"gl_FrontColor", PROGRAM_OUTPUT, VERT_RESULT_COL0}, + {"gl_BackColor", PROGRAM_OUTPUT, VERT_RESULT_BFC0}, + {"gl_FrontSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_COL1}, + {"gl_BackSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_BFC1}, + {"gl_FogFragCoord", PROGRAM_OUTPUT, VERT_RESULT_FOGC}, + + /* 130_vs */ + /*{"gl_VertexID", PROGRAM_INPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ + + {"gl_FragData", PROGRAM_OUTPUT, FRAG_RESULT_DATA0}, /* array */ +}; + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2) +{ + ir_to_mesa_instruction *inst = new(ctx) ir_to_mesa_instruction(); + + inst->op = op; + inst->dst_reg = dst; + inst->src_reg[0] = src0; + inst->src_reg[1] = src1; + inst->src_reg[2] = src2; + inst->ir = ir; + + this->instructions.push_tail(inst); + + return inst; +} + + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1) +{ + return ir_to_mesa_emit_op3(ir, op, dst, src0, src1, ir_to_mesa_undef); +} + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + return ir_to_mesa_emit_op3(ir, op, dst, + src0, ir_to_mesa_undef, ir_to_mesa_undef); +} + +inline ir_to_mesa_dst_reg +ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) +{ + ir_to_mesa_dst_reg dst_reg; + + dst_reg.file = reg.file; + dst_reg.index = reg.index; + dst_reg.writemask = WRITEMASK_XYZW; + + return dst_reg; +} + +/** + * Emits Mesa scalar opcodes to produce unique answers across channels. + * + * Some Mesa opcodes are scalar-only, like ARB_fp/vp. The src X + * channel determines the result across all channels. So to do a vec4 + * of this operation, we want to emit a scalar per source channel used + * to produce dest channels. + */ +void +ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + int i, j; + int done_mask = ~dst.writemask; + + /* Mesa RCP is a scalar operation splatting results to all channels, + * like ARB_fp/vp. So emit as many RCPs as necessary to cover our + * dst channels. + */ + for (i = 0; i < 4; i++) { + int this_mask = (1 << i); + ir_to_mesa_instruction *inst; + ir_to_mesa_src_reg src = src0; + + if (done_mask & this_mask) + continue; + + int src_swiz = GET_SWZ(src.swizzle, i); + for (j = i + 1; j < 4; j++) { + if (!(done_mask & (1 << j)) && GET_SWZ(src.swizzle, j) == src_swiz) { + this_mask |= (1 << j); + } + } + src.swizzle = MAKE_SWIZZLE4(src_swiz, src_swiz, + src_swiz, src_swiz); + + inst = ir_to_mesa_emit_op1(ir, op, + dst, + src); + inst->dst_reg.writemask = this_mask; + done_mask |= this_mask; + } +} + +struct ir_to_mesa_src_reg +ir_to_mesa_visitor::src_reg_for_float(float val) +{ + ir_to_mesa_src_reg src_reg; + + /* FINISHME: This will end up being _mesa_add_unnamed_constant, + * which handles sharing values and sharing channels of vec4 + * constants for small values. + */ + /* FINISHME: Do something with the constant values for now. + */ + (void)val; + src_reg.file = PROGRAM_CONSTANT; + src_reg.index = this->next_constant++; + src_reg.swizzle = SWIZZLE_NOOP; + + return src_reg; +} + +/** + * In the initial pass of codegen, we assign temporary numbers to + * intermediate results. (not SSA -- variable assignments will reuse + * storage). Actual register allocation for the Mesa VM occurs in a + * pass over the Mesa IR later. + */ +ir_to_mesa_src_reg +ir_to_mesa_visitor::get_temp(const glsl_type *type) +{ + ir_to_mesa_src_reg src_reg; + int swizzle[4]; + int i; + + assert(!type->is_array()); + + src_reg.file = PROGRAM_TEMPORARY; + src_reg.index = type->matrix_columns; + src_reg.reladdr = false; + + for (i = 0; i < type->vector_elements; i++) + swizzle[i] = i; + for (; i < 4; i++) + swizzle[i] = type->vector_elements - 1; + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], + swizzle[2], swizzle[3]); + + return src_reg; +} + +static int +type_size(const struct glsl_type *type) +{ + unsigned int i; + int size; + + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + if (type->is_matrix()) { + return 4; /* FINISHME: Not all matrices are 4x4. */ + } else { + /* Regardless of size of vector, it gets a vec4. This is bad + * packing for things like floats, but otherwise arrays become a + * mess. Hopefully a later pass over the code can pack scalars + * down if appropriate. + */ + return 1; + } + case GLSL_TYPE_ARRAY: + return type_size(type->fields.array) * type->length; + case GLSL_TYPE_STRUCT: + size = 0; + for (i = 0; i < type->length; i++) { + size += type_size(type->fields.structure[i].type); + } + return size; + default: + assert(0); + } +} + +temp_entry * +ir_to_mesa_visitor::find_variable_storage(ir_variable *var) +{ + + temp_entry *entry; + + foreach_iter(exec_list_iterator, iter, this->variable_storage) { + entry = (temp_entry *)iter.get(); + + if (entry->var == var) + return entry; + } + + return NULL; +} + +void +ir_to_mesa_visitor::visit(ir_variable *ir) +{ + (void)ir; +} + +void +ir_to_mesa_visitor::visit(ir_loop *ir) +{ + assert(!ir->from); + assert(!ir->to); + assert(!ir->increment); + assert(!ir->counter); + + ir_to_mesa_emit_op1(NULL, OPCODE_BGNLOOP, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + + visit_exec_list(&ir->body_instructions, this); + + ir_to_mesa_emit_op1(NULL, OPCODE_ENDLOOP, + ir_to_mesa_undef_dst, ir_to_mesa_undef); +} + +void +ir_to_mesa_visitor::visit(ir_loop_jump *ir) +{ + switch (ir->mode) { + case ir_loop_jump::jump_break: + ir_to_mesa_emit_op1(NULL, OPCODE_BRK, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + break; + case ir_loop_jump::jump_continue: + ir_to_mesa_emit_op1(NULL, OPCODE_CONT, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + break; + } +} + + +void +ir_to_mesa_visitor::visit(ir_function_signature *ir) +{ + assert(0); + (void)ir; +} + +void +ir_to_mesa_visitor::visit(ir_function *ir) +{ + /* Ignore function bodies other than main() -- we shouldn't see calls to + * them since they should all be inlined before we get to ir_to_mesa. + */ + if (strcmp(ir->name, "main") == 0) { + const ir_function_signature *sig; + exec_list empty; + + sig = ir->matching_signature(&empty); + + assert(sig); + + foreach_iter(exec_list_iterator, iter, sig->body) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + ir->accept(this); + } + } +} + +void +ir_to_mesa_visitor::visit(ir_expression *ir) +{ + unsigned int operand; + struct ir_to_mesa_src_reg op[2]; + struct ir_to_mesa_src_reg result_src; + struct ir_to_mesa_dst_reg result_dst; + const glsl_type *vec4_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 4, 1); + const glsl_type *vec3_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 3, 1); + const glsl_type *vec2_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 2, 1); + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + this->result.file = PROGRAM_UNDEFINED; + ir->operands[operand]->accept(this); + if (this->result.file == PROGRAM_UNDEFINED) { + ir_print_visitor v; + printf("Failed to get tree for expression operand:\n"); + ir->operands[operand]->accept(&v); + exit(1); + } + op[operand] = this->result; + + /* Only expression implemented for matrices yet */ + assert(!ir->operands[operand]->type->is_matrix() || + ir->operation == ir_binop_mul); + } + + this->result.file = PROGRAM_UNDEFINED; + + /* Storage for our result. Ideally for an assignment we'd be using + * the actual storage for the result here, instead. + */ + result_src = get_temp(ir->type); + /* convenience for the emit functions below. */ + result_dst = ir_to_mesa_dst_reg_from_src(result_src); + /* Limit writes to the channels that will be used by result_src later. + * This does limit this temp's use as a temporary for multi-instruction + * sequences. + */ + result_dst.writemask = (1 << ir->type->vector_elements) - 1; + + switch (ir->operation) { + case ir_unop_logic_not: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, + op[0], src_reg_for_float(0.0)); + break; + case ir_unop_neg: + op[0].negate = ~op[0].negate; + result_src = op[0]; + break; + case ir_unop_exp: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); + break; + case ir_unop_exp2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_EX2, result_dst, op[0]); + break; + case ir_unop_log: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_LOG, result_dst, op[0]); + break; + case ir_unop_log2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_LG2, result_dst, op[0]); + break; + case ir_unop_sin: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_SIN, result_dst, op[0]); + break; + case ir_unop_cos: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_COS, result_dst, op[0]); + break; + case ir_binop_add: + ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); + break; + case ir_binop_sub: + ir_to_mesa_emit_op2(ir, OPCODE_SUB, result_dst, op[0], op[1]); + break; + case ir_binop_mul: + if (ir->operands[0]->type->is_matrix() && + !ir->operands[1]->type->is_matrix()) { + if (ir->operands[0]->type->is_scalar()) { + ir_to_mesa_dst_reg dst_column = result_dst; + ir_to_mesa_src_reg src_column = op[0]; + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_column, src_column, op[1]); + dst_column.index++; + src_column.index++; + } + } else { + ir_to_mesa_dst_reg dst_chan = result_dst; + ir_to_mesa_src_reg src_column = op[0]; + ir_to_mesa_src_reg src_chan = op[1]; + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + dst_chan.writemask = (1 << i); + src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_chan, src_column, src_chan); + src_column.index++; + } + } + } else { + assert(!ir->operands[0]->type->is_matrix()); + assert(!ir->operands[1]->type->is_matrix()); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], op[1]); + } + break; + case ir_binop_div: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], result_src); + break; + + case ir_binop_less: + ir_to_mesa_emit_op2(ir, OPCODE_SLT, result_dst, op[0], op[1]); + break; + case ir_binop_greater: + ir_to_mesa_emit_op2(ir, OPCODE_SGT, result_dst, op[0], op[1]); + break; + case ir_binop_lequal: + ir_to_mesa_emit_op2(ir, OPCODE_SLE, result_dst, op[0], op[1]); + break; + case ir_binop_gequal: + ir_to_mesa_emit_op2(ir, OPCODE_SGE, result_dst, op[0], op[1]); + break; + case ir_binop_equal: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); + break; + case ir_binop_logic_xor: + case ir_binop_nequal: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + break; + + case ir_binop_logic_or: + /* This could be a saturated add and skip the SNE. */ + ir_to_mesa_emit_op2(ir, OPCODE_ADD, + result_dst, + op[0], op[1]); + + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, + result_src, src_reg_for_float(0.0)); + break; + + case ir_binop_logic_and: + /* the bool args are stored as float 0.0 or 1.0, so "mul" gives us "and". */ + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + result_dst, + op[0], op[1]); + break; + + case ir_binop_dot: + if (ir->operands[0]->type == vec4_type) { + assert(ir->operands[1]->type == vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP4, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec3_type) { + assert(ir->operands[1]->type == vec3_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP3, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec2_type) { + assert(ir->operands[1]->type == vec2_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP2, + result_dst, + op[0], op[1]); + } + break; + case ir_unop_sqrt: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + ir_to_mesa_emit_op1(ir, OPCODE_RCP, result_dst, result_src); + break; + case ir_unop_rsq: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + break; + case ir_unop_i2f: + /* Mesa IR lacks types, ints are stored as truncated floats. */ + result_src = op[0]; + break; + case ir_unop_f2i: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_f2b: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, + result_src, src_reg_for_float(0.0)); + break; + case ir_unop_trunc: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_ceil: + op[0].negate = ~op[0].negate; + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + result_src.negate = ~result_src.negate; + break; + case ir_unop_floor: + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + break; + case ir_binop_min: + ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]); + break; + case ir_binop_max: + ir_to_mesa_emit_op2(ir, OPCODE_MAX, result_dst, op[0], op[1]); + break; + default: + ir_print_visitor v; + printf("Failed to get tree for expression:\n"); + ir->accept(&v); + exit(1); + break; + } + + this->result = result_src; +} + + +void +ir_to_mesa_visitor::visit(ir_swizzle *ir) +{ + ir_to_mesa_src_reg src_reg; + int i; + int swizzle[4]; + + /* Note that this is only swizzles in expressions, not those on the left + * hand side of an assignment, which do write masking. See ir_assignment + * for that. + */ + + ir->val->accept(this); + src_reg = this->result; + assert(src_reg.file != PROGRAM_UNDEFINED); + + for (i = 0; i < 4; i++) { + if (i < ir->type->vector_elements) { + switch (i) { + case 0: + swizzle[i] = ir->mask.x; + break; + case 1: + swizzle[i] = ir->mask.y; + break; + case 2: + swizzle[i] = ir->mask.z; + break; + case 3: + swizzle[i] = ir->mask.w; + break; + } + } else { + /* If the type is smaller than a vec4, replicate the last + * channel out. + */ + swizzle[i] = ir->type->vector_elements - 1; + } + } + + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], + swizzle[1], + swizzle[2], + swizzle[3]); + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_variable *ir) +{ + ir_to_mesa_src_reg src_reg; + temp_entry *entry = find_variable_storage(ir->var); + unsigned int i; + bool var_in; + + if (!entry) { + switch (ir->var->mode) { + case ir_var_uniform: + entry = new(ctx) temp_entry(ir->var, PROGRAM_UNIFORM, + this->next_uniform); + this->variable_storage.push_tail(entry); + + this->next_uniform += type_size(ir->var->type); + break; + case ir_var_in: + case ir_var_out: + case ir_var_inout: + var_in = (ir->var->mode == ir_var_in || + ir->var->mode == ir_var_inout); + + for (i = 0; i < ARRAY_SIZE(builtin_var_to_mesa_reg); i++) { + bool in = builtin_var_to_mesa_reg[i].file == PROGRAM_INPUT; + + if (strcmp(ir->var->name, builtin_var_to_mesa_reg[i].name) == 0 && + !(var_in ^ in)) + break; + } + if (i == ARRAY_SIZE(builtin_var_to_mesa_reg)) { + printf("Failed to find builtin for %s variable %s\n", + var_in ? "in" : "out", + ir->var->name); + abort(); + } + entry = new(ctx) temp_entry(ir->var, + builtin_var_to_mesa_reg[i].file, + builtin_var_to_mesa_reg[i].index); + break; + case ir_var_auto: + entry = new(ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, + this->next_temp); + this->variable_storage.push_tail(entry); + + next_temp += type_size(ir->var->type); + break; + } + + if (!entry) { + printf("Failed to make storage for %s\n", ir->var->name); + exit(1); + } + } + + src_reg.file = entry->file; + src_reg.index = entry->index; + /* If the type is smaller than a vec4, replicate the last channel out. */ + src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); + src_reg.reladdr = false; + src_reg.negate = 0; + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_array *ir) +{ + ir_constant *index; + ir_to_mesa_src_reg src_reg; + + index = ir->array_index->constant_expression_value(); + + /* By the time we make it to this stage, matrices should be broken down + * to vectors. + */ + assert(!ir->type->is_matrix()); + + ir->array->accept(this); + src_reg = this->result; + + if (src_reg.file == PROGRAM_INPUT || + src_reg.file == PROGRAM_OUTPUT) { + assert(index); /* FINISHME: Handle variable indexing of builtins. */ + + src_reg.index += index->value.i[0]; + } else { + if (index) { + src_reg.index += index->value.i[0]; + } else { + ir_to_mesa_src_reg array_base = this->result; + /* Variable index array dereference. It eats the "vec4" of the + * base of the array and an index that offsets the Mesa register + * index. + */ + ir->array_index->accept(this); + + /* FINISHME: This doesn't work when we're trying to do the LHS + * of an assignment. + */ + src_reg.reladdr = true; + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, + this->result); + + this->result = get_temp(ir->type); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(this->result), + src_reg); + } + } + + /* If the type is smaller than a vec4, replicate the last channel out. */ + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_record *ir) +{ + unsigned int i; + const glsl_type *struct_type = ir->record->type; + int offset = 0; + + ir->record->accept(this); + + for (i = 0; i < struct_type->length; i++) { + if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) + break; + offset += type_size(struct_type->fields.structure[i].type); + } + this->result.index += offset; +} + +/** + * We want to be careful in assignment setup to hit the actual storage + * instead of potentially using a temporary like we might with the + * ir_dereference handler. + * + * Thanks to ir_swizzle_swizzle, and ir_vec_index_to_swizzle, we + * should only see potentially one variable array index of a vector, + * and one swizzle, before getting to actual vec4 storage. So handle + * those, then go use ir_dereference to handle the rest. + */ +static struct ir_to_mesa_dst_reg +get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) +{ + struct ir_to_mesa_dst_reg dst_reg; + ir_dereference *deref; + ir_swizzle *swiz; + + /* Use the rvalue deref handler for the most part. We'll ignore + * swizzles in it and write swizzles using writemask, though. + */ + ir->accept(v); + dst_reg = ir_to_mesa_dst_reg_from_src(v->result); + + if ((deref = ir->as_dereference())) { + ir_dereference_array *deref_array = ir->as_dereference_array(); + assert(!deref_array || deref_array->array->type->is_array()); + + ir->accept(v); + } else if ((swiz = ir->as_swizzle())) { + dst_reg.writemask = 0; + if (swiz->mask.num_components >= 1) + dst_reg.writemask |= (1 << swiz->mask.x); + if (swiz->mask.num_components >= 2) + dst_reg.writemask |= (1 << swiz->mask.y); + if (swiz->mask.num_components >= 3) + dst_reg.writemask |= (1 << swiz->mask.z); + if (swiz->mask.num_components >= 4) + dst_reg.writemask |= (1 << swiz->mask.w); + } + + return dst_reg; +} + +void +ir_to_mesa_visitor::visit(ir_assignment *ir) +{ + struct ir_to_mesa_dst_reg l; + struct ir_to_mesa_src_reg r; + + assert(!ir->lhs->type->is_matrix()); + assert(!ir->lhs->type->is_array()); + assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); + + l = get_assignment_lhs(ir->lhs, this); + + ir->rhs->accept(this); + r = this->result; + assert(l.file != PROGRAM_UNDEFINED); + assert(r.file != PROGRAM_UNDEFINED); + + if (ir->condition) { + ir_constant *condition_constant; + + condition_constant = ir->condition->constant_expression_value(); + + assert(condition_constant && condition_constant->value.b[0]); + } + + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); +} + + +void +ir_to_mesa_visitor::visit(ir_constant *ir) +{ + ir_to_mesa_src_reg src_reg; + + assert(ir->type->base_type == GLSL_TYPE_FLOAT || + ir->type->base_type == GLSL_TYPE_UINT || + ir->type->base_type == GLSL_TYPE_INT || + ir->type->base_type == GLSL_TYPE_BOOL); + + /* FINISHME: This will end up being _mesa_add_unnamed_constant, + * which handles sharing values and sharing channels of vec4 + * constants for small values. + */ + /* FINISHME: Do something with the constant values for now. + */ + src_reg.file = PROGRAM_CONSTANT; + src_reg.index = this->next_constant; + src_reg.swizzle = SWIZZLE_NOOP; + src_reg.reladdr = false; + src_reg.negate = 0; + + this->next_constant += type_size(ir->type); + + this->result = src_reg; +} + + +void +ir_to_mesa_visitor::visit(ir_call *ir) +{ + printf("Can't support call to %s\n", ir->callee_name()); + exit(1); +} + + +void +ir_to_mesa_visitor::visit(ir_texture *ir) +{ + assert(0); + + ir->coordinate->accept(this); +} + +void +ir_to_mesa_visitor::visit(ir_return *ir) +{ + assert(0); + + ir->get_value()->accept(this); +} + + +void +ir_to_mesa_visitor::visit(ir_if *ir) +{ + ir_to_mesa_instruction *if_inst, *else_inst = NULL; + + ir->condition->accept(this); + assert(this->result.file != PROGRAM_UNDEFINED); + + if_inst = ir_to_mesa_emit_op1(ir->condition, + OPCODE_IF, ir_to_mesa_undef_dst, + this->result); + + this->instructions.push_tail(if_inst); + + visit_exec_list(&ir->then_instructions, this); + + if (!ir->else_instructions.is_empty()) { + else_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ELSE, + ir_to_mesa_undef_dst, + ir_to_mesa_undef); + visit_exec_list(&ir->then_instructions, this); + } + + if_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ENDIF, + ir_to_mesa_undef_dst, ir_to_mesa_undef); +} + +ir_to_mesa_visitor::ir_to_mesa_visitor() +{ + result.file = PROGRAM_UNDEFINED; + next_temp = 1; + next_constant = 0; + next_uniform = 0; +} + +static struct prog_src_register +mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) +{ + struct prog_src_register mesa_reg; + + mesa_reg.File = reg.file; + assert(reg.index < (1 << INST_INDEX_BITS) - 1); + mesa_reg.Index = reg.index; + mesa_reg.Swizzle = reg.swizzle; + mesa_reg.RelAddr = reg.reladdr; + + return mesa_reg; +} + +static void +set_branchtargets(struct prog_instruction *mesa_instructions, + int num_instructions) +{ + int if_count = 0, loop_count; + int *if_stack, *loop_stack; + int if_stack_pos = 0, loop_stack_pos = 0; + int i, j; + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_count++; + break; + case OPCODE_BGNLOOP: + loop_count++; + break; + case OPCODE_BRK: + case OPCODE_CONT: + mesa_instructions[i].BranchTarget = -1; + break; + default: + break; + } + } + + if_stack = (int *)calloc(if_count, sizeof(*if_stack)); + loop_stack = (int *)calloc(loop_count, sizeof(*loop_stack)); + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_stack[if_stack_pos] = i; + if_stack_pos++; + break; + case OPCODE_ELSE: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack[if_stack_pos - 1] = i; + break; + case OPCODE_ENDIF: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack_pos--; + break; + case OPCODE_BGNLOOP: + loop_stack[loop_stack_pos] = i; + loop_stack_pos++; + break; + case OPCODE_ENDLOOP: + loop_stack_pos--; + /* Rewrite any breaks/conts at this nesting level (haven't + * already had a BranchTarget assigned) to point to the end + * of the loop. + */ + for (j = loop_stack[loop_stack_pos]; j < i; j++) { + if (mesa_instructions[j].Opcode == OPCODE_BRK || + mesa_instructions[j].Opcode == OPCODE_CONT) { + if (mesa_instructions[j].BranchTarget == -1) { + mesa_instructions[j].BranchTarget = i; + } + } + } + /* The loop ends point at each other. */ + mesa_instructions[i].BranchTarget = loop_stack[loop_stack_pos]; + mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i; + default: + break; + } + } + + free(if_stack); +} + +static void +print_program(struct prog_instruction *mesa_instructions, + ir_instruction **mesa_instruction_annotation, + int num_instructions) +{ + ir_instruction *last_ir = NULL; + int i; + + for (i = 0; i < num_instructions; i++) { + struct prog_instruction *mesa_inst = mesa_instructions + i; + ir_instruction *ir = mesa_instruction_annotation[i]; + + if (last_ir != ir && ir) { + ir_print_visitor print; + ir->accept(&print); + printf("\n"); + last_ir = ir; + } + + _mesa_print_instruction(mesa_inst); + } +} + +void +do_ir_to_mesa(exec_list *instructions) +{ + ir_to_mesa_visitor v; + struct prog_instruction *mesa_instructions, *mesa_inst; + ir_instruction **mesa_instruction_annotation; + int i; + + v.ctx = talloc_new(NULL); + visit_exec_list(instructions, &v); + + int num_instructions = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + num_instructions++; + } + + mesa_instructions = + (struct prog_instruction *)calloc(num_instructions, + sizeof(*mesa_instructions)); + mesa_instruction_annotation = + (ir_instruction **)calloc(num_instructions, + sizeof(*mesa_instruction_annotation)); + + mesa_inst = mesa_instructions; + i = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + + mesa_inst->Opcode = inst->op; + mesa_inst->DstReg.File = inst->dst_reg.file; + mesa_inst->DstReg.Index = inst->dst_reg.index; + mesa_inst->DstReg.CondMask = COND_TR; + mesa_inst->DstReg.WriteMask = inst->dst_reg.writemask; + mesa_inst->SrcReg[0] = mesa_src_reg_from_ir_src_reg(inst->src_reg[0]); + mesa_inst->SrcReg[1] = mesa_src_reg_from_ir_src_reg(inst->src_reg[1]); + mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); + mesa_instruction_annotation[i] = inst->ir; + + mesa_inst++; + i++; + } + + set_branchtargets(mesa_instructions, num_instructions); + print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); + + free(mesa_instruction_annotation); + talloc_free(v.ctx); +} diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp new file mode 100644 index 0000000000..507e88993f --- /dev/null +++ b/src/glsl/ir_validate.cpp @@ -0,0 +1,104 @@ +/* + * 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 ir_validate.cpp + * + * Attempts to verify that various invariants of the IR tree are true. + * + * In particular, at the moment it makes sure that no single + * ir_instruction node except for ir_variable appears multiple times + * in the ir tree. ir_variable does appear multiple times: Once as a + * declaration in an exec_list, and multiple times as the endpoint of + * a dereference chain. + */ + +#include +#include "ir.h" +#include "ir_hierarchical_visitor.h" +#include "hash_table.h" + +static unsigned int hash_func(const void *key) +{ + return (unsigned int)(uintptr_t)key; +} + +static int hash_compare_func(const void *key1, const void *key2) +{ + return key1 == key2 ? 0 : 1; +} + + +class ir_validate : public ir_hierarchical_visitor { +public: + ir_validate() + { + this->ht = hash_table_ctor(0, hash_func, hash_compare_func); + + this->callback = ir_validate::validate_ir; + this->data = ht; + } + + ~ir_validate() + { + hash_table_dtor(this->ht); + } + + virtual ir_visitor_status visit(ir_variable *v); + + static void validate_ir(ir_instruction *ir, void *data); + + struct hash_table *ht; +}; + +ir_visitor_status +ir_validate::visit(ir_variable *ir) +{ + /* An ir_variable is the one thing that can (and will) appear multiple times + * in an IR tree. + */ + (void) ir; + return visit_continue; +} + +void +ir_validate::validate_ir(ir_instruction *ir, void *data) +{ + struct hash_table *ht = (struct hash_table *) data; + + if (hash_table_find(ht, ir)) { + printf("Instruction node present twice in ir tree:\n"); + ir->print(); + printf("\n"); + abort(); + } + hash_table_insert(ht, ir, ir); +} + +void +validate_ir_tree(exec_list *instructions) +{ + ir_validate v; + + v.run(instructions); +} diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp new file mode 100644 index 0000000000..15a4a92f62 --- /dev/null +++ b/src/glsl/ir_variable.cpp @@ -0,0 +1,345 @@ +/* + * 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 "ir.h" +#include "glsl_parser_extras.h" +#include "glsl_symbol_table.h" +#include "builtin_variables.h" + +#ifndef Elements +#define Elements(x) (sizeof(x)/sizeof(*(x))) +#endif + +static ir_variable * +add_variable(const char *name, enum ir_variable_mode mode, int slot, + const glsl_type *type, exec_list *instructions, + glsl_symbol_table *symtab) +{ + ir_variable *var = new(symtab) ir_variable(type, name); + + var->mode = mode; + switch (var->mode) { + case ir_var_in: + var->shader_in = true; + var->read_only = true; + break; + case ir_var_inout: + var->shader_in = true; + var->shader_out = true; + break; + case ir_var_out: + var->shader_out = true; + break; + case ir_var_uniform: + var->shader_in = true; + var->read_only = true; + break; + default: + assert(0); + break; + } + + var->location = slot; + + /* Once the variable is created an initialized, add it to the symbol table + * and add the declaration to the IR stream. + */ + instructions->push_tail(var); + + symtab->add_variable(var->name, var); + return var; +} + + +static void +add_builtin_variable(const builtin_variable *proto, exec_list *instructions, + glsl_symbol_table *symtab) +{ + /* Create a new variable declaration from the description supplied by + * the caller. + */ + const glsl_type *const type = symtab->get_type(proto->type); + + assert(type != NULL); + + add_variable(proto->name, proto->mode, proto->slot, type, instructions, + symtab); +} + + +static void +generate_110_uniforms(exec_list *instructions, + glsl_symbol_table *symtab) +{ + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_uniforms) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_uniforms[i], + instructions, symtab); + } + + /* FINISHME: The size of this array is implementation dependent based on the + * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports + * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 + * FINISHME: for now. + */ + const glsl_type *const mat4_array_type = + glsl_type::get_array_instance(symtab, glsl_type::mat4_type, 4); + + add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type, + instructions, symtab); + + /* FINISHME: Add support for gl_DepthRangeParameters */ + /* FINISHME: Add support for gl_ClipPlane[] */ + /* FINISHME: Add support for gl_PointParameters */ + + /* FINISHME: Add support for gl_MaterialParameters + * FINISHME: (glFrontMaterial, glBackMaterial) + */ + + /* FINISHME: The size of this array is implementation dependent based on the + * FINISHME: value of GL_MAX_TEXTURE_LIGHTS. GL_MAX_TEXTURE_LIGHTS must be + * FINISHME: at least 8, so hard-code 8 for now. + */ + const glsl_type *const light_source_array_type = + glsl_type::get_array_instance(symtab, + symtab->get_type("gl_LightSourceParameters"), 8); + + add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, + instructions, symtab); + + /* FINISHME: Add support for gl_LightModel */ + /* FINISHME: Add support for gl_FrontLightProduct[], gl_BackLightProduct[] */ + /* FINISHME: Add support for gl_TextureEnvColor[] */ + /* FINISHME: Add support for gl_ObjectPlane*[], gl_EyePlane*[] */ + /* FINISHME: Add support for gl_Fog */ +} + +static void +generate_110_vs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { + add_builtin_variable(& builtin_core_vs_variables[i], + instructions, symtab); + } + + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_vs_variables) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_vs_variables[i], + instructions, symtab); + } + generate_110_uniforms(instructions, symtab); + + /* FINISHME: The size of this array is implementation dependent based on the + * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports + * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 + * FINISHME: for now. + */ + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4); + + add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, + instructions, symtab); +} + + +static void +generate_120_vs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + /* GLSL version 1.20 did not add any built-in variables in the vertex + * shader. + */ + generate_110_vs_variables(instructions, symtab); +} + + +static void +generate_130_vs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + void *ctx = symtab; + generate_120_vs_variables(instructions, symtab); + + for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { + add_builtin_variable(& builtin_130_vs_variables[i], + instructions, symtab); + } + + /* FINISHME: The size of this array is implementation dependent based on + * FINISHME: the value of GL_MAX_CLIP_DISTANCES. + */ + const glsl_type *const clip_distance_array_type = + glsl_type::get_array_instance(ctx, glsl_type::float_type, 8); + + /* FINISHME: gl_ClipDistance needs a real location assigned. */ + add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, + instructions, symtab); + +} + + +static void +initialize_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + + switch (state->language_version) { + case 110: + generate_110_vs_variables(instructions, state->symbols); + break; + case 120: + generate_120_vs_variables(instructions, state->symbols); + break; + case 130: + generate_130_vs_variables(instructions, state->symbols); + break; + } +} + +static void +generate_110_fs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { + add_builtin_variable(& builtin_core_fs_variables[i], + instructions, symtab); + } + + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_fs_variables) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_fs_variables[i], + instructions, symtab); + } + generate_110_uniforms(instructions, symtab); + + /* FINISHME: The size of this array is implementation dependent based on the + * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports + * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 + * FINISHME: for now. + */ + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4); + + add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, + instructions, symtab); +} + + +static void +generate_ARB_draw_buffers_fs_variables(exec_list *instructions, + glsl_symbol_table *symtab, bool warn) +{ + /* FINISHME: The size of this array is implementation dependent based on the + * FINISHME: value of GL_MAX_DRAW_BUFFERS. GL_MAX_DRAW_BUFFERS must be + * FINISHME: at least 1, so hard-code 1 for now. + */ + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 1); + + ir_variable *const fd = + add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, + vec4_array_type, instructions, symtab); + + if (warn) + fd->warn_extension = "GL_ARB_draw_buffers"; +} + + +static void +generate_120_fs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + generate_110_fs_variables(instructions, symtab); + generate_ARB_draw_buffers_fs_variables(instructions, symtab, false); +} + +static void +generate_130_fs_variables(exec_list *instructions, + glsl_symbol_table *symtab) +{ + void *ctx = symtab; + generate_120_fs_variables(instructions, symtab); + + /* FINISHME: The size of this array is implementation dependent based on + * FINISHME: the value of GL_MAX_CLIP_DISTANCES. + */ + const glsl_type *const clip_distance_array_type = + glsl_type::get_array_instance(ctx, glsl_type::float_type, 8); + + /* FINISHME: gl_ClipDistance needs a real location assigned. */ + add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, + instructions, symtab); +} + +static void +initialize_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + + switch (state->language_version) { + case 110: + generate_110_fs_variables(instructions, state->symbols); + break; + case 120: + generate_120_fs_variables(instructions, state->symbols); + break; + case 130: + generate_130_fs_variables(instructions, state->symbols); + break; + } + + + /* Since GL_ARB_draw_buffers is included in GLSL 1.20 and later, we + * can basically ignore any extension settings for it. + */ + if (state->language_version < 120) { + if (state->ARB_draw_buffers_enable) { + generate_ARB_draw_buffers_fs_variables(instructions, state->symbols, + state->ARB_draw_buffers_warn); + } + } +} + +void +_mesa_glsl_initialize_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + switch (state->target) { + case vertex_shader: + initialize_vs_variables(instructions, state); + break; + case geometry_shader: + break; + case fragment_shader: + initialize_fs_variables(instructions, state); + break; + case ir_shader: + fprintf(stderr, "ir reader has no builtin variables"); + exit(1); + break; + } +} diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp new file mode 100644 index 0000000000..abeb43cd68 --- /dev/null +++ b/src/glsl/ir_vec_index_to_swizzle.cpp @@ -0,0 +1,158 @@ +/* + * 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 ir_vec_index_to_swizzle.cpp + * + * Turns constant indexing into vector types to swizzles. This will + * let other swizzle-aware optimization passes catch these constructs, + * and codegen backends not have to worry about this case. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_vec_index_to_swizzle_visitor : public ir_hierarchical_visitor { +public: + ir_vec_index_to_swizzle_visitor() + { + progress = false; + } + + ir_rvalue *convert_vec_index_to_swizzle(ir_rvalue *val); + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_if *); + + bool progress; +}; + +ir_rvalue * +ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) +{ + ir_dereference_array *deref = ir->as_dereference_array(); + ir_constant *ir_constant; + + if (!deref) + return ir; + + if (deref->array->type->is_matrix() || deref->array->type->is_array()) + return ir; + + assert(deref->array_index->type->base_type == GLSL_TYPE_INT); + ir_constant = deref->array_index->constant_expression_value(); + if (!ir_constant) + return ir; + + void *ctx = talloc_parent(ir); + this->progress = true; + return new(ctx) ir_swizzle(deref->array, + ir_constant->value.i[0], 0, 0, 0, 1); +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_expression *ir) +{ + unsigned int i; + + for (i = 0; i < ir->get_num_operands(); i++) { + ir->operands[i] = convert_vec_index_to_swizzle(ir->operands[i]); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_swizzle *ir) +{ + /* Can't be hit from normal GLSL, since you can't swizzle a scalar (which + * the result of indexing a vector is. But maybe at some point we'll end up + * using swizzling of scalars for vector construction. + */ + ir->val = convert_vec_index_to_swizzle(ir->val); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_assignment *ir) +{ + ir->lhs = convert_vec_index_to_swizzle(ir->lhs); + ir->rhs = convert_vec_index_to_swizzle(ir->rhs); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = convert_vec_index_to_swizzle(param); + + if (new_param != param) { + param->insert_before(new_param); + param->remove(); + } + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_return *ir) +{ + if (ir->value) { + ir->value = convert_vec_index_to_swizzle(ir->value); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_if *ir) +{ + ir->condition = convert_vec_index_to_swizzle(ir->condition); + + return visit_continue; +} + +bool +do_vec_index_to_swizzle(exec_list *instructions) +{ + ir_vec_index_to_swizzle_visitor v; + + v.run(instructions); + + return false; +} diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h new file mode 100644 index 0000000000..a6f9d2b7ee --- /dev/null +++ b/src/glsl/ir_visitor.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef IR_VISITOR_H +#define IR_VISITOR_H + +/** + * Abstract base class of visitors of IR instruction trees + */ +class ir_visitor { +public: + virtual ~ir_visitor() + { + /* empty */ + } + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(class ir_variable *) = 0; + virtual void visit(class ir_function_signature *) = 0; + virtual void visit(class ir_function *) = 0; + virtual void visit(class ir_expression *) = 0; + virtual void visit(class ir_texture *) = 0; + virtual void visit(class ir_swizzle *) = 0; + virtual void visit(class ir_dereference_variable *) = 0; + virtual void visit(class ir_dereference_array *) = 0; + virtual void visit(class ir_dereference_record *) = 0; + virtual void visit(class ir_assignment *) = 0; + virtual void visit(class ir_constant *) = 0; + virtual void visit(class ir_call *) = 0; + virtual void visit(class ir_return *) = 0; + virtual void visit(class ir_if *) = 0; + virtual void visit(class ir_loop *) = 0; + virtual void visit(class ir_loop_jump *) = 0; + /*@}*/ +}; + +#endif /* IR_VISITOR_H */ diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp new file mode 100644 index 0000000000..ba382fe881 --- /dev/null +++ b/src/glsl/linker.cpp @@ -0,0 +1,871 @@ +/* + * 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 linker.cpp + * GLSL linker implementation + * + * Given a set of shaders that are to be linked to generate a final program, + * there are three distinct stages. + * + * In the first stage shaders are partitioned into groups based on the shader + * type. All shaders of a particular type (e.g., vertex shaders) are linked + * together. + * + * - Undefined references in each shader are resolve to definitions in + * another shader. + * - Types and qualifiers of uniforms, outputs, and global variables defined + * in multiple shaders with the same name are verified to be the same. + * - Initializers for uniforms and global variables defined + * in multiple shaders with the same name are verified to be the same. + * + * The result, in the terminology of the GLSL spec, is a set of shader + * executables for each processing unit. + * + * After the first stage is complete, a series of semantic checks are performed + * on each of the shader executables. + * + * - Each shader executable must define a \c main function. + * - Each vertex shader executable must write to \c gl_Position. + * - Each fragment shader executable must write to either \c gl_FragData or + * \c gl_FragColor. + * + * In the final stage individual shader executables are linked to create a + * complete exectuable. + * + * - Types of uniforms defined in multiple shader stages with the same name + * are verified to be the same. + * - Initializers for uniforms defined in multiple shader stages with the + * same name are verified to be the same. + * - Types and qualifiers of outputs defined in one stage are verified to + * be the same as the types and qualifiers of inputs defined with the same + * name in a later stage. + * + * \author Ian Romanick + */ +#include +#include +#include + +extern "C" { +#include +} + +#include "main/mtypes.h" +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "ir.h" +#include "ir_optimization.h" +#include "program.h" +#include "hash_table.h" + +/** + * Visitor that determines whether or not a variable is ever written. + */ +class find_assignment_visitor : public ir_hierarchical_visitor { +public: + find_assignment_visitor(const char *name) + : name(name), found(false) + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_assignment *ir) + { + ir_variable *const var = ir->lhs->variable_referenced(); + + if (strcmp(name, var->name) == 0) { + found = true; + return visit_stop; + } + + return visit_continue_with_parent; + } + + bool variable_found() + { + return found; + } + +private: + const char *name; /**< Find writes to a variable with this name. */ + bool found; /**< Was a write to the variable found? */ +}; + + +void +linker_error_printf(glsl_program *prog, const char *fmt, ...) +{ + va_list ap; + + prog->InfoLog = talloc_strdup_append(prog->InfoLog, "error: "); + va_start(ap, fmt); + prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, ap); + va_end(ap); +} + + +void +invalidate_variable_locations(glsl_shader *sh, enum ir_variable_mode mode, + int generic_base) +{ + foreach_list(node, &sh->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != (unsigned) mode)) + continue; + + /* Only assign locations for generic attributes / varyings / etc. + */ + if (var->location >= generic_base) + var->location = -1; + } +} + + +/** + * Determine the number of attribute slots required for a particular type + * + * This code is here because it implements the language rules of a specific + * GLSL version. Since it's a property of the language and not a property of + * types in general, it doesn't really belong in glsl_type. + */ +unsigned +count_attribute_slots(const glsl_type *t) +{ + /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec: + * + * "A scalar input counts the same amount against this limit as a vec4, + * so applications may want to consider packing groups of four + * unrelated float inputs together into a vector to better utilize the + * capabilities of the underlying hardware. A matrix input will use up + * multiple locations. The number of locations used will equal the + * number of columns in the matrix." + * + * The spec does not explicitly say how arrays are counted. However, it + * should be safe to assume the total number of slots consumed by an array + * is the number of entries in the array multiplied by the number of slots + * consumed by a single element of the array. + */ + + if (t->is_array()) + return t->array_size() * count_attribute_slots(t->element_type()); + + if (t->is_matrix()) + return t->matrix_columns; + + return 1; +} + + +/** + * Verify that a vertex shader executable meets all semantic requirements + * + * \param shader Vertex shader executable to be verified + */ +bool +validate_vertex_shader_executable(struct glsl_program *prog, + struct glsl_shader *shader) +{ + if (shader == NULL) + return true; + + if (!shader->symbols->get_function("main")) { + linker_error_printf(prog, "vertex shader lacks `main'\n"); + return false; + } + + find_assignment_visitor find("gl_Position"); + find.run(&shader->ir); + if (!find.variable_found()) { + linker_error_printf(prog, + "vertex shader does not write to `gl_Position'\n"); + return false; + } + + return true; +} + + +/** + * Verify that a fragment shader executable meets all semantic requirements + * + * \param shader Fragment shader executable to be verified + */ +bool +validate_fragment_shader_executable(struct glsl_program *prog, + struct glsl_shader *shader) +{ + if (shader == NULL) + return true; + + if (!shader->symbols->get_function("main")) { + linker_error_printf(prog, "fragment shader lacks `main'\n"); + return false; + } + + find_assignment_visitor frag_color("gl_FragColor"); + find_assignment_visitor frag_data("gl_FragData"); + + frag_color.run(&shader->ir); + frag_data.run(&shader->ir); + + if (!frag_color.variable_found() && !frag_data.variable_found()) { + linker_error_printf(prog, "fragment shader does not write to " + "`gl_FragColor' or `gl_FragData'\n"); + return false; + } + + if (frag_color.variable_found() && frag_data.variable_found()) { + linker_error_printf(prog, "fragment shader writes to both " + "`gl_FragColor' and `gl_FragData'\n"); + return false; + } + + return true; +} + + +/** + * Perform validation of uniforms used across multiple shader stages + */ +bool +cross_validate_uniforms(struct glsl_program *prog) +{ + /* Examine all of the uniforms in all of the shaders and cross validate + * them. + */ + glsl_symbol_table uniforms; + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + foreach_list(node, &prog->_LinkedShaders[i]->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_uniform)) + continue; + + /* If a uniform with this name has already been seen, verify that the + * new instance has the same type. In addition, if the uniforms have + * initializers, the values of the initializers must be the same. + */ + ir_variable *const existing = uniforms.get_variable(var->name); + if (existing != NULL) { + if (var->type != existing->type) { + linker_error_printf(prog, "uniform `%s' declared as type " + "`%s' and type `%s'\n", + var->name, var->type->name, + existing->type->name); + return false; + } + + if (var->constant_value != NULL) { + if (existing->constant_value != NULL) { + if (!var->constant_value->has_value(existing->constant_value)) { + linker_error_printf(prog, "initializers for uniform " + "`%s' have differing values\n", + var->name); + return false; + } + } else + /* If the first-seen instance of a particular uniform did not + * have an initializer but a later instance does, copy the + * initializer to the version stored in the symbol table. + */ + existing->constant_value = + (ir_constant *)var->constant_value->clone(NULL); + } + } else + uniforms.add_variable(var->name, var); + } + } + + return true; +} + + +/** + * Validate that outputs from one stage match inputs of another + */ +bool +cross_validate_outputs_to_inputs(struct glsl_program *prog, + glsl_shader *producer, glsl_shader *consumer) +{ + glsl_symbol_table parameters; + /* FINISHME: Figure these out dynamically. */ + const char *const producer_stage = "vertex"; + const char *const consumer_stage = "fragment"; + + /* Find all shader outputs in the "producer" stage. + */ + foreach_list(node, &producer->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + /* FINISHME: For geometry shaders, this should also look for inout + * FINISHME: variables. + */ + if ((var == NULL) || (var->mode != ir_var_out)) + continue; + + parameters.add_variable(var->name, var); + } + + + /* Find all shader inputs in the "consumer" stage. Any variables that have + * matching outputs already in the symbol table must have the same type and + * qualifiers. + */ + foreach_list(node, &consumer->ir) { + ir_variable *const input = ((ir_instruction *) node)->as_variable(); + + /* FINISHME: For geometry shaders, this should also look for inout + * FINISHME: variables. + */ + if ((input == NULL) || (input->mode != ir_var_in)) + continue; + + ir_variable *const output = parameters.get_variable(input->name); + if (output != NULL) { + /* Check that the types match between stages. + */ + if (input->type != output->type) { + linker_error_printf(prog, + "%s shader output `%s' delcared as " + "type `%s', but %s shader input declared " + "as type `%s'\n", + producer_stage, output->name, + output->type->name, + consumer_stage, input->type->name); + return false; + } + + /* Check that all of the qualifiers match between stages. + */ + if (input->centroid != output->centroid) { + linker_error_printf(prog, + "%s shader output `%s' %s centroid qualifier, " + "but %s shader input %s centroid qualifier\n", + producer_stage, + output->name, + (output->centroid) ? "has" : "lacks", + consumer_stage, + (input->centroid) ? "has" : "lacks"); + return false; + } + + if (input->invariant != output->invariant) { + linker_error_printf(prog, + "%s shader output `%s' %s invariant qualifier, " + "but %s shader input %s invariant qualifier\n", + producer_stage, + output->name, + (output->invariant) ? "has" : "lacks", + consumer_stage, + (input->invariant) ? "has" : "lacks"); + return false; + } + + if (input->interpolation != output->interpolation) { + linker_error_printf(prog, + "%s shader output `%s' specifies %s " + "interpolation qualifier, " + "but %s shader input specifies %s " + "interpolation qualifier\n", + producer_stage, + output->name, + output->interpolation_string(), + consumer_stage, + input->interpolation_string()); + return false; + } + } + } + + return true; +} + + +struct uniform_node { + exec_node link; + struct gl_uniform *u; + unsigned slots; +}; + +void +assign_uniform_locations(struct glsl_program *prog) +{ + /* */ + exec_list uniforms; + unsigned total_uniforms = 0; + hash_table *ht = hash_table_ctor(32, hash_table_string_hash, + hash_table_string_compare); + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + unsigned next_position = 0; + + foreach_list(node, &prog->_LinkedShaders[i]->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_uniform)) + continue; + + const unsigned vec4_slots = (var->component_slots() + 3) / 4; + assert(vec4_slots != 0); + + uniform_node *n = (uniform_node *) hash_table_find(ht, var->name); + if (n == NULL) { + n = (uniform_node *) calloc(1, sizeof(struct uniform_node)); + n->u = (gl_uniform *) calloc(vec4_slots, sizeof(struct gl_uniform)); + n->slots = vec4_slots; + + n->u[0].Name = strdup(var->name); + for (unsigned j = 1; j < vec4_slots; j++) + n->u[j].Name = n->u[0].Name; + + hash_table_insert(ht, n, n->u[0].Name); + uniforms.push_tail(& n->link); + total_uniforms += vec4_slots; + } + + if (var->constant_value != NULL) + for (unsigned j = 0; j < vec4_slots; j++) + n->u[j].Initialized = true; + + var->location = next_position; + + for (unsigned j = 0; j < vec4_slots; j++) { + switch (prog->_LinkedShaders[i]->Type) { + case GL_VERTEX_SHADER: + n->u[j].VertPos = next_position; + break; + case GL_FRAGMENT_SHADER: + n->u[j].FragPos = next_position; + break; + case GL_GEOMETRY_SHADER: + /* FINISHME: Support geometry shaders. */ + assert(prog->_LinkedShaders[i]->Type != GL_GEOMETRY_SHADER); + break; + } + + next_position++; + } + } + } + + gl_uniform_list *ul = (gl_uniform_list *) + calloc(1, sizeof(gl_uniform_list)); + + ul->Size = total_uniforms; + ul->NumUniforms = total_uniforms; + ul->Uniforms = (gl_uniform *) calloc(total_uniforms, sizeof(gl_uniform)); + + unsigned idx = 0; + uniform_node *next; + for (uniform_node *node = (uniform_node *) uniforms.head + ; node->link.next != NULL + ; node = next) { + next = (uniform_node *) node->link.next; + + node->link.remove(); + memcpy(&ul->Uniforms[idx], node->u, sizeof(gl_uniform) * node->slots); + idx += node->slots; + + free(node->u); + free(node); + } + + hash_table_dtor(ht); + + prog->Uniforms = ul; +} + + +/** + * Find a contiguous set of available bits in a bitmask + * + * \param used_mask Bits representing used (1) and unused (0) locations + * \param needed_count Number of contiguous bits needed. + * + * \return + * Base location of the available bits on success or -1 on failure. + */ +int +find_available_slots(unsigned used_mask, unsigned needed_count) +{ + unsigned needed_mask = (1 << needed_count) - 1; + const int max_bit_to_test = (8 * sizeof(used_mask)) - needed_count; + + /* The comparison to 32 is redundant, but without it GCC emits "warning: + * cannot optimize possibly infinite loops" for the loop below. + */ + if ((needed_count == 0) || (max_bit_to_test < 0) || (max_bit_to_test > 32)) + return -1; + + for (int i = 0; i <= max_bit_to_test; i++) { + if ((needed_mask & ~used_mask) == needed_mask) + return i; + + needed_mask <<= 1; + } + + return -1; +} + + +bool +assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index) +{ + /* Mark invalid attribute locations as being used. + */ + unsigned used_locations = (max_attribute_index >= 32) + ? ~0 : ~((1 << max_attribute_index) - 1); + + glsl_shader *const sh = prog->_LinkedShaders[0]; + assert(sh->Type == GL_VERTEX_SHADER); + + /* Operate in a total of four passes. + * + * 1. Invalidate the location assignments for all vertex shader inputs. + * + * 2. Assign locations for inputs that have user-defined (via + * glBindVertexAttribLocation) locatoins. + * + * 3. Sort the attributes without assigned locations by number of slots + * required in decreasing order. Fragmentation caused by attribute + * locations assigned by the application may prevent large attributes + * from having enough contiguous space. + * + * 4. Assign locations to any inputs without assigned locations. + */ + + invalidate_variable_locations(sh, ir_var_in, VERT_ATTRIB_GENERIC0); + + if (prog->Attributes != NULL) { + for (unsigned i = 0; i < prog->Attributes->NumParameters; i++) { + ir_variable *const var = + sh->symbols->get_variable(prog->Attributes->Parameters[i].Name); + + /* Note: attributes that occupy multiple slots, such as arrays or + * matrices, may appear in the attrib array multiple times. + */ + if ((var == NULL) || (var->location != -1)) + continue; + + /* From page 61 of the OpenGL 4.0 spec: + * + * "LinkProgram will fail if the attribute bindings assigned by + * BindAttribLocation do not leave not enough space to assign a + * location for an active matrix attribute or an active attribute + * array, both of which require multiple contiguous generic + * attributes." + * + * Previous versions of the spec contain similar language but omit the + * bit about attribute arrays. + * + * Page 61 of the OpenGL 4.0 spec also says: + * + * "It is possible for an application to bind more than one + * attribute name to the same location. This is referred to as + * aliasing. This will only work if only one of the aliased + * attributes is active in the executable program, or if no path + * through the shader consumes more than one attribute of a set + * of attributes aliased to the same location. A link error can + * occur if the linker determines that every path through the + * shader consumes multiple aliased attributes, but + * implementations are not required to generate an error in this + * case." + * + * These two paragraphs are either somewhat contradictory, or I don't + * fully understand one or both of them. + */ + /* FINISHME: The code as currently written does not support attribute + * FINISHME: location aliasing (see comment above). + */ + const int attr = prog->Attributes->Parameters[i].StateIndexes[0]; + const unsigned slots = count_attribute_slots(var->type); + + /* Mask representing the contiguous slots that will be used by this + * attribute. + */ + const unsigned use_mask = (1 << slots) - 1; + + /* Generate a link error if the set of bits requested for this + * attribute overlaps any previously allocated bits. + */ + if ((~(use_mask << attr) & used_locations) != used_locations) { + linker_error_printf(prog, + "insufficient contiguous attribute locations " + "available for vertex shader input `%s'", + var->name); + return false; + } + + var->location = VERT_ATTRIB_GENERIC0 + attr; + used_locations |= (use_mask << attr); + } + } + + /* Temporary storage for the set of attributes that need locations assigned. + */ + struct temp_attr { + unsigned slots; + ir_variable *var; + + /* Used below in the call to qsort. */ + static int compare(const void *a, const void *b) + { + const temp_attr *const l = (const temp_attr *) a; + const temp_attr *const r = (const temp_attr *) b; + + /* Reversed because we want a descending order sort below. */ + return r->slots - l->slots; + } + } to_assign[16]; + + unsigned num_attr = 0; + + foreach_list(node, &sh->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_in)) + continue; + + /* The location was explicitly assigned, nothing to do here. + */ + if (var->location != -1) + continue; + + to_assign[num_attr].slots = count_attribute_slots(var->type); + to_assign[num_attr].var = var; + num_attr++; + } + + /* If all of the attributes were assigned locations by the application (or + * are built-in attributes with fixed locations), return early. This should + * be the common case. + */ + if (num_attr == 0) + return true; + + qsort(to_assign, num_attr, sizeof(to_assign[0]), temp_attr::compare); + + for (unsigned i = 0; i < num_attr; i++) { + /* Mask representing the contiguous slots that will be used by this + * attribute. + */ + const unsigned use_mask = (1 << to_assign[i].slots) - 1; + + int location = find_available_slots(used_locations, to_assign[i].slots); + + if (location < 0) { + linker_error_printf(prog, + "insufficient contiguous attribute locations " + "available for vertex shader input `%s'", + to_assign[i].var->name); + return false; + } + + to_assign[i].var->location = VERT_ATTRIB_GENERIC0 + location; + used_locations |= (use_mask << location); + } + + return true; +} + + +void +assign_varying_locations(glsl_shader *producer, glsl_shader *consumer) +{ + /* FINISHME: Set dynamically when geometry shader support is added. */ + unsigned output_index = VERT_RESULT_VAR0; + unsigned input_index = FRAG_ATTRIB_VAR0; + + /* Operate in a total of three passes. + * + * 1. Assign locations for any matching inputs and outputs. + * + * 2. Mark output variables in the producer that do not have locations as + * not being outputs. This lets the optimizer eliminate them. + * + * 3. Mark input variables in the consumer that do not have locations as + * not being inputs. This lets the optimizer eliminate them. + */ + + invalidate_variable_locations(producer, ir_var_out, VERT_RESULT_VAR0); + invalidate_variable_locations(consumer, ir_var_in, FRAG_ATTRIB_VAR0); + + foreach_list(node, &producer->ir) { + ir_variable *const output_var = ((ir_instruction *) node)->as_variable(); + + if ((output_var == NULL) || (output_var->mode != ir_var_out) + || (output_var->location != -1)) + continue; + + ir_variable *const input_var = + consumer->symbols->get_variable(output_var->name); + + if ((input_var == NULL) || (input_var->mode != ir_var_in)) + continue; + + assert(input_var->location == -1); + + /* FINISHME: Location assignment will need some changes when arrays, + * FINISHME: matrices, and structures are allowed as shader inputs / + * FINISHME: outputs. + */ + output_var->location = output_index; + input_var->location = input_index; + + output_index++; + input_index++; + } + + foreach_list(node, &producer->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_out)) + continue; + + /* An 'out' variable is only really a shader output if its value is read + * by the following stage. + */ + var->shader_out = (var->location != -1); + } + + foreach_list(node, &consumer->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_in)) + continue; + + /* An 'in' variable is only really a shader input if its value is written + * by the previous stage. + */ + var->shader_in = (var->location != -1); + } +} + + +void +link_shaders(struct glsl_program *prog) +{ + prog->LinkStatus = false; + prog->Validated = false; + prog->_Used = false; + + if (prog->InfoLog != NULL) + talloc_free(prog->InfoLog); + + prog->InfoLog = talloc_strdup(NULL, ""); + + /* Separate the shaders into groups based on their type. + */ + struct glsl_shader **vert_shader_list; + unsigned num_vert_shaders = 0; + struct glsl_shader **frag_shader_list; + unsigned num_frag_shaders = 0; + + vert_shader_list = (struct glsl_shader **) + calloc(2 * prog->NumShaders, sizeof(struct glsl_shader *)); + frag_shader_list = &vert_shader_list[prog->NumShaders]; + + for (unsigned i = 0; i < prog->NumShaders; i++) { + switch (prog->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + vert_shader_list[num_vert_shaders] = prog->Shaders[i]; + num_vert_shaders++; + break; + case GL_FRAGMENT_SHADER: + frag_shader_list[num_frag_shaders] = prog->Shaders[i]; + num_frag_shaders++; + break; + case GL_GEOMETRY_SHADER: + /* FINISHME: Support geometry shaders. */ + assert(prog->Shaders[i]->Type != GL_GEOMETRY_SHADER); + break; + } + } + + /* FINISHME: Implement intra-stage linking. */ + assert(num_vert_shaders <= 1); + assert(num_frag_shaders <= 1); + + /* Verify that each of the per-target executables is valid. + */ + if (!validate_vertex_shader_executable(prog, vert_shader_list[0]) + || !validate_fragment_shader_executable(prog, frag_shader_list[0])) + goto done; + + + prog->_LinkedShaders = (struct glsl_shader **) + calloc(2, sizeof(struct glsl_shader *)); + prog->_NumLinkedShaders = 0; + + if (num_vert_shaders > 0) { + prog->_LinkedShaders[prog->_NumLinkedShaders] = vert_shader_list[0]; + prog->_NumLinkedShaders++; + } + + if (num_frag_shaders > 0) { + prog->_LinkedShaders[prog->_NumLinkedShaders] = frag_shader_list[0]; + prog->_NumLinkedShaders++; + } + + /* Here begins the inter-stage linking phase. Some initial validation is + * performed, then locations are assigned for uniforms, attributes, and + * varyings. + */ + if (cross_validate_uniforms(prog)) { + /* Validate the inputs of each stage with the output of the preceeding + * stage. + */ + for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) { + if (!cross_validate_outputs_to_inputs(prog, + prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[i])) + goto done; + } + + prog->LinkStatus = true; + } + + /* FINISHME: Perform whole-program optimization here. */ + + assign_uniform_locations(prog); + + if (prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) + /* FINISHME: The value of the max_attribute_index parameter is + * FINISHME: implementation dependent based on the value of + * FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be + * FINISHME: at least 16, so hardcode 16 for now. + */ + if (!assign_attribute_locations(prog, 16)) + goto done; + + for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) + assign_varying_locations(prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[i]); + + /* FINISHME: Assign fragment shader output locations. */ + +done: + free(vert_shader_list); +} diff --git a/src/glsl/list.h b/src/glsl/list.h new file mode 100644 index 0000000000..7732d66d7a --- /dev/null +++ b/src/glsl/list.h @@ -0,0 +1,403 @@ +/* + * Copyright © 2008, 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 list.h + * \brief Doubly-linked list abstract container type. + * + * Each doubly-linked list has a sentinal head and tail node. These nodes + * contain no data. The head sentinal can be identified by its \c prev + * pointer being \c NULL. The tail sentinal can be identified by its + * \c next pointer being \c NULL. + * + * A list is empty if either the head sentinal's \c next pointer points to the + * tail sentinal or the tail sentinal's \c prev poiner points to the head + * sentinal. + * + * Instead of tracking two separate \c node structures and a \c list structure + * that points to them, the sentinal nodes are in a single structure. Noting + * that each sentinal node always has one \c NULL pointer, the \c NULL + * pointers occupy the same memory location. In the \c list structure + * contains a the following: + * + * - A \c head pointer that represents the \c next pointer of the + * head sentinal node. + * - A \c tail pointer that represents the \c prev pointer of the head + * sentinal node and the \c next pointer of the tail sentinal node. This + * pointer is \b always \c NULL. + * - A \c tail_prev pointer that represents the \c prev pointer of the + * tail sentinal node. + * + * Therefore, if \c head->next is \c NULL or \c tail_prev->prev is \c NULL, + * the list is empty. + * + * To anyone familiar with "exec lists" on the Amiga, this structure should + * be immediately recognizable. See the following link for the original Amiga + * operating system documentation on the subject. + * + * http://www.natami.net/dev/Libraries_Manual_guide/node02D7.html + * + * \author Ian Romanick + */ + +#pragma once +#ifndef LIST_CONTAINER_H +#define LIST_CONTAINER_H + +#ifndef __cplusplus +#include +#include +#else +extern "C" { +#include +} +#endif + +#include + +struct exec_node { + struct exec_node *next; + struct exec_node *prev; + +#ifdef __cplusplus + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *node) + { + talloc_free(node); + } + + exec_node() : next(NULL), prev(NULL) + { + /* empty */ + } + + const exec_node *get_next() const + { + return next; + } + + exec_node *get_next() + { + return next; + } + + const exec_node *get_prev() const + { + return prev; + } + + exec_node *get_prev() + { + return prev; + } + + void remove() + { + next->prev = prev; + prev->next = next; + next = NULL; + prev = NULL; + } + + /** + * Link a node with itself + * + * This creates a sort of degenerate list that is occasionally useful. + */ + void self_link() + { + next = this; + prev = this; + } + + /** + * Insert a node in the list after the current node + */ + void insert_after(exec_node *after) + { + after->next = this->next; + after->prev = this; + + this->next->prev = after; + this->next = after; + } + /** + * Insert a node in the list before the current node + */ + void insert_before(exec_node *before) + { + before->next = this; + before->prev = this->prev; + + this->prev->next = before; + this->prev = before; + } + + /** + * Is this the sentinal at the tail of the list? + */ + bool is_tail_sentinal() const + { + return this->next == NULL; + } + + /** + * Is this the sentinal at the head of the list? + */ + bool is_head_sentinal() const + { + return this->prev == NULL; + } +#endif +}; + + +#ifdef __cplusplus +/* This macro will not work correctly if `t' uses virtual inheritance. If you + * are using virtual inheritance, you deserve a slow and painful death. Enjoy! + */ +#define exec_list_offsetof(t, f, p) \ + (((char *) &((t *) p)->f) - ((char *) p)) +#else +#define exec_list_offsetof(t, f, p) offsetof(t, f) +#endif + +/** + * Get a pointer to the structure containing an exec_node + * + * Given a pointer to an \c exec_node embedded in a structure, get a pointer to + * the containing structure. + * + * \param type Base type of the structure containing the node + * \param node Pointer to the \c exec_node + * \param field Name of the field in \c type that is the embedded \c exec_node + */ +#define exec_node_data(type, node, field) \ + ((type *) (((char *) node) - exec_list_offsetof(type, field, node))) + +#ifdef __cplusplus +struct exec_node; + +class iterator { +public: + void next() + { + } + + void *get() + { + return NULL; + } + + bool has_next() const + { + return false; + } +}; + +class exec_list_iterator : public iterator { +public: + exec_list_iterator(exec_node *n) : node(n), _next(n->next) + { + /* empty */ + } + + void next() + { + node = _next; + _next = node->next; + } + + void remove() + { + node->remove(); + } + + exec_node *get() + { + return node; + } + + bool has_next() const + { + return _next != NULL; + } + +private: + exec_node *node; + exec_node *_next; +}; + +#define foreach_iter(iter_type, iter, container) \ + for (iter_type iter = (container) . iterator(); iter.has_next(); iter.next()) +#endif + + +struct exec_list { + struct exec_node *head; + struct exec_node *tail; + struct exec_node *tail_pred; + +#ifdef __cplusplus + exec_list() + { + make_empty(); + } + + void make_empty() + { + head = (exec_node *) & tail; + tail = NULL; + tail_pred = (exec_node *) & head; + } + + bool is_empty() const + { + /* There are three ways to test whether a list is empty or not. + * + * - Check to see if the \c head points to the \c tail. + * - Check to see if the \c tail_pred points to the \c head. + * - Check to see if the \c head is the sentinal node by test whether its + * \c next pointer is \c NULL. + * + * The first two methods tend to generate better code on modern systems + * because they save a pointer dereference. + */ + return head == (exec_node *) &tail; + } + + const exec_node *get_head() const + { + return !is_empty() ? head : NULL; + } + + exec_node *get_head() + { + return !is_empty() ? head : NULL; + } + + const exec_node *get_tail() const + { + return !is_empty() ? tail_pred : NULL; + } + + exec_node *get_tail() + { + return !is_empty() ? tail_pred : NULL; + } + + void push_head(exec_node *n) + { + n->next = head; + n->prev = (exec_node *) &head; + + n->next->prev = n; + head = n; + } + + void push_tail(exec_node *n) + { + n->next = (exec_node *) &tail; + n->prev = tail_pred; + + n->prev->next = n; + tail_pred = n; + } + + void push_degenerate_list_at_head(exec_node *n) + { + assert(n->prev->next == n); + + n->prev->next = head; + head->prev = n->prev; + n->prev = (exec_node *) &head; + head = n; + } + + /** + * Move all of the nodes from this list to the target list + */ + void move_nodes_to(exec_list *target) + { + if (is_empty()) { + target->make_empty(); + } else { + target->head = head; + target->tail = NULL; + target->tail_pred = tail_pred; + + target->head->prev = (exec_node *) &target->head; + target->tail_pred->next = (exec_node *) &target->tail; + + make_empty(); + } + } + + exec_list_iterator iterator() + { + return exec_list_iterator(head); + } + + exec_list_iterator iterator() const + { + return exec_list_iterator((exec_node *) head); + } +#endif +}; + +#define foreach_list(__node, __list) \ + for (exec_node * __node = (__list)->head \ + ; (__node)->next != NULL \ + ; (__node) = (__node)->next) + +#define foreach_list_const(__node, __list) \ + for (const exec_node * __node = (__list)->head \ + ; (__node)->next != NULL \ + ; (__node) = (__node)->next) + +#define foreach_list_typed(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)->head, __field); \ + (__node)->__field.next != NULL; \ + (__node) = exec_node_data(__type, (__node)->__field.next, __field)) + +#define foreach_list_typed_const(__type, __node, __field, __list) \ + for (const __type * __node = \ + exec_node_data(__type, (__list)->head, __field); \ + (__node)->__field.next != NULL; \ + (__node) = exec_node_data(__type, (__node)->__field.next, __field)) + +#endif /* LIST_CONTAINER_H */ diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp new file mode 100644 index 0000000000..dcd9bd69c0 --- /dev/null +++ b/src/glsl/main.cpp @@ -0,0 +1,256 @@ +/* + * Copyright © 2008, 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. + */ +#include +#include +#include + +#include +#include +#include +#include + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" +#include "ir_optimization.h" +#include "ir_print_visitor.h" +#include "program.h" + +/* Returned string will have 'ctx' as its talloc owner. */ +static char * +load_text_file(void *ctx, const char *file_name, size_t *size) +{ + char *text = NULL; + struct stat st; + ssize_t total_read = 0; + int fd = open(file_name, O_RDONLY); + + *size = 0; + if (fd < 0) { + return NULL; + } + + if (fstat(fd, & st) == 0) { + text = (char *) talloc_size(ctx, st.st_size + 1); + if (text != NULL) { + do { + ssize_t bytes = read(fd, text + total_read, + st.st_size - total_read); + if (bytes < 0) { + free(text); + text = NULL; + break; + } + + if (bytes == 0) { + break; + } + + total_read += bytes; + } while (total_read < st.st_size); + + text[total_read] = '\0'; + *size = total_read; + } + } + + close(fd); + + return text; +} + + +void +usage_fail(const char *name) +{ + printf("%s \n", name); + exit(EXIT_FAILURE); +} + + +int dump_ast = 0; +int dump_lir = 0; +int do_link = 0; + +const struct option compiler_opts[] = { + { "dump-ast", 0, &dump_ast, 1 }, + { "dump-lir", 0, &dump_lir, 1 }, + { "link", 0, &do_link, 1 }, + { NULL, 0, NULL, 0 } +}; + +void +compile_shader(struct glsl_shader *shader) +{ + struct _mesa_glsl_parse_state *state; + + state = talloc_zero(talloc_parent(shader), struct _mesa_glsl_parse_state); + + switch (shader->Type) { + case GL_VERTEX_SHADER: state->target = vertex_shader; break; + case GL_FRAGMENT_SHADER: state->target = fragment_shader; break; + case GL_GEOMETRY_SHADER: state->target = geometry_shader; break; + } + + state->scanner = NULL; + state->translation_unit.make_empty(); + state->symbols = new(shader) glsl_symbol_table; + state->info_log = talloc_strdup(shader, ""); + state->error = false; + state->temp_index = 0; + state->loop_or_switch_nesting = NULL; + state->ARB_texture_rectangle_enable = true; + + /* Create a new context for the preprocessor output. Ultimately, this + * should probably be the parser context, but there isn't one yet. + */ + const char *source = shader->Source; + state->error = preprocess(shader, &source, &state->info_log); + + if (!state->error) { + _mesa_glsl_lexer_ctor(state, source); + _mesa_glsl_parse(state); + _mesa_glsl_lexer_dtor(state); + } + + if (dump_ast) { + foreach_list_const(n, &state->translation_unit) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf("\n\n"); + } + + shader->ir.make_empty(); + if (!state->error && !state->translation_unit.is_empty()) + _mesa_ast_to_hir(&shader->ir, state); + + validate_ir_tree(&shader->ir); + + /* Optimization passes */ + if (!state->error && !shader->ir.is_empty()) { + bool progress; + do { + progress = false; + + progress = do_function_inlining(&shader->ir) || progress; + progress = do_if_simplification(&shader->ir) || progress; + progress = do_copy_propagation(&shader->ir) || progress; + progress = do_dead_code_local(&shader->ir) || progress; + progress = do_dead_code_unlinked(&shader->ir) || progress; + progress = do_constant_variable_unlinked(&shader->ir) || progress; + progress = do_constant_folding(&shader->ir) || progress; + progress = do_vec_index_to_swizzle(&shader->ir) || progress; + progress = do_swizzle_swizzle(&shader->ir) || progress; + } while (progress); + } + + validate_ir_tree(&shader->ir); + + /* Print out the resulting IR */ + if (!state->error && dump_lir) { + _mesa_print_ir(&shader->ir, state); + } + + shader->symbols = state->symbols; + shader->CompileStatus = !state->error; + + if (shader->InfoLog) + talloc_free(shader->InfoLog); + + shader->InfoLog = state->info_log; + + talloc_free(state); + + return; +} + +int +main(int argc, char **argv) +{ + int status = EXIT_SUCCESS; + + int c; + int idx = 0; + while ((c = getopt_long(argc, argv, "", compiler_opts, &idx)) != -1) + /* empty */ ; + + + if (argc <= optind) + usage_fail(argv[0]); + + struct glsl_program *whole_program; + + whole_program = talloc_zero (NULL, struct glsl_program); + assert(whole_program != NULL); + + for (/* empty */; argc > optind; optind++) { + whole_program->Shaders = (struct glsl_shader **) + talloc_realloc(whole_program, whole_program->Shaders, + struct glsl_shader *, whole_program->NumShaders + 1); + assert(whole_program->Shaders != NULL); + + struct glsl_shader *shader = talloc_zero(whole_program, glsl_shader); + + whole_program->Shaders[whole_program->NumShaders] = shader; + whole_program->NumShaders++; + + const unsigned len = strlen(argv[optind]); + if (len < 6) + usage_fail(argv[0]); + + const char *const ext = & argv[optind][len - 5]; + if (strncmp(".vert", ext, 5) == 0) + shader->Type = GL_VERTEX_SHADER; + else if (strncmp(".geom", ext, 5) == 0) + shader->Type = GL_GEOMETRY_SHADER; + else if (strncmp(".frag", ext, 5) == 0) + shader->Type = GL_FRAGMENT_SHADER; + else + usage_fail(argv[0]); + + shader->Source = load_text_file(whole_program, + argv[optind], &shader->SourceLen); + if (shader->Source == NULL) { + printf("File \"%s\" does not exist.\n", argv[optind]); + exit(EXIT_FAILURE); + } + + compile_shader(shader); + + if (!shader->CompileStatus) { + printf("Info log for %s:\n%s\n", argv[optind], shader->InfoLog); + status = EXIT_FAILURE; + break; + } + } + + if ((status == EXIT_SUCCESS) && do_link) { + link_shaders(whole_program); + status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE; + } + + talloc_free(whole_program); + + return status; +} diff --git a/src/glsl/main/imports.h b/src/glsl/main/imports.h new file mode 100644 index 0000000000..d2197342c0 --- /dev/null +++ b/src/glsl/main/imports.h @@ -0,0 +1,6 @@ +#include +#include + +#define _mesa_malloc(x) malloc(x) +#define _mesa_free(x) free(x) +#define _mesa_calloc(x) calloc(1,x) diff --git a/src/glsl/main/mtypes.h b/src/glsl/main/mtypes.h new file mode 100644 index 0000000000..06e2dd4b54 --- /dev/null +++ b/src/glsl/main/mtypes.h @@ -0,0 +1,270 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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 mtypes.h + * Main Mesa data structures. + * + * Please try to mark derived values with a leading underscore ('_'). + */ + +#ifndef MTYPES_H +#define MTYPES_H + +#define MAX_DRAW_BUFFERS 8 +#define MAX_VARYING 16 + +#include + +/** + * Indexes for vertex program attributes. + * GL_NV_vertex_program aliases generic attributes over the conventional + * attributes. In GL_ARB_vertex_program shader the aliasing is optional. + * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the + * generic attributes are distinct/separate). + */ +typedef enum +{ + VERT_ATTRIB_POS = 0, + VERT_ATTRIB_WEIGHT = 1, + VERT_ATTRIB_NORMAL = 2, + VERT_ATTRIB_COLOR0 = 3, + VERT_ATTRIB_COLOR1 = 4, + VERT_ATTRIB_FOG = 5, + VERT_ATTRIB_COLOR_INDEX = 6, + VERT_ATTRIB_POINT_SIZE = 6, /*alias*/ + VERT_ATTRIB_EDGEFLAG = 7, + VERT_ATTRIB_TEX0 = 8, + VERT_ATTRIB_TEX1 = 9, + VERT_ATTRIB_TEX2 = 10, + VERT_ATTRIB_TEX3 = 11, + VERT_ATTRIB_TEX4 = 12, + VERT_ATTRIB_TEX5 = 13, + VERT_ATTRIB_TEX6 = 14, + VERT_ATTRIB_TEX7 = 15, + VERT_ATTRIB_GENERIC0 = 16, + VERT_ATTRIB_GENERIC1 = 17, + VERT_ATTRIB_GENERIC2 = 18, + VERT_ATTRIB_GENERIC3 = 19, + VERT_ATTRIB_GENERIC4 = 20, + VERT_ATTRIB_GENERIC5 = 21, + VERT_ATTRIB_GENERIC6 = 22, + VERT_ATTRIB_GENERIC7 = 23, + VERT_ATTRIB_GENERIC8 = 24, + VERT_ATTRIB_GENERIC9 = 25, + VERT_ATTRIB_GENERIC10 = 26, + VERT_ATTRIB_GENERIC11 = 27, + VERT_ATTRIB_GENERIC12 = 28, + VERT_ATTRIB_GENERIC13 = 29, + VERT_ATTRIB_GENERIC14 = 30, + VERT_ATTRIB_GENERIC15 = 31, + VERT_ATTRIB_MAX = 32 +} gl_vert_attrib; + +/** + * Bitflags for vertex attributes. + * These are used in bitfields in many places. + */ +/*@{*/ +#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) +#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) +#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) +#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) +#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) +#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) +#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX) +#define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG) +#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) +#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) +#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) +#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) +#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) +#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) +#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) +#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) +#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) +#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) +#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) +#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) +#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4) +#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5) +#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6) +#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7) +#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8) +#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9) +#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10) +#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11) +#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12) +#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13) +#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14) +#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15) + +#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) +#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) +/*@}*/ + + +/** + * Indexes for vertex program result attributes + */ +typedef enum +{ + VERT_RESULT_HPOS = 0, + VERT_RESULT_COL0 = 1, + VERT_RESULT_COL1 = 2, + VERT_RESULT_FOGC = 3, + VERT_RESULT_TEX0 = 4, + VERT_RESULT_TEX1 = 5, + VERT_RESULT_TEX2 = 6, + VERT_RESULT_TEX3 = 7, + VERT_RESULT_TEX4 = 8, + VERT_RESULT_TEX5 = 9, + VERT_RESULT_TEX6 = 10, + VERT_RESULT_TEX7 = 11, + VERT_RESULT_PSIZ = 12, + VERT_RESULT_BFC0 = 13, + VERT_RESULT_BFC1 = 14, + VERT_RESULT_EDGE = 15, + VERT_RESULT_VAR0 = 16, /**< shader varying */ + VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) +} gl_vert_result; + + +/** + * Indexes for fragment program input attributes. + */ +typedef enum +{ + FRAG_ATTRIB_WPOS = 0, + FRAG_ATTRIB_COL0 = 1, + FRAG_ATTRIB_COL1 = 2, + FRAG_ATTRIB_FOGC = 3, + FRAG_ATTRIB_TEX0 = 4, + FRAG_ATTRIB_TEX1 = 5, + FRAG_ATTRIB_TEX2 = 6, + FRAG_ATTRIB_TEX3 = 7, + FRAG_ATTRIB_TEX4 = 8, + FRAG_ATTRIB_TEX5 = 9, + FRAG_ATTRIB_TEX6 = 10, + FRAG_ATTRIB_TEX7 = 11, + FRAG_ATTRIB_FACE = 12, /**< front/back face */ + FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */ + FRAG_ATTRIB_VAR0 = 14, /**< shader varying */ + FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) +} gl_frag_attrib; + +/** + * Bitflags for fragment program input attributes. + */ +/*@{*/ +#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) +#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) +#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) +#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) +#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE) +#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC) +#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) +#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) +#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) +#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) +#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) +#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) +#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) +#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) +#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) + +#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) +#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) + +#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ + FRAG_BIT_TEX1| \ + FRAG_BIT_TEX2| \ + FRAG_BIT_TEX3| \ + FRAG_BIT_TEX4| \ + FRAG_BIT_TEX5| \ + FRAG_BIT_TEX6| \ + FRAG_BIT_TEX7) +/*@}*/ + + +/** + * Fragment program results + */ +typedef enum +{ + FRAG_RESULT_DEPTH = 0, + FRAG_RESULT_COLOR = 1, + FRAG_RESULT_DATA0 = 2, + FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) +} gl_frag_result; + +/** + * Names of the various vertex/fragment program register files, etc. + * + * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c) + * All values should fit in a 4-bit field. + * + * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM, + * PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to + * be "uniform" variables since they can only be set outside glBegin/End. + * They're also all stored in the same Parameters array. + */ +typedef enum +{ + PROGRAM_TEMPORARY, /**< machine->Temporary[] */ + PROGRAM_INPUT, /**< machine->Inputs[] */ + PROGRAM_OUTPUT, /**< machine->Outputs[] */ + PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */ + PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */ + PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ + PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */ + PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ + PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ + PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ + PROGRAM_ADDRESS, /**< machine->AddressReg */ + PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ + PROGRAM_UNDEFINED, /**< Invalid/TBD value */ + PROGRAM_FILE_MAX +} gl_register_file; + +/** + * An index for each type of texture object. These correspond to the GL + * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. + * Note: the order is from highest priority to lowest priority. + */ +typedef enum +{ + TEXTURE_2D_ARRAY_INDEX, + TEXTURE_1D_ARRAY_INDEX, + TEXTURE_CUBE_INDEX, + TEXTURE_3D_INDEX, + TEXTURE_RECT_INDEX, + TEXTURE_2D_INDEX, + TEXTURE_1D_INDEX, + NUM_TEXTURE_TARGETS +} gl_texture_index; + +#endif /* MTYPES_H */ diff --git a/src/glsl/main/simple_list.h b/src/glsl/main/simple_list.h new file mode 100644 index 0000000000..5ef39e14cc --- /dev/null +++ b/src/glsl/main/simple_list.h @@ -0,0 +1,235 @@ +/** + * \file simple_list.h + * Simple macros for type-safe, intrusive lists. + * + * Intended to work with a list sentinal which is created as an empty + * list. Insert & delete are O(1). + * + * \author + * (C) 1997, Keith Whitwell + */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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. + */ + + +#ifndef _SIMPLE_LIST_H +#define _SIMPLE_LIST_H + +struct simple_node { + struct simple_node *next; + struct simple_node *prev; +}; + +/** + * Remove an element from list. + * + * \param elem element to remove. + */ +#define remove_from_list(elem) \ +do { \ + (elem)->next->prev = (elem)->prev; \ + (elem)->prev->next = (elem)->next; \ +} while (0) + +/** + * Insert an element to the list head. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_head(list, elem) \ +do { \ + (elem)->prev = list; \ + (elem)->next = (list)->next; \ + (list)->next->prev = elem; \ + (list)->next = elem; \ +} while(0) + +/** + * Insert an element to the list tail. + * + * \param list list. + * \param elem element to insert. + */ +#define insert_at_tail(list, elem) \ +do { \ + (elem)->next = list; \ + (elem)->prev = (list)->prev; \ + (list)->prev->next = elem; \ + (list)->prev = elem; \ +} while(0) + +/** + * Move an element to the list head. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_head(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_head(list, elem); \ +} while (0) + +/** + * Move an element to the list tail. + * + * \param list list. + * \param elem element to move. + */ +#define move_to_tail(list, elem) \ +do { \ + remove_from_list(elem); \ + insert_at_tail(list, elem); \ +} while (0) + +/** + * Consatinate a cyclic list to a list + * + * Appends the sequence of nodes starting with \c tail to the list \c head. + * A "cyclic list" is a list that does not have a sentinal node. This means + * that the data pointed to by \c tail is an actual node, not a dataless + * sentinal. Note that if \c tail constist of a single node, this macro + * behaves identically to \c insert_at_tail + * + * \param head Head of the list to be appended to. This may or may not + * be a cyclic list. + * \param tail Head of the cyclic list to be appended to \c head. + * \param temp Temporary \c simple_list used by the macro + * + * \sa insert_at_tail + */ +#define concat_list_and_cycle(head, tail, temp) \ +do { \ + (head)->prev->next = (tail); \ + (tail)->prev->next = (head); \ + (temp) = (head)->prev; \ + (head)->prev = (tail)->prev; \ + (tail)->prev = (temp); \ +} while (0) + +#define concat_list(head, next_list) \ +do { \ + (next_list)->next->prev = (head)->prev; \ + (next_list)->prev->next = (head); \ + (head)->prev->next = (next_list)->next; \ + (head)->prev = (next_list)->prev; \ +} while (0) + +/** + * Make a empty list empty. + * + * \param sentinal list (sentinal element). + */ +#define make_empty_list(sentinal) \ +do { \ + (sentinal)->next = sentinal; \ + (sentinal)->prev = sentinal; \ +} while (0) + +/** + * Get list first element. + * + * \param list list. + * + * \return pointer to first element. + */ +#define first_elem(list) ((list)->next) + +/** + * Get list last element. + * + * \param list list. + * + * \return pointer to last element. + */ +#define last_elem(list) ((list)->prev) + +/** + * Get next element. + * + * \param elem element. + * + * \return pointer to next element. + */ +#define next_elem(elem) ((elem)->next) + +/** + * Get previous element. + * + * \param elem element. + * + * \return pointer to previous element. + */ +#define prev_elem(elem) ((elem)->prev) + +/** + * Test whether element is at end of the list. + * + * \param list list. + * \param elem element. + * + * \return non-zero if element is at end of list, or zero otherwise. + */ +#define at_end(list, elem) ((elem) == (list)) + +/** + * Test if a list is empty. + * + * \param list list. + * + * \return non-zero if list empty, or zero otherwise. + */ +#define is_empty_list(list) ((list)->next == (list)) + +/** + * Walk through the elements of a list. + * + * \param ptr pointer to the current element. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach(ptr, list) \ + for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) + +/** + * Walk through the elements of a list. + * + * Same as #foreach but lets you unlink the current value during a list + * traversal. Useful for freeing a list, element by element. + * + * \param ptr pointer to the current element. + * \param t temporary pointer. + * \param list list. + * + * \note It should be followed by a { } block or a single statement, as in a \c + * for loop. + */ +#define foreach_s(ptr, t, list) \ + for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) + +#endif diff --git a/src/glsl/mesa/shader/prog_instruction.c b/src/glsl/mesa/shader/prog_instruction.c new file mode 100644 index 0000000000..fbcf868f50 --- /dev/null +++ b/src/glsl/mesa/shader/prog_instruction.c @@ -0,0 +1,363 @@ +/* + * Mesa 3-D graphics library + * Version: 7.3 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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. + */ + + +#define _GNU_SOURCE +#include +#include +#include + +#if 0 +#include "main/glheader.h" +#else +#define _mesa_strdup strdup +#define _mesa_snprintf snprintf +#define ASSERT assert +#endif +#include "main/imports.h" +#include "main/mtypes.h" +#include "prog_instruction.h" + + +/** + * Initialize program instruction fields to defaults. + * \param inst first instruction to initialize + * \param count number of instructions to initialize + */ +void +_mesa_init_instructions(struct prog_instruction *inst, GLuint count) +{ + GLuint i; + + memset(inst, 0, count * sizeof(struct prog_instruction)); + + for (i = 0; i < count; i++) { + inst[i].SrcReg[0].File = PROGRAM_UNDEFINED; + inst[i].SrcReg[0].Swizzle = SWIZZLE_NOOP; + inst[i].SrcReg[1].File = PROGRAM_UNDEFINED; + inst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP; + inst[i].SrcReg[2].File = PROGRAM_UNDEFINED; + inst[i].SrcReg[2].Swizzle = SWIZZLE_NOOP; + + inst[i].DstReg.File = PROGRAM_UNDEFINED; + inst[i].DstReg.WriteMask = WRITEMASK_XYZW; + inst[i].DstReg.CondMask = COND_TR; + inst[i].DstReg.CondSwizzle = SWIZZLE_NOOP; + + inst[i].SaturateMode = SATURATE_OFF; + inst[i].Precision = FLOAT32; + } +} + + +/** + * Allocate an array of program instructions. + * \param numInst number of instructions + * \return pointer to instruction memory + */ +struct prog_instruction * +_mesa_alloc_instructions(GLuint numInst) +{ + return (struct prog_instruction *) + calloc(1, numInst * sizeof(struct prog_instruction)); +} + + +/** + * Reallocate memory storing an array of program instructions. + * This is used when we need to append additional instructions onto an + * program. + * \param oldInst pointer to first of old/src instructions + * \param numOldInst number of instructions at + * \param numNewInst desired size of new instruction array. + * \return pointer to start of new instruction array. + */ +struct prog_instruction * +_mesa_realloc_instructions(struct prog_instruction *oldInst, + GLuint numOldInst, GLuint numNewInst) +{ + struct prog_instruction *newInst; + + (void)numOldInst; + newInst = (struct prog_instruction *) + realloc(oldInst, + numNewInst * sizeof(struct prog_instruction)); + + return newInst; +} + + +/** + * Copy an array of program instructions. + * \param dest pointer to destination. + * \param src pointer to source. + * \param n number of instructions to copy. + * \return pointer to destination. + */ +struct prog_instruction * +_mesa_copy_instructions(struct prog_instruction *dest, + const struct prog_instruction *src, GLuint n) +{ + GLuint i; + memcpy(dest, src, n * sizeof(struct prog_instruction)); + for (i = 0; i < n; i++) { + if (src[i].Comment) + dest[i].Comment = _mesa_strdup(src[i].Comment); + } + return dest; +} + + +/** + * Free an array of instructions + */ +void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count) +{ + GLuint i; + for (i = 0; i < count; i++) { + if (inst[i].Data) + free(inst[i].Data); + if (inst[i].Comment) + free((char *) inst[i].Comment); + } + free(inst); +} + + +/** + * Basic info about each instruction + */ +struct instruction_info +{ + gl_inst_opcode Opcode; + const char *Name; + GLuint NumSrcRegs; + GLuint NumDstRegs; +}; + +/** + * Instruction info + * \note Opcode should equal array index! + */ +static const struct instruction_info InstInfo[MAX_OPCODE] = { + { OPCODE_NOP, "NOP", 0, 0 }, + { OPCODE_ABS, "ABS", 1, 1 }, + { OPCODE_ADD, "ADD", 2, 1 }, + { OPCODE_AND, "AND", 2, 1 }, + { OPCODE_ARA, "ARA", 1, 1 }, + { OPCODE_ARL, "ARL", 1, 1 }, + { OPCODE_ARL_NV, "ARL_NV", 1, 1 }, + { OPCODE_ARR, "ARL", 1, 1 }, + { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 }, + { OPCODE_BGNSUB, "BGNSUB", 0, 0 }, + { OPCODE_BRA, "BRA", 0, 0 }, + { OPCODE_BRK, "BRK", 0, 0 }, + { OPCODE_CAL, "CAL", 0, 0 }, + { OPCODE_CMP, "CMP", 3, 1 }, + { OPCODE_CONT, "CONT", 0, 0 }, + { OPCODE_COS, "COS", 1, 1 }, + { OPCODE_DDX, "DDX", 1, 1 }, + { OPCODE_DDY, "DDY", 1, 1 }, + { OPCODE_DP2, "DP2", 2, 1 }, + { OPCODE_DP2A, "DP2A", 3, 1 }, + { OPCODE_DP3, "DP3", 2, 1 }, + { OPCODE_DP4, "DP4", 2, 1 }, + { OPCODE_DPH, "DPH", 2, 1 }, + { OPCODE_DST, "DST", 2, 1 }, + { OPCODE_ELSE, "ELSE", 0, 0 }, + { OPCODE_END, "END", 0, 0 }, + { OPCODE_ENDIF, "ENDIF", 0, 0 }, + { OPCODE_ENDLOOP,"ENDLOOP", 0, 0 }, + { OPCODE_ENDSUB, "ENDSUB", 0, 0 }, + { OPCODE_EX2, "EX2", 1, 1 }, + { OPCODE_EXP, "EXP", 1, 1 }, + { OPCODE_FLR, "FLR", 1, 1 }, + { OPCODE_FRC, "FRC", 1, 1 }, + { OPCODE_IF, "IF", 1, 0 }, + { OPCODE_KIL, "KIL", 1, 0 }, + { OPCODE_KIL_NV, "KIL_NV", 0, 0 }, + { OPCODE_LG2, "LG2", 1, 1 }, + { OPCODE_LIT, "LIT", 1, 1 }, + { OPCODE_LOG, "LOG", 1, 1 }, + { OPCODE_LRP, "LRP", 3, 1 }, + { OPCODE_MAD, "MAD", 3, 1 }, + { OPCODE_MAX, "MAX", 2, 1 }, + { OPCODE_MIN, "MIN", 2, 1 }, + { OPCODE_MOV, "MOV", 1, 1 }, + { OPCODE_MUL, "MUL", 2, 1 }, + { OPCODE_NOISE1, "NOISE1", 1, 1 }, + { OPCODE_NOISE2, "NOISE2", 1, 1 }, + { OPCODE_NOISE3, "NOISE3", 1, 1 }, + { OPCODE_NOISE4, "NOISE4", 1, 1 }, + { OPCODE_NOT, "NOT", 1, 1 }, + { OPCODE_NRM3, "NRM3", 1, 1 }, + { OPCODE_NRM4, "NRM4", 1, 1 }, + { OPCODE_OR, "OR", 2, 1 }, + { OPCODE_PK2H, "PK2H", 1, 1 }, + { OPCODE_PK2US, "PK2US", 1, 1 }, + { OPCODE_PK4B, "PK4B", 1, 1 }, + { OPCODE_PK4UB, "PK4UB", 1, 1 }, + { OPCODE_POW, "POW", 2, 1 }, + { OPCODE_POPA, "POPA", 0, 0 }, + { OPCODE_PRINT, "PRINT", 1, 0 }, + { OPCODE_PUSHA, "PUSHA", 0, 0 }, + { OPCODE_RCC, "RCC", 1, 1 }, + { OPCODE_RCP, "RCP", 1, 1 }, + { OPCODE_RET, "RET", 0, 0 }, + { OPCODE_RFL, "RFL", 1, 1 }, + { OPCODE_RSQ, "RSQ", 1, 1 }, + { OPCODE_SCS, "SCS", 1, 1 }, + { OPCODE_SEQ, "SEQ", 2, 1 }, + { OPCODE_SFL, "SFL", 0, 1 }, + { OPCODE_SGE, "SGE", 2, 1 }, + { OPCODE_SGT, "SGT", 2, 1 }, + { OPCODE_SIN, "SIN", 1, 1 }, + { OPCODE_SLE, "SLE", 2, 1 }, + { OPCODE_SLT, "SLT", 2, 1 }, + { OPCODE_SNE, "SNE", 2, 1 }, + { OPCODE_SSG, "SSG", 1, 1 }, + { OPCODE_STR, "STR", 0, 1 }, + { OPCODE_SUB, "SUB", 2, 1 }, + { OPCODE_SWZ, "SWZ", 1, 1 }, + { OPCODE_TEX, "TEX", 1, 1 }, + { OPCODE_TXB, "TXB", 1, 1 }, + { OPCODE_TXD, "TXD", 3, 1 }, + { OPCODE_TXL, "TXL", 1, 1 }, + { OPCODE_TXP, "TXP", 1, 1 }, + { OPCODE_TXP_NV, "TXP_NV", 1, 1 }, + { OPCODE_TRUNC, "TRUNC", 1, 1 }, + { OPCODE_UP2H, "UP2H", 1, 1 }, + { OPCODE_UP2US, "UP2US", 1, 1 }, + { OPCODE_UP4B, "UP4B", 1, 1 }, + { OPCODE_UP4UB, "UP4UB", 1, 1 }, + { OPCODE_X2D, "X2D", 3, 1 }, + { OPCODE_XOR, "XOR", 2, 1 }, + { OPCODE_XPD, "XPD", 2, 1 } +}; + + +/** + * Return the number of src registers for the given instruction/opcode. + */ +GLuint +_mesa_num_inst_src_regs(gl_inst_opcode opcode) +{ + ASSERT(opcode < MAX_OPCODE); + ASSERT(opcode == InstInfo[opcode].Opcode); + ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode); + return InstInfo[opcode].NumSrcRegs; +} + + +/** + * Return the number of dst registers for the given instruction/opcode. + */ +GLuint +_mesa_num_inst_dst_regs(gl_inst_opcode opcode) +{ + ASSERT(opcode < MAX_OPCODE); + ASSERT(opcode == InstInfo[opcode].Opcode); + ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode); + return InstInfo[opcode].NumDstRegs; +} + + +GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode) +{ + return (opcode == OPCODE_TEX || + opcode == OPCODE_TXB || + opcode == OPCODE_TXD || + opcode == OPCODE_TXL || + opcode == OPCODE_TXP); +} + + +/** + * Check if there's a potential src/dst register data dependency when + * using SOA execution. + * Example: + * MOV T, T.yxwz; + * This would expand into: + * MOV t0, t1; + * MOV t1, t0; + * MOV t2, t3; + * MOV t3, t2; + * The second instruction will have the wrong value for t0 if executed as-is. + */ +GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst) +{ + GLuint i, chan; + + if (inst->DstReg.WriteMask == WRITEMASK_X || + inst->DstReg.WriteMask == WRITEMASK_Y || + inst->DstReg.WriteMask == WRITEMASK_Z || + inst->DstReg.WriteMask == WRITEMASK_W || + inst->DstReg.WriteMask == 0x0) { + /* no chance of data dependency */ + return GL_FALSE; + } + + /* loop over src regs */ + for (i = 0; i < 3; i++) { + if (inst->SrcReg[i].File == inst->DstReg.File && + inst->SrcReg[i].Index == inst->DstReg.Index) { + /* loop over dest channels */ + GLuint channelsWritten = 0x0; + for (chan = 0; chan < 4; chan++) { + if (inst->DstReg.WriteMask & (1 << chan)) { + /* check if we're reading a channel that's been written */ + GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan); + if (swizzle <= SWIZZLE_W && + (channelsWritten & (1 << swizzle))) { + return GL_TRUE; + } + + channelsWritten |= (1 << chan); + } + } + } + } + return GL_FALSE; +} + + +/** + * Return string name for given program opcode. + */ +const char * +_mesa_opcode_string(gl_inst_opcode opcode) +{ + if (opcode < MAX_OPCODE) + return InstInfo[opcode].Name; + else { + static char s[20]; + _mesa_snprintf(s, sizeof(s), "OP%u", opcode); + return s; + } +} + diff --git a/src/glsl/mesa/shader/prog_instruction.h b/src/glsl/mesa/shader/prog_instruction.h new file mode 100644 index 0000000000..2c95d274ca --- /dev/null +++ b/src/glsl/mesa/shader/prog_instruction.h @@ -0,0 +1,437 @@ +/* + * Mesa 3-D graphics library + * Version: 7.3 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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 prog_instruction.h + * + * Vertex/fragment program instruction datatypes and constants. + * + * \author Brian Paul + * \author Keith Whitwell + * \author Ian Romanick + */ + + +#ifndef PROG_INSTRUCTION_H +#define PROG_INSTRUCTION_H + + +#include "main/mtypes.h" + + +/** + * Swizzle indexes. + * Do not change! + */ +/*@{*/ +#define SWIZZLE_X 0 +#define SWIZZLE_Y 1 +#define SWIZZLE_Z 2 +#define SWIZZLE_W 3 +#define SWIZZLE_ZERO 4 /**< For SWZ instruction only */ +#define SWIZZLE_ONE 5 /**< For SWZ instruction only */ +#define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */ +/*@}*/ + +#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) +#define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3) +#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) +#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) + +#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W) +#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X) +#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y) +#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z) +#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) + + +/** + * Writemask values, 1 bit per component. + */ +/*@{*/ +#define WRITEMASK_X 0x1 +#define WRITEMASK_Y 0x2 +#define WRITEMASK_XY 0x3 +#define WRITEMASK_Z 0x4 +#define WRITEMASK_XZ 0x5 +#define WRITEMASK_YZ 0x6 +#define WRITEMASK_XYZ 0x7 +#define WRITEMASK_W 0x8 +#define WRITEMASK_XW 0x9 +#define WRITEMASK_YW 0xa +#define WRITEMASK_XYW 0xb +#define WRITEMASK_ZW 0xc +#define WRITEMASK_XZW 0xd +#define WRITEMASK_YZW 0xe +#define WRITEMASK_XYZW 0xf +/*@}*/ + + +/** + * Condition codes + */ +/*@{*/ +#define COND_GT 1 /**< greater than zero */ +#define COND_EQ 2 /**< equal to zero */ +#define COND_LT 3 /**< less than zero */ +#define COND_UN 4 /**< unordered (NaN) */ +#define COND_GE 5 /**< greater than or equal to zero */ +#define COND_LE 6 /**< less than or equal to zero */ +#define COND_NE 7 /**< not equal to zero */ +#define COND_TR 8 /**< always true */ +#define COND_FL 9 /**< always false */ +/*@}*/ + + +/** + * Instruction precision for GL_NV_fragment_program + */ +/*@{*/ +#define FLOAT32 0x1 +#define FLOAT16 0x2 +#define FIXED12 0x4 +/*@}*/ + + +/** + * Saturation modes when storing values. + */ +/*@{*/ +#define SATURATE_OFF 0 +#define SATURATE_ZERO_ONE 1 +/*@}*/ + + +/** + * Per-component negation masks + */ +/*@{*/ +#define NEGATE_X 0x1 +#define NEGATE_Y 0x2 +#define NEGATE_Z 0x4 +#define NEGATE_W 0x8 +#define NEGATE_XYZ 0x7 +#define NEGATE_XYZW 0xf +#define NEGATE_NONE 0x0 +/*@}*/ + + +/** + * Program instruction opcodes, for both vertex and fragment programs. + * \note changes to this opcode list must be reflected in t_vb_arbprogram.c + */ +typedef enum prog_opcode { + /* ARB_vp ARB_fp NV_vp NV_fp GLSL */ + /*------------------------------------------*/ + OPCODE_NOP = 0, /* X */ + OPCODE_ABS, /* X X 1.1 X */ + OPCODE_ADD, /* X X X X X */ + OPCODE_AND, /* */ + OPCODE_ARA, /* 2 */ + OPCODE_ARL, /* X X */ + OPCODE_ARL_NV, /* 2 */ + OPCODE_ARR, /* 2 */ + OPCODE_BGNLOOP, /* opt */ + OPCODE_BGNSUB, /* opt */ + OPCODE_BRA, /* 2 X */ + OPCODE_BRK, /* 2 opt */ + OPCODE_CAL, /* 2 2 */ + OPCODE_CMP, /* X */ + OPCODE_CONT, /* opt */ + OPCODE_COS, /* X 2 X X */ + OPCODE_DDX, /* X X */ + OPCODE_DDY, /* X X */ + OPCODE_DP2, /* 2 */ + OPCODE_DP2A, /* 2 */ + OPCODE_DP3, /* X X X X X */ + OPCODE_DP4, /* X X X X X */ + OPCODE_DPH, /* X X 1.1 */ + OPCODE_DST, /* X X X X */ + OPCODE_ELSE, /* X */ + OPCODE_END, /* X X X X opt */ + OPCODE_ENDIF, /* opt */ + OPCODE_ENDLOOP, /* opt */ + OPCODE_ENDSUB, /* opt */ + OPCODE_EX2, /* X X 2 X X */ + OPCODE_EXP, /* X X X */ + OPCODE_FLR, /* X X 2 X X */ + OPCODE_FRC, /* X X 2 X X */ + OPCODE_IF, /* opt */ + OPCODE_KIL, /* X */ + OPCODE_KIL_NV, /* X X */ + OPCODE_LG2, /* X X 2 X X */ + OPCODE_LIT, /* X X X X */ + OPCODE_LOG, /* X X X */ + OPCODE_LRP, /* X X */ + OPCODE_MAD, /* X X X X X */ + OPCODE_MAX, /* X X X X X */ + OPCODE_MIN, /* X X X X X */ + OPCODE_MOV, /* X X X X X */ + OPCODE_MUL, /* X X X X X */ + OPCODE_NOISE1, /* X */ + OPCODE_NOISE2, /* X */ + OPCODE_NOISE3, /* X */ + OPCODE_NOISE4, /* X */ + OPCODE_NOT, /* */ + OPCODE_NRM3, /* */ + OPCODE_NRM4, /* */ + OPCODE_OR, /* */ + OPCODE_PK2H, /* X */ + OPCODE_PK2US, /* X */ + OPCODE_PK4B, /* X */ + OPCODE_PK4UB, /* X */ + OPCODE_POW, /* X X X X */ + OPCODE_POPA, /* 3 */ + OPCODE_PRINT, /* X X */ + OPCODE_PUSHA, /* 3 */ + OPCODE_RCC, /* 1.1 */ + OPCODE_RCP, /* X X X X X */ + OPCODE_RET, /* 2 2 */ + OPCODE_RFL, /* X X */ + OPCODE_RSQ, /* X X X X X */ + OPCODE_SCS, /* X */ + OPCODE_SEQ, /* 2 X X */ + OPCODE_SFL, /* 2 X */ + OPCODE_SGE, /* X X X X X */ + OPCODE_SGT, /* 2 X X */ + OPCODE_SIN, /* X 2 X X */ + OPCODE_SLE, /* 2 X X */ + OPCODE_SLT, /* X X X X X */ + OPCODE_SNE, /* 2 X X */ + OPCODE_SSG, /* 2 */ + OPCODE_STR, /* 2 X */ + OPCODE_SUB, /* X X 1.1 X X */ + OPCODE_SWZ, /* X X */ + OPCODE_TEX, /* X 3 X X */ + OPCODE_TXB, /* X 3 X */ + OPCODE_TXD, /* X X */ + OPCODE_TXL, /* 3 2 X */ + OPCODE_TXP, /* X X */ + OPCODE_TXP_NV, /* 3 X */ + OPCODE_TRUNC, /* X */ + OPCODE_UP2H, /* X */ + OPCODE_UP2US, /* X */ + OPCODE_UP4B, /* X */ + OPCODE_UP4UB, /* X */ + OPCODE_X2D, /* X */ + OPCODE_XOR, /* */ + OPCODE_XPD, /* X X X */ + MAX_OPCODE +} gl_inst_opcode; + + +/** + * Number of bits for the src/dst register Index field. + * This limits the size of temp/uniform register files. + */ +#define INST_INDEX_BITS 10 + + +/** + * Instruction source register. + */ +struct prog_src_register +{ + GLuint File:4; /**< One of the PROGRAM_* register file values. */ + GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + * May be negative for relative addressing. + */ + GLuint Swizzle:12; + GLuint RelAddr:1; + + /** Take the component-wise absolute value */ + GLuint Abs:1; + + /** + * Post-Abs negation. + * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ + * instruction which allows per-component negation. + */ + GLuint Negate:4; +}; + + +/** + * Instruction destination register. + */ +struct prog_dst_register +{ + GLuint File:4; /**< One of the PROGRAM_* register file values */ + GLuint Index:INST_INDEX_BITS; /**< Unsigned, never negative */ + GLuint WriteMask:4; + GLuint RelAddr:1; + + /** + * \name Conditional destination update control. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + /*@{*/ + /** + * Takes one of the 9 possible condition values (EQ, FL, GT, GE, LE, LT, + * NE, TR, or UN). Dest reg is only written to if the matching + * (swizzled) condition code value passes. When a conditional update mask + * is not specified, this will be \c COND_TR. + */ + GLuint CondMask:4; + + /** + * Condition code swizzle value. + */ + GLuint CondSwizzle:12; + + /** + * Selects the condition code register to use for conditional destination + * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only + * condition code register 0 is available. In NV_vertex_program3 mode, + * condition code registers 0 and 1 are available. + */ + GLuint CondSrc:1; + /*@}*/ +}; + + +/** + * Vertex/fragment program instruction. + */ +struct prog_instruction +{ + gl_inst_opcode Opcode; + struct prog_src_register SrcReg[3]; + struct prog_dst_register DstReg; + + /** + * Indicates that the instruction should update the condition code + * register. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + GLuint CondUpdate:1; + + /** + * If prog_instruction::CondUpdate is \c GL_TRUE, this value selects the + * condition code register that is to be updated. + * + * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition + * code register 0 is available. In GL_NV_vertex_program3 mode, condition + * code registers 0 and 1 are available. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, + * NV_vertex_program2_option. + */ + GLuint CondDst:1; + + /** + * Saturate each value of the vectored result to the range [0,1] or the + * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is + * only available in NV_fragment_program2 mode. + * Value is one of the SATURATE_* tokens. + * + * \since + * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3. + */ + GLuint SaturateMode:2; + + /** + * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12. + * + * \since + * NV_fragment_program, NV_fragment_program_option. + */ + GLuint Precision:3; + + /** + * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. + */ + /*@{*/ + /** Source texture unit. */ + GLuint TexSrcUnit:5; + + /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */ + GLuint TexSrcTarget:3; + + /** True if tex instruction should do shadow comparison */ + GLuint TexShadow:1; + /*@}*/ + + /** + * For BRA and CAL instructions, the location to jump to. + * For BGNLOOP, points to ENDLOOP (and vice-versa). + * For BRK, points to BGNLOOP (which points to ENDLOOP). + * For IF, points to ELSE or ENDIF. + * For ELSE, points to ENDIF. + */ + GLint BranchTarget; + + /** for debugging purposes */ + const char *Comment; + + /** Arbitrary data. Used for OPCODE_PRINT and some drivers */ + void *Data; + + /** for driver use (try to remove someday) */ + GLint Aux; +}; + + +extern void +_mesa_init_instructions(struct prog_instruction *inst, GLuint count); + +extern struct prog_instruction * +_mesa_alloc_instructions(GLuint numInst); + +extern struct prog_instruction * +_mesa_realloc_instructions(struct prog_instruction *oldInst, + GLuint numOldInst, GLuint numNewInst); + +extern struct prog_instruction * +_mesa_copy_instructions(struct prog_instruction *dest, + const struct prog_instruction *src, GLuint n); + +extern void +_mesa_free_instructions(struct prog_instruction *inst, GLuint count); + +extern GLuint +_mesa_num_inst_src_regs(gl_inst_opcode opcode); + +extern GLuint +_mesa_num_inst_dst_regs(gl_inst_opcode opcode); + +extern GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode); + +extern GLboolean +_mesa_check_soa_dependencies(const struct prog_instruction *inst); + +extern const char * +_mesa_opcode_string(gl_inst_opcode opcode); + + +#endif /* PROG_INSTRUCTION_H */ diff --git a/src/glsl/mesa/shader/prog_print.c b/src/glsl/mesa/shader/prog_print.c new file mode 100644 index 0000000000..3f1cb48e4b --- /dev/null +++ b/src/glsl/mesa/shader/prog_print.c @@ -0,0 +1,1089 @@ +/* + * Mesa 3-D graphics library + * Version: 7.3 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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 prog_print.c + * Print vertex/fragment programs - for debugging. + * \author Brian Paul + */ + +#if 0 +#include "main/glheader.h" +#include "main/context.h" +#include "main/imports.h" +#else + +#define _GNU_SOURCE + +#include +#include +#include +#include +struct gl_program { + int Target; +}; + +void _mesa_problem(void *ctx, char *msg) +{ + (void)ctx; + fprintf(stderr, "%s", msg); + exit(1); +} + +#endif + +#include "prog_instruction.h" +#include "prog_print.h" + + + +/** + * Return string name for given program/register file. + */ +static const char * +file_string(gl_register_file f, gl_prog_print_mode mode) +{ + (void)mode; + switch (f) { + case PROGRAM_TEMPORARY: + return "TEMP"; + case PROGRAM_LOCAL_PARAM: + return "LOCAL"; + case PROGRAM_ENV_PARAM: + return "ENV"; + case PROGRAM_STATE_VAR: + return "STATE"; + case PROGRAM_INPUT: + return "INPUT"; + case PROGRAM_OUTPUT: + return "OUTPUT"; + case PROGRAM_NAMED_PARAM: + return "NAMED"; + case PROGRAM_CONSTANT: + return "CONST"; + case PROGRAM_UNIFORM: + return "UNIFORM"; + case PROGRAM_VARYING: + return "VARYING"; + case PROGRAM_WRITE_ONLY: + return "WRITE_ONLY"; + case PROGRAM_ADDRESS: + return "ADDR"; + case PROGRAM_SAMPLER: + return "SAMPLER"; + case PROGRAM_UNDEFINED: + return "UNDEFINED"; + default: + { + static char s[20]; + snprintf(s, sizeof(s), "FILE%u", f); + return s; + } + } +} + + +/** + * Return ARB_v/f_prog-style input attrib string. + */ +static const char * +arb_input_attrib_string(GLint index, GLenum progType) +{ + /* + * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. + */ + const char *vertAttribs[] = { + "vertex.position", + "vertex.weight", + "vertex.normal", + "vertex.color.primary", + "vertex.color.secondary", + "vertex.fogcoord", + "vertex.(six)", + "vertex.(seven)", + "vertex.texcoord[0]", + "vertex.texcoord[1]", + "vertex.texcoord[2]", + "vertex.texcoord[3]", + "vertex.texcoord[4]", + "vertex.texcoord[5]", + "vertex.texcoord[6]", + "vertex.texcoord[7]", + "vertex.attrib[0]", + "vertex.attrib[1]", + "vertex.attrib[2]", + "vertex.attrib[3]", + "vertex.attrib[4]", + "vertex.attrib[5]", + "vertex.attrib[6]", + "vertex.attrib[7]", + "vertex.attrib[8]", + "vertex.attrib[9]", + "vertex.attrib[10]", + "vertex.attrib[11]", + "vertex.attrib[12]", + "vertex.attrib[13]", + "vertex.attrib[14]", + "vertex.attrib[15]" + }; + const char *fragAttribs[] = { + "fragment.position", + "fragment.color.primary", + "fragment.color.secondary", + "fragment.fogcoord", + "fragment.texcoord[0]", + "fragment.texcoord[1]", + "fragment.texcoord[2]", + "fragment.texcoord[3]", + "fragment.texcoord[4]", + "fragment.texcoord[5]", + "fragment.texcoord[6]", + "fragment.texcoord[7]", + "fragment.varying[0]", + "fragment.varying[1]", + "fragment.varying[2]", + "fragment.varying[3]", + "fragment.varying[4]", + "fragment.varying[5]", + "fragment.varying[6]", + "fragment.varying[7]" + }; + + /* sanity checks */ + assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); + assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); + + if (progType == GL_VERTEX_PROGRAM_ARB) { + assert((unsigned int)index < sizeof(vertAttribs) / sizeof(vertAttribs[0])); + return vertAttribs[index]; + } + else { + assert((unsigned int)index < sizeof(fragAttribs) / sizeof(fragAttribs[0])); + return fragAttribs[index]; + } +} + + +/** + * Print a vertex program's InputsRead field in human-readable format. + * For debugging. + */ +void +_mesa_print_vp_inputs(GLbitfield inputs) +{ + printf("VP Inputs 0x%x: \n", inputs); + while (inputs) { + GLint attr = ffs(inputs) - 1; + const char *name = arb_input_attrib_string(attr, + GL_VERTEX_PROGRAM_ARB); + printf(" %d: %s\n", attr, name); + inputs &= ~(1 << attr); + } +} + + +/** + * Print a fragment program's InputsRead field in human-readable format. + * For debugging. + */ +void +_mesa_print_fp_inputs(GLbitfield inputs) +{ + printf("FP Inputs 0x%x: \n", inputs); + while (inputs) { + GLint attr = ffs(inputs) - 1; + const char *name = arb_input_attrib_string(attr, + GL_FRAGMENT_PROGRAM_ARB); + printf(" %d: %s\n", attr, name); + inputs &= ~(1 << attr); + } +} + + +#if 0 +/** + * Return ARB_v/f_prog-style output attrib string. + */ +static const char * +arb_output_attrib_string(GLint index, GLenum progType) +{ + /* + * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. + */ + const char *vertResults[] = { + "result.position", + "result.color.primary", + "result.color.secondary", + "result.fogcoord", + "result.texcoord[0]", + "result.texcoord[1]", + "result.texcoord[2]", + "result.texcoord[3]", + "result.texcoord[4]", + "result.texcoord[5]", + "result.texcoord[6]", + "result.texcoord[7]", + "result.varying[0]", + "result.varying[1]", + "result.varying[2]", + "result.varying[3]", + "result.varying[4]", + "result.varying[5]", + "result.varying[6]", + "result.varying[7]" + }; + const char *fragResults[] = { + "result.color", + "result.color(half)", + "result.depth", + "result.color[0]", + "result.color[1]", + "result.color[2]", + "result.color[3]" + }; + + if (progType == GL_VERTEX_PROGRAM_ARB) { + assert(index < sizeof(vertResults) / sizeof(vertResults[0])); + return vertResults[index]; + } + else { + assert(index < sizeof(fragResults) / sizeof(fragResults[0])); + return fragResults[index]; + } +} +#endif + +/** + * Return string representation of the given register. + * Note that some types of registers (like PROGRAM_UNIFORM) aren't defined + * by the ARB/NV program languages so we've taken some liberties here. + * \param f the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc) + * \param index number of the register in the register file + * \param mode the output format/mode/style + * \param prog pointer to containing program + */ +static const char * +reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, + GLboolean relAddr, const struct gl_program *prog) +{ + static char str[100]; + const char *addr = relAddr ? "ADDR+" : ""; + + str[0] = 0; + + switch (mode) { + case PROG_PRINT_DEBUG: + sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); + break; + case PROG_PRINT_ARB: +#if 0 + switch (f) { + case PROGRAM_INPUT: + sprintf(str, "%s", arb_input_attrib_string(index, prog->Target)); + break; + case PROGRAM_OUTPUT: + sprintf(str, "%s", arb_output_attrib_string(index, prog->Target)); + break; + case PROGRAM_TEMPORARY: + sprintf(str, "temp%d", index); + break; + case PROGRAM_ENV_PARAM: + sprintf(str, "program.env[%s%d]", addr, index); + break; + case PROGRAM_LOCAL_PARAM: + sprintf(str, "program.local[%s%d]", addr, index); + break; + case PROGRAM_VARYING: /* extension */ + sprintf(str, "varying[%s%d]", addr, index); + break; + case PROGRAM_CONSTANT: /* extension */ + sprintf(str, "constant[%s%d]", addr, index); + break; + case PROGRAM_UNIFORM: /* extension */ + sprintf(str, "uniform[%s%d]", addr, index); + break; + case PROGRAM_STATE_VAR: + { + struct gl_program_parameter *param + = prog->Parameters->Parameters + index; + char *state = _mesa_program_state_string(param->StateIndexes); + sprintf(str, "%s", state); + free(state); + } + break; + case PROGRAM_ADDRESS: + sprintf(str, "A%d", index); + break; + default: + _mesa_problem(NULL, "bad file in reg_string()"); + } + break; +#else + assert(0); + break; +#endif + + case PROG_PRINT_NV: + switch (f) { + case PROGRAM_INPUT: + if (prog->Target == GL_VERTEX_PROGRAM_ARB) + sprintf(str, "v[%d]", index); + else + sprintf(str, "f[%d]", index); + break; + case PROGRAM_OUTPUT: + sprintf(str, "o[%d]", index); + break; + case PROGRAM_TEMPORARY: + sprintf(str, "R%d", index); + break; + case PROGRAM_ENV_PARAM: + sprintf(str, "c[%d]", index); + break; + case PROGRAM_VARYING: /* extension */ + sprintf(str, "varying[%s%d]", addr, index); + break; + case PROGRAM_UNIFORM: /* extension */ + sprintf(str, "uniform[%s%d]", addr, index); + break; + case PROGRAM_CONSTANT: /* extension */ + sprintf(str, "constant[%s%d]", addr, index); + break; + case PROGRAM_STATE_VAR: /* extension */ + sprintf(str, "state[%s%d]", addr, index); + break; + default: + _mesa_problem(NULL, "bad file in reg_string()"); + } + break; + + default: + _mesa_problem(NULL, "bad mode in reg_string()"); + } + + return str; +} + + +/** + * Return a string representation of the given swizzle word. + * If extended is true, use extended (comma-separated) format. + * \param swizzle the swizzle field + * \param negateBase 4-bit negation vector + * \param extended if true, also allow 0, 1 values + */ +const char * +_mesa_swizzle_string(GLuint swizzle, GLuint negateMask, GLboolean extended) +{ + static const char swz[] = "xyzw01!?"; /* See SWIZZLE_x definitions */ + static char s[20]; + GLuint i = 0; + + if (!extended && swizzle == SWIZZLE_NOOP && negateMask == 0) + return ""; /* no swizzle/negation */ + + if (!extended) + s[i++] = '.'; + + if (negateMask & NEGATE_X) + s[i++] = '-'; + s[i++] = swz[GET_SWZ(swizzle, 0)]; + + if (extended) { + s[i++] = ','; + } + + if (negateMask & NEGATE_Y) + s[i++] = '-'; + s[i++] = swz[GET_SWZ(swizzle, 1)]; + + if (extended) { + s[i++] = ','; + } + + if (negateMask & NEGATE_Z) + s[i++] = '-'; + s[i++] = swz[GET_SWZ(swizzle, 2)]; + + if (extended) { + s[i++] = ','; + } + + if (negateMask & NEGATE_W) + s[i++] = '-'; + s[i++] = swz[GET_SWZ(swizzle, 3)]; + + s[i] = 0; + return s; +} + + +void +_mesa_print_swizzle(GLuint swizzle) +{ + if (swizzle == SWIZZLE_XYZW) { + printf(".xyzw\n"); + } + else { + const char *s = _mesa_swizzle_string(swizzle, 0, 0); + printf("%s\n", s); + } +} + + +const char * +_mesa_writemask_string(GLuint writeMask) +{ + static char s[10]; + GLuint i = 0; + + if (writeMask == WRITEMASK_XYZW) + return ""; + + s[i++] = '.'; + if (writeMask & WRITEMASK_X) + s[i++] = 'x'; + if (writeMask & WRITEMASK_Y) + s[i++] = 'y'; + if (writeMask & WRITEMASK_Z) + s[i++] = 'z'; + if (writeMask & WRITEMASK_W) + s[i++] = 'w'; + + s[i] = 0; + return s; +} + + +const char * +_mesa_condcode_string(GLuint condcode) +{ + switch (condcode) { + case COND_GT: return "GT"; + case COND_EQ: return "EQ"; + case COND_LT: return "LT"; + case COND_UN: return "UN"; + case COND_GE: return "GE"; + case COND_LE: return "LE"; + case COND_NE: return "NE"; + case COND_TR: return "TR"; + case COND_FL: return "FL"; + default: return "cond???"; + } +} + + +static void +fprint_dst_reg(FILE * f, + const struct prog_dst_register *dstReg, + gl_prog_print_mode mode, + const struct gl_program *prog) +{ + fprintf(f, "%s%s", + reg_string((gl_register_file) dstReg->File, + dstReg->Index, mode, dstReg->RelAddr, prog), + _mesa_writemask_string(dstReg->WriteMask)); + + if (dstReg->CondMask != COND_TR) { + fprintf(f, " (%s.%s)", + _mesa_condcode_string(dstReg->CondMask), + _mesa_swizzle_string(dstReg->CondSwizzle, + GL_FALSE, GL_FALSE)); + } + +#if 0 + fprintf(f, "%s[%d]%s", + file_string((gl_register_file) dstReg->File, mode), + dstReg->Index, + _mesa_writemask_string(dstReg->WriteMask)); +#endif +} + + +static void +fprint_src_reg(FILE *f, + const struct prog_src_register *srcReg, + gl_prog_print_mode mode, + const struct gl_program *prog) +{ + const char *abs = srcReg->Abs ? "|" : ""; + + fprintf(f, "%s%s%s%s", + abs, + reg_string((gl_register_file) srcReg->File, + srcReg->Index, mode, srcReg->RelAddr, prog), + _mesa_swizzle_string(srcReg->Swizzle, + srcReg->Negate, GL_FALSE), + abs); +#if 0 + fprintf(f, "%s[%d]%s", + file_string((gl_register_file) srcReg->File, mode), + srcReg->Index, + _mesa_swizzle_string(srcReg->Swizzle, + srcReg->Negate, GL_FALSE)); +#endif +} + + +static void +fprint_comment(FILE *f, const struct prog_instruction *inst) +{ + if (inst->Comment) + fprintf(f, "; # %s\n", inst->Comment); + else + fprintf(f, ";\n"); +} + + +static void +fprint_alu_instruction(FILE *f, + const struct prog_instruction *inst, + const char *opcode_string, GLuint numRegs, + gl_prog_print_mode mode, + const struct gl_program *prog) +{ + GLuint j; + + fprintf(f, "%s", opcode_string); + if (inst->CondUpdate) + fprintf(f, ".C"); + + /* frag prog only */ + if (inst->SaturateMode == SATURATE_ZERO_ONE) + fprintf(f, "_SAT"); + + fprintf(f, " "); + if (inst->DstReg.File != PROGRAM_UNDEFINED) { + fprint_dst_reg(f, &inst->DstReg, mode, prog); + } + else { + fprintf(f, " ???"); + } + + if (numRegs > 0) + fprintf(f, ", "); + + for (j = 0; j < numRegs; j++) { + fprint_src_reg(f, inst->SrcReg + j, mode, prog); + if (j + 1 < numRegs) + fprintf(f, ", "); + } + + fprint_comment(f, inst); +} + + +void +_mesa_print_alu_instruction(const struct prog_instruction *inst, + const char *opcode_string, GLuint numRegs) +{ + fprint_alu_instruction(stderr, inst, opcode_string, + numRegs, PROG_PRINT_DEBUG, NULL); +} + + +/** + * Print a single vertex/fragment program instruction. + */ +GLint +_mesa_fprint_instruction_opt(FILE *f, + const struct prog_instruction *inst, + GLint indent, + gl_prog_print_mode mode, + const struct gl_program *prog) +{ + GLint i; + + if (inst->Opcode == OPCODE_ELSE || + inst->Opcode == OPCODE_ENDIF || + inst->Opcode == OPCODE_ENDLOOP || + inst->Opcode == OPCODE_ENDSUB) { + indent -= 3; + } + for (i = 0; i < indent; i++) { + fprintf(f, " "); + } + + switch (inst->Opcode) { + case OPCODE_PRINT: + fprintf(f, "PRINT '%s'", (char *) inst->Data); + if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { + fprintf(f, ", "); + fprintf(f, "%s[%d]%s", + file_string((gl_register_file) inst->SrcReg[0].File, + mode), + inst->SrcReg[0].Index, + _mesa_swizzle_string(inst->SrcReg[0].Swizzle, + inst->SrcReg[0].Negate, GL_FALSE)); + } + if (inst->Comment) + fprintf(f, " # %s", inst->Comment); + fprint_comment(f, inst); + break; + case OPCODE_SWZ: + fprintf(f, "SWZ"); + if (inst->SaturateMode == SATURATE_ZERO_ONE) + fprintf(f, "_SAT"); + fprintf(f, " "); + fprint_dst_reg(f, &inst->DstReg, mode, prog); + fprintf(f, ", %s[%d], %s", + file_string((gl_register_file) inst->SrcReg[0].File, + mode), + inst->SrcReg[0].Index, + _mesa_swizzle_string(inst->SrcReg[0].Swizzle, + inst->SrcReg[0].Negate, GL_TRUE)); + fprint_comment(f, inst); + break; + case OPCODE_TEX: + case OPCODE_TXP: + case OPCODE_TXL: + case OPCODE_TXB: + fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); + if (inst->SaturateMode == SATURATE_ZERO_ONE) + fprintf(f, "_SAT"); + fprintf(f, " "); + fprint_dst_reg(f, &inst->DstReg, mode, prog); + fprintf(f, ", "); + fprint_src_reg(f, &inst->SrcReg[0], mode, prog); + fprintf(f, ", texture[%d], ", inst->TexSrcUnit); + switch (inst->TexSrcTarget) { + case TEXTURE_1D_INDEX: fprintf(f, "1D"); break; + case TEXTURE_2D_INDEX: fprintf(f, "2D"); break; + case TEXTURE_3D_INDEX: fprintf(f, "3D"); break; + case TEXTURE_CUBE_INDEX: fprintf(f, "CUBE"); break; + case TEXTURE_RECT_INDEX: fprintf(f, "RECT"); break; + case TEXTURE_1D_ARRAY_INDEX: fprintf(f, "1D_ARRAY"); break; + case TEXTURE_2D_ARRAY_INDEX: fprintf(f, "2D_ARRAY"); break; + default: + ; + } + if (inst->TexShadow) + fprintf(f, " SHADOW"); + fprint_comment(f, inst); + break; + + case OPCODE_KIL: + fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); + fprintf(f, " "); + fprint_src_reg(f, &inst->SrcReg[0], mode, prog); + fprint_comment(f, inst); + break; + case OPCODE_KIL_NV: + fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); + fprintf(f, " "); + fprintf(f, "%s.%s", + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, + GL_FALSE, GL_FALSE)); + fprint_comment(f, inst); + break; + + case OPCODE_ARL: + fprintf(f, "ARL "); + fprint_dst_reg(f, &inst->DstReg, mode, prog); + fprintf(f, ", "); + fprint_src_reg(f, &inst->SrcReg[0], mode, prog); + fprint_comment(f, inst); + break; + case OPCODE_BRA: + fprintf(f, "BRA %d (%s%s)", + inst->BranchTarget, + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE)); + fprint_comment(f, inst); + break; + case OPCODE_IF: + if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { + /* Use ordinary register */ + fprintf(f, "IF "); + fprint_src_reg(f, &inst->SrcReg[0], mode, prog); + fprintf(f, "; "); + } + else { + /* Use cond codes */ + fprintf(f, "IF (%s%s);", + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, + 0, GL_FALSE)); + } + fprintf(f, " # (if false, goto %d)", inst->BranchTarget); + fprint_comment(f, inst); + return indent + 3; + case OPCODE_ELSE: + fprintf(f, "ELSE; # (goto %d)\n", inst->BranchTarget); + return indent + 3; + case OPCODE_ENDIF: + fprintf(f, "ENDIF;\n"); + break; + case OPCODE_BGNLOOP: + fprintf(f, "BGNLOOP; # (end at %d)\n", inst->BranchTarget); + return indent + 3; + case OPCODE_ENDLOOP: + fprintf(f, "ENDLOOP; # (goto %d)\n", inst->BranchTarget); + break; + case OPCODE_BRK: + case OPCODE_CONT: + fprintf(f, "%s (%s%s); # (goto %d)", + _mesa_opcode_string(inst->Opcode), + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE), + inst->BranchTarget); + fprint_comment(f, inst); + break; + + case OPCODE_BGNSUB: + if (mode == PROG_PRINT_NV) { + fprintf(f, "%s:\n", inst->Comment); /* comment is label */ + return indent; + } + else { + fprintf(f, "BGNSUB"); + fprint_comment(f, inst); + return indent + 3; + } + case OPCODE_ENDSUB: + if (mode == PROG_PRINT_DEBUG) { + fprintf(f, "ENDSUB"); + fprint_comment(f, inst); + } + break; + case OPCODE_CAL: + if (mode == PROG_PRINT_NV) { + fprintf(f, "CAL %s; # (goto %d)\n", inst->Comment, inst->BranchTarget); + } + else { + fprintf(f, "CAL %u", inst->BranchTarget); + fprint_comment(f, inst); + } + break; + case OPCODE_RET: + fprintf(f, "RET (%s%s)", + _mesa_condcode_string(inst->DstReg.CondMask), + _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE)); + fprint_comment(f, inst); + break; + + case OPCODE_END: + fprintf(f, "END\n"); + break; + case OPCODE_NOP: + if (mode == PROG_PRINT_DEBUG) { + fprintf(f, "NOP"); + fprint_comment(f, inst); + } + else if (inst->Comment) { + /* ARB/NV extensions don't have NOP instruction */ + fprintf(f, "# %s\n", inst->Comment); + } + break; + /* XXX may need other special-case instructions */ + default: + if (inst->Opcode < MAX_OPCODE) { + /* typical alu instruction */ + fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + _mesa_num_inst_src_regs(inst->Opcode), + mode, prog); + } + else { + fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, + mode, prog); + } + break; + } + return indent; +} + + +GLint +_mesa_print_instruction_opt(const struct prog_instruction *inst, + GLint indent, + gl_prog_print_mode mode, + const struct gl_program *prog) +{ + return _mesa_fprint_instruction_opt(stderr, inst, indent, mode, prog); +} + + +void +_mesa_print_instruction(const struct prog_instruction *inst) +{ + /* note: 4th param should be ignored for PROG_PRINT_DEBUG */ + _mesa_fprint_instruction_opt(stdout, inst, 0, PROG_PRINT_DEBUG, NULL); +} + +#if 0 +/** + * Print program, with options. + */ +void +_mesa_fprint_program_opt(FILE *f, + const struct gl_program *prog, + gl_prog_print_mode mode, + GLboolean lineNumbers) +{ + GLuint i, indent = 0; + + switch (prog->Target) { + case GL_VERTEX_PROGRAM_ARB: + if (mode == PROG_PRINT_ARB) + fprintf(f, "!!ARBvp1.0\n"); + else if (mode == PROG_PRINT_NV) + fprintf(f, "!!VP1.0\n"); + else + fprintf(f, "# Vertex Program/Shader %u\n", prog->Id); + break; + case GL_FRAGMENT_PROGRAM_ARB: + case GL_FRAGMENT_PROGRAM_NV: + if (mode == PROG_PRINT_ARB) + fprintf(f, "!!ARBfp1.0\n"); + else if (mode == PROG_PRINT_NV) + fprintf(f, "!!FP1.0\n"); + else + fprintf(f, "# Fragment Program/Shader %u\n", prog->Id); + break; + } + + for (i = 0; i < prog->NumInstructions; i++) { + if (lineNumbers) + fprintf(f, "%3d: ", i); + indent = _mesa_fprint_instruction_opt(f, prog->Instructions + i, + indent, mode, prog); + } +} + + +/** + * Print program to stderr, default options. + */ +void +_mesa_print_program(const struct gl_program *prog) +{ + _mesa_fprint_program_opt(stderr, prog, PROG_PRINT_DEBUG, GL_TRUE); +} + +/** + * Return binary representation of 64-bit value (as a string). + * Insert a comma to separate each group of 8 bits. + * Note we return a pointer to local static storage so this is not + * re-entrant, etc. + * XXX move to imports.[ch] if useful elsewhere. + */ +static const char * +binary(GLbitfield64 val) +{ + static char buf[80]; + GLint i, len = 0; + for (i = 63; i >= 0; --i) { + if (val & (1ULL << i)) + buf[len++] = '1'; + else if (len > 0 || i == 0) + buf[len++] = '0'; + if (len > 0 && ((i-1) % 8) == 7) + buf[len++] = ','; + } + buf[len] = '\0'; + return buf; +} + + +/** + * Print all of a program's parameters/fields to given file. + */ +static void +_mesa_fprint_program_parameters(FILE *f, + GLcontext *ctx, + const struct gl_program *prog) +{ + GLuint i; + + fprintf(f, "InputsRead: 0x%x (0b%s)\n", + prog->InputsRead, binary(prog->InputsRead)); + fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n", + prog->OutputsWritten, binary(prog->OutputsWritten)); + fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); + fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries); + fprintf(f, "NumParameters=%d\n", prog->NumParameters); + fprintf(f, "NumAttributes=%d\n", prog->NumAttributes); + fprintf(f, "NumAddressRegs=%d\n", prog->NumAddressRegs); + fprintf(f, "SamplersUsed: 0x%x (0b%s)\n", + prog->SamplersUsed, binary(prog->SamplersUsed)); + fprintf(f, "Samplers=[ "); + for (i = 0; i < MAX_SAMPLERS; i++) { + fprintf(f, "%d ", prog->SamplerUnits[i]); + } + fprintf(f, "]\n"); + + _mesa_load_state_parameters(ctx, prog->Parameters); + +#if 0 + fprintf(f, "Local Params:\n"); + for (i = 0; i < MAX_PROGRAM_LOCAL_PARAMS; i++){ + const GLfloat *p = prog->LocalParams[i]; + fprintf(f, "%2d: %f, %f, %f, %f\n", i, p[0], p[1], p[2], p[3]); + } +#endif + _mesa_print_parameter_list(prog->Parameters); +} + + +/** + * Print all of a program's parameters/fields to stderr. + */ +void +_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) +{ + _mesa_fprint_program_parameters(stderr, ctx, prog); +} + + +/** + * Print a program parameter list to given file. + */ +static void +_mesa_fprint_parameter_list(FILE *f, + const struct gl_program_parameter_list *list) +{ + const gl_prog_print_mode mode = PROG_PRINT_DEBUG; + GLuint i; + + if (!list) + return; + + if (0) + fprintf(f, "param list %p\n", (void *) list); + fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags); + for (i = 0; i < list->NumParameters; i++){ + struct gl_program_parameter *param = list->Parameters + i; + const GLfloat *v = list->ParameterValues[i]; + fprintf(f, "param[%d] sz=%d %s %s = {%.3g, %.3g, %.3g, %.3g}", + i, param->Size, + file_string(list->Parameters[i].Type, mode), + param->Name, v[0], v[1], v[2], v[3]); + if (param->Flags & PROG_PARAM_BIT_CENTROID) + fprintf(f, " Centroid"); + if (param->Flags & PROG_PARAM_BIT_INVARIANT) + fprintf(f, " Invariant"); + if (param->Flags & PROG_PARAM_BIT_FLAT) + fprintf(f, " Flat"); + if (param->Flags & PROG_PARAM_BIT_LINEAR) + fprintf(f, " Linear"); + fprintf(f, "\n"); + } +} + + +/** + * Print a program parameter list to stderr. + */ +void +_mesa_print_parameter_list(const struct gl_program_parameter_list *list) +{ + _mesa_fprint_parameter_list(stderr, list); +} + + +/** + * Write shader and associated info to a file. + */ +void +_mesa_write_shader_to_file(const struct gl_shader *shader) +{ + const char *type; + char filename[100]; + FILE *f; + + if (shader->Type == GL_FRAGMENT_SHADER) + type = "frag"; + else + type = "vert"; + + snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); + f = fopen(filename, "w"); + if (!f) { + fprintf(stderr, "Unable to open %s for writing\n", filename); + return; + } + + fprintf(f, "/* Shader %u source, checksum %u */\n", shader->Name, shader->SourceChecksum); + fputs(shader->Source, f); + fprintf(f, "\n"); + + fprintf(f, "/* Compile status: %s */\n", + shader->CompileStatus ? "ok" : "fail"); + if (!shader->CompileStatus) { + fprintf(f, "/* Log Info: */\n"); + fputs(shader->InfoLog, f); + } + else { + fprintf(f, "/* GPU code */\n"); + fprintf(f, "/*\n"); + _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE); + fprintf(f, "*/\n"); + fprintf(f, "/* Parameters / constants */\n"); + fprintf(f, "/*\n"); + _mesa_fprint_parameter_list(f, shader->Program->Parameters); + fprintf(f, "*/\n"); + } + + fclose(f); +} + + +/** + * Append the shader's uniform info/values to the shader log file. + * The log file will typically have been created by the + * _mesa_write_shader_to_file function. + */ +void +_mesa_append_uniforms_to_file(const struct gl_shader *shader, + const struct gl_program *prog) +{ + const char *type; + char filename[100]; + FILE *f; + + if (shader->Type == GL_FRAGMENT_SHADER) + type = "frag"; + else + type = "vert"; + + snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); + f = fopen(filename, "a"); /* append */ + if (!f) { + fprintf(stderr, "Unable to open %s for appending\n", filename); + return; + } + + fprintf(f, "/* First-draw parameters / constants */\n"); + fprintf(f, "/*\n"); + _mesa_fprint_parameter_list(f, prog->Parameters); + fprintf(f, "*/\n"); + + fclose(f); +} +#endif diff --git a/src/glsl/mesa/shader/prog_print.h b/src/glsl/mesa/shader/prog_print.h new file mode 100644 index 0000000000..f0df77b512 --- /dev/null +++ b/src/glsl/mesa/shader/prog_print.h @@ -0,0 +1,98 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5.3 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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. + */ + + +#ifndef PROG_PRINT_H +#define PROG_PRINT_H + + +/** + * The output style to use when printing programs. + */ +typedef enum { + PROG_PRINT_ARB, + PROG_PRINT_NV, + PROG_PRINT_DEBUG +} gl_prog_print_mode; + + +extern void +_mesa_print_vp_inputs(GLbitfield inputs); + +extern void +_mesa_print_fp_inputs(GLbitfield inputs); + +extern const char * +_mesa_condcode_string(GLuint condcode); + +extern const char * +_mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended); + +const char * +_mesa_writemask_string(GLuint writeMask); + +extern void +_mesa_print_swizzle(GLuint swizzle); + +extern void +_mesa_print_alu_instruction(const struct prog_instruction *inst, + const char *opcode_string, GLuint numRegs); + +extern void +_mesa_print_instruction(const struct prog_instruction *inst); + +extern GLint +_mesa_fprint_instruction_opt(FILE *f, + const struct prog_instruction *inst, + GLint indent, + gl_prog_print_mode mode, + const struct gl_program *prog); + +extern GLint +_mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, + gl_prog_print_mode mode, + const struct gl_program *prog); + +extern void +_mesa_print_program(const struct gl_program *prog); + +extern void +_mesa_fprint_program_opt(FILE *f, + const struct gl_program *prog, gl_prog_print_mode mode, + GLboolean lineNumbers); + +#if 0 +extern void +_mesa_print_parameter_list(const struct gl_program_parameter_list *list); + +extern void +_mesa_write_shader_to_file(const struct gl_shader *shader); + +extern void +_mesa_append_uniforms_to_file(const struct gl_shader *shader, + const struct gl_program *prog); +#endif + + +#endif /* PROG_PRINT_H */ diff --git a/src/glsl/program.h b/src/glsl/program.h new file mode 100644 index 0000000000..d21b04344c --- /dev/null +++ b/src/glsl/program.h @@ -0,0 +1,155 @@ +/* + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * 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 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 + * BRIAN PAUL 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 +#include "main/mtypes.h" + +/** + * Based on gl_shader in Mesa's mtypes.h. + */ +struct glsl_shader { + GLenum Type; + GLuint Name; + GLint RefCount; + GLboolean DeletePending; + GLboolean CompileStatus; + const GLchar *Source; /**< Source code string */ + size_t SourceLen; + GLchar *InfoLog; + + struct exec_list ir; + struct glsl_symbol_table *symbols; +}; + + +typedef int gl_state_index; +#define STATE_LENGTH 5 + +/** + * Program parameter. + * Used by shaders/programs for uniforms, constants, varying vars, etc. + */ +struct gl_program_parameter +{ + const char *Name; /**< Null-terminated string */ + gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ + GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ + /** + * Number of components (1..4), or more. + * If the number of components is greater than 4, + * this parameter is part of a larger uniform like a GLSL matrix or array. + * The next program parameter's Size will be Size-4 of this parameter. + */ + GLuint Size; + GLboolean Used; /**< Helper flag for GLSL uniform tracking */ + GLboolean Initialized; /**< Has the ParameterValue[] been set? */ + GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ + /** + * A sequence of STATE_* tokens and integers to identify GL state. + */ + gl_state_index StateIndexes[STATE_LENGTH]; +}; + + +/** + * List of gl_program_parameter instances. + */ +struct gl_program_parameter_list +{ + GLuint Size; /**< allocated size of Parameters, ParameterValues */ + GLuint NumParameters; /**< number of parameters in arrays */ + struct gl_program_parameter *Parameters; /**< Array [Size] */ + GLfloat (*ParameterValues)[4]; /**< Array [Size] of GLfloat[4] */ + GLbitfield StateFlags; /**< _NEW_* flags indicating which state changes + might invalidate ParameterValues[] */ +}; + + +/** + * Shader program uniform variable. + * The glGetUniformLocation() and glUniform() commands will use this + * information. + * Note that a uniform such as "binormal" might be used in both the + * vertex shader and the fragment shader. When glUniform() is called to + * set the uniform's value, it must be updated in both the vertex and + * fragment shaders. The uniform may be in different locations in the + * two shaders so we keep track of that here. + */ +struct gl_uniform +{ + const char *Name; /**< Null-terminated string */ + GLint VertPos; + GLint FragPos; + GLboolean Initialized; /**< For debug. Has this uniform been set? */ +#if 0 + GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ + GLuint Size; /**< Number of components (1..4) */ +#endif +}; + + +/** + * List of gl_uniforms + */ +struct gl_uniform_list +{ + GLuint Size; /**< allocated size of Uniforms array */ + GLuint NumUniforms; /**< number of uniforms in the array */ + struct gl_uniform *Uniforms; /**< Array [Size] */ +}; + + +/** + * Based on gl_shader_program in Mesa's mtypes.h. + */ +struct glsl_program { + GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */ + GLuint Name; /**< aka handle or ID */ + GLint RefCount; /**< Reference count */ + GLboolean DeletePending; + + GLuint NumShaders; /**< number of attached shaders */ + struct glsl_shader **Shaders; /**< List of attached the shaders */ + + /** + * Per-stage shaders resulting from the first stage of linking. + */ + /*@{*/ + unsigned _NumLinkedShaders; + struct glsl_shader **_LinkedShaders; + /*@}*/ + + /** User-defined attribute bindings (glBindAttribLocation) */ + struct gl_program_parameter_list *Attributes; + + /* post-link info: */ + struct gl_uniform_list *Uniforms; + struct gl_program_parameter_list *Varying; + GLboolean LinkStatus; /**< GL_LINK_STATUS */ + GLboolean Validated; + GLboolean _Used; /**< Ever used for drawing? */ + GLchar *InfoLog; +}; + +extern void +link_shaders(struct glsl_program *prog); diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp new file mode 100644 index 0000000000..26be23ea8f --- /dev/null +++ b/src/glsl/s_expression.cpp @@ -0,0 +1,131 @@ +/* -*- c++ -*- */ +/* + * 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 +#include +#include +#include +#include "s_expression.h" + +s_symbol::s_symbol(const char *tmp) +{ + this->str = talloc_strdup (this, tmp); + assert(this->str != NULL); +} + +s_list::s_list() +{ +} + +unsigned +s_list::length() const +{ + unsigned i = 0; + foreach_iter(exec_list_iterator, it, this->subexpressions) { + i++; + } + return i; +} + +static s_expression * +read_atom(void *ctx, const char *& src) +{ + char buf[101]; + int n; + if (sscanf(src, " %100[^( \v\t\r\n)]%n", buf, &n) != 1) + return NULL; // no atom + src += n; + + // Check if the atom is a number. + char *float_end = NULL; + double f = strtod(buf, &float_end); + if (float_end != buf) { + char *int_end = NULL; + int i = strtol(buf, &int_end, 10); + // If strtod matched more characters, it must have a decimal part + if (float_end > int_end) + return new(ctx) s_float(f); + + return new(ctx) s_int(i); + } + // Not a number; return a symbol. + return new(ctx) s_symbol(buf); +} + +s_expression * +s_expression::read_expression(void *ctx, const char *&src) +{ + assert(src != NULL); + + s_expression *atom = read_atom(ctx, src); + if (atom != NULL) + return atom; + + char c; + int n; + if (sscanf(src, " %c%n", &c, &n) == 1 && c == '(') { + src += n; + + s_list *list = new(ctx) s_list; + s_expression *expr; + + while ((expr = read_expression(ctx, src)) != NULL) { + list->subexpressions.push_tail(expr); + } + if (sscanf(src, " %c%n", &c, &n) != 1 || c != ')') { + printf("Unclosed expression (check your parenthesis).\n"); + return NULL; + } + src += n; + return list; + } + return NULL; +} + +void s_int::print() +{ + printf("%d", this->val); +} + +void s_float::print() +{ + printf("%f", this->val); +} + +void s_symbol::print() +{ + printf("%s", this->str); +} + +void s_list::print() +{ + printf("("); + foreach_iter(exec_list_iterator, it, this->subexpressions) { + s_expression *expr = (s_expression*) it.get(); + expr->print(); + printf(" "); + } + printf(")"); +} + diff --git a/src/glsl/s_expression.h b/src/glsl/s_expression.h new file mode 100644 index 0000000000..1a0c03c218 --- /dev/null +++ b/src/glsl/s_expression.h @@ -0,0 +1,142 @@ +/* -*- c++ -*- */ +/* + * 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. + */ + +#pragma once +#ifndef S_EXPRESSION_H +#define S_EXPRESSION_H + +#include "list.h" + +#define SX_AS_(t,x) ((x) && ((s_expression*) x)->is_##t()) ? ((s_##t*) (x)) \ + : NULL +#define SX_AS_LIST(x) SX_AS_(list, x) +#define SX_AS_SYMBOL(x) SX_AS_(symbol, x) +#define SX_AS_NUMBER(x) SX_AS_(number, x) +#define SX_AS_INT(x) SX_AS_(int, x) + +/* For our purposes, S-Expressions are: + * - + * - + * - symbol + * - (expr1 expr2 ... exprN) where exprN is an S-Expression + * + * Unlike LISP/Scheme, we do not support (foo . bar) pairs. + */ +class s_expression : public exec_node +{ +public: + /** + * Read an S-Expression from the given string. + * Advances the supplied pointer to just after the expression read. + * + * Any allocation will be performed with 'ctx' as the talloc owner. + */ + static s_expression *read_expression(void *ctx, const char *&src); + + /** + * Print out an S-Expression. Useful for debugging. + */ + virtual void print() = 0; + + virtual bool is_list() const { return false; } + virtual bool is_symbol() const { return false; } + virtual bool is_number() const { return false; } + virtual bool is_int() const { return false; } + +protected: + s_expression() { } +}; + +/* Atoms */ + +class s_number : public s_expression +{ +public: + bool is_number() const { return true; } + + virtual float fvalue() = 0; + +protected: + s_number() { } +}; + +class s_int : public s_number +{ +public: + s_int(int x) : val(x) { } + + bool is_int() const { return true; } + + float fvalue() { return float(this->val); } + int value() { return this->val; } + + void print(); + +private: + int val; +}; + +class s_float : public s_number +{ +public: + s_float(float x) : val(x) { } + + float fvalue() { return this->val; } + + void print(); + +private: + float val; +}; + +class s_symbol : public s_expression +{ +public: + s_symbol(const char *); + + bool is_symbol() const { return true; } + + const char *value() { return this->str; } + + void print(); + +private: + char *str; +}; + +/* Lists of expressions: (expr1 ... exprN) */ +class s_list : public s_expression +{ +public: + s_list(); + + virtual bool is_list() const { return true; } + unsigned length() const; + + void print(); + + exec_list subexpressions; +}; + +#endif /* S_EXPRESSION_H */ diff --git a/src/glsl/symbol_table.c b/src/glsl/symbol_table.c new file mode 100644 index 0000000000..0f0df7a261 --- /dev/null +++ b/src/glsl/symbol_table.c @@ -0,0 +1,413 @@ +/* + * Copyright © 2008 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 "main/imports.h" +#include "symbol_table.h" +#include "hash_table.h" + +struct symbol { + /** + * Link to the next symbol in the table with the same name + * + * The linked list of symbols with the same name is ordered by scope + * from inner-most to outer-most. + */ + struct symbol *next_with_same_name; + + + /** + * Link to the next symbol in the table with the same scope + * + * The linked list of symbols with the same scope is unordered. Symbols + * in this list my have unique names. + */ + struct symbol *next_with_same_scope; + + + /** + * Header information for the list of symbols with the same name. + */ + struct symbol_header *hdr; + + + /** + * Name space of the symbol + * + * Name space are arbitrary user assigned integers. No two symbols can + * exist in the same name space at the same scope level. + */ + int name_space; + + + /** + * Arbitrary user supplied data. + */ + void *data; + + /** Scope depth where this symbol was defined. */ + unsigned depth; +}; + + +/** + */ +struct symbol_header { + /** Linkage in list of all headers in a given symbol table. */ + struct symbol_header *next; + + /** Symbol name. */ + const char *name; + + /** Linked list of symbols with the same name. */ + struct symbol *symbols; +}; + + +/** + * Element of the scope stack. + */ +struct scope_level { + /** Link to next (inner) scope level. */ + struct scope_level *next; + + /** Linked list of symbols with the same scope. */ + struct symbol *symbols; +}; + + +/** + * + */ +struct _mesa_symbol_table { + /** Hash table containing all symbols in the symbol table. */ + struct hash_table *ht; + + /** Top of scope stack. */ + struct scope_level *current_scope; + + /** List of all symbol headers in the table. */ + struct symbol_header *hdr; + + /** Current scope depth. */ + unsigned depth; +}; + + +struct _mesa_symbol_table_iterator { + /** + * Name space of symbols returned by this iterator. + */ + int name_space; + + + /** + * Currently iterated symbol + * + * The next call to \c _mesa_symbol_table_iterator_get will return this + * value. It will also update this value to the value that should be + * returned by the next call. + */ + struct symbol *curr; +}; + + +static void +check_symbol_table(struct _mesa_symbol_table *table) +{ +#if 1 + struct scope_level *scope; + + for (scope = table->current_scope; scope != NULL; scope = scope->next) { + struct symbol *sym; + + for (sym = scope->symbols + ; sym != NULL + ; sym = sym->next_with_same_name) { + const struct symbol_header *const hdr = sym->hdr; + struct symbol *sym2; + + for (sym2 = hdr->symbols + ; sym2 != NULL + ; sym2 = sym2->next_with_same_name) { + assert(sym2->hdr == hdr); + } + } + } +#endif +} + +void +_mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table) +{ + struct scope_level *const scope = table->current_scope; + struct symbol *sym = scope->symbols; + + table->current_scope = scope->next; + table->depth--; + + free(scope); + + while (sym != NULL) { + struct symbol *const next = sym->next_with_same_scope; + struct symbol_header *const hdr = sym->hdr; + + assert(hdr->symbols == sym); + + hdr->symbols = sym->next_with_same_name; + + free(sym); + + sym = next; + } + + check_symbol_table(table); +} + + +void +_mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) +{ + struct scope_level *const scope = calloc(1, sizeof(*scope)); + + scope->next = table->current_scope; + table->current_scope = scope; + table->depth++; +} + + +static struct symbol_header * +find_symbol(struct _mesa_symbol_table *table, const char *name) +{ + return (struct symbol_header *) hash_table_find(table->ht, name); +} + + +struct _mesa_symbol_table_iterator * +_mesa_symbol_table_iterator_ctor(struct _mesa_symbol_table *table, + int name_space, const char *name) +{ + struct _mesa_symbol_table_iterator *iter = calloc(1, sizeof(*iter)); + struct symbol_header *const hdr = find_symbol(table, name); + + iter->name_space = name_space; + + if (hdr != NULL) { + struct symbol *sym; + + for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { + assert(sym->hdr == hdr); + + if ((name_space == -1) || (sym->name_space == name_space)) { + iter->curr = sym; + break; + } + } + } + + return iter; +} + + +void +_mesa_symbol_table_iterator_dtor(struct _mesa_symbol_table_iterator *iter) +{ + free(iter); +} + + +void * +_mesa_symbol_table_iterator_get(struct _mesa_symbol_table_iterator *iter) +{ + return (iter->curr == NULL) ? NULL : iter->curr->data; +} + + +int +_mesa_symbol_table_iterator_next(struct _mesa_symbol_table_iterator *iter) +{ + struct symbol_header *hdr; + + if (iter->curr == NULL) { + return 0; + } + + hdr = iter->curr->hdr; + iter->curr = iter->curr->next_with_same_name; + + while (iter->curr != NULL) { + assert(iter->curr->hdr == hdr); + + if ((iter->name_space == -1) + || (iter->curr->name_space == iter->name_space)) { + return 1; + } + + iter->curr = iter->curr->next_with_same_name; + } + + return 0; +} + + +/** + * Determine the scope "distance" of a symbol from the current scope + * + * \return + * A non-negative number for the number of scopes between the current scope + * and the scope where a symbol was defined. A value of zero means the current + * scope. A negative number if the symbol does not exist. + */ +int +_mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, + int name_space, const char *name) +{ + struct symbol_header *const hdr = find_symbol(table, name); + struct symbol *sym; + + if (hdr != NULL) { + for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { + assert(sym->hdr == hdr); + + if ((name_space == -1) || (sym->name_space == name_space)) { + assert(sym->depth <= table->depth); + return sym->depth - table->depth; + } + } + } + + return -1; +} + + +void * +_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *table, + int name_space, const char *name) +{ + struct symbol_header *const hdr = find_symbol(table, name); + + if (hdr != NULL) { + struct symbol *sym; + + + for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { + assert(sym->hdr == hdr); + + if ((name_space == -1) || (sym->name_space == name_space)) { + return sym->data; + } + } + } + + return NULL; +} + + +int +_mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, + int name_space, const char *name, + void *declaration) +{ + struct symbol_header *hdr; + struct symbol *sym; + + check_symbol_table(table); + + hdr = find_symbol(table, name); + + check_symbol_table(table); + + if (hdr == NULL) { + hdr = calloc(1, sizeof(*hdr)); + hdr->name = name; + + hash_table_insert(table->ht, hdr, name); + hdr->next = table->hdr; + table->hdr = hdr; + } + + check_symbol_table(table); + + /* If the symbol already exists in this namespace at this scope, it cannot + * be added to the table. + */ + for (sym = hdr->symbols + ; (sym != NULL) && (sym->name_space != name_space) + ; sym = sym->next_with_same_name) { + /* empty */ + } + + if (sym && (sym->depth == table->depth)) + return -1; + + sym = calloc(1, sizeof(*sym)); + sym->next_with_same_name = hdr->symbols; + sym->next_with_same_scope = table->current_scope->symbols; + sym->hdr = hdr; + sym->name_space = name_space; + sym->data = declaration; + sym->depth = table->depth; + + assert(sym->hdr == hdr); + + hdr->symbols = sym; + table->current_scope->symbols = sym; + + check_symbol_table(table); + return 0; +} + + +struct _mesa_symbol_table * +_mesa_symbol_table_ctor(void) +{ + struct _mesa_symbol_table *table = calloc(1, sizeof(*table)); + + if (table != NULL) { + table->ht = hash_table_ctor(32, hash_table_string_hash, + hash_table_string_compare); + + _mesa_symbol_table_push_scope(table); + } + + return table; +} + + +void +_mesa_symbol_table_dtor(struct _mesa_symbol_table *table) +{ + struct symbol_header *hdr; + struct symbol_header *next; + + while (table->current_scope != NULL) { + _mesa_symbol_table_pop_scope(table); + } + + for (hdr = table->hdr; hdr != NULL; hdr = next) { + next = hdr->next; + _mesa_free(hdr); + } + + hash_table_dtor(table->ht); + free(table); +} diff --git a/src/glsl/symbol_table.h b/src/glsl/symbol_table.h new file mode 100644 index 0000000000..3a9994c1ac --- /dev/null +++ b/src/glsl/symbol_table.h @@ -0,0 +1,66 @@ +/* + * Copyright © 2008 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. + */ +#ifndef MESA_SYMBOL_TABLE_H +#define MESA_SYMBOL_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct _mesa_symbol_table; +struct _mesa_symbol_table_iterator; + +extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table); + +extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table); + +extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab, + int name_space, const char *name, void *declaration); + +extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, + int name_space, const char *name); + +extern void *_mesa_symbol_table_find_symbol( + struct _mesa_symbol_table *symtab, int name_space, const char *name); + +extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void); + +extern void _mesa_symbol_table_dtor(struct _mesa_symbol_table *); + +extern struct _mesa_symbol_table_iterator *_mesa_symbol_table_iterator_ctor( + struct _mesa_symbol_table *table, int name_space, const char *name); + +extern void _mesa_symbol_table_iterator_dtor( + struct _mesa_symbol_table_iterator *); + +extern void *_mesa_symbol_table_iterator_get( + struct _mesa_symbol_table_iterator *iter); + +extern int _mesa_symbol_table_iterator_next( + struct _mesa_symbol_table_iterator *iter); + +#ifdef __cplusplus +} +#endif + +#endif /* MESA_SYMBOL_TABLE_H */ diff --git a/src/glsl/tests/array-01.glsl b/src/glsl/tests/array-01.glsl new file mode 100644 index 0000000000..d14135fb3a --- /dev/null +++ b/src/glsl/tests/array-01.glsl @@ -0,0 +1,3 @@ +#version 120 +/* FAIL - array size type must be int */ +uniform vec4 [3.2] a; diff --git a/src/glsl/tests/array-02.glsl b/src/glsl/tests/array-02.glsl new file mode 100644 index 0000000000..d743617158 --- /dev/null +++ b/src/glsl/tests/array-02.glsl @@ -0,0 +1,3 @@ +#version 120 +/* FAIL - array size type must be scalar */ +uniform vec4 [ivec4(3)] a; diff --git a/src/glsl/tests/array-03.glsl b/src/glsl/tests/array-03.glsl new file mode 100644 index 0000000000..0026913f01 --- /dev/null +++ b/src/glsl/tests/array-03.glsl @@ -0,0 +1,3 @@ +#version 120 +/* PASS */ +uniform vec4 [3] a; diff --git a/src/glsl/tests/array-04.glsl b/src/glsl/tests/array-04.glsl new file mode 100644 index 0000000000..70f434d8ab --- /dev/null +++ b/src/glsl/tests/array-04.glsl @@ -0,0 +1,2 @@ +/* FAIL - array size type must be int */ +uniform vec4 a[3.2]; diff --git a/src/glsl/tests/array-05.glsl b/src/glsl/tests/array-05.glsl new file mode 100644 index 0000000000..168704096b --- /dev/null +++ b/src/glsl/tests/array-05.glsl @@ -0,0 +1,2 @@ +/* FAIL - array size type must be scalar */ +uniform vec4 a[ivec4(3)]; diff --git a/src/glsl/tests/array-06.glsl b/src/glsl/tests/array-06.glsl new file mode 100644 index 0000000000..46b43795be --- /dev/null +++ b/src/glsl/tests/array-06.glsl @@ -0,0 +1,2 @@ +/* PASS */ +uniform vec4 a[3]; diff --git a/src/glsl/tests/array-07.glsl b/src/glsl/tests/array-07.glsl new file mode 100644 index 0000000000..161ffbf2f2 --- /dev/null +++ b/src/glsl/tests/array-07.glsl @@ -0,0 +1,2 @@ +/* FAIL - array size must be > 0 */ +uniform vec4 a[0]; diff --git a/src/glsl/tests/array-08.glsl b/src/glsl/tests/array-08.glsl new file mode 100644 index 0000000000..4bf0c6bd51 --- /dev/null +++ b/src/glsl/tests/array-08.glsl @@ -0,0 +1,2 @@ +/* FAIL - array size must be > 0 */ +uniform vec4 a[-1]; diff --git a/src/glsl/tests/array-09.glsl b/src/glsl/tests/array-09.glsl new file mode 100644 index 0000000000..cad6d0e54e --- /dev/null +++ b/src/glsl/tests/array-09.glsl @@ -0,0 +1,9 @@ +#version 120 +/* PASS */ + +void main() +{ + vec4 a[2] = vec4 [2] (vec4(1.0), vec4(2.0)); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/array-10.glsl b/src/glsl/tests/array-10.glsl new file mode 100644 index 0000000000..019aa21150 --- /dev/null +++ b/src/glsl/tests/array-10.glsl @@ -0,0 +1,11 @@ +/* FAIL - array constructors forbidden in GLSL 1.10 + * + * This can also generate an error because the 'vec4[]' style syntax is + * illegal in GLSL 1.10. + */ +void main() +{ + vec4 a[2] = vec4 [2] (vec4(1.0), vec4(2.0)); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/array-11.glsl b/src/glsl/tests/array-11.glsl new file mode 100644 index 0000000000..51d94e9477 --- /dev/null +++ b/src/glsl/tests/array-11.glsl @@ -0,0 +1,9 @@ +#version 120 +/* PASS */ + +void main() +{ + vec4 a[] = vec4 [] (vec4(1.0), vec4(2.0)); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/array-12.glsl b/src/glsl/tests/array-12.glsl new file mode 100644 index 0000000000..7fc9579452 --- /dev/null +++ b/src/glsl/tests/array-12.glsl @@ -0,0 +1,11 @@ +#version 120 +/* FAIL - array must have an implicit or explicit size */ + +void main() +{ + vec4 a[]; + + a = vec4 [2] (vec4(1.0), vec4(2.0)); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/array-13.glsl b/src/glsl/tests/array-13.glsl new file mode 100644 index 0000000000..cc7e29a5f7 --- /dev/null +++ b/src/glsl/tests/array-13.glsl @@ -0,0 +1,11 @@ +#version 120 +/* PASS */ + +void main() +{ + vec4 a[2]; + + a = vec4 [] (vec4(1.0), vec4(2.0)); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/attribute-01.glsl b/src/glsl/tests/attribute-01.glsl new file mode 100644 index 0000000000..18e9e4468a --- /dev/null +++ b/src/glsl/tests/attribute-01.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type int */ +attribute int i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-02.glsl b/src/glsl/tests/attribute-02.glsl new file mode 100644 index 0000000000..6b6df74d25 --- /dev/null +++ b/src/glsl/tests/attribute-02.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type ivec2 */ +attribute ivec2 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-03.glsl b/src/glsl/tests/attribute-03.glsl new file mode 100644 index 0000000000..870de9e814 --- /dev/null +++ b/src/glsl/tests/attribute-03.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type ivec3 */ +attribute ivec3 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-04.glsl b/src/glsl/tests/attribute-04.glsl new file mode 100644 index 0000000000..14af2fcaad --- /dev/null +++ b/src/glsl/tests/attribute-04.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type ivec4 */ +attribute ivec4 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-05.glsl b/src/glsl/tests/attribute-05.glsl new file mode 100644 index 0000000000..18822c7854 --- /dev/null +++ b/src/glsl/tests/attribute-05.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type bool */ +attribute bool i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-06.glsl b/src/glsl/tests/attribute-06.glsl new file mode 100644 index 0000000000..f18027b81a --- /dev/null +++ b/src/glsl/tests/attribute-06.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type bvec2 */ +attribute bvec2 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-07.glsl b/src/glsl/tests/attribute-07.glsl new file mode 100644 index 0000000000..0af13ba84b --- /dev/null +++ b/src/glsl/tests/attribute-07.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type bvec3 */ +attribute bvec3 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-08.glsl b/src/glsl/tests/attribute-08.glsl new file mode 100644 index 0000000000..b069c04d1b --- /dev/null +++ b/src/glsl/tests/attribute-08.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have type bvec4 */ +attribute bvec4 i; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-09.glsl b/src/glsl/tests/attribute-09.glsl new file mode 100644 index 0000000000..6a607244b9 --- /dev/null +++ b/src/glsl/tests/attribute-09.glsl @@ -0,0 +1,7 @@ +/* FAIL - attribute cannot have array type in GLSL 1.10 */ +attribute vec4 i[10]; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-10.glsl b/src/glsl/tests/attribute-10.glsl new file mode 100644 index 0000000000..6f5ef63a01 --- /dev/null +++ b/src/glsl/tests/attribute-10.glsl @@ -0,0 +1,8 @@ +#version 120 +/* FAIL - attribute cannot have array type in GLSL 1.20 */ +attribute vec4 i[10]; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/attribute-11.glsl b/src/glsl/tests/attribute-11.glsl new file mode 100644 index 0000000000..47cb5a0583 --- /dev/null +++ b/src/glsl/tests/attribute-11.glsl @@ -0,0 +1,8 @@ +#version 130 +/* FAIL - attribute cannot have array type in GLSL 1.30 */ +attribute vec4 i[10]; + +void main() +{ + gl_Position = vec4(1.0); +} diff --git a/src/glsl/tests/condition-01.glsl b/src/glsl/tests/condition-01.glsl new file mode 100644 index 0000000000..d89c313117 --- /dev/null +++ b/src/glsl/tests/condition-01.glsl @@ -0,0 +1,8 @@ +/* FAIL - :? condition is not bool scalar */ + +uniform bvec4 a; + +void main() +{ + gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/condition-02.glsl b/src/glsl/tests/condition-02.glsl new file mode 100644 index 0000000000..cbd0e18d9a --- /dev/null +++ b/src/glsl/tests/condition-02.glsl @@ -0,0 +1,8 @@ +/* FAIL - :? condition is not bool scalar */ + +uniform float a; + +void main() +{ + gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/condition-03.glsl b/src/glsl/tests/condition-03.glsl new file mode 100644 index 0000000000..9af5d7aa47 --- /dev/null +++ b/src/glsl/tests/condition-03.glsl @@ -0,0 +1,8 @@ +/* PASS */ + +uniform bool a; + +void main() +{ + gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/condition-04.glsl b/src/glsl/tests/condition-04.glsl new file mode 100644 index 0000000000..f440b7e995 --- /dev/null +++ b/src/glsl/tests/condition-04.glsl @@ -0,0 +1,8 @@ +/* FAIL - type of second two operands must match */ + +uniform bool a; + +void main() +{ + gl_Position = (a) ? vec4(1.0, 0.0, 0.0, 1.0) : vec3(0.0, 1.0, 0.0); +} diff --git a/src/glsl/tests/condition-05.glsl b/src/glsl/tests/condition-05.glsl new file mode 100644 index 0000000000..3dff18f519 --- /dev/null +++ b/src/glsl/tests/condition-05.glsl @@ -0,0 +1,13 @@ +#version 120 +/* PASS */ + +uniform bool a; +uniform int b; + +void main() +{ + float x; + + x = (a) ? 2.0 : b; + gl_Position = vec4(x); +} diff --git a/src/glsl/tests/constructor-01.glsl b/src/glsl/tests/constructor-01.glsl new file mode 100644 index 0000000000..fdfaf89866 --- /dev/null +++ b/src/glsl/tests/constructor-01.glsl @@ -0,0 +1,6 @@ +/* PASS */ + +void main() +{ + gl_Position = vec4(1.0, 1.0, 1.0, 0.0);; +} diff --git a/src/glsl/tests/constructor-02.glsl b/src/glsl/tests/constructor-02.glsl new file mode 100644 index 0000000000..47acbe9db1 --- /dev/null +++ b/src/glsl/tests/constructor-02.glsl @@ -0,0 +1,7 @@ +/* FAIL - cannot construct samplers */ +void main() +{ + int i; + + i = sampler2D(0); +} diff --git a/src/glsl/tests/constructor-03.glsl b/src/glsl/tests/constructor-03.glsl new file mode 100644 index 0000000000..07ec225633 --- /dev/null +++ b/src/glsl/tests/constructor-03.glsl @@ -0,0 +1,12 @@ +/* FAIL - cannot construct a matrix from a matrix in GLSL 1.10 */ + +uniform mat2 a; + +void main() +{ + mat2 b; + + b = mat2(a); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-04.glsl b/src/glsl/tests/constructor-04.glsl new file mode 100644 index 0000000000..19d5e011de --- /dev/null +++ b/src/glsl/tests/constructor-04.glsl @@ -0,0 +1,14 @@ +#version 120 +/* FAIL - matrix must be only parameter to matrix constructor */ + +uniform mat2 a; +uniform float x; + +void main() +{ + mat2 b; + + b = mat2(a, x); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-05.glsl b/src/glsl/tests/constructor-05.glsl new file mode 100644 index 0000000000..9c74f75a40 --- /dev/null +++ b/src/glsl/tests/constructor-05.glsl @@ -0,0 +1,13 @@ +/* FAIL - too few components supplied to constructor */ + +uniform vec2 a; +uniform float x; + +void main() +{ + mat2 b; + + b = mat2(a, x); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-06.glsl b/src/glsl/tests/constructor-06.glsl new file mode 100644 index 0000000000..d77a5f9e89 --- /dev/null +++ b/src/glsl/tests/constructor-06.glsl @@ -0,0 +1,13 @@ +#version 120 +/* PASS */ + +uniform mat2 a; + +void main() +{ + mat2 b; + + b = mat2(a); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-07.glsl b/src/glsl/tests/constructor-07.glsl new file mode 100644 index 0000000000..92322506ed --- /dev/null +++ b/src/glsl/tests/constructor-07.glsl @@ -0,0 +1,13 @@ +/* PASS */ + +uniform ivec2 a; +uniform ivec2 b; + +void main() +{ + mat2 c; + + c = mat2(a, b); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-08.glsl b/src/glsl/tests/constructor-08.glsl new file mode 100644 index 0000000000..27153f0cda --- /dev/null +++ b/src/glsl/tests/constructor-08.glsl @@ -0,0 +1,13 @@ +/* PASS */ + +uniform float a; +uniform float b; + +void main() +{ + ivec2 c; + + c = ivec2(a, b); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/constructor-09.glsl b/src/glsl/tests/constructor-09.glsl new file mode 100644 index 0000000000..1985699b30 --- /dev/null +++ b/src/glsl/tests/constructor-09.glsl @@ -0,0 +1,26 @@ +/* PASS */ + +uniform int a; +uniform float b; +uniform bool c; + +void main() +{ + float x; + int y; + bool z; + + x = float(a); + x = float(b); + x = float(c); + + y = int(a); + y = int(b); + y = int(c); + + z = bool(a); + z = bool(b); + z = bool(c); + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/function-01.glsl b/src/glsl/tests/function-01.glsl new file mode 100644 index 0000000000..0eaa2397ab --- /dev/null +++ b/src/glsl/tests/function-01.glsl @@ -0,0 +1,16 @@ +/* FAIL - no function named 'foo' exists */ + +vec4 bar(float x, float y, float z, float w) +{ + vec4 v; + v.x = x; + v.y = y; + v.z = z; + v.w = w; + return v; +} + +void main() +{ + gl_Position = foo(1.0, 1.0, 1.0, 0.0); +} diff --git a/src/glsl/tests/function-02.glsl b/src/glsl/tests/function-02.glsl new file mode 100644 index 0000000000..941fcc1ef7 --- /dev/null +++ b/src/glsl/tests/function-02.glsl @@ -0,0 +1,16 @@ +/* FAIL - no version of 'foo' matches the call to 'foo' */ + +vec4 foo(float x, float y, float z, float w) +{ + vec4 v; + v.x = x; + v.y = y; + v.z = z; + v.w = w; + return v; +} + +void main() +{ + gl_Position = foo(1.0, 1.0, 1.0); +} diff --git a/src/glsl/tests/function-03.glsl b/src/glsl/tests/function-03.glsl new file mode 100644 index 0000000000..b0da42f8e9 --- /dev/null +++ b/src/glsl/tests/function-03.glsl @@ -0,0 +1,16 @@ +/* PASS */ + +vec4 foo(in float x, in float y, float z, float w) +{ + vec4 v; + v.x = x; + v.y = y; + v.z = z; + v.w = w; + return v; +} + +void main() +{ + gl_Position = foo(1.0, 1.0, 1.0, 0.0); +} diff --git a/src/glsl/tests/function-04.glsl b/src/glsl/tests/function-04.glsl new file mode 100644 index 0000000000..dfc0d2b7a6 --- /dev/null +++ b/src/glsl/tests/function-04.glsl @@ -0,0 +1,15 @@ +/* FAIL - type mismatch in assignment */ + +vec3 foo(float x, float y, float z) +{ + vec3 v; + v.x = x; + v.y = y; + v.z = z; + return v; +} + +void main() +{ + gl_Position = foo(1.0, 1.0, 1.0); +} diff --git a/src/glsl/tests/function-05.glsl b/src/glsl/tests/function-05.glsl new file mode 100644 index 0000000000..43365bf606 --- /dev/null +++ b/src/glsl/tests/function-05.glsl @@ -0,0 +1,26 @@ +/* PASS */ + +vec4 foo(in float x, in float y, float z, float w) +{ + vec4 v; + v.x = x; + v.y = y; + v.z = z; + v.w = w; + return v; +} + +vec4 foo(in float x) +{ + vec4 v; + v.x = x; + v.y = x; + v.z = x; + v.w = x; +} + +void main() +{ + gl_Position = foo(1.0, 1.0, 1.0, 0.0); + gl_Position = foo(2.0); +} diff --git a/src/glsl/tests/if-01.glsl b/src/glsl/tests/if-01.glsl new file mode 100644 index 0000000000..ca9abd54f7 --- /dev/null +++ b/src/glsl/tests/if-01.glsl @@ -0,0 +1,11 @@ +/* FAIL - if-statement condition is not bool scalar */ + +uniform bvec4 a; + +void main() +{ + if (a) + gl_Position = vec4(1.0, 0.0, 0.0, 1.0); + else + gl_Position = vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/if-02.glsl b/src/glsl/tests/if-02.glsl new file mode 100644 index 0000000000..7adccea043 --- /dev/null +++ b/src/glsl/tests/if-02.glsl @@ -0,0 +1,11 @@ +/* FAIL - if-statement condition is not bool scalar */ + +uniform float a; + +void main() +{ + if (a) + gl_Position = vec4(1.0, 0.0, 0.0, 1.0); + else + gl_Position = vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/if-03.glsl b/src/glsl/tests/if-03.glsl new file mode 100644 index 0000000000..179618c716 --- /dev/null +++ b/src/glsl/tests/if-03.glsl @@ -0,0 +1,11 @@ +/* PASS */ + +uniform bool a; + +void main() +{ + if (a) + gl_Position = vec4(1.0, 0.0, 0.0, 1.0); + else + gl_Position = vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/if-04.glsl b/src/glsl/tests/if-04.glsl new file mode 100644 index 0000000000..7b711fb7ed --- /dev/null +++ b/src/glsl/tests/if-04.glsl @@ -0,0 +1,11 @@ +/* PASS */ + +uniform bvec4 a; + +void main() +{ + if (a.x) + gl_Position = vec4(1.0, 0.0, 0.0, 1.0); + else + gl_Position = vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/src/glsl/tests/matrix-01.glsl b/src/glsl/tests/matrix-01.glsl new file mode 100644 index 0000000000..f46416c8f6 --- /dev/null +++ b/src/glsl/tests/matrix-01.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat2x3 m; +} diff --git a/src/glsl/tests/matrix-02.glsl b/src/glsl/tests/matrix-02.glsl new file mode 100644 index 0000000000..0630722b79 --- /dev/null +++ b/src/glsl/tests/matrix-02.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat2x4 m; +} diff --git a/src/glsl/tests/matrix-03.glsl b/src/glsl/tests/matrix-03.glsl new file mode 100644 index 0000000000..925dc80625 --- /dev/null +++ b/src/glsl/tests/matrix-03.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat3x2 m; +} diff --git a/src/glsl/tests/matrix-04.glsl b/src/glsl/tests/matrix-04.glsl new file mode 100644 index 0000000000..5275619b31 --- /dev/null +++ b/src/glsl/tests/matrix-04.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat3x4 m; +} diff --git a/src/glsl/tests/matrix-05.glsl b/src/glsl/tests/matrix-05.glsl new file mode 100644 index 0000000000..74e1fd2514 --- /dev/null +++ b/src/glsl/tests/matrix-05.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat4x2 m; +} diff --git a/src/glsl/tests/matrix-06.glsl b/src/glsl/tests/matrix-06.glsl new file mode 100644 index 0000000000..0a512b8523 --- /dev/null +++ b/src/glsl/tests/matrix-06.glsl @@ -0,0 +1,6 @@ +/* FAIL - non-square matrices are not available in GLSL 1.10 */ + +void main() +{ + mat4x3 m; +} diff --git a/src/glsl/tests/matrix-07.glsl b/src/glsl/tests/matrix-07.glsl new file mode 100644 index 0000000000..0b59aa69d5 --- /dev/null +++ b/src/glsl/tests/matrix-07.glsl @@ -0,0 +1,27 @@ +/* PASS */ + +uniform mat2 a; +uniform mat2 b; +uniform mat2 c; +uniform mat2 d; +uniform mat3 e; +uniform mat3 f; +uniform mat3 g; +uniform mat3 h; +uniform mat4 i; +uniform mat4 j; +uniform mat4 k; +uniform mat4 l; + +void main() +{ + mat2 x; + mat3 y; + mat4 z; + + x = a * b + c / d; + y = e * f + g / h; + z = i * j + k / l; + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/matrix-08.glsl b/src/glsl/tests/matrix-08.glsl new file mode 100644 index 0000000000..38138d22de --- /dev/null +++ b/src/glsl/tests/matrix-08.glsl @@ -0,0 +1,19 @@ +#version 120 +/* PASS */ + +uniform mat2x3 a; +uniform mat3x2 b; +uniform mat3x3 c; +uniform mat3x3 d; + +void main() +{ + mat3x3 x; + + /* Multiplying a 2 column, 3 row matrix with a 3 column, 2 row matrix + * results in a 3 column, 3 row matrix. + */ + x = (a * b) + c / d; + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/matrix-09.glsl b/src/glsl/tests/matrix-09.glsl new file mode 100644 index 0000000000..18afbcacea --- /dev/null +++ b/src/glsl/tests/matrix-09.glsl @@ -0,0 +1,11 @@ +/* FAIL - matrix-to-matrix constructors are not available in GLSL 1.10 */ + +uniform mat3 a; + +void main() +{ + mat2 m; + + m = mat2(a); + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/matrix-10.glsl b/src/glsl/tests/matrix-10.glsl new file mode 100644 index 0000000000..20b55180cb --- /dev/null +++ b/src/glsl/tests/matrix-10.glsl @@ -0,0 +1,12 @@ +#version 120 +/* PASS */ + +uniform mat3 a; + +void main() +{ + mat2 m; + + m = mat2(a); + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/parameters-01.glsl b/src/glsl/tests/parameters-01.glsl new file mode 100644 index 0000000000..b485106e9d --- /dev/null +++ b/src/glsl/tests/parameters-01.glsl @@ -0,0 +1,11 @@ +/* FAIL: redefinition of a() */ + +void a() +{ + ; +} + +void a() +{ + ; +} diff --git a/src/glsl/tests/parameters-02.glsl b/src/glsl/tests/parameters-02.glsl new file mode 100644 index 0000000000..7ff5f59ab7 --- /dev/null +++ b/src/glsl/tests/parameters-02.glsl @@ -0,0 +1,11 @@ +/* PASS */ + +void a() +{ + ; +} + +void a(float x) +{ + ; +} diff --git a/src/glsl/tests/parameters-03.glsl b/src/glsl/tests/parameters-03.glsl new file mode 100644 index 0000000000..7ec30f80cc --- /dev/null +++ b/src/glsl/tests/parameters-03.glsl @@ -0,0 +1,9 @@ +/* FAIL - x is redeclared in the function body at the same scope as the + * parameter + */ +void a(float x, float y) +{ + float x; + + x = y; +} diff --git a/src/glsl/tests/qualifier-01.glsl b/src/glsl/tests/qualifier-01.glsl new file mode 100644 index 0000000000..54ec3572a2 --- /dev/null +++ b/src/glsl/tests/qualifier-01.glsl @@ -0,0 +1,3 @@ +#version 130 +/* FAIL - inout only allowed in parameter list */ +inout vec4 foo; diff --git a/src/glsl/tests/qualifier-02.glsl b/src/glsl/tests/qualifier-02.glsl new file mode 100644 index 0000000000..b635d52aa2 --- /dev/null +++ b/src/glsl/tests/qualifier-02.glsl @@ -0,0 +1,2 @@ +/* FAIL - in only allowed in parameter list in GLSL 1.10 */ +in foo; diff --git a/src/glsl/tests/qualifier-03.glsl b/src/glsl/tests/qualifier-03.glsl new file mode 100644 index 0000000000..7e448034a7 --- /dev/null +++ b/src/glsl/tests/qualifier-03.glsl @@ -0,0 +1,2 @@ +/* FAIL - out only allowed in parameter list in GLSL 1.10 */ +out vec4 foo; diff --git a/src/glsl/tests/qualifier-04.glsl b/src/glsl/tests/qualifier-04.glsl new file mode 100644 index 0000000000..d03cafc1db --- /dev/null +++ b/src/glsl/tests/qualifier-04.glsl @@ -0,0 +1,3 @@ +#version 130 +/* PASS */ +in vec4 foo; diff --git a/src/glsl/tests/qualifier-05.glsl b/src/glsl/tests/qualifier-05.glsl new file mode 100644 index 0000000000..15281f3384 --- /dev/null +++ b/src/glsl/tests/qualifier-05.glsl @@ -0,0 +1,3 @@ +#version 130 +/* PASS */ +out vec4 foo; diff --git a/src/glsl/tests/qualifier-06.glsl b/src/glsl/tests/qualifier-06.glsl new file mode 100644 index 0000000000..1907a087c8 --- /dev/null +++ b/src/glsl/tests/qualifier-06.glsl @@ -0,0 +1,7 @@ +/* FAIL - in only allowed in parameter list in GLSL 1.10 */ +void main() +{ + in vec4 foo; + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/qualifier-07.glsl b/src/glsl/tests/qualifier-07.glsl new file mode 100644 index 0000000000..12568a57db --- /dev/null +++ b/src/glsl/tests/qualifier-07.glsl @@ -0,0 +1,7 @@ +/* FAIL - out only allowed in parameter list in GLSL 1.10 */ +void main() +{ + out vec4 foo; + + gl_Position = gl_Vertex; +} diff --git a/src/glsl/tests/swiz-01.glsl b/src/glsl/tests/swiz-01.glsl new file mode 100644 index 0000000000..3268fa178c --- /dev/null +++ b/src/glsl/tests/swiz-01.glsl @@ -0,0 +1,11 @@ +/* PASS */ +#version 120 + +void main() +{ + float a; + vec4 b; + + b.x = 6.0; + a = b.x; +} diff --git a/src/glsl/tests/swiz-02.glsl b/src/glsl/tests/swiz-02.glsl new file mode 100644 index 0000000000..e3f043c47b --- /dev/null +++ b/src/glsl/tests/swiz-02.glsl @@ -0,0 +1,11 @@ +/* FAIL: assignment of a vec2 to a float */ +#version 120 + +void main() +{ + float a; + vec4 b; + + b.x = 6.0; + a = b.xy; +} diff --git a/src/glsl/tests/void-01.glsl b/src/glsl/tests/void-01.glsl new file mode 100644 index 0000000000..5719edc0b6 --- /dev/null +++ b/src/glsl/tests/void-01.glsl @@ -0,0 +1,2 @@ +/* FAIL - cannot declare a variable as having type `void' */ +void foo; -- cgit v1.2.3 From e5cf3aadb8d57dcc70b597092ecac276042f73cb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:41:40 -0700 Subject: glsl2: Add a README file for the new compiler. --- src/glsl/README | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 src/glsl/README (limited to 'src/glsl') diff --git a/src/glsl/README b/src/glsl/README new file mode 100644 index 0000000000..8b6162ab67 --- /dev/null +++ b/src/glsl/README @@ -0,0 +1,153 @@ +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 --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. -- cgit v1.2.3 From 9aa0b6d728dafc40a65d1a45aa0830f87d76cb23 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:49:18 -0700 Subject: glsl2: Move the Mesa IR codegen into mesa/shader/ --- src/glsl/ir_to_mesa.cpp | 1211 ---------------------------------------- src/mesa/shader/ir_to_mesa.cpp | 1211 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1211 insertions(+), 1211 deletions(-) delete mode 100644 src/glsl/ir_to_mesa.cpp create mode 100644 src/mesa/shader/ir_to_mesa.cpp (limited to 'src/glsl') diff --git a/src/glsl/ir_to_mesa.cpp b/src/glsl/ir_to_mesa.cpp deleted file mode 100644 index 26449c5a5c..0000000000 --- a/src/glsl/ir_to_mesa.cpp +++ /dev/null @@ -1,1211 +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 ir_to_mesa.cpp - * - * Translates the IR to ARB_fragment_program text if possible, - * printing the result - */ - -#include -#include "ir.h" -#include "ir_visitor.h" -#include "ir_print_visitor.h" -#include "ir_expression_flattening.h" -#include "glsl_types.h" - -extern "C" { -#include "shader/prog_instruction.h" -#include "shader/prog_print.h" -} - -/** - * This struct is a corresponding struct to Mesa prog_src_register, with - * wider fields. - */ -typedef struct ir_to_mesa_src_reg { - int file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ - int swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ - int negate; /**< NEGATE_XYZW mask from mesa */ - bool reladdr; /**< Register index should be offset by address reg. */ -} ir_to_mesa_src_reg; - -typedef struct ir_to_mesa_dst_reg { - int file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ - int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ -} ir_to_mesa_dst_reg; - -extern ir_to_mesa_src_reg ir_to_mesa_undef; - -class ir_to_mesa_instruction : public exec_node { -public: - enum prog_opcode op; - ir_to_mesa_dst_reg dst_reg; - ir_to_mesa_src_reg src_reg[3]; - /** Pointer to the ir source this tree came from for debugging */ - ir_instruction *ir; -}; - -class temp_entry : public exec_node { -public: - temp_entry(ir_variable *var, int file, int index) - : file(file), index(index), var(var) - { - /* empty */ - } - - int file; - int index; - ir_variable *var; /* variable that maps to this, if any */ -}; - -class ir_to_mesa_visitor : public ir_visitor { -public: - ir_to_mesa_visitor(); - - int next_temp; - int next_constant; - int next_uniform; - - temp_entry *find_variable_storage(ir_variable *var); - - ir_to_mesa_src_reg get_temp(const glsl_type *type); - - struct ir_to_mesa_src_reg src_reg_for_float(float val); - - /** - * \name Visit methods - * - * As typical for the visitor pattern, there must be one \c visit method for - * each concrete subclass of \c ir_instruction. Virtual base classes within - * the hierarchy should not have \c visit methods. - */ - /*@{*/ - virtual void visit(ir_variable *); - virtual void visit(ir_loop *); - virtual void visit(ir_loop_jump *); - virtual void visit(ir_function_signature *); - virtual void visit(ir_function *); - virtual void visit(ir_expression *); - virtual void visit(ir_swizzle *); - virtual void visit(ir_dereference_variable *); - virtual void visit(ir_dereference_array *); - virtual void visit(ir_dereference_record *); - virtual void visit(ir_assignment *); - virtual void visit(ir_constant *); - virtual void visit(ir_call *); - virtual void visit(ir_return *); - virtual void visit(ir_texture *); - virtual void visit(ir_if *); - /*@}*/ - - struct ir_to_mesa_src_reg result; - - /** List of temp_entry */ - exec_list variable_storage; - - /** List of ir_to_mesa_instruction */ - exec_list instructions; - - ir_to_mesa_instruction *ir_to_mesa_emit_op1(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0); - - ir_to_mesa_instruction *ir_to_mesa_emit_op2(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0, - ir_to_mesa_src_reg src1); - - ir_to_mesa_instruction *ir_to_mesa_emit_op3(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0, - ir_to_mesa_src_reg src1, - ir_to_mesa_src_reg src2); - - void ir_to_mesa_emit_scalar_op1(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0); - - /* talloc context (the ) */ - void *ctx; -}; - -ir_to_mesa_src_reg ir_to_mesa_undef = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, false, -}; - -ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { - PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP -}; - -ir_to_mesa_dst_reg ir_to_mesa_address_reg = { - PROGRAM_ADDRESS, 0, WRITEMASK_X -}; - -static int swizzle_for_size(int size) -{ - int size_swizzles[4] = { - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z), - MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W), - }; - - return size_swizzles[size - 1]; -} - -/* This list should match up with builtin_variables.h */ -static const struct { - const char *name; - int file; - int index; -} builtin_var_to_mesa_reg[] = { - /* core_vs */ - {"gl_Position", PROGRAM_OUTPUT, VERT_RESULT_HPOS}, - {"gl_PointSize", PROGRAM_OUTPUT, VERT_RESULT_PSIZ}, - - /* core_fs */ - {"gl_FragCoord", PROGRAM_INPUT, FRAG_ATTRIB_WPOS}, - {"gl_FrontFacing", PROGRAM_INPUT, FRAG_ATTRIB_FACE}, - {"gl_FragColor", PROGRAM_OUTPUT, FRAG_ATTRIB_COL0}, - {"gl_FragDepth", PROGRAM_UNDEFINED, FRAG_ATTRIB_WPOS}, /* FINISHME: WPOS.z */ - - /* 110_deprecated_fs */ - {"gl_Color", PROGRAM_INPUT, FRAG_ATTRIB_COL0}, - {"gl_SecondaryColor", PROGRAM_INPUT, FRAG_ATTRIB_COL1}, - {"gl_FogFragCoord", PROGRAM_INPUT, FRAG_ATTRIB_FOGC}, - {"gl_TexCoord", PROGRAM_INPUT, FRAG_ATTRIB_TEX0}, /* array */ - - /* 110_deprecated_vs */ - {"gl_Vertex", PROGRAM_INPUT, VERT_ATTRIB_POS}, - {"gl_Normal", PROGRAM_INPUT, VERT_ATTRIB_NORMAL}, - {"gl_Color", PROGRAM_INPUT, VERT_ATTRIB_COLOR0}, - {"gl_SecondaryColor", PROGRAM_INPUT, VERT_ATTRIB_COLOR1}, - {"gl_MultiTexCoord0", PROGRAM_INPUT, VERT_ATTRIB_TEX0}, - {"gl_MultiTexCoord1", PROGRAM_INPUT, VERT_ATTRIB_TEX1}, - {"gl_MultiTexCoord2", PROGRAM_INPUT, VERT_ATTRIB_TEX2}, - {"gl_MultiTexCoord3", PROGRAM_INPUT, VERT_ATTRIB_TEX3}, - {"gl_MultiTexCoord4", PROGRAM_INPUT, VERT_ATTRIB_TEX4}, - {"gl_MultiTexCoord5", PROGRAM_INPUT, VERT_ATTRIB_TEX5}, - {"gl_MultiTexCoord6", PROGRAM_INPUT, VERT_ATTRIB_TEX6}, - {"gl_MultiTexCoord7", PROGRAM_INPUT, VERT_ATTRIB_TEX7}, - {"gl_TexCoord", PROGRAM_OUTPUT, VERT_RESULT_TEX0}, /* array */ - {"gl_FogCoord", PROGRAM_INPUT, VERT_RESULT_FOGC}, - /*{"gl_ClipVertex", PROGRAM_OUTPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ - {"gl_FrontColor", PROGRAM_OUTPUT, VERT_RESULT_COL0}, - {"gl_BackColor", PROGRAM_OUTPUT, VERT_RESULT_BFC0}, - {"gl_FrontSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_COL1}, - {"gl_BackSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_BFC1}, - {"gl_FogFragCoord", PROGRAM_OUTPUT, VERT_RESULT_FOGC}, - - /* 130_vs */ - /*{"gl_VertexID", PROGRAM_INPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ - - {"gl_FragData", PROGRAM_OUTPUT, FRAG_RESULT_DATA0}, /* array */ -}; - -ir_to_mesa_instruction * -ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0, - ir_to_mesa_src_reg src1, - ir_to_mesa_src_reg src2) -{ - ir_to_mesa_instruction *inst = new(ctx) ir_to_mesa_instruction(); - - inst->op = op; - inst->dst_reg = dst; - inst->src_reg[0] = src0; - inst->src_reg[1] = src1; - inst->src_reg[2] = src2; - inst->ir = ir; - - this->instructions.push_tail(inst); - - return inst; -} - - -ir_to_mesa_instruction * -ir_to_mesa_visitor::ir_to_mesa_emit_op2(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0, - ir_to_mesa_src_reg src1) -{ - return ir_to_mesa_emit_op3(ir, op, dst, src0, src1, ir_to_mesa_undef); -} - -ir_to_mesa_instruction * -ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0) -{ - return ir_to_mesa_emit_op3(ir, op, dst, - src0, ir_to_mesa_undef, ir_to_mesa_undef); -} - -inline ir_to_mesa_dst_reg -ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) -{ - ir_to_mesa_dst_reg dst_reg; - - dst_reg.file = reg.file; - dst_reg.index = reg.index; - dst_reg.writemask = WRITEMASK_XYZW; - - return dst_reg; -} - -/** - * Emits Mesa scalar opcodes to produce unique answers across channels. - * - * Some Mesa opcodes are scalar-only, like ARB_fp/vp. The src X - * channel determines the result across all channels. So to do a vec4 - * of this operation, we want to emit a scalar per source channel used - * to produce dest channels. - */ -void -ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, - enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0) -{ - int i, j; - int done_mask = ~dst.writemask; - - /* Mesa RCP is a scalar operation splatting results to all channels, - * like ARB_fp/vp. So emit as many RCPs as necessary to cover our - * dst channels. - */ - for (i = 0; i < 4; i++) { - int this_mask = (1 << i); - ir_to_mesa_instruction *inst; - ir_to_mesa_src_reg src = src0; - - if (done_mask & this_mask) - continue; - - int src_swiz = GET_SWZ(src.swizzle, i); - for (j = i + 1; j < 4; j++) { - if (!(done_mask & (1 << j)) && GET_SWZ(src.swizzle, j) == src_swiz) { - this_mask |= (1 << j); - } - } - src.swizzle = MAKE_SWIZZLE4(src_swiz, src_swiz, - src_swiz, src_swiz); - - inst = ir_to_mesa_emit_op1(ir, op, - dst, - src); - inst->dst_reg.writemask = this_mask; - done_mask |= this_mask; - } -} - -struct ir_to_mesa_src_reg -ir_to_mesa_visitor::src_reg_for_float(float val) -{ - ir_to_mesa_src_reg src_reg; - - /* FINISHME: This will end up being _mesa_add_unnamed_constant, - * which handles sharing values and sharing channels of vec4 - * constants for small values. - */ - /* FINISHME: Do something with the constant values for now. - */ - (void)val; - src_reg.file = PROGRAM_CONSTANT; - src_reg.index = this->next_constant++; - src_reg.swizzle = SWIZZLE_NOOP; - - return src_reg; -} - -/** - * In the initial pass of codegen, we assign temporary numbers to - * intermediate results. (not SSA -- variable assignments will reuse - * storage). Actual register allocation for the Mesa VM occurs in a - * pass over the Mesa IR later. - */ -ir_to_mesa_src_reg -ir_to_mesa_visitor::get_temp(const glsl_type *type) -{ - ir_to_mesa_src_reg src_reg; - int swizzle[4]; - int i; - - assert(!type->is_array()); - - src_reg.file = PROGRAM_TEMPORARY; - src_reg.index = type->matrix_columns; - src_reg.reladdr = false; - - for (i = 0; i < type->vector_elements; i++) - swizzle[i] = i; - for (; i < 4; i++) - swizzle[i] = type->vector_elements - 1; - src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], - swizzle[2], swizzle[3]); - - return src_reg; -} - -static int -type_size(const struct glsl_type *type) -{ - unsigned int i; - int size; - - switch (type->base_type) { - case GLSL_TYPE_UINT: - case GLSL_TYPE_INT: - case GLSL_TYPE_FLOAT: - case GLSL_TYPE_BOOL: - if (type->is_matrix()) { - return 4; /* FINISHME: Not all matrices are 4x4. */ - } else { - /* Regardless of size of vector, it gets a vec4. This is bad - * packing for things like floats, but otherwise arrays become a - * mess. Hopefully a later pass over the code can pack scalars - * down if appropriate. - */ - return 1; - } - case GLSL_TYPE_ARRAY: - return type_size(type->fields.array) * type->length; - case GLSL_TYPE_STRUCT: - size = 0; - for (i = 0; i < type->length; i++) { - size += type_size(type->fields.structure[i].type); - } - return size; - default: - assert(0); - } -} - -temp_entry * -ir_to_mesa_visitor::find_variable_storage(ir_variable *var) -{ - - temp_entry *entry; - - foreach_iter(exec_list_iterator, iter, this->variable_storage) { - entry = (temp_entry *)iter.get(); - - if (entry->var == var) - return entry; - } - - return NULL; -} - -void -ir_to_mesa_visitor::visit(ir_variable *ir) -{ - (void)ir; -} - -void -ir_to_mesa_visitor::visit(ir_loop *ir) -{ - assert(!ir->from); - assert(!ir->to); - assert(!ir->increment); - assert(!ir->counter); - - ir_to_mesa_emit_op1(NULL, OPCODE_BGNLOOP, - ir_to_mesa_undef_dst, ir_to_mesa_undef); - - visit_exec_list(&ir->body_instructions, this); - - ir_to_mesa_emit_op1(NULL, OPCODE_ENDLOOP, - ir_to_mesa_undef_dst, ir_to_mesa_undef); -} - -void -ir_to_mesa_visitor::visit(ir_loop_jump *ir) -{ - switch (ir->mode) { - case ir_loop_jump::jump_break: - ir_to_mesa_emit_op1(NULL, OPCODE_BRK, - ir_to_mesa_undef_dst, ir_to_mesa_undef); - break; - case ir_loop_jump::jump_continue: - ir_to_mesa_emit_op1(NULL, OPCODE_CONT, - ir_to_mesa_undef_dst, ir_to_mesa_undef); - break; - } -} - - -void -ir_to_mesa_visitor::visit(ir_function_signature *ir) -{ - assert(0); - (void)ir; -} - -void -ir_to_mesa_visitor::visit(ir_function *ir) -{ - /* Ignore function bodies other than main() -- we shouldn't see calls to - * them since they should all be inlined before we get to ir_to_mesa. - */ - if (strcmp(ir->name, "main") == 0) { - const ir_function_signature *sig; - exec_list empty; - - sig = ir->matching_signature(&empty); - - assert(sig); - - foreach_iter(exec_list_iterator, iter, sig->body) { - ir_instruction *ir = (ir_instruction *)iter.get(); - - ir->accept(this); - } - } -} - -void -ir_to_mesa_visitor::visit(ir_expression *ir) -{ - unsigned int operand; - struct ir_to_mesa_src_reg op[2]; - struct ir_to_mesa_src_reg result_src; - struct ir_to_mesa_dst_reg result_dst; - const glsl_type *vec4_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 4, 1); - const glsl_type *vec3_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 3, 1); - const glsl_type *vec2_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 2, 1); - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - this->result.file = PROGRAM_UNDEFINED; - ir->operands[operand]->accept(this); - if (this->result.file == PROGRAM_UNDEFINED) { - ir_print_visitor v; - printf("Failed to get tree for expression operand:\n"); - ir->operands[operand]->accept(&v); - exit(1); - } - op[operand] = this->result; - - /* Only expression implemented for matrices yet */ - assert(!ir->operands[operand]->type->is_matrix() || - ir->operation == ir_binop_mul); - } - - this->result.file = PROGRAM_UNDEFINED; - - /* Storage for our result. Ideally for an assignment we'd be using - * the actual storage for the result here, instead. - */ - result_src = get_temp(ir->type); - /* convenience for the emit functions below. */ - result_dst = ir_to_mesa_dst_reg_from_src(result_src); - /* Limit writes to the channels that will be used by result_src later. - * This does limit this temp's use as a temporary for multi-instruction - * sequences. - */ - result_dst.writemask = (1 << ir->type->vector_elements) - 1; - - switch (ir->operation) { - case ir_unop_logic_not: - ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, - op[0], src_reg_for_float(0.0)); - break; - case ir_unop_neg: - op[0].negate = ~op[0].negate; - result_src = op[0]; - break; - case ir_unop_exp: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); - break; - case ir_unop_exp2: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_EX2, result_dst, op[0]); - break; - case ir_unop_log: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_LOG, result_dst, op[0]); - break; - case ir_unop_log2: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_LG2, result_dst, op[0]); - break; - case ir_unop_sin: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_SIN, result_dst, op[0]); - break; - case ir_unop_cos: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_COS, result_dst, op[0]); - break; - case ir_binop_add: - ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); - break; - case ir_binop_sub: - ir_to_mesa_emit_op2(ir, OPCODE_SUB, result_dst, op[0], op[1]); - break; - case ir_binop_mul: - if (ir->operands[0]->type->is_matrix() && - !ir->operands[1]->type->is_matrix()) { - if (ir->operands[0]->type->is_scalar()) { - ir_to_mesa_dst_reg dst_column = result_dst; - ir_to_mesa_src_reg src_column = op[0]; - for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - dst_column, src_column, op[1]); - dst_column.index++; - src_column.index++; - } - } else { - ir_to_mesa_dst_reg dst_chan = result_dst; - ir_to_mesa_src_reg src_column = op[0]; - ir_to_mesa_src_reg src_chan = op[1]; - for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { - dst_chan.writemask = (1 << i); - src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - dst_chan, src_column, src_chan); - src_column.index++; - } - } - } else { - assert(!ir->operands[0]->type->is_matrix()); - assert(!ir->operands[1]->type->is_matrix()); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], op[1]); - } - break; - case ir_binop_div: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[1]); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], result_src); - break; - - case ir_binop_less: - ir_to_mesa_emit_op2(ir, OPCODE_SLT, result_dst, op[0], op[1]); - break; - case ir_binop_greater: - ir_to_mesa_emit_op2(ir, OPCODE_SGT, result_dst, op[0], op[1]); - break; - case ir_binop_lequal: - ir_to_mesa_emit_op2(ir, OPCODE_SLE, result_dst, op[0], op[1]); - break; - case ir_binop_gequal: - ir_to_mesa_emit_op2(ir, OPCODE_SGE, result_dst, op[0], op[1]); - break; - case ir_binop_equal: - ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); - break; - case ir_binop_logic_xor: - case ir_binop_nequal: - ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); - break; - - case ir_binop_logic_or: - /* This could be a saturated add and skip the SNE. */ - ir_to_mesa_emit_op2(ir, OPCODE_ADD, - result_dst, - op[0], op[1]); - - ir_to_mesa_emit_op2(ir, OPCODE_SNE, - result_dst, - result_src, src_reg_for_float(0.0)); - break; - - case ir_binop_logic_and: - /* the bool args are stored as float 0.0 or 1.0, so "mul" gives us "and". */ - ir_to_mesa_emit_op2(ir, OPCODE_MUL, - result_dst, - op[0], op[1]); - break; - - case ir_binop_dot: - if (ir->operands[0]->type == vec4_type) { - assert(ir->operands[1]->type == vec4_type); - ir_to_mesa_emit_op2(ir, OPCODE_DP4, - result_dst, - op[0], op[1]); - } else if (ir->operands[0]->type == vec3_type) { - assert(ir->operands[1]->type == vec3_type); - ir_to_mesa_emit_op2(ir, OPCODE_DP3, - result_dst, - op[0], op[1]); - } else if (ir->operands[0]->type == vec2_type) { - assert(ir->operands[1]->type == vec2_type); - ir_to_mesa_emit_op2(ir, OPCODE_DP2, - result_dst, - op[0], op[1]); - } - break; - case ir_unop_sqrt: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); - ir_to_mesa_emit_op1(ir, OPCODE_RCP, result_dst, result_src); - break; - case ir_unop_rsq: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); - break; - case ir_unop_i2f: - /* Mesa IR lacks types, ints are stored as truncated floats. */ - result_src = op[0]; - break; - case ir_unop_f2i: - ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); - break; - case ir_unop_f2b: - ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, - result_src, src_reg_for_float(0.0)); - break; - case ir_unop_trunc: - ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); - break; - case ir_unop_ceil: - op[0].negate = ~op[0].negate; - ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); - result_src.negate = ~result_src.negate; - break; - case ir_unop_floor: - ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); - break; - case ir_binop_min: - ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]); - break; - case ir_binop_max: - ir_to_mesa_emit_op2(ir, OPCODE_MAX, result_dst, op[0], op[1]); - break; - default: - ir_print_visitor v; - printf("Failed to get tree for expression:\n"); - ir->accept(&v); - exit(1); - break; - } - - this->result = result_src; -} - - -void -ir_to_mesa_visitor::visit(ir_swizzle *ir) -{ - ir_to_mesa_src_reg src_reg; - int i; - int swizzle[4]; - - /* Note that this is only swizzles in expressions, not those on the left - * hand side of an assignment, which do write masking. See ir_assignment - * for that. - */ - - ir->val->accept(this); - src_reg = this->result; - assert(src_reg.file != PROGRAM_UNDEFINED); - - for (i = 0; i < 4; i++) { - if (i < ir->type->vector_elements) { - switch (i) { - case 0: - swizzle[i] = ir->mask.x; - break; - case 1: - swizzle[i] = ir->mask.y; - break; - case 2: - swizzle[i] = ir->mask.z; - break; - case 3: - swizzle[i] = ir->mask.w; - break; - } - } else { - /* If the type is smaller than a vec4, replicate the last - * channel out. - */ - swizzle[i] = ir->type->vector_elements - 1; - } - } - - src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], - swizzle[1], - swizzle[2], - swizzle[3]); - - this->result = src_reg; -} - -void -ir_to_mesa_visitor::visit(ir_dereference_variable *ir) -{ - ir_to_mesa_src_reg src_reg; - temp_entry *entry = find_variable_storage(ir->var); - unsigned int i; - bool var_in; - - if (!entry) { - switch (ir->var->mode) { - case ir_var_uniform: - entry = new(ctx) temp_entry(ir->var, PROGRAM_UNIFORM, - this->next_uniform); - this->variable_storage.push_tail(entry); - - this->next_uniform += type_size(ir->var->type); - break; - case ir_var_in: - case ir_var_out: - case ir_var_inout: - var_in = (ir->var->mode == ir_var_in || - ir->var->mode == ir_var_inout); - - for (i = 0; i < ARRAY_SIZE(builtin_var_to_mesa_reg); i++) { - bool in = builtin_var_to_mesa_reg[i].file == PROGRAM_INPUT; - - if (strcmp(ir->var->name, builtin_var_to_mesa_reg[i].name) == 0 && - !(var_in ^ in)) - break; - } - if (i == ARRAY_SIZE(builtin_var_to_mesa_reg)) { - printf("Failed to find builtin for %s variable %s\n", - var_in ? "in" : "out", - ir->var->name); - abort(); - } - entry = new(ctx) temp_entry(ir->var, - builtin_var_to_mesa_reg[i].file, - builtin_var_to_mesa_reg[i].index); - break; - case ir_var_auto: - entry = new(ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, - this->next_temp); - this->variable_storage.push_tail(entry); - - next_temp += type_size(ir->var->type); - break; - } - - if (!entry) { - printf("Failed to make storage for %s\n", ir->var->name); - exit(1); - } - } - - src_reg.file = entry->file; - src_reg.index = entry->index; - /* If the type is smaller than a vec4, replicate the last channel out. */ - src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); - src_reg.reladdr = false; - src_reg.negate = 0; - - this->result = src_reg; -} - -void -ir_to_mesa_visitor::visit(ir_dereference_array *ir) -{ - ir_constant *index; - ir_to_mesa_src_reg src_reg; - - index = ir->array_index->constant_expression_value(); - - /* By the time we make it to this stage, matrices should be broken down - * to vectors. - */ - assert(!ir->type->is_matrix()); - - ir->array->accept(this); - src_reg = this->result; - - if (src_reg.file == PROGRAM_INPUT || - src_reg.file == PROGRAM_OUTPUT) { - assert(index); /* FINISHME: Handle variable indexing of builtins. */ - - src_reg.index += index->value.i[0]; - } else { - if (index) { - src_reg.index += index->value.i[0]; - } else { - ir_to_mesa_src_reg array_base = this->result; - /* Variable index array dereference. It eats the "vec4" of the - * base of the array and an index that offsets the Mesa register - * index. - */ - ir->array_index->accept(this); - - /* FINISHME: This doesn't work when we're trying to do the LHS - * of an assignment. - */ - src_reg.reladdr = true; - ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, - this->result); - - this->result = get_temp(ir->type); - ir_to_mesa_emit_op1(ir, OPCODE_MOV, - ir_to_mesa_dst_reg_from_src(this->result), - src_reg); - } - } - - /* If the type is smaller than a vec4, replicate the last channel out. */ - src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); - - this->result = src_reg; -} - -void -ir_to_mesa_visitor::visit(ir_dereference_record *ir) -{ - unsigned int i; - const glsl_type *struct_type = ir->record->type; - int offset = 0; - - ir->record->accept(this); - - for (i = 0; i < struct_type->length; i++) { - if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) - break; - offset += type_size(struct_type->fields.structure[i].type); - } - this->result.index += offset; -} - -/** - * We want to be careful in assignment setup to hit the actual storage - * instead of potentially using a temporary like we might with the - * ir_dereference handler. - * - * Thanks to ir_swizzle_swizzle, and ir_vec_index_to_swizzle, we - * should only see potentially one variable array index of a vector, - * and one swizzle, before getting to actual vec4 storage. So handle - * those, then go use ir_dereference to handle the rest. - */ -static struct ir_to_mesa_dst_reg -get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) -{ - struct ir_to_mesa_dst_reg dst_reg; - ir_dereference *deref; - ir_swizzle *swiz; - - /* Use the rvalue deref handler for the most part. We'll ignore - * swizzles in it and write swizzles using writemask, though. - */ - ir->accept(v); - dst_reg = ir_to_mesa_dst_reg_from_src(v->result); - - if ((deref = ir->as_dereference())) { - ir_dereference_array *deref_array = ir->as_dereference_array(); - assert(!deref_array || deref_array->array->type->is_array()); - - ir->accept(v); - } else if ((swiz = ir->as_swizzle())) { - dst_reg.writemask = 0; - if (swiz->mask.num_components >= 1) - dst_reg.writemask |= (1 << swiz->mask.x); - if (swiz->mask.num_components >= 2) - dst_reg.writemask |= (1 << swiz->mask.y); - if (swiz->mask.num_components >= 3) - dst_reg.writemask |= (1 << swiz->mask.z); - if (swiz->mask.num_components >= 4) - dst_reg.writemask |= (1 << swiz->mask.w); - } - - return dst_reg; -} - -void -ir_to_mesa_visitor::visit(ir_assignment *ir) -{ - struct ir_to_mesa_dst_reg l; - struct ir_to_mesa_src_reg r; - - assert(!ir->lhs->type->is_matrix()); - assert(!ir->lhs->type->is_array()); - assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); - - l = get_assignment_lhs(ir->lhs, this); - - ir->rhs->accept(this); - r = this->result; - assert(l.file != PROGRAM_UNDEFINED); - assert(r.file != PROGRAM_UNDEFINED); - - if (ir->condition) { - ir_constant *condition_constant; - - condition_constant = ir->condition->constant_expression_value(); - - assert(condition_constant && condition_constant->value.b[0]); - } - - ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); -} - - -void -ir_to_mesa_visitor::visit(ir_constant *ir) -{ - ir_to_mesa_src_reg src_reg; - - assert(ir->type->base_type == GLSL_TYPE_FLOAT || - ir->type->base_type == GLSL_TYPE_UINT || - ir->type->base_type == GLSL_TYPE_INT || - ir->type->base_type == GLSL_TYPE_BOOL); - - /* FINISHME: This will end up being _mesa_add_unnamed_constant, - * which handles sharing values and sharing channels of vec4 - * constants for small values. - */ - /* FINISHME: Do something with the constant values for now. - */ - src_reg.file = PROGRAM_CONSTANT; - src_reg.index = this->next_constant; - src_reg.swizzle = SWIZZLE_NOOP; - src_reg.reladdr = false; - src_reg.negate = 0; - - this->next_constant += type_size(ir->type); - - this->result = src_reg; -} - - -void -ir_to_mesa_visitor::visit(ir_call *ir) -{ - printf("Can't support call to %s\n", ir->callee_name()); - exit(1); -} - - -void -ir_to_mesa_visitor::visit(ir_texture *ir) -{ - assert(0); - - ir->coordinate->accept(this); -} - -void -ir_to_mesa_visitor::visit(ir_return *ir) -{ - assert(0); - - ir->get_value()->accept(this); -} - - -void -ir_to_mesa_visitor::visit(ir_if *ir) -{ - ir_to_mesa_instruction *if_inst, *else_inst = NULL; - - ir->condition->accept(this); - assert(this->result.file != PROGRAM_UNDEFINED); - - if_inst = ir_to_mesa_emit_op1(ir->condition, - OPCODE_IF, ir_to_mesa_undef_dst, - this->result); - - this->instructions.push_tail(if_inst); - - visit_exec_list(&ir->then_instructions, this); - - if (!ir->else_instructions.is_empty()) { - else_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ELSE, - ir_to_mesa_undef_dst, - ir_to_mesa_undef); - visit_exec_list(&ir->then_instructions, this); - } - - if_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ENDIF, - ir_to_mesa_undef_dst, ir_to_mesa_undef); -} - -ir_to_mesa_visitor::ir_to_mesa_visitor() -{ - result.file = PROGRAM_UNDEFINED; - next_temp = 1; - next_constant = 0; - next_uniform = 0; -} - -static struct prog_src_register -mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) -{ - struct prog_src_register mesa_reg; - - mesa_reg.File = reg.file; - assert(reg.index < (1 << INST_INDEX_BITS) - 1); - mesa_reg.Index = reg.index; - mesa_reg.Swizzle = reg.swizzle; - mesa_reg.RelAddr = reg.reladdr; - - return mesa_reg; -} - -static void -set_branchtargets(struct prog_instruction *mesa_instructions, - int num_instructions) -{ - int if_count = 0, loop_count; - int *if_stack, *loop_stack; - int if_stack_pos = 0, loop_stack_pos = 0; - int i, j; - - for (i = 0; i < num_instructions; i++) { - switch (mesa_instructions[i].Opcode) { - case OPCODE_IF: - if_count++; - break; - case OPCODE_BGNLOOP: - loop_count++; - break; - case OPCODE_BRK: - case OPCODE_CONT: - mesa_instructions[i].BranchTarget = -1; - break; - default: - break; - } - } - - if_stack = (int *)calloc(if_count, sizeof(*if_stack)); - loop_stack = (int *)calloc(loop_count, sizeof(*loop_stack)); - - for (i = 0; i < num_instructions; i++) { - switch (mesa_instructions[i].Opcode) { - case OPCODE_IF: - if_stack[if_stack_pos] = i; - if_stack_pos++; - break; - case OPCODE_ELSE: - mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; - if_stack[if_stack_pos - 1] = i; - break; - case OPCODE_ENDIF: - mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; - if_stack_pos--; - break; - case OPCODE_BGNLOOP: - loop_stack[loop_stack_pos] = i; - loop_stack_pos++; - break; - case OPCODE_ENDLOOP: - loop_stack_pos--; - /* Rewrite any breaks/conts at this nesting level (haven't - * already had a BranchTarget assigned) to point to the end - * of the loop. - */ - for (j = loop_stack[loop_stack_pos]; j < i; j++) { - if (mesa_instructions[j].Opcode == OPCODE_BRK || - mesa_instructions[j].Opcode == OPCODE_CONT) { - if (mesa_instructions[j].BranchTarget == -1) { - mesa_instructions[j].BranchTarget = i; - } - } - } - /* The loop ends point at each other. */ - mesa_instructions[i].BranchTarget = loop_stack[loop_stack_pos]; - mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i; - default: - break; - } - } - - free(if_stack); -} - -static void -print_program(struct prog_instruction *mesa_instructions, - ir_instruction **mesa_instruction_annotation, - int num_instructions) -{ - ir_instruction *last_ir = NULL; - int i; - - for (i = 0; i < num_instructions; i++) { - struct prog_instruction *mesa_inst = mesa_instructions + i; - ir_instruction *ir = mesa_instruction_annotation[i]; - - if (last_ir != ir && ir) { - ir_print_visitor print; - ir->accept(&print); - printf("\n"); - last_ir = ir; - } - - _mesa_print_instruction(mesa_inst); - } -} - -void -do_ir_to_mesa(exec_list *instructions) -{ - ir_to_mesa_visitor v; - struct prog_instruction *mesa_instructions, *mesa_inst; - ir_instruction **mesa_instruction_annotation; - int i; - - v.ctx = talloc_new(NULL); - visit_exec_list(instructions, &v); - - int num_instructions = 0; - foreach_iter(exec_list_iterator, iter, v.instructions) { - num_instructions++; - } - - mesa_instructions = - (struct prog_instruction *)calloc(num_instructions, - sizeof(*mesa_instructions)); - mesa_instruction_annotation = - (ir_instruction **)calloc(num_instructions, - sizeof(*mesa_instruction_annotation)); - - mesa_inst = mesa_instructions; - i = 0; - foreach_iter(exec_list_iterator, iter, v.instructions) { - ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); - - mesa_inst->Opcode = inst->op; - mesa_inst->DstReg.File = inst->dst_reg.file; - mesa_inst->DstReg.Index = inst->dst_reg.index; - mesa_inst->DstReg.CondMask = COND_TR; - mesa_inst->DstReg.WriteMask = inst->dst_reg.writemask; - mesa_inst->SrcReg[0] = mesa_src_reg_from_ir_src_reg(inst->src_reg[0]); - mesa_inst->SrcReg[1] = mesa_src_reg_from_ir_src_reg(inst->src_reg[1]); - mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); - mesa_instruction_annotation[i] = inst->ir; - - mesa_inst++; - i++; - } - - set_branchtargets(mesa_instructions, num_instructions); - print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); - - free(mesa_instruction_annotation); - talloc_free(v.ctx); -} diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp new file mode 100644 index 0000000000..26449c5a5c --- /dev/null +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -0,0 +1,1211 @@ +/* + * 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 ir_to_mesa.cpp + * + * Translates the IR to ARB_fragment_program text if possible, + * printing the result + */ + +#include +#include "ir.h" +#include "ir_visitor.h" +#include "ir_print_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +extern "C" { +#include "shader/prog_instruction.h" +#include "shader/prog_print.h" +} + +/** + * This struct is a corresponding struct to Mesa prog_src_register, with + * wider fields. + */ +typedef struct ir_to_mesa_src_reg { + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ + int negate; /**< NEGATE_XYZW mask from mesa */ + bool reladdr; /**< Register index should be offset by address reg. */ +} ir_to_mesa_src_reg; + +typedef struct ir_to_mesa_dst_reg { + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ +} ir_to_mesa_dst_reg; + +extern ir_to_mesa_src_reg ir_to_mesa_undef; + +class ir_to_mesa_instruction : public exec_node { +public: + enum prog_opcode op; + ir_to_mesa_dst_reg dst_reg; + ir_to_mesa_src_reg src_reg[3]; + /** Pointer to the ir source this tree came from for debugging */ + ir_instruction *ir; +}; + +class temp_entry : public exec_node { +public: + temp_entry(ir_variable *var, int file, int index) + : file(file), index(index), var(var) + { + /* empty */ + } + + int file; + int index; + ir_variable *var; /* variable that maps to this, if any */ +}; + +class ir_to_mesa_visitor : public ir_visitor { +public: + ir_to_mesa_visitor(); + + int next_temp; + int next_constant; + int next_uniform; + + temp_entry *find_variable_storage(ir_variable *var); + + ir_to_mesa_src_reg get_temp(const glsl_type *type); + + struct ir_to_mesa_src_reg src_reg_for_float(float val); + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_texture *); + virtual void visit(ir_if *); + /*@}*/ + + struct ir_to_mesa_src_reg result; + + /** List of temp_entry */ + exec_list variable_storage; + + /** List of ir_to_mesa_instruction */ + exec_list instructions; + + ir_to_mesa_instruction *ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + ir_to_mesa_instruction *ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1); + + ir_to_mesa_instruction *ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2); + + void ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + /* talloc context (the ) */ + void *ctx; +}; + +ir_to_mesa_src_reg ir_to_mesa_undef = { + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, NEGATE_NONE, false, +}; + +ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP +}; + +ir_to_mesa_dst_reg ir_to_mesa_address_reg = { + PROGRAM_ADDRESS, 0, WRITEMASK_X +}; + +static int swizzle_for_size(int size) +{ + int size_swizzles[4] = { + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W), + }; + + return size_swizzles[size - 1]; +} + +/* This list should match up with builtin_variables.h */ +static const struct { + const char *name; + int file; + int index; +} builtin_var_to_mesa_reg[] = { + /* core_vs */ + {"gl_Position", PROGRAM_OUTPUT, VERT_RESULT_HPOS}, + {"gl_PointSize", PROGRAM_OUTPUT, VERT_RESULT_PSIZ}, + + /* core_fs */ + {"gl_FragCoord", PROGRAM_INPUT, FRAG_ATTRIB_WPOS}, + {"gl_FrontFacing", PROGRAM_INPUT, FRAG_ATTRIB_FACE}, + {"gl_FragColor", PROGRAM_OUTPUT, FRAG_ATTRIB_COL0}, + {"gl_FragDepth", PROGRAM_UNDEFINED, FRAG_ATTRIB_WPOS}, /* FINISHME: WPOS.z */ + + /* 110_deprecated_fs */ + {"gl_Color", PROGRAM_INPUT, FRAG_ATTRIB_COL0}, + {"gl_SecondaryColor", PROGRAM_INPUT, FRAG_ATTRIB_COL1}, + {"gl_FogFragCoord", PROGRAM_INPUT, FRAG_ATTRIB_FOGC}, + {"gl_TexCoord", PROGRAM_INPUT, FRAG_ATTRIB_TEX0}, /* array */ + + /* 110_deprecated_vs */ + {"gl_Vertex", PROGRAM_INPUT, VERT_ATTRIB_POS}, + {"gl_Normal", PROGRAM_INPUT, VERT_ATTRIB_NORMAL}, + {"gl_Color", PROGRAM_INPUT, VERT_ATTRIB_COLOR0}, + {"gl_SecondaryColor", PROGRAM_INPUT, VERT_ATTRIB_COLOR1}, + {"gl_MultiTexCoord0", PROGRAM_INPUT, VERT_ATTRIB_TEX0}, + {"gl_MultiTexCoord1", PROGRAM_INPUT, VERT_ATTRIB_TEX1}, + {"gl_MultiTexCoord2", PROGRAM_INPUT, VERT_ATTRIB_TEX2}, + {"gl_MultiTexCoord3", PROGRAM_INPUT, VERT_ATTRIB_TEX3}, + {"gl_MultiTexCoord4", PROGRAM_INPUT, VERT_ATTRIB_TEX4}, + {"gl_MultiTexCoord5", PROGRAM_INPUT, VERT_ATTRIB_TEX5}, + {"gl_MultiTexCoord6", PROGRAM_INPUT, VERT_ATTRIB_TEX6}, + {"gl_MultiTexCoord7", PROGRAM_INPUT, VERT_ATTRIB_TEX7}, + {"gl_TexCoord", PROGRAM_OUTPUT, VERT_RESULT_TEX0}, /* array */ + {"gl_FogCoord", PROGRAM_INPUT, VERT_RESULT_FOGC}, + /*{"gl_ClipVertex", PROGRAM_OUTPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ + {"gl_FrontColor", PROGRAM_OUTPUT, VERT_RESULT_COL0}, + {"gl_BackColor", PROGRAM_OUTPUT, VERT_RESULT_BFC0}, + {"gl_FrontSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_COL1}, + {"gl_BackSecondaryColor", PROGRAM_OUTPUT, VERT_RESULT_BFC1}, + {"gl_FogFragCoord", PROGRAM_OUTPUT, VERT_RESULT_FOGC}, + + /* 130_vs */ + /*{"gl_VertexID", PROGRAM_INPUT, VERT_ATTRIB_FOGC},*/ /* FINISHME */ + + {"gl_FragData", PROGRAM_OUTPUT, FRAG_RESULT_DATA0}, /* array */ +}; + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2) +{ + ir_to_mesa_instruction *inst = new(ctx) ir_to_mesa_instruction(); + + inst->op = op; + inst->dst_reg = dst; + inst->src_reg[0] = src0; + inst->src_reg[1] = src1; + inst->src_reg[2] = src2; + inst->ir = ir; + + this->instructions.push_tail(inst); + + return inst; +} + + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1) +{ + return ir_to_mesa_emit_op3(ir, op, dst, src0, src1, ir_to_mesa_undef); +} + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + return ir_to_mesa_emit_op3(ir, op, dst, + src0, ir_to_mesa_undef, ir_to_mesa_undef); +} + +inline ir_to_mesa_dst_reg +ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) +{ + ir_to_mesa_dst_reg dst_reg; + + dst_reg.file = reg.file; + dst_reg.index = reg.index; + dst_reg.writemask = WRITEMASK_XYZW; + + return dst_reg; +} + +/** + * Emits Mesa scalar opcodes to produce unique answers across channels. + * + * Some Mesa opcodes are scalar-only, like ARB_fp/vp. The src X + * channel determines the result across all channels. So to do a vec4 + * of this operation, we want to emit a scalar per source channel used + * to produce dest channels. + */ +void +ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + int i, j; + int done_mask = ~dst.writemask; + + /* Mesa RCP is a scalar operation splatting results to all channels, + * like ARB_fp/vp. So emit as many RCPs as necessary to cover our + * dst channels. + */ + for (i = 0; i < 4; i++) { + int this_mask = (1 << i); + ir_to_mesa_instruction *inst; + ir_to_mesa_src_reg src = src0; + + if (done_mask & this_mask) + continue; + + int src_swiz = GET_SWZ(src.swizzle, i); + for (j = i + 1; j < 4; j++) { + if (!(done_mask & (1 << j)) && GET_SWZ(src.swizzle, j) == src_swiz) { + this_mask |= (1 << j); + } + } + src.swizzle = MAKE_SWIZZLE4(src_swiz, src_swiz, + src_swiz, src_swiz); + + inst = ir_to_mesa_emit_op1(ir, op, + dst, + src); + inst->dst_reg.writemask = this_mask; + done_mask |= this_mask; + } +} + +struct ir_to_mesa_src_reg +ir_to_mesa_visitor::src_reg_for_float(float val) +{ + ir_to_mesa_src_reg src_reg; + + /* FINISHME: This will end up being _mesa_add_unnamed_constant, + * which handles sharing values and sharing channels of vec4 + * constants for small values. + */ + /* FINISHME: Do something with the constant values for now. + */ + (void)val; + src_reg.file = PROGRAM_CONSTANT; + src_reg.index = this->next_constant++; + src_reg.swizzle = SWIZZLE_NOOP; + + return src_reg; +} + +/** + * In the initial pass of codegen, we assign temporary numbers to + * intermediate results. (not SSA -- variable assignments will reuse + * storage). Actual register allocation for the Mesa VM occurs in a + * pass over the Mesa IR later. + */ +ir_to_mesa_src_reg +ir_to_mesa_visitor::get_temp(const glsl_type *type) +{ + ir_to_mesa_src_reg src_reg; + int swizzle[4]; + int i; + + assert(!type->is_array()); + + src_reg.file = PROGRAM_TEMPORARY; + src_reg.index = type->matrix_columns; + src_reg.reladdr = false; + + for (i = 0; i < type->vector_elements; i++) + swizzle[i] = i; + for (; i < 4; i++) + swizzle[i] = type->vector_elements - 1; + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], + swizzle[2], swizzle[3]); + + return src_reg; +} + +static int +type_size(const struct glsl_type *type) +{ + unsigned int i; + int size; + + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + if (type->is_matrix()) { + return 4; /* FINISHME: Not all matrices are 4x4. */ + } else { + /* Regardless of size of vector, it gets a vec4. This is bad + * packing for things like floats, but otherwise arrays become a + * mess. Hopefully a later pass over the code can pack scalars + * down if appropriate. + */ + return 1; + } + case GLSL_TYPE_ARRAY: + return type_size(type->fields.array) * type->length; + case GLSL_TYPE_STRUCT: + size = 0; + for (i = 0; i < type->length; i++) { + size += type_size(type->fields.structure[i].type); + } + return size; + default: + assert(0); + } +} + +temp_entry * +ir_to_mesa_visitor::find_variable_storage(ir_variable *var) +{ + + temp_entry *entry; + + foreach_iter(exec_list_iterator, iter, this->variable_storage) { + entry = (temp_entry *)iter.get(); + + if (entry->var == var) + return entry; + } + + return NULL; +} + +void +ir_to_mesa_visitor::visit(ir_variable *ir) +{ + (void)ir; +} + +void +ir_to_mesa_visitor::visit(ir_loop *ir) +{ + assert(!ir->from); + assert(!ir->to); + assert(!ir->increment); + assert(!ir->counter); + + ir_to_mesa_emit_op1(NULL, OPCODE_BGNLOOP, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + + visit_exec_list(&ir->body_instructions, this); + + ir_to_mesa_emit_op1(NULL, OPCODE_ENDLOOP, + ir_to_mesa_undef_dst, ir_to_mesa_undef); +} + +void +ir_to_mesa_visitor::visit(ir_loop_jump *ir) +{ + switch (ir->mode) { + case ir_loop_jump::jump_break: + ir_to_mesa_emit_op1(NULL, OPCODE_BRK, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + break; + case ir_loop_jump::jump_continue: + ir_to_mesa_emit_op1(NULL, OPCODE_CONT, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + break; + } +} + + +void +ir_to_mesa_visitor::visit(ir_function_signature *ir) +{ + assert(0); + (void)ir; +} + +void +ir_to_mesa_visitor::visit(ir_function *ir) +{ + /* Ignore function bodies other than main() -- we shouldn't see calls to + * them since they should all be inlined before we get to ir_to_mesa. + */ + if (strcmp(ir->name, "main") == 0) { + const ir_function_signature *sig; + exec_list empty; + + sig = ir->matching_signature(&empty); + + assert(sig); + + foreach_iter(exec_list_iterator, iter, sig->body) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + ir->accept(this); + } + } +} + +void +ir_to_mesa_visitor::visit(ir_expression *ir) +{ + unsigned int operand; + struct ir_to_mesa_src_reg op[2]; + struct ir_to_mesa_src_reg result_src; + struct ir_to_mesa_dst_reg result_dst; + const glsl_type *vec4_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 4, 1); + const glsl_type *vec3_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 3, 1); + const glsl_type *vec2_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 2, 1); + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + this->result.file = PROGRAM_UNDEFINED; + ir->operands[operand]->accept(this); + if (this->result.file == PROGRAM_UNDEFINED) { + ir_print_visitor v; + printf("Failed to get tree for expression operand:\n"); + ir->operands[operand]->accept(&v); + exit(1); + } + op[operand] = this->result; + + /* Only expression implemented for matrices yet */ + assert(!ir->operands[operand]->type->is_matrix() || + ir->operation == ir_binop_mul); + } + + this->result.file = PROGRAM_UNDEFINED; + + /* Storage for our result. Ideally for an assignment we'd be using + * the actual storage for the result here, instead. + */ + result_src = get_temp(ir->type); + /* convenience for the emit functions below. */ + result_dst = ir_to_mesa_dst_reg_from_src(result_src); + /* Limit writes to the channels that will be used by result_src later. + * This does limit this temp's use as a temporary for multi-instruction + * sequences. + */ + result_dst.writemask = (1 << ir->type->vector_elements) - 1; + + switch (ir->operation) { + case ir_unop_logic_not: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, + op[0], src_reg_for_float(0.0)); + break; + case ir_unop_neg: + op[0].negate = ~op[0].negate; + result_src = op[0]; + break; + case ir_unop_exp: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_EXP, result_dst, op[0]); + break; + case ir_unop_exp2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_EX2, result_dst, op[0]); + break; + case ir_unop_log: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_LOG, result_dst, op[0]); + break; + case ir_unop_log2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_LG2, result_dst, op[0]); + break; + case ir_unop_sin: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_SIN, result_dst, op[0]); + break; + case ir_unop_cos: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_COS, result_dst, op[0]); + break; + case ir_binop_add: + ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); + break; + case ir_binop_sub: + ir_to_mesa_emit_op2(ir, OPCODE_SUB, result_dst, op[0], op[1]); + break; + case ir_binop_mul: + if (ir->operands[0]->type->is_matrix() && + !ir->operands[1]->type->is_matrix()) { + if (ir->operands[0]->type->is_scalar()) { + ir_to_mesa_dst_reg dst_column = result_dst; + ir_to_mesa_src_reg src_column = op[0]; + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_column, src_column, op[1]); + dst_column.index++; + src_column.index++; + } + } else { + ir_to_mesa_dst_reg dst_chan = result_dst; + ir_to_mesa_src_reg src_column = op[0]; + ir_to_mesa_src_reg src_chan = op[1]; + for (int i = 0; i < ir->operands[0]->type->matrix_columns; i++) { + dst_chan.writemask = (1 << i); + src_chan.swizzle = MAKE_SWIZZLE4(i, i, i, i); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + dst_chan, src_column, src_chan); + src_column.index++; + } + } + } else { + assert(!ir->operands[0]->type->is_matrix()); + assert(!ir->operands[1]->type->is_matrix()); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], op[1]); + } + break; + case ir_binop_div: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[1]); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], result_src); + break; + + case ir_binop_less: + ir_to_mesa_emit_op2(ir, OPCODE_SLT, result_dst, op[0], op[1]); + break; + case ir_binop_greater: + ir_to_mesa_emit_op2(ir, OPCODE_SGT, result_dst, op[0], op[1]); + break; + case ir_binop_lequal: + ir_to_mesa_emit_op2(ir, OPCODE_SLE, result_dst, op[0], op[1]); + break; + case ir_binop_gequal: + ir_to_mesa_emit_op2(ir, OPCODE_SGE, result_dst, op[0], op[1]); + break; + case ir_binop_equal: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); + break; + case ir_binop_logic_xor: + case ir_binop_nequal: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + break; + + case ir_binop_logic_or: + /* This could be a saturated add and skip the SNE. */ + ir_to_mesa_emit_op2(ir, OPCODE_ADD, + result_dst, + op[0], op[1]); + + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, + result_src, src_reg_for_float(0.0)); + break; + + case ir_binop_logic_and: + /* the bool args are stored as float 0.0 or 1.0, so "mul" gives us "and". */ + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + result_dst, + op[0], op[1]); + break; + + case ir_binop_dot: + if (ir->operands[0]->type == vec4_type) { + assert(ir->operands[1]->type == vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP4, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec3_type) { + assert(ir->operands[1]->type == vec3_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP3, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec2_type) { + assert(ir->operands[1]->type == vec2_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP2, + result_dst, + op[0], op[1]); + } + break; + case ir_unop_sqrt: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + ir_to_mesa_emit_op1(ir, OPCODE_RCP, result_dst, result_src); + break; + case ir_unop_rsq: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + break; + case ir_unop_i2f: + /* Mesa IR lacks types, ints are stored as truncated floats. */ + result_src = op[0]; + break; + case ir_unop_f2i: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_f2b: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, + result_src, src_reg_for_float(0.0)); + break; + case ir_unop_trunc: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_ceil: + op[0].negate = ~op[0].negate; + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + result_src.negate = ~result_src.negate; + break; + case ir_unop_floor: + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + break; + case ir_binop_min: + ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]); + break; + case ir_binop_max: + ir_to_mesa_emit_op2(ir, OPCODE_MAX, result_dst, op[0], op[1]); + break; + default: + ir_print_visitor v; + printf("Failed to get tree for expression:\n"); + ir->accept(&v); + exit(1); + break; + } + + this->result = result_src; +} + + +void +ir_to_mesa_visitor::visit(ir_swizzle *ir) +{ + ir_to_mesa_src_reg src_reg; + int i; + int swizzle[4]; + + /* Note that this is only swizzles in expressions, not those on the left + * hand side of an assignment, which do write masking. See ir_assignment + * for that. + */ + + ir->val->accept(this); + src_reg = this->result; + assert(src_reg.file != PROGRAM_UNDEFINED); + + for (i = 0; i < 4; i++) { + if (i < ir->type->vector_elements) { + switch (i) { + case 0: + swizzle[i] = ir->mask.x; + break; + case 1: + swizzle[i] = ir->mask.y; + break; + case 2: + swizzle[i] = ir->mask.z; + break; + case 3: + swizzle[i] = ir->mask.w; + break; + } + } else { + /* If the type is smaller than a vec4, replicate the last + * channel out. + */ + swizzle[i] = ir->type->vector_elements - 1; + } + } + + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], + swizzle[1], + swizzle[2], + swizzle[3]); + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_variable *ir) +{ + ir_to_mesa_src_reg src_reg; + temp_entry *entry = find_variable_storage(ir->var); + unsigned int i; + bool var_in; + + if (!entry) { + switch (ir->var->mode) { + case ir_var_uniform: + entry = new(ctx) temp_entry(ir->var, PROGRAM_UNIFORM, + this->next_uniform); + this->variable_storage.push_tail(entry); + + this->next_uniform += type_size(ir->var->type); + break; + case ir_var_in: + case ir_var_out: + case ir_var_inout: + var_in = (ir->var->mode == ir_var_in || + ir->var->mode == ir_var_inout); + + for (i = 0; i < ARRAY_SIZE(builtin_var_to_mesa_reg); i++) { + bool in = builtin_var_to_mesa_reg[i].file == PROGRAM_INPUT; + + if (strcmp(ir->var->name, builtin_var_to_mesa_reg[i].name) == 0 && + !(var_in ^ in)) + break; + } + if (i == ARRAY_SIZE(builtin_var_to_mesa_reg)) { + printf("Failed to find builtin for %s variable %s\n", + var_in ? "in" : "out", + ir->var->name); + abort(); + } + entry = new(ctx) temp_entry(ir->var, + builtin_var_to_mesa_reg[i].file, + builtin_var_to_mesa_reg[i].index); + break; + case ir_var_auto: + entry = new(ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, + this->next_temp); + this->variable_storage.push_tail(entry); + + next_temp += type_size(ir->var->type); + break; + } + + if (!entry) { + printf("Failed to make storage for %s\n", ir->var->name); + exit(1); + } + } + + src_reg.file = entry->file; + src_reg.index = entry->index; + /* If the type is smaller than a vec4, replicate the last channel out. */ + src_reg.swizzle = swizzle_for_size(ir->var->type->vector_elements); + src_reg.reladdr = false; + src_reg.negate = 0; + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_array *ir) +{ + ir_constant *index; + ir_to_mesa_src_reg src_reg; + + index = ir->array_index->constant_expression_value(); + + /* By the time we make it to this stage, matrices should be broken down + * to vectors. + */ + assert(!ir->type->is_matrix()); + + ir->array->accept(this); + src_reg = this->result; + + if (src_reg.file == PROGRAM_INPUT || + src_reg.file == PROGRAM_OUTPUT) { + assert(index); /* FINISHME: Handle variable indexing of builtins. */ + + src_reg.index += index->value.i[0]; + } else { + if (index) { + src_reg.index += index->value.i[0]; + } else { + ir_to_mesa_src_reg array_base = this->result; + /* Variable index array dereference. It eats the "vec4" of the + * base of the array and an index that offsets the Mesa register + * index. + */ + ir->array_index->accept(this); + + /* FINISHME: This doesn't work when we're trying to do the LHS + * of an assignment. + */ + src_reg.reladdr = true; + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, + this->result); + + this->result = get_temp(ir->type); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(this->result), + src_reg); + } + } + + /* If the type is smaller than a vec4, replicate the last channel out. */ + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_record *ir) +{ + unsigned int i; + const glsl_type *struct_type = ir->record->type; + int offset = 0; + + ir->record->accept(this); + + for (i = 0; i < struct_type->length; i++) { + if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) + break; + offset += type_size(struct_type->fields.structure[i].type); + } + this->result.index += offset; +} + +/** + * We want to be careful in assignment setup to hit the actual storage + * instead of potentially using a temporary like we might with the + * ir_dereference handler. + * + * Thanks to ir_swizzle_swizzle, and ir_vec_index_to_swizzle, we + * should only see potentially one variable array index of a vector, + * and one swizzle, before getting to actual vec4 storage. So handle + * those, then go use ir_dereference to handle the rest. + */ +static struct ir_to_mesa_dst_reg +get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v) +{ + struct ir_to_mesa_dst_reg dst_reg; + ir_dereference *deref; + ir_swizzle *swiz; + + /* Use the rvalue deref handler for the most part. We'll ignore + * swizzles in it and write swizzles using writemask, though. + */ + ir->accept(v); + dst_reg = ir_to_mesa_dst_reg_from_src(v->result); + + if ((deref = ir->as_dereference())) { + ir_dereference_array *deref_array = ir->as_dereference_array(); + assert(!deref_array || deref_array->array->type->is_array()); + + ir->accept(v); + } else if ((swiz = ir->as_swizzle())) { + dst_reg.writemask = 0; + if (swiz->mask.num_components >= 1) + dst_reg.writemask |= (1 << swiz->mask.x); + if (swiz->mask.num_components >= 2) + dst_reg.writemask |= (1 << swiz->mask.y); + if (swiz->mask.num_components >= 3) + dst_reg.writemask |= (1 << swiz->mask.z); + if (swiz->mask.num_components >= 4) + dst_reg.writemask |= (1 << swiz->mask.w); + } + + return dst_reg; +} + +void +ir_to_mesa_visitor::visit(ir_assignment *ir) +{ + struct ir_to_mesa_dst_reg l; + struct ir_to_mesa_src_reg r; + + assert(!ir->lhs->type->is_matrix()); + assert(!ir->lhs->type->is_array()); + assert(ir->lhs->type->base_type != GLSL_TYPE_STRUCT); + + l = get_assignment_lhs(ir->lhs, this); + + ir->rhs->accept(this); + r = this->result; + assert(l.file != PROGRAM_UNDEFINED); + assert(r.file != PROGRAM_UNDEFINED); + + if (ir->condition) { + ir_constant *condition_constant; + + condition_constant = ir->condition->constant_expression_value(); + + assert(condition_constant && condition_constant->value.b[0]); + } + + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); +} + + +void +ir_to_mesa_visitor::visit(ir_constant *ir) +{ + ir_to_mesa_src_reg src_reg; + + assert(ir->type->base_type == GLSL_TYPE_FLOAT || + ir->type->base_type == GLSL_TYPE_UINT || + ir->type->base_type == GLSL_TYPE_INT || + ir->type->base_type == GLSL_TYPE_BOOL); + + /* FINISHME: This will end up being _mesa_add_unnamed_constant, + * which handles sharing values and sharing channels of vec4 + * constants for small values. + */ + /* FINISHME: Do something with the constant values for now. + */ + src_reg.file = PROGRAM_CONSTANT; + src_reg.index = this->next_constant; + src_reg.swizzle = SWIZZLE_NOOP; + src_reg.reladdr = false; + src_reg.negate = 0; + + this->next_constant += type_size(ir->type); + + this->result = src_reg; +} + + +void +ir_to_mesa_visitor::visit(ir_call *ir) +{ + printf("Can't support call to %s\n", ir->callee_name()); + exit(1); +} + + +void +ir_to_mesa_visitor::visit(ir_texture *ir) +{ + assert(0); + + ir->coordinate->accept(this); +} + +void +ir_to_mesa_visitor::visit(ir_return *ir) +{ + assert(0); + + ir->get_value()->accept(this); +} + + +void +ir_to_mesa_visitor::visit(ir_if *ir) +{ + ir_to_mesa_instruction *if_inst, *else_inst = NULL; + + ir->condition->accept(this); + assert(this->result.file != PROGRAM_UNDEFINED); + + if_inst = ir_to_mesa_emit_op1(ir->condition, + OPCODE_IF, ir_to_mesa_undef_dst, + this->result); + + this->instructions.push_tail(if_inst); + + visit_exec_list(&ir->then_instructions, this); + + if (!ir->else_instructions.is_empty()) { + else_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ELSE, + ir_to_mesa_undef_dst, + ir_to_mesa_undef); + visit_exec_list(&ir->then_instructions, this); + } + + if_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ENDIF, + ir_to_mesa_undef_dst, ir_to_mesa_undef); +} + +ir_to_mesa_visitor::ir_to_mesa_visitor() +{ + result.file = PROGRAM_UNDEFINED; + next_temp = 1; + next_constant = 0; + next_uniform = 0; +} + +static struct prog_src_register +mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) +{ + struct prog_src_register mesa_reg; + + mesa_reg.File = reg.file; + assert(reg.index < (1 << INST_INDEX_BITS) - 1); + mesa_reg.Index = reg.index; + mesa_reg.Swizzle = reg.swizzle; + mesa_reg.RelAddr = reg.reladdr; + + return mesa_reg; +} + +static void +set_branchtargets(struct prog_instruction *mesa_instructions, + int num_instructions) +{ + int if_count = 0, loop_count; + int *if_stack, *loop_stack; + int if_stack_pos = 0, loop_stack_pos = 0; + int i, j; + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_count++; + break; + case OPCODE_BGNLOOP: + loop_count++; + break; + case OPCODE_BRK: + case OPCODE_CONT: + mesa_instructions[i].BranchTarget = -1; + break; + default: + break; + } + } + + if_stack = (int *)calloc(if_count, sizeof(*if_stack)); + loop_stack = (int *)calloc(loop_count, sizeof(*loop_stack)); + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_stack[if_stack_pos] = i; + if_stack_pos++; + break; + case OPCODE_ELSE: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack[if_stack_pos - 1] = i; + break; + case OPCODE_ENDIF: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack_pos--; + break; + case OPCODE_BGNLOOP: + loop_stack[loop_stack_pos] = i; + loop_stack_pos++; + break; + case OPCODE_ENDLOOP: + loop_stack_pos--; + /* Rewrite any breaks/conts at this nesting level (haven't + * already had a BranchTarget assigned) to point to the end + * of the loop. + */ + for (j = loop_stack[loop_stack_pos]; j < i; j++) { + if (mesa_instructions[j].Opcode == OPCODE_BRK || + mesa_instructions[j].Opcode == OPCODE_CONT) { + if (mesa_instructions[j].BranchTarget == -1) { + mesa_instructions[j].BranchTarget = i; + } + } + } + /* The loop ends point at each other. */ + mesa_instructions[i].BranchTarget = loop_stack[loop_stack_pos]; + mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i; + default: + break; + } + } + + free(if_stack); +} + +static void +print_program(struct prog_instruction *mesa_instructions, + ir_instruction **mesa_instruction_annotation, + int num_instructions) +{ + ir_instruction *last_ir = NULL; + int i; + + for (i = 0; i < num_instructions; i++) { + struct prog_instruction *mesa_inst = mesa_instructions + i; + ir_instruction *ir = mesa_instruction_annotation[i]; + + if (last_ir != ir && ir) { + ir_print_visitor print; + ir->accept(&print); + printf("\n"); + last_ir = ir; + } + + _mesa_print_instruction(mesa_inst); + } +} + +void +do_ir_to_mesa(exec_list *instructions) +{ + ir_to_mesa_visitor v; + struct prog_instruction *mesa_instructions, *mesa_inst; + ir_instruction **mesa_instruction_annotation; + int i; + + v.ctx = talloc_new(NULL); + visit_exec_list(instructions, &v); + + int num_instructions = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + num_instructions++; + } + + mesa_instructions = + (struct prog_instruction *)calloc(num_instructions, + sizeof(*mesa_instructions)); + mesa_instruction_annotation = + (ir_instruction **)calloc(num_instructions, + sizeof(*mesa_instruction_annotation)); + + mesa_inst = mesa_instructions; + i = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + + mesa_inst->Opcode = inst->op; + mesa_inst->DstReg.File = inst->dst_reg.file; + mesa_inst->DstReg.Index = inst->dst_reg.index; + mesa_inst->DstReg.CondMask = COND_TR; + mesa_inst->DstReg.WriteMask = inst->dst_reg.writemask; + mesa_inst->SrcReg[0] = mesa_src_reg_from_ir_src_reg(inst->src_reg[0]); + mesa_inst->SrcReg[1] = mesa_src_reg_from_ir_src_reg(inst->src_reg[1]); + mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); + mesa_instruction_annotation[i] = inst->ir; + + mesa_inst++; + i++; + } + + set_branchtargets(mesa_instructions, num_instructions); + print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); + + free(mesa_instruction_annotation); + talloc_free(v.ctx); +} -- cgit v1.2.3 From e82ddb781ad100702322eb465e82b1cec433f099 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 15:52:07 -0700 Subject: glsl2: Stop .gitignoring the old standalone build system. --- src/glsl/.gitignore | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore index 376aaeda13..e90b98accb 100644 --- a/src/glsl/.gitignore +++ b/src/glsl/.gitignore @@ -1,25 +1 @@ -.deps -COPYING -INSTALL -Makefile.in -aclocal.m4 -autom4te.cache -config.* -configure -depcomp -ylwrap -install-sh -missing -stamp-h1 -libtool -ltmain.sh -Makefile -*.o -*~ -glsl_lexer.cpp -glsl_parser.output -glsl_parser.cpp -glsl_parser.h glsl -mesa_codegen.cpp -mesa_codegen.h -- cgit v1.2.3 From f4869f33269c54779f8199b68e769024100421a3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 16:34:43 -0700 Subject: glsl2: Remove files that had been imported for standalone. --- src/glsl/hash_table.c | 159 ----- src/glsl/hash_table.h | 125 ---- src/glsl/main/imports.h | 6 - src/glsl/main/mtypes.h | 270 -------- src/glsl/main/simple_list.h | 235 ------- src/glsl/mesa/shader/prog_instruction.c | 363 ----------- src/glsl/mesa/shader/prog_instruction.h | 437 ------------- src/glsl/mesa/shader/prog_print.c | 1089 ------------------------------- src/glsl/mesa/shader/prog_print.h | 98 --- src/glsl/symbol_table.c | 413 ------------ src/glsl/symbol_table.h | 66 -- 11 files changed, 3261 deletions(-) delete mode 100644 src/glsl/hash_table.c delete mode 100644 src/glsl/hash_table.h delete mode 100644 src/glsl/main/imports.h delete mode 100644 src/glsl/main/mtypes.h delete mode 100644 src/glsl/main/simple_list.h delete mode 100644 src/glsl/mesa/shader/prog_instruction.c delete mode 100644 src/glsl/mesa/shader/prog_instruction.h delete mode 100644 src/glsl/mesa/shader/prog_print.c delete mode 100644 src/glsl/mesa/shader/prog_print.h delete mode 100644 src/glsl/symbol_table.c delete mode 100644 src/glsl/symbol_table.h (limited to 'src/glsl') diff --git a/src/glsl/hash_table.c b/src/glsl/hash_table.c deleted file mode 100644 index e89a2564d7..0000000000 --- a/src/glsl/hash_table.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright © 2008 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 hash_table.c - * \brief Implementation of a generic, opaque hash table data type. - * - * \author Ian Romanick - */ - -#include "main/imports.h" -#include "main/simple_list.h" -#include "hash_table.h" - -struct node { - struct node *next; - struct node *prev; -}; - -struct hash_table { - hash_func_t hash; - hash_compare_func_t compare; - - unsigned num_buckets; - struct node buckets[1]; -}; - - -struct hash_node { - struct node link; - const void *key; - void *data; -}; - - -struct hash_table * -hash_table_ctor(unsigned num_buckets, hash_func_t hash, - hash_compare_func_t compare) -{ - struct hash_table *ht; - unsigned i; - - - if (num_buckets < 16) { - num_buckets = 16; - } - - ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) - * sizeof(ht->buckets[0]))); - if (ht != NULL) { - ht->hash = hash; - ht->compare = compare; - ht->num_buckets = num_buckets; - - for (i = 0; i < num_buckets; i++) { - make_empty_list(& ht->buckets[i]); - } - } - - return ht; -} - - -void -hash_table_dtor(struct hash_table *ht) -{ - hash_table_clear(ht); - _mesa_free(ht); -} - - -void -hash_table_clear(struct hash_table *ht) -{ - struct node *node; - struct node *temp; - unsigned i; - - - for (i = 0; i < ht->num_buckets; i++) { - foreach_s(node, temp, & ht->buckets[i]) { - remove_from_list(node); - _mesa_free(node); - } - - assert(is_empty_list(& ht->buckets[i])); - } -} - - -void * -hash_table_find(struct hash_table *ht, const void *key) -{ - const unsigned hash_value = (*ht->hash)(key); - const unsigned bucket = hash_value % ht->num_buckets; - struct node *node; - - foreach(node, & ht->buckets[bucket]) { - struct hash_node *hn = (struct hash_node *) node; - - if ((*ht->compare)(hn->key, key) == 0) { - return hn->data; - } - } - - return NULL; -} - - -void -hash_table_insert(struct hash_table *ht, void *data, const void *key) -{ - const unsigned hash_value = (*ht->hash)(key); - const unsigned bucket = hash_value % ht->num_buckets; - struct hash_node *node; - - node = _mesa_calloc(sizeof(*node)); - - node->data = data; - node->key = key; - - insert_at_head(& ht->buckets[bucket], & node->link); -} - - -unsigned -hash_table_string_hash(const void *key) -{ - const char *str = (const char *) key; - unsigned hash = 5381; - - - while (*str != '\0') { - hash = (hash * 33) + *str; - str++; - } - - return hash; -} diff --git a/src/glsl/hash_table.h b/src/glsl/hash_table.h deleted file mode 100644 index b9dd343dee..0000000000 --- a/src/glsl/hash_table.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright © 2008 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 hash_table.h - * \brief Implementation of a generic, opaque hash table data type. - * - * \author Ian Romanick - */ - -#ifndef HASH_TABLE_H -#define HASH_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -struct hash_table; - -typedef unsigned (*hash_func_t)(const void *key); -typedef int (*hash_compare_func_t)(const void *key1, const void *key2); - -/** - * Hash table constructor - * - * Creates a hash table with the specified number of buckets. The supplied - * \c hash and \c compare routines are used when adding elements to the table - * and when searching for elements in the table. - * - * \param num_buckets Number of buckets (bins) in the hash table. - * \param hash Function used to compute hash value of input keys. - * \param compare Function used to compare keys. - */ -extern struct hash_table *hash_table_ctor(unsigned num_buckets, - hash_func_t hash, hash_compare_func_t compare); - - -/** - * Release all memory associated with a hash table - * - * \warning - * This function cannot release memory occupied either by keys or data. - */ -extern void hash_table_dtor(struct hash_table *ht); - - -/** - * Flush all entries from a hash table - * - * \param ht Table to be cleared of its entries. - */ -extern void hash_table_clear(struct hash_table *ht); - - -/** - * Search a hash table for a specific element - * - * \param ht Table to be searched - * \param key Key of the desired element - * - * \return - * The \c data value supplied to \c hash_table_insert when the element with - * the matching key was added. If no matching key exists in the table, - * \c NULL is returned. - */ -extern void *hash_table_find(struct hash_table *ht, const void *key); - - -/** - * Add an element to a hash table - */ -extern void hash_table_insert(struct hash_table *ht, void *data, - const void *key); - - -/** - * Compute hash value of a string - * - * Computes the hash value of a string using the DJB2 algorithm developed by - * Professor Daniel J. Bernstein. It was published on comp.lang.c once upon - * a time. I was unable to find the original posting in the archives. - * - * \param key Pointer to a NUL terminated string to be hashed. - * - * \sa hash_table_string_compare - */ -extern unsigned hash_table_string_hash(const void *key); - - -/** - * Compare two strings used as keys - * - * This is just a macro wrapper around \c strcmp. - * - * \sa hash_table_string_hash - */ -#define hash_table_string_compare ((hash_compare_func_t) strcmp) - -#ifdef __cplusplus -}; -#endif - -#endif /* HASH_TABLE_H */ diff --git a/src/glsl/main/imports.h b/src/glsl/main/imports.h deleted file mode 100644 index d2197342c0..0000000000 --- a/src/glsl/main/imports.h +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -#define _mesa_malloc(x) malloc(x) -#define _mesa_free(x) free(x) -#define _mesa_calloc(x) calloc(1,x) diff --git a/src/glsl/main/mtypes.h b/src/glsl/main/mtypes.h deleted file mode 100644 index 06e2dd4b54..0000000000 --- a/src/glsl/main/mtypes.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.7 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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 mtypes.h - * Main Mesa data structures. - * - * Please try to mark derived values with a leading underscore ('_'). - */ - -#ifndef MTYPES_H -#define MTYPES_H - -#define MAX_DRAW_BUFFERS 8 -#define MAX_VARYING 16 - -#include - -/** - * Indexes for vertex program attributes. - * GL_NV_vertex_program aliases generic attributes over the conventional - * attributes. In GL_ARB_vertex_program shader the aliasing is optional. - * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the - * generic attributes are distinct/separate). - */ -typedef enum -{ - VERT_ATTRIB_POS = 0, - VERT_ATTRIB_WEIGHT = 1, - VERT_ATTRIB_NORMAL = 2, - VERT_ATTRIB_COLOR0 = 3, - VERT_ATTRIB_COLOR1 = 4, - VERT_ATTRIB_FOG = 5, - VERT_ATTRIB_COLOR_INDEX = 6, - VERT_ATTRIB_POINT_SIZE = 6, /*alias*/ - VERT_ATTRIB_EDGEFLAG = 7, - VERT_ATTRIB_TEX0 = 8, - VERT_ATTRIB_TEX1 = 9, - VERT_ATTRIB_TEX2 = 10, - VERT_ATTRIB_TEX3 = 11, - VERT_ATTRIB_TEX4 = 12, - VERT_ATTRIB_TEX5 = 13, - VERT_ATTRIB_TEX6 = 14, - VERT_ATTRIB_TEX7 = 15, - VERT_ATTRIB_GENERIC0 = 16, - VERT_ATTRIB_GENERIC1 = 17, - VERT_ATTRIB_GENERIC2 = 18, - VERT_ATTRIB_GENERIC3 = 19, - VERT_ATTRIB_GENERIC4 = 20, - VERT_ATTRIB_GENERIC5 = 21, - VERT_ATTRIB_GENERIC6 = 22, - VERT_ATTRIB_GENERIC7 = 23, - VERT_ATTRIB_GENERIC8 = 24, - VERT_ATTRIB_GENERIC9 = 25, - VERT_ATTRIB_GENERIC10 = 26, - VERT_ATTRIB_GENERIC11 = 27, - VERT_ATTRIB_GENERIC12 = 28, - VERT_ATTRIB_GENERIC13 = 29, - VERT_ATTRIB_GENERIC14 = 30, - VERT_ATTRIB_GENERIC15 = 31, - VERT_ATTRIB_MAX = 32 -} gl_vert_attrib; - -/** - * Bitflags for vertex attributes. - * These are used in bitfields in many places. - */ -/*@{*/ -#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) -#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) -#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) -#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) -#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) -#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) -#define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX) -#define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG) -#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) -#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) -#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) -#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) -#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) -#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) -#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) -#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) -#define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0) -#define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1) -#define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2) -#define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3) -#define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4) -#define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5) -#define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6) -#define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7) -#define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8) -#define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9) -#define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10) -#define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11) -#define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12) -#define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13) -#define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14) -#define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15) - -#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) -#define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g))) -/*@}*/ - - -/** - * Indexes for vertex program result attributes - */ -typedef enum -{ - VERT_RESULT_HPOS = 0, - VERT_RESULT_COL0 = 1, - VERT_RESULT_COL1 = 2, - VERT_RESULT_FOGC = 3, - VERT_RESULT_TEX0 = 4, - VERT_RESULT_TEX1 = 5, - VERT_RESULT_TEX2 = 6, - VERT_RESULT_TEX3 = 7, - VERT_RESULT_TEX4 = 8, - VERT_RESULT_TEX5 = 9, - VERT_RESULT_TEX6 = 10, - VERT_RESULT_TEX7 = 11, - VERT_RESULT_PSIZ = 12, - VERT_RESULT_BFC0 = 13, - VERT_RESULT_BFC1 = 14, - VERT_RESULT_EDGE = 15, - VERT_RESULT_VAR0 = 16, /**< shader varying */ - VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) -} gl_vert_result; - - -/** - * Indexes for fragment program input attributes. - */ -typedef enum -{ - FRAG_ATTRIB_WPOS = 0, - FRAG_ATTRIB_COL0 = 1, - FRAG_ATTRIB_COL1 = 2, - FRAG_ATTRIB_FOGC = 3, - FRAG_ATTRIB_TEX0 = 4, - FRAG_ATTRIB_TEX1 = 5, - FRAG_ATTRIB_TEX2 = 6, - FRAG_ATTRIB_TEX3 = 7, - FRAG_ATTRIB_TEX4 = 8, - FRAG_ATTRIB_TEX5 = 9, - FRAG_ATTRIB_TEX6 = 10, - FRAG_ATTRIB_TEX7 = 11, - FRAG_ATTRIB_FACE = 12, /**< front/back face */ - FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */ - FRAG_ATTRIB_VAR0 = 14, /**< shader varying */ - FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING) -} gl_frag_attrib; - -/** - * Bitflags for fragment program input attributes. - */ -/*@{*/ -#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) -#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) -#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) -#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) -#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE) -#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC) -#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) -#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) -#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) -#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) -#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) -#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) -#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) -#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) -#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) - -#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) -#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) - -#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ - FRAG_BIT_TEX1| \ - FRAG_BIT_TEX2| \ - FRAG_BIT_TEX3| \ - FRAG_BIT_TEX4| \ - FRAG_BIT_TEX5| \ - FRAG_BIT_TEX6| \ - FRAG_BIT_TEX7) -/*@}*/ - - -/** - * Fragment program results - */ -typedef enum -{ - FRAG_RESULT_DEPTH = 0, - FRAG_RESULT_COLOR = 1, - FRAG_RESULT_DATA0 = 2, - FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) -} gl_frag_result; - -/** - * Names of the various vertex/fragment program register files, etc. - * - * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c) - * All values should fit in a 4-bit field. - * - * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM, - * PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to - * be "uniform" variables since they can only be set outside glBegin/End. - * They're also all stored in the same Parameters array. - */ -typedef enum -{ - PROGRAM_TEMPORARY, /**< machine->Temporary[] */ - PROGRAM_INPUT, /**< machine->Inputs[] */ - PROGRAM_OUTPUT, /**< machine->Outputs[] */ - PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */ - PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */ - PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */ - PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ - PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */ - PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ - PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ - PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ - PROGRAM_ADDRESS, /**< machine->AddressReg */ - PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ - PROGRAM_UNDEFINED, /**< Invalid/TBD value */ - PROGRAM_FILE_MAX -} gl_register_file; - -/** - * An index for each type of texture object. These correspond to the GL - * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. - * Note: the order is from highest priority to lowest priority. - */ -typedef enum -{ - TEXTURE_2D_ARRAY_INDEX, - TEXTURE_1D_ARRAY_INDEX, - TEXTURE_CUBE_INDEX, - TEXTURE_3D_INDEX, - TEXTURE_RECT_INDEX, - TEXTURE_2D_INDEX, - TEXTURE_1D_INDEX, - NUM_TEXTURE_TARGETS -} gl_texture_index; - -#endif /* MTYPES_H */ diff --git a/src/glsl/main/simple_list.h b/src/glsl/main/simple_list.h deleted file mode 100644 index 5ef39e14cc..0000000000 --- a/src/glsl/main/simple_list.h +++ /dev/null @@ -1,235 +0,0 @@ -/** - * \file simple_list.h - * Simple macros for type-safe, intrusive lists. - * - * Intended to work with a list sentinal which is created as an empty - * list. Insert & delete are O(1). - * - * \author - * (C) 1997, Keith Whitwell - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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. - */ - - -#ifndef _SIMPLE_LIST_H -#define _SIMPLE_LIST_H - -struct simple_node { - struct simple_node *next; - struct simple_node *prev; -}; - -/** - * Remove an element from list. - * - * \param elem element to remove. - */ -#define remove_from_list(elem) \ -do { \ - (elem)->next->prev = (elem)->prev; \ - (elem)->prev->next = (elem)->next; \ -} while (0) - -/** - * Insert an element to the list head. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_head(list, elem) \ -do { \ - (elem)->prev = list; \ - (elem)->next = (list)->next; \ - (list)->next->prev = elem; \ - (list)->next = elem; \ -} while(0) - -/** - * Insert an element to the list tail. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_tail(list, elem) \ -do { \ - (elem)->next = list; \ - (elem)->prev = (list)->prev; \ - (list)->prev->next = elem; \ - (list)->prev = elem; \ -} while(0) - -/** - * Move an element to the list head. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_head(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_head(list, elem); \ -} while (0) - -/** - * Move an element to the list tail. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_tail(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_tail(list, elem); \ -} while (0) - -/** - * Consatinate a cyclic list to a list - * - * Appends the sequence of nodes starting with \c tail to the list \c head. - * A "cyclic list" is a list that does not have a sentinal node. This means - * that the data pointed to by \c tail is an actual node, not a dataless - * sentinal. Note that if \c tail constist of a single node, this macro - * behaves identically to \c insert_at_tail - * - * \param head Head of the list to be appended to. This may or may not - * be a cyclic list. - * \param tail Head of the cyclic list to be appended to \c head. - * \param temp Temporary \c simple_list used by the macro - * - * \sa insert_at_tail - */ -#define concat_list_and_cycle(head, tail, temp) \ -do { \ - (head)->prev->next = (tail); \ - (tail)->prev->next = (head); \ - (temp) = (head)->prev; \ - (head)->prev = (tail)->prev; \ - (tail)->prev = (temp); \ -} while (0) - -#define concat_list(head, next_list) \ -do { \ - (next_list)->next->prev = (head)->prev; \ - (next_list)->prev->next = (head); \ - (head)->prev->next = (next_list)->next; \ - (head)->prev = (next_list)->prev; \ -} while (0) - -/** - * Make a empty list empty. - * - * \param sentinal list (sentinal element). - */ -#define make_empty_list(sentinal) \ -do { \ - (sentinal)->next = sentinal; \ - (sentinal)->prev = sentinal; \ -} while (0) - -/** - * Get list first element. - * - * \param list list. - * - * \return pointer to first element. - */ -#define first_elem(list) ((list)->next) - -/** - * Get list last element. - * - * \param list list. - * - * \return pointer to last element. - */ -#define last_elem(list) ((list)->prev) - -/** - * Get next element. - * - * \param elem element. - * - * \return pointer to next element. - */ -#define next_elem(elem) ((elem)->next) - -/** - * Get previous element. - * - * \param elem element. - * - * \return pointer to previous element. - */ -#define prev_elem(elem) ((elem)->prev) - -/** - * Test whether element is at end of the list. - * - * \param list list. - * \param elem element. - * - * \return non-zero if element is at end of list, or zero otherwise. - */ -#define at_end(list, elem) ((elem) == (list)) - -/** - * Test if a list is empty. - * - * \param list list. - * - * \return non-zero if list empty, or zero otherwise. - */ -#define is_empty_list(list) ((list)->next == (list)) - -/** - * Walk through the elements of a list. - * - * \param ptr pointer to the current element. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach(ptr, list) \ - for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) - -/** - * Walk through the elements of a list. - * - * Same as #foreach but lets you unlink the current value during a list - * traversal. Useful for freeing a list, element by element. - * - * \param ptr pointer to the current element. - * \param t temporary pointer. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach_s(ptr, t, list) \ - for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) - -#endif diff --git a/src/glsl/mesa/shader/prog_instruction.c b/src/glsl/mesa/shader/prog_instruction.c deleted file mode 100644 index fbcf868f50..0000000000 --- a/src/glsl/mesa/shader/prog_instruction.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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. - */ - - -#define _GNU_SOURCE -#include -#include -#include - -#if 0 -#include "main/glheader.h" -#else -#define _mesa_strdup strdup -#define _mesa_snprintf snprintf -#define ASSERT assert -#endif -#include "main/imports.h" -#include "main/mtypes.h" -#include "prog_instruction.h" - - -/** - * Initialize program instruction fields to defaults. - * \param inst first instruction to initialize - * \param count number of instructions to initialize - */ -void -_mesa_init_instructions(struct prog_instruction *inst, GLuint count) -{ - GLuint i; - - memset(inst, 0, count * sizeof(struct prog_instruction)); - - for (i = 0; i < count; i++) { - inst[i].SrcReg[0].File = PROGRAM_UNDEFINED; - inst[i].SrcReg[0].Swizzle = SWIZZLE_NOOP; - inst[i].SrcReg[1].File = PROGRAM_UNDEFINED; - inst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP; - inst[i].SrcReg[2].File = PROGRAM_UNDEFINED; - inst[i].SrcReg[2].Swizzle = SWIZZLE_NOOP; - - inst[i].DstReg.File = PROGRAM_UNDEFINED; - inst[i].DstReg.WriteMask = WRITEMASK_XYZW; - inst[i].DstReg.CondMask = COND_TR; - inst[i].DstReg.CondSwizzle = SWIZZLE_NOOP; - - inst[i].SaturateMode = SATURATE_OFF; - inst[i].Precision = FLOAT32; - } -} - - -/** - * Allocate an array of program instructions. - * \param numInst number of instructions - * \return pointer to instruction memory - */ -struct prog_instruction * -_mesa_alloc_instructions(GLuint numInst) -{ - return (struct prog_instruction *) - calloc(1, numInst * sizeof(struct prog_instruction)); -} - - -/** - * Reallocate memory storing an array of program instructions. - * This is used when we need to append additional instructions onto an - * program. - * \param oldInst pointer to first of old/src instructions - * \param numOldInst number of instructions at - * \param numNewInst desired size of new instruction array. - * \return pointer to start of new instruction array. - */ -struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst) -{ - struct prog_instruction *newInst; - - (void)numOldInst; - newInst = (struct prog_instruction *) - realloc(oldInst, - numNewInst * sizeof(struct prog_instruction)); - - return newInst; -} - - -/** - * Copy an array of program instructions. - * \param dest pointer to destination. - * \param src pointer to source. - * \param n number of instructions to copy. - * \return pointer to destination. - */ -struct prog_instruction * -_mesa_copy_instructions(struct prog_instruction *dest, - const struct prog_instruction *src, GLuint n) -{ - GLuint i; - memcpy(dest, src, n * sizeof(struct prog_instruction)); - for (i = 0; i < n; i++) { - if (src[i].Comment) - dest[i].Comment = _mesa_strdup(src[i].Comment); - } - return dest; -} - - -/** - * Free an array of instructions - */ -void -_mesa_free_instructions(struct prog_instruction *inst, GLuint count) -{ - GLuint i; - for (i = 0; i < count; i++) { - if (inst[i].Data) - free(inst[i].Data); - if (inst[i].Comment) - free((char *) inst[i].Comment); - } - free(inst); -} - - -/** - * Basic info about each instruction - */ -struct instruction_info -{ - gl_inst_opcode Opcode; - const char *Name; - GLuint NumSrcRegs; - GLuint NumDstRegs; -}; - -/** - * Instruction info - * \note Opcode should equal array index! - */ -static const struct instruction_info InstInfo[MAX_OPCODE] = { - { OPCODE_NOP, "NOP", 0, 0 }, - { OPCODE_ABS, "ABS", 1, 1 }, - { OPCODE_ADD, "ADD", 2, 1 }, - { OPCODE_AND, "AND", 2, 1 }, - { OPCODE_ARA, "ARA", 1, 1 }, - { OPCODE_ARL, "ARL", 1, 1 }, - { OPCODE_ARL_NV, "ARL_NV", 1, 1 }, - { OPCODE_ARR, "ARL", 1, 1 }, - { OPCODE_BGNLOOP,"BGNLOOP", 0, 0 }, - { OPCODE_BGNSUB, "BGNSUB", 0, 0 }, - { OPCODE_BRA, "BRA", 0, 0 }, - { OPCODE_BRK, "BRK", 0, 0 }, - { OPCODE_CAL, "CAL", 0, 0 }, - { OPCODE_CMP, "CMP", 3, 1 }, - { OPCODE_CONT, "CONT", 0, 0 }, - { OPCODE_COS, "COS", 1, 1 }, - { OPCODE_DDX, "DDX", 1, 1 }, - { OPCODE_DDY, "DDY", 1, 1 }, - { OPCODE_DP2, "DP2", 2, 1 }, - { OPCODE_DP2A, "DP2A", 3, 1 }, - { OPCODE_DP3, "DP3", 2, 1 }, - { OPCODE_DP4, "DP4", 2, 1 }, - { OPCODE_DPH, "DPH", 2, 1 }, - { OPCODE_DST, "DST", 2, 1 }, - { OPCODE_ELSE, "ELSE", 0, 0 }, - { OPCODE_END, "END", 0, 0 }, - { OPCODE_ENDIF, "ENDIF", 0, 0 }, - { OPCODE_ENDLOOP,"ENDLOOP", 0, 0 }, - { OPCODE_ENDSUB, "ENDSUB", 0, 0 }, - { OPCODE_EX2, "EX2", 1, 1 }, - { OPCODE_EXP, "EXP", 1, 1 }, - { OPCODE_FLR, "FLR", 1, 1 }, - { OPCODE_FRC, "FRC", 1, 1 }, - { OPCODE_IF, "IF", 1, 0 }, - { OPCODE_KIL, "KIL", 1, 0 }, - { OPCODE_KIL_NV, "KIL_NV", 0, 0 }, - { OPCODE_LG2, "LG2", 1, 1 }, - { OPCODE_LIT, "LIT", 1, 1 }, - { OPCODE_LOG, "LOG", 1, 1 }, - { OPCODE_LRP, "LRP", 3, 1 }, - { OPCODE_MAD, "MAD", 3, 1 }, - { OPCODE_MAX, "MAX", 2, 1 }, - { OPCODE_MIN, "MIN", 2, 1 }, - { OPCODE_MOV, "MOV", 1, 1 }, - { OPCODE_MUL, "MUL", 2, 1 }, - { OPCODE_NOISE1, "NOISE1", 1, 1 }, - { OPCODE_NOISE2, "NOISE2", 1, 1 }, - { OPCODE_NOISE3, "NOISE3", 1, 1 }, - { OPCODE_NOISE4, "NOISE4", 1, 1 }, - { OPCODE_NOT, "NOT", 1, 1 }, - { OPCODE_NRM3, "NRM3", 1, 1 }, - { OPCODE_NRM4, "NRM4", 1, 1 }, - { OPCODE_OR, "OR", 2, 1 }, - { OPCODE_PK2H, "PK2H", 1, 1 }, - { OPCODE_PK2US, "PK2US", 1, 1 }, - { OPCODE_PK4B, "PK4B", 1, 1 }, - { OPCODE_PK4UB, "PK4UB", 1, 1 }, - { OPCODE_POW, "POW", 2, 1 }, - { OPCODE_POPA, "POPA", 0, 0 }, - { OPCODE_PRINT, "PRINT", 1, 0 }, - { OPCODE_PUSHA, "PUSHA", 0, 0 }, - { OPCODE_RCC, "RCC", 1, 1 }, - { OPCODE_RCP, "RCP", 1, 1 }, - { OPCODE_RET, "RET", 0, 0 }, - { OPCODE_RFL, "RFL", 1, 1 }, - { OPCODE_RSQ, "RSQ", 1, 1 }, - { OPCODE_SCS, "SCS", 1, 1 }, - { OPCODE_SEQ, "SEQ", 2, 1 }, - { OPCODE_SFL, "SFL", 0, 1 }, - { OPCODE_SGE, "SGE", 2, 1 }, - { OPCODE_SGT, "SGT", 2, 1 }, - { OPCODE_SIN, "SIN", 1, 1 }, - { OPCODE_SLE, "SLE", 2, 1 }, - { OPCODE_SLT, "SLT", 2, 1 }, - { OPCODE_SNE, "SNE", 2, 1 }, - { OPCODE_SSG, "SSG", 1, 1 }, - { OPCODE_STR, "STR", 0, 1 }, - { OPCODE_SUB, "SUB", 2, 1 }, - { OPCODE_SWZ, "SWZ", 1, 1 }, - { OPCODE_TEX, "TEX", 1, 1 }, - { OPCODE_TXB, "TXB", 1, 1 }, - { OPCODE_TXD, "TXD", 3, 1 }, - { OPCODE_TXL, "TXL", 1, 1 }, - { OPCODE_TXP, "TXP", 1, 1 }, - { OPCODE_TXP_NV, "TXP_NV", 1, 1 }, - { OPCODE_TRUNC, "TRUNC", 1, 1 }, - { OPCODE_UP2H, "UP2H", 1, 1 }, - { OPCODE_UP2US, "UP2US", 1, 1 }, - { OPCODE_UP4B, "UP4B", 1, 1 }, - { OPCODE_UP4UB, "UP4UB", 1, 1 }, - { OPCODE_X2D, "X2D", 3, 1 }, - { OPCODE_XOR, "XOR", 2, 1 }, - { OPCODE_XPD, "XPD", 2, 1 } -}; - - -/** - * Return the number of src registers for the given instruction/opcode. - */ -GLuint -_mesa_num_inst_src_regs(gl_inst_opcode opcode) -{ - ASSERT(opcode < MAX_OPCODE); - ASSERT(opcode == InstInfo[opcode].Opcode); - ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode); - return InstInfo[opcode].NumSrcRegs; -} - - -/** - * Return the number of dst registers for the given instruction/opcode. - */ -GLuint -_mesa_num_inst_dst_regs(gl_inst_opcode opcode) -{ - ASSERT(opcode < MAX_OPCODE); - ASSERT(opcode == InstInfo[opcode].Opcode); - ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode); - return InstInfo[opcode].NumDstRegs; -} - - -GLboolean -_mesa_is_tex_instruction(gl_inst_opcode opcode) -{ - return (opcode == OPCODE_TEX || - opcode == OPCODE_TXB || - opcode == OPCODE_TXD || - opcode == OPCODE_TXL || - opcode == OPCODE_TXP); -} - - -/** - * Check if there's a potential src/dst register data dependency when - * using SOA execution. - * Example: - * MOV T, T.yxwz; - * This would expand into: - * MOV t0, t1; - * MOV t1, t0; - * MOV t2, t3; - * MOV t3, t2; - * The second instruction will have the wrong value for t0 if executed as-is. - */ -GLboolean -_mesa_check_soa_dependencies(const struct prog_instruction *inst) -{ - GLuint i, chan; - - if (inst->DstReg.WriteMask == WRITEMASK_X || - inst->DstReg.WriteMask == WRITEMASK_Y || - inst->DstReg.WriteMask == WRITEMASK_Z || - inst->DstReg.WriteMask == WRITEMASK_W || - inst->DstReg.WriteMask == 0x0) { - /* no chance of data dependency */ - return GL_FALSE; - } - - /* loop over src regs */ - for (i = 0; i < 3; i++) { - if (inst->SrcReg[i].File == inst->DstReg.File && - inst->SrcReg[i].Index == inst->DstReg.Index) { - /* loop over dest channels */ - GLuint channelsWritten = 0x0; - for (chan = 0; chan < 4; chan++) { - if (inst->DstReg.WriteMask & (1 << chan)) { - /* check if we're reading a channel that's been written */ - GLuint swizzle = GET_SWZ(inst->SrcReg[i].Swizzle, chan); - if (swizzle <= SWIZZLE_W && - (channelsWritten & (1 << swizzle))) { - return GL_TRUE; - } - - channelsWritten |= (1 << chan); - } - } - } - } - return GL_FALSE; -} - - -/** - * Return string name for given program opcode. - */ -const char * -_mesa_opcode_string(gl_inst_opcode opcode) -{ - if (opcode < MAX_OPCODE) - return InstInfo[opcode].Name; - else { - static char s[20]; - _mesa_snprintf(s, sizeof(s), "OP%u", opcode); - return s; - } -} - diff --git a/src/glsl/mesa/shader/prog_instruction.h b/src/glsl/mesa/shader/prog_instruction.h deleted file mode 100644 index 2c95d274ca..0000000000 --- a/src/glsl/mesa/shader/prog_instruction.h +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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 prog_instruction.h - * - * Vertex/fragment program instruction datatypes and constants. - * - * \author Brian Paul - * \author Keith Whitwell - * \author Ian Romanick - */ - - -#ifndef PROG_INSTRUCTION_H -#define PROG_INSTRUCTION_H - - -#include "main/mtypes.h" - - -/** - * Swizzle indexes. - * Do not change! - */ -/*@{*/ -#define SWIZZLE_X 0 -#define SWIZZLE_Y 1 -#define SWIZZLE_Z 2 -#define SWIZZLE_W 3 -#define SWIZZLE_ZERO 4 /**< For SWZ instruction only */ -#define SWIZZLE_ONE 5 /**< For SWZ instruction only */ -#define SWIZZLE_NIL 7 /**< used during shader code gen (undefined value) */ -/*@}*/ - -#define MAKE_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) -#define SWIZZLE_NOOP MAKE_SWIZZLE4(0,1,2,3) -#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) -#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) - -#define SWIZZLE_XYZW MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W) -#define SWIZZLE_XXXX MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X) -#define SWIZZLE_YYYY MAKE_SWIZZLE4(SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y) -#define SWIZZLE_ZZZZ MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z) -#define SWIZZLE_WWWW MAKE_SWIZZLE4(SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) - - -/** - * Writemask values, 1 bit per component. - */ -/*@{*/ -#define WRITEMASK_X 0x1 -#define WRITEMASK_Y 0x2 -#define WRITEMASK_XY 0x3 -#define WRITEMASK_Z 0x4 -#define WRITEMASK_XZ 0x5 -#define WRITEMASK_YZ 0x6 -#define WRITEMASK_XYZ 0x7 -#define WRITEMASK_W 0x8 -#define WRITEMASK_XW 0x9 -#define WRITEMASK_YW 0xa -#define WRITEMASK_XYW 0xb -#define WRITEMASK_ZW 0xc -#define WRITEMASK_XZW 0xd -#define WRITEMASK_YZW 0xe -#define WRITEMASK_XYZW 0xf -/*@}*/ - - -/** - * Condition codes - */ -/*@{*/ -#define COND_GT 1 /**< greater than zero */ -#define COND_EQ 2 /**< equal to zero */ -#define COND_LT 3 /**< less than zero */ -#define COND_UN 4 /**< unordered (NaN) */ -#define COND_GE 5 /**< greater than or equal to zero */ -#define COND_LE 6 /**< less than or equal to zero */ -#define COND_NE 7 /**< not equal to zero */ -#define COND_TR 8 /**< always true */ -#define COND_FL 9 /**< always false */ -/*@}*/ - - -/** - * Instruction precision for GL_NV_fragment_program - */ -/*@{*/ -#define FLOAT32 0x1 -#define FLOAT16 0x2 -#define FIXED12 0x4 -/*@}*/ - - -/** - * Saturation modes when storing values. - */ -/*@{*/ -#define SATURATE_OFF 0 -#define SATURATE_ZERO_ONE 1 -/*@}*/ - - -/** - * Per-component negation masks - */ -/*@{*/ -#define NEGATE_X 0x1 -#define NEGATE_Y 0x2 -#define NEGATE_Z 0x4 -#define NEGATE_W 0x8 -#define NEGATE_XYZ 0x7 -#define NEGATE_XYZW 0xf -#define NEGATE_NONE 0x0 -/*@}*/ - - -/** - * Program instruction opcodes, for both vertex and fragment programs. - * \note changes to this opcode list must be reflected in t_vb_arbprogram.c - */ -typedef enum prog_opcode { - /* ARB_vp ARB_fp NV_vp NV_fp GLSL */ - /*------------------------------------------*/ - OPCODE_NOP = 0, /* X */ - OPCODE_ABS, /* X X 1.1 X */ - OPCODE_ADD, /* X X X X X */ - OPCODE_AND, /* */ - OPCODE_ARA, /* 2 */ - OPCODE_ARL, /* X X */ - OPCODE_ARL_NV, /* 2 */ - OPCODE_ARR, /* 2 */ - OPCODE_BGNLOOP, /* opt */ - OPCODE_BGNSUB, /* opt */ - OPCODE_BRA, /* 2 X */ - OPCODE_BRK, /* 2 opt */ - OPCODE_CAL, /* 2 2 */ - OPCODE_CMP, /* X */ - OPCODE_CONT, /* opt */ - OPCODE_COS, /* X 2 X X */ - OPCODE_DDX, /* X X */ - OPCODE_DDY, /* X X */ - OPCODE_DP2, /* 2 */ - OPCODE_DP2A, /* 2 */ - OPCODE_DP3, /* X X X X X */ - OPCODE_DP4, /* X X X X X */ - OPCODE_DPH, /* X X 1.1 */ - OPCODE_DST, /* X X X X */ - OPCODE_ELSE, /* X */ - OPCODE_END, /* X X X X opt */ - OPCODE_ENDIF, /* opt */ - OPCODE_ENDLOOP, /* opt */ - OPCODE_ENDSUB, /* opt */ - OPCODE_EX2, /* X X 2 X X */ - OPCODE_EXP, /* X X X */ - OPCODE_FLR, /* X X 2 X X */ - OPCODE_FRC, /* X X 2 X X */ - OPCODE_IF, /* opt */ - OPCODE_KIL, /* X */ - OPCODE_KIL_NV, /* X X */ - OPCODE_LG2, /* X X 2 X X */ - OPCODE_LIT, /* X X X X */ - OPCODE_LOG, /* X X X */ - OPCODE_LRP, /* X X */ - OPCODE_MAD, /* X X X X X */ - OPCODE_MAX, /* X X X X X */ - OPCODE_MIN, /* X X X X X */ - OPCODE_MOV, /* X X X X X */ - OPCODE_MUL, /* X X X X X */ - OPCODE_NOISE1, /* X */ - OPCODE_NOISE2, /* X */ - OPCODE_NOISE3, /* X */ - OPCODE_NOISE4, /* X */ - OPCODE_NOT, /* */ - OPCODE_NRM3, /* */ - OPCODE_NRM4, /* */ - OPCODE_OR, /* */ - OPCODE_PK2H, /* X */ - OPCODE_PK2US, /* X */ - OPCODE_PK4B, /* X */ - OPCODE_PK4UB, /* X */ - OPCODE_POW, /* X X X X */ - OPCODE_POPA, /* 3 */ - OPCODE_PRINT, /* X X */ - OPCODE_PUSHA, /* 3 */ - OPCODE_RCC, /* 1.1 */ - OPCODE_RCP, /* X X X X X */ - OPCODE_RET, /* 2 2 */ - OPCODE_RFL, /* X X */ - OPCODE_RSQ, /* X X X X X */ - OPCODE_SCS, /* X */ - OPCODE_SEQ, /* 2 X X */ - OPCODE_SFL, /* 2 X */ - OPCODE_SGE, /* X X X X X */ - OPCODE_SGT, /* 2 X X */ - OPCODE_SIN, /* X 2 X X */ - OPCODE_SLE, /* 2 X X */ - OPCODE_SLT, /* X X X X X */ - OPCODE_SNE, /* 2 X X */ - OPCODE_SSG, /* 2 */ - OPCODE_STR, /* 2 X */ - OPCODE_SUB, /* X X 1.1 X X */ - OPCODE_SWZ, /* X X */ - OPCODE_TEX, /* X 3 X X */ - OPCODE_TXB, /* X 3 X */ - OPCODE_TXD, /* X X */ - OPCODE_TXL, /* 3 2 X */ - OPCODE_TXP, /* X X */ - OPCODE_TXP_NV, /* 3 X */ - OPCODE_TRUNC, /* X */ - OPCODE_UP2H, /* X */ - OPCODE_UP2US, /* X */ - OPCODE_UP4B, /* X */ - OPCODE_UP4UB, /* X */ - OPCODE_X2D, /* X */ - OPCODE_XOR, /* */ - OPCODE_XPD, /* X X X */ - MAX_OPCODE -} gl_inst_opcode; - - -/** - * Number of bits for the src/dst register Index field. - * This limits the size of temp/uniform register files. - */ -#define INST_INDEX_BITS 10 - - -/** - * Instruction source register. - */ -struct prog_src_register -{ - GLuint File:4; /**< One of the PROGRAM_* register file values. */ - GLint Index:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. - * May be negative for relative addressing. - */ - GLuint Swizzle:12; - GLuint RelAddr:1; - - /** Take the component-wise absolute value */ - GLuint Abs:1; - - /** - * Post-Abs negation. - * This will either be NEGATE_NONE or NEGATE_XYZW, except for the SWZ - * instruction which allows per-component negation. - */ - GLuint Negate:4; -}; - - -/** - * Instruction destination register. - */ -struct prog_dst_register -{ - GLuint File:4; /**< One of the PROGRAM_* register file values */ - GLuint Index:INST_INDEX_BITS; /**< Unsigned, never negative */ - GLuint WriteMask:4; - GLuint RelAddr:1; - - /** - * \name Conditional destination update control. - * - * \since - * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, - * NV_vertex_program2_option. - */ - /*@{*/ - /** - * Takes one of the 9 possible condition values (EQ, FL, GT, GE, LE, LT, - * NE, TR, or UN). Dest reg is only written to if the matching - * (swizzled) condition code value passes. When a conditional update mask - * is not specified, this will be \c COND_TR. - */ - GLuint CondMask:4; - - /** - * Condition code swizzle value. - */ - GLuint CondSwizzle:12; - - /** - * Selects the condition code register to use for conditional destination - * update masking. In NV_fragmnet_program or NV_vertex_program2 mode, only - * condition code register 0 is available. In NV_vertex_program3 mode, - * condition code registers 0 and 1 are available. - */ - GLuint CondSrc:1; - /*@}*/ -}; - - -/** - * Vertex/fragment program instruction. - */ -struct prog_instruction -{ - gl_inst_opcode Opcode; - struct prog_src_register SrcReg[3]; - struct prog_dst_register DstReg; - - /** - * Indicates that the instruction should update the condition code - * register. - * - * \since - * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, - * NV_vertex_program2_option. - */ - GLuint CondUpdate:1; - - /** - * If prog_instruction::CondUpdate is \c GL_TRUE, this value selects the - * condition code register that is to be updated. - * - * In GL_NV_fragment_program or GL_NV_vertex_program2 mode, only condition - * code register 0 is available. In GL_NV_vertex_program3 mode, condition - * code registers 0 and 1 are available. - * - * \since - * NV_fragment_program, NV_fragment_program_option, NV_vertex_program2, - * NV_vertex_program2_option. - */ - GLuint CondDst:1; - - /** - * Saturate each value of the vectored result to the range [0,1] or the - * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is - * only available in NV_fragment_program2 mode. - * Value is one of the SATURATE_* tokens. - * - * \since - * NV_fragment_program, NV_fragment_program_option, NV_vertex_program3. - */ - GLuint SaturateMode:2; - - /** - * Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12. - * - * \since - * NV_fragment_program, NV_fragment_program_option. - */ - GLuint Precision:3; - - /** - * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. - */ - /*@{*/ - /** Source texture unit. */ - GLuint TexSrcUnit:5; - - /** Source texture target, one of TEXTURE_{1D,2D,3D,CUBE,RECT}_INDEX */ - GLuint TexSrcTarget:3; - - /** True if tex instruction should do shadow comparison */ - GLuint TexShadow:1; - /*@}*/ - - /** - * For BRA and CAL instructions, the location to jump to. - * For BGNLOOP, points to ENDLOOP (and vice-versa). - * For BRK, points to BGNLOOP (which points to ENDLOOP). - * For IF, points to ELSE or ENDIF. - * For ELSE, points to ENDIF. - */ - GLint BranchTarget; - - /** for debugging purposes */ - const char *Comment; - - /** Arbitrary data. Used for OPCODE_PRINT and some drivers */ - void *Data; - - /** for driver use (try to remove someday) */ - GLint Aux; -}; - - -extern void -_mesa_init_instructions(struct prog_instruction *inst, GLuint count); - -extern struct prog_instruction * -_mesa_alloc_instructions(GLuint numInst); - -extern struct prog_instruction * -_mesa_realloc_instructions(struct prog_instruction *oldInst, - GLuint numOldInst, GLuint numNewInst); - -extern struct prog_instruction * -_mesa_copy_instructions(struct prog_instruction *dest, - const struct prog_instruction *src, GLuint n); - -extern void -_mesa_free_instructions(struct prog_instruction *inst, GLuint count); - -extern GLuint -_mesa_num_inst_src_regs(gl_inst_opcode opcode); - -extern GLuint -_mesa_num_inst_dst_regs(gl_inst_opcode opcode); - -extern GLboolean -_mesa_is_tex_instruction(gl_inst_opcode opcode); - -extern GLboolean -_mesa_check_soa_dependencies(const struct prog_instruction *inst); - -extern const char * -_mesa_opcode_string(gl_inst_opcode opcode); - - -#endif /* PROG_INSTRUCTION_H */ diff --git a/src/glsl/mesa/shader/prog_print.c b/src/glsl/mesa/shader/prog_print.c deleted file mode 100644 index 3f1cb48e4b..0000000000 --- a/src/glsl/mesa/shader/prog_print.c +++ /dev/null @@ -1,1089 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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 prog_print.c - * Print vertex/fragment programs - for debugging. - * \author Brian Paul - */ - -#if 0 -#include "main/glheader.h" -#include "main/context.h" -#include "main/imports.h" -#else - -#define _GNU_SOURCE - -#include -#include -#include -#include -struct gl_program { - int Target; -}; - -void _mesa_problem(void *ctx, char *msg) -{ - (void)ctx; - fprintf(stderr, "%s", msg); - exit(1); -} - -#endif - -#include "prog_instruction.h" -#include "prog_print.h" - - - -/** - * Return string name for given program/register file. - */ -static const char * -file_string(gl_register_file f, gl_prog_print_mode mode) -{ - (void)mode; - switch (f) { - case PROGRAM_TEMPORARY: - return "TEMP"; - case PROGRAM_LOCAL_PARAM: - return "LOCAL"; - case PROGRAM_ENV_PARAM: - return "ENV"; - case PROGRAM_STATE_VAR: - return "STATE"; - case PROGRAM_INPUT: - return "INPUT"; - case PROGRAM_OUTPUT: - return "OUTPUT"; - case PROGRAM_NAMED_PARAM: - return "NAMED"; - case PROGRAM_CONSTANT: - return "CONST"; - case PROGRAM_UNIFORM: - return "UNIFORM"; - case PROGRAM_VARYING: - return "VARYING"; - case PROGRAM_WRITE_ONLY: - return "WRITE_ONLY"; - case PROGRAM_ADDRESS: - return "ADDR"; - case PROGRAM_SAMPLER: - return "SAMPLER"; - case PROGRAM_UNDEFINED: - return "UNDEFINED"; - default: - { - static char s[20]; - snprintf(s, sizeof(s), "FILE%u", f); - return s; - } - } -} - - -/** - * Return ARB_v/f_prog-style input attrib string. - */ -static const char * -arb_input_attrib_string(GLint index, GLenum progType) -{ - /* - * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. - */ - const char *vertAttribs[] = { - "vertex.position", - "vertex.weight", - "vertex.normal", - "vertex.color.primary", - "vertex.color.secondary", - "vertex.fogcoord", - "vertex.(six)", - "vertex.(seven)", - "vertex.texcoord[0]", - "vertex.texcoord[1]", - "vertex.texcoord[2]", - "vertex.texcoord[3]", - "vertex.texcoord[4]", - "vertex.texcoord[5]", - "vertex.texcoord[6]", - "vertex.texcoord[7]", - "vertex.attrib[0]", - "vertex.attrib[1]", - "vertex.attrib[2]", - "vertex.attrib[3]", - "vertex.attrib[4]", - "vertex.attrib[5]", - "vertex.attrib[6]", - "vertex.attrib[7]", - "vertex.attrib[8]", - "vertex.attrib[9]", - "vertex.attrib[10]", - "vertex.attrib[11]", - "vertex.attrib[12]", - "vertex.attrib[13]", - "vertex.attrib[14]", - "vertex.attrib[15]" - }; - const char *fragAttribs[] = { - "fragment.position", - "fragment.color.primary", - "fragment.color.secondary", - "fragment.fogcoord", - "fragment.texcoord[0]", - "fragment.texcoord[1]", - "fragment.texcoord[2]", - "fragment.texcoord[3]", - "fragment.texcoord[4]", - "fragment.texcoord[5]", - "fragment.texcoord[6]", - "fragment.texcoord[7]", - "fragment.varying[0]", - "fragment.varying[1]", - "fragment.varying[2]", - "fragment.varying[3]", - "fragment.varying[4]", - "fragment.varying[5]", - "fragment.varying[6]", - "fragment.varying[7]" - }; - - /* sanity checks */ - assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); - assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); - - if (progType == GL_VERTEX_PROGRAM_ARB) { - assert((unsigned int)index < sizeof(vertAttribs) / sizeof(vertAttribs[0])); - return vertAttribs[index]; - } - else { - assert((unsigned int)index < sizeof(fragAttribs) / sizeof(fragAttribs[0])); - return fragAttribs[index]; - } -} - - -/** - * Print a vertex program's InputsRead field in human-readable format. - * For debugging. - */ -void -_mesa_print_vp_inputs(GLbitfield inputs) -{ - printf("VP Inputs 0x%x: \n", inputs); - while (inputs) { - GLint attr = ffs(inputs) - 1; - const char *name = arb_input_attrib_string(attr, - GL_VERTEX_PROGRAM_ARB); - printf(" %d: %s\n", attr, name); - inputs &= ~(1 << attr); - } -} - - -/** - * Print a fragment program's InputsRead field in human-readable format. - * For debugging. - */ -void -_mesa_print_fp_inputs(GLbitfield inputs) -{ - printf("FP Inputs 0x%x: \n", inputs); - while (inputs) { - GLint attr = ffs(inputs) - 1; - const char *name = arb_input_attrib_string(attr, - GL_FRAGMENT_PROGRAM_ARB); - printf(" %d: %s\n", attr, name); - inputs &= ~(1 << attr); - } -} - - -#if 0 -/** - * Return ARB_v/f_prog-style output attrib string. - */ -static const char * -arb_output_attrib_string(GLint index, GLenum progType) -{ - /* - * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. - */ - const char *vertResults[] = { - "result.position", - "result.color.primary", - "result.color.secondary", - "result.fogcoord", - "result.texcoord[0]", - "result.texcoord[1]", - "result.texcoord[2]", - "result.texcoord[3]", - "result.texcoord[4]", - "result.texcoord[5]", - "result.texcoord[6]", - "result.texcoord[7]", - "result.varying[0]", - "result.varying[1]", - "result.varying[2]", - "result.varying[3]", - "result.varying[4]", - "result.varying[5]", - "result.varying[6]", - "result.varying[7]" - }; - const char *fragResults[] = { - "result.color", - "result.color(half)", - "result.depth", - "result.color[0]", - "result.color[1]", - "result.color[2]", - "result.color[3]" - }; - - if (progType == GL_VERTEX_PROGRAM_ARB) { - assert(index < sizeof(vertResults) / sizeof(vertResults[0])); - return vertResults[index]; - } - else { - assert(index < sizeof(fragResults) / sizeof(fragResults[0])); - return fragResults[index]; - } -} -#endif - -/** - * Return string representation of the given register. - * Note that some types of registers (like PROGRAM_UNIFORM) aren't defined - * by the ARB/NV program languages so we've taken some liberties here. - * \param f the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc) - * \param index number of the register in the register file - * \param mode the output format/mode/style - * \param prog pointer to containing program - */ -static const char * -reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, - GLboolean relAddr, const struct gl_program *prog) -{ - static char str[100]; - const char *addr = relAddr ? "ADDR+" : ""; - - str[0] = 0; - - switch (mode) { - case PROG_PRINT_DEBUG: - sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); - break; - case PROG_PRINT_ARB: -#if 0 - switch (f) { - case PROGRAM_INPUT: - sprintf(str, "%s", arb_input_attrib_string(index, prog->Target)); - break; - case PROGRAM_OUTPUT: - sprintf(str, "%s", arb_output_attrib_string(index, prog->Target)); - break; - case PROGRAM_TEMPORARY: - sprintf(str, "temp%d", index); - break; - case PROGRAM_ENV_PARAM: - sprintf(str, "program.env[%s%d]", addr, index); - break; - case PROGRAM_LOCAL_PARAM: - sprintf(str, "program.local[%s%d]", addr, index); - break; - case PROGRAM_VARYING: /* extension */ - sprintf(str, "varying[%s%d]", addr, index); - break; - case PROGRAM_CONSTANT: /* extension */ - sprintf(str, "constant[%s%d]", addr, index); - break; - case PROGRAM_UNIFORM: /* extension */ - sprintf(str, "uniform[%s%d]", addr, index); - break; - case PROGRAM_STATE_VAR: - { - struct gl_program_parameter *param - = prog->Parameters->Parameters + index; - char *state = _mesa_program_state_string(param->StateIndexes); - sprintf(str, "%s", state); - free(state); - } - break; - case PROGRAM_ADDRESS: - sprintf(str, "A%d", index); - break; - default: - _mesa_problem(NULL, "bad file in reg_string()"); - } - break; -#else - assert(0); - break; -#endif - - case PROG_PRINT_NV: - switch (f) { - case PROGRAM_INPUT: - if (prog->Target == GL_VERTEX_PROGRAM_ARB) - sprintf(str, "v[%d]", index); - else - sprintf(str, "f[%d]", index); - break; - case PROGRAM_OUTPUT: - sprintf(str, "o[%d]", index); - break; - case PROGRAM_TEMPORARY: - sprintf(str, "R%d", index); - break; - case PROGRAM_ENV_PARAM: - sprintf(str, "c[%d]", index); - break; - case PROGRAM_VARYING: /* extension */ - sprintf(str, "varying[%s%d]", addr, index); - break; - case PROGRAM_UNIFORM: /* extension */ - sprintf(str, "uniform[%s%d]", addr, index); - break; - case PROGRAM_CONSTANT: /* extension */ - sprintf(str, "constant[%s%d]", addr, index); - break; - case PROGRAM_STATE_VAR: /* extension */ - sprintf(str, "state[%s%d]", addr, index); - break; - default: - _mesa_problem(NULL, "bad file in reg_string()"); - } - break; - - default: - _mesa_problem(NULL, "bad mode in reg_string()"); - } - - return str; -} - - -/** - * Return a string representation of the given swizzle word. - * If extended is true, use extended (comma-separated) format. - * \param swizzle the swizzle field - * \param negateBase 4-bit negation vector - * \param extended if true, also allow 0, 1 values - */ -const char * -_mesa_swizzle_string(GLuint swizzle, GLuint negateMask, GLboolean extended) -{ - static const char swz[] = "xyzw01!?"; /* See SWIZZLE_x definitions */ - static char s[20]; - GLuint i = 0; - - if (!extended && swizzle == SWIZZLE_NOOP && negateMask == 0) - return ""; /* no swizzle/negation */ - - if (!extended) - s[i++] = '.'; - - if (negateMask & NEGATE_X) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 0)]; - - if (extended) { - s[i++] = ','; - } - - if (negateMask & NEGATE_Y) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 1)]; - - if (extended) { - s[i++] = ','; - } - - if (negateMask & NEGATE_Z) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 2)]; - - if (extended) { - s[i++] = ','; - } - - if (negateMask & NEGATE_W) - s[i++] = '-'; - s[i++] = swz[GET_SWZ(swizzle, 3)]; - - s[i] = 0; - return s; -} - - -void -_mesa_print_swizzle(GLuint swizzle) -{ - if (swizzle == SWIZZLE_XYZW) { - printf(".xyzw\n"); - } - else { - const char *s = _mesa_swizzle_string(swizzle, 0, 0); - printf("%s\n", s); - } -} - - -const char * -_mesa_writemask_string(GLuint writeMask) -{ - static char s[10]; - GLuint i = 0; - - if (writeMask == WRITEMASK_XYZW) - return ""; - - s[i++] = '.'; - if (writeMask & WRITEMASK_X) - s[i++] = 'x'; - if (writeMask & WRITEMASK_Y) - s[i++] = 'y'; - if (writeMask & WRITEMASK_Z) - s[i++] = 'z'; - if (writeMask & WRITEMASK_W) - s[i++] = 'w'; - - s[i] = 0; - return s; -} - - -const char * -_mesa_condcode_string(GLuint condcode) -{ - switch (condcode) { - case COND_GT: return "GT"; - case COND_EQ: return "EQ"; - case COND_LT: return "LT"; - case COND_UN: return "UN"; - case COND_GE: return "GE"; - case COND_LE: return "LE"; - case COND_NE: return "NE"; - case COND_TR: return "TR"; - case COND_FL: return "FL"; - default: return "cond???"; - } -} - - -static void -fprint_dst_reg(FILE * f, - const struct prog_dst_register *dstReg, - gl_prog_print_mode mode, - const struct gl_program *prog) -{ - fprintf(f, "%s%s", - reg_string((gl_register_file) dstReg->File, - dstReg->Index, mode, dstReg->RelAddr, prog), - _mesa_writemask_string(dstReg->WriteMask)); - - if (dstReg->CondMask != COND_TR) { - fprintf(f, " (%s.%s)", - _mesa_condcode_string(dstReg->CondMask), - _mesa_swizzle_string(dstReg->CondSwizzle, - GL_FALSE, GL_FALSE)); - } - -#if 0 - fprintf(f, "%s[%d]%s", - file_string((gl_register_file) dstReg->File, mode), - dstReg->Index, - _mesa_writemask_string(dstReg->WriteMask)); -#endif -} - - -static void -fprint_src_reg(FILE *f, - const struct prog_src_register *srcReg, - gl_prog_print_mode mode, - const struct gl_program *prog) -{ - const char *abs = srcReg->Abs ? "|" : ""; - - fprintf(f, "%s%s%s%s", - abs, - reg_string((gl_register_file) srcReg->File, - srcReg->Index, mode, srcReg->RelAddr, prog), - _mesa_swizzle_string(srcReg->Swizzle, - srcReg->Negate, GL_FALSE), - abs); -#if 0 - fprintf(f, "%s[%d]%s", - file_string((gl_register_file) srcReg->File, mode), - srcReg->Index, - _mesa_swizzle_string(srcReg->Swizzle, - srcReg->Negate, GL_FALSE)); -#endif -} - - -static void -fprint_comment(FILE *f, const struct prog_instruction *inst) -{ - if (inst->Comment) - fprintf(f, "; # %s\n", inst->Comment); - else - fprintf(f, ";\n"); -} - - -static void -fprint_alu_instruction(FILE *f, - const struct prog_instruction *inst, - const char *opcode_string, GLuint numRegs, - gl_prog_print_mode mode, - const struct gl_program *prog) -{ - GLuint j; - - fprintf(f, "%s", opcode_string); - if (inst->CondUpdate) - fprintf(f, ".C"); - - /* frag prog only */ - if (inst->SaturateMode == SATURATE_ZERO_ONE) - fprintf(f, "_SAT"); - - fprintf(f, " "); - if (inst->DstReg.File != PROGRAM_UNDEFINED) { - fprint_dst_reg(f, &inst->DstReg, mode, prog); - } - else { - fprintf(f, " ???"); - } - - if (numRegs > 0) - fprintf(f, ", "); - - for (j = 0; j < numRegs; j++) { - fprint_src_reg(f, inst->SrcReg + j, mode, prog); - if (j + 1 < numRegs) - fprintf(f, ", "); - } - - fprint_comment(f, inst); -} - - -void -_mesa_print_alu_instruction(const struct prog_instruction *inst, - const char *opcode_string, GLuint numRegs) -{ - fprint_alu_instruction(stderr, inst, opcode_string, - numRegs, PROG_PRINT_DEBUG, NULL); -} - - -/** - * Print a single vertex/fragment program instruction. - */ -GLint -_mesa_fprint_instruction_opt(FILE *f, - const struct prog_instruction *inst, - GLint indent, - gl_prog_print_mode mode, - const struct gl_program *prog) -{ - GLint i; - - if (inst->Opcode == OPCODE_ELSE || - inst->Opcode == OPCODE_ENDIF || - inst->Opcode == OPCODE_ENDLOOP || - inst->Opcode == OPCODE_ENDSUB) { - indent -= 3; - } - for (i = 0; i < indent; i++) { - fprintf(f, " "); - } - - switch (inst->Opcode) { - case OPCODE_PRINT: - fprintf(f, "PRINT '%s'", (char *) inst->Data); - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - fprintf(f, ", "); - fprintf(f, "%s[%d]%s", - file_string((gl_register_file) inst->SrcReg[0].File, - mode), - inst->SrcReg[0].Index, - _mesa_swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].Negate, GL_FALSE)); - } - if (inst->Comment) - fprintf(f, " # %s", inst->Comment); - fprint_comment(f, inst); - break; - case OPCODE_SWZ: - fprintf(f, "SWZ"); - if (inst->SaturateMode == SATURATE_ZERO_ONE) - fprintf(f, "_SAT"); - fprintf(f, " "); - fprint_dst_reg(f, &inst->DstReg, mode, prog); - fprintf(f, ", %s[%d], %s", - file_string((gl_register_file) inst->SrcReg[0].File, - mode), - inst->SrcReg[0].Index, - _mesa_swizzle_string(inst->SrcReg[0].Swizzle, - inst->SrcReg[0].Negate, GL_TRUE)); - fprint_comment(f, inst); - break; - case OPCODE_TEX: - case OPCODE_TXP: - case OPCODE_TXL: - case OPCODE_TXB: - fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); - if (inst->SaturateMode == SATURATE_ZERO_ONE) - fprintf(f, "_SAT"); - fprintf(f, " "); - fprint_dst_reg(f, &inst->DstReg, mode, prog); - fprintf(f, ", "); - fprint_src_reg(f, &inst->SrcReg[0], mode, prog); - fprintf(f, ", texture[%d], ", inst->TexSrcUnit); - switch (inst->TexSrcTarget) { - case TEXTURE_1D_INDEX: fprintf(f, "1D"); break; - case TEXTURE_2D_INDEX: fprintf(f, "2D"); break; - case TEXTURE_3D_INDEX: fprintf(f, "3D"); break; - case TEXTURE_CUBE_INDEX: fprintf(f, "CUBE"); break; - case TEXTURE_RECT_INDEX: fprintf(f, "RECT"); break; - case TEXTURE_1D_ARRAY_INDEX: fprintf(f, "1D_ARRAY"); break; - case TEXTURE_2D_ARRAY_INDEX: fprintf(f, "2D_ARRAY"); break; - default: - ; - } - if (inst->TexShadow) - fprintf(f, " SHADOW"); - fprint_comment(f, inst); - break; - - case OPCODE_KIL: - fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); - fprintf(f, " "); - fprint_src_reg(f, &inst->SrcReg[0], mode, prog); - fprint_comment(f, inst); - break; - case OPCODE_KIL_NV: - fprintf(f, "%s", _mesa_opcode_string(inst->Opcode)); - fprintf(f, " "); - fprintf(f, "%s.%s", - _mesa_condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, - GL_FALSE, GL_FALSE)); - fprint_comment(f, inst); - break; - - case OPCODE_ARL: - fprintf(f, "ARL "); - fprint_dst_reg(f, &inst->DstReg, mode, prog); - fprintf(f, ", "); - fprint_src_reg(f, &inst->SrcReg[0], mode, prog); - fprint_comment(f, inst); - break; - case OPCODE_BRA: - fprintf(f, "BRA %d (%s%s)", - inst->BranchTarget, - _mesa_condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE)); - fprint_comment(f, inst); - break; - case OPCODE_IF: - if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { - /* Use ordinary register */ - fprintf(f, "IF "); - fprint_src_reg(f, &inst->SrcReg[0], mode, prog); - fprintf(f, "; "); - } - else { - /* Use cond codes */ - fprintf(f, "IF (%s%s);", - _mesa_condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, - 0, GL_FALSE)); - } - fprintf(f, " # (if false, goto %d)", inst->BranchTarget); - fprint_comment(f, inst); - return indent + 3; - case OPCODE_ELSE: - fprintf(f, "ELSE; # (goto %d)\n", inst->BranchTarget); - return indent + 3; - case OPCODE_ENDIF: - fprintf(f, "ENDIF;\n"); - break; - case OPCODE_BGNLOOP: - fprintf(f, "BGNLOOP; # (end at %d)\n", inst->BranchTarget); - return indent + 3; - case OPCODE_ENDLOOP: - fprintf(f, "ENDLOOP; # (goto %d)\n", inst->BranchTarget); - break; - case OPCODE_BRK: - case OPCODE_CONT: - fprintf(f, "%s (%s%s); # (goto %d)", - _mesa_opcode_string(inst->Opcode), - _mesa_condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE), - inst->BranchTarget); - fprint_comment(f, inst); - break; - - case OPCODE_BGNSUB: - if (mode == PROG_PRINT_NV) { - fprintf(f, "%s:\n", inst->Comment); /* comment is label */ - return indent; - } - else { - fprintf(f, "BGNSUB"); - fprint_comment(f, inst); - return indent + 3; - } - case OPCODE_ENDSUB: - if (mode == PROG_PRINT_DEBUG) { - fprintf(f, "ENDSUB"); - fprint_comment(f, inst); - } - break; - case OPCODE_CAL: - if (mode == PROG_PRINT_NV) { - fprintf(f, "CAL %s; # (goto %d)\n", inst->Comment, inst->BranchTarget); - } - else { - fprintf(f, "CAL %u", inst->BranchTarget); - fprint_comment(f, inst); - } - break; - case OPCODE_RET: - fprintf(f, "RET (%s%s)", - _mesa_condcode_string(inst->DstReg.CondMask), - _mesa_swizzle_string(inst->DstReg.CondSwizzle, 0, GL_FALSE)); - fprint_comment(f, inst); - break; - - case OPCODE_END: - fprintf(f, "END\n"); - break; - case OPCODE_NOP: - if (mode == PROG_PRINT_DEBUG) { - fprintf(f, "NOP"); - fprint_comment(f, inst); - } - else if (inst->Comment) { - /* ARB/NV extensions don't have NOP instruction */ - fprintf(f, "# %s\n", inst->Comment); - } - break; - /* XXX may need other special-case instructions */ - default: - if (inst->Opcode < MAX_OPCODE) { - /* typical alu instruction */ - fprint_alu_instruction(f, inst, - _mesa_opcode_string(inst->Opcode), - _mesa_num_inst_src_regs(inst->Opcode), - mode, prog); - } - else { - fprint_alu_instruction(f, inst, - _mesa_opcode_string(inst->Opcode), - 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, - mode, prog); - } - break; - } - return indent; -} - - -GLint -_mesa_print_instruction_opt(const struct prog_instruction *inst, - GLint indent, - gl_prog_print_mode mode, - const struct gl_program *prog) -{ - return _mesa_fprint_instruction_opt(stderr, inst, indent, mode, prog); -} - - -void -_mesa_print_instruction(const struct prog_instruction *inst) -{ - /* note: 4th param should be ignored for PROG_PRINT_DEBUG */ - _mesa_fprint_instruction_opt(stdout, inst, 0, PROG_PRINT_DEBUG, NULL); -} - -#if 0 -/** - * Print program, with options. - */ -void -_mesa_fprint_program_opt(FILE *f, - const struct gl_program *prog, - gl_prog_print_mode mode, - GLboolean lineNumbers) -{ - GLuint i, indent = 0; - - switch (prog->Target) { - case GL_VERTEX_PROGRAM_ARB: - if (mode == PROG_PRINT_ARB) - fprintf(f, "!!ARBvp1.0\n"); - else if (mode == PROG_PRINT_NV) - fprintf(f, "!!VP1.0\n"); - else - fprintf(f, "# Vertex Program/Shader %u\n", prog->Id); - break; - case GL_FRAGMENT_PROGRAM_ARB: - case GL_FRAGMENT_PROGRAM_NV: - if (mode == PROG_PRINT_ARB) - fprintf(f, "!!ARBfp1.0\n"); - else if (mode == PROG_PRINT_NV) - fprintf(f, "!!FP1.0\n"); - else - fprintf(f, "# Fragment Program/Shader %u\n", prog->Id); - break; - } - - for (i = 0; i < prog->NumInstructions; i++) { - if (lineNumbers) - fprintf(f, "%3d: ", i); - indent = _mesa_fprint_instruction_opt(f, prog->Instructions + i, - indent, mode, prog); - } -} - - -/** - * Print program to stderr, default options. - */ -void -_mesa_print_program(const struct gl_program *prog) -{ - _mesa_fprint_program_opt(stderr, prog, PROG_PRINT_DEBUG, GL_TRUE); -} - -/** - * Return binary representation of 64-bit value (as a string). - * Insert a comma to separate each group of 8 bits. - * Note we return a pointer to local static storage so this is not - * re-entrant, etc. - * XXX move to imports.[ch] if useful elsewhere. - */ -static const char * -binary(GLbitfield64 val) -{ - static char buf[80]; - GLint i, len = 0; - for (i = 63; i >= 0; --i) { - if (val & (1ULL << i)) - buf[len++] = '1'; - else if (len > 0 || i == 0) - buf[len++] = '0'; - if (len > 0 && ((i-1) % 8) == 7) - buf[len++] = ','; - } - buf[len] = '\0'; - return buf; -} - - -/** - * Print all of a program's parameters/fields to given file. - */ -static void -_mesa_fprint_program_parameters(FILE *f, - GLcontext *ctx, - const struct gl_program *prog) -{ - GLuint i; - - fprintf(f, "InputsRead: 0x%x (0b%s)\n", - prog->InputsRead, binary(prog->InputsRead)); - fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n", - prog->OutputsWritten, binary(prog->OutputsWritten)); - fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); - fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries); - fprintf(f, "NumParameters=%d\n", prog->NumParameters); - fprintf(f, "NumAttributes=%d\n", prog->NumAttributes); - fprintf(f, "NumAddressRegs=%d\n", prog->NumAddressRegs); - fprintf(f, "SamplersUsed: 0x%x (0b%s)\n", - prog->SamplersUsed, binary(prog->SamplersUsed)); - fprintf(f, "Samplers=[ "); - for (i = 0; i < MAX_SAMPLERS; i++) { - fprintf(f, "%d ", prog->SamplerUnits[i]); - } - fprintf(f, "]\n"); - - _mesa_load_state_parameters(ctx, prog->Parameters); - -#if 0 - fprintf(f, "Local Params:\n"); - for (i = 0; i < MAX_PROGRAM_LOCAL_PARAMS; i++){ - const GLfloat *p = prog->LocalParams[i]; - fprintf(f, "%2d: %f, %f, %f, %f\n", i, p[0], p[1], p[2], p[3]); - } -#endif - _mesa_print_parameter_list(prog->Parameters); -} - - -/** - * Print all of a program's parameters/fields to stderr. - */ -void -_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) -{ - _mesa_fprint_program_parameters(stderr, ctx, prog); -} - - -/** - * Print a program parameter list to given file. - */ -static void -_mesa_fprint_parameter_list(FILE *f, - const struct gl_program_parameter_list *list) -{ - const gl_prog_print_mode mode = PROG_PRINT_DEBUG; - GLuint i; - - if (!list) - return; - - if (0) - fprintf(f, "param list %p\n", (void *) list); - fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags); - for (i = 0; i < list->NumParameters; i++){ - struct gl_program_parameter *param = list->Parameters + i; - const GLfloat *v = list->ParameterValues[i]; - fprintf(f, "param[%d] sz=%d %s %s = {%.3g, %.3g, %.3g, %.3g}", - i, param->Size, - file_string(list->Parameters[i].Type, mode), - param->Name, v[0], v[1], v[2], v[3]); - if (param->Flags & PROG_PARAM_BIT_CENTROID) - fprintf(f, " Centroid"); - if (param->Flags & PROG_PARAM_BIT_INVARIANT) - fprintf(f, " Invariant"); - if (param->Flags & PROG_PARAM_BIT_FLAT) - fprintf(f, " Flat"); - if (param->Flags & PROG_PARAM_BIT_LINEAR) - fprintf(f, " Linear"); - fprintf(f, "\n"); - } -} - - -/** - * Print a program parameter list to stderr. - */ -void -_mesa_print_parameter_list(const struct gl_program_parameter_list *list) -{ - _mesa_fprint_parameter_list(stderr, list); -} - - -/** - * Write shader and associated info to a file. - */ -void -_mesa_write_shader_to_file(const struct gl_shader *shader) -{ - const char *type; - char filename[100]; - FILE *f; - - if (shader->Type == GL_FRAGMENT_SHADER) - type = "frag"; - else - type = "vert"; - - snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); - f = fopen(filename, "w"); - if (!f) { - fprintf(stderr, "Unable to open %s for writing\n", filename); - return; - } - - fprintf(f, "/* Shader %u source, checksum %u */\n", shader->Name, shader->SourceChecksum); - fputs(shader->Source, f); - fprintf(f, "\n"); - - fprintf(f, "/* Compile status: %s */\n", - shader->CompileStatus ? "ok" : "fail"); - if (!shader->CompileStatus) { - fprintf(f, "/* Log Info: */\n"); - fputs(shader->InfoLog, f); - } - else { - fprintf(f, "/* GPU code */\n"); - fprintf(f, "/*\n"); - _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE); - fprintf(f, "*/\n"); - fprintf(f, "/* Parameters / constants */\n"); - fprintf(f, "/*\n"); - _mesa_fprint_parameter_list(f, shader->Program->Parameters); - fprintf(f, "*/\n"); - } - - fclose(f); -} - - -/** - * Append the shader's uniform info/values to the shader log file. - * The log file will typically have been created by the - * _mesa_write_shader_to_file function. - */ -void -_mesa_append_uniforms_to_file(const struct gl_shader *shader, - const struct gl_program *prog) -{ - const char *type; - char filename[100]; - FILE *f; - - if (shader->Type == GL_FRAGMENT_SHADER) - type = "frag"; - else - type = "vert"; - - snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); - f = fopen(filename, "a"); /* append */ - if (!f) { - fprintf(stderr, "Unable to open %s for appending\n", filename); - return; - } - - fprintf(f, "/* First-draw parameters / constants */\n"); - fprintf(f, "/*\n"); - _mesa_fprint_parameter_list(f, prog->Parameters); - fprintf(f, "*/\n"); - - fclose(f); -} -#endif diff --git a/src/glsl/mesa/shader/prog_print.h b/src/glsl/mesa/shader/prog_print.h deleted file mode 100644 index f0df77b512..0000000000 --- a/src/glsl/mesa/shader/prog_print.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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. - */ - - -#ifndef PROG_PRINT_H -#define PROG_PRINT_H - - -/** - * The output style to use when printing programs. - */ -typedef enum { - PROG_PRINT_ARB, - PROG_PRINT_NV, - PROG_PRINT_DEBUG -} gl_prog_print_mode; - - -extern void -_mesa_print_vp_inputs(GLbitfield inputs); - -extern void -_mesa_print_fp_inputs(GLbitfield inputs); - -extern const char * -_mesa_condcode_string(GLuint condcode); - -extern const char * -_mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended); - -const char * -_mesa_writemask_string(GLuint writeMask); - -extern void -_mesa_print_swizzle(GLuint swizzle); - -extern void -_mesa_print_alu_instruction(const struct prog_instruction *inst, - const char *opcode_string, GLuint numRegs); - -extern void -_mesa_print_instruction(const struct prog_instruction *inst); - -extern GLint -_mesa_fprint_instruction_opt(FILE *f, - const struct prog_instruction *inst, - GLint indent, - gl_prog_print_mode mode, - const struct gl_program *prog); - -extern GLint -_mesa_print_instruction_opt(const struct prog_instruction *inst, GLint indent, - gl_prog_print_mode mode, - const struct gl_program *prog); - -extern void -_mesa_print_program(const struct gl_program *prog); - -extern void -_mesa_fprint_program_opt(FILE *f, - const struct gl_program *prog, gl_prog_print_mode mode, - GLboolean lineNumbers); - -#if 0 -extern void -_mesa_print_parameter_list(const struct gl_program_parameter_list *list); - -extern void -_mesa_write_shader_to_file(const struct gl_shader *shader); - -extern void -_mesa_append_uniforms_to_file(const struct gl_shader *shader, - const struct gl_program *prog); -#endif - - -#endif /* PROG_PRINT_H */ diff --git a/src/glsl/symbol_table.c b/src/glsl/symbol_table.c deleted file mode 100644 index 0f0df7a261..0000000000 --- a/src/glsl/symbol_table.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright © 2008 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 "main/imports.h" -#include "symbol_table.h" -#include "hash_table.h" - -struct symbol { - /** - * Link to the next symbol in the table with the same name - * - * The linked list of symbols with the same name is ordered by scope - * from inner-most to outer-most. - */ - struct symbol *next_with_same_name; - - - /** - * Link to the next symbol in the table with the same scope - * - * The linked list of symbols with the same scope is unordered. Symbols - * in this list my have unique names. - */ - struct symbol *next_with_same_scope; - - - /** - * Header information for the list of symbols with the same name. - */ - struct symbol_header *hdr; - - - /** - * Name space of the symbol - * - * Name space are arbitrary user assigned integers. No two symbols can - * exist in the same name space at the same scope level. - */ - int name_space; - - - /** - * Arbitrary user supplied data. - */ - void *data; - - /** Scope depth where this symbol was defined. */ - unsigned depth; -}; - - -/** - */ -struct symbol_header { - /** Linkage in list of all headers in a given symbol table. */ - struct symbol_header *next; - - /** Symbol name. */ - const char *name; - - /** Linked list of symbols with the same name. */ - struct symbol *symbols; -}; - - -/** - * Element of the scope stack. - */ -struct scope_level { - /** Link to next (inner) scope level. */ - struct scope_level *next; - - /** Linked list of symbols with the same scope. */ - struct symbol *symbols; -}; - - -/** - * - */ -struct _mesa_symbol_table { - /** Hash table containing all symbols in the symbol table. */ - struct hash_table *ht; - - /** Top of scope stack. */ - struct scope_level *current_scope; - - /** List of all symbol headers in the table. */ - struct symbol_header *hdr; - - /** Current scope depth. */ - unsigned depth; -}; - - -struct _mesa_symbol_table_iterator { - /** - * Name space of symbols returned by this iterator. - */ - int name_space; - - - /** - * Currently iterated symbol - * - * The next call to \c _mesa_symbol_table_iterator_get will return this - * value. It will also update this value to the value that should be - * returned by the next call. - */ - struct symbol *curr; -}; - - -static void -check_symbol_table(struct _mesa_symbol_table *table) -{ -#if 1 - struct scope_level *scope; - - for (scope = table->current_scope; scope != NULL; scope = scope->next) { - struct symbol *sym; - - for (sym = scope->symbols - ; sym != NULL - ; sym = sym->next_with_same_name) { - const struct symbol_header *const hdr = sym->hdr; - struct symbol *sym2; - - for (sym2 = hdr->symbols - ; sym2 != NULL - ; sym2 = sym2->next_with_same_name) { - assert(sym2->hdr == hdr); - } - } - } -#endif -} - -void -_mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table) -{ - struct scope_level *const scope = table->current_scope; - struct symbol *sym = scope->symbols; - - table->current_scope = scope->next; - table->depth--; - - free(scope); - - while (sym != NULL) { - struct symbol *const next = sym->next_with_same_scope; - struct symbol_header *const hdr = sym->hdr; - - assert(hdr->symbols == sym); - - hdr->symbols = sym->next_with_same_name; - - free(sym); - - sym = next; - } - - check_symbol_table(table); -} - - -void -_mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) -{ - struct scope_level *const scope = calloc(1, sizeof(*scope)); - - scope->next = table->current_scope; - table->current_scope = scope; - table->depth++; -} - - -static struct symbol_header * -find_symbol(struct _mesa_symbol_table *table, const char *name) -{ - return (struct symbol_header *) hash_table_find(table->ht, name); -} - - -struct _mesa_symbol_table_iterator * -_mesa_symbol_table_iterator_ctor(struct _mesa_symbol_table *table, - int name_space, const char *name) -{ - struct _mesa_symbol_table_iterator *iter = calloc(1, sizeof(*iter)); - struct symbol_header *const hdr = find_symbol(table, name); - - iter->name_space = name_space; - - if (hdr != NULL) { - struct symbol *sym; - - for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { - assert(sym->hdr == hdr); - - if ((name_space == -1) || (sym->name_space == name_space)) { - iter->curr = sym; - break; - } - } - } - - return iter; -} - - -void -_mesa_symbol_table_iterator_dtor(struct _mesa_symbol_table_iterator *iter) -{ - free(iter); -} - - -void * -_mesa_symbol_table_iterator_get(struct _mesa_symbol_table_iterator *iter) -{ - return (iter->curr == NULL) ? NULL : iter->curr->data; -} - - -int -_mesa_symbol_table_iterator_next(struct _mesa_symbol_table_iterator *iter) -{ - struct symbol_header *hdr; - - if (iter->curr == NULL) { - return 0; - } - - hdr = iter->curr->hdr; - iter->curr = iter->curr->next_with_same_name; - - while (iter->curr != NULL) { - assert(iter->curr->hdr == hdr); - - if ((iter->name_space == -1) - || (iter->curr->name_space == iter->name_space)) { - return 1; - } - - iter->curr = iter->curr->next_with_same_name; - } - - return 0; -} - - -/** - * Determine the scope "distance" of a symbol from the current scope - * - * \return - * A non-negative number for the number of scopes between the current scope - * and the scope where a symbol was defined. A value of zero means the current - * scope. A negative number if the symbol does not exist. - */ -int -_mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, - int name_space, const char *name) -{ - struct symbol_header *const hdr = find_symbol(table, name); - struct symbol *sym; - - if (hdr != NULL) { - for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { - assert(sym->hdr == hdr); - - if ((name_space == -1) || (sym->name_space == name_space)) { - assert(sym->depth <= table->depth); - return sym->depth - table->depth; - } - } - } - - return -1; -} - - -void * -_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *table, - int name_space, const char *name) -{ - struct symbol_header *const hdr = find_symbol(table, name); - - if (hdr != NULL) { - struct symbol *sym; - - - for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { - assert(sym->hdr == hdr); - - if ((name_space == -1) || (sym->name_space == name_space)) { - return sym->data; - } - } - } - - return NULL; -} - - -int -_mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, - int name_space, const char *name, - void *declaration) -{ - struct symbol_header *hdr; - struct symbol *sym; - - check_symbol_table(table); - - hdr = find_symbol(table, name); - - check_symbol_table(table); - - if (hdr == NULL) { - hdr = calloc(1, sizeof(*hdr)); - hdr->name = name; - - hash_table_insert(table->ht, hdr, name); - hdr->next = table->hdr; - table->hdr = hdr; - } - - check_symbol_table(table); - - /* If the symbol already exists in this namespace at this scope, it cannot - * be added to the table. - */ - for (sym = hdr->symbols - ; (sym != NULL) && (sym->name_space != name_space) - ; sym = sym->next_with_same_name) { - /* empty */ - } - - if (sym && (sym->depth == table->depth)) - return -1; - - sym = calloc(1, sizeof(*sym)); - sym->next_with_same_name = hdr->symbols; - sym->next_with_same_scope = table->current_scope->symbols; - sym->hdr = hdr; - sym->name_space = name_space; - sym->data = declaration; - sym->depth = table->depth; - - assert(sym->hdr == hdr); - - hdr->symbols = sym; - table->current_scope->symbols = sym; - - check_symbol_table(table); - return 0; -} - - -struct _mesa_symbol_table * -_mesa_symbol_table_ctor(void) -{ - struct _mesa_symbol_table *table = calloc(1, sizeof(*table)); - - if (table != NULL) { - table->ht = hash_table_ctor(32, hash_table_string_hash, - hash_table_string_compare); - - _mesa_symbol_table_push_scope(table); - } - - return table; -} - - -void -_mesa_symbol_table_dtor(struct _mesa_symbol_table *table) -{ - struct symbol_header *hdr; - struct symbol_header *next; - - while (table->current_scope != NULL) { - _mesa_symbol_table_pop_scope(table); - } - - for (hdr = table->hdr; hdr != NULL; hdr = next) { - next = hdr->next; - _mesa_free(hdr); - } - - hash_table_dtor(table->ht); - free(table); -} diff --git a/src/glsl/symbol_table.h b/src/glsl/symbol_table.h deleted file mode 100644 index 3a9994c1ac..0000000000 --- a/src/glsl/symbol_table.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2008 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. - */ -#ifndef MESA_SYMBOL_TABLE_H -#define MESA_SYMBOL_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct _mesa_symbol_table; -struct _mesa_symbol_table_iterator; - -extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table); - -extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table); - -extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab, - int name_space, const char *name, void *declaration); - -extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, - int name_space, const char *name); - -extern void *_mesa_symbol_table_find_symbol( - struct _mesa_symbol_table *symtab, int name_space, const char *name); - -extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void); - -extern void _mesa_symbol_table_dtor(struct _mesa_symbol_table *); - -extern struct _mesa_symbol_table_iterator *_mesa_symbol_table_iterator_ctor( - struct _mesa_symbol_table *table, int name_space, const char *name); - -extern void _mesa_symbol_table_iterator_dtor( - struct _mesa_symbol_table_iterator *); - -extern void *_mesa_symbol_table_iterator_get( - struct _mesa_symbol_table_iterator *iter); - -extern int _mesa_symbol_table_iterator_next( - struct _mesa_symbol_table_iterator *iter); - -#ifdef __cplusplus -} -#endif - -#endif /* MESA_SYMBOL_TABLE_H */ -- cgit v1.2.3 From 3d6012303c3ce24c75d209267e6914f706d025c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Jun 2010 17:08:53 -0700 Subject: glsl2: Wrap includes of C interfaces with extern "C". --- src/glsl/ast_type.cpp | 2 ++ src/glsl/glsl_symbol_table.h | 2 ++ src/glsl/glsl_types.cpp | 3 ++- src/glsl/ir_clone.cpp | 2 ++ src/glsl/ir_function_inlining.cpp | 2 ++ src/glsl/ir_validate.cpp | 2 ++ src/glsl/linker.cpp | 2 ++ 7 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index cb0852bb77..49dfde20e9 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -23,7 +23,9 @@ #include #include "ast.h" +extern "C" { #include "symbol_table.h" +} void ast_type_specifier::print(void) const diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index ae2fd3f4f1..8fbc66c974 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -28,7 +28,9 @@ #include +extern "C" { #include "symbol_table.h" +} #include "ir.h" #include "glsl_types.h" diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index bef267fa6b..9a53fbdbcb 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -27,8 +27,9 @@ #include "glsl_parser_extras.h" #include "glsl_types.h" #include "builtin_types.h" +extern "C" { #include "hash_table.h" - +} hash_table *glsl_type::array_types = NULL; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 84176383fc..01a1ce3a6d 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -24,7 +24,9 @@ #include #include "ir.h" #include "glsl_types.h" +extern "C" { #include "hash_table.h" +} /** * Duplicate an IR variable diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index e55780c940..1adf67868e 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -33,7 +33,9 @@ #include "ir_function_inlining.h" #include "ir_expression_flattening.h" #include "glsl_types.h" +extern "C" { #include "hash_table.h" +} class ir_function_inlining_visitor : public ir_hierarchical_visitor { public: diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 507e88993f..1953852487 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -36,7 +36,9 @@ #include #include "ir.h" #include "ir_hierarchical_visitor.h" +extern "C" { #include "hash_table.h" +} static unsigned int hash_func(const void *key) { diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index ba382fe881..8547f74ce6 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -77,7 +77,9 @@ extern "C" { #include "ir.h" #include "ir_optimization.h" #include "program.h" +extern "C" { #include "hash_table.h" +} /** * Visitor that determines whether or not a variable is ever written. -- cgit v1.2.3 From 0a1b54df7ac118722bb627c61cb322cb4e248ace Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 21 Jun 2010 11:29:15 -0700 Subject: glsl2: Replace the GLSL compiler with the glsl2 project. --- configure.ac | 4 +- src/glsl/Makefile | 130 +++++++++++++++++++++++++++++++-- src/glsl/Makefile.am | 8 +- src/mesa/Makefile | 19 ++--- src/mesa/drivers/dri/Makefile.template | 4 +- src/mesa/shader/ir_to_mesa.cpp | 1 + src/mesa/shader/shader_api.c | 6 +- src/mesa/sources.mak | 21 ++++-- 8 files changed, 157 insertions(+), 36 deletions(-) (limited to 'src/glsl') diff --git a/configure.ac b/configure.ac index 21123ecccc..bf42992b2f 100644 --- a/configure.ac +++ b/configure.ac @@ -462,6 +462,8 @@ xxlib|xdri|xosmesa) ;; esac +PKG_CHECK_MODULES([TALLOC], [talloc]) + dnl dnl Driver specific build directories dnl @@ -852,7 +854,7 @@ if test "$mesa_driver" = dri; then [AC_MSG_ERROR([Expat required for DRI.])]) # put all the necessary libs together - DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" + DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS $TALLOC_LIBS" fi AC_SUBST([DRI_DIRS]) AC_SUBST([EXPAT_INCLUDES]) diff --git a/src/glsl/Makefile b/src/glsl/Makefile index ca7f2d2ac7..91e4d2e05d 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -1,15 +1,129 @@ -# src/glsl/Makefile +#src/glsl/pp/Makefile TOP = ../.. include $(TOP)/configs/current -SUBDIRS = pp cl apps +LIBNAME = glsl -default install clean: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) $@) || exit 1; \ - fi \ - done +C_SOURCES = \ + glcpp/glcpp.c \ + glcpp/glcpp-lex.c \ + glcpp/glcpp-parse.c \ + glcpp/pp.c \ + glcpp/xtalloc.c +CXX_SOURCES = \ + ast_expr.cpp \ + ast_function.cpp \ + ast_to_hir.cpp \ + ast_type.cpp \ + builtin_function.cpp \ + glsl_lexer.cpp \ + glsl_parser.cpp \ + glsl_parser_extras.cpp \ + glsl_types.cpp \ + hir_field_selection.cpp \ + ir_basic_block.cpp \ + ir_clone.cpp \ + ir_constant_expression.cpp \ + ir_constant_folding.cpp \ + ir_constant_variable.cpp \ + ir_copy_propagation.cpp \ + ir.cpp \ + ir_dead_code.cpp \ + ir_dead_code_local.cpp \ + ir_expression_flattening.cpp \ + ir_function_can_inline.cpp \ + ir_function.cpp \ + ir_function_inlining.cpp \ + ir_hierarchical_visitor.cpp \ + ir_hv_accept.cpp \ + ir_if_simplification.cpp \ + ir_print_visitor.cpp \ + ir_reader.cpp \ + ir_swizzle_swizzle.cpp \ + ir_validate.cpp \ + ir_variable.cpp \ + ir_vec_index_to_swizzle.cpp \ + linker.cpp \ + s_expression.cpp + +LIBS = \ + $(TOP)/src/glsl/libglsl.a \ + $(shell pkg-config --libs talloc) + +APPS = glsl_compiler +GLSL2_C_SOURCES = \ + ../mesa/shader/hash_table.c \ + ../mesa/shader/symbol_table.c +GLSL2_CXX_SOURCES = \ + main.cpp + +GLSL2_OBJECTS = \ + $(GLSL2_C_SOURCES:.c=.o) \ + $(GLSL2_CXX_SOURCES:.cpp=.o) + +### Basic defines ### + +OBJECTS = \ + $(C_SOURCES:.c=.o) \ + $(CXX_SOURCES:.cpp=.o) + +INCLUDES = \ + -I. \ + -I../mesa \ + -I../mapi \ + -I../mesa/shader \ + $(LIBRARY_INCLUDES) + + +##### TARGETS ##### + +default: depend lib$(LIBNAME).a $(APPS) + +lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template + $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) + +depend: $(CXX_SOURCES) $(GLSL2_CXX_SOURCES) $(GLSL2_C_SOURCES) + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $@ 2> /dev/null + +# Remove .o and backup files +clean: + rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak + -rm -f $(APPS) + +# Dummy target +install: + @echo -n "" + + +##### RULES ##### + +glsl_compiler: $(GLSL2_OBJECTS) libglsl.a + $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@ + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ + +glsl_lexer.cpp: glsl_lexer.lpp + flex --never-interactive --outfile="$@" $< + +glsl_parser.cpp: glsl_parser.ypp + bison -v -o "$@" --defines=glsl_parser.h $< + +glcpp/glcpp-lex.c: glcpp/glcpp-lex.l + flex --never-interactive --outfile="$@" $< + +glcpp/glcpp-parse.c: glcpp/glcpp-parse.y + bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< + +builtin_function.cpp: builtins/*/* + ./builtins/tools/generate_builtins.pl > builtin_function.cpp + +-include depend diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am index c34f7d8abf..5728a8b63d 100644 --- a/src/glsl/Makefile.am +++ b/src/glsl/Makefile.am @@ -32,7 +32,7 @@ glsl_LDFLAGS = @LDFLAGS@ $(talloc_LIBS) glsl_SOURCES = \ main.cpp \ builtin_types.h \ - symbol_table.c hash_table.c glsl_types.cpp \ + glsl_types.cpp \ glsl_parser.ypp glsl_lexer.lpp glsl_parser_extras.cpp \ ast_expr.cpp ast_to_hir.cpp ast_function.cpp ast_type.cpp \ ir.cpp hir_field_selection.cpp builtin_function.cpp \ @@ -62,11 +62,7 @@ glsl_SOURCES = \ ir_to_mesa.h \ ir_validate.cpp \ ir_vec_index_to_swizzle.cpp \ - linker.cpp \ - mesa/shader/prog_instruction.c \ - mesa/shader/prog_instruction.h \ - mesa/shader/prog_print.c \ - mesa/shader/prog_print.h + linker.cpp BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp CLEANFILES = $(BUILT_SOURCES) diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 4f81768924..84ced27953 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -35,16 +35,24 @@ MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) MESA_INCLUDES := $(INCLUDE_DIRS) ES1_INCLUDES := -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) ES2_INCLUDES := -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) - +MESA_INCLUDES := -I$(TOP)/src/glsl $(MESA_INCLUDES) define mesa-cc-c @mkdir -p $(dir $@) $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_INCLUDES) $(CFLAGS) endef +define mesa-cxx-c + @mkdir -p $(dir $@) + $(CXX) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_INCLUDES) $(CXXFLAGS) +endef + $(MESA_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,MESA) +$(MESA_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,MESA) + $(MESA_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,MESA) @@ -63,7 +71,7 @@ $(ES2_OBJ_DIR)/%.o: %.S # Default: build dependencies, then asm_subdirs, GLSL built-in lib, # then convenience libs (.a) and finally the device drivers: -default: $(DEPENDS) asm_subdirs glsl_builtin \ +default: $(DEPENDS) asm_subdirs \ $(MESA_LIBS) $(ES1_LIBS) $(ES2_LIBS) driver_subdirs main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py @@ -113,12 +121,6 @@ asm_subdirs: fi -###################################################################### -# GLSL built-in library -glsl_builtin: - (cd shader/slang/library && $(MAKE)) || exit 1 ; - - ###################################################################### # Dependency generation @@ -234,7 +236,6 @@ clean: clean-es1 clean-es2 -rm -f depend depend.bak libmesa.a libmesagallium.a -rm -f drivers/*/*.o -rm -f *.pc - -rm -f shader/slang/library/*_gc.h -@cd drivers/dri && $(MAKE) clean -@cd drivers/x11 && $(MAKE) clean -@cd drivers/osmesa && $(MAKE) clean diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 8cb25439e4..35daacfacd 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -54,9 +54,9 @@ lib: symlinks subdirs depend $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \ $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o - $(MKLIB) -o $@.tmp -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + $(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS) - $(CC) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) + $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) @rm -f $@.test mv -f $@.tmp $@ diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 26449c5a5c..9fc1268e5a 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -36,6 +36,7 @@ #include "glsl_types.h" extern "C" { +#include "main/mtypes.h" #include "shader/prog_instruction.h" #include "shader/prog_print.h" } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index c414e89825..a584f6072c 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -44,8 +44,6 @@ #include "shader/prog_uniform.h" #include "shader/shader_api.h" #include "shader/uniforms.h" -#include "shader/slang/slang_compile.h" -#include "shader/slang/slang_link.h" /** @@ -1100,7 +1098,7 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) /* this call will set the sh->CompileStatus field to indicate if * compilation was successful. */ - (void) _slang_compile(ctx, sh); + _mesa_glsl_compile_shader(ctx, sh); } @@ -1126,7 +1124,7 @@ _mesa_link_program(GLcontext *ctx, GLuint program) FLUSH_VERTICES(ctx, _NEW_PROGRAM); - _slang_link(ctx, program, shProg); + _mesa_glsl_link_shader(ctx, shProg); /* debug code */ if (0) { diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index ddd63cea0b..117b3f3d2b 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -250,6 +250,9 @@ SHADER_SOURCES = \ shader/shader_api.c \ shader/uniforms.c +SHADER_CXX_SOURCES = \ + shader/ir_to_mesa.cpp + SLANG_SOURCES = \ shader/slang/slang_builtin.c \ shader/slang/slang_codegen.c \ @@ -324,8 +327,10 @@ MESA_SOURCES = \ $(SWRAST_SOURCES) \ $(SWRAST_SETUP_SOURCES) \ $(COMMON_DRIVER_SOURCES)\ - $(ASM_C_SOURCES) \ - $(SLANG_SOURCES) + $(ASM_C_SOURCES) + +MESA_CXX_SOURCES = \ + $(SHADER_CXX_SOURCES) # Sources for building Gallium drivers MESA_GALLIUM_SOURCES = \ @@ -335,12 +340,15 @@ MESA_GALLIUM_SOURCES = \ $(STATETRACKER_SOURCES) \ $(SHADER_SOURCES) \ ppc/common_ppc.c \ - x86/common_x86.c \ - $(SLANG_SOURCES) + x86/common_x86.c + +MESA_GALLIUM_CXX_SOURCES = \ + $(SHADER_CXX_SOURCES) # All the core C sources, for dependency checking ALL_SOURCES = \ $(MESA_SOURCES) \ + $(MESA_CXX_SOURCES) \ $(MESA_ASM_SOURCES) \ $(STATETRACKER_SOURCES) @@ -349,10 +357,12 @@ ALL_SOURCES = \ MESA_OBJECTS = \ $(MESA_SOURCES:.c=.o) \ + $(MESA_CXX_SOURCES:.cpp=.o) \ $(MESA_ASM_SOURCES:.S=.o) MESA_GALLIUM_OBJECTS = \ $(MESA_GALLIUM_SOURCES:.c=.o) \ + $(MESA_GALLIUM_CXX_SOURCES:.cpp=.o) \ $(MESA_ASM_SOURCES:.S=.o) @@ -362,8 +372,7 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) ### Other archives/libraries GLSL_LIBS = \ - $(TOP)/src/glsl/pp/libglslpp.a \ - $(TOP)/src/glsl/cl/libglslcl.a + $(TOP)/src/glsl/libglsl.a ### Include directories -- cgit v1.2.3 From 2a3d46dd46779136e14c3e939a5b761c58576862 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 12:23:20 -0700 Subject: glsl2: Fix dependencies. (at least partially) --- src/glsl/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 91e4d2e05d..f4e32b9185 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -77,6 +77,11 @@ INCLUDES = \ -I../mesa/shader \ $(LIBRARY_INCLUDES) +ALL_SOURCES = \ + $(C_SOURCES) \ + $(CXX_SOURCES) \ + $(GLSL2_CXX_SOURCES) \ + $(GLSL2_C_SOURCES) ##### TARGETS ##### @@ -85,10 +90,10 @@ default: depend lib$(LIBNAME).a $(APPS) lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) -depend: $(CXX_SOURCES) $(GLSL2_CXX_SOURCES) $(GLSL2_C_SOURCES) +depend: $(ALL_SOURCES) Makefile rm -f depend touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $@ 2> /dev/null + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null # Remove .o and backup files clean: -- cgit v1.2.3 From 7f2bf62d25b2fdc059163ee046cf2fe007e5041e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 12:23:38 -0700 Subject: glsl2: Use Mesa types instead of duping them into our program.h. --- src/glsl/program.h | 80 ++---------------------------------------------------- 1 file changed, 2 insertions(+), 78 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/program.h b/src/glsl/program.h index d21b04344c..3c656e9e7c 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -23,6 +23,8 @@ #include #include "main/mtypes.h" +#include "shader/prog_parameter.h" +#include "shader/prog_uniform.h" /** * Based on gl_shader in Mesa's mtypes.h. @@ -41,84 +43,6 @@ struct glsl_shader { struct glsl_symbol_table *symbols; }; - -typedef int gl_state_index; -#define STATE_LENGTH 5 - -/** - * Program parameter. - * Used by shaders/programs for uniforms, constants, varying vars, etc. - */ -struct gl_program_parameter -{ - const char *Name; /**< Null-terminated string */ - gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ - GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - /** - * Number of components (1..4), or more. - * If the number of components is greater than 4, - * this parameter is part of a larger uniform like a GLSL matrix or array. - * The next program parameter's Size will be Size-4 of this parameter. - */ - GLuint Size; - GLboolean Used; /**< Helper flag for GLSL uniform tracking */ - GLboolean Initialized; /**< Has the ParameterValue[] been set? */ - GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ - /** - * A sequence of STATE_* tokens and integers to identify GL state. - */ - gl_state_index StateIndexes[STATE_LENGTH]; -}; - - -/** - * List of gl_program_parameter instances. - */ -struct gl_program_parameter_list -{ - GLuint Size; /**< allocated size of Parameters, ParameterValues */ - GLuint NumParameters; /**< number of parameters in arrays */ - struct gl_program_parameter *Parameters; /**< Array [Size] */ - GLfloat (*ParameterValues)[4]; /**< Array [Size] of GLfloat[4] */ - GLbitfield StateFlags; /**< _NEW_* flags indicating which state changes - might invalidate ParameterValues[] */ -}; - - -/** - * Shader program uniform variable. - * The glGetUniformLocation() and glUniform() commands will use this - * information. - * Note that a uniform such as "binormal" might be used in both the - * vertex shader and the fragment shader. When glUniform() is called to - * set the uniform's value, it must be updated in both the vertex and - * fragment shaders. The uniform may be in different locations in the - * two shaders so we keep track of that here. - */ -struct gl_uniform -{ - const char *Name; /**< Null-terminated string */ - GLint VertPos; - GLint FragPos; - GLboolean Initialized; /**< For debug. Has this uniform been set? */ -#if 0 - GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - GLuint Size; /**< Number of components (1..4) */ -#endif -}; - - -/** - * List of gl_uniforms - */ -struct gl_uniform_list -{ - GLuint Size; /**< allocated size of Uniforms array */ - GLuint NumUniforms; /**< number of uniforms in the array */ - struct gl_uniform *Uniforms; /**< Array [Size] */ -}; - - /** * Based on gl_shader_program in Mesa's mtypes.h. */ -- cgit v1.2.3 From 364fcd8ee1af39e215338fba59306a14dd81c2b2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 12:37:21 -0700 Subject: glsl2: Start integrating ir_to_mesa.cpp into shader_api.h The compiler is now called by the driver, and generates program instructions. Parameter lists are still not set up, so the driver chokes on it shortly thereafter. --- src/glsl/program.h | 4 + src/mesa/Makefile | 2 + src/mesa/shader/ir_to_mesa.cpp | 218 +++++++++++++++++++++++++++++++++++++---- src/mesa/shader/shader_api.h | 2 +- 4 files changed, 206 insertions(+), 20 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/program.h b/src/glsl/program.h index 3c656e9e7c..fd8197a45a 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -23,8 +23,11 @@ #include #include "main/mtypes.h" + +extern "C" { #include "shader/prog_parameter.h" #include "shader/prog_uniform.h" +} /** * Based on gl_shader in Mesa's mtypes.h. @@ -41,6 +44,7 @@ struct glsl_shader { struct exec_list ir; struct glsl_symbol_table *symbols; + struct gl_shader *mesa_shader; }; /** diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 84ced27953..e2eeb16c9a 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -36,6 +36,8 @@ MESA_INCLUDES := $(INCLUDE_DIRS) ES1_INCLUDES := -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) ES2_INCLUDES := -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) MESA_INCLUDES := -I$(TOP)/src/glsl $(MESA_INCLUDES) +# For symbol_table.h in glsl compiler headers. +MESA_INCLUDES := -I$(TOP)/src/mesa/shader $(MESA_INCLUDES) define mesa-cc-c @mkdir -p $(dir $@) diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 9fc1268e5a..02d3f7e2ee 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -34,11 +34,19 @@ #include "ir_print_visitor.h" #include "ir_expression_flattening.h" #include "glsl_types.h" +#include "glsl_parser_extras.h" +#include "../glsl/program.h" +#include "ir_optimization.h" +#include "ast.h" extern "C" { #include "main/mtypes.h" #include "shader/prog_instruction.h" #include "shader/prog_print.h" +#include "shader/program.h" +#include "shader/prog_uniform.h" +#include "shader/prog_parameter.h" +#include "shader/shader_api.h" } /** @@ -87,6 +95,9 @@ class ir_to_mesa_visitor : public ir_visitor { public: ir_to_mesa_visitor(); + GLcontext *ctx; + struct gl_program *prog; + int next_temp; int next_constant; int next_uniform; @@ -154,8 +165,7 @@ public: ir_to_mesa_dst_reg dst, ir_to_mesa_src_reg src0); - /* talloc context (the ) */ - void *ctx; + void *mem_ctx; }; ir_to_mesa_src_reg ir_to_mesa_undef = { @@ -240,7 +250,7 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, ir_to_mesa_src_reg src1, ir_to_mesa_src_reg src2) { - ir_to_mesa_instruction *inst = new(ctx) ir_to_mesa_instruction(); + ir_to_mesa_instruction *inst = new(mem_ctx) ir_to_mesa_instruction(); inst->op = op; inst->dst_reg = dst; @@ -770,8 +780,8 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) if (!entry) { switch (ir->var->mode) { case ir_var_uniform: - entry = new(ctx) temp_entry(ir->var, PROGRAM_UNIFORM, - this->next_uniform); + entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_UNIFORM, + this->next_uniform); this->variable_storage.push_tail(entry); this->next_uniform += type_size(ir->var->type); @@ -795,13 +805,13 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) ir->var->name); abort(); } - entry = new(ctx) temp_entry(ir->var, - builtin_var_to_mesa_reg[i].file, - builtin_var_to_mesa_reg[i].index); + entry = new(mem_ctx) temp_entry(ir->var, + builtin_var_to_mesa_reg[i].file, + builtin_var_to_mesa_reg[i].index); break; case ir_var_auto: - entry = new(ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, - this->next_temp); + entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_TEMPORARY, + this->next_temp); this->variable_storage.push_tail(entry); next_temp += type_size(ir->var->type); @@ -1162,17 +1172,37 @@ print_program(struct prog_instruction *mesa_instructions, } } -void -do_ir_to_mesa(exec_list *instructions) +struct gl_program * +get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) { ir_to_mesa_visitor v; struct prog_instruction *mesa_instructions, *mesa_inst; ir_instruction **mesa_instruction_annotation; int i; + exec_list *instructions = &shader->ir; + struct gl_program *prog; + GLenum target; + + switch (shader->Type) { + case GL_VERTEX_SHADER: target = GL_VERTEX_PROGRAM_ARB; break; + case GL_FRAGMENT_SHADER: target = GL_FRAGMENT_PROGRAM_ARB; break; + default: assert(!"should not be reached"); break; + } - v.ctx = talloc_new(NULL); + prog = ctx->Driver.NewProgram(ctx, target, 1); + if (!prog) + return NULL; + prog->Parameters = _mesa_new_parameter_list(); + prog->Varying = _mesa_new_parameter_list(); + prog->Attributes = _mesa_new_parameter_list(); + v.ctx = ctx; + v.prog = prog; + + v.mem_ctx = talloc_new(NULL); visit_exec_list(instructions, &v); + prog->NumTemporaries = v.next_temp; + int num_instructions = 0; foreach_iter(exec_list_iterator, iter, v.instructions) { num_instructions++; @@ -1181,9 +1211,8 @@ do_ir_to_mesa(exec_list *instructions) mesa_instructions = (struct prog_instruction *)calloc(num_instructions, sizeof(*mesa_instructions)); - mesa_instruction_annotation = - (ir_instruction **)calloc(num_instructions, - sizeof(*mesa_instruction_annotation)); + mesa_instruction_annotation = talloc_array(mem_ctx, ir_instruction *, + num_instructions); mesa_inst = mesa_instructions; i = 0; @@ -1205,8 +1234,159 @@ do_ir_to_mesa(exec_list *instructions) } set_branchtargets(mesa_instructions, num_instructions); - print_program(mesa_instructions, mesa_instruction_annotation, num_instructions); + if (0) { + print_program(mesa_instructions, mesa_instruction_annotation, + num_instructions); + } + + prog->Instructions = mesa_instructions; + prog->NumInstructions = num_instructions; + + _mesa_reference_program(ctx, &shader->mesa_shader->Program, prog); + + return prog; +} + +/* Takes a Mesa gl shader structure and compiles it, returning our Mesa-like + * structure with the IR and such attached. + */ +static struct glsl_shader * +_mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) +{ + struct glsl_shader *shader = talloc_zero(mem_ctx, struct glsl_shader); + struct _mesa_glsl_parse_state *state; + + shader->Type = sh->Type; + shader->Name = sh->Name; + shader->RefCount = 1; + shader->Source = sh->Source; + shader->SourceLen = strlen(sh->Source); + shader->mesa_shader = sh; + + state = talloc_zero(shader, struct _mesa_glsl_parse_state); + switch (shader->Type) { + case GL_VERTEX_SHADER: state->target = vertex_shader; break; + case GL_FRAGMENT_SHADER: state->target = fragment_shader; break; + case GL_GEOMETRY_SHADER: state->target = geometry_shader; break; + } + + state->scanner = NULL; + state->translation_unit.make_empty(); + state->symbols = new(mem_ctx) glsl_symbol_table; + state->info_log = talloc_strdup(shader, ""); + state->error = false; + state->temp_index = 0; + state->loop_or_switch_nesting = NULL; + state->ARB_texture_rectangle_enable = true; + + _mesa_glsl_lexer_ctor(state, shader->Source); + _mesa_glsl_parse(state); + _mesa_glsl_lexer_dtor(state); + + shader->ir.make_empty(); + if (!state->error && !state->translation_unit.is_empty()) + _mesa_ast_to_hir(&shader->ir, state); + + /* Optimization passes */ + if (!state->error && !shader->ir.is_empty()) { + bool progress; + do { + progress = false; + + progress = do_function_inlining(&shader->ir) || progress; + progress = do_if_simplification(&shader->ir) || progress; + progress = do_copy_propagation(&shader->ir) || progress; + progress = do_dead_code_local(&shader->ir) || progress; + progress = do_dead_code_unlinked(&shader->ir) || progress; + progress = do_constant_variable_unlinked(&shader->ir) || progress; + progress = do_constant_folding(&shader->ir) || progress; + progress = do_vec_index_to_swizzle(&shader->ir) || progress; + progress = do_swizzle_swizzle(&shader->ir) || progress; + } while (progress); + } + + shader->symbols = state->symbols; + + shader->CompileStatus = !state->error; + shader->InfoLog = state->info_log; - free(mesa_instruction_annotation); - talloc_free(v.ctx); + talloc_free(state); + + return shader; } + +extern "C" { + +void +_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh) +{ + struct glsl_shader *shader; + TALLOC_CTX *mem_ctx = talloc_new(NULL); + + shader = _mesa_get_glsl_shader(ctx, mem_ctx, sh); + + sh->CompileStatus = shader->CompileStatus; + sh->InfoLog = strdup(shader->InfoLog); + talloc_free(mem_ctx); + } + +void +_mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +{ + struct glsl_program *whole_program; + unsigned int i; + + _mesa_clear_shader_program_data(ctx, prog); + + whole_program = talloc_zero(NULL, struct glsl_program); + whole_program->LinkStatus = GL_TRUE; + whole_program->NumShaders = prog->NumShaders; + whole_program->Shaders = talloc_array(whole_program, struct glsl_shader *, + prog->NumShaders); + + for (i = 0; i < prog->NumShaders; i++) { + whole_program->Shaders[i] = _mesa_get_glsl_shader(ctx, whole_program, + prog->Shaders[i]); + if (!whole_program->Shaders[i]->CompileStatus) { + whole_program->InfoLog = + talloc_asprintf_append(whole_program->InfoLog, + "linking with uncompiled shader"); + whole_program->LinkStatus = GL_FALSE; + } + } + + prog->Uniforms = _mesa_new_uniform_list(); + prog->Varying = _mesa_new_parameter_list(); + _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL); + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); + + if (whole_program->LinkStatus) + link_shaders(whole_program); + + prog->LinkStatus = whole_program->LinkStatus; + + /* FINISHME: This should use the linker-generated code */ + if (prog->LinkStatus) { + for (i = 0; i < prog->NumShaders; i++) { + struct gl_program *linked_prog; + + linked_prog = get_mesa_program(ctx, whole_program, + whole_program->Shaders[i]); + + switch (whole_program->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + _mesa_reference_vertprog(ctx, &prog->VertexProgram, + (struct gl_vertex_program *)linked_prog); + break; + case GL_FRAGMENT_SHADER: + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, + (struct gl_fragment_program *)linked_prog); + break; + } + } + } + + talloc_free(whole_program); +} + +} /* extern "C" */ diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h index 9743a23ce6..557e910595 100644 --- a/src/mesa/shader/shader_api.h +++ b/src/mesa/shader/shader_api.h @@ -30,7 +30,7 @@ #include "main/glheader.h" #include "main/mtypes.h" - +#include "ir_to_mesa.h" /** * Internal functions -- cgit v1.2.3 From bda27424cf04c0d2ec2b49c56f562d5b2d2f0bff Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 13:38:38 -0700 Subject: glsl2: Use the parser state as the talloc context for dead code elimination. This cuts runtime by around 20% from talloc_parent() lookups. --- src/glsl/ir_dead_code.cpp | 15 +++++++++------ src/glsl/ir_optimization.h | 6 ++++-- src/glsl/main.cpp | 2 +- src/mesa/shader/ir_to_mesa.cpp | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 8821304682..51fa96df0c 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -71,6 +71,8 @@ public: /* List of variable_entry */ exec_list variable_list; + + void *mem_ctx; }; @@ -84,9 +86,7 @@ ir_dead_code_visitor::get_variable_entry(ir_variable *var) return entry; } - void *ctx = talloc_parent(var); - - variable_entry *entry = new(ctx) variable_entry(var); + variable_entry *entry = new(mem_ctx) variable_entry(var); this->variable_list.push_tail(entry); return entry; } @@ -147,11 +147,13 @@ ir_dead_code_visitor::visit_leave(ir_assignment *ir) * for usage on an unlinked instruction stream. */ bool -do_dead_code(exec_list *instructions) +do_dead_code(struct _mesa_glsl_parse_state *state, + exec_list *instructions) { ir_dead_code_visitor v; bool progress = false; + v.mem_ctx = state; v.run(instructions); foreach_iter(exec_list_iterator, iter, v.variable_list) { @@ -198,7 +200,8 @@ do_dead_code(exec_list *instructions) * with global scope. */ bool -do_dead_code_unlinked(exec_list *instructions) +do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, + exec_list *instructions) { bool progress = false; @@ -209,7 +212,7 @@ do_dead_code_unlinked(exec_list *instructions) foreach_iter(exec_list_iterator, sigiter, *f) { ir_function_signature *sig = (ir_function_signature *) sigiter.get(); - if (do_dead_code(&sig->body)) + if (do_dead_code(state, &sig->body)) progress = true; } } diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 432a33458c..147f92176b 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -32,9 +32,11 @@ bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); bool do_copy_propagation(exec_list *instructions); -bool do_dead_code(exec_list *instructions); +bool do_dead_code(struct _mesa_glsl_parse_state *state, + exec_list *instructions); bool do_dead_code_local(exec_list *instructions); -bool do_dead_code_unlinked(exec_list *instructions); +bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, + exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_simplification(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index dcd9bd69c0..b32e2ad3db 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -157,7 +157,7 @@ compile_shader(struct glsl_shader *shader) progress = do_if_simplification(&shader->ir) || progress; progress = do_copy_propagation(&shader->ir) || progress; progress = do_dead_code_local(&shader->ir) || progress; - progress = do_dead_code_unlinked(&shader->ir) || progress; + progress = do_dead_code_unlinked(state, &shader->ir) || progress; progress = do_constant_variable_unlinked(&shader->ir) || progress; progress = do_constant_folding(&shader->ir) || progress; progress = do_vec_index_to_swizzle(&shader->ir) || progress; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index f58af0f65f..0425e7d91e 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1332,7 +1332,7 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) progress = do_if_simplification(&shader->ir) || progress; progress = do_copy_propagation(&shader->ir) || progress; progress = do_dead_code_local(&shader->ir) || progress; - progress = do_dead_code_unlinked(&shader->ir) || progress; + progress = do_dead_code_unlinked(state, &shader->ir) || progress; progress = do_constant_variable_unlinked(&shader->ir) || progress; progress = do_constant_folding(&shader->ir) || progress; progress = do_vec_index_to_swizzle(&shader->ir) || progress; -- cgit v1.2.3 From 0fd97db8b077ad1bd5d26e86e67ebb2d58b6a38a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 25 Jun 2010 14:27:07 -0700 Subject: glsl2: Associate the GLenum for the type with builtin GLSL types. --- src/glsl/builtin_types.h | 150 ++++++++++++++++++++++++++++------------------- src/glsl/glsl_types.h | 10 +++- 2 files changed, 99 insertions(+), 61 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index 48202f5645..526421a017 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -26,10 +26,10 @@ #endif static const struct glsl_type _error_type = - glsl_type(GLSL_TYPE_ERROR, 0, 0, ""); + glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, ""); static const struct glsl_type void_type = - glsl_type(GLSL_TYPE_VOID, 0, 0, "void"); + glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void"); const glsl_type *const glsl_type::error_type = & _error_type; @@ -40,27 +40,33 @@ const glsl_type *const glsl_type::error_type = & _error_type; /*@{*/ static const struct glsl_type builtin_core_types[] = { - glsl_type( GLSL_TYPE_BOOL, 1, 1, "bool"), - glsl_type( GLSL_TYPE_BOOL, 2, 1, "bvec2"), - glsl_type( GLSL_TYPE_BOOL, 3, 1, "bvec3"), - glsl_type( GLSL_TYPE_BOOL, 4, 1, "bvec4"), - glsl_type( GLSL_TYPE_INT, 1, 1, "int"), - glsl_type( GLSL_TYPE_INT, 2, 1, "ivec2"), - glsl_type( GLSL_TYPE_INT, 3, 1, "ivec3"), - glsl_type( GLSL_TYPE_INT, 4, 1, "ivec4"), - glsl_type( GLSL_TYPE_FLOAT, 1, 1, "float"), - glsl_type( GLSL_TYPE_FLOAT, 2, 1, "vec2"), - glsl_type( GLSL_TYPE_FLOAT, 3, 1, "vec3"), - glsl_type( GLSL_TYPE_FLOAT, 4, 1, "vec4"), - glsl_type( GLSL_TYPE_FLOAT, 2, 2, "mat2"), - glsl_type( GLSL_TYPE_FLOAT, 3, 3, "mat3"), - glsl_type( GLSL_TYPE_FLOAT, 4, 4, "mat4"), - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT, "sampler1D"), - glsl_type( GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT, "sampler1DShadow"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT, "sampler2D"), - glsl_type( GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT, "sampler2DShadow"), - glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT, "sampler3D"), - glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT, "samplerCube"), + glsl_type(GL_BOOL, GLSL_TYPE_BOOL, 1, 1, "bool"), + glsl_type(GL_BOOL_VEC2, GLSL_TYPE_BOOL, 2, 1, "bvec2"), + glsl_type(GL_BOOL_VEC3, GLSL_TYPE_BOOL, 3, 1, "bvec3"), + glsl_type(GL_BOOL_VEC4, GLSL_TYPE_BOOL, 4, 1, "bvec4"), + glsl_type(GL_INT, GLSL_TYPE_INT, 1, 1, "int"), + glsl_type(GL_INT_VEC2, GLSL_TYPE_INT, 2, 1, "ivec2"), + glsl_type(GL_INT_VEC3, GLSL_TYPE_INT, 3, 1, "ivec3"), + glsl_type(GL_INT_VEC4, GLSL_TYPE_INT, 4, 1, "ivec4"), + glsl_type(GL_FLOAT, GLSL_TYPE_FLOAT, 1, 1, "float"), + glsl_type(GL_FLOAT_VEC2, GLSL_TYPE_FLOAT, 2, 1, "vec2"), + glsl_type(GL_FLOAT_VEC3, GLSL_TYPE_FLOAT, 3, 1, "vec3"), + glsl_type(GL_FLOAT_VEC4, GLSL_TYPE_FLOAT, 4, 1, "vec4"), + glsl_type(GL_FLOAT_MAT2, GLSL_TYPE_FLOAT, 2, 2, "mat2"), + glsl_type(GL_FLOAT_MAT3, GLSL_TYPE_FLOAT, 3, 3, "mat3"), + glsl_type(GL_FLOAT_MAT4, GLSL_TYPE_FLOAT, 4, 4, "mat4"), + glsl_type(GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT, + "sampler1D"), + glsl_type(GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT, + "sampler1DShadow"), + glsl_type(GL_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT, + "sampler2D"), + glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT, + "sampler2DShadow"), + glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT, + "sampler3D"), + glsl_type(GL_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT, + "samplerCube"), }; const glsl_type *const glsl_type::bool_type = & builtin_core_types[0]; @@ -181,12 +187,12 @@ static const struct glsl_type builtin_110_deprecated_structure_types[] = { /*@{*/ static const struct glsl_type builtin_120_types[] = { - glsl_type( GLSL_TYPE_FLOAT, 3, 2, "mat2x3"), - glsl_type( GLSL_TYPE_FLOAT, 4, 2, "mat2x4"), - glsl_type( GLSL_TYPE_FLOAT, 2, 3, "mat3x2"), - glsl_type( GLSL_TYPE_FLOAT, 4, 3, "mat3x4"), - glsl_type( GLSL_TYPE_FLOAT, 2, 4, "mat4x2"), - glsl_type( GLSL_TYPE_FLOAT, 3, 4, "mat4x3"), + glsl_type(GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2, "mat2x3"), + glsl_type(GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2, "mat2x4"), + glsl_type(GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3, "mat3x2"), + glsl_type(GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3, "mat3x4"), + glsl_type(GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4, "mat4x2"), + glsl_type(GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4, "mat4x3"), }; const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0]; const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1]; @@ -201,33 +207,50 @@ const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5]; /*@{*/ static const struct glsl_type builtin_130_types[] = { - glsl_type( GLSL_TYPE_UINT, 1, 1, "uint"), - glsl_type( GLSL_TYPE_UINT, 2, 1, "uvec2"), - glsl_type( GLSL_TYPE_UINT, 3, 1, "uvec3"), - glsl_type( GLSL_TYPE_UINT, 4, 1, "uvec4"), + glsl_type(GL_UNSIGNED_INT, GLSL_TYPE_UINT, 1, 1, "uint"), + glsl_type(GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1, "uvec2"), + glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"), + glsl_type(GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1, "uvec4"), /* 1D and 2D texture arrays */ - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"), - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"), - glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"), - glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), + glsl_type(GL_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type(GL_INT_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"), + glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type(GL_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type(GL_INT_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"), + glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), /* cube shadow samplers */ - glsl_type(GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"), + glsl_type(GL_SAMPLER_CUBE_SHADOW, + GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"), /* signed and unsigned integer samplers */ - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"), - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"), - glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"), - glsl_type( GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"), - glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"), - glsl_type(GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"), + glsl_type(GL_INT_SAMPLER_1D, + GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_1D, + GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"), + glsl_type(GL_INT_SAMPLER_2D, + GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D, + GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"), + glsl_type(GL_INT_SAMPLER_3D, + GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_3D, + GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"), + glsl_type(GL_INT_SAMPLER_CUBE, + GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"), + glsl_type(GL_INT_SAMPLER_CUBE, + GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"), }; const glsl_type *const glsl_type::uint_type = & builtin_130_types[0]; @@ -239,8 +262,10 @@ const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3]; /*@{*/ static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { - glsl_type(GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"), - glsl_type(GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"), + glsl_type(GL_SAMPLER_2D_RECT, + GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"), + glsl_type(GL_SAMPLER_2D_RECT_SHADOW, + GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"), }; /*@}*/ @@ -249,10 +274,14 @@ static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { /*@{*/ static const struct glsl_type builtin_EXT_texture_array_types[] = { - glsl_type( GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), - glsl_type( GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), - glsl_type( GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), - glsl_type( GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), + glsl_type(GL_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type(GL_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), }; /*@}*/ @@ -261,8 +290,11 @@ static const struct glsl_type builtin_EXT_texture_array_types[] = { /*@{*/ static const struct glsl_type builtin_EXT_texture_buffer_object_types[] = { - glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"), - glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"), - glsl_type( GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"), + glsl_type(GL_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"), + glsl_type(GL_INT_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"), }; /*@}*/ diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 39e6ac970a..93cf60be8d 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -30,6 +30,7 @@ #include extern "C" { +#include "GL/gl.h" #include } @@ -55,6 +56,7 @@ enum glsl_sampler_dim { struct glsl_type { + GLenum gl_type; unsigned base_type:4; unsigned sampler_dimensionality:3; @@ -151,8 +153,10 @@ struct glsl_type { /*@}*/ - glsl_type(unsigned base_type, unsigned vector_elements, + glsl_type(GLenum gl_type, + unsigned base_type, unsigned vector_elements, unsigned matrix_columns, const char *name) : + gl_type(gl_type), base_type(base_type), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), @@ -166,8 +170,10 @@ struct glsl_type { memset(& fields, 0, sizeof(fields)); } - glsl_type(enum glsl_sampler_dim dim, bool shadow, bool array, + glsl_type(GLenum gl_type, + enum glsl_sampler_dim dim, bool shadow, bool array, unsigned type, const char *name) : + gl_type(gl_type), base_type(GLSL_TYPE_SAMPLER), sampler_dimensionality(dim), sampler_shadow(shadow), sampler_array(array), sampler_type(type), -- cgit v1.2.3 From 78062273de65bf8133f2550aa2a26040a82a65aa Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 13:10:37 -0700 Subject: ir_reader: Free memory for S-Expressions earlier. There's no point in keeping it around once we've read the IR. Also, remove an unnecessary talloc_parent call. --- src/glsl/ir_reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 7383c42cbc..03dce0d684 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -70,8 +70,7 @@ void _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, const char *src) { - void *ctx = talloc_parent(state); - s_expression *expr = s_expression::read_expression(ctx, src); + s_expression *expr = s_expression::read_expression(state, src); if (expr == NULL) { ir_read_error(state, NULL, "couldn't parse S-Expression."); return; @@ -82,6 +81,7 @@ _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, return; read_instructions(state, instructions, expr, NULL); + talloc_free(expr); } static void -- cgit v1.2.3 From 26b5d33dce37755a6a4a799a9edfcdff8c5ce3e5 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 16:19:45 -0700 Subject: glsl2: Use i2b and f2b IR opcodes for casting int or float to bool --- src/glsl/ast_function.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 761af00b95..f431d1d015 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -172,17 +172,17 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type) break; } break; - case GLSL_TYPE_BOOL: { - ir_constant *zero = NULL; - + case GLSL_TYPE_BOOL: switch (b) { - case GLSL_TYPE_UINT: zero = new(ctx) ir_constant(unsigned(0)); break; - case GLSL_TYPE_INT: zero = new(ctx) ir_constant(int(0)); break; - case GLSL_TYPE_FLOAT: zero = new(ctx) ir_constant(0.0f); break; + case GLSL_TYPE_UINT: + 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; } - - result = new(ctx) ir_expression(ir_binop_nequal, desired_type, src, zero); - } + break; } assert(result != NULL); -- cgit v1.2.3 From 22c23dedad4e7f362ffbd990f1c2d5caf4cae75a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 15:27:47 -0700 Subject: glsl2: Add option to stand-alone GLSL compiler to dump IR before optimizations --- src/glsl/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index b32e2ad3db..16b2cf84c5 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -89,11 +89,13 @@ usage_fail(const char *name) int dump_ast = 0; +int dump_hir = 0; int dump_lir = 0; int do_link = 0; const struct option compiler_opts[] = { { "dump-ast", 0, &dump_ast, 1 }, + { "dump-hir", 0, &dump_hir, 1 }, { "dump-lir", 0, &dump_lir, 1 }, { "link", 0, &do_link, 1 }, { NULL, 0, NULL, 0 } @@ -147,6 +149,11 @@ compile_shader(struct glsl_shader *shader) validate_ir_tree(&shader->ir); + /* Print out the unoptimized IR. */ + if (!state->error && dump_hir) { + _mesa_print_ir(&shader->ir, state); + } + /* Optimization passes */ if (!state->error && !shader->ir.is_empty()) { bool progress; -- cgit v1.2.3 From a815f7fb83b1117e957c097044f36eae3a6851fb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 13:36:14 -0700 Subject: Use more sensible contexts in ir_dead_code_local. --- src/glsl/ir_dead_code_local.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp index e01877077c..5e197e1948 100644 --- a/src/glsl/ir_dead_code_local.cpp +++ b/src/glsl/ir_dead_code_local.cpp @@ -111,9 +111,8 @@ public: * of a variable to a variable. */ static bool -process_assignment(ir_assignment *ir, exec_list *assignments) +process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) { - void *ctx = talloc_parent(ir); ir_variable *var = NULL; bool progress = false; kill_for_derefs_visitor v(assignments); @@ -186,6 +185,7 @@ dead_code_local_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; + void *ctx = talloc(NULL, void*); /* Safe looping, since process_assignment */ for (ir = first, ir_next = (ir_instruction *)first->next;; ir = ir_next, ir_next = (ir_instruction *)ir->next) { @@ -197,7 +197,7 @@ dead_code_local_basic_block(ir_instruction *first, } if (ir_assign) { - progress = process_assignment(ir_assign, &assignments) || progress; + progress = process_assignment(ctx, ir_assign, &assignments) || progress; } else { kill_for_derefs_visitor kill(&assignments); ir->accept(&kill); @@ -207,6 +207,7 @@ dead_code_local_basic_block(ir_instruction *first, break; } *out_progress = progress; + talloc_free(ctx); } /** -- cgit v1.2.3 From 5f3fe44595e53874908d1f047405d27861f1df0f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 13:44:09 -0700 Subject: Use a more sensible context in copy propagation. --- src/glsl/ir_copy_propagation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 46ef6679d9..a02852ed0c 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -195,9 +195,8 @@ kill_invalidated_copies(ir_assignment *ir, exec_list *acp) * of a variable to a variable. */ static void -add_copy(ir_assignment *ir, exec_list *acp) +add_copy(void *ctx, ir_assignment *ir, exec_list *acp) { - void *ctx = talloc_parent(ir); acp_entry *entry; if (ir->condition) { @@ -226,6 +225,7 @@ copy_propagation_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; + void *ctx = talloc(NULL, void*); for (ir = first;; ir = (ir_instruction *)ir->next) { ir_assignment *ir_assign = ir->as_assignment(); @@ -234,12 +234,13 @@ copy_propagation_basic_block(ir_instruction *first, if (ir_assign) { kill_invalidated_copies(ir_assign, &acp); - add_copy(ir_assign, &acp); + add_copy(ctx, ir_assign, &acp); } if (ir == last) break; } *out_progress = progress; + talloc_free(ctx); } /** -- cgit v1.2.3 From 18707eba1cd6c07fa8b63d0ba5b26f6433f1ae91 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 28 Jun 2010 23:38:04 -0700 Subject: glsl2: Check that returned expressions match the function return type. From my reading of the specification, implicit conversions are not allowed. ATI seems to agree, though nVidia allows it without warning. --- src/glsl/ast_to_hir.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 33eb27533f..45228649ad 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2151,9 +2151,17 @@ ast_jump_statement::hir(exec_list *instructions, opt_return_value->hir(instructions, state); assert(ret != NULL); - /* FINISHME: Make sure the type of the return value matches the return - * FINISHME: type of the enclosing function. - */ + /* Implicit conversions are not allowed for return values. */ + if (state->current_function->return_type != ret->type) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return' with wrong type %s, in function `%s' " + "returning %s", + ret->type->name, + state->current_function->function_name(), + state->current_function->return_type->name); + } inst = new(ctx) ir_return(ret); } else { -- cgit v1.2.3 From 28527ed557923aecff5d3b88e5d7776f04389547 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 00:47:44 -0700 Subject: glsl2: Add a method for querying if an AST type has any qualifiers. --- src/glsl/ast.h | 1 + src/glsl/ast_type.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index de300e719c..adb5fb11d4 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -418,6 +418,7 @@ public: 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; diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index 49dfde20e9..e2510a10c6 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -110,3 +110,13 @@ ast_type_specifier::ast_type_specifier(int specifier) type_name = names[specifier]; } + +bool +ast_fully_specified_type::has_qualifiers() const +{ + return qualifier.invariant || qualifier.constant || qualifier.attribute + || qualifier.varying || qualifier.in + || qualifier.out || qualifier.centroid + || qualifier.uniform || qualifier.smooth + || qualifier.flat || qualifier.noperspective; +} -- cgit v1.2.3 From ac04c257e31fe012dac750bcf5bf3134ba07ebdc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 00:48:10 -0700 Subject: glsl2: Reject return types with qualifiers. Fixes piglit test return-qualifier.frag. --- src/glsl/ast_to_hir.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 45228649ad..5a13b74c03 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1984,6 +1984,7 @@ ast_function::hir(exec_list *instructions, ir_function_signature *sig = NULL; exec_list hir_parameters; + const char *const name = identifier; /* Convert the list of function parameters to HIR now so that they can be * used below to compare this function's signature with previously seen @@ -1999,11 +2000,19 @@ ast_function::hir(exec_list *instructions, assert(return_type != NULL); + /* From page 56 (page 62 of the PDF) of the GLSL 1.30 spec: + * "No qualifier is allowed on the return type of a function." + */ + if (this->return_type->has_qualifiers()) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(& loc, state, + "function `%s' return type has qualifiers", name); + } + /* Verify that this function's signature either doesn't match a previously * seen signature for a function with the same name, or, if a match is found, * that the previously seen signature does not have an associated definition. */ - const char *const name = identifier; f = state->symbols->get_function(name); if (f != NULL) { ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); -- cgit v1.2.3 From 6de825650560198eb97f19e72b2d56e68e3d7a63 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 09:59:40 -0700 Subject: glsl2: Check for non-void functions that don't have a return statement. This doesn't do any control flow analysis to ensure that the return statements are actually reached. Fixes piglit tests function5.frag and function-07.vert. --- src/glsl/ast_to_hir.cpp | 10 ++++++++++ src/glsl/glsl_parser_extras.h | 3 +++ 2 files changed, 13 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 5a13b74c03..c5df0b0fd0 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2097,6 +2097,7 @@ ast_function_definition::hir(exec_list *instructions, assert(state->current_function == NULL); state->current_function = signature; + state->found_return = false; /* Duplicate parameters declared in the prototype as concrete variables. * Add these to the symbol table. @@ -2128,6 +2129,14 @@ ast_function_definition::hir(exec_list *instructions, assert(state->current_function == signature); state->current_function = NULL; + if (!signature->return_type->is_void() && !state->found_return) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(& loc, state, "function `%s' has non-void return type " + "%s, but no return statement", + signature->function_name(), + signature->return_type->name); + } + /* Function definitions do not have r-values. */ return NULL; @@ -2186,6 +2195,7 @@ ast_jump_statement::hir(exec_list *instructions, inst = new(ctx) ir_return; } + state->found_return = true; instructions->push_tail(inst); break; } diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index cfe02e3b0c..726bafa7e4 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -51,6 +51,9 @@ struct _mesa_glsl_parse_state { */ class ir_function_signature *current_function; + /** Have we found a return statement in this function? */ + bool found_return; + /** Was there an error during compilation? */ bool error; -- cgit v1.2.3 From 50577b96ac07bc24af1ef8e2490cb633aa84dd7d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 10:02:01 -0700 Subject: glsl2: Update TODO. --- src/glsl/TODO | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/TODO b/src/glsl/TODO index 193cfc767d..c702eb4927 100644 --- a/src/glsl/TODO +++ b/src/glsl/TODO @@ -43,10 +43,7 @@ - Care must be taken to handle both the 1.10 rules and the 1.20+ rules. In 1.10, built-in functions cannot be constant expressions. -- Detect non-void functions that lack a return statement - -- Detect return statements with a type not matching the funciton's - return type. +- Detect code paths in non-void functions that don't reach a return statement - Handle over-riding built-in functions - Is the overload per-compilation unit or per-linked shader? -- cgit v1.2.3 From 6315b68f5fbe529bce3497b67c42af1eaa62b8c1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 15:25:27 -0700 Subject: ir_swizzle: Add new constructor, refactor constructors Adds a new constructor that takes an array of component values. Refactors the meat of the two constructors to an init_mask method. --- src/glsl/ir.cpp | 63 ++++++++++++++++++++++++++++++++++++++++----------------- src/glsl/ir.h | 11 ++++++++++ 2 files changed, 56 insertions(+), 18 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 2756752ba4..4eb0e9e33e 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -573,28 +573,40 @@ ir_texture::set_sampler(ir_dereference *sampler) } -ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, - unsigned w, unsigned count) - : val(val) +void +ir_swizzle::init_mask(const unsigned *comp, unsigned count) { assert((count >= 1) && (count <= 4)); - const unsigned dup_mask = 0 - | ((count > 1) ? ((1U << y) & ((1U << x) )) : 0) - | ((count > 2) ? ((1U << z) & ((1U << x) | (1U << y) )) : 0) - | ((count > 3) ? ((1U << w) & ((1U << x) | (1U << y) | (1U << z))) : 0); - - assert(x <= 3); - assert(y <= 3); - assert(z <= 3); - assert(w <= 3); + memset(&this->mask, 0, sizeof(this->mask)); + this->mask.num_components = count; + + unsigned dup_mask = 0; + switch (count) { + case 4: + assert(comp[3] <= 3); + dup_mask |= (1U << comp[3]) + & ((1U << comp[0]) | (1U << comp[1]) | (1U << comp[2])); + this->mask.w = comp[3]; + + case 3: + assert(comp[2] <= 3); + dup_mask |= (1U << comp[2]) + & ((1U << comp[0]) | (1U << comp[1])); + this->mask.z = comp[2]; + + case 2: + assert(comp[1] <= 3); + dup_mask |= (1U << comp[1]) + & ((1U << comp[0])); + this->mask.y = comp[1]; + + case 1: + assert(comp[0] <= 3); + this->mask.x = comp[0]; + } - mask.x = x; - mask.y = y; - mask.z = z; - mask.w = w; - mask.num_components = count; - mask.has_duplicates = dup_mask != 0; + this->mask.has_duplicates = dup_mask != 0; /* Based on the number of elements in the swizzle and the base type * (i.e., float, int, unsigned, or bool) of the vector being swizzled, @@ -603,6 +615,21 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1); } +ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, + unsigned w, unsigned count) + : val(val) +{ + const unsigned components[4] = { x, y, z, w }; + this->init_mask(components, count); +} + +ir_swizzle::ir_swizzle(ir_rvalue *val, const unsigned *comp, + unsigned count) + : val(val) +{ + this->init_mask(comp, count); +} + ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) { this->val = val; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 3d2c7ff5cf..de1124975d 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -918,6 +918,9 @@ class ir_swizzle : public ir_rvalue { public: ir_swizzle(ir_rvalue *, unsigned x, unsigned y, unsigned z, unsigned w, unsigned count); + + ir_swizzle(ir_rvalue *val, const unsigned *components, unsigned count); + ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask); virtual ir_instruction *clone(struct hash_table *) const; @@ -951,6 +954,14 @@ public: ir_rvalue *val; ir_swizzle_mask mask; + +private: + /** + * Initialize the mask component of a swizzle + * + * This is used by the \c ir_swizzle constructors. + */ + void init_mask(const unsigned *components, unsigned count); }; -- cgit v1.2.3 From c31dcdf57ed9646580040ebfe44c2609885fe96b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 23 Jun 2010 15:19:40 -0700 Subject: glsl2: Always emit vector constructors inline --- src/glsl/ast_function.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index f431d1d015..f1ab6f0c5a 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -444,6 +444,98 @@ generate_constructor_vector(const glsl_type *type, ir_constant *initializer, } +/** + * 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_sentinal()); +} + + +/** + * 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, strdup("vec_ctor")); + 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); + + assert(rhs->type == lhs->type); + + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + } else { + unsigned base_component = 0; + foreach_list(node, parameters) { + ir_rvalue *rhs = (ir_rvalue *) node; + unsigned rhs_components = rhs->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; + } + + /* Emit an assignment of the constructor parameter to the next set of + * components in the temporary variable. + */ + unsigned mask[4] = { 0, 0, 0, 0 }; + for (unsigned i = 0; i < rhs_components; i++) { + mask[i] = i + base_component; + } + + + ir_rvalue *lhs_ref = new(ctx) ir_dereference_variable(var); + ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, mask, rhs_components); + + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + 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); +} + + ir_rvalue * ast_function_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -708,8 +800,15 @@ ast_function_expression::hir(exec_list *instructions, &data); return new(ctx) ir_constant(sig->return_type, &data); - } else + } else if (constructor_type->is_vector()) { + return emit_inline_vector_constructor(constructor_type, + instructions, + &actual_parameters, + ctx); + } else { + assert(constructor_type->is_matrix()); return new(ctx) ir_call(sig, & actual_parameters); + } } else { /* FINISHME: Log a better error message here. G++ will show the * FINSIHME: types of the actual parameters and the set of -- cgit v1.2.3 From 81c7e94466da19f9295b8eb5e4b5e587fea96284 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 16:10:43 -0700 Subject: glsl2: Always emit matrix constructors inline --- src/glsl/ast_function.cpp | 322 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 321 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index f1ab6f0c5a..3828d3273f 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -26,6 +26,11 @@ #include "glsl_types.h" #include "ir.h" +inline unsigned min(unsigned a, unsigned b) +{ + return (a < b) ? a : b; +} + static unsigned process_parameters(exec_list *instructions, exec_list *actual_parameters, exec_list *parameters, @@ -536,6 +541,318 @@ emit_inline_vector_constructor(const glsl_type *type, } +/** + * 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, + TALLOC_CTX *ctx) +{ + const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 }; + + ir_constant *col_idx = new(ctx) ir_constant(column); + ir_rvalue *column_ref = new(ctx) ir_dereference_array(var, col_idx); + + assert(column_ref->type->components() >= (row_base + count)); + ir_rvalue *lhs = new(ctx) ir_swizzle(column_ref, &mask[row_base], count); + + assert(src->type->components() >= (src_base + count)); + ir_rvalue *rhs = new(ctx) ir_swizzle(src, &mask[src_base], count); + + return new(ctx) ir_assignment(lhs, rhs, NULL); +} + + +/** + * 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, strdup("mat_ctor")); + 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, + strdup("mat_ctor_vec")); + 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_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); + ir_rvalue *const x_of_rhs = new(ctx) ir_swizzle(rhs_ref, 0, 0, 0, 0, 1); + + inst = new(ctx) ir_assignment(x_of_rhs, first_param, NULL); + 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 = min(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_sentinal()); + 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, + strdup("mat_ctor_mat")); + 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 swiz[4] = { 0, 1, 2, 3 }; + const unsigned last_col = min(src_matrix->type->matrix_columns, + var->type->matrix_columns); + for (unsigned i = 0; i < last_col; i++) { + ir_rvalue *const lhs_col = + 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 *lhs; + ir_rvalue *rhs; + if (lhs_col->type->vector_elements < rhs_col->type->vector_elements) { + lhs = lhs_col; + + rhs = new(ctx) ir_swizzle(rhs_col, swiz, + lhs_col->type->vector_elements); + } else if (lhs_col->type->vector_elements + > rhs_col->type->vector_elements) { + lhs = new(ctx) ir_swizzle(lhs_col, swiz, + rhs_col->type->vector_elements); + rhs = rhs_col; + } else { + lhs = lhs_col; + rhs = rhs_col; + } + + assert(lhs->type == rhs->type); + + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + } + } else { + const unsigned rows = type->matrix_columns; + const unsigned cols = 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, + strdup("mat_ctor_vec")); + 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 = min(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 * ast_function_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -807,7 +1124,10 @@ ast_function_expression::hir(exec_list *instructions, ctx); } else { assert(constructor_type->is_matrix()); - return new(ctx) ir_call(sig, & actual_parameters); + return emit_inline_matrix_constructor(constructor_type, + instructions, + &actual_parameters, + ctx); } } else { /* FINISHME: Log a better error message here. G++ will show the -- cgit v1.2.3 From 699b247661b1c70e890e478dba88253cad035969 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 17:36:17 -0700 Subject: glsl2: Don't flatten constructor parameters to scalars Now that all scalar, vector, and matrix constructors are emitted in-line, the parameters to these constructors should not be flattened to a pile of scalars. Instead, the functions that emit the in-line constructor bodies can directly write the parameters to the correct locations in the objects being constructed. --- src/glsl/ast_function.cpp | 188 +++++++++++++++------------------------------- 1 file changed, 59 insertions(+), 129 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 3828d3273f..e23d789fa9 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -903,19 +903,6 @@ ast_function_expression::hir(exec_list *instructions, * matching rules as functions. */ if (constructor_type->is_numeric() || constructor_type->is_boolean()) { - /* Constructing a numeric type has a couple steps. First all values - * passed to the constructor are broken into individual parameters - * and type converted to the base type of the thing being constructed. - * - * At that point we have some number of values that match the base - * type of the thing being constructed. Now the constructor can be - * treated like a function call. Each numeric type has a small set - * of constructor functions. The set of new parameters will either - * match one of those functions or the original constructor is - * invalid. - */ - const glsl_type *const base_type = constructor_type->get_base_type(); - /* Total number of components of the type being constructed. */ const unsigned type_components = constructor_type->components(); @@ -944,19 +931,6 @@ ast_function_expression::hir(exec_list *instructions, ast_node *ast = exec_node_data(ast_node, n, link); ir_rvalue *result = ast->hir(instructions, state)->as_rvalue(); - ir_variable *result_var = NULL; - - /* 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; /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec: * @@ -985,58 +959,28 @@ ast_function_expression::hir(exec_list *instructions, else nonmatrix_parameters++; - /* We can't use the same instruction node in the multiple - * swizzle dereferences that happen, so assign it to a - * variable and deref that. Plus it saves computation for - * complicated expressions and handles - * glsl-vs-constructor-call.shader_test. + /* Type cast the parameter and add it to the parameter list for + * the constructor. */ - if (result->type->components() >= 1 && !result->as_constant()) { - result_var = new(ctx) ir_variable(result->type, - "constructor_tmp"); - ir_dereference_variable *lhs; - - lhs = new(ctx) ir_dereference_variable(result_var); - instructions->push_tail(new(ctx) ir_assignment(lhs, - result, NULL)); - } + const glsl_type *desired_type = + glsl_type::get_instance(constructor_type->base_type, + result->type->vector_elements, + result->type->matrix_columns); + result = convert_component(result, desired_type); - /* Process each of the components of the parameter. Dereference - * each component individually, perform any type conversions, and - * add it to the parameter list for the constructor. + /* 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. */ - for (unsigned i = 0; i < result->type->components(); i++) { - if (components_used >= type_components) - break; - - ir_rvalue *component; - - if (result_var) { - ir_dereference *d = new(ctx) ir_dereference_variable(result_var); - component = dereference_component(d, i); - } else { - component = dereference_component(result, i); - } - component = convert_component(component, base_type); - - /* All cases that could result in component->type being the - * error type should have already been caught above. - */ - assert(component->type == base_type); - - if (component->as_constant() == NULL) - all_parameters_are_constant = false; + ir_rvalue *const constant = result->constant_expression_value(); - /* Don't actually generate constructor calls for scalars. - * Instead, do the usual component selection and conversion, - * and return the single component. - */ - if (constructor_type->is_scalar()) - return component; + if (constant != NULL) + result = constant; + else + all_parameters_are_constant = false; - actual_parameters.push_tail(component); - components_used++; - } + actual_parameters.push_tail(result); + components_used += result->type->components(); } /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec: @@ -1079,65 +1023,51 @@ ast_function_expression::hir(exec_list *instructions, return ir_call::get_error_instruction(ctx); } - ir_function *f = state->symbols->get_function(constructor_type->name); - if (f == NULL) { - _mesa_glsl_error(& loc, state, "no constructor for type `%s'", - constructor_type->name); - return ir_call::get_error_instruction(ctx); - } - const ir_function_signature *sig = - f->matching_signature(& actual_parameters); - if (sig != NULL) { - /* If all of the parameters are trivially constant, create a - * constant representing the complete collection of parameters. + /* If all of the parameters are trivially constant, create a + * constant representing the complete collection of parameters. + */ + if (all_parameters_are_constant) { + if (components_used >= type_components) + return new(ctx) ir_constant(constructor_type, + & actual_parameters); + + /* The above case must handle all scalar constructors. */ - if (all_parameters_are_constant) { - if (components_used >= type_components) - return new(ctx) ir_constant(sig->return_type, - & actual_parameters); - - assert(sig->return_type->is_vector() - || sig->return_type->is_matrix()); - - /* Constructors with exactly one component are special for - * vectors and matrices. For vectors it causes all elements of - * the vector to be filled with the value. For matrices it - * causes the matrix to be filled with 0 and the diagonal to be - * filled with the value. - */ - ir_constant_data data; - ir_constant *const initializer = - (ir_constant *) actual_parameters.head; - if (sig->return_type->is_matrix()) - generate_constructor_matrix(sig->return_type, initializer, - &data); - else - generate_constructor_vector(sig->return_type, initializer, - &data); - - return new(ctx) ir_constant(sig->return_type, &data); - } 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 { - /* FINISHME: Log a better error message here. G++ will show the - * FINSIHME: types of the actual parameters and the set of - * FINSIHME: candidate functions. A different error should also be - * FINSIHME: logged when multiple functions match. + assert(constructor_type->is_vector() + || constructor_type->is_matrix()); + + /* Constructors with exactly one component are special for + * vectors and matrices. For vectors it causes all elements of + * the vector to be filled with the value. For matrices it + * causes the matrix to be filled with 0 and the diagonal to be + * filled with the value. */ - _mesa_glsl_error(& loc, state, "no matching constructor for `%s'", - constructor_type->name); - return ir_call::get_error_instruction(ctx); + ir_constant_data data; + ir_constant *const initializer = + (ir_constant *) actual_parameters.head; + if (constructor_type->is_matrix()) + generate_constructor_matrix(constructor_type, initializer, + &data); + else + generate_constructor_vector(constructor_type, initializer, + &data); + + return new(ctx) ir_constant(constructor_type, &data); + } 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); } } -- cgit v1.2.3 From 12681610f54b40324e9e342dc25976c223614b81 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 25 Jun 2010 17:58:16 -0700 Subject: glsl_type: Remove vector and matrix constructor generators All scalar, vector, and matrix constructors are generated in-line during AST-to-HIR translation. There is no longer any need to generate function versions of the constructors. --- src/glsl/ast_to_hir.cpp | 1 - src/glsl/glsl_types.cpp | 365 ------------------------------------------------ src/glsl/glsl_types.h | 4 - 3 files changed, 370 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c5df0b0fd0..54a8e9e00a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -60,7 +60,6 @@ void _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { _mesa_glsl_initialize_variables(instructions, state); - _mesa_glsl_initialize_constructors(instructions, state); _mesa_glsl_initialize_functions(instructions, state); state->current_function = NULL; diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 9a53fbdbcb..ff157080ff 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -210,371 +210,6 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const } -/** - * Generate the function intro for a constructor - * - * \param type Data type to be constructed - * \param count Number of parameters to this concrete constructor. Most - * types have at least two constructors. One will take a - * single scalar parameter and the other will take "N" - * scalar parameters. - * \param parameters Storage for the list of parameters. These are - * typically stored in an \c ir_function_signature. - * \param declarations Pointers to the variable declarations for the function - * parameters. These are used later to avoid having to use - * the symbol table. - */ -static ir_function_signature * -generate_constructor_intro(void *ctx, - const glsl_type *type, unsigned parameter_count, - ir_variable **declarations) -{ - /* Names of parameters used in vector and matrix constructors - */ - static const char *const names[] = { - "a", "b", "c", "d", "e", "f", "g", "h", - "i", "j", "k", "l", "m", "n", "o", "p", - }; - - assert(parameter_count <= Elements(names)); - - const glsl_type *const parameter_type = type->get_base_type(); - - ir_function_signature *const signature = new(ctx) ir_function_signature(type); - - for (unsigned i = 0; i < parameter_count; i++) { - ir_variable *var = new(ctx) ir_variable(parameter_type, names[i]); - - var->mode = ir_var_in; - signature->parameters.push_tail(var); - - declarations[i] = var; - } - - ir_variable *retval = new(ctx) ir_variable(type, "__retval"); - signature->body.push_tail(retval); - - declarations[16] = retval; - return signature; -} - - -/** - * Generate the body of a vector constructor that takes a single scalar - */ -static void -generate_vec_body_from_scalar(void *ctx, - exec_list *instructions, - ir_variable **declarations) -{ - ir_instruction *inst; - - /* Generate a single assignment of the parameter to __retval.x and return - * __retval.xxxx for however many vector components there are. - */ - ir_dereference *const lhs_ref = - new(ctx) ir_dereference_variable(declarations[16]); - ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[0]); - - ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, 0, 0, 0, 0, 1); - - inst = new(ctx) ir_assignment(lhs, rhs, NULL); - instructions->push_tail(inst); - - ir_dereference *const retref = new(ctx) ir_dereference_variable(declarations[16]); - - ir_swizzle *retval = new(ctx) ir_swizzle(retref, 0, 0, 0, 0, - declarations[16]->type->vector_elements); - - inst = new(ctx) ir_return(retval); - instructions->push_tail(inst); -} - - -/** - * Generate the body of a vector constructor that takes multiple scalars - */ -static void -generate_vec_body_from_N_scalars(void *ctx, - exec_list *instructions, - ir_variable **declarations) -{ - ir_instruction *inst; - const glsl_type *const vec_type = declarations[16]->type; - - /* Generate an assignment of each parameter to a single component of - * __retval.x and return __retval. - */ - for (unsigned i = 0; i < vec_type->vector_elements; i++) { - ir_dereference *const lhs_ref = - new(ctx) ir_dereference_variable(declarations[16]); - ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[i]); - - ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, i, 0, 0, 0, 1); - - inst = new(ctx) ir_assignment(lhs, rhs, NULL); - instructions->push_tail(inst); - } - - ir_dereference *retval = new(ctx) ir_dereference_variable(declarations[16]); - - inst = new(ctx) ir_return(retval); - instructions->push_tail(inst); -} - - -/** - * Generate the body of a matrix constructor that takes a single scalar - */ -static void -generate_mat_body_from_scalar(void *ctx, - exec_list *instructions, - ir_variable **declarations) -{ - ir_instruction *inst; - - /* Generate an assignment of the parameter to the X component of a - * temporary vector. Set the remaining fields of the vector to 0. The - * size of the vector is equal to the number of rows of the matrix. - * - * Set each column of the matrix to a successive "rotation" of the - * temporary vector. This fills the matrix with 0s, but writes the single - * scalar along the matrix's diagonal. - * - * For a mat4x3, this is equivalent to: - * - * vec3 tmp; - * mat4x3 __retval; - * tmp.x = a; - * tmp.y = 0.0; - * tmp.z = 0.0; - * __retval[0] = tmp.xyy; - * __retval[1] = tmp.yxy; - * __retval[2] = tmp.yyx; - * __retval[3] = tmp.yyy; - */ - const glsl_type *const column_type = declarations[16]->type->column_type(); - const glsl_type *const row_type = declarations[16]->type->row_type(); - - ir_variable *const column = new(ctx) ir_variable(column_type, "v"); - - instructions->push_tail(column); - - ir_dereference *const lhs_ref = new(ctx) ir_dereference_variable(column); - ir_dereference *const rhs = new(ctx) ir_dereference_variable(declarations[0]); - - ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, 0, 0, 0, 0, 1); - - inst = new(ctx) ir_assignment(lhs, rhs, NULL); - instructions->push_tail(inst); - - for (unsigned i = 1; i < column_type->vector_elements; i++) { - ir_dereference *const lhs_ref = new(ctx) ir_dereference_variable(column); - ir_constant *const zero = new(ctx) ir_constant(0.0f); - - ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, i, 0, 0, 0, 1); - - inst = new(ctx) ir_assignment(lhs, zero, NULL); - instructions->push_tail(inst); - } - - - for (unsigned i = 0; i < row_type->vector_elements; i++) { - static const unsigned swiz[] = { 1, 1, 1, 0, 1, 1, 1 }; - ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(column); - - /* This will be .xyyy when i=0, .yxyy when i=1, etc. - */ - ir_swizzle *rhs = new(ctx) ir_swizzle(rhs_ref, swiz[3 - i], swiz[4 - i], - swiz[5 - i], swiz[6 - i], - column_type->vector_elements); - - ir_constant *const idx = new(ctx) ir_constant(int(i)); - ir_dereference *const lhs = - new(ctx) ir_dereference_array(declarations[16], idx); - - inst = new(ctx) ir_assignment(lhs, rhs, NULL); - instructions->push_tail(inst); - } - - ir_dereference *const retval = new(ctx) ir_dereference_variable(declarations[16]); - inst = new(ctx) ir_return(retval); - instructions->push_tail(inst); -} - - -/** - * Generate the body of a vector constructor that takes multiple scalars - */ -static void -generate_mat_body_from_N_scalars(void *ctx, - exec_list *instructions, - ir_variable **declarations) -{ - ir_instruction *inst; - const glsl_type *const row_type = declarations[16]->type->row_type(); - const glsl_type *const column_type = declarations[16]->type->column_type(); - - /* Generate an assignment of each parameter to a single component of - * of a particular column of __retval and return __retval. - */ - for (unsigned i = 0; i < column_type->vector_elements; i++) { - for (unsigned j = 0; j < row_type->vector_elements; j++) { - ir_constant *row_index = new(ctx) ir_constant(int(i)); - ir_dereference *const row_access = - new(ctx) ir_dereference_array(declarations[16], row_index); - - ir_swizzle *component_access = new(ctx) ir_swizzle(row_access, - j, 0, 0, 0, 1); - - const unsigned param = (i * row_type->vector_elements) + j; - ir_dereference *const rhs = - new(ctx) ir_dereference_variable(declarations[param]); - - inst = new(ctx) ir_assignment(component_access, rhs, NULL); - instructions->push_tail(inst); - } - } - - ir_dereference *retval = new(ctx) ir_dereference_variable(declarations[16]); - - inst = new(ctx) ir_return(retval); - instructions->push_tail(inst); -} - - -/** - * Generate the constructors for a set of GLSL types - * - * Constructor implementations are added to \c instructions, and the symbols - * are added to \c symtab. - */ -static void -generate_constructor(glsl_symbol_table *symtab, const struct glsl_type *types, - unsigned num_types, exec_list *instructions) -{ - void *ctx = symtab; - ir_variable *declarations[17]; - - for (unsigned i = 0; i < num_types; i++) { - /* Only numeric and boolean vectors and matrices get constructors here. - * Structures need to be handled elsewhere. It is expected that scalar - * constructors are never actually called, so they are not generated. - */ - if (!types[i].is_numeric() && !types[i].is_boolean()) - continue; - - if (types[i].is_scalar()) - continue; - - /* Generate the function block, add it to the symbol table, and emit it. - */ - ir_function *const f = new(ctx) ir_function(types[i].name); - - bool added = symtab->add_function(types[i].name, f); - assert(added); - - instructions->push_tail(f); - - /* Each type has several basic constructors. The total number of forms - * depends on the derived type. - * - * Vectors: 1 scalar, N scalars - * Matrices: 1 scalar, NxM scalars - * - * Several possible types of constructors are not included in this list. - * - * Scalar constructors are not included. The expectation is that the - * IR generator won't actually generate these as constructor calls. The - * expectation is that it will just generate the necessary type - * conversion. - * - * Matrix contructors from matrices are also not included. The - * expectation is that the IR generator will generate a call to the - * appropriate from-scalars constructor. - */ - ir_function_signature *const sig = - generate_constructor_intro(ctx, &types[i], 1, declarations); - f->add_signature(sig); - - if (types[i].is_vector()) { - generate_vec_body_from_scalar(ctx, &sig->body, declarations); - - ir_function_signature *const vec_sig = - generate_constructor_intro(ctx, - &types[i], types[i].vector_elements, - declarations); - f->add_signature(vec_sig); - - generate_vec_body_from_N_scalars(ctx, &vec_sig->body, declarations); - } else { - assert(types[i].is_matrix()); - - generate_mat_body_from_scalar(ctx, &sig->body, declarations); - - ir_function_signature *const mat_sig = - generate_constructor_intro(ctx, - &types[i], - (types[i].vector_elements - * types[i].matrix_columns), - declarations); - f->add_signature(mat_sig); - - generate_mat_body_from_N_scalars(ctx, &mat_sig->body, declarations); - } - } -} - - -void -generate_110_constructors(glsl_symbol_table *symtab, exec_list *instructions) -{ - generate_constructor(symtab, builtin_core_types, - Elements(builtin_core_types), instructions); -} - - -void -generate_120_constructors(glsl_symbol_table *symtab, exec_list *instructions) -{ - generate_110_constructors(symtab, instructions); - - generate_constructor(symtab, builtin_120_types, - Elements(builtin_120_types), instructions); -} - - -void -generate_130_constructors(glsl_symbol_table *symtab, exec_list *instructions) -{ - generate_120_constructors(symtab, instructions); - - generate_constructor(symtab, builtin_130_types, - Elements(builtin_130_types), instructions); -} - - -void -_mesa_glsl_initialize_constructors(exec_list *instructions, - struct _mesa_glsl_parse_state *state) -{ - switch (state->language_version) { - case 110: - generate_110_constructors(state->symbols, instructions); - break; - case 120: - generate_120_constructors(state->symbols, instructions); - break; - case 130: - generate_130_constructors(state->symbols, instructions); - break; - default: - /* error */ - break; - } -} - - glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) : base_type(GLSL_TYPE_ARRAY), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 93cf60be8d..b753742b91 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -440,10 +440,6 @@ extern "C" { extern void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); -extern void -_mesa_glsl_initialize_constructors(struct exec_list *instructions, - struct _mesa_glsl_parse_state *state); - #ifdef __cplusplus } #endif -- cgit v1.2.3 From 4b6feb0398458a69259e3b77d7a8573b926f2039 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 13:22:55 -0700 Subject: glsl2: Use talloc_strdup when generating constructor temporary names --- src/glsl/ast_function.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index e23d789fa9..f3074a362d 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -481,7 +481,8 @@ emit_inline_vector_constructor(const glsl_type *type, { assert(!parameters->is_empty()); - ir_variable *var = new(ctx) ir_variable(type, strdup("vec_ctor")); + ir_variable *var = new(ctx) ir_variable(type, + talloc_strdup(ctx, "vec_ctor")); instructions->push_tail(var); /* There are two kinds of vector constructors. @@ -592,7 +593,8 @@ emit_inline_matrix_constructor(const glsl_type *type, { assert(!parameters->is_empty()); - ir_variable *var = new(ctx) ir_variable(type, strdup("mat_ctor")); + ir_variable *var = new(ctx) ir_variable(type, + talloc_strdup(ctx, "mat_ctor")); instructions->push_tail(var); /* There are three kinds of matrix constructors. @@ -614,8 +616,9 @@ emit_inline_matrix_constructor(const glsl_type *type, /* 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, - strdup("mat_ctor_vec")); + ir_variable *rhs_var = + new(ctx) ir_variable(glsl_type::vec4_type, + talloc_strdup(ctx, "mat_ctor_vec")); instructions->push_tail(rhs_var); ir_constant_data zero; @@ -727,8 +730,9 @@ emit_inline_matrix_constructor(const glsl_type *type, * 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, - strdup("mat_ctor_mat")); + ir_variable *const rhs_var = + new(ctx) ir_variable(first_param->type, + talloc_strdup(ctx, "mat_ctor_mat")); instructions->push_tail(rhs_var); ir_dereference *const rhs_var_ref = @@ -792,8 +796,9 @@ emit_inline_matrix_constructor(const glsl_type *type, /* 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, - strdup("mat_ctor_vec")); + ir_variable *rhs_var = + new(ctx) ir_variable(rhs->type, + talloc_strdup(ctx, "mat_ctor_vec")); instructions->push_tail(rhs_var); ir_dereference *rhs_var_ref = -- cgit v1.2.3 From e94642eb0d99ff7f6cdaee31ed4f5f29bdabd6f7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 11:01:57 -0700 Subject: glsl_type: Make all static objects be class private --- src/glsl/builtin_types.h | 22 +++++++++---------- src/glsl/glsl_types.cpp | 32 ++++++++++++++------------- src/glsl/glsl_types.h | 57 +++++++++++++++++++++++++++++++++++++----------- 3 files changed, 72 insertions(+), 39 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index 526421a017..bd8f8b583a 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -25,13 +25,13 @@ #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif -static const struct glsl_type _error_type = +const glsl_type glsl_type::_error_type = glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, ""); -static const struct glsl_type void_type = +const glsl_type glsl_type::void_type = glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void"); -const glsl_type *const glsl_type::error_type = & _error_type; +const glsl_type *const glsl_type::error_type = & glsl_type::_error_type; /** \name Core built-in types * @@ -39,7 +39,7 @@ const glsl_type *const glsl_type::error_type = & _error_type; */ /*@{*/ -static const struct glsl_type builtin_core_types[] = { +const glsl_type glsl_type::builtin_core_types[] = { glsl_type(GL_BOOL, GLSL_TYPE_BOOL, 1, 1, "bool"), glsl_type(GL_BOOL_VEC2, GLSL_TYPE_BOOL, 2, 1, "bvec2"), glsl_type(GL_BOOL_VEC3, GLSL_TYPE_BOOL, 3, 1, "bvec3"), @@ -91,7 +91,7 @@ static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = { { glsl_type::float_type, "diff" }, }; -static const struct glsl_type builtin_structure_types[] = { +const glsl_type glsl_type::builtin_structure_types[] = { glsl_type(gl_DepthRangeParameters_fields, Elements(gl_DepthRangeParameters_fields), "gl_DepthRangeParameters"), @@ -157,7 +157,7 @@ static const struct glsl_struct_field gl_FogParameters_fields[] = { { glsl_type::float_type, "scale" }, }; -static const struct glsl_type builtin_110_deprecated_structure_types[] = { +const glsl_type glsl_type::builtin_110_deprecated_structure_types[] = { glsl_type(gl_PointParameters_fields, Elements(gl_PointParameters_fields), "gl_PointParameters"), @@ -186,7 +186,7 @@ static const struct glsl_type builtin_110_deprecated_structure_types[] = { */ /*@{*/ -static const struct glsl_type builtin_120_types[] = { +const glsl_type glsl_type::builtin_120_types[] = { glsl_type(GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2, "mat2x3"), glsl_type(GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2, "mat2x4"), glsl_type(GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3, "mat3x2"), @@ -206,7 +206,7 @@ const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5]; */ /*@{*/ -static const struct glsl_type builtin_130_types[] = { +const glsl_type glsl_type::builtin_130_types[] = { glsl_type(GL_UNSIGNED_INT, GLSL_TYPE_UINT, 1, 1, "uint"), glsl_type(GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1, "uvec2"), glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"), @@ -261,7 +261,7 @@ const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3]; */ /*@{*/ -static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { +const glsl_type glsl_type::builtin_ARB_texture_rectangle_types[] = { glsl_type(GL_SAMPLER_2D_RECT, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"), glsl_type(GL_SAMPLER_2D_RECT_SHADOW, @@ -273,7 +273,7 @@ static const struct glsl_type builtin_ARB_texture_rectangle_types[] = { */ /*@{*/ -static const struct glsl_type builtin_EXT_texture_array_types[] = { +const glsl_type glsl_type::builtin_EXT_texture_array_types[] = { glsl_type(GL_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW, @@ -289,7 +289,7 @@ static const struct glsl_type builtin_EXT_texture_array_types[] = { */ /*@{*/ -static const struct glsl_type builtin_EXT_texture_buffer_object_types[] = { +const glsl_type glsl_type::builtin_EXT_texture_buffer_object_types[] = { glsl_type(GL_SAMPLER_BUFFER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"), glsl_type(GL_INT_SAMPLER_BUFFER, diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index ff157080ff..69bed33d81 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -46,8 +46,8 @@ add_types_to_symbol_table(glsl_symbol_table *symtab, } -static void -generate_110_types(glsl_symbol_table *symtab) +void +glsl_type::generate_110_types(glsl_symbol_table *symtab) { add_types_to_symbol_table(symtab, builtin_core_types, Elements(builtin_core_types), @@ -62,8 +62,8 @@ generate_110_types(glsl_symbol_table *symtab) } -static void -generate_120_types(glsl_symbol_table *symtab) +void +glsl_type::generate_120_types(glsl_symbol_table *symtab) { generate_110_types(symtab); @@ -72,8 +72,8 @@ generate_120_types(glsl_symbol_table *symtab) } -static void -generate_130_types(glsl_symbol_table *symtab) +void +glsl_type::generate_130_types(glsl_symbol_table *symtab) { generate_120_types(symtab); @@ -82,8 +82,9 @@ generate_130_types(glsl_symbol_table *symtab) } -static void -generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, bool warn) +void +glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, + bool warn) { add_types_to_symbol_table(symtab, builtin_ARB_texture_rectangle_types, Elements(builtin_ARB_texture_rectangle_types), @@ -91,8 +92,9 @@ generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, bool warn) } -static void -generate_EXT_texture_array_types(glsl_symbol_table *symtab, bool warn) +void +glsl_type::generate_EXT_texture_array_types(glsl_symbol_table *symtab, + bool warn) { add_types_to_symbol_table(symtab, builtin_EXT_texture_array_types, Elements(builtin_EXT_texture_array_types), @@ -105,13 +107,13 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) { switch (state->language_version) { case 110: - generate_110_types(state->symbols); + glsl_type::generate_110_types(state->symbols); break; case 120: - generate_120_types(state->symbols); + glsl_type::generate_120_types(state->symbols); break; case 130: - generate_130_types(state->symbols); + glsl_type::generate_130_types(state->symbols); break; default: /* error */ @@ -119,13 +121,13 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) } if (state->ARB_texture_rectangle_enable) { - generate_ARB_texture_rectangle_types(state->symbols, + glsl_type::generate_ARB_texture_rectangle_types(state->symbols, state->ARB_texture_rectangle_warn); } if (state->EXT_texture_array_enable && state->language_version < 130) { // These are already included in 130; don't create twice. - generate_EXT_texture_array_types(state->symbols, + glsl_type::generate_EXT_texture_array_types(state->symbols, state->EXT_texture_array_warn); } } diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index b753742b91..c62d290def 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -34,6 +34,11 @@ extern "C" { #include } +struct _mesa_glsl_parse_state; + +extern "C" void +_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); + #define GLSL_TYPE_UINT 0 #define GLSL_TYPE_INT 1 #define GLSL_TYPE_FLOAT 2 @@ -424,6 +429,45 @@ private: static int array_key_compare(const void *a, const void *b); static unsigned array_key_hash(const void *key); + + /** + * \name Pointers to various type singletons + */ + /*@{*/ + static const glsl_type _error_type; + static const glsl_type void_type; + static const glsl_type builtin_core_types[]; + static const glsl_type builtin_structure_types[]; + static const glsl_type builtin_110_deprecated_structure_types[]; + static const glsl_type builtin_120_types[]; + static const glsl_type builtin_130_types[]; + static const glsl_type builtin_ARB_texture_rectangle_types[]; + static const glsl_type builtin_EXT_texture_array_types[]; + static const glsl_type builtin_EXT_texture_buffer_object_types[]; + /*@}*/ + + /** + * \name Methods to populate a symbol table with built-in types. + * + * \internal + * This is one of the truely annoying things about C++. Methods that are + * completely internal and private to a type still have to be advertised to + * the world in a public header file. + */ + /*@{*/ + static void generate_110_types(class glsl_symbol_table *); + static void generate_120_types(class glsl_symbol_table *); + static void generate_130_types(class glsl_symbol_table *); + static void generate_ARB_texture_rectangle_types(class glsl_symbol_table *, + bool); + static void generate_EXT_texture_array_types(class glsl_symbol_table *, + bool); + /** + * This function is a friend because it needs to call the various + * generate_*_types functions and it has C linkage. + */ + friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *); + /*@}*/ }; struct glsl_struct_field { @@ -431,17 +475,4 @@ struct glsl_struct_field { const char *name; }; -struct _mesa_glsl_parse_state; - -#ifdef __cplusplus -extern "C" { -#endif - -extern void -_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); - -#ifdef __cplusplus -} -#endif - #endif /* GLSL_TYPES_H */ -- cgit v1.2.3 From 31bcce04b1f9c8c5e33370e26a3a9d6e60049aa8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 11:09:40 -0700 Subject: glsl_type: Vector, matrix, and sampler type constructors are private --- src/glsl/glsl_types.cpp | 31 +++++++++++++++++++++++++++++++ src/glsl/glsl_types.h | 45 +++++++++++---------------------------------- 2 files changed, 42 insertions(+), 34 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 69bed33d81..158659c71e 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -33,6 +33,37 @@ extern "C" { hash_table *glsl_type::array_types = NULL; +glsl_type::glsl_type(GLenum gl_type, + unsigned base_type, unsigned vector_elements, + unsigned matrix_columns, const char *name) : + gl_type(gl_type), + base_type(base_type), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(vector_elements), matrix_columns(matrix_columns), + name(name), + length(0) +{ + /* Neither dimension is zero or both dimensions are zero. + */ + assert((vector_elements == 0) == (matrix_columns == 0)); + memset(& fields, 0, sizeof(fields)); +} + +glsl_type::glsl_type(GLenum gl_type, + enum glsl_sampler_dim dim, bool shadow, bool array, + unsigned type, const char *name) : + gl_type(gl_type), + base_type(GLSL_TYPE_SAMPLER), + sampler_dimensionality(dim), sampler_shadow(shadow), + sampler_array(array), sampler_type(type), + vector_elements(0), matrix_columns(0), + name(name), + length(0) +{ + memset(& fields, 0, sizeof(fields)); +} + static void add_types_to_symbol_table(glsl_symbol_table *symtab, const struct glsl_type *types, diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index c62d290def..e1bfd34f4e 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -158,37 +158,6 @@ struct glsl_type { /*@}*/ - glsl_type(GLenum gl_type, - unsigned base_type, unsigned vector_elements, - unsigned matrix_columns, const char *name) : - gl_type(gl_type), - base_type(base_type), - sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), - sampler_type(0), - vector_elements(vector_elements), matrix_columns(matrix_columns), - name(name), - length(0) - { - /* Neither dimension is zero or both dimensions are zero. - */ - assert((vector_elements == 0) == (matrix_columns == 0)); - memset(& fields, 0, sizeof(fields)); - } - - glsl_type(GLenum gl_type, - enum glsl_sampler_dim dim, bool shadow, bool array, - unsigned type, const char *name) : - gl_type(gl_type), - base_type(GLSL_TYPE_SAMPLER), - sampler_dimensionality(dim), sampler_shadow(shadow), - sampler_array(array), sampler_type(type), - vector_elements(0), matrix_columns(0), - name(name), - length(0) - { - memset(& fields, 0, sizeof(fields)); - } - glsl_type(const glsl_struct_field *fields, unsigned num_fields, const char *name) : base_type(GLSL_TYPE_STRUCT), @@ -419,9 +388,17 @@ struct glsl_type { } private: - /** - * Constructor for array types - */ + /** Constructor for vector and matrix types */ + glsl_type(GLenum gl_type, + unsigned base_type, unsigned vector_elements, + unsigned matrix_columns, const char *name); + + /** Constructor for sampler types */ + glsl_type(GLenum gl_type, + enum glsl_sampler_dim dim, bool shadow, bool array, + unsigned type, const char *name); + + /** Constructor for array types */ glsl_type(void *ctx, const glsl_type *array, unsigned length); /** Hash table containing the known array types. */ -- cgit v1.2.3 From 49e3577b91f44013746f7a3db411e7041b7d899e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 11:54:57 -0700 Subject: glsl_type: Add get_record_instance method --- src/glsl/ast_to_hir.cpp | 4 +-- src/glsl/glsl_types.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ src/glsl/glsl_types.h | 12 +++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 54a8e9e00a..664e4687c4 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2383,7 +2383,6 @@ ir_rvalue * ast_struct_specifier::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); unsigned decl_count = 0; /* Make an initial pass over the list of structure fields to determine how @@ -2446,7 +2445,8 @@ ast_struct_specifier::hir(exec_list *instructions, name = this->name; } - glsl_type *t = new(ctx) glsl_type(fields, decl_count, name); + const glsl_type *t = + glsl_type::get_record_instance(fields, decl_count, name); YYLTYPE loc = this->get_location(); if (!state->symbols->add_type(name, t)) { diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 158659c71e..672a7f7cd1 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -32,6 +32,7 @@ extern "C" { } hash_table *glsl_type::array_types = NULL; +hash_table *glsl_type::record_types = NULL; glsl_type::glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, @@ -384,6 +385,77 @@ glsl_type::get_array_instance(void *ctx, const glsl_type *base, } +int +glsl_type::record_key_compare(const void *a, const void *b) +{ + const glsl_type *const key1 = (glsl_type *) a; + const glsl_type *const key2 = (glsl_type *) b; + + /* Return zero is the types match (there is zero difference) or non-zero + * otherwise. + */ + if (strcmp(key1->name, key2->name) != 0) + return 1; + + if (key1->length != key2->length) + return 1; + + for (unsigned i = 0; i < key1->length; i++) + /* FINISHME: Is the name of the structure field also significant? */ + if (key1->fields.structure[i].type != key2->fields.structure[i].type) + return 1; + + return 0; +} + + +unsigned +glsl_type::record_key_hash(const void *a) +{ + const glsl_type *const key = (glsl_type *) a; + char hash_key[128]; + unsigned size = 0; + + size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length); + + for (unsigned i = 0; i < key->length; i++) { + if (size >= sizeof(hash_key)) + break; + + size += snprintf(& hash_key[size], sizeof(hash_key) - size, + "%p", key->fields.structure[i].type); + } + + return hash_table_string_hash(& hash_key); +} + + +const glsl_type * +glsl_type::get_record_instance(const glsl_struct_field *fields, + unsigned num_fields, + const char *name) +{ + const glsl_type key(fields, num_fields, name); + + if (record_types == NULL) { + record_types = hash_table_ctor(64, record_key_hash, record_key_compare); + } + + const glsl_type *t = (glsl_type *) hash_table_find(record_types, & key); + if (t == NULL) { + t = new(NULL) glsl_type(fields, num_fields, name); + + hash_table_insert(record_types, (void *) t, t); + } + + assert(t->base_type == GLSL_TYPE_STRUCT); + assert(t->length == num_fields); + assert(strcmp(t->name, name) == 0); + + return t; +} + + const glsl_type * glsl_type::field_type(const char *name) const { diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index e1bfd34f4e..a1c9fae4f9 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -205,6 +205,12 @@ struct glsl_type { const glsl_type *base, unsigned elements); + /** + * Get the instance of a record type + */ + static const glsl_type *get_record_instance(const glsl_struct_field *fields, + unsigned num_fields, + const char *name); /** * Generate the constructor for this type and add it to the symbol table */ @@ -407,6 +413,12 @@ private: static int array_key_compare(const void *a, const void *b); static unsigned array_key_hash(const void *key); + /** Hash table containing the known record types. */ + static struct hash_table *record_types; + + static int record_key_compare(const void *a, const void *b); + static unsigned record_key_hash(const void *key); + /** * \name Pointers to various type singletons */ -- cgit v1.2.3 From 72e627d02a78cbf40c861384293e355588fd0977 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 11:57:38 -0700 Subject: glsl_type: Record type constructors are private --- src/glsl/glsl_types.cpp | 12 ++++++++++++ src/glsl/glsl_types.h | 16 ++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 672a7f7cd1..f910efddde 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -65,6 +65,18 @@ glsl_type::glsl_type(GLenum gl_type, memset(& fields, 0, sizeof(fields)); } +glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, + const char *name) : + base_type(GLSL_TYPE_STRUCT), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(0), matrix_columns(0), + name(name), + length(num_fields) +{ + this->fields.structure = fields; +} + static void add_types_to_symbol_table(glsl_symbol_table *symtab, const struct glsl_type *types, diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index a1c9fae4f9..fc94bea1cc 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -158,18 +158,6 @@ struct glsl_type { /*@}*/ - glsl_type(const glsl_struct_field *fields, unsigned num_fields, - const char *name) : - base_type(GLSL_TYPE_STRUCT), - sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), - sampler_type(0), - vector_elements(0), matrix_columns(0), - name(name), - length(num_fields) - { - this->fields.structure = fields; - } - /** * For numeric and boolean derrived types returns the basic scalar type * @@ -404,6 +392,10 @@ private: enum glsl_sampler_dim dim, bool shadow, bool array, unsigned type, const char *name); + /** Constructor for record types */ + glsl_type(const glsl_struct_field *fields, unsigned num_fields, + const char *name); + /** Constructor for array types */ glsl_type(void *ctx, const glsl_type *array, unsigned length); -- cgit v1.2.3 From e1374d48ded09dba576f5a2b86c3d11984d1f7c4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 12:19:52 -0700 Subject: glsl_type: All glsl_type objects live in their own talloc context --- src/glsl/glsl_types.cpp | 5 +++-- src/glsl/glsl_types.h | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index f910efddde..0d807fbc3d 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -33,6 +33,7 @@ extern "C" { hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; +void *glsl_type::ctx = NULL; glsl_type::glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, @@ -384,7 +385,7 @@ glsl_type::get_array_instance(void *ctx, const glsl_type *base, const glsl_type *t = (glsl_type *) hash_table_find(array_types, & key); if (t == NULL) { - t = new(ctx) glsl_type(ctx, base, array_size); + t = new glsl_type(ctx, base, array_size); hash_table_insert(array_types, (void *) t, t); } @@ -455,7 +456,7 @@ glsl_type::get_record_instance(const glsl_struct_field *fields, const glsl_type *t = (glsl_type *) hash_table_find(record_types, & key); if (t == NULL) { - t = new(NULL) glsl_type(fields, num_fields, name); + t = new glsl_type(fields, num_fields, name); hash_table_insert(record_types, (void *) t, t); } diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index fc94bea1cc..1147d38ca6 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -74,11 +74,16 @@ struct glsl_type { /* Callers of this talloc-based new need not call delete. It's * easier to just talloc_free 'ctx' (or any of its ancestors). */ - static void* operator new(size_t size, void *ctx) + static void* operator new(size_t size) { + if (glsl_type::ctx == NULL) { + glsl_type::ctx = talloc_init("glsl_type"); + assert(glsl_type::ctx != NULL); + } + void *type; - type = talloc_size(ctx, size); + type = talloc_size(glsl_type::ctx, size); assert(type != NULL); return type; @@ -382,6 +387,13 @@ struct glsl_type { } private: + /** + * talloc context for all glsl_type allocations + * + * Set on the first call to \c glsl_type::new. + */ + static TALLOC_CTX *ctx; + /** Constructor for vector and matrix types */ glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, -- cgit v1.2.3 From efc15f862b08a9f035c06a79bc43848cca740372 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Jun 2010 13:17:18 -0700 Subject: glsl_type: Add _mesa_glsl_release_types to release all type related storage --- src/glsl/glsl_types.cpp | 20 ++++++++++++++++++++ src/glsl/glsl_types.h | 14 ++++++++++++-- src/glsl/main.cpp | 1 + 3 files changed, 33 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 0d807fbc3d..806b71495d 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -195,6 +195,26 @@ const glsl_type *glsl_type::get_base_type() const } +void +_mesa_glsl_release_types(void) +{ + if (glsl_type::array_types != NULL) { + hash_table_dtor(glsl_type::array_types); + glsl_type::array_types = NULL; + } + + if (glsl_type::record_types != NULL) { + hash_table_dtor(glsl_type::record_types); + glsl_type::record_types = NULL; + } + + if (glsl_type::ctx != NULL) { + talloc_free(glsl_type::ctx); + glsl_type::ctx = NULL; + } +} + + ir_function * glsl_type::generate_constructor(glsl_symbol_table *symtab) const { diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 1147d38ca6..e869071cab 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -39,6 +39,9 @@ struct _mesa_glsl_parse_state; extern "C" void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); +extern "C" void +_mesa_glsl_release_types(void); + #define GLSL_TYPE_UINT 0 #define GLSL_TYPE_INT 1 #define GLSL_TYPE_FLOAT 2 @@ -455,11 +458,18 @@ private: bool); static void generate_EXT_texture_array_types(class glsl_symbol_table *, bool); + /*@}*/ + /** - * This function is a friend because it needs to call the various - * generate_*_types functions and it has C linkage. + * \name Friend functions. + * + * These functions are friends because they must have C linkage and the + * need to call various private methods or access various private static + * data. */ + /*@{*/ friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *); + friend void _mesa_glsl_release_types(void); /*@}*/ }; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 16b2cf84c5..342cf98840 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -258,6 +258,7 @@ main(int argc, char **argv) } talloc_free(whole_program); + _mesa_glsl_release_types(); return status; } -- cgit v1.2.3 From 5e18b051c039564d1998818d08caf1bff3983630 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 14:21:05 -0700 Subject: glsl2: Pass MaxDrawBuffers from core Mesa into the GLSL compiler --- src/glsl/glsl_parser_extras.h | 9 +++++++++ src/glsl/ir_variable.cpp | 46 ++++++++++++++++++++---------------------- src/glsl/main.cpp | 2 ++ src/mesa/shader/ir_to_mesa.cpp | 2 ++ 4 files changed, 35 insertions(+), 24 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 726bafa7e4..f957a926be 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -43,6 +43,15 @@ struct _mesa_glsl_parse_state { unsigned language_version; enum _mesa_glsl_parser_targets target; + /** + * Implementation defined limits that affect built-in variables, etc. + * + * \sa struct gl_constants (in mtypes.h) + */ + struct { + unsigned MaxDrawBuffers; + } Const; + /** * During AST to IR conversion, pointer to current IR function * diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 15a4a92f62..44c3065107 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -221,20 +221,20 @@ initialize_vs_variables(exec_list *instructions, static void generate_110_fs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { add_builtin_variable(& builtin_core_fs_variables[i], - instructions, symtab); + instructions, state->symbols); } for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_fs_variables) ; i++) { add_builtin_variable(& builtin_110_deprecated_fs_variables[i], - instructions, symtab); + instructions, state->symbols); } - generate_110_uniforms(instructions, symtab); + generate_110_uniforms(instructions, state->symbols); /* FINISHME: The size of this array is implementation dependent based on the * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports @@ -242,27 +242,25 @@ generate_110_fs_variables(exec_list *instructions, * FINISHME: for now. */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4); + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 4); add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, - instructions, symtab); + instructions, state->symbols); } static void generate_ARB_draw_buffers_fs_variables(exec_list *instructions, - glsl_symbol_table *symtab, bool warn) + struct _mesa_glsl_parse_state *state, + bool warn) { - /* FINISHME: The size of this array is implementation dependent based on the - * FINISHME: value of GL_MAX_DRAW_BUFFERS. GL_MAX_DRAW_BUFFERS must be - * FINISHME: at least 1, so hard-code 1 for now. - */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 1); + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, + state->Const.MaxDrawBuffers); ir_variable *const fd = add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, - vec4_array_type, instructions, symtab); + vec4_array_type, instructions, state->symbols); if (warn) fd->warn_extension = "GL_ARB_draw_buffers"; @@ -271,18 +269,18 @@ generate_ARB_draw_buffers_fs_variables(exec_list *instructions, static void generate_120_fs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { - generate_110_fs_variables(instructions, symtab); - generate_ARB_draw_buffers_fs_variables(instructions, symtab, false); + generate_110_fs_variables(instructions, state); + generate_ARB_draw_buffers_fs_variables(instructions, state, false); } static void generate_130_fs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { - void *ctx = symtab; - generate_120_fs_variables(instructions, symtab); + void *ctx = state->symbols; + generate_120_fs_variables(instructions, state); /* FINISHME: The size of this array is implementation dependent based on * FINISHME: the value of GL_MAX_CLIP_DISTANCES. @@ -292,7 +290,7 @@ generate_130_fs_variables(exec_list *instructions, /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, - instructions, symtab); + instructions, state->symbols); } static void @@ -302,13 +300,13 @@ initialize_fs_variables(exec_list *instructions, switch (state->language_version) { case 110: - generate_110_fs_variables(instructions, state->symbols); + generate_110_fs_variables(instructions, state); break; case 120: - generate_120_fs_variables(instructions, state->symbols); + generate_120_fs_variables(instructions, state); break; case 130: - generate_130_fs_variables(instructions, state->symbols); + generate_130_fs_variables(instructions, state); break; } @@ -318,7 +316,7 @@ initialize_fs_variables(exec_list *instructions, */ if (state->language_version < 120) { if (state->ARB_draw_buffers_enable) { - generate_ARB_draw_buffers_fs_variables(instructions, state->symbols, + generate_ARB_draw_buffers_fs_variables(instructions, state, state->ARB_draw_buffers_warn); } } diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 342cf98840..f1dab7b576 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -123,6 +123,8 @@ compile_shader(struct glsl_shader *shader) state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; + state->Const.MaxDrawBuffers = 2; + /* Create a new context for the preprocessor output. Ultimately, this * should probably be the parser context, but there isn't one yet. */ diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 1232bada27..ab8aca0a81 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1526,6 +1526,8 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; + state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + /* Create a new context for the preprocessor output. Ultimately, this * should probably be the parser context, but there isn't one yet. */ -- cgit v1.2.3 From 9c4b1f2bad97b1b83c6bf01db567be5494dfaee5 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 15:10:09 -0700 Subject: glsl2: Make gl_FragData be available in GLSL 1.10 too --- src/glsl/ir_variable.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 44c3065107..6e466fa6d1 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -30,6 +30,9 @@ #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif +static void generate_ARB_draw_buffers_fs_variables(exec_list *, + struct _mesa_glsl_parse_state *, bool); + static ir_variable * add_variable(const char *name, enum ir_variable_mode mode, int slot, const glsl_type *type, exec_list *instructions, @@ -246,6 +249,8 @@ generate_110_fs_variables(exec_list *instructions, add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, instructions, state->symbols); + + generate_ARB_draw_buffers_fs_variables(instructions, state, false); } @@ -272,7 +277,6 @@ generate_120_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { generate_110_fs_variables(instructions, state); - generate_ARB_draw_buffers_fs_variables(instructions, state, false); } static void @@ -309,17 +313,6 @@ initialize_fs_variables(exec_list *instructions, generate_130_fs_variables(instructions, state); break; } - - - /* Since GL_ARB_draw_buffers is included in GLSL 1.20 and later, we - * can basically ignore any extension settings for it. - */ - if (state->language_version < 120) { - if (state->ARB_draw_buffers_enable) { - generate_ARB_draw_buffers_fs_variables(instructions, state, - state->ARB_draw_buffers_warn); - } - } } void -- cgit v1.2.3 From e2f84f04e5df1d4364694e5f150058f7c847550e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 15:19:11 -0700 Subject: glsl2: Make gl_MaxDrawBuffers available in the fragment shader --- src/glsl/ir_variable.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 6e466fa6d1..e298a0e06b 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -42,6 +42,9 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, var->mode = mode; switch (var->mode) { + case ir_var_auto: + var->read_only = true; + break; case ir_var_in: var->shader_in = true; var->read_only = true; @@ -259,6 +262,18 @@ generate_ARB_draw_buffers_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state, bool warn) { + assert(state->Const.MaxDrawBuffers >= 1); + + ir_variable *const mdb = + add_variable("gl_MaxDrawBuffers", ir_var_auto, -1, + glsl_type::int_type, instructions, state->symbols); + + if (warn) + mdb->warn_extension = "GL_ARB_draw_buffers"; + + mdb->constant_value = new(mdb) + ir_constant(int(state->Const.MaxDrawBuffers)); + const glsl_type *const vec4_array_type = glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, state->Const.MaxDrawBuffers); -- cgit v1.2.3 From 22971e922a72c8a433638429b635935fe80907ee Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 15:29:56 -0700 Subject: glsl2: Make gl_MaxDrawBuffers available in the vertex shader --- src/glsl/ir_variable.cpp | 74 +++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 32 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index e298a0e06b..ac168142dc 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -30,8 +30,9 @@ #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif -static void generate_ARB_draw_buffers_fs_variables(exec_list *, - struct _mesa_glsl_parse_state *, bool); +static void generate_ARB_draw_buffers_variables(exec_list *, + struct _mesa_glsl_parse_state *, + bool, _mesa_glsl_parser_targets); static ir_variable * add_variable(const char *name, enum ir_variable_mode mode, int slot, @@ -143,20 +144,20 @@ generate_110_uniforms(exec_list *instructions, static void generate_110_vs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { add_builtin_variable(& builtin_core_vs_variables[i], - instructions, symtab); + instructions, state->symbols); } for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_vs_variables) ; i++) { add_builtin_variable(& builtin_110_deprecated_vs_variables[i], - instructions, symtab); + instructions, state->symbols); } - generate_110_uniforms(instructions, symtab); + generate_110_uniforms(instructions, state->symbols); /* FINISHME: The size of this array is implementation dependent based on the * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports @@ -164,34 +165,37 @@ generate_110_vs_variables(exec_list *instructions, * FINISHME: for now. */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(symtab, glsl_type::vec4_type, 4); + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 4); add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, - instructions, symtab); + instructions, state->symbols); + + generate_ARB_draw_buffers_variables(instructions, state, false, + vertex_shader); } static void generate_120_vs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { /* GLSL version 1.20 did not add any built-in variables in the vertex * shader. */ - generate_110_vs_variables(instructions, symtab); + generate_110_vs_variables(instructions, state); } static void generate_130_vs_variables(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { - void *ctx = symtab; - generate_120_vs_variables(instructions, symtab); + void *ctx = state->symbols; + generate_120_vs_variables(instructions, state); for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { add_builtin_variable(& builtin_130_vs_variables[i], - instructions, symtab); + instructions, state->symbols); } /* FINISHME: The size of this array is implementation dependent based on @@ -202,7 +206,7 @@ generate_130_vs_variables(exec_list *instructions, /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, - instructions, symtab); + instructions, state->symbols); } @@ -214,13 +218,13 @@ initialize_vs_variables(exec_list *instructions, switch (state->language_version) { case 110: - generate_110_vs_variables(instructions, state->symbols); + generate_110_vs_variables(instructions, state); break; case 120: - generate_120_vs_variables(instructions, state->symbols); + generate_120_vs_variables(instructions, state); break; case 130: - generate_130_vs_variables(instructions, state->symbols); + generate_130_vs_variables(instructions, state); break; } } @@ -253,17 +257,18 @@ generate_110_fs_variables(exec_list *instructions, add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, instructions, state->symbols); - generate_ARB_draw_buffers_fs_variables(instructions, state, false); + generate_ARB_draw_buffers_variables(instructions, state, false, + fragment_shader); } static void -generate_ARB_draw_buffers_fs_variables(exec_list *instructions, - struct _mesa_glsl_parse_state *state, - bool warn) +generate_ARB_draw_buffers_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, _mesa_glsl_parser_targets target) { - assert(state->Const.MaxDrawBuffers >= 1); - + /* gl_MaxDrawBuffers is available in all shader stages. + */ ir_variable *const mdb = add_variable("gl_MaxDrawBuffers", ir_var_auto, -1, glsl_type::int_type, instructions, state->symbols); @@ -274,16 +279,21 @@ generate_ARB_draw_buffers_fs_variables(exec_list *instructions, mdb->constant_value = new(mdb) ir_constant(int(state->Const.MaxDrawBuffers)); - const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, - state->Const.MaxDrawBuffers); - ir_variable *const fd = - add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, - vec4_array_type, instructions, state->symbols); + /* gl_FragData is only available in the fragment shader. + */ + if (target == fragment_shader) { + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, + state->Const.MaxDrawBuffers); + + ir_variable *const fd = + add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, + vec4_array_type, instructions, state->symbols); - if (warn) - fd->warn_extension = "GL_ARB_draw_buffers"; + if (warn) + fd->warn_extension = "GL_ARB_draw_buffers"; + } } -- cgit v1.2.3 From 506199b852390e14a1d78392285bee8f06b6ede7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 15:59:27 -0700 Subject: glsl2: Keep the same number of components in implicit conversions. Fixes piglit test glsl-implicit-conversion-01. --- src/glsl/ast_to_hir.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 664e4687c4..ba29240092 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -109,6 +109,12 @@ apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, 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); -- cgit v1.2.3 From d4f7e660dd81e05b0829c1b70663b3959fd78f47 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 29 Jun 2010 14:16:11 -0700 Subject: ir_to_mesa: Start adding support for texture instructions. Fixes: glsl-fs-bug25902 glsl-fs-sampler-numbering glsl-lod-bias --- src/glsl/ir.h | 6 ++ src/mesa/shader/ir_to_mesa.cpp | 138 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 142 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index de1124975d..65026ef1f5 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -73,6 +73,7 @@ public: virtual class ir_function * as_function() { return NULL; } virtual class ir_dereference * as_dereference() { return NULL; } virtual class ir_dereference_array * as_dereference_array() { return NULL; } + virtual class ir_dereference_variable *as_dereference_variable() { return NULL; } virtual class ir_rvalue * as_rvalue() { return NULL; } virtual class ir_loop * as_loop() { return NULL; } virtual class ir_assignment * as_assignment() { return NULL; } @@ -987,6 +988,11 @@ public: virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_dereference_variable *as_dereference_variable() + { + return this; + } + /** * Get the variable that is ultimately referenced by an r-value */ diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index ab8aca0a81..f04518175d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -80,6 +80,8 @@ public: /** Pointer to the ir source this tree came from for debugging */ ir_instruction *ir; GLboolean cond_update; + int sampler; /**< sampler index */ + int tex_target; /**< One of TEXTURE_*_INDEX */ }; class temp_entry : public exec_node { @@ -173,6 +175,12 @@ public: ir_to_mesa_src_reg src0, ir_to_mesa_src_reg src1); + int *sampler_map; + int sampler_map_size; + + void map_sampler(int location, int sampler); + int get_sampler_number(int location); + void *mem_ctx; }; @@ -293,6 +301,25 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, src0, ir_to_mesa_undef, ir_to_mesa_undef); } +void +ir_to_mesa_visitor::map_sampler(int location, int sampler) +{ + if (this->sampler_map_size <= location) { + this->sampler_map = talloc_realloc(this->mem_ctx, this->sampler_map, + int, location + 1); + this->sampler_map_size = location + 1; + } + + this->sampler_map[location] = sampler; +} + +int +ir_to_mesa_visitor::get_sampler_number(int location) +{ + assert(location < this->sampler_map_size); + return this->sampler_map[location]; +} + inline ir_to_mesa_dst_reg ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) { @@ -901,6 +928,21 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) break; /* FINISHME: Fix up uniform name for arrays and things */ + if (ir->var->type->base_type == GLSL_TYPE_SAMPLER) { + /* FINISHME: we whack the location of the var here, which + * is probably not expected. But we need to communicate + * mesa's sampler number to the tex instruction. + */ + int sampler = _mesa_add_sampler(this->prog->Parameters, + ir->var->name, + ir->var->type->gl_type); + map_sampler(ir->var->location, sampler); + + entry = new(mem_ctx) temp_entry(ir->var, PROGRAM_SAMPLER, sampler); + this->variable_storage.push_tail(entry); + break; + } + assert(ir->var->type->gl_type != 0 && ir->var->type->gl_type != GL_INVALID_ENUM); loc = _mesa_add_uniform(this->prog->Parameters, @@ -908,6 +950,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) type_size(ir->var->type) * 4, ir->var->type->gl_type, NULL); + /* Always mark the uniform used at this point. If it isn't * used, dead code elimination should have nuked the decl already. */ @@ -1176,9 +1219,77 @@ ir_to_mesa_visitor::visit(ir_call *ir) void ir_to_mesa_visitor::visit(ir_texture *ir) { - assert(0); + ir_to_mesa_src_reg result_src, coord; + ir_to_mesa_dst_reg result_dst, lod_info; + ir_to_mesa_instruction *inst = NULL; ir->coordinate->accept(this); + coord = this->result; + + /* Storage for our result. Ideally for an assignment we'd be using + * the actual storage for the result here, instead. + */ + result_src = get_temp(glsl_type::vec4_type); + result_dst = ir_to_mesa_dst_reg_from_src(result_src); + + switch (ir->op) { + case ir_tex: + inst = ir_to_mesa_emit_op1(ir, OPCODE_TEX, result_dst, coord); + break; + case ir_txb: + /* Mesa IR stores bias in the last channel of the coords. */ + lod_info = ir_to_mesa_dst_reg_from_src(coord); + lod_info.writemask = WRITEMASK_W; + ir->lod_info.bias->accept(this); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, lod_info, this->result); + + inst = ir_to_mesa_emit_op1(ir, OPCODE_TXB, result_dst, coord); + break; + case ir_txl: + /* Mesa IR stores lod in the last channel of the coords. */ + lod_info = ir_to_mesa_dst_reg_from_src(coord); + lod_info.writemask = WRITEMASK_W; + ir->lod_info.lod->accept(this); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, lod_info, this->result); + + inst = ir_to_mesa_emit_op1(ir, OPCODE_TXL, result_dst, coord); + break; + case ir_txd: + case ir_txf: + assert(!"GLSL 1.30 features unsupported"); + break; + } + + ir_dereference_variable *sampler = ir->sampler->as_dereference_variable(); + assert(sampler); /* FINISHME: sampler arrays */ + /* generate the mapping, remove when we generate storage at + * declaration time + */ + sampler->accept(this); + + inst->sampler = get_sampler_number(sampler->var->location); + + switch (sampler->type->sampler_dimensionality) { + case GLSL_SAMPLER_DIM_1D: + inst->tex_target = TEXTURE_1D_INDEX; + break; + case GLSL_SAMPLER_DIM_2D: + inst->tex_target = TEXTURE_2D_INDEX; + break; + case GLSL_SAMPLER_DIM_3D: + inst->tex_target = TEXTURE_3D_INDEX; + break; + case GLSL_SAMPLER_DIM_CUBE: + inst->tex_target = TEXTURE_CUBE_INDEX; + break; + default: + assert(!"FINISHME: other texture targets"); + } + + assert(!ir->projector); /* FINISHME */ + assert(!ir->shadow_comparitor); /* FINISHME */ + + this->result = result_src; } void @@ -1245,6 +1356,8 @@ ir_to_mesa_visitor::ir_to_mesa_visitor() { result.file = PROGRAM_UNDEFINED; next_temp = 1; + sampler_map = NULL; + sampler_map_size = 0; } static struct prog_src_register @@ -1359,9 +1472,11 @@ print_program(struct prog_instruction *mesa_instructions, static void count_resources(struct gl_program *prog) { + unsigned int i; + prog->InputsRead = 0; prog->OutputsWritten = 0; - unsigned int i; + prog->SamplersUsed = 0; for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = &prog->Instructions[i]; @@ -1390,7 +1505,24 @@ count_resources(struct gl_program *prog) break; } } + + /* Instead of just using the uniform's value to map to a + * sampler, Mesa first allocates a separate number for the + * sampler (_mesa_add_sampler), then we reindex it down to a + * small integer (sampler_map[], SamplersUsed), then that gets + * mapped to the uniform's value, and we get an actual sampler. + */ + if (_mesa_is_tex_instruction(inst->Opcode)) { + prog->SamplerTargets[inst->TexSrcUnit] = + (gl_texture_index)inst->TexSrcTarget; + prog->SamplersUsed |= 1 << inst->TexSrcUnit; + if (inst->TexShadow) { + prog->ShadowSamplers |= 1 << inst->TexSrcUnit; + } + } } + + _mesa_update_shader_textures_used(prog); } /* Each stage has some uniforms in its Parameters list. The Uniforms @@ -1474,6 +1606,8 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) mesa_inst->SrcReg[0] = mesa_src_reg_from_ir_src_reg(inst->src_reg[0]); mesa_inst->SrcReg[1] = mesa_src_reg_from_ir_src_reg(inst->src_reg[1]); mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); + mesa_inst->TexSrcUnit = inst->sampler; + mesa_inst->TexSrcTarget = inst->tex_target; mesa_instruction_annotation[i] = inst->ir; mesa_inst++; -- cgit v1.2.3 From 16b68b1952d0da14b9ce8306efa64988ce46b4b7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 11:05:43 -0700 Subject: glsl2: Move our data from a glsl_shader* on the side to the main gl_shader *. This saves recompiling at link time. gl_shader->ir is made a pointer so that we don't have to bring exec_list into mtypes.h. --- src/glsl/linker.cpp | 48 +++++++++++++-------------- src/glsl/list.h | 19 +++++++++++ src/glsl/main.cpp | 47 +++++++++++++-------------- src/glsl/program.h | 22 ++----------- src/mesa/main/mtypes.h | 3 ++ src/mesa/shader/ir_to_mesa.cpp | 73 +++++++++++++----------------------------- src/mesa/shader/shader_api.c | 8 ++--- 7 files changed, 95 insertions(+), 125 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 8547f74ce6..df71f21b54 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -128,10 +128,10 @@ linker_error_printf(glsl_program *prog, const char *fmt, ...) void -invalidate_variable_locations(glsl_shader *sh, enum ir_variable_mode mode, +invalidate_variable_locations(gl_shader *sh, enum ir_variable_mode mode, int generic_base) { - foreach_list(node, &sh->ir) { + foreach_list(node, sh->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != (unsigned) mode)) @@ -187,7 +187,7 @@ count_attribute_slots(const glsl_type *t) */ bool validate_vertex_shader_executable(struct glsl_program *prog, - struct glsl_shader *shader) + struct gl_shader *shader) { if (shader == NULL) return true; @@ -198,7 +198,7 @@ validate_vertex_shader_executable(struct glsl_program *prog, } find_assignment_visitor find("gl_Position"); - find.run(&shader->ir); + find.run(shader->ir); if (!find.variable_found()) { linker_error_printf(prog, "vertex shader does not write to `gl_Position'\n"); @@ -216,7 +216,7 @@ validate_vertex_shader_executable(struct glsl_program *prog, */ bool validate_fragment_shader_executable(struct glsl_program *prog, - struct glsl_shader *shader) + struct gl_shader *shader) { if (shader == NULL) return true; @@ -229,8 +229,8 @@ validate_fragment_shader_executable(struct glsl_program *prog, find_assignment_visitor frag_color("gl_FragColor"); find_assignment_visitor frag_data("gl_FragData"); - frag_color.run(&shader->ir); - frag_data.run(&shader->ir); + frag_color.run(shader->ir); + frag_data.run(shader->ir); if (!frag_color.variable_found() && !frag_data.variable_found()) { linker_error_printf(prog, "fragment shader does not write to " @@ -259,7 +259,7 @@ cross_validate_uniforms(struct glsl_program *prog) */ glsl_symbol_table uniforms; for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - foreach_list(node, &prog->_LinkedShaders[i]->ir) { + foreach_list(node, prog->_LinkedShaders[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_uniform)) @@ -309,7 +309,7 @@ cross_validate_uniforms(struct glsl_program *prog) */ bool cross_validate_outputs_to_inputs(struct glsl_program *prog, - glsl_shader *producer, glsl_shader *consumer) + gl_shader *producer, gl_shader *consumer) { glsl_symbol_table parameters; /* FINISHME: Figure these out dynamically. */ @@ -318,7 +318,7 @@ cross_validate_outputs_to_inputs(struct glsl_program *prog, /* Find all shader outputs in the "producer" stage. */ - foreach_list(node, &producer->ir) { + foreach_list(node, producer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); /* FINISHME: For geometry shaders, this should also look for inout @@ -335,7 +335,7 @@ cross_validate_outputs_to_inputs(struct glsl_program *prog, * matching outputs already in the symbol table must have the same type and * qualifiers. */ - foreach_list(node, &consumer->ir) { + foreach_list(node, consumer->ir) { ir_variable *const input = ((ir_instruction *) node)->as_variable(); /* FINISHME: For geometry shaders, this should also look for inout @@ -423,7 +423,7 @@ assign_uniform_locations(struct glsl_program *prog) for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { unsigned next_position = 0; - foreach_list(node, &prog->_LinkedShaders[i]->ir) { + foreach_list(node, prog->_LinkedShaders[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_uniform)) @@ -540,7 +540,7 @@ assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index) unsigned used_locations = (max_attribute_index >= 32) ? ~0 : ~((1 << max_attribute_index) - 1); - glsl_shader *const sh = prog->_LinkedShaders[0]; + gl_shader *const sh = prog->_LinkedShaders[0]; assert(sh->Type == GL_VERTEX_SHADER); /* Operate in a total of four passes. @@ -644,7 +644,7 @@ assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index) unsigned num_attr = 0; - foreach_list(node, &sh->ir) { + foreach_list(node, sh->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_in)) @@ -694,7 +694,7 @@ assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index) void -assign_varying_locations(glsl_shader *producer, glsl_shader *consumer) +assign_varying_locations(gl_shader *producer, gl_shader *consumer) { /* FINISHME: Set dynamically when geometry shader support is added. */ unsigned output_index = VERT_RESULT_VAR0; @@ -714,7 +714,7 @@ assign_varying_locations(glsl_shader *producer, glsl_shader *consumer) invalidate_variable_locations(producer, ir_var_out, VERT_RESULT_VAR0); invalidate_variable_locations(consumer, ir_var_in, FRAG_ATTRIB_VAR0); - foreach_list(node, &producer->ir) { + foreach_list(node, producer->ir) { ir_variable *const output_var = ((ir_instruction *) node)->as_variable(); if ((output_var == NULL) || (output_var->mode != ir_var_out) @@ -740,7 +740,7 @@ assign_varying_locations(glsl_shader *producer, glsl_shader *consumer) input_index++; } - foreach_list(node, &producer->ir) { + foreach_list(node, producer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_out)) @@ -752,7 +752,7 @@ assign_varying_locations(glsl_shader *producer, glsl_shader *consumer) var->shader_out = (var->location != -1); } - foreach_list(node, &consumer->ir) { + foreach_list(node, consumer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_in)) @@ -780,13 +780,13 @@ link_shaders(struct glsl_program *prog) /* Separate the shaders into groups based on their type. */ - struct glsl_shader **vert_shader_list; + struct gl_shader **vert_shader_list; unsigned num_vert_shaders = 0; - struct glsl_shader **frag_shader_list; + struct gl_shader **frag_shader_list; unsigned num_frag_shaders = 0; - vert_shader_list = (struct glsl_shader **) - calloc(2 * prog->NumShaders, sizeof(struct glsl_shader *)); + vert_shader_list = (struct gl_shader **) + calloc(2 * prog->NumShaders, sizeof(struct gl_shader *)); frag_shader_list = &vert_shader_list[prog->NumShaders]; for (unsigned i = 0; i < prog->NumShaders; i++) { @@ -817,8 +817,8 @@ link_shaders(struct glsl_program *prog) goto done; - prog->_LinkedShaders = (struct glsl_shader **) - calloc(2, sizeof(struct glsl_shader *)); + prog->_LinkedShaders = (struct gl_shader **) + calloc(2, sizeof(struct gl_shader *)); prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { diff --git a/src/glsl/list.h b/src/glsl/list.h index 7732d66d7a..d449bdd8b1 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -272,6 +272,25 @@ struct exec_list { struct exec_node *tail_pred; #ifdef __cplusplus + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *node) + { + talloc_free(node); + } + exec_list() { make_empty(); diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index f1dab7b576..e78af42ac6 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -38,14 +38,13 @@ /* Returned string will have 'ctx' as its talloc owner. */ static char * -load_text_file(void *ctx, const char *file_name, size_t *size) +load_text_file(void *ctx, const char *file_name) { char *text = NULL; struct stat st; ssize_t total_read = 0; int fd = open(file_name, O_RDONLY); - *size = 0; if (fd < 0) { return NULL; } @@ -70,7 +69,6 @@ load_text_file(void *ctx, const char *file_name, size_t *size) } while (total_read < st.st_size); text[total_read] = '\0'; - *size = total_read; } } @@ -102,7 +100,7 @@ const struct option compiler_opts[] = { }; void -compile_shader(struct glsl_shader *shader) +compile_shader(struct gl_shader *shader) { struct _mesa_glsl_parse_state *state; @@ -145,40 +143,40 @@ compile_shader(struct glsl_shader *shader) printf("\n\n"); } - shader->ir.make_empty(); + shader->ir = new(shader) exec_list; if (!state->error && !state->translation_unit.is_empty()) - _mesa_ast_to_hir(&shader->ir, state); + _mesa_ast_to_hir(shader->ir, state); - validate_ir_tree(&shader->ir); + validate_ir_tree(shader->ir); /* Print out the unoptimized IR. */ if (!state->error && dump_hir) { - _mesa_print_ir(&shader->ir, state); + _mesa_print_ir(shader->ir, state); } /* Optimization passes */ - if (!state->error && !shader->ir.is_empty()) { + if (!state->error && !shader->ir->is_empty()) { bool progress; do { progress = false; - progress = do_function_inlining(&shader->ir) || progress; - progress = do_if_simplification(&shader->ir) || progress; - progress = do_copy_propagation(&shader->ir) || progress; - progress = do_dead_code_local(&shader->ir) || progress; - progress = do_dead_code_unlinked(state, &shader->ir) || progress; - progress = do_constant_variable_unlinked(&shader->ir) || progress; - progress = do_constant_folding(&shader->ir) || progress; - progress = do_vec_index_to_swizzle(&shader->ir) || progress; - progress = do_swizzle_swizzle(&shader->ir) || progress; + progress = do_function_inlining(shader->ir) || progress; + progress = do_if_simplification(shader->ir) || progress; + progress = do_copy_propagation(shader->ir) || progress; + progress = do_dead_code_local(shader->ir) || progress; + progress = do_dead_code_unlinked(state, shader->ir) || progress; + progress = do_constant_variable_unlinked(shader->ir) || progress; + progress = do_constant_folding(shader->ir) || progress; + progress = do_vec_index_to_swizzle(shader->ir) || progress; + progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); } - validate_ir_tree(&shader->ir); + validate_ir_tree(shader->ir); /* Print out the resulting IR */ if (!state->error && dump_lir) { - _mesa_print_ir(&shader->ir, state); + _mesa_print_ir(shader->ir, state); } shader->symbols = state->symbols; @@ -214,12 +212,12 @@ main(int argc, char **argv) assert(whole_program != NULL); for (/* empty */; argc > optind; optind++) { - whole_program->Shaders = (struct glsl_shader **) + whole_program->Shaders = (struct gl_shader **) talloc_realloc(whole_program, whole_program->Shaders, - struct glsl_shader *, whole_program->NumShaders + 1); + struct gl_shader *, whole_program->NumShaders + 1); assert(whole_program->Shaders != NULL); - struct glsl_shader *shader = talloc_zero(whole_program, glsl_shader); + struct gl_shader *shader = talloc_zero(whole_program, gl_shader); whole_program->Shaders[whole_program->NumShaders] = shader; whole_program->NumShaders++; @@ -238,8 +236,7 @@ main(int argc, char **argv) else usage_fail(argv[0]); - shader->Source = load_text_file(whole_program, - argv[optind], &shader->SourceLen); + shader->Source = load_text_file(whole_program, argv[optind]); if (shader->Source == NULL) { printf("File \"%s\" does not exist.\n", argv[optind]); exit(EXIT_FAILURE); diff --git a/src/glsl/program.h b/src/glsl/program.h index fd8197a45a..19c3a3e611 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -29,24 +29,6 @@ extern "C" { #include "shader/prog_uniform.h" } -/** - * Based on gl_shader in Mesa's mtypes.h. - */ -struct glsl_shader { - GLenum Type; - GLuint Name; - GLint RefCount; - GLboolean DeletePending; - GLboolean CompileStatus; - const GLchar *Source; /**< Source code string */ - size_t SourceLen; - GLchar *InfoLog; - - struct exec_list ir; - struct glsl_symbol_table *symbols; - struct gl_shader *mesa_shader; -}; - /** * Based on gl_shader_program in Mesa's mtypes.h. */ @@ -57,14 +39,14 @@ struct glsl_program { GLboolean DeletePending; GLuint NumShaders; /**< number of attached shaders */ - struct glsl_shader **Shaders; /**< List of attached the shaders */ + struct gl_shader **Shaders; /**< List of attached the shaders */ /** * Per-stage shaders resulting from the first stage of linking. */ /*@{*/ unsigned _NumLinkedShaders; - struct glsl_shader **_LinkedShaders; + struct gl_shader **_LinkedShaders; /*@}*/ /** User-defined attribute bindings (glBindAttribLocation) */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c34d9bac4a..6fc7e29baf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1966,6 +1966,9 @@ struct gl_shader struct gl_program *Program; /**< Post-compile assembly code */ GLchar *InfoLog; struct gl_sl_pragmas Pragmas; + + struct exec_list *ir; + struct glsl_symbol_table *symbols; }; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 85ede3e328..c2dde312ef 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1561,13 +1561,12 @@ link_uniforms_to_shared_uniform_list(struct gl_uniform_list *uniforms, } struct gl_program * -get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) +get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) { ir_to_mesa_visitor v; struct prog_instruction *mesa_instructions, *mesa_inst; ir_instruction **mesa_instruction_annotation; int i; - exec_list *instructions = &shader->ir; struct gl_program *prog; GLenum target; @@ -1587,7 +1586,7 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) v.prog = prog; v.mem_ctx = talloc_new(NULL); - visit_exec_list(instructions, &v); + visit_exec_list(shader->ir, &v); v.ir_to_mesa_emit_op1(NULL, OPCODE_END, ir_to_mesa_undef_dst, ir_to_mesa_undef); @@ -1635,27 +1634,18 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct glsl_shader *shader) prog->Instructions = mesa_instructions; prog->NumInstructions = num_instructions; - _mesa_reference_program(ctx, &shader->mesa_shader->Program, prog); + _mesa_reference_program(ctx, &shader->Program, prog); return prog; } -/* Takes a Mesa gl shader structure and compiles it, returning our Mesa-like - * structure with the IR and such attached. - */ -static struct glsl_shader * -_mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) +extern "C" { + +void +_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) { - struct glsl_shader *shader = talloc_zero(mem_ctx, struct glsl_shader); struct _mesa_glsl_parse_state *state; - shader->Type = sh->Type; - shader->Name = sh->Name; - shader->RefCount = 1; - shader->Source = sh->Source; - shader->SourceLen = strlen(sh->Source); - shader->mesa_shader = sh; - state = talloc_zero(shader, struct _mesa_glsl_parse_state); switch (shader->Type) { case GL_VERTEX_SHADER: state->target = vertex_shader; break; @@ -1665,7 +1655,7 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) state->scanner = NULL; state->translation_unit.make_empty(); - state->symbols = new(mem_ctx) glsl_symbol_table; + state->symbols = new(shader) glsl_symbol_table; state->info_log = talloc_strdup(shader, ""); state->error = false; state->temp_index = 0; @@ -1686,25 +1676,25 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) _mesa_glsl_lexer_dtor(state); } - shader->ir.make_empty(); + shader->ir = new(shader) exec_list; if (!state->error && !state->translation_unit.is_empty()) - _mesa_ast_to_hir(&shader->ir, state); + _mesa_ast_to_hir(shader->ir, state); /* Optimization passes */ - if (!state->error && !shader->ir.is_empty()) { + if (!state->error && !shader->ir->is_empty()) { bool progress; do { progress = false; - progress = do_function_inlining(&shader->ir) || progress; - progress = do_if_simplification(&shader->ir) || progress; - progress = do_copy_propagation(&shader->ir) || progress; - progress = do_dead_code_local(&shader->ir) || progress; - progress = do_dead_code_unlinked(state, &shader->ir) || progress; - progress = do_constant_variable_unlinked(&shader->ir) || progress; - progress = do_constant_folding(&shader->ir) || progress; - progress = do_vec_index_to_swizzle(&shader->ir) || progress; - progress = do_swizzle_swizzle(&shader->ir) || progress; + progress = do_function_inlining(shader->ir) || progress; + progress = do_if_simplification(shader->ir) || progress; + progress = do_copy_propagation(shader->ir) || progress; + progress = do_dead_code_local(shader->ir) || progress; + progress = do_dead_code_unlinked(state, shader->ir) || progress; + progress = do_constant_variable_unlinked(shader->ir) || progress; + progress = do_constant_folding(shader->ir) || progress; + progress = do_vec_index_to_swizzle(shader->ir) || progress; + progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); } @@ -1714,23 +1704,6 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh) shader->InfoLog = state->info_log; talloc_free(state); - - return shader; -} - -extern "C" { - -void -_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh) -{ - struct glsl_shader *shader; - TALLOC_CTX *mem_ctx = talloc_new(NULL); - - shader = _mesa_get_glsl_shader(ctx, mem_ctx, sh); - - sh->CompileStatus = shader->CompileStatus; - sh->InfoLog = strdup(shader->InfoLog); - talloc_free(mem_ctx); } void @@ -1738,18 +1711,16 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) { struct glsl_program *whole_program; unsigned int i; - _mesa_clear_shader_program_data(ctx, prog); whole_program = talloc_zero(NULL, struct glsl_program); whole_program->LinkStatus = GL_TRUE; whole_program->NumShaders = prog->NumShaders; - whole_program->Shaders = talloc_array(whole_program, struct glsl_shader *, + whole_program->Shaders = talloc_array(whole_program, struct gl_shader *, prog->NumShaders); for (i = 0; i < prog->NumShaders; i++) { - whole_program->Shaders[i] = _mesa_get_glsl_shader(ctx, whole_program, - prog->Shaders[i]); + whole_program->Shaders[i] = prog->Shaders[i]; if (!whole_program->Shaders[i]->CompileStatus) { whole_program->InfoLog = talloc_asprintf_append(whole_program->InfoLog, diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index a584f6072c..40b8286a13 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -44,7 +44,7 @@ #include "shader/prog_uniform.h" #include "shader/shader_api.h" #include "shader/uniforms.h" - +#include "talloc.h" /** * Allocate a new gl_shader_program object, initialize it. @@ -253,7 +253,7 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) { struct gl_shader *shader; assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); - shader = CALLOC_STRUCT(gl_shader); + shader = talloc_zero(NULL, struct gl_shader); if (shader) { shader->Type = type; shader->Name = name; @@ -268,10 +268,8 @@ _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) { if (sh->Source) free((void *) sh->Source); - if (sh->InfoLog) - free(sh->InfoLog); _mesa_reference_program(ctx, &sh->Program, NULL); - free(sh); + talloc_free(sh); } -- cgit v1.2.3 From 0eda9ae0a6bcd6a7e014df046c87fac5caee0e9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 11:51:54 -0700 Subject: glsl2: Make function names and variable names be children of the node. This avoids losing their memory when the parser state is freed. --- src/glsl/ir.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 4eb0e9e33e..60ee36d17c 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -733,7 +733,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name) mode(ir_var_auto), interpolation(ir_var_smooth), array_lvalue(false) { this->type = type; - this->name = name; + this->name = talloc_strdup(this, name); this->location = -1; this->warn_extension = NULL; this->constant_value = NULL; @@ -820,9 +820,8 @@ ir_function_signature::replace_parameters(exec_list *new_params) ir_function::ir_function(const char *name) - : name(name) { - /* empty */ + this->name = talloc_strdup(this, name); } -- cgit v1.2.3 From 849e18153cd91d812f694b806a84008498860bc3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 11:49:17 -0700 Subject: glsl2: Use Mesa's gl_shader_program instead of our own struct glsl_program. This avoids more allocation and shuffling of data around. --- src/glsl/linker.cpp | 16 ++++++++-------- src/glsl/main.cpp | 4 ++-- src/glsl/program.h | 34 +--------------------------------- src/mesa/main/mtypes.h | 3 +++ src/mesa/shader/ir_to_mesa.cpp | 39 +++++++++++++++++++-------------------- src/mesa/shader/shader_api.c | 6 +++--- 6 files changed, 36 insertions(+), 66 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index df71f21b54..719cae2f27 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -116,7 +116,7 @@ private: void -linker_error_printf(glsl_program *prog, const char *fmt, ...) +linker_error_printf(gl_shader_program *prog, const char *fmt, ...) { va_list ap; @@ -186,7 +186,7 @@ count_attribute_slots(const glsl_type *t) * \param shader Vertex shader executable to be verified */ bool -validate_vertex_shader_executable(struct glsl_program *prog, +validate_vertex_shader_executable(struct gl_shader_program *prog, struct gl_shader *shader) { if (shader == NULL) @@ -215,7 +215,7 @@ validate_vertex_shader_executable(struct glsl_program *prog, * \param shader Fragment shader executable to be verified */ bool -validate_fragment_shader_executable(struct glsl_program *prog, +validate_fragment_shader_executable(struct gl_shader_program *prog, struct gl_shader *shader) { if (shader == NULL) @@ -252,7 +252,7 @@ validate_fragment_shader_executable(struct glsl_program *prog, * Perform validation of uniforms used across multiple shader stages */ bool -cross_validate_uniforms(struct glsl_program *prog) +cross_validate_uniforms(struct gl_shader_program *prog) { /* Examine all of the uniforms in all of the shaders and cross validate * them. @@ -308,7 +308,7 @@ cross_validate_uniforms(struct glsl_program *prog) * Validate that outputs from one stage match inputs of another */ bool -cross_validate_outputs_to_inputs(struct glsl_program *prog, +cross_validate_outputs_to_inputs(struct gl_shader_program *prog, gl_shader *producer, gl_shader *consumer) { glsl_symbol_table parameters; @@ -412,7 +412,7 @@ struct uniform_node { }; void -assign_uniform_locations(struct glsl_program *prog) +assign_uniform_locations(struct gl_shader_program *prog) { /* */ exec_list uniforms; @@ -533,7 +533,7 @@ find_available_slots(unsigned used_mask, unsigned needed_count) bool -assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index) +assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index) { /* Mark invalid attribute locations as being used. */ @@ -767,7 +767,7 @@ assign_varying_locations(gl_shader *producer, gl_shader *consumer) void -link_shaders(struct glsl_program *prog) +link_shaders(struct gl_shader_program *prog) { prog->LinkStatus = false; prog->Validated = false; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index e78af42ac6..1ed22e1f33 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -206,9 +206,9 @@ main(int argc, char **argv) if (argc <= optind) usage_fail(argv[0]); - struct glsl_program *whole_program; + struct gl_shader_program *whole_program; - whole_program = talloc_zero (NULL, struct glsl_program); + whole_program = talloc_zero (NULL, struct gl_shader_program); assert(whole_program != NULL); for (/* empty */; argc > optind; optind++) { diff --git a/src/glsl/program.h b/src/glsl/program.h index 19c3a3e611..bb1cd919cd 100644 --- a/src/glsl/program.h +++ b/src/glsl/program.h @@ -29,37 +29,5 @@ extern "C" { #include "shader/prog_uniform.h" } -/** - * Based on gl_shader_program in Mesa's mtypes.h. - */ -struct glsl_program { - GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */ - GLuint Name; /**< aka handle or ID */ - GLint RefCount; /**< Reference count */ - GLboolean DeletePending; - - GLuint NumShaders; /**< number of attached shaders */ - struct gl_shader **Shaders; /**< List of attached the shaders */ - - /** - * Per-stage shaders resulting from the first stage of linking. - */ - /*@{*/ - unsigned _NumLinkedShaders; - struct gl_shader **_LinkedShaders; - /*@}*/ - - /** User-defined attribute bindings (glBindAttribLocation) */ - struct gl_program_parameter_list *Attributes; - - /* post-link info: */ - struct gl_uniform_list *Uniforms; - struct gl_program_parameter_list *Varying; - GLboolean LinkStatus; /**< GL_LINK_STATUS */ - GLboolean Validated; - GLboolean _Used; /**< Ever used for drawing? */ - GLchar *InfoLog; -}; - extern void -link_shaders(struct glsl_program *prog); +link_shaders(struct gl_shader_program *prog); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6fc7e29baf..bc90b1e044 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2005,6 +2005,9 @@ struct gl_shader_program GLboolean Validated; GLboolean _Used; /**< Ever used for drawing? */ GLchar *InfoLog; + + GLuint _NumLinkedShaders; + struct gl_shader **_LinkedShaders; }; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c2dde312ef..f0eb46a3ee 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1709,48 +1709,49 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) { - struct glsl_program *whole_program; unsigned int i; + _mesa_clear_shader_program_data(ctx, prog); - whole_program = talloc_zero(NULL, struct glsl_program); - whole_program->LinkStatus = GL_TRUE; - whole_program->NumShaders = prog->NumShaders; - whole_program->Shaders = talloc_array(whole_program, struct gl_shader *, - prog->NumShaders); + prog->LinkStatus = GL_TRUE; for (i = 0; i < prog->NumShaders; i++) { - whole_program->Shaders[i] = prog->Shaders[i]; - if (!whole_program->Shaders[i]->CompileStatus) { - whole_program->InfoLog = - talloc_asprintf_append(whole_program->InfoLog, + if (!prog->Shaders[i]->CompileStatus) { + prog->InfoLog = + talloc_asprintf_append(prog->InfoLog, "linking with uncompiled shader"); - whole_program->LinkStatus = GL_FALSE; + prog->LinkStatus = GL_FALSE; } } - prog->Uniforms = _mesa_new_uniform_list(); prog->Varying = _mesa_new_parameter_list(); _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL); _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); - if (whole_program->LinkStatus) - link_shaders(whole_program); + if (prog->LinkStatus) { + link_shaders(prog); + + /* We don't use the linker's uniforms list, and cook up our own at + * generate time. + */ + free(prog->Uniforms); + prog->Uniforms = _mesa_new_uniform_list(); + } - prog->LinkStatus = whole_program->LinkStatus; + prog->LinkStatus = prog->LinkStatus; /* FINISHME: This should use the linker-generated code */ if (prog->LinkStatus) { for (i = 0; i < prog->NumShaders; i++) { struct gl_program *linked_prog; - linked_prog = get_mesa_program(ctx, whole_program, - whole_program->Shaders[i]); + linked_prog = get_mesa_program(ctx, prog, + prog->Shaders[i]); count_resources(linked_prog); link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); - switch (whole_program->Shaders[i]->Type) { + switch (prog->Shaders[i]->Type) { case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, (struct gl_vertex_program *)linked_prog); @@ -1766,8 +1767,6 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) } } } - - talloc_free(whole_program); } } /* extern "C" */ diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 40b8286a13..f05ebc9fcb 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -53,7 +53,7 @@ static struct gl_shader_program * _mesa_new_shader_program(GLcontext *ctx, GLuint name) { struct gl_shader_program *shProg; - shProg = CALLOC_STRUCT(gl_shader_program); + shProg = talloc_zero(NULL, struct gl_shader_program); if (shProg) { shProg->Type = GL_SHADER_PROGRAM_MESA; shProg->Name = name; @@ -117,7 +117,7 @@ _mesa_free_shader_program_data(GLcontext *ctx, } if (shProg->InfoLog) { - free(shProg->InfoLog); + talloc_free(shProg->InfoLog); shProg->InfoLog = NULL; } @@ -139,7 +139,7 @@ _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) { _mesa_free_shader_program_data(ctx, shProg); - free(shProg); + talloc_free(shProg); } -- cgit v1.2.3 From 982e3798d8b9bfec7ff3f37c52687036b36bc153 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 18:58:20 -0700 Subject: linker: Don't automatically allocate VERT_ATTRIB_GENERIC0 --- src/glsl/linker.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 719cae2f27..a53e91d2ef 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -669,6 +669,12 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index qsort(to_assign, num_attr, sizeof(to_assign[0]), temp_attr::compare); + /* VERT_ATTRIB_GENERIC0 is a psdueo-alias for VERT_ATTRIB_POS. It can only + * be explicitly assigned by via glBindAttribLocation. Mark it as reserved + * to prevent it from being automatically allocated below. + */ + used_locations |= VERT_BIT_GENERIC0; + for (unsigned i = 0; i < num_attr; i++) { /* Mask representing the contiguous slots that will be used by this * attribute. -- cgit v1.2.3 From ef5f1948316664055c1444d12076c7d86589a8b9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 17:58:43 -0700 Subject: linker: Don't dynamically allocate slots for linked shaders The can be at most one shader per stage. There are currently only two stages. There is zero reason to dynamically size this array. --- src/glsl/linker.cpp | 2 -- src/mesa/main/mtypes.h | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index a53e91d2ef..11fccba378 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -823,8 +823,6 @@ link_shaders(struct gl_shader_program *prog) goto done; - prog->_LinkedShaders = (struct gl_shader **) - calloc(2, sizeof(struct gl_shader *)); prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bc90b1e044..9a36740c41 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2006,8 +2006,13 @@ struct gl_shader_program GLboolean _Used; /**< Ever used for drawing? */ GLchar *InfoLog; + /** + * Per-stage shaders resulting from the first stage of linking. + */ + /*@{*/ GLuint _NumLinkedShaders; - struct gl_shader **_LinkedShaders; + struct gl_shader *_LinkedShaders[2]; + /*@}*/ }; -- cgit v1.2.3 From 116f1d4f95d8eb0a82b272016590549632c865b3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 14:10:01 -0700 Subject: glsl2: Steal the live IR and free the rest of the junk. --- src/glsl/main.cpp | 11 +++++++++++ src/mesa/shader/ir_to_mesa.cpp | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 1ed22e1f33..8b2eeaa13a 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -99,6 +99,12 @@ const struct option compiler_opts[] = { { NULL, 0, NULL, 0 } }; +static void +steal_memory(ir_instruction *ir, void *new_ctx) +{ + talloc_steal(new_ctx, ir); +} + void compile_shader(struct gl_shader *shader) { @@ -187,6 +193,11 @@ compile_shader(struct gl_shader *shader) shader->InfoLog = state->info_log; + /* Retain any live IR, but trash the rest. */ + foreach_list(node, shader->ir) { + visit_tree((ir_instruction *) node, steal_memory, shader); + } + talloc_free(state); return; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 75021a70fd..c3de3aae05 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1650,6 +1650,12 @@ get_mesa_program(GLcontext *ctx, void *mem_ctx, struct gl_shader *shader) extern "C" { +static void +steal_memory(ir_instruction *ir, void *new_ctx) +{ + talloc_steal(new_ctx, ir); +} + void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) { @@ -1712,6 +1718,11 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) shader->CompileStatus = !state->error; shader->InfoLog = state->info_log; + /* Retain any live IR, but trash the rest. */ + foreach_list(node, shader->ir) { + visit_tree((ir_instruction *) node, steal_memory, shader); + } + talloc_free(state); } -- cgit v1.2.3 From 953ff1283d3d52e6a6b4850c2b0b574111625010 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 13:14:37 -0700 Subject: glsl2: Use _mesa_glsl_parse_state as the talloc parent, not glsl_shader. _mesa_glsl_parse_state should be the parent for all temporary allocation done while compiling a shader. glsl_shader should only be used as the parent for the shader's final IR---the _result_ of compilation. Since many IR instructions may be added or discarded during optimization passes, IR should not ever be allocated to glsl_shader directly. Done via sed -i s/talloc_parent(state)/state/g and s/talloc_parent(st)/st/g. This also removes a ton of talloc_parent calls, which may help performance. --- src/glsl/ast_function.cpp | 10 +-- src/glsl/ast_to_hir.cpp | 22 ++--- src/glsl/glsl_lexer.lpp | 2 +- src/glsl/glsl_parser.ypp | 174 +++++++++++++++++++-------------------- src/glsl/hir_field_selection.cpp | 2 +- src/glsl/ir_reader.cpp | 30 +++---- 6 files changed, 120 insertions(+), 120 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index f3074a362d..b681115387 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -59,7 +59,7 @@ process_call(exec_list *instructions, ir_function *f, YYLTYPE *loc, exec_list *actual_parameters, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; const ir_function_signature *sig = f->matching_signature(actual_parameters); @@ -119,7 +119,7 @@ match_function_by_name(exec_list *instructions, const char *name, YYLTYPE *loc, exec_list *actual_parameters, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; ir_function *f = state->symbols->get_function(name); if (f == NULL) { @@ -244,7 +244,7 @@ process_array_constructor(exec_list *instructions, YYLTYPE *loc, exec_list *parameters, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(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 @@ -318,7 +318,7 @@ constant_record_constructor(const glsl_type *constructor_type, YYLTYPE *loc, exec_list *parameters, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; bool all_parameters_are_constant = true; exec_node *node = parameters->head; @@ -862,7 +862,7 @@ ir_rvalue * ast_function_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; /* There are three sorts of function calls. * * 1. contstructors - The first subexpression is an ast_type_specifier. diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ba29240092..53f17de7b9 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -86,7 +86,7 @@ static bool apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; if (to->base_type == from->type->base_type) return true; @@ -473,7 +473,7 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, ir_rvalue *lhs, ir_rvalue *rhs, YYLTYPE lhs_loc) { - void *ctx = talloc_parent(state); + void *ctx = state; bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); if (!error_emitted) { @@ -550,7 +550,7 @@ static ir_variable * generate_temporary(const glsl_type *type, exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; char *name = (char *) malloc(sizeof(char) * 13); snprintf(name, 13, "tmp_%08X", state->temp_index); @@ -600,7 +600,7 @@ ir_rvalue * ast_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(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. */ @@ -1544,7 +1544,7 @@ ir_rvalue * ast_declarator_list::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; const struct glsl_type *decl_type; const char *type_name = NULL; ir_rvalue *result = NULL; @@ -1883,7 +1883,7 @@ ir_rvalue * ast_parameter_declarator::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; const struct glsl_type *type; const char *name = NULL; YYLTYPE loc = this->get_location(); @@ -1984,7 +1984,7 @@ ir_rvalue * ast_function::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; ir_function *f = NULL; ir_function_signature *sig = NULL; exec_list hir_parameters; @@ -2152,7 +2152,7 @@ ir_rvalue * ast_jump_statement::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; switch (mode) { case ast_return: { @@ -2255,7 +2255,7 @@ ir_rvalue * ast_selection_statement::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; ir_rvalue *const condition = this->condition->hir(instructions, state); @@ -2295,7 +2295,7 @@ void ast_iteration_statement::condition_to_hir(ir_loop *stmt, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; if (condition != NULL) { ir_rvalue *const cond = @@ -2331,7 +2331,7 @@ ir_rvalue * ast_iteration_statement::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; /* For-loops and while-loops start a new scope, but do-while loops do not. */ diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index fa439f1278..f236a15682 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -313,7 +313,7 @@ precision return PRECISION; [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; - void *ctx = talloc_parent(state); + void *ctx = state; yylval->identifier = talloc_strdup(ctx, yytext); return IDENTIFIER; } diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 4132495f40..d894a968ec 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -255,35 +255,35 @@ variable_identifier: primary_expression: variable_identifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.identifier = $1; } | INTCONSTANT { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.int_constant = $1; } | UINTCONSTANT { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.uint_constant = $1; } | FLOATCONSTANT { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.float_constant = $1; } | BOOLCONSTANT { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.bool_constant = $1; @@ -298,7 +298,7 @@ postfix_expression: primary_expression | postfix_expression '[' integer_expression ']' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_array_index, $1, $3, NULL); $$->set_location(yylloc); } @@ -314,20 +314,20 @@ postfix_expression: } | postfix_expression '.' IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, NULL, NULL); $$->set_location(yylloc); $$->primary_expression.identifier = $3; } | postfix_expression INC_OP { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_post_inc, $1, NULL, NULL); $$->set_location(yylloc); } | postfix_expression DEC_OP { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_post_dec, $1, NULL, NULL); $$->set_location(yylloc); } @@ -345,7 +345,7 @@ function_call_or_method: function_call_generic | postfix_expression '.' function_call_generic { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_field_selection, $1, $3, NULL); $$->set_location(yylloc); } @@ -386,20 +386,20 @@ function_call_header: function_identifier: type_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_function_expression($1); $$->set_location(yylloc); } | IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); $$ = new(ctx) ast_function_expression(callee); $$->set_location(yylloc); } | FIELD_SELECTION { - void *ctx = talloc_parent(state); + void *ctx = state; ast_expression *callee = new(ctx) ast_expression($1); $$ = new(ctx) ast_function_expression(callee); $$->set_location(yylloc); @@ -411,19 +411,19 @@ unary_expression: postfix_expression | INC_OP unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_pre_inc, $2, NULL, NULL); $$->set_location(yylloc); } | DEC_OP unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_pre_dec, $2, NULL, NULL); $$->set_location(yylloc); } | unary_operator unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression($1, $2, NULL, NULL); $$->set_location(yylloc); } @@ -441,19 +441,19 @@ multiplicative_expression: unary_expression | multiplicative_expression '*' unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_mul, $1, $3); $$->set_location(yylloc); } | multiplicative_expression '/' unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_div, $1, $3); $$->set_location(yylloc); } | multiplicative_expression '%' unary_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_mod, $1, $3); $$->set_location(yylloc); } @@ -463,13 +463,13 @@ additive_expression: multiplicative_expression | additive_expression '+' multiplicative_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_add, $1, $3); $$->set_location(yylloc); } | additive_expression '-' multiplicative_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_sub, $1, $3); $$->set_location(yylloc); } @@ -479,13 +479,13 @@ shift_expression: additive_expression | shift_expression LEFT_OP additive_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_lshift, $1, $3); $$->set_location(yylloc); } | shift_expression RIGHT_OP additive_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_rshift, $1, $3); $$->set_location(yylloc); } @@ -495,25 +495,25 @@ relational_expression: shift_expression | relational_expression '<' shift_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_less, $1, $3); $$->set_location(yylloc); } | relational_expression '>' shift_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_greater, $1, $3); $$->set_location(yylloc); } | relational_expression LE_OP shift_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_lequal, $1, $3); $$->set_location(yylloc); } | relational_expression GE_OP shift_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_gequal, $1, $3); $$->set_location(yylloc); } @@ -523,13 +523,13 @@ equality_expression: relational_expression | equality_expression EQ_OP relational_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_equal, $1, $3); $$->set_location(yylloc); } | equality_expression NE_OP relational_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_nequal, $1, $3); $$->set_location(yylloc); } @@ -539,7 +539,7 @@ and_expression: equality_expression | and_expression '&' equality_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); $$->set_location(yylloc); } @@ -549,7 +549,7 @@ exclusive_or_expression: and_expression | exclusive_or_expression '^' and_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_xor, $1, $3); $$->set_location(yylloc); } @@ -559,7 +559,7 @@ inclusive_or_expression: exclusive_or_expression | inclusive_or_expression '|' exclusive_or_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); $$->set_location(yylloc); } @@ -569,7 +569,7 @@ logical_and_expression: inclusive_or_expression | logical_and_expression AND_OP inclusive_or_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_and, $1, $3); $$->set_location(yylloc); } @@ -579,7 +579,7 @@ logical_xor_expression: logical_and_expression | logical_xor_expression XOR_OP logical_and_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_xor, $1, $3); $$->set_location(yylloc); } @@ -589,7 +589,7 @@ logical_or_expression: logical_xor_expression | logical_or_expression OR_OP logical_xor_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_bin(ast_logic_or, $1, $3); $$->set_location(yylloc); } @@ -599,7 +599,7 @@ conditional_expression: logical_or_expression | logical_or_expression '?' expression ':' assignment_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression(ast_conditional, $1, $3, $5); $$->set_location(yylloc); } @@ -609,7 +609,7 @@ assignment_expression: conditional_expression | unary_expression assignment_operator assignment_expression { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression($2, $1, $3, NULL); $$->set_location(yylloc); } @@ -636,7 +636,7 @@ expression: } | expression ',' assignment_expression { - void *ctx = talloc_parent(state); + void *ctx = state; if ($1->oper != ast_sequence) { $$ = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); $$->set_location(yylloc); @@ -700,7 +700,7 @@ function_header_with_parameters: function_header: fully_specified_type IDENTIFIER '(' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_function(); $$->set_location(yylloc); $$->return_type = $1; @@ -711,7 +711,7 @@ function_header: parameter_declarator: type_specifier IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); $$->set_location(yylloc); $$->type = new(ctx) ast_fully_specified_type(); @@ -721,7 +721,7 @@ parameter_declarator: } | type_specifier IDENTIFIER '[' constant_expression ']' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); $$->set_location(yylloc); $$->type = new(ctx) ast_fully_specified_type(); @@ -748,7 +748,7 @@ parameter_declaration: } | parameter_type_qualifier parameter_qualifier parameter_type_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $1.i |= $2.i; $$ = new(ctx) ast_parameter_declarator(); @@ -759,7 +759,7 @@ parameter_declaration: } | parameter_qualifier parameter_type_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_parameter_declarator(); $$->set_location(yylloc); $$->type = new(ctx) ast_fully_specified_type(); @@ -783,7 +783,7 @@ init_declarator_list: single_declaration | init_declarator_list ',' IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, NULL); decl->set_location(yylloc); @@ -792,7 +792,7 @@ init_declarator_list: } | init_declarator_list ',' IDENTIFIER '[' ']' { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, NULL); decl->set_location(yylloc); @@ -801,7 +801,7 @@ init_declarator_list: } | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, NULL); decl->set_location(yylloc); @@ -810,7 +810,7 @@ init_declarator_list: } | init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, $7); decl->set_location(yylloc); @@ -819,7 +819,7 @@ init_declarator_list: } | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, $8); decl->set_location(yylloc); @@ -828,7 +828,7 @@ init_declarator_list: } | init_declarator_list ',' IDENTIFIER '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, $5); decl->set_location(yylloc); @@ -841,7 +841,7 @@ init_declarator_list: single_declaration: fully_specified_type { - void *ctx = talloc_parent(state); + void *ctx = state; if ($1->specifier->type_specifier != ast_struct) { _mesa_glsl_error(& @1, state, "empty declaration list\n"); YYERROR; @@ -852,7 +852,7 @@ single_declaration: } | fully_specified_type IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); $$ = new(ctx) ast_declarator_list($1); @@ -861,7 +861,7 @@ single_declaration: } | fully_specified_type IDENTIFIER '[' ']' { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, NULL); $$ = new(ctx) ast_declarator_list($1); @@ -870,7 +870,7 @@ single_declaration: } | fully_specified_type IDENTIFIER '[' constant_expression ']' { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, NULL); $$ = new(ctx) ast_declarator_list($1); @@ -879,7 +879,7 @@ single_declaration: } | fully_specified_type IDENTIFIER '[' ']' '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, $6); $$ = new(ctx) ast_declarator_list($1); @@ -888,7 +888,7 @@ single_declaration: } | fully_specified_type IDENTIFIER '[' constant_expression ']' '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, $7); $$ = new(ctx) ast_declarator_list($1); @@ -897,7 +897,7 @@ single_declaration: } | fully_specified_type IDENTIFIER '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); $$ = new(ctx) ast_declarator_list($1); @@ -906,7 +906,7 @@ single_declaration: } | INVARIANT IDENTIFIER // Vertex only. { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); $$ = new(ctx) ast_declarator_list(NULL); @@ -920,14 +920,14 @@ single_declaration: fully_specified_type: type_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_fully_specified_type(); $$->set_location(yylloc); $$->specifier = $1; } | type_qualifier type_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_fully_specified_type(); $$->set_location(yylloc); $$->qualifier = $1.q; @@ -998,19 +998,19 @@ type_specifier_no_prec: type_specifier_nonarray: basic_type_specifier_nonarray { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_type_specifier($1); $$->set_location(yylloc); } | struct_specifier { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_type_specifier($1); $$->set_location(yylloc); } | IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_type_specifier($1); $$->set_location(yylloc); } @@ -1112,13 +1112,13 @@ precision_qualifier: struct_specifier: STRUCT IDENTIFIER '{' struct_declaration_list '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_struct_specifier($2, $4); $$->set_location(yylloc); } | STRUCT '{' struct_declaration_list '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_struct_specifier(NULL, $3); $$->set_location(yylloc); } @@ -1140,7 +1140,7 @@ struct_declaration_list: struct_declaration: type_specifier struct_declarator_list ';' { - void *ctx = talloc_parent(state); + void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); type->set_location(yylloc); @@ -1168,13 +1168,13 @@ struct_declarator_list: struct_declarator: IDENTIFIER { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_declaration($1, false, NULL, NULL); $$->set_location(yylloc); } | IDENTIFIER '[' constant_expression ']' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_declaration($1, true, $3, NULL); $$->set_location(yylloc); } @@ -1217,13 +1217,13 @@ simple_statement: compound_statement: '{' '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_compound_statement(true, NULL); $$->set_location(yylloc); } | '{' statement_list '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_compound_statement(true, $2); $$->set_location(yylloc); } @@ -1237,13 +1237,13 @@ statement_no_new_scope: compound_statement_no_new_scope: '{' '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_compound_statement(false, NULL); $$->set_location(yylloc); } | '{' statement_list '}' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_compound_statement(false, $2); $$->set_location(yylloc); } @@ -1274,13 +1274,13 @@ statement_list: expression_statement: ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_statement(NULL); $$->set_location(yylloc); } | expression ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_expression_statement($1); $$->set_location(yylloc); } @@ -1289,7 +1289,7 @@ expression_statement: selection_statement_matched: IF '(' expression ')' statement_matched ELSE statement_matched { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_selection_statement($3, $5, $7); $$->set_location(yylloc); } @@ -1298,19 +1298,19 @@ selection_statement_matched: selection_statement_unmatched: IF '(' expression ')' statement_matched { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_selection_statement($3, $5, NULL); $$->set_location(yylloc); } | IF '(' expression ')' statement_unmatched { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_selection_statement($3, $5, NULL); $$->set_location(yylloc); } | IF '(' expression ')' statement_matched ELSE statement_unmatched { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_selection_statement($3, $5, $7); $$->set_location(yylloc); } @@ -1323,7 +1323,7 @@ condition: } | fully_specified_type IDENTIFIER '=' initializer { - void *ctx = talloc_parent(state); + void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); ast_declarator_list *declarator = new(ctx) ast_declarator_list($1); decl->set_location(yylloc); @@ -1346,21 +1346,21 @@ case_label: iteration_statement: WHILE '(' condition ')' statement_no_new_scope { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, NULL, $3, NULL, $5); $$->set_location(yylloc); } | DO statement WHILE '(' expression ')' ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, NULL, $5, NULL, $2); $$->set_location(yylloc); } | FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, $3, $4.cond, $4.rest, $6); $$->set_location(yylloc); @@ -1397,31 +1397,31 @@ for_rest_statement: jump_statement: CONTINUE ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); $$->set_location(yylloc); } | BREAK ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); $$->set_location(yylloc); } | RETURN ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); $$->set_location(yylloc); } | RETURN expression ';' { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, $2); $$->set_location(yylloc); } | DISCARD ';' // Fragment shader only. { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); $$->set_location(yylloc); } @@ -1435,7 +1435,7 @@ external_declaration: function_definition: function_prototype compound_statement_no_new_scope { - void *ctx = talloc_parent(state); + void *ctx = state; $$ = new(ctx) ast_function_definition(); $$->set_location(yylloc); $$->prototype = $1; diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index e2efff60d3..5500e09d7e 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -33,7 +33,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = talloc_parent(state); + void *ctx = state; ir_rvalue *result = NULL; ir_rvalue *op; diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 03dce0d684..5ba76e29ea 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -191,7 +191,7 @@ scan_for_prototypes(_mesa_glsl_parse_state *st, exec_list *instructions, static ir_function * read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() < 3) { ir_read_error(st, list, "Expected (function (signature ...) ...)"); return NULL; @@ -235,7 +235,7 @@ static void read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, bool skip_body) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 4) { ir_read_error(st, list, "Expected (signature (parameters ...) " "( ...))"); @@ -334,7 +334,7 @@ static ir_instruction * read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, ir_loop *loop_ctx) { - void *ctx = talloc_parent(st); + void *ctx = st; s_symbol *symbol = SX_AS_SYMBOL(expr); if (symbol != NULL) { if (strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL) @@ -376,7 +376,7 @@ read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, static ir_variable * read_declaration(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 4) { ir_read_error(st, list, "expected (declare () " ")"); @@ -448,7 +448,7 @@ read_declaration(_mesa_glsl_parse_state *st, s_list *list) static ir_if * read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 4) { ir_read_error(st, list, "expected (if ( ...) " "( ...))"); @@ -480,7 +480,7 @@ read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx) static ir_loop * read_loop(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 6) { ir_read_error(st, list, "expected (loop " " )"); @@ -508,7 +508,7 @@ read_loop(_mesa_glsl_parse_state *st, s_list *list) static ir_return * read_return(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 2) { ir_read_error(st, list, "expected (return )"); return NULL; @@ -564,7 +564,7 @@ read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr) static ir_assignment * read_assignment(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 4) { ir_read_error(st, list, "expected (assign )"); return NULL; @@ -599,7 +599,7 @@ read_assignment(_mesa_glsl_parse_state *st, s_list *list) static ir_call * read_call(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 3) { ir_read_error(st, list, "expected (call ( ...))"); return NULL; @@ -644,7 +644,7 @@ read_call(_mesa_glsl_parse_state *st, s_list *list) static ir_expression * read_expression(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; const unsigned list_length = list->length(); if (list_length < 4) { ir_read_error(st, list, "expected (expression " @@ -749,7 +749,7 @@ read_swizzle(_mesa_glsl_parse_state *st, s_list *list) static ir_constant * read_constant(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 3) { ir_read_error(st, list, "expected (constant ( ... ))"); return NULL; @@ -840,7 +840,7 @@ read_dereference(_mesa_glsl_parse_state *st, s_expression *expr) static ir_dereference * read_var_ref(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 2) { ir_read_error(st, list, "expected (var_ref )"); return NULL; @@ -863,7 +863,7 @@ read_var_ref(_mesa_glsl_parse_state *st, s_list *list) static ir_dereference * read_array_ref(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 3) { ir_read_error(st, list, "expected (array_ref )"); return NULL; @@ -884,7 +884,7 @@ read_array_ref(_mesa_glsl_parse_state *st, s_list *list) static ir_dereference * read_record_ref(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; if (list->length() != 3) { ir_read_error(st, list, "expected (record_ref )"); return NULL; @@ -920,7 +920,7 @@ valid_texture_list_length(ir_texture_opcode op, s_list *list) static ir_texture * read_texture(_mesa_glsl_parse_state *st, s_list *list) { - void *ctx = talloc_parent(st); + void *ctx = st; s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head); assert(tag != NULL); -- cgit v1.2.3 From c6099a65f8f8310a540f7c19cfc380ad980c9dd7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 25 Jun 2010 13:36:14 -0700 Subject: glsl2: Create new talloc contexts the "right" way. --- src/glsl/ir_copy_propagation.cpp | 2 +- src/glsl/ir_dead_code_local.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index a02852ed0c..f502f5e0b0 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -225,7 +225,7 @@ copy_propagation_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; - void *ctx = talloc(NULL, void*); + void *ctx = talloc_new(NULL); for (ir = first;; ir = (ir_instruction *)ir->next) { ir_assignment *ir_assign = ir->as_assignment(); diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp index 5e197e1948..7a44ec8a4a 100644 --- a/src/glsl/ir_dead_code_local.cpp +++ b/src/glsl/ir_dead_code_local.cpp @@ -185,7 +185,7 @@ dead_code_local_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; - void *ctx = talloc(NULL, void*); + void *ctx = talloc_new(NULL); /* Safe looping, since process_assignment */ for (ir = first, ir_next = (ir_instruction *)first->next;; ir = ir_next, ir_next = (ir_instruction *)ir->next) { -- cgit v1.2.3 From 629198b96a8f471c48932d6af56184b6c33b5fe5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 29 Jun 2010 11:31:04 -0700 Subject: glsl2: Preprocessed source doesn't need to live past compile time. --- src/glsl/main.cpp | 5 +---- src/mesa/shader/ir_to_mesa.cpp | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 8b2eeaa13a..fa63853b47 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -129,11 +129,8 @@ compile_shader(struct gl_shader *shader) state->Const.MaxDrawBuffers = 2; - /* Create a new context for the preprocessor output. Ultimately, this - * should probably be the parser context, but there isn't one yet. - */ const char *source = shader->Source; - state->error = preprocess(shader, &source, &state->info_log); + state->error = preprocess(state, &source, &state->info_log); if (!state->error) { _mesa_glsl_lexer_ctor(state, source); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c3de3aae05..4eac810679 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1679,11 +1679,8 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; - /* Create a new context for the preprocessor output. Ultimately, this - * should probably be the parser context, but there isn't one yet. - */ const char *source = shader->Source; - state->error = preprocess(shader, &source, &state->info_log); + state->error = preprocess(state, &source, &state->info_log); if (!state->error) { _mesa_glsl_lexer_ctor(state, source); -- cgit v1.2.3 From c7f4ff193a6f7cfae2e4cdc6c4b9162a16226dc0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 30 Jun 2010 11:57:43 -0700 Subject: glsl2: Fix storing of dead memory in the symbol table. decl->identifier is part of the AST, so it doesn't live very long. Instead, add var->name which is owned by var. --- src/glsl/ast_to_hir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 53f17de7b9..a0ca7e5f6d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1851,7 +1851,7 @@ ast_declarator_list::hir(exec_list *instructions, "const declaration of `%s' must be initialized"); } - /* Add the vairable to the symbol table after processing the initializer. + /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 * spec: @@ -1861,7 +1861,7 @@ ast_declarator_list::hir(exec_list *instructions, * being declared if not." */ const bool added_variable = - state->symbols->add_variable(decl->identifier, var); + state->symbols->add_variable(var->name, var); assert(added_variable); } -- cgit v1.2.3 From 97eba76b8c5fe60738716c4dce9404de417a7d34 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 14:51:50 -0700 Subject: glsl2: Allow a fragment shader to not write a color. I can't find any text justifying this check, and it caused a reasonable-looking shader in glsl-bug-22603 (which writes only gl_FragDepth) to fail. --- src/glsl/linker.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 11fccba378..5227d42e35 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -232,12 +232,6 @@ validate_fragment_shader_executable(struct gl_shader_program *prog, frag_color.run(shader->ir); frag_data.run(shader->ir); - if (!frag_color.variable_found() && !frag_data.variable_found()) { - linker_error_printf(prog, "fragment shader does not write to " - "`gl_FragColor' or `gl_FragData'\n"); - return false; - } - if (frag_color.variable_found() && frag_data.variable_found()) { linker_error_printf(prog, "fragment shader writes to both " "`gl_FragColor' and `gl_FragData'\n"); -- cgit v1.2.3 From 16efab1c4dee6e6a827ba5f1c482378159545ae5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 30 Jun 2010 10:47:34 -0700 Subject: glsl2: Define new ir_discard instruction. --- src/glsl/ir.h | 27 +++++++++++++++++++++++++++ src/glsl/ir_clone.cpp | 12 ++++++++++++ src/glsl/ir_constant_expression.cpp | 9 +++++++++ src/glsl/ir_constant_folding.cpp | 8 ++++++++ src/glsl/ir_hierarchical_visitor.cpp | 16 ++++++++++++++++ src/glsl/ir_hierarchical_visitor.h | 2 ++ src/glsl/ir_hv_accept.cpp | 17 +++++++++++++++++ src/glsl/ir_print_visitor.cpp | 14 ++++++++++++++ src/glsl/ir_print_visitor.h | 1 + src/glsl/ir_visitor.h | 1 + src/mesa/shader/ir_to_mesa.cpp | 8 ++++++++ 11 files changed, 115 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 65026ef1f5..00b0076c17 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -793,6 +793,33 @@ private: /** Loop containing this break instruction. */ ir_loop *loop; }; + +/** + * IR instruction representing discard statements. + */ +class ir_discard : public ir_jump { +public: + ir_discard() + { + this->condition = NULL; + } + + ir_discard(ir_rvalue *cond) + { + this->condition = cond; + } + + virtual ir_instruction *clone(struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *condition; +}; /*@}*/ diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 01a1ce3a6d..74cc858bda 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -74,6 +74,18 @@ ir_return::clone(struct hash_table *ht) const return new(ctx) ir_return(new_value); } +ir_instruction * +ir_discard::clone(struct hash_table *ht) const +{ + void *ctx = talloc_parent(this); + ir_rvalue *new_condition = NULL; + + if (this->condition != NULL) + new_condition = (ir_rvalue *) this->condition->clone(ht); + + return new(ctx) ir_discard(new_condition); +} + ir_instruction * ir_loop_jump::clone(struct hash_table *ht) const { diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 3408f5256a..c6348ac434 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -75,6 +75,7 @@ public: virtual void visit(ir_constant *); virtual void visit(ir_call *); virtual void visit(ir_return *); + virtual void visit(ir_discard *); virtual void visit(ir_if *); virtual void visit(ir_loop *); virtual void visit(ir_loop_jump *); @@ -647,6 +648,14 @@ ir_constant_visitor::visit(ir_return *ir) } +void +ir_constant_visitor::visit(ir_discard *ir) +{ + (void) ir; + value = NULL; +} + + void ir_constant_visitor::visit(ir_if *ir) { diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 342d027bbe..2daa6fde38 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -68,6 +68,7 @@ public: virtual void visit(ir_constant *); virtual void visit(ir_call *); virtual void visit(ir_return *); + virtual void visit(ir_discard *); virtual void visit(ir_if *); virtual void visit(ir_loop *); virtual void visit(ir_loop_jump *); @@ -190,6 +191,13 @@ ir_constant_folding_visitor::visit(ir_return *ir) } +void +ir_constant_folding_visitor::visit(ir_discard *ir) +{ + (void) ir; +} + + void ir_constant_folding_visitor::visit(ir_if *ir) { diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp index 0d520b127f..9afb12a4a2 100644 --- a/src/glsl/ir_hierarchical_visitor.cpp +++ b/src/glsl/ir_hierarchical_visitor.cpp @@ -242,6 +242,22 @@ ir_hierarchical_visitor::visit_leave(ir_return *ir) return visit_continue; } +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_discard *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_discard *ir) +{ + (void) ir; + return visit_continue; +} + ir_visitor_status ir_hierarchical_visitor::visit_enter(ir_if *ir) { diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h index 8b9e49dab1..2c4590d4b1 100644 --- a/src/glsl/ir_hierarchical_visitor.h +++ b/src/glsl/ir_hierarchical_visitor.h @@ -129,6 +129,8 @@ public: virtual ir_visitor_status visit_leave(class ir_call *); virtual ir_visitor_status visit_enter(class ir_return *); virtual ir_visitor_status visit_leave(class ir_return *); + virtual ir_visitor_status visit_enter(class ir_discard *); + virtual ir_visitor_status visit_leave(class ir_discard *); virtual ir_visitor_status visit_enter(class ir_if *); virtual ir_visitor_status visit_leave(class ir_if *); /*@}*/ diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index f936b3500e..7b5cc5234c 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -321,6 +321,23 @@ ir_return::accept(ir_hierarchical_visitor *v) } +ir_visitor_status +ir_discard::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->condition != NULL) { + s = this->condition->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + return v->visit_leave(this); +} + + ir_visitor_status ir_if::accept(ir_hierarchical_visitor *v) { diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index be5a843f67..6f867e3253 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -314,6 +314,20 @@ ir_print_visitor::visit(ir_return *ir) } +void +ir_print_visitor::visit(ir_discard *ir) +{ + printf("(discard "); + + if (ir->condition != NULL) { + printf(" "); + ir->condition->accept(this); + } + + printf(")"); +} + + void ir_print_visitor::visit(ir_if *ir) { diff --git a/src/glsl/ir_print_visitor.h b/src/glsl/ir_print_visitor.h index e97b823522..3db42e24ca 100644 --- a/src/glsl/ir_print_visitor.h +++ b/src/glsl/ir_print_visitor.h @@ -69,6 +69,7 @@ public: virtual void visit(ir_constant *); virtual void visit(ir_call *); virtual void visit(ir_return *); + virtual void visit(ir_discard *); virtual void visit(ir_if *); virtual void visit(ir_loop *); virtual void visit(ir_loop_jump *); diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h index a6f9d2b7ee..b87d737318 100644 --- a/src/glsl/ir_visitor.h +++ b/src/glsl/ir_visitor.h @@ -57,6 +57,7 @@ public: virtual void visit(class ir_constant *) = 0; virtual void visit(class ir_call *) = 0; virtual void visit(class ir_return *) = 0; + virtual void visit(class ir_discard *) = 0; virtual void visit(class ir_if *) = 0; virtual void visit(class ir_loop *) = 0; virtual void visit(class ir_loop_jump *) = 0; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index ef9a96e2f5..8c074a8bd9 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -134,6 +134,7 @@ public: virtual void visit(ir_constant *); virtual void visit(ir_call *); virtual void visit(ir_return *); + virtual void visit(ir_discard *); virtual void visit(ir_texture *); virtual void visit(ir_if *); /*@}*/ @@ -1321,6 +1322,13 @@ ir_to_mesa_visitor::visit(ir_return *ir) ir->get_value()->accept(this); } +void +ir_to_mesa_visitor::visit(ir_discard *ir) +{ + assert(0); + + ir->condition->accept(this); +} void ir_to_mesa_visitor::visit(ir_if *ir) -- cgit v1.2.3 From 77049a702ad54e09c4102fe8c964e069944f83e5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 30 Jun 2010 14:11:00 -0700 Subject: glsl2: Implement AST->HIR support for the "discard" instruction. --- src/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index a0ca7e5f6d..7d966f848b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2206,13 +2206,13 @@ ast_jump_statement::hir(exec_list *instructions, } case ast_discard: - /* FINISHME: discard support */ if (state->target != fragment_shader) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "`discard' may only appear in a fragment shader"); } + instructions->push_tail(new(ctx) ir_discard); break; case ast_break: -- cgit v1.2.3 From 4e16a7b526bb4736cd11e512009cf6532b2d1dc5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 15:59:07 -0700 Subject: glsl2: Fix up the implementation of fract() for vector types. There's no need to split each vector component out, just do vector ops. --- src/glsl/builtin_function.cpp | 18 +++--------------- src/glsl/builtins/110/fract | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index d248388a1a..626ba4e2bf 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -786,29 +786,17 @@ static const char *builtins_110_fract = { " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x)))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x)))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float - (swiz w (var_ref x)) (expression float floor (swiz w (var_ref x)))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x))))))\n" "))\n" "\n" }; diff --git a/src/glsl/builtins/110/fract b/src/glsl/builtins/110/fract index 3995bfaf3f..46741bb3cb 100644 --- a/src/glsl/builtins/110/fract +++ b/src/glsl/builtins/110/fract @@ -7,28 +7,16 @@ (signature vec2 (parameters (declare (in) vec2 x)) - ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) - (return (var_ref t)))) + ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x)))))) (signature vec3 (parameters (declare (in) vec3 x)) - ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x))))) - (return (var_ref t)))) + ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x)))))) (signature vec4 (parameters (declare (in) vec4 x)) - ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float - (swiz x (var_ref x)) (expression float floor (swiz x (var_ref x))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float - (swiz y (var_ref x)) (expression float floor (swiz y (var_ref x))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float - (swiz z (var_ref x)) (expression float floor (swiz z (var_ref x))))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float - (swiz w (var_ref x)) (expression float floor (swiz w (var_ref x))))) - (return (var_ref t)))) + ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x)))))) )) -- cgit v1.2.3 From 02d615306eb930bd6de9f1503ddd54ee33d3b930 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 16:22:52 -0700 Subject: glsl2: Fix reversed value of step(). It's 0.0 if x < edge, not 1.0. Partial fix for glsl-fs-step. --- src/glsl/builtin_function.cpp | 38 +++++++++++++++++++------------------- src/glsl/builtins/110/step | 38 +++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 626ba4e2bf..811c5b20ac 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -2164,15 +2164,15 @@ static const char *builtins_110_step = { " (parameters\n" " (declare (in) float edge)\n" " (declare (in) float x))\n" - " ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge))))))\n" + " ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) float edge)\n" " (declare (in) vec2 x))\n" " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" " (return (var_ref t))))\n" "\n" " (signature vec3\n" @@ -2180,9 +2180,9 @@ static const char *builtins_110_step = { " (declare (in) float edge)\n" " (declare (in) vec3 x))\n" " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" " (return (var_ref t))))\n" "\n" " (signature vec4\n" @@ -2190,10 +2190,10 @@ static const char *builtins_110_step = { " (declare (in) float edge)\n" " (declare (in) vec4 x))\n" " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n" " (return (var_ref t))))\n" "\n" " (signature vec2\n" @@ -2201,8 +2201,8 @@ static const char *builtins_110_step = { " (declare (in) vec2 edge)\n" " (declare (in) vec2 x))\n" " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" " (return (var_ref t))))\n" "\n" " (signature vec3\n" @@ -2210,9 +2210,9 @@ static const char *builtins_110_step = { " (declare (in) vec3 edge)\n" " (declare (in) vec3 x))\n" " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" " (return (var_ref t))))\n" "\n" " (signature vec4\n" @@ -2220,10 +2220,10 @@ static const char *builtins_110_step = { " (declare (in) vec4 edge)\n" " (declare (in) vec4 x))\n" " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" " (return (var_ref t))))\n" "))\n" "\n" diff --git a/src/glsl/builtins/110/step b/src/glsl/builtins/110/step index 1cc2b51f8f..ce6f435422 100644 --- a/src/glsl/builtins/110/step +++ b/src/glsl/builtins/110/step @@ -3,15 +3,15 @@ (parameters (declare (in) float edge) (declare (in) float x)) - ((return (expression float b2f (expression bool < (var_ref x) (var_ref edge)))))) + ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge)))))) (signature vec2 (parameters (declare (in) float edge) (declare (in) vec2 x)) ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) (return (var_ref t)))) (signature vec3 @@ -19,9 +19,9 @@ (declare (in) float edge) (declare (in) vec3 x)) ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) (return (var_ref t)))) (signature vec4 @@ -29,10 +29,10 @@ (declare (in) float edge) (declare (in) vec4 x)) ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) (return (var_ref t)))) (signature vec2 @@ -40,8 +40,8 @@ (declare (in) vec2 edge) (declare (in) vec2 x)) ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) (return (var_ref t)))) (signature vec3 @@ -49,9 +49,9 @@ (declare (in) vec3 edge) (declare (in) vec3 x)) ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz z (var_ref x))(swiz z (var_ref edge))))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge))))) (return (var_ref t)))) (signature vec4 @@ -59,10 +59,10 @@ (declare (in) vec4 edge) (declare (in) vec4 x)) ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool < (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz y (var_ref edge))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool < (swiz y (var_ref x))(swiz z (var_ref edge))))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool < (swiz w (var_ref x))(swiz w (var_ref edge))))) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge))))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge))))) (return (var_ref t)))) )) -- cgit v1.2.3 From f5b3b2a01a320d136df3cf1f8c6fa78685d164d1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jun 2010 17:25:09 -0700 Subject: glsl2: Don't break sign() down by vector components. --- src/glsl/builtin_function.cpp | 19 +++---------------- src/glsl/builtins/110/sign | 19 +++---------------- 2 files changed, 6 insertions(+), 32 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 811c5b20ac..b7dbc6b34f 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1856,31 +1856,18 @@ static const char *builtins_110_sign = { " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec2 sign (var_ref x)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec3 sign (var_ref x)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float sign (swiz w (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec4 sign (var_ref x)))))\n" "))\n" - "\n" }; static const char *builtins_110_sin = { diff --git a/src/glsl/builtins/110/sign b/src/glsl/builtins/110/sign index 7d540de405..fa475197cf 100644 --- a/src/glsl/builtins/110/sign +++ b/src/glsl/builtins/110/sign @@ -7,28 +7,15 @@ (signature vec2 (parameters (declare (in) vec2 x)) - ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) - (return (var_ref t)))) + ((return (expression vec2 sign (var_ref x))))) (signature vec3 (parameters (declare (in) vec3 x)) - ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x)))) - (return (var_ref t)))) + ((return (expression vec3 sign (var_ref x))))) (signature vec4 (parameters (declare (in) vec4 x)) - ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float sign (swiz y (var_ref x)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float sign (swiz z (var_ref x)))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float sign (swiz w (var_ref x)))) - (return (var_ref t)))) + ((return (expression vec4 sign (var_ref x))))) )) - -- cgit v1.2.3 From d925c9173009e9e5d48df30b30aaef22753183aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 10:37:11 -0700 Subject: glsl2: Add ir_unop_fract as an expression type. Most backends will prefer seeing this to seeing (a - floor(a)), so represent it explicitly. --- src/glsl/builtin_function.cpp | 8 ++++---- src/glsl/builtins/110/fract | 8 ++++---- src/glsl/ir.cpp | 2 ++ src/glsl/ir.h | 1 + src/glsl/ir_constant_expression.cpp | 18 ++++++++++++++++++ src/mesa/shader/ir_to_mesa.cpp | 4 ++++ 6 files changed, 33 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index b7dbc6b34f..30ba6a5267 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -781,22 +781,22 @@ static const char *builtins_110_fract = { " (signature float\n" " (parameters\n" " (declare (in) float x))\n" - " ((return (expression float - (var_ref x) (expression float floor (var_ref x))))))\n" + " ((return (expression float fract (var_ref x)))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" - " ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x))))))\n" + " ((return (expression vec2 fract (var_ref x)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" - " ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x))))))\n" + " ((return (expression vec3 fract (var_ref x)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x))))))\n" + " ((return (expression vec4 fract (var_ref x)))))\n" "))\n" "\n" }; diff --git a/src/glsl/builtins/110/fract b/src/glsl/builtins/110/fract index 46741bb3cb..3f0763d1b3 100644 --- a/src/glsl/builtins/110/fract +++ b/src/glsl/builtins/110/fract @@ -2,21 +2,21 @@ (signature float (parameters (declare (in) float x)) - ((return (expression float - (var_ref x) (expression float floor (var_ref x)))))) + ((return (expression float fract (var_ref x))))) (signature vec2 (parameters (declare (in) vec2 x)) - ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x)))))) + ((return (expression vec2 fract (var_ref x))))) (signature vec3 (parameters (declare (in) vec3 x)) - ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x)))))) + ((return (expression vec3 fract (var_ref x))))) (signature vec4 (parameters (declare (in) vec4 x)) - ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x)))))) + ((return (expression vec4 fract (var_ref x))))) )) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 60ee36d17c..4257842583 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -72,6 +72,7 @@ ir_expression::get_num_operands(ir_expression_operation op) 1, /* ir_unop_trunc */ 1, /* ir_unop_ceil */ 1, /* ir_unop_floor */ + 1, /* ir_unop_fract */ 1, /* ir_unop_sin */ 1, /* ir_unop_cos */ @@ -137,6 +138,7 @@ static const char *const operator_strs[] = { "trunc", "ceil", "floor", + "fract", "sin", "cos", "dFdx", diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 00b0076c17..f47813786b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -528,6 +528,7 @@ enum ir_expression_operation { ir_unop_trunc, ir_unop_ceil, ir_unop_floor, + ir_unop_fract, /*@}*/ /** diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c6348ac434..548217cddd 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -187,6 +187,24 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_fract: + for (c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = 0; + break; + case GLSL_TYPE_INT: + data.i[c] = 0; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] - floor(op[0]->value.f[c]); + break; + default: + assert(0); + } + } + break; + case ir_unop_neg: for (c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index b270e2da41..2f2096ef97 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -782,6 +782,10 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_floor: ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); break; + case ir_unop_fract: + ir_to_mesa_emit_op1(ir, OPCODE_FRC, result_dst, op[0]); + break; + case ir_binop_min: ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]); break; -- cgit v1.2.3 From 9acf618f24428eba72650c0e328e7ed52986728e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 10:52:30 -0700 Subject: glsl2: Remove dead member from dead code visitor. --- src/glsl/ir_dead_code.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 51fa96df0c..ea78107f49 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -67,7 +67,6 @@ public: variable_entry *get_variable_entry(ir_variable *var); bool (*predicate)(ir_instruction *ir); - ir_instruction *base_ir; /* List of variable_entry */ exec_list variable_list; -- cgit v1.2.3 From 8a1f186cc55979bb9df0a88b48da8d81460c3e7c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 10:09:58 -0700 Subject: glsl2: Add a pass to convert mod(a, b) to b * fract(a/b). This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod. --- src/glsl/Makefile | 1 + src/glsl/ir.h | 9 ++++ src/glsl/ir_hierarchical_visitor.cpp | 7 +-- src/glsl/ir_hierarchical_visitor.h | 12 +++++ src/glsl/ir_hv_accept.cpp | 5 +- src/glsl/ir_mod_to_fract.cpp | 89 ++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/mesa/shader/ir_to_mesa.cpp | 3 ++ 8 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 src/glsl/ir_mod_to_fract.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index f4e32b9185..a709bf7121 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -40,6 +40,7 @@ CXX_SOURCES = \ ir_hierarchical_visitor.cpp \ ir_hv_accept.cpp \ ir_if_simplification.cpp \ + ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ ir_swizzle_swizzle.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index f47813786b..c19bd417c3 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -551,6 +551,15 @@ enum ir_expression_operation { ir_binop_sub, ir_binop_mul, ir_binop_div, + + /** + * Takes one of two combinations of arguments: + * + * - mod(vecN, vecN) + * - mod(vecN, float) + * + * Does not take integer types. + */ ir_binop_mod, /** diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp index 9afb12a4a2..d475df62fc 100644 --- a/src/glsl/ir_hierarchical_visitor.cpp +++ b/src/glsl/ir_hierarchical_visitor.cpp @@ -277,12 +277,7 @@ ir_hierarchical_visitor::visit_leave(ir_if *ir) void ir_hierarchical_visitor::run(exec_list *instructions) { - foreach_list(n, instructions) { - ir_instruction *ir = (ir_instruction *) n; - - if (ir->accept(this) != visit_continue) - break; - } + visit_list_elements(this, instructions); } diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h index 2c4590d4b1..afa780dc91 100644 --- a/src/glsl/ir_hierarchical_visitor.h +++ b/src/glsl/ir_hierarchical_visitor.h @@ -141,6 +141,16 @@ public: */ void run(struct exec_list *instructions); + /* Some visitors may need to insert new variable declarations and + * assignments for portions of a subtree, which means they need a + * pointer to the current instruction in the stream, not just their + * node in the tree rooted at that instruction. + * + * This is implemented by visit_list_elements -- if the visitor is + * not called by it, nothing good will happen. + */ + class ir_instruction *base_ir; + /** * Callback function that is invoked on entry to each node visited. * @@ -161,4 +171,6 @@ void visit_tree(ir_instruction *ir, void (*callback)(class ir_instruction *ir, void *data), void *data); +ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l); + #endif /* IR_HIERARCHICAL_VISITOR_H */ diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index 7b5cc5234c..e772018a45 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -37,20 +37,23 @@ * from list. However, if nodes are added to the list after the node being * processed, some of the added noded may not be processed. */ -static ir_visitor_status +ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l) { exec_node *next; + ir_instruction *prev_base_ir = v->base_ir; for (exec_node *n = l->head; n->next != NULL; n = next) { next = n->next; ir_instruction *const ir = (ir_instruction *) n; + v->base_ir = ir; ir_visitor_status s = ir->accept(v); if (s != visit_continue) return s; } + v->base_ir = prev_base_ir; return visit_continue; } diff --git a/src/glsl/ir_mod_to_fract.cpp b/src/glsl/ir_mod_to_fract.cpp new file mode 100644 index 0000000000..ec1e65092d --- /dev/null +++ b/src/glsl/ir_mod_to_fract.cpp @@ -0,0 +1,89 @@ +/* + * 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 ir_mod_to_floor.cpp + * + * Breaks an ir_unop_mod expression down to (op1 * fract(op0 / op1)) + * + * Many GPUs don't have a MOD instruction (945 and 965 included), and + * if we have to break it down like this anyway, it gives an + * opportunity to do things like constant fold the (1.0 / op1) easily. + */ + +#include "ir.h" + +class ir_mod_to_fract_visitor : public ir_hierarchical_visitor { +public: + ir_mod_to_fract_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool made_progress; +}; + +bool +do_mod_to_fract(exec_list *instructions) +{ + ir_mod_to_fract_visitor v; + + visit_list_elements(&v, instructions); + return v.made_progress; +} + +ir_visitor_status +ir_mod_to_fract_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_mod) + return visit_continue; + + ir_variable *temp = new(ir) ir_variable(ir->operands[1]->type, "mod_b"); + this->base_ir->insert_before(temp); + + ir_assignment *assign; + ir_rvalue *expr; + + assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(temp), + ir->operands[1], NULL); + this->base_ir->insert_before(assign); + + expr = new(ir) ir_expression(ir_binop_div, + ir->operands[0]->type, + ir->operands[0], + new(ir) ir_dereference_variable(temp)); + + expr = new(ir) ir_expression(ir_unop_fract, + ir->operands[0]->type, + expr, + NULL); + + ir->operation = ir_binop_mul; + ir->operands[0] = new(ir) ir_dereference_variable(temp); + ir->operands[1] = expr; + this->made_progress = true; + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 147f92176b..1a8b740566 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -39,5 +39,6 @@ bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_simplification(exec_list *instructions); +bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 2f2096ef97..25267d79b5 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1724,6 +1724,9 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) if (!state->error && !state->translation_unit.is_empty()) _mesa_ast_to_hir(shader->ir, state); + /* Lowering */ + do_mod_to_fract(shader->ir); + /* Optimization passes */ if (!state->error && !shader->ir->is_empty()) { bool progress; -- cgit v1.2.3 From d1b07167b947715577a45b9d9b256c846f3964c6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Jul 2010 10:32:30 -0700 Subject: glsl2: Update README for what I've been thinking about with expr types work. --- src/glsl/README | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/README b/src/glsl/README index 8b6162ab67..74520321b2 100644 --- a/src/glsl/README +++ b/src/glsl/README @@ -68,7 +68,8 @@ 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 --dump-lir ~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag +./glsl_compiler --dump-lir \ + ~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag So for example one of the ir_instructions in main() contains: @@ -151,3 +152,39 @@ 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_binop_mul for +matrices. 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) + +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). -- cgit v1.2.3 From 5466b63968b98c9627b8dd207ea2bebf838b5268 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 12:46:55 -0700 Subject: glsl2: Change order of semaintic checks on variable declarations This will make it easier to support more (valid) kinds of redeclarations. --- src/glsl/ast_to_hir.cpp | 122 ++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 7d966f848b..9d642c1a64 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1636,67 +1636,6 @@ ast_declarator_list::hir(exec_list *instructions, apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc); - /* Attempt to add the variable to the symbol table. If this fails, it - * means the variable has already been declared at this scope. Arrays - * fudge this rule a little bit. - * - * 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 (state->symbols->name_declared_this_scope(decl->identifier)) { - ir_variable *const earlier = - state->symbols->get_variable(decl->identifier); - - if ((earlier != NULL) - && (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. - */ - - if (var->type->array_size() <= (int)earlier->max_array_access) { - YYLTYPE loc = this->get_location(); - - _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 { - YYLTYPE loc = this->get_location(); - - _mesa_glsl_error(& loc, state, "`%s' redeclared", - decl->identifier); - } - - continue; - } - - /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, - * - * "Identifiers starting with "gl_" are reserved for use by - * OpenGL, and may not be declared in a shader as either a - * variable or a function." - */ - if (strncmp(decl->identifier, "gl_", 3) == 0) { - /* FINISHME: This should only trigger if we're not redefining - * FINISHME: a builtin (to add a qualifier, for example). - */ - _mesa_glsl_error(& loc, state, - "identifier `%s' uses reserved `gl_' prefix", - decl->identifier); - } - - instructions->push_tail(var); - if (state->current_function != NULL) { const char *mode = NULL; const char *extra = ""; @@ -1851,6 +1790,67 @@ ast_declarator_list::hir(exec_list *instructions, "const declaration of `%s' must be initialized"); } + /* Attempt to add the variable to the symbol table. If this fails, it + * means the variable has already been declared at this scope. Arrays + * fudge this rule a little bit. + * + * 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 (state->symbols->name_declared_this_scope(decl->identifier)) { + ir_variable *const earlier = + state->symbols->get_variable(decl->identifier); + + if ((earlier != NULL) + && (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. + */ + + if (var->type->array_size() <= (int)earlier->max_array_access) { + YYLTYPE loc = this->get_location(); + + _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 { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "`%s' redeclared", + decl->identifier); + } + + continue; + } + + /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, + * + * "Identifiers starting with "gl_" are reserved for use by + * OpenGL, and may not be declared in a shader as either a + * variable or a function." + */ + if (strncmp(decl->identifier, "gl_", 3) == 0) { + /* FINISHME: This should only trigger if we're not redefining + * FINISHME: a builtin (to add a qualifier, for example). + */ + _mesa_glsl_error(& loc, state, + "identifier `%s' uses reserved `gl_' prefix", + decl->identifier); + } + + instructions->push_tail(var); + /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 -- cgit v1.2.3 From cd00d5b88caa41ebf4b407126f314832f9fdae54 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 13:17:54 -0700 Subject: glsl2: Default delcaration of gl_TexCoord is unsized --- src/glsl/ast_to_hir.cpp | 19 ++++++++++++++++++- src/glsl/ir_variable.cpp | 26 ++++++++++++++++---------- 2 files changed, 34 insertions(+), 11 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9d642c1a64..22d9f7ad53 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1813,7 +1813,24 @@ ast_declarator_list::hir(exec_list *instructions, * FINISHME: required or not. */ - if (var->type->array_size() <= (int)earlier->max_array_access) { + /* 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." + * + * FINISHME: Every platform that supports GLSL sets + * FINISHME: gl_MaxTextureCoords to at least 4, so hard-code 4 + * FINISHME: for now. + */ + if ((strcmp("gl_TexCoord", var->name) == 0) + && (var->type->array_size() > 4)) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot " + "be larger than gl_MaxTextureCoords (%u)\n", + 4); + } else if (var->type->array_size() <= + (int)earlier->max_array_access) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "array size must be > %u due to " diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index ac168142dc..d43809ef9c 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -159,13 +159,16 @@ generate_110_vs_variables(exec_list *instructions, } generate_110_uniforms(instructions, state->symbols); - /* FINISHME: The size of this array is implementation dependent based on the - * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports - * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 - * FINISHME: for now. + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "As with all arrays, indices used to subscript gl_TexCoord must + * either be an integral constant expressions, or this array must be + * re-declared by the shader with a size. The size can be at most + * gl_MaxTextureCoords. Using indexes close to 0 may aid the + * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 4); + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, instructions, state->symbols); @@ -246,13 +249,16 @@ generate_110_fs_variables(exec_list *instructions, } generate_110_uniforms(instructions, state->symbols); - /* FINISHME: The size of this array is implementation dependent based on the - * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports - * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 - * FINISHME: for now. + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "As with all arrays, indices used to subscript gl_TexCoord must + * either be an integral constant expressions, or this array must be + * re-declared by the shader with a size. The size can be at most + * gl_MaxTextureCoords. Using indexes close to 0 may aid the + * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 4); + glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, instructions, state->symbols); -- cgit v1.2.3 From 127308b4be077e5bdf60f76320307550921e86bb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 13:30:50 -0700 Subject: glsl2: Add gl_MaxTextureCoords --- src/glsl/ast_to_hir.cpp | 12 ++++-------- src/glsl/glsl_parser_extras.h | 1 + src/glsl/ir_variable.cpp | 31 +++++++++++++++++-------------- src/glsl/main.cpp | 1 + src/mesa/shader/ir_to_mesa.cpp | 1 + 5 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 22d9f7ad53..fc5a652f25 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1817,20 +1817,16 @@ ast_declarator_list::hir(exec_list *instructions, * * "The size [of gl_TexCoord] can be at most * gl_MaxTextureCoords." - * - * FINISHME: Every platform that supports GLSL sets - * FINISHME: gl_MaxTextureCoords to at least 4, so hard-code 4 - * FINISHME: for now. */ + const unsigned size = unsigned(var->type->array_size()); if ((strcmp("gl_TexCoord", var->name) == 0) - && (var->type->array_size() > 4)) { + && (size > state->Const.MaxTextureCoords)) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot " "be larger than gl_MaxTextureCoords (%u)\n", - 4); - } else if (var->type->array_size() <= - (int)earlier->max_array_access) { + state->Const.MaxTextureCoords); + } else if (size <= earlier->max_array_access) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "array size must be > %u due to " diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index f957a926be..3aeba83cc5 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -50,6 +50,7 @@ struct _mesa_glsl_parse_state { */ struct { unsigned MaxDrawBuffers; + unsigned MaxTextureCoords; } Const; /** diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index d43809ef9c..9daad803e9 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -96,25 +96,28 @@ add_builtin_variable(const builtin_variable *proto, exec_list *instructions, static void generate_110_uniforms(exec_list *instructions, - glsl_symbol_table *symtab) + struct _mesa_glsl_parse_state *state) { for (unsigned i = 0 ; i < Elements(builtin_110_deprecated_uniforms) ; i++) { add_builtin_variable(& builtin_110_deprecated_uniforms[i], - instructions, symtab); + instructions, state->symbols); } - /* FINISHME: The size of this array is implementation dependent based on the - * FINISHME: value of GL_MAX_TEXTURE_COORDS. Every platform that supports - * FINISHME: GLSL sets GL_MAX_TEXTURE_COORDS to at least 4, so hard-code 4 - * FINISHME: for now. - */ + ir_variable *const mtc = add_variable("gl_MaxTextureCoords", ir_var_auto, + -1, glsl_type::int_type, + instructions, state->symbols); + mtc->constant_value = new(mtc) + ir_constant(int(state->Const.MaxTextureCoords)); + + const glsl_type *const mat4_array_type = - glsl_type::get_array_instance(symtab, glsl_type::mat4_type, 4); + glsl_type::get_array_instance(state->symbols, glsl_type::mat4_type, + state->Const.MaxTextureCoords); add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type, - instructions, symtab); + instructions, state->symbols); /* FINISHME: Add support for gl_DepthRangeParameters */ /* FINISHME: Add support for gl_ClipPlane[] */ @@ -129,11 +132,11 @@ generate_110_uniforms(exec_list *instructions, * FINISHME: at least 8, so hard-code 8 for now. */ const glsl_type *const light_source_array_type = - glsl_type::get_array_instance(symtab, - symtab->get_type("gl_LightSourceParameters"), 8); + glsl_type::get_array_instance(state->symbols, + state->symbols->get_type("gl_LightSourceParameters"), 8); add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, - instructions, symtab); + instructions, state->symbols); /* FINISHME: Add support for gl_LightModel */ /* FINISHME: Add support for gl_FrontLightProduct[], gl_BackLightProduct[] */ @@ -157,7 +160,7 @@ generate_110_vs_variables(exec_list *instructions, add_builtin_variable(& builtin_110_deprecated_vs_variables[i], instructions, state->symbols); } - generate_110_uniforms(instructions, state->symbols); + generate_110_uniforms(instructions, state); /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: * @@ -247,7 +250,7 @@ generate_110_fs_variables(exec_list *instructions, add_builtin_variable(& builtin_110_deprecated_fs_variables[i], instructions, state->symbols); } - generate_110_uniforms(instructions, state->symbols); + generate_110_uniforms(instructions, state); /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: * diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index fa63853b47..c833c9cde6 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -128,6 +128,7 @@ compile_shader(struct gl_shader *shader) state->ARB_texture_rectangle_enable = true; state->Const.MaxDrawBuffers = 2; + state->Const.MaxTextureCoords = 4; const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 1e186354c5..14abf602af 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1710,6 +1710,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->ARB_texture_rectangle_enable = true; state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + state->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log); -- cgit v1.2.3 From 12873fa4e332959295154edfe957c0af79af5e74 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 14:10:19 -0700 Subject: glsl2: Don't bounds check unsize array redeclarations This along with several previous commits fix test CorrectUnsizedArray.frag. --- src/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index fc5a652f25..3a7fcf16c5 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1826,7 +1826,7 @@ ast_declarator_list::hir(exec_list *instructions, _mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot " "be larger than gl_MaxTextureCoords (%u)\n", state->Const.MaxTextureCoords); - } else if (size <= earlier->max_array_access) { + } else if ((size > 0) && (size <= earlier->max_array_access)) { YYLTYPE loc = this->get_location(); _mesa_glsl_error(& loc, state, "array size must be > %u due to " -- cgit v1.2.3 From 3832706f81d7f5310882eda6d7ef0c3e39593b18 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 17:10:11 -0700 Subject: glsl2: Initialize ast_declarator_list::invariant in constructor --- src/glsl/glsl_parser_extras.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 1d16ef55f5..2e17c4c337 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -484,6 +484,7 @@ ast_declarator_list::print(void) const ast_declarator_list::ast_declarator_list(ast_fully_specified_type *type) { this->type = type; + this->invariant = false; } void -- cgit v1.2.3 From 6f0823da09384cc1b557385b9e19a9cc7e901ad7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Jul 2010 20:39:08 -0700 Subject: glsl2: Support AST-to-IR translation of invariant keyword --- src/glsl/ast_to_hir.cpp | 84 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 14 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 3a7fcf16c5..3bd0bd6591 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1550,29 +1550,73 @@ ast_declarator_list::hir(exec_list *instructions, 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 { + 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); - /* FINISHME: Handle vertex shader "invariant" declarations that do not - * FINISHME: include a type. These re-declare built-in variables to be - * FINISHME: invariant. - */ - decl_type = this->type->specifier->glsl_type(& type_name, state); if (this->declarations.is_empty()) { - /* There are only two valid cases where the declaration list can be - * empty. - * - * 1. The declaration is setting the default precision of a built-in - * type (e.g., 'precision highp vec4;'). - * - * 2. Adding 'invariant' to an existing vertex shader output. + /* The only valid case where the declaration list can be empty is when + * the declaration is setting the default precision of a built-in type + * (e.g., 'precision highp vec4;'). */ - if (this->type->qualifier.invariant) { - } else if (decl_type != NULL) { + if (decl_type != NULL) { } else { _mesa_glsl_error(& loc, state, "incomplete declaration"); } @@ -1636,6 +1680,18 @@ ast_declarator_list::hir(exec_list *instructions, apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc); + if (this->type->qualifier.invariant) { + if ((state->target == vertex_shader) && !var->shader_out) { + _mesa_glsl_error(& loc, state, + "`%s' cannot be marked invariant, vertex shader " + "outputs only\n", var->name); + } else if ((state->target == fragment_shader) && !var->shader_in) { + _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 = ""; -- cgit v1.2.3 From 2d1223611700b33aab084f1927bfc1ff1b284115 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 16:03:19 -0700 Subject: glsl2: Define preprocessor tokens for extensions Currently only GL_ARB_draw_buffers and GL_ARB_texture_rectangle are defined because those extensions are always enabled. This make tex_rect-03.frag pass. --- src/glsl/glcpp/glcpp-parse.y | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 6beac18c65..d4cb006bbc 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -897,6 +897,8 @@ glcpp_parser_t * glcpp_parser_create (void) { glcpp_parser_t *parser; + token_t *tok; + token_list_t *list; parser = xtalloc (NULL, glcpp_parser_t); @@ -919,6 +921,19 @@ glcpp_parser_create (void) parser->info_log = talloc_strdup(parser, ""); parser->error = 0; + /* Add pre-defined macros. */ + tok = _token_create_ival (parser, INTEGER, 1); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list); + + talloc_unlink(parser, tok); + return parser; } @@ -1413,7 +1428,8 @@ _define_object_macro (glcpp_parser_t *parser, { macro_t *macro; - _check_for_reserved_macro_name(parser, loc, identifier); + if (loc != NULL) + _check_for_reserved_macro_name(parser, loc, identifier); macro = xtalloc (parser, macro_t); -- cgit v1.2.3 From 06143ea09411aa283ac3633bfbfa4326584cd952 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 16:27:22 -0700 Subject: glsl2: Conditionally define preprocessor tokens for optional extensions The only optional extension currently supported by the compiler is GL_EXT_texture_array. --- src/glsl/glcpp/glcpp-parse.y | 10 +++++++++- src/glsl/glcpp/glcpp.c | 5 +---- src/glsl/glcpp/glcpp.h | 7 +++++-- src/glsl/glcpp/pp.c | 5 +++-- src/glsl/glsl_parser_extras.h | 3 ++- src/glsl/main.cpp | 4 +++- src/mesa/shader/ir_to_mesa.cpp | 3 ++- 7 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index d4cb006bbc..e5544fe29b 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -28,6 +28,7 @@ #include #include "glcpp.h" +#include "main/mtypes.h" #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) #define glcpp_printf(stream, fmt, args...) \ @@ -894,7 +895,7 @@ yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) } glcpp_parser_t * -glcpp_parser_create (void) +glcpp_parser_create (const struct gl_extensions *extensions) { glcpp_parser_t *parser; token_t *tok; @@ -932,6 +933,13 @@ glcpp_parser_create (void) _token_list_append(list, tok); _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list); + if ((extensions != NULL) && extensions->EXT_texture_array) { + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, + "GL_EXT_texture_array", list); + } + talloc_unlink(parser, tok); return parser; diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c index cc87e14950..a245cb5406 100644 --- a/src/glsl/glcpp/glcpp.c +++ b/src/glsl/glcpp/glcpp.c @@ -68,16 +68,13 @@ load_text_file(void *ctx, const char *file_name) return text; } -int -preprocess(void *talloc_ctx, const char **shader, char **info_log); - int main (void) { void *ctx = talloc(NULL, void*); const char *shader = load_text_file(ctx, NULL); char *info_log = talloc_strdup(ctx, ""); - int ret = preprocess(ctx, &shader, &info_log); + int ret = preprocess(ctx, &shader, &info_log, NULL); printf("%s", shader); fprintf(stderr, "%s", info_log); diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h index 2cfa98d2b1..fc9511a67a 100644 --- a/src/glsl/glcpp/glcpp.h +++ b/src/glsl/glcpp/glcpp.h @@ -158,8 +158,10 @@ struct glcpp_parser { int error; }; +struct gl_extensions; + glcpp_parser_t * -glcpp_parser_create (void); +glcpp_parser_create (const struct gl_extensions *extensions); int glcpp_parser_parse (glcpp_parser_t *parser); @@ -168,7 +170,8 @@ void glcpp_parser_destroy (glcpp_parser_t *parser); int -preprocess(void *talloc_ctx, const char **shader, char **info_log); +preprocess(void *talloc_ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions); /* Functions for writing to the info log */ diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index a25b7b72a6..1ce829a2c9 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -134,10 +134,11 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) } extern int -preprocess(void *talloc_ctx, const char **shader, char **info_log) +preprocess(void *talloc_ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions) { int errors; - glcpp_parser_t *parser = glcpp_parser_create (); + glcpp_parser_t *parser = glcpp_parser_create (extensions); *shader = remove_line_continuations(parser, *shader); glcpp_lex_set_source_string (parser, *shader); diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 3aeba83cc5..dc3d23ac54 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -115,7 +115,8 @@ extern void _mesa_glsl_warning(const YYLTYPE *locp, const char *fmt, ...); extern "C" { -extern int preprocess(void *ctx, const char **shader, char **info_log); +extern int preprocess(void *ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions); } extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index c833c9cde6..deaab7e033 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -109,6 +109,7 @@ void compile_shader(struct gl_shader *shader) { struct _mesa_glsl_parse_state *state; + struct gl_extensions ext; state = talloc_zero(talloc_parent(shader), struct _mesa_glsl_parse_state); @@ -127,11 +128,12 @@ compile_shader(struct gl_shader *shader) state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; + memset(&ext, 0, sizeof(ext)); state->Const.MaxDrawBuffers = 2; state->Const.MaxTextureCoords = 4; const char *source = shader->Source; - state->error = preprocess(state, &source, &state->info_log); + state->error = preprocess(state, &source, &state->info_log, &ext); if (!state->error) { _mesa_glsl_lexer_ctor(state, source); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 14abf602af..918004c79f 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1713,7 +1713,8 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; const char *source = shader->Source; - state->error = preprocess(state, &source, &state->info_log); + state->error = preprocess(state, &source, &state->info_log, + &ctx->Extensions); if (!state->error) { _mesa_glsl_lexer_ctor(state, source); -- cgit v1.2.3 From efb6b24223e0bfd29959e131cd308b1e07ff20df Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 16:40:47 -0700 Subject: glsl2: Append _TOK to some parser tokens This prevents conflicts with defines elsewhere in Mesa and allows including mtypes.h in the compiler. --- src/glsl/glsl_lexer.lpp | 6 +++--- src/glsl/glsl_parser.ypp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index f236a15682..ddaa19db72 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -105,7 +105,7 @@ HASH ^{SPC}#{SPC} \n { yylineno++; yycolumn = 0; } attribute return ATTRIBUTE; -const return CONST; +const return CONST_TOK; bool return BOOL; float return FLOAT; int return INT; @@ -272,10 +272,10 @@ packed return PACKED; goto return GOTO; switch return SWITCH; default return DEFAULT; -inline return INLINE; +inline return INLINE_TOK; noinline return NOINLINE; volatile return VOLATILE; -public return PUBLIC; +public return PUBLIC_TOK; static return STATIC; extern return EXTERN; external return EXTERNAL; diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index d894a968ec..f85b419271 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -70,7 +70,7 @@ } for_rest_statement; } -%token ATTRIBUTE CONST BOOL FLOAT INT UINT +%token ATTRIBUTE CONST_TOK BOOL FLOAT INT UINT %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 %token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT UNIFORM VARYING @@ -101,7 +101,7 @@ /* Reserved words that are not actually used in the grammar. */ %token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED GOTO -%token INLINE NOINLINE VOLATILE PUBLIC STATIC EXTERN EXTERNAL +%token INLINE_TOK NOINLINE VOLATILE PUBLIC_TOK STATIC EXTERN EXTERNAL %token LONG SHORT DOUBLE HALF FIXED UNSIGNED INPUT OUPTUT %token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4 %token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW @@ -942,7 +942,7 @@ interpolation_qualifier: ; parameter_type_qualifier: - CONST { $$.i = 0; $$.q.constant = 1; } + CONST_TOK { $$.i = 0; $$.q.constant = 1; } ; type_qualifier: @@ -959,7 +959,7 @@ type_qualifier: ; storage_qualifier: - CONST { $$.i = 0; $$.q.constant = 1; } + CONST_TOK { $$.i = 0; $$.q.constant = 1; } | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } | VARYING { $$.i = 0; $$.q.varying = 1; } | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } -- cgit v1.2.3 From 667f4e1940c4c4660e35dc9906672a476369660f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 16:42:07 -0700 Subject: glsl2: Conditionally allow optional extensions to be enabled The only optional extension currently supported by the compiler is GL_EXT_texture_array. --- src/glsl/glsl_parser_extras.cpp | 6 ++++++ src/glsl/glsl_parser_extras.h | 3 +++ src/glsl/main.cpp | 1 + src/mesa/shader/ir_to_mesa.cpp | 1 + 4 files changed, 11 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 2e17c4c337..fc3f9e90b6 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -27,6 +27,7 @@ extern "C" { #include +#include "main/mtypes.h" } #include "ast.h" @@ -135,6 +136,11 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) { state->ARB_texture_rectangle_enable = (ext_mode != extension_disable); state->ARB_texture_rectangle_warn = (ext_mode == extension_warn); + } else if (strcmp(name, "GL_EXT_texture_array") == 0) { + state->EXT_texture_array_enable = (ext_mode != extension_disable); + state->EXT_texture_array_warn = (ext_mode == extension_warn); + + unsupported = !state->extensions->EXT_texture_array; } else { unsupported = true; } diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index dc3d23ac54..16f7268181 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -90,6 +90,9 @@ struct _mesa_glsl_parse_state { unsigned EXT_texture_array_enable:1; unsigned EXT_texture_array_warn:1; /*@}*/ + + /** Extensions supported by the OpenGL implementation. */ + const struct gl_extensions *extensions; }; typedef struct YYLTYPE { diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index deaab7e033..16bbc8cd3f 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -129,6 +129,7 @@ compile_shader(struct gl_shader *shader) state->ARB_texture_rectangle_enable = true; memset(&ext, 0, sizeof(ext)); + state->extensions = &ext; state->Const.MaxDrawBuffers = 2; state->Const.MaxTextureCoords = 4; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 918004c79f..7c7e368d0d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1709,6 +1709,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; + state->extensions = &ctx->Extensions; state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; state->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; -- cgit v1.2.3 From 9a0e421983edc31371440c08687fa2bb2207924d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Jul 2010 11:27:06 -0700 Subject: glsl2: Add a pass to break ir_binop_div to _mul and _rcp. This results in constant folding of a constant divisor. --- src/glsl/Makefile | 1 + src/glsl/ir_div_to_mul_rcp.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/mesa/shader/ir_to_mesa.cpp | 5 ++- 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 src/glsl/ir_div_to_mul_rcp.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index a709bf7121..30ba475d92 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -33,6 +33,7 @@ CXX_SOURCES = \ ir.cpp \ ir_dead_code.cpp \ ir_dead_code_local.cpp \ + ir_div_to_mul_rcp.cpp \ ir_expression_flattening.cpp \ ir_function_can_inline.cpp \ ir_function.cpp \ diff --git a/src/glsl/ir_div_to_mul_rcp.cpp b/src/glsl/ir_div_to_mul_rcp.cpp new file mode 100644 index 0000000000..ce84add221 --- /dev/null +++ b/src/glsl/ir_div_to_mul_rcp.cpp @@ -0,0 +1,77 @@ +/* + * 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 ir_div_to_mul_rcp.cpp + * + * Breaks an ir_unop_div expression down to op0 * (rcp(op1)). + * + * Many GPUs don't have a divide instruction (945 and 965 included), + * but they do have an RCP instruction to compute an approximate + * reciprocal. By breaking the operation down, constant reciprocals + * can get constant folded. + */ + +#include "ir.h" + +class ir_div_to_mul_rcp_visitor : public ir_hierarchical_visitor { +public: + ir_div_to_mul_rcp_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool made_progress; +}; + +bool +do_div_to_mul_rcp(exec_list *instructions) +{ + ir_div_to_mul_rcp_visitor v; + + visit_list_elements(&v, instructions); + return v.made_progress; +} + +ir_visitor_status +ir_div_to_mul_rcp_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_div) + return visit_continue; + + /* New expression for the 1.0 / op1 */ + ir_rvalue *expr; + expr = new(ir) ir_expression(ir_unop_rcp, + ir->operands[1]->type, + ir->operands[1], + NULL); + + /* op0 / op1 -> op0 * (1.0 / op1) */ + ir->operation = ir_binop_mul; + ir->operands[1] = expr; + this->made_progress = true; + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 1a8b740566..6d02e591c3 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -37,6 +37,7 @@ bool do_dead_code(struct _mesa_glsl_parse_state *state, bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, exec_list *instructions); +bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_simplification(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 7c7e368d0d..d5664e7b91 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -691,9 +691,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) } break; case ir_binop_div: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[1]); - ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], result_src); - break; + assert(!"not reached: should be handled by ir_div_to_mul_rcp"); case ir_binop_mod: assert(!"ir_binop_mod should have been converted to b * fract(a/b)"); break; @@ -1729,6 +1727,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) /* Lowering */ do_mod_to_fract(shader->ir); + do_div_to_mul_rcp(shader->ir); /* Optimization passes */ if (!state->error && !shader->ir->is_empty()) { -- cgit v1.2.3 From 4d962e66e319191d5b94291b6f55d720df71130a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 2 Jul 2010 14:43:01 -0700 Subject: glsl2: Print the linking info log in the stand-alone compiler --- src/glsl/main.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 16bbc8cd3f..9bed2c6bcc 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -266,6 +266,9 @@ main(int argc, char **argv) if ((status == EXIT_SUCCESS) && do_link) { link_shaders(whole_program); status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE; + + if (strlen(whole_program->InfoLog) > 0) + printf("Info log for linking:\n%s\n", whole_program->InfoLog); } talloc_free(whole_program); -- cgit v1.2.3 From 9a7ac272fb7d87e56277ed88585f389446a4a1b9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 02:10:01 -0700 Subject: glsl2/builtins: Use vector ops in "smoothstep." --- src/glsl/builtins/110/smoothstep | 101 ++++++--------------------------------- 1 file changed, 15 insertions(+), 86 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/110/smoothstep b/src/glsl/builtins/110/smoothstep index b4255ba78f..663eec6341 100644 --- a/src/glsl/builtins/110/smoothstep +++ b/src/glsl/builtins/110/smoothstep @@ -122,103 +122,32 @@ (declare (in) vec2 edge0) (declare (in) vec2 edge1) (declare (in) vec2 x)) - ((declare () vec2 t) - (declare () vec2 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - (return (var_ref retval)) - )) + ((return (expression vec2 max + (expression vec2 min + (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0))) + (constant vec2 (1.0 1.0))) + (constant vec2 (0.0 0.0)))))) (signature vec3 (parameters (declare (in) vec3 edge0) (declare (in) vec3 edge1) (declare (in) vec3 x)) - ((declare () vec3 t) - (declare () vec3 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (swiz z (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - (return (var_ref retval)) - )) - + ((return (expression vec3 max + (expression vec3 min + (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0))) + (constant vec3 (1.0 1.0 1.0))) + (constant vec3 (0.0 0.0 0.0)))))) (signature vec4 (parameters (declare (in) vec4 edge0) (declare (in) vec4 edge1) (declare (in) vec4 x)) - ((declare () vec4 t) - (declare () vec4 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (swiz z (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - - (assign (constant bool (1)) (swiz w (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz w (var_ref x)) (swiz w (var_ref edge0))) (expression float - (swiz w (var_ref edge1)) (swiz w (var_ref edge0)))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) - (return (var_ref retval)) - )) - + ((return (expression vec4 max + (expression vec4 min + (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0))) + (constant vec4 (1.0 1.0 1.0 1.0))) + (constant vec4 (0.0 0.0 0.0 0.0)))))) )) -- cgit v1.2.3 From ddc3aa07832c3fa35382b57ce2539dbac5a6158d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 02:12:34 -0700 Subject: glsl2/builtins: Use vector ops in the 130 version of "sign." --- src/glsl/builtins/130/sign | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/130/sign b/src/glsl/builtins/130/sign index 0bdc0e09d2..170795948b 100644 --- a/src/glsl/builtins/130/sign +++ b/src/glsl/builtins/130/sign @@ -7,28 +7,16 @@ (signature ivec2 (parameters (declare (in) ivec2 x)) - ((declare () ivec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) - (return (var_ref t)))) + ((return (expression ivec2 sign (var_ref x))))) (signature ivec3 (parameters (declare (in) ivec3 x)) - ((declare () ivec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x)))) - (return (var_ref t)))) + ((return (expression ivec3 sign (var_ref x))))) (signature ivec4 (parameters (declare (in) ivec4 x)) - ((declare () ivec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x)))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression int sign (swiz w (var_ref x)))) - (return (var_ref t)))) + ((return (expression ivec4 sign (var_ref x))))) )) -- cgit v1.2.3 From 2070f9f5bec99e7b91309060984431aa7ea32c00 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 15:02:57 -0700 Subject: glsl2: Fix for dead strings being stored in the symbol table. --- src/glsl/ir_reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 5ba76e29ea..80dbc08645 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -206,7 +206,7 @@ read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) ir_function *f = st->symbols->get_function(name->value()); if (f == NULL) { f = new(ctx) ir_function(name->value()); - bool added = st->symbols->add_function(name->value(), f); + bool added = st->symbols->add_function(f->name, f); assert(added); } @@ -439,7 +439,7 @@ read_declaration(_mesa_glsl_parse_state *st, s_list *list) } // Add the variable to the symbol table - st->symbols->add_variable(var_name->value(), var); + st->symbols->add_variable(var->name, var); return var; } -- cgit v1.2.3 From 7e908a6a27f196027a4dfd0f4d8c37aa71e163fa Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 15:31:26 -0700 Subject: glcpp: Add #error support. --- src/glsl/glcpp/glcpp-lex.l | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index afddd7ddb3..6a91b09954 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -24,6 +24,7 @@ #include #include +#include #include "glcpp.h" #include "glcpp-parse.h" @@ -139,6 +140,13 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } } +{HASH}error.* { + char *p; + for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ + p += 5; /* skip "error" */ + glcpp_error(yylloc, yyextra, "#error%s", p); +} + {HASH}define{HSPACE}+/{IDENTIFIER}"(" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; -- cgit v1.2.3 From 83035574dbe0e225fbdeb9ceb4f0af9b0e0c5ddb Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 18:20:19 -0700 Subject: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 119 +++++++----------------------------------- 1 file changed, 18 insertions(+), 101 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 30ba6a5267..40c85e7c98 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -2019,104 +2019,33 @@ static const char *builtins_110_smoothstep = { " (declare (in) vec2 edge0)\n" " (declare (in) vec2 edge1)\n" " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (declare () vec2 retval)\n" - "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " ((return (expression vec2 max\n" + " (expression vec2 min\n" + " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec2 (1.0 1.0)))\n" + " (constant vec2 (0.0 0.0))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 edge0)\n" " (declare (in) vec3 edge1)\n" " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (declare () vec3 retval)\n" - "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz z (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" - "\n" + " ((return (expression vec3 max\n" + " (expression vec3 min\n" + " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec3 (1.0 1.0 1.0)))\n" + " (constant vec3 (0.0 0.0 0.0))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 edge0)\n" " (declare (in) vec4 edge1)\n" " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (declare () vec4 retval)\n" - "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (swiz x (var_ref edge0))) (expression float - (swiz x (var_ref edge1)) (swiz x (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (swiz y (var_ref edge0))) (expression float - (swiz y (var_ref edge1)) (swiz y (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz z (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (swiz z (var_ref edge0))) (expression float - (swiz z (var_ref edge1)) (swiz z (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (swiz w (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz w (var_ref x)) (swiz w (var_ref edge0))) (expression float - (swiz w (var_ref edge1)) (swiz w (var_ref edge0))))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" - "\n" + " ((return (expression vec4 max\n" + " (expression vec4 min\n" + " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec4 (1.0 1.0 1.0 1.0)))\n" + " (constant vec4 (0.0 0.0 0.0 0.0))))))\n" "))\n" "\n" }; @@ -3664,29 +3593,17 @@ static const char *builtins_130_sign = { " (signature ivec2\n" " (parameters\n" " (declare (in) ivec2 x))\n" - " ((declare () ivec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression ivec2 sign (var_ref x)))))\n" "\n" " (signature ivec3\n" " (parameters\n" " (declare (in) ivec3 x))\n" - " ((declare () ivec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression ivec3 sign (var_ref x)))))\n" "\n" " (signature ivec4\n" " (parameters\n" " (declare (in) ivec4 x))\n" - " ((declare () ivec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression int sign (swiz x (var_ref x))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression int sign (swiz y (var_ref x))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression int sign (swiz z (var_ref x))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression int sign (swiz w (var_ref x))))\n" - " (return (var_ref t))))\n" + " ((return (expression ivec4 sign (var_ref x)))))\n" "))\n" "\n" }; -- cgit v1.2.3 From d1a1ee583e7e8338243b3e9768d2fc5312a1145d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 6 Jul 2010 14:49:14 -0700 Subject: Add hash table helper functions for using pointers as hash keys --- src/glsl/ir_function_inlining.cpp | 14 +------------- src/glsl/ir_validate.cpp | 15 ++------------- src/mesa/shader/hash_table.c | 14 ++++++++++++++ src/mesa/shader/hash_table.h | 24 ++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 26 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 1adf67868e..b3d1f1d167 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -33,9 +33,7 @@ #include "ir_function_inlining.h" #include "ir_expression_flattening.h" #include "glsl_types.h" -extern "C" { #include "hash_table.h" -} class ir_function_inlining_visitor : public ir_hierarchical_visitor { public: @@ -60,16 +58,6 @@ public: }; -unsigned int hash_func(const void *key) -{ - return (unsigned int)(uintptr_t)key; -} - -int hash_compare_func(const void *key1, const void *key2) -{ - return key1 == key2 ? 0 : 1; -} - bool automatic_inlining_predicate(ir_instruction *ir) { @@ -124,7 +112,7 @@ ir_call::generate_inline(ir_instruction *next_ir) ir_variable *retval = NULL; struct hash_table *ht; - ht = hash_table_ctor(0, hash_func, hash_compare_func); + ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); num_parameters = 0; foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters) diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 1953852487..7582d57e7c 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -36,26 +36,15 @@ #include #include "ir.h" #include "ir_hierarchical_visitor.h" -extern "C" { #include "hash_table.h" -} - -static unsigned int hash_func(const void *key) -{ - return (unsigned int)(uintptr_t)key; -} - -static int hash_compare_func(const void *key1, const void *key2) -{ - return key1 == key2 ? 0 : 1; -} class ir_validate : public ir_hierarchical_visitor { public: ir_validate() { - this->ht = hash_table_ctor(0, hash_func, hash_compare_func); + this->ht = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); this->callback = ir_validate::validate_ir; this->data = ht; diff --git a/src/mesa/shader/hash_table.c b/src/mesa/shader/hash_table.c index fa6ba2bfdf..933e300abd 100644 --- a/src/mesa/shader/hash_table.c +++ b/src/mesa/shader/hash_table.c @@ -157,3 +157,17 @@ hash_table_string_hash(const void *key) return hash; } + + +unsigned +hash_table_pointer_hash(const void *key) +{ + return (unsigned)((uintptr_t) key / sizeof(void *)); +} + + +int +hash_table_pointer_compare(const void *key1, const void *key2) +{ + return key1 == key2 ? 0 : 1; +} diff --git a/src/mesa/shader/hash_table.h b/src/mesa/shader/hash_table.h index 881e756f08..0552691464 100644 --- a/src/mesa/shader/hash_table.h +++ b/src/mesa/shader/hash_table.h @@ -118,6 +118,30 @@ extern unsigned hash_table_string_hash(const void *key); */ #define hash_table_string_compare ((hash_compare_func_t) strcmp) + +/** + * Compute hash value of a pointer + * + * \param key Pointer to be used as a hash key + * + * \note + * The memory pointed to by \c key is \b never accessed. The value of \c key + * itself is used as the hash key + * + * \sa hash_table_pointer_compare + */ +unsigned +hash_table_pointer_hash(const void *key); + + +/** + * Compare two pointers used as keys + * + * \sa hash_table_pointer_hash + */ +int +hash_table_pointer_compare(const void *key1, const void *key2); + #ifdef __cplusplus }; #endif -- cgit v1.2.3 From c63a1db81f56cc2021fe1fb2411c327f720b0e09 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 5 Jul 2010 22:33:35 -0700 Subject: ir_constant_expression: Initialize all components of constant data to 0. This is probably just a good idea, and will come in useful when implementing things like matrix multiplication. --- src/glsl/ir_constant_expression.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 548217cddd..1b81017698 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -133,6 +133,8 @@ ir_constant_visitor::visit(ir_expression *ir) unsigned int operand, c; ir_constant_data data; + memset(&data, 0, sizeof(data)); + for (operand = 0; operand < ir->get_num_operands(); operand++) { op[operand] = ir->operands[operand]->constant_expression_value(); if (!op[operand]) -- cgit v1.2.3 From 6bc432e14e12c280bc53e57338bf86fbf8d26885 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 2 Jul 2010 17:12:23 -0700 Subject: ir_constant_expression: Initialize op[0] and op[1] to NULL. This makes it easy to check if there is a second argument. --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 1b81017698..6d6ee093d7 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -129,7 +129,7 @@ void ir_constant_visitor::visit(ir_expression *ir) { value = NULL; - ir_constant *op[2]; + ir_constant *op[2] = { NULL, NULL }; unsigned int operand, c; ir_constant_data data; -- cgit v1.2.3 From 6fc983b9bb5555e2906d2680bc3cbd11c43b63f6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 02:39:57 -0700 Subject: ir_constant_expression: Assert that both operands share a base type. --- src/glsl/ir_constant_expression.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 6d6ee093d7..610d9479a9 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -141,6 +141,9 @@ ir_constant_visitor::visit(ir_expression *ir) return; } + if (op[1] != NULL) + assert(op[0]->type->base_type == op[1]->type->base_type); + switch (ir->operation) { case ir_unop_logic_not: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); -- cgit v1.2.3 From e74dcd7924901e5cb3d0952f46e955e15d0b3207 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 02:48:16 -0700 Subject: ir_constant_expression: Support scalar + vector and scalar + matrix. Fixes piglit tests const-vec-scalar-01.frag, const-vec-scalar-05.frag, and const-mat-scalar-01.frag. --- src/glsl/ir_constant_expression.cpp | 46 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 610d9479a9..033eee1d72 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -144,6 +144,16 @@ ir_constant_visitor::visit(ir_expression *ir) if (op[1] != NULL) assert(op[0]->type->base_type == op[1]->type->base_type); + bool op0_scalar = op[0]->type->is_scalar(); + bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar(); + + /* When iterating over a vector or matrix's components, we want to increase + * the loop counter. However, for scalars, we want to stay at 0. + */ + unsigned c0_inc = op0_scalar ? 1 : 0; + unsigned c1_inc = op1_scalar ? 1 : 0; + unsigned components = op[op1_scalar ? 0 : 1]->type->components(); + switch (ir->operation) { case ir_unop_logic_not: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); @@ -308,25 +318,25 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_add: - if (ir->operands[0]->type == ir->operands[1]->type) { - for (c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c] + op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c] + op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.f[c] = op[0]->value.f[c] + op[1]->value.f[c]; - break; - default: - assert(0); - } + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] + op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] + op[1]->value.f[c1]; + break; + default: + assert(0); } - } else - /* FINISHME: Support operations with non-equal types. */ - return; + } break; case ir_binop_sub: -- cgit v1.2.3 From 97b44f040abc9cbf257aba1b7fdaa11134dcc70b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 02:53:29 -0700 Subject: ir_constant_expression: Support scalar - vector and scalar - matrix. Fixes piglit tests const-vec-scalar-02.frag and const-mat-scalar-02.frag. --- src/glsl/ir_constant_expression.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 033eee1d72..fbf06f1325 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -340,25 +340,25 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_sub: - if (ir->operands[0]->type == ir->operands[1]->type) { - for (c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c] - op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c] - op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.f[c] = op[0]->value.f[c] - op[1]->value.f[c]; - break; - default: - assert(0); - } + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] - op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1]; + break; + default: + assert(0); } - } else - /* FINISHME: Support operations with non-equal types. */ - return; + } break; case ir_binop_mul: -- cgit v1.2.3 From dad35eb8b0c7378588d9dca1c1091aaede83a83f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 02:56:36 -0700 Subject: ir_constant_expression: Support scalar / vector and scalar / matrix. Fixes piglit tests const-vec-scalar-04.frag and const-mat-scalar-04.frag. --- src/glsl/ir_constant_expression.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index fbf06f1325..2fab03bb60 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -385,25 +385,25 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_div: - if (ir->operands[0]->type == ir->operands[1]->type) { - for (c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c] / op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c] / op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.f[c] = op[0]->value.f[c] / op[1]->value.f[c]; - break; - default: - assert(0); - } + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1]; + break; + default: + assert(0); } - } else - /* FINISHME: Support operations with non-equal types. */ - return; + } break; case ir_binop_logic_and: -- cgit v1.2.3 From 37b3f9d0edb55807f822c02292348e20a8369c43 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 03:01:15 -0700 Subject: ir_constant_expression: Support scalar * vector and scalar * matrix. The test here is slightly different since we need to keep matrix multiplication separate. Fixes piglit tests const-vec-scalar-03.frag and const-mat-scalar-03.frag. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 2fab03bb60..e039504d4e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -362,25 +362,28 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_mul: - if (ir->operands[0]->type == ir->operands[1]->type && - !ir->operands[0]->type->is_matrix()) { - for (c = 0; c < ir->operands[0]->type->components(); c++) { + if ((op[0]->type == op[1]->type && !op[0]->type->is_matrix()) + || op0_scalar || op1_scalar) { + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + switch (ir->operands[0]->type->base_type) { case GLSL_TYPE_UINT: - data.u[c] = op[0]->value.u[c] * op[1]->value.u[c]; + data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1]; break; case GLSL_TYPE_INT: - data.i[c] = op[0]->value.i[c] * op[1]->value.i[c]; + data.i[c] = op[0]->value.i[c0] * op[1]->value.i[c1]; break; case GLSL_TYPE_FLOAT: - data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]; + data.f[c] = op[0]->value.f[c0] * op[1]->value.f[c1]; break; default: assert(0); } } } else - /* FINISHME: Support operations with non-equal types. */ + /* FINISHME: Support vector/matrix and matrix multiplication. */ return; break; -- cgit v1.2.3 From cf80a4d177225345c2238d8e545f8ae02b41da71 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 5 Jul 2010 23:19:56 -0700 Subject: ir_constant_expression: Add support for matrix multiplication. Also handles matrix/vector and vector/matrix multiplication. Fixes piglit tests const-matrix-multiply-01.frag, const-matrix-multiply-02.frag, and const-vec-mat.frag. --- src/glsl/ir_constant_expression.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index e039504d4e..d05aa104f8 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -362,6 +362,7 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_mul: + /* Check for equal types, or unequal types involving scalars */ if ((op[0]->type == op[1]->type && !op[0]->type->is_matrix()) || op0_scalar || op1_scalar) { for (unsigned c = 0, c0 = 0, c1 = 0; @@ -382,9 +383,30 @@ ir_constant_visitor::visit(ir_expression *ir) assert(0); } } - } else - /* FINISHME: Support vector/matrix and matrix multiplication. */ - return; + } else { + assert(op[0]->type->is_matrix() || op[1]->type->is_matrix()); + + /* Multiply an N-by-M matrix with an M-by-P matrix. Since either + * matrix can be a GLSL vector, either N or P can be 1. + * + * For vec*mat, the vector is treated as a row vector. This + * means the vector is a 1-row x M-column matrix. + * + * For mat*vec, the vector is treated as a column vector. Since + * matrix_columns is 1 for vectors, this just works. + */ + const unsigned n = op[0]->type->is_vector() + ? 1 : op[0]->type->vector_elements; + const unsigned m = op[1]->type->vector_elements; + const unsigned p = op[1]->type->matrix_columns; + for (unsigned j = 0; j < p; j++) { + for (unsigned i = 0; i < n; i++) { + for (unsigned k = 0; k < m; k++) { + data.f[i+n*j] += op[0]->value.f[i+n*k]*op[1]->value.f[k+m*j]; + } + } + } + } break; case ir_binop_div: -- cgit v1.2.3 From 3f4a0b8bb0cfa36cc6f9968c8aab03f1cb0678ff Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 5 Jul 2010 21:15:32 -0700 Subject: ir_constant_expression: Add support for dot products. --- src/glsl/ir_constant_expression.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index d05aa104f8..5c2e3629e1 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -317,6 +317,26 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_binop_dot: + assert(op[0]->type->is_vector() && op[1]->type->is_vector()); + data.f[0] = 0; + for (c = 0; c < op[0]->type->components(); c++) { + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[0] += op[0]->value.u[c] * op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[0] += op[0]->value.i[c] * op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[0] += op[0]->value.f[c] * op[1]->value.f[c]; + break; + default: + assert(0); + } + } + + break; case ir_binop_add: assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); for (unsigned c = 0, c0 = 0, c1 = 0; -- cgit v1.2.3 From f2dfac6d7455b6bf95cb94bd9ba296dea5c93faf Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 04:59:08 -0700 Subject: glsl2: Update TODO. --- src/glsl/TODO | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/TODO b/src/glsl/TODO index c702eb4927..b2baa13078 100644 --- a/src/glsl/TODO +++ b/src/glsl/TODO @@ -1,13 +1,3 @@ -- Implement AST-to-HIR conversion of discard instructions. - -- Handle constant expressions of (matrix {+,-,*,/} scalar) - -- Handle constant expressions of (vector {+,-,*,/} scalar) - -- Handle constant expressions of (matrix * vector) - -- Handle constant expressions of (matrix * matrix) - - Handle currently unsupported constant expression types - ir_unop_sign - ir_unop_exp2 @@ -18,7 +8,6 @@ - ir_unop_floor - ir_unop_sin - ir_unop_cos - - ir_binop_dot - ir_binop_min - ir_binop_max - ir_binop_pow @@ -79,3 +68,6 @@ - ir_binop_bit_and - ir_binop_bit_xor - ir_binop_bit_or + +- Implement support for 1.30 style shadow compares which only return a float + instead of a vec4. -- cgit v1.2.3 From f14e596f11b4e44c75a880536efb1e8c5a72da7d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 6 Jul 2010 16:26:11 -0700 Subject: ir_constant_expression: Declare loop counting variables in the loops. Fixes "name lookup of 'c' changed" warning. --- src/glsl/ir_constant_expression.cpp | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 5c2e3629e1..11c810bc48 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -130,12 +130,11 @@ ir_constant_visitor::visit(ir_expression *ir) { value = NULL; ir_constant *op[2] = { NULL, NULL }; - unsigned int operand, c; ir_constant_data data; memset(&data, 0, sizeof(data)); - for (operand = 0; operand < ir->get_num_operands(); operand++) { + for (unsigned operand = 0; operand < ir->get_num_operands(); operand++) { op[operand] = ir->operands[operand]->constant_expression_value(); if (!op[operand]) return; @@ -157,20 +156,20 @@ ir_constant_visitor::visit(ir_expression *ir) switch (ir->operation) { case ir_unop_logic_not: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) data.b[c] = !op[0]->value.b[c]; break; case ir_unop_f2i: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.i[c] = op[0]->value.f[c]; } break; case ir_unop_i2f: assert(op[0]->type->base_type == GLSL_TYPE_UINT || op[0]->type->base_type == GLSL_TYPE_INT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { if (op[0]->type->base_type == GLSL_TYPE_INT) data.f[c] = op[0]->value.i[c]; else @@ -179,31 +178,31 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_unop_b2f: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = op[0]->value.b[c] ? 1.0 : 0.0; } break; case ir_unop_f2b: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.b[c] = bool(op[0]->value.f[c]); } break; case ir_unop_b2i: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.u[c] = op[0]->value.b[c] ? 1 : 0; } break; case ir_unop_i2b: assert(op[0]->type->is_integer()); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.b[c] = bool(op[0]->value.u[c]); } break; case ir_unop_fract: - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = 0; @@ -221,7 +220,7 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_unop_neg: - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = -op[0]->value.u[c]; @@ -240,7 +239,7 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_unop_abs: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c]; @@ -261,7 +260,7 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_unop_rcp: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { case GLSL_TYPE_UINT: if (op[0]->value.u[c] != 0.0) @@ -283,28 +282,28 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_unop_rsq: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = 1.0 / sqrtf(op[0]->value.f[c]); } break; case ir_unop_sqrt: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = sqrtf(op[0]->value.f[c]); } break; case ir_unop_exp: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = expf(op[0]->value.f[c]); } break; case ir_unop_log: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = logf(op[0]->value.f[c]); } break; @@ -312,7 +311,7 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_unop_dFdx: case ir_unop_dFdy: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { data.f[c] = 0.0; } break; @@ -320,7 +319,7 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_binop_dot: assert(op[0]->type->is_vector() && op[1]->type->is_vector()); data.f[0] = 0; - for (c = 0; c < op[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { switch (ir->operands[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[0] += op[0]->value.u[c] * op[1]->value.u[c]; @@ -453,17 +452,17 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_logic_and: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] && op[1]->value.b[c]; break; case ir_binop_logic_xor: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c]; break; case ir_binop_logic_or: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] || op[1]->value.b[c]; break; @@ -530,7 +529,7 @@ ir_constant_visitor::visit(ir_expression *ir) case ir_binop_equal: data.b[0] = true; - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->operands[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c]; @@ -551,7 +550,7 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_binop_nequal: data.b[0] = false; - for (c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->operands[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c]; -- cgit v1.2.3 From ca088cc277ce9f986693c857f3961dc0e1a4d91c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 6 Jul 2010 17:41:02 -0700 Subject: glsl2: Clone methods return the type of the thing being cloned This is as opposed to returning the type of the base class of the hierarchy. --- src/glsl/ast_to_hir.cpp | 10 +++++----- src/glsl/ir.h | 38 ++++++++++++++++++++----------------- src/glsl/ir_clone.cpp | 34 ++++++++++++++++----------------- src/glsl/ir_constant_expression.cpp | 2 +- src/glsl/ir_function_inlining.cpp | 2 +- 5 files changed, 45 insertions(+), 41 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 3bd0bd6591..f5e93b0254 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -961,7 +961,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + op[0]->clone(NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = (op[0]->type->is_error()); @@ -987,7 +987,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + op[0]->clone(NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = type->is_error(); @@ -1107,7 +1107,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + op[0]->clone(NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = op[0]->type->is_error(); @@ -1133,10 +1133,10 @@ ast_expression::hir(exec_list *instructions, /* Get a temporary of a copy of the lvalue before it's modified. * This may get thrown away later. */ - result = get_lvalue_copy(instructions, (ir_rvalue *)op[0]->clone(NULL)); + result = get_lvalue_copy(instructions, op[0]->clone(NULL)); (void)do_assignment(instructions, state, - (ir_rvalue *)op[0]->clone(NULL), temp_rhs, + op[0]->clone(NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index c19bd417c3..500a8c7a00 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -94,6 +94,8 @@ protected: class ir_rvalue : public ir_instruction { public: + virtual ir_rvalue *clone(struct hash_table *) const = 0; + virtual ir_rvalue * as_rvalue() { return this; @@ -154,7 +156,7 @@ class ir_variable : public ir_instruction { public: ir_variable(const struct glsl_type *, const char *); - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_variable *clone(struct hash_table *ht) const; virtual ir_variable *as_variable() { @@ -258,7 +260,7 @@ class ir_function_signature : public ir_instruction { public: ir_function_signature(const glsl_type *return_type); - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_function_signature *clone(struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -324,7 +326,7 @@ class ir_function : public ir_instruction { public: ir_function(const char *name); - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_function *clone(struct hash_table *ht) const; virtual ir_function *as_function() { @@ -394,7 +396,7 @@ public: /* empty */ } - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_if *clone(struct hash_table *ht) const; virtual ir_if *as_if() { @@ -426,7 +428,7 @@ public: /* empty */ } - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_loop *clone(struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -467,7 +469,7 @@ class ir_assignment : public ir_rvalue { public: ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_assignment *clone(struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -601,7 +603,7 @@ public: ir_expression(int op, const struct glsl_type *type, ir_rvalue *, ir_rvalue *); - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_expression *clone(struct hash_table *ht) const; static unsigned int get_num_operands(ir_expression_operation); unsigned int get_num_operands() const @@ -644,7 +646,7 @@ public: actual_parameters->move_nodes_to(& this->actual_parameters); } - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_call *clone(struct hash_table *ht) const; virtual ir_call *as_call() { @@ -734,7 +736,7 @@ public: /* empty */ } - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_return *clone(struct hash_table *) const; virtual ir_return *as_return() { @@ -778,7 +780,7 @@ public: this->loop = loop; } - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_loop_jump *clone(struct hash_table *) const; virtual void accept(ir_visitor *v) { @@ -819,7 +821,7 @@ public: this->condition = cond; } - virtual ir_instruction *clone(struct hash_table *ht) const; + virtual ir_discard *clone(struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -871,7 +873,7 @@ public: /* empty */ } - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_texture *clone(struct hash_table *) const; virtual void accept(ir_visitor *v) { @@ -961,7 +963,7 @@ public: ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask); - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_swizzle *clone(struct hash_table *) const; virtual ir_swizzle *as_swizzle() { @@ -1005,6 +1007,8 @@ private: class ir_dereference : public ir_rvalue { public: + virtual ir_dereference *clone(struct hash_table *) const = 0; + virtual ir_dereference *as_dereference() { return this; @@ -1023,7 +1027,7 @@ class ir_dereference_variable : public ir_dereference { public: ir_dereference_variable(ir_variable *var); - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_dereference_variable *clone(struct hash_table *) const; virtual ir_dereference_variable *as_dereference_variable() { @@ -1069,7 +1073,7 @@ public: ir_dereference_array(ir_variable *var, ir_rvalue *array_index); - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_dereference_array *clone(struct hash_table *) const; virtual ir_dereference_array *as_dereference_array() { @@ -1105,7 +1109,7 @@ public: ir_dereference_record(ir_variable *var, const char *field); - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_dereference_record *clone(struct hash_table *) const; /** * Get the variable that is ultimately referenced by an r-value @@ -1163,7 +1167,7 @@ public: */ ir_constant(const ir_constant *c, unsigned i); - virtual ir_instruction *clone(struct hash_table *) const; + virtual ir_constant *clone(struct hash_table *) const; virtual ir_constant *as_constant() { diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 74cc858bda..cf21c24d73 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -35,7 +35,7 @@ extern "C" { * This will probably be made \c virtual and moved to the base class * eventually. */ -ir_instruction * +ir_variable * ir_variable::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -55,14 +55,14 @@ ir_variable::clone(struct hash_table *ht) const return var; } -ir_instruction * +ir_swizzle * ir_swizzle::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); return new(ctx) ir_swizzle((ir_rvalue *)this->val->clone(ht), this->mask); } -ir_instruction * +ir_return * ir_return::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -74,7 +74,7 @@ ir_return::clone(struct hash_table *ht) const return new(ctx) ir_return(new_value); } -ir_instruction * +ir_discard * ir_discard::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -86,7 +86,7 @@ ir_discard::clone(struct hash_table *ht) const return new(ctx) ir_discard(new_condition); } -ir_instruction * +ir_loop_jump * ir_loop_jump::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -95,7 +95,7 @@ ir_loop_jump::clone(struct hash_table *ht) const return new(ctx) ir_loop_jump(this->mode); } -ir_instruction * +ir_if * ir_if::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -114,7 +114,7 @@ ir_if::clone(struct hash_table *ht) const return new_if; } -ir_instruction * +ir_loop * ir_loop::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -136,7 +136,7 @@ ir_loop::clone(struct hash_table *ht) const return new_loop; } -ir_instruction * +ir_call * ir_call::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -150,7 +150,7 @@ ir_call::clone(struct hash_table *ht) const return new(ctx) ir_call(this->callee, &new_parameters); } -ir_instruction * +ir_expression * ir_expression::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -164,7 +164,7 @@ ir_expression::clone(struct hash_table *ht) const return new(ctx) ir_expression(this->operation, this->type, op[0], op[1]); } -ir_instruction * +ir_dereference_variable * ir_dereference_variable::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -181,7 +181,7 @@ ir_dereference_variable::clone(struct hash_table *ht) const return new(ctx) ir_dereference_variable(new_var); } -ir_instruction * +ir_dereference_array * ir_dereference_array::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -189,7 +189,7 @@ ir_dereference_array::clone(struct hash_table *ht) const (ir_rvalue *)this->array_index->clone(ht)); } -ir_instruction * +ir_dereference_record * ir_dereference_record::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -197,7 +197,7 @@ ir_dereference_record::clone(struct hash_table *ht) const this->field); } -ir_instruction * +ir_texture * ir_texture::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); @@ -236,7 +236,7 @@ ir_texture::clone(struct hash_table *ht) const return new_tex; } -ir_instruction * +ir_assignment * ir_assignment::clone(struct hash_table *ht) const { ir_rvalue *new_condition = NULL; @@ -250,7 +250,7 @@ ir_assignment::clone(struct hash_table *ht) const new_condition); } -ir_instruction * +ir_function * ir_function::clone(struct hash_table *ht) const { (void)ht; @@ -258,7 +258,7 @@ ir_function::clone(struct hash_table *ht) const abort(); } -ir_instruction * +ir_function_signature * ir_function_signature::clone(struct hash_table *ht) const { (void)ht; @@ -266,7 +266,7 @@ ir_function_signature::clone(struct hash_table *ht) const abort(); } -ir_instruction * +ir_constant * ir_constant::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 11c810bc48..541398a91c 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -626,7 +626,7 @@ ir_constant_visitor::visit(ir_dereference_variable *ir) ir_variable *var = ir->variable_referenced(); if (var && var->constant_value) - value = (ir_constant *)var->constant_value->clone(NULL); + value = var->constant_value->clone(NULL); } diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index b3d1f1d167..6fe1264b0a 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -137,7 +137,7 @@ ir_call::generate_inline(ir_instruction *next_ir) ir_rvalue *param = (ir_rvalue *) param_iter.get(); /* Generate a new variable for the parameter. */ - parameters[i] = (ir_variable *)sig_param->clone(ht); + parameters[i] = sig_param->clone(ht); parameters[i]->mode = ir_var_auto; next_ir->insert_before(parameters[i]); -- cgit v1.2.3 From a36334be02cb0a2b834667116bfeb680bf365857 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 6 Jul 2010 17:53:32 -0700 Subject: glsl2: Add pass for supporting variable vector indexing in rvalues. The Mesa IR needs this to support vector indexing correctly, and hardware backends such as 915 would want this behavior as well. Fixes glsl-vs-vec4-indexing-2. --- src/glsl/Makefile | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/ir_vec_index_to_cond_assign.cpp | 197 +++++++++++++++++++++++++++++++ src/glsl/main.cpp | 1 + src/mesa/shader/ir_to_mesa.cpp | 6 + 5 files changed, 206 insertions(+) create mode 100644 src/glsl/ir_vec_index_to_cond_assign.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 30ba475d92..d2a687aa33 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -47,6 +47,7 @@ CXX_SOURCES = \ ir_swizzle_swizzle.cpp \ ir_validate.cpp \ ir_variable.cpp \ + ir_vec_index_to_cond_assign.cpp \ ir_vec_index_to_swizzle.cpp \ linker.cpp \ s_expression.cpp diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 6d02e591c3..93010dadbe 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -42,4 +42,5 @@ bool do_function_inlining(exec_list *instructions); bool do_if_simplification(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); +bool do_vec_index_to_cond_assign(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions); diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp new file mode 100644 index 0000000000..6264a430e3 --- /dev/null +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -0,0 +1,197 @@ +/* + * 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 ir_vec_index_to_cond_assign.cpp + * + * Turns indexing into vector types to a series of conditional moves + * of each channel's swizzle into a temporary. + * + * Most GPUs don't have a native way to do this operation, and this + * works around that. For drivers using both this pass and + * ir_vec_index_to_swizzle, there's a risk that this pass will happen + * before sufficient constant folding to find that the array index is + * constant. However, we hope that other optimization passes, + * particularly constant folding of assignment conditions and copy + * propagation, will result in the same code in the end. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_vec_index_to_cond_assign_visitor : public ir_hierarchical_visitor { +public: + ir_vec_index_to_cond_assign_visitor() + { + progress = false; + } + + ir_rvalue *convert_vec_index_to_cond_assign(ir_rvalue *val); + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_if *); + + bool progress; +}; + +ir_rvalue * +ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue *ir) +{ + ir_dereference_array *orig_deref = ir->as_dereference_array(); + ir_assignment *assign; + ir_variable *index, *var; + ir_dereference *deref; + ir_expression *condition; + ir_swizzle *swizzle; + int i; + + if (!orig_deref) + return ir; + + if (orig_deref->array->type->is_matrix() || + orig_deref->array->type->is_array()) + return ir; + + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); + + /* Store the index to a temporary to avoid reusing its tree. */ + index = new(base_ir) ir_variable(glsl_type::int_type, + "vec_index_tmp_i"); + base_ir->insert_before(index); + deref = new(base_ir) ir_dereference_variable(index); + assign = new(base_ir) ir_assignment(deref, orig_deref->array_index, NULL); + base_ir->insert_before(assign); + + /* Temporary where we store whichever value we swizzle out. */ + var = new(base_ir) ir_variable(ir->type, "vec_index_tmp_v"); + base_ir->insert_before(var); + + /* Generate a conditional move of each vector element to the temp. */ + for (i = 0; i < orig_deref->array->type->vector_elements; i++) { + deref = new(base_ir) ir_dereference_variable(index); + condition = new(base_ir) ir_expression(ir_binop_equal, + glsl_type::bool_type, + deref, + new(base_ir) ir_constant(i)); + + /* Just clone the rest of the deref chain when trying to get at the + * underlying variable. + */ + deref = (ir_dereference *)orig_deref->array->clone(NULL); + swizzle = new(base_ir) ir_swizzle(deref, i, 0, 0, 0, 1); + + deref = new(base_ir) ir_dereference_variable(var); + assign = new(base_ir) ir_assignment(deref, swizzle, condition); + base_ir->insert_before(assign); + } + + this->progress = true; + return new(base_ir) ir_dereference_variable(var); +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_expression *ir) +{ + unsigned int i; + + for (i = 0; i < ir->get_num_operands(); i++) { + ir->operands[i] = convert_vec_index_to_cond_assign(ir->operands[i]); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_swizzle *ir) +{ + /* Can't be hit from normal GLSL, since you can't swizzle a scalar (which + * the result of indexing a vector is. But maybe at some point we'll end up + * using swizzling of scalars for vector construction. + */ + ir->val = convert_vec_index_to_cond_assign(ir->val); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_assignment *ir) +{ + /* FINISHME: Handle it on the LHS. */ + ir->rhs = convert_vec_index_to_cond_assign(ir->rhs); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = convert_vec_index_to_cond_assign(param); + + if (new_param != param) { + param->insert_before(new_param); + param->remove(); + } + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_return *ir) +{ + if (ir->value) { + ir->value = convert_vec_index_to_cond_assign(ir->value); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_if *ir) +{ + ir->condition = convert_vec_index_to_cond_assign(ir->condition); + + return visit_continue; +} + +bool +do_vec_index_to_cond_assign(exec_list *instructions) +{ + ir_vec_index_to_cond_assign_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 9bed2c6bcc..782934a8d7 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -175,6 +175,7 @@ compile_shader(struct gl_shader *shader) progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_vec_index_to_swizzle(shader->ir) || progress; + progress = do_vec_index_to_cond_assign(shader->ir) || progress; progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); } diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 021e270f18..daf09e9e65 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1821,7 +1821,13 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_dead_code_unlinked(state, shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; + progress = do_vec_index_to_swizzle(shader->ir) || progress; + /* Do this one after the previous to let the easier pass handle + * constant vector indexing. + */ + progress = do_vec_index_to_cond_assign(shader->ir) || progress; + progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); } -- cgit v1.2.3 From d4d630b72c7b7f38074addda0f1b819608247d93 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 6 Jul 2010 18:31:32 -0700 Subject: glsl2: Put the declaration in the instruction stream before its initializer. This fixes a regression in the generated code from when I did the ir_validate.cpp-driven rework of assignments. --- src/glsl/ast_to_hir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index f5e93b0254..3de754fa81 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1772,6 +1772,8 @@ ast_declarator_list::hir(exec_list *instructions, } } + instructions->push_tail(var); + if (decl->initializer != NULL) { YYLTYPE initializer_loc = decl->initializer->get_location(); @@ -1918,8 +1920,6 @@ ast_declarator_list::hir(exec_list *instructions, decl->identifier); } - instructions->push_tail(var); - /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 -- cgit v1.2.3 From 570dc0d4004bf09d257b3e4c8664d3c26a8af510 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 09:07:09 -0700 Subject: glsl2: Avoid null deref in scalar constant unop expressions. --- src/glsl/ir_constant_expression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 541398a91c..98cbb6cec6 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -151,7 +151,12 @@ ir_constant_visitor::visit(ir_expression *ir) */ unsigned c0_inc = op0_scalar ? 1 : 0; unsigned c1_inc = op1_scalar ? 1 : 0; - unsigned components = op[op1_scalar ? 0 : 1]->type->components(); + unsigned components; + if (op1_scalar || !op[1]) { + components = op[0]->type->components(); + } else { + components = op[1]->type->components(); + } switch (ir->operation) { case ir_unop_logic_not: -- cgit v1.2.3 From 773025b92c934014b9ceb4ebfdabcfc9d8587aa2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 08:38:16 -0700 Subject: glsl2: Don't forget to walk the parameters to a function in the hv. Fixes segfaults from use after free after the steal of ir nodes and free of the compile context. --- src/glsl/ir_hv_accept.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index e772018a45..1a88c59439 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -116,6 +116,10 @@ ir_function_signature::accept(ir_hierarchical_visitor *v) if (s != visit_continue) return (s == visit_continue_with_parent) ? visit_continue : s; + s = visit_list_elements(v, &this->parameters); + if (s == visit_stop) + return s; + s = visit_list_elements(v, &this->body); return (s == visit_stop) ? s : v->visit_leave(this); } -- cgit v1.2.3 From 6de882334ac7f3d32d04261adfed1397e075ffd5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 08:39:09 -0700 Subject: glsl2: Clean up vec_index_to_cond_assign after the clone return type change. --- src/glsl/ir_vec_index_to_cond_assign.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index 6264a430e3..3f527fcbe7 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -107,8 +107,8 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue /* Just clone the rest of the deref chain when trying to get at the * underlying variable. */ - deref = (ir_dereference *)orig_deref->array->clone(NULL); - swizzle = new(base_ir) ir_swizzle(deref, i, 0, 0, 0, 1); + swizzle = new(base_ir) ir_swizzle(orig_deref->array->clone(NULL), + i, 0, 0, 0, 1); deref = new(base_ir) ir_dereference_variable(var); assign = new(base_ir) ir_assignment(deref, swizzle, condition); -- cgit v1.2.3 From d674ebcee0d2731e50d6530502cefcebc39dcdb6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 6 Jul 2010 18:09:39 -0700 Subject: glsl2: Add a pass to simplify if statements returning from both sides. This allows function inlining making the following tests work even without function calls implemented: glsl-fs-functions-2 glsl-fs-functions-3 glsl-vs-functions glsl-vs-functions-2 glsl-vs-functions-3 glsl-vs-vec4-indexing-5 (Note that those tests were designed to trigger actual function calls, and this defeats them. However, those testcases ended up catching the bug in the previous commit.) --- src/glsl/Makefile | 1 + src/glsl/ir_if_return.cpp | 123 +++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/mesa/shader/ir_to_mesa.cpp | 1 + 4 files changed, 126 insertions(+) create mode 100644 src/glsl/ir_if_return.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index d2a687aa33..ddc9d82d61 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -40,6 +40,7 @@ CXX_SOURCES = \ ir_function_inlining.cpp \ ir_hierarchical_visitor.cpp \ ir_hv_accept.cpp \ + ir_if_return.cpp \ ir_if_simplification.cpp \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp new file mode 100644 index 0000000000..f68dcfb501 --- /dev/null +++ b/src/glsl/ir_if_return.cpp @@ -0,0 +1,123 @@ +/* + * 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 ir_if_return.cpp + * + * If a function includes an if statement that returns from both + * branches, then make the branches write the return val to a temp and + * return the temp after the if statement. + * + * This allows inlinining in the common case of short functions that + * return one of two values based on a condition. This helps on + * hardware with no branching support, and may even be a useful + * transform on hardware supporting control flow by masked returns + * with normal returns. + */ + +#include "ir.h" + +class ir_if_return_visitor : public ir_hierarchical_visitor { +public: + ir_if_return_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_enter(ir_if *); + + bool progress; +}; + +bool +do_if_return(exec_list *instructions) +{ + ir_if_return_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} + + +ir_visitor_status +ir_if_return_visitor::visit_enter(ir_if *ir) +{ + ir_return *then_return = NULL; + ir_return *else_return = NULL; + + /* Try to find a return statement on both sides. */ + foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + then_return = then_ir->as_return(); + if (then_return) + break; + } + if (!then_return) + return visit_continue; + + foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + else_return = else_ir->as_return(); + if (else_return) + break; + } + if (!else_return) + return visit_continue; + + /* Trim off any trailing instructions after the return statements + * on both sides. + */ + while (then_return->get_next()->get_next()) + ((ir_instruction *)then_return->get_next())->remove(); + while (else_return->get_next()->get_next()) + ((ir_instruction *)else_return->get_next())->remove(); + + this->progress = true; + + if (!then_return->value) { + then_return->remove(); + else_return->remove(); + ir->insert_after(new(ir) ir_return(NULL)); + } else { + ir_assignment *assign; + ir_variable *new_var = new(ir) ir_variable(then_return->value->type, + "if_return_tmp"); + ir->insert_before(new_var); + + assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), + then_return->value, NULL); + then_return->insert_before(assign); + then_return->remove(); + + assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), + else_return->value, NULL); + else_return->insert_before(assign); + else_return->remove(); + + ir_dereference_variable *deref = new(ir) ir_dereference_variable(new_var); + ir->insert_after(new(ir) ir_return(deref)); + } + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 93010dadbe..b03c0644cf 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -39,6 +39,7 @@ bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, exec_list *instructions); bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); +bool do_if_return(exec_list *instructions); bool do_if_simplification(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index daf09e9e65..2ffff60065 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1821,6 +1821,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_dead_code_unlinked(state, shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; + progress = do_if_return(shader->ir) || progress; progress = do_vec_index_to_swizzle(shader->ir) || progress; /* Do this one after the previous to let the easier pass handle -- cgit v1.2.3 From 2e85f993d8a014b53ad2f6d295cf66d3fb38b091 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 11:57:16 -0700 Subject: Revert "glsl2: Put the declaration in the instruction stream before its initializer." This change causes segfaults in other tests. A fix for both sets of segfaults is coming. This reverts commit d4d630b72c7b7f38074addda0f1b819608247d93. --- src/glsl/ast_to_hir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 3de754fa81..f5e93b0254 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1772,8 +1772,6 @@ ast_declarator_list::hir(exec_list *instructions, } } - instructions->push_tail(var); - if (decl->initializer != NULL) { YYLTYPE initializer_loc = decl->initializer->get_location(); @@ -1920,6 +1918,8 @@ ast_declarator_list::hir(exec_list *instructions, decl->identifier); } + instructions->push_tail(var); + /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 -- cgit v1.2.3 From c44556317abf77ca6e344c79d119c91bebe25c8c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 12:12:48 -0700 Subject: exec_list: Add method to append one complete list to another --- src/glsl/list.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/list.h b/src/glsl/list.h index d449bdd8b1..b5a413dc51 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -385,6 +385,30 @@ struct exec_list { } } + /** + * Append all nodes from the source list to the target list + */ + void + append_list(exec_list *source) + { + if (source->is_empty()) + return; + + /* Link the first node of the source with the last node of the target list. + */ + this->tail_pred->next = source->head; + source->head->prev = this->tail_pred; + + /* Make the tail of the source list be the tail of the target list. + */ + this->tail_pred = source->tail_pred; + this->tail_pred->next = (exec_node *) &this->tail; + + /* Make the source list empty for good measure. + */ + source->make_empty(); + } + exec_list_iterator iterator() { return exec_list_iterator(head); -- cgit v1.2.3 From e78e0fa42b49b50ed1150f7fdb74bf942ebd6bcf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 12:13:34 -0700 Subject: glsl2: Put the initializer in the instruction stream after the declaration --- src/glsl/ast_to_hir.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index f5e93b0254..b21131f60f 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1772,6 +1772,13 @@ ast_declarator_list::hir(exec_list *instructions, } } + /* Process the initializer and add its instructions to a temporary + * list. This list will be added to the instruction stream (below) after + * the declaration is added. This is done because in some cases (such as + * redeclarations) the declaration may not actually be added to the + * instruction stream. + */ + exec_list intializer_instructions; if (decl->initializer != NULL) { YYLTYPE initializer_loc = decl->initializer->get_location(); @@ -1801,7 +1808,8 @@ ast_declarator_list::hir(exec_list *instructions, } ir_dereference *const lhs = new(ctx) ir_dereference_variable(var); - ir_rvalue *rhs = decl->initializer->hir(instructions, state); + ir_rvalue *rhs = decl->initializer->hir(&intializer_instructions, + state); /* Calculate the constant value if this is a const or uniform * declaration. @@ -1829,7 +1837,7 @@ ast_declarator_list::hir(exec_list *instructions, /* Never emit code to initialize a uniform. */ if (!this->type->qualifier.uniform) - result = do_assignment(instructions, state, lhs, rhs, + result = do_assignment(&intializer_instructions, state, lhs, rhs, this->get_location()); var->read_only = temp; } @@ -1919,6 +1927,7 @@ ast_declarator_list::hir(exec_list *instructions, } instructions->push_tail(var); + instructions->append_list(&intializer_instructions); /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL -- cgit v1.2.3 From 388ab9fa6b468d8c162dd4fc645d2f758c49051c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 7 Jul 2010 11:40:51 -0700 Subject: glsl2: Initialize yylineno and yycolumn so line numbers are sane. --- src/glsl/glcpp/glcpp-lex.l | 1 + src/glsl/glsl_lexer.lpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 6a91b09954..53e85556c1 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -36,6 +36,7 @@ yylloc->first_line = yylineno; \ yycolumn += yyleng; \ } while(0); +#define YY_USER_INIT yylineno = 0; yycolumn = 0; %} %option bison-bridge bison-locations reentrant noyywrap diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index ddaa19db72..6c1000876e 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -34,6 +34,8 @@ yycolumn += yyleng; \ } while(0); +#define YY_USER_INIT yylineno = 0; yycolumn = 0; + %} %option bison-bridge bison-locations reentrant noyywrap -- cgit v1.2.3 From acf88f2769c15c9185abe5bd76a885218f431e58 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 7 Jul 2010 12:08:23 -0700 Subject: ir_constant_expression: Fix loop increments. --- src/glsl/ir_constant_expression.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 98cbb6cec6..0fe93adcea 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -149,8 +149,8 @@ ir_constant_visitor::visit(ir_expression *ir) /* When iterating over a vector or matrix's components, we want to increase * the loop counter. However, for scalars, we want to stay at 0. */ - unsigned c0_inc = op0_scalar ? 1 : 0; - unsigned c1_inc = op1_scalar ? 1 : 0; + unsigned c0_inc = op0_scalar ? 0 : 1; + unsigned c1_inc = op1_scalar ? 0 : 1; unsigned components; if (op1_scalar || !op[1]) { components = op[0]->type->components(); -- cgit v1.2.3 From 43b5b03d67ce890e867c81d4a5cfc4871d711d43 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 14:04:30 -0700 Subject: glsl2: Actually add the declaration of _post_incdec_temp. --- src/glsl/ast_to_hir.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b21131f60f..e716b8a11e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -571,6 +571,7 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) /* FINISHME: Give unique names to the temporaries. */ var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp"); + instructions->push_tail(var); var->mode = ir_var_auto; instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), -- cgit v1.2.3 From 9cbd8a1d5a85f39f12e9edbd2defbb9e9d0468ef Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 12:25:22 -0700 Subject: glsl2: Fix ir_div_to_mul_rcp for integer division. rcp of an integer value did not produce the result you're looking for. Instead, do the a * rcp(b) as float and truncate after. This mostly fixes glsl-fs-loop-nested. --- src/glsl/ir_div_to_mul_rcp.cpp | 56 +++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_div_to_mul_rcp.cpp b/src/glsl/ir_div_to_mul_rcp.cpp index ce84add221..640d5d64f9 100644 --- a/src/glsl/ir_div_to_mul_rcp.cpp +++ b/src/glsl/ir_div_to_mul_rcp.cpp @@ -33,6 +33,7 @@ */ #include "ir.h" +#include "glsl_types.h" class ir_div_to_mul_rcp_visitor : public ir_hierarchical_visitor { public: @@ -61,16 +62,53 @@ ir_div_to_mul_rcp_visitor::visit_leave(ir_expression *ir) if (ir->operation != ir_binop_div) return visit_continue; - /* New expression for the 1.0 / op1 */ - ir_rvalue *expr; - expr = new(ir) ir_expression(ir_unop_rcp, - ir->operands[1]->type, - ir->operands[1], - NULL); + if (ir->operands[1]->type->base_type != GLSL_TYPE_INT && + ir->operands[1]->type->base_type != GLSL_TYPE_UINT) { + /* New expression for the 1.0 / op1 */ + ir_rvalue *expr; + expr = new(ir) ir_expression(ir_unop_rcp, + ir->operands[1]->type, + ir->operands[1], + NULL); + + /* op0 / op1 -> op0 * (1.0 / op1) */ + ir->operation = ir_binop_mul; + ir->operands[1] = expr; + } else { + /* Be careful with integer division -- we need to do it as a + * float and re-truncate, since rcp(n > 1) of an integer would + * just be 0. + */ + ir_rvalue *op0, *op1; + const struct glsl_type *vec_type; + + vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, + ir->operands[1]->type->vector_elements, + ir->operands[1]->type->matrix_columns); + + if (ir->operands[1]->type->base_type == GLSL_TYPE_INT) + op1 = new(ir) ir_expression(ir_unop_i2f, vec_type, ir->operands[1], NULL); + else + op1 = new(ir) ir_expression(ir_unop_u2f, vec_type, ir->operands[1], NULL); + + op1 = new(ir) ir_expression(ir_unop_rcp, op1->type, op1, NULL); + + vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, + ir->operands[0]->type->vector_elements, + ir->operands[0]->type->matrix_columns); + + if (ir->operands[0]->type->base_type == GLSL_TYPE_INT) + op0 = new(ir) ir_expression(ir_unop_i2f, vec_type, ir->operands[0], NULL); + else + op0 = new(ir) ir_expression(ir_unop_u2f, vec_type, ir->operands[0], NULL); + + op0 = new(ir) ir_expression(ir_binop_mul, vec_type, op0, op1); + + ir->operation = ir_unop_f2i; + ir->operands[0] = op0; + ir->operands[1] = NULL; + } - /* op0 / op1 -> op0 * (1.0 / op1) */ - ir->operation = ir_binop_mul; - ir->operands[1] = expr; this->made_progress = true; return visit_continue; -- cgit v1.2.3 From 0b74bbb3dcf07489e1dbd1976f07093ad7821e51 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 14:53:43 -0700 Subject: glsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0. caught by valgrind. --- src/glsl/builtin_function.cpp | 4 ++-- src/glsl/builtins/110/refract | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 40c85e7c98..5b3b49d310 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1808,7 +1808,7 @@ static const char *builtins_110_refract = { " (expression float dot (var_ref n) (var_ref i))\n" " (expression float dot (var_ref n) (var_ref i))))))))\n" " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec3 (0.0 0.0))))\n" + " ((return (constant vec3 (0.0 0.0 0.0))))\n" " ((return (expression vec3 -\n" " (expression vec3 * (var_ref eta) (var_ref i))\n" " (expression vec3 *\n" @@ -1833,7 +1833,7 @@ static const char *builtins_110_refract = { " (expression float dot (var_ref n) (var_ref i))\n" " (expression float dot (var_ref n) (var_ref i))))))))\n" " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec4 (0.0 0.0))))\n" + " ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n" " ((return (expression vec4 -\n" " (expression vec4 * (var_ref eta) (var_ref i))\n" " (expression vec4 *\n" diff --git a/src/glsl/builtins/110/refract b/src/glsl/builtins/110/refract index e9b1475294..522ab41173 100644 --- a/src/glsl/builtins/110/refract +++ b/src/glsl/builtins/110/refract @@ -64,7 +64,7 @@ (expression float dot (var_ref n) (var_ref i)) (expression float dot (var_ref n) (var_ref i)))))))) (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec3 (0.0 0.0)))) + ((return (constant vec3 (0.0 0.0 0.0)))) ((return (expression vec3 - (expression vec3 * (var_ref eta) (var_ref i)) (expression vec3 * @@ -89,7 +89,7 @@ (expression float dot (var_ref n) (var_ref i)) (expression float dot (var_ref n) (var_ref i)))))))) (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec4 (0.0 0.0)))) + ((return (constant vec4 (0.0 0.0 0.0 0.0)))) ((return (expression vec4 - (expression vec4 * (var_ref eta) (var_ref i)) (expression vec4 * -- cgit v1.2.3 From 35c89204e597e6d4d3e8b8c665ce1c51d6dde4d7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 16:28:39 -0700 Subject: linker: Use bit-0 instead of VERT_BIT_GENERIC0 Uses of the bits for allocation are offset by 16, and VERT_BIT_GENERIC0 already has the 16 offset. As a result, it was preventing the wrong thing from being allocated. --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 5227d42e35..eb10f90a91 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -667,7 +667,7 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index * be explicitly assigned by via glBindAttribLocation. Mark it as reserved * to prevent it from being automatically allocated below. */ - used_locations |= VERT_BIT_GENERIC0; + used_locations |= (1 << 0); for (unsigned i = 0; i < num_attr; i++) { /* Mask representing the contiguous slots that will be used by this -- cgit v1.2.3 From e024c5c6900c068634c2726d9ccfb9beac966c57 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 7 Jul 2010 15:23:27 -0700 Subject: ir_reader: Don't emit ir_function multiple times. --- src/glsl/ir_reader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 80dbc08645..03212830cd 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -192,6 +192,7 @@ static ir_function * read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) { void *ctx = st; + bool added = false; if (list->length() < 3) { ir_read_error(st, list, "Expected (function (signature ...) ...)"); return NULL; @@ -206,7 +207,7 @@ read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) ir_function *f = st->symbols->get_function(name->value()); if (f == NULL) { f = new(ctx) ir_function(name->value()); - bool added = st->symbols->add_function(f->name, f); + added = st->symbols->add_function(f->name, f); assert(added); } @@ -228,7 +229,7 @@ read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) read_function_sig(st, f, siglist, skip_body); } - return f; + return added ? f : NULL; } static void @@ -321,11 +322,8 @@ read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions, foreach_iter(exec_list_iterator, it, list->subexpressions) { s_expression *sub = (s_expression*) it.get(); ir_instruction *ir = read_instruction(st, sub, loop_ctx); - if (ir == NULL) { - ir_read_error(st, sub, "Invalid instruction.\n"); - return; - } - instructions->push_tail(ir); + if (ir != NULL) + instructions->push_tail(ir); } } @@ -344,8 +342,10 @@ read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, } s_list *list = SX_AS_LIST(expr); - if (list == NULL || list->subexpressions.is_empty()) + if (list == NULL || list->subexpressions.is_empty()) { + ir_read_error(st, expr, "Invalid instruction.\n"); return NULL; + } s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head()); if (tag == NULL) { -- cgit v1.2.3 From 152b55e74da7bf548d8846538b85960f703d6059 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 19:45:22 -0700 Subject: glsl2: Add support for gl_PointCoord in 1.20. Fixes glsl-fs-pointcoord on swrast (remains broken on 965, like master) --- src/glsl/builtin_variables.h | 4 ++++ src/glsl/ir_variable.cpp | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h index 77f2fe5502..9551e1accf 100644 --- a/src/glsl/builtin_variables.h +++ b/src/glsl/builtin_variables.h @@ -70,6 +70,10 @@ static const builtin_variable builtin_110_deprecated_vs_variables[] = { { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, }; +static const builtin_variable builtin_120_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + static const builtin_variable builtin_130_vs_variables[] = { { ir_var_in, -1, "int", "gl_VertexID" }, }; diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 9daad803e9..a0b66b7770 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -311,6 +311,13 @@ generate_120_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { generate_110_fs_variables(instructions, state); + + for (unsigned i = 0 + ; i < Elements(builtin_120_fs_variables) + ; i++) { + add_builtin_variable(& builtin_120_fs_variables[i], + instructions, state->symbols); + } } static void -- cgit v1.2.3 From dfd30ca6a95a7d95835dad78ffe1fba4d1f4ef69 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 12:40:52 -0700 Subject: glsl2: Remove generate_temporary and global temporary counter. Most places in the code simply use a static name, which works because names are never used to look up an ir_variable. generate_temporary is simply unnecessary (and looks like it would leak memory, and isn't thread safe...) --- src/glsl/ast_to_hir.cpp | 32 +++++--------------------------- src/glsl/glsl_parser_extras.h | 3 --- src/glsl/main.cpp | 1 - src/mesa/shader/ir_to_mesa.cpp | 1 - 4 files changed, 5 insertions(+), 32 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index e716b8a11e..e03bb6394f 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -542,27 +542,6 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, return new(ctx) ir_dereference_variable(var); } - -/** - * Generate a new temporary and add its declaration to the instruction stream - */ -static ir_variable * -generate_temporary(const glsl_type *type, exec_list *instructions, - struct _mesa_glsl_parse_state *state) -{ - void *ctx = state; - char *name = (char *) malloc(sizeof(char) * 13); - - snprintf(name, 13, "tmp_%08X", state->temp_index); - state->temp_index++; - - ir_variable *const var = new(ctx) ir_variable(type, name); - instructions->push_tail(var); - - return var; -} - - static ir_rvalue * get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) { @@ -840,8 +819,8 @@ ast_expression::hir(exec_list *instructions, error_emitted = true; } - ir_variable *const tmp = generate_temporary(glsl_type::bool_type, - instructions, state); + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "and_tmp"); ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp); ir_assignment *const then_assign = @@ -892,8 +871,8 @@ ast_expression::hir(exec_list *instructions, ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); - ir_variable *const tmp = generate_temporary(glsl_type::bool_type, - instructions, state); + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "or_tmp"); op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); @@ -1068,8 +1047,7 @@ ast_expression::hir(exec_list *instructions, && (cond_val != NULL) && (then_val != NULL) && (else_val != NULL)) { result = (cond_val->value.b[0]) ? then_val : else_val; } else { - ir_variable *const tmp = generate_temporary(type, - instructions, state); + ir_variable *const tmp = new(ctx) ir_variable(type, "conditional_tmp"); ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 16f7268181..4b28ae118d 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -67,9 +67,6 @@ struct _mesa_glsl_parse_state { /** Was there an error during compilation? */ bool error; - /** Index of last generated anonymous temporary. */ - unsigned temp_index; - /** Loop or switch statement containing the current instructions. */ class ir_instruction *loop_or_switch_nesting; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 782934a8d7..dd43d12474 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -124,7 +124,6 @@ compile_shader(struct gl_shader *shader) state->symbols = new(shader) glsl_symbol_table; state->info_log = talloc_strdup(shader, ""); state->error = false; - state->temp_index = 0; state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 4496daf2a5..708c6fece1 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1938,7 +1938,6 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->symbols = new(shader) glsl_symbol_table; state->info_log = talloc_strdup(shader, ""); state->error = false; - state->temp_index = 0; state->loop_or_switch_nesting = NULL; state->ARB_texture_rectangle_enable = true; -- cgit v1.2.3 From f3290e950cd78a423d380b7e0a7aa18eb7718e27 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 13:06:22 -0700 Subject: glsl2: Add foreach_list_safe which works even when mutating the list. In particular, with foreach_list_safe, one can remove and free the current node without crashes; if new nodes are added after the current node, they will be properly visited as well. Signed-off-by: Ian Romanick --- src/glsl/list.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/list.h b/src/glsl/list.h index b5a413dc51..48502fb4c8 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -421,6 +421,20 @@ struct exec_list { #endif }; +/** + * This version is safe even if the current node is removed. If you insert + * new nodes before the current node, they will be processed next. + * + * \note + * The extra test for \c __node being \c NULL is required because after the + * iteration \c __prev coupld be the last node in the list. The loop increment + * then causes \c __prev to point to the sentinal and \c __node to be \c NULL. + */ +#define foreach_list_safe(__node, __list) \ + for (exec_node * __prev = (exec_node *) (__list), * __node = (__list)->head \ + ; __node != NULL && (__node)->next != NULL \ + ; __prev = (__prev)->next, __node = (__prev)->next) + #define foreach_list(__node, __list) \ for (exec_node * __node = (__list)->head \ ; (__node)->next != NULL \ -- cgit v1.2.3 From a4dde28ee6893ab99c6ca93699392bb8bc2d981c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 13:08:14 -0700 Subject: glsl2: Use new foreach_list_safe abstraction. --- src/glsl/ir_hv_accept.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index 1a88c59439..46bc5b17fe 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -32,20 +32,16 @@ /** * Process a list of nodes using a hierarchical vistor * - * \warning * This function will operate correctly if a node being processed is removed - * from list. However, if nodes are added to the list after the node being - * processed, some of the added noded may not be processed. + * from the list. If nodes are inserted before the current node, they will be + * processed next. */ ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l) { - exec_node *next; ir_instruction *prev_base_ir = v->base_ir; - for (exec_node *n = l->head; n->next != NULL; n = next) { - next = n->next; - + foreach_list_safe(n, l) { ir_instruction *const ir = (ir_instruction *) n; v->base_ir = ir; ir_visitor_status s = ir->accept(v); -- cgit v1.2.3 From 59df3385e1c413332c75be5d0e7751972d45430e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 17:59:56 -0700 Subject: ast_function: Remove unnecessary check for empty constructors. This case is already caught by a later check that ensures sufficient components were provided, based on the type. --- src/glsl/ast_function.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index b681115387..c6cc3eb43c 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -923,15 +923,6 @@ ast_function_expression::hir(exec_list *instructions, bool all_parameters_are_constant = true; - /* This handles invalid constructor calls such as 'vec4 v = vec4();' - */ - if (this->expressions.is_empty()) { - _mesa_glsl_error(& loc, state, "too few components to construct " - "`%s'", - constructor_type->name); - return ir_call::get_error_instruction(ctx); - } - foreach_list (n, &this->expressions) { ast_node *ast = exec_node_data(ast_node, n, link); ir_rvalue *result = -- cgit v1.2.3 From f58bbd134e921b14f50ecd1e76b2943753ba194c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 18:03:28 -0700 Subject: ast_function: Move error return earlier and don't indent the world. This has no functional changes. --- src/glsl/ast_function.cpp | 281 +++++++++++++++++++++++----------------------- 1 file changed, 139 insertions(+), 142 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index c6cc3eb43c..566eac4d33 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -865,7 +865,7 @@ ast_function_expression::hir(exec_list *instructions, void *ctx = state; /* There are three sorts of function calls. * - * 1. contstructors - The first subexpression is an ast_type_specifier. + * 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. * @@ -907,167 +907,164 @@ ast_function_expression::hir(exec_list *instructions, * correct order. These constructors follow essentially the same type * matching rules as functions. */ - if (constructor_type->is_numeric() || constructor_type->is_boolean()) { - /* Total number of components of the type being constructed. - */ - const unsigned type_components = constructor_type->components(); + if (!constructor_type->is_numeric() && !constructor_type->is_boolean()) + return ir_call::get_error_instruction(ctx); - /* 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; - - bool all_parameters_are_constant = true; - - 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); - } + /* Total number of components of the type being constructed. */ + const unsigned type_components = constructor_type->components(); - 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); - } + /* Number of components from parameters that have actually been + * consumed. This is used to perform several kinds of error checking. + */ + unsigned components_used = 0; - /* 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++; - - /* Type cast the parameter and add it to the parameter list for - * the constructor. - */ - const glsl_type *desired_type = - glsl_type::get_instance(constructor_type->base_type, - result->type->vector_elements, - result->type->matrix_columns); - result = convert_component(result, 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; - - actual_parameters.push_tail(result); - components_used += result->type->components(); - } + unsigned matrix_parameters = 0; + unsigned nonmatrix_parameters = 0; + exec_list actual_parameters; - /* 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); - } + bool all_parameters_are_constant = true; + + 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: * - * "If a matrix argument is given to a matrix constructor, it is - * an error to have any other arguments." + * "It is an error to provide extra arguments beyond this + * last used argument." */ - 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", + 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); } - /* 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)) { - _mesa_glsl_error(& loc, state, "too few components to construct " - "`%s'", + 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++; - /* If all of the parameters are trivially constant, create a - * constant representing the complete collection of parameters. + /* Type cast the parameter and add it to the parameter list for + * the constructor. */ - if (all_parameters_are_constant) { - if (components_used >= type_components) - return new(ctx) ir_constant(constructor_type, - & actual_parameters); - - /* The above case must handle all scalar constructors. - */ - assert(constructor_type->is_vector() - || constructor_type->is_matrix()); - - /* Constructors with exactly one component are special for - * vectors and matrices. For vectors it causes all elements of - * the vector to be filled with the value. For matrices it - * causes the matrix to be filled with 0 and the diagonal to be - * filled with the value. - */ - ir_constant_data data; - ir_constant *const initializer = - (ir_constant *) actual_parameters.head; - if (constructor_type->is_matrix()) - generate_constructor_matrix(constructor_type, initializer, - &data); - else - generate_constructor_vector(constructor_type, initializer, - &data); - - return new(ctx) ir_constant(constructor_type, &data); - } 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); - } + const glsl_type *desired_type = + glsl_type::get_instance(constructor_type->base_type, + result->type->vector_elements, + result->type->matrix_columns); + result = convert_component(result, 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; + + actual_parameters.push_tail(result); + components_used += result->type->components(); } - return ir_call::get_error_instruction(ctx); + /* 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)) { + _mesa_glsl_error(& loc, state, "too few components to construct " + "`%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + + /* If all of the parameters are trivially constant, create a + * constant representing the complete collection of parameters. + */ + if (all_parameters_are_constant) { + if (components_used >= type_components) + return new(ctx) ir_constant(constructor_type, + & actual_parameters); + + /* The above case must handle all scalar constructors. + */ + assert(constructor_type->is_vector() + || constructor_type->is_matrix()); + + /* Constructors with exactly one component are special for + * vectors and matrices. For vectors it causes all elements of + * the vector to be filled with the value. For matrices it + * causes the matrix to be filled with 0 and the diagonal to be + * filled with the value. + */ + ir_constant_data data; + ir_constant *const initializer = + (ir_constant *) actual_parameters.head; + if (constructor_type->is_matrix()) + generate_constructor_matrix(constructor_type, initializer, + &data); + else + generate_constructor_vector(constructor_type, initializer, + &data); + + return new(ctx) ir_constant(constructor_type, &data); + } 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(); -- cgit v1.2.3 From 284d821206d74fddb346cd0d892d2dcec463e2a5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 18:15:32 -0700 Subject: ast_function: Fix non-float constructors with matrix arguments. Previously, code like ivec4(mat2(...)) would fail because the compiler would naively try to convert a mat2 to an imat2...which doesn't exist. Now, a separate pass breaks such matrices down to their columns, which can be converted from vec2 to ivec2. Fixes piglit tests constructor-11.vert, constructor-14.vert, constructor-15.vert, and CorrectConstFolding2.frag. --- src/glsl/ast_function.cpp | 77 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 22 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 566eac4d33..9315a92ecb 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -922,8 +922,6 @@ ast_function_expression::hir(exec_list *instructions, unsigned nonmatrix_parameters = 0; exec_list actual_parameters; - bool all_parameters_are_constant = true; - foreach_list (n, &this->expressions) { ast_node *ast = exec_node_data(ast_node, n, link); ir_rvalue *result = ast->hir(instructions, state)->as_rvalue(); @@ -955,26 +953,6 @@ ast_function_expression::hir(exec_list *instructions, else nonmatrix_parameters++; - /* Type cast the parameter and add it to the parameter list for - * the constructor. - */ - const glsl_type *desired_type = - glsl_type::get_instance(constructor_type->base_type, - result->type->vector_elements, - result->type->matrix_columns); - result = convert_component(result, 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; - actual_parameters.push_tail(result); components_used += result->type->components(); } @@ -1019,6 +997,61 @@ ast_function_expression::hir(exec_list *instructions, 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"); + 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->insert_before(result); + ir->remove(); + } + } /* If all of the parameters are trivially constant, create a * constant representing the complete collection of parameters. -- cgit v1.2.3 From d2afc874452a84965ee71c96f80e1d124c211ff4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 10:13:20 -0700 Subject: glsl2: Check when inlining a bare function call that it actually is. It would be easy to miss an entry either of the two visitors involved that would result in trying to ir->remove() the call to remove it from the instruction stream when really it's part of an expression tree that wasn't flattened. --- src/glsl/ir_function_inlining.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 6fe1264b0a..8c545aaa6b 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -233,6 +233,12 @@ ir_visitor_status ir_function_inlining_visitor::visit_enter(ir_call *ir) { if (can_inline(ir)) { + /* If the call was part of some tree, then it should have been + * flattened out or we shouldn't have seen it because of a + * visit_continue_with_parent in this visitor. + */ + assert(ir == base_ir); + (void) ir->generate_inline(ir); ir->remove(); this->progress = true; -- cgit v1.2.3 From 5723e5bb8b73cd2a3b77d750972e3d0b4d0d0ff8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 10:48:22 -0700 Subject: glsl2: Flatten out expressions that are the child of an assignment rhs. This feels a little odd, but it will be useful for ir_mat_to_vec, where I want to see a plain assignment of the expression to a variable, not to a writemasked array dereference with a call as the array index. --- src/glsl/ir_expression_flattening.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 5ba24e390b..0f10b67193 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -57,9 +57,11 @@ public: virtual ir_visitor_status visit_enter(ir_function_signature *); virtual ir_visitor_status visit_enter(ir_if *); virtual ir_visitor_status visit_enter(ir_loop *); + virtual ir_visitor_status visit_leave(ir_assignment *); virtual ir_visitor_status visit_leave(ir_expression *); virtual ir_visitor_status visit_leave(ir_swizzle *); + ir_rvalue *operand_to_temp(ir_rvalue *val); bool (*predicate)(ir_instruction *ir); ir_instruction *base_ir; }; @@ -77,13 +79,16 @@ do_expression_flattening(exec_list *instructions, } -static ir_rvalue * -operand_to_temp(ir_instruction *base_ir, ir_rvalue *ir) +ir_rvalue * +ir_expression_flattening_visitor::operand_to_temp(ir_rvalue *ir) { void *ctx = talloc_parent(base_ir); ir_variable *var; ir_assignment *assign; + if (!this->predicate(ir)) + return ir; + var = new(ctx) ir_variable(ir->type, "flattening_tmp"); base_ir->insert_before(var); @@ -131,20 +136,27 @@ ir_expression_flattening_visitor::visit_leave(ir_expression *ir) /* If the operand matches the predicate, then we'll assign its * value to a temporary and deref the temporary as the operand. */ - if (this->predicate(ir->operands[operand])) { - ir->operands[operand] = operand_to_temp(base_ir, - ir->operands[operand]); - } + ir->operands[operand] = operand_to_temp(ir->operands[operand]); } return visit_continue; } +ir_visitor_status +ir_expression_flattening_visitor::visit_leave(ir_assignment *ir) +{ + ir->rhs = operand_to_temp(ir->rhs); + if (ir->condition) + ir->condition = operand_to_temp(ir->condition); + + return visit_continue; +} + ir_visitor_status ir_expression_flattening_visitor::visit_leave(ir_swizzle *ir) { if (this->predicate(ir->val)) { - ir->val = operand_to_temp(this->base_ir, ir->val); + ir->val = operand_to_temp(ir->val); } return visit_continue; -- cgit v1.2.3 From 6d8a0a0aadaafbab02dffcf7f89eb0210dd37b2e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 11:04:07 -0700 Subject: glsl2: Add a new pass at the IR level to break down matrix ops to vector ops. This will be used by the Mesa IR and likely most HW backends, as it allows other optimizations to occur that might not otherwise. Fixes glsl-vs-mat-sub-1, glsl-vs-mat-div-1. --- src/glsl/Makefile | 1 + src/glsl/ir.h | 6 ++ src/glsl/ir_mat_op_to_vec.cpp | 188 +++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/mesa/shader/ir_to_mesa.cpp | 1 + 5 files changed, 197 insertions(+) create mode 100644 src/glsl/ir_mat_op_to_vec.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index ddc9d82d61..a36ff28a4b 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -42,6 +42,7 @@ CXX_SOURCES = \ ir_hv_accept.cpp \ ir_if_return.cpp \ ir_if_simplification.cpp \ + ir_mat_op_to_vec.cpp \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 500a8c7a00..0d5bbc20aa 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -74,6 +74,7 @@ public: virtual class ir_dereference * as_dereference() { return NULL; } virtual class ir_dereference_array * as_dereference_array() { return NULL; } virtual class ir_dereference_variable *as_dereference_variable() { return NULL; } + virtual class ir_expression * as_expression() { return NULL; } virtual class ir_rvalue * as_rvalue() { return NULL; } virtual class ir_loop * as_loop() { return NULL; } virtual class ir_assignment * as_assignment() { return NULL; } @@ -603,6 +604,11 @@ public: ir_expression(int op, const struct glsl_type *type, ir_rvalue *, ir_rvalue *); + virtual ir_expression *as_expression() + { + return this; + } + virtual ir_expression *clone(struct hash_table *ht) const; static unsigned int get_num_operands(ir_expression_operation); diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp new file mode 100644 index 0000000000..828c63c17a --- /dev/null +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -0,0 +1,188 @@ +/* + * 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 ir_mat_op_to_vec.cpp + * + * Breaks matrix operation expressions down to a series of vector operations. + * + * Generally this is how we have to codegen matrix operations for a + * GPU, so this gives us the chance to constant fold operations on a + * column or row. + */ + +#include "ir.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor { +public: + ir_mat_op_to_vec_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_assignment *); + + ir_rvalue *get_column(ir_variable *var, int i); + + bool made_progress; +}; + +static bool +mat_op_to_vec_predicate(ir_instruction *ir) +{ + ir_expression *expr = ir->as_expression(); + unsigned int i; + + if (!expr) + return false; + + for (i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_matrix()) + return true; + } + + return false; +} + +bool +do_mat_op_to_vec(exec_list *instructions) +{ + ir_mat_op_to_vec_visitor v; + + /* Pull out any matrix expression to a separate assignment to a + * temp. This will make our handling of the breakdown to + * operations on the matrix's vector components much easier. + */ + do_expression_flattening(instructions, mat_op_to_vec_predicate); + + visit_list_elements(&v, instructions); + + return v.made_progress; +} + +ir_rvalue * +ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int i) +{ + ir_dereference *deref; + + if (!var->type->is_matrix()) { + deref = new(base_ir) ir_dereference_variable(var); + } else { + deref = new(base_ir) ir_dereference_variable(var); + deref = new(base_ir) ir_dereference_array(deref, + new(base_ir) ir_constant(i)); + } + + return deref; +} + +ir_visitor_status +ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) +{ + ir_expression *expr = assign->rhs->as_expression(); + bool found_matrix = false; + unsigned int i, matrix_columns = 1; + ir_variable *op_var[2]; + + if (!expr) + return visit_continue; + + for (i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_matrix()) { + found_matrix = true; + matrix_columns = expr->operands[i]->type->matrix_columns; + break; + } + } + if (!found_matrix) + return visit_continue; + + /* FINISHME: see below */ + if (expr->operation == ir_binop_mul) + return visit_continue; + + ir_dereference_variable *lhs_deref = assign->lhs->as_dereference_variable(); + assert(lhs_deref); + + ir_variable *result_var = lhs_deref->var; + + /* Store the expression operands in temps so we can use them + * multiple times. + */ + for (i = 0; i < expr->get_num_operands(); i++) { + ir_assignment *assign; + + op_var[i] = new(base_ir) ir_variable(expr->operands[i]->type, + "mat_op_to_vec"); + base_ir->insert_before(op_var[i]); + + lhs_deref = new(base_ir) ir_dereference_variable(op_var[i]); + assign = new(base_ir) ir_assignment(lhs_deref, + expr->operands[i], + NULL); + base_ir->insert_before(assign); + } + + /* OK, time to break down this matrix operation. */ + switch (expr->operation) { + case ir_binop_add: + case ir_binop_sub: + case ir_binop_div: + case ir_binop_mod: + /* For most operations, the matrix version is just going + * column-wise through and applying the operation to each column + * if available. + */ + for (i = 0; i < matrix_columns; i++) { + ir_rvalue *op0 = get_column(op_var[0], i); + ir_rvalue *op1 = get_column(op_var[1], i); + ir_rvalue *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(base_ir) ir_expression(expr->operation, + result->type, + op0, + op1); + + column_assign = new(base_ir) ir_assignment(result, + column_expr, + NULL); + base_ir->insert_before(column_assign); + } + break; + case ir_binop_mul: + /* FINISHME */ + return visit_continue; + break; + default: + printf("FINISHME: Handle matrix operation for %s\n", expr->operator_string()); + abort(); + } + assign->remove(); + this->made_progress = true; + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index b03c0644cf..fae583df75 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -41,6 +41,7 @@ bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_return(exec_list *instructions); bool do_if_simplification(exec_list *instructions); +bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 708c6fece1..81b91918cb 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1960,6 +1960,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) _mesa_ast_to_hir(shader->ir, state); /* Lowering */ + do_mat_op_to_vec(shader->ir); do_mod_to_fract(shader->ir); do_div_to_mul_rcp(shader->ir); -- cgit v1.2.3 From 288733f6001a2148d6689587d9a05e6909e88a61 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 14:02:59 -0700 Subject: glsl2: Store the gl_type of the array's element type in the array. Fixes glsl-fs-uniform-array-1, glsl-vs-uniform-array-1, and the -2 tests on software. --- src/glsl/glsl_types.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 806b71495d..d6799cf428 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -285,6 +285,11 @@ glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) : name(NULL), length(length) { this->fields.array = array; + /* Inherit the gl type of the base. The GL type is used for + * uniform/statevar handling in Mesa and the arrayness of the type + * is represented by the size rather than the type. + */ + this->gl_type = array->gl_type; /* Allow a maximum of 10 characters for the array size. This is enough * for 32-bits of ~0. The extra 3 are for the '[', ']', and terminating -- cgit v1.2.3 From 0b9ae3befb0bf80e000b159fd44c961a144f9c36 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 14:22:05 -0700 Subject: glsl2: Add declarations for temporaries to instruction stream Temporary variables added for &&, ||, and ?: were not being added to the instruction stream. This resulted in either test failures or Valgrind being angry after the original IR tree was destroyed by talloc_free. The talloc_free caused the ir_variables to be destroyed even though they were still referenced. --- src/glsl/ast_to_hir.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index e03bb6394f..a9ab17f421 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -821,6 +821,7 @@ ast_expression::hir(exec_list *instructions, ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, "and_tmp"); + instructions->push_tail(tmp); ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp); ir_assignment *const then_assign = @@ -873,6 +874,7 @@ ast_expression::hir(exec_list *instructions, ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, "or_tmp"); + instructions->push_tail(tmp); op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); @@ -1048,6 +1050,7 @@ ast_expression::hir(exec_list *instructions, result = (cond_val->value.b[0]) ? then_val : else_val; } else { ir_variable *const tmp = new(ctx) ir_variable(type, "conditional_tmp"); + instructions->push_tail(tmp); ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); -- cgit v1.2.3 From 10d222b70266a1b6e8dde90652156c6e18bcd3c8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 16:11:10 -0700 Subject: glsl2: Add missing fields in ir_variable::clone --- src/glsl/ir_clone.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index cf21c24d73..f1d2851793 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -45,8 +45,16 @@ ir_variable::clone(struct hash_table *ht) const var->read_only = this->read_only; var->centroid = this->centroid; var->invariant = this->invariant; + var->shader_in = this->shader_in; + var->shader_out = this->shader_out; var->mode = this->mode; var->interpolation = this->interpolation; + var->array_lvalue = this->array_lvalue; + var->location = this->location; + var->warn_extension = this->warn_extension; + + if (this->constant_value) + var->constant_value = this->constant_value->clone(ht); if (ht) { hash_table_insert(ht, var, (void *)const_cast(this)); -- cgit v1.2.3 From 81d664f099a5fd5fac777480532fb4307d591451 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 15:18:55 -0700 Subject: glsl2: Move temp declaration to correct side of if-statement in IR --- src/glsl/ast_to_hir.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index a9ab17f421..98090d2b01 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -805,6 +805,10 @@ ast_expression::hir(exec_list *instructions, } type = glsl_type::bool_type; } else { + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "and_tmp"); + instructions->push_tail(tmp); + ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); @@ -819,10 +823,6 @@ ast_expression::hir(exec_list *instructions, error_emitted = true; } - ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, - "and_tmp"); - instructions->push_tail(tmp); - 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); @@ -869,13 +869,13 @@ ast_expression::hir(exec_list *instructions, } type = glsl_type::bool_type; } else { - ir_if *const stmt = new(ctx) ir_if(op[0]); - instructions->push_tail(stmt); - ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, "or_tmp"); instructions->push_tail(tmp); + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { -- cgit v1.2.3 From b50098122696c00e7f9e57089197e25e5fe0e0cf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 11:02:19 -0700 Subject: glsl2: Implement ir_function::clone and ir_function_signature::clone --- src/glsl/ir_clone.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index f1d2851793..2bde585914 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -261,17 +261,54 @@ ir_assignment::clone(struct hash_table *ht) const ir_function * ir_function::clone(struct hash_table *ht) const { - (void)ht; - /* FINISHME */ - abort(); + void *mem_ctx = talloc_parent(this); + ir_function *copy = new(mem_ctx) ir_function(this->name); + + foreach_list_const(node, &this->signatures) { + const ir_function_signature *const sig = + (const ir_function_signature *const) node; + + ir_function_signature *sig_copy = sig->clone(ht); + copy->add_signature(sig_copy); + + if (ht != NULL) + hash_table_insert(ht, sig_copy, + (void *)const_cast(sig)); + } + + return copy; } ir_function_signature * ir_function_signature::clone(struct hash_table *ht) const { - (void)ht; - /* FINISHME */ - abort(); + void *mem_ctx = talloc_parent(this); + ir_function_signature *copy = + new(mem_ctx) ir_function_signature(this->return_type); + + copy->is_defined = this->is_defined; + + /* Clone the parameter list. + */ + foreach_list_const(node, &this->parameters) { + const ir_variable *const param = (const ir_variable *) node; + + assert(const_cast(param)->as_variable() != NULL); + + ir_variable *const param_copy = param->clone(ht); + copy->parameters.push_tail(param_copy); + } + + /* Clone the instruction list. + */ + foreach_list_const(node, &this->body) { + const ir_instruction *const inst = (const ir_instruction *) node; + + ir_instruction *const inst_copy = inst->clone(ht); + copy->body.push_tail(inst_copy); + } + + return copy; } ir_constant * -- cgit v1.2.3 From 792e01c1e259077eb339af3ce61905fd227ae4bd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 7 Jul 2010 11:33:13 -0700 Subject: ir_call: Add method to set the function signature being called --- src/glsl/ir.cpp | 8 ++++++++ src/glsl/ir.h | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 4257842583..f3ee12ce81 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -836,6 +836,14 @@ ir_call::get_error_instruction(void *ctx) return call; } +void +ir_call::set_callee(const ir_function_signature *sig) +{ + assert((this->type == NULL) || (this->type == sig->return_type)); + + this->callee = sig; +} + void visit_exec_list(exec_list *list, ir_visitor *visitor) { diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 0d5bbc20aa..89922c6bbc 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -694,6 +694,11 @@ public: return callee; } + /** + * Set the function call target + */ + void set_callee(const ir_function_signature *sig); + /** * Generates an inline version of the function before @ir, * returning the return value of the function. -- cgit v1.2.3 From f3235eb37f264244f4ea432700be7dd6b2930d6c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 6 Jul 2010 16:01:06 -0700 Subject: glsl2: Add utility function clone_ir_list --- src/glsl/ir.h | 9 ++++++++ src/glsl/ir_clone.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 89922c6bbc..18294ebc31 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1236,6 +1236,15 @@ visit_exec_list(exec_list *list, ir_visitor *visitor); void validate_ir_tree(exec_list *instructions); +/** + * Make a clone of each IR instruction in a list + * + * \param in List of IR instructions that are to be cloned + * \param out List to hold the cloned instructions + */ +void +clone_ir_list(exec_list *out, const exec_list *in); + extern void _mesa_glsl_initialize_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state); diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 2bde585914..f1547d9106 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -344,3 +344,63 @@ ir_constant::clone(struct hash_table *ht) const return NULL; } } + + +class fixup_ir_call_visitor : public ir_hierarchical_visitor { +public: + fixup_ir_call_visitor(struct hash_table *ht) + { + this->ht = ht; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + /* Try to find the function signature referenced by the ir_call in the + * table. If it is found, replace it with the value from the table. + */ + const ir_function_signature *const sig = + (ir_function_signature *) hash_table_find(this->ht, ir->get_callee()); + if (sig != NULL) + ir->set_callee(sig); + + /* Since this may be used before function call parameters are flattened, + * the children also need to be processed. + */ + return visit_continue; + } + +private: + struct hash_table *ht; +}; + + +static void +fixup_function_calls(struct hash_table *ht, exec_list *instructions) +{ + fixup_ir_call_visitor v(ht); + v.run(instructions); +} + + +void +clone_ir_list(exec_list *out, const exec_list *in) +{ + struct hash_table *ht = + hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + + foreach_list_const(node, in) { + const ir_instruction *const original = (ir_instruction *) node; + ir_instruction *copy = original->clone(ht); + + out->push_tail(copy); + } + + /* Make a pass over the cloned tree to fix up ir_call nodes to point to the + * cloned ir_function_signature nodes. This cannot be done automatically + * during cloning because the ir_call might be a forward reference (i.e., + * the function signature that it references may not have been cloned yet). + */ + fixup_function_calls(ht, out); + + hash_table_dtor(ht); +} -- cgit v1.2.3 From df05ad4e1aa5512ce1dfd2e6661641e012c8b279 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 2 Jul 2010 13:28:32 -0700 Subject: ir_function_signature: Add method to get the function owning a signature There is no setter function, the getter returns a constant pointer, and ir_function_signature::_function is private for a reason. The only way to make a connection between a function and function signature is via ir_function::add_signature. This helps ensure that certain invariants (i.e., a function signature is in the list of signatures for its _function) are met. --- src/glsl/ir.cpp | 2 +- src/glsl/ir.h | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index f3ee12ce81..6d89913286 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -771,7 +771,7 @@ ir_variable::component_slots() const ir_function_signature::ir_function_signature(const glsl_type *return_type) - : return_type(return_type), is_defined(false) + : return_type(return_type), is_defined(false), _function(NULL) { /* empty */ } diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 18294ebc31..fb94b5a560 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -275,6 +275,23 @@ public: */ const char *function_name() const; + /** + * Get a handle to the function for which this is a signature + * + * There is no setter function, this function returns a \c const pointer, + * and \c ir_function_signature::_function is private for a reason. The + * only way to make a connection between a function and function signature + * is via \c ir_function::add_signature. This helps ensure that certain + * invariants (i.e., a function signature is in the list of signatures for + * its \c _function) are met. + * + * \sa ir_function::add_signature + */ + inline const class ir_function *function() const + { + return this->_function; + } + /** * Check whether the qualifiers match between this signature's parameters * and the supplied parameter list. If not, returns the name of the first @@ -312,7 +329,7 @@ public: private: /** Function of which this signature is one overload. */ - class ir_function *function; + class ir_function *_function; friend class ir_function; }; @@ -343,8 +360,8 @@ public: void add_signature(ir_function_signature *sig) { - sig->function = this; - signatures.push_tail(sig); + sig->_function = this; + this->signatures.push_tail(sig); } /** @@ -381,7 +398,7 @@ private: inline const char *ir_function_signature::function_name() const { - return function->name; + return this->_function->name; } /*@}*/ -- cgit v1.2.3 From c67016de960c988c748ffdb11247072543a8f328 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 2 Jul 2010 13:30:23 -0700 Subject: ir_validate: Additional function related invariant checks Add two invariant checks related to functions and function signatures: 1. Ensure that function definitions (ir_function) are not nested. 2. Ensure that the ir_function pointed to by an ir_function_signature is the one that contains it in its signatures list. --- src/glsl/ir_validate.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 7582d57e7c..8c86748d26 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -46,6 +46,8 @@ public: this->ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + this->current_function = NULL; + this->callback = ir_validate::validate_ir; this->data = ht; } @@ -57,11 +59,69 @@ public: virtual ir_visitor_status visit(ir_variable *v); + virtual ir_visitor_status visit_enter(ir_function *ir); + virtual ir_visitor_status visit_leave(ir_function *ir); + virtual ir_visitor_status visit_enter(ir_function_signature *ir); + static void validate_ir(ir_instruction *ir, void *data); + ir_function *current_function; + struct hash_table *ht; }; +ir_visitor_status +ir_validate::visit_enter(ir_function *ir) +{ + /* Function definitions cannot be nested. + */ + if (this->current_function != NULL) { + printf("Function definition nested inside another function " + "definition:\n"); + printf("%s %p inside %s %p\n", + ir->name, ir, + this->current_function->name, this->current_function); + abort(); + } + + /* Store the current function hierarchy being traversed. This is used + * by the function signature visitor to ensure that the signatures are + * linked with the correct functions. + */ + this->current_function = ir; + + this->validate_ir(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_leave(ir_function *ir) +{ + (void) ir; + + this->current_function = NULL; + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_enter(ir_function_signature *ir) +{ + if (this->current_function != ir->function()) { + printf("Function signature nested inside wrong function " + "definition:\n"); + printf("%p inside %s %p instead of %s %p\n", + ir, + this->current_function->name, this->current_function, + ir->function_name(), ir->function()); + abort(); + } + + this->validate_ir(ir, this->data); + + return visit_continue; +} + ir_visitor_status ir_validate::visit(ir_variable *ir) { -- cgit v1.2.3 From 3fb878722ed53d79eedb9fe68972ef32b79575d4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 9 Jul 2010 14:09:34 -0700 Subject: linker: Stub-out intrastage linker --- src/glsl/linker.cpp | 81 ++++++++++++++++++++++++++++++++++-------- src/glsl/main.cpp | 22 ++++++++++++ src/mesa/shader/ir_to_mesa.cpp | 9 ++--- 3 files changed, 92 insertions(+), 20 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index eb10f90a91..e70fa31a2b 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -77,9 +77,8 @@ extern "C" { #include "ir.h" #include "ir_optimization.h" #include "program.h" -extern "C" { #include "hash_table.h" -} +#include "shader_api.h" /** * Visitor that determines whether or not a variable is ever written. @@ -399,6 +398,53 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, } +/** + * Populates a shaders symbol table with all global declarations + */ +static void +populate_symbol_table(gl_shader *sh) +{ + sh->symbols = new(sh) glsl_symbol_table; + + foreach_list(node, sh->ir) { + ir_instruction *const inst = (ir_instruction *) node; + ir_variable *var; + ir_function *func; + + if ((func = inst->as_function()) != NULL) { + sh->symbols->add_function(func->name, func); + } else if ((var = inst->as_variable()) != NULL) { + sh->symbols->add_variable(var->name, var); + } + } +} + + +/** + * Combine a group of shaders for a single stage to generate a linked shader + * + * \note + * If this function is supplied a single shader, it is cloned, and the new + * shader is returned. + */ +static struct gl_shader * +link_intrastage_shaders(struct gl_shader_program *prog, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + (void) prog; + assert(num_shaders == 1); + + gl_shader *const linked = _mesa_new_shader(NULL, 0, shader_list[0]->Type); + linked->ir = new(linked) exec_list; + clone_ir_list(linked->ir, shader_list[0]->ir); + + populate_symbol_table(linked); + + return linked; +} + + struct uniform_node { exec_node link; struct gl_uniform *u; @@ -807,25 +853,32 @@ link_shaders(struct gl_shader_program *prog) } /* FINISHME: Implement intra-stage linking. */ - assert(num_vert_shaders <= 1); - assert(num_frag_shaders <= 1); - - /* Verify that each of the per-target executables is valid. - */ - if (!validate_vertex_shader_executable(prog, vert_shader_list[0]) - || !validate_fragment_shader_executable(prog, frag_shader_list[0])) - goto done; + prog->_NumLinkedShaders = 0; + if (num_vert_shaders > 0) { + gl_shader *const sh = + link_intrastage_shaders(prog, vert_shader_list, num_vert_shaders); + if (sh == NULL) + goto done; - prog->_NumLinkedShaders = 0; + if (!validate_vertex_shader_executable(prog, sh)) + goto done; - if (num_vert_shaders > 0) { - prog->_LinkedShaders[prog->_NumLinkedShaders] = vert_shader_list[0]; + prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; prog->_NumLinkedShaders++; } if (num_frag_shaders > 0) { - prog->_LinkedShaders[prog->_NumLinkedShaders] = frag_shader_list[0]; + gl_shader *const sh = + link_intrastage_shaders(prog, frag_shader_list, num_frag_shaders); + + if (sh == NULL) + goto done; + + if (!validate_fragment_shader_executable(prog, sh)) + goto done; + + prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; prog->_NumLinkedShaders++; } diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index dd43d12474..8b0bccdcb7 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -36,6 +36,25 @@ #include "ir_print_visitor.h" #include "program.h" +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +/* Copied from shader_api.c for the stand-alone compiler. + */ +struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +{ + struct gl_shader *shader; + assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); + shader = talloc_zero(NULL, struct gl_shader); + if (shader) { + shader->Type = type; + shader->Name = name; + shader->RefCount = 1; + } + return shader; +} + /* Returned string will have 'ctx' as its talloc owner. */ static char * load_text_file(void *ctx, const char *file_name) @@ -271,6 +290,9 @@ main(int argc, char **argv) printf("Info log for linking:\n%s\n", whole_program->InfoLog); } + for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++) + talloc_free(whole_program->_LinkedShaders[i]); + talloc_free(whole_program); _mesa_glsl_release_types(); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index c636d69aba..8945e9b3b4 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1998,20 +1998,17 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) prog->Uniforms = _mesa_new_uniform_list(); } - prog->LinkStatus = prog->LinkStatus; - - /* FINISHME: This should use the linker-generated code */ if (prog->LinkStatus) { - for (i = 0; i < prog->NumShaders; i++) { + for (i = 0; i < prog->_NumLinkedShaders; i++) { struct gl_program *linked_prog; linked_prog = get_mesa_program(ctx, prog, - prog->Shaders[i]); + prog->_LinkedShaders[i]); count_resources(linked_prog); link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); - switch (prog->Shaders[i]->Type) { + switch (prog->_LinkedShaders[i]->Type) { case GL_VERTEX_SHADER: _mesa_reference_vertprog(ctx, &prog->VertexProgram, (struct gl_vertex_program *)linked_prog); -- cgit v1.2.3 From 8baf21b1a4d50efca086679cc43bb0cfc3fee03a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 13:55:32 -0700 Subject: ir_validate: Validate that varibles are declared before used in IR --- src/glsl/ir_validate.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 8c86748d26..74b4826e35 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -58,6 +58,7 @@ public: } virtual ir_visitor_status visit(ir_variable *v); + virtual ir_visitor_status visit(ir_dereference_variable *ir); virtual ir_visitor_status visit_enter(ir_function *ir); virtual ir_visitor_status visit_leave(ir_function *ir); @@ -70,6 +71,27 @@ public: struct hash_table *ht; }; + +ir_visitor_status +ir_validate::visit(ir_dereference_variable *ir) +{ + if ((ir->var == NULL) || (ir->var->as_variable() == NULL)) { + printf("ir_dereference_variable @ %p does not specify a variable %p\n", + ir, ir->var); + abort(); + } + + if (hash_table_find(ht, ir->var) == NULL) { + printf("ir_dereference_variable @ %p specifies undeclared variable " + "`%s' @ %p\n", + ir, ir->var->name, ir->var); + abort(); + } + + return visit_continue; +} + + ir_visitor_status ir_validate::visit_enter(ir_function *ir) { @@ -126,9 +148,11 @@ ir_visitor_status ir_validate::visit(ir_variable *ir) { /* An ir_variable is the one thing that can (and will) appear multiple times - * in an IR tree. + * in an IR tree. It is added to the hashtable so that it can be used + * in the ir_dereference_variable handler to ensure that a variable is + * declared before it is dereferenced. */ - (void) ir; + hash_table_insert(ht, ir, ir); return visit_continue; } -- cgit v1.2.3 From 506880bc32e7bb98fd1896a9b2fe3614abab904f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 15:46:16 -0700 Subject: ir_validate: Also perform usual checks on ir_dereference_variable nodes --- src/glsl/ir_validate.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 74b4826e35..4284f6b120 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -88,6 +88,8 @@ ir_validate::visit(ir_dereference_variable *ir) abort(); } + this->validate_ir(ir, this->data); + return visit_continue; } -- cgit v1.2.3 From b87259d3efeadf05556e2daf688935a038097bba Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 15:32:37 -0700 Subject: glsl2: Fix copy propagation in the presence of derefs in array indexes. We would clear the in_lhs flag early, avoiding copy propagation on the array index variable (oops) and then copy propagating on the array variable (ouch). Just avoid all copy propagation on the LHS instead. --- src/glsl/ir_copy_propagation.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index f502f5e0b0..5712398732 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -96,9 +96,29 @@ ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_assignment *ir) { - (void) ir; + ir_visitor_status s; + + /* Inline the rest of ir_assignment::accept(ir_hv *v), wrapping the + * LHS part with setting in_lhs so that we can avoid copy + * propagating into the LHS. + * + * Note that this means we won't copy propagate into the derefs of + * an array index. Oh well. + */ this->in_lhs = true; - return visit_continue; + s = ir->lhs->accept(this); + this->in_lhs = false; + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = ir->rhs->accept(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (ir->condition) + s = ir->condition->accept(this); + + return (s == visit_stop) ? s : visit_continue_with_parent; } ir_visitor_status @@ -122,7 +142,6 @@ ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) * other storage! */ if (this->in_lhs) { - this->in_lhs = false; return visit_continue; } -- cgit v1.2.3 From 7b96b474e06f83bf4abec42b3a9cb2dee0ea1b68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 15:18:52 -0700 Subject: glsl2: Add support for variable vector indexing on the LHS of assignments. Fixes glsl-vs-vec4-indexing-3. --- src/glsl/ir_vec_index_to_cond_assign.cpp | 60 ++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index 3f527fcbe7..ac420454e8 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -56,7 +56,7 @@ public: virtual ir_visitor_status visit_enter(ir_expression *); virtual ir_visitor_status visit_enter(ir_swizzle *); - virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_assignment *); virtual ir_visitor_status visit_enter(ir_return *); virtual ir_visitor_status visit_enter(ir_call *); virtual ir_visitor_status visit_enter(ir_if *); @@ -144,10 +144,64 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_swizzle *ir) } ir_visitor_status -ir_vec_index_to_cond_assign_visitor::visit_enter(ir_assignment *ir) +ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) { - /* FINISHME: Handle it on the LHS. */ + ir_variable *index, *var; + ir_dereference_variable *deref; + ir_assignment *assign; + int i; + ir->rhs = convert_vec_index_to_cond_assign(ir->rhs); + if (ir->condition) + ir->condition = convert_vec_index_to_cond_assign(ir->condition); + + /* Last, handle the LHS */ + ir_dereference_array *orig_deref = ir->lhs->as_dereference_array(); + + if (!orig_deref || + orig_deref->array->type->is_matrix() || + orig_deref->array->type->is_array()) + return visit_continue; + + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); + + /* Store the index to a temporary to avoid reusing its tree. */ + index = new(ir) ir_variable(glsl_type::int_type, "vec_index_tmp_i"); + ir->insert_before(index); + deref = new(ir) ir_dereference_variable(index); + assign = new(ir) ir_assignment(deref, orig_deref->array_index, NULL); + ir->insert_before(assign); + + /* Store the RHS to a temporary to avoid reusing its tree. */ + var = new(ir) ir_variable(ir->rhs->type, "vec_index_tmp_v"); + ir->insert_before(var); + deref = new(ir) ir_dereference_variable(var); + assign = new(ir) ir_assignment(deref, ir->rhs, NULL); + ir->insert_before(assign); + + /* Generate a conditional move of each vector element to the temp. */ + for (i = 0; i < orig_deref->array->type->vector_elements; i++) { + ir_rvalue *condition, *swizzle; + + deref = new(ir) ir_dereference_variable(index); + condition = new(ir) ir_expression(ir_binop_equal, + glsl_type::bool_type, + deref, + new(ir) ir_constant(i)); + + /* Just clone the rest of the deref chain when trying to get at the + * underlying variable. + */ + swizzle = new(ir) ir_swizzle(orig_deref->array->clone(NULL), + i, 0, 0, 0, 1); + + deref = new(ir) ir_dereference_variable(var); + assign = new(ir) ir_assignment(swizzle, deref, condition); + ir->insert_before(assign); + } + ir->remove(); + + this->progress = true; return visit_continue; } -- cgit v1.2.3 From d74c9ff046c9cf8ee33c202eb5eba3dfc7f8e06e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 15:41:31 -0700 Subject: glsl2: Use a better talloc context for ir_expression_flattening. The instruction can be hung off of any other in the tree, even if the other one will be deleted, since it'll get stolen to the shader's context later if it's still live. --- src/glsl/ir_expression_flattening.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 0f10b67193..629194c1a0 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -82,7 +82,7 @@ do_expression_flattening(exec_list *instructions, ir_rvalue * ir_expression_flattening_visitor::operand_to_temp(ir_rvalue *ir) { - void *ctx = talloc_parent(base_ir); + void *ctx = base_ir; ir_variable *var; ir_assignment *assign; -- cgit v1.2.3 From e2e5d0def490ed03970efa0a7468fef0623ae617 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 18:47:11 -0700 Subject: linker: Refactor cross_validate_uniforms into cross_validate_globals The later, more generic function will be used in the intra-stage linker. --- src/glsl/linker.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 13 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e70fa31a2b..04b4efd84b 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -242,42 +242,72 @@ validate_fragment_shader_executable(struct gl_shader_program *prog, /** - * Perform validation of uniforms used across multiple shader stages + * Generate a string describing the mode of a variable + */ +static const char * +mode_string(const ir_variable *var) +{ + switch (var->mode) { + case ir_var_auto: + return (var->read_only) ? "global constant" : "global variable"; + + case ir_var_uniform: return "uniform"; + case ir_var_in: return "shader input"; + case ir_var_out: return "shader output"; + case ir_var_inout: return "shader inout"; + default: + assert(!"Should not get here."); + return "invalid variable"; + } +} + + +/** + * Perform validation of global variables used across multiple shaders */ bool -cross_validate_uniforms(struct gl_shader_program *prog) +cross_validate_globals(struct gl_shader_program *prog, + struct gl_shader **shader_list, + unsigned num_shaders, + bool uniforms_only) { /* Examine all of the uniforms in all of the shaders and cross validate * them. */ - glsl_symbol_table uniforms; - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - foreach_list(node, prog->_LinkedShaders[i]->ir) { + glsl_symbol_table variables; + for (unsigned i = 0; i < num_shaders; i++) { + foreach_list(node, shader_list[i]->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if ((var == NULL) || (var->mode != ir_var_uniform)) + if (var == NULL) continue; - /* If a uniform with this name has already been seen, verify that the - * new instance has the same type. In addition, if the uniforms have + if (uniforms_only && (var->mode != ir_var_uniform)) + continue; + + /* If a global with this name has already been seen, verify that the + * new instance has the same type. In addition, if the globals have * initializers, the values of the initializers must be the same. */ - ir_variable *const existing = uniforms.get_variable(var->name); + ir_variable *const existing = variables.get_variable(var->name); if (existing != NULL) { if (var->type != existing->type) { - linker_error_printf(prog, "uniform `%s' declared as type " + linker_error_printf(prog, "%s `%s' declared as type " "`%s' and type `%s'\n", + mode_string(var), var->name, var->type->name, existing->type->name); return false; } + /* FINISHME: Handle non-constant initializers. + */ if (var->constant_value != NULL) { if (existing->constant_value != NULL) { if (!var->constant_value->has_value(existing->constant_value)) { - linker_error_printf(prog, "initializers for uniform " + linker_error_printf(prog, "initializers for %s " "`%s' have differing values\n", - var->name); + mode_string(var), var->name); return false; } } else @@ -289,7 +319,7 @@ cross_validate_uniforms(struct gl_shader_program *prog) (ir_constant *)var->constant_value->clone(NULL); } } else - uniforms.add_variable(var->name, var); + variables.add_variable(var->name, var); } } @@ -297,6 +327,17 @@ cross_validate_uniforms(struct gl_shader_program *prog) } +/** + * Perform validation of uniforms used across multiple shader stages + */ +bool +cross_validate_uniforms(struct gl_shader_program *prog) +{ + return cross_validate_globals(prog, prog->_LinkedShaders, + prog->_NumLinkedShaders, true); +} + + /** * Validate that outputs from one stage match inputs of another */ -- cgit v1.2.3 From 13f782c4ae4e38e64ec4fe87a1c24597a5e894c3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 29 Jun 2010 18:53:38 -0700 Subject: linker: Implement first bits of intrastage linking This currently involves an ugly hack so that every link doesn't result in all the built-in functions showing up as multiply defined. As soon as the built-in functions are stored in a separate compilation unit, ir_function_signature::is_built_in can be removed. --- src/glsl/ir.h | 3 +++ src/glsl/ir_clone.cpp | 1 + src/glsl/ir_reader.cpp | 1 + src/glsl/linker.cpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 63 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index fb94b5a560..25bf6c6d15 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -324,6 +324,9 @@ public: /** Whether or not this function has a body (which may be empty). */ unsigned is_defined:1; + /** Whether or not this function signature is a built-in. */ + unsigned is_built_in:1; + /** Body of instructions in the function. */ struct exec_list body; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index f1547d9106..2562ad9118 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -287,6 +287,7 @@ ir_function_signature::clone(struct hash_table *ht) const new(mem_ctx) ir_function_signature(this->return_type); copy->is_defined = this->is_defined; + copy->is_built_in = this->is_built_in; /* Clone the parameter list. */ diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 03212830cd..c83f92ef57 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -291,6 +291,7 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, } } else { sig = new(ctx) ir_function_signature(return_type); + sig->is_built_in = true; f->add_signature(sig); } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 04b4efd84b..3d8f24bb44 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -473,8 +473,64 @@ link_intrastage_shaders(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - (void) prog; - assert(num_shaders == 1); + /* Check that global variables defined in multiple shaders are consistent. + */ + if (!cross_validate_globals(prog, shader_list, num_shaders, false)) + return NULL; + + /* Check that there is only a single definition of each function signature + * across all shaders. + */ + for (unsigned i = 0; i < (num_shaders - 1); i++) { + foreach_list(node, shader_list[i]->ir) { + ir_function *const f = ((ir_instruction *) node)->as_function(); + + if (f == NULL) + continue; + + for (unsigned j = i + 1; j < num_shaders; j++) { + ir_function *const other = + shader_list[j]->symbols->get_function(f->name); + + /* If the other shader has no function (and therefore no function + * signatures) with the same name, skip to the next shader. + */ + if (other == NULL) + continue; + + foreach_iter (exec_list_iterator, iter, *f) { + ir_function_signature *sig = + (ir_function_signature *) iter.get(); + + if (!sig->is_defined || sig->is_built_in) + continue; + + ir_function_signature *other_sig = + other->exact_matching_signature(& sig->parameters); + + if ((other_sig != NULL) && other_sig->is_defined + && !other_sig->is_built_in) { + linker_error_printf(prog, + "function `%s' is multiply defined", + f->name); + return NULL; + } + } + } + } + } + + /* Find the shader that defines main, and make a clone of it. + * + * Starting with the clone, search for undefined references. If one is + * found, find the shader that defines it. Clone the reference and add + * it to the shader. Repeat until there are no undefined references or + * until a reference cannot be resolved. + */ + + + /* Resolve initializers for global variables in the linked shader. + */ gl_shader *const linked = _mesa_new_shader(NULL, 0, shader_list[0]->Type); linked->ir = new(linked) exec_list; -- cgit v1.2.3 From 11fc7beb2fa82179cfd9202449e1365b28f868a9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 18:35:20 -0700 Subject: ir_function: Make matching_signature not return const The linker needs to use this function to get specific function signatures, but it also needs to modify the returned signature. Since this method isn't itself const (i.e., const this pointer), there is no value in making a const and non-const version. --- src/glsl/ir.h | 2 +- src/glsl/ir_function.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 25bf6c6d15..053b6fecd1 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -379,7 +379,7 @@ public: * Find a signature that matches a set of actual parameters, taking implicit * conversions into account. */ - const ir_function_signature *matching_signature(exec_list *actual_param); + ir_function_signature *matching_signature(exec_list *actual_param); /** * Find a signature that exactly matches a set of actual parameters without diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 5db93f67fb..fcdb83be56 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -155,7 +155,7 @@ parameter_lists_match(exec_list *list_a, exec_list *list_b) } -const ir_function_signature * +ir_function_signature * ir_function::matching_signature(exec_list *actual_parameters) { ir_function_signature *match = NULL; -- cgit v1.2.3 From 15ce87e9f2d4f66ef87af693a284b3cc9fd870c1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 9 Jul 2010 15:28:22 -0700 Subject: linker: Detect the shader that contains "main" during intrastage linking --- src/glsl/linker.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 3d8f24bb44..11deeed593 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -461,6 +461,33 @@ populate_symbol_table(gl_shader *sh) } +/** + * Get the function signature for main from a shader + */ +static ir_function_signature * +get_main_function_signature(gl_shader *sh) +{ + ir_function *const f = sh->symbols->get_function("main"); + if (f != NULL) { + exec_list void_parameters; + + /* Look for the 'void main()' signature and ensure that it's defined. + * This keeps the linker from accidentally pick a shader that just + * contains a prototype for main. + * + * We don't have to check for multiple definitions of main (in multiple + * shaders) because that would have already been caught above. + */ + ir_function_signature *sig = f->matching_signature(&void_parameters); + if ((sig != NULL) && sig->is_defined) { + return sig; + } + } + + return NULL; +} + + /** * Combine a group of shaders for a single stage to generate a linked shader * @@ -527,17 +554,30 @@ link_intrastage_shaders(struct gl_shader_program *prog, * it to the shader. Repeat until there are no undefined references or * until a reference cannot be resolved. */ + gl_shader *main = NULL; + for (unsigned i = 0; i < num_shaders; i++) { + if (get_main_function_signature(shader_list[i]) != NULL) { + main = shader_list[i]; + break; + } + } + if (main == NULL) { + linker_error_printf(prog, "%s shader lacks `main'\n", + (shader_list[0]->Type == GL_VERTEX_SHADER) + ? "vertex" : "fragment"); + return NULL; + } - /* Resolve initializers for global variables in the linked shader. - */ - - gl_shader *const linked = _mesa_new_shader(NULL, 0, shader_list[0]->Type); + gl_shader *const linked = _mesa_new_shader(NULL, 0, main->Type); linked->ir = new(linked) exec_list; - clone_ir_list(linked->ir, shader_list[0]->ir); + clone_ir_list(linked->ir, main->ir); populate_symbol_table(linked); + /* Resolve initializers for global variables in the linked shader. + */ + return linked; } -- cgit v1.2.3 From 31a97868fc14d4c57681c35021571b4b61f29e20 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 12 Jul 2010 18:48:50 -0700 Subject: linker: Merge global-scope instructions into main Find instructions in all shaders that are not contained in a function (i.e., initializers for global variables). "Move" these instructions to the top of the main function in the linked shader. As a side-effect, many global variables will also be copied into the linked shader. --- src/glsl/linker.cpp | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 11deeed593..481fcab16f 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -461,6 +461,111 @@ populate_symbol_table(gl_shader *sh) } +/** + * Remap variables referenced in an instruction tree + * + * This is used when instruction trees are cloned from one shader and placed in + * another. These trees will contain references to \c ir_variable nodes that + * do not exist in the target shader. This function finds these \c ir_variable + * references and replaces the references with matching variables in the target + * shader. + * + * If there is no matching variable in the target shader, a clone of the + * \c ir_variable is made and added to the target shader. The new variable is + * added to \b both the instruction stream and the symbol table. + * + * \param inst IR tree that is to be processed. + * \param symbols Symbol table containing global scope symbols in the + * linked shader. + * \param instructions Instruction stream where new variable declarations + * should be added. + */ +void +remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, + exec_list *instructions) +{ + class remap_visitor : public ir_hierarchical_visitor { + public: + remap_visitor(glsl_symbol_table *symbols, exec_list *instructions) + { + this->symbols = symbols; + this->instructions = instructions; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + ir_variable *const existing = + this->symbols->get_variable(ir->var->name); + if (existing != NULL) + ir->var = existing; + else { + ir_variable *copy = ir->var->clone(NULL); + + this->symbols->add_variable(copy->name, copy); + this->instructions->push_head(copy); + } + + return visit_continue; + } + + private: + glsl_symbol_table *symbols; + exec_list *instructions; + }; + + remap_visitor v(symbols, instructions); + + inst->accept(&v); +} + + +/** + * Move non-declarations from one instruction stream to another + * + * The intended usage pattern of this function is to pass the pointer to the + * head sentinal of a list (i.e., a pointer to the list cast to an \c exec_node + * pointer) for \c last and \c false for \c make_copies on the first + * call. Successive calls pass the return value of the previous call for + * \c last and \c true for \c make_copies. + * + * \param instructions Source instruction stream + * \param last Instruction after which new instructions should be + * inserted in the target instruction stream + * \param make_copies Flag selecting whether instructions in \c instructions + * should be copied (via \c ir_instruction::clone) into the + * target list or moved. + * + * \return + * The new "last" instruction in the target instruction stream. This pointer + * is suitable for use as the \c last parameter of a later call to this + * function. + */ +exec_node * +move_non_declarations(exec_list *instructions, exec_node *last, + bool make_copies, gl_shader *target) +{ + foreach_list(node, instructions) { + ir_instruction *inst = (ir_instruction *) node; + + if (inst->as_variable() || inst->as_function()) + continue; + + assert(inst->as_assignment()); + + if (make_copies) { + inst = inst->clone(NULL); + remap_variables(inst, target->symbols, target->ir); + } else { + inst->remove(); + } + + last->insert_after(inst); + last = inst; + } + + return last; +} + /** * Get the function signature for main from a shader */ @@ -575,6 +680,22 @@ link_intrastage_shaders(struct gl_shader_program *prog, populate_symbol_table(linked); + /* The a pointer to the main function in the final linked shader (i.e., the + * copy of the original shader that contained the main function). + */ + ir_function_signature *const main_sig = get_main_function_signature(linked); + + /* Move any instructions other than variable declarations or function + * declarations into main. + */ + exec_node *insertion_point = (exec_node *) &main_sig->body; + for (unsigned i = 0; i < num_shaders; i++) { + insertion_point = move_non_declarations(shader_list[i]->ir, + insertion_point, + (shader_list[i] != main), + linked); + } + /* Resolve initializers for global variables in the linked shader. */ -- cgit v1.2.3 From 94da2abfd49c6b4060544986ef68d5662b1cc292 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 19:31:54 -0700 Subject: glsl2: Flatten expressions that appear as the children of ir_return as well. --- src/glsl/ir_expression_flattening.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 629194c1a0..66268a679d 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -176,9 +176,7 @@ ir_expression_flattening_visitor::visit_enter(ir_call *ir) ir_visitor_status ir_expression_flattening_visitor::visit_enter(ir_return *ir) { - /* FINISHME: Why not process the return value? (Same behavior as original - * FINISHME: code.) - */ - (void) ir; - return visit_continue_with_parent; + if (ir->value) + ir->value = operand_to_temp(ir->value); + return visit_continue; } -- cgit v1.2.3 From 562c3d0cb1aedbf3c9f13f206678fa3f0fa26a9f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 19:50:01 -0700 Subject: glsl2: Flatten expression that appear as the parameters of ir_call as well. --- src/glsl/ir_expression_flattening.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 66268a679d..f18659342f 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -165,11 +165,18 @@ ir_expression_flattening_visitor::visit_leave(ir_swizzle *ir) ir_visitor_status ir_expression_flattening_visitor::visit_enter(ir_call *ir) { - /* FINISHME: Why not process the call parameters? (Same behavior as original - * FINISHME: code.) - */ - (void) ir; - return visit_continue_with_parent; + /* Reminder: iterating ir_call iterates its parameters. */ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *ir = (ir_rvalue *)iter.get(); + ir_rvalue *new_ir = operand_to_temp(ir); + + if (new_ir != ir) { + ir->insert_before(new_ir); + ir->remove(); + } + } + + return visit_continue; } -- cgit v1.2.3 From 15ded6327966fa5824e34f7291e624994457f9b5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Jul 2010 17:34:17 -0700 Subject: glsl2: Add matrix multiplication to ir_mat_op_to_vec. --- src/glsl/ir_mat_op_to_vec.cpp | 197 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 188 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 828c63c17a..7bdb9057d8 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -44,7 +44,17 @@ public: ir_visitor_status visit_leave(ir_assignment *); - ir_rvalue *get_column(ir_variable *var, int i); + ir_rvalue *get_column(ir_variable *var, int col); + ir_rvalue *get_element(ir_variable *var, int col, int row); + + void do_mul_mat_mat(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_mat_vec(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_vec_mat(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_mat_scalar(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); bool made_progress; }; @@ -83,7 +93,24 @@ do_mat_op_to_vec(exec_list *instructions) } ir_rvalue * -ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int i) +ir_mat_op_to_vec_visitor::get_element(ir_variable *var, int col, int row) +{ + ir_dereference *deref; + + deref = new(base_ir) ir_dereference_variable(var); + + if (var->type->is_matrix()) { + deref = new(base_ir) ir_dereference_array(var, + new(base_ir) ir_constant(col)); + } else { + assert(col == 0); + } + + return new(base_ir) ir_swizzle(deref, row, 0, 0, 0, 1); +} + +ir_rvalue * +ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int row) { ir_dereference *deref; @@ -92,12 +119,152 @@ ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int i) } else { deref = new(base_ir) ir_dereference_variable(var); deref = new(base_ir) ir_dereference_array(deref, - new(base_ir) ir_constant(i)); + new(base_ir) ir_constant(row)); } return deref; } +void +ir_mat_op_to_vec_visitor::do_mul_mat_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int b_col, i; + ir_assignment *assign; + ir_expression *expr; + + for (b_col = 0; b_col < b_var->type->matrix_columns; b_col++) { + ir_rvalue *a = get_column(a_var, 0); + ir_rvalue *b = get_element(b_var, b_col, 0); + + /* first column */ + expr = new(base_ir) ir_expression(ir_binop_mul, + a->type, + a, + b); + + /* following columns */ + for (i = 1; i < a_var->type->matrix_columns; i++) { + ir_expression *mul_expr; + + a = get_column(a_var, i); + b = get_element(b_var, b_col, i); + + mul_expr = new(base_ir) ir_expression(ir_binop_mul, + a->type, + a, + b); + expr = new(base_ir) ir_expression(ir_binop_add, + a->type, + expr, + mul_expr); + } + + ir_rvalue *result = get_column(result_var, b_col); + assign = new(base_ir) ir_assignment(result, + expr, + NULL); + base_ir->insert_before(assign); + } +} + +void +ir_mat_op_to_vec_visitor::do_mul_mat_vec(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + ir_rvalue *a = get_column(a_var, 0); + ir_rvalue *b = get_element(b_var, 0, 0); + ir_assignment *assign; + ir_expression *expr; + + /* first column */ + expr = new(base_ir) ir_expression(ir_binop_mul, + result_var->type, + a, + b); + + /* following columns */ + for (i = 1; i < a_var->type->matrix_columns; i++) { + ir_expression *mul_expr; + + a = get_column(a_var, i); + b = get_element(b_var, 0, i); + + mul_expr = new(base_ir) ir_expression(ir_binop_mul, + result_var->type, + a, + b); + expr = new(base_ir) ir_expression(ir_binop_add, + result_var->type, + expr, + mul_expr); + } + + ir_rvalue *result = new(base_ir) ir_dereference_variable(result_var); + assign = new(base_ir) ir_assignment(result, + expr, + NULL); + base_ir->insert_before(assign); +} + +void +ir_mat_op_to_vec_visitor::do_mul_vec_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + + for (i = 0; i < b_var->type->matrix_columns; i++) { + ir_rvalue *a = new(base_ir) ir_dereference_variable(a_var); + ir_rvalue *b = get_column(b_var, i); + ir_rvalue *result; + ir_expression *column_expr; + ir_assignment *column_assign; + + result = new(base_ir) ir_dereference_variable(result_var); + result = new(base_ir) ir_swizzle(result, i, 0, 0, 0, 1); + + column_expr = new(base_ir) ir_expression(ir_binop_dot, + result->type, + a, + b); + + column_assign = new(base_ir) ir_assignment(result, + column_expr, + NULL); + base_ir->insert_before(column_assign); + } +} + +void +ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + + for (i = 0; i < a_var->type->matrix_columns; i++) { + ir_rvalue *a = get_column(a_var, i); + ir_rvalue *b = new(base_ir) ir_dereference_variable(b_var); + ir_rvalue *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(base_ir) ir_expression(ir_binop_mul, + result->type, + a, + b); + + column_assign = new(base_ir) ir_assignment(result, + column_expr, + NULL); + base_ir->insert_before(column_assign); + } +} + ir_visitor_status ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) { @@ -119,10 +286,6 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) if (!found_matrix) return visit_continue; - /* FINISHME: see below */ - if (expr->operation == ir_binop_mul) - return visit_continue; - ir_dereference_variable *lhs_deref = assign->lhs->as_dereference_variable(); assert(lhs_deref); @@ -174,8 +337,24 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) } break; case ir_binop_mul: - /* FINISHME */ - return visit_continue; + if (op_var[0]->type->is_matrix()) { + if (op_var[1]->type->is_matrix()) { + do_mul_mat_mat(result_var, op_var[0], op_var[1]); + } else if (op_var[1]->type->is_vector()) { + do_mul_mat_vec(result_var, op_var[0], op_var[1]); + } else { + assert(op_var[1]->type->is_scalar()); + do_mul_mat_scalar(result_var, op_var[0], op_var[1]); + } + } else { + assert(op_var[1]->type->is_matrix()); + if (op_var[0]->type->is_vector()) { + do_mul_vec_mat(result_var, op_var[0], op_var[1]); + } else { + assert(op_var[0]->type->is_scalar()); + do_mul_mat_scalar(result_var, op_var[1], op_var[0]); + } + } break; default: printf("FINISHME: Handle matrix operation for %s\n", expr->operator_string()); -- cgit v1.2.3 From 4e6a3e0d2d148747002ab9e9c1dffe63e912c688 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 13 Jul 2010 09:22:35 -0700 Subject: glsl2: Remove unnecessary casts of clone return values --- src/glsl/ir_clone.cpp | 47 ++++++++++++++++++++++------------------------- src/glsl/linker.cpp | 3 +-- 2 files changed, 23 insertions(+), 27 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 2562ad9118..c7b786f0c4 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -67,7 +67,7 @@ ir_swizzle * ir_swizzle::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); - return new(ctx) ir_swizzle((ir_rvalue *)this->val->clone(ht), this->mask); + return new(ctx) ir_swizzle(this->val->clone(ht), this->mask); } ir_return * @@ -77,7 +77,7 @@ ir_return::clone(struct hash_table *ht) const ir_rvalue *new_value = NULL; if (this->value) - new_value = (ir_rvalue *)this->value->clone(ht); + new_value = this->value->clone(ht); return new(ctx) ir_return(new_value); } @@ -89,7 +89,7 @@ ir_discard::clone(struct hash_table *ht) const ir_rvalue *new_condition = NULL; if (this->condition != NULL) - new_condition = (ir_rvalue *) this->condition->clone(ht); + new_condition = this->condition->clone(ht); return new(ctx) ir_discard(new_condition); } @@ -107,7 +107,7 @@ ir_if * ir_if::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); - ir_if *new_if = new(ctx) ir_if((ir_rvalue *)this->condition->clone(ht)); + ir_if *new_if = new(ctx) ir_if(this->condition->clone(ht)); foreach_iter(exec_list_iterator, iter, this->then_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); @@ -129,11 +129,11 @@ ir_loop::clone(struct hash_table *ht) const ir_loop *new_loop = new(ctx) ir_loop(); if (this->from) - new_loop->from = (ir_rvalue *)this->from->clone(ht); + new_loop->from = this->from->clone(ht); if (this->to) - new_loop->to = (ir_rvalue *)this->to->clone(ht); + new_loop->to = this->to->clone(ht); if (this->increment) - new_loop->increment = (ir_rvalue *)this->increment->clone(ht); + new_loop->increment = this->increment->clone(ht); new_loop->counter = counter; foreach_iter(exec_list_iterator, iter, this->body_instructions) { @@ -166,7 +166,7 @@ ir_expression::clone(struct hash_table *ht) const unsigned int i; for (i = 0; i < get_num_operands(); i++) { - op[i] = (ir_rvalue *)this->operands[i]->clone(ht); + op[i] = this->operands[i]->clone(ht); } return new(ctx) ir_expression(this->operation, this->type, op[0], op[1]); @@ -193,15 +193,15 @@ ir_dereference_array * ir_dereference_array::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); - return new(ctx) ir_dereference_array((ir_rvalue *)this->array->clone(ht), - (ir_rvalue *)this->array_index->clone(ht)); + return new(ctx) ir_dereference_array(this->array->clone(ht), + this->array_index->clone(ht)); } ir_dereference_record * ir_dereference_record::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); - return new(ctx) ir_dereference_record((ir_rvalue *)this->record->clone(ht), + return new(ctx) ir_dereference_record(this->record->clone(ht), this->field); } @@ -211,13 +211,12 @@ ir_texture::clone(struct hash_table *ht) const void *ctx = talloc_parent(this); ir_texture *new_tex = new(ctx) ir_texture(this->op); - new_tex->sampler = (ir_dereference *)this->sampler->clone(ht); - new_tex->coordinate = (ir_rvalue *)this->coordinate->clone(ht); + new_tex->sampler = this->sampler->clone(ht); + new_tex->coordinate = this->coordinate->clone(ht); if (this->projector) - new_tex->projector = (ir_rvalue *)this->projector->clone(ht); + new_tex->projector = this->projector->clone(ht); if (this->shadow_comparitor) { - new_tex->shadow_comparitor = - (ir_rvalue *)this->shadow_comparitor->clone(ht); + new_tex->shadow_comparitor = this->shadow_comparitor->clone(ht); } for (int i = 0; i < 3; i++) @@ -227,17 +226,15 @@ ir_texture::clone(struct hash_table *ht) const case ir_tex: break; case ir_txb: - new_tex->lod_info.bias = (ir_rvalue *)this->lod_info.bias->clone(ht); + new_tex->lod_info.bias = this->lod_info.bias->clone(ht); break; case ir_txl: case ir_txf: - new_tex->lod_info.lod = (ir_rvalue *)this->lod_info.lod->clone(ht); + new_tex->lod_info.lod = this->lod_info.lod->clone(ht); break; case ir_txd: - new_tex->lod_info.grad.dPdx = - (ir_rvalue *)this->lod_info.grad.dPdx->clone(ht); - new_tex->lod_info.grad.dPdy = - (ir_rvalue *)this->lod_info.grad.dPdy->clone(ht); + new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(ht); + new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(ht); break; } @@ -250,11 +247,11 @@ ir_assignment::clone(struct hash_table *ht) const ir_rvalue *new_condition = NULL; if (this->condition) - new_condition = (ir_rvalue *)this->condition->clone(ht); + new_condition = this->condition->clone(ht); void *ctx = talloc_parent(this); - return new(ctx) ir_assignment((ir_rvalue *)this->lhs->clone(ht), - (ir_rvalue *)this->rhs->clone(ht), + return new(ctx) ir_assignment(this->lhs->clone(ht), + this->rhs->clone(ht), new_condition); } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 481fcab16f..90dc97bc53 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -315,8 +315,7 @@ cross_validate_globals(struct gl_shader_program *prog, * have an initializer but a later instance does, copy the * initializer to the version stored in the symbol table. */ - existing->constant_value = - (ir_constant *)var->constant_value->clone(NULL); + existing->constant_value = var->constant_value->clone(NULL); } } else variables.add_variable(var->name, var); -- cgit v1.2.3 From c10a68522c400d48553dbd473b9778140842d9dd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 11:07:16 -0700 Subject: glsl2: When linking makes a variable not a varying output, make it ir_var_auto. This almost fixes glsl-unused-varying, except that the used varying gets assigned to the first varying slot (position). --- src/glsl/linker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 90dc97bc53..c71c07d6e9 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1052,7 +1052,10 @@ assign_varying_locations(gl_shader *producer, gl_shader *consumer) /* An 'out' variable is only really a shader output if its value is read * by the following stage. */ - var->shader_out = (var->location != -1); + if (var->location == -1) { + var->shader_out = false; + var->mode = ir_var_auto; + } } foreach_list(node, consumer->ir) { -- cgit v1.2.3 From 7d19bf2ec34dceb621ec82861be3d12ba73e67d3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 14 Jul 2010 11:54:15 -0700 Subject: glsl2: Remove ir_program bong hits. --- src/glsl/ir.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 053b6fecd1..790173ed6b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -41,10 +41,6 @@ extern "C" { #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #endif -struct ir_program { - void *bong_hits; -}; - /** * Base class of all IR instructions */ -- cgit v1.2.3 From 5e840dba4412b33ae49289efd357a60098ac2611 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:09:48 -0700 Subject: ir_constant_expression: Remove bogus assert in ir_unop_abs case. abs is defined for integral types; it's even implemented. --- src/glsl/ir_constant_expression.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 0fe93adcea..06d7dd8fbe 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -243,7 +243,6 @@ ir_constant_visitor::visit(ir_expression *ir) break; case ir_unop_abs: - assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { case GLSL_TYPE_UINT: -- cgit v1.2.3 From 14b7b2660c771aa090477c11f85da998ec3d2570 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:11:14 -0700 Subject: ir_constant_expression: Add support for ir_unop_sign. --- src/glsl/ir_constant_expression.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 06d7dd8fbe..5ba6264dd6 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -262,6 +262,24 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_sign: + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.i[c] > 0; + break; + case GLSL_TYPE_INT: + data.i[c] = (op[0]->value.i[c] > 0) - (op[0]->value.i[c] < 0); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = float((op[0]->value.f[c] > 0)-(op[0]->value.f[c] < 0)); + break; + default: + assert(0); + } + } + break; + case ir_unop_rcp: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { -- cgit v1.2.3 From aca01edc8336fd14005a7ac853e7158f31a74940 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:14:32 -0700 Subject: ir_constant_expression: Add support for ir_unop_exp2. This uses a C99 function. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 5ba6264dd6..871bce43b7 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -323,6 +323,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_exp2: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = exp2f(op[0]->value.f[c]); + } + break; + case ir_unop_log: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { -- cgit v1.2.3 From cb63929df4ce17e94e8ead0316a00d48b51944c9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:18:09 -0700 Subject: ir_constant_expression: Add support for ir_unop_log2. This uses a C99 function. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 871bce43b7..292461e5eb 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -337,6 +337,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_log2: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = log2f(op[0]->value.f[c]); + } + break; + case ir_unop_dFdx: case ir_unop_dFdy: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); -- cgit v1.2.3 From 323d909ab21c9f378903e2027fcfef5ba9e890f9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:21:36 -0700 Subject: ir_constant_expression: Add support for ir_unop_trunc. This uses a C99 function. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 292461e5eb..09bc5b6bbf 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -206,6 +206,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_trunc: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = truncf(op[0]->value.f[c]); + } + break; + case ir_unop_fract: for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { -- cgit v1.2.3 From c1ee30a14590d73217f7dbd35e6a1839435cc5b4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:22:36 -0700 Subject: ir_constant_expression: Add support for ir_unop_ceil. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 09bc5b6bbf..19498a3bf9 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -213,6 +213,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_ceil: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = ceilf(op[0]->value.f[c]); + } + break; + case ir_unop_fract: for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { -- cgit v1.2.3 From 074720477ce9de3b4dafceffd7406bcebae1a3b9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:23:23 -0700 Subject: ir_constant_expression: Add support for ir_unop_floor. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 19498a3bf9..44a69854ad 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -220,6 +220,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_floor: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = floorf(op[0]->value.f[c]); + } + break; + case ir_unop_fract: for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { -- cgit v1.2.3 From 908afd16d1f6b5283a2535e388b6dcb77e6504d2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:28:50 -0700 Subject: ir_constant_expression: Add support for ir_unop_sin. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 44a69854ad..3d0a5e5fe0 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -245,6 +245,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_sin: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = sinf(op[0]->value.f[c]); + } + break; + case ir_unop_neg: for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { -- cgit v1.2.3 From 3fab376bef8c5f407d4011b89a17ea4fd414f213 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:29:37 -0700 Subject: ir_constant_expression: Add support for ir_unop_cos. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 3d0a5e5fe0..ef8661baf5 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -252,6 +252,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_unop_cos: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = cosf(op[0]->value.f[c]); + } + break; + case ir_unop_neg: for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { switch (ir->type->base_type) { -- cgit v1.2.3 From 891a0647e419c0cd2b67e43540936bf0ac94f840 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 8 Jul 2010 23:35:09 -0700 Subject: ir_constant_expression: Add support for ir_binop_pow. --- src/glsl/ir_constant_expression.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ef8661baf5..437a3805de 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -387,6 +387,13 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_binop_pow: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]); + } + break; + case ir_binop_dot: assert(op[0]->type->is_vector() && op[1]->type->is_vector()); data.f[0] = 0; -- cgit v1.2.3 From 79fed377f4625da9ce6a0a32c1e7277a2e90e914 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 9 Jul 2010 11:53:56 -0700 Subject: ir_constant_expression: Add support for ir_binop_min and ir_binop_max. These now work on scalar/vector combos. Semantically, if a is a scalar, min(a, vec2(x,y)) == vec2(min(a,x), min(a,y)) --- src/glsl/ir_constant_expression.cpp | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 437a3805de..7e276e1c25 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -38,6 +38,9 @@ #include "ir_visitor.h" #include "glsl_types.h" +#define min(x,y) (x) < (y) ? (x) : (y) +#define max(x,y) (x) > (y) ? (x) : (y) + /** * Visitor class for evaluating constant expressions */ @@ -413,6 +416,50 @@ ir_constant_visitor::visit(ir_expression *ir) } } + break; + case ir_binop_min: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = min(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = min(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = min(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + + break; + case ir_binop_max: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = max(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = max(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = max(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + break; case ir_binop_add: assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); -- cgit v1.2.3 From ce5ae5f49d82b545ab204b9fdb9a8f939e0a6d78 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 14 Jul 2010 11:28:40 -0700 Subject: ir_constant_expression: Add support for ir_binop_mod. --- src/glsl/ir_constant_expression.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 7e276e1c25..c0fe47067b 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -575,6 +575,33 @@ ir_constant_visitor::visit(ir_expression *ir) } break; + case ir_binop_mod: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (ir->operands[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + /* We don't use fmod because it rounds toward zero; GLSL specifies + * the use of floor. + */ + data.f[c] = (op[0]->value.f[c0] - op[1]->value.f[c1]) + * floorf(op[0]->value.f[c0] / op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + + break; + case ir_binop_logic_and: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) -- cgit v1.2.3 From 8984203abb711d5b9e763afc6afc8f52cc4f7cc2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 9 Jul 2010 12:12:41 -0700 Subject: glsl2/builtins: Rework min/max to use scalar/vector combinations. --- src/glsl/builtins/110/max | 27 +++--------------------- src/glsl/builtins/110/min | 27 +++--------------------- src/glsl/builtins/130/max | 54 ++++++----------------------------------------- src/glsl/builtins/130/min | 54 ++++++----------------------------------------- 4 files changed, 18 insertions(+), 144 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/110/max b/src/glsl/builtins/110/max index c05545f3d9..f91ae417e4 100644 --- a/src/glsl/builtins/110/max +++ b/src/glsl/builtins/110/max @@ -27,38 +27,17 @@ (parameters (declare (in) vec2 arg0) (declare (in) float arg1)) - ((declare () vec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) float arg1)) - ((declare () vec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float max (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) float arg1)) - ((declare () vec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float max (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression float max (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/110/min b/src/glsl/builtins/110/min index 31e7948940..78fc44120a 100644 --- a/src/glsl/builtins/110/min +++ b/src/glsl/builtins/110/min @@ -27,38 +27,17 @@ (parameters (declare (in) vec2 arg0) (declare (in) float arg1)) - ((declare () vec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) float arg1)) - ((declare () vec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float min (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) float arg1)) - ((declare () vec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float min (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression float min (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/130/max b/src/glsl/builtins/130/max index 45a6089c9f..0863e411a3 100644 --- a/src/glsl/builtins/130/max +++ b/src/glsl/builtins/130/max @@ -27,40 +27,19 @@ (parameters (declare (in) ivec2 arg0) (declare (in) int arg1)) - ((declare () ivec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) (signature ivec3 (parameters (declare (in) ivec3 arg0) (declare (in) int arg1)) - ((declare () ivec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression int max (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) (signature ivec4 (parameters (declare (in) ivec4 arg0) (declare (in) int arg1)) - ((declare () ivec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression int max (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression int max (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) (signature uint (parameters @@ -90,38 +69,17 @@ (parameters (declare (in) uvec2 arg0) (declare (in) uint arg1)) - ((declare () uvec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) (signature uvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uint arg1)) - ((declare () uvec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression uint max (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) (signature uvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uint arg1)) - ((declare () uvec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint max (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint max (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression uint max (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression uint max (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/130/min b/src/glsl/builtins/130/min index d98ec1e79d..576546f6f2 100644 --- a/src/glsl/builtins/130/min +++ b/src/glsl/builtins/130/min @@ -27,40 +27,19 @@ (parameters (declare (in) ivec2 arg0) (declare (in) int arg1)) - ((declare () ivec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) (signature ivec3 (parameters (declare (in) ivec3 arg0) (declare (in) int arg1)) - ((declare () ivec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression int min (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) (signature ivec4 (parameters (declare (in) ivec4 arg0) (declare (in) int arg1)) - ((declare () ivec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression int min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression int min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression int min (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression int min (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) (signature uint (parameters @@ -90,38 +69,17 @@ (parameters (declare (in) uvec2 arg0) (declare (in) uint arg1)) - ((declare () uvec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) (signature uvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uint arg1)) - ((declare () uvec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression uint min (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) (signature uvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uint arg1)) - ((declare () uvec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression uint min (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression uint min (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression uint min (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression uint min (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) )) -- cgit v1.2.3 From d5316aeb38865b3315a8a2b46f2c5bfd0d985d65 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 10 Jul 2010 12:54:41 -0700 Subject: glsl2/builtins: Rework clamp to use scalar/vector combinations. --- src/glsl/builtins/110/clamp | 18 +++--------------- src/glsl/builtins/130/clamp | 36 ++++++------------------------------ 2 files changed, 9 insertions(+), 45 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/110/clamp b/src/glsl/builtins/110/clamp index 94c8e5ed16..d05cc76dc2 100644 --- a/src/glsl/builtins/110/clamp +++ b/src/glsl/builtins/110/clamp @@ -32,31 +32,19 @@ (declare (in) vec2 arg0) (declare (in) float arg1) (declare (in) float arg2)) - ((declare () vec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) float arg1) (declare (in) float arg2)) - ((declare () vec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) float arg1) (declare (in) float arg2)) - ((declare () vec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) (expression vec4 max (expression vec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) )) diff --git a/src/glsl/builtins/130/clamp b/src/glsl/builtins/130/clamp index 3aed22c20d..e1aad5c8d9 100644 --- a/src/glsl/builtins/130/clamp +++ b/src/glsl/builtins/130/clamp @@ -32,33 +32,21 @@ (declare (in) ivec2 arg0) (declare (in) int arg1) (declare (in) int arg2)) - ((declare () ivec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature ivec3 (parameters (declare (in) ivec3 arg0) (declare (in) int arg1) (declare (in) int arg2)) - ((declare () ivec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature ivec4 (parameters (declare (in) ivec4 arg0) (declare (in) int arg1) (declare (in) int arg2)) - ((declare () ivec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature uint (parameters @@ -93,31 +81,19 @@ (declare (in) uvec2 arg0) (declare (in) uint arg1) (declare (in) uint arg2)) - ((declare () uvec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature uvec3 (parameters (declare (in) uvec3 arg0) (declare (in) uint arg1) (declare (in) uint arg2)) - ((declare () uvec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) (signature uvec4 (parameters (declare (in) uvec4 arg0) (declare (in) uint arg1) (declare (in) uint arg2)) - ((declare () uvec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) )) -- cgit v1.2.3 From 53120805a83a834349a96515d8e2dcbd622d06db Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 12 Jul 2010 13:54:36 -0700 Subject: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 216 ++++++------------------------------------ 1 file changed, 27 insertions(+), 189 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 5b3b49d310..1cf88ada16 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -438,33 +438,21 @@ static const char *builtins_110_clamp = { " (declare (in) vec2 arg0)\n" " (declare (in) float arg1)\n" " (declare (in) float arg2))\n" - " ((declare () vec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) float arg1)\n" " (declare (in) float arg2))\n" - " ((declare () vec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) float arg1)\n" " (declare (in) float arg2))\n" - " ((declare () vec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression vec4 max (expression vec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression vec4 max (expression vec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression vec4 max (expression vec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result)) (expression vec4 max (expression vec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "))\n" }; @@ -1218,40 +1206,19 @@ static const char *builtins_110_max = { " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression float max (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; @@ -1285,40 +1252,19 @@ static const char *builtins_110_min = { " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression float min (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; @@ -2995,33 +2941,21 @@ static const char *builtins_130_clamp = { " (declare (in) ivec2 arg0)\n" " (declare (in) int arg1)\n" " (declare (in) int arg2))\n" - " ((declare () ivec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature ivec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) int arg1)\n" " (declare (in) int arg2))\n" - " ((declare () ivec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) int arg1)\n" " (declare (in) int arg2))\n" - " ((declare () ivec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result)) (expression ivec4 max (expression ivec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature uint\n" " (parameters\n" @@ -3056,33 +2990,21 @@ static const char *builtins_130_clamp = { " (declare (in) uvec2 arg0)\n" " (declare (in) uint arg1)\n" " (declare (in) uint arg2))\n" - " ((declare () uvec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature uvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uint arg1)\n" " (declare (in) uint arg2))\n" - " ((declare () uvec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uint arg1)\n" " (declare (in) uint arg2))\n" - " ((declare () uvec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz x (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz y (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz z (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result)) (expression uvec4 max (expression uvec4 min (swiz w (var_ref arg0)) (var_ref arg2)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "))\n" }; @@ -3319,40 +3241,19 @@ static const char *builtins_130_max = { " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression int max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression int max (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uint\n" " (parameters\n" @@ -3382,40 +3283,19 @@ static const char *builtins_130_max = { " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint max (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint max (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression uint max (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression uint max (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; @@ -3449,40 +3329,19 @@ static const char *builtins_130_min = { " (parameters\n" " (declare (in) ivec2 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" " (declare (in) int arg1))\n" - " ((declare () ivec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression int min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression int min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression int min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression int min (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uint\n" " (parameters\n" @@ -3512,40 +3371,19 @@ static const char *builtins_130_min = { " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec3\n" " (parameters\n" " (declare (in) uvec3 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" " (declare (in) uvec4 arg0)\n" " (declare (in) uint arg1))\n" - " ((declare () uvec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression uint min (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression uint min (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression uint min (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression uint min (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; -- cgit v1.2.3 From 1fdcdb2dca97cdf4b8f4790aa66587ff3e89e526 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 14 Jul 2010 12:14:26 -0700 Subject: exec_list: Add a new replace_with method. --- src/glsl/list.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/list.h b/src/glsl/list.h index 48502fb4c8..29997c78ee 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -165,6 +165,17 @@ struct exec_node { this->prev->next = before; this->prev = before; } + /** + * Replace the current node with the given node. + */ + void replace_with(exec_node *replacement) + { + replacement->prev = this->prev; + replacement->next = this->next; + + this->prev->next = replacement; + this->next->prev = replacement; + } /** * Is this the sentinal at the tail of the list? -- cgit v1.2.3 From 17a307d154489d718ab51a6272d2054868d782f6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 14 Jul 2010 13:22:07 -0700 Subject: ast_function: Actually do type conversion on function arguments. --- src/glsl/ast_function.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 9315a92ecb..467722c868 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -31,6 +31,9 @@ inline unsigned min(unsigned a, unsigned b) return (a < b) ? a : b; } +static ir_rvalue * +convert_component(ir_rvalue *src, const glsl_type *desired_type); + static unsigned process_parameters(exec_list *instructions, exec_list *actual_parameters, exec_list *parameters, @@ -93,13 +96,15 @@ process_call(exec_list *instructions, ir_function *f, } } + if (formal->type->is_numeric() || formal->type->is_boolean()) { + ir_rvalue *converted = convert_component(actual, formal->type); + actual->replace_with(converted); + } + actual_iter.next(); formal_iter.next(); } - /* FINISHME: The list of actual parameters needs to be modified to - * FINISHME: include any necessary conversions. - */ return new(ctx) ir_call(sig, actual_parameters); } else { /* FINISHME: Log a better error message here. G++ will show the types -- cgit v1.2.3 From 87a2ee8db6222006480bd0e0ac58b77795c5d951 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 18 Jul 2010 17:47:15 -0700 Subject: glsl2: Fix warning from always-false assert not being known to not return. --- src/glsl/glsl_parser_extras.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index fc3f9e90b6..cb7b6d36a2 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -45,6 +45,7 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) } assert(!"Should not get here."); + return "unknown"; } -- cgit v1.2.3 From 9be7f638130f46a9df2bfbcd4a03b36de9e4f3aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Jul 2010 15:37:57 -0700 Subject: glsl2: Make cross() be an expression operation. ARB_fp, ARB_vp, Mesa IR, and the 965 vertex shader all have instructions for cross. Shaves 12 Mesa instructions off of a 66-instruction shader I have. --- src/glsl/builtin_function.cpp | 12 +----------- src/glsl/builtins/110/cross | 12 +----------- src/glsl/ir.cpp | 2 ++ src/glsl/ir.h | 1 + src/glsl/ir_constant_expression.cpp | 11 +++++++++++ src/mesa/shader/ir_to_mesa.cpp | 5 +++++ 6 files changed, 21 insertions(+), 22 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 1cf88ada16..b3a283306d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -486,17 +486,7 @@ static const char *builtins_110_cross = { " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1)))\n" - " (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1)))\n" - " (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t))\n" - " (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1)))\n" - " (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0)))))\n" - " (return (var_ref t))))\n" + " ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; diff --git a/src/glsl/builtins/110/cross b/src/glsl/builtins/110/cross index deb2f952bf..24717a2183 100644 --- a/src/glsl/builtins/110/cross +++ b/src/glsl/builtins/110/cross @@ -3,15 +3,5 @@ (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1)) - ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1))) - (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0))))) - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1))) - (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0))))) - (assign (constant bool (1)) (swiz z (var_ref t)) - (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1))) - (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0))))) - (return (var_ref t)))) + ((return (expression vec3 cross (var_ref arg0) (var_ref arg1))))) )) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 6d89913286..fcf5deced8 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -104,6 +104,7 @@ ir_expression::get_num_operands(ir_expression_operation op) 2, /* ir_binop_logic_or */ 2, /* ir_binop_dot */ + 2, /* ir_binop_cross */ 2, /* ir_binop_min */ 2, /* ir_binop_max */ @@ -163,6 +164,7 @@ static const char *const operator_strs[] = { "^^", "||", "dot", + "cross", "min", "max", "pow", diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 790173ed6b..9d7af2dcab 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -609,6 +609,7 @@ enum ir_expression_operation { ir_binop_logic_or, ir_binop_dot, + ir_binop_cross, ir_binop_min, ir_binop_max, diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c0fe47067b..ca834978f4 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -459,8 +459,19 @@ ir_constant_visitor::visit(ir_expression *ir) assert(0); } } + break; + case ir_binop_cross: + assert(op[0]->type == glsl_type::vec3_type); + assert(op[1]->type == glsl_type::vec3_type); + data.f[0] = (op[0]->value.f[1] * op[1]->value.f[2] - + op[1]->value.f[1] * op[0]->value.f[2]); + data.f[1] = (op[0]->value.f[2] * op[1]->value.f[0] - + op[1]->value.f[2] * op[0]->value.f[0]); + data.f[2] = (op[0]->value.f[0] * op[1]->value.f[1] - + op[1]->value.f[0] * op[0]->value.f[1]); break; + case ir_binop_add: assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); for (unsigned c = 0, c0 = 0, c1 = 0; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 6ecc6d317c..f99a1fc450 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -781,6 +781,11 @@ ir_to_mesa_visitor::visit(ir_expression *ir) op[0], op[1]); } break; + + case ir_binop_cross: + ir_to_mesa_emit_op2(ir, OPCODE_XPD, result_dst, op[0], op[1]); + break; + case ir_unop_sqrt: ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, result_src); -- cgit v1.2.3 From 1f47245bdda2c85bf0f0174e6c24a50486b413aa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 18 Jul 2010 17:45:16 -0700 Subject: glsl2: Remove the const disease from function signature's callee. --- src/glsl/ast_function.cpp | 3 +-- src/glsl/ir.cpp | 2 +- src/glsl/ir.h | 8 ++++---- src/glsl/ir_clone.cpp | 2 +- src/glsl/ir_reader.cpp | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 467722c868..aaf1e57ae2 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -64,8 +64,7 @@ process_call(exec_list *instructions, ir_function *f, { void *ctx = state; - const ir_function_signature *sig = - f->matching_signature(actual_parameters); + ir_function_signature *sig = f->matching_signature(actual_parameters); /* The instructions param will be used when the FINISHMEs below are done */ (void) instructions; diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index fcf5deced8..70905ddb80 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -839,7 +839,7 @@ ir_call::get_error_instruction(void *ctx) } void -ir_call::set_callee(const ir_function_signature *sig) +ir_call::set_callee(ir_function_signature *sig) { assert((this->type == NULL) || (this->type == sig->return_type)); diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 9d7af2dcab..042da94d85 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -661,7 +661,7 @@ public: */ class ir_call : public ir_rvalue { public: - ir_call(const ir_function_signature *callee, exec_list *actual_parameters) + ir_call(ir_function_signature *callee, exec_list *actual_parameters) : callee(callee) { assert(callee->return_type != NULL); @@ -706,7 +706,7 @@ public: return callee->function_name(); } - const ir_function_signature *get_callee() + ir_function_signature *get_callee() { return callee; } @@ -714,7 +714,7 @@ public: /** * Set the function call target */ - void set_callee(const ir_function_signature *sig); + void set_callee(ir_function_signature *sig); /** * Generates an inline version of the function before @ir, @@ -729,7 +729,7 @@ private: /* empty */ } - const ir_function_signature *callee; + ir_function_signature *callee; /* List of ir_rvalue of paramaters passed in this call. */ exec_list actual_parameters; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index c7b786f0c4..91d6977354 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -356,7 +356,7 @@ public: /* Try to find the function signature referenced by the ir_call in the * table. If it is found, replace it with the value from the table. */ - const ir_function_signature *const sig = + ir_function_signature *sig = (ir_function_signature *) hash_table_find(this->ht, ir->get_callee()); if (sig != NULL) ir->set_callee(sig); diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index c83f92ef57..a1e5a7ad74 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -632,7 +632,7 @@ read_call(_mesa_glsl_parse_state *st, s_list *list) return NULL; } - const ir_function_signature *callee = f->matching_signature(¶meters); + ir_function_signature *callee = f->matching_signature(¶meters); if (callee == NULL) { ir_read_error(st, list, "couldn't find matching signature for function " "%s", name->value()); -- cgit v1.2.3 From d16044ad4d6176fec6164f96450a25f76b7677f1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 09:05:42 -0700 Subject: glsl2: Give IR nodes a type field. This is a big deal for debugging if nothing else ("what class is this ir_instruction, really?"), but is also nice for avoiding building a whole visitor or an if (node->as_whatever() || node->as_other_thing()) chain. --- src/glsl/ir.cpp | 23 +++++++++++++++++++++-- src/glsl/ir.h | 42 ++++++++++++++++++++++++++++++++++-------- src/glsl/ir_validate.cpp | 15 +++++++++++++++ 3 files changed, 70 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 70905ddb80..1648848ecb 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -29,6 +29,7 @@ ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition) { + this->ir_type = ir_type_assignment; this->lhs = lhs; this->rhs = rhs; this->condition = condition; @@ -38,6 +39,7 @@ ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_expression::ir_expression(int op, const struct glsl_type *type, ir_rvalue *op0, ir_rvalue *op1) { + this->ir_type = ir_type_expression; this->type = type; this->operation = ir_expression_operation(op); this->operands[0] = op0; @@ -190,7 +192,7 @@ ir_expression::get_operator(const char *str) ir_constant::ir_constant() { - /* empty */ + this->ir_type = ir_type_constant; } ir_constant::ir_constant(const struct glsl_type *type, @@ -199,36 +201,42 @@ ir_constant::ir_constant(const struct glsl_type *type, assert((type->base_type >= GLSL_TYPE_UINT) && (type->base_type <= GLSL_TYPE_BOOL)); + this->ir_type = ir_type_constant; this->type = type; memcpy(& this->value, data, sizeof(this->value)); } ir_constant::ir_constant(float f) { + this->ir_type = ir_type_constant; this->type = glsl_type::float_type; this->value.f[0] = f; } ir_constant::ir_constant(unsigned int u) { + this->ir_type = ir_type_constant; this->type = glsl_type::uint_type; this->value.u[0] = u; } ir_constant::ir_constant(int i) { + this->ir_type = ir_type_constant; this->type = glsl_type::int_type; this->value.i[0] = i; } ir_constant::ir_constant(bool b) { + this->ir_type = ir_type_constant; this->type = glsl_type::bool_type; this->value.b[0] = b; } ir_constant::ir_constant(const ir_constant *c, unsigned i) { + this->ir_type = ir_type_constant; this->type = c->type->get_base_type(); switch (this->type->base_type) { @@ -242,6 +250,7 @@ ir_constant::ir_constant(const ir_constant *c, unsigned i) ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) { + this->ir_type = ir_type_constant; this->type = type; /* FINISHME: Support array types. */ @@ -454,6 +463,7 @@ ir_constant::has_value(const ir_constant *c) const ir_dereference_variable::ir_dereference_variable(ir_variable *var) { + this->ir_type = ir_type_dereference_variable; this->var = var; this->type = (var != NULL) ? var->type : glsl_type::error_type; } @@ -462,6 +472,7 @@ ir_dereference_variable::ir_dereference_variable(ir_variable *var) ir_dereference_array::ir_dereference_array(ir_rvalue *value, ir_rvalue *array_index) { + this->ir_type = ir_type_dereference_array; this->array_index = array_index; this->set_array(value); } @@ -472,6 +483,7 @@ ir_dereference_array::ir_dereference_array(ir_variable *var, { void *ctx = talloc_parent(var); + this->ir_type = ir_type_dereference_array; this->array_index = array_index; this->set_array(new(ctx) ir_dereference_variable(var)); } @@ -500,6 +512,7 @@ ir_dereference_array::set_array(ir_rvalue *value) ir_dereference_record::ir_dereference_record(ir_rvalue *value, const char *field) { + this->ir_type = ir_type_dereference_record; this->record = value; this->field = field; this->type = (this->record != NULL) @@ -512,6 +525,7 @@ ir_dereference_record::ir_dereference_record(ir_variable *var, { void *ctx = talloc_parent(var); + this->ir_type = ir_type_dereference_record; this->record = new(ctx) ir_dereference_variable(var); this->field = field; this->type = (this->record != NULL) @@ -624,6 +638,7 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, : val(val) { const unsigned components[4] = { x, y, z, w }; + this->ir_type = ir_type_swizzle; this->init_mask(components, count); } @@ -631,11 +646,13 @@ ir_swizzle::ir_swizzle(ir_rvalue *val, const unsigned *comp, unsigned count) : val(val) { + this->ir_type = ir_type_swizzle; this->init_mask(comp, count); } ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) { + this->ir_type = ir_type_swizzle; this->val = val; this->mask = mask; this->type = glsl_type::get_instance(val->type->base_type, @@ -736,6 +753,7 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name) shader_in(false), shader_out(false), mode(ir_var_auto), interpolation(ir_var_smooth), array_lvalue(false) { + this->ir_type = ir_type_variable; this->type = type; this->name = talloc_strdup(this, name); this->location = -1; @@ -775,7 +793,7 @@ ir_variable::component_slots() const ir_function_signature::ir_function_signature(const glsl_type *return_type) : return_type(return_type), is_defined(false), _function(NULL) { - /* empty */ + this->ir_type = ir_type_function_signature; } @@ -825,6 +843,7 @@ ir_function_signature::replace_parameters(exec_list *new_params) ir_function::ir_function(const char *name) { + this->ir_type = ir_type_function; this->name = talloc_strdup(this, name); } diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 042da94d85..389fe24326 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -41,11 +41,34 @@ extern "C" { #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #endif +enum ir_node_type { + ir_type_unset, + ir_type_variable, + ir_type_assignment, + ir_type_call, + ir_type_constant, + ir_type_dereference_array, + ir_type_dereference_record, + ir_type_dereference_variable, + ir_type_discard, + ir_type_expression, + ir_type_function, + ir_type_function_signature, + ir_type_if, + ir_type_loop, + ir_type_loop_jump, + ir_type_return, + ir_type_swizzle, + ir_type_texture, + ir_type_max, /**< maximum ir_type enum number, for validation */ +}; + /** * Base class of all IR instructions */ class ir_instruction : public exec_node { public: + enum ir_node_type ir_type; const struct glsl_type *type; class ir_constant *constant_expression_value(); @@ -84,7 +107,7 @@ public: protected: ir_instruction() { - /* empty */ + ir_type = ir_type_unset; } }; @@ -410,7 +433,7 @@ public: ir_if(ir_rvalue *condition) : condition(condition) { - /* empty */ + ir_type = ir_type_if; } virtual ir_if *clone(struct hash_table *ht) const; @@ -442,7 +465,7 @@ class ir_loop : public ir_instruction { public: ir_loop() : from(NULL), to(NULL), increment(NULL), counter(NULL) { - /* empty */ + ir_type = ir_type_loop; } virtual ir_loop *clone(struct hash_table *ht) const; @@ -664,6 +687,7 @@ public: ir_call(ir_function_signature *callee, exec_list *actual_parameters) : callee(callee) { + ir_type = ir_type_call; assert(callee->return_type != NULL); type = callee->return_type; actual_parameters->move_nodes_to(& this->actual_parameters); @@ -726,7 +750,7 @@ private: ir_call() : callee(NULL) { - /* empty */ + this->ir_type = ir_type_call; } ir_function_signature *callee; @@ -746,7 +770,7 @@ class ir_jump : public ir_instruction { protected: ir_jump() { - /* empty */ + ir_type = ir_type_unset; } }; @@ -755,13 +779,13 @@ public: ir_return() : value(NULL) { - /* empty */ + this->ir_type = ir_type_return; } ir_return(ir_rvalue *value) : value(value) { - /* empty */ + this->ir_type = ir_type_return; } virtual ir_return *clone(struct hash_table *) const; @@ -804,6 +828,7 @@ public: ir_loop_jump(jump_mode mode) { + this->ir_type = ir_type_loop_jump; this->mode = mode; this->loop = loop; } @@ -841,6 +866,7 @@ class ir_discard : public ir_jump { public: ir_discard() { + this->ir_type = ir_type_discard; this->condition = NULL; } @@ -898,7 +924,7 @@ public: ir_texture(enum ir_texture_opcode op) : op(op), projector(NULL), shadow_comparitor(NULL) { - /* empty */ + this->ir_type = ir_type_texture; } virtual ir_texture *clone(struct hash_table *) const; diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 4284f6b120..8a567954a1 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -172,10 +172,25 @@ ir_validate::validate_ir(ir_instruction *ir, void *data) hash_table_insert(ht, ir, ir); } +void +check_node_type(ir_instruction *ir, void *data) +{ + if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) { + printf("Instruction node with unset type\n"); + ir->print(); printf("\n"); + } +} + void validate_ir_tree(exec_list *instructions) { ir_validate v; v.run(instructions); + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + visit_tree(ir, check_node_type, NULL); + } } -- cgit v1.2.3 From 29ce44ad2b8d37ea54923f1d1856b44ef26903e5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 09:36:43 -0700 Subject: glsl2: Add a pass for converting if statements to conditional assignment. This will be used on 915 and similar hardware of that generation. --- src/glsl/Makefile | 1 + src/glsl/ir_if_to_cond_assign.cpp | 167 ++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + 3 files changed, 169 insertions(+) create mode 100644 src/glsl/ir_if_to_cond_assign.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index a36ff28a4b..c09735dff6 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -42,6 +42,7 @@ CXX_SOURCES = \ ir_hv_accept.cpp \ ir_if_return.cpp \ ir_if_simplification.cpp \ + ir_if_to_cond_assign.cpp \ ir_mat_op_to_vec.cpp \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ diff --git a/src/glsl/ir_if_to_cond_assign.cpp b/src/glsl/ir_if_to_cond_assign.cpp new file mode 100644 index 0000000000..274874bbb7 --- /dev/null +++ b/src/glsl/ir_if_to_cond_assign.cpp @@ -0,0 +1,167 @@ +/* + * 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 ir_if_to_cond_assign.cpp + * + * This attempts to flatten all if statements to conditional + * assignments for GPUs that don't do control flow. + * + * It can't handle other control flow being inside of its block, such + * as calls or loops. Hopefully loop unrolling and inlining will take + * care of those. + */ + +#include "glsl_types.h" +#include "ir.h" + +class ir_if_to_cond_assign_visitor : public ir_hierarchical_visitor { +public: + ir_if_to_cond_assign_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_if *); + + bool progress; +}; + +bool +do_if_to_cond_assign(exec_list *instructions) +{ + ir_if_to_cond_assign_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} + +void +check_control_flow(ir_instruction *ir, void *data) +{ + bool *found_control_flow = (bool *)data; + switch (ir->ir_type) { + case ir_type_call: + case ir_type_discard: + case ir_type_loop: + case ir_type_loop_jump: + case ir_type_return: + *found_control_flow = true; + break; + default: + break; + } +} + +void +move_block_to_cond_assign(void *mem_ctx, + ir_if *if_ir, ir_variable *cond_var, bool then) +{ + exec_list *instructions; + + if (then) { + instructions = &if_ir->then_instructions; + } else { + instructions = &if_ir->else_instructions; + } + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + if (ir->ir_type == ir_type_assignment) { + ir_assignment *assign = (ir_assignment *)ir; + ir_rvalue *cond_expr; + ir_dereference *deref = new(mem_ctx) ir_dereference_variable(cond_var); + + if (then) { + cond_expr = deref; + } else { + cond_expr = new(mem_ctx) ir_expression(ir_unop_logic_not, + glsl_type::bool_type, + deref, + NULL); + } + + if (!assign->condition) { + assign->condition = cond_expr; + } else { + assign->condition = new(mem_ctx) ir_expression(ir_binop_logic_and, + glsl_type::bool_type, + cond_expr, + assign->condition); + } + } + + /* Now, move from the if block to the block surrounding it. */ + ir->remove(); + if_ir->insert_before(ir); + } +} + +ir_visitor_status +ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) +{ + bool found_control_flow = false; + ir_variable *cond_var; + ir_assignment *assign; + ir_dereference_variable *deref; + + /* Check that both blocks don't contain anything we can't support. */ + foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + visit_tree(then_ir, check_control_flow, &found_control_flow); + } + foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + visit_tree(else_ir, check_control_flow, &found_control_flow); + } + if (found_control_flow) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + /* Store the condition to a variable so the assignment conditions are + * simpler. + */ + cond_var = new(mem_ctx) ir_variable(glsl_type::bool_type, + "if_to_cond_assign_condition"); + ir->insert_before(cond_var); + + deref = new(mem_ctx) ir_dereference_variable(cond_var); + assign = new(mem_ctx) ir_assignment(deref, + ir->condition, NULL); + ir->insert_before(assign); + + /* Now, move all of the instructions out of the if blocks, putting + * conditions on assignments. + */ + move_block_to_cond_assign(mem_ctx, ir, cond_var, true); + move_block_to_cond_assign(mem_ctx, ir, cond_var, false); + + ir->remove(); + + this->progress = true; + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index fae583df75..06cb4d22ca 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -41,6 +41,7 @@ bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_return(exec_list *instructions); bool do_if_simplification(exec_list *instructions); +bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); -- cgit v1.2.3 From 82d4b9593bd541b20771cddc1365add21dea6ba9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 10:31:03 -0700 Subject: glsl2: Fix the expression type for atan's pi * sign(y). Fixes CorrectFunction.vert. --- src/glsl/builtin_function.cpp | 8 ++++---- src/glsl/builtins/110/atan | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index b3a283306d..75e058c41c 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -292,7 +292,7 @@ static const char *builtins_110_atan = { " (expression float +\n" " (var_ref r)\n" " (expression float *\n" - " (expression int sign (var_ref y))\n" + " (expression float sign (var_ref y))\n" " (constant float (3.1415926))))))\n" " ()))\n" " ())\n" @@ -318,7 +318,7 @@ static const char *builtins_110_atan = { " (expression vec2 +\n" " (var_ref r)\n" " (expression vec2 *\n" - " (expression int sign (var_ref y))\n" + " (expression float sign (var_ref y))\n" " (constant float (3.1415926))))))\n" " ()))\n" " ())\n" @@ -344,7 +344,7 @@ static const char *builtins_110_atan = { " (expression vec3 +\n" " (var_ref r)\n" " (expression vec3 *\n" - " (expression int sign (var_ref y))\n" + " (expression float sign (var_ref y))\n" " (constant float (3.1415926))))))\n" " ()))\n" " ())\n" @@ -370,7 +370,7 @@ static const char *builtins_110_atan = { " (expression vec4 +\n" " (var_ref r)\n" " (expression vec4 *\n" - " (expression int sign (var_ref y))\n" + " (expression float sign (var_ref y))\n" " (constant float (3.1415926))))))\n" " ()))\n" " ())\n" diff --git a/src/glsl/builtins/110/atan b/src/glsl/builtins/110/atan index e5542350b5..bcf75718e4 100644 --- a/src/glsl/builtins/110/atan +++ b/src/glsl/builtins/110/atan @@ -67,7 +67,7 @@ (expression float + (var_ref r) (expression float * - (expression int sign (var_ref y)) + (expression float sign (var_ref y)) (constant float (3.1415926)))))) ())) ()) @@ -93,7 +93,7 @@ (expression vec2 + (var_ref r) (expression vec2 * - (expression int sign (var_ref y)) + (expression float sign (var_ref y)) (constant float (3.1415926)))))) ())) ()) @@ -119,7 +119,7 @@ (expression vec3 + (var_ref r) (expression vec3 * - (expression int sign (var_ref y)) + (expression float sign (var_ref y)) (constant float (3.1415926)))))) ())) ()) @@ -145,7 +145,7 @@ (expression vec4 + (var_ref r) (expression vec4 * - (expression int sign (var_ref y)) + (expression float sign (var_ref y)) (constant float (3.1415926)))))) ())) ()) -- cgit v1.2.3 From 5304493c40c5f450568fb518cb09940a72c1bc1d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Jul 2010 11:52:54 -0700 Subject: glsl2: Fix lexing of octal values, including "0". When faced with a constructor like 'ivec4(0, 2, 0, 0)', we would manage to get a value of 2 instead of 0 for the first "0". Usually 2 characters past "0" would point at some junk and lex as 0 anyway. Fixes glsl-octal and glsl-unused-varyings. --- src/glsl/glsl_lexer.lpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 6c1000876e..b0afc44d5e 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -231,7 +231,7 @@ void return VOID; return INTCONSTANT; } 0[0-7]* { - yylval->n = strtol(yytext + 2, NULL, 8); + yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; } -- cgit v1.2.3 From 9303e358cb3062f62c39961ebd4708bf63db03c1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 19 Jul 2010 12:33:54 -0700 Subject: linker: Move global instructions from the linked shader first For the shader containing 'main', use the linked shader (i.e., the clone of the original shader that contained main) as the source for global instructions to move into main. --- src/glsl/linker.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c71c07d6e9..d46744eeda 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -687,12 +687,16 @@ link_intrastage_shaders(struct gl_shader_program *prog, /* Move any instructions other than variable declarations or function * declarations into main. */ - exec_node *insertion_point = (exec_node *) &main_sig->body; + exec_node *insertion_point = + move_non_declarations(linked->ir, (exec_node *) &main_sig->body, false, + linked); + for (unsigned i = 0; i < num_shaders; i++) { + if (shader_list[i] == main) + continue; + insertion_point = move_non_declarations(shader_list[i]->ir, - insertion_point, - (shader_list[i] != main), - linked); + insertion_point, true, linked); } /* Resolve initializers for global variables in the linked shader. -- cgit v1.2.3 From 303c99f12fd1234a763147f9e081f2544433fc77 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 19 Jul 2010 12:34:56 -0700 Subject: linker: Use foreach_list_safe in move_non_declarations The node being processed may be removed from the list and put in a different list. Not using the safe version caused list processing to change streams after moving a node. --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index d46744eeda..72b83ff992 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -543,7 +543,7 @@ exec_node * move_non_declarations(exec_list *instructions, exec_node *last, bool make_copies, gl_shader *target) { - foreach_list(node, instructions) { + foreach_list_safe(node, instructions) { ir_instruction *inst = (ir_instruction *) node; if (inst->as_variable() || inst->as_function()) -- cgit v1.2.3 From 61a44ccaef63a8ad36ebd934e6944ede5587e4d5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 19 Jul 2010 14:49:34 -0700 Subject: exec_list: Fix foreach_list_safe. It now works correctly when nodes are removed, as it was originally intended to do; it no longer processes nodes added to the list before the current node, nor those added immediately after the current node. This matches the behavior of Linux's list_for_each_safe. --- src/glsl/ir_hv_accept.cpp | 5 +++-- src/glsl/list.h | 16 +++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index 46bc5b17fe..8989605e26 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -32,9 +32,10 @@ /** * Process a list of nodes using a hierarchical vistor * + * \warning * This function will operate correctly if a node being processed is removed - * from the list. If nodes are inserted before the current node, they will be - * processed next. + * from the list. However, if nodes are added to the list after the node being + * processed, some of the added nodes may not be processed. */ ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l) diff --git a/src/glsl/list.h b/src/glsl/list.h index 29997c78ee..7348e323c1 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -433,18 +433,12 @@ struct exec_list { }; /** - * This version is safe even if the current node is removed. If you insert - * new nodes before the current node, they will be processed next. - * - * \note - * The extra test for \c __node being \c NULL is required because after the - * iteration \c __prev coupld be the last node in the list. The loop increment - * then causes \c __prev to point to the sentinal and \c __node to be \c NULL. + * This version is safe even if the current node is removed. */ -#define foreach_list_safe(__node, __list) \ - for (exec_node * __prev = (exec_node *) (__list), * __node = (__list)->head \ - ; __node != NULL && (__node)->next != NULL \ - ; __prev = (__prev)->next, __node = (__prev)->next) +#define foreach_list_safe(__node, __list) \ + for (exec_node * __node = (__list)->head, * __next = __node->next \ + ; __next != NULL \ + ; __node = __next, __next = __next->next) #define foreach_list(__node, __list) \ for (exec_node * __node = (__list)->head \ -- cgit v1.2.3 From 3880d07f4bde3f3743bad6e0f5966276c476fb21 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 13 Jul 2010 17:31:12 -0700 Subject: linker: Remove some unnecessary includes --- src/glsl/linker.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 72b83ff992..155c9d40b3 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -73,9 +73,7 @@ extern "C" { #include "main/mtypes.h" #include "glsl_symbol_table.h" -#include "glsl_parser_extras.h" #include "ir.h" -#include "ir_optimization.h" #include "program.h" #include "hash_table.h" #include "shader_api.h" -- cgit v1.2.3 From a48a2b66e86d6d1c2fbb24bc60df2fdef42b3086 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 13 Jul 2010 17:34:02 -0700 Subject: ir_function_signature: Make actual_parameters public --- src/glsl/ir.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 389fe24326..ff91a8dbce 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -746,6 +746,9 @@ public: */ ir_rvalue *generate_inline(ir_instruction *ir); + /* List of ir_rvalue of paramaters passed in this call. */ + exec_list actual_parameters; + private: ir_call() : callee(NULL) @@ -754,9 +757,6 @@ private: } ir_function_signature *callee; - - /* List of ir_rvalue of paramaters passed in this call. */ - exec_list actual_parameters; }; -- cgit v1.2.3 From 8fe8a814b0c746f0f655a67f8755f9dee858d230 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 13 Jul 2010 17:36:13 -0700 Subject: linker: First bits of intrastage, intershader function linking This handles the easy case of linking a function in a different compilation unit that doesn't call any functions or reference any global variables. --- src/glsl/Makefile | 1 + src/glsl/link_functions.cpp | 176 ++++++++++++++++++++++++++++++++++++++++++++ src/glsl/linker.cpp | 2 + src/glsl/linker.h | 35 +++++++++ 4 files changed, 214 insertions(+) create mode 100644 src/glsl/link_functions.cpp create mode 100644 src/glsl/linker.h (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index c09735dff6..497f6ca1a0 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -53,6 +53,7 @@ CXX_SOURCES = \ ir_vec_index_to_cond_assign.cpp \ ir_vec_index_to_swizzle.cpp \ linker.cpp \ + link_functions.cpp \ s_expression.cpp LIBS = \ diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp new file mode 100644 index 0000000000..35bd22350d --- /dev/null +++ b/src/glsl/link_functions.cpp @@ -0,0 +1,176 @@ +/* + * 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 +#include +#include + +extern "C" { +#include +} + +#include "main/mtypes.h" +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "ir.h" +#include "program.h" +#include "hash_table.h" +#include "linker.h" + +class call_link_visitor : public ir_hierarchical_visitor { +public: + call_link_visitor(gl_shader_program *prog, gl_shader **shader_list, + unsigned num_shaders) + { + this->prog = prog; + this->shader_list = shader_list; + this->num_shaders = num_shaders; + this->success = true; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + /* If the function call references a function signature that does not + * have a definition, try to find the definition in one of the other + * shaders. + */ + ir_function_signature *callee = + const_cast(ir->get_callee()); + assert(callee != NULL); + + if (callee->is_defined) + /* FINISHME: Do children need to be processed, or are all parameters + * FINISHME: with function calls already flattend? + */ + return visit_continue; + + const char *const name = callee->function_name(); + + ir_function_signature *sig = const_cast + (this->find_matching_signature(name, &ir->actual_parameters)); + if (sig == NULL) { + /* FINISHME: Log the full signature of unresolved function. + */ + linker_error_printf(this->prog, "unresolved reference to function " + "`%s'\n", name); + this->success = false; + return visit_stop; + } + + /* Create an in-place clone of the function definition. This multistep + * process introduces some complexity here, but it has some advantages. + * The parameter list and the and function body are cloned separately. + * The clone of the parameter list is used to prime the hashtable used + * to replace variable references in the cloned body. + * + * The big advantage is that the ir_function_signature does not change. + * This means that we don't have to process the rest of the IR tree to + * patch ir_call nodes. In addition, there is no way to remove or replace + * signature stored in a function. One could easily be added, but this + * avoids the need. + */ + struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + exec_list formal_parameters; + foreach_list_const(node, &sig->parameters) { + const ir_instruction *const original = (ir_instruction *) node; + assert(const_cast(original)->as_variable()); + + ir_instruction *copy = original->clone(ht); + formal_parameters.push_tail(copy); + } + + callee->replace_parameters(&formal_parameters); + + assert(callee->body.is_empty()); + foreach_list_const(node, &sig->body) { + const ir_instruction *const original = (ir_instruction *) node; + + ir_instruction *copy = original->clone(ht); + callee->body.push_tail(copy); + } + + callee->is_defined = true; + + /* FINISHME: Patch references inside the function to things outside the + * FINISHME: function (i.e., function calls and global variables). + */ + + hash_table_dtor(ht); + + return visit_continue; + } + + /** Was function linking successful? */ + bool success; + +private: + /** + * Shader program being linked + * + * This is only used for logging error messages. + */ + gl_shader_program *prog; + + /** List of shaders available for linking. */ + gl_shader **shader_list; + + /** Number of shaders available for linking. */ + unsigned num_shaders; + + /** + * Searches all shaders for a particular function definition + */ + const ir_function_signature * + find_matching_signature(const char *name, exec_list *actual_parameters) + { + for (unsigned i = 0; i < this->num_shaders; i++) { + ir_function *const f = + this->shader_list[i]->symbols->get_function(name); + + if (f == NULL) + continue; + + const ir_function_signature *sig = + f->matching_signature(actual_parameters); + + if ((sig == NULL) || !sig->is_defined) + continue; + + return sig; + } + + return NULL; + } +}; + + +bool +link_function_calls(gl_shader_program *prog, gl_shader *main, + gl_shader **shader_list, unsigned num_shaders) +{ + call_link_visitor v(prog, shader_list, num_shaders); + + v.run(main->ir); + return v.success; +} diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 155c9d40b3..f7c178e967 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -77,6 +77,7 @@ extern "C" { #include "program.h" #include "hash_table.h" #include "shader_api.h" +#include "linker.h" /** * Visitor that determines whether or not a variable is ever written. @@ -699,6 +700,7 @@ link_intrastage_shaders(struct gl_shader_program *prog, /* Resolve initializers for global variables in the linked shader. */ + link_function_calls(prog, linked, shader_list, num_shaders); return linked; } diff --git a/src/glsl/linker.h b/src/glsl/linker.h new file mode 100644 index 0000000000..a8ce16a7ec --- /dev/null +++ b/src/glsl/linker.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#pragma once +#ifndef GLSL_LINKER_H +#define GLSL_LINKER_H + +extern void +linker_error_printf(gl_shader_program *prog, const char *fmt, ...); + +extern bool +link_function_calls(gl_shader_program *prog, gl_shader *main, + gl_shader **shader_list, unsigned num_shaders); + +#endif /* GLSL_LINKER_H */ -- cgit v1.2.3 From de415b7f4b1278f10097f4af80886bc82912dd92 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 14 Jul 2010 13:22:12 -0700 Subject: linker: Add comment about bug in initializer handling --- src/glsl/linker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index f7c178e967..06aa24e66f 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -314,6 +314,14 @@ cross_validate_globals(struct gl_shader_program *prog, * have an initializer but a later instance does, copy the * initializer to the version stored in the symbol table. */ + /* FINISHME: This is wrong. The constant_value field should + * FINISHME: not be modified! Imagine a case where a shader + * FINISHME: without an initializer is linked in two different + * FINISHME: programs with shaders that have differing + * FINISHME: initializers. Linking with the first will + * FINISHME: modify the shader, and linking with the second + * FINISHME: will fail. + */ existing->constant_value = var->constant_value->clone(NULL); } } else -- cgit v1.2.3 From b95897b89d36a25c237a021c299a4eb295856476 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 15 Jul 2010 13:09:25 -0700 Subject: glsl2: Explicitly walk lists in ir_function::parameter_lists_match Give ir_function::parameter_lists_match_exist similar treatment. Make the parameters const, and propogate the constness as far as it will trivially go. --- src/glsl/ir.h | 4 ++-- src/glsl/ir_function.cpp | 44 +++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 25 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index ff91a8dbce..1d667be89c 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -398,13 +398,13 @@ public: * Find a signature that matches a set of actual parameters, taking implicit * conversions into account. */ - ir_function_signature *matching_signature(exec_list *actual_param); + ir_function_signature *matching_signature(const exec_list *actual_param); /** * Find a signature that exactly matches a set of actual parameters without * any implicit type conversions. */ - ir_function_signature *exact_matching_signature(exec_list *actual_ps); + ir_function_signature *exact_matching_signature(const exec_list *actual_ps); /** * Name of the function. diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index fcdb83be56..e85b18ce02 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -87,23 +87,25 @@ type_compare(const glsl_type *a, const glsl_type *b) static int -parameter_lists_match(exec_list *list_a, exec_list *list_b) +parameter_lists_match(const exec_list *list_a, const exec_list *list_b) { - exec_list_iterator iter_a = list_a->iterator(); - exec_list_iterator iter_b = list_b->iterator(); + const exec_node *node_a = list_a->head; + const exec_node *node_b = list_b->head; int total_score = 0; - for (/* empty */ ; iter_a.has_next(); iter_a.next(), iter_b.next()) { + for (/* empty */ + ; !node_a->is_tail_sentinal() + ; node_a = node_a->next, node_b = node_b->next) { /* If all of the parameters from the other parameter list have been * exhausted, the lists have different length and, by definition, * do not match. */ - if (!iter_b.has_next()) + if (node_b->is_tail_sentinal()) return -1; - const ir_variable *const param = (ir_variable *) iter_a.get(); - const ir_instruction *const actual = (ir_instruction *) iter_b.get(); + const ir_variable *const param = (ir_variable *) node_a; + const ir_instruction *const actual = (ir_instruction *) node_b; /* Determine whether or not the types match. If the types are an * exact match, the match score is zero. If the types don't match @@ -148,7 +150,7 @@ parameter_lists_match(exec_list *list_a, exec_list *list_b) * exhausted, the lists have different length and, by definition, do not * match. */ - if (iter_b.has_next()) + if (!node_b->is_tail_sentinal()) return -1; return total_score; @@ -156,7 +158,7 @@ parameter_lists_match(exec_list *list_a, exec_list *list_b) ir_function_signature * -ir_function::matching_signature(exec_list *actual_parameters) +ir_function::matching_signature(const exec_list *actual_parameters) { ir_function_signature *match = NULL; @@ -183,36 +185,32 @@ ir_function::matching_signature(exec_list *actual_parameters) static bool -parameter_lists_match_exact(exec_list *list_a, exec_list *list_b) +parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b) { - exec_list_iterator iter_a = list_a->iterator(); - exec_list_iterator iter_b = list_b->iterator(); + const exec_node *node_a = list_a->head; + const exec_node *node_b = list_b->head; - while (iter_a.has_next() && iter_b.has_next()) { - ir_variable *a = (ir_variable *)iter_a.get(); - ir_variable *b = (ir_variable *)iter_b.get(); + for (/* empty */ + ; !node_a->is_tail_sentinal() && !node_b->is_tail_sentinal() + ; node_a = node_a->next, node_b = node_b->next) { + ir_variable *a = (ir_variable *) node_a; + ir_variable *b = (ir_variable *) node_b; /* If the types of the parameters do not match, the parameters lists * are different. */ if (a->type != b->type) return false; - - iter_a.next(); - iter_b.next(); } /* Unless both lists are exhausted, they differ in length and, by * definition, do not match. */ - if (iter_a.has_next() != iter_b.has_next()) - return false; - - return true; + return (node_a->is_tail_sentinal() == node_b->is_tail_sentinal()); } ir_function_signature * -ir_function::exact_matching_signature(exec_list *actual_parameters) +ir_function::exact_matching_signature(const exec_list *actual_parameters) { foreach_iter(exec_list_iterator, iter, signatures) { ir_function_signature *const sig = -- cgit v1.2.3 From 5adbf0bff168c088d9fd5140226b76e3ba6471b8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 15 Jul 2010 13:32:27 -0700 Subject: linker: Pull find_matching_signature out of call_link_visitor The list of shaders to search needs to be provided as an explicit parameter to support coming changes. At that point there is no reason for it to be in the class. Also, fix some of the 'const' decorators. --- src/glsl/link_functions.cpp | 48 +++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 35bd22350d..28e56cb0fa 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -37,6 +37,10 @@ extern "C" { #include "hash_table.h" #include "linker.h" +static ir_function_signature * +find_matching_signature(const char *name, const exec_list *actual_parameters, + gl_shader **shader_list, unsigned num_shaders); + class call_link_visitor : public ir_hierarchical_visitor { public: call_link_visitor(gl_shader_program *prog, gl_shader **shader_list, @@ -66,8 +70,9 @@ public: const char *const name = callee->function_name(); - ir_function_signature *sig = const_cast - (this->find_matching_signature(name, &ir->actual_parameters)); + ir_function_signature *sig = + find_matching_signature(name, &ir->actual_parameters, shader_list, + num_shaders); if (sig == NULL) { /* FINISHME: Log the full signature of unresolved function. */ @@ -138,31 +143,32 @@ private: /** Number of shaders available for linking. */ unsigned num_shaders; - /** - * Searches all shaders for a particular function definition - */ - const ir_function_signature * - find_matching_signature(const char *name, exec_list *actual_parameters) - { - for (unsigned i = 0; i < this->num_shaders; i++) { - ir_function *const f = - this->shader_list[i]->symbols->get_function(name); +}; + - if (f == NULL) - continue; +/** + * Searches a list of shaders for a particular function definition + */ +ir_function_signature * +find_matching_signature(const char *name, const exec_list *actual_parameters, + gl_shader **shader_list, unsigned num_shaders) +{ + for (unsigned i = 0; i < num_shaders; i++) { + ir_function *const f = shader_list[i]->symbols->get_function(name); - const ir_function_signature *sig = - f->matching_signature(actual_parameters); + if (f == NULL) + continue; - if ((sig == NULL) || !sig->is_defined) - continue; + ir_function_signature *sig = f->matching_signature(actual_parameters); - return sig; - } + if ((sig == NULL) || !sig->is_defined) + continue; - return NULL; + return sig; } -}; + + return NULL; +} bool -- cgit v1.2.3 From 532c2d30850908b75f4b0ad0aa5fa7ce88f8202d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 15 Jul 2010 19:28:32 -0700 Subject: linker: look up function signatures during linking instead of using callee Instead of using ir_call::callee, search for the signature in the linked shader. This will allow resolving calls from functions imported from other shaders. The ir_call::callee pointer in the imported function will still reference a signature in the original shader. --- src/glsl/link_functions.cpp | 83 ++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 24 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 28e56cb0fa..721bec65f3 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -43,36 +43,43 @@ find_matching_signature(const char *name, const exec_list *actual_parameters, class call_link_visitor : public ir_hierarchical_visitor { public: - call_link_visitor(gl_shader_program *prog, gl_shader **shader_list, - unsigned num_shaders) + call_link_visitor(gl_shader_program *prog, gl_shader *linked, + gl_shader **shader_list, unsigned num_shaders) { this->prog = prog; this->shader_list = shader_list; this->num_shaders = num_shaders; this->success = true; + this->linked = linked; } virtual ir_visitor_status visit_enter(ir_call *ir) { - /* If the function call references a function signature that does not - * have a definition, try to find the definition in one of the other - * shaders. + /* If ir is an ir_call from a function that was imported from another + * shader callee will point to an ir_function_signature in the original + * shader. In this case the function signature MUST NOT BE MODIFIED. + * Doing so will modify the original shader. This may prevent that + * shader from being linkable in other programs. */ - ir_function_signature *callee = - const_cast(ir->get_callee()); + const ir_function_signature *const callee = ir->get_callee(); assert(callee != NULL); - - if (callee->is_defined) - /* FINISHME: Do children need to be processed, or are all parameters - * FINISHME: with function calls already flattend? - */ - return visit_continue; - const char *const name = callee->function_name(); + /* Determine if the requested function signature already exists in the + * final linked shader. If it does, use it as the target of the call. + */ ir_function_signature *sig = - find_matching_signature(name, &ir->actual_parameters, shader_list, - num_shaders); + find_matching_signature(name, &callee->parameters, &linked, 1); + if (sig != NULL) { + ir->set_callee(sig); + return visit_continue; + } + + /* Try to find the signature in one of the other shaders that is being + * linked. If it's not found there, return an error. + */ + sig = find_matching_signature(name, &ir->actual_parameters, shader_list, + num_shaders); if (sig == NULL) { /* FINISHME: Log the full signature of unresolved function. */ @@ -82,6 +89,27 @@ public: return visit_stop; } + /* Find the prototype information in the linked shader. Generate any + * details that may be missing. + */ + ir_function *f = linked->symbols->get_function(name); + if (f == NULL) + f = new(linked) ir_function(name); + + ir_function_signature *linked_sig = + f->matching_signature(&callee->parameters); + if (linked_sig == NULL) { + linked_sig = new(linked) ir_function_signature(callee->return_type); + f->add_signature(linked_sig); + } + + /* At this point linked_sig and called may be the same. If ir is an + * ir_call from linked then linked_sig and callee will be + * ir_function_signatures that have no definitions (is_defined is false). + */ + assert(!linked_sig->is_defined); + assert(linked_sig->body.is_empty()); + /* Create an in-place clone of the function definition. This multistep * process introduces some complexity here, but it has some advantages. * The parameter list and the and function body are cloned separately. @@ -90,9 +118,9 @@ public: * * The big advantage is that the ir_function_signature does not change. * This means that we don't have to process the rest of the IR tree to - * patch ir_call nodes. In addition, there is no way to remove or replace - * signature stored in a function. One could easily be added, but this - * avoids the need. + * patch ir_call nodes. In addition, there is no way to remove or + * replace signature stored in a function. One could easily be added, + * but this avoids the need. */ struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); @@ -105,17 +133,16 @@ public: formal_parameters.push_tail(copy); } - callee->replace_parameters(&formal_parameters); + linked_sig->replace_parameters(&formal_parameters); - assert(callee->body.is_empty()); foreach_list_const(node, &sig->body) { const ir_instruction *const original = (ir_instruction *) node; ir_instruction *copy = original->clone(ht); - callee->body.push_tail(copy); + linked_sig->body.push_tail(copy); } - callee->is_defined = true; + linked_sig->is_defined = true; /* FINISHME: Patch references inside the function to things outside the * FINISHME: function (i.e., function calls and global variables). @@ -143,6 +170,14 @@ private: /** Number of shaders available for linking. */ unsigned num_shaders; + /** + * Final linked shader + * + * This is used two ways. It is used to find global variables in the + * linked shader that are accessed by the function. It is also used to add + * global variables from the shader where the function originated. + */ + gl_shader *linked; }; @@ -175,7 +210,7 @@ bool link_function_calls(gl_shader_program *prog, gl_shader *main, gl_shader **shader_list, unsigned num_shaders) { - call_link_visitor v(prog, shader_list, num_shaders); + call_link_visitor v(prog, main, shader_list, num_shaders); v.run(main->ir); return v.success; -- cgit v1.2.3 From fc9ae101b4b7a71ca7a5d4f185e887064007e0d1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 15 Jul 2010 20:20:36 -0700 Subject: linker: Recursively resolve function calls in imported functions --- src/glsl/link_functions.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 721bec65f3..a9ed49a349 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -51,6 +51,20 @@ public: this->num_shaders = num_shaders; this->success = true; this->linked = linked; + + this->locals = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + } + + ~call_link_visitor() + { + hash_table_dtor(this->locals); + } + + virtual ir_visitor_status visit(ir_variable *ir) + { + hash_table_insert(locals, ir, ir); + return visit_continue; } virtual ir_visitor_status visit_enter(ir_call *ir) @@ -143,12 +157,36 @@ public: } linked_sig->is_defined = true; + hash_table_dtor(ht); - /* FINISHME: Patch references inside the function to things outside the - * FINISHME: function (i.e., function calls and global variables). + /* Patch references inside the function to things outside the function + * (i.e., function calls and global variables). */ + linked_sig->accept(this); - hash_table_dtor(ht); + return visit_continue; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + if (hash_table_find(locals, ir->var) == NULL) { + /* The non-function variable must be a global, so try to find the + * variable in the shader's symbol table. If the variable is not + * found, then it's a global that *MUST* be defined in the original + * shader. + */ + ir_variable *var = linked->symbols->get_variable(ir->var->name); + if (var == NULL) { + /* Clone the ir_variable that the dereference already has and add + * it to the linked shader. + */ + var = ir->var->clone(NULL); + linked->symbols->add_variable(var->name, var); + linked->ir->push_head(var); + } + + ir->var = var; + } return visit_continue; } @@ -178,6 +216,11 @@ private: * global variables from the shader where the function originated. */ gl_shader *linked; + + /** + * Table of variables local to the function. + */ + hash_table *locals; }; -- cgit v1.2.3 From b64e979971e764ec1df8800d31c755298e618ba0 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 16 Jul 2010 15:31:23 -0700 Subject: glsl2: Use Elements macro --- src/glsl/builtin_function.cpp | 22 +++++++++++++--------- src/glsl/builtins/tools/generate_builtins.pl | 7 +++++-- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 75e058c41c..fbb2638fc9 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -4748,6 +4748,10 @@ static const char *functions_for_EXT_texture_array_fs [] = { builtins_EXT_texture_array_fs_textures, }; +#ifndef Elements +#define Elements(x) (sizeof(x)/sizeof(*(x))) +#endif + void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -4755,46 +4759,46 @@ _mesa_glsl_initialize_functions(exec_list *instructions, if (state->language_version >= 110) read_builtins(state, instructions, functions_for_110, - sizeof(functions_for_110) / sizeof(const char *)); + Elements(functions_for_110)); if (state->target == fragment_shader && state->language_version >= 110) read_builtins(state, instructions, functions_for_110_fs, - sizeof(functions_for_110_fs) / sizeof(const char *)); + Elements(functions_for_110_fs)); if (state->target == vertex_shader && state->language_version >= 110) read_builtins(state, instructions, functions_for_110_vs, - sizeof(functions_for_110_vs) / sizeof(const char *)); + Elements(functions_for_110_vs)); if (state->language_version >= 120) read_builtins(state, instructions, functions_for_120, - sizeof(functions_for_120) / sizeof(const char *)); + Elements(functions_for_120)); if (state->language_version >= 130) read_builtins(state, instructions, functions_for_130, - sizeof(functions_for_130) / sizeof(const char *)); + Elements(functions_for_130)); if (state->target == fragment_shader && state->language_version >= 130) read_builtins(state, instructions, functions_for_130_fs, - sizeof(functions_for_130_fs) / sizeof(const char *)); + Elements(functions_for_130_fs)); if (state->ARB_texture_rectangle_enable) read_builtins(state, instructions, functions_for_ARB_texture_rectangle, - sizeof(functions_for_ARB_texture_rectangle) / sizeof(const char *)); + Elements(functions_for_ARB_texture_rectangle)); if (state->EXT_texture_array_enable) read_builtins(state, instructions, functions_for_EXT_texture_array, - sizeof(functions_for_EXT_texture_array) / sizeof(const char *)); + Elements(functions_for_EXT_texture_array)); if (state->target == fragment_shader && state->EXT_texture_array_enable) read_builtins(state, instructions, functions_for_EXT_texture_array_fs, - sizeof(functions_for_EXT_texture_array_fs) / sizeof(const char *)); + Elements(functions_for_EXT_texture_array_fs)); } diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl index 8b640ab8ff..a0b5c1f421 100755 --- a/src/glsl/builtins/tools/generate_builtins.pl +++ b/src/glsl/builtins/tools/generate_builtins.pl @@ -91,6 +91,10 @@ foreach $version (@versions) { } print << 'EOF'; +#ifndef Elements +#define Elements(x) (sizeof(x)/sizeof(*(x))) +#endif + void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -116,8 +120,7 @@ foreach $version_xs (@versions) { print " if ($check)\n"; print " read_builtins(state, instructions,\n"; print " functions_for_$version_xs,\n"; - print " sizeof(functions_for_$version_xs) / "; - print "sizeof(const char *));\n\n" + print " Elements(functions_for_$version_xs));\n\n" } print "}\n"; -- cgit v1.2.3 From 25f51d3b9b8c36c41cd23d2797b6a06f6e27ff86 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 16 Jul 2010 15:51:50 -0700 Subject: linker: Track and validate GLSL versions used in shaders --- src/glsl/linker.cpp | 21 +++++++++++++++++++++ src/glsl/main.cpp | 1 + src/mesa/main/mtypes.h | 4 ++++ src/mesa/shader/ir_to_mesa.cpp | 1 + 4 files changed, 27 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 06aa24e66f..4933686b5e 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -66,12 +66,14 @@ #include #include #include +#include extern "C" { #include } #include "main/mtypes.h" +#include "main/macros.h" #include "glsl_symbol_table.h" #include "ir.h" #include "program.h" @@ -1107,7 +1109,12 @@ link_shaders(struct gl_shader_program *prog) calloc(2 * prog->NumShaders, sizeof(struct gl_shader *)); frag_shader_list = &vert_shader_list[prog->NumShaders]; + unsigned min_version = UINT_MAX; + unsigned max_version = 0; for (unsigned i = 0; i < prog->NumShaders; i++) { + min_version = MIN2(min_version, prog->Shaders[i]->Version); + max_version = MAX2(max_version, prog->Shaders[i]->Version); + switch (prog->Shaders[i]->Type) { case GL_VERTEX_SHADER: vert_shader_list[num_vert_shaders] = prog->Shaders[i]; @@ -1124,6 +1131,20 @@ link_shaders(struct gl_shader_program *prog) } } + /* Previous to GLSL version 1.30, different compilation units could mix and + * match shading language versions. With GLSL 1.30 and later, the versions + * of all shaders must match. + */ + assert(min_version >= 110); + assert(max_version <= 130); + if ((max_version >= 130) && (min_version != max_version)) { + linker_error_printf(prog, "all shaders must use same shading " + "language version\n"); + goto done; + } + + prog->Version = max_version; + /* FINISHME: Implement intra-stage linking. */ prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 8b0bccdcb7..e27d9c1d85 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -207,6 +207,7 @@ compile_shader(struct gl_shader *shader) shader->symbols = state->symbols; shader->CompileStatus = !state->error; + shader->Version = state->language_version; if (shader->InfoLog) talloc_free(shader->InfoLog); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index be9eaaa875..729c2eaf0f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1967,6 +1967,8 @@ struct gl_shader GLchar *InfoLog; struct gl_sl_pragmas Pragmas; + unsigned Version; /**< GLSL version used for linking */ + struct exec_list *ir; struct glsl_symbol_table *symbols; }; @@ -2006,6 +2008,8 @@ struct gl_shader_program GLboolean _Used; /**< Ever used for drawing? */ GLchar *InfoLog; + unsigned Version; /**< GLSL version used for linking */ + /** * Per-stage shaders resulting from the first stage of linking. */ diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 58320c9217..557f5d319d 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2234,6 +2234,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) shader->CompileStatus = !state->error; shader->InfoLog = state->info_log; + shader->Version = state->language_version; /* Retain any live IR, but trash the rest. */ foreach_list(node, shader->ir) { -- cgit v1.2.3 From 1a03a644d2f933fbbbe535e584a92fdf1ad619f1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 16 Jul 2010 15:52:40 -0700 Subject: linker: Remove redundant check for 'main' in shaders This is now handled in link_intrastage_shaders. --- src/glsl/linker.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 4933686b5e..a4776b1941 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -192,11 +192,6 @@ validate_vertex_shader_executable(struct gl_shader_program *prog, if (shader == NULL) return true; - if (!shader->symbols->get_function("main")) { - linker_error_printf(prog, "vertex shader lacks `main'\n"); - return false; - } - find_assignment_visitor find("gl_Position"); find.run(shader->ir); if (!find.variable_found()) { @@ -221,11 +216,6 @@ validate_fragment_shader_executable(struct gl_shader_program *prog, if (shader == NULL) return true; - if (!shader->symbols->get_function("main")) { - linker_error_printf(prog, "fragment shader lacks `main'\n"); - return false; - } - find_assignment_visitor frag_color("gl_FragColor"); find_assignment_visitor frag_data("gl_FragData"); -- cgit v1.2.3 From cd6764ed6ec5ae1a4bce636feaf9d4b18ff3ccf3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 16 Jul 2010 16:00:07 -0700 Subject: linker: Remove the FINISHME comment for intrastage linking --- src/glsl/linker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index a4776b1941..4869dbe1ca 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1135,7 +1135,8 @@ link_shaders(struct gl_shader_program *prog) prog->Version = max_version; - /* FINISHME: Implement intra-stage linking. */ + /* Link all shaders for a particular stage and validate the result. + */ prog->_NumLinkedShaders = 0; if (num_vert_shaders > 0) { gl_shader *const sh = -- cgit v1.2.3 From 5a2e0b8ce59a3d9f8fa7510546137aff40016c74 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 11:37:45 -0700 Subject: glsl2: Don't validate IR if there were compilation errors --- src/glsl/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index e27d9c1d85..3ae0eebab3 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -172,10 +172,9 @@ compile_shader(struct gl_shader *shader) if (!state->error && !state->translation_unit.is_empty()) _mesa_ast_to_hir(shader->ir, state); - validate_ir_tree(shader->ir); - /* Print out the unoptimized IR. */ if (!state->error && dump_hir) { + validate_ir_tree(shader->ir); _mesa_print_ir(shader->ir, state); } @@ -196,9 +195,10 @@ compile_shader(struct gl_shader *shader) progress = do_vec_index_to_cond_assign(shader->ir) || progress; progress = do_swizzle_swizzle(shader->ir) || progress; } while (progress); + + validate_ir_tree(shader->ir); } - validate_ir_tree(shader->ir); /* Print out the resulting IR */ if (!state->error && dump_lir) { -- cgit v1.2.3 From 14f8e16132409f38656e4874aa53bc471977f9ad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 11:43:28 -0700 Subject: glsl2: Constant-fold assignment conditions. --- src/glsl/ir_constant_folding.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 2daa6fde38..66a92e9f3b 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -167,6 +167,19 @@ ir_constant_folding_visitor::visit(ir_assignment *ir) ir->rhs = const_val; else ir->rhs->accept(this); + + if (ir->condition) { + /* If the condition is constant, either remove the condition or + * remove the never-executed assignment. + */ + const_val = ir->condition->constant_expression_value(); + if (const_val) { + if (const_val->value.b[0]) + ir->condition = NULL; + else + ir->remove(); + } + } } -- cgit v1.2.3 From 117d154b4d877e8c4d7880432af0a80b8f717dc6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 11:56:48 -0700 Subject: glsl2: notEqual() produces a boolean value, not the base type of the args. Fixes: glsl1-vector relational (bvec2 ==,!=) glsl1-vector relational (vec4 !=) --- src/glsl/builtin_function.cpp | 36 ++++++++++++++++++------------------ src/glsl/builtins/110/notEqual | 36 ++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index fbb2638fc9..be7a4f2c63 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1507,8 +1507,8 @@ static const char *builtins_110_notEqual = { " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" " (return (var_ref temp))))\n" "\n" " (signature bvec3\n" @@ -1516,9 +1516,9 @@ static const char *builtins_110_notEqual = { " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" " (return (var_ref temp))))\n" "\n" " (signature bvec4\n" @@ -1526,10 +1526,10 @@ static const char *builtins_110_notEqual = { " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" " (return (var_ref temp))))\n" "\n" " (signature bvec2\n" @@ -1537,8 +1537,8 @@ static const char *builtins_110_notEqual = { " (declare (in) ivec2 arg0)\n" " (declare (in) ivec2 arg1))\n" " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" " (return (var_ref temp))))\n" "\n" " (signature bvec3\n" @@ -1546,9 +1546,9 @@ static const char *builtins_110_notEqual = { " (declare (in) ivec3 arg0)\n" " (declare (in) ivec3 arg1))\n" " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" " (return (var_ref temp))))\n" "\n" " (signature bvec4\n" @@ -1556,10 +1556,10 @@ static const char *builtins_110_notEqual = { " (declare (in) ivec4 arg0)\n" " (declare (in) ivec4 arg1))\n" " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" " (return (var_ref temp))))\n" "))\n" }; diff --git a/src/glsl/builtins/110/notEqual b/src/glsl/builtins/110/notEqual index c87efa317f..ccdcaa3aaf 100644 --- a/src/glsl/builtins/110/notEqual +++ b/src/glsl/builtins/110/notEqual @@ -4,8 +4,8 @@ (declare (in) vec2 arg0) (declare (in) vec2 arg1)) ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) (return (var_ref temp)))) (signature bvec3 @@ -13,9 +13,9 @@ (declare (in) vec3 arg0) (declare (in) vec3 arg1)) ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) (return (var_ref temp)))) (signature bvec4 @@ -23,10 +23,10 @@ (declare (in) vec4 arg0) (declare (in) vec4 arg1)) ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) (return (var_ref temp)))) (signature bvec2 @@ -34,8 +34,8 @@ (declare (in) ivec2 arg0) (declare (in) ivec2 arg1)) ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) (return (var_ref temp)))) (signature bvec3 @@ -43,9 +43,9 @@ (declare (in) ivec3 arg0) (declare (in) ivec3 arg1)) ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) (return (var_ref temp)))) (signature bvec4 @@ -53,9 +53,9 @@ (declare (in) ivec4 arg0) (declare (in) ivec4 arg1)) ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) (return (var_ref temp)))) )) -- cgit v1.2.3 From 1245babe0c69846d227a78a11429584433e77a9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 12:22:37 -0700 Subject: glsl2: Fix asin() implementation. I'd flipped around the order of two operations in paren-balancing adventures, and left out the multiply by sign(x) required for negative x. Fixes: glsl1-acos(vec4) function glsl1-asin(vec4) function glsl1-atan(vec4) function --- src/glsl/builtin_function.cpp | 130 ++++++++++++++++++++++-------------------- src/glsl/builtins/110/asin | 130 ++++++++++++++++++++++-------------------- 2 files changed, 138 insertions(+), 122 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index be7a4f2c63..967bcd0c40 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -113,90 +113,98 @@ static const char *builtins_110_asin = { " (parameters\n" " (declare (in) float x))\n" " ((return (expression float *\n" - " (expression float -\n" - " (expression float *\n" + " (expression float sign (var_ref x))\n" + " (expression float -\n" + " (expression float *\n" " (constant float (3.1415926))\n" " (constant float (0.5)))\n" - " (expression float sqrt\n" - " (expression float -\n" - " (constant float (1.0))\n" - " (expression float abs (var_ref x)))))\n" - " (expression float +\n" - " (constant float (1.5707288))\n" - " (expression float *\n" - " (expression float abs (var_ref x))\n" - " (expression float +\n" - " (constant float (-0.2121144))\n" - " (expression float *\n" - " (constant float (0.0742610))\n" - " (expression float abs (var_ref x))))))))))\n" + " (expression float *\n" + " (expression float sqrt\n" + " (expression float -\n" + " (constant float (1.0))\n" + " (expression float abs (var_ref x))))\n" + " (expression float +\n" + " (constant float (1.5707288))\n" + " (expression float *\n" + " (expression float abs (var_ref x))\n" + " (expression float +\n" + " (constant float (-0.2121144))\n" + " (expression float *\n" + " (constant float (0.0742610))\n" + " (expression float abs (var_ref x))))))))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" " ((return (expression vec2 *\n" - " (expression float -\n" - " (expression float *\n" + " (expression vec2 sign (var_ref x))\n" + " (expression vec2 -\n" + " (expression float *\n" " (constant float (3.1415926))\n" " (constant float (0.5)))\n" - " (expression vec2 sqrt\n" - " (expression vec2 -\n" - " (constant float (1.0))\n" - " (expression vec2 abs (var_ref x)))))\n" - " (expression vec2 +\n" - " (constant float (1.5707288))\n" - " (expression vec2 *\n" - " (expression vec2 abs (var_ref x))\n" - " (expression vec2 +\n" - " (constant float (-0.2121144))\n" - " (expression vec2 *\n" - " (constant float (0.0742610))\n" - " (expression vec2 abs (var_ref x))))))))))\n" + " (expression vec2 *\n" + " (expression vec2 sqrt\n" + " (expression vec2 -\n" + " (constant float (1.0))\n" + " (expression vec2 abs (var_ref x))))\n" + " (expression vec2 +\n" + " (constant float (1.5707288))\n" + " (expression vec2 *\n" + " (expression vec2 abs (var_ref x))\n" + " (expression vec2 +\n" + " (constant float (-0.2121144))\n" + " (expression vec2 *\n" + " (constant float (0.0742610))\n" + " (expression vec2 abs (var_ref x))))))))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" " ((return (expression vec3 *\n" - " (expression vec3 -\n" - " (expression float *\n" + " (expression vec3 sign (var_ref x))\n" + " (expression vec3 -\n" + " (expression float *\n" " (constant float (3.1415926))\n" " (constant float (0.5)))\n" - " (expression vec3 sqrt\n" - " (expression vec3 -\n" - " (constant float (1.0))\n" - " (expression vec3 abs (var_ref x)))))\n" - " (expression vec3 +\n" - " (constant float (1.5707288))\n" - " (expression vec3 *\n" - " (expression vec3 abs (var_ref x))\n" - " (expression vec3 +\n" - " (constant float (-0.2121144))\n" - " (expression vec3 *\n" - " (constant float (0.0742610))\n" - " (expression vec3 abs (var_ref x))))))))))\n" + " (expression vec3 *\n" + " (expression vec3 sqrt\n" + " (expression vec3 -\n" + " (constant float (1.0))\n" + " (expression vec3 abs (var_ref x))))\n" + " (expression vec3 +\n" + " (constant float (1.5707288))\n" + " (expression vec3 *\n" + " (expression vec3 abs (var_ref x))\n" + " (expression vec3 +\n" + " (constant float (-0.2121144))\n" + " (expression vec3 *\n" + " (constant float (0.0742610))\n" + " (expression vec3 abs (var_ref x))))))))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" " ((return (expression vec4 *\n" - " (expression vec4 -\n" - " (expression float *\n" + " (expression vec4 sign (var_ref x))\n" + " (expression vec4 -\n" + " (expression float *\n" " (constant float (3.1415926))\n" " (constant float (0.5)))\n" - " (expression vec4 sqrt\n" - " (expression vec4 -\n" - " (constant float (1.0))\n" - " (expression vec4 abs (var_ref x)))))\n" - " (expression vec4 +\n" - " (constant float (1.5707288))\n" - " (expression vec4 *\n" - " (expression vec4 abs (var_ref x))\n" - " (expression vec4 +\n" - " (constant float (-0.2121144))\n" - " (expression vec4 *\n" - " (constant float (0.0742610))\n" - " (expression vec4 abs (var_ref x))))))))))\n" - ")\n" + " (expression vec4 *\n" + " (expression vec4 sqrt\n" + " (expression vec4 -\n" + " (constant float (1.0))\n" + " (expression vec4 abs (var_ref x))))\n" + " (expression vec4 +\n" + " (constant float (1.5707288))\n" + " (expression vec4 *\n" + " (expression vec4 abs (var_ref x))\n" + " (expression vec4 +\n" + " (constant float (-0.2121144))\n" + " (expression vec4 *\n" + " (constant float (0.0742610))\n" + " (expression vec4 abs (var_ref x)))))))))))\n" + "))\n" "\n" " (function acos\n" " (signature float\n" diff --git a/src/glsl/builtins/110/asin b/src/glsl/builtins/110/asin index fe93337bff..d26bde364b 100644 --- a/src/glsl/builtins/110/asin +++ b/src/glsl/builtins/110/asin @@ -3,90 +3,98 @@ (parameters (declare (in) float x)) ((return (expression float * - (expression float - - (expression float * + (expression float sign (var_ref x)) + (expression float - + (expression float * (constant float (3.1415926)) (constant float (0.5))) - (expression float sqrt - (expression float - - (constant float (1.0)) - (expression float abs (var_ref x))))) - (expression float + - (constant float (1.5707288)) - (expression float * - (expression float abs (var_ref x)) - (expression float + - (constant float (-0.2121144)) - (expression float * - (constant float (0.0742610)) - (expression float abs (var_ref x)))))))))) + (expression float * + (expression float sqrt + (expression float - + (constant float (1.0)) + (expression float abs (var_ref x)))) + (expression float + + (constant float (1.5707288)) + (expression float * + (expression float abs (var_ref x)) + (expression float + + (constant float (-0.2121144)) + (expression float * + (constant float (0.0742610)) + (expression float abs (var_ref x)))))))))))) (signature vec2 (parameters (declare (in) vec2 x)) ((return (expression vec2 * - (expression float - - (expression float * + (expression vec2 sign (var_ref x)) + (expression vec2 - + (expression float * (constant float (3.1415926)) (constant float (0.5))) - (expression vec2 sqrt - (expression vec2 - - (constant float (1.0)) - (expression vec2 abs (var_ref x))))) - (expression vec2 + - (constant float (1.5707288)) - (expression vec2 * - (expression vec2 abs (var_ref x)) - (expression vec2 + - (constant float (-0.2121144)) - (expression vec2 * - (constant float (0.0742610)) - (expression vec2 abs (var_ref x)))))))))) + (expression vec2 * + (expression vec2 sqrt + (expression vec2 - + (constant float (1.0)) + (expression vec2 abs (var_ref x)))) + (expression vec2 + + (constant float (1.5707288)) + (expression vec2 * + (expression vec2 abs (var_ref x)) + (expression vec2 + + (constant float (-0.2121144)) + (expression vec2 * + (constant float (0.0742610)) + (expression vec2 abs (var_ref x)))))))))))) (signature vec3 (parameters (declare (in) vec3 x)) ((return (expression vec3 * - (expression vec3 - - (expression float * + (expression vec3 sign (var_ref x)) + (expression vec3 - + (expression float * (constant float (3.1415926)) (constant float (0.5))) - (expression vec3 sqrt - (expression vec3 - - (constant float (1.0)) - (expression vec3 abs (var_ref x))))) - (expression vec3 + - (constant float (1.5707288)) - (expression vec3 * - (expression vec3 abs (var_ref x)) - (expression vec3 + - (constant float (-0.2121144)) - (expression vec3 * - (constant float (0.0742610)) - (expression vec3 abs (var_ref x)))))))))) + (expression vec3 * + (expression vec3 sqrt + (expression vec3 - + (constant float (1.0)) + (expression vec3 abs (var_ref x)))) + (expression vec3 + + (constant float (1.5707288)) + (expression vec3 * + (expression vec3 abs (var_ref x)) + (expression vec3 + + (constant float (-0.2121144)) + (expression vec3 * + (constant float (0.0742610)) + (expression vec3 abs (var_ref x)))))))))))) (signature vec4 (parameters (declare (in) vec4 x)) ((return (expression vec4 * - (expression vec4 - - (expression float * + (expression vec4 sign (var_ref x)) + (expression vec4 - + (expression float * (constant float (3.1415926)) (constant float (0.5))) - (expression vec4 sqrt - (expression vec4 - - (constant float (1.0)) - (expression vec4 abs (var_ref x))))) - (expression vec4 + - (constant float (1.5707288)) - (expression vec4 * - (expression vec4 abs (var_ref x)) - (expression vec4 + - (constant float (-0.2121144)) - (expression vec4 * - (constant float (0.0742610)) - (expression vec4 abs (var_ref x)))))))))) -) + (expression vec4 * + (expression vec4 sqrt + (expression vec4 - + (constant float (1.0)) + (expression vec4 abs (var_ref x)))) + (expression vec4 + + (constant float (1.5707288)) + (expression vec4 * + (expression vec4 abs (var_ref x)) + (expression vec4 + + (constant float (-0.2121144)) + (expression vec4 * + (constant float (0.0742610)) + (expression vec4 abs (var_ref x))))))))))) +)) (function acos (signature float -- cgit v1.2.3 From f8946699ecfa5bc6566821fb855072bbdbd716b2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 14:03:35 -0700 Subject: glsl2: Add definitions of the builtin constants present in GLSL 1.10. Fixes: glsl1-built-in constants --- src/glsl/glsl_parser_extras.h | 15 ++++++++++++++- src/glsl/ir_variable.cpp | 38 ++++++++++++++++++++++++++++++++------ src/glsl/main.cpp | 19 ++++++++++++++++++- src/mesa/shader/ir_to_mesa.cpp | 14 +++++++++++++- 4 files changed, 77 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 4b28ae118d..fed6e8c823 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -49,8 +49,21 @@ struct _mesa_glsl_parse_state { * \sa struct gl_constants (in mtypes.h) */ struct { - unsigned MaxDrawBuffers; + /* 1.10 */ + unsigned MaxLights; + unsigned MaxClipPlanes; + unsigned MaxTextureUnits; unsigned MaxTextureCoords; + unsigned MaxVertexAttribs; + unsigned MaxVertexUniformComponents; + unsigned MaxVaryingFloats; + unsigned MaxVertexTextureImageUnits; + unsigned MaxCombinedTextureImageUnits; + unsigned MaxTextureImageUnits; + unsigned MaxFragmentUniformComponents; + + /* ARB_draw_buffers */ + unsigned MaxDrawBuffers; } Const; /** diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index a0b66b7770..4593c18112 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -93,6 +93,16 @@ add_builtin_variable(const builtin_variable *proto, exec_list *instructions, symtab); } +static void +add_builtin_constant(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + const char *name, int value) +{ + ir_variable *const var = add_variable(name, ir_var_auto, + -1, glsl_type::int_type, + instructions, state->symbols); + var->constant_value = new(var) ir_constant(value); +} static void generate_110_uniforms(exec_list *instructions, @@ -105,12 +115,28 @@ generate_110_uniforms(exec_list *instructions, instructions, state->symbols); } - ir_variable *const mtc = add_variable("gl_MaxTextureCoords", ir_var_auto, - -1, glsl_type::int_type, - instructions, state->symbols); - mtc->constant_value = new(mtc) - ir_constant(int(state->Const.MaxTextureCoords)); - + add_builtin_constant(instructions, state, "gl_MaxLights", + state->Const.MaxLights); + add_builtin_constant(instructions, state, "gl_MaxClipPlanes", + state->Const.MaxClipPlanes); + add_builtin_constant(instructions, state, "gl_MaxTextureUnits", + state->Const.MaxTextureUnits); + add_builtin_constant(instructions, state, "gl_MaxTextureCoords", + state->Const.MaxTextureCoords); + add_builtin_constant(instructions, state, "gl_MaxVertexAttribs", + state->Const.MaxVertexAttribs); + add_builtin_constant(instructions, state, "gl_MaxVertexUniformComponents", + state->Const.MaxVertexUniformComponents); + add_builtin_constant(instructions, state, "gl_MaxVaryingFloats", + state->Const.MaxVaryingFloats); + add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits", + state->Const.MaxVertexTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits", + state->Const.MaxCombinedTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits", + state->Const.MaxTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxFragmentUniformComponents", + state->Const.MaxFragmentUniformComponents); const glsl_type *const mat4_array_type = glsl_type::get_array_instance(state->symbols, glsl_type::mat4_type, diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 3ae0eebab3..6b1a01c704 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -148,9 +148,26 @@ compile_shader(struct gl_shader *shader) memset(&ext, 0, sizeof(ext)); state->extensions = &ext; - state->Const.MaxDrawBuffers = 2; + /* 1.10 minimums. */ + state->Const.MaxLights = 8; + state->Const.MaxClipPlanes = 8; + state->Const.MaxTextureUnits = 2; + + /* More than the 1.10 minimum to appease parser tests taken from + * apps that (hopefully) already checked the number of coords. + */ state->Const.MaxTextureCoords = 4; + state->Const.MaxVertexAttribs = 16; + state->Const.MaxVertexUniformComponents = 512; + state->Const.MaxVaryingFloats = 32; + state->Const.MaxVertexTextureImageUnits = 0; + state->Const.MaxCombinedTextureImageUnits = 2; + state->Const.MaxTextureImageUnits = 2; + state->Const.MaxFragmentUniformComponents = 64; + + state->Const.MaxDrawBuffers = 2; + const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log, &ext); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 848fb0fb6c..5803960d44 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2170,8 +2170,20 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) state->ARB_texture_rectangle_enable = true; state->extensions = &ctx->Extensions; - state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + + state->Const.MaxLights = ctx->Const.MaxLights; + state->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes; + state->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits; state->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; + state->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; + state->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; + state->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; + state->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + state->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; + state->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + state->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; + + state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log, -- cgit v1.2.3 From 02d3711a21f5766d286b09fbe1eda5d8520d151a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 15:50:48 -0700 Subject: glsl2: Always insert function calls into the instruction stream. If they have a return value, this means putting it into a temporary and making a deref of the temp be the rvalue, since we don't know if the rvalue will be used or not. --- src/glsl/ast_function.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index aaf1e57ae2..643eb229a7 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -104,7 +104,30 @@ process_call(exec_list *instructions, ir_function *f, formal_iter.next(); } - return new(ctx) ir_call(sig, actual_parameters); + /* 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. + */ + ir_call *call = new(ctx) ir_call(sig, actual_parameters); + if (!sig->return_type->is_void()) { + ir_variable *var; + ir_dereference_variable *deref; + + var = new(ctx) ir_variable(sig->return_type, + talloc_asprintf(ctx, "%s_retval", + sig->function_name())); + 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); + + deref = new(ctx) ir_dereference_variable(var); + return deref; + } else { + instructions->push_tail(call); + return NULL; + } } else { /* FINISHME: Log a better error message here. G++ will show the types * FINISHME: of the actual parameters and the set of candidate -- cgit v1.2.3 From 2927c81ed10c0dc617f734c00376d0582ac3c061 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 14:21:43 -0700 Subject: glsl2: Don't mark a variable as constant if it was used as an out param. --- src/glsl/ir_constant_variable.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp index ef5e1e418e..c5ccd52e5d 100644 --- a/src/glsl/ir_constant_variable.cpp +++ b/src/glsl/ir_constant_variable.cpp @@ -47,6 +47,7 @@ struct assignment_entry { class ir_constant_variable_visitor : public ir_hierarchical_visitor { public: virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_call *); exec_list list; }; @@ -107,6 +108,28 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir) return visit_continue; } +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_call *ir) +{ + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *param = (ir_variable *)sig_iter.get(); + + if (param->mode == ir_var_out || + param->mode == ir_var_inout) { + ir_variable *var = param_rval->variable_referenced(); + struct assignment_entry *entry; + + assert(var); + entry = get_assignment_entry(var, &this->list); + entry->assignment_count++; + } + sig_iter.next(); + } + return visit_continue; +} + /** * Does a copy propagation pass on the code present in the instruction stream. */ -- cgit v1.2.3 From 325a49701fbee14a99a02c69872a1d7577a633cf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 16:03:46 -0700 Subject: glsl2: Fix handling of out values in function inlining. The parameters[i] is our inlined variables representing the parameters, so they are always ir_var_auto. Walk the signature params in handling "out" values like we do for "in" values to find the mode. Fixes (with the previous 2 commits): glsl1-function call with in, out params glsl1-function call with inout params --- src/glsl/ir_function_inlining.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 8c545aaa6b..a3f7089cdc 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -169,21 +169,24 @@ ir_call::generate_inline(ir_instruction *next_ir) */ i = 0; param_iter = this->actual_parameters.iterator(); + sig_param_iter = this->callee->parameters.iterator(); for (i = 0; i < num_parameters; i++) { ir_instruction *const param = (ir_instruction *) param_iter.get(); + const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); /* Move our param variable into the actual param if it's an 'out' type. */ - if (parameters[i]->mode == ir_var_out || - parameters[i]->mode == ir_var_inout) { + if (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout) { ir_assignment *assign; - assign = new(ctx) ir_assignment(param->as_rvalue(), + assign = new(ctx) ir_assignment(param->clone(NULL)->as_rvalue(), new(ctx) ir_dereference_variable(parameters[i]), NULL); next_ir->insert_before(assign); } param_iter.next(); + sig_param_iter.next(); } delete [] parameters; -- cgit v1.2.3 From f15e27ec1d3238df5cd5ab40642e21aea5a162e3 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 14 Jul 2010 12:45:58 -0700 Subject: glcpp: Delete copies of hash_table.c, hash_table.h, and other headers. These were only ever intended to exist in the original, standalone implementation of glcpp, (with the idea of dropping them as soon as the code moved into mesa). The current build system wasn't compiling this C file, but the presence of the header files could cause problems if the two copies diverge in the future. We head those problems off by deleting al of these redundant files. --- src/glsl/glcpp/Makefile.am | 1 - src/glsl/glcpp/hash_table.c | 159 -------------------------- src/glsl/glcpp/hash_table.h | 125 -------------------- src/glsl/glcpp/main/imports.h | 6 - src/glsl/glcpp/main/simple_list.h | 235 -------------------------------------- 5 files changed, 526 deletions(-) delete mode 100644 src/glsl/glcpp/hash_table.c delete mode 100644 src/glsl/glcpp/hash_table.h delete mode 100644 src/glsl/glcpp/main/imports.h delete mode 100644 src/glsl/glcpp/main/simple_list.h (limited to 'src/glsl') diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am index a49fd615cd..00c6c5610e 100644 --- a/src/glsl/glcpp/Makefile.am +++ b/src/glsl/glcpp/Makefile.am @@ -25,7 +25,6 @@ libglcpp_la_SOURCES = \ glcpp-lex.l \ glcpp-parse.y \ glcpp.h \ - hash_table.c \ pp.c \ xtalloc.c diff --git a/src/glsl/glcpp/hash_table.c b/src/glsl/glcpp/hash_table.c deleted file mode 100644 index e89a2564d7..0000000000 --- a/src/glsl/glcpp/hash_table.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright © 2008 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 hash_table.c - * \brief Implementation of a generic, opaque hash table data type. - * - * \author Ian Romanick - */ - -#include "main/imports.h" -#include "main/simple_list.h" -#include "hash_table.h" - -struct node { - struct node *next; - struct node *prev; -}; - -struct hash_table { - hash_func_t hash; - hash_compare_func_t compare; - - unsigned num_buckets; - struct node buckets[1]; -}; - - -struct hash_node { - struct node link; - const void *key; - void *data; -}; - - -struct hash_table * -hash_table_ctor(unsigned num_buckets, hash_func_t hash, - hash_compare_func_t compare) -{ - struct hash_table *ht; - unsigned i; - - - if (num_buckets < 16) { - num_buckets = 16; - } - - ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) - * sizeof(ht->buckets[0]))); - if (ht != NULL) { - ht->hash = hash; - ht->compare = compare; - ht->num_buckets = num_buckets; - - for (i = 0; i < num_buckets; i++) { - make_empty_list(& ht->buckets[i]); - } - } - - return ht; -} - - -void -hash_table_dtor(struct hash_table *ht) -{ - hash_table_clear(ht); - _mesa_free(ht); -} - - -void -hash_table_clear(struct hash_table *ht) -{ - struct node *node; - struct node *temp; - unsigned i; - - - for (i = 0; i < ht->num_buckets; i++) { - foreach_s(node, temp, & ht->buckets[i]) { - remove_from_list(node); - _mesa_free(node); - } - - assert(is_empty_list(& ht->buckets[i])); - } -} - - -void * -hash_table_find(struct hash_table *ht, const void *key) -{ - const unsigned hash_value = (*ht->hash)(key); - const unsigned bucket = hash_value % ht->num_buckets; - struct node *node; - - foreach(node, & ht->buckets[bucket]) { - struct hash_node *hn = (struct hash_node *) node; - - if ((*ht->compare)(hn->key, key) == 0) { - return hn->data; - } - } - - return NULL; -} - - -void -hash_table_insert(struct hash_table *ht, void *data, const void *key) -{ - const unsigned hash_value = (*ht->hash)(key); - const unsigned bucket = hash_value % ht->num_buckets; - struct hash_node *node; - - node = _mesa_calloc(sizeof(*node)); - - node->data = data; - node->key = key; - - insert_at_head(& ht->buckets[bucket], & node->link); -} - - -unsigned -hash_table_string_hash(const void *key) -{ - const char *str = (const char *) key; - unsigned hash = 5381; - - - while (*str != '\0') { - hash = (hash * 33) + *str; - str++; - } - - return hash; -} diff --git a/src/glsl/glcpp/hash_table.h b/src/glsl/glcpp/hash_table.h deleted file mode 100644 index b9dd343dee..0000000000 --- a/src/glsl/glcpp/hash_table.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright © 2008 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 hash_table.h - * \brief Implementation of a generic, opaque hash table data type. - * - * \author Ian Romanick - */ - -#ifndef HASH_TABLE_H -#define HASH_TABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -struct hash_table; - -typedef unsigned (*hash_func_t)(const void *key); -typedef int (*hash_compare_func_t)(const void *key1, const void *key2); - -/** - * Hash table constructor - * - * Creates a hash table with the specified number of buckets. The supplied - * \c hash and \c compare routines are used when adding elements to the table - * and when searching for elements in the table. - * - * \param num_buckets Number of buckets (bins) in the hash table. - * \param hash Function used to compute hash value of input keys. - * \param compare Function used to compare keys. - */ -extern struct hash_table *hash_table_ctor(unsigned num_buckets, - hash_func_t hash, hash_compare_func_t compare); - - -/** - * Release all memory associated with a hash table - * - * \warning - * This function cannot release memory occupied either by keys or data. - */ -extern void hash_table_dtor(struct hash_table *ht); - - -/** - * Flush all entries from a hash table - * - * \param ht Table to be cleared of its entries. - */ -extern void hash_table_clear(struct hash_table *ht); - - -/** - * Search a hash table for a specific element - * - * \param ht Table to be searched - * \param key Key of the desired element - * - * \return - * The \c data value supplied to \c hash_table_insert when the element with - * the matching key was added. If no matching key exists in the table, - * \c NULL is returned. - */ -extern void *hash_table_find(struct hash_table *ht, const void *key); - - -/** - * Add an element to a hash table - */ -extern void hash_table_insert(struct hash_table *ht, void *data, - const void *key); - - -/** - * Compute hash value of a string - * - * Computes the hash value of a string using the DJB2 algorithm developed by - * Professor Daniel J. Bernstein. It was published on comp.lang.c once upon - * a time. I was unable to find the original posting in the archives. - * - * \param key Pointer to a NUL terminated string to be hashed. - * - * \sa hash_table_string_compare - */ -extern unsigned hash_table_string_hash(const void *key); - - -/** - * Compare two strings used as keys - * - * This is just a macro wrapper around \c strcmp. - * - * \sa hash_table_string_hash - */ -#define hash_table_string_compare ((hash_compare_func_t) strcmp) - -#ifdef __cplusplus -}; -#endif - -#endif /* HASH_TABLE_H */ diff --git a/src/glsl/glcpp/main/imports.h b/src/glsl/glcpp/main/imports.h deleted file mode 100644 index d2197342c0..0000000000 --- a/src/glsl/glcpp/main/imports.h +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -#define _mesa_malloc(x) malloc(x) -#define _mesa_free(x) free(x) -#define _mesa_calloc(x) calloc(1,x) diff --git a/src/glsl/glcpp/main/simple_list.h b/src/glsl/glcpp/main/simple_list.h deleted file mode 100644 index 5ef39e14cc..0000000000 --- a/src/glsl/glcpp/main/simple_list.h +++ /dev/null @@ -1,235 +0,0 @@ -/** - * \file simple_list.h - * Simple macros for type-safe, intrusive lists. - * - * Intended to work with a list sentinal which is created as an empty - * list. Insert & delete are O(1). - * - * \author - * (C) 1997, Keith Whitwell - */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * 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 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 - * BRIAN PAUL 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. - */ - - -#ifndef _SIMPLE_LIST_H -#define _SIMPLE_LIST_H - -struct simple_node { - struct simple_node *next; - struct simple_node *prev; -}; - -/** - * Remove an element from list. - * - * \param elem element to remove. - */ -#define remove_from_list(elem) \ -do { \ - (elem)->next->prev = (elem)->prev; \ - (elem)->prev->next = (elem)->next; \ -} while (0) - -/** - * Insert an element to the list head. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_head(list, elem) \ -do { \ - (elem)->prev = list; \ - (elem)->next = (list)->next; \ - (list)->next->prev = elem; \ - (list)->next = elem; \ -} while(0) - -/** - * Insert an element to the list tail. - * - * \param list list. - * \param elem element to insert. - */ -#define insert_at_tail(list, elem) \ -do { \ - (elem)->next = list; \ - (elem)->prev = (list)->prev; \ - (list)->prev->next = elem; \ - (list)->prev = elem; \ -} while(0) - -/** - * Move an element to the list head. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_head(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_head(list, elem); \ -} while (0) - -/** - * Move an element to the list tail. - * - * \param list list. - * \param elem element to move. - */ -#define move_to_tail(list, elem) \ -do { \ - remove_from_list(elem); \ - insert_at_tail(list, elem); \ -} while (0) - -/** - * Consatinate a cyclic list to a list - * - * Appends the sequence of nodes starting with \c tail to the list \c head. - * A "cyclic list" is a list that does not have a sentinal node. This means - * that the data pointed to by \c tail is an actual node, not a dataless - * sentinal. Note that if \c tail constist of a single node, this macro - * behaves identically to \c insert_at_tail - * - * \param head Head of the list to be appended to. This may or may not - * be a cyclic list. - * \param tail Head of the cyclic list to be appended to \c head. - * \param temp Temporary \c simple_list used by the macro - * - * \sa insert_at_tail - */ -#define concat_list_and_cycle(head, tail, temp) \ -do { \ - (head)->prev->next = (tail); \ - (tail)->prev->next = (head); \ - (temp) = (head)->prev; \ - (head)->prev = (tail)->prev; \ - (tail)->prev = (temp); \ -} while (0) - -#define concat_list(head, next_list) \ -do { \ - (next_list)->next->prev = (head)->prev; \ - (next_list)->prev->next = (head); \ - (head)->prev->next = (next_list)->next; \ - (head)->prev = (next_list)->prev; \ -} while (0) - -/** - * Make a empty list empty. - * - * \param sentinal list (sentinal element). - */ -#define make_empty_list(sentinal) \ -do { \ - (sentinal)->next = sentinal; \ - (sentinal)->prev = sentinal; \ -} while (0) - -/** - * Get list first element. - * - * \param list list. - * - * \return pointer to first element. - */ -#define first_elem(list) ((list)->next) - -/** - * Get list last element. - * - * \param list list. - * - * \return pointer to last element. - */ -#define last_elem(list) ((list)->prev) - -/** - * Get next element. - * - * \param elem element. - * - * \return pointer to next element. - */ -#define next_elem(elem) ((elem)->next) - -/** - * Get previous element. - * - * \param elem element. - * - * \return pointer to previous element. - */ -#define prev_elem(elem) ((elem)->prev) - -/** - * Test whether element is at end of the list. - * - * \param list list. - * \param elem element. - * - * \return non-zero if element is at end of list, or zero otherwise. - */ -#define at_end(list, elem) ((elem) == (list)) - -/** - * Test if a list is empty. - * - * \param list list. - * - * \return non-zero if list empty, or zero otherwise. - */ -#define is_empty_list(list) ((list)->next == (list)) - -/** - * Walk through the elements of a list. - * - * \param ptr pointer to the current element. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach(ptr, list) \ - for( ptr=(list)->next ; ptr!=list ; ptr=(ptr)->next ) - -/** - * Walk through the elements of a list. - * - * Same as #foreach but lets you unlink the current value during a list - * traversal. Useful for freeing a list, element by element. - * - * \param ptr pointer to the current element. - * \param t temporary pointer. - * \param list list. - * - * \note It should be followed by a { } block or a single statement, as in a \c - * for loop. - */ -#define foreach_s(ptr, t, list) \ - for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next) - -#endif -- cgit v1.2.3 From 41d525f2dfde130b4a1cfa908a729e5a3f79b200 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 14 Jul 2010 14:48:15 -0700 Subject: Build a standalone glcpp binary. This is convenient for testing the preprocessor independent of the rest of mesa, (just run glcpp-test in the src/glsl/glcpp/tests). --- src/glsl/Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 497f6ca1a0..7bf95fbfc2 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -6,13 +6,19 @@ include $(TOP)/configs/current LIBNAME = glsl -C_SOURCES = \ - glcpp/glcpp.c \ +LIBGLCPP_SOURCES = \ glcpp/glcpp-lex.c \ glcpp/glcpp-parse.c \ glcpp/pp.c \ glcpp/xtalloc.c +GLCPP_SOURCES = \ + $(LIBGLCPP_SOURCES) \ + glcpp/glcpp.c + +C_SOURCES = \ + $(LIBGLCPP_SOURCES) + CXX_SOURCES = \ ast_expr.cpp \ ast_function.cpp \ @@ -60,7 +66,8 @@ LIBS = \ $(TOP)/src/glsl/libglsl.a \ $(shell pkg-config --libs talloc) -APPS = glsl_compiler +APPS = glsl_compiler glcpp/glcpp + GLSL2_C_SOURCES = \ ../mesa/shader/hash_table.c \ ../mesa/shader/symbol_table.c @@ -73,6 +80,10 @@ GLSL2_OBJECTS = \ ### Basic defines ### +GLCPP_OBJECTS = \ + $(GLCPP_SOURCES:.c=.o) \ + ../mesa/shader/hash_table.o + OBJECTS = \ $(C_SOURCES:.c=.o) \ $(CXX_SOURCES:.cpp=.o) @@ -117,6 +128,9 @@ install: glsl_compiler: $(GLSL2_OBJECTS) libglsl.a $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@ +glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a + $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@ + .cpp.o: $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@ -- cgit v1.2.3 From 3a530b8ef68a40526b33de2af8de85f71ebdb30d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 17:48:17 -0700 Subject: glcpp: Make test suite report final count of passed/total tests. And report PASS or FAIL for each test along the way as well. --- src/glsl/glcpp/tests/glcpp-test | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 396f6e175e..8277719715 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -1,7 +1,27 @@ #!/bin/sh +total=0 +pass=0 + for test in *.c; do - echo "Testing $test" + echo -n "Testing $test..." ../glcpp < $test > $test.out - diff -u $test.expected $test.out + total=$((total+1)) + if cmp $test.expected $test.out; then + echo "PASS" + pass=$((pass+1)) + else + echo "FAIL" + diff -u $test.expected $test.out + fi done + +echo "$pass/$total tests returned correct results" +echo "" + +if [ "$pass" = "$total" ] ; then + exit 0 +else + exit 1 +fi + -- cgit v1.2.3 From d1500f8a195b7afe871cd768a5d33ecfecad5f31 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 17:49:23 -0700 Subject: glcpp: Make test suite test for valgrind cleanliness. As it turns out, 4 of our current tests are not valgrind clean, (use after free errors or so), so this will be helpful for investigating and fixing those. --- src/glsl/glcpp/tests/glcpp-test | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 8277719715..cfe7e97878 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -2,7 +2,9 @@ total=0 pass=0 +clean=0 +echo "====== Testing for correctness ======" for test in *.c; do echo -n "Testing $test..." ../glcpp < $test > $test.out @@ -16,10 +18,28 @@ for test in *.c; do fi done +echo "" echo "$pass/$total tests returned correct results" echo "" -if [ "$pass" = "$total" ] ; then +echo "====== Testing for valgrind cleanliness ======" +for test in *.c; do + echo -n "Testing $test with valgrind..." + if valgrind --error-exitcode=1 --log-file=$test.valgrind-errors ../glcpp < $test >/dev/null; then + echo "CLEAN" + clean=$((clean+1)) + rm $test.valgrind-errors + else + echo "ERRORS" + cat $test.valgrind-errors + fi +done + +echo "" +echo "$pass/$total tests returned correct results" +echo "$clean/$total tests are valgrind-clean" + +if [ "$pass" = "$total" ] && [ "$clean" = "$total" ]; then exit 0 else exit 1 -- cgit v1.2.3 From 61ebc01dfecda0963a184e881ea966e2d92f0519 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 19 Jul 2010 18:02:12 -0700 Subject: glcpp: Fix use-after-free error from #undef directive. By taking advantage of the recently-added hash_table_remove function. With this change, all existing tests are now valgrind-clean. --- src/glsl/glcpp/glcpp-parse.y | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e5544fe29b..a2b54eff50 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -202,10 +202,7 @@ control_line: | HASH_UNDEF IDENTIFIER NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); if (macro) { - /* XXX: Need hash table to support a real way - * to remove an element rather than prefixing - * a new node with data of NULL like this. */ - hash_table_insert (parser->defines, NULL, $2); + hash_table_remove (parser->defines, $2); talloc_free (macro); } talloc_free ($2); -- cgit v1.2.3 From 17f9beb6c313b41ca08984add7b76ecb84a7339e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 13:16:17 -0700 Subject: glcpp: Support #if(expression) with no intervening space. And add a test case to ensure that this works. --- src/glsl/glcpp/glcpp-lex.l | 2 +- src/glsl/glcpp/tests/066-if-nospace-expression.c | 3 +++ src/glsl/glcpp/tests/066-if-nospace-expression.c.expected | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/glsl/glcpp/tests/066-if-nospace-expression.c create mode 100644 src/glsl/glcpp/tests/066-if-nospace-expression.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 53e85556c1..a81c8f92c1 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -99,7 +99,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return HASH_IFNDEF; } -{HASH}if{HSPACE}/.*\n { +{HASH}if{HSPACE}*/[^_a-zA-Z0-9].*\n { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IF; diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c b/src/glsl/glcpp/tests/066-if-nospace-expression.c new file mode 100644 index 0000000000..3b0b47349d --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c @@ -0,0 +1,3 @@ +#if(1) +success +#endif diff --git a/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected new file mode 100644 index 0000000000..0e84a7cda3 --- /dev/null +++ b/src/glsl/glcpp/tests/066-if-nospace-expression.c.expected @@ -0,0 +1,4 @@ + +success + + -- cgit v1.2.3 From 1d7e03e48e87328ce0081021dde133921b78b406 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 14:13:32 -0700 Subject: glcpp: Fix support for nested #ifdef and nested #ifndef Previously, if the outer #ifdef/#ifndef evaluated to false, the inner directive would not be parsed correctly, (the identifier as the subject of the #ifdef/#ifndef would inadvertently be skipped along with the other content correctly being skipped). We fix this by setting the lexing_if state in each case here. We also add a new test to the test suite to ensure that this case is tested. --- src/glsl/glcpp/glcpp-lex.l | 6 ++-- src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c | 40 +++++++++++++++++++++ .../glcpp/tests/067-nested-ifdef-ifndef.c.expected | 41 ++++++++++++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c create mode 100644 src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a81c8f92c1..6773832f29 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -90,16 +90,18 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {HASH}ifdef/.*\n { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFDEF; } {HASH}ifndef/.*\n { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IFNDEF; } -{HASH}if{HSPACE}*/[^_a-zA-Z0-9].*\n { +{HASH}if/[^_a-zA-Z0-9].*\n { yyextra->lexing_if = 1; yyextra->space_tokens = 0; return HASH_IF; @@ -122,7 +124,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } /* When skipping (due to an #if 0 or similar) consume anything - * up to a newline. We do this less priroty than any + * up to a newline. We do this with less priority than any * #if-related directive (#if, #elif, #else, #endif), but with * more priority than any other directive or token to avoid * any side-effects from skipped content. diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c new file mode 100644 index 0000000000..f46cce4e60 --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c @@ -0,0 +1,40 @@ +#define D1 +#define D2 + +#define result success + +#ifdef U1 +#ifdef U2 +#undef result +#define result failure +#endif +#endif +result + +#ifndef D1 +#ifndef D2 +#undef result +#define result failure +#endif +#endif +result + +#undef result +#define result failure +#ifdef D1 +#ifdef D2 +#undef result +#define result success +#endif +#endif +result + +#undef result +#define result failure +#ifndef U1 +#ifndef U2 +#undef result +#define result success +#endif +#endif +result diff --git a/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected new file mode 100644 index 0000000000..3340daaa1f --- /dev/null +++ b/src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected @@ -0,0 +1,41 @@ + + + + + + + + + + + +success + + + + + + + +success + + + + + + + + + +success + + + + + + + + + +success + -- cgit v1.2.3 From a9bb4bcde360ef8d0a444bf1c4a7d02a8fdb5fa1 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 15:03:20 -0700 Subject: glcpp-lex: Declare some generated functions to eliminate compiler warnings. It's really a bug in flex that these functions are generated with neither a declaration nor the 'static' keyword, but we can at least avoid the warnings this way. --- src/glsl/glcpp/glcpp-lex.l | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 6773832f29..29b2769397 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -29,6 +29,11 @@ #include "glcpp.h" #include "glcpp-parse.h" +/* Flex annoyingly generates some functions without making them + * static. Let's declare them here. */ +int glcpp_get_column (yyscan_t yyscanner); +void glcpp_set_column (int column_no , yyscan_t yyscanner); + #define YY_USER_ACTION \ do { \ yylloc->source = 0; \ -- cgit v1.2.3 From fb90560744864e44730330e4c801ac47c4ece0e1 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 15:53:14 -0700 Subject: glcpp: Avoid warnings in generated flex code. We define the YY_NO_INPUT macro to avoid one needless function being generated. for the other needless functions, (yyunput and yy_top_state), we add a new UNREACHABLE start condition and call these functions from an action there. This doesn't change functionality at all, (since we never enter the UNREACHABLE start condition), but makes the compiler stop complaining about these two functions being defined but not used. --- src/glsl/glcpp/glcpp-lex.l | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 29b2769397..a4c891bdc6 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -34,6 +34,8 @@ int glcpp_get_column (yyscan_t yyscanner); void glcpp_set_column (int column_no , yyscan_t yyscanner); +#define YY_NO_INPUT + #define YY_USER_ACTION \ do { \ yylloc->source = 0; \ @@ -49,7 +51,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); %option prefix="glcpp_" %option stack -%x DONE COMMENT +%x DONE COMMENT UNREACHABLE SPACE [[:space:]] NONSPACE [^[:space:]] @@ -264,6 +266,15 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return NEWLINE; } + /* We don't actually use the UNREACHABLE start condition. We + only have this action here so that we can pretend to call some + generated functions, (to avoid "defined but not used" + warnings. */ +. { + unput('.'); + yy_top_state(yyextra); +} + %% void -- cgit v1.2.3 From d80dcaf427e12a5cba9cfc5bcd1b485572a2714b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 15:55:21 -0700 Subject: glcpp: Add static keyword to several functions in the parser. This quiets warnings about missing declarations otherwise. --- src/glsl/glcpp/glcpp-parse.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index a2b54eff50..c37c9bcff0 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -692,7 +692,7 @@ _token_list_append_list (token_list_t *list, token_list_t *tail) list->non_space_tail = tail->non_space_tail; } -token_list_t * +static token_list_t * _token_list_copy (void *ctx, token_list_t *other) { token_list_t *copy; @@ -708,7 +708,7 @@ _token_list_copy (void *ctx, token_list_t *other) return copy; } -void +static void _token_list_trim_trailing_space (token_list_t *list) { token_node_t *tail, *next; @@ -1410,7 +1410,7 @@ _glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, _token_list_print (parser, list); } -void +static void _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, const char *identifier) { -- cgit v1.2.3 From 942ccc517012e360a7e30d3322331c8450dda022 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 15:56:02 -0700 Subject: glcpp: Add missing include in xtalloc.c Without this, the compiler was legitimately complaining about missing declarations for all of the functions being defined here. --- src/glsl/glcpp/xtalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/xtalloc.c b/src/glsl/glcpp/xtalloc.c index 656ac2d6cb..a20ea8b93f 100644 --- a/src/glsl/glcpp/xtalloc.c +++ b/src/glsl/glcpp/xtalloc.c @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include +#include "glcpp.h" void * xtalloc_named_const (const void *context, size_t size, const char *name) -- cgit v1.2.3 From e1acbfca322c4ac720707ec8d3fda08fab65a30b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Jul 2010 16:44:03 -0700 Subject: glcpp: Avoid accidental token pasting in preprocessed result. Consider this test case: #define EMPTY int foo = 1+EMPTY+4; The expression should compile as the sequence of tokens 1, PLUS, UNARY_POSITIVE, 4. But glcpp has been failing for this case since it results in the string "1++4" which a compiler correctly sees as a syntax error, (1, POST_INCREMENT, 4). We fix this by changing any macro with an empty definition to result in a single SPACE token rather than nothing. This then gives "1+ +4" which compiles correctly. This commit does touch up the two existing test cases which already have empty macros, (to add the space to the expected result). It also adds a new test case to exercise the above scenario. --- src/glsl/glcpp/glcpp-parse.y | 21 ++++++++++++++++++--- src/glsl/glcpp/tests/008-define-empty.c.expected | 2 +- .../glcpp/tests/011-define-func-empty.c.expected | 2 +- src/glsl/glcpp/tests/068-accidental-pasting.c | 11 +++++++++++ .../glcpp/tests/068-accidental-pasting.c.expected | 12 ++++++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 src/glsl/glcpp/tests/068-accidental-pasting.c create mode 100644 src/glsl/glcpp/tests/068-accidental-pasting.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c37c9bcff0..e4dcc76e0a 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1048,6 +1048,19 @@ _arguments_parse (argument_list_t *arguments, return FUNCTION_STATUS_SUCCESS; } +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + token_list_t *list; + token_t *space; + + list = _token_list_create (ctx); + space = _token_create_ival (list, SPACE, SPACE); + _token_list_append (list, space); + + return list; +} + /* This is a helper function that's essentially part of the * implementation of _glcpp_parser_expand_node. It shouldn't be called * except for by that function. @@ -1097,9 +1110,10 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, return NULL; } + /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) { talloc_free (arguments); - return _token_list_create (parser); + return _token_list_create_with_one_space (parser); } if (! ((_argument_list_length (arguments) == @@ -1203,7 +1217,7 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, * * Otherwise, returns the token list that results from the expansion * and sets *last to the last node in the list that was consumed by - * the expansion. Specificallty, *last will be set as follows: + * the expansion. Specifically, *last will be set as follows: * * As 'node' in the case of object-like macro expansion. * @@ -1262,8 +1276,9 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, { *last = node; + /* Replace a macro defined as empty with a SPACE token. */ if (macro->replacements == NULL) - return _token_list_create (parser); + return _token_list_create_with_one_space (parser); return _token_list_copy (parser, macro->replacements); } diff --git a/src/glsl/glcpp/tests/008-define-empty.c.expected b/src/glsl/glcpp/tests/008-define-empty.c.expected index b28b04f643..c0f53d75c7 100644 --- a/src/glsl/glcpp/tests/008-define-empty.c.expected +++ b/src/glsl/glcpp/tests/008-define-empty.c.expected @@ -1,3 +1,3 @@ - + diff --git a/src/glsl/glcpp/tests/011-define-func-empty.c.expected b/src/glsl/glcpp/tests/011-define-func-empty.c.expected index b28b04f643..c0f53d75c7 100644 --- a/src/glsl/glcpp/tests/011-define-func-empty.c.expected +++ b/src/glsl/glcpp/tests/011-define-func-empty.c.expected @@ -1,3 +1,3 @@ - + diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c b/src/glsl/glcpp/tests/068-accidental-pasting.c new file mode 100644 index 0000000000..699ac5144e --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c @@ -0,0 +1,11 @@ +#define empty +empty> +>empty= +=empty= +!empty= +&empty& +|empty| ++empty+ +-empty- diff --git a/src/glsl/glcpp/tests/068-accidental-pasting.c.expected b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected new file mode 100644 index 0000000000..ce41cd6e52 --- /dev/null +++ b/src/glsl/glcpp/tests/068-accidental-pasting.c.expected @@ -0,0 +1,12 @@ + +< < +< = +> > +> = += = +! = +& & +| | ++ + +- - + -- cgit v1.2.3 From e340854115f2562109c91fa908ffe6628432f989 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 12 Jul 2010 13:55:10 -0700 Subject: glsl2: Move constant_expression_value method to ir_rvalue. This prevents top-level callers from asking for the value of something that is guaranteed not to have one. --- src/glsl/ir.h | 4 ++-- src/glsl/ir_constant_expression.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 1d667be89c..b6cd1bae31 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -71,8 +71,6 @@ public: enum ir_node_type ir_type; const struct glsl_type *type; - class ir_constant *constant_expression_value(); - /** ir_print_visitor helper for debugging. */ void print(void) const; @@ -114,6 +112,8 @@ protected: class ir_rvalue : public ir_instruction { public: + class ir_constant *constant_expression_value(); + virtual ir_rvalue *clone(struct hash_table *) const = 0; virtual ir_rvalue * as_rvalue() diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ca834978f4..44f4a64209 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -96,7 +96,7 @@ public: ir_constant * -ir_instruction::constant_expression_value() +ir_rvalue::constant_expression_value() { ir_constant_visitor visitor; -- cgit v1.2.3 From fb2ffd2846b48cb50128fb74df56f2ee63179832 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 15 Jul 2010 10:09:09 -0700 Subject: ir_constant_expression: Convert from a visitor to a virtual function. The constant_expression_wrapper was already the only external API, and much of the internal code used it anyway. Also, it wouldn't ever visit non-rvalue ir_instructions, so using a visitor seemed a bit unnecessary. This uses "ir_foo *ir = this;" lines to avoid code churn. These should be removed. --- src/glsl/ir.h | 22 +++- src/glsl/ir_constant_expression.cpp | 207 +++++++----------------------------- 2 files changed, 60 insertions(+), 169 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index b6cd1bae31..3be096270d 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -112,10 +112,10 @@ protected: class ir_rvalue : public ir_instruction { public: - class ir_constant *constant_expression_value(); - virtual ir_rvalue *clone(struct hash_table *) const = 0; + virtual ir_constant *constant_expression_value() = 0; + virtual ir_rvalue * as_rvalue() { return this; @@ -511,6 +511,8 @@ public: virtual ir_assignment *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + virtual void accept(ir_visitor *v) { v->visit(this); @@ -651,6 +653,8 @@ public: virtual ir_expression *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + static unsigned int get_num_operands(ir_expression_operation); unsigned int get_num_operands() const { @@ -695,6 +699,8 @@ public: virtual ir_call *clone(struct hash_table *ht) const; + virtual ir_constant *constant_expression_value(); + virtual ir_call *as_call() { return this; @@ -929,6 +935,8 @@ public: virtual ir_texture *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual void accept(ir_visitor *v) { v->visit(this); @@ -1019,6 +1027,8 @@ public: virtual ir_swizzle *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_swizzle *as_swizzle() { return this; @@ -1083,6 +1093,8 @@ public: virtual ir_dereference_variable *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_dereference_variable *as_dereference_variable() { return this; @@ -1129,6 +1141,8 @@ public: virtual ir_dereference_array *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_dereference_array *as_dereference_array() { return this; @@ -1165,6 +1179,8 @@ public: virtual ir_dereference_record *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + /** * Get the variable that is ultimately referenced by an r-value */ @@ -1223,6 +1239,8 @@ public: virtual ir_constant *clone(struct hash_table *) const; + virtual ir_constant *constant_expression_value(); + virtual ir_constant *as_constant() { return this; diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 44f4a64209..e3e717a14e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -41,97 +41,10 @@ #define min(x,y) (x) < (y) ? (x) : (y) #define max(x,y) (x) > (y) ? (x) : (y) -/** - * Visitor class for evaluating constant expressions - */ -class ir_constant_visitor : public ir_visitor { -public: - ir_constant_visitor() - : value(NULL) - { - /* empty */ - } - - virtual ~ir_constant_visitor() - { - /* empty */ - } - - /** - * \name Visit methods - * - * As typical for the visitor pattern, there must be one \c visit method for - * each concrete subclass of \c ir_instruction. Virtual base classes within - * the hierarchy should not have \c visit methods. - */ - /*@{*/ - virtual void visit(ir_variable *); - virtual void visit(ir_function_signature *); - virtual void visit(ir_function *); - virtual void visit(ir_expression *); - virtual void visit(ir_texture *); - virtual void visit(ir_swizzle *); - virtual void visit(ir_dereference_variable *); - virtual void visit(ir_dereference_array *); - virtual void visit(ir_dereference_record *); - virtual void visit(ir_assignment *); - virtual void visit(ir_constant *); - virtual void visit(ir_call *); - virtual void visit(ir_return *); - virtual void visit(ir_discard *); - virtual void visit(ir_if *); - virtual void visit(ir_loop *); - virtual void visit(ir_loop_jump *); - /*@}*/ - - /** - * Value of the constant expression. - * - * \note - * This field will be \c NULL if the expression is not constant valued. - */ - /* FINIHSME: This cannot hold values for constant arrays or structures. */ - ir_constant *value; -}; - - ir_constant * -ir_rvalue::constant_expression_value() -{ - ir_constant_visitor visitor; - - this->accept(& visitor); - return visitor.value; -} - - -void -ir_constant_visitor::visit(ir_variable *ir) -{ - (void) ir; - value = NULL; -} - - -void -ir_constant_visitor::visit(ir_function_signature *ir) -{ - (void) ir; - value = NULL; -} - - -void -ir_constant_visitor::visit(ir_function *ir) +ir_expression::constant_expression_value() { - (void) ir; - value = NULL; -} - -void -ir_constant_visitor::visit(ir_expression *ir) -{ - value = NULL; + ir_expression *ir = this; ir_constant *op[2] = { NULL, NULL }; ir_constant_data data; @@ -140,7 +53,7 @@ ir_constant_visitor::visit(ir_expression *ir) for (unsigned operand = 0; operand < ir->get_num_operands(); operand++) { op[operand] = ir->operands[operand]->constant_expression_value(); if (!op[operand]) - return; + return NULL; } if (op[1] != NULL) @@ -735,30 +648,28 @@ ir_constant_visitor::visit(ir_expression *ir) default: /* FINISHME: Should handle all expression types. */ - return; + return NULL; } void *ctx = talloc_parent(ir); - this->value = new(ctx) ir_constant(ir->type, &data); + return new(ctx) ir_constant(ir->type, &data); } -void -ir_constant_visitor::visit(ir_texture *ir) +ir_constant * +ir_texture::constant_expression_value() { - // FINISHME: Do stuff with texture lookups - (void) ir; - value = NULL; + /* texture lookups aren't constant expressions */ + return NULL; } -void -ir_constant_visitor::visit(ir_swizzle *ir) +ir_constant * +ir_swizzle::constant_expression_value() { + ir_swizzle *ir = this; ir_constant *v = ir->val->constant_expression_value(); - this->value = NULL; - if (v != NULL) { ir_constant_data data; @@ -777,31 +688,30 @@ ir_constant_visitor::visit(ir_swizzle *ir) } void *ctx = talloc_parent(ir); - this->value = new(ctx) ir_constant(ir->type, &data); + return new(ctx) ir_constant(ir->type, &data); } + return NULL; } -void -ir_constant_visitor::visit(ir_dereference_variable *ir) +ir_constant * +ir_dereference_variable::constant_expression_value() { - value = NULL; - - ir_variable *var = ir->variable_referenced(); + ir_variable *var = this->variable_referenced(); if (var && var->constant_value) - value = var->constant_value->clone(NULL); + return var->constant_value->clone(NULL); + return NULL; } -void -ir_constant_visitor::visit(ir_dereference_array *ir) +ir_constant * +ir_dereference_array::constant_expression_value() { + ir_dereference_array *ir = this; void *ctx = talloc_parent(ir); ir_constant *array = ir->array->constant_expression_value(); ir_constant *idx = ir->array_index->constant_expression_value(); - this->value = NULL; - if ((array != NULL) && (idx != NULL)) { if (array->type->is_matrix()) { /* Array access of a matrix results in a vector. @@ -836,85 +746,48 @@ ir_constant_visitor::visit(ir_dereference_array *ir) break; } - this->value = new(ctx) ir_constant(column_type, &data); + return new(ctx) ir_constant(column_type, &data); } else if (array->type->is_vector()) { const unsigned component = idx->value.u[0]; - this->value = new(ctx) ir_constant(array, component); + return new(ctx) ir_constant(array, component); } else { /* FINISHME: Handle access of constant arrays. */ } } + return NULL; } -void -ir_constant_visitor::visit(ir_dereference_record *ir) +ir_constant * +ir_dereference_record::constant_expression_value() { + ir_dereference_record *ir = this; ir_constant *v = ir->record->constant_expression_value(); - this->value = (v != NULL) ? v->get_record_field(ir->field) : NULL; -} - - -void -ir_constant_visitor::visit(ir_assignment *ir) -{ - (void) ir; - value = NULL; -} - - -void -ir_constant_visitor::visit(ir_constant *ir) -{ - value = ir; -} - - -void -ir_constant_visitor::visit(ir_call *ir) -{ - (void) ir; - value = NULL; -} - - -void -ir_constant_visitor::visit(ir_return *ir) -{ - (void) ir; - value = NULL; + return (v != NULL) ? v->get_record_field(ir->field) : NULL; } -void -ir_constant_visitor::visit(ir_discard *ir) +ir_constant * +ir_assignment::constant_expression_value() { - (void) ir; - value = NULL; + /* FINISHME: Handle CEs involving assignment (return RHS) */ + return NULL; } -void -ir_constant_visitor::visit(ir_if *ir) +ir_constant * +ir_constant::constant_expression_value() { - (void) ir; - value = NULL; + return this; } -void -ir_constant_visitor::visit(ir_loop *ir) +ir_constant * +ir_call::constant_expression_value() { - (void) ir; - value = NULL; + /* FINISHME: Handle CEs involving builtin function calls. */ + return NULL; } - -void -ir_constant_visitor::visit(ir_loop_jump *ir) -{ - (void) ir; - value = NULL; -} -- cgit v1.2.3 From 98f32a13bef1eef732304eb8e2781e08835ff69a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 15 Jul 2010 10:20:51 -0700 Subject: ir_constant_expression: Use "this" pointer directly. In ir_expression's signature, I replaced ir->operands[i] with op[i] as it is more concise; an assertion already ensures these are equal. --- src/glsl/ir_constant_expression.cpp | 132 +++++++++++++++++------------------- 1 file changed, 64 insertions(+), 68 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index e3e717a14e..186d0c48c1 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -44,14 +44,13 @@ ir_constant * ir_expression::constant_expression_value() { - ir_expression *ir = this; ir_constant *op[2] = { NULL, NULL }; ir_constant_data data; memset(&data, 0, sizeof(data)); - for (unsigned operand = 0; operand < ir->get_num_operands(); operand++) { - op[operand] = ir->operands[operand]->constant_expression_value(); + for (unsigned operand = 0; operand < this->get_num_operands(); operand++) { + op[operand] = this->operands[operand]->constant_expression_value(); if (!op[operand]) return NULL; } @@ -74,23 +73,23 @@ ir_expression::constant_expression_value() components = op[1]->type->components(); } - switch (ir->operation) { + switch (this->operation) { case ir_unop_logic_not: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < op[0]->type->components(); c++) data.b[c] = !op[0]->value.b[c]; break; case ir_unop_f2i: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.i[c] = op[0]->value.f[c]; } break; case ir_unop_i2f: assert(op[0]->type->base_type == GLSL_TYPE_UINT || op[0]->type->base_type == GLSL_TYPE_INT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { if (op[0]->type->base_type == GLSL_TYPE_INT) data.f[c] = op[0]->value.i[c]; else @@ -99,53 +98,53 @@ ir_expression::constant_expression_value() break; case ir_unop_b2f: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = op[0]->value.b[c] ? 1.0 : 0.0; } break; case ir_unop_f2b: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.b[c] = bool(op[0]->value.f[c]); } break; case ir_unop_b2i: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.u[c] = op[0]->value.b[c] ? 1 : 0; } break; case ir_unop_i2b: assert(op[0]->type->is_integer()); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.b[c] = bool(op[0]->value.u[c]); } break; case ir_unop_trunc: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = truncf(op[0]->value.f[c]); } break; case ir_unop_ceil: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = ceilf(op[0]->value.f[c]); } break; case ir_unop_floor: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = floorf(op[0]->value.f[c]); } break; case ir_unop_fract: - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = 0; break; @@ -163,21 +162,21 @@ ir_expression::constant_expression_value() case ir_unop_sin: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = sinf(op[0]->value.f[c]); } break; case ir_unop_cos: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = cosf(op[0]->value.f[c]); } break; case ir_unop_neg: - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = -op[0]->value.u[c]; break; @@ -194,8 +193,8 @@ ir_expression::constant_expression_value() break; case ir_unop_abs: - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c]; break; @@ -214,8 +213,8 @@ ir_expression::constant_expression_value() break; case ir_unop_sign: - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.i[c] > 0; break; @@ -233,8 +232,8 @@ ir_expression::constant_expression_value() case ir_unop_rcp: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { case GLSL_TYPE_UINT: if (op[0]->value.u[c] != 0.0) data.u[c] = 1 / op[0]->value.u[c]; @@ -255,42 +254,42 @@ ir_expression::constant_expression_value() case ir_unop_rsq: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = 1.0 / sqrtf(op[0]->value.f[c]); } break; case ir_unop_sqrt: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = sqrtf(op[0]->value.f[c]); } break; case ir_unop_exp: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = expf(op[0]->value.f[c]); } break; case ir_unop_exp2: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = exp2f(op[0]->value.f[c]); } break; case ir_unop_log: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = logf(op[0]->value.f[c]); } break; case ir_unop_log2: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = log2f(op[0]->value.f[c]); } break; @@ -298,14 +297,14 @@ ir_expression::constant_expression_value() case ir_unop_dFdx: case ir_unop_dFdy: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = 0.0; } break; case ir_binop_pow: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]); } break; @@ -314,7 +313,7 @@ ir_expression::constant_expression_value() assert(op[0]->type->is_vector() && op[1]->type->is_vector()); data.f[0] = 0; for (unsigned c = 0; c < op[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[0] += op[0]->value.u[c] * op[1]->value.u[c]; break; @@ -336,7 +335,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = min(op[0]->value.u[c0], op[1]->value.u[c1]); break; @@ -358,7 +357,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = max(op[0]->value.u[c0], op[1]->value.u[c1]); break; @@ -391,7 +390,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1]; break; @@ -413,7 +412,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1]; break; @@ -437,7 +436,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1]; break; @@ -483,7 +482,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1]; break; @@ -505,7 +504,7 @@ ir_expression::constant_expression_value() c < components; c0 += c0_inc, c1 += c1_inc, c++) { - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1]; break; @@ -528,22 +527,22 @@ ir_expression::constant_expression_value() case ir_binop_logic_and: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < op[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] && op[1]->value.b[c]; break; case ir_binop_logic_xor: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < op[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c]; break; case ir_binop_logic_or: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) + for (unsigned c = 0; c < op[0]->type->components(); c++) data.b[c] = op[0]->value.b[c] || op[1]->value.b[c]; break; case ir_binop_less: - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = op[0]->value.u[0] < op[1]->value.u[0]; break; @@ -558,7 +557,7 @@ ir_expression::constant_expression_value() } break; case ir_binop_greater: - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = op[0]->value.u[0] > op[1]->value.u[0]; break; @@ -573,7 +572,7 @@ ir_expression::constant_expression_value() } break; case ir_binop_lequal: - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0]; break; @@ -588,7 +587,7 @@ ir_expression::constant_expression_value() } break; case ir_binop_gequal: - switch (ir->operands[0]->type->base_type) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0]; break; @@ -605,8 +604,8 @@ ir_expression::constant_expression_value() case ir_binop_equal: data.b[0] = true; - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c]; break; @@ -626,8 +625,8 @@ ir_expression::constant_expression_value() break; case ir_binop_nequal: data.b[0] = false; - for (unsigned c = 0; c < ir->operands[0]->type->components(); c++) { - switch (ir->operands[0]->type->base_type) { + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c]; break; @@ -651,8 +650,8 @@ ir_expression::constant_expression_value() return NULL; } - void *ctx = talloc_parent(ir); - return new(ctx) ir_constant(ir->type, &data); + void *ctx = talloc_parent(this); + return new(ctx) ir_constant(this->type, &data); } @@ -667,17 +666,16 @@ ir_texture::constant_expression_value() ir_constant * ir_swizzle::constant_expression_value() { - ir_swizzle *ir = this; - ir_constant *v = ir->val->constant_expression_value(); + ir_constant *v = this->val->constant_expression_value(); if (v != NULL) { ir_constant_data data; const unsigned swiz_idx[4] = { - ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w + this->mask.x, this->mask.y, this->mask.z, this->mask.w }; - for (unsigned i = 0; i < ir->mask.num_components; i++) { + for (unsigned i = 0; i < this->mask.num_components; i++) { switch (v->type->base_type) { case GLSL_TYPE_UINT: case GLSL_TYPE_INT: data.u[i] = v->value.u[swiz_idx[i]]; break; @@ -687,8 +685,8 @@ ir_swizzle::constant_expression_value() } } - void *ctx = talloc_parent(ir); - return new(ctx) ir_constant(ir->type, &data); + void *ctx = talloc_parent(this); + return new(ctx) ir_constant(this->type, &data); } return NULL; } @@ -707,10 +705,9 @@ ir_dereference_variable::constant_expression_value() ir_constant * ir_dereference_array::constant_expression_value() { - ir_dereference_array *ir = this; - void *ctx = talloc_parent(ir); - ir_constant *array = ir->array->constant_expression_value(); - ir_constant *idx = ir->array_index->constant_expression_value(); + void *ctx = talloc_parent(this); + ir_constant *array = this->array->constant_expression_value(); + ir_constant *idx = this->array_index->constant_expression_value(); if ((array != NULL) && (idx != NULL)) { if (array->type->is_matrix()) { @@ -762,10 +759,9 @@ ir_dereference_array::constant_expression_value() ir_constant * ir_dereference_record::constant_expression_value() { - ir_dereference_record *ir = this; - ir_constant *v = ir->record->constant_expression_value(); + ir_constant *v = this->record->constant_expression_value(); - return (v != NULL) ? v->get_record_field(ir->field) : NULL; + return (v != NULL) ? v->get_record_field(this->field) : NULL; } -- cgit v1.2.3 From e4768eecd5da6f9e955aa7c3892810813623f0dc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 15 Jul 2010 10:27:53 -0700 Subject: ir_constant_expression: Remove pointless use of variable_referenced. ir_dereference_variable always references an ir_variable, so there's no point in calling a function and NULL-checking the result. --- src/glsl/ir_constant_expression.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 186d0c48c1..cb07f38128 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -695,10 +695,7 @@ ir_swizzle::constant_expression_value() ir_constant * ir_dereference_variable::constant_expression_value() { - ir_variable *var = this->variable_referenced(); - if (var && var->constant_value) - return var->constant_value->clone(NULL); - return NULL; + return var->constant_value ? var->constant_value->clone(NULL) : NULL; } -- cgit v1.2.3 From 2b7c42b40ae459f7b290eb134d6dabd075aab9f0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 16 Jul 2010 18:28:44 -0700 Subject: glsl2: Disallow non-constant array indexing for unsized arrays. Fixes piglit test unsized-array-non-const-index.vert. --- src/glsl/ast_to_hir.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 98090d2b01..41371e7536 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1233,6 +1233,8 @@ ast_expression::hir(exec_list *instructions, if ((v != NULL) && (unsigned(idx) > v->max_array_access)) v->max_array_access = idx; } + } else if (array->type->array_size() == 0) { + _mesa_glsl_error(&loc, state, "unsized array index must be constant"); } if (error_emitted) -- cgit v1.2.3 From 1036a7ebae2da03efd1b990037b6fd102d4cc5ca Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 17 Jul 2010 22:42:35 -0700 Subject: glsl2: Remove incorrect assertion in the parser. This assertion is triggered by method calls (i.e. array.length()), where subexpressions[1] is an ast_function_call expression. Since the assertion itself had a comment saying it could be removed eventually, simply do so. Causes negative glslparser tests array-length-110.frag, array-length-args.frag, and array-length-unsized.frag to pass, but only because the length() method is not supported yet. --- src/glsl/glsl_parser.ypp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index f85b419271..6782255d45 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -304,12 +304,6 @@ postfix_expression: } | function_call { - /* Function call parameters used to be stored as a circular list in - * subexpressions[1]. They are now stored as a regular list in - * expressions. This assertion validates that the old code was - * correctly converted. It can eventually be removed. - */ - assert($1->subexpressions[1] == NULL); $$ = $1; } | postfix_expression '.' IDENTIFIER -- cgit v1.2.3 From 094cf8c199930d958d9e1139467eb8579d082df6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 17 Jul 2010 22:50:26 -0700 Subject: glsl2: Add support for the .length() method on arrays. Fixes piglit test glsl-array-length, and provides proper error messages for negative piglit tests array-length-110.frag, array-length-unsized.frag, and array-length-args.frag. --- src/glsl/hir_field_selection.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 5500e09d7e..db1e06932f 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -71,6 +71,28 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, "structure", expr->primary_expression.identifier); } + } else if (expr->subexpressions[1] != NULL) { + /* Handle "method calls" in GLSL 1.20 - namely, array.length() */ + if (state->language_version < 120) + _mesa_glsl_error(&loc, state, "Methods not supported in GLSL 1.10."); + + ast_expression *call = expr->subexpressions[1]; + assert(call->oper == ast_function_call); + + const char *method; + method = call->subexpressions[0]->primary_expression.identifier; + + if (op->type->is_array() && strcmp(method, "length") == 0) { + if (!call->expressions.is_empty()) + _mesa_glsl_error(&loc, state, "length method takes no arguments."); + + if (op->type->array_size() == 0) + _mesa_glsl_error(&loc, state, "length called on unsized array."); + + result = new(ctx) ir_constant(op->type->array_size()); + } else { + _mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method); + } } else { _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " "non-structure / non-vector.", -- cgit v1.2.3 From b6e92ad7da9d4f00607caca90bd0b8853623a493 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 16:38:23 -0700 Subject: glsl2: Don't claim a match on structure types with different field names. We regularly do lookups on the field names of the structure to find the types within the struct, so returning a structure type with bad names will lead to lots of error types being found. --- src/glsl/glsl_types.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index d6799cf428..6ca141ef48 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -438,10 +438,13 @@ glsl_type::record_key_compare(const void *a, const void *b) if (key1->length != key2->length) return 1; - for (unsigned i = 0; i < key1->length; i++) - /* FINISHME: Is the name of the structure field also significant? */ + for (unsigned i = 0; i < key1->length; i++) { if (key1->fields.structure[i].type != key2->fields.structure[i].type) return 1; + if (strcmp(key1->fields.structure[i].name, + key2->fields.structure[i].name) != 0) + return 1; + } return 0; } -- cgit v1.2.3 From 21b0dbd79937e9d6787f045af7d60d4b6c649ec8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 16:47:25 -0700 Subject: glsl2: talloc the glsl_struct_field[] we use to look up structure types. Since the types are singletons across the lifetime of the compiler, repeatedly compiling a program with the same structure type defined would drop a copy of the array on the floor per compile. This is a bit tricky because the static GLSL types are not called with the talloc-based new, so we have to use the global type context, which may not be initialized yet. --- src/glsl/ast_to_hir.cpp | 4 ++-- src/glsl/glsl_types.cpp | 15 ++++++++++++++- src/glsl/glsl_types.h | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 41371e7536..f20c7ead33 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2471,8 +2471,8 @@ ast_struct_specifier::hir(exec_list *instructions, * the types to HIR. This ensures that structure definitions embedded in * other structure definitions are processed. */ - glsl_struct_field *const fields = (glsl_struct_field *) - malloc(sizeof(*fields) * decl_count); + glsl_struct_field *const fields = talloc_array(state, glsl_struct_field, + decl_count); unsigned i = 0; foreach_list_typed (ast_declarator_list, decl_list, link, diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 6ca141ef48..77c591ed69 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -75,7 +75,20 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, name(name), length(num_fields) { - this->fields.structure = fields; + unsigned int i; + + if (glsl_type::ctx == NULL) { + glsl_type::ctx = talloc_init("glsl_type"); + assert(glsl_type::ctx != NULL); + } + + this->fields.structure = talloc_array(glsl_type::ctx, + glsl_struct_field, length); + for (i = 0; i < length; i++) { + this->fields.structure[i].type = fields[i].type; + this->fields.structure[i].name = talloc_strdup(this->fields.structure, + fields[i].name); + } } static void diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index e869071cab..8ba9b5ff63 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -136,7 +136,7 @@ struct glsl_type { union { const struct glsl_type *array; /**< Type of array elements. */ const struct glsl_type *parameters; /**< Parameters to function. */ - const struct glsl_struct_field *structure;/**< List of struct fields. */ + struct glsl_struct_field *structure; /**< List of struct fields. */ } fields; -- cgit v1.2.3 From fade78edcbff1e0ae24a1e2c455be2cc7932ee9c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 17:17:47 -0700 Subject: glsl2: strdup the field names used in dereference_record. Otherwise, after linking and freeing the old data, the pointer would dangle. Partial fix for glsl1-struct*. --- src/glsl/ir.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 1648848ecb..ba8ee7b9ac 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -514,7 +514,7 @@ ir_dereference_record::ir_dereference_record(ir_rvalue *value, { this->ir_type = ir_type_dereference_record; this->record = value; - this->field = field; + this->field = talloc_strdup(this, field); this->type = (this->record != NULL) ? this->record->type->field_type(field) : glsl_type::error_type; } @@ -527,7 +527,7 @@ ir_dereference_record::ir_dereference_record(ir_variable *var, this->ir_type = ir_type_dereference_record; this->record = new(ctx) ir_dereference_variable(var); - this->field = field; + this->field = talloc_strdup(this, field); this->type = (this->record != NULL) ? this->record->type->field_type(field) : glsl_type::error_type; } -- cgit v1.2.3 From f141fa63a4391621cc92cd2c39724a952b297a58 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Jul 2010 17:18:57 -0700 Subject: glsl2: Check that nodes in a valid tree aren't error-type. We're good at propagating error types around, but finding when the first one was triggered can be painful if we aren't paying attention. --- src/glsl/ir_validate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 8a567954a1..c05edf2ee3 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -37,7 +37,7 @@ #include "ir.h" #include "ir_hierarchical_visitor.h" #include "hash_table.h" - +#include "glsl_types.h" class ir_validate : public ir_hierarchical_visitor { public: @@ -179,6 +179,7 @@ check_node_type(ir_instruction *ir, void *data) printf("Instruction node with unset type\n"); ir->print(); printf("\n"); } + assert(ir->type != glsl_type::error_type); } void -- cgit v1.2.3 From 7e2aa91507a5883e33473e0a94215ee3985baad1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 19 Jul 2010 17:12:42 -0700 Subject: glsl2: Add and use new variable mode ir_var_temporary This is quite a large patch because breaking it into smaller pieces would result in the tree being intermitently broken. The big changes are: * Add the ir_var_temporary variable mode * Change the ir_variable constructor to take the mode as a parameter and correctly specify the mode for all ir_varables. * Change the linker to not cross validate ir_var_temporary variables. * Change the linker to pull all ir_var_temporary variables from global scope into 'main'. --- src/glsl/ast_function.cpp | 21 +++++++++----- src/glsl/ast_to_hir.cpp | 26 ++++++++++------- src/glsl/glsl_types.cpp | 7 ++--- src/glsl/ir.cpp | 6 ++-- src/glsl/ir.h | 5 ++-- src/glsl/ir_clone.cpp | 4 +-- src/glsl/ir_expression_flattening.cpp | 2 +- src/glsl/ir_function.cpp | 1 + src/glsl/ir_function_inlining.cpp | 3 +- src/glsl/ir_if_return.cpp | 3 +- src/glsl/ir_if_to_cond_assign.cpp | 3 +- src/glsl/ir_mat_op_to_vec.cpp | 3 +- src/glsl/ir_mod_to_fract.cpp | 3 +- src/glsl/ir_reader.cpp | 3 +- src/glsl/ir_variable.cpp | 3 +- src/glsl/ir_vec_index_to_cond_assign.cpp | 12 +++++--- src/glsl/linker.cpp | 50 ++++++++++++++++++++++++++++---- src/mesa/shader/ir_to_mesa.cpp | 1 + 18 files changed, 109 insertions(+), 47 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 643eb229a7..14c36af911 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -115,7 +115,8 @@ process_call(exec_list *instructions, ir_function *f, var = new(ctx) ir_variable(sig->return_type, talloc_asprintf(ctx, "%s_retval", - sig->function_name())); + sig->function_name()), + ir_var_temporary); instructions->push_tail(var); deref = new(ctx) ir_dereference_variable(var); @@ -509,7 +510,8 @@ emit_inline_vector_constructor(const glsl_type *type, assert(!parameters->is_empty()); ir_variable *var = new(ctx) ir_variable(type, - talloc_strdup(ctx, "vec_ctor")); + talloc_strdup(ctx, "vec_ctor"), + ir_var_temporary); instructions->push_tail(var); /* There are two kinds of vector constructors. @@ -621,7 +623,8 @@ emit_inline_matrix_constructor(const glsl_type *type, assert(!parameters->is_empty()); ir_variable *var = new(ctx) ir_variable(type, - talloc_strdup(ctx, "mat_ctor")); + talloc_strdup(ctx, "mat_ctor"), + ir_var_temporary); instructions->push_tail(var); /* There are three kinds of matrix constructors. @@ -645,7 +648,8 @@ emit_inline_matrix_constructor(const glsl_type *type, */ ir_variable *rhs_var = new(ctx) ir_variable(glsl_type::vec4_type, - talloc_strdup(ctx, "mat_ctor_vec")); + talloc_strdup(ctx, "mat_ctor_vec"), + ir_var_temporary); instructions->push_tail(rhs_var); ir_constant_data zero; @@ -759,7 +763,8 @@ emit_inline_matrix_constructor(const glsl_type *type, */ ir_variable *const rhs_var = new(ctx) ir_variable(first_param->type, - talloc_strdup(ctx, "mat_ctor_mat")); + talloc_strdup(ctx, "mat_ctor_mat"), + ir_var_temporary); instructions->push_tail(rhs_var); ir_dereference *const rhs_var_ref = @@ -825,7 +830,8 @@ emit_inline_matrix_constructor(const glsl_type *type, */ ir_variable *rhs_var = new(ctx) ir_variable(rhs->type, - talloc_strdup(ctx, "mat_ctor_vec")); + talloc_strdup(ctx, "mat_ctor_vec"), + ir_var_temporary); instructions->push_tail(rhs_var); ir_dereference *rhs_var_ref = @@ -1036,7 +1042,8 @@ ast_function_expression::hir(exec_list *instructions, continue; /* Create a temporary containing the matrix. */ - ir_variable *var = new(ctx) ir_variable(matrix->type, "matrix_tmp"); + 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)); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index f20c7ead33..c68e136256 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -527,7 +527,8 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, * 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_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, @@ -549,7 +550,8 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) ir_variable *var; /* FINISHME: Give unique names to the temporaries. */ - var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp"); + var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp", + ir_var_temporary); instructions->push_tail(var); var->mode = ir_var_auto; @@ -806,7 +808,8 @@ ast_expression::hir(exec_list *instructions, type = glsl_type::bool_type; } else { ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, - "and_tmp"); + "and_tmp", + ir_var_temporary); instructions->push_tail(tmp); ir_if *const stmt = new(ctx) ir_if(op[0]); @@ -870,7 +873,8 @@ ast_expression::hir(exec_list *instructions, type = glsl_type::bool_type; } else { ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, - "or_tmp"); + "or_tmp", + ir_var_temporary); instructions->push_tail(tmp); ir_if *const stmt = new(ctx) ir_if(op[0]); @@ -1049,7 +1053,8 @@ ast_expression::hir(exec_list *instructions, && (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_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]); @@ -1474,6 +1479,9 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, } } + /* If there is no qualifier that changes the mode of the variable, leave + * the setting alone. + */ if (qual->in && qual->out) var->mode = ir_var_inout; else if (qual->attribute || qual->in @@ -1483,8 +1491,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, var->mode = ir_var_out; else if (qual->uniform) var->mode = ir_var_uniform; - else - var->mode = ir_var_auto; if (qual->uniform) var->shader_in = true; @@ -1633,7 +1639,7 @@ ast_declarator_list::hir(exec_list *instructions, var_type = decl_type; } - var = new(ctx) ir_variable(var_type, decl->identifier); + 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; * @@ -1993,7 +1999,7 @@ ast_parameter_declarator::hir(exec_list *instructions, } is_void = false; - ir_variable *var = new(ctx) ir_variable(type, this->identifier); + ir_variable *var = new(ctx) ir_variable(type, this->identifier, ir_var_in); /* FINISHME: Handle array declarations. Note that this requires * FINISHME: complete handling of constant expressions. @@ -2003,8 +2009,6 @@ ast_parameter_declarator::hir(exec_list *instructions, * for function parameters the default mode is 'in'. */ apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc); - if (var->mode == ir_var_auto) - var->mode = ir_var_in; instructions->push_tail(var); diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 77c591ed69..5cb327c89d 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -251,10 +251,9 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const snprintf(param_name, 10, "p%08X", i); ir_variable *var = (this->base_type == GLSL_TYPE_ARRAY) - ? new(ctx) ir_variable(fields.array, param_name) - : new(ctx) ir_variable(fields.structure[i].type, param_name); + ? new(ctx) ir_variable(fields.array, param_name, ir_var_in) + : new(ctx) ir_variable(fields.structure[i].type, param_name, ir_var_in); - var->mode = ir_var_in; declarations[i] = var; sig->parameters.push_tail(var); } @@ -264,7 +263,7 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const * the same type as the constructor. After initializing __retval, * __retval is returned. */ - ir_variable *retval = new(ctx) ir_variable(this, "__retval"); + ir_variable *retval = new(ctx) ir_variable(this, "__retval", ir_var_auto); sig->body.push_tail(retval); for (unsigned i = 0; i < length; i++) { diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index ba8ee7b9ac..146ff17af3 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -748,10 +748,12 @@ ir_swizzle::variable_referenced() return this->val->variable_referenced(); } -ir_variable::ir_variable(const struct glsl_type *type, const char *name) + +ir_variable::ir_variable(const struct glsl_type *type, const char *name, + ir_variable_mode mode) : max_array_access(0), read_only(false), centroid(false), invariant(false), shader_in(false), shader_out(false), - mode(ir_var_auto), interpolation(ir_var_smooth), array_lvalue(false) + mode(mode), interpolation(ir_var_smooth), array_lvalue(false) { this->ir_type = ir_type_variable; this->type = type; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 3be096270d..9fd9850391 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -162,7 +162,8 @@ enum ir_variable_mode { ir_var_uniform, ir_var_in, ir_var_out, - ir_var_inout + ir_var_inout, + ir_var_temporary /**< Temporary variable generated during compilation. */ }; enum ir_variable_interpolation { @@ -174,7 +175,7 @@ enum ir_variable_interpolation { class ir_variable : public ir_instruction { public: - ir_variable(const struct glsl_type *, const char *); + ir_variable(const struct glsl_type *, const char *, ir_variable_mode); virtual ir_variable *clone(struct hash_table *ht) const; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 91d6977354..f7e8794728 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -39,7 +39,8 @@ ir_variable * ir_variable::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); - ir_variable *var = new(ctx) ir_variable(type, name); + ir_variable *var = new(ctx) ir_variable(this->type, this->name, + (ir_variable_mode) this->mode); var->max_array_access = this->max_array_access; var->read_only = this->read_only; @@ -47,7 +48,6 @@ ir_variable::clone(struct hash_table *ht) const var->invariant = this->invariant; var->shader_in = this->shader_in; var->shader_out = this->shader_out; - var->mode = this->mode; var->interpolation = this->interpolation; var->array_lvalue = this->array_lvalue; var->location = this->location; diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index f18659342f..6dbebc6378 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -89,7 +89,7 @@ ir_expression_flattening_visitor::operand_to_temp(ir_rvalue *ir) if (!this->predicate(ir)) return ir; - var = new(ctx) ir_variable(ir->type, "flattening_tmp"); + var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary); base_ir->insert_before(var); assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index e85b18ce02..28a5c399f1 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -116,6 +116,7 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) switch ((enum ir_variable_mode)(param->mode)) { case ir_var_auto: case ir_var_uniform: + case ir_var_temporary: /* These are all error conditions. It is invalid for a parameter to * a function to be declared as auto (not in, out, or inout) or * as uniform. diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index a3f7089cdc..05dd83f7ff 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -122,7 +122,8 @@ ir_call::generate_inline(ir_instruction *next_ir) /* Generate storage for the return value. */ if (this->callee->return_type) { - retval = new(ctx) ir_variable(this->callee->return_type, "__retval"); + retval = new(ctx) ir_variable(this->callee->return_type, "__retval", + ir_var_auto); next_ir->insert_before(retval); } diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index f68dcfb501..a9af7166b9 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -102,7 +102,8 @@ ir_if_return_visitor::visit_enter(ir_if *ir) } else { ir_assignment *assign; ir_variable *new_var = new(ir) ir_variable(then_return->value->type, - "if_return_tmp"); + "if_return_tmp", + ir_var_temporary); ir->insert_before(new_var); assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), diff --git a/src/glsl/ir_if_to_cond_assign.cpp b/src/glsl/ir_if_to_cond_assign.cpp index 274874bbb7..0b87413941 100644 --- a/src/glsl/ir_if_to_cond_assign.cpp +++ b/src/glsl/ir_if_to_cond_assign.cpp @@ -145,7 +145,8 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) * simpler. */ cond_var = new(mem_ctx) ir_variable(glsl_type::bool_type, - "if_to_cond_assign_condition"); + "if_to_cond_assign_condition", + ir_var_temporary); ir->insert_before(cond_var); deref = new(mem_ctx) ir_dereference_variable(cond_var); diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 7bdb9057d8..742fc2a295 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -298,7 +298,8 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) ir_assignment *assign; op_var[i] = new(base_ir) ir_variable(expr->operands[i]->type, - "mat_op_to_vec"); + "mat_op_to_vec", + ir_var_temporary); base_ir->insert_before(op_var[i]); lhs_deref = new(base_ir) ir_dereference_variable(op_var[i]); diff --git a/src/glsl/ir_mod_to_fract.cpp b/src/glsl/ir_mod_to_fract.cpp index ec1e65092d..71c9472b12 100644 --- a/src/glsl/ir_mod_to_fract.cpp +++ b/src/glsl/ir_mod_to_fract.cpp @@ -60,7 +60,8 @@ ir_mod_to_fract_visitor::visit_leave(ir_expression *ir) if (ir->operation != ir_binop_mod) return visit_continue; - ir_variable *temp = new(ir) ir_variable(ir->operands[1]->type, "mod_b"); + ir_variable *temp = new(ir) ir_variable(ir->operands[1]->type, "mod_b", + ir_var_temporary); this->base_ir->insert_before(temp); ir_assignment *assign; diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index a1e5a7ad74..ed68496587 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -401,7 +401,8 @@ read_declaration(_mesa_glsl_parse_state *st, s_list *list) return NULL; } - ir_variable *var = new(ctx) ir_variable(type, var_name->value()); + ir_variable *var = new(ctx) ir_variable(type, var_name->value(), + ir_var_auto); foreach_iter(exec_list_iterator, it, quals->subexpressions) { s_symbol *qualifier = SX_AS_SYMBOL(it.get()); diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 4593c18112..700c5de648 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -39,9 +39,8 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, const glsl_type *type, exec_list *instructions, glsl_symbol_table *symtab) { - ir_variable *var = new(symtab) ir_variable(type, name); + ir_variable *var = new(symtab) ir_variable(type, name, mode); - var->mode = mode; switch (var->mode) { case ir_var_auto: var->read_only = true; diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index ac420454e8..7e04389b5f 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -86,14 +86,16 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue /* Store the index to a temporary to avoid reusing its tree. */ index = new(base_ir) ir_variable(glsl_type::int_type, - "vec_index_tmp_i"); + "vec_index_tmp_i", + ir_var_temporary); base_ir->insert_before(index); deref = new(base_ir) ir_dereference_variable(index); assign = new(base_ir) ir_assignment(deref, orig_deref->array_index, NULL); base_ir->insert_before(assign); /* Temporary where we store whichever value we swizzle out. */ - var = new(base_ir) ir_variable(ir->type, "vec_index_tmp_v"); + var = new(base_ir) ir_variable(ir->type, "vec_index_tmp_v", + ir_var_temporary); base_ir->insert_before(var); /* Generate a conditional move of each vector element to the temp. */ @@ -166,14 +168,16 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); /* Store the index to a temporary to avoid reusing its tree. */ - index = new(ir) ir_variable(glsl_type::int_type, "vec_index_tmp_i"); + index = new(ir) ir_variable(glsl_type::int_type, "vec_index_tmp_i", + ir_var_temporary); ir->insert_before(index); deref = new(ir) ir_dereference_variable(index); assign = new(ir) ir_assignment(deref, orig_deref->array_index, NULL); ir->insert_before(assign); /* Store the RHS to a temporary to avoid reusing its tree. */ - var = new(ir) ir_variable(ir->rhs->type, "vec_index_tmp_v"); + var = new(ir) ir_variable(ir->rhs->type, "vec_index_tmp_v", + ir_var_temporary); ir->insert_before(var); deref = new(ir) ir_dereference_variable(var); assign = new(ir) ir_assignment(deref, ir->rhs, NULL); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 4869dbe1ca..eb4eb9d20e 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -246,6 +246,8 @@ mode_string(const ir_variable *var) case ir_var_in: return "shader input"; case ir_var_out: return "shader output"; case ir_var_inout: return "shader inout"; + + case ir_var_temporary: default: assert(!"Should not get here."); return "invalid variable"; @@ -276,6 +278,12 @@ cross_validate_globals(struct gl_shader_program *prog, if (uniforms_only && (var->mode != ir_var_uniform)) continue; + /* Don't cross validate temporaries that are at global scope. These + * will eventually get pulled into the shaders 'main'. + */ + if (var->mode == ir_var_temporary) + continue; + /* If a global with this name has already been seen, verify that the * new instance has the same type. In addition, if the globals have * initializers, the values of the initializers must be the same. @@ -480,18 +488,28 @@ populate_symbol_table(gl_shader *sh) */ void remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, - exec_list *instructions) + exec_list *instructions, hash_table *temps) { class remap_visitor : public ir_hierarchical_visitor { public: - remap_visitor(glsl_symbol_table *symbols, exec_list *instructions) + remap_visitor(glsl_symbol_table *symbols, exec_list *instructions, + hash_table *temps) { this->symbols = symbols; this->instructions = instructions; + this->temps = temps; } virtual ir_visitor_status visit(ir_dereference_variable *ir) { + if (ir->var->mode == ir_var_temporary) { + ir_variable *var = (ir_variable *) hash_table_find(temps, ir->var); + + assert(var != NULL); + ir->var = var; + return visit_continue; + } + ir_variable *const existing = this->symbols->get_variable(ir->var->name); if (existing != NULL) @@ -501,6 +519,7 @@ remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, this->symbols->add_variable(copy->name, copy); this->instructions->push_head(copy); + ir->var = copy; } return visit_continue; @@ -509,9 +528,10 @@ remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, private: glsl_symbol_table *symbols; exec_list *instructions; + hash_table *temps; }; - remap_visitor v(symbols, instructions); + remap_visitor v(symbols, instructions, temps); inst->accept(&v); } @@ -542,17 +562,32 @@ exec_node * move_non_declarations(exec_list *instructions, exec_node *last, bool make_copies, gl_shader *target) { + hash_table *temps = NULL; + + if (make_copies) + temps = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + foreach_list_safe(node, instructions) { ir_instruction *inst = (ir_instruction *) node; - if (inst->as_variable() || inst->as_function()) + if (inst->as_function()) + continue; + + ir_variable *var = inst->as_variable(); + if ((var != NULL) && (var->mode != ir_var_temporary)) continue; - assert(inst->as_assignment()); + assert(inst->as_assignment() + || ((var != NULL) && (var->mode == ir_var_temporary))); if (make_copies) { inst = inst->clone(NULL); - remap_variables(inst, target->symbols, target->ir); + + if (var != NULL) + hash_table_insert(temps, inst, var); + else + remap_variables(inst, target->symbols, target->ir, temps); } else { inst->remove(); } @@ -561,6 +596,9 @@ move_non_declarations(exec_list *instructions, exec_node *last, last = inst; } + if (make_copies) + hash_table_dtor(temps); + return last; } diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 352b496625..7cc469f3a7 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -1133,6 +1133,7 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) break; case ir_var_auto: + case ir_var_temporary: entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_TEMPORARY, this->next_temp); this->variables.push_tail(entry); -- cgit v1.2.3 From 2462a536ea5c98867296905e3da127eba7c7bdff Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 18 Jul 2010 15:59:43 -0700 Subject: glsl2: Add a constructor for _mesa_glsl_parse_state Coming changes to the handling of built-in functions necessitate this. --- src/glsl/Makefile | 1 + src/glsl/glsl_parser_extras.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ src/glsl/glsl_parser_extras.h | 22 ++++++++++++++++++++++ src/mesa/shader/ir_to_mesa.cpp | 34 ++-------------------------------- 4 files changed, 66 insertions(+), 32 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 7bf95fbfc2..2b040377b0 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -93,6 +93,7 @@ INCLUDES = \ -I../mesa \ -I../mapi \ -I../mesa/shader \ + -I../../include \ $(LIBRARY_INCLUDES) ALL_SOURCES = \ diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index cb7b6d36a2..bcf2579733 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -34,6 +34,47 @@ extern "C" { #include "glsl_parser_extras.h" #include "glsl_parser.h" +_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, + GLenum target, void *mem_ctx) +{ + switch (target) { + case GL_VERTEX_SHADER: this->target = vertex_shader; break; + case GL_FRAGMENT_SHADER: this->target = fragment_shader; break; + case GL_GEOMETRY_SHADER: this->target = geometry_shader; break; + } + + this->scanner = NULL; + this->translation_unit.make_empty(); + this->symbols = new(mem_ctx) glsl_symbol_table; + this->info_log = talloc_strdup(mem_ctx, ""); + this->error = false; + this->loop_or_switch_nesting = NULL; + this->ARB_texture_rectangle_enable = true; + + if (ctx != NULL) { + this->extensions = &ctx->Extensions; + + this->Const.MaxLights = ctx->Const.MaxLights; + this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes; + this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits; + this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; + this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; + this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; + this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; + this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; + this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; + + this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + } else { + static struct gl_extensions null_extensions; + + memset(&null_extensions, 0, sizeof(null_extensions)); + this->extensions = &null_extensions; + } +} + const char * _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) { diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index fed6e8c823..e2efbd9ac9 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -35,7 +35,29 @@ enum _mesa_glsl_parser_targets { ir_shader }; +struct __GLcontextRec; + struct _mesa_glsl_parse_state { + _mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target, + void *mem_ctx); + + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *mem = talloc_zero_size(ctx, size); + assert(mem != NULL); + + return mem; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *mem) + { + talloc_free(mem); + } + void *scanner; exec_list translation_unit; glsl_symbol_table *symbols; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 7cc469f3a7..1a9b0e3948 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2155,38 +2155,8 @@ steal_memory(ir_instruction *ir, void *new_ctx) void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) { - struct _mesa_glsl_parse_state *state; - - state = talloc_zero(shader, struct _mesa_glsl_parse_state); - switch (shader->Type) { - case GL_VERTEX_SHADER: state->target = vertex_shader; break; - case GL_FRAGMENT_SHADER: state->target = fragment_shader; break; - case GL_GEOMETRY_SHADER: state->target = geometry_shader; break; - } - - state->scanner = NULL; - state->translation_unit.make_empty(); - state->symbols = new(shader) glsl_symbol_table; - state->info_log = talloc_strdup(shader, ""); - state->error = false; - state->loop_or_switch_nesting = NULL; - state->ARB_texture_rectangle_enable = true; - - state->extensions = &ctx->Extensions; - - state->Const.MaxLights = ctx->Const.MaxLights; - state->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes; - state->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits; - state->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; - state->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; - state->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; - state->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; - state->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; - state->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; - state->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; - state->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; - - state->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + struct _mesa_glsl_parse_state *state = + new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader); const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log, -- cgit v1.2.3 From 60e2d06d1ccc66ad00cd7ab81c418853f21be291 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 11:27:38 -0700 Subject: glsl2: Implement utility routine to talloc reparent an IR tree --- src/glsl/ir.cpp | 15 +++++++++++++++ src/glsl/ir.h | 3 +++ src/glsl/main.cpp | 10 +--------- src/mesa/shader/ir_to_mesa.cpp | 10 +--------- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 146ff17af3..a2732962f0 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -875,3 +875,18 @@ visit_exec_list(exec_list *list, ir_visitor *visitor) } } + +static void +steal_memory(ir_instruction *ir, void *new_ctx) +{ + talloc_steal(new_ctx, ir); +} + + +void +reparent_ir(exec_list *list, void *mem_ctx) +{ + foreach_list(node, list) { + visit_tree((ir_instruction *) node, steal_memory, mem_ctx); + } +} diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 9fd9850391..e4b0e9f082 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1315,4 +1315,7 @@ extern void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state); +extern void +reparent_ir(exec_list *list, void *mem_ctx); + #endif /* IR_H */ diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 6b1a01c704..cf9a515785 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -118,12 +118,6 @@ const struct option compiler_opts[] = { { NULL, 0, NULL, 0 } }; -static void -steal_memory(ir_instruction *ir, void *new_ctx) -{ - talloc_steal(new_ctx, ir); -} - void compile_shader(struct gl_shader *shader) { @@ -232,9 +226,7 @@ compile_shader(struct gl_shader *shader) shader->InfoLog = state->info_log; /* Retain any live IR, but trash the rest. */ - foreach_list(node, shader->ir) { - visit_tree((ir_instruction *) node, steal_memory, shader); - } + reparent_ir(shader->ir, shader); talloc_free(state); diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index 1a9b0e3948..d1c09febd6 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2146,12 +2146,6 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, extern "C" { -static void -steal_memory(ir_instruction *ir, void *new_ctx) -{ - talloc_steal(new_ctx, ir); -} - void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) { @@ -2215,9 +2209,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) shader->Version = state->language_version; /* Retain any live IR, but trash the rest. */ - foreach_list(node, shader->ir) { - visit_tree((ir_instruction *) node, steal_memory, shader); - } + reparent_ir(shader->ir, shader); talloc_free(state); } -- cgit v1.2.3 From a7ba9a7919110fd619b0e792368aa1f3534080fe Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 13:36:32 -0700 Subject: linker: Do post-link lowering and optimization The lowering code should probably be moved elsewhere. --- src/glsl/linker.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index eb4eb9d20e..640e6eee8e 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -80,6 +80,7 @@ extern "C" { #include "hash_table.h" #include "shader_api.h" #include "linker.h" +#include "ir_optimization.h" /** * Visitor that determines whether or not a variable is ever written. @@ -1223,6 +1224,43 @@ link_shaders(struct gl_shader_program *prog) } /* FINISHME: Perform whole-program optimization here. */ + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + /* Optimization passes */ + bool progress; + exec_list *ir = prog->_LinkedShaders[i]->ir; + + /* Lowering */ + do_mat_op_to_vec(ir); + do_mod_to_fract(ir); + do_div_to_mul_rcp(ir); + + do { + progress = false; + + progress = do_function_inlining(ir) || progress; + progress = do_if_simplification(ir) || progress; + progress = do_copy_propagation(ir) || progress; + progress = do_dead_code_local(ir) || progress; +#if 0 + progress = do_dead_code_unlinked(state, ir) || progress; +#endif + progress = do_constant_variable_unlinked(ir) || progress; + progress = do_constant_folding(ir) || progress; + progress = do_if_return(ir) || progress; +#if 0 + if (ctx->Shader.EmitNoIfs) + progress = do_if_to_cond_assign(ir) || progress; +#endif + + progress = do_vec_index_to_swizzle(ir) || progress; + /* Do this one after the previous to let the easier pass handle + * constant vector indexing. + */ + progress = do_vec_index_to_cond_assign(ir) || progress; + + progress = do_swizzle_swizzle(ir) || progress; + } while (progress); + } assign_uniform_locations(prog); -- cgit v1.2.3 From f38d15b80d4e4c8ecb7a76087cdc49835f0aa271 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 15:33:40 -0700 Subject: glsl2: glsl_type has its own talloc context, don't pass one in --- src/glsl/ast_function.cpp | 3 +-- src/glsl/ast_to_hir.cpp | 5 ++--- src/glsl/glsl_types.cpp | 11 +++++------ src/glsl/glsl_types.h | 5 ++--- src/glsl/ir_reader.cpp | 2 +- src/glsl/ir_variable.cpp | 17 +++++++---------- 6 files changed, 18 insertions(+), 25 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 14c36af911..73af882c53 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -312,8 +312,7 @@ process_array_constructor(exec_list *instructions, if (constructor_type->length == 0) { constructor_type = - glsl_type::get_array_instance(state, - constructor_type->element_type(), + glsl_type::get_array_instance(constructor_type->element_type(), parameter_count); assert(constructor_type != NULL); assert(constructor_type->length == parameter_count); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c68e136256..5cadcd1946 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -511,8 +511,7 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, var->max_array_access); } - var->type = glsl_type::get_array_instance(state, - lhs->type->element_type(), + var->type = glsl_type::get_array_instance(lhs->type->element_type(), rhs->type->array_size()); } } @@ -1407,7 +1406,7 @@ process_array_type(const glsl_type *base, ast_node *array_size, } } - return glsl_type::get_array_instance(state, base, length); + return glsl_type::get_array_instance(base, length); } diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 5cb327c89d..de0adc0c6e 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -289,7 +289,7 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const } -glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) : +glsl_type::glsl_type(const glsl_type *array, unsigned length) : base_type(GLSL_TYPE_ARRAY), sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), @@ -308,7 +308,7 @@ glsl_type::glsl_type(void *ctx, const glsl_type *array, unsigned length) : * NUL. */ const unsigned name_length = strlen(array->name) + 10 + 3; - char *const n = (char *) talloc_size(ctx, name_length); + char *const n = (char *) talloc_size(this->ctx, name_length); if (length == 0) snprintf(n, name_length, "%s[]", array->name); @@ -411,10 +411,9 @@ glsl_type::array_key_hash(const void *a) const glsl_type * -glsl_type::get_array_instance(void *ctx, const glsl_type *base, - unsigned array_size) +glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) { - const glsl_type key(ctx, base, array_size); + const glsl_type key(base, array_size); if (array_types == NULL) { array_types = hash_table_ctor(64, array_key_hash, array_key_compare); @@ -422,7 +421,7 @@ glsl_type::get_array_instance(void *ctx, const glsl_type *base, const glsl_type *t = (glsl_type *) hash_table_find(array_types, & key); if (t == NULL) { - t = new glsl_type(ctx, base, array_size); + t = new glsl_type(base, array_size); hash_table_insert(array_types, (void *) t, t); } diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 8ba9b5ff63..69fb9e3fb5 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -197,8 +197,7 @@ struct glsl_type { /** * Get the instance of an array type */ - static const glsl_type *get_array_instance(void *ctx, - const glsl_type *base, + static const glsl_type *get_array_instance(const glsl_type *base, unsigned elements); /** @@ -412,7 +411,7 @@ private: const char *name); /** Constructor for array types */ - glsl_type(void *ctx, const glsl_type *array, unsigned length); + glsl_type(const glsl_type *array, unsigned length); /** Hash table containing the known array types. */ static struct hash_table *array_types; diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index ed68496587..8b4be4100b 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -138,7 +138,7 @@ read_type(_mesa_glsl_parse_state *st, s_expression *expr) return NULL; } - return glsl_type::get_array_instance(st, base_type, size->value()); + return glsl_type::get_array_instance(base_type, size->value()); } else if (strcmp(type_sym->value(), "struct") == 0) { assert(false); // FINISHME } else { diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 700c5de648..0dd6d834b7 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -138,7 +138,7 @@ generate_110_uniforms(exec_list *instructions, state->Const.MaxFragmentUniformComponents); const glsl_type *const mat4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::mat4_type, + glsl_type::get_array_instance(glsl_type::mat4_type, state->Const.MaxTextureCoords); add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type, @@ -157,8 +157,7 @@ generate_110_uniforms(exec_list *instructions, * FINISHME: at least 8, so hard-code 8 for now. */ const glsl_type *const light_source_array_type = - glsl_type::get_array_instance(state->symbols, - state->symbols->get_type("gl_LightSourceParameters"), 8); + glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), 8); add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, instructions, state->symbols); @@ -196,7 +195,7 @@ generate_110_vs_variables(exec_list *instructions, * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 0); + glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, instructions, state->symbols); @@ -221,7 +220,6 @@ static void generate_130_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = state->symbols; generate_120_vs_variables(instructions, state); for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { @@ -233,7 +231,7 @@ generate_130_vs_variables(exec_list *instructions, * FINISHME: the value of GL_MAX_CLIP_DISTANCES. */ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(ctx, glsl_type::float_type, 8); + glsl_type::get_array_instance(glsl_type::float_type, 8); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, @@ -286,7 +284,7 @@ generate_110_fs_variables(exec_list *instructions, * implementation in preserving varying resources." */ const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, 0); + glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, instructions, state->symbols); @@ -318,7 +316,7 @@ generate_ARB_draw_buffers_variables(exec_list *instructions, */ if (target == fragment_shader) { const glsl_type *const vec4_array_type = - glsl_type::get_array_instance(state->symbols, glsl_type::vec4_type, + glsl_type::get_array_instance(glsl_type::vec4_type, state->Const.MaxDrawBuffers); ir_variable *const fd = @@ -349,14 +347,13 @@ static void generate_130_fs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - void *ctx = state->symbols; generate_120_fs_variables(instructions, state); /* FINISHME: The size of this array is implementation dependent based on * FINISHME: the value of GL_MAX_CLIP_DISTANCES. */ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(ctx, glsl_type::float_type, 8); + glsl_type::get_array_instance(glsl_type::float_type, 8); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, -- cgit v1.2.3 From c24bcad9f88379ffba9e2f0ff92f22cdf60c2927 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Jul 2010 11:23:51 -0700 Subject: glsl: Correctly handle unary plus operator. Previously, any occurence of the unary plus operator would trigger a bogus type mismatch error. Fix this by making the ast_plus case look more like the ast_neg case as far as type-checking is concerned. With this change the shaders/CorrectPreprocess8.frag test in piglit now passes. --- src/glsl/ast_to_hir.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 5cadcd1946..e9257eee28 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -660,9 +660,9 @@ ast_expression::hir(exec_list *instructions, case ast_plus: op[0] = this->subexpressions[0]->hir(instructions, state); - error_emitted = op[0]->type->is_error(); - if (type->is_error()) - op[0]->type = type; + type = unary_arithmetic_result_type(op[0]->type, state, & loc); + + error_emitted = type->is_error(); result = op[0]; break; -- cgit v1.2.3 From a0cfe8c44085032fd982bbbff1f02252ffaa7114 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 21 Jul 2010 13:43:47 -0700 Subject: glsl: Fix missing initialization of yylloc.source In both the preprocessor and in the compiler proper, we use a custom yyltype struct to allow tracking the source-string number in addition to line and column. However, we were previously relying on bison's default initialization of the yyltype struct which of course is not aware of the source field and leaves it uninitialized. We fix this by defining our own YYLLOC_DEFAULT macro expanding on the default version (as appears in the bison manual) and adding initialization of yylloc.source. --- src/glsl/glcpp/glcpp.h | 19 +++++++++++++++++++ src/glsl/glsl_parser_extras.h | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h index fc9511a67a..869de2efbc 100644 --- a/src/glsl/glcpp/glcpp.h +++ b/src/glsl/glcpp/glcpp.h @@ -69,6 +69,25 @@ typedef struct YYLTYPE { # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + (Current).source = 0; \ +} while (0) + struct token { int type; YYSTYPE value; diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index e2efbd9ac9..b50d9eea67 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -137,6 +137,25 @@ typedef struct YYLTYPE { # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + (Current).source = 0; \ +} while (0) + extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...); -- cgit v1.2.3 From 4ccd3c548b9b9a2fee79342445f68d73525bfcdb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 11:28:31 -0700 Subject: glsl2: Add function to import function prototypes from one IR tree to another --- src/glsl/Makefile | 1 + src/glsl/ir.h | 6 ++ src/glsl/ir_import_prototypes.cpp | 137 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 src/glsl/ir_import_prototypes.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 2b040377b0..47292bdb15 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -49,6 +49,7 @@ CXX_SOURCES = \ ir_if_return.cpp \ ir_if_simplification.cpp \ ir_if_to_cond_assign.cpp \ + ir_import_prototypes.cpp \ ir_mat_op_to_vec.cpp \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index e4b0e9f082..38b10f5b06 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1318,4 +1318,10 @@ _mesa_glsl_initialize_functions(exec_list *instructions, extern void reparent_ir(exec_list *list, void *mem_ctx); +class glsl_symbol_table; + +extern void +import_prototypes(const exec_list *source, exec_list *dest, + class glsl_symbol_table *symbols, void *mem_ctx); + #endif /* IR_H */ diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp new file mode 100644 index 0000000000..20aa8a6ae2 --- /dev/null +++ b/src/glsl/ir_import_prototypes.cpp @@ -0,0 +1,137 @@ +/* + * 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 ir_import_prototypes.cpp + * Import function prototypes from one IR tree into another. + * + * \author Ian Romanick + */ +#include +#include "ir.h" +#include "glsl_symbol_table.h" + +/** + * Visitor used to import function prototypes + * + * Normally the \c clone method of either \c ir_function or + * \c ir_function_signature could be used. However, we don't want a complete + * clone of the \c ir_function_signature. We want everything \b except the + * body of the function. + */ +class import_prototype_visitor : public ir_hierarchical_visitor { +public: + /** + */ + import_prototype_visitor(exec_list *list, glsl_symbol_table *symbols, + void *mem_ctx) + { + this->mem_ctx = mem_ctx; + this->list = list; + this->symbols = symbols; + this->function = NULL; + } + + virtual ir_visitor_status visit_enter(ir_function *ir) + { + assert(this->function == NULL); + this->function = new(this->mem_ctx) ir_function(ir->name); + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_function *ir) + { + (void) ir; + assert(this->function != NULL); + + /* Add the new function (and all its signatures) to the end of the + * instruction stream. + */ + list->push_tail(this->function); + + /* Add the new function to the symbol table. + */ + this->symbols->add_function(this->function->name, this->function); + + this->function = NULL; + return visit_continue; + } + + ir_visitor_status visit_enter(ir_function_signature *ir) + { + assert(this->function != NULL); + + ir_function_signature *copy = + new(mem_ctx) ir_function_signature(ir->return_type); + + copy->is_defined = false; + copy->is_built_in = ir->is_built_in; + + /* Clone the parameter list, but NOT the body. + */ + foreach_list_const(node, &ir->parameters) { + const ir_variable *const param = (const ir_variable *) node; + + assert(const_cast(param)->as_variable() != NULL); + + ir_variable *const param_copy = param->clone(NULL); + copy->parameters.push_tail(param_copy); + } + + this->function->add_signature(copy); + + /* Do not process child nodes of the ir_function_signature. There can + * never be any nodes inside the ir_function_signature that we care + * about. Instead continue with the next sibling. + */ + return visit_continue_with_parent; + } + +private: + exec_list *list; + ir_function *function; + glsl_symbol_table *symbols; + void *mem_ctx; +}; + + +/** + * Import function prototypes from one IR tree into another + * + * \param source Source instruction stream containing functions whose + * prototypes are to be imported + * \param dest Destination instruction stream where new \c ir_function and + * \c ir_function_signature nodes will be stored + * \param symbols Symbol table where new functions will be stored + * \param mem_ctx talloc memory context used for new allocations + */ +void +import_prototypes(const exec_list *source, exec_list *dest, + glsl_symbol_table *symbols, void *mem_ctx) +{ + import_prototype_visitor v(dest, symbols, mem_ctx); + + /* Making source be const is just extra documentation. + */ + v.run(const_cast(source)); +} -- cgit v1.2.3 From d5be2acae379783c4aa31243e0a88a9e67e6ca7e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Jul 2010 11:29:46 -0700 Subject: linker: Link built-in functions instead of including them in every shader This is an invasive set of changes. Each user shader tracks a set of other shaders that contain built-in functions. During compilation, function prototypes are imported from these shaders. During linking, the shaders are linked with these built-in-function shaders just like with any other shader. --- src/glsl/builtin_function.cpp | 218 ++++++++++++++++++++------- src/glsl/builtins/110_vs/ftransform | 4 +- src/glsl/builtins/tools/generate_builtins.pl | 63 ++++++-- src/glsl/glsl_parser_extras.h | 4 + src/glsl/ir.h | 3 + src/glsl/linker.cpp | 23 ++- src/glsl/main.cpp | 4 + src/mesa/main/mtypes.h | 4 + src/mesa/shader/ir_to_mesa.cpp | 3 + 9 files changed, 261 insertions(+), 65 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 967bcd0c40..10e59e491e 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -25,22 +25,41 @@ #include #include "glsl_parser_extras.h" #include "ir_reader.h" +#include "program.h" -void -read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, - const char **functions, unsigned count) +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +gl_shader * +read_builtins(GLenum target, const char **functions, unsigned count) { - if (st->error) - return; + gl_shader *sh = _mesa_new_shader(NULL, 0, target); + struct _mesa_glsl_parse_state *st = + new(sh) _mesa_glsl_parse_state(NULL, target, sh); + + st->language_version = 130; + st->ARB_texture_rectangle_enable = true; + st->EXT_texture_array_enable = true; + _mesa_glsl_initialize_types(st); + + sh->ir = new(sh) exec_list; + sh->symbols = st->symbols; for (unsigned i = 0; i < count; i++) { - _mesa_glsl_read_ir(st, instructions, functions[i]); + _mesa_glsl_read_ir(st, sh->ir, functions[i]); if (st->error) { printf("error reading builtin: %.35s ...\n", functions[i]); - return; + delete st; + talloc_free(sh); + return NULL; } } + + reparent_ir(sh->ir, sh); + delete st; + + return sh; } /* 110 builtins */ @@ -2580,7 +2599,9 @@ static const char *functions_for_110_fs [] = { /* 110_vs builtins */ static const char *builtins_110_vs_ftransform = { - "((function ftransform\n" + "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n" + " (declare (in) vec4 gl_Vertex)\n" + " (function ftransform\n" " (signature vec4\n" " (parameters)\n" " ((return (expression vec4 *\n" @@ -4760,53 +4781,146 @@ static const char *functions_for_EXT_texture_array_fs [] = { #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif +void *builtin_mem_ctx = NULL; + +void +_mesa_glsl_release_functions(void) +{ + talloc_free(builtin_mem_ctx); +} + void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - if (state->language_version >= 110) - read_builtins(state, instructions, - functions_for_110, - Elements(functions_for_110)); - - if (state->target == fragment_shader && state->language_version >= 110) - read_builtins(state, instructions, - functions_for_110_fs, - Elements(functions_for_110_fs)); - - if (state->target == vertex_shader && state->language_version >= 110) - read_builtins(state, instructions, - functions_for_110_vs, - Elements(functions_for_110_vs)); - - if (state->language_version >= 120) - read_builtins(state, instructions, - functions_for_120, - Elements(functions_for_120)); - - if (state->language_version >= 130) - read_builtins(state, instructions, - functions_for_130, - Elements(functions_for_130)); - - if (state->target == fragment_shader && state->language_version >= 130) - read_builtins(state, instructions, - functions_for_130_fs, - Elements(functions_for_130_fs)); - - if (state->ARB_texture_rectangle_enable) - read_builtins(state, instructions, - functions_for_ARB_texture_rectangle, - Elements(functions_for_ARB_texture_rectangle)); - - if (state->EXT_texture_array_enable) - read_builtins(state, instructions, - functions_for_EXT_texture_array, - Elements(functions_for_EXT_texture_array)); - - if (state->target == fragment_shader && state->EXT_texture_array_enable) - read_builtins(state, instructions, - functions_for_EXT_texture_array_fs, - Elements(functions_for_EXT_texture_array_fs)); + if (builtin_mem_ctx == NULL) + builtin_mem_ctx = talloc_init("GLSL built-in functions"); + + state->num_builtins_to_link = 0; + if (state->language_version >= 110) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_110, + Elements(functions_for_110)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->target == fragment_shader && state->language_version >= 110) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_110_fs, + Elements(functions_for_110_fs)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->target == vertex_shader && state->language_version >= 110) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_110_vs, + Elements(functions_for_110_vs)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->language_version >= 120) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_120, + Elements(functions_for_120)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->language_version >= 130) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_130, + Elements(functions_for_130)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->target == fragment_shader && state->language_version >= 130) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_130_fs, + Elements(functions_for_130_fs)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->ARB_texture_rectangle_enable) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_ARB_texture_rectangle, + Elements(functions_for_ARB_texture_rectangle)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->EXT_texture_array_enable) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_EXT_texture_array, + Elements(functions_for_EXT_texture_array)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + + if (state->target == fragment_shader && state->EXT_texture_array_enable) { + static gl_shader *sh = NULL; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, functions_for_EXT_texture_array_fs, + Elements(functions_for_EXT_texture_array_fs)); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } } diff --git a/src/glsl/builtins/110_vs/ftransform b/src/glsl/builtins/110_vs/ftransform index 3a5e8ccecf..9ca63dc1e3 100644 --- a/src/glsl/builtins/110_vs/ftransform +++ b/src/glsl/builtins/110_vs/ftransform @@ -1,4 +1,6 @@ -((function ftransform +((declare (uniform) mat4 gl_ModelViewProjectionMatrix) + (declare (in) vec4 gl_Vertex) + (function ftransform (signature vec4 (parameters) ((return (expression vec4 * diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl index a0b5c1f421..61d511da1d 100755 --- a/src/glsl/builtins/tools/generate_builtins.pl +++ b/src/glsl/builtins/tools/generate_builtins.pl @@ -64,22 +64,41 @@ print << 'EOF'; #include #include "glsl_parser_extras.h" #include "ir_reader.h" +#include "program.h" -void -read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, - const char **functions, unsigned count) +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +gl_shader * +read_builtins(GLenum target, const char **functions, unsigned count) { - if (st->error) - return; + gl_shader *sh = _mesa_new_shader(NULL, 0, target); + struct _mesa_glsl_parse_state *st = + new(sh) _mesa_glsl_parse_state(NULL, target, sh); + + st->language_version = 130; + st->ARB_texture_rectangle_enable = true; + st->EXT_texture_array_enable = true; + _mesa_glsl_initialize_types(st); + + sh->ir = new(sh) exec_list; + sh->symbols = st->symbols; for (unsigned i = 0; i < count; i++) { - _mesa_glsl_read_ir(st, instructions, functions[i]); + _mesa_glsl_read_ir(st, sh->ir, functions[i]); if (st->error) { printf("error reading builtin: %.35s ...\n", functions[i]); - return; + delete st; + talloc_free(sh); + return NULL; } } + + reparent_ir(sh->ir, sh); + delete st; + + return sh; } EOF @@ -95,10 +114,22 @@ print << 'EOF'; #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif +void *builtin_mem_ctx = NULL; + +void +_mesa_glsl_release_functions(void) +{ + talloc_free(builtin_mem_ctx); +} + void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state) { + if (builtin_mem_ctx == NULL) + builtin_mem_ctx = talloc_init("GLSL built-in functions"); + + state->num_builtins_to_link = 0; EOF foreach $version_xs (@versions) { @@ -117,10 +148,20 @@ foreach $version_xs (@versions) { # Not a version...an extension name $check = "${check}state->${version}_enable"; } - print " if ($check)\n"; - print " read_builtins(state, instructions,\n"; - print " functions_for_$version_xs,\n"; - print " Elements(functions_for_$version_xs));\n\n" + print " if ($check) {\n"; + print " static gl_shader *sh = NULL;\n"; + print "\n"; + print " if (sh == NULL) {\n"; + print " sh = read_builtins(GL_VERTEX_SHADER, functions_for_$version_xs,\n"; + print " Elements(functions_for_$version_xs));\n"; + print " talloc_steal(builtin_mem_ctx, sh);\n"; + print " }\n"; + print "\n"; + print " import_prototypes(sh->ir, instructions, state->symbols, state);\n"; + print " state->builtins_to_link[state->num_builtins_to_link] = sh;\n"; + print " state->num_builtins_to_link++;\n"; + print " }\n"; + print "\n"; } print "}\n"; diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index b50d9eea67..56f6e18e0b 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -125,6 +125,10 @@ struct _mesa_glsl_parse_state { /** Extensions supported by the OpenGL implementation. */ const struct gl_extensions *extensions; + + /** Shaders containing built-in functions that are used for linking. */ + struct gl_shader *builtins_to_link[16]; + unsigned num_builtins_to_link; }; typedef struct YYLTYPE { diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 38b10f5b06..3a643fc580 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1315,6 +1315,9 @@ extern void _mesa_glsl_initialize_functions(exec_list *instructions, struct _mesa_glsl_parse_state *state); +extern void +_mesa_glsl_release_functions(void); + extern void reparent_ir(exec_list *list, void *mem_ctx); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 640e6eee8e..7c30a40a6c 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -739,7 +739,28 @@ link_intrastage_shaders(struct gl_shader_program *prog, /* Resolve initializers for global variables in the linked shader. */ - link_function_calls(prog, linked, shader_list, num_shaders); + unsigned num_linking_shaders = num_shaders; + for (unsigned i = 0; i < num_shaders; i++) + num_linking_shaders += shader_list[i]->num_builtins_to_link; + + gl_shader **linking_shaders = + (gl_shader **) calloc(num_linking_shaders, sizeof(gl_shader *)); + + memcpy(linking_shaders, shader_list, + sizeof(linking_shaders[0]) * num_shaders); + + unsigned idx = num_shaders; + for (unsigned i = 0; i < num_shaders; i++) { + memcpy(&linking_shaders[idx], shader_list[i]->builtins_to_link, + sizeof(linking_shaders[0]) * shader_list[i]->num_builtins_to_link); + idx += shader_list[i]->num_builtins_to_link; + } + + assert(idx == num_linking_shaders); + + link_function_calls(prog, linked, linking_shaders, num_linking_shaders); + + free(linking_shaders); return linked; } diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index cf9a515785..2ecf57f8ce 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -219,6 +219,9 @@ compile_shader(struct gl_shader *shader) shader->symbols = state->symbols; shader->CompileStatus = !state->error; shader->Version = state->language_version; + memcpy(shader->builtins_to_link, state->builtins_to_link, + sizeof(shader->builtins_to_link[0]) * state->num_builtins_to_link); + shader->num_builtins_to_link = state->num_builtins_to_link; if (shader->InfoLog) talloc_free(shader->InfoLog); @@ -305,6 +308,7 @@ main(int argc, char **argv) talloc_free(whole_program); _mesa_glsl_release_types(); + _mesa_glsl_release_functions(); return status; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 729c2eaf0f..f8257d565b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1971,6 +1971,10 @@ struct gl_shader struct exec_list *ir; struct glsl_symbol_table *symbols; + + /** Shaders containing built-in functions that are used for linking. */ + struct gl_shader *builtins_to_link[16]; + unsigned num_builtins_to_link; }; diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp index a2b2eb95c8..bfb8e3201a 100644 --- a/src/mesa/shader/ir_to_mesa.cpp +++ b/src/mesa/shader/ir_to_mesa.cpp @@ -2207,6 +2207,9 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) shader->CompileStatus = !state->error; shader->InfoLog = state->info_log; shader->Version = state->language_version; + memcpy(shader->builtins_to_link, state->builtins_to_link, + sizeof(shader->builtins_to_link[0]) * state->num_builtins_to_link); + shader->num_builtins_to_link = state->num_builtins_to_link; /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader); -- cgit v1.2.3 From c7a18da69022d3f9b05c21ff2473e8ea390f77f1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 19 Jul 2010 21:44:03 -0700 Subject: glsl2: Replace insert_before/remove pairs with exec_node::replace_with. --- src/glsl/ast_function.cpp | 3 +-- src/glsl/ir_expression_flattening.cpp | 3 +-- src/glsl/ir_function_inlining.cpp | 3 +-- src/glsl/ir_if_return.cpp | 6 ++---- src/glsl/ir_vec_index_to_cond_assign.cpp | 3 +-- src/glsl/ir_vec_index_to_swizzle.cpp | 3 +-- 6 files changed, 7 insertions(+), 14 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 73af882c53..2348bdf24f 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -1081,8 +1081,7 @@ ast_function_expression::hir(exec_list *instructions, all_parameters_are_constant = false; if (result != ir) { - ir->insert_before(result); - ir->remove(); + ir->replace_with(result); } } diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index 6dbebc6378..ccb2e2bce9 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -171,8 +171,7 @@ ir_expression_flattening_visitor::visit_enter(ir_call *ir) ir_rvalue *new_ir = operand_to_temp(ir); if (new_ir != ir) { - ir->insert_before(new_ir); - ir->remove(); + ir->replace_with(new_ir); } } diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 05dd83f7ff..c391f12d88 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -91,8 +91,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) if (ret) { if (ret->value) { ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval); - ret->insert_before(new(ctx) ir_assignment(lhs, ret->value, NULL)); - ret->remove(); + ret->replace_with(new(ctx) ir_assignment(lhs, ret->value, NULL)); } else { /* un-valued return has to be the last return, or we shouldn't * have reached here. (see can_inline()). diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index a9af7166b9..bfb52e7e68 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -108,13 +108,11 @@ ir_if_return_visitor::visit_enter(ir_if *ir) assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), then_return->value, NULL); - then_return->insert_before(assign); - then_return->remove(); + then_return->replace_with(assign); assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var), else_return->value, NULL); - else_return->insert_before(assign); - else_return->remove(); + else_return->replace_with(assign); ir_dereference_variable *deref = new(ir) ir_dereference_variable(new_var); ir->insert_after(new(ir) ir_return(deref)); diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index 7e04389b5f..dbc6f9ada8 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -218,8 +218,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) ir_rvalue *new_param = convert_vec_index_to_cond_assign(param); if (new_param != param) { - param->insert_before(new_param); - param->remove(); + param->replace_with(new_param); } } diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp index abeb43cd68..1e170cbae6 100644 --- a/src/glsl/ir_vec_index_to_swizzle.cpp +++ b/src/glsl/ir_vec_index_to_swizzle.cpp @@ -121,8 +121,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) ir_rvalue *new_param = convert_vec_index_to_swizzle(param); if (new_param != param) { - param->insert_before(new_param); - param->remove(); + param->replace_with(new_param); } } -- cgit v1.2.3 From 0048c7aef82b17c6bd160f49125a91a70cbf2b55 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 19 Jul 2010 23:45:23 -0700 Subject: glsl2: Add some comments. --- src/glsl/ast_function.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 2348bdf24f..1122521e0d 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -164,6 +164,9 @@ match_function_by_name(exec_list *instructions, const char *name, /** * 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) @@ -220,11 +223,11 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type) assert(result != NULL); + /* 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 */ -- cgit v1.2.3 From 3163f87463e6d0123c4f95bd76a658cb1e5d0843 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 03:01:54 -0700 Subject: ir_constant_expression: Remove open coded equality comparisons. The ir_constant::has_value method already does this. --- src/glsl/ir_constant_expression.cpp | 40 ++----------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index cb07f38128..b0333dbebb 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -603,46 +603,10 @@ ir_expression::constant_expression_value() break; case ir_binop_equal: - data.b[0] = true; - for (unsigned c = 0; c < op[0]->type->components(); c++) { - switch (op[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c]; - break; - case GLSL_TYPE_BOOL: - data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c]; - break; - default: - assert(0); - } - } + data.b[0] = op[0]->has_value(op[1]); break; case ir_binop_nequal: - data.b[0] = false; - for (unsigned c = 0; c < op[0]->type->components(); c++) { - switch (op[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c]; - break; - case GLSL_TYPE_BOOL: - data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c]; - break; - default: - assert(0); - } - } + data.b[0] = !op[0]->has_value(op[1]); break; default: -- cgit v1.2.3 From 46d6b8d1ba09d9d6844ce99a30416283004f77c6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 13:01:56 -0700 Subject: ir_constant_expression: Add support for ir_unop_u2f. Also make ir_unop_i2f only operate on signed integers. --- src/glsl/ir_constant_expression.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index b0333dbebb..acfbb86459 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -87,13 +87,15 @@ ir_expression::constant_expression_value() } break; case ir_unop_i2f: - assert(op[0]->type->base_type == GLSL_TYPE_UINT || - op[0]->type->base_type == GLSL_TYPE_INT); + assert(op[0]->type->base_type == GLSL_TYPE_INT); for (unsigned c = 0; c < op[0]->type->components(); c++) { - if (op[0]->type->base_type == GLSL_TYPE_INT) - data.f[c] = op[0]->value.i[c]; - else - data.f[c] = op[0]->value.u[c]; + data.f[c] = op[0]->value.i[c]; + } + break; + case ir_unop_u2f: + assert(op[0]->type->base_type == GLSL_TYPE_UINT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = op[0]->value.u[c]; } break; case ir_unop_b2f: -- cgit v1.2.3 From e1d71850faba23d1bea3858a8c2e05a45fd21143 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 03:53:47 -0700 Subject: ast_to_hir: Fix bug in constant initializers. Implicit conversions were not being performed, nor was there any type checking - it was possible to have, say, var->type == float and var->constant_value->type == int. Later use of the constant expression would trigger an assertion. Fixes piglit test const-implicit-conversion.frag. --- src/glsl/ast_to_hir.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index e9257eee28..99a2183cf8 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1804,6 +1804,16 @@ ast_declarator_list::hir(exec_list *instructions, * declaration. */ if (this->type->qualifier.constant || this->type->qualifier.uniform) { + ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs); + if (new_rhs != NULL) { + rhs = new_rhs; + } 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); + } + ir_constant *constant_value = rhs->constant_expression_value(); if (!constant_value) { _mesa_glsl_error(& initializer_loc, state, -- cgit v1.2.3 From 13a19745d46d383fa7fc148ce129150ebde151b7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 19 Jul 2010 23:49:58 -0700 Subject: glsl2: Emit array constructors inline. --- src/glsl/ast_function.cpp | 64 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 11 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1122521e0d..1982c83a43 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -321,22 +321,64 @@ process_array_constructor(exec_list *instructions, assert(constructor_type->length == parameter_count); } - ir_function *f = state->symbols->get_function(constructor_type->name); + bool all_parameters_are_constant = true; - /* If the constructor for this type of array does not exist, generate the - * prototype and add it to the symbol table. - */ - if (f == NULL) { - f = constructor_type->generate_constructor(state->symbols); + /* 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!) */ + 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); + 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); } - ir_rvalue *const r = - process_call(instructions, f, loc, &actual_parameters, state); + if (all_parameters_are_constant) { + /* FINISHME: Add support for generating constant arrays. */ + } - assert(r != NULL); - assert(r->type->is_error() || (r->type == constructor_type)); + ir_variable *var = new(ctx) ir_variable(constructor_type, "array_ctor", + ir_var_temporary); + instructions->push_tail(var); - return r; + 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); } -- cgit v1.2.3 From 74e1802f5dd8921750851abc6128e4073602d405 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:06:33 -0700 Subject: glsl2: Extend ir_constant to store constant arrays, and generate them. Since GLSL permits arrays of structures, we need to store each element as an ir_constant*, not just ir_constant_data. Fixes parser tests const-array-01.frag, const-array-03.frag, const-array-04.frag, const-array-05.frag, though 03 and 04 generate the wrong code. --- src/glsl/ast_function.cpp | 5 ++--- src/glsl/ir.cpp | 23 +++++++++++++++++++++-- src/glsl/ir.h | 6 ++++++ src/glsl/ir_clone.cpp | 11 +++++++++++ 4 files changed, 40 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1982c83a43..855f27f175 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -358,9 +358,8 @@ process_array_constructor(exec_list *instructions, ir->replace_with(result); } - if (all_parameters_are_constant) { - /* FINISHME: Add support for generating constant arrays. */ - } + 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); diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index a2732962f0..d3f7302b54 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -253,9 +253,20 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) this->ir_type = ir_type_constant; this->type = type; - /* FINISHME: Support array types. */ assert(type->is_scalar() || type->is_vector() || type->is_matrix() - || type->is_record()); + || type->is_record() || type->is_array()); + + if (type->is_array()) { + this->array_elements = talloc_array(this, ir_constant *, type->length); + unsigned i = 0; + foreach_list(node, value_list) { + ir_constant *value = (ir_constant *) node; + assert(value->as_constant() != NULL); + + this->array_elements[i++] = value; + } + return; + } /* If the constant is a record, the types of each of the entries in * value_list must be a 1-for-1 match with the structure components. Each @@ -378,6 +389,14 @@ ir_constant::get_uint_component(unsigned i) const return 0; } +ir_constant * +ir_constant::get_array_element(unsigned i) const +{ + assert(this->type->is_array()); + assert(i < this->type->length); + + return array_elements[i]; +} ir_constant * ir_constant::get_record_field(const char *name) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 3a643fc580..c73bf4ce8b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1268,6 +1268,8 @@ public: unsigned get_uint_component(unsigned i) const; /*@}*/ + ir_constant *get_array_element(unsigned i) const; + ir_constant *get_record_field(const char *name); /** @@ -1284,6 +1286,10 @@ public: */ union ir_constant_data value; + /* Array elements */ + ir_constant **array_elements; + + /* Structure fields */ exec_list components; private: diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index f7e8794728..a3e4a3ae31 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -337,6 +337,17 @@ ir_constant::clone(struct hash_table *ht) const return c; } + case GLSL_TYPE_ARRAY: { + ir_constant *c = new(ctx) ir_constant; + + c->type = this->type; + c->array_elements = talloc_array(c, ir_constant *, this->type->length); + for (unsigned i = 0; i < this->type->length; i++) { + c->array_elements[i] = this->array_elements[i]->clone(NULL); + } + return c; + } + default: assert(!"Should not get here."); break; return NULL; -- cgit v1.2.3 From 7ea977a15c05f4a638478b7a5b8ca78454cecf41 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:23:12 -0700 Subject: ir_print_visitor: Remove commas between ir_constant's components. The IR reader does not expect commas. --- src/glsl/ir_print_visitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 6f867e3253..05ac302992 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -272,7 +272,7 @@ void ir_print_visitor::visit(ir_constant *ir) for (unsigned i = 0; i < ir->type->components(); i++) { if (i != 0) - printf(", "); + printf(" "); switch (base_type->base_type) { case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; -- cgit v1.2.3 From 9930d18c2aefad12152d12bc251d02ae1c1593bc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:28:09 -0700 Subject: ir_print_visitor: Print out constant arrays. --- src/glsl/ir_print_visitor.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 05ac302992..1eb073ff6a 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -270,16 +270,20 @@ void ir_print_visitor::visit(ir_constant *ir) print_type(ir->type); printf(" ("); - for (unsigned i = 0; i < ir->type->components(); i++) { - if (i != 0) - printf(" "); - - switch (base_type->base_type) { - case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; - case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; - case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; - case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; - default: assert(0); + if (ir->type->is_array()) { + for (unsigned i = 0; i < ir->type->length; i++) + ir->get_array_element(i)->accept(this); + } else { + for (unsigned i = 0; i < ir->type->components(); i++) { + if (i != 0) + printf(" "); + switch (base_type->base_type) { + case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; + case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; + case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; + case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; + default: assert(0); + } } } printf(")) "); -- cgit v1.2.3 From ef2c38b2450eb366a2e6f6a46d1725aa6c14d74b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:53:07 -0700 Subject: ir_reader: Add support for reading constant arrays. --- src/glsl/ir_reader.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 8b4be4100b..2248e926d5 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -753,7 +753,7 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list) { void *ctx = st; if (list->length() != 3) { - ir_read_error(st, list, "expected (constant ( ... ))"); + ir_read_error(st, list, "expected (constant (...))"); return NULL; } @@ -764,10 +764,35 @@ read_constant(_mesa_glsl_parse_state *st, s_list *list) s_list *values = SX_AS_LIST(type_expr->next); if (values == NULL) { - ir_read_error(st, list, "expected (constant ( ... ))"); + ir_read_error(st, list, "expected (constant (...))"); return NULL; } + if (type->is_array()) { + const unsigned elements_supplied = values->length(); + if (elements_supplied != type->length) { + ir_read_error(st, values, "expected exactly %u array elements, " + "given %u", type->length, elements_supplied); + return NULL; + } + + exec_list elements; + foreach_iter(exec_list_iterator, it, values->subexpressions) { + s_expression *expr = (s_expression *) it.get(); + s_list *elt = SX_AS_LIST(expr); + if (elt == NULL) { + ir_read_error(st, expr, "expected (constant ...) array element"); + return NULL; + } + + ir_constant *ir_elt = read_constant(st, elt); + if (ir_elt == NULL) + return NULL; + elements.push_tail(ir_elt); + } + return new(ctx) ir_constant(type, &elements); + } + const glsl_type *const base_type = type->get_base_type(); ir_constant_data data; -- cgit v1.2.3 From a096fa747611472965cf0f953bfe2757fc80383c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 01:31:29 -0700 Subject: ir_constant_expression: Add support for constant arrays. Fixes piglit test const-array-02.frag. --- src/glsl/ir_constant_expression.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index acfbb86459..d72a57c66a 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -712,7 +712,8 @@ ir_dereference_array::constant_expression_value() return new(ctx) ir_constant(array, component); } else { - /* FINISHME: Handle access of constant arrays. */ + const unsigned index = idx->value.u[0]; + return array->get_array_element(index)->clone(NULL); } } return NULL; -- cgit v1.2.3 From 9a6d40fbfb679f01412c1fcc9d767c20a22246d8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 03:08:32 -0700 Subject: ir_constant_expression: Add support for array == and !=. Piglit parser tests const-array-03.frag and const-array-04.frag now generate the correct code. --- src/glsl/ir.cpp | 11 ++++++++--- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index d3f7302b54..5054ec725c 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -430,9 +430,14 @@ ir_constant::has_value(const ir_constant *c) const if (this->type != c->type) return false; - /* FINISHME: This will probably also handle constant arrays as soon as those - * FINISHME: are supported. - */ + if (this->type->is_array()) { + for (unsigned i = 0; i < this->type->length; i++) { + if (this->array_elements[i]->has_value(c->array_elements[i])) + return false; + } + return true; + } + if (this->type->base_type == GLSL_TYPE_STRUCT) { const exec_node *a_node = this->components.head; const exec_node *b_node = c->components.head; diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index d72a57c66a..5bef17c755 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -73,6 +73,22 @@ ir_expression::constant_expression_value() components = op[1]->type->components(); } + void *ctx = talloc_parent(this); + + /* Handle array operations here, rather than below. */ + if (op[0]->type->is_array()) { + assert(op[1] != NULL && op[1]->type->is_array()); + switch (this->operation) { + case ir_binop_equal: + return new(ctx) ir_constant(op[0]->has_value(op[1])); + case ir_binop_nequal: + return new(ctx) ir_constant(!op[0]->has_value(op[1])); + default: + break; + } + return NULL; + } + switch (this->operation) { case ir_unop_logic_not: assert(op[0]->type->base_type == GLSL_TYPE_BOOL); @@ -616,7 +632,6 @@ ir_expression::constant_expression_value() return NULL; } - void *ctx = talloc_parent(this); return new(ctx) ir_constant(this->type, &data); } -- cgit v1.2.3 From e9384d1d7fdf06b6345b3be0a70a294b90eac96e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 20 Jul 2010 13:04:23 -0700 Subject: glsl2: Update TODO. --- src/glsl/TODO | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/TODO b/src/glsl/TODO index b2baa13078..07ac5f5c6e 100644 --- a/src/glsl/TODO +++ b/src/glsl/TODO @@ -1,30 +1,7 @@ -- Handle currently unsupported constant expression types - - ir_unop_sign - - ir_unop_exp2 - - ir_unop_log2 - - ir_unop_u2f - - ir_unop_trunc - - ir_unop_ceil - - ir_unop_floor - - ir_unop_sin - - ir_unop_cos - - ir_binop_min - - ir_binop_max - - ir_binop_pow - - Handle constant expressions of (struct == struct) - Handle constant expressions of (struct != struct) -- Add support to ir_constant for array constants Arrays can only be - - declared 'const' in GLSL 1.20+. This is because there are no - array constructors in GLSL 1.10, and any variable declared as - 'const' must have an initializer. - -- Handle constant expressions of (array == array) - -- Handle constant expressions of (array != array) - - Treat built-in functions with constant parameters as constant expressions. - Rewrite all built-in functions return a single expression. - Modify the HIR generator for functions to automatically inline built-in -- cgit v1.2.3 From 2d1ed7b1b112cf13dd7eda7f500691f4c98a1ccc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 12:55:16 -0700 Subject: glsl2: When a "continue" happens in a "for" loop, run the loop expression. Fixes: glsl1-for-loop with continue Bug #29097 --- src/glsl/ast_to_hir.cpp | 14 ++++++++++++++ src/glsl/glsl_parser_extras.h | 1 + 2 files changed, 15 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 99a2183cf8..0cb3863b3e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2308,6 +2308,16 @@ ast_jump_statement::hir(exec_list *instructions, } else { ir_loop *const loop = state->loop_or_switch_nesting->as_loop(); + /* Inline the for loop expression again, since we don't know + * where near the end of the loop body the normal copy of it + * is going to be placed. + */ + if (mode == ast_continue && + state->loop_or_switch_nesting_ast->rest_expression) { + state->loop_or_switch_nesting_ast->rest_expression->hir(instructions, + state); + } + if (loop != NULL) { ir_loop_jump *const jump = new(ctx) ir_loop_jump((mode == ast_break) @@ -2422,7 +2432,10 @@ ast_iteration_statement::hir(exec_list *instructions, /* Track the current loop and / or switch-statement nesting. */ ir_instruction *const nesting = state->loop_or_switch_nesting; + ast_iteration_statement *nesting_ast = state->loop_or_switch_nesting_ast; + state->loop_or_switch_nesting = stmt; + state->loop_or_switch_nesting_ast = this; if (mode != ast_do_while) condition_to_hir(stmt, state); @@ -2442,6 +2455,7 @@ ast_iteration_statement::hir(exec_list *instructions, /* Restore previous nesting before returning. */ state->loop_or_switch_nesting = nesting; + state->loop_or_switch_nesting_ast = nesting_ast; /* Loops do not have r-values. */ diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 56f6e18e0b..3865843fd1 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -104,6 +104,7 @@ struct _mesa_glsl_parse_state { /** Loop or switch statement containing the current instructions. */ class ir_instruction *loop_or_switch_nesting; + class ast_iteration_statement *loop_or_switch_nesting_ast; /** List of structures defined in user code. */ const glsl_type **user_structures; -- cgit v1.2.3 From 8ec0b8187ea695353c75eed7314e86344df60e5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 13:52:41 -0700 Subject: glsl2: When inlining, don't clone and assign sampler arguments. Instead, just use the incoming sampler param. Fixes many texture-using piglit tests since the linker rework. --- src/glsl/ir_function_inlining.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index c391f12d88..b143190ff6 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -133,17 +133,27 @@ ir_call::generate_inline(ir_instruction *next_ir) exec_list_iterator sig_param_iter = this->callee->parameters.iterator(); exec_list_iterator param_iter = this->actual_parameters.iterator(); for (i = 0; i < num_parameters; i++) { - const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); + ir_variable *sig_param = (ir_variable *) sig_param_iter.get(); ir_rvalue *param = (ir_rvalue *) param_iter.get(); /* Generate a new variable for the parameter. */ - parameters[i] = sig_param->clone(ht); - parameters[i]->mode = ir_var_auto; - next_ir->insert_before(parameters[i]); + if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) { + /* For samplers, we want the inlined sampler references + * referencing the passed in sampler variable, since that + * will have the location information, which an assignment of + * a sampler wouldn't. + */ + parameters[i] = NULL; + hash_table_insert(ht, param->variable_referenced(), sig_param); + } else { + parameters[i] = sig_param->clone(ht); + parameters[i]->mode = ir_var_auto; + next_ir->insert_before(parameters[i]); + } /* Move the actual param into our param variable if it's an 'in' type. */ - if (sig_param->mode == ir_var_in || - sig_param->mode == ir_var_inout) { + if (parameters[i] && (sig_param->mode == ir_var_in || + sig_param->mode == ir_var_inout)) { ir_assignment *assign; assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]), @@ -175,8 +185,8 @@ ir_call::generate_inline(ir_instruction *next_ir) const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); /* Move our param variable into the actual param if it's an 'out' type. */ - if (sig_param->mode == ir_var_out || - sig_param->mode == ir_var_inout) { + if (parameters[i] && (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout)) { ir_assignment *assign; assign = new(ctx) ir_assignment(param->clone(NULL)->as_rvalue(), -- cgit v1.2.3 From e65dfa89eef86be127d788ecd5bd23c35c8fbbe4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 14:25:26 -0700 Subject: glsl2: Fix the type of (1.0 - arg2) for mix(gen, gen, float). Previously, we'd constant-fold up a value of vec4(1.0 - arg2, 0, 0, 0). Fixes: glsl1-mix(vec4) function --- src/glsl/builtin_function.cpp | 6 +++--- src/glsl/builtins/110/mix | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 10e59e491e..ae0eabcf77 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1320,21 +1320,21 @@ static const char *builtins_110_mix = { " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1)\n" " (declare (in) float arg2))\n" - " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1)\n" " (declare (in) float arg2))\n" - " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1)\n" " (declare (in) float arg2))\n" - " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" "))\n" }; diff --git a/src/glsl/builtins/110/mix b/src/glsl/builtins/110/mix index 032f29e5fa..8638d06887 100644 --- a/src/glsl/builtins/110/mix +++ b/src/glsl/builtins/110/mix @@ -32,19 +32,19 @@ (declare (in) vec2 arg0) (declare (in) vec2 arg1) (declare (in) float arg2)) - ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) vec3 arg1) (declare (in) float arg2)) - ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) vec4 arg1) (declare (in) float arg2)) - ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) )) -- cgit v1.2.3 From 47c90b144729e3edf3b5cbf5b260c1c46e429879 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 22 Jul 2010 14:56:14 -0700 Subject: glsl2: Fix expected type for multiplying vector with non-square matrix. Previously, the compiler expected the result of the multiplication to be of the same type as the vector. This is correct for square matrices, but wrong for all others. We fix this by instead expecting a vector with the same number of rows as the matrix (for the case of M*v with a column vector) or the same number of columns as the matrix (for v*M with a row vector). This fix causes the following four glean tests to now pass: glsl1-mat4x2 * vec4 glsl1-vec2 * mat4x2 multiply glsl1-vec3 * mat4x3 multiply glsl1-vec4 * mat3x4 multiply --- src/glsl/ast_to_hir.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 0cb3863b3e..5e26f21e9a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -282,8 +282,17 @@ arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, * 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) - return type_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()); @@ -292,8 +301,17 @@ arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, * the type of A must be the same as the vector type of a column from * B. */ - if (type_a == type_b->column_type()) - return type_a; + 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"); -- cgit v1.2.3 From 1bef4c8c4bc11e7f4150500def6e6a4291ceb587 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 14:57:55 -0700 Subject: glsl2: Fix builtin prototypes defined in multiple glsl/builtins/* files If we put the protos in separate ir_functions, they wouldn't be found at lookup time for linking. Fixes: glsl-fs-texture2d-bias glsl-fs-texture2dproj-bias glsl-fs-texture2dproj-bias-2 glsl-lod-bias glsl1-texture2D(), computed coordinate --- src/glsl/ir_import_prototypes.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index 20aa8a6ae2..5c5dc00ad7 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/src/glsl/ir_import_prototypes.cpp @@ -55,7 +55,17 @@ public: virtual ir_visitor_status visit_enter(ir_function *ir) { assert(this->function == NULL); - this->function = new(this->mem_ctx) ir_function(ir->name); + + this->function = this->symbols->get_function(ir->name); + if (!this->function) { + this->function = new(this->mem_ctx) ir_function(ir->name); + + list->push_tail(this->function); + + /* Add the new function to the symbol table. + */ + this->symbols->add_function(this->function->name, this->function); + } return visit_continue; } @@ -64,15 +74,6 @@ public: (void) ir; assert(this->function != NULL); - /* Add the new function (and all its signatures) to the end of the - * instruction stream. - */ - list->push_tail(this->function); - - /* Add the new function to the symbol table. - */ - this->symbols->add_function(this->function->name, this->function); - this->function = NULL; return visit_continue; } -- cgit v1.2.3 From a711ad6bf2407f63110de8e8f216eacd09dd8e82 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 15:17:23 -0700 Subject: glsl2: Add the API defines to the glsl2 build so we get the right GLcontext Fixes: draw_buffers-08.frag draw_buffers-09.frag glsl-vs-texturematrix-2 --- src/glsl/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 47292bdb15..f4b0fb55a7 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -81,6 +81,10 @@ GLSL2_OBJECTS = \ ### Basic defines ### +DEFINES = \ + $(LIBRARY_DEFINES) \ + $(API_DEFINES) + GLCPP_OBJECTS = \ $(GLCPP_SOURCES:.c=.o) \ ../mesa/shader/hash_table.o @@ -134,10 +138,10 @@ glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@ .cpp.o: - $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@ + $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@ .c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ glsl_lexer.cpp: glsl_lexer.lpp flex --never-interactive --outfile="$@" $< -- cgit v1.2.3 From c3081e627302429cdf2ee23a40fb20fa5cbf5770 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 15:34:01 -0700 Subject: glsl2: Set the type on cloned tex instructions. --- src/glsl/ir_clone.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index a3e4a3ae31..c49a732481 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -210,6 +210,7 @@ ir_texture::clone(struct hash_table *ht) const { void *ctx = talloc_parent(this); ir_texture *new_tex = new(ctx) ir_texture(this->op); + new_tex->type = this->type; new_tex->sampler = this->sampler->clone(ht); new_tex->coordinate = this->coordinate->clone(ht); -- cgit v1.2.3 From 9703ed05e684f4269cd8af27c94e9b6bf8781d85 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 15:50:37 -0700 Subject: glsl2: When setting the size of an unsized array, set its deref's size too. --- src/glsl/ast_to_hir.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 5e26f21e9a..c03206fd2e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -531,6 +531,7 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, var->type = glsl_type::get_array_instance(lhs->type->element_type(), rhs->type->array_size()); + d->type = var->type; } } -- cgit v1.2.3 From 432b787b29202301dbfc139c3289521b0bfc3dec Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 16:24:49 -0700 Subject: glsl2: Validate that ir_if conditions are actually bool. --- src/glsl/ir_validate.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index c05edf2ee3..bb381a00df 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -59,6 +59,7 @@ public: virtual ir_visitor_status visit(ir_variable *v); virtual ir_visitor_status visit(ir_dereference_variable *ir); + virtual ir_visitor_status visit(ir_if *ir); virtual ir_visitor_status visit_enter(ir_function *ir); virtual ir_visitor_status visit_leave(ir_function *ir); @@ -93,6 +94,18 @@ ir_validate::visit(ir_dereference_variable *ir) return visit_continue; } +ir_visitor_status +ir_validate::visit(ir_if *ir) +{ + if (ir->condition->type != glsl_type::bool_type) { + printf("ir_if condition %s type instead of bool.\n", + ir->condition->type->name); + ir->print(); + printf("\n"); + abort(); + } +} + ir_visitor_status ir_validate::visit_enter(ir_function *ir) -- cgit v1.2.3 From a0879b9dd438d78635f047cdd5ed4c72bc831b60 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 22 Jul 2010 16:30:41 -0700 Subject: glsl2: Put side effects of the RHS of logic_or in the right branch. Kind of missing the point to only do the side effects if the LHS evaluates as true. Fixes: glsl1-|| operator, short-circuit --- src/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c03206fd2e..98ea789249 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -898,7 +898,7 @@ ast_expression::hir(exec_list *instructions, ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); - op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); + op[1] = this->subexpressions[1]->hir(&stmt->else_instructions, state); if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { YYLTYPE loc = this->subexpressions[1]->get_location(); -- cgit v1.2.3 From fbe4240626bfe102a9c4c889ee18cb9ea27bddec Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 22 Jul 2010 16:36:04 -0700 Subject: glcpp: Fix function-like macros with an argument used multiple times. It's really hard to believe that this case has been broken, but apparently no test previously exercised it. So this commit adds such a test and fixes it by making a copy of the argument token-list before expanding it. This fix causes the following glean tests to now pass: glsl1-Preprocessor test 6 (#if 0, #define macro) glsl1-Preprocessor test 7 (multi-line #define) --- src/glsl/glcpp/glcpp-parse.y | 10 +++++++--- src/glsl/glcpp/tests/069-repeated-argument.c | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/glsl/glcpp/tests/069-repeated-argument.c (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e4dcc76e0a..5b7467836d 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1075,7 +1075,7 @@ _token_list_create_with_one_space (void *ctx) * * Returns the token list that results from the expansion and sets * *last to the last node in the list that was consumed by the - * expansion. Specificallty, *last will be set as follows: as the + * expansion. Specifically, *last will be set as follows: as the * token of the closing right parenthesis. */ static token_list_t * @@ -1147,9 +1147,13 @@ _glcpp_parser_expand_function (glcpp_parser_t *parser, * tokens, or append a placeholder token for * an empty argument. */ if (argument->head) { + token_list_t *expanded_argument; + expanded_argument = _token_list_copy (parser, + argument); _glcpp_parser_expand_token_list (parser, - argument); - _token_list_append_list (substituted, argument); + expanded_argument); + _token_list_append_list (substituted, + expanded_argument); } else { token_t *new_token; diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c b/src/glsl/glcpp/tests/069-repeated-argument.c new file mode 100644 index 0000000000..2b46ead294 --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c @@ -0,0 +1,2 @@ +#define double(x) x x +double(1) -- cgit v1.2.3 From 40c4298a6ea9e83b49858916d5423fd2135ef39c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 16:18:57 -0700 Subject: ir_print_visitor: Add "temporary" to mode string printing. Variables with mode ir_var_temporary were causing an out of bounds array access and filling my screen with rubbish. I'm not sure if "temporary" is the right thing to print. --- src/glsl/ir_print_visitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 1eb073ff6a..ee489cda7f 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -85,7 +85,8 @@ void ir_print_visitor::visit(ir_variable *ir) const char *const cent = (ir->centroid) ? "centroid " : ""; const char *const inv = (ir->invariant) ? "invariant " : ""; - const char *const mode[] = { "", "uniform ", "in ", "out ", "inout " }; + const char *const mode[] = { "", "uniform ", "in ", "out ", "inout ", + "temporary " }; const char *const interp[] = { "", "flat", "noperspective" }; printf("(%s%s%s%s) ", -- cgit v1.2.3 From aa9f86ae8b3bb2172092ff9b50751677c509e6b4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 16:20:36 -0700 Subject: glsl2: Fix standalone compiler to not crash horribly. ir_to_mesa was updated for the _mesa_glsl_parse_state constructor changes, but main.cpp was not. --- src/glsl/glsl_parser_extras.cpp | 23 +++++++++++++++++++++ src/glsl/main.cpp | 45 ++++------------------------------------- 2 files changed, 27 insertions(+), 41 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index bcf2579733..009aabcd35 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -68,10 +68,33 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; } else { + /* If there is no GL context (standalone compiler), fill in constants + * with the minimum required values. + */ static struct gl_extensions null_extensions; memset(&null_extensions, 0, sizeof(null_extensions)); this->extensions = &null_extensions; + + /* 1.10 minimums. */ + this->Const.MaxLights = 8; + this->Const.MaxClipPlanes = 8; + this->Const.MaxTextureUnits = 2; + + /* More than the 1.10 minimum to appease parser tests taken from + * apps that (hopefully) already checked the number of coords. + */ + this->Const.MaxTextureCoords = 4; + + this->Const.MaxVertexAttribs = 16; + this->Const.MaxVertexUniformComponents = 512; + this->Const.MaxVaryingFloats = 32; + this->Const.MaxVertexTextureImageUnits = 0; + this->Const.MaxCombinedTextureImageUnits = 2; + this->Const.MaxTextureImageUnits = 2; + this->Const.MaxFragmentUniformComponents = 64; + + this->Const.MaxDrawBuffers = 2; } } diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 2ecf57f8ce..5c0f6475e0 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -121,49 +121,12 @@ const struct option compiler_opts[] = { void compile_shader(struct gl_shader *shader) { - struct _mesa_glsl_parse_state *state; - struct gl_extensions ext; - - state = talloc_zero(talloc_parent(shader), struct _mesa_glsl_parse_state); - - switch (shader->Type) { - case GL_VERTEX_SHADER: state->target = vertex_shader; break; - case GL_FRAGMENT_SHADER: state->target = fragment_shader; break; - case GL_GEOMETRY_SHADER: state->target = geometry_shader; break; - } - - state->scanner = NULL; - state->translation_unit.make_empty(); - state->symbols = new(shader) glsl_symbol_table; - state->info_log = talloc_strdup(shader, ""); - state->error = false; - state->loop_or_switch_nesting = NULL; - state->ARB_texture_rectangle_enable = true; - - memset(&ext, 0, sizeof(ext)); - state->extensions = &ext; - /* 1.10 minimums. */ - state->Const.MaxLights = 8; - state->Const.MaxClipPlanes = 8; - state->Const.MaxTextureUnits = 2; - - /* More than the 1.10 minimum to appease parser tests taken from - * apps that (hopefully) already checked the number of coords. - */ - state->Const.MaxTextureCoords = 4; - - state->Const.MaxVertexAttribs = 16; - state->Const.MaxVertexUniformComponents = 512; - state->Const.MaxVaryingFloats = 32; - state->Const.MaxVertexTextureImageUnits = 0; - state->Const.MaxCombinedTextureImageUnits = 2; - state->Const.MaxTextureImageUnits = 2; - state->Const.MaxFragmentUniformComponents = 64; - - state->Const.MaxDrawBuffers = 2; + struct _mesa_glsl_parse_state *state = + new(shader) _mesa_glsl_parse_state(NULL, shader->Type, shader); const char *source = shader->Source; - state->error = preprocess(state, &source, &state->info_log, &ext); + state->error = preprocess(state, &source, &state->info_log, + state->extensions); if (!state->error) { _mesa_glsl_lexer_ctor(state, source); -- cgit v1.2.3 From 3c033637de7def553559c11d037f2e8bbb750f77 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 16:40:35 -0700 Subject: glsl2: Make ir_assignment derive from ir_instruction, not ir_rvalue. Assignments can only exist at the top level instruction stream; the residual value is handled by assigning the value to a temporary and returning an ir_dereference_variable of that temporary. --- src/glsl/ir.h | 2 +- src/glsl/ir_reader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index c73bf4ce8b..3fd3a7660b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -506,7 +506,7 @@ public: }; -class ir_assignment : public ir_rvalue { +class ir_assignment : public ir_instruction { public: ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 2248e926d5..14bd2d62fd 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -357,6 +357,8 @@ read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, ir_instruction *inst = NULL; if (strcmp(tag->value(), "declare") == 0) { inst = read_declaration(st, list); + } else if (strcmp(tag->value(), "assign") == 0) { + inst = read_assignment(st, list); } else if (strcmp(tag->value(), "if") == 0) { inst = read_if(st, list, loop_ctx); } else if (strcmp(tag->value(), "loop") == 0) { @@ -546,8 +548,6 @@ read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr) return rvalue; else if (strcmp(tag->value(), "swiz") == 0) { rvalue = read_swizzle(st, list); - } else if (strcmp(tag->value(), "assign") == 0) { - rvalue = read_assignment(st, list); } else if (strcmp(tag->value(), "expression") == 0) { rvalue = read_expression(st, list); } else if (strcmp(tag->value(), "call") == 0) { -- cgit v1.2.3 From 0a89175a35ba3ac2a94d0ba9bcc9926edc8927e3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 16:45:37 -0700 Subject: glsl2: Initialize ir_instruction::type and ir_rvalue::type. Top-level instructions now get NULL as their default type (since type is irrelevant for things like ir_function), while ir_rvalues get error_type by default. This should make it easier to tell if we've forgotten to set a type. It also fixes some "Conditional jump or move depends on uninitialized value" errors in valgrind caused by ir_validate examining the type of top level ir_instructions, which weren't set. --- src/glsl/ir.cpp | 5 +++++ src/glsl/ir.h | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 5054ec725c..8ebef7d95a 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -26,6 +26,11 @@ #include "ir_visitor.h" #include "glsl_types.h" +ir_rvalue::ir_rvalue() +{ + this->type = glsl_type::error_type; +} + ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition) { diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 3fd3a7660b..e0f3683a7a 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -106,6 +106,7 @@ protected: ir_instruction() { ir_type = ir_type_unset; + type = NULL; } }; @@ -150,10 +151,7 @@ public: } protected: - ir_rvalue() - { - /* empty */ - } + ir_rvalue(); }; -- cgit v1.2.3 From 63a92c975dd97445979c6aa1c5fef63d37bfc897 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:17:44 -0700 Subject: glsl2/builtins: Fix "mod" builtin to use scalar/vector operations. --- src/glsl/builtins/110/mod | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/110/mod b/src/glsl/builtins/110/mod index 9e08bbc7ef..aeaea240e2 100644 --- a/src/glsl/builtins/110/mod +++ b/src/glsl/builtins/110/mod @@ -27,38 +27,17 @@ (parameters (declare (in) vec2 arg0) (declare (in) float arg1)) - ((declare () vec2 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) (signature vec3 (parameters (declare (in) vec3 arg0) (declare (in) float arg1)) - ((declare () vec3 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float % (swiz z (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) (signature vec4 (parameters (declare (in) vec4 arg0) (declare (in) float arg1)) - ((declare () vec4 result) - (assign (constant bool (1)) (swiz x (var_ref result)) - (expression float % (swiz x (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz y (var_ref result)) - (expression float % (swiz y (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz z (var_ref result)) - (expression float % (swiz z (var_ref arg0)) (var_ref arg1))) - (assign (constant bool (1)) (swiz w (var_ref result)) - (expression float % (swiz w (var_ref arg0)) (var_ref arg1))) - (return (var_ref result)))) + ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) )) -- cgit v1.2.3 From 5304c251fcceca40096d69002efcf1a122df259d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:25:49 -0700 Subject: glsl2/builtins: Fix 1.30 sign implementation for ints. --- src/glsl/builtins/130/sign | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/130/sign b/src/glsl/builtins/130/sign index 170795948b..f86062a244 100644 --- a/src/glsl/builtins/130/sign +++ b/src/glsl/builtins/130/sign @@ -2,7 +2,7 @@ (signature int (parameters (declare (in) int x)) - ((return (expression int / (var_ref x) (expression int abs (var_ref x)))))) + ((return (expression int sign (var_ref x))))) (signature ivec2 (parameters -- cgit v1.2.3 From 0b8e5f384c75b56bf2ee34c317bb9d06095c798b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 16:52:32 -0700 Subject: glsl2/builtins: Add 1.30 bvec variant of the "mix" builtin. --- src/glsl/builtins/130/mix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/glsl/builtins/130/mix (limited to 'src/glsl') diff --git a/src/glsl/builtins/130/mix b/src/glsl/builtins/130/mix new file mode 100644 index 0000000000..9a1fcd70ff --- /dev/null +++ b/src/glsl/builtins/130/mix @@ -0,0 +1,39 @@ +((function mix + (signature float + (parameters + (declare (in) float v1) + (declare (in) float v2) + (declare (in) bool a)) + ((assign (var_ref a) (var_ref v1) (var_ref v2)) + (return (var_ref v1)))) + + (signature vec2 + (parameters + (declare (in) vec2 v1) + (declare (in) vec2 v2) + (declare (in) bvec2 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (return (var_ref v1)))) + + (signature vec3 + (parameters + (declare (in) vec3 v1) + (declare (in) vec3 v2) + (declare (in) bvec3 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) + (return (var_ref v1)))) + + (signature vec4 + (parameters + (declare (in) vec4 v1) + (declare (in) vec4 v2) + (declare (in) bvec4 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) + (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2))) + (return (var_ref v1)))) +)) -- cgit v1.2.3 From 0a71527dabb7086e81d488451cf4a5cd90380938 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:33:57 -0700 Subject: glsl2: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 72 ++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 25 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index ae0eabcf77..cc957e4b66 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1368,40 +1368,19 @@ static const char *builtins_110_mod = { " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec2 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec3 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) float arg1))\n" - " ((declare () vec4 result)\n" - " (assign (constant bool (1)) (swiz x (var_ref result))\n" - " (expression float % (swiz x (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz y (var_ref result))\n" - " (expression float % (swiz y (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz z (var_ref result))\n" - " (expression float % (swiz z (var_ref arg0)) (var_ref arg1)))\n" - " (assign (constant bool (1)) (swiz w (var_ref result))\n" - " (expression float % (swiz w (var_ref arg0)) (var_ref arg1)))\n" - " (return (var_ref result))))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" "))\n" }; @@ -3406,6 +3385,48 @@ static const char *builtins_130_min = { "))\n" }; +static const char *builtins_130_mix = { + "((function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float v1)\n" + " (declare (in) float v2)\n" + " (declare (in) bool a))\n" + " ((assign (var_ref a) (var_ref v1) (var_ref v2))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 v1)\n" + " (declare (in) vec2 v2)\n" + " (declare (in) bvec2 a))\n" + " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 v1)\n" + " (declare (in) vec3 v2)\n" + " (declare (in) bvec3 a))\n" + " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n" + " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 v1)\n" + " (declare (in) vec4 v2)\n" + " (declare (in) bvec4 a))\n" + " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n" + " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n" + " (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "))\n" +}; + static const char *builtins_130_notEqual = { "((function notEqual\n" " (signature bvec2\n" @@ -3445,7 +3466,7 @@ static const char *builtins_130_sign = { " (signature int\n" " (parameters\n" " (declare (in) int x))\n" - " ((return (expression int / (var_ref x) (expression int abs (var_ref x))))))\n" + " ((return (expression int sign (var_ref x)))))\n" "\n" " (signature ivec2\n" " (parameters\n" @@ -4387,6 +4408,7 @@ static const char *functions_for_130 [] = { builtins_130_lessThanEqual, builtins_130_max, builtins_130_min, + builtins_130_mix, builtins_130_notEqual, builtins_130_sign, builtins_130_sinh, -- cgit v1.2.3 From 3e882ec84a2493da74c55d105010a37de521e593 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 17:44:34 -0700 Subject: ir_constant_expression: Fix broken code for floating point modulus. It's supposed to be x - y * floor(x/y), not (x - y) * floor(x/y). --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 5bef17c755..f15530ae89 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -533,7 +533,7 @@ ir_expression::constant_expression_value() /* We don't use fmod because it rounds toward zero; GLSL specifies * the use of floor. */ - data.f[c] = (op[0]->value.f[c0] - op[1]->value.f[c1]) + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1] * floorf(op[0]->value.f[c0] / op[1]->value.f[c1]); break; default: -- cgit v1.2.3 From e2130d4e39b6ebd9f5d39598a006906680efd830 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 17:54:35 -0700 Subject: glsl2: Remove old .gitignore file from when we were out of tree. --- src/glsl/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/glsl/.gitignore (limited to 'src/glsl') diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore deleted file mode 100644 index e90b98accb..0000000000 --- a/src/glsl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -glsl -- cgit v1.2.3 From eb2cc4f1b1f5ac657c632aa41da5f23eb1cdbe10 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 23 Jul 2010 12:49:17 -0700 Subject: glsl2: Steal ir_variable's constant_value field. Fixes a link-time crash in glsl-vs-cross-3. --- src/glsl/ir.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 8ebef7d95a..2fd654e9bf 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -908,6 +908,9 @@ visit_exec_list(exec_list *list, ir_visitor *visitor) static void steal_memory(ir_instruction *ir, void *new_ctx) { + ir_variable *var = ir->as_variable(); + if (var != NULL && var->constant_value != NULL) + talloc_steal(ir, var->constant_value); talloc_steal(new_ctx, ir); } -- cgit v1.2.3 From fbaca31352678ab7d7bf132f0c9a6aa29ca9fabf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 19:26:53 -0700 Subject: glsl2: Also steal the constant components of aggregate-typed ir_constants. --- src/glsl/ir.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 2fd654e9bf..6dccbd806e 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -909,8 +909,26 @@ static void steal_memory(ir_instruction *ir, void *new_ctx) { ir_variable *var = ir->as_variable(); + ir_constant *constant = ir->as_constant(); if (var != NULL && var->constant_value != NULL) talloc_steal(ir, var->constant_value); + + /* The components of aggregate constants are not visited by the normal + * visitor, so steal their values by hand. + */ + if (constant != NULL) { + if (constant->type->is_record()) { + foreach_iter(exec_list_iterator, iter, constant->components) { + ir_constant *field = (ir_constant *)iter.get(); + steal_memory(field, ir); + } + } else if (constant->type->is_array()) { + for (unsigned int i = 0; i < constant->type->length; i++) { + steal_memory(constant->array_elements[i], ir); + } + } + } + talloc_steal(new_ctx, ir); } -- cgit v1.2.3 From 6a1401eb889b5e535c212c414743cc7ea07f6622 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 00:18:33 -0700 Subject: glsl2: Fix missing visit_continue return in ir_validate. --- src/glsl/ir_validate.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index bb381a00df..93f9c0f7af 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -104,6 +104,8 @@ ir_validate::visit(ir_if *ir) printf("\n"); abort(); } + + return visit_continue; } -- cgit v1.2.3 From 5533c6e38030ff6e26375a1a4e4bfa9ab2204d4c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 09:01:30 -0700 Subject: ir_validate: Check the types of expression operations. --- src/glsl/ir_validate.cpp | 144 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 93f9c0f7af..1fa6e19ce9 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -65,6 +65,8 @@ public: virtual ir_visitor_status visit_leave(ir_function *ir); virtual ir_visitor_status visit_enter(ir_function_signature *ir); + virtual ir_visitor_status visit_leave(ir_expression *ir); + static void validate_ir(ir_instruction *ir, void *data); ir_function *current_function; @@ -161,6 +163,148 @@ ir_validate::visit_enter(ir_function_signature *ir) return visit_continue; } +ir_visitor_status +ir_validate::visit_leave(ir_expression *ir) +{ + switch (ir->operation) { + case ir_unop_bit_not: + assert(ir->operands[0]->type == ir->type); + break; + case ir_unop_logic_not: + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == glsl_type::bool_type); + break; + + case ir_unop_neg: + case ir_unop_abs: + case ir_unop_sign: + case ir_unop_rcp: + case ir_unop_rsq: + case ir_unop_sqrt: + case ir_unop_exp: + case ir_unop_log: + case ir_unop_exp2: + case ir_unop_log2: + assert(ir->type == ir->operands[0]->type); + break; + + case ir_unop_f2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_i2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_f2b: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + break; + case ir_unop_b2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_i2b: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + break; + case ir_unop_b2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_u2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + + case ir_unop_trunc: + case ir_unop_ceil: + case ir_unop_floor: + case ir_unop_fract: + case ir_unop_sin: + case ir_unop_cos: + case ir_unop_dFdx: + case ir_unop_dFdy: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->operands[0]->type == ir->type); + break; + + case ir_binop_add: + case ir_binop_sub: + case ir_binop_mul: + case ir_binop_div: + case ir_binop_mod: + case ir_binop_min: + case ir_binop_max: + case ir_binop_pow: + if (ir->operands[0]->type->is_scalar()) + assert(ir->operands[1]->type == ir->type); + else if (ir->operands[1]->type->is_scalar()) + assert(ir->operands[0]->type == ir->type); + else if (ir->operands[0]->type->is_vector() && + ir->operands[1]->type->is_vector()) { + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->operands[0]->type == ir->type); + } + break; + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: + /* GLSL < > <= >= operators take scalar floats/ints, but in the + * IR we may want to do them for vectors instead to support the + * lessEqual() and friends builtins. + */ + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == ir->operands[1]->type); + break; + + case ir_binop_equal: + case ir_binop_nequal: + /* GLSL == and != operate on vectors and return a bool, and the + * IR matches that. We may want to switch up the IR to work on + * vectors and return a bvec and make the operators break down + * to ANDing/ORing the results of the vector comparison. + */ + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == ir->operands[1]->type); + break; + + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->type == ir->operands[0]->type); + assert(ir->type->base_type == GLSL_TYPE_INT || + ir->type->base_type == GLSL_TYPE_UINT); + break; + + case ir_binop_logic_and: + case ir_binop_logic_xor: + case ir_binop_logic_or: + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == glsl_type::bool_type); + assert(ir->operands[1]->type == glsl_type::bool_type); + break; + + case ir_binop_dot: + assert(ir->type == glsl_type::float_type); + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->operands[0]->type == ir->operands[1]->type); + break; + + case ir_binop_cross: + assert(ir->operands[0]->type == glsl_type::vec3_type); + assert(ir->operands[1]->type == glsl_type::vec3_type); + assert(ir->type == glsl_type::vec3_type); + break; + } + + return visit_continue; +} + ir_visitor_status ir_validate::visit(ir_variable *ir) { -- cgit v1.2.3 From 832aad989e3d319a8aaac046aa49df25da134d82 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 22:50:29 -0700 Subject: glsl2: Add optimization pass for algebraic simplifications. This cleans up the assembly output of almost all the non-logic tests glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically, flattening to a temporary and squaring it). --- src/glsl/Makefile | 1 + src/glsl/ir.h | 8 + src/glsl/ir_algebraic.cpp | 366 ++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 3 +- src/glsl/main.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 1 + 6 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 src/glsl/ir_algebraic.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 462d49e884..4c85af8906 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -30,6 +30,7 @@ CXX_SOURCES = \ glsl_parser_extras.cpp \ glsl_types.cpp \ hir_field_selection.cpp \ + ir_algebraic.cpp \ ir_basic_block.cpp \ ir_clone.cpp \ ir_constant_expression.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index e0f3683a7a..7e8363106d 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -613,7 +613,15 @@ enum ir_expression_operation { ir_binop_greater, ir_binop_lequal, ir_binop_gequal, + /** + * Returns single boolean for whether all components of operands[0] + * equal the components of operands[1]. + */ ir_binop_equal, + /** + * Returns single boolean for whether any component of operands[0] + * is not equal to the corresponding component of operands[1]. + */ ir_binop_nequal, /*@}*/ diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp new file mode 100644 index 0000000000..5b065b086e --- /dev/null +++ b/src/glsl/ir_algebraic.cpp @@ -0,0 +1,366 @@ +/* + * 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 ir_algebraic.cpp + * + * Takes advantage of association, commutivity, and other algebraic + * properties to simplify expressions. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_algebraic_visitor : public ir_hierarchical_visitor { +public: + ir_algebraic_visitor() + { + this->progress = false; + } + + virtual ~ir_algebraic_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_expression *); + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_return *); + virtual ir_visitor_status visit_leave(ir_swizzle *); + virtual ir_visitor_status visit_leave(ir_texture *); + + ir_rvalue *handle_expression(ir_rvalue *in_ir); + + bool progress; +}; + +static bool +is_vec_zero(ir_constant *ir) +{ + int c; + + if (!ir) + return false; + if (!ir->type->is_scalar() && + !ir->type->is_vector()) + return false; + + for (c = 0; c < ir->type->vector_elements; c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + if (ir->value.f[c] != 0.0) + return false; + break; + case GLSL_TYPE_INT: + if (ir->value.i[c] != 0) + return false; + break; + case GLSL_TYPE_UINT: + if (ir->value.u[c] != 0) + return false; + break; + case GLSL_TYPE_BOOL: + if (ir->value.b[c] != false) + return false; + break; + default: + assert(!"bad base type"); + return false; + } + } + + return true; +} + +static bool +is_vec_one(ir_constant *ir) +{ + int c; + + if (!ir) + return false; + if (!ir->type->is_scalar() && + !ir->type->is_vector()) + return false; + + for (c = 0; c < ir->type->vector_elements; c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + if (ir->value.f[c] != 1.0) + return false; + break; + case GLSL_TYPE_INT: + if (ir->value.i[c] != 1) + return false; + break; + case GLSL_TYPE_UINT: + if (ir->value.u[c] != 1) + return false; + break; + case GLSL_TYPE_BOOL: + if (ir->value.b[c] != true) + return false; + break; + default: + assert(!"bad base type"); + return false; + } + } + + return true; +} + +ir_rvalue * +ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) +{ + ir_expression *ir = (ir_expression *)in_ir; + ir_constant *op_const[2] = {NULL, NULL}; + ir_expression *op_expr[2] = {NULL, NULL}; + unsigned int i; + + if (!in_ir) + return NULL; + + if (in_ir->ir_type != ir_type_expression) + return in_ir; + + for (i = 0; i < ir->get_num_operands(); i++) { + if (ir->operands[i]->type->is_matrix()) + return in_ir; + + op_const[i] = ir->operands[i]->constant_expression_value(); + op_expr[i] = ir->operands[i]->as_expression(); + } + + switch (ir->operation) { + case ir_unop_logic_not: + if (op_expr[0] && op_expr[0]->operation == ir_binop_equal) { + this->progress = true; + return new(ir) ir_expression(ir_binop_nequal, + ir->type, + op_expr[0]->operands[0], + op_expr[0]->operands[1]); + } + if (op_expr[0] && op_expr[0]->operation == ir_binop_nequal) { + this->progress = true; + return new(ir) ir_expression(ir_binop_equal, + ir->type, + op_expr[0]->operands[0], + op_expr[0]->operands[1]); + } + break; + + case ir_binop_add: + if (is_vec_zero(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } + if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } + break; + + case ir_binop_sub: + if (is_vec_zero(op_const[0])) { + this->progress = true; + return new(ir) ir_expression(ir_unop_neg, + ir->type, + ir->operands[1], + NULL); + } + if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } + break; + + case ir_binop_mul: + if (is_vec_one(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } + if (is_vec_one(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } + + if (is_vec_zero(op_const[0]) || + is_vec_zero(op_const[1])) { + ir_constant_data zero_data; + memset(&zero_data, 0, sizeof(zero_data)); + + this->progress = true; + return new(ir) ir_constant(ir->type, &zero_data); + } + break; + + case ir_binop_div: + if (is_vec_one(op_const[0]) && ir->type->base_type == GLSL_TYPE_FLOAT) { + this->progress = true; + return new(ir) ir_expression(ir_unop_rcp, + ir->type, + ir->operands[1], + NULL); + } + if (is_vec_one(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } + break; + + case ir_unop_rcp: + if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp) { + this->progress = true; + return op_expr[0]->operands[0]; + } + + /* FINISHME: We should do rcp(rsq(x)) -> sqrt(x) for some + * backends, except that some backends will have done sqrt -> + * rcp(rsq(x)) and we don't want to undo it for them. + */ + + /* As far as we know, all backends are OK with rsq. */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_sqrt) { + this->progress = true; + return new(ir) ir_expression(ir_unop_rsq, + ir->type, + op_expr[0]->operands[0], + NULL); + } + + break; + + default: + break; + } + + return in_ir; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_expression *ir) +{ + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + ir->operands[operand] = handle_expression(ir->operands[operand]); + } + + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_texture *ir) +{ + ir->coordinate = handle_expression(ir->coordinate); + ir->projector = handle_expression(ir->projector); + ir->shadow_comparitor = handle_expression(ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + ir->lod_info.bias = handle_expression(ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + ir->lod_info.lod = handle_expression(ir->lod_info.lod); + break; + case ir_txd: + ir->lod_info.grad.dPdx = handle_expression(ir->lod_info.grad.dPdx); + ir->lod_info.grad.dPdy = handle_expression(ir->lod_info.grad.dPdy); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_swizzle *ir) +{ + ir->val = handle_expression(ir->val); + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_dereference_array *ir) +{ + ir->array_index = handle_expression(ir->array_index); + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_assignment *ir) +{ + ir->rhs = handle_expression(ir->rhs); + ir->condition = handle_expression(ir->condition); + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = handle_expression(param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_return *ir) +{ + ir->value = handle_expression(ir->value);; + return visit_continue; +} + +ir_visitor_status +ir_algebraic_visitor::visit_leave(ir_if *ir) +{ + ir->condition = handle_expression(ir->condition); + return visit_continue; +} + + +bool +do_algebraic(exec_list *instructions) +{ + ir_algebraic_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 06cb4d22ca..4f39565e5f 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -23,11 +23,12 @@ /** - * \file ir_dead_code.h + * \file ir_optimization.h * * Prototypes for optimization passes to be called by the compiler and drivers. */ +bool do_algebraic(exec_list *instructions); bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 5c0f6475e0..b62902278c 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -165,6 +165,7 @@ compile_shader(struct gl_shader *shader) progress = do_dead_code_unlinked(state, shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; + progress = do_algebraic(shader->ir) || progress; progress = do_vec_index_to_swizzle(shader->ir) || progress; progress = do_vec_index_to_cond_assign(shader->ir) || progress; progress = do_swizzle_swizzle(shader->ir) || progress; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index d06b83261c..2fd0507c2f 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2240,6 +2240,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_dead_code_unlinked(state, shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; + progress = do_algebraic(shader->ir) || progress; progress = do_if_return(shader->ir) || progress; if (ctx->Shader.EmitNoIfs) progress = do_if_to_cond_assign(shader->ir) || progress; -- cgit v1.2.3 From 85cd64ee170e578317a6aa41d824314550a318ac Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:14:59 -0700 Subject: glsl2: Talloc type names. Otherwise, we end up losing structure names after compile time, and dumping IR often ends up reporting some other mysterious string. --- src/glsl/glsl_types.cpp | 25 ++++++++++++++++--------- src/glsl/glsl_types.h | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index de0adc0c6e..8192b86dfc 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -35,6 +35,15 @@ hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; void *glsl_type::ctx = NULL; +static void +init_talloc_type_ctx(void) +{ + if (glsl_type::ctx == NULL) { + glsl_type::ctx = talloc_init("glsl_type"); + assert(glsl_type::ctx != NULL); + } +} + glsl_type::glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, unsigned matrix_columns, const char *name) : @@ -43,9 +52,10 @@ glsl_type::glsl_type(GLenum gl_type, sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), vector_elements(vector_elements), matrix_columns(matrix_columns), - name(name), length(0) { + init_talloc_type_ctx(); + this->name = talloc_strdup(this->ctx, name); /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); @@ -60,9 +70,10 @@ glsl_type::glsl_type(GLenum gl_type, sampler_dimensionality(dim), sampler_shadow(shadow), sampler_array(array), sampler_type(type), vector_elements(0), matrix_columns(0), - name(name), length(0) { + init_talloc_type_ctx(); + this->name = talloc_strdup(this->ctx, name); memset(& fields, 0, sizeof(fields)); } @@ -72,17 +83,13 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), vector_elements(0), matrix_columns(0), - name(name), length(num_fields) { unsigned int i; - if (glsl_type::ctx == NULL) { - glsl_type::ctx = talloc_init("glsl_type"); - assert(glsl_type::ctx != NULL); - } - - this->fields.structure = talloc_array(glsl_type::ctx, + init_talloc_type_ctx(); + this->name = talloc_strdup(this->ctx, name); + this->fields.structure = talloc_array(this->ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 69fb9e3fb5..4bec318167 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -388,7 +388,6 @@ struct glsl_type { return is_array() ? length : -1; } -private: /** * talloc context for all glsl_type allocations * @@ -396,6 +395,7 @@ private: */ static TALLOC_CTX *ctx; +private: /** Constructor for vector and matrix types */ glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, -- cgit v1.2.3 From 66d4c65ee2c311ea0c71c39a28456d0c11798d6b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:28:26 -0700 Subject: glsl2: Make the dead code handler make its own talloc context. This way, we don't need to pass in a parse state, and the context doesn't grow with the number of passes through optimization. --- src/glsl/ir_dead_code.cpp | 12 ++++++------ src/glsl/ir_optimization.h | 6 ++---- src/glsl/main.cpp | 2 +- src/mesa/program/ir_to_mesa.cpp | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index ea78107f49..4804407bdc 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -146,13 +146,12 @@ ir_dead_code_visitor::visit_leave(ir_assignment *ir) * for usage on an unlinked instruction stream. */ bool -do_dead_code(struct _mesa_glsl_parse_state *state, - exec_list *instructions) +do_dead_code(exec_list *instructions) { ir_dead_code_visitor v; bool progress = false; - v.mem_ctx = state; + v.mem_ctx = talloc_new(NULL); v.run(instructions); foreach_iter(exec_list_iterator, iter, v.variable_list) { @@ -188,6 +187,8 @@ do_dead_code(struct _mesa_glsl_parse_state *state, progress = true; } } + talloc_free(v.mem_ctx); + return progress; } @@ -199,8 +200,7 @@ do_dead_code(struct _mesa_glsl_parse_state *state, * with global scope. */ bool -do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, - exec_list *instructions) +do_dead_code_unlinked(exec_list *instructions) { bool progress = false; @@ -211,7 +211,7 @@ do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, foreach_iter(exec_list_iterator, sigiter, *f) { ir_function_signature *sig = (ir_function_signature *) sigiter.get(); - if (do_dead_code(state, &sig->body)) + if (do_dead_code(&sig->body)) progress = true; } } diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 4f39565e5f..5dbb025d35 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -33,11 +33,9 @@ bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); bool do_copy_propagation(exec_list *instructions); -bool do_dead_code(struct _mesa_glsl_parse_state *state, - exec_list *instructions); +bool do_dead_code(exec_list *instructions); bool do_dead_code_local(exec_list *instructions); -bool do_dead_code_unlinked(struct _mesa_glsl_parse_state *state, - exec_list *instructions); +bool do_dead_code_unlinked(exec_list *instructions); bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_return(exec_list *instructions); diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index b62902278c..08b133f124 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -162,7 +162,7 @@ compile_shader(struct gl_shader *shader) progress = do_if_simplification(shader->ir) || progress; progress = do_copy_propagation(shader->ir) || progress; progress = do_dead_code_local(shader->ir) || progress; - progress = do_dead_code_unlinked(state, shader->ir) || progress; + progress = do_dead_code_unlinked(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 5cc999c2e3..409b6d7288 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2237,7 +2237,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_if_simplification(shader->ir) || progress; progress = do_copy_propagation(shader->ir) || progress; progress = do_dead_code_local(shader->ir) || progress; - progress = do_dead_code_unlinked(state, shader->ir) || progress; + progress = do_dead_code_unlinked(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; -- cgit v1.2.3 From 5532c4ca696fea32fb9b2f8de15beabe4a20ae15 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:29:17 -0700 Subject: glsl2: Fix the linked version of ir_dead_code. If we don't walk into functions, we won't see any usage of variables in the functions. --- src/glsl/ir_dead_code.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 4804407bdc..eab459b920 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -61,7 +61,7 @@ public: virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit(ir_dereference_variable *); - virtual ir_visitor_status visit_enter(ir_function *); + virtual ir_visitor_status visit_enter(ir_function_signature *); virtual ir_visitor_status visit_leave(ir_assignment *); variable_entry *get_variable_entry(ir_variable *var); @@ -116,9 +116,12 @@ ir_dead_code_visitor::visit(ir_dereference_variable *ir) ir_visitor_status -ir_dead_code_visitor::visit_enter(ir_function *ir) +ir_dead_code_visitor::visit_enter(ir_function_signature *ir) { - (void) ir; + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); return visit_continue_with_parent; } -- cgit v1.2.3 From bf6ad0ab3d3940ca642c388444f7ddae91eefffc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 11:31:12 -0700 Subject: glsl2: Use ir_dead_code's linked version after linking. glsl-fs-raytrace-bug27060 goes from 485 Mesa IR instructions to 389 before Mesa IR optimization. --- src/glsl/linker.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index ea0274eac3..06f2a8231a 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1262,9 +1262,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_if_simplification(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_dead_code_local(ir) || progress; -#if 0 - progress = do_dead_code_unlinked(state, ir) || progress; -#endif + progress = do_dead_code_unlinked(ir) || progress; progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_if_return(ir) || progress; -- cgit v1.2.3 From 54f583a206a15b1a92c547333adfae29ced796ef Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 12:10:50 -0700 Subject: glsl2: Don't dereference a NULL var in CE handling during a compile error. If an undeclared variable was dereferenced in an expression that needed constant expression handling, we would walk off a null ir->var pointer. Fixes: glsl1-TIntermediate::addUnaryMath --- src/glsl/ir_constant_expression.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index f15530ae89..6a07f4e189 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -676,6 +676,10 @@ ir_swizzle::constant_expression_value() ir_constant * ir_dereference_variable::constant_expression_value() { + /* This may occur during compile and var->type is glsl_type::error_type */ + if (!var) + return NULL; + return var->constant_value ? var->constant_value->clone(NULL) : NULL; } -- cgit v1.2.3 From 59c45e9e6cf80be149c6e5d94763e98312f49be2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 14:32:21 -0700 Subject: glsl2: Actually use the linked dead code eliminator. I managed to revert the change from unlinked at some point while cleaning up the changes. glsl-fs-raytrace-bug27060 drops from 389 instructions to 370. --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 06f2a8231a..e7bc700029 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1262,7 +1262,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_if_simplification(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_dead_code_local(ir) || progress; - progress = do_dead_code_unlinked(ir) || progress; + progress = do_dead_code(ir) || progress; progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_if_return(ir) || progress; -- cgit v1.2.3 From f9b0e5e322a676cf778dc3785281040fcc0bd248 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Jul 2010 15:25:07 -0700 Subject: glsl2: When stealing var->constant_value, steal its children as well. Fixes: glsl1-GLSL 1.20 uniform array constructor --- src/glsl/ir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 6dccbd806e..c75d560c48 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -911,7 +911,7 @@ steal_memory(ir_instruction *ir, void *new_ctx) ir_variable *var = ir->as_variable(); ir_constant *constant = ir->as_constant(); if (var != NULL && var->constant_value != NULL) - talloc_steal(ir, var->constant_value); + steal_memory(var->constant_value, ir); /* The components of aggregate constants are not visited by the normal * visitor, so steal their values by hand. -- cgit v1.2.3 From 2233d10442f1e19d18693fc030aefe292b14cf29 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 11:07:46 -0700 Subject: glcpp: Remove 2 shift/reduce conflicts from the grammar. Since we have productions to turn "defined FOO" and "defined ( FOO )" into a conditional_token we don't need to list DEFINED as an operator as well. Doing so just introduces the shift/reduce ambiguity with no benefit. --- src/glsl/glcpp/glcpp-parse.y | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 5b7467836d..3322db06ed 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -478,7 +478,6 @@ operator: | ',' { $$ = ','; } | '=' { $$ = '='; } | PASTE { $$ = PASTE; } -| DEFINED { $$ = DEFINED; } ; %% -- cgit v1.2.3 From efef950f393dfe6cb7ef60bee646f2197143df41 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 11:10:52 -0700 Subject: glcpp: Explicitly expect 0 shift/reduce conflicts. The "%expect 0" construct will make bison emit an error if any future changes to the grammar introduce shift/reduce conflicts, (without also increasing the number after "%expect"). --- src/glsl/glcpp/glcpp-parse.y | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 3322db06ed..41cfff5551 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -141,6 +141,7 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); %parse-param {glcpp_parser_t *parser} %lex-param {glcpp_parser_t *parser} +%expect 0 %token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE %token PASTE %type expression INTEGER operator SPACE -- cgit v1.2.3 From 73df636e043fc72a07b0b8b759906d92d7edf793 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 08:18:59 -0700 Subject: glsl2: Size builtin arrays according to the context constants. Cleans up some of the FINISHMEs in this file. --- src/glsl/ir_variable.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 0dd6d834b7..ea2872f237 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -152,12 +152,8 @@ generate_110_uniforms(exec_list *instructions, * FINISHME: (glFrontMaterial, glBackMaterial) */ - /* FINISHME: The size of this array is implementation dependent based on the - * FINISHME: value of GL_MAX_TEXTURE_LIGHTS. GL_MAX_TEXTURE_LIGHTS must be - * FINISHME: at least 8, so hard-code 8 for now. - */ const glsl_type *const light_source_array_type = - glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), 8); + glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), state->Const.MaxLights); add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, instructions, state->symbols); @@ -227,11 +223,9 @@ generate_130_vs_variables(exec_list *instructions, instructions, state->symbols); } - /* FINISHME: The size of this array is implementation dependent based on - * FINISHME: the value of GL_MAX_CLIP_DISTANCES. - */ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(glsl_type::float_type, 8); + glsl_type::get_array_instance(glsl_type::float_type, + state->Const.MaxClipPlanes); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, @@ -349,11 +343,9 @@ generate_130_fs_variables(exec_list *instructions, { generate_120_fs_variables(instructions, state); - /* FINISHME: The size of this array is implementation dependent based on - * FINISHME: the value of GL_MAX_CLIP_DISTANCES. - */ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(glsl_type::float_type, 8); + glsl_type::get_array_instance(glsl_type::float_type, + state->Const.MaxClipPlanes); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, -- cgit v1.2.3 From 85b5dba5933437763dfb6ddc5384f59c0943d658 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 12:23:51 -0700 Subject: glsl2: Add the remaining builtin uniforms. --- src/glsl/ir_variable.cpp | 68 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 15 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index ea2872f237..478cefc5a6 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -76,6 +76,14 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, return var; } +static ir_variable * +add_uniform(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + const char *name, const glsl_type *type) +{ + return add_variable(name, ir_var_uniform, -1, type, instructions, + state->symbols); +} static void add_builtin_variable(const builtin_variable *proto, exec_list *instructions, @@ -141,28 +149,58 @@ generate_110_uniforms(exec_list *instructions, glsl_type::get_array_instance(glsl_type::mat4_type, state->Const.MaxTextureCoords); - add_variable("gl_TextureMatrix", ir_var_uniform, -1, mat4_array_type, - instructions, state->symbols); + add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type); - /* FINISHME: Add support for gl_DepthRangeParameters */ - /* FINISHME: Add support for gl_ClipPlane[] */ - /* FINISHME: Add support for gl_PointParameters */ + add_uniform(instructions, state, "gl_DepthRangeParameters", + state->symbols->get_type("gl_DepthRangeParameters")); - /* FINISHME: Add support for gl_MaterialParameters - * FINISHME: (glFrontMaterial, glBackMaterial) - */ + add_uniform(instructions, state, "gl_ClipPlane", + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxClipPlanes)); + add_uniform(instructions, state, "gl_Point", + state->symbols->get_type("gl_PointParameters")); + + const glsl_type *const material_parameters_type = + state->symbols->get_type("gl_MaterialParameters"); + add_uniform(instructions, state, "gl_FrontMaterial", material_parameters_type); + add_uniform(instructions, state, "gl_BackMaterial", material_parameters_type); const glsl_type *const light_source_array_type = glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), state->Const.MaxLights); - add_variable("gl_LightSource", ir_var_uniform, -1, light_source_array_type, - instructions, state->symbols); + add_uniform(instructions, state, "gl_LightSource", light_source_array_type); + + const glsl_type *const light_model_products_type = + state->symbols->get_type("gl_LightModelProducts"); + add_uniform(instructions, state, "gl_FrontLightModelProduct", + light_model_products_type); + add_uniform(instructions, state, "gl_BackLightModelProduct", + light_model_products_type); + + const glsl_type *const light_products_type = + glsl_type::get_array_instance(state->symbols->get_type("gl_LightProducts"), + state->Const.MaxLights); + add_uniform(instructions, state, "gl_FrontLightProduct", light_products_type); + add_uniform(instructions, state, "gl_BackLightProduct", light_products_type); - /* FINISHME: Add support for gl_LightModel */ - /* FINISHME: Add support for gl_FrontLightProduct[], gl_BackLightProduct[] */ - /* FINISHME: Add support for gl_TextureEnvColor[] */ - /* FINISHME: Add support for gl_ObjectPlane*[], gl_EyePlane*[] */ - /* FINISHME: Add support for gl_Fog */ + add_uniform(instructions, state, "gl_TextureEnvColor", + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxTextureUnits)); + + const glsl_type *const texcoords_vec4 = + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxTextureCoords); + add_uniform(instructions, state, "gl_EyePlaneS", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneT", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneR", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneQ", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneS", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneT", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneR", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneQ", texcoords_vec4); + + add_uniform(instructions, state, "gl_Fog", + state->symbols->get_type("gl_FogParameters")); } static void -- cgit v1.2.3 From 279cc22dbc297b32ddc7301ed1790336cd1038ae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 12:19:44 -0700 Subject: glcpp: Add expected output for a recently-added test. I simply forgot to add this file when adding the test case originally. --- src/glsl/glcpp/tests/069-repeated-argument.c.expected | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/glsl/glcpp/tests/069-repeated-argument.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/069-repeated-argument.c.expected b/src/glsl/glcpp/tests/069-repeated-argument.c.expected new file mode 100644 index 0000000000..755c4d4b56 --- /dev/null +++ b/src/glsl/glcpp/tests/069-repeated-argument.c.expected @@ -0,0 +1,3 @@ + +1 1 + -- cgit v1.2.3 From e8a8f0f278d3c2b46b9e9883cbd837a59fcc3aaa Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 12:27:33 -0700 Subject: glsl: Add generated files from flex/bison. The mesa build environment does not (currently) accept external dependencies such as flex and bison. The compromise is to commit the generated output files, (in spite of the pain that comes from having generated files under version control). --- src/glsl/glsl_lexer.cpp | 3174 +++++++++++++++++++++++++++++ src/glsl/glsl_parser.cpp | 5054 ++++++++++++++++++++++++++++++++++++++++++++++ src/glsl/glsl_parser.h | 262 +++ 3 files changed, 8490 insertions(+) create mode 100644 src/glsl/glsl_lexer.cpp create mode 100644 src/glsl/glsl_parser.cpp create mode 100644 src/glsl/glsl_parser.h (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp new file mode 100644 index 0000000000..e3e89195b2 --- /dev/null +++ b/src/glsl/glsl_lexer.cpp @@ -0,0 +1,3174 @@ +#line 2 "glsl_lexer.cpp" + +#line 4 "glsl_lexer.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE _mesa_glsl_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via _mesa_glsl_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void _mesa_glsl_restart (FILE *input_file ,yyscan_t yyscanner ); +void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner ); + +static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner ); +static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner ); +static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER _mesa_glsl__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE _mesa_glsl__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *_mesa_glsl_alloc (yy_size_t ,yyscan_t yyscanner ); +void *_mesa_glsl_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void _mesa_glsl_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer _mesa_glsl__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + _mesa_glsl_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + _mesa_glsl_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define _mesa_glsl_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 145 +#define YY_END_OF_BUFFER 146 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[519] = + { 0, + 0, 0, 9, 9, 146, 144, 1, 14, 144, 144, + 144, 144, 144, 144, 144, 144, 89, 87, 144, 144, + 144, 143, 144, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 144, 1, 144, 84, 145, 9, 13, + 145, 12, 10, 11, 1, 73, 80, 74, 83, 77, + 68, 79, 69, 86, 91, 78, 92, 89, 0, 0, + 0, 87, 0, 70, 72, 71, 0, 143, 76, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 22, 143, 143, 143, 143, 143, 143, 143, 143, 143, + + 143, 143, 143, 143, 26, 50, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 85, 75, 1, 0, 0, 2, 0, + 0, 0, 0, 9, 8, 12, 11, 0, 91, 90, + 0, 92, 0, 93, 88, 81, 82, 96, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 25, 143, 143, + 143, 143, 143, 143, 143, 143, 19, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 51, 143, 143, 143, + + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 0, 0, 0, 0, 8, 0, 91, 0, 90, 0, + 92, 93, 143, 17, 143, 143, 136, 143, 143, 143, + 143, 143, 143, 143, 143, 24, 99, 143, 143, 143, + 57, 143, 143, 104, 118, 143, 143, 143, 143, 143, + 143, 143, 143, 115, 139, 38, 39, 40, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 143, 143, 143, 102, 94, 143, 143, 143, + 143, 143, 143, 35, 36, 37, 67, 143, 143, 0, + + 0, 0, 0, 0, 90, 143, 20, 29, 30, 31, + 143, 97, 16, 143, 143, 143, 143, 126, 127, 128, + 143, 95, 119, 18, 129, 130, 131, 141, 123, 124, + 125, 143, 52, 121, 143, 143, 32, 33, 34, 143, + 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, + 143, 143, 116, 143, 143, 143, 143, 143, 143, 143, + 143, 98, 143, 138, 143, 143, 23, 0, 0, 0, + 0, 143, 143, 143, 143, 143, 117, 112, 107, 143, + 143, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 143, 143, 143, 143, 122, 103, 143, 110, 28, 143, + + 135, 58, 111, 66, 105, 143, 143, 143, 143, 143, + 143, 0, 0, 0, 0, 143, 143, 143, 106, 27, + 143, 143, 143, 140, 143, 143, 143, 143, 143, 143, + 100, 53, 143, 54, 143, 0, 0, 0, 7, 0, + 143, 55, 21, 113, 143, 143, 143, 108, 143, 143, + 143, 143, 143, 143, 101, 120, 109, 0, 0, 6, + 0, 0, 0, 3, 15, 114, 56, 137, 143, 142, + 60, 61, 62, 143, 0, 0, 0, 0, 143, 143, + 143, 143, 143, 143, 4, 0, 5, 0, 0, 0, + 143, 143, 143, 143, 143, 63, 0, 143, 143, 143, + + 143, 143, 59, 143, 132, 143, 133, 143, 143, 143, + 64, 143, 65, 143, 143, 143, 134, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 1, 6, 1, 7, 8, 1, 1, + 1, 9, 10, 1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 19, 19, 20, 20, 21, 1, 22, + 23, 24, 1, 1, 25, 25, 26, 27, 28, 29, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 31, 32, 30, 30, 30, 30, 33, 30, 30, + 1, 1, 1, 34, 30, 1, 35, 36, 37, 38, + + 39, 40, 41, 42, 43, 30, 44, 45, 46, 47, + 48, 49, 30, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 1, 59, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[60] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, + 4, 5, 1, 6, 6, 6, 6, 6, 6, 7, + 1, 1, 1, 1, 8, 8, 8, 9, 10, 11, + 11, 11, 12, 1, 8, 8, 8, 8, 9, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 12, 11, 11, 1 + } ; + +static yyconst flex_int16_t yy_base[538] = + { 0, + 0, 58, 81, 0, 809, 810, 59, 810, 785, 784, + 54, 783, 55, 56, 54, 782, 129, 130, 53, 781, + 127, 0, 769, 101, 106, 126, 116, 128, 143, 754, + 144, 136, 753, 128, 145, 747, 142, 760, 159, 165, + 149, 164, 756, 149, 214, 207, 774, 810, 215, 810, + 783, 209, 810, 0, 228, 810, 810, 810, 810, 810, + 810, 810, 810, 810, 205, 810, 208, 133, 223, 171, + 0, 226, 772, 810, 810, 810, 771, 0, 810, 747, + 740, 743, 751, 750, 737, 740, 751, 738, 744, 732, + 729, 742, 729, 726, 726, 732, 720, 205, 725, 735, + + 721, 727, 730, 731, 0, 215, 730, 166, 716, 729, + 720, 200, 713, 727, 724, 726, 709, 714, 711, 700, + 709, 207, 713, 709, 711, 700, 703, 188, 708, 700, + 712, 223, 705, 810, 810, 268, 256, 273, 810, 691, + 703, 695, 705, 269, 0, 263, 0, 274, 810, 258, + 278, 810, 314, 280, 0, 810, 810, 0, 693, 697, + 706, 703, 687, 686, 686, 241, 701, 698, 698, 696, + 693, 685, 691, 678, 689, 675, 691, 0, 688, 676, + 683, 680, 684, 677, 666, 665, 678, 681, 678, 673, + 664, 286, 669, 672, 663, 670, 659, 663, 669, 660, + + 651, 654, 652, 662, 652, 647, 645, 645, 647, 644, + 655, 654, 259, 649, 644, 633, 297, 651, 653, 642, + 634, 638, 649, 633, 0, 321, 313, 306, 810, 329, + 340, 810, 639, 0, 637, 338, 0, 630, 628, 626, + 634, 623, 640, 629, 341, 0, 0, 623, 633, 633, + 0, 618, 344, 0, 0, 620, 347, 621, 615, 614, + 615, 614, 350, 0, 0, 607, 606, 605, 607, 608, + 613, 607, 603, 616, 611, 610, 602, 606, 598, 601, + 596, 604, 609, 608, 599, 0, 0, 605, 594, 594, + 599, 598, 595, 0, 0, 0, 0, 585, 597, 596, + + 595, 592, 581, 356, 367, 595, 0, 0, 0, 0, + 582, 0, 0, 582, 583, 577, 587, 0, 0, 0, + 578, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 585, 0, 0, 583, 579, 0, 0, 0, 365, + 368, 371, 575, 571, 576, 567, 565, 578, 564, 577, + 566, 573, 0, 571, 568, 572, 556, 565, 571, 566, + 554, 0, 556, 0, 555, 558, 0, 553, 597, 552, + 554, 543, 552, 541, 541, 554, 0, 556, 0, 548, + 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 529, 542, 529, 526, 0, 0, 531, 0, 0, 522, + + 0, 0, 0, 0, 0, 519, 521, 514, 516, 513, + 505, 498, 395, 513, 499, 494, 506, 504, 0, 0, + 493, 497, 483, 0, 482, 470, 467, 452, 375, 456, + 0, 0, 439, 0, 433, 428, 391, 323, 810, 423, + 430, 0, 0, 0, 429, 415, 427, 0, 428, 417, + 436, 435, 434, 407, 0, 0, 0, 411, 402, 810, + 415, 0, 396, 810, 0, 0, 0, 0, 406, 0, + 425, 371, 418, 412, 399, 417, 419, 423, 402, 402, + 404, 400, 402, 384, 810, 425, 810, 437, 0, 433, + 354, 371, 363, 360, 342, 0, 435, 313, 283, 267, + + 273, 256, 0, 258, 268, 248, 0, 239, 213, 195, + 0, 206, 0, 168, 32, 11, 0, 810, 469, 473, + 480, 487, 492, 498, 504, 506, 516, 525, 529, 533, + 539, 550, 556, 558, 567, 578, 580 + } ; + +static yyconst flex_int16_t yy_def[538] = + { 0, + 518, 1, 518, 3, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 519, 518, 518, + 518, 520, 518, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 521, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 522, 518, 523, 17, 524, 525, + 526, 519, 518, 518, 518, 518, 518, 520, 518, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 527, 518, 521, 528, 518, 523, + 529, 518, 518, 525, 526, 518, 518, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 518, 518, 518, 518, 527, 518, 528, 530, 518, 518, + 529, 518, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 518, + + 518, 518, 518, 518, 530, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 518, 518, 518, + 518, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 518, 518, 518, 518, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 518, 531, 532, 518, 518, + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 518, 533, 518, + 518, 534, 532, 518, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 518, 535, 536, 534, 520, 520, + 520, 520, 520, 520, 518, 518, 518, 518, 537, 536, + 520, 520, 520, 520, 520, 520, 537, 520, 520, 520, + + 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, + 520, 520, 520, 520, 520, 520, 520, 0, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518 + } ; + +static yyconst flex_int16_t yy_nxt[870] = + { 0, + 6, 7, 8, 7, 9, 6, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, + 6, 19, 20, 21, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 22, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 22, 22, 22, 44, 45, + 55, 58, 55, 46, 61, 517, 63, 65, 65, 65, + 65, 65, 65, 65, 73, 74, 59, 62, 64, 516, + 47, 48, 49, 50, 49, 48, 48, 48, 48, 48, + 48, 48, 48, 51, 48, 52, 52, 52, 52, 52, + + 52, 53, 48, 48, 48, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 48, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 48, + 67, 67, 68, 68, 68, 68, 68, 68, 69, 76, + 77, 80, 81, 82, 89, 83, 70, 70, 90, 84, + 85, 71, 109, 91, 86, 518, 110, 70, 70, 92, + 87, 134, 93, 88, 94, 105, 114, 96, 102, 111, + 153, 153, 106, 95, 71, 97, 103, 98, 518, 107, + 99, 115, 112, 118, 116, 128, 100, 104, 130, 129, + + 119, 120, 131, 124, 121, 515, 125, 135, 138, 139, + 122, 132, 190, 123, 126, 136, 144, 55, 144, 137, + 191, 127, 146, 146, 146, 146, 146, 146, 146, 55, + 213, 55, 148, 149, 67, 151, 152, 67, 214, 176, + 514, 206, 195, 148, 149, 140, 151, 152, 196, 513, + 70, 141, 177, 70, 512, 142, 207, 138, 139, 184, + 143, 70, 185, 186, 70, 218, 187, 219, 188, 136, + 144, 55, 144, 137, 138, 139, 146, 146, 146, 146, + 146, 146, 146, 226, 226, 228, 229, 230, 230, 518, + 518, 240, 241, 511, 140, 510, 228, 229, 289, 509, + + 141, 266, 267, 268, 142, 508, 290, 507, 232, 143, + 506, 140, 294, 295, 296, 304, 304, 141, 505, 232, + 504, 142, 518, 518, 459, 460, 143, 154, 154, 154, + 154, 154, 154, 154, 227, 227, 227, 227, 227, 227, + 227, 149, 231, 231, 231, 231, 231, 231, 231, 518, + 518, 503, 149, 308, 309, 310, 318, 319, 320, 325, + 326, 327, 329, 330, 331, 337, 338, 339, 152, 305, + 305, 305, 305, 305, 305, 305, 518, 518, 502, 152, + 382, 383, 384, 385, 386, 387, 388, 389, 390, 451, + 452, 453, 459, 460, 501, 229, 413, 459, 460, 500, + + 454, 481, 482, 459, 460, 499, 229, 498, 437, 438, + 438, 438, 438, 438, 438, 476, 459, 460, 486, 487, + 486, 487, 496, 462, 459, 460, 486, 487, 461, 461, + 461, 461, 461, 461, 486, 487, 486, 487, 486, 487, + 495, 494, 493, 492, 491, 485, 462, 484, 483, 489, + 488, 488, 488, 488, 488, 488, 480, 479, 475, 474, + 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, + 458, 457, 489, 72, 72, 72, 456, 72, 78, 78, + 78, 78, 78, 78, 78, 147, 147, 147, 147, 147, + 147, 147, 65, 65, 455, 65, 65, 150, 150, 450, + + 150, 150, 69, 69, 69, 449, 69, 154, 448, 154, + 154, 155, 155, 155, 155, 155, 225, 225, 447, 225, + 225, 225, 225, 225, 225, 225, 225, 225, 227, 446, + 227, 227, 231, 445, 231, 231, 305, 444, 305, 305, + 461, 461, 443, 442, 461, 441, 440, 439, 436, 435, + 461, 463, 463, 434, 433, 463, 463, 477, 477, 432, + 431, 477, 477, 478, 478, 478, 478, 478, 488, 488, + 430, 429, 488, 428, 427, 426, 425, 424, 488, 490, + 490, 423, 422, 490, 490, 497, 497, 497, 497, 497, + 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, + + 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, + 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, + 391, 381, 380, 379, 378, 377, 376, 375, 374, 373, + 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, + 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, + 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, + 342, 341, 340, 336, 335, 334, 333, 332, 328, 324, + 323, 322, 321, 317, 316, 315, 314, 313, 312, 311, + 307, 306, 303, 302, 301, 300, 299, 298, 297, 293, + 292, 291, 288, 287, 286, 285, 284, 283, 282, 281, + + 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, + 270, 269, 265, 264, 263, 262, 261, 260, 259, 258, + 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, + 247, 246, 245, 244, 243, 242, 239, 238, 237, 236, + 235, 234, 233, 224, 223, 222, 221, 220, 217, 216, + 215, 212, 211, 210, 209, 208, 205, 204, 203, 202, + 201, 200, 199, 198, 197, 194, 193, 192, 189, 183, + 182, 181, 180, 179, 178, 175, 174, 173, 172, 171, + 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, + 160, 159, 158, 157, 156, 145, 75, 133, 117, 113, + + 108, 101, 79, 75, 66, 60, 57, 56, 518, 5, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518 + } ; + +static yyconst flex_int16_t yy_chk[870] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 7, 11, 7, 2, 13, 516, 14, 15, 15, 15, + 15, 15, 15, 15, 19, 19, 11, 13, 14, 515, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 17, 18, 17, 17, 17, 17, 17, 17, 17, 21, + 21, 24, 24, 25, 27, 25, 17, 18, 27, 25, + 26, 17, 34, 27, 26, 68, 34, 17, 18, 27, + 26, 44, 28, 26, 28, 32, 37, 29, 31, 35, + 70, 70, 32, 28, 17, 29, 31, 29, 68, 32, + 29, 37, 35, 39, 37, 41, 29, 31, 42, 41, + + 39, 39, 42, 40, 39, 514, 40, 44, 46, 46, + 39, 42, 108, 39, 40, 45, 49, 45, 49, 45, + 108, 40, 52, 52, 52, 52, 52, 52, 52, 55, + 128, 55, 65, 65, 69, 67, 67, 72, 128, 98, + 512, 122, 112, 65, 65, 46, 67, 67, 112, 510, + 69, 46, 98, 72, 509, 46, 122, 137, 137, 106, + 46, 69, 106, 106, 72, 132, 106, 132, 106, 136, + 144, 136, 144, 136, 138, 138, 146, 146, 146, 146, + 146, 146, 146, 148, 148, 150, 150, 151, 151, 154, + 154, 166, 166, 508, 137, 506, 150, 150, 213, 505, + + 137, 192, 192, 192, 137, 504, 213, 502, 154, 137, + 501, 138, 217, 217, 217, 228, 228, 138, 500, 154, + 499, 138, 227, 227, 438, 438, 138, 153, 153, 153, + 153, 153, 153, 153, 226, 226, 226, 226, 226, 226, + 226, 227, 230, 230, 230, 230, 230, 230, 230, 231, + 231, 498, 227, 236, 236, 236, 245, 245, 245, 253, + 253, 253, 257, 257, 257, 263, 263, 263, 231, 304, + 304, 304, 304, 304, 304, 304, 305, 305, 495, 231, + 340, 340, 340, 341, 341, 341, 342, 342, 342, 429, + 429, 429, 437, 437, 494, 305, 413, 463, 463, 493, + + 429, 472, 472, 459, 459, 492, 305, 491, 413, 413, + 413, 413, 413, 413, 413, 459, 461, 461, 476, 476, + 477, 477, 484, 437, 478, 478, 486, 486, 461, 461, + 461, 461, 461, 461, 490, 490, 497, 497, 488, 488, + 483, 482, 481, 480, 479, 475, 437, 474, 473, 476, + 488, 488, 488, 488, 488, 488, 471, 469, 458, 454, + 453, 452, 451, 450, 449, 447, 446, 445, 441, 440, + 436, 435, 476, 519, 519, 519, 433, 519, 520, 520, + 520, 520, 520, 520, 520, 521, 521, 521, 521, 521, + 521, 521, 522, 522, 430, 522, 522, 523, 523, 428, + + 523, 523, 524, 524, 524, 427, 524, 525, 426, 525, + 525, 526, 526, 526, 526, 526, 527, 527, 425, 527, + 527, 527, 527, 527, 527, 527, 527, 527, 528, 423, + 528, 528, 529, 422, 529, 529, 530, 421, 530, 530, + 531, 531, 418, 417, 531, 416, 415, 414, 412, 411, + 531, 532, 532, 410, 409, 532, 532, 533, 533, 408, + 407, 533, 533, 534, 534, 534, 534, 534, 535, 535, + 406, 400, 535, 397, 394, 393, 392, 391, 535, 536, + 536, 381, 380, 536, 536, 537, 537, 537, 537, 537, + 378, 376, 375, 374, 373, 372, 371, 370, 369, 368, + + 366, 365, 363, 361, 360, 359, 358, 357, 356, 355, + 354, 352, 351, 350, 349, 348, 347, 346, 345, 344, + 343, 336, 335, 332, 321, 317, 316, 315, 314, 311, + 306, 303, 302, 301, 300, 299, 298, 293, 292, 291, + 290, 289, 288, 285, 284, 283, 282, 281, 280, 279, + 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, + 268, 267, 266, 262, 261, 260, 259, 258, 256, 252, + 250, 249, 248, 244, 243, 242, 241, 240, 239, 238, + 235, 233, 224, 223, 222, 221, 220, 219, 218, 216, + 215, 214, 212, 211, 210, 209, 208, 207, 206, 205, + + 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, + 194, 193, 191, 190, 189, 188, 187, 186, 185, 184, + 183, 182, 181, 180, 179, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 167, 165, 164, 163, 162, + 161, 160, 159, 143, 142, 141, 140, 133, 131, 130, + 129, 127, 126, 125, 124, 123, 121, 120, 119, 118, + 117, 116, 115, 114, 113, 111, 110, 109, 107, 104, + 103, 102, 101, 100, 99, 97, 96, 95, 94, 93, + 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, + 82, 81, 80, 77, 73, 51, 47, 43, 38, 36, + + 33, 30, 23, 20, 16, 12, 10, 9, 5, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, + 518, 518, 518, 518, 518, 518, 518, 518, 518 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "glsl_lexer.lpp" +#line 2 "glsl_lexer.lpp" +/* + * Copyright © 2008, 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. + */ +#include +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno + 1; \ + yycolumn += yyleng; \ + } while(0); + +#define YY_USER_INIT yylineno = 0; yycolumn = 0; + + +#line 845 "glsl_lexer.cpp" + +#define INITIAL 0 +#define PP 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#define YY_EXTRA_TYPE struct _mesa_glsl_parse_state * + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int _mesa_glsl_lex_init (yyscan_t* scanner); + +int _mesa_glsl_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int _mesa_glsl_lex_destroy (yyscan_t yyscanner ); + +int _mesa_glsl_get_debug (yyscan_t yyscanner ); + +void _mesa_glsl_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner ); + +void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *_mesa_glsl_get_in (yyscan_t yyscanner ); + +void _mesa_glsl_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *_mesa_glsl_get_out (yyscan_t yyscanner ); + +void _mesa_glsl_set_out (FILE * out_str ,yyscan_t yyscanner ); + +int _mesa_glsl_get_leng (yyscan_t yyscanner ); + +char *_mesa_glsl_get_text (yyscan_t yyscanner ); + +int _mesa_glsl_get_lineno (yyscan_t yyscanner ); + +void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner ); + +void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner ); + + void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int _mesa_glsl_wrap (yyscan_t yyscanner ); +#else +extern int _mesa_glsl_wrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int _mesa_glsl_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int _mesa_glsl_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 56 "glsl_lexer.lpp" + + +#line 1094 "glsl_lexer.cpp" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + _mesa_glsl_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + _mesa_glsl__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 519 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 518 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 58 "glsl_lexer.lpp" +; + YY_BREAK +/* Preprocessor tokens. */ +case 2: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 61 "glsl_lexer.lpp" +; + YY_BREAK +case 3: +YY_RULE_SETUP +#line 62 "glsl_lexer.lpp" +{ BEGIN PP; return VERSION; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 63 "glsl_lexer.lpp" +{ BEGIN PP; return EXTENSION; } + YY_BREAK +case 5: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 64 "glsl_lexer.lpp" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); + } + YY_BREAK +case 6: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 79 "glsl_lexer.lpp" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 93 "glsl_lexer.lpp" +{ BEGIN PP; return PRAGMA; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 94 "glsl_lexer.lpp" +{ } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 95 "glsl_lexer.lpp" +{ } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 96 "glsl_lexer.lpp" +return COLON; + YY_BREAK +case 11: +YY_RULE_SETUP +#line 97 "glsl_lexer.lpp" +{ + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 101 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } + YY_BREAK +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +#line 105 "glsl_lexer.lpp" +{ BEGIN 0; yylineno++; yycolumn = 0; return EOL; } + YY_BREAK +case 14: +/* rule 14 can match eol */ +YY_RULE_SETUP +#line 107 "glsl_lexer.lpp" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 109 "glsl_lexer.lpp" +return ATTRIBUTE; + YY_BREAK +case 16: +YY_RULE_SETUP +#line 110 "glsl_lexer.lpp" +return CONST_TOK; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 111 "glsl_lexer.lpp" +return BOOL; + YY_BREAK +case 18: +YY_RULE_SETUP +#line 112 "glsl_lexer.lpp" +return FLOAT; + YY_BREAK +case 19: +YY_RULE_SETUP +#line 113 "glsl_lexer.lpp" +return INT; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 115 "glsl_lexer.lpp" +return BREAK; + YY_BREAK +case 21: +YY_RULE_SETUP +#line 116 "glsl_lexer.lpp" +return CONTINUE; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 117 "glsl_lexer.lpp" +return DO; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 118 "glsl_lexer.lpp" +return WHILE; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 119 "glsl_lexer.lpp" +return ELSE; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 120 "glsl_lexer.lpp" +return FOR; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 121 "glsl_lexer.lpp" +return IF; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 122 "glsl_lexer.lpp" +return DISCARD; + YY_BREAK +case 28: +YY_RULE_SETUP +#line 123 "glsl_lexer.lpp" +return RETURN; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 125 "glsl_lexer.lpp" +return BVEC2; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 126 "glsl_lexer.lpp" +return BVEC3; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 127 "glsl_lexer.lpp" +return BVEC4; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 128 "glsl_lexer.lpp" +return IVEC2; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 129 "glsl_lexer.lpp" +return IVEC3; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 130 "glsl_lexer.lpp" +return IVEC4; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 131 "glsl_lexer.lpp" +return VEC2; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 132 "glsl_lexer.lpp" +return VEC3; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 133 "glsl_lexer.lpp" +return VEC4; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 134 "glsl_lexer.lpp" +return MAT2; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 135 "glsl_lexer.lpp" +return MAT3; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 136 "glsl_lexer.lpp" +return MAT4; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 137 "glsl_lexer.lpp" +return MAT2X2; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 138 "glsl_lexer.lpp" +return MAT2X3; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 139 "glsl_lexer.lpp" +return MAT2X4; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 140 "glsl_lexer.lpp" +return MAT3X2; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 141 "glsl_lexer.lpp" +return MAT3X3; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 142 "glsl_lexer.lpp" +return MAT3X4; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 143 "glsl_lexer.lpp" +return MAT4X2; + YY_BREAK +case 48: +YY_RULE_SETUP +#line 144 "glsl_lexer.lpp" +return MAT4X3; + YY_BREAK +case 49: +YY_RULE_SETUP +#line 145 "glsl_lexer.lpp" +return MAT4X4; + YY_BREAK +case 50: +YY_RULE_SETUP +#line 147 "glsl_lexer.lpp" +return IN; + YY_BREAK +case 51: +YY_RULE_SETUP +#line 148 "glsl_lexer.lpp" +return OUT; + YY_BREAK +case 52: +YY_RULE_SETUP +#line 149 "glsl_lexer.lpp" +return INOUT; + YY_BREAK +case 53: +YY_RULE_SETUP +#line 150 "glsl_lexer.lpp" +return UNIFORM; + YY_BREAK +case 54: +YY_RULE_SETUP +#line 151 "glsl_lexer.lpp" +return VARYING; + YY_BREAK +case 55: +YY_RULE_SETUP +#line 152 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 120) { + return CENTROID; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 160 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 120) { + return INVARIANT; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 169 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 130) { + return FLAT; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 177 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 130) { + return SMOOTH; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 185 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 130) { + return NOPERSPECTIVE; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 194 "glsl_lexer.lpp" +return SAMPLER1D; + YY_BREAK +case 61: +YY_RULE_SETUP +#line 195 "glsl_lexer.lpp" +return SAMPLER2D; + YY_BREAK +case 62: +YY_RULE_SETUP +#line 196 "glsl_lexer.lpp" +return SAMPLER3D; + YY_BREAK +case 63: +YY_RULE_SETUP +#line 197 "glsl_lexer.lpp" +return SAMPLERCUBE; + YY_BREAK +case 64: +YY_RULE_SETUP +#line 198 "glsl_lexer.lpp" +return SAMPLER1DSHADOW; + YY_BREAK +case 65: +YY_RULE_SETUP +#line 199 "glsl_lexer.lpp" +return SAMPLER2DSHADOW; + YY_BREAK +case 66: +YY_RULE_SETUP +#line 201 "glsl_lexer.lpp" +return STRUCT; + YY_BREAK +case 67: +YY_RULE_SETUP +#line 202 "glsl_lexer.lpp" +return VOID; + YY_BREAK +case 68: +YY_RULE_SETUP +#line 204 "glsl_lexer.lpp" +return INC_OP; + YY_BREAK +case 69: +YY_RULE_SETUP +#line 205 "glsl_lexer.lpp" +return DEC_OP; + YY_BREAK +case 70: +YY_RULE_SETUP +#line 206 "glsl_lexer.lpp" +return LE_OP; + YY_BREAK +case 71: +YY_RULE_SETUP +#line 207 "glsl_lexer.lpp" +return GE_OP; + YY_BREAK +case 72: +YY_RULE_SETUP +#line 208 "glsl_lexer.lpp" +return EQ_OP; + YY_BREAK +case 73: +YY_RULE_SETUP +#line 209 "glsl_lexer.lpp" +return NE_OP; + YY_BREAK +case 74: +YY_RULE_SETUP +#line 210 "glsl_lexer.lpp" +return AND_OP; + YY_BREAK +case 75: +YY_RULE_SETUP +#line 211 "glsl_lexer.lpp" +return OR_OP; + YY_BREAK +case 76: +YY_RULE_SETUP +#line 212 "glsl_lexer.lpp" +return XOR_OP; + YY_BREAK +case 77: +YY_RULE_SETUP +#line 214 "glsl_lexer.lpp" +return MUL_ASSIGN; + YY_BREAK +case 78: +YY_RULE_SETUP +#line 215 "glsl_lexer.lpp" +return DIV_ASSIGN; + YY_BREAK +case 79: +YY_RULE_SETUP +#line 216 "glsl_lexer.lpp" +return ADD_ASSIGN; + YY_BREAK +case 80: +YY_RULE_SETUP +#line 217 "glsl_lexer.lpp" +return MOD_ASSIGN; + YY_BREAK +case 81: +YY_RULE_SETUP +#line 218 "glsl_lexer.lpp" +return LEFT_ASSIGN; + YY_BREAK +case 82: +YY_RULE_SETUP +#line 219 "glsl_lexer.lpp" +return RIGHT_ASSIGN; + YY_BREAK +case 83: +YY_RULE_SETUP +#line 220 "glsl_lexer.lpp" +return AND_ASSIGN; + YY_BREAK +case 84: +YY_RULE_SETUP +#line 221 "glsl_lexer.lpp" +return XOR_ASSIGN; + YY_BREAK +case 85: +YY_RULE_SETUP +#line 222 "glsl_lexer.lpp" +return OR_ASSIGN; + YY_BREAK +case 86: +YY_RULE_SETUP +#line 223 "glsl_lexer.lpp" +return SUB_ASSIGN; + YY_BREAK +case 87: +YY_RULE_SETUP +#line 225 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 229 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext + 2, NULL, 16); + return INTCONSTANT; + } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 233 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 8); + return INTCONSTANT; + } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 238 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 91: +YY_RULE_SETUP +#line 242 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 246 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 250 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 94: +YY_RULE_SETUP +#line 255 "glsl_lexer.lpp" +{ + yylval->n = 1; + return BOOLCONSTANT; + } + YY_BREAK +case 95: +YY_RULE_SETUP +#line 259 "glsl_lexer.lpp" +{ + yylval->n = 0; + return BOOLCONSTANT; + } + YY_BREAK +/* Reserved words in GLSL 1.10. */ +case 96: +YY_RULE_SETUP +#line 266 "glsl_lexer.lpp" +return ASM; + YY_BREAK +case 97: +YY_RULE_SETUP +#line 267 "glsl_lexer.lpp" +return CLASS; + YY_BREAK +case 98: +YY_RULE_SETUP +#line 268 "glsl_lexer.lpp" +return UNION; + YY_BREAK +case 99: +YY_RULE_SETUP +#line 269 "glsl_lexer.lpp" +return ENUM; + YY_BREAK +case 100: +YY_RULE_SETUP +#line 270 "glsl_lexer.lpp" +return TYPEDEF; + YY_BREAK +case 101: +YY_RULE_SETUP +#line 271 "glsl_lexer.lpp" +return TEMPLATE; + YY_BREAK +case 102: +YY_RULE_SETUP +#line 272 "glsl_lexer.lpp" +return THIS; + YY_BREAK +case 103: +YY_RULE_SETUP +#line 273 "glsl_lexer.lpp" +return PACKED; + YY_BREAK +case 104: +YY_RULE_SETUP +#line 274 "glsl_lexer.lpp" +return GOTO; + YY_BREAK +case 105: +YY_RULE_SETUP +#line 275 "glsl_lexer.lpp" +return SWITCH; + YY_BREAK +case 106: +YY_RULE_SETUP +#line 276 "glsl_lexer.lpp" +return DEFAULT; + YY_BREAK +case 107: +YY_RULE_SETUP +#line 277 "glsl_lexer.lpp" +return INLINE_TOK; + YY_BREAK +case 108: +YY_RULE_SETUP +#line 278 "glsl_lexer.lpp" +return NOINLINE; + YY_BREAK +case 109: +YY_RULE_SETUP +#line 279 "glsl_lexer.lpp" +return VOLATILE; + YY_BREAK +case 110: +YY_RULE_SETUP +#line 280 "glsl_lexer.lpp" +return PUBLIC_TOK; + YY_BREAK +case 111: +YY_RULE_SETUP +#line 281 "glsl_lexer.lpp" +return STATIC; + YY_BREAK +case 112: +YY_RULE_SETUP +#line 282 "glsl_lexer.lpp" +return EXTERN; + YY_BREAK +case 113: +YY_RULE_SETUP +#line 283 "glsl_lexer.lpp" +return EXTERNAL; + YY_BREAK +case 114: +YY_RULE_SETUP +#line 284 "glsl_lexer.lpp" +return INTERFACE; + YY_BREAK +case 115: +YY_RULE_SETUP +#line 285 "glsl_lexer.lpp" +return LONG; + YY_BREAK +case 116: +YY_RULE_SETUP +#line 286 "glsl_lexer.lpp" +return SHORT; + YY_BREAK +case 117: +YY_RULE_SETUP +#line 287 "glsl_lexer.lpp" +return DOUBLE; + YY_BREAK +case 118: +YY_RULE_SETUP +#line 288 "glsl_lexer.lpp" +return HALF; + YY_BREAK +case 119: +YY_RULE_SETUP +#line 289 "glsl_lexer.lpp" +return FIXED; + YY_BREAK +case 120: +YY_RULE_SETUP +#line 290 "glsl_lexer.lpp" +return UNSIGNED; + YY_BREAK +case 121: +YY_RULE_SETUP +#line 291 "glsl_lexer.lpp" +return INPUT; + YY_BREAK +case 122: +YY_RULE_SETUP +#line 292 "glsl_lexer.lpp" +return OUTPUT; + YY_BREAK +case 123: +YY_RULE_SETUP +#line 293 "glsl_lexer.lpp" +return HVEC2; + YY_BREAK +case 124: +YY_RULE_SETUP +#line 294 "glsl_lexer.lpp" +return HVEC3; + YY_BREAK +case 125: +YY_RULE_SETUP +#line 295 "glsl_lexer.lpp" +return HVEC4; + YY_BREAK +case 126: +YY_RULE_SETUP +#line 296 "glsl_lexer.lpp" +return DVEC2; + YY_BREAK +case 127: +YY_RULE_SETUP +#line 297 "glsl_lexer.lpp" +return DVEC3; + YY_BREAK +case 128: +YY_RULE_SETUP +#line 298 "glsl_lexer.lpp" +return DVEC4; + YY_BREAK +case 129: +YY_RULE_SETUP +#line 299 "glsl_lexer.lpp" +return FVEC2; + YY_BREAK +case 130: +YY_RULE_SETUP +#line 300 "glsl_lexer.lpp" +return FVEC3; + YY_BREAK +case 131: +YY_RULE_SETUP +#line 301 "glsl_lexer.lpp" +return FVEC4; + YY_BREAK +case 132: +YY_RULE_SETUP +#line 302 "glsl_lexer.lpp" +return SAMPLER2DRECT; + YY_BREAK +case 133: +YY_RULE_SETUP +#line 303 "glsl_lexer.lpp" +return SAMPLER3DRECT; + YY_BREAK +case 134: +YY_RULE_SETUP +#line 304 "glsl_lexer.lpp" +return SAMPLER2DRECTSHADOW; + YY_BREAK +case 135: +YY_RULE_SETUP +#line 305 "glsl_lexer.lpp" +return SIZEOF; + YY_BREAK +case 136: +YY_RULE_SETUP +#line 306 "glsl_lexer.lpp" +return CAST; + YY_BREAK +case 137: +YY_RULE_SETUP +#line 307 "glsl_lexer.lpp" +return NAMESPACE; + YY_BREAK +case 138: +YY_RULE_SETUP +#line 308 "glsl_lexer.lpp" +return USING; + YY_BREAK +/* Additional reserved words in GLSL 1.20. */ +case 139: +YY_RULE_SETUP +#line 311 "glsl_lexer.lpp" +return LOWP; + YY_BREAK +case 140: +YY_RULE_SETUP +#line 312 "glsl_lexer.lpp" +return MEDIUMP; + YY_BREAK +case 141: +YY_RULE_SETUP +#line 313 "glsl_lexer.lpp" +return HIGHP; + YY_BREAK +case 142: +YY_RULE_SETUP +#line 314 "glsl_lexer.lpp" +return PRECISION; + YY_BREAK +case 143: +YY_RULE_SETUP +#line 316 "glsl_lexer.lpp" +{ + struct _mesa_glsl_parse_state *state = yyextra; + void *ctx = state; + yylval->identifier = talloc_strdup(ctx, yytext); + return IDENTIFIER; + } + YY_BREAK +case 144: +YY_RULE_SETUP +#line 323 "glsl_lexer.lpp" +{ return yytext[0]; } + YY_BREAK +case 145: +YY_RULE_SETUP +#line 325 "glsl_lexer.lpp" +ECHO; + YY_BREAK +#line 2017 "glsl_lexer.cpp" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(PP): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * _mesa_glsl_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( _mesa_glsl_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of _mesa_glsl_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + _mesa_glsl_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + _mesa_glsl_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) _mesa_glsl_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 519 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 519 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 518); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + _mesa_glsl_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( _mesa_glsl_wrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void _mesa_glsl_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + _mesa_glsl_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + _mesa_glsl__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + _mesa_glsl__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * _mesa_glsl_pop_buffer_state(); + * _mesa_glsl_push_buffer_state(new_buffer); + */ + _mesa_glsl_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + _mesa_glsl__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (_mesa_glsl_wrap()) processing, but the only time this flag + * is looked at is after _mesa_glsl_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE _mesa_glsl__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) _mesa_glsl_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + _mesa_glsl__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with _mesa_glsl__create_buffer() + * @param yyscanner The scanner object. + */ + void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + _mesa_glsl_free((void *) b->yy_ch_buf ,yyscanner ); + + _mesa_glsl_free((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a _mesa_glsl_restart() or at EOF. + */ + static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + _mesa_glsl__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then _mesa_glsl__init_buffer was _probably_ + * called from _mesa_glsl_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + _mesa_glsl__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + _mesa_glsl_ensure_buffer_stack(yyscanner); + + /* This block is copied from _mesa_glsl__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from _mesa_glsl__switch_to_buffer. */ + _mesa_glsl__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + _mesa_glsl__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)_mesa_glsl_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)_mesa_glsl_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE _mesa_glsl__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + _mesa_glsl__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to _mesa_glsl_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * _mesa_glsl__scan_bytes() instead. + */ +YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return _mesa_glsl__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE _mesa_glsl__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) _mesa_glsl_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = _mesa_glsl__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in _mesa_glsl__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *_mesa_glsl_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *_mesa_glsl_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *_mesa_glsl_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "_mesa_glsl_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "_mesa_glsl_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see _mesa_glsl__switch_to_buffer + */ +void _mesa_glsl_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void _mesa_glsl_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int _mesa_glsl_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void _mesa_glsl_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void _mesa_glsl_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* _mesa_glsl_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int _mesa_glsl_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* _mesa_glsl_lex_init_extra has the same functionality as _mesa_glsl_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to _mesa_glsl_alloc in + * the yyextra field. + */ + +int _mesa_glsl_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + _mesa_glsl_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + _mesa_glsl_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from _mesa_glsl_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * _mesa_glsl_lex_init() + */ + return 0; +} + +/* _mesa_glsl_lex_destroy is for both reentrant and non-reentrant scanners. */ +int _mesa_glsl_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + _mesa_glsl_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + _mesa_glsl_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + _mesa_glsl_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * _mesa_glsl_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + _mesa_glsl_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *_mesa_glsl_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *_mesa_glsl_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see _mesa_glsl_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 325 "glsl_lexer.lpp" + + + +void +_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) +{ + _mesa_glsl_lex_init_extra(state,& state->scanner); + _mesa_glsl__scan_string(string,state->scanner); +} + +void +_mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state) +{ + _mesa_glsl_lex_destroy(state->scanner); +} + diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp new file mode 100644 index 0000000000..b2113c083c --- /dev/null +++ b/src/glsl/glsl_parser.cpp @@ -0,0 +1,5054 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + +/* Substitute the variable and function names. */ +#define yyparse _mesa_glsl_parse +#define yylex _mesa_glsl_lex +#define yyerror _mesa_glsl_error +#define yylval _mesa_glsl_lval +#define yychar _mesa_glsl_char +#define yydebug _mesa_glsl_debug +#define yynerrs _mesa_glsl_nerrs +#define yylloc _mesa_glsl_lloc + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "glsl_parser.ypp" + +/* + * Copyright © 2008, 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. + */ +#include +#include +#include +#include + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" + +#define YYLEX_PARAM state->scanner + + + +/* Line 189 of yacc.c */ +#line 118 "glsl_parser.cpp" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ATTRIBUTE = 258, + CONST_TOK = 259, + BOOL = 260, + FLOAT = 261, + INT = 262, + UINT = 263, + BREAK = 264, + CONTINUE = 265, + DO = 266, + ELSE = 267, + FOR = 268, + IF = 269, + DISCARD = 270, + RETURN = 271, + SWITCH = 272, + CASE = 273, + DEFAULT = 274, + BVEC2 = 275, + BVEC3 = 276, + BVEC4 = 277, + IVEC2 = 278, + IVEC3 = 279, + IVEC4 = 280, + UVEC2 = 281, + UVEC3 = 282, + UVEC4 = 283, + VEC2 = 284, + VEC3 = 285, + VEC4 = 286, + MAT2 = 287, + MAT3 = 288, + MAT4 = 289, + CENTROID = 290, + IN = 291, + OUT = 292, + INOUT = 293, + UNIFORM = 294, + VARYING = 295, + NOPERSPECTIVE = 296, + FLAT = 297, + SMOOTH = 298, + MAT2X2 = 299, + MAT2X3 = 300, + MAT2X4 = 301, + MAT3X2 = 302, + MAT3X3 = 303, + MAT3X4 = 304, + MAT4X2 = 305, + MAT4X3 = 306, + MAT4X4 = 307, + SAMPLER1D = 308, + SAMPLER2D = 309, + SAMPLER3D = 310, + SAMPLERCUBE = 311, + SAMPLER1DSHADOW = 312, + SAMPLER2DSHADOW = 313, + SAMPLERCUBESHADOW = 314, + SAMPLER1DARRAY = 315, + SAMPLER2DARRAY = 316, + SAMPLER1DARRAYSHADOW = 317, + SAMPLER2DARRAYSHADOW = 318, + ISAMPLER1D = 319, + ISAMPLER2D = 320, + ISAMPLER3D = 321, + ISAMPLERCUBE = 322, + ISAMPLER1DARRAY = 323, + ISAMPLER2DARRAY = 324, + USAMPLER1D = 325, + USAMPLER2D = 326, + USAMPLER3D = 327, + USAMPLERCUBE = 328, + USAMPLER1DARRAY = 329, + USAMPLER2DARRAY = 330, + STRUCT = 331, + VOID = 332, + WHILE = 333, + IDENTIFIER = 334, + FLOATCONSTANT = 335, + INTCONSTANT = 336, + UINTCONSTANT = 337, + BOOLCONSTANT = 338, + FIELD_SELECTION = 339, + LEFT_OP = 340, + RIGHT_OP = 341, + INC_OP = 342, + DEC_OP = 343, + LE_OP = 344, + GE_OP = 345, + EQ_OP = 346, + NE_OP = 347, + AND_OP = 348, + OR_OP = 349, + XOR_OP = 350, + MUL_ASSIGN = 351, + DIV_ASSIGN = 352, + ADD_ASSIGN = 353, + MOD_ASSIGN = 354, + LEFT_ASSIGN = 355, + RIGHT_ASSIGN = 356, + AND_ASSIGN = 357, + XOR_ASSIGN = 358, + OR_ASSIGN = 359, + SUB_ASSIGN = 360, + INVARIANT = 361, + LOWP = 362, + MEDIUMP = 363, + HIGHP = 364, + PRECISION = 365, + VERSION = 366, + EXTENSION = 367, + LINE = 368, + PRAGMA = 369, + COLON = 370, + EOL = 371, + INTERFACE = 372, + OUTPUT = 373, + ASM = 374, + CLASS = 375, + UNION = 376, + ENUM = 377, + TYPEDEF = 378, + TEMPLATE = 379, + THIS = 380, + PACKED = 381, + GOTO = 382, + INLINE_TOK = 383, + NOINLINE = 384, + VOLATILE = 385, + PUBLIC_TOK = 386, + STATIC = 387, + EXTERN = 388, + EXTERNAL = 389, + LONG = 390, + SHORT = 391, + DOUBLE = 392, + HALF = 393, + FIXED = 394, + UNSIGNED = 395, + INPUT = 396, + OUPTUT = 397, + HVEC2 = 398, + HVEC3 = 399, + HVEC4 = 400, + DVEC2 = 401, + DVEC3 = 402, + DVEC4 = 403, + FVEC2 = 404, + FVEC3 = 405, + FVEC4 = 406, + SAMPLER2DRECT = 407, + SAMPLER3DRECT = 408, + SAMPLER2DRECTSHADOW = 409, + SIZEOF = 410, + CAST = 411, + NAMESPACE = 412, + USING = 413 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 45 "glsl_parser.ypp" + + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + struct ast_node *node; + struct ast_type_specifier *type_specifier; + struct ast_fully_specified_type *fully_specified_type; + struct ast_function *function; + struct ast_parameter_declarator *parameter_declarator; + struct ast_function_definition *function_definition; + struct ast_compound_statement *compound_statement; + struct ast_expression *expression; + struct ast_declarator_list *declarator_list; + struct ast_struct_specifier *struct_specifier; + struct ast_declaration *declaration; + + struct { + struct ast_node *cond; + struct ast_expression *rest; + } for_rest_statement; + + + +/* Line 214 of yacc.c */ +#line 342 "glsl_parser.cpp" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 367 "glsl_parser.cpp" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 5 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 3646 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 183 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 85 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 270 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 403 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 413 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 167, 2, 2, 2, 171, 174, 2, + 159, 160, 169, 165, 164, 166, 163, 170, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 178, 180, + 172, 179, 173, 177, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 161, 2, 162, 175, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 181, 176, 182, 168, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 4, 9, 10, 14, 15, 18, 24, + 26, 29, 31, 33, 35, 37, 39, 41, 45, 47, + 52, 54, 58, 61, 64, 66, 68, 70, 74, 77, + 80, 83, 85, 88, 92, 95, 97, 99, 101, 103, + 106, 109, 112, 114, 116, 118, 120, 122, 126, 130, + 134, 136, 140, 144, 146, 150, 154, 156, 160, 164, + 168, 172, 174, 178, 182, 184, 188, 190, 194, 196, + 200, 202, 206, 208, 212, 214, 218, 220, 226, 228, + 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, + 252, 254, 256, 260, 262, 265, 268, 273, 276, 278, + 280, 283, 287, 291, 294, 300, 304, 307, 311, 314, + 315, 317, 319, 321, 323, 325, 329, 335, 342, 350, + 359, 365, 367, 370, 375, 381, 388, 396, 401, 404, + 406, 409, 411, 413, 415, 417, 419, 422, 425, 427, + 429, 431, 434, 436, 438, 441, 444, 446, 448, 451, + 453, 457, 462, 464, 466, 468, 470, 472, 474, 476, + 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, + 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, + 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, + 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, + 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, + 578, 580, 582, 588, 593, 595, 598, 602, 604, 608, + 610, 615, 617, 619, 621, 623, 625, 627, 629, 631, + 633, 635, 637, 639, 641, 643, 646, 650, 652, 654, + 657, 661, 663, 666, 668, 671, 679, 685, 691, 699, + 701, 706, 712, 716, 719, 725, 733, 740, 742, 744, + 746, 747, 750, 754, 757, 760, 763, 767, 770, 772, + 774 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 184, 0, -1, -1, 186, 187, 185, 189, -1, -1, + 111, 81, 116, -1, -1, 187, 188, -1, 112, 79, + 115, 79, 116, -1, 266, -1, 189, 266, -1, 79, + -1, 190, -1, 81, -1, 82, -1, 80, -1, 83, + -1, 159, 217, 160, -1, 191, -1, 192, 161, 193, + 162, -1, 194, -1, 192, 163, 79, -1, 192, 87, + -1, 192, 88, -1, 217, -1, 195, -1, 196, -1, + 192, 163, 196, -1, 198, 160, -1, 197, 160, -1, + 199, 77, -1, 199, -1, 199, 215, -1, 198, 164, + 215, -1, 200, 159, -1, 235, -1, 79, -1, 84, + -1, 192, -1, 87, 201, -1, 88, 201, -1, 202, + 201, -1, 165, -1, 166, -1, 167, -1, 168, -1, + 201, -1, 203, 169, 201, -1, 203, 170, 201, -1, + 203, 171, 201, -1, 203, -1, 204, 165, 203, -1, + 204, 166, 203, -1, 204, -1, 205, 85, 204, -1, + 205, 86, 204, -1, 205, -1, 206, 172, 205, -1, + 206, 173, 205, -1, 206, 89, 205, -1, 206, 90, + 205, -1, 206, -1, 207, 91, 206, -1, 207, 92, + 206, -1, 207, -1, 208, 174, 207, -1, 208, -1, + 209, 175, 208, -1, 209, -1, 210, 176, 209, -1, + 210, -1, 211, 93, 210, -1, 211, -1, 212, 95, + 211, -1, 212, -1, 213, 94, 212, -1, 213, -1, + 213, 177, 217, 178, 215, -1, 214, -1, 201, 216, + 215, -1, 179, -1, 96, -1, 97, -1, 99, -1, + 98, -1, 105, -1, 100, -1, 101, -1, 102, -1, + 103, -1, 104, -1, 215, -1, 217, 164, 215, -1, + 214, -1, 220, 180, -1, 228, 180, -1, 110, 239, + 236, 180, -1, 221, 160, -1, 223, -1, 222, -1, + 223, 225, -1, 222, 164, 225, -1, 230, 79, 159, + -1, 235, 79, -1, 235, 79, 161, 218, 162, -1, + 232, 226, 224, -1, 226, 224, -1, 232, 226, 227, + -1, 226, 227, -1, -1, 36, -1, 37, -1, 38, + -1, 235, -1, 229, -1, 228, 164, 79, -1, 228, + 164, 79, 161, 162, -1, 228, 164, 79, 161, 218, + 162, -1, 228, 164, 79, 161, 162, 179, 245, -1, + 228, 164, 79, 161, 218, 162, 179, 245, -1, 228, + 164, 79, 179, 245, -1, 230, -1, 230, 79, -1, + 230, 79, 161, 162, -1, 230, 79, 161, 218, 162, + -1, 230, 79, 161, 162, 179, 245, -1, 230, 79, + 161, 218, 162, 179, 245, -1, 230, 79, 179, 245, + -1, 106, 79, -1, 235, -1, 233, 235, -1, 43, + -1, 42, -1, 41, -1, 4, -1, 234, -1, 231, + 233, -1, 106, 233, -1, 4, -1, 3, -1, 40, + -1, 35, 40, -1, 36, -1, 37, -1, 35, 36, + -1, 35, 37, -1, 39, -1, 236, -1, 239, 236, + -1, 237, -1, 237, 161, 162, -1, 237, 161, 218, + 162, -1, 238, -1, 240, -1, 79, -1, 77, -1, + 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, + 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, + 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, + 28, -1, 32, -1, 33, -1, 34, -1, 44, -1, + 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, + 50, -1, 51, -1, 52, -1, 53, -1, 54, -1, + 152, -1, 55, -1, 56, -1, 57, -1, 58, -1, + 154, -1, 59, -1, 60, -1, 61, -1, 62, -1, + 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, + 68, -1, 69, -1, 70, -1, 71, -1, 72, -1, + 73, -1, 74, -1, 75, -1, 109, -1, 108, -1, + 107, -1, 76, 79, 181, 241, 182, -1, 76, 181, + 241, 182, -1, 242, -1, 241, 242, -1, 235, 243, + 180, -1, 244, -1, 243, 164, 244, -1, 79, -1, + 79, 161, 218, 162, -1, 215, -1, 219, -1, 248, + -1, 249, -1, 251, -1, 250, -1, 257, -1, 246, + -1, 255, -1, 256, -1, 259, -1, 260, -1, 261, + -1, 265, -1, 181, 182, -1, 181, 254, 182, -1, + 253, -1, 250, -1, 181, 182, -1, 181, 254, 182, + -1, 247, -1, 254, 247, -1, 180, -1, 217, 180, + -1, 14, 159, 217, 160, 248, 12, 248, -1, 14, + 159, 217, 160, 248, -1, 14, 159, 217, 160, 249, + -1, 14, 159, 217, 160, 248, 12, 249, -1, 217, + -1, 230, 79, 179, 245, -1, 17, 159, 217, 160, + 251, -1, 18, 217, 178, -1, 19, 178, -1, 78, + 159, 258, 160, 252, -1, 11, 247, 78, 159, 217, + 160, 180, -1, 13, 159, 262, 264, 160, 252, -1, + 255, -1, 246, -1, 258, -1, -1, 263, 180, -1, + 263, 180, 217, -1, 10, 180, -1, 9, 180, -1, + 16, 180, -1, 16, 217, 180, -1, 15, 180, -1, + 267, -1, 219, -1, 220, 253, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 190, 190, 189, 198, 201, 218, 220, 224, 233, + 241, 252, 256, 263, 270, 277, 284, 291, 298, 299, + 305, 309, 316, 322, 331, 335, 339, 340, 349, 350, + 354, 355, 359, 365, 377, 381, 387, 394, 405, 406, + 412, 418, 428, 429, 430, 431, 435, 436, 442, 448, + 457, 458, 464, 473, 474, 480, 489, 490, 496, 502, + 508, 517, 518, 524, 533, 534, 543, 544, 553, 554, + 563, 564, 573, 574, 583, 584, 593, 594, 603, 604, + 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, + 623, 627, 631, 647, 651, 655, 659, 673, 677, 678, + 682, 687, 695, 706, 716, 731, 738, 743, 754, 766, + 767, 768, 769, 773, 777, 778, 787, 796, 805, 814, + 823, 836, 847, 856, 865, 874, 883, 892, 901, 915, + 922, 933, 934, 935, 939, 943, 944, 948, 956, 957, + 958, 959, 960, 961, 962, 963, 964, 968, 969, 977, + 978, 984, 993, 999, 1005, 1014, 1015, 1016, 1017, 1018, + 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, + 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, + 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, + 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, + 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1071, + 1082, 1093, 1107, 1113, 1122, 1127, 1135, 1150, 1155, 1163, + 1169, 1178, 1182, 1188, 1189, 1193, 1194, 1198, 1202, 1203, + 1204, 1205, 1206, 1207, 1208, 1212, 1218, 1227, 1228, 1232, + 1238, 1247, 1257, 1269, 1275, 1284, 1293, 1299, 1305, 1314, + 1318, 1332, 1336, 1337, 1341, 1348, 1355, 1365, 1366, 1370, + 1372, 1378, 1383, 1392, 1398, 1404, 1410, 1416, 1425, 1426, + 1430 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ATTRIBUTE", "CONST_TOK", "BOOL", + "FLOAT", "INT", "UINT", "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", + "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", + "BVEC4", "IVEC2", "IVEC3", "IVEC4", "UVEC2", "UVEC3", "UVEC4", "VEC2", + "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", "IN", "OUT", "INOUT", + "UNIFORM", "VARYING", "NOPERSPECTIVE", "FLAT", "SMOOTH", "MAT2X2", + "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", + "MAT4X4", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", + "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", + "SAMPLER1DARRAY", "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", + "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", + "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", + "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", + "USAMPLER2DARRAY", "STRUCT", "VOID", "WHILE", "IDENTIFIER", + "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", + "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", + "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", + "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", + "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", + "LOWP", "MEDIUMP", "HIGHP", "PRECISION", "VERSION", "EXTENSION", "LINE", + "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", "ASM", "CLASS", "UNION", + "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED", "GOTO", "INLINE_TOK", + "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", + "LONG", "SHORT", "DOUBLE", "HALF", "FIXED", "UNSIGNED", "INPUT", + "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", + "FVEC3", "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", + "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", "USING", "'('", + "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", + "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "'='", + "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1", + "version_statement", "extension_statement_list", "extension_statement", + "external_declaration_list", "variable_identifier", "primary_expression", + "postfix_expression", "integer_expression", "function_call", + "function_call_or_method", "function_call_generic", + "function_call_header_no_parameters", + "function_call_header_with_parameters", "function_call_header", + "function_identifier", "unary_expression", "unary_operator", + "multiplicative_expression", "additive_expression", "shift_expression", + "relational_expression", "equality_expression", "and_expression", + "exclusive_or_expression", "inclusive_or_expression", + "logical_and_expression", "logical_xor_expression", + "logical_or_expression", "conditional_expression", + "assignment_expression", "assignment_operator", "expression", + "constant_expression", "declaration", "function_prototype", + "function_declarator", "function_header_with_parameters", + "function_header", "parameter_declarator", "parameter_declaration", + "parameter_qualifier", "parameter_type_specifier", + "init_declarator_list", "single_declaration", "fully_specified_type", + "interpolation_qualifier", "parameter_type_qualifier", "type_qualifier", + "storage_qualifier", "type_specifier", "type_specifier_no_prec", + "type_specifier_nonarray", "basic_type_specifier_nonarray", + "precision_qualifier", "struct_specifier", "struct_declaration_list", + "struct_declaration", "struct_declarator_list", "struct_declarator", + "initializer", "declaration_statement", "statement", "statement_matched", + "statement_unmatched", "simple_statement", "compound_statement", + "statement_no_new_scope", "compound_statement_no_new_scope", + "statement_list", "expression_statement", "selection_statement_matched", + "selection_statement_unmatched", "condition", "switch_statement", + "case_label", "iteration_statement", "for_init_statement", + "conditionopt", "for_rest_statement", "jump_statement", + "external_declaration", "function_definition", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 40, + 41, 91, 93, 46, 44, 43, 45, 33, 126, 42, + 47, 37, 60, 62, 38, 94, 124, 63, 58, 61, + 59, 123, 125 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 183, 185, 184, 186, 186, 187, 187, 188, 189, + 189, 190, 191, 191, 191, 191, 191, 191, 192, 192, + 192, 192, 192, 192, 193, 194, 195, 195, 196, 196, + 197, 197, 198, 198, 199, 200, 200, 200, 201, 201, + 201, 201, 202, 202, 202, 202, 203, 203, 203, 203, + 204, 204, 204, 205, 205, 205, 206, 206, 206, 206, + 206, 207, 207, 207, 208, 208, 209, 209, 210, 210, + 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, + 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, + 216, 217, 217, 218, 219, 219, 219, 220, 221, 221, + 222, 222, 223, 224, 224, 225, 225, 225, 225, 226, + 226, 226, 226, 227, 228, 228, 228, 228, 228, 228, + 228, 229, 229, 229, 229, 229, 229, 229, 229, 230, + 230, 231, 231, 231, 232, 233, 233, 233, 234, 234, + 234, 234, 234, 234, 234, 234, 234, 235, 235, 236, + 236, 236, 237, 237, 237, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, + 238, 238, 238, 238, 238, 238, 238, 238, 238, 239, + 239, 239, 240, 240, 241, 241, 242, 243, 243, 244, + 244, 245, 246, 247, 247, 248, 248, 249, 250, 250, + 250, 250, 250, 250, 250, 251, 251, 252, 252, 253, + 253, 254, 254, 255, 255, 256, 257, 257, 257, 258, + 258, 259, 260, 260, 261, 261, 261, 262, 262, 263, + 263, 264, 264, 265, 265, 265, 265, 265, 266, 266, + 267 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 4, 0, 3, 0, 2, 5, 1, + 2, 1, 1, 1, 1, 1, 1, 3, 1, 4, + 1, 3, 2, 2, 1, 1, 1, 3, 2, 2, + 2, 1, 2, 3, 2, 1, 1, 1, 1, 2, + 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, + 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, + 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 5, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 1, 2, 2, 4, 2, 1, 1, + 2, 3, 3, 2, 5, 3, 2, 3, 2, 0, + 1, 1, 1, 1, 1, 3, 5, 6, 7, 8, + 5, 1, 2, 4, 5, 6, 7, 4, 2, 1, + 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, + 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, + 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 5, 4, 1, 2, 3, 1, 3, 1, + 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, + 3, 1, 2, 1, 2, 7, 5, 5, 7, 1, + 4, 5, 3, 2, 5, 7, 6, 1, 1, 1, + 0, 2, 3, 2, 2, 2, 3, 2, 1, 1, + 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 4, 0, 0, 6, 0, 1, 2, 5, 0, 0, + 7, 0, 139, 138, 159, 156, 157, 158, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 160, 161, 162, + 172, 173, 174, 0, 142, 143, 146, 140, 133, 132, + 131, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 187, 188, 189, 190, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 0, 155, 154, 0, 211, 210, 209, + 0, 186, 191, 3, 269, 0, 0, 99, 109, 0, + 114, 121, 0, 0, 135, 129, 147, 149, 152, 0, + 153, 9, 268, 0, 144, 145, 141, 0, 0, 128, + 0, 137, 0, 10, 94, 0, 270, 97, 109, 134, + 110, 111, 112, 100, 0, 109, 0, 95, 122, 136, + 130, 0, 148, 0, 0, 0, 0, 214, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 11, 15, 13, 14, 16, 37, 0, 0, 0, 42, + 43, 44, 45, 243, 0, 239, 12, 18, 38, 20, + 25, 26, 0, 0, 31, 0, 46, 0, 50, 53, + 56, 61, 64, 66, 68, 70, 72, 74, 76, 78, + 91, 0, 222, 0, 129, 228, 241, 223, 224, 226, + 225, 0, 229, 230, 227, 231, 232, 233, 234, 101, + 106, 108, 113, 0, 115, 102, 0, 0, 150, 46, + 93, 0, 35, 8, 0, 219, 0, 217, 213, 215, + 96, 264, 263, 0, 0, 0, 267, 265, 0, 0, + 0, 253, 0, 39, 40, 0, 235, 0, 22, 23, + 0, 0, 29, 28, 0, 155, 32, 34, 81, 82, + 84, 83, 86, 87, 88, 89, 90, 85, 80, 0, + 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 244, 240, 242, 103, 105, 107, 0, 0, + 123, 0, 221, 127, 151, 212, 0, 0, 216, 0, + 258, 257, 260, 0, 266, 0, 252, 249, 0, 0, + 17, 236, 0, 24, 21, 27, 33, 79, 47, 48, + 49, 51, 52, 54, 55, 59, 60, 57, 58, 62, + 63, 65, 67, 69, 71, 73, 75, 0, 92, 0, + 116, 0, 120, 0, 124, 0, 218, 0, 259, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 117, + 125, 0, 220, 0, 261, 0, 246, 247, 251, 0, + 0, 238, 254, 237, 77, 104, 118, 0, 126, 0, + 262, 256, 0, 250, 0, 119, 255, 245, 248, 0, + 0, 0, 0 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 9, 3, 6, 10, 83, 166, 167, 168, + 322, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 269, 191, 221, 192, 193, 86, 87, + 88, 210, 123, 124, 211, 89, 90, 91, 92, 125, + 93, 94, 222, 96, 97, 98, 99, 100, 136, 137, + 226, 227, 303, 195, 196, 197, 198, 199, 200, 382, + 383, 201, 202, 203, 204, 319, 205, 206, 207, 312, + 359, 360, 208, 101, 102 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -325 +static const yytype_int16 yypact[] = +{ + -52, -1, 67, -325, -31, -325, 37, -325, 23, 3159, + -325, 52, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, 94, -325, -325, -325, -325, -325, -325, + -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, -72, -325, -325, 12, -325, -325, -325, + 36, -325, -325, 3159, -325, -163, 30, 27, -2, -98, + -325, 114, 144, 3381, -325, -325, -325, 33, -325, 3492, + -325, -325, -325, 117, -325, -325, -325, 17, 3381, -325, + 144, -325, 3492, -325, -325, 391, -325, -325, 35, -325, + -325, -325, -325, -325, 3381, 116, 120, -325, -119, -325, + -325, 2393, -325, 86, 3381, 124, 1799, -325, 25, 26, + 29, 1111, 48, 51, 31, 2077, 53, 2843, 39, 54, + -67, -325, -325, -325, -325, -325, 2843, 2843, 2843, -325, + -325, -325, -325, -325, 571, -325, -325, -325, -44, -325, + -325, -325, 60, -99, 2993, 55, -75, 2843, -10, 4, + 71, -79, 80, 47, 49, 46, 130, 131, -63, -325, + -325, -59, -325, 50, 68, -325, -325, -325, -325, -325, + -325, 751, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, 149, 3381, -129, -325, 2543, 2843, -325, -325, + -325, 69, -325, -325, 1938, 73, -56, -325, -325, -325, + -325, -325, -325, 151, 1635, 2843, -325, -325, -51, 2843, + -108, -325, 2243, -325, -325, -38, -325, 931, -325, -325, + 2843, 3270, -325, -325, 2843, 72, -325, -325, -325, -325, + -325, -325, -325, -325, -325, -325, -325, -325, -325, 2843, + -325, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, + 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, + 2843, 2843, -325, -325, -325, 75, -325, -325, 2693, 2843, + 58, 77, -325, -325, -325, -325, 2843, 124, -325, 81, + -325, -325, 2243, -27, -325, -25, -325, 78, 162, 83, + -325, -325, 82, 78, 87, -325, -325, -325, -325, -325, + -325, -10, -10, 4, 4, 71, 71, 71, 71, -79, + -79, 80, 47, 49, 46, 130, 131, -102, -325, 2843, + 66, 85, -325, 2843, 70, 89, -325, 2843, -325, 74, + 88, 1111, 95, 96, 1290, -325, 2843, 90, 2843, 98, + -325, 2843, -325, -24, 2843, 1290, 241, -325, -325, 2843, + 119, -325, -325, -325, -325, -325, -325, 2843, -325, 99, + 78, -325, 1111, -325, 2843, -325, -325, -325, -325, -14, + 1469, 268, 1469 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, + -325, -325, -325, 34, -325, -325, -325, -325, -15, -325, + -100, -88, -115, -105, -3, 1, -4, 0, 2, -5, + -325, -130, -171, -325, -139, -211, 5, 24, -325, -325, + -325, 76, 170, 167, 84, -325, -325, -222, -325, -325, + -35, -325, -9, -54, -325, -325, 213, -325, 160, -123, + -325, -12, -290, 62, -137, -323, -324, -252, -64, -76, + 215, 137, 79, -325, -325, -8, -325, -325, -325, -325, + -325, -325, -325, 219, -325 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -155 +static const yytype_int16 yytable[] = +{ + 95, 220, 119, 256, 233, 301, 238, 107, 240, 352, + 278, 279, -154, 229, 84, 12, 13, 114, 115, 245, + 318, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 289, 298, 85, 120, 121, 122, 377, 376, 119, + 215, 111, 216, 248, 249, 132, 302, 33, 34, 35, + 299, 36, 37, 38, 39, 40, 291, 129, 138, 1, + 217, 253, 291, 370, 294, 254, 126, 5, 398, 397, + 316, 120, 121, 122, 95, 111, 366, 401, 386, 397, + 4, 388, 127, 326, 130, 7, 220, 351, 84, 393, + 318, 109, -36, 280, 281, 355, 313, 395, 327, 135, + 315, 229, 11, 317, 268, 291, 194, 85, 307, 108, + 294, 323, 381, 291, 290, 212, 219, 250, 110, 251, + 348, 292, 320, 381, 308, 135, 291, 135, 302, 314, + 104, 105, 194, 361, 106, 362, 389, 291, 367, 291, + 291, 243, 244, 77, 78, 79, 400, 12, 13, 8, + 291, 347, 120, 121, 122, 194, 276, 277, -98, 271, + 272, 273, 270, 335, 336, 337, 338, 103, 220, 274, + 275, 282, 283, 317, 331, 332, 220, 339, 340, 33, + 34, 35, 302, 36, 37, 38, 39, 40, 333, 334, + 117, 118, 194, 128, 131, 384, 133, 302, 134, 214, + 302, 219, 223, 225, 212, 230, 231, 234, 302, 232, + 235, 236, 239, 242, 257, 135, 302, 241, 373, 220, + 252, 284, 286, 287, 285, 194, 288, -35, 295, 309, + 114, 304, -30, 194, 306, 390, 349, 353, 194, 354, + 357, 363, 291, 364, 365, 368, -36, 369, 375, 371, + 110, 372, 385, 392, 374, 399, 328, 329, 330, 219, + 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, + 219, 219, 219, 219, 219, 379, 164, 387, 394, 396, + 402, 341, 343, 219, 346, 325, 342, 344, 209, 296, + 345, 219, 213, 112, 224, 356, 310, 297, 378, 391, + 116, 247, 113, 194, 358, 0, 0, 0, 0, 0, + 0, 0, 0, 311, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 219, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 194, 0, 0, 194, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 194, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 194, 0, 0, 0, 0, 0, 0, + 0, 194, 0, 194, 12, 13, 14, 15, 16, 17, + 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, + 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, + 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 164, 165, 12, 13, 14, 15, 16, 17, + 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, + 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, + 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 164, 246, 12, 13, 14, 15, 16, 17, + 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, + 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, + 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 164, 293, 12, 13, 14, 15, 16, 17, + 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, + 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, + 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 164, 321, 12, 13, 14, 15, 16, 17, + 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, + 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, + 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, + 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 164, 12, 13, 14, 15, 16, 17, 139, + 140, 141, 0, 142, 380, 144, 145, 146, 147, 148, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 0, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 149, 150, + 151, 152, 153, 154, 155, 0, 0, 156, 157, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 76, 77, 78, 79, + 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 81, 0, 82, 0, 0, 0, 0, 158, + 0, 0, 0, 0, 0, 159, 160, 161, 162, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 163, 115, 12, 13, 14, 15, 16, 17, 139, 140, + 141, 0, 142, 380, 144, 145, 146, 147, 148, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 149, 150, 151, + 152, 153, 154, 155, 0, 0, 156, 157, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 158, 0, + 0, 0, 0, 0, 159, 160, 161, 162, 12, 13, + 14, 15, 16, 17, 0, 0, 0, 0, 0, 163, + 164, 0, 0, 0, 0, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 0, 150, 151, 152, 153, 154, 155, + 0, 0, 156, 157, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 76, 77, 78, 79, 80, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 81, 0, 82, + 0, 0, 0, 0, 158, 0, 0, 0, 0, 0, + 159, 160, 161, 162, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 0, 163, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 77, 78, 79, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 228, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 78, 79, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 81, 0, 82, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 305, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 0, 150, 151, 152, 153, + 154, 155, 0, 0, 156, 157, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, + 0, 82, 0, 0, 0, 0, 158, 0, 0, 0, + 0, 0, 159, 160, 161, 162, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 237, 0, 0, + 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, + 16, 17, 158, 0, 0, 0, 0, 0, 159, 160, + 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, + 16, 17, 158, 0, 0, 218, 0, 0, 159, 160, + 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, + 16, 17, 158, 0, 0, 300, 0, 0, 159, 160, + 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, + 16, 17, 158, 0, 0, 350, 0, 0, 159, 160, + 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, + 16, 17, 158, 0, 0, 0, 0, 0, 159, 160, + 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 255, 0, 150, 151, 152, 153, 154, 155, 0, 0, + 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 0, 0, + 0, 0, 158, 0, 0, 0, 0, 0, 159, 160, + 161, 162, 12, 13, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 81, 0, 82, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 0, 324, + 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, + 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, + 0, 0, 81, 0, 82, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 0, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 77, 78, + 79, 0, 0, 0, 0, 0, 0, 14, 15, 16, + 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 81, 0, 82 +}; + +static const yytype_int16 yycheck[] = +{ + 9, 131, 4, 174, 141, 216, 145, 79, 147, 299, + 89, 90, 79, 136, 9, 3, 4, 180, 181, 158, + 242, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 94, 161, 9, 36, 37, 38, 361, 361, 4, + 159, 76, 161, 87, 88, 99, 217, 35, 36, 37, + 179, 39, 40, 41, 42, 43, 164, 92, 112, 111, + 179, 160, 164, 353, 201, 164, 164, 0, 392, 392, + 178, 36, 37, 38, 83, 110, 178, 400, 368, 402, + 81, 371, 180, 254, 93, 116, 216, 298, 83, 379, + 312, 79, 159, 172, 173, 306, 235, 387, 269, 108, + 239, 224, 79, 242, 179, 164, 115, 83, 164, 181, + 247, 250, 364, 164, 177, 124, 131, 161, 106, 163, + 291, 180, 160, 375, 180, 134, 164, 136, 299, 180, + 36, 37, 141, 160, 40, 160, 160, 164, 349, 164, + 164, 156, 157, 107, 108, 109, 160, 3, 4, 112, + 164, 290, 36, 37, 38, 164, 85, 86, 160, 169, + 170, 171, 177, 278, 279, 280, 281, 115, 298, 165, + 166, 91, 92, 312, 274, 275, 306, 282, 283, 35, + 36, 37, 353, 39, 40, 41, 42, 43, 276, 277, + 160, 164, 201, 79, 161, 366, 79, 368, 181, 79, + 371, 216, 116, 79, 213, 180, 180, 159, 379, 180, + 159, 180, 159, 159, 159, 224, 387, 178, 357, 349, + 160, 174, 176, 93, 175, 234, 95, 159, 79, 78, + 180, 162, 160, 242, 161, 374, 161, 179, 247, 162, + 159, 79, 164, 160, 162, 179, 159, 162, 160, 179, + 106, 162, 162, 12, 180, 394, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 179, 181, 179, 159, 180, + 12, 284, 286, 298, 289, 251, 285, 287, 118, 213, + 288, 306, 125, 80, 134, 307, 234, 213, 362, 375, + 85, 164, 83, 312, 312, -1, -1, -1, -1, -1, + -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 349, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 361, -1, -1, 364, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 375, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 392, -1, -1, -1, -1, -1, -1, + -1, 400, -1, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, + 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 180, 181, 3, 4, 5, 6, 7, 8, 9, + 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, -1, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, + 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 152, -1, 154, -1, -1, -1, -1, 159, + -1, -1, -1, -1, -1, 165, 166, 167, 168, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 180, 181, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, -1, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 152, -1, 154, -1, -1, -1, -1, 159, -1, + -1, -1, -1, -1, 165, 166, 167, 168, 3, 4, + 5, 6, 7, 8, -1, -1, -1, -1, -1, 180, + 181, -1, -1, -1, -1, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, -1, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, + -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 152, -1, 154, + -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, + 165, 166, 167, 168, 5, 6, 7, 8, -1, -1, + -1, -1, -1, -1, -1, 180, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, + -1, 152, -1, 154, -1, -1, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, + -1, 182, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + 152, -1, 154, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + 182, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, + -1, 154, -1, -1, -1, -1, 159, -1, -1, -1, + -1, -1, 165, 166, 167, 168, 3, 4, 5, 6, + 7, 8, -1, -1, -1, -1, -1, 180, -1, -1, + -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, -1, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, + 7, 8, 159, -1, -1, -1, -1, -1, 165, 166, + 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, + 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, + 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, + 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, + 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, + 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, + 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, + 7, 8, 159, -1, -1, -1, -1, -1, 165, 166, + 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 152, -1, 154, -1, -1, + -1, -1, 159, -1, -1, -1, -1, -1, 165, 166, + 167, 168, 3, 4, 5, 6, 7, 8, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, -1, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + -1, 152, -1, 154, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, + -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, + -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, + -1, -1, 152, -1, 154, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, + 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, + 109, -1, -1, -1, -1, -1, -1, 5, 6, 7, + 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, + -1, -1, -1, 152, -1, 154, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 152, -1, 154 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 111, 184, 186, 81, 0, 187, 116, 112, 185, + 188, 79, 3, 4, 5, 6, 7, 8, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 79, 106, 107, 108, 109, + 110, 152, 154, 189, 219, 220, 221, 222, 223, 228, + 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, + 240, 266, 267, 115, 36, 37, 40, 79, 181, 79, + 106, 233, 239, 266, 180, 181, 253, 160, 164, 4, + 36, 37, 38, 225, 226, 232, 164, 180, 79, 233, + 235, 161, 236, 79, 181, 235, 241, 242, 236, 9, + 10, 11, 13, 14, 15, 16, 17, 18, 19, 78, + 79, 80, 81, 82, 83, 84, 87, 88, 159, 165, + 166, 167, 168, 180, 181, 182, 190, 191, 192, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 217, 219, 220, 235, 246, 247, 248, 249, 250, + 251, 254, 255, 256, 257, 259, 260, 261, 265, 225, + 224, 227, 235, 226, 79, 159, 161, 179, 162, 201, + 214, 218, 235, 116, 241, 79, 243, 244, 182, 242, + 180, 180, 180, 247, 159, 159, 180, 180, 217, 159, + 217, 178, 159, 201, 201, 217, 182, 254, 87, 88, + 161, 163, 160, 160, 164, 77, 215, 159, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 179, 216, + 201, 169, 170, 171, 165, 166, 85, 86, 89, 90, + 172, 173, 91, 92, 174, 175, 176, 93, 95, 94, + 177, 164, 180, 182, 247, 79, 224, 227, 161, 179, + 162, 218, 215, 245, 162, 182, 161, 164, 180, 78, + 246, 255, 262, 217, 180, 217, 178, 217, 230, 258, + 160, 182, 193, 217, 79, 196, 215, 215, 201, 201, + 201, 203, 203, 204, 204, 205, 205, 205, 205, 206, + 206, 207, 208, 209, 210, 211, 212, 217, 215, 161, + 162, 218, 245, 179, 162, 218, 244, 159, 258, 263, + 264, 160, 160, 79, 160, 162, 178, 218, 179, 162, + 245, 179, 162, 217, 180, 160, 248, 249, 251, 179, + 14, 250, 252, 253, 215, 162, 245, 179, 245, 160, + 217, 252, 12, 245, 159, 245, 180, 248, 249, 217, + 160, 248, 12 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, scanner) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, state); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (state); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct _mesa_glsl_parse_state *state) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, state) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + struct _mesa_glsl_parse_state *state; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , state); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, state); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, state) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (state); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (struct _mesa_glsl_parse_state *state); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (struct _mesa_glsl_parse_state *state) +#else +int +yyparse (state) + struct _mesa_glsl_parse_state *state; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 1455 of yacc.c */ +#line 190 "glsl_parser.ypp" + { + _mesa_glsl_initialize_types(state); + ;} + break; + + case 4: + +/* Line 1455 of yacc.c */ +#line 198 "glsl_parser.ypp" + { + state->language_version = 110; + ;} + break; + + case 5: + +/* Line 1455 of yacc.c */ +#line 202 "glsl_parser.ypp" + { + switch ((yyvsp[(2) - (3)].n)) { + case 110: + case 120: + case 130: + /* FINISHME: Check against implementation support versions. */ + state->language_version = (yyvsp[(2) - (3)].n); + break; + default: + _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version" + "%u is not supported\n", (yyvsp[(2) - (3)].n)); + break; + } + ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 225 "glsl_parser.ypp" + { + if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { + YYERROR; + } + ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 234 "glsl_parser.ypp" + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ((yyvsp[(1) - (1)].node) != NULL) + state->translation_unit.push_tail(& (yyvsp[(1) - (1)].node)->link); + ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 242 "glsl_parser.ypp" + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ((yyvsp[(2) - (2)].node) != NULL) + state->translation_unit.push_tail(& (yyvsp[(2) - (2)].node)->link); + ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 257 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.identifier = (yyvsp[(1) - (1)].identifier); + ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 264 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.int_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 271 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.uint_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 278 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.float_constant = (yyvsp[(1) - (1)].real); + ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 285 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.bool_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 292 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(2) - (3)].expression); + ;} + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 300 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 306 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (1)].expression); + ;} + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 310 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.identifier = (yyvsp[(3) - (3)].identifier); + ;} + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 317 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 323 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 341 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 360 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (2)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(2) - (2)].expression)->link); + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 366 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (3)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(3) - (3)].expression)->link); + ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 382 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 388 "glsl_parser.ypp" + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); + (yyval.expression) = new(ctx) ast_function_expression(callee); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 395 "glsl_parser.ypp" + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); + (yyval.expression) = new(ctx) ast_function_expression(callee); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 407 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 413 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 419 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 428 "glsl_parser.ypp" + { (yyval.n) = ast_plus; ;} + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 429 "glsl_parser.ypp" + { (yyval.n) = ast_neg; ;} + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 430 "glsl_parser.ypp" + { (yyval.n) = ast_logic_not; ;} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 431 "glsl_parser.ypp" + { (yyval.n) = ast_bit_not; ;} + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 437 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 443 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 449 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 459 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 465 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 475 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 481 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 491 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 497 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 503 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 509 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 519 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 63: + +/* Line 1455 of yacc.c */ +#line 525 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 65: + +/* Line 1455 of yacc.c */ +#line 535 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 545 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 555 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 71: + +/* Line 1455 of yacc.c */ +#line 565 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 73: + +/* Line 1455 of yacc.c */ +#line 575 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 75: + +/* Line 1455 of yacc.c */ +#line 585 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 77: + +/* Line 1455 of yacc.c */ +#line 595 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 79: + +/* Line 1455 of yacc.c */ +#line 605 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 613 "glsl_parser.ypp" + { (yyval.n) = ast_assign; ;} + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 614 "glsl_parser.ypp" + { (yyval.n) = ast_mul_assign; ;} + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 615 "glsl_parser.ypp" + { (yyval.n) = ast_div_assign; ;} + break; + + case 83: + +/* Line 1455 of yacc.c */ +#line 616 "glsl_parser.ypp" + { (yyval.n) = ast_mod_assign; ;} + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 617 "glsl_parser.ypp" + { (yyval.n) = ast_add_assign; ;} + break; + + case 85: + +/* Line 1455 of yacc.c */ +#line 618 "glsl_parser.ypp" + { (yyval.n) = ast_sub_assign; ;} + break; + + case 86: + +/* Line 1455 of yacc.c */ +#line 619 "glsl_parser.ypp" + { (yyval.n) = ast_ls_assign; ;} + break; + + case 87: + +/* Line 1455 of yacc.c */ +#line 620 "glsl_parser.ypp" + { (yyval.n) = ast_rs_assign; ;} + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 621 "glsl_parser.ypp" + { (yyval.n) = ast_and_assign; ;} + break; + + case 89: + +/* Line 1455 of yacc.c */ +#line 622 "glsl_parser.ypp" + { (yyval.n) = ast_xor_assign; ;} + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 623 "glsl_parser.ypp" + { (yyval.n) = ast_or_assign; ;} + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 628 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (1)].expression); + ;} + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 632 "glsl_parser.ypp" + { + void *ctx = state; + if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { + (yyval.expression) = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(1) - (3)].expression)->link); + } else { + (yyval.expression) = (yyvsp[(1) - (3)].expression); + } + + (yyval.expression)->expressions.push_tail(& (yyvsp[(3) - (3)].expression)->link); + ;} + break; + + case 94: + +/* Line 1455 of yacc.c */ +#line 652 "glsl_parser.ypp" + { + (yyval.node) = (yyvsp[(1) - (2)].function); + ;} + break; + + case 95: + +/* Line 1455 of yacc.c */ +#line 656 "glsl_parser.ypp" + { + (yyval.node) = (yyvsp[(1) - (2)].declarator_list); + ;} + break; + + case 96: + +/* Line 1455 of yacc.c */ +#line 660 "glsl_parser.ypp" + { + if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) + && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { + _mesa_glsl_error(& (yylsp[(3) - (4)]), state, "global precision qualifier can " + "only be applied to `int' or `float'\n"); + YYERROR; + } + + (yyval.node) = NULL; /* FINISHME */ + ;} + break; + + case 100: + +/* Line 1455 of yacc.c */ +#line 683 "glsl_parser.ypp" + { + (yyval.function) = (yyvsp[(1) - (2)].function); + (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); + ;} + break; + + case 101: + +/* Line 1455 of yacc.c */ +#line 688 "glsl_parser.ypp" + { + (yyval.function) = (yyvsp[(1) - (3)].function); + (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); + ;} + break; + + case 102: + +/* Line 1455 of yacc.c */ +#line 696 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.function) = new(ctx) ast_function(); + (yyval.function)->set_location(yylloc); + (yyval.function)->return_type = (yyvsp[(1) - (3)].fully_specified_type); + (yyval.function)->identifier = (yyvsp[(2) - (3)].identifier); + ;} + break; + + case 103: + +/* Line 1455 of yacc.c */ +#line 707 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->set_location(yylloc); + (yyval.parameter_declarator)->type->specifier = (yyvsp[(1) - (2)].type_specifier); + (yyval.parameter_declarator)->identifier = (yyvsp[(2) - (2)].identifier); + ;} + break; + + case 104: + +/* Line 1455 of yacc.c */ +#line 717 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->set_location(yylloc); + (yyval.parameter_declarator)->type->specifier = (yyvsp[(1) - (5)].type_specifier); + (yyval.parameter_declarator)->identifier = (yyvsp[(2) - (5)].identifier); + (yyval.parameter_declarator)->is_array = true; + (yyval.parameter_declarator)->array_size = (yyvsp[(4) - (5)].expression); + ;} + break; + + case 105: + +/* Line 1455 of yacc.c */ +#line 732 "glsl_parser.ypp" + { + (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; + + (yyval.parameter_declarator) = (yyvsp[(3) - (3)].parameter_declarator); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q; + ;} + break; + + case 106: + +/* Line 1455 of yacc.c */ +#line 739 "glsl_parser.ypp" + { + (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + ;} + break; + + case 107: + +/* Line 1455 of yacc.c */ +#line 744 "glsl_parser.ypp" + { + void *ctx = state; + (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; + + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q; + (yyval.parameter_declarator)->type->specifier = (yyvsp[(3) - (3)].type_specifier); + ;} + break; + + case 108: + +/* Line 1455 of yacc.c */ +#line 755 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + (yyval.parameter_declarator)->type->specifier = (yyvsp[(2) - (2)].type_specifier); + ;} + break; + + case 109: + +/* Line 1455 of yacc.c */ +#line 766 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; ;} + break; + + case 110: + +/* Line 1455 of yacc.c */ +#line 767 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 111: + +/* Line 1455 of yacc.c */ +#line 768 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 112: + +/* Line 1455 of yacc.c */ +#line 769 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 115: + +/* Line 1455 of yacc.c */ +#line 779 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (3)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 116: + +/* Line 1455 of yacc.c */ +#line 788 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 117: + +/* Line 1455 of yacc.c */ +#line 797 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (6)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 118: + +/* Line 1455 of yacc.c */ +#line 806 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (7)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 119: + +/* Line 1455 of yacc.c */ +#line 815 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (8)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 120: + +/* Line 1455 of yacc.c */ +#line 824 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 121: + +/* Line 1455 of yacc.c */ +#line 837 "glsl_parser.ypp" + { + void *ctx = state; + if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "empty declaration list\n"); + YYERROR; + } else { + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (1)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + } + ;} + break; + + case 122: + +/* Line 1455 of yacc.c */ +#line 848 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (2)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 123: + +/* Line 1455 of yacc.c */ +#line 857 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 124: + +/* Line 1455 of yacc.c */ +#line 866 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (5)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 125: + +/* Line 1455 of yacc.c */ +#line 875 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (6)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 126: + +/* Line 1455 of yacc.c */ +#line 884 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (7)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 127: + +/* Line 1455 of yacc.c */ +#line 893 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 128: + +/* Line 1455 of yacc.c */ +#line 902 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list(NULL); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->invariant = true; + + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 129: + +/* Line 1455 of yacc.c */ +#line 916 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); + (yyval.fully_specified_type)->set_location(yylloc); + (yyval.fully_specified_type)->specifier = (yyvsp[(1) - (1)].type_specifier); + ;} + break; + + case 130: + +/* Line 1455 of yacc.c */ +#line 923 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); + (yyval.fully_specified_type)->set_location(yylloc); + (yyval.fully_specified_type)->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + (yyval.fully_specified_type)->specifier = (yyvsp[(2) - (2)].type_specifier); + ;} + break; + + case 131: + +/* Line 1455 of yacc.c */ +#line 933 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} + break; + + case 132: + +/* Line 1455 of yacc.c */ +#line 934 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} + break; + + case 133: + +/* Line 1455 of yacc.c */ +#line 935 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} + break; + + case 134: + +/* Line 1455 of yacc.c */ +#line 939 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} + break; + + case 136: + +/* Line 1455 of yacc.c */ +#line 945 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; + ;} + break; + + case 137: + +/* Line 1455 of yacc.c */ +#line 949 "glsl_parser.ypp" + { + (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); + (yyval.type_qualifier).q.invariant = 1; + ;} + break; + + case 138: + +/* Line 1455 of yacc.c */ +#line 956 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} + break; + + case 139: + +/* Line 1455 of yacc.c */ +#line 957 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} + break; + + case 140: + +/* Line 1455 of yacc.c */ +#line 958 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.varying = 1; ;} + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 959 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} + break; + + case 142: + +/* Line 1455 of yacc.c */ +#line 960 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 143: + +/* Line 1455 of yacc.c */ +#line 961 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 144: + +/* Line 1455 of yacc.c */ +#line 962 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 145: + +/* Line 1455 of yacc.c */ +#line 963 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 146: + +/* Line 1455 of yacc.c */ +#line 964 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} + break; + + case 148: + +/* Line 1455 of yacc.c */ +#line 970 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); + (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); + ;} + break; + + case 150: + +/* Line 1455 of yacc.c */ +#line 979 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); + (yyval.type_specifier)->is_array = true; + (yyval.type_specifier)->array_size = NULL; + ;} + break; + + case 151: + +/* Line 1455 of yacc.c */ +#line 985 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); + (yyval.type_specifier)->is_array = true; + (yyval.type_specifier)->array_size = (yyvsp[(3) - (4)].expression); + ;} + break; + + case 152: + +/* Line 1455 of yacc.c */ +#line 994 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 153: + +/* Line 1455 of yacc.c */ +#line 1000 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 154: + +/* Line 1455 of yacc.c */ +#line 1006 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 155: + +/* Line 1455 of yacc.c */ +#line 1014 "glsl_parser.ypp" + { (yyval.n) = ast_void; ;} + break; + + case 156: + +/* Line 1455 of yacc.c */ +#line 1015 "glsl_parser.ypp" + { (yyval.n) = ast_float; ;} + break; + + case 157: + +/* Line 1455 of yacc.c */ +#line 1016 "glsl_parser.ypp" + { (yyval.n) = ast_int; ;} + break; + + case 158: + +/* Line 1455 of yacc.c */ +#line 1017 "glsl_parser.ypp" + { (yyval.n) = ast_uint; ;} + break; + + case 159: + +/* Line 1455 of yacc.c */ +#line 1018 "glsl_parser.ypp" + { (yyval.n) = ast_bool; ;} + break; + + case 160: + +/* Line 1455 of yacc.c */ +#line 1019 "glsl_parser.ypp" + { (yyval.n) = ast_vec2; ;} + break; + + case 161: + +/* Line 1455 of yacc.c */ +#line 1020 "glsl_parser.ypp" + { (yyval.n) = ast_vec3; ;} + break; + + case 162: + +/* Line 1455 of yacc.c */ +#line 1021 "glsl_parser.ypp" + { (yyval.n) = ast_vec4; ;} + break; + + case 163: + +/* Line 1455 of yacc.c */ +#line 1022 "glsl_parser.ypp" + { (yyval.n) = ast_bvec2; ;} + break; + + case 164: + +/* Line 1455 of yacc.c */ +#line 1023 "glsl_parser.ypp" + { (yyval.n) = ast_bvec3; ;} + break; + + case 165: + +/* Line 1455 of yacc.c */ +#line 1024 "glsl_parser.ypp" + { (yyval.n) = ast_bvec4; ;} + break; + + case 166: + +/* Line 1455 of yacc.c */ +#line 1025 "glsl_parser.ypp" + { (yyval.n) = ast_ivec2; ;} + break; + + case 167: + +/* Line 1455 of yacc.c */ +#line 1026 "glsl_parser.ypp" + { (yyval.n) = ast_ivec3; ;} + break; + + case 168: + +/* Line 1455 of yacc.c */ +#line 1027 "glsl_parser.ypp" + { (yyval.n) = ast_ivec4; ;} + break; + + case 169: + +/* Line 1455 of yacc.c */ +#line 1028 "glsl_parser.ypp" + { (yyval.n) = ast_uvec2; ;} + break; + + case 170: + +/* Line 1455 of yacc.c */ +#line 1029 "glsl_parser.ypp" + { (yyval.n) = ast_uvec3; ;} + break; + + case 171: + +/* Line 1455 of yacc.c */ +#line 1030 "glsl_parser.ypp" + { (yyval.n) = ast_uvec4; ;} + break; + + case 172: + +/* Line 1455 of yacc.c */ +#line 1031 "glsl_parser.ypp" + { (yyval.n) = ast_mat2; ;} + break; + + case 173: + +/* Line 1455 of yacc.c */ +#line 1032 "glsl_parser.ypp" + { (yyval.n) = ast_mat3; ;} + break; + + case 174: + +/* Line 1455 of yacc.c */ +#line 1033 "glsl_parser.ypp" + { (yyval.n) = ast_mat4; ;} + break; + + case 175: + +/* Line 1455 of yacc.c */ +#line 1034 "glsl_parser.ypp" + { (yyval.n) = ast_mat2; ;} + break; + + case 176: + +/* Line 1455 of yacc.c */ +#line 1035 "glsl_parser.ypp" + { (yyval.n) = ast_mat2x3; ;} + break; + + case 177: + +/* Line 1455 of yacc.c */ +#line 1036 "glsl_parser.ypp" + { (yyval.n) = ast_mat2x4; ;} + break; + + case 178: + +/* Line 1455 of yacc.c */ +#line 1037 "glsl_parser.ypp" + { (yyval.n) = ast_mat3x2; ;} + break; + + case 179: + +/* Line 1455 of yacc.c */ +#line 1038 "glsl_parser.ypp" + { (yyval.n) = ast_mat3; ;} + break; + + case 180: + +/* Line 1455 of yacc.c */ +#line 1039 "glsl_parser.ypp" + { (yyval.n) = ast_mat3x4; ;} + break; + + case 181: + +/* Line 1455 of yacc.c */ +#line 1040 "glsl_parser.ypp" + { (yyval.n) = ast_mat4x2; ;} + break; + + case 182: + +/* Line 1455 of yacc.c */ +#line 1041 "glsl_parser.ypp" + { (yyval.n) = ast_mat4x3; ;} + break; + + case 183: + +/* Line 1455 of yacc.c */ +#line 1042 "glsl_parser.ypp" + { (yyval.n) = ast_mat4; ;} + break; + + case 184: + +/* Line 1455 of yacc.c */ +#line 1043 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1d; ;} + break; + + case 185: + +/* Line 1455 of yacc.c */ +#line 1044 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2d; ;} + break; + + case 186: + +/* Line 1455 of yacc.c */ +#line 1045 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2drect; ;} + break; + + case 187: + +/* Line 1455 of yacc.c */ +#line 1046 "glsl_parser.ypp" + { (yyval.n) = ast_sampler3d; ;} + break; + + case 188: + +/* Line 1455 of yacc.c */ +#line 1047 "glsl_parser.ypp" + { (yyval.n) = ast_samplercube; ;} + break; + + case 189: + +/* Line 1455 of yacc.c */ +#line 1048 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1dshadow; ;} + break; + + case 190: + +/* Line 1455 of yacc.c */ +#line 1049 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2dshadow; ;} + break; + + case 191: + +/* Line 1455 of yacc.c */ +#line 1050 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2drectshadow; ;} + break; + + case 192: + +/* Line 1455 of yacc.c */ +#line 1051 "glsl_parser.ypp" + { (yyval.n) = ast_samplercubeshadow; ;} + break; + + case 193: + +/* Line 1455 of yacc.c */ +#line 1052 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1darray; ;} + break; + + case 194: + +/* Line 1455 of yacc.c */ +#line 1053 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2darray; ;} + break; + + case 195: + +/* Line 1455 of yacc.c */ +#line 1054 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1darrayshadow; ;} + break; + + case 196: + +/* Line 1455 of yacc.c */ +#line 1055 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2darrayshadow; ;} + break; + + case 197: + +/* Line 1455 of yacc.c */ +#line 1056 "glsl_parser.ypp" + { (yyval.n) = ast_isampler1d; ;} + break; + + case 198: + +/* Line 1455 of yacc.c */ +#line 1057 "glsl_parser.ypp" + { (yyval.n) = ast_isampler2d; ;} + break; + + case 199: + +/* Line 1455 of yacc.c */ +#line 1058 "glsl_parser.ypp" + { (yyval.n) = ast_isampler3d; ;} + break; + + case 200: + +/* Line 1455 of yacc.c */ +#line 1059 "glsl_parser.ypp" + { (yyval.n) = ast_isamplercube; ;} + break; + + case 201: + +/* Line 1455 of yacc.c */ +#line 1060 "glsl_parser.ypp" + { (yyval.n) = ast_isampler1darray; ;} + break; + + case 202: + +/* Line 1455 of yacc.c */ +#line 1061 "glsl_parser.ypp" + { (yyval.n) = ast_isampler2darray; ;} + break; + + case 203: + +/* Line 1455 of yacc.c */ +#line 1062 "glsl_parser.ypp" + { (yyval.n) = ast_usampler1d; ;} + break; + + case 204: + +/* Line 1455 of yacc.c */ +#line 1063 "glsl_parser.ypp" + { (yyval.n) = ast_usampler2d; ;} + break; + + case 205: + +/* Line 1455 of yacc.c */ +#line 1064 "glsl_parser.ypp" + { (yyval.n) = ast_usampler3d; ;} + break; + + case 206: + +/* Line 1455 of yacc.c */ +#line 1065 "glsl_parser.ypp" + { (yyval.n) = ast_usamplercube; ;} + break; + + case 207: + +/* Line 1455 of yacc.c */ +#line 1066 "glsl_parser.ypp" + { (yyval.n) = ast_usampler1darray; ;} + break; + + case 208: + +/* Line 1455 of yacc.c */ +#line 1067 "glsl_parser.ypp" + { (yyval.n) = ast_usampler2darray; ;} + break; + + case 209: + +/* Line 1455 of yacc.c */ +#line 1071 "glsl_parser.ypp" + { + if (state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_high; + ;} + break; + + case 210: + +/* Line 1455 of yacc.c */ +#line 1082 "glsl_parser.ypp" + { + if (state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_medium; + ;} + break; + + case 211: + +/* Line 1455 of yacc.c */ +#line 1093 "glsl_parser.ypp" + { + if (state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precission qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_low; + ;} + break; + + case 212: + +/* Line 1455 of yacc.c */ +#line 1108 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); + (yyval.struct_specifier)->set_location(yylloc); + ;} + break; + + case 213: + +/* Line 1455 of yacc.c */ +#line 1114 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); + (yyval.struct_specifier)->set_location(yylloc); + ;} + break; + + case 214: + +/* Line 1455 of yacc.c */ +#line 1123 "glsl_parser.ypp" + { + (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); + (yyvsp[(1) - (1)].declarator_list)->link.self_link(); + ;} + break; + + case 215: + +/* Line 1455 of yacc.c */ +#line 1128 "glsl_parser.ypp" + { + (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); + (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); + ;} + break; + + case 216: + +/* Line 1455 of yacc.c */ +#line 1136 "glsl_parser.ypp" + { + void *ctx = state; + ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); + type->set_location(yylloc); + + type->specifier = (yyvsp[(1) - (3)].type_specifier); + (yyval.declarator_list) = new(ctx) ast_declarator_list(type); + (yyval.declarator_list)->set_location(yylloc); + + (yyval.declarator_list)->declarations.push_degenerate_list_at_head(& (yyvsp[(2) - (3)].declaration)->link); + ;} + break; + + case 217: + +/* Line 1455 of yacc.c */ +#line 1151 "glsl_parser.ypp" + { + (yyval.declaration) = (yyvsp[(1) - (1)].declaration); + (yyvsp[(1) - (1)].declaration)->link.self_link(); + ;} + break; + + case 218: + +/* Line 1455 of yacc.c */ +#line 1156 "glsl_parser.ypp" + { + (yyval.declaration) = (yyvsp[(1) - (3)].declaration); + (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); + ;} + break; + + case 219: + +/* Line 1455 of yacc.c */ +#line 1164 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); + (yyval.declaration)->set_location(yylloc); + ;} + break; + + case 220: + +/* Line 1455 of yacc.c */ +#line 1170 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); + (yyval.declaration)->set_location(yylloc); + ;} + break; + + case 225: + +/* Line 1455 of yacc.c */ +#line 1193 "glsl_parser.ypp" + { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + break; + + case 231: + +/* Line 1455 of yacc.c */ +#line 1205 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 232: + +/* Line 1455 of yacc.c */ +#line 1206 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 235: + +/* Line 1455 of yacc.c */ +#line 1213 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 236: + +/* Line 1455 of yacc.c */ +#line 1219 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 237: + +/* Line 1455 of yacc.c */ +#line 1227 "glsl_parser.ypp" + { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + break; + + case 239: + +/* Line 1455 of yacc.c */ +#line 1233 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 240: + +/* Line 1455 of yacc.c */ +#line 1239 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 241: + +/* Line 1455 of yacc.c */ +#line 1248 "glsl_parser.ypp" + { + if ((yyvsp[(1) - (1)].node) == NULL) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); + assert((yyvsp[(1) - (1)].node) != NULL); + } + + (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node)->link.self_link(); + ;} + break; + + case 242: + +/* Line 1455 of yacc.c */ +#line 1258 "glsl_parser.ypp" + { + if ((yyvsp[(2) - (2)].node) == NULL) { + _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); + assert((yyvsp[(2) - (2)].node) != NULL); + } + (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].node)->link); + ;} + break; + + case 243: + +/* Line 1455 of yacc.c */ +#line 1270 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_expression_statement(NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 244: + +/* Line 1455 of yacc.c */ +#line 1276 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 245: + +/* Line 1455 of yacc.c */ +#line 1285 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 246: + +/* Line 1455 of yacc.c */ +#line 1294 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 247: + +/* Line 1455 of yacc.c */ +#line 1300 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 248: + +/* Line 1455 of yacc.c */ +#line 1306 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 249: + +/* Line 1455 of yacc.c */ +#line 1315 "glsl_parser.ypp" + { + (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); + ;} + break; + + case 250: + +/* Line 1455 of yacc.c */ +#line 1319 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); + ast_declarator_list *declarator = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + decl->set_location(yylloc); + declarator->set_location(yylloc); + + declarator->declarations.push_tail(&decl->link); + (yyval.node) = declarator; + ;} + break; + + case 254: + +/* Line 1455 of yacc.c */ +#line 1342 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, + NULL, (yyvsp[(3) - (5)].node), NULL, (yyvsp[(5) - (5)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 255: + +/* Line 1455 of yacc.c */ +#line 1349 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, + NULL, (yyvsp[(5) - (7)].expression), NULL, (yyvsp[(2) - (7)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 256: + +/* Line 1455 of yacc.c */ +#line 1356 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, + (yyvsp[(3) - (6)].node), (yyvsp[(4) - (6)].for_rest_statement).cond, (yyvsp[(4) - (6)].for_rest_statement).rest, (yyvsp[(6) - (6)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 260: + +/* Line 1455 of yacc.c */ +#line 1372 "glsl_parser.ypp" + { + (yyval.node) = NULL; + ;} + break; + + case 261: + +/* Line 1455 of yacc.c */ +#line 1379 "glsl_parser.ypp" + { + (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); + (yyval.for_rest_statement).rest = NULL; + ;} + break; + + case 262: + +/* Line 1455 of yacc.c */ +#line 1384 "glsl_parser.ypp" + { + (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); + (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); + ;} + break; + + case 263: + +/* Line 1455 of yacc.c */ +#line 1393 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 264: + +/* Line 1455 of yacc.c */ +#line 1399 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 265: + +/* Line 1455 of yacc.c */ +#line 1405 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 266: + +/* Line 1455 of yacc.c */ +#line 1411 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 267: + +/* Line 1455 of yacc.c */ +#line 1417 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 268: + +/* Line 1455 of yacc.c */ +#line 1425 "glsl_parser.ypp" + { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} + break; + + case 269: + +/* Line 1455 of yacc.c */ +#line 1426 "glsl_parser.ypp" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 270: + +/* Line 1455 of yacc.c */ +#line 1431 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.function_definition) = new(ctx) ast_function_definition(); + (yyval.function_definition)->set_location(yylloc); + (yyval.function_definition)->prototype = (yyvsp[(1) - (2)].function); + (yyval.function_definition)->body = (yyvsp[(2) - (2)].compound_statement); + ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 4838 "glsl_parser.cpp" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, state, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, state, yymsg); + } + else + { + yyerror (&yylloc, state, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[0] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, state); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, state); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, state, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, state); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, state); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h new file mode 100644 index 0000000000..6cbab40557 --- /dev/null +++ b/src/glsl/glsl_parser.h @@ -0,0 +1,262 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ATTRIBUTE = 258, + CONST_TOK = 259, + BOOL = 260, + FLOAT = 261, + INT = 262, + UINT = 263, + BREAK = 264, + CONTINUE = 265, + DO = 266, + ELSE = 267, + FOR = 268, + IF = 269, + DISCARD = 270, + RETURN = 271, + SWITCH = 272, + CASE = 273, + DEFAULT = 274, + BVEC2 = 275, + BVEC3 = 276, + BVEC4 = 277, + IVEC2 = 278, + IVEC3 = 279, + IVEC4 = 280, + UVEC2 = 281, + UVEC3 = 282, + UVEC4 = 283, + VEC2 = 284, + VEC3 = 285, + VEC4 = 286, + MAT2 = 287, + MAT3 = 288, + MAT4 = 289, + CENTROID = 290, + IN = 291, + OUT = 292, + INOUT = 293, + UNIFORM = 294, + VARYING = 295, + NOPERSPECTIVE = 296, + FLAT = 297, + SMOOTH = 298, + MAT2X2 = 299, + MAT2X3 = 300, + MAT2X4 = 301, + MAT3X2 = 302, + MAT3X3 = 303, + MAT3X4 = 304, + MAT4X2 = 305, + MAT4X3 = 306, + MAT4X4 = 307, + SAMPLER1D = 308, + SAMPLER2D = 309, + SAMPLER3D = 310, + SAMPLERCUBE = 311, + SAMPLER1DSHADOW = 312, + SAMPLER2DSHADOW = 313, + SAMPLERCUBESHADOW = 314, + SAMPLER1DARRAY = 315, + SAMPLER2DARRAY = 316, + SAMPLER1DARRAYSHADOW = 317, + SAMPLER2DARRAYSHADOW = 318, + ISAMPLER1D = 319, + ISAMPLER2D = 320, + ISAMPLER3D = 321, + ISAMPLERCUBE = 322, + ISAMPLER1DARRAY = 323, + ISAMPLER2DARRAY = 324, + USAMPLER1D = 325, + USAMPLER2D = 326, + USAMPLER3D = 327, + USAMPLERCUBE = 328, + USAMPLER1DARRAY = 329, + USAMPLER2DARRAY = 330, + STRUCT = 331, + VOID = 332, + WHILE = 333, + IDENTIFIER = 334, + FLOATCONSTANT = 335, + INTCONSTANT = 336, + UINTCONSTANT = 337, + BOOLCONSTANT = 338, + FIELD_SELECTION = 339, + LEFT_OP = 340, + RIGHT_OP = 341, + INC_OP = 342, + DEC_OP = 343, + LE_OP = 344, + GE_OP = 345, + EQ_OP = 346, + NE_OP = 347, + AND_OP = 348, + OR_OP = 349, + XOR_OP = 350, + MUL_ASSIGN = 351, + DIV_ASSIGN = 352, + ADD_ASSIGN = 353, + MOD_ASSIGN = 354, + LEFT_ASSIGN = 355, + RIGHT_ASSIGN = 356, + AND_ASSIGN = 357, + XOR_ASSIGN = 358, + OR_ASSIGN = 359, + SUB_ASSIGN = 360, + INVARIANT = 361, + LOWP = 362, + MEDIUMP = 363, + HIGHP = 364, + PRECISION = 365, + VERSION = 366, + EXTENSION = 367, + LINE = 368, + PRAGMA = 369, + COLON = 370, + EOL = 371, + INTERFACE = 372, + OUTPUT = 373, + ASM = 374, + CLASS = 375, + UNION = 376, + ENUM = 377, + TYPEDEF = 378, + TEMPLATE = 379, + THIS = 380, + PACKED = 381, + GOTO = 382, + INLINE_TOK = 383, + NOINLINE = 384, + VOLATILE = 385, + PUBLIC_TOK = 386, + STATIC = 387, + EXTERN = 388, + EXTERNAL = 389, + LONG = 390, + SHORT = 391, + DOUBLE = 392, + HALF = 393, + FIXED = 394, + UNSIGNED = 395, + INPUT = 396, + OUPTUT = 397, + HVEC2 = 398, + HVEC3 = 399, + HVEC4 = 400, + DVEC2 = 401, + DVEC3 = 402, + DVEC4 = 403, + FVEC2 = 404, + FVEC3 = 405, + FVEC4 = 406, + SAMPLER2DRECT = 407, + SAMPLER3DRECT = 408, + SAMPLER2DRECTSHADOW = 409, + SIZEOF = 410, + CAST = 411, + NAMESPACE = 412, + USING = 413 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 45 "glsl_parser.ypp" + + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + struct ast_node *node; + struct ast_type_specifier *type_specifier; + struct ast_fully_specified_type *fully_specified_type; + struct ast_function *function; + struct ast_parameter_declarator *parameter_declarator; + struct ast_function_definition *function_definition; + struct ast_compound_statement *compound_statement; + struct ast_expression *expression; + struct ast_declarator_list *declarator_list; + struct ast_struct_specifier *struct_specifier; + struct ast_declaration *declaration; + + struct { + struct ast_node *cond; + struct ast_expression *rest; + } for_rest_statement; + + + +/* Line 1676 of yacc.c */ +#line 240 "glsl_parser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + + -- cgit v1.2.3 From f8a04b38775cc9f40619e3fb3be39d585e0d4920 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 12:30:07 -0700 Subject: glsl: Ignore glsl_compiler and glsl_parser.output files. These are generated files where we can do the sane thing, and keep them out of version control. --- src/glsl/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/glsl/.gitignore (limited to 'src/glsl') diff --git a/src/glsl/.gitignore b/src/glsl/.gitignore new file mode 100644 index 0000000000..4c212313e4 --- /dev/null +++ b/src/glsl/.gitignore @@ -0,0 +1,2 @@ +glsl_compiler +glsl_parser.output -- cgit v1.2.3 From 667173e36293d781e145f40e0d6919cb847af318 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 28 Jul 2010 12:33:56 -0700 Subject: glcpp: Add generated source files. This is now consistent with other usage of flex/bison througout mesa, (which is that these generated files are added to source control so that the build system does not require external tools like flex/bison for non-developers). --- src/glsl/glcpp/.gitignore | 3 - src/glsl/glcpp/glcpp-lex.c | 2636 ++++++++++++++++++++++++++++ src/glsl/glcpp/glcpp-parse.c | 3957 ++++++++++++++++++++++++++++++++++++++++++ src/glsl/glcpp/glcpp-parse.h | 100 ++ 4 files changed, 6693 insertions(+), 3 deletions(-) create mode 100644 src/glsl/glcpp/glcpp-lex.c create mode 100644 src/glsl/glcpp/glcpp-parse.c create mode 100644 src/glsl/glcpp/glcpp-parse.h (limited to 'src/glsl') diff --git a/src/glsl/glcpp/.gitignore b/src/glsl/glcpp/.gitignore index c158dc8b86..dbc37e1926 100644 --- a/src/glsl/glcpp/.gitignore +++ b/src/glsl/glcpp/.gitignore @@ -1,7 +1,4 @@ glcpp -glcpp-lex.c -glcpp-parse.c -glcpp-parse.h glcpp-parse.output *.o *.lo diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c new file mode 100644 index 0000000000..edf98a4afd --- /dev/null +++ b/src/glsl/glcpp/glcpp-lex.c @@ -0,0 +1,2636 @@ +#line 2 "glcpp/glcpp-lex.c" + +#line 4 "glcpp/glcpp-lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE glcpp_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via glcpp_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void glcpp_restart (FILE *input_file ,yyscan_t yyscanner ); +void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void glcpp_pop_buffer_state (yyscan_t yyscanner ); + +static void glcpp_ensure_buffer_stack (yyscan_t yyscanner ); +static void glcpp__load_buffer_state (yyscan_t yyscanner ); +static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner ); +void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void glcpp_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer glcpp__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + glcpp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + glcpp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define glcpp_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 40 +#define YY_END_OF_BUFFER 41 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[132] = + { 0, + 3, 3, 41, 36, 40, 37, 40, 38, 40, 40, + 35, 40, 40, 35, 40, 35, 40, 35, 40, 22, + 36, 40, 21, 36, 40, 35, 40, 35, 40, 35, + 40, 34, 36, 40, 34, 36, 40, 35, 40, 37, + 40, 20, 40, 40, 3, 40, 4, 40, 5, 40, + 39, 40, 36, 15, 37, 29, 32, 30, 2, 22, + 36, 22, 36, 36, 21, 36, 21, 36, 24, 26, + 28, 27, 25, 34, 36, 34, 36, 31, 37, 20, + 20, 3, 4, 5, 6, 5, 7, 1, 15, 23, + 36, 34, 36,16395, 23, 36, 34, 36, 15, 34, + + 36,16396,16397, 8203, 15, 8203, 34, 36, 8204, 15, + 8205, 15,16398, 16,16393, 19, 33, 34, 36, 18, + 8206, 15, 16, 8201, 15,16394,16401, 8202, 15, 8, + 8209 + } ; + +static yyconst flex_int16_t yy_accept[151] = + { 0, + 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, + 6, 8, 10, 11, 13, 14, 16, 18, 20, 23, + 26, 28, 30, 32, 35, 38, 40, 42, 44, 45, + 47, 49, 51, 53, 54, 54, 55, 56, 57, 58, + 59, 60, 60, 62, 64, 65, 67, 69, 70, 71, + 72, 73, 74, 76, 78, 79, 80, 81, 82, 82, + 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, + 88, 88, 90, 92, 94, 94, 94, 94, 94, 94, + 95, 95, 95, 95, 97, 99, 99, 99, 99, 99, + 99, 99, 99, 100, 100, 100, 100, 100, 100, 102, + + 102, 103, 104, 104, 104, 104, 104, 106, 106, 107, + 107, 107, 107, 107, 107, 109, 109, 109, 111, 111, + 113, 114, 115, 115, 116, 116, 116, 117, 117, 120, + 121, 121, 123, 124, 124, 124, 126, 127, 127, 127, + 128, 128, 128, 130, 131, 131, 131, 132, 132, 132 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, + 7, 10, 7, 7, 7, 7, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 14, 14, 1, 7, 15, + 16, 17, 1, 1, 18, 18, 18, 18, 18, 18, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 20, 19, 19, 21, 19, 19, + 7, 1, 7, 7, 19, 1, 22, 18, 18, 23, + + 24, 25, 26, 19, 27, 19, 19, 28, 29, 30, + 31, 32, 19, 33, 34, 35, 36, 37, 19, 38, + 19, 19, 7, 39, 7, 7, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[40] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[169] = + { 0, + 0, 38, 0, 0, 38, 39, 426, 425, 427, 48, + 43, 549, 423, 44, 63, 422, 59, 65, 87, 125, + 58, 67, 68, 164, 203, 40, 75, 241, 549, 421, + 549, 140, 549, 140, 420, 549, 144, 419, 418, 417, + 415, 414, 156, 179, 267, 0, 209, 413, 412, 411, + 410, 409, 387, 124, 407, 153, 403, 402, 154, 198, + 159, 155, 160, 192, 404, 549, 186, 549, 214, 549, + 359, 549, 162, 159, 227, 229, 230, 234, 199, 303, + 232, 235, 236, 262, 56, 243, 237, 247, 245, 252, + 291, 358, 357, 292, 238, 296, 293, 254, 335, 256, + + 355, 354, 298, 294, 263, 352, 549, 350, 549, 299, + 297, 322, 325, 257, 306, 328, 346, 549, 345, 549, + 344, 343, 329, 342, 331, 332, 341, 333, 319, 335, + 337, 549, 248, 338, 246, 549, 197, 184, 336, 366, + 403, 182, 549, 141, 434, 416, 79, 473, 549, 512, + 514, 516, 518, 520, 522, 71, 524, 526, 528, 530, + 532, 534, 536, 538, 540, 542, 544, 546 + } ; + +static yyconst flex_int16_t yy_def[169] = + { 0, + 149, 1, 150, 150, 151, 151, 152, 152, 149, 153, + 154, 149, 154, 154, 154, 154, 154, 154, 149, 153, + 154, 154, 154, 155, 155, 154, 154, 154, 149, 156, + 149, 157, 149, 20, 154, 149, 154, 154, 154, 154, + 154, 158, 19, 20, 20, 20, 20, 154, 154, 154, + 154, 154, 25, 25, 154, 154, 28, 28, 154, 154, + 154, 154, 154, 154, 156, 149, 157, 149, 157, 149, + 158, 149, 45, 25, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 20, 25, 154, 154, 154, 154, 154, + 154, 159, 160, 154, 154, 154, 154, 154, 25, 154, + + 161, 162, 154, 154, 154, 159, 149, 160, 149, 154, + 154, 154, 154, 154, 25, 154, 161, 149, 162, 149, + 163, 164, 154, 165, 154, 154, 154, 154, 25, 154, + 163, 149, 164, 154, 165, 149, 166, 167, 154, 149, + 154, 166, 149, 167, 168, 154, 154, 168, 0, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149 + } ; + +static yyconst flex_int16_t yy_nxt[589] = + { 0, + 10, 11, 12, 13, 14, 15, 16, 17, 16, 16, + 18, 19, 20, 20, 21, 22, 23, 24, 24, 24, + 24, 24, 25, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 26, 27, + 31, 31, 36, 28, 37, 36, 36, 32, 32, 35, + 36, 35, 35, 35, 35, 35, 35, 35, 35, 38, + 36, 36, 35, 35, 35, 36, 40, 36, 39, 36, + 36, 65, 48, 49, 41, 42, 56, 36, 55, 53, + 57, 36, 50, 51, 52, 99, 35, 34, 35, 36, + 35, 35, 35, 35, 35, 35, 35, 35, 43, 43, + + 34, 35, 35, 35, 34, 34, 44, 45, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 44, 34, 45, 35, 35, 36, 35, 35, + 35, 35, 35, 35, 35, 35, 46, 46, 46, 35, + 35, 35, 68, 36, 47, 37, 36, 53, 74, 69, + 70, 34, 34, 34, 56, 36, 36, 36, 57, 34, + 47, 36, 36, 35, 34, 35, 36, 35, 35, 35, + 35, 35, 35, 35, 35, 34, 34, 75, 35, 35, + 35, 84, 53, 80, 143, 85, 36, 81, 68, 82, + 34, 34, 34, 34, 36, 149, 149, 84, 34, 143, + + 36, 36, 35, 34, 35, 36, 35, 35, 35, 35, + 35, 35, 35, 35, 34, 83, 68, 35, 35, 35, + 34, 34, 34, 69, 70, 76, 54, 77, 34, 36, + 78, 36, 36, 91, 36, 79, 36, 36, 36, 36, + 36, 35, 58, 36, 34, 36, 39, 36, 136, 36, + 36, 86, 89, 96, 36, 87, 36, 97, 36, 36, + 111, 101, 88, 59, 60, 36, 90, 61, 98, 100, + 102, 103, 62, 34, 34, 34, 63, 64, 73, 73, + 73, 34, 104, 128, 73, 116, 34, 114, 73, 73, + 73, 73, 123, 36, 36, 36, 36, 34, 36, 36, + + 36, 36, 34, 92, 92, 93, 92, 92, 92, 92, + 92, 92, 92, 92, 105, 110, 113, 92, 92, 92, + 125, 112, 121, 124, 36, 94, 122, 36, 129, 53, + 36, 36, 95, 36, 36, 36, 140, 36, 36, 132, + 36, 92, 53, 36, 136, 36, 132, 120, 118, 127, + 126, 130, 109, 138, 107, 137, 120, 118, 115, 109, + 107, 72, 134, 139, 141, 138, 35, 140, 36, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + + 145, 145, 145, 145, 35, 36, 66, 35, 35, 36, + 53, 36, 36, 36, 36, 36, 72, 36, 36, 36, + 36, 36, 36, 66, 36, 36, 149, 29, 29, 149, + 149, 149, 149, 146, 35, 35, 36, 35, 35, 35, + 35, 35, 147, 35, 35, 138, 149, 149, 35, 35, + 35, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 35, 35, 35, 36, 35, 35, 35, 35, + 35, 147, 35, 35, 149, 149, 149, 35, 35, 35, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 35, 29, 29, 30, 30, 33, 33, 34, 34, + 35, 35, 53, 53, 67, 67, 71, 71, 106, 106, + 108, 108, 117, 117, 119, 119, 131, 131, 133, 133, + 135, 135, 142, 142, 144, 144, 148, 148, 9, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149 + } ; + +static yyconst flex_int16_t yy_chk[589] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 5, 6, 26, 2, 11, 11, 14, 5, 6, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 14, + 21, 17, 10, 10, 10, 15, 17, 18, 15, 22, + 23, 156, 21, 21, 18, 18, 27, 27, 26, 85, + 27, 147, 22, 23, 23, 85, 10, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 32, 144, 20, 37, 37, 54, 54, 32, + 32, 34, 34, 34, 56, 56, 59, 62, 56, 34, + 20, 61, 63, 20, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 34, 43, 59, 24, 24, + 24, 73, 74, 61, 142, 74, 138, 62, 67, 63, + 44, 44, 44, 43, 64, 67, 67, 73, 44, 137, + + 60, 79, 24, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 44, 64, 69, 25, 25, 25, + 47, 47, 47, 69, 69, 60, 25, 60, 47, 75, + 60, 76, 77, 79, 81, 60, 78, 82, 83, 87, + 95, 25, 28, 28, 47, 86, 28, 89, 135, 88, + 133, 75, 77, 81, 90, 76, 98, 82, 100, 114, + 95, 87, 76, 28, 28, 105, 78, 28, 83, 86, + 88, 89, 28, 84, 84, 84, 28, 28, 45, 45, + 45, 84, 90, 114, 45, 100, 45, 98, 45, 45, + 45, 45, 105, 91, 94, 97, 104, 84, 96, 111, + + 103, 110, 45, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 91, 94, 97, 80, 80, 80, + 111, 96, 103, 110, 112, 80, 104, 113, 115, 115, + 116, 123, 80, 125, 126, 128, 130, 130, 139, 131, + 134, 80, 129, 127, 124, 122, 121, 119, 117, 113, + 112, 116, 108, 126, 106, 125, 102, 101, 99, 93, + 92, 71, 123, 128, 134, 139, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + + 140, 140, 140, 140, 140, 141, 65, 58, 57, 55, + 53, 52, 51, 50, 49, 48, 42, 41, 146, 40, + 39, 38, 35, 30, 16, 13, 9, 8, 7, 0, + 0, 0, 0, 141, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 146, 0, 0, 145, 145, + 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 145, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 0, 0, 0, 148, 148, 148, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 148, 150, 150, 151, 151, 152, 152, 153, 153, + 154, 154, 155, 155, 157, 157, 158, 158, 159, 159, + 160, 160, 161, 161, 162, 162, 163, 163, 164, 164, + 165, 165, 166, 166, 167, 167, 168, 168, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 149, 149, 149, 149 + } ; + +#define YY_TRAILING_MASK 0x2000 +#define YY_TRAILING_HEAD_MASK 0x4000 +#define REJECT \ +{ \ +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \ +yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \ +yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \ +yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \ +yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \ +++yyg->yy_lp; \ +goto find_rule; \ +} + +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "glcpp/glcpp-lex.l" +#line 2 "glcpp/glcpp-lex.l" +/* + * 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 +#include +#include + +#include "glcpp.h" +#include "glcpp-parse.h" + +/* Flex annoyingly generates some functions without making them + * static. Let's declare them here. */ +int glcpp_get_column (yyscan_t yyscanner); +void glcpp_set_column (int column_no , yyscan_t yyscanner); + +#define YY_NO_INPUT + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno; \ + yycolumn += yyleng; \ + } while(0); +#define YY_USER_INIT yylineno = 0; yycolumn = 0; + +#line 694 "glcpp/glcpp-lex.c" + +#define INITIAL 0 +#define DONE 1 +#define COMMENT 2 +#define UNREACHABLE 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#define YY_EXTRA_TYPE glcpp_parser_t * + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + yy_state_type *yy_state_buf; + yy_state_type *yy_state_ptr; + char *yy_full_match; + int yy_lp; + + /* These are only needed for trailing context rules, + * but there's no conditional variable for that yet. */ + int yy_looking_for_trail_begin; + int yy_full_lp; + int *yy_full_state; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int glcpp_lex_init (yyscan_t* scanner); + +int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int glcpp_lex_destroy (yyscan_t yyscanner ); + +int glcpp_get_debug (yyscan_t yyscanner ); + +void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner ); + +void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *glcpp_get_in (yyscan_t yyscanner ); + +void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *glcpp_get_out (yyscan_t yyscanner ); + +void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner ); + +int glcpp_get_leng (yyscan_t yyscanner ); + +char *glcpp_get_text (yyscan_t yyscanner ); + +int glcpp_get_lineno (yyscan_t yyscanner ); + +void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); + +void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner ); + + void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int glcpp_wrap (yyscan_t yyscanner ); +#else +extern int glcpp_wrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + static int yy_top_state (yyscan_t yyscanner ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int glcpp_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int glcpp_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 69 "glcpp/glcpp-lex.l" + + + /* Single-line comments */ +#line 965 "glcpp/glcpp-lex.c" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + /* Create the reject buffer large enough to save one state per allowed character. */ + if ( ! yyg->yy_state_buf ) + yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE ,yyscanner); + if ( ! yyg->yy_state_buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" ); + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + glcpp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + glcpp__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + yyg->yy_state_ptr = yyg->yy_state_buf; + *yyg->yy_state_ptr++ = yy_current_state; + +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 150 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yyg->yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 549 ); + +yy_find_action: + yy_current_state = *--yyg->yy_state_ptr; + yyg->yy_lp = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yyg->yy_lp]; + if ( yy_act & YY_TRAILING_HEAD_MASK || + yyg->yy_looking_for_trail_begin ) + { + if ( yy_act == yyg->yy_looking_for_trail_begin ) + { + yyg->yy_looking_for_trail_begin = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } + else if ( yy_act & YY_TRAILING_MASK ) + { + yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; + yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; + yyg->yy_full_match = yy_cp; + yyg->yy_full_state = yyg->yy_state_ptr; + yyg->yy_full_lp = yyg->yy_lp; + } + else + { + yyg->yy_full_match = yy_cp; + yyg->yy_full_state = yyg->yy_state_ptr; + yyg->yy_full_lp = yyg->yy_lp; + break; + } + ++yyg->yy_lp; + goto find_rule; + } + --yy_cp; + yy_current_state = *--yyg->yy_state_ptr; + yyg->yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 72 "glcpp/glcpp-lex.l" +{ + yylineno++; + yycolumn = 0; + return NEWLINE; +} + YY_BREAK +/* Multi-line comments */ +case 2: +YY_RULE_SETUP +#line 79 "glcpp/glcpp-lex.l" +{ yy_push_state(COMMENT, yyscanner); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 80 "glcpp/glcpp-lex.l" + + YY_BREAK +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 81 "glcpp/glcpp-lex.l" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 82 "glcpp/glcpp-lex.l" + + YY_BREAK +case 6: +/* rule 6 can match eol */ +YY_RULE_SETUP +#line 83 "glcpp/glcpp-lex.l" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 84 "glcpp/glcpp-lex.l" +{ + yy_pop_state(yyscanner); + if (yyextra->space_tokens) + return SPACE; +} + YY_BREAK +/* glcpp doesn't handle #extension, #version, or #pragma directives. + * Simply pass them through to the main compiler's lexer/parser. */ +case 8: +YY_RULE_SETUP +#line 92 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + return OTHER; +} + YY_BREAK +case 9: +/* rule 9 can match eol */ +YY_RULE_SETUP +#line 99 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFDEF; +} + YY_BREAK +case 10: +/* rule 10 can match eol */ +YY_RULE_SETUP +#line 105 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFNDEF; +} + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 111 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IF; +} + YY_BREAK +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +#line 117 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_ELIF; +} + YY_BREAK +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +#line 123 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ELSE; +} + YY_BREAK +case 14: +/* rule 14 can match eol */ +YY_RULE_SETUP +#line 128 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ENDIF; +} + YY_BREAK +/* When skipping (due to an #if 0 or similar) consume anything + * up to a newline. We do this with less priority than any + * #if-related directive (#if, #elif, #else, #endif), but with + * more priority than any other directive or token to avoid + * any side-effects from skipped content. + * + * We use the lexing_if flag to avoid skipping any part of an + * if conditional expression. */ +case 15: +/* rule 15 can match eol */ +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 141 "glcpp/glcpp-lex.l" +{ + /* Since this rule always matches, YY_USER_ACTION gets called for it, + * wrongly incrementing yycolumn. We undo that effect here. */ + yycolumn -= yyleng; + if (yyextra->lexing_if || + yyextra->skip_stack == NULL || + yyextra->skip_stack->type == SKIP_NO_SKIP) + { + REJECT; + } +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 153 "glcpp/glcpp-lex.l" +{ + char *p; + for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ + p += 5; /* skip "error" */ + glcpp_error(yylloc, yyextra, "#error%s", p); +} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 160 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_DEFINE_FUNC; +} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 165 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_DEFINE_OBJ; +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 170 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_UNDEF; +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 175 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH; +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 180 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 185 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 190 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 195 "glcpp/glcpp-lex.l" +{ + return LEFT_SHIFT; +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 199 "glcpp/glcpp-lex.l" +{ + return RIGHT_SHIFT; +} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 203 "glcpp/glcpp-lex.l" +{ + return LESS_OR_EQUAL; +} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 207 "glcpp/glcpp-lex.l" +{ + return GREATER_OR_EQUAL; +} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 211 "glcpp/glcpp-lex.l" +{ + return EQUAL; +} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 215 "glcpp/glcpp-lex.l" +{ + return NOT_EQUAL; +} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 219 "glcpp/glcpp-lex.l" +{ + return AND; +} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 223 "glcpp/glcpp-lex.l" +{ + return OR; +} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 227 "glcpp/glcpp-lex.l" +{ + return PASTE; +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 231 "glcpp/glcpp-lex.l" +{ + return DEFINED; +} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 235 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + return IDENTIFIER; +} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 240 "glcpp/glcpp-lex.l" +{ + return yytext[0]; +} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 244 "glcpp/glcpp-lex.l" +{ + yylval->str = xtalloc_strdup (yyextra, yytext); + return OTHER; +} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 249 "glcpp/glcpp-lex.l" +{ + if (yyextra->space_tokens) { + return SPACE; + } +} + YY_BREAK +case 38: +/* rule 38 can match eol */ +YY_RULE_SETUP +#line 255 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 0; + yylineno++; + yycolumn = 0; + return NEWLINE; +} + YY_BREAK +/* Handle missing newline at EOF. */ +case YY_STATE_EOF(INITIAL): +#line 263 "glcpp/glcpp-lex.l" +{ + BEGIN DONE; /* Don't keep matching this rule forever. */ + yyextra->lexing_if = 0; + return NEWLINE; +} + YY_BREAK +/* We don't actually use the UNREACHABLE start condition. We + only have this action here so that we can pretend to call some + generated functions, (to avoid "defined but not used" + warnings. */ +case 39: +YY_RULE_SETUP +#line 273 "glcpp/glcpp-lex.l" +{ + unput('.'); + yy_top_state(yyextra); +} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 278 "glcpp/glcpp-lex.l" +ECHO; + YY_BREAK +#line 1434 "glcpp/glcpp-lex.c" + case YY_STATE_EOF(DONE): + case YY_STATE_EOF(COMMENT): + case YY_STATE_EOF(UNREACHABLE): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * glcpp_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( glcpp_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of glcpp_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + glcpp_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + yyg->yy_state_ptr = yyg->yy_state_buf; + *yyg->yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 150 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yyg->yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 150 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 149); + if ( ! yy_is_jam ) + *yyg->yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + glcpp_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( glcpp_wrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void glcpp_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + glcpp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + glcpp__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * glcpp_pop_buffer_state(); + * glcpp_push_buffer_state(new_buffer); + */ + glcpp_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + glcpp__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (glcpp_wrap()) processing, but the only time this flag + * is looked at is after glcpp_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void glcpp__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + glcpp__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with glcpp__create_buffer() + * @param yyscanner The scanner object. + */ + void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + glcpp_free((void *) b->yy_ch_buf ,yyscanner ); + + glcpp_free((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a glcpp_restart() or at EOF. + */ + static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + glcpp__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then glcpp__init_buffer was _probably_ + * called from glcpp_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + glcpp__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + glcpp_ensure_buffer_stack(yyscanner); + + /* This block is copied from glcpp__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from glcpp__switch_to_buffer. */ + glcpp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void glcpp_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + glcpp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + glcpp__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to glcpp_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * glcpp__scan_bytes() instead. + */ +YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) glcpp_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = glcpp__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + static int yy_top_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int glcpp_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int glcpp_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *glcpp_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *glcpp_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int glcpp_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *glcpp_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void glcpp_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void glcpp_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see glcpp__switch_to_buffer + */ +void glcpp_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void glcpp_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int glcpp_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void glcpp_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * glcpp_get_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* glcpp_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int glcpp_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to glcpp_alloc in + * the yyextra field. + */ + +int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + glcpp_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + glcpp_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from glcpp_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + + yyg->yy_state_buf = 0; + yyg->yy_state_ptr = 0; + yyg->yy_full_match = 0; + yyg->yy_lp = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * glcpp_lex_init() + */ + return 0; +} + +/* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */ +int glcpp_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + glcpp_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + glcpp_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + glcpp_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + glcpp_free ( yyg->yy_state_buf , yyscanner); + yyg->yy_state_buf = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * glcpp_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + glcpp_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void glcpp_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 278 "glcpp/glcpp-lex.l" + + + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) +{ + glcpp__scan_string(shader,parser->scanner); +} + diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c new file mode 100644 index 0000000000..2f08ff8112 --- /dev/null +++ b/src/glsl/glcpp/glcpp-parse.c @@ -0,0 +1,3957 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "glcpp/glcpp-parse.y" + +/* + * 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 +#include +#include +#include + +#include "glcpp.h" +#include "main/mtypes.h" + +#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) +#define glcpp_printf(stream, fmt, args...) \ + stream = talloc_asprintf_append(stream, fmt, args) + +static void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); + +static void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + token_list_t *replacements); + +static void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + string_list_t *parameters, + token_list_t *replacements); + +static string_list_t * +_string_list_create (void *ctx); + +static void +_string_list_append_item (string_list_t *list, const char *str); + +static int +_string_list_contains (string_list_t *list, const char *member, int *index); + +static int +_string_list_length (string_list_t *list); + +static argument_list_t * +_argument_list_create (void *ctx); + +static void +_argument_list_append (argument_list_t *list, token_list_t *argument); + +static int +_argument_list_length (argument_list_t *list); + +static token_list_t * +_argument_list_member_at (argument_list_t *list, int index); + +/* Note: This function talloc_steal()s the str pointer. */ +static token_t * +_token_create_str (void *ctx, int type, char *str); + +static token_t * +_token_create_ival (void *ctx, int type, int ival); + +static token_list_t * +_token_list_create (void *ctx); + +/* Note: This function adds a talloc_reference() to token. + * + * You may want to talloc_unlink any current reference if you no + * longer need it. */ +static void +_token_list_append (token_list_t *list, token_t *token); + +static void +_token_list_append_list (token_list_t *list, token_list_t *tail); + +static active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker); + +static active_list_t * +_active_list_pop (active_list_t *list); + +int +_active_list_contains (active_list_t *list, const char *identifier); + +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition); + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition); + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc); + +#define yylex glcpp_parser_lex + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); + + + +/* Line 189 of yacc.c */ +#line 210 "glcpp/glcpp-parse.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + COMMA_FINAL = 258, + DEFINED = 259, + ELIF_EXPANDED = 260, + HASH = 261, + HASH_DEFINE_FUNC = 262, + HASH_DEFINE_OBJ = 263, + HASH_ELIF = 264, + HASH_ELSE = 265, + HASH_ENDIF = 266, + HASH_IF = 267, + HASH_IFDEF = 268, + HASH_IFNDEF = 269, + HASH_UNDEF = 270, + IDENTIFIER = 271, + IF_EXPANDED = 272, + INTEGER = 273, + INTEGER_STRING = 274, + NEWLINE = 275, + OTHER = 276, + PLACEHOLDER = 277, + SPACE = 278, + PASTE = 279, + OR = 280, + AND = 281, + NOT_EQUAL = 282, + EQUAL = 283, + GREATER_OR_EQUAL = 284, + LESS_OR_EQUAL = 285, + RIGHT_SHIFT = 286, + LEFT_SHIFT = 287, + UNARY = 288 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 297 "glcpp/glcpp-parse.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 673 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 56 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 16 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 98 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 157 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 288 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 46, 2, 2, 2, 42, 29, 2, + 44, 45, 40, 38, 48, 39, 53, 41, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 54, + 32, 55, 33, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 49, 2, 50, 28, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 51, 27, 52, 47, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 30, 31, 34, 35, 36, 37, 43 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 4, 7, 9, 11, 13, 16, 20, + 24, 29, 36, 44, 48, 52, 57, 62, 66, 69, + 72, 75, 78, 80, 82, 86, 90, 94, 98, 102, + 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, + 146, 150, 154, 157, 160, 163, 166, 170, 172, 176, + 178, 181, 184, 185, 187, 188, 190, 193, 198, 200, + 202, 205, 207, 210, 212, 214, 216, 218, 220, 222, + 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, + 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, + 264, 266, 268, 270, 272, 274, 276, 278, 280 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 57, 0, -1, -1, 57, 58, -1, 60, -1, 63, + -1, 59, -1, 6, 64, -1, 17, 61, 20, -1, + 5, 61, 20, -1, 8, 16, 65, 20, -1, 7, + 16, 44, 45, 65, 20, -1, 7, 16, 44, 62, + 45, 65, 20, -1, 15, 16, 20, -1, 12, 68, + 20, -1, 13, 16, 66, 20, -1, 14, 16, 66, + 20, -1, 9, 68, 20, -1, 9, 20, -1, 10, + 20, -1, 11, 20, -1, 6, 20, -1, 19, -1, + 18, -1, 61, 25, 61, -1, 61, 26, 61, -1, + 61, 27, 61, -1, 61, 28, 61, -1, 61, 29, + 61, -1, 61, 30, 61, -1, 61, 31, 61, -1, + 61, 34, 61, -1, 61, 35, 61, -1, 61, 33, + 61, -1, 61, 32, 61, -1, 61, 36, 61, -1, + 61, 37, 61, -1, 61, 39, 61, -1, 61, 38, + 61, -1, 61, 42, 61, -1, 61, 41, 61, -1, + 61, 40, 61, -1, 46, 61, -1, 47, 61, -1, + 39, 61, -1, 38, 61, -1, 44, 61, 45, -1, + 16, -1, 62, 48, 16, -1, 20, -1, 69, 20, + -1, 69, 20, -1, -1, 69, -1, -1, 69, -1, + 4, 16, -1, 4, 44, 16, 45, -1, 70, -1, + 67, -1, 68, 67, -1, 70, -1, 69, 70, -1, + 16, -1, 19, -1, 71, -1, 21, -1, 23, -1, + 49, -1, 50, -1, 44, -1, 45, -1, 51, -1, + 52, -1, 53, -1, 29, -1, 40, -1, 38, -1, + 39, -1, 47, -1, 46, -1, 41, -1, 42, -1, + 37, -1, 36, -1, 32, -1, 33, -1, 35, -1, + 34, -1, 31, -1, 30, -1, 28, -1, 27, -1, + 26, -1, 25, -1, 54, -1, 48, -1, 55, -1, + 24, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 166, 166, 168, 172, 175, 180, 181, 185, 188, + 194, 197, 200, 203, 211, 223, 228, 233, 245, 256, + 259, 262, 266, 275, 278, 281, 284, 287, 290, 293, + 296, 299, 302, 305, 308, 311, 314, 317, 320, 323, + 326, 329, 332, 335, 338, 341, 344, 350, 355, 363, + 364, 368, 374, 375, 378, 380, 387, 391, 395, 400, + 406, 414, 420, 428, 432, 436, 440, 444, 451, 452, + 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 479, 480, 481 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "COMMA_FINAL", "DEFINED", + "ELIF_EXPANDED", "HASH", "HASH_DEFINE_FUNC", "HASH_DEFINE_OBJ", + "HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF", "HASH_IFDEF", + "HASH_IFNDEF", "HASH_UNDEF", "IDENTIFIER", "IF_EXPANDED", "INTEGER", + "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", "PASTE", + "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'", "'>'", + "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT", "'+'", + "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", "','", + "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", "input", + "line", "expanded_line", "control_line", "expression", "identifier_list", + "text_line", "non_directive", "replacement_list", "junk", + "conditional_token", "conditional_tokens", "pp_tokens", + "preprocessing_token", "operator", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 124, 94, 38, + 282, 283, 60, 62, 284, 285, 286, 287, 43, 45, + 42, 47, 37, 288, 40, 41, 33, 126, 44, 91, + 93, 123, 125, 46, 59, 61 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 56, 57, 57, 58, 58, 58, 58, 59, 59, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 62, 62, 63, + 63, 64, 65, 65, 66, 66, 67, 67, 67, 68, + 68, 69, 69, 70, 70, 70, 70, 70, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 1, 1, 2, 3, 3, + 4, 6, 7, 3, 3, 4, 4, 3, 2, 2, + 2, 2, 1, 1, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 2, 2, 2, 2, 3, 1, 3, 1, + 2, 2, 0, 1, 0, 1, 2, 4, 1, 1, + 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 63, 0, 64, 49, 66, 67, + 98, 94, 93, 92, 91, 75, 90, 89, 85, 86, + 88, 87, 84, 83, 77, 78, 76, 81, 82, 70, + 71, 80, 79, 96, 68, 69, 72, 73, 74, 95, + 97, 3, 6, 4, 5, 0, 61, 65, 23, 22, + 0, 0, 0, 0, 0, 0, 21, 7, 0, 0, + 52, 0, 18, 59, 0, 58, 19, 20, 0, 54, + 54, 0, 0, 50, 62, 45, 44, 0, 42, 43, + 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 0, 0, 53, 56, 0, 17, 60, 14, 0, 55, + 0, 13, 8, 46, 24, 25, 26, 27, 28, 29, + 30, 34, 33, 31, 32, 35, 36, 38, 37, 41, + 40, 39, 47, 52, 0, 10, 0, 15, 16, 0, + 52, 0, 57, 11, 0, 48, 12 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 51, 52, 53, 65, 144, 54, 67, 111, + 118, 73, 74, 112, 56, 57 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -120 +static const yytype_int16 yypact[] = +{ + -120, 108, -120, -17, 356, -9, 9, 160, -15, 6, + 316, 17, 18, 29, -120, -17, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, + -120, -120, -120, -120, -120, 396, -120, -120, -120, -120, + -17, -17, -17, -17, -17, 512, -120, -120, 436, 2, + 476, -8, -120, -120, 212, -120, -120, -120, 264, 476, + 476, 39, 535, -120, -120, -120, -120, 553, -120, -120, + -120, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -120, + -10, 40, 476, -120, 49, -120, -120, -120, 46, 476, + 48, -120, -120, -120, 573, 589, 604, 618, 631, -23, + -23, 1, 1, 1, 1, 16, 16, 22, 22, -120, + -120, -120, -120, 476, -1, -120, 24, -120, -120, 50, + 476, 56, -120, -120, 53, -120, -120 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -120, -120, -120, -120, -120, -11, -120, -120, -120, -119, + -6, -46, 65, 19, -7, -120 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 75, 58, 59, 75, 82, 76, 142, 69, 113, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 55, 60, 61, 68, 149, 70, 77, 62, 116, 63, + 64, 154, 116, 79, 80, 143, 114, 102, 103, 104, + 105, 106, 107, 108, 150, 81, 110, 151, 84, 85, + 86, 87, 88, 89, 104, 105, 106, 107, 108, 121, + 145, 84, 106, 107, 108, 146, 147, 75, 148, 152, + 153, 75, 155, 156, 120, 78, 0, 0, 0, 0, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 119, 119, + 0, 0, 0, 0, 0, 84, 0, 0, 2, 0, + 0, 0, 84, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 0, 16, 17, 18, + 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 0, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 71, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 0, 0, 16, + 72, 18, 0, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 0, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 71, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, + 0, 16, 115, 18, 0, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 0, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 71, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 0, 0, 16, 117, 18, 0, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 0, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 0, 0, 16, 0, 18, 0, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 14, 0, 0, 16, 66, 18, 0, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 14, 0, 0, 16, 83, 18, 0, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 14, 0, 0, 16, 109, 18, 0, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 14, 0, 0, 16, 0, 18, 0, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 90, 0, 0, 0, 0, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 122, 0, 0, 0, 0, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 0, 0, 123, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108 +}; + +static const yytype_int16 yycheck[] = +{ + 7, 18, 19, 10, 15, 20, 16, 16, 16, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 1, 38, 39, 4, 143, 16, 20, 44, 74, 46, + 47, 150, 78, 16, 16, 45, 44, 36, 37, 38, + 39, 40, 41, 42, 45, 16, 44, 48, 55, 60, + 61, 62, 63, 64, 38, 39, 40, 41, 42, 20, + 20, 68, 40, 41, 42, 16, 20, 74, 20, 45, + 20, 78, 16, 20, 80, 10, -1, -1, -1, -1, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 79, 80, + -1, -1, -1, -1, -1, 112, -1, -1, 0, -1, + -1, -1, 119, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, 21, + -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, -1, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 4, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 16, -1, -1, 19, + 20, 21, -1, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, -1, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 4, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, + -1, 19, 20, 21, -1, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, -1, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 4, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 16, -1, -1, 19, 20, 21, -1, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, -1, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 16, -1, -1, 19, -1, 21, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 16, -1, -1, 19, -1, 21, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 20, -1, -1, -1, -1, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 20, -1, -1, -1, -1, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, -1, -1, 45, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 57, 0, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 19, 20, 21, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 58, 59, 60, 63, 69, 70, 71, 18, 19, + 38, 39, 44, 46, 47, 61, 20, 64, 69, 16, + 16, 4, 20, 67, 68, 70, 20, 20, 68, 16, + 16, 16, 61, 20, 70, 61, 61, 61, 61, 61, + 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 20, + 44, 65, 69, 16, 44, 20, 67, 20, 66, 69, + 66, 20, 20, 45, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 16, 45, 62, 20, 16, 20, 20, 65, + 45, 48, 45, 20, 65, 16, 20 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, parser, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, parser) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, parser); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + glcpp_parser_t *parser; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (parser); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, parser) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + glcpp_parser_t *parser; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, glcpp_parser_t *parser) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, parser) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + glcpp_parser_t *parser; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , parser); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, parser); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, glcpp_parser_t *parser) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, parser) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + glcpp_parser_t *parser; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (parser); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (glcpp_parser_t *parser); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (glcpp_parser_t *parser) +#else +int +yyparse (parser) + glcpp_parser_t *parser; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: + +/* Line 1455 of yacc.c */ +#line 172 "glcpp/glcpp-parse.y" + { + glcpp_print(parser->output, "\n"); + ;} + break; + + case 5: + +/* Line 1455 of yacc.c */ +#line 175 "glcpp/glcpp-parse.y" + { + _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); + glcpp_print(parser->output, "\n"); + talloc_free ((yyvsp[(1) - (1)].token_list)); + ;} + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 185 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 188 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 10: + +/* Line 1455 of yacc.c */ +#line 194 "glcpp/glcpp-parse.y" + { + _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); + ;} + break; + + case 11: + +/* Line 1455 of yacc.c */ +#line 197 "glcpp/glcpp-parse.y" + { + _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); + ;} + break; + + case 12: + +/* Line 1455 of yacc.c */ +#line 200 "glcpp/glcpp-parse.y" + { + _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); + ;} + break; + + case 13: + +/* Line 1455 of yacc.c */ +#line 203 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); + if (macro) { + hash_table_remove (parser->defines, (yyvsp[(2) - (3)].str)); + talloc_free (macro); + } + talloc_free ((yyvsp[(2) - (3)].str)); + ;} + break; + + case 14: + +/* Line 1455 of yacc.c */ +#line 211 "glcpp/glcpp-parse.y" + { + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, IF_EXPANDED, IF_EXPANDED); + _token_list_append (expanded, token); + talloc_unlink (parser, token); + _glcpp_parser_expand_token_list (parser, (yyvsp[(2) - (3)].token_list)); + _token_list_append_list (expanded, (yyvsp[(2) - (3)].token_list)); + glcpp_parser_lex_from (parser, expanded); + ;} + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 223 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); + talloc_free ((yyvsp[(2) - (4)].str)); + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro != NULL); + ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 228 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); + talloc_free ((yyvsp[(2) - (4)].str)); + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro == NULL); + ;} + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 233 "glcpp/glcpp-parse.y" + { + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, ELIF_EXPANDED, ELIF_EXPANDED); + _token_list_append (expanded, token); + talloc_unlink (parser, token); + _glcpp_parser_expand_token_list (parser, (yyvsp[(2) - (3)].token_list)); + _token_list_append_list (expanded, (yyvsp[(2) - (3)].token_list)); + glcpp_parser_lex_from (parser, expanded); + ;} + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 245 "glcpp/glcpp-parse.y" + { + /* #elif without an expression results in a warning if the + * condition doesn't matter (we just handled #if 1 or such) + * but an error otherwise. */ + if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) { + parser->skip_stack->type = SKIP_TO_ENDIF; + glcpp_warning(& (yylsp[(1) - (2)]), parser, "ignoring illegal #elif without expression"); + } else { + glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif needs an expression"); + } + ;} + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 256 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); + ;} + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 259 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); + ;} + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 266 "glcpp/glcpp-parse.y" + { + if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); + } else if ((yyvsp[(1) - (1)].str)[0] == '0') { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 8); + } else { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 10); + } + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 275 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (1)].ival); + ;} + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 278 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); + ;} + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 281 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); + ;} + break; + + case 26: + +/* Line 1455 of yacc.c */ +#line 284 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); + ;} + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 287 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); + ;} + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 290 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); + ;} + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 293 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); + ;} + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 296 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); + ;} + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 299 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); + ;} + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 302 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 305 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); + ;} + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 308 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); + ;} + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 311 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); + ;} + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 314 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); + ;} + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 317 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); + ;} + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 320 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); + ;} + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 323 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); + ;} + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 326 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); + ;} + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 329 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); + ;} + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 332 "glcpp/glcpp-parse.y" + { + (yyval.ival) = ! (yyvsp[(2) - (2)].ival); + ;} + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 335 "glcpp/glcpp-parse.y" + { + (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); + ;} + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 338 "glcpp/glcpp-parse.y" + { + (yyval.ival) = - (yyvsp[(2) - (2)].ival); + ;} + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 341 "glcpp/glcpp-parse.y" + { + (yyval.ival) = + (yyvsp[(2) - (2)].ival); + ;} + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 344 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(2) - (3)].ival); + ;} + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 350 "glcpp/glcpp-parse.y" + { + (yyval.string_list) = _string_list_create (parser); + _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); + talloc_steal ((yyval.string_list), (yyvsp[(1) - (1)].str)); + ;} + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 355 "glcpp/glcpp-parse.y" + { + (yyval.string_list) = (yyvsp[(1) - (3)].string_list); + _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); + talloc_steal ((yyval.string_list), (yyvsp[(3) - (3)].str)); + ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 363 "glcpp/glcpp-parse.y" + { (yyval.token_list) = NULL; ;} + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 368 "glcpp/glcpp-parse.y" + { + yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); + ;} + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 374 "glcpp/glcpp-parse.y" + { (yyval.token_list) = NULL; ;} + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 380 "glcpp/glcpp-parse.y" + { + glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); + ;} + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 387 "glcpp/glcpp-parse.y" + { + int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; + (yyval.token) = _token_create_ival (parser, INTEGER, v); + ;} + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 391 "glcpp/glcpp-parse.y" + { + int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; + (yyval.token) = _token_create_ival (parser, INTEGER, v); + ;} + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 400 "glcpp/glcpp-parse.y" + { + parser->space_tokens = 1; + (yyval.token_list) = _token_list_create (parser); + _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); + talloc_unlink (parser, (yyvsp[(1) - (1)].token)); + ;} + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 406 "glcpp/glcpp-parse.y" + { + (yyval.token_list) = (yyvsp[(1) - (2)].token_list); + _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); + talloc_unlink (parser, (yyvsp[(2) - (2)].token)); + ;} + break; + + case 61: + +/* Line 1455 of yacc.c */ +#line 414 "glcpp/glcpp-parse.y" + { + parser->space_tokens = 1; + (yyval.token_list) = _token_list_create (parser); + _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); + talloc_unlink (parser, (yyvsp[(1) - (1)].token)); + ;} + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 420 "glcpp/glcpp-parse.y" + { + (yyval.token_list) = (yyvsp[(1) - (2)].token_list); + _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); + talloc_unlink (parser, (yyvsp[(2) - (2)].token)); + ;} + break; + + case 63: + +/* Line 1455 of yacc.c */ +#line 428 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 64: + +/* Line 1455 of yacc.c */ +#line 432 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 65: + +/* Line 1455 of yacc.c */ +#line 436 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); + (yyval.token)->location = yylloc; + ;} + break; + + case 66: + +/* Line 1455 of yacc.c */ +#line 440 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 444 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_ival (parser, SPACE, SPACE); + (yyval.token)->location = yylloc; + ;} + break; + + case 68: + +/* Line 1455 of yacc.c */ +#line 451 "glcpp/glcpp-parse.y" + { (yyval.ival) = '['; ;} + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 452 "glcpp/glcpp-parse.y" + { (yyval.ival) = ']'; ;} + break; + + case 70: + +/* Line 1455 of yacc.c */ +#line 453 "glcpp/glcpp-parse.y" + { (yyval.ival) = '('; ;} + break; + + case 71: + +/* Line 1455 of yacc.c */ +#line 454 "glcpp/glcpp-parse.y" + { (yyval.ival) = ')'; ;} + break; + + case 72: + +/* Line 1455 of yacc.c */ +#line 455 "glcpp/glcpp-parse.y" + { (yyval.ival) = '{'; ;} + break; + + case 73: + +/* Line 1455 of yacc.c */ +#line 456 "glcpp/glcpp-parse.y" + { (yyval.ival) = '}'; ;} + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 457 "glcpp/glcpp-parse.y" + { (yyval.ival) = '.'; ;} + break; + + case 75: + +/* Line 1455 of yacc.c */ +#line 458 "glcpp/glcpp-parse.y" + { (yyval.ival) = '&'; ;} + break; + + case 76: + +/* Line 1455 of yacc.c */ +#line 459 "glcpp/glcpp-parse.y" + { (yyval.ival) = '*'; ;} + break; + + case 77: + +/* Line 1455 of yacc.c */ +#line 460 "glcpp/glcpp-parse.y" + { (yyval.ival) = '+'; ;} + break; + + case 78: + +/* Line 1455 of yacc.c */ +#line 461 "glcpp/glcpp-parse.y" + { (yyval.ival) = '-'; ;} + break; + + case 79: + +/* Line 1455 of yacc.c */ +#line 462 "glcpp/glcpp-parse.y" + { (yyval.ival) = '~'; ;} + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 463 "glcpp/glcpp-parse.y" + { (yyval.ival) = '!'; ;} + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 464 "glcpp/glcpp-parse.y" + { (yyval.ival) = '/'; ;} + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 465 "glcpp/glcpp-parse.y" + { (yyval.ival) = '%'; ;} + break; + + case 83: + +/* Line 1455 of yacc.c */ +#line 466 "glcpp/glcpp-parse.y" + { (yyval.ival) = LEFT_SHIFT; ;} + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 467 "glcpp/glcpp-parse.y" + { (yyval.ival) = RIGHT_SHIFT; ;} + break; + + case 85: + +/* Line 1455 of yacc.c */ +#line 468 "glcpp/glcpp-parse.y" + { (yyval.ival) = '<'; ;} + break; + + case 86: + +/* Line 1455 of yacc.c */ +#line 469 "glcpp/glcpp-parse.y" + { (yyval.ival) = '>'; ;} + break; + + case 87: + +/* Line 1455 of yacc.c */ +#line 470 "glcpp/glcpp-parse.y" + { (yyval.ival) = LESS_OR_EQUAL; ;} + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 471 "glcpp/glcpp-parse.y" + { (yyval.ival) = GREATER_OR_EQUAL; ;} + break; + + case 89: + +/* Line 1455 of yacc.c */ +#line 472 "glcpp/glcpp-parse.y" + { (yyval.ival) = EQUAL; ;} + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 473 "glcpp/glcpp-parse.y" + { (yyval.ival) = NOT_EQUAL; ;} + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 474 "glcpp/glcpp-parse.y" + { (yyval.ival) = '^'; ;} + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 475 "glcpp/glcpp-parse.y" + { (yyval.ival) = '|'; ;} + break; + + case 93: + +/* Line 1455 of yacc.c */ +#line 476 "glcpp/glcpp-parse.y" + { (yyval.ival) = AND; ;} + break; + + case 94: + +/* Line 1455 of yacc.c */ +#line 477 "glcpp/glcpp-parse.y" + { (yyval.ival) = OR; ;} + break; + + case 95: + +/* Line 1455 of yacc.c */ +#line 478 "glcpp/glcpp-parse.y" + { (yyval.ival) = ';'; ;} + break; + + case 96: + +/* Line 1455 of yacc.c */ +#line 479 "glcpp/glcpp-parse.y" + { (yyval.ival) = ','; ;} + break; + + case 97: + +/* Line 1455 of yacc.c */ +#line 480 "glcpp/glcpp-parse.y" + { (yyval.ival) = '='; ;} + break; + + case 98: + +/* Line 1455 of yacc.c */ +#line 481 "glcpp/glcpp-parse.y" + { (yyval.ival) = PASTE; ;} + break; + + + +/* Line 1455 of yacc.c */ +#line 2570 "glcpp/glcpp-parse.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, parser, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, parser, yymsg); + } + else + { + yyerror (&yylloc, parser, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[0] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, parser); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[0] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[0] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, parser); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[1] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, parser, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, parser); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, parser); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 484 "glcpp/glcpp-parse.y" + + +string_list_t * +_string_list_create (void *ctx) +{ + string_list_t *list; + + list = xtalloc (ctx, string_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_string_list_append_item (string_list_t *list, const char *str) +{ + string_node_t *node; + + node = xtalloc (list, string_node_t); + node->str = xtalloc_strdup (node, str); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_string_list_contains (string_list_t *list, const char *member, int *index) +{ + string_node_t *node; + int i; + + if (list == NULL) + return 0; + + for (i = 0, node = list->head; node; i++, node = node->next) { + if (strcmp (node->str, member) == 0) { + if (index) + *index = i; + return 1; + } + } + + return 0; +} + +int +_string_list_length (string_list_t *list) +{ + int length = 0; + string_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +argument_list_t * +_argument_list_create (void *ctx) +{ + argument_list_t *list; + + list = xtalloc (ctx, argument_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_argument_list_append (argument_list_t *list, token_list_t *argument) +{ + argument_node_t *node; + + node = xtalloc (list, argument_node_t); + node->argument = argument; + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_argument_list_length (argument_list_t *list) +{ + int length = 0; + argument_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +token_list_t * +_argument_list_member_at (argument_list_t *list, int index) +{ + argument_node_t *node; + int i; + + if (list == NULL) + return NULL; + + node = list->head; + for (i = 0; i < index; i++) { + node = node->next; + if (node == NULL) + break; + } + + if (node) + return node->argument; + + return NULL; +} + +/* Note: This function talloc_steal()s the str pointer. */ +token_t * +_token_create_str (void *ctx, int type, char *str) +{ + token_t *token; + + token = xtalloc (ctx, token_t); + token->type = type; + token->value.str = talloc_steal (token, str); + + return token; +} + +token_t * +_token_create_ival (void *ctx, int type, int ival) +{ + token_t *token; + + token = xtalloc (ctx, token_t); + token->type = type; + token->value.ival = ival; + + return token; +} + +token_list_t * +_token_list_create (void *ctx) +{ + token_list_t *list; + + list = xtalloc (ctx, token_list_t); + list->head = NULL; + list->tail = NULL; + list->non_space_tail = NULL; + + return list; +} + +void +_token_list_append (token_list_t *list, token_t *token) +{ + token_node_t *node; + + node = xtalloc (list, token_node_t); + node->token = xtalloc_reference (list, token); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; + if (token->type != SPACE) + list->non_space_tail = node; +} + +void +_token_list_append_list (token_list_t *list, token_list_t *tail) +{ + if (tail == NULL || tail->head == NULL) + return; + + if (list->head == NULL) { + list->head = tail->head; + } else { + list->tail->next = tail->head; + } + + list->tail = tail->tail; + list->non_space_tail = tail->non_space_tail; +} + +static token_list_t * +_token_list_copy (void *ctx, token_list_t *other) +{ + token_list_t *copy; + token_node_t *node; + + if (other == NULL) + return NULL; + + copy = _token_list_create (ctx); + for (node = other->head; node; node = node->next) + _token_list_append (copy, node->token); + + return copy; +} + +static void +_token_list_trim_trailing_space (token_list_t *list) +{ + token_node_t *tail, *next; + + if (list->non_space_tail) { + tail = list->non_space_tail->next; + list->non_space_tail->next = NULL; + list->tail = list->non_space_tail; + + while (tail) { + next = tail->next; + talloc_free (tail); + tail = next; + } + } +} + +static void +_token_print (char **out, token_t *token) +{ + if (token->type < 256) { + glcpp_printf (*out, "%c", token->type); + return; + } + + switch (token->type) { + case INTEGER: + glcpp_printf (*out, "%" PRIxMAX, token->value.ival); + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + glcpp_print (*out, token->value.str); + break; + case SPACE: + glcpp_print (*out, " "); + break; + case LEFT_SHIFT: + glcpp_print (*out, "<<"); + break; + case RIGHT_SHIFT: + glcpp_print (*out, ">>"); + break; + case LESS_OR_EQUAL: + glcpp_print (*out, "<="); + break; + case GREATER_OR_EQUAL: + glcpp_print (*out, ">="); + break; + case EQUAL: + glcpp_print (*out, "=="); + break; + case NOT_EQUAL: + glcpp_print (*out, "!="); + break; + case AND: + glcpp_print (*out, "&&"); + break; + case OR: + glcpp_print (*out, "||"); + break; + case PASTE: + glcpp_print (*out, "##"); + break; + case COMMA_FINAL: + glcpp_print (*out, ","); + break; + case PLACEHOLDER: + /* Nothing to print. */ + break; + default: + assert(!"Error: Don't know how to print token."); + break; + } +} + +/* Return a new token (talloc()ed off of 'token') formed by pasting + * 'token' and 'other'. Note that this function may return 'token' or + * 'other' directly rather than allocating anything new. + * + * Caution: Only very cursory error-checking is performed to see if + * the final result is a valid single token. */ +static token_t * +_token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) +{ + token_t *combined = NULL; + + /* Pasting a placeholder onto anything makes no change. */ + if (other->type == PLACEHOLDER) + return token; + + /* When 'token' is a placeholder, just return 'other'. */ + if (token->type == PLACEHOLDER) + return other; + + /* A very few single-character punctuators can be combined + * with another to form a multi-character punctuator. */ + switch (token->type) { + case '<': + if (other->type == '<') + combined = _token_create_ival (token, LEFT_SHIFT, LEFT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, LESS_OR_EQUAL, LESS_OR_EQUAL); + break; + case '>': + if (other->type == '>') + combined = _token_create_ival (token, RIGHT_SHIFT, RIGHT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, GREATER_OR_EQUAL, GREATER_OR_EQUAL); + break; + case '=': + if (other->type == '=') + combined = _token_create_ival (token, EQUAL, EQUAL); + break; + case '!': + if (other->type == '=') + combined = _token_create_ival (token, NOT_EQUAL, NOT_EQUAL); + break; + case '&': + if (other->type == '&') + combined = _token_create_ival (token, AND, AND); + break; + case '|': + if (other->type == '|') + combined = _token_create_ival (token, OR, OR); + break; + } + + if (combined != NULL) { + /* Inherit the location from the first token */ + combined->location = token->location; + return combined; + } + + /* Two string-valued tokens can usually just be mashed + * together. + * + * XXX: This isn't actually legitimate. Several things here + * should result in a diagnostic since the result cannot be a + * valid, single pre-processing token. For example, pasting + * "123" and "abc" is not legal, but we don't catch that + * here. */ + if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) && + (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING)) + { + char *str; + + str = xtalloc_asprintf (token, "%s%s", + token->value.str, other->value.str); + combined = _token_create_str (token, token->type, str); + combined->location = token->location; + return combined; + } + + glcpp_error (&token->location, parser, ""); + glcpp_print (parser->info_log, "Pasting \""); + _token_print (&parser->info_log, token); + glcpp_print (parser->info_log, "\" and \""); + _token_print (&parser->info_log, other); + glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + + return token; +} + +static void +_token_list_print (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + if (list == NULL) + return; + + for (node = list->head; node; node = node->next) + _token_print (&parser->output, node->token); +} + +void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) +{ + glcpp_error(locp, parser, "%s", error); +} + +glcpp_parser_t * +glcpp_parser_create (const struct gl_extensions *extensions) +{ + glcpp_parser_t *parser; + token_t *tok; + token_list_t *list; + + parser = xtalloc (NULL, glcpp_parser_t); + + glcpp_lex_init_extra (parser, &parser->scanner); + parser->defines = hash_table_ctor (32, hash_table_string_hash, + hash_table_string_compare); + parser->active = NULL; + parser->lexing_if = 0; + parser->space_tokens = 1; + parser->newline_as_space = 0; + parser->in_control_line = 0; + parser->paren_count = 0; + + parser->skip_stack = NULL; + + parser->lex_from_list = NULL; + parser->lex_from_node = NULL; + + parser->output = talloc_strdup(parser, ""); + parser->info_log = talloc_strdup(parser, ""); + parser->error = 0; + + /* Add pre-defined macros. */ + tok = _token_create_ival (parser, INTEGER, 1); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list); + + if ((extensions != NULL) && extensions->EXT_texture_array) { + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, + "GL_EXT_texture_array", list); + } + + talloc_unlink(parser, tok); + + return parser; +} + +int +glcpp_parser_parse (glcpp_parser_t *parser) +{ + return yyparse (parser); +} + +void +glcpp_parser_destroy (glcpp_parser_t *parser) +{ + if (parser->skip_stack) + glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + glcpp_lex_destroy (parser->scanner); + hash_table_dtor (parser->defines); + talloc_free (parser); +} + +typedef enum function_status +{ + FUNCTION_STATUS_SUCCESS, + FUNCTION_NOT_A_FUNCTION, + FUNCTION_UNBALANCED_PARENTHESES +} function_status_t; + +/* Find a set of function-like macro arguments by looking for a + * balanced set of parentheses. + * + * When called, 'node' should be the opening-parenthesis token, (or + * perhaps preceeding SPACE tokens). Upon successful return *last will + * be the last consumed node, (corresponding to the closing right + * parenthesis). + * + * Return values: + * + * FUNCTION_STATUS_SUCCESS: + * + * Successfully parsed a set of function arguments. + * + * FUNCTION_NOT_A_FUNCTION: + * + * Macro name not followed by a '('. This is not an error, but + * simply that the macro name should be treated as a non-macro. + * + * FUNCTION_UNBALANCED_PARENTHESES + * + * Macro name is not followed by a balanced set of parentheses. + */ +static function_status_t +_arguments_parse (argument_list_t *arguments, + token_node_t *node, + token_node_t **last) +{ + token_list_t *argument; + int paren_count; + + node = node->next; + + /* Ignore whitespace before first parenthesis. */ + while (node && node->token->type == SPACE) + node = node->next; + + if (node == NULL || node->token->type != '(') + return FUNCTION_NOT_A_FUNCTION; + + node = node->next; + + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + + for (paren_count = 1; node; node = node->next) { + if (node->token->type == '(') + { + paren_count++; + } + else if (node->token->type == ')') + { + paren_count--; + if (paren_count == 0) + break; + } + + if (node->token->type == ',' && + paren_count == 1) + { + _token_list_trim_trailing_space (argument); + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + } + else { + if (argument->head == NULL) { + /* Don't treat initial whitespace as + * part of the arguement. */ + if (node->token->type == SPACE) + continue; + } + _token_list_append (argument, node->token); + } + } + + if (paren_count) + return FUNCTION_UNBALANCED_PARENTHESES; + + *last = node; + + return FUNCTION_STATUS_SUCCESS; +} + +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + token_list_t *list; + token_t *space; + + list = _token_list_create (ctx); + space = _token_create_ival (list, SPACE, SPACE); + _token_list_append (list, space); + + return list; +} + +/* This is a helper function that's essentially part of the + * implementation of _glcpp_parser_expand_node. It shouldn't be called + * except for by that function. + * + * Returns NULL if node is a simple token with no expansion, (that is, + * although 'node' corresponds to an identifier defined as a + * function-like macro, it is not followed with a parenthesized + * argument list). + * + * Compute the complete expansion of node (which is a function-like + * macro) and subsequent nodes which are arguments. + * + * Returns the token list that results from the expansion and sets + * *last to the last node in the list that was consumed by the + * expansion. Specifically, *last will be set as follows: as the + * token of the closing right parenthesis. + */ +static token_list_t * +_glcpp_parser_expand_function (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) + +{ + macro_t *macro; + const char *identifier; + argument_list_t *arguments; + function_status_t status; + token_list_t *substituted; + int parameter_index; + + identifier = node->token->value.str; + + macro = hash_table_find (parser->defines, identifier); + + assert (macro->is_function); + + arguments = _argument_list_create (parser); + status = _arguments_parse (arguments, node, last); + + switch (status) { + case FUNCTION_STATUS_SUCCESS: + break; + case FUNCTION_NOT_A_FUNCTION: + return NULL; + case FUNCTION_UNBALANCED_PARENTHESES: + glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier); + return NULL; + } + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) { + talloc_free (arguments); + return _token_list_create_with_one_space (parser); + } + + if (! ((_argument_list_length (arguments) == + _string_list_length (macro->parameters)) || + (_string_list_length (macro->parameters) == 0 && + _argument_list_length (arguments) == 1 && + arguments->head->argument->head == NULL))) + { + glcpp_error (&node->token->location, parser, + "Error: macro %s invoked with %d arguments (expected %d)\n", + identifier, + _argument_list_length (arguments), + _string_list_length (macro->parameters)); + return NULL; + } + + /* Perform argument substitution on the replacement list. */ + substituted = _token_list_create (arguments); + + for (node = macro->replacements->head; node; node = node->next) + { + if (node->token->type == IDENTIFIER && + _string_list_contains (macro->parameters, + node->token->value.str, + ¶meter_index)) + { + token_list_t *argument; + argument = _argument_list_member_at (arguments, + parameter_index); + /* Before substituting, we expand the argument + * tokens, or append a placeholder token for + * an empty argument. */ + if (argument->head) { + token_list_t *expanded_argument; + expanded_argument = _token_list_copy (parser, + argument); + _glcpp_parser_expand_token_list (parser, + expanded_argument); + _token_list_append_list (substituted, + expanded_argument); + } else { + token_t *new_token; + + new_token = _token_create_ival (substituted, + PLACEHOLDER, + PLACEHOLDER); + _token_list_append (substituted, new_token); + } + } else { + _token_list_append (substituted, node->token); + } + } + + /* After argument substitution, and before further expansion + * below, implement token pasting. */ + + _token_list_trim_trailing_space (substituted); + + node = substituted->head; + while (node) + { + token_node_t *next_non_space; + + /* Look ahead for a PASTE token, skipping space. */ + next_non_space = node->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) + break; + + if (next_non_space->token->type != PASTE) { + node = next_non_space; + continue; + } + + /* Now find the next non-space token after the PASTE. */ + next_non_space = next_non_space->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) { + yyerror (&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n"); + return NULL; + } + + node->token = _token_paste (parser, node->token, next_non_space->token); + node->next = next_non_space->next; + if (next_non_space == substituted->tail) + substituted->tail = node; + + node = node->next; + } + + substituted->non_space_tail = substituted->tail; + + return substituted; +} + +/* Compute the complete expansion of node, (and subsequent nodes after + * 'node' in the case that 'node' is a function-like macro and + * subsequent nodes are arguments). + * + * Returns NULL if node is a simple token with no expansion. + * + * Otherwise, returns the token list that results from the expansion + * and sets *last to the last node in the list that was consumed by + * the expansion. Specifically, *last will be set as follows: + * + * As 'node' in the case of object-like macro expansion. + * + * As the token of the closing right parenthesis in the case of + * function-like macro expansion. + */ +static token_list_t * +_glcpp_parser_expand_node (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) +{ + token_t *token = node->token; + const char *identifier; + macro_t *macro; + + /* We only expand identifiers */ + if (token->type != IDENTIFIER) { + /* We change any COMMA into a COMMA_FINAL to prevent + * it being mistaken for an argument separator + * later. */ + if (token->type == ',') { + token->type = COMMA_FINAL; + token->value.ival = COMMA_FINAL; + } + + return NULL; + } + + /* Look up this identifier in the hash table. */ + identifier = token->value.str; + macro = hash_table_find (parser->defines, identifier); + + /* Not a macro, so no expansion needed. */ + if (macro == NULL) + return NULL; + + /* Finally, don't expand this macro if we're already actively + * expanding it, (to avoid infinite recursion). */ + if (_active_list_contains (parser->active, identifier)) { + /* We change the token type here from IDENTIFIER to + * OTHER to prevent any future expansion of this + * unexpanded token. */ + char *str; + token_list_t *expansion; + token_t *final; + + str = xtalloc_strdup (parser, token->value.str); + final = _token_create_str (parser, OTHER, str); + expansion = _token_list_create (parser); + _token_list_append (expansion, final); + *last = node; + return expansion; + } + + if (! macro->is_function) + { + *last = node; + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) + return _token_list_create_with_one_space (parser); + + return _token_list_copy (parser, macro->replacements); + } + + return _glcpp_parser_expand_function (parser, node, last); +} + +/* Push a new identifier onto the active list, returning the new list. + * + * Here, 'marker' is the token node that appears in the list after the + * expansion of 'identifier'. That is, when the list iterator begins + * examinging 'marker', then it is time to pop this node from the + * active stack. + */ +active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker) +{ + active_list_t *node; + + node = xtalloc (list, active_list_t); + node->identifier = xtalloc_strdup (node, identifier); + node->marker = marker; + node->next = list; + + return node; +} + +active_list_t * +_active_list_pop (active_list_t *list) +{ + active_list_t *node = list; + + if (node == NULL) + return NULL; + + node = list->next; + talloc_free (list); + + return node; +} + +int +_active_list_contains (active_list_t *list, const char *identifier) +{ + active_list_t *node; + + if (list == NULL) + return 0; + + for (node = list; node; node = node->next) + if (strcmp (node->identifier, identifier) == 0) + return 1; + + return 0; +} + +/* Walk over the token list replacing nodes with their expansion. + * Whenever nodes are expanded the walking will walk over the new + * nodes, continuing to expand as necessary. The results are placed in + * 'list' itself; + */ +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + token_node_t *node_prev; + token_node_t *node, *last = NULL; + token_list_t *expansion; + + if (list == NULL) + return; + + _token_list_trim_trailing_space (list); + + node_prev = NULL; + node = list->head; + + while (node) { + + while (parser->active && parser->active->marker == node) + parser->active = _active_list_pop (parser->active); + + /* Find the expansion for node, which will replace all + * nodes from node to last, inclusive. */ + expansion = _glcpp_parser_expand_node (parser, node, &last); + if (expansion) { + token_node_t *n; + + for (n = node; n != last->next; n = n->next) + while (parser->active && + parser->active->marker == n) + { + parser->active = _active_list_pop (parser->active); + } + + parser->active = _active_list_push (parser->active, + node->token->value.str, + last->next); + + /* Splice expansion into list, supporting a + * simple deletion if the expansion is + * empty. */ + if (expansion->head) { + if (node_prev) + node_prev->next = expansion->head; + else + list->head = expansion->head; + expansion->tail->next = last->next; + if (last == list->tail) + list->tail = expansion->tail; + } else { + if (node_prev) + node_prev->next = last->next; + else + list->head = last->next; + if (last == list->tail) + list->tail = NULL; + } + } else { + node_prev = node; + } + node = node_prev ? node_prev->next : list->head; + } + + while (parser->active) + parser->active = _active_list_pop (parser->active); + + list->non_space_tail = list->tail; +} + +void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + if (list == NULL) + return; + + _glcpp_parser_expand_token_list (parser, list); + + _token_list_trim_trailing_space (list); + + _token_list_print (parser, list); +} + +static void +_check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, + const char *identifier) +{ + /* According to the GLSL specification, macro names starting with "__" + * or "GL_" are reserved for future use. So, don't allow them. + */ + if (strncmp(identifier, "__", 2) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n"); + } + if (strncmp(identifier, "GL_", 3) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n"); + } +} + +void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + token_list_t *replacements) +{ + macro_t *macro; + + if (loc != NULL) + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = xtalloc (parser, macro_t); + + macro->is_function = 0; + macro->parameters = NULL; + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + hash_table_insert (parser->defines, macro, identifier); +} + +void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + string_list_t *parameters, + token_list_t *replacements) +{ + macro_t *macro; + + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = xtalloc (parser, macro_t); + + macro->is_function = 1; + macro->parameters = talloc_steal (macro, parameters); + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + hash_table_insert (parser->defines, macro, identifier); +} + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) +{ + token_node_t *node; + int ret; + + if (parser->lex_from_list == NULL) { + ret = glcpp_lex (yylval, yylloc, parser->scanner); + + /* XXX: This ugly block of code exists for the sole + * purpose of converting a NEWLINE token into a SPACE + * token, but only in the case where we have seen a + * function-like macro name, but have not yet seen its + * closing parenthesis. + * + * There's perhaps a more compact way to do this with + * mid-rule actions in the grammar. + * + * I'm definitely not pleased with the complexity of + * this code here. + */ + if (parser->newline_as_space) + { + if (ret == '(') { + parser->paren_count++; + } else if (ret == ')') { + parser->paren_count--; + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } else if (ret == NEWLINE) { + ret = SPACE; + } else if (ret != SPACE) { + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } + } + else if (parser->in_control_line) + { + if (ret == NEWLINE) + parser->in_control_line = 0; + } + else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC || + ret == HASH_UNDEF || ret == HASH_IF || + ret == HASH_IFDEF || ret == HASH_IFNDEF || + ret == HASH_ELIF || ret == HASH_ELSE || + ret == HASH_ENDIF || ret == HASH) + { + parser->in_control_line = 1; + } + else if (ret == IDENTIFIER) + { + macro_t *macro; + macro = hash_table_find (parser->defines, + yylval->str); + if (macro && macro->is_function) { + parser->newline_as_space = 1; + parser->paren_count = 0; + } + } + + return ret; + } + + node = parser->lex_from_node; + + if (node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + return NEWLINE; + } + + *yylval = node->token->value; + ret = node->token->type; + + parser->lex_from_node = node->next; + + return ret; +} + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + assert (parser->lex_from_list == NULL); + + /* Copy list, eliminating any space tokens. */ + parser->lex_from_list = _token_list_create (parser); + + for (node = list->head; node; node = node->next) { + if (node->token->type == SPACE) + continue; + _token_list_append (parser->lex_from_list, node->token); + } + + talloc_free (list); + + parser->lex_from_node = parser->lex_from_list->head; + + /* It's possible the list consisted of nothing but whitespace. */ + if (parser->lex_from_node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + } +} + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition) +{ + skip_type_t current = SKIP_NO_SKIP; + skip_node_t *node; + + if (parser->skip_stack) + current = parser->skip_stack->type; + + node = xtalloc (parser, skip_node_t); + node->loc = *loc; + + if (current == SKIP_NO_SKIP) { + if (condition) + node->type = SKIP_NO_SKIP; + else + node->type = SKIP_TO_ELSE; + } else { + node->type = SKIP_TO_ENDIF; + } + + node->next = parser->skip_stack; + parser->skip_stack = node; +} + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition) +{ + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "%s without #if\n", type); + return; + } + + if (parser->skip_stack->type == SKIP_TO_ELSE) { + if (condition) + parser->skip_stack->type = SKIP_NO_SKIP; + } else { + parser->skip_stack->type = SKIP_TO_ENDIF; + } +} + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) +{ + skip_node_t *node; + + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "#endif without #if\n"); + return; + } + + node = parser->skip_stack; + parser->skip_stack = node->next; + talloc_free (node); +} + diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h new file mode 100644 index 0000000000..6365068ad0 --- /dev/null +++ b/src/glsl/glcpp/glcpp-parse.h @@ -0,0 +1,100 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + COMMA_FINAL = 258, + DEFINED = 259, + ELIF_EXPANDED = 260, + HASH = 261, + HASH_DEFINE_FUNC = 262, + HASH_DEFINE_OBJ = 263, + HASH_ELIF = 264, + HASH_ELSE = 265, + HASH_ENDIF = 266, + HASH_IF = 267, + HASH_IFDEF = 268, + HASH_IFNDEF = 269, + HASH_UNDEF = 270, + IDENTIFIER = 271, + IF_EXPANDED = 272, + INTEGER = 273, + INTEGER_STRING = 274, + NEWLINE = 275, + OTHER = 276, + PLACEHOLDER = 277, + SPACE = 278, + PASTE = 279, + OR = 280, + AND = 281, + NOT_EQUAL = 282, + EQUAL = 283, + GREATER_OR_EQUAL = 284, + LESS_OR_EQUAL = 285, + RIGHT_SHIFT = 286, + LEFT_SHIFT = 287, + UNARY = 288 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + + -- cgit v1.2.3 From a6c7606ab6e2ba8b4fc253e93a83ca2f18a874b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 13:42:36 -0700 Subject: glsl2: Unmark unwritten varyings as varying. This fixes an assertion failure in ir_to_mesa, and the varying won't take up varying space. --- src/glsl/linker.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e7bc700029..ec3cc01d40 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1132,6 +1132,7 @@ assign_varying_locations(gl_shader *producer, gl_shader *consumer) * by the previous stage. */ var->shader_in = (var->location != -1); + var->mode = ir_var_auto; } } -- cgit v1.2.3 From b706283c79de41caf775b0bb15b3c849932f2574 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 13:52:23 -0700 Subject: glsl2: Fail linking where the FS reads a varying that the VS doesn't write. Fixes: glsl1-varying read but not written glsl1-varying var mismatch --- src/glsl/linker.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index ec3cc01d40..fa4fb493f2 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1061,7 +1061,8 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index void -assign_varying_locations(gl_shader *producer, gl_shader *consumer) +assign_varying_locations(struct gl_shader_program *prog, + gl_shader *producer, gl_shader *consumer) { /* FINISHME: Set dynamically when geometry shader support is added. */ unsigned output_index = VERT_RESULT_VAR0; @@ -1128,11 +1129,32 @@ assign_varying_locations(gl_shader *producer, gl_shader *consumer) if ((var == NULL) || (var->mode != ir_var_in)) continue; - /* An 'in' variable is only really a shader input if its value is written - * by the previous stage. - */ - var->shader_in = (var->location != -1); - var->mode = ir_var_auto; + if (var->location == -1) { + if (prog->Version <= 120) { + /* On page 25 (page 31 of the PDF) of the GLSL 1.20 spec: + * + * Only those varying variables used (i.e. read) in + * the fragment shader executable must be written to + * by the vertex shader executable; declaring + * superfluous varying variables in a vertex shader is + * permissible. + * + * We interpret this text as meaning that the VS must + * write the variable for the FS to read it. See + * "glsl1-varying read but not written" in piglit. + */ + + linker_error_printf(prog, "fragment shader varying %s not written " + "by vertex shader\n.", var->name); + prog->LinkStatus = false; + } + + /* An 'in' variable is only really a shader input if its + * value is written by the previous stage. + */ + var->shader_in = false; + var->mode = ir_var_auto; + } } } @@ -1294,7 +1316,8 @@ link_shaders(struct gl_shader_program *prog) goto done; for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) - assign_varying_locations(prog->_LinkedShaders[i - 1], + assign_varying_locations(prog, + prog->_LinkedShaders[i - 1], prog->_LinkedShaders[i]); /* FINISHME: Assign fragment shader output locations. */ -- cgit v1.2.3 From f50f06552eb1e4af27d6fe99c381eac6a0a4ea0f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 17:30:03 -0700 Subject: glsl2: Parser support for GL_ARB_fragment_coord_conventions --- src/glsl/ast.h | 6 + src/glsl/glsl_lexer.cpp | 1028 +++++++-------- src/glsl/glsl_lexer.lpp | 10 + src/glsl/glsl_parser.cpp | 2613 ++++++++++++++++++++------------------- src/glsl/glsl_parser.h | 83 +- src/glsl/glsl_parser.ypp | 61 +- src/glsl/glsl_parser_extras.cpp | 7 + src/glsl/glsl_parser_extras.h | 2 + 8 files changed, 2009 insertions(+), 1801 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index adb5fb11d4..655054ff6f 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -302,6 +302,12 @@ struct ast_type_qualifier { unsigned smooth:1; unsigned flat:1; unsigned noperspective:1; + + /** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */ + /*@{*/ + unsigned origin_upper_left:1; + unsigned pixel_center_integer:1; + /*@}*/ }; class ast_struct_specifier : public ast_node { diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index e3e89195b2..ecb4b857bb 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -358,8 +358,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 145 -#define YY_END_OF_BUFFER 146 +#define YY_NUM_RULES 146 +#define YY_END_OF_BUFFER 147 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,65 +367,66 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[519] = +static yyconst flex_int16_t yy_accept[524] = { 0, - 0, 0, 9, 9, 146, 144, 1, 14, 144, 144, - 144, 144, 144, 144, 144, 144, 89, 87, 144, 144, - 144, 143, 144, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 144, 1, 144, 84, 145, 9, 13, - 145, 12, 10, 11, 1, 73, 80, 74, 83, 77, - 68, 79, 69, 86, 91, 78, 92, 89, 0, 0, - 0, 87, 0, 70, 72, 71, 0, 143, 76, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 22, 143, 143, 143, 143, 143, 143, 143, 143, 143, - - 143, 143, 143, 143, 26, 50, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 85, 75, 1, 0, 0, 2, 0, - 0, 0, 0, 9, 8, 12, 11, 0, 91, 90, - 0, 92, 0, 93, 88, 81, 82, 96, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 25, 143, 143, - 143, 143, 143, 143, 143, 143, 19, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 51, 143, 143, 143, - - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 0, 0, 0, 0, 8, 0, 91, 0, 90, 0, - 92, 93, 143, 17, 143, 143, 136, 143, 143, 143, - 143, 143, 143, 143, 143, 24, 99, 143, 143, 143, - 57, 143, 143, 104, 118, 143, 143, 143, 143, 143, - 143, 143, 143, 115, 139, 38, 39, 40, 143, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 143, 143, 143, 102, 94, 143, 143, 143, - 143, 143, 143, 35, 36, 37, 67, 143, 143, 0, - - 0, 0, 0, 0, 90, 143, 20, 29, 30, 31, - 143, 97, 16, 143, 143, 143, 143, 126, 127, 128, - 143, 95, 119, 18, 129, 130, 131, 141, 123, 124, - 125, 143, 52, 121, 143, 143, 32, 33, 34, 143, - 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, - 143, 143, 116, 143, 143, 143, 143, 143, 143, 143, - 143, 98, 143, 138, 143, 143, 23, 0, 0, 0, - 0, 143, 143, 143, 143, 143, 117, 112, 107, 143, - 143, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 143, 143, 143, 143, 122, 103, 143, 110, 28, 143, - - 135, 58, 111, 66, 105, 143, 143, 143, 143, 143, - 143, 0, 0, 0, 0, 143, 143, 143, 106, 27, - 143, 143, 143, 140, 143, 143, 143, 143, 143, 143, - 100, 53, 143, 54, 143, 0, 0, 0, 7, 0, - 143, 55, 21, 113, 143, 143, 143, 108, 143, 143, - 143, 143, 143, 143, 101, 120, 109, 0, 0, 6, - 0, 0, 0, 3, 15, 114, 56, 137, 143, 142, - 60, 61, 62, 143, 0, 0, 0, 0, 143, 143, - 143, 143, 143, 143, 4, 0, 5, 0, 0, 0, - 143, 143, 143, 143, 143, 63, 0, 143, 143, 143, - - 143, 143, 59, 143, 132, 143, 133, 143, 143, 143, - 64, 143, 65, 143, 143, 143, 134, 0 + 0, 0, 9, 9, 147, 145, 1, 14, 145, 145, + 145, 145, 145, 145, 145, 145, 90, 88, 145, 145, + 145, 144, 145, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 145, 1, 145, 85, 146, 9, 13, + 146, 12, 10, 11, 1, 74, 81, 75, 84, 78, + 69, 80, 70, 87, 92, 79, 93, 90, 0, 0, + 0, 88, 0, 71, 73, 72, 0, 144, 77, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 22, 144, 144, 144, 144, 144, 144, 144, 144, 144, + + 144, 144, 144, 144, 26, 50, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 86, 76, 1, 0, 0, 2, + 0, 0, 0, 0, 9, 8, 12, 11, 0, 92, + 91, 0, 93, 0, 94, 89, 82, 83, 97, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 25, 144, + 144, 144, 144, 144, 144, 144, 144, 19, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 51, 144, + + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 0, 0, 0, 0, 8, 0, 92, 0, + 91, 0, 93, 94, 144, 17, 144, 144, 137, 144, + 144, 144, 144, 144, 144, 144, 144, 24, 100, 144, + 144, 144, 57, 144, 144, 105, 119, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 116, 140, 38, 39, + 40, 144, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 103, 95, + 144, 144, 144, 144, 144, 144, 35, 36, 37, 67, + + 144, 144, 0, 0, 0, 0, 0, 91, 144, 20, + 29, 30, 31, 144, 98, 16, 144, 144, 144, 144, + 127, 128, 129, 144, 96, 120, 18, 130, 131, 132, + 142, 124, 125, 126, 144, 52, 122, 144, 144, 32, + 33, 34, 144, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 117, 144, 144, 144, + 144, 144, 144, 144, 144, 99, 144, 139, 144, 144, + 23, 0, 0, 0, 0, 144, 144, 144, 144, 144, + 118, 113, 108, 144, 144, 68, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 144, 144, 144, 144, 123, + + 104, 144, 111, 28, 144, 136, 58, 112, 66, 106, + 144, 144, 144, 144, 144, 144, 0, 0, 0, 0, + 144, 144, 144, 107, 27, 144, 144, 144, 141, 144, + 144, 144, 144, 144, 144, 101, 53, 144, 54, 144, + 0, 0, 0, 7, 0, 144, 55, 21, 114, 144, + 144, 144, 109, 144, 144, 144, 144, 144, 144, 102, + 121, 110, 0, 0, 6, 0, 0, 0, 3, 15, + 115, 56, 138, 144, 143, 60, 61, 62, 144, 0, + 0, 0, 0, 144, 144, 144, 144, 144, 144, 4, + 0, 5, 0, 0, 0, 144, 144, 144, 144, 144, + + 63, 0, 144, 144, 144, 144, 144, 59, 144, 133, + 144, 134, 144, 144, 144, 64, 144, 65, 144, 144, + 144, 135, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -470,133 +471,135 @@ static yyconst flex_int32_t yy_meta[60] = 11, 11, 11, 11, 11, 12, 11, 11, 1 } ; -static yyconst flex_int16_t yy_base[538] = +static yyconst flex_int16_t yy_base[543] = { 0, - 0, 58, 81, 0, 809, 810, 59, 810, 785, 784, - 54, 783, 55, 56, 54, 782, 129, 130, 53, 781, - 127, 0, 769, 101, 106, 126, 116, 128, 143, 754, - 144, 136, 753, 128, 145, 747, 142, 760, 159, 165, - 149, 164, 756, 149, 214, 207, 774, 810, 215, 810, - 783, 209, 810, 0, 228, 810, 810, 810, 810, 810, - 810, 810, 810, 810, 205, 810, 208, 133, 223, 171, - 0, 226, 772, 810, 810, 810, 771, 0, 810, 747, - 740, 743, 751, 750, 737, 740, 751, 738, 744, 732, - 729, 742, 729, 726, 726, 732, 720, 205, 725, 735, - - 721, 727, 730, 731, 0, 215, 730, 166, 716, 729, - 720, 200, 713, 727, 724, 726, 709, 714, 711, 700, - 709, 207, 713, 709, 711, 700, 703, 188, 708, 700, - 712, 223, 705, 810, 810, 268, 256, 273, 810, 691, - 703, 695, 705, 269, 0, 263, 0, 274, 810, 258, - 278, 810, 314, 280, 0, 810, 810, 0, 693, 697, - 706, 703, 687, 686, 686, 241, 701, 698, 698, 696, - 693, 685, 691, 678, 689, 675, 691, 0, 688, 676, - 683, 680, 684, 677, 666, 665, 678, 681, 678, 673, - 664, 286, 669, 672, 663, 670, 659, 663, 669, 660, - - 651, 654, 652, 662, 652, 647, 645, 645, 647, 644, - 655, 654, 259, 649, 644, 633, 297, 651, 653, 642, - 634, 638, 649, 633, 0, 321, 313, 306, 810, 329, - 340, 810, 639, 0, 637, 338, 0, 630, 628, 626, - 634, 623, 640, 629, 341, 0, 0, 623, 633, 633, - 0, 618, 344, 0, 0, 620, 347, 621, 615, 614, - 615, 614, 350, 0, 0, 607, 606, 605, 607, 608, - 613, 607, 603, 616, 611, 610, 602, 606, 598, 601, - 596, 604, 609, 608, 599, 0, 0, 605, 594, 594, - 599, 598, 595, 0, 0, 0, 0, 585, 597, 596, - - 595, 592, 581, 356, 367, 595, 0, 0, 0, 0, - 582, 0, 0, 582, 583, 577, 587, 0, 0, 0, - 578, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 585, 0, 0, 583, 579, 0, 0, 0, 365, - 368, 371, 575, 571, 576, 567, 565, 578, 564, 577, - 566, 573, 0, 571, 568, 572, 556, 565, 571, 566, - 554, 0, 556, 0, 555, 558, 0, 553, 597, 552, - 554, 543, 552, 541, 541, 554, 0, 556, 0, 548, - 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 529, 542, 529, 526, 0, 0, 531, 0, 0, 522, - - 0, 0, 0, 0, 0, 519, 521, 514, 516, 513, - 505, 498, 395, 513, 499, 494, 506, 504, 0, 0, - 493, 497, 483, 0, 482, 470, 467, 452, 375, 456, - 0, 0, 439, 0, 433, 428, 391, 323, 810, 423, - 430, 0, 0, 0, 429, 415, 427, 0, 428, 417, - 436, 435, 434, 407, 0, 0, 0, 411, 402, 810, - 415, 0, 396, 810, 0, 0, 0, 0, 406, 0, - 425, 371, 418, 412, 399, 417, 419, 423, 402, 402, - 404, 400, 402, 384, 810, 425, 810, 437, 0, 433, - 354, 371, 363, 360, 342, 0, 435, 313, 283, 267, - - 273, 256, 0, 258, 268, 248, 0, 239, 213, 195, - 0, 206, 0, 168, 32, 11, 0, 810, 469, 473, - 480, 487, 492, 498, 504, 506, 516, 525, 529, 533, - 539, 550, 556, 558, 567, 578, 580 + 0, 58, 81, 0, 814, 815, 59, 815, 790, 789, + 54, 788, 55, 56, 54, 787, 129, 130, 53, 786, + 127, 0, 774, 101, 106, 126, 116, 128, 143, 759, + 144, 136, 132, 142, 147, 753, 154, 766, 157, 163, + 159, 176, 762, 149, 212, 191, 780, 815, 215, 815, + 789, 232, 815, 0, 219, 815, 815, 815, 815, 815, + 815, 815, 815, 815, 198, 815, 203, 200, 216, 224, + 0, 229, 778, 815, 815, 815, 777, 0, 815, 753, + 746, 749, 757, 756, 743, 746, 757, 744, 750, 738, + 735, 748, 735, 732, 732, 738, 726, 218, 731, 741, + + 727, 733, 736, 737, 0, 213, 736, 717, 216, 721, + 734, 725, 211, 718, 732, 729, 731, 714, 719, 716, + 705, 714, 224, 718, 714, 716, 705, 708, 221, 713, + 705, 717, 230, 710, 815, 815, 274, 267, 279, 815, + 696, 708, 700, 710, 275, 0, 269, 0, 280, 815, + 264, 284, 815, 282, 297, 0, 815, 815, 0, 698, + 702, 711, 708, 692, 691, 691, 258, 706, 703, 703, + 701, 698, 690, 696, 683, 694, 680, 696, 0, 693, + 681, 688, 685, 689, 682, 671, 670, 683, 686, 683, + 671, 677, 668, 297, 673, 676, 667, 674, 663, 667, + + 673, 664, 655, 658, 656, 666, 656, 651, 649, 649, + 651, 648, 659, 658, 271, 653, 648, 637, 313, 655, + 657, 646, 638, 642, 653, 637, 0, 324, 324, 312, + 815, 331, 344, 815, 643, 0, 641, 340, 0, 634, + 632, 630, 638, 627, 644, 633, 343, 0, 0, 627, + 637, 637, 0, 622, 349, 0, 0, 624, 352, 625, + 619, 618, 619, 618, 358, 614, 0, 0, 610, 609, + 608, 610, 611, 616, 610, 606, 619, 614, 613, 605, + 609, 601, 604, 599, 607, 612, 611, 602, 0, 0, + 608, 597, 597, 602, 601, 598, 0, 0, 0, 0, + + 588, 600, 599, 598, 595, 584, 363, 361, 598, 0, + 0, 0, 0, 585, 0, 0, 585, 586, 580, 590, + 0, 0, 0, 581, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 588, 0, 0, 586, 582, 0, + 0, 0, 572, 369, 375, 378, 577, 573, 578, 569, + 567, 580, 566, 579, 568, 575, 0, 573, 570, 574, + 558, 567, 573, 568, 556, 0, 558, 0, 557, 560, + 0, 555, 599, 554, 556, 545, 554, 543, 543, 556, + 0, 551, 0, 550, 546, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 531, 544, 531, 528, 0, + + 0, 532, 0, 0, 524, 0, 0, 0, 0, 0, + 512, 523, 512, 518, 512, 507, 500, 395, 515, 501, + 495, 508, 502, 0, 0, 492, 496, 475, 0, 475, + 470, 464, 450, 390, 441, 0, 0, 437, 0, 435, + 430, 386, 360, 815, 425, 432, 0, 0, 0, 431, + 417, 429, 0, 430, 419, 438, 437, 436, 409, 0, + 0, 0, 413, 415, 815, 418, 0, 396, 815, 0, + 0, 0, 0, 402, 0, 420, 371, 420, 414, 402, + 420, 422, 424, 405, 405, 407, 403, 389, 369, 815, + 428, 815, 441, 0, 436, 350, 365, 315, 301, 295, + + 0, 438, 288, 287, 268, 279, 253, 0, 191, 197, + 177, 0, 167, 159, 141, 0, 131, 0, 125, 32, + 11, 0, 815, 472, 476, 483, 490, 495, 501, 507, + 509, 519, 528, 532, 536, 542, 553, 559, 561, 570, + 581, 583 } ; -static yyconst flex_int16_t yy_def[538] = +static yyconst flex_int16_t yy_def[543] = { 0, - 518, 1, 518, 3, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 519, 518, 518, - 518, 520, 518, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 521, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 522, 518, 523, 17, 524, 525, - 526, 519, 518, 518, 518, 518, 518, 520, 518, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 527, 518, 521, 528, 518, 523, - 529, 518, 518, 525, 526, 518, 518, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 518, 518, 518, 518, 527, 518, 528, 530, 518, 518, - 529, 518, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 518, - - 518, 518, 518, 518, 530, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 518, 518, 518, - 518, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 518, 518, 518, 518, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 518, 531, 532, 518, 518, - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 518, 533, 518, - 518, 534, 532, 518, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 518, 535, 536, 534, 520, 520, - 520, 520, 520, 520, 518, 518, 518, 518, 537, 536, - 520, 520, 520, 520, 520, 520, 537, 520, 520, 520, - - 520, 520, 520, 520, 520, 520, 520, 520, 520, 520, - 520, 520, 520, 520, 520, 520, 520, 0, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518 + 523, 1, 523, 3, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 524, 523, 523, + 523, 525, 523, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 526, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 527, 523, 528, 17, 529, 530, + 531, 524, 523, 523, 523, 523, 523, 525, 523, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 532, 523, 526, 533, 523, + 528, 534, 523, 523, 530, 531, 523, 523, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 523, 523, 523, 523, 532, 523, 533, 535, + 523, 523, 534, 523, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + + 525, 525, 523, 523, 523, 523, 523, 535, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 523, 523, 523, 523, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 523, 523, 523, 523, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 523, 536, 537, 523, 523, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 523, 538, 523, 523, 539, 537, 523, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 523, + 540, 541, 539, 525, 525, 525, 525, 525, 525, 523, + 523, 523, 523, 542, 541, 525, 525, 525, 525, 525, + + 525, 542, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 0, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523 } ; -static yyconst flex_int16_t yy_nxt[870] = +static yyconst flex_int16_t yy_nxt[875] = { 0, 6, 7, 8, 7, 9, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, @@ -604,8 +607,8 @@ static yyconst flex_int16_t yy_nxt[870] = 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 22, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 22, 22, 22, 44, 45, - 55, 58, 55, 46, 61, 517, 63, 65, 65, 65, - 65, 65, 65, 65, 73, 74, 59, 62, 64, 516, + 55, 58, 55, 46, 61, 522, 63, 65, 65, 65, + 65, 65, 65, 65, 73, 74, 59, 62, 64, 521, 47, 48, 49, 50, 49, 48, 48, 48, 48, 48, 48, 48, 48, 51, 48, 52, 52, 52, 52, 52, @@ -615,87 +618,88 @@ static yyconst flex_int16_t yy_nxt[870] = 54, 54, 54, 54, 54, 54, 54, 54, 54, 48, 67, 67, 68, 68, 68, 68, 68, 68, 69, 76, 77, 80, 81, 82, 89, 83, 70, 70, 90, 84, - 85, 71, 109, 91, 86, 518, 110, 70, 70, 92, - 87, 134, 93, 88, 94, 105, 114, 96, 102, 111, - 153, 153, 106, 95, 71, 97, 103, 98, 518, 107, - 99, 115, 112, 118, 116, 128, 100, 104, 130, 129, - - 119, 120, 131, 124, 121, 515, 125, 135, 138, 139, - 122, 132, 190, 123, 126, 136, 144, 55, 144, 137, - 191, 127, 146, 146, 146, 146, 146, 146, 146, 55, - 213, 55, 148, 149, 67, 151, 152, 67, 214, 176, - 514, 206, 195, 148, 149, 140, 151, 152, 196, 513, - 70, 141, 177, 70, 512, 142, 207, 138, 139, 184, - 143, 70, 185, 186, 70, 218, 187, 219, 188, 136, - 144, 55, 144, 137, 138, 139, 146, 146, 146, 146, - 146, 146, 146, 226, 226, 228, 229, 230, 230, 518, - 518, 240, 241, 511, 140, 510, 228, 229, 289, 509, - - 141, 266, 267, 268, 142, 508, 290, 507, 232, 143, - 506, 140, 294, 295, 296, 304, 304, 141, 505, 232, - 504, 142, 518, 518, 459, 460, 143, 154, 154, 154, - 154, 154, 154, 154, 227, 227, 227, 227, 227, 227, - 227, 149, 231, 231, 231, 231, 231, 231, 231, 518, - 518, 503, 149, 308, 309, 310, 318, 319, 320, 325, - 326, 327, 329, 330, 331, 337, 338, 339, 152, 305, - 305, 305, 305, 305, 305, 305, 518, 518, 502, 152, - 382, 383, 384, 385, 386, 387, 388, 389, 390, 451, - 452, 453, 459, 460, 501, 229, 413, 459, 460, 500, - - 454, 481, 482, 459, 460, 499, 229, 498, 437, 438, - 438, 438, 438, 438, 438, 476, 459, 460, 486, 487, - 486, 487, 496, 462, 459, 460, 486, 487, 461, 461, - 461, 461, 461, 461, 486, 487, 486, 487, 486, 487, - 495, 494, 493, 492, 491, 485, 462, 484, 483, 489, - 488, 488, 488, 488, 488, 488, 480, 479, 475, 474, - 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, - 458, 457, 489, 72, 72, 72, 456, 72, 78, 78, - 78, 78, 78, 78, 78, 147, 147, 147, 147, 147, - 147, 147, 65, 65, 455, 65, 65, 150, 150, 450, - - 150, 150, 69, 69, 69, 449, 69, 154, 448, 154, - 154, 155, 155, 155, 155, 155, 225, 225, 447, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 227, 446, - 227, 227, 231, 445, 231, 231, 305, 444, 305, 305, - 461, 461, 443, 442, 461, 441, 440, 439, 436, 435, - 461, 463, 463, 434, 433, 463, 463, 477, 477, 432, - 431, 477, 477, 478, 478, 478, 478, 478, 488, 488, - 430, 429, 488, 428, 427, 426, 425, 424, 488, 490, - 490, 423, 422, 490, 490, 497, 497, 497, 497, 497, - 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, - - 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, - 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, - 391, 381, 380, 379, 378, 377, 376, 375, 374, 373, - 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, - 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, - 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, - 342, 341, 340, 336, 335, 334, 333, 332, 328, 324, - 323, 322, 321, 317, 316, 315, 314, 313, 312, 311, - 307, 306, 303, 302, 301, 300, 299, 298, 297, 293, - 292, 291, 288, 287, 286, 285, 284, 283, 282, 281, - - 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, - 270, 269, 265, 264, 263, 262, 261, 260, 259, 258, - 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, - 247, 246, 245, 244, 243, 242, 239, 238, 237, 236, - 235, 234, 233, 224, 223, 222, 221, 220, 217, 216, - 215, 212, 211, 210, 209, 208, 205, 204, 203, 202, - 201, 200, 199, 198, 197, 194, 193, 192, 189, 183, - 182, 181, 180, 179, 178, 175, 174, 173, 172, 171, - 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, - 160, 159, 158, 157, 156, 145, 75, 133, 117, 113, - - 108, 101, 79, 75, 66, 60, 57, 56, 518, 5, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518 + 85, 71, 520, 91, 86, 519, 108, 70, 70, 92, + 87, 135, 93, 88, 94, 105, 110, 96, 102, 109, + 111, 112, 106, 95, 71, 97, 103, 98, 115, 107, + 99, 119, 139, 140, 113, 518, 100, 104, 120, 121, + + 517, 125, 122, 116, 126, 129, 117, 136, 123, 130, + 131, 124, 127, 137, 132, 55, 145, 138, 145, 128, + 55, 516, 55, 133, 515, 149, 150, 67, 514, 141, + 152, 153, 523, 154, 154, 142, 149, 150, 513, 143, + 67, 152, 153, 70, 144, 147, 147, 147, 147, 147, + 147, 147, 177, 197, 70, 523, 70, 185, 208, 198, + 186, 187, 192, 215, 188, 178, 189, 70, 139, 140, + 193, 216, 220, 209, 221, 137, 145, 55, 145, 138, + 139, 140, 147, 147, 147, 147, 147, 147, 147, 228, + 228, 230, 231, 232, 232, 155, 155, 155, 155, 155, + + 155, 155, 230, 231, 512, 141, 523, 523, 242, 243, + 292, 142, 269, 270, 271, 143, 511, 141, 293, 510, + 144, 307, 307, 142, 509, 234, 508, 143, 297, 298, + 299, 507, 144, 523, 523, 506, 234, 229, 229, 229, + 229, 229, 229, 229, 233, 233, 233, 233, 233, 233, + 233, 505, 150, 523, 523, 311, 312, 313, 321, 322, + 323, 464, 465, 150, 328, 329, 330, 332, 333, 334, + 523, 523, 153, 340, 341, 342, 308, 308, 308, 308, + 308, 308, 308, 153, 387, 388, 389, 464, 465, 231, + 390, 391, 392, 393, 394, 395, 418, 464, 465, 504, + + 231, 486, 487, 503, 456, 457, 458, 501, 442, 443, + 443, 443, 443, 443, 443, 459, 464, 465, 467, 464, + 465, 491, 492, 491, 492, 464, 465, 500, 481, 491, + 492, 466, 466, 466, 466, 466, 466, 491, 492, 491, + 492, 467, 491, 492, 499, 498, 497, 496, 490, 489, + 488, 485, 494, 484, 493, 493, 493, 493, 493, 493, + 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, + 470, 469, 463, 462, 461, 494, 72, 72, 72, 460, + 72, 78, 78, 78, 78, 78, 78, 78, 148, 148, + 148, 148, 148, 148, 148, 65, 65, 455, 65, 65, + + 151, 151, 454, 151, 151, 69, 69, 69, 453, 69, + 155, 452, 155, 155, 156, 156, 156, 156, 156, 227, + 227, 451, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 229, 450, 229, 229, 233, 449, 233, 233, 308, + 448, 308, 308, 466, 466, 447, 446, 466, 445, 444, + 441, 440, 439, 466, 468, 468, 438, 437, 468, 468, + 482, 482, 436, 435, 482, 482, 483, 483, 483, 483, + 483, 493, 493, 434, 433, 493, 432, 431, 430, 429, + 428, 493, 495, 495, 427, 426, 495, 495, 502, 502, + 502, 502, 502, 425, 424, 423, 422, 421, 420, 419, + + 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, + 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, + 398, 397, 396, 386, 385, 384, 383, 382, 381, 380, + 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, + 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, + 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, + 349, 348, 347, 346, 345, 344, 343, 339, 338, 337, + 336, 335, 331, 327, 326, 325, 324, 320, 319, 318, + 317, 316, 315, 314, 310, 309, 306, 305, 304, 303, + 302, 301, 300, 296, 295, 294, 291, 290, 289, 288, + + 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, + 277, 276, 275, 274, 273, 272, 268, 267, 266, 265, + 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, + 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, + 244, 241, 240, 239, 238, 237, 236, 235, 226, 225, + 224, 223, 222, 219, 218, 217, 214, 213, 212, 211, + 210, 207, 206, 205, 204, 203, 202, 201, 200, 199, + 196, 195, 194, 191, 190, 184, 183, 182, 181, 180, + 179, 176, 175, 174, 173, 172, 171, 170, 169, 168, + 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, + + 157, 146, 75, 134, 118, 114, 101, 79, 75, 66, + 60, 57, 56, 523, 5, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523 } ; -static yyconst flex_int16_t yy_chk[870] = +static yyconst flex_int16_t yy_chk[875] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -703,8 +707,8 @@ static yyconst flex_int16_t yy_chk[870] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 7, 11, 7, 2, 13, 516, 14, 15, 15, 15, - 15, 15, 15, 15, 19, 19, 11, 13, 14, 515, + 7, 11, 7, 2, 13, 521, 14, 15, 15, 15, + 15, 15, 15, 15, 19, 19, 11, 13, 14, 520, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -714,84 +718,85 @@ static yyconst flex_int16_t yy_chk[870] = 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 17, 18, 17, 17, 17, 17, 17, 17, 17, 21, 21, 24, 24, 25, 27, 25, 17, 18, 27, 25, - 26, 17, 34, 27, 26, 68, 34, 17, 18, 27, - 26, 44, 28, 26, 28, 32, 37, 29, 31, 35, - 70, 70, 32, 28, 17, 29, 31, 29, 68, 32, - 29, 37, 35, 39, 37, 41, 29, 31, 42, 41, - - 39, 39, 42, 40, 39, 514, 40, 44, 46, 46, - 39, 42, 108, 39, 40, 45, 49, 45, 49, 45, - 108, 40, 52, 52, 52, 52, 52, 52, 52, 55, - 128, 55, 65, 65, 69, 67, 67, 72, 128, 98, - 512, 122, 112, 65, 65, 46, 67, 67, 112, 510, - 69, 46, 98, 72, 509, 46, 122, 137, 137, 106, - 46, 69, 106, 106, 72, 132, 106, 132, 106, 136, - 144, 136, 144, 136, 138, 138, 146, 146, 146, 146, - 146, 146, 146, 148, 148, 150, 150, 151, 151, 154, - 154, 166, 166, 508, 137, 506, 150, 150, 213, 505, - - 137, 192, 192, 192, 137, 504, 213, 502, 154, 137, - 501, 138, 217, 217, 217, 228, 228, 138, 500, 154, - 499, 138, 227, 227, 438, 438, 138, 153, 153, 153, - 153, 153, 153, 153, 226, 226, 226, 226, 226, 226, - 226, 227, 230, 230, 230, 230, 230, 230, 230, 231, - 231, 498, 227, 236, 236, 236, 245, 245, 245, 253, - 253, 253, 257, 257, 257, 263, 263, 263, 231, 304, - 304, 304, 304, 304, 304, 304, 305, 305, 495, 231, - 340, 340, 340, 341, 341, 341, 342, 342, 342, 429, - 429, 429, 437, 437, 494, 305, 413, 463, 463, 493, - - 429, 472, 472, 459, 459, 492, 305, 491, 413, 413, - 413, 413, 413, 413, 413, 459, 461, 461, 476, 476, - 477, 477, 484, 437, 478, 478, 486, 486, 461, 461, - 461, 461, 461, 461, 490, 490, 497, 497, 488, 488, - 483, 482, 481, 480, 479, 475, 437, 474, 473, 476, - 488, 488, 488, 488, 488, 488, 471, 469, 458, 454, - 453, 452, 451, 450, 449, 447, 446, 445, 441, 440, - 436, 435, 476, 519, 519, 519, 433, 519, 520, 520, - 520, 520, 520, 520, 520, 521, 521, 521, 521, 521, - 521, 521, 522, 522, 430, 522, 522, 523, 523, 428, - - 523, 523, 524, 524, 524, 427, 524, 525, 426, 525, - 525, 526, 526, 526, 526, 526, 527, 527, 425, 527, - 527, 527, 527, 527, 527, 527, 527, 527, 528, 423, - 528, 528, 529, 422, 529, 529, 530, 421, 530, 530, - 531, 531, 418, 417, 531, 416, 415, 414, 412, 411, - 531, 532, 532, 410, 409, 532, 532, 533, 533, 408, - 407, 533, 533, 534, 534, 534, 534, 534, 535, 535, - 406, 400, 535, 397, 394, 393, 392, 391, 535, 536, - 536, 381, 380, 536, 536, 537, 537, 537, 537, 537, - 378, 376, 375, 374, 373, 372, 371, 370, 369, 368, - - 366, 365, 363, 361, 360, 359, 358, 357, 356, 355, - 354, 352, 351, 350, 349, 348, 347, 346, 345, 344, - 343, 336, 335, 332, 321, 317, 316, 315, 314, 311, - 306, 303, 302, 301, 300, 299, 298, 293, 292, 291, - 290, 289, 288, 285, 284, 283, 282, 281, 280, 279, - 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, - 268, 267, 266, 262, 261, 260, 259, 258, 256, 252, - 250, 249, 248, 244, 243, 242, 241, 240, 239, 238, - 235, 233, 224, 223, 222, 221, 220, 219, 218, 216, - 215, 214, 212, 211, 210, 209, 208, 207, 206, 205, - - 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, - 194, 193, 191, 190, 189, 188, 187, 186, 185, 184, - 183, 182, 181, 180, 179, 177, 176, 175, 174, 173, - 172, 171, 170, 169, 168, 167, 165, 164, 163, 162, - 161, 160, 159, 143, 142, 141, 140, 133, 131, 130, - 129, 127, 126, 125, 124, 123, 121, 120, 119, 118, - 117, 116, 115, 114, 113, 111, 110, 109, 107, 104, - 103, 102, 101, 100, 99, 97, 96, 95, 94, 93, - 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, - 82, 81, 80, 77, 73, 51, 47, 43, 38, 36, - - 33, 30, 23, 20, 16, 12, 10, 9, 5, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, - 518, 518, 518, 518, 518, 518, 518, 518, 518 + 26, 17, 519, 27, 26, 517, 33, 17, 18, 27, + 26, 44, 28, 26, 28, 32, 34, 29, 31, 33, + 34, 35, 32, 28, 17, 29, 31, 29, 37, 32, + 29, 39, 46, 46, 35, 515, 29, 31, 39, 39, + + 514, 40, 39, 37, 40, 41, 37, 44, 39, 41, + 42, 39, 40, 45, 42, 45, 49, 45, 49, 40, + 55, 513, 55, 42, 511, 65, 65, 69, 510, 46, + 67, 67, 68, 70, 70, 46, 65, 65, 509, 46, + 72, 67, 67, 69, 46, 52, 52, 52, 52, 52, + 52, 52, 98, 113, 69, 68, 72, 106, 123, 113, + 106, 106, 109, 129, 106, 98, 106, 72, 138, 138, + 109, 129, 133, 123, 133, 137, 145, 137, 145, 137, + 139, 139, 147, 147, 147, 147, 147, 147, 147, 149, + 149, 151, 151, 152, 152, 154, 154, 154, 154, 154, + + 154, 154, 151, 151, 507, 138, 155, 155, 167, 167, + 215, 138, 194, 194, 194, 138, 506, 139, 215, 505, + 138, 230, 230, 139, 504, 155, 503, 139, 219, 219, + 219, 500, 139, 229, 229, 499, 155, 228, 228, 228, + 228, 228, 228, 228, 232, 232, 232, 232, 232, 232, + 232, 498, 229, 233, 233, 238, 238, 238, 247, 247, + 247, 443, 443, 229, 255, 255, 255, 259, 259, 259, + 308, 308, 233, 265, 265, 265, 307, 307, 307, 307, + 307, 307, 307, 233, 344, 344, 344, 442, 442, 308, + 345, 345, 345, 346, 346, 346, 418, 468, 468, 497, + + 308, 477, 477, 496, 434, 434, 434, 489, 418, 418, + 418, 418, 418, 418, 418, 434, 464, 464, 442, 466, + 466, 481, 481, 482, 482, 483, 483, 488, 464, 491, + 491, 466, 466, 466, 466, 466, 466, 495, 495, 502, + 502, 442, 493, 493, 487, 486, 485, 484, 480, 479, + 478, 476, 481, 474, 493, 493, 493, 493, 493, 493, + 463, 459, 458, 457, 456, 455, 454, 452, 451, 450, + 446, 445, 441, 440, 438, 481, 524, 524, 524, 435, + 524, 525, 525, 525, 525, 525, 525, 525, 526, 526, + 526, 526, 526, 526, 526, 527, 527, 433, 527, 527, + + 528, 528, 432, 528, 528, 529, 529, 529, 431, 529, + 530, 430, 530, 530, 531, 531, 531, 531, 531, 532, + 532, 428, 532, 532, 532, 532, 532, 532, 532, 532, + 532, 533, 427, 533, 533, 534, 426, 534, 534, 535, + 423, 535, 535, 536, 536, 422, 421, 536, 420, 419, + 417, 416, 415, 536, 537, 537, 414, 413, 537, 537, + 538, 538, 412, 411, 538, 538, 539, 539, 539, 539, + 539, 540, 540, 405, 402, 540, 399, 398, 397, 396, + 385, 540, 541, 541, 384, 382, 541, 541, 542, 542, + 542, 542, 542, 380, 379, 378, 377, 376, 375, 374, + + 373, 372, 370, 369, 367, 365, 364, 363, 362, 361, + 360, 359, 358, 356, 355, 354, 353, 352, 351, 350, + 349, 348, 347, 343, 339, 338, 335, 324, 320, 319, + 318, 317, 314, 309, 306, 305, 304, 303, 302, 301, + 296, 295, 294, 293, 292, 291, 288, 287, 286, 285, + 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, + 274, 273, 272, 271, 270, 269, 266, 264, 263, 262, + 261, 260, 258, 254, 252, 251, 250, 246, 245, 244, + 243, 242, 241, 240, 237, 235, 226, 225, 224, 223, + 222, 221, 220, 218, 217, 216, 214, 213, 212, 211, + + 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, + 200, 199, 198, 197, 196, 195, 193, 192, 191, 190, + 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, + 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, + 168, 166, 165, 164, 163, 162, 161, 160, 144, 143, + 142, 141, 134, 132, 131, 130, 128, 127, 126, 125, + 124, 122, 121, 120, 119, 118, 117, 116, 115, 114, + 112, 111, 110, 108, 107, 104, 103, 102, 101, 100, + 99, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 77, + + 73, 51, 47, 43, 38, 36, 30, 23, 20, 16, + 12, 10, 9, 5, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, + 523, 523, 523, 523 } ; /* The intent behind this definition is that it'll catch @@ -841,7 +846,7 @@ static yyconst flex_int16_t yy_chk[870] = #define YY_USER_INIT yylineno = 0; yycolumn = 0; -#line 845 "glsl_lexer.cpp" +#line 850 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1090,7 +1095,7 @@ YY_DECL #line 56 "glsl_lexer.lpp" -#line 1094 "glsl_lexer.cpp" +#line 1099 "glsl_lexer.cpp" yylval = yylval_param; @@ -1148,13 +1153,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 519 ) + if ( yy_current_state >= 524 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 518 ); + while ( yy_current_state != 523 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1592,410 +1597,423 @@ return VOID; case 68: YY_RULE_SETUP #line 204 "glsl_lexer.lpp" -return INC_OP; +{ + if ((yyextra->language_version >= 140) + || (yyextra->ARB_fragment_coord_conventions_enable)){ + return LAYOUT_TOK; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } YY_BREAK case 69: YY_RULE_SETUP -#line 205 "glsl_lexer.lpp" -return DEC_OP; +#line 214 "glsl_lexer.lpp" +return INC_OP; YY_BREAK case 70: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" -return LE_OP; +#line 215 "glsl_lexer.lpp" +return DEC_OP; YY_BREAK case 71: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" -return GE_OP; +#line 216 "glsl_lexer.lpp" +return LE_OP; YY_BREAK case 72: YY_RULE_SETUP -#line 208 "glsl_lexer.lpp" -return EQ_OP; +#line 217 "glsl_lexer.lpp" +return GE_OP; YY_BREAK case 73: YY_RULE_SETUP -#line 209 "glsl_lexer.lpp" -return NE_OP; +#line 218 "glsl_lexer.lpp" +return EQ_OP; YY_BREAK case 74: YY_RULE_SETUP -#line 210 "glsl_lexer.lpp" -return AND_OP; +#line 219 "glsl_lexer.lpp" +return NE_OP; YY_BREAK case 75: YY_RULE_SETUP -#line 211 "glsl_lexer.lpp" -return OR_OP; +#line 220 "glsl_lexer.lpp" +return AND_OP; YY_BREAK case 76: YY_RULE_SETUP -#line 212 "glsl_lexer.lpp" -return XOR_OP; +#line 221 "glsl_lexer.lpp" +return OR_OP; YY_BREAK case 77: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" -return MUL_ASSIGN; +#line 222 "glsl_lexer.lpp" +return XOR_OP; YY_BREAK case 78: YY_RULE_SETUP -#line 215 "glsl_lexer.lpp" -return DIV_ASSIGN; +#line 224 "glsl_lexer.lpp" +return MUL_ASSIGN; YY_BREAK case 79: YY_RULE_SETUP -#line 216 "glsl_lexer.lpp" -return ADD_ASSIGN; +#line 225 "glsl_lexer.lpp" +return DIV_ASSIGN; YY_BREAK case 80: YY_RULE_SETUP -#line 217 "glsl_lexer.lpp" -return MOD_ASSIGN; +#line 226 "glsl_lexer.lpp" +return ADD_ASSIGN; YY_BREAK case 81: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" -return LEFT_ASSIGN; +#line 227 "glsl_lexer.lpp" +return MOD_ASSIGN; YY_BREAK case 82: YY_RULE_SETUP -#line 219 "glsl_lexer.lpp" -return RIGHT_ASSIGN; +#line 228 "glsl_lexer.lpp" +return LEFT_ASSIGN; YY_BREAK case 83: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" -return AND_ASSIGN; +#line 229 "glsl_lexer.lpp" +return RIGHT_ASSIGN; YY_BREAK case 84: YY_RULE_SETUP -#line 221 "glsl_lexer.lpp" -return XOR_ASSIGN; +#line 230 "glsl_lexer.lpp" +return AND_ASSIGN; YY_BREAK case 85: YY_RULE_SETUP -#line 222 "glsl_lexer.lpp" -return OR_ASSIGN; +#line 231 "glsl_lexer.lpp" +return XOR_ASSIGN; YY_BREAK case 86: YY_RULE_SETUP -#line 223 "glsl_lexer.lpp" -return SUB_ASSIGN; +#line 232 "glsl_lexer.lpp" +return OR_ASSIGN; YY_BREAK case 87: YY_RULE_SETUP -#line 225 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" +return SUB_ASSIGN; + YY_BREAK +case 88: +YY_RULE_SETUP +#line 235 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; } YY_BREAK -case 88: +case 89: YY_RULE_SETUP -#line 229 "glsl_lexer.lpp" +#line 239 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return INTCONSTANT; } YY_BREAK -case 89: +case 90: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 243 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; } YY_BREAK -case 90: +case 91: YY_RULE_SETUP -#line 238 "glsl_lexer.lpp" +#line 248 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 91: +case 92: YY_RULE_SETUP -#line 242 "glsl_lexer.lpp" +#line 252 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 92: +case 93: YY_RULE_SETUP -#line 246 "glsl_lexer.lpp" +#line 256 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 93: +case 94: YY_RULE_SETUP -#line 250 "glsl_lexer.lpp" +#line 260 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK -case 94: +case 95: YY_RULE_SETUP -#line 255 "glsl_lexer.lpp" +#line 265 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; } YY_BREAK -case 95: +case 96: YY_RULE_SETUP -#line 259 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; } YY_BREAK /* Reserved words in GLSL 1.10. */ -case 96: +case 97: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" +#line 276 "glsl_lexer.lpp" return ASM; YY_BREAK -case 97: +case 98: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" +#line 277 "glsl_lexer.lpp" return CLASS; YY_BREAK -case 98: +case 99: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" +#line 278 "glsl_lexer.lpp" return UNION; YY_BREAK -case 99: +case 100: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" return ENUM; YY_BREAK -case 100: +case 101: YY_RULE_SETUP -#line 270 "glsl_lexer.lpp" +#line 280 "glsl_lexer.lpp" return TYPEDEF; YY_BREAK -case 101: +case 102: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" +#line 281 "glsl_lexer.lpp" return TEMPLATE; YY_BREAK -case 102: +case 103: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" +#line 282 "glsl_lexer.lpp" return THIS; YY_BREAK -case 103: +case 104: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" +#line 283 "glsl_lexer.lpp" return PACKED; YY_BREAK -case 104: +case 105: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 284 "glsl_lexer.lpp" return GOTO; YY_BREAK -case 105: +case 106: YY_RULE_SETUP -#line 275 "glsl_lexer.lpp" +#line 285 "glsl_lexer.lpp" return SWITCH; YY_BREAK -case 106: +case 107: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 286 "glsl_lexer.lpp" return DEFAULT; YY_BREAK -case 107: +case 108: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" return INLINE_TOK; YY_BREAK -case 108: +case 109: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" return NOINLINE; YY_BREAK -case 109: +case 110: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 289 "glsl_lexer.lpp" return VOLATILE; YY_BREAK -case 110: +case 111: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 290 "glsl_lexer.lpp" return PUBLIC_TOK; YY_BREAK -case 111: +case 112: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" +#line 291 "glsl_lexer.lpp" return STATIC; YY_BREAK -case 112: +case 113: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 292 "glsl_lexer.lpp" return EXTERN; YY_BREAK -case 113: +case 114: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" +#line 293 "glsl_lexer.lpp" return EXTERNAL; YY_BREAK -case 114: +case 115: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" +#line 294 "glsl_lexer.lpp" return INTERFACE; YY_BREAK -case 115: +case 116: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 295 "glsl_lexer.lpp" return LONG; YY_BREAK -case 116: +case 117: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 296 "glsl_lexer.lpp" return SHORT; YY_BREAK -case 117: +case 118: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 297 "glsl_lexer.lpp" return DOUBLE; YY_BREAK -case 118: +case 119: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" +#line 298 "glsl_lexer.lpp" return HALF; YY_BREAK -case 119: +case 120: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" +#line 299 "glsl_lexer.lpp" return FIXED; YY_BREAK -case 120: +case 121: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 300 "glsl_lexer.lpp" return UNSIGNED; YY_BREAK -case 121: +case 122: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" return INPUT; YY_BREAK -case 122: +case 123: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" +#line 302 "glsl_lexer.lpp" return OUTPUT; YY_BREAK -case 123: +case 124: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" return HVEC2; YY_BREAK -case 124: +case 125: YY_RULE_SETUP -#line 294 "glsl_lexer.lpp" +#line 304 "glsl_lexer.lpp" return HVEC3; YY_BREAK -case 125: +case 126: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 305 "glsl_lexer.lpp" return HVEC4; YY_BREAK -case 126: +case 127: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" +#line 306 "glsl_lexer.lpp" return DVEC2; YY_BREAK -case 127: +case 128: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" +#line 307 "glsl_lexer.lpp" return DVEC3; YY_BREAK -case 128: +case 129: YY_RULE_SETUP -#line 298 "glsl_lexer.lpp" +#line 308 "glsl_lexer.lpp" return DVEC4; YY_BREAK -case 129: +case 130: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 309 "glsl_lexer.lpp" return FVEC2; YY_BREAK -case 130: +case 131: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" return FVEC3; YY_BREAK -case 131: +case 132: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 311 "glsl_lexer.lpp" return FVEC4; YY_BREAK -case 132: +case 133: YY_RULE_SETUP -#line 302 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK -case 133: +case 134: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 313 "glsl_lexer.lpp" return SAMPLER3DRECT; YY_BREAK -case 134: +case 135: YY_RULE_SETUP -#line 304 "glsl_lexer.lpp" +#line 314 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK -case 135: +case 136: YY_RULE_SETUP -#line 305 "glsl_lexer.lpp" +#line 315 "glsl_lexer.lpp" return SIZEOF; YY_BREAK -case 136: +case 137: YY_RULE_SETUP -#line 306 "glsl_lexer.lpp" +#line 316 "glsl_lexer.lpp" return CAST; YY_BREAK -case 137: +case 138: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 317 "glsl_lexer.lpp" return NAMESPACE; YY_BREAK -case 138: +case 139: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 318 "glsl_lexer.lpp" return USING; YY_BREAK /* Additional reserved words in GLSL 1.20. */ -case 139: +case 140: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 321 "glsl_lexer.lpp" return LOWP; YY_BREAK -case 140: +case 141: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 322 "glsl_lexer.lpp" return MEDIUMP; YY_BREAK -case 141: +case 142: YY_RULE_SETUP -#line 313 "glsl_lexer.lpp" +#line 323 "glsl_lexer.lpp" return HIGHP; YY_BREAK -case 142: +case 143: YY_RULE_SETUP -#line 314 "glsl_lexer.lpp" +#line 324 "glsl_lexer.lpp" return PRECISION; YY_BREAK -case 143: +case 144: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 326 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2003,17 +2021,17 @@ YY_RULE_SETUP return IDENTIFIER; } YY_BREAK -case 144: +case 145: YY_RULE_SETUP -#line 323 "glsl_lexer.lpp" +#line 333 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK -case 145: +case 146: YY_RULE_SETUP -#line 325 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2017 "glsl_lexer.cpp" +#line 2035 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -2310,7 +2328,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 519 ) + if ( yy_current_state >= 524 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2339,11 +2357,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 519 ) + if ( yy_current_state >= 524 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 518); + yy_is_jam = (yy_current_state == 523); return yy_is_jam ? 0 : yy_current_state; } @@ -3155,7 +3173,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 325 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index b0afc44d5e..ebfea37597 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -201,6 +201,16 @@ sampler2DShadow return SAMPLER2DSHADOW; struct return STRUCT; void return VOID; +layout { + if ((yyextra->language_version >= 140) + || (yyextra->ARB_fragment_coord_conventions_enable)){ + return LAYOUT_TOK; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + \+\+ return INC_OP; -- return DEC_OP; \<= return LE_OP; diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index b2113c083c..b31f558168 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -257,46 +257,47 @@ EOL = 371, INTERFACE = 372, OUTPUT = 373, - ASM = 374, - CLASS = 375, - UNION = 376, - ENUM = 377, - TYPEDEF = 378, - TEMPLATE = 379, - THIS = 380, - PACKED = 381, - GOTO = 382, - INLINE_TOK = 383, - NOINLINE = 384, - VOLATILE = 385, - PUBLIC_TOK = 386, - STATIC = 387, - EXTERN = 388, - EXTERNAL = 389, - LONG = 390, - SHORT = 391, - DOUBLE = 392, - HALF = 393, - FIXED = 394, - UNSIGNED = 395, - INPUT = 396, - OUPTUT = 397, - HVEC2 = 398, - HVEC3 = 399, - HVEC4 = 400, - DVEC2 = 401, - DVEC3 = 402, - DVEC4 = 403, - FVEC2 = 404, - FVEC3 = 405, - FVEC4 = 406, - SAMPLER2DRECT = 407, - SAMPLER3DRECT = 408, - SAMPLER2DRECTSHADOW = 409, - SIZEOF = 410, - CAST = 411, - NAMESPACE = 412, - USING = 413 + LAYOUT_TOK = 374, + ASM = 375, + CLASS = 376, + UNION = 377, + ENUM = 378, + TYPEDEF = 379, + TEMPLATE = 380, + THIS = 381, + PACKED = 382, + GOTO = 383, + INLINE_TOK = 384, + NOINLINE = 385, + VOLATILE = 386, + PUBLIC_TOK = 387, + STATIC = 388, + EXTERN = 389, + EXTERNAL = 390, + LONG = 391, + SHORT = 392, + DOUBLE = 393, + HALF = 394, + FIXED = 395, + UNSIGNED = 396, + INPUT = 397, + OUPTUT = 398, + HVEC2 = 399, + HVEC3 = 400, + HVEC4 = 401, + DVEC2 = 402, + DVEC3 = 403, + DVEC4 = 404, + FVEC2 = 405, + FVEC3 = 406, + FVEC4 = 407, + SAMPLER2DRECT = 408, + SAMPLER3DRECT = 409, + SAMPLER2DRECTSHADOW = 410, + SIZEOF = 411, + CAST = 412, + NAMESPACE = 413, + USING = 414 }; #endif @@ -338,7 +339,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 342 "glsl_parser.cpp" +#line 343 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -363,7 +364,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 367 "glsl_parser.cpp" +#line 368 "glsl_parser.cpp" #ifdef short # undef short @@ -580,20 +581,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 3646 +#define YYLAST 3839 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 183 +#define YYNTOKENS 184 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 85 +#define YYNNTS 89 /* YYNRULES -- Number of rules. */ -#define YYNRULES 270 +#define YYNRULES 276 /* YYNRULES -- Number of states. */ -#define YYNSTATES 403 +#define YYNSTATES 413 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 413 +#define YYMAXUTOK 414 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -604,16 +605,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 167, 2, 2, 2, 171, 174, 2, - 159, 160, 169, 165, 164, 166, 163, 170, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 178, 180, - 172, 179, 173, 177, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 168, 2, 2, 2, 172, 175, 2, + 160, 161, 170, 166, 165, 167, 164, 171, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 179, 181, + 173, 180, 174, 178, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 161, 2, 162, 175, 2, 2, 2, 2, 2, + 2, 162, 2, 163, 176, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 181, 176, 182, 168, 2, 2, 2, + 2, 2, 2, 182, 177, 183, 169, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -642,7 +643,7 @@ static const yytype_uint8 yytranslate[] = 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158 + 155, 156, 157, 158, 159 }; #if YYDEBUG @@ -663,137 +664,139 @@ static const yytype_uint16 yyprhs[] = 280, 283, 287, 291, 294, 300, 304, 307, 311, 314, 315, 317, 319, 321, 323, 325, 329, 335, 342, 350, 359, 365, 367, 370, 375, 381, 388, 396, 401, 404, - 406, 409, 411, 413, 415, 417, 419, 422, 425, 427, - 429, 431, 434, 436, 438, 441, 444, 446, 448, 451, - 453, 457, 462, 464, 466, 468, 470, 472, 474, 476, - 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, - 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, - 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, - 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, - 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, - 578, 580, 582, 588, 593, 595, 598, 602, 604, 608, - 610, 615, 617, 619, 621, 623, 625, 627, 629, 631, - 633, 635, 637, 639, 641, 643, 646, 650, 652, 654, - 657, 661, 663, 666, 668, 671, 679, 685, 691, 699, - 701, 706, 712, 716, 719, 725, 733, 740, 742, 744, - 746, 747, 750, 754, 757, 760, 763, 767, 770, 772, - 774 + 406, 409, 410, 412, 417, 419, 423, 425, 427, 429, + 431, 433, 435, 438, 441, 443, 445, 448, 451, 454, + 456, 459, 462, 464, 466, 469, 471, 475, 480, 482, + 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, + 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, + 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, + 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, + 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, + 584, 586, 588, 590, 592, 594, 596, 598, 600, 606, + 611, 613, 616, 620, 622, 626, 628, 633, 635, 637, + 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, + 659, 661, 664, 668, 670, 672, 675, 679, 681, 684, + 686, 689, 697, 703, 709, 717, 719, 724, 730, 734, + 737, 743, 751, 758, 760, 762, 764, 765, 768, 772, + 775, 778, 781, 785, 788, 790, 792 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 184, 0, -1, -1, 186, 187, 185, 189, -1, -1, - 111, 81, 116, -1, -1, 187, 188, -1, 112, 79, - 115, 79, 116, -1, 266, -1, 189, 266, -1, 79, - -1, 190, -1, 81, -1, 82, -1, 80, -1, 83, - -1, 159, 217, 160, -1, 191, -1, 192, 161, 193, - 162, -1, 194, -1, 192, 163, 79, -1, 192, 87, - -1, 192, 88, -1, 217, -1, 195, -1, 196, -1, - 192, 163, 196, -1, 198, 160, -1, 197, 160, -1, - 199, 77, -1, 199, -1, 199, 215, -1, 198, 164, - 215, -1, 200, 159, -1, 235, -1, 79, -1, 84, - -1, 192, -1, 87, 201, -1, 88, 201, -1, 202, - 201, -1, 165, -1, 166, -1, 167, -1, 168, -1, - 201, -1, 203, 169, 201, -1, 203, 170, 201, -1, - 203, 171, 201, -1, 203, -1, 204, 165, 203, -1, - 204, 166, 203, -1, 204, -1, 205, 85, 204, -1, - 205, 86, 204, -1, 205, -1, 206, 172, 205, -1, - 206, 173, 205, -1, 206, 89, 205, -1, 206, 90, - 205, -1, 206, -1, 207, 91, 206, -1, 207, 92, - 206, -1, 207, -1, 208, 174, 207, -1, 208, -1, - 209, 175, 208, -1, 209, -1, 210, 176, 209, -1, - 210, -1, 211, 93, 210, -1, 211, -1, 212, 95, - 211, -1, 212, -1, 213, 94, 212, -1, 213, -1, - 213, 177, 217, 178, 215, -1, 214, -1, 201, 216, - 215, -1, 179, -1, 96, -1, 97, -1, 99, -1, + 185, 0, -1, -1, 187, 188, 186, 190, -1, -1, + 111, 81, 116, -1, -1, 188, 189, -1, 112, 79, + 115, 79, 116, -1, 271, -1, 190, 271, -1, 79, + -1, 191, -1, 81, -1, 82, -1, 80, -1, 83, + -1, 160, 218, 161, -1, 192, -1, 193, 162, 194, + 163, -1, 195, -1, 193, 164, 79, -1, 193, 87, + -1, 193, 88, -1, 218, -1, 196, -1, 197, -1, + 193, 164, 197, -1, 199, 161, -1, 198, 161, -1, + 200, 77, -1, 200, -1, 200, 216, -1, 199, 165, + 216, -1, 201, 160, -1, 240, -1, 79, -1, 84, + -1, 193, -1, 87, 202, -1, 88, 202, -1, 203, + 202, -1, 166, -1, 167, -1, 168, -1, 169, -1, + 202, -1, 204, 170, 202, -1, 204, 171, 202, -1, + 204, 172, 202, -1, 204, -1, 205, 166, 204, -1, + 205, 167, 204, -1, 205, -1, 206, 85, 205, -1, + 206, 86, 205, -1, 206, -1, 207, 173, 206, -1, + 207, 174, 206, -1, 207, 89, 206, -1, 207, 90, + 206, -1, 207, -1, 208, 91, 207, -1, 208, 92, + 207, -1, 208, -1, 209, 175, 208, -1, 209, -1, + 210, 176, 209, -1, 210, -1, 211, 177, 210, -1, + 211, -1, 212, 93, 211, -1, 212, -1, 213, 95, + 212, -1, 213, -1, 214, 94, 213, -1, 214, -1, + 214, 178, 218, 179, 216, -1, 215, -1, 202, 217, + 216, -1, 180, -1, 96, -1, 97, -1, 99, -1, 98, -1, 105, -1, 100, -1, 101, -1, 102, -1, - 103, -1, 104, -1, 215, -1, 217, 164, 215, -1, - 214, -1, 220, 180, -1, 228, 180, -1, 110, 239, - 236, 180, -1, 221, 160, -1, 223, -1, 222, -1, - 223, 225, -1, 222, 164, 225, -1, 230, 79, 159, - -1, 235, 79, -1, 235, 79, 161, 218, 162, -1, - 232, 226, 224, -1, 226, 224, -1, 232, 226, 227, - -1, 226, 227, -1, -1, 36, -1, 37, -1, 38, - -1, 235, -1, 229, -1, 228, 164, 79, -1, 228, - 164, 79, 161, 162, -1, 228, 164, 79, 161, 218, - 162, -1, 228, 164, 79, 161, 162, 179, 245, -1, - 228, 164, 79, 161, 218, 162, 179, 245, -1, 228, - 164, 79, 179, 245, -1, 230, -1, 230, 79, -1, - 230, 79, 161, 162, -1, 230, 79, 161, 218, 162, - -1, 230, 79, 161, 162, 179, 245, -1, 230, 79, - 161, 218, 162, 179, 245, -1, 230, 79, 179, 245, - -1, 106, 79, -1, 235, -1, 233, 235, -1, 43, - -1, 42, -1, 41, -1, 4, -1, 234, -1, 231, - 233, -1, 106, 233, -1, 4, -1, 3, -1, 40, - -1, 35, 40, -1, 36, -1, 37, -1, 35, 36, - -1, 35, 37, -1, 39, -1, 236, -1, 239, 236, - -1, 237, -1, 237, 161, 162, -1, 237, 161, 218, - 162, -1, 238, -1, 240, -1, 79, -1, 77, -1, - 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, - 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, - 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, - 28, -1, 32, -1, 33, -1, 34, -1, 44, -1, - 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, - 50, -1, 51, -1, 52, -1, 53, -1, 54, -1, - 152, -1, 55, -1, 56, -1, 57, -1, 58, -1, - 154, -1, 59, -1, 60, -1, 61, -1, 62, -1, - 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, - 68, -1, 69, -1, 70, -1, 71, -1, 72, -1, - 73, -1, 74, -1, 75, -1, 109, -1, 108, -1, - 107, -1, 76, 79, 181, 241, 182, -1, 76, 181, - 241, 182, -1, 242, -1, 241, 242, -1, 235, 243, - 180, -1, 244, -1, 243, 164, 244, -1, 79, -1, - 79, 161, 218, 162, -1, 215, -1, 219, -1, 248, - -1, 249, -1, 251, -1, 250, -1, 257, -1, 246, - -1, 255, -1, 256, -1, 259, -1, 260, -1, 261, - -1, 265, -1, 181, 182, -1, 181, 254, 182, -1, - 253, -1, 250, -1, 181, 182, -1, 181, 254, 182, - -1, 247, -1, 254, 247, -1, 180, -1, 217, 180, - -1, 14, 159, 217, 160, 248, 12, 248, -1, 14, - 159, 217, 160, 248, -1, 14, 159, 217, 160, 249, - -1, 14, 159, 217, 160, 248, 12, 249, -1, 217, - -1, 230, 79, 179, 245, -1, 17, 159, 217, 160, - 251, -1, 18, 217, 178, -1, 19, 178, -1, 78, - 159, 258, 160, 252, -1, 11, 247, 78, 159, 217, - 160, 180, -1, 13, 159, 262, 264, 160, 252, -1, - 255, -1, 246, -1, 258, -1, -1, 263, 180, -1, - 263, 180, 217, -1, 10, 180, -1, 9, 180, -1, - 16, 180, -1, 16, 217, 180, -1, 15, 180, -1, - 267, -1, 219, -1, 220, 253, -1 + 103, -1, 104, -1, 216, -1, 218, 165, 216, -1, + 215, -1, 221, 181, -1, 229, 181, -1, 110, 244, + 241, 181, -1, 222, 161, -1, 224, -1, 223, -1, + 224, 226, -1, 223, 165, 226, -1, 231, 79, 160, + -1, 240, 79, -1, 240, 79, 162, 219, 163, -1, + 237, 227, 225, -1, 227, 225, -1, 237, 227, 228, + -1, 227, 228, -1, -1, 36, -1, 37, -1, 38, + -1, 240, -1, 230, -1, 229, 165, 79, -1, 229, + 165, 79, 162, 163, -1, 229, 165, 79, 162, 219, + 163, -1, 229, 165, 79, 162, 163, 180, 250, -1, + 229, 165, 79, 162, 219, 163, 180, 250, -1, 229, + 165, 79, 180, 250, -1, 231, -1, 231, 79, -1, + 231, 79, 162, 163, -1, 231, 79, 162, 219, 163, + -1, 231, 79, 162, 163, 180, 250, -1, 231, 79, + 162, 219, 163, 180, 250, -1, 231, 79, 180, 250, + -1, 106, 79, -1, 240, -1, 238, 240, -1, -1, + 233, -1, 119, 160, 234, 161, -1, 235, -1, 234, + 165, 235, -1, 79, -1, 43, -1, 42, -1, 41, + -1, 4, -1, 239, -1, 236, 238, -1, 106, 238, + -1, 4, -1, 3, -1, 232, 40, -1, 35, 40, + -1, 232, 36, -1, 37, -1, 35, 36, -1, 35, + 37, -1, 39, -1, 241, -1, 244, 241, -1, 242, + -1, 242, 162, 163, -1, 242, 162, 219, 163, -1, + 243, -1, 245, -1, 79, -1, 77, -1, 6, -1, + 7, -1, 8, -1, 5, -1, 29, -1, 30, -1, + 31, -1, 20, -1, 21, -1, 22, -1, 23, -1, + 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, + 32, -1, 33, -1, 34, -1, 44, -1, 45, -1, + 46, -1, 47, -1, 48, -1, 49, -1, 50, -1, + 51, -1, 52, -1, 53, -1, 54, -1, 153, -1, + 55, -1, 56, -1, 57, -1, 58, -1, 155, -1, + 59, -1, 60, -1, 61, -1, 62, -1, 63, -1, + 64, -1, 65, -1, 66, -1, 67, -1, 68, -1, + 69, -1, 70, -1, 71, -1, 72, -1, 73, -1, + 74, -1, 75, -1, 109, -1, 108, -1, 107, -1, + 76, 79, 182, 246, 183, -1, 76, 182, 246, 183, + -1, 247, -1, 246, 247, -1, 240, 248, 181, -1, + 249, -1, 248, 165, 249, -1, 79, -1, 79, 162, + 219, 163, -1, 216, -1, 220, -1, 253, -1, 254, + -1, 256, -1, 255, -1, 262, -1, 251, -1, 260, + -1, 261, -1, 264, -1, 265, -1, 266, -1, 270, + -1, 182, 183, -1, 182, 259, 183, -1, 258, -1, + 255, -1, 182, 183, -1, 182, 259, 183, -1, 252, + -1, 259, 252, -1, 181, -1, 218, 181, -1, 14, + 160, 218, 161, 253, 12, 253, -1, 14, 160, 218, + 161, 253, -1, 14, 160, 218, 161, 254, -1, 14, + 160, 218, 161, 253, 12, 254, -1, 218, -1, 231, + 79, 180, 250, -1, 17, 160, 218, 161, 256, -1, + 18, 218, 179, -1, 19, 179, -1, 78, 160, 263, + 161, 257, -1, 11, 252, 78, 160, 218, 161, 181, + -1, 13, 160, 267, 269, 161, 257, -1, 260, -1, + 251, -1, 263, -1, -1, 268, 181, -1, 268, 181, + 218, -1, 10, 181, -1, 9, 181, -1, 16, 181, + -1, 16, 218, 181, -1, 15, 181, -1, 272, -1, + 220, -1, 221, 258, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 190, 190, 189, 198, 201, 218, 220, 224, 233, - 241, 252, 256, 263, 270, 277, 284, 291, 298, 299, - 305, 309, 316, 322, 331, 335, 339, 340, 349, 350, - 354, 355, 359, 365, 377, 381, 387, 394, 405, 406, - 412, 418, 428, 429, 430, 431, 435, 436, 442, 448, - 457, 458, 464, 473, 474, 480, 489, 490, 496, 502, - 508, 517, 518, 524, 533, 534, 543, 544, 553, 554, - 563, 564, 573, 574, 583, 584, 593, 594, 603, 604, - 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, - 623, 627, 631, 647, 651, 655, 659, 673, 677, 678, - 682, 687, 695, 706, 716, 731, 738, 743, 754, 766, - 767, 768, 769, 773, 777, 778, 787, 796, 805, 814, - 823, 836, 847, 856, 865, 874, 883, 892, 901, 915, - 922, 933, 934, 935, 939, 943, 944, 948, 956, 957, - 958, 959, 960, 961, 962, 963, 964, 968, 969, 977, - 978, 984, 993, 999, 1005, 1014, 1015, 1016, 1017, 1018, - 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, - 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, - 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, - 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, - 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1071, - 1082, 1093, 1107, 1113, 1122, 1127, 1135, 1150, 1155, 1163, - 1169, 1178, 1182, 1188, 1189, 1193, 1194, 1198, 1202, 1203, - 1204, 1205, 1206, 1207, 1208, 1212, 1218, 1227, 1228, 1232, - 1238, 1247, 1257, 1269, 1275, 1284, 1293, 1299, 1305, 1314, - 1318, 1332, 1336, 1337, 1341, 1348, 1355, 1365, 1366, 1370, - 1372, 1378, 1383, 1392, 1398, 1404, 1410, 1416, 1425, 1426, - 1430 + 0, 193, 193, 192, 201, 204, 221, 223, 227, 236, + 244, 255, 259, 266, 273, 280, 287, 294, 301, 302, + 308, 312, 319, 325, 334, 338, 342, 343, 352, 353, + 357, 358, 362, 368, 380, 384, 390, 397, 408, 409, + 415, 421, 431, 432, 433, 434, 438, 439, 445, 451, + 460, 461, 467, 476, 477, 483, 492, 493, 499, 505, + 511, 520, 521, 527, 536, 537, 546, 547, 556, 557, + 566, 567, 576, 577, 586, 587, 596, 597, 606, 607, + 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, + 626, 630, 634, 650, 654, 658, 662, 676, 680, 681, + 685, 690, 698, 709, 719, 734, 741, 746, 757, 769, + 770, 771, 772, 776, 780, 781, 790, 799, 808, 817, + 826, 839, 850, 859, 868, 877, 886, 895, 904, 918, + 925, 936, 937, 941, 948, 949, 956, 990, 991, 992, + 996, 1000, 1001, 1005, 1013, 1014, 1015, 1016, 1017, 1018, + 1019, 1020, 1021, 1025, 1026, 1034, 1035, 1041, 1050, 1056, + 1062, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, + 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, + 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, + 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, + 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, + 1120, 1121, 1122, 1123, 1124, 1128, 1139, 1150, 1164, 1170, + 1179, 1184, 1192, 1207, 1212, 1220, 1226, 1235, 1239, 1245, + 1246, 1250, 1251, 1255, 1259, 1260, 1261, 1262, 1263, 1264, + 1265, 1269, 1275, 1284, 1285, 1289, 1295, 1304, 1314, 1326, + 1332, 1341, 1350, 1356, 1362, 1371, 1375, 1389, 1393, 1394, + 1398, 1405, 1412, 1422, 1423, 1427, 1429, 1435, 1440, 1449, + 1455, 1461, 1467, 1473, 1482, 1483, 1487 }; #endif @@ -822,16 +825,16 @@ static const char *const yytname[] = "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", "LOWP", "MEDIUMP", "HIGHP", "PRECISION", "VERSION", "EXTENSION", "LINE", - "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", "ASM", "CLASS", "UNION", - "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED", "GOTO", "INLINE_TOK", - "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", - "LONG", "SHORT", "DOUBLE", "HALF", "FIXED", "UNSIGNED", "INPUT", - "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", - "FVEC3", "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", - "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", "USING", "'('", - "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", - "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "'='", - "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1", + "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", "LAYOUT_TOK", "ASM", + "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED", + "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", + "EXTERN", "EXTERNAL", "LONG", "SHORT", "DOUBLE", "HALF", "FIXED", + "UNSIGNED", "INPUT", "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", + "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", "SAMPLER2DRECT", + "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", + "USING", "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", + "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", + "':'", "'='", "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1", "version_statement", "extension_statement_list", "extension_statement", "external_declaration_list", "variable_identifier", "primary_expression", "postfix_expression", "integer_expression", "function_call", @@ -850,12 +853,14 @@ static const char *const yytname[] = "function_header", "parameter_declarator", "parameter_declaration", "parameter_qualifier", "parameter_type_specifier", "init_declarator_list", "single_declaration", "fully_specified_type", - "interpolation_qualifier", "parameter_type_qualifier", "type_qualifier", - "storage_qualifier", "type_specifier", "type_specifier_no_prec", - "type_specifier_nonarray", "basic_type_specifier_nonarray", - "precision_qualifier", "struct_specifier", "struct_declaration_list", - "struct_declaration", "struct_declarator_list", "struct_declarator", - "initializer", "declaration_statement", "statement", "statement_matched", + "opt_layout_qualifier", "layout_qualifier", "layout_qualifier_id_list", + "layout_qualifier_id", "interpolation_qualifier", + "parameter_type_qualifier", "type_qualifier", "storage_qualifier", + "type_specifier", "type_specifier_no_prec", "type_specifier_nonarray", + "basic_type_specifier_nonarray", "precision_qualifier", + "struct_specifier", "struct_declaration_list", "struct_declaration", + "struct_declarator_list", "struct_declarator", "initializer", + "declaration_statement", "statement", "statement_matched", "statement_unmatched", "simple_statement", "compound_statement", "statement_no_new_scope", "compound_statement_no_new_scope", "statement_list", "expression_statement", "selection_statement_matched", @@ -886,44 +891,44 @@ static const yytype_uint16 yytoknum[] = 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 40, - 41, 91, 93, 46, 44, 43, 45, 33, 126, 42, - 47, 37, 60, 62, 38, 94, 124, 63, 58, 61, - 59, 123, 125 + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 40, 41, 91, 93, 46, 44, 43, 45, 33, 126, + 42, 47, 37, 60, 62, 38, 94, 124, 63, 58, + 61, 59, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 183, 185, 184, 186, 186, 187, 187, 188, 189, - 189, 190, 191, 191, 191, 191, 191, 191, 192, 192, - 192, 192, 192, 192, 193, 194, 195, 195, 196, 196, - 197, 197, 198, 198, 199, 200, 200, 200, 201, 201, - 201, 201, 202, 202, 202, 202, 203, 203, 203, 203, - 204, 204, 204, 205, 205, 205, 206, 206, 206, 206, - 206, 207, 207, 207, 208, 208, 209, 209, 210, 210, - 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 217, 217, 218, 219, 219, 219, 220, 221, 221, - 222, 222, 223, 224, 224, 225, 225, 225, 225, 226, - 226, 226, 226, 227, 228, 228, 228, 228, 228, 228, - 228, 229, 229, 229, 229, 229, 229, 229, 229, 230, - 230, 231, 231, 231, 232, 233, 233, 233, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 235, 235, 236, - 236, 236, 237, 237, 237, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 239, - 239, 239, 240, 240, 241, 241, 242, 243, 243, 244, - 244, 245, 246, 247, 247, 248, 248, 249, 250, 250, - 250, 250, 250, 250, 250, 251, 251, 252, 252, 253, - 253, 254, 254, 255, 255, 256, 257, 257, 257, 258, - 258, 259, 260, 260, 261, 261, 261, 262, 262, 263, - 263, 264, 264, 265, 265, 265, 265, 265, 266, 266, - 267 + 0, 184, 186, 185, 187, 187, 188, 188, 189, 190, + 190, 191, 192, 192, 192, 192, 192, 192, 193, 193, + 193, 193, 193, 193, 194, 195, 196, 196, 197, 197, + 198, 198, 199, 199, 200, 201, 201, 201, 202, 202, + 202, 202, 203, 203, 203, 203, 204, 204, 204, 204, + 205, 205, 205, 206, 206, 206, 207, 207, 207, 207, + 207, 208, 208, 208, 209, 209, 210, 210, 211, 211, + 212, 212, 213, 213, 214, 214, 215, 215, 216, 216, + 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, + 217, 218, 218, 219, 220, 220, 220, 221, 222, 222, + 223, 223, 224, 225, 225, 226, 226, 226, 226, 227, + 227, 227, 227, 228, 229, 229, 229, 229, 229, 229, + 229, 230, 230, 230, 230, 230, 230, 230, 230, 231, + 231, 232, 232, 233, 234, 234, 235, 236, 236, 236, + 237, 238, 238, 238, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 240, 240, 241, 241, 241, 242, 242, + 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, + 243, 243, 243, 243, 243, 244, 244, 244, 245, 245, + 246, 246, 247, 248, 248, 249, 249, 250, 251, 252, + 252, 253, 253, 254, 255, 255, 255, 255, 255, 255, + 255, 256, 256, 257, 257, 258, 258, 259, 259, 260, + 260, 261, 262, 262, 262, 263, 263, 264, 265, 265, + 266, 266, 266, 267, 267, 268, 268, 269, 269, 270, + 270, 270, 270, 270, 271, 271, 272 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -942,21 +947,21 @@ static const yytype_uint8 yyr2[] = 2, 3, 3, 2, 5, 3, 2, 3, 2, 0, 1, 1, 1, 1, 1, 3, 5, 6, 7, 8, 5, 1, 2, 4, 5, 6, 7, 4, 2, 1, - 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, - 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, - 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 0, 1, 4, 1, 3, 1, 1, 1, 1, + 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, + 2, 2, 1, 1, 2, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 5, 4, 1, 2, 3, 1, 3, 1, - 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, - 3, 1, 2, 1, 2, 7, 5, 5, 7, 1, - 4, 5, 3, 2, 5, 7, 6, 1, 1, 1, - 0, 2, 3, 2, 2, 2, 3, 2, 1, 1, - 2 + 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, + 1, 2, 3, 1, 3, 1, 4, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 1, 1, 2, 3, 1, 2, 1, + 2, 7, 5, 5, 7, 1, 4, 5, 3, 2, + 5, 7, 6, 1, 1, 1, 0, 2, 3, 2, + 2, 2, 3, 2, 1, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -964,730 +969,757 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 4, 0, 0, 6, 0, 1, 2, 5, 0, 0, - 7, 0, 139, 138, 159, 156, 157, 158, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 160, 161, 162, - 172, 173, 174, 0, 142, 143, 146, 140, 133, 132, - 131, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 187, 188, 189, 190, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 0, 155, 154, 0, 211, 210, 209, - 0, 186, 191, 3, 269, 0, 0, 99, 109, 0, - 114, 121, 0, 0, 135, 129, 147, 149, 152, 0, - 153, 9, 268, 0, 144, 145, 141, 0, 0, 128, - 0, 137, 0, 10, 94, 0, 270, 97, 109, 134, - 110, 111, 112, 100, 0, 109, 0, 95, 122, 136, - 130, 0, 148, 0, 0, 0, 0, 214, 0, 0, + 4, 0, 0, 6, 0, 1, 2, 5, 0, 131, + 7, 0, 145, 144, 165, 162, 163, 164, 169, 170, + 171, 172, 173, 174, 175, 176, 177, 166, 167, 168, + 178, 179, 180, 0, 149, 152, 139, 138, 137, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 0, 161, 160, 131, 217, 216, 215, 0, 0, + 192, 197, 131, 275, 0, 0, 99, 109, 0, 114, + 121, 0, 132, 131, 0, 141, 129, 153, 155, 158, + 0, 159, 9, 274, 0, 150, 151, 147, 0, 0, + 128, 131, 143, 0, 0, 10, 94, 131, 276, 97, + 109, 140, 110, 111, 112, 100, 0, 109, 0, 95, + 122, 148, 146, 142, 130, 0, 154, 0, 0, 0, + 0, 220, 0, 136, 0, 134, 0, 0, 131, 0, + 0, 0, 0, 0, 0, 0, 0, 11, 15, 13, + 14, 16, 37, 0, 0, 0, 42, 43, 44, 45, + 249, 131, 245, 12, 18, 38, 20, 25, 26, 0, + 0, 31, 0, 46, 0, 50, 53, 56, 61, 64, + 66, 68, 70, 72, 74, 76, 78, 91, 0, 228, + 0, 129, 234, 247, 229, 230, 232, 231, 131, 235, + 236, 233, 237, 238, 239, 240, 101, 106, 108, 113, + 0, 115, 102, 0, 0, 156, 46, 93, 0, 35, + 8, 0, 225, 0, 223, 219, 221, 96, 133, 0, + 270, 269, 0, 131, 0, 273, 271, 0, 0, 0, + 259, 131, 39, 40, 0, 241, 131, 22, 23, 0, + 0, 29, 28, 0, 161, 32, 34, 81, 82, 84, + 83, 86, 87, 88, 89, 90, 85, 80, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 11, 15, 13, 14, 16, 37, 0, 0, 0, 42, - 43, 44, 45, 243, 0, 239, 12, 18, 38, 20, - 25, 26, 0, 0, 31, 0, 46, 0, 50, 53, - 56, 61, 64, 66, 68, 70, 72, 74, 76, 78, - 91, 0, 222, 0, 129, 228, 241, 223, 224, 226, - 225, 0, 229, 230, 227, 231, 232, 233, 234, 101, - 106, 108, 113, 0, 115, 102, 0, 0, 150, 46, - 93, 0, 35, 8, 0, 219, 0, 217, 213, 215, - 96, 264, 263, 0, 0, 0, 267, 265, 0, 0, - 0, 253, 0, 39, 40, 0, 235, 0, 22, 23, - 0, 0, 29, 28, 0, 155, 32, 34, 81, 82, - 84, 83, 86, 87, 88, 89, 90, 85, 80, 0, - 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 244, 240, 242, 103, 105, 107, 0, 0, - 123, 0, 221, 127, 151, 212, 0, 0, 216, 0, - 258, 257, 260, 0, 266, 0, 252, 249, 0, 0, - 17, 236, 0, 24, 21, 27, 33, 79, 47, 48, + 0, 250, 246, 248, 103, 105, 107, 0, 0, 123, + 0, 227, 127, 157, 218, 0, 0, 222, 135, 0, + 264, 263, 131, 0, 272, 0, 258, 255, 0, 0, + 17, 242, 0, 24, 21, 27, 33, 79, 47, 48, 49, 51, 52, 54, 55, 59, 60, 57, 58, 62, 63, 65, 67, 69, 71, 73, 75, 0, 92, 0, - 116, 0, 120, 0, 124, 0, 218, 0, 259, 0, - 0, 0, 0, 0, 0, 19, 0, 0, 0, 117, - 125, 0, 220, 0, 261, 0, 246, 247, 251, 0, - 0, 238, 254, 237, 77, 104, 118, 0, 126, 0, - 262, 256, 0, 250, 0, 119, 255, 245, 248, 0, - 0, 0, 0 + 116, 0, 120, 0, 124, 0, 224, 0, 265, 0, + 0, 131, 0, 0, 131, 19, 0, 0, 0, 117, + 125, 0, 226, 0, 267, 131, 252, 253, 257, 0, + 0, 244, 260, 243, 77, 104, 118, 0, 126, 0, + 268, 262, 131, 256, 0, 119, 261, 251, 254, 0, + 131, 0, 131 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 9, 3, 6, 10, 83, 166, 167, 168, - 322, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 269, 191, 221, 192, 193, 86, 87, - 88, 210, 123, 124, 211, 89, 90, 91, 92, 125, - 93, 94, 222, 96, 97, 98, 99, 100, 136, 137, - 226, 227, 303, 195, 196, 197, 198, 199, 200, 382, - 383, 201, 202, 203, 204, 319, 205, 206, 207, 312, - 359, 360, 208, 101, 102 + -1, 2, 9, 3, 6, 10, 82, 173, 174, 175, + 332, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 278, 198, 228, 199, 200, 85, 86, + 87, 217, 125, 126, 218, 88, 89, 90, 91, 92, + 144, 145, 93, 127, 94, 95, 229, 97, 98, 99, + 100, 101, 140, 141, 233, 234, 312, 202, 203, 204, + 205, 206, 207, 392, 393, 208, 209, 210, 211, 329, + 212, 213, 214, 322, 369, 370, 215, 102, 103 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -325 +#define YYPACT_NINF -353 static const yytype_int16 yypact[] = { - -52, -1, 67, -325, -31, -325, 37, -325, 23, 3159, - -325, 52, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, 94, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, -72, -325, -325, 12, -325, -325, -325, - 36, -325, -325, 3159, -325, -163, 30, 27, -2, -98, - -325, 114, 144, 3381, -325, -325, -325, 33, -325, 3492, - -325, -325, -325, 117, -325, -325, -325, 17, 3381, -325, - 144, -325, 3492, -325, -325, 391, -325, -325, 35, -325, - -325, -325, -325, -325, 3381, 116, 120, -325, -119, -325, - -325, 2393, -325, 86, 3381, 124, 1799, -325, 25, 26, - 29, 1111, 48, 51, 31, 2077, 53, 2843, 39, 54, - -67, -325, -325, -325, -325, -325, 2843, 2843, 2843, -325, - -325, -325, -325, -325, 571, -325, -325, -325, -44, -325, - -325, -325, 60, -99, 2993, 55, -75, 2843, -10, 4, - 71, -79, 80, 47, 49, 46, 130, 131, -63, -325, - -325, -59, -325, 50, 68, -325, -325, -325, -325, -325, - -325, 751, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, 149, 3381, -129, -325, 2543, 2843, -325, -325, - -325, 69, -325, -325, 1938, 73, -56, -325, -325, -325, - -325, -325, -325, 151, 1635, 2843, -325, -325, -51, 2843, - -108, -325, 2243, -325, -325, -38, -325, 931, -325, -325, - 2843, 3270, -325, -325, 2843, 72, -325, -325, -325, -325, - -325, -325, -325, -325, -325, -325, -325, -325, -325, 2843, - -325, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, - 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, 2843, - 2843, 2843, -325, -325, -325, 75, -325, -325, 2693, 2843, - 58, 77, -325, -325, -325, -325, 2843, 124, -325, 81, - -325, -325, 2243, -27, -325, -25, -325, 78, 162, 83, - -325, -325, 82, 78, 87, -325, -325, -325, -325, -325, - -325, -10, -10, 4, 4, 71, 71, 71, 71, -79, - -79, 80, 47, 49, 46, 130, 131, -102, -325, 2843, - 66, 85, -325, 2843, 70, 89, -325, 2843, -325, 74, - 88, 1111, 95, 96, 1290, -325, 2843, 90, 2843, 98, - -325, 2843, -325, -24, 2843, 1290, 241, -325, -325, 2843, - 119, -325, -325, -325, -325, -325, -325, 2843, -325, 99, - 78, -325, 1111, -325, 2843, -325, -325, -325, -325, -14, - 1469, 268, 1469 + -96, -61, 22, -353, -89, -353, -75, -353, -25, 3345, + -353, -48, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -353, -353, 106, -353, -353, -353, -353, -353, -353, + -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -78, -353, -353, 3, -353, -353, -353, 63, -80, + -353, -353, 3228, -353, -55, -92, -54, -2, -133, -353, + -5, 50, -353, 14, 3572, -353, -353, -353, -56, -353, + 3684, -353, -353, -353, 34, -353, -353, -353, -44, 3572, + -353, 14, -353, 3684, 62, -353, -353, 273, -353, -353, + 87, -353, -353, -353, -353, -353, 3572, 176, 85, -353, + -137, -353, -353, -353, -353, 2454, -353, 33, 3572, 89, + 1856, -353, -15, -353, -33, -353, 28, 42, 997, 43, + 64, 44, 2136, 66, 2907, 48, 69, -68, -353, -353, + -353, -353, -353, 2907, 2907, 2907, -353, -353, -353, -353, + -353, 454, -353, -353, -353, -59, -353, -353, -353, 13, + -17, 3058, 71, 270, 2907, 49, -31, 70, -76, 103, + 57, 60, 61, 144, 145, -85, -353, -353, -104, -353, + 58, 83, -353, -353, -353, -353, -353, -353, 635, -353, + -353, -353, -353, -353, -353, -353, -353, -353, -353, 165, + 3572, -102, -353, 2605, 2907, -353, -353, -353, 82, -353, + -353, 1996, 84, -100, -353, -353, -353, -353, -353, 62, + -353, -353, 172, 1524, 2907, -353, -353, -94, 2907, -90, + -353, 2303, -353, -353, -14, -353, 816, -353, -353, 2907, + 3460, -353, -353, 2907, 90, -353, -353, -353, -353, -353, + -353, -353, -353, -353, -353, -353, -353, -353, 2907, -353, + 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, + 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, + 2907, -353, -353, -353, 91, -353, -353, 2756, 2907, 72, + 93, -353, -353, -353, -353, 2907, 89, -353, -353, 97, + -353, -353, 1691, -7, -353, -4, -353, 94, 179, 99, + -353, -353, 98, 94, 102, -353, -353, -353, -353, -353, + -353, 49, 49, -31, -31, 70, 70, 70, 70, -76, + -76, 103, 57, 60, 61, 144, 145, -58, -353, 2907, + 86, 100, -353, 2907, 88, 101, -353, 2907, -353, 92, + 104, 997, 127, 95, 1177, -353, 2907, 107, 2907, 105, + -353, 2907, -353, 2, 2907, 1177, 255, -353, -353, 2907, + 109, -353, -353, -353, -353, -353, -353, 2907, -353, 130, + 94, -353, 997, -353, 2907, -353, -353, -353, -353, 4, + 1357, 259, 1357 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, - -325, -325, -325, 34, -325, -325, -325, -325, -15, -325, - -100, -88, -115, -105, -3, 1, -4, 0, 2, -5, - -325, -130, -171, -325, -139, -211, 5, 24, -325, -325, - -325, 76, 170, 167, 84, -325, -325, -222, -325, -325, - -35, -325, -9, -54, -325, -325, 213, -325, 160, -123, - -325, -12, -290, 62, -137, -323, -324, -252, -64, -76, - 215, 137, 79, -325, -325, -8, -325, -325, -325, -325, - -325, -325, -325, 219, -325 + -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, + -353, -353, -353, 117, -353, -353, -353, -353, -105, -353, + -86, -69, -82, -91, -21, -20, 68, 108, 67, 80, + -353, -111, -148, -353, -149, -219, 12, 32, -353, -353, + -353, 138, 239, 257, 166, -353, -353, -239, -353, -353, + -353, 146, -353, -353, -27, -353, -9, -74, -353, -353, + 309, -353, 250, -130, -353, 73, -244, 147, -140, -340, + -352, -322, 19, 9, 311, 225, 154, -353, -353, 76, + -353, -353, -353, -353, -353, -353, -353, 317, -353 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -155 +#define YYTABLE_NINF -267 static const yytype_int16 yytable[] = { - 95, 220, 119, 256, 233, 301, 238, 107, 240, 352, - 278, 279, -154, 229, 84, 12, 13, 114, 115, 245, - 318, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 289, 298, 85, 120, 121, 122, 377, 376, 119, - 215, 111, 216, 248, 249, 132, 302, 33, 34, 35, - 299, 36, 37, 38, 39, 40, 291, 129, 138, 1, - 217, 253, 291, 370, 294, 254, 126, 5, 398, 397, - 316, 120, 121, 122, 95, 111, 366, 401, 386, 397, - 4, 388, 127, 326, 130, 7, 220, 351, 84, 393, - 318, 109, -36, 280, 281, 355, 313, 395, 327, 135, - 315, 229, 11, 317, 268, 291, 194, 85, 307, 108, - 294, 323, 381, 291, 290, 212, 219, 250, 110, 251, - 348, 292, 320, 381, 308, 135, 291, 135, 302, 314, - 104, 105, 194, 361, 106, 362, 389, 291, 367, 291, - 291, 243, 244, 77, 78, 79, 400, 12, 13, 8, - 291, 347, 120, 121, 122, 194, 276, 277, -98, 271, - 272, 273, 270, 335, 336, 337, 338, 103, 220, 274, - 275, 282, 283, 317, 331, 332, 220, 339, 340, 33, - 34, 35, 302, 36, 37, 38, 39, 40, 333, 334, - 117, 118, 194, 128, 131, 384, 133, 302, 134, 214, - 302, 219, 223, 225, 212, 230, 231, 234, 302, 232, - 235, 236, 239, 242, 257, 135, 302, 241, 373, 220, - 252, 284, 286, 287, 285, 194, 288, -35, 295, 309, - 114, 304, -30, 194, 306, 390, 349, 353, 194, 354, - 357, 363, 291, 364, 365, 368, -36, 369, 375, 371, - 110, 372, 385, 392, 374, 399, 328, 329, 330, 219, - 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, - 219, 219, 219, 219, 219, 379, 164, 387, 394, 396, - 402, 341, 343, 219, 346, 325, 342, 344, 209, 296, - 345, 219, 213, 112, 224, 356, 310, 297, 378, 391, - 116, 247, 113, 194, 358, 0, 0, 0, 0, 0, - 0, 0, 0, 311, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 219, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 194, 0, 0, 194, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 194, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 194, 0, 0, 0, 0, 0, 0, - 0, 194, 0, 194, 12, 13, 14, 15, 16, 17, - 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, - 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, - 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, - 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, - 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 163, 164, 165, 12, 13, 14, 15, 16, 17, - 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, - 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, - 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, - 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, - 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 163, 164, 246, 12, 13, 14, 15, 16, 17, - 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, - 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, - 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, - 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 96, 108, 121, 247, 310, 249, 12, 13, 242, 298, + 236, -160, 328, 287, 288, 1, 254, 12, 13, 387, + 4, 83, 5, 222, 227, 223, 136, 7, 257, 258, + 226, 386, 128, 265, 122, 123, 124, 8, 33, 142, + 34, 84, 35, 224, 36, 37, 38, 112, 129, 33, + 408, 34, 391, 35, 11, 36, 37, 38, 252, 253, + 307, 300, 407, 391, 362, 316, 133, 104, 303, 119, + 411, 300, 407, 96, 130, 300, 311, 301, 308, 279, + 114, 317, 110, 328, 112, 134, 131, 324, 361, 326, + 132, 121, -36, 299, 83, 323, 365, 289, 290, 325, + 139, 236, 327, 259, 109, 260, 135, 300, 201, 111, + 333, 120, 227, 137, 84, 336, 303, 219, 226, 380, + 111, 376, 79, 122, 123, 124, 116, 117, 238, 139, + 337, 139, 239, 79, 396, 283, 284, 398, 138, 201, + 377, 143, 105, 106, 262, 403, 107, 330, 263, 230, + 357, 300, 358, 405, 371, 285, 286, 372, 300, -98, + 311, 300, 201, 399, 221, 410, 237, 300, 232, 300, + 75, 76, 77, 327, 261, 338, 339, 340, 226, 226, + 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, + 226, 226, 226, 226, 291, 292, 227, 341, 342, 201, + 349, 350, 226, 243, 227, 345, 346, 347, 348, 240, + 226, 219, 122, 123, 124, 311, 343, 344, 383, 280, + 281, 282, 139, 241, 244, 245, 248, 250, 394, 251, + 311, 266, 293, 311, 201, 400, 294, 296, 295, 116, + 297, 311, 201, -35, 304, 313, 315, 201, 227, 311, + 319, -30, 363, 359, 226, 409, 364, 367, 373, 300, + 374, 375, -36, 379, 382, 385, 378, 402, 381, 404, + 395, 412, 351, 384, 352, 389, 12, 13, 14, 15, + 16, 17, 146, 147, 148, 397, 149, 150, 151, 152, + 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 171, + 34, 406, 35, 201, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 156, 157, 158, 159, 160, 161, 162, 305, 216, + 163, 164, 201, 353, 355, 201, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 201, 335, 356, 74, + 75, 76, 77, 78, 220, 318, 306, 113, 231, 366, + 320, 388, 79, 201, 401, 118, 256, 321, 368, 115, + 0, 201, 0, 201, 354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, + 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, + 167, 168, 169, 0, 0, 0, 0, 0, 0, 0, + 277, 0, 0, 0, 170, 171, 172, 12, 13, 14, + 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, + 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 156, 157, 158, 159, 160, 161, 162, 0, + 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, - 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 74, 75, 76, 77, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 163, 164, 293, 12, 13, 14, 15, 16, 17, - 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, - 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, - 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, - 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, + 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 170, 171, 255, 12, 13, + 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, + 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, + 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 74, 75, 76, 77, 78, 0, 0, 0, 0, + 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, - 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, + 81, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 170, 171, 302, 12, + 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, + 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 0, 34, 0, 35, 0, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 156, 157, 158, 159, 160, 161, + 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 163, 164, 321, 12, 13, 14, 15, 16, 17, - 139, 140, 141, 0, 142, 143, 144, 145, 146, 147, - 148, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 149, - 150, 151, 152, 153, 154, 155, 0, 0, 156, 157, + 0, 0, 74, 75, 76, 77, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 76, 77, 78, - 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, + 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 170, 171, 331, + 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, + 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, + 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, - 158, 0, 0, 0, 0, 0, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 163, 164, 12, 13, 14, 15, 16, 17, 139, - 140, 141, 0, 142, 380, 144, 145, 146, 147, 148, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 0, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 149, 150, - 151, 152, 153, 154, 155, 0, 0, 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 76, 77, 78, 79, - 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 170, 171, + 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, + 149, 390, 151, 152, 153, 154, 155, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, + 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 81, 0, 82, 0, 0, 0, 0, 158, - 0, 0, 0, 0, 0, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 163, 115, 12, 13, 14, 15, 16, 17, 139, 140, - 141, 0, 142, 380, 144, 145, 146, 147, 148, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 0, 36, 37, + 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 170, 117, + 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, + 149, 390, 151, 152, 153, 154, 155, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 149, 150, 151, - 152, 153, 154, 155, 0, 0, 156, 157, 0, 0, + 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, + 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, + 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 12, 13, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 170, 171, + 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 0, 157, 158, 159, 160, 161, 162, 0, + 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 81, 0, 82, 0, 0, 0, 0, 158, 0, - 0, 0, 0, 0, 159, 160, 161, 162, 12, 13, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 163, - 164, 0, 0, 0, 0, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 0, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 0, 150, 151, 152, 153, 154, 155, - 0, 0, 156, 157, 0, 0, 0, 0, 0, 0, + 74, 75, 76, 77, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, + 166, 167, 168, 169, 12, 13, 14, 15, 16, 17, + 0, 0, 0, 0, 0, 170, 0, 0, 0, 0, + 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, + 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, + 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 111, 75, 76, + 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 81, 0, 82, - 0, 0, 0, 0, 158, 0, 0, 0, 0, 0, - 159, 160, 161, 162, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 0, 163, 0, 0, 0, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, + 169, 14, 15, 16, 17, 0, 0, 0, 0, 0, + 0, 0, -266, 0, 0, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, - 0, 81, 0, 82, 0, 0, 0, 0, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 228, 41, 42, 43, 44, 45, 46, 47, 48, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 235, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 0, 75, 0, 0, + 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 77, 78, 79, 0, 0, + 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, - 81, 0, 82, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 305, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 0, 150, 151, 152, 153, - 154, 155, 0, 0, 156, 157, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 314, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 0, 157, 158, 159, 160, 161, + 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 78, 79, 0, 0, 0, + 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, - 0, 82, 0, 0, 0, 0, 158, 0, 0, 0, - 0, 0, 159, 160, 161, 162, 12, 13, 14, 15, - 16, 17, 0, 0, 0, 0, 0, 237, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, + 0, 0, 166, 167, 168, 169, 12, 13, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, + 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 0, 157, 158, 159, 160, 161, 162, 0, 0, + 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, + 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, - 16, 17, 158, 0, 0, 0, 0, 0, 159, 160, - 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 81, 14, + 15, 16, 17, 165, 0, 0, 0, 0, 0, 166, + 167, 168, 169, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 0, 157, 158, 159, 160, 161, 162, 0, + 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, - 16, 17, 158, 0, 0, 218, 0, 0, 159, 160, - 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 14, 15, 16, 17, 165, 0, 0, 225, 0, 0, + 166, 167, 168, 169, 0, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 0, 157, 158, 159, 160, 161, 162, + 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, - 16, 17, 158, 0, 0, 300, 0, 0, 159, 160, - 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, + 81, 14, 15, 16, 17, 165, 0, 0, 309, 0, + 0, 166, 167, 168, 169, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 0, 157, 158, 159, 160, 161, + 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, - 16, 17, 158, 0, 0, 350, 0, 0, 159, 160, - 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 81, 14, 15, 16, 17, 165, 0, 0, 360, + 0, 0, 166, 167, 168, 169, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 14, 15, - 16, 17, 158, 0, 0, 0, 0, 0, 159, 160, - 161, 162, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 255, 0, 150, 151, 152, 153, 154, 155, 0, 0, - 156, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 81, 14, 15, 16, 17, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 0, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 264, 0, 157, 158, 159, + 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 82, 0, 0, - 0, 0, 158, 0, 0, 0, 0, 0, 159, 160, - 161, 162, 12, 13, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, - 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, - 0, 81, 0, 82, 41, 42, 43, 44, 45, 46, + 0, 80, 0, 81, 0, 0, 0, 0, 165, 0, + 0, 0, 0, 0, 166, 167, 168, 169, -3, 0, + 0, 12, 13, 14, 15, 16, 17, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 0, 34, 0, 35, 0, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 0, 324, - 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, + 67, 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, - 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, - 0, 0, 81, 0, 82, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 74, 75, 76, 77, 78, 0, + 0, 0, 0, 0, 0, 0, 0, 79, 12, 13, + 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 80, 34, 81, 35, 0, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 77, 78, - 79, 0, 0, 0, 0, 0, 0, 14, 15, 16, + 0, 74, 75, 76, 77, 78, 0, 0, 0, 0, + 0, 0, 0, 0, 79, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 80, 0, + 81, 0, 0, 0, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 0, 334, + 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, + 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, - 0, 0, 0, 81, 0, 82, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 81, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + 76, 77, 0, 0, 0, 0, 0, 0, 0, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 80, 0, 81, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 81, 0, 82 + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81 }; static const yytype_int16 yycheck[] = { - 9, 131, 4, 174, 141, 216, 145, 79, 147, 299, - 89, 90, 79, 136, 9, 3, 4, 180, 181, 158, - 242, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 94, 161, 9, 36, 37, 38, 361, 361, 4, - 159, 76, 161, 87, 88, 99, 217, 35, 36, 37, - 179, 39, 40, 41, 42, 43, 164, 92, 112, 111, - 179, 160, 164, 353, 201, 164, 164, 0, 392, 392, - 178, 36, 37, 38, 83, 110, 178, 400, 368, 402, - 81, 371, 180, 254, 93, 116, 216, 298, 83, 379, - 312, 79, 159, 172, 173, 306, 235, 387, 269, 108, - 239, 224, 79, 242, 179, 164, 115, 83, 164, 181, - 247, 250, 364, 164, 177, 124, 131, 161, 106, 163, - 291, 180, 160, 375, 180, 134, 164, 136, 299, 180, - 36, 37, 141, 160, 40, 160, 160, 164, 349, 164, - 164, 156, 157, 107, 108, 109, 160, 3, 4, 112, - 164, 290, 36, 37, 38, 164, 85, 86, 160, 169, - 170, 171, 177, 278, 279, 280, 281, 115, 298, 165, - 166, 91, 92, 312, 274, 275, 306, 282, 283, 35, - 36, 37, 353, 39, 40, 41, 42, 43, 276, 277, - 160, 164, 201, 79, 161, 366, 79, 368, 181, 79, - 371, 216, 116, 79, 213, 180, 180, 159, 379, 180, - 159, 180, 159, 159, 159, 224, 387, 178, 357, 349, - 160, 174, 176, 93, 175, 234, 95, 159, 79, 78, - 180, 162, 160, 242, 161, 374, 161, 179, 247, 162, - 159, 79, 164, 160, 162, 179, 159, 162, 160, 179, - 106, 162, 162, 12, 180, 394, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 179, 181, 179, 159, 180, - 12, 284, 286, 298, 289, 251, 285, 287, 118, 213, - 288, 306, 125, 80, 134, 307, 234, 213, 362, 375, - 85, 164, 83, 312, 312, -1, -1, -1, -1, -1, - -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, + 9, 79, 4, 152, 223, 154, 3, 4, 148, 94, + 140, 79, 251, 89, 90, 111, 165, 3, 4, 371, + 81, 9, 0, 160, 135, 162, 100, 116, 87, 88, + 135, 371, 165, 181, 36, 37, 38, 112, 35, 113, + 37, 9, 39, 180, 41, 42, 43, 74, 181, 35, + 402, 37, 374, 39, 79, 41, 42, 43, 163, 164, + 162, 165, 402, 385, 308, 165, 93, 115, 208, 161, + 410, 165, 412, 82, 79, 165, 224, 181, 180, 184, + 160, 181, 79, 322, 111, 94, 36, 181, 307, 179, + 40, 4, 160, 178, 82, 244, 315, 173, 174, 248, + 109, 231, 251, 162, 182, 164, 162, 165, 117, 106, + 259, 165, 223, 79, 82, 263, 256, 126, 223, 363, + 106, 179, 119, 36, 37, 38, 181, 182, 161, 138, + 278, 140, 165, 119, 378, 166, 167, 381, 182, 148, + 359, 79, 36, 37, 161, 389, 40, 161, 165, 116, + 299, 165, 300, 397, 161, 85, 86, 161, 165, 161, + 308, 165, 171, 161, 79, 161, 181, 165, 79, 165, + 107, 108, 109, 322, 161, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 91, 92, 307, 283, 284, 208, + 291, 292, 307, 160, 315, 287, 288, 289, 290, 181, + 315, 220, 36, 37, 38, 363, 285, 286, 367, 170, + 171, 172, 231, 181, 160, 181, 160, 179, 376, 160, + 378, 160, 175, 381, 243, 384, 176, 93, 177, 181, + 95, 389, 251, 160, 79, 163, 162, 256, 359, 397, + 78, 161, 180, 162, 359, 404, 163, 160, 79, 165, + 161, 163, 160, 163, 163, 161, 180, 12, 180, 160, + 163, 12, 293, 181, 294, 180, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 180, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 182, + 37, 181, 39, 322, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 220, 120, + 87, 88, 371, 295, 297, 374, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 385, 260, 298, 106, + 107, 108, 109, 110, 127, 239, 220, 78, 138, 316, + 243, 372, 119, 402, 385, 84, 171, 243, 322, 82, + -1, 410, -1, 412, 296, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 349, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 153, -1, 155, -1, + -1, -1, -1, 160, -1, -1, -1, -1, -1, 166, + 167, 168, 169, -1, -1, -1, -1, -1, -1, -1, + 180, -1, -1, -1, 181, 182, 183, 3, 4, 5, + 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, + -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 361, -1, -1, 364, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 375, -1, -1, -1, + 106, 107, 108, 109, 110, -1, -1, -1, -1, -1, + -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 392, -1, -1, -1, -1, -1, -1, - -1, 400, -1, 402, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, + -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, + 166, 167, 168, 169, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 181, 182, 183, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, + -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, - 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, + 155, -1, -1, -1, -1, 160, -1, -1, -1, -1, + -1, 166, 167, 168, 169, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 181, 182, 183, 3, + 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, -1, 37, -1, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, 106, 107, 108, 109, 110, -1, -1, -1, + -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, + -1, 155, -1, -1, -1, -1, 160, -1, -1, -1, + -1, -1, 166, 167, 168, 169, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 181, 182, 183, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, + -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, - 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, + 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, + -1, -1, -1, 166, 167, 168, 169, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 181, 182, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, + -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, - 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, + -1, -1, -1, 166, 167, 168, 169, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 181, 182, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, + -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, + -1, -1, -1, 166, 167, 168, 169, 3, 4, 5, + 6, 7, 8, -1, -1, -1, -1, -1, 181, 182, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, + -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, - 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, + 106, 107, 108, 109, 110, -1, -1, -1, -1, -1, + -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 180, 181, 182, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, + -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, + 166, 167, 168, 169, 3, 4, 5, 6, 7, 8, + -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 152, -1, 154, -1, -1, -1, -1, - 159, -1, -1, -1, -1, -1, 165, 166, 167, 168, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 180, 181, 3, 4, 5, 6, 7, 8, 9, - 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, -1, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, - 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 152, -1, 154, -1, -1, -1, -1, 159, - -1, -1, -1, -1, -1, 165, 166, 167, 168, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 180, 181, 3, 4, 5, 6, 7, 8, 9, 10, - 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, -1, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 152, -1, 154, -1, -1, -1, -1, 159, -1, - -1, -1, -1, -1, 165, 166, 167, 168, 3, 4, - 5, 6, 7, 8, -1, -1, -1, -1, -1, 180, - 181, -1, -1, -1, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, -1, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, - -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 152, -1, 154, - -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, - 165, 166, 167, 168, 5, 6, 7, 8, -1, -1, - -1, -1, -1, -1, -1, 180, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, + -1, -1, -1, -1, 153, -1, 155, -1, -1, -1, + -1, 160, -1, -1, -1, -1, -1, 166, 167, 168, + 169, 5, 6, 7, 8, -1, -1, -1, -1, -1, + -1, -1, 181, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, + -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, - -1, 152, -1, 154, -1, -1, -1, -1, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, - -1, 182, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, + -1, 5, 6, 7, 8, -1, -1, -1, -1, 153, + -1, 155, -1, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, 183, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, + -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, - 152, -1, 154, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - 182, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, -1, -1, -1, 153, + -1, 155, -1, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, 183, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, + 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, - -1, 154, -1, -1, -1, -1, 159, -1, -1, -1, - -1, -1, 165, 166, 167, 168, 3, 4, 5, 6, - 7, 8, -1, -1, -1, -1, -1, 180, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, + -1, 155, -1, -1, -1, -1, 160, -1, -1, -1, + -1, -1, 166, 167, 168, 169, 3, 4, 5, 6, + 7, 8, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, -1, 39, 40, 41, 42, 43, 44, 45, 46, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, + 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, @@ -1695,182 +1727,196 @@ static const yytype_int16 yycheck[] = 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 153, -1, 155, 5, + 6, 7, 8, 160, -1, -1, -1, -1, -1, 166, + 167, 168, 169, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, + -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, - 7, 8, 159, -1, -1, -1, -1, -1, 165, 166, - 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, + 5, 6, 7, 8, 160, -1, -1, 163, -1, -1, + 166, 167, 168, 169, -1, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, + -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, - 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, - 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, + 155, 5, 6, 7, 8, 160, -1, -1, 163, -1, + -1, 166, 167, 168, 169, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, + 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, - 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, - 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, + -1, 155, 5, 6, 7, 8, 160, -1, -1, 163, + -1, -1, 166, 167, 168, 169, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, - 7, 8, 159, -1, -1, 162, -1, -1, 165, 166, - 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, 5, 6, - 7, 8, 159, -1, -1, -1, -1, -1, 165, 166, - 167, 168, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + 153, -1, 155, 5, 6, 7, 8, 160, -1, -1, + -1, -1, -1, 166, 167, 168, 169, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, + 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, -1, 154, -1, -1, - -1, -1, 159, -1, -1, -1, -1, -1, 165, 166, - 167, 168, 3, 4, 5, 6, 7, 8, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, -1, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 153, -1, 155, -1, -1, -1, -1, 160, -1, + -1, -1, -1, -1, 166, 167, 168, 169, 0, -1, + -1, 3, 4, 5, 6, 7, 8, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, -1, 37, -1, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, - -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 106, 107, 108, 109, 110, -1, + -1, -1, -1, -1, -1, -1, -1, 119, 3, 4, + 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 153, 37, 155, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, + -1, -1, -1, -1, 119, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - -1, 152, -1, 154, 44, 45, 46, 47, 48, 49, + 30, 31, 32, 33, 34, -1, -1, -1, 153, -1, + 155, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, - -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, - -1, -1, 152, -1, 154, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, - 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, - 109, -1, -1, -1, -1, -1, -1, 5, 6, 7, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, - -1, -1, -1, 152, -1, 154, 44, 45, 46, 47, + -1, -1, -1, 153, -1, 155, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, + 108, 109, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, -1, 153, -1, 155, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 152, -1, 154 + -1, -1, -1, -1, -1, -1, -1, 153, -1, 155 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 111, 184, 186, 81, 0, 187, 116, 112, 185, - 188, 79, 3, 4, 5, 6, 7, 8, 20, 21, + 0, 111, 185, 187, 81, 0, 188, 116, 112, 186, + 189, 79, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 79, 106, 107, 108, 109, - 110, 152, 154, 189, 219, 220, 221, 222, 223, 228, - 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, - 240, 266, 267, 115, 36, 37, 40, 79, 181, 79, - 106, 233, 239, 266, 180, 181, 253, 160, 164, 4, - 36, 37, 38, 225, 226, 232, 164, 180, 79, 233, - 235, 161, 236, 79, 181, 235, 241, 242, 236, 9, - 10, 11, 13, 14, 15, 16, 17, 18, 19, 78, - 79, 80, 81, 82, 83, 84, 87, 88, 159, 165, - 166, 167, 168, 180, 181, 182, 190, 191, 192, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 217, 219, 220, 235, 246, 247, 248, 249, 250, - 251, 254, 255, 256, 257, 259, 260, 261, 265, 225, - 224, 227, 235, 226, 79, 159, 161, 179, 162, 201, - 214, 218, 235, 116, 241, 79, 243, 244, 182, 242, - 180, 180, 180, 247, 159, 159, 180, 180, 217, 159, - 217, 178, 159, 201, 201, 217, 182, 254, 87, 88, - 161, 163, 160, 160, 164, 77, 215, 159, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 179, 216, - 201, 169, 170, 171, 165, 166, 85, 86, 89, 90, - 172, 173, 91, 92, 174, 175, 176, 93, 95, 94, - 177, 164, 180, 182, 247, 79, 224, 227, 161, 179, - 162, 218, 215, 245, 162, 182, 161, 164, 180, 78, - 246, 255, 262, 217, 180, 217, 178, 217, 230, 258, - 160, 182, 193, 217, 79, 196, 215, 215, 201, 201, - 201, 203, 203, 204, 204, 205, 205, 205, 205, 206, - 206, 207, 208, 209, 210, 211, 212, 217, 215, 161, - 162, 218, 245, 179, 162, 218, 244, 159, 258, 263, - 264, 160, 160, 79, 160, 162, 178, 218, 179, 162, - 245, 179, 162, 217, 180, 160, 248, 249, 251, 179, - 14, 250, 252, 253, 215, 162, 245, 179, 245, 160, - 217, 252, 12, 245, 159, 245, 180, 248, 249, 217, - 160, 248, 12 + 32, 33, 34, 35, 37, 39, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 79, 106, 107, 108, 109, 110, 119, + 153, 155, 190, 220, 221, 222, 223, 224, 229, 230, + 231, 232, 233, 236, 238, 239, 240, 241, 242, 243, + 244, 245, 271, 272, 115, 36, 37, 40, 79, 182, + 79, 106, 238, 244, 160, 271, 181, 182, 258, 161, + 165, 4, 36, 37, 38, 226, 227, 237, 165, 181, + 79, 36, 40, 238, 240, 162, 241, 79, 182, 240, + 246, 247, 241, 79, 234, 235, 9, 10, 11, 13, + 14, 15, 16, 17, 18, 19, 78, 79, 80, 81, + 82, 83, 84, 87, 88, 160, 166, 167, 168, 169, + 181, 182, 183, 191, 192, 193, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 218, 220, + 221, 240, 251, 252, 253, 254, 255, 256, 259, 260, + 261, 262, 264, 265, 266, 270, 226, 225, 228, 240, + 227, 79, 160, 162, 180, 163, 202, 215, 219, 240, + 116, 246, 79, 248, 249, 183, 247, 181, 161, 165, + 181, 181, 252, 160, 160, 181, 181, 218, 160, 218, + 179, 160, 202, 202, 218, 183, 259, 87, 88, 162, + 164, 161, 161, 165, 77, 216, 160, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 180, 217, 202, + 170, 171, 172, 166, 167, 85, 86, 89, 90, 173, + 174, 91, 92, 175, 176, 177, 93, 95, 94, 178, + 165, 181, 183, 252, 79, 225, 228, 162, 180, 163, + 219, 216, 250, 163, 183, 162, 165, 181, 235, 78, + 251, 260, 267, 218, 181, 218, 179, 218, 231, 263, + 161, 183, 194, 218, 79, 197, 216, 216, 202, 202, + 202, 204, 204, 205, 205, 206, 206, 206, 206, 207, + 207, 208, 209, 210, 211, 212, 213, 218, 216, 162, + 163, 219, 250, 180, 163, 219, 249, 160, 263, 268, + 269, 161, 161, 79, 161, 163, 179, 219, 180, 163, + 250, 180, 163, 218, 181, 161, 253, 254, 256, 180, + 14, 255, 257, 258, 216, 163, 250, 180, 250, 161, + 218, 257, 12, 250, 160, 250, 181, 253, 254, 218, + 161, 253, 12 }; #define yyerrok (yyerrstatus = 0) @@ -2724,7 +2770,7 @@ yyreduce: case 2: /* Line 1455 of yacc.c */ -#line 190 "glsl_parser.ypp" +#line 193 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2733,7 +2779,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 198 "glsl_parser.ypp" +#line 201 "glsl_parser.ypp" { state->language_version = 110; ;} @@ -2742,7 +2788,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 202 "glsl_parser.ypp" +#line 205 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2762,7 +2808,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 225 "glsl_parser.ypp" +#line 228 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2773,7 +2819,7 @@ yyreduce: case 9: /* Line 1455 of yacc.c */ -#line 234 "glsl_parser.ypp" +#line 237 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2786,7 +2832,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 242 "glsl_parser.ypp" +#line 245 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2799,7 +2845,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 257 "glsl_parser.ypp" +#line 260 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -2811,7 +2857,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 264 "glsl_parser.ypp" +#line 267 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -2823,7 +2869,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 271 "glsl_parser.ypp" +#line 274 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -2835,7 +2881,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 278 "glsl_parser.ypp" +#line 281 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -2847,7 +2893,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 285 "glsl_parser.ypp" +#line 288 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -2859,7 +2905,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 292 "glsl_parser.ypp" +#line 295 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -2868,7 +2914,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 300 "glsl_parser.ypp" +#line 303 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -2879,7 +2925,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 306 "glsl_parser.ypp" +#line 309 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -2888,7 +2934,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 310 "glsl_parser.ypp" +#line 313 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -2900,7 +2946,7 @@ yyreduce: case 22: /* Line 1455 of yacc.c */ -#line 317 "glsl_parser.ypp" +#line 320 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -2911,7 +2957,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 323 "glsl_parser.ypp" +#line 326 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -2922,7 +2968,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 341 "glsl_parser.ypp" +#line 344 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -2933,7 +2979,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 360 "glsl_parser.ypp" +#line 363 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -2944,7 +2990,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 366 "glsl_parser.ypp" +#line 369 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -2955,7 +3001,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 382 "glsl_parser.ypp" +#line 385 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -2966,7 +3012,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 388 "glsl_parser.ypp" +#line 391 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -2978,7 +3024,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 395 "glsl_parser.ypp" +#line 398 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -2990,7 +3036,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 407 "glsl_parser.ypp" +#line 410 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3001,7 +3047,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 413 "glsl_parser.ypp" +#line 416 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3012,7 +3058,7 @@ yyreduce: case 41: /* Line 1455 of yacc.c */ -#line 419 "glsl_parser.ypp" +#line 422 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3023,35 +3069,35 @@ yyreduce: case 42: /* Line 1455 of yacc.c */ -#line 428 "glsl_parser.ypp" +#line 431 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 429 "glsl_parser.ypp" +#line 432 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 430 "glsl_parser.ypp" +#line 433 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 431 "glsl_parser.ypp" +#line 434 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: /* Line 1455 of yacc.c */ -#line 437 "glsl_parser.ypp" +#line 440 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3062,7 +3108,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 443 "glsl_parser.ypp" +#line 446 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3073,7 +3119,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 449 "glsl_parser.ypp" +#line 452 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3084,7 +3130,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 459 "glsl_parser.ypp" +#line 462 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3095,7 +3141,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 465 "glsl_parser.ypp" +#line 468 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3106,7 +3152,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 475 "glsl_parser.ypp" +#line 478 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3117,7 +3163,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 481 "glsl_parser.ypp" +#line 484 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3128,7 +3174,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 491 "glsl_parser.ypp" +#line 494 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3139,7 +3185,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 497 "glsl_parser.ypp" +#line 500 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3150,7 +3196,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 503 "glsl_parser.ypp" +#line 506 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3161,7 +3207,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 509 "glsl_parser.ypp" +#line 512 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3172,7 +3218,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 519 "glsl_parser.ypp" +#line 522 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3183,7 +3229,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 525 "glsl_parser.ypp" +#line 528 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3194,7 +3240,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 535 "glsl_parser.ypp" +#line 538 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3205,7 +3251,7 @@ yyreduce: case 67: /* Line 1455 of yacc.c */ -#line 545 "glsl_parser.ypp" +#line 548 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3216,7 +3262,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 555 "glsl_parser.ypp" +#line 558 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3227,7 +3273,7 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 565 "glsl_parser.ypp" +#line 568 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3238,7 +3284,7 @@ yyreduce: case 73: /* Line 1455 of yacc.c */ -#line 575 "glsl_parser.ypp" +#line 578 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3249,7 +3295,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 585 "glsl_parser.ypp" +#line 588 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3260,7 +3306,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 595 "glsl_parser.ypp" +#line 598 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3271,7 +3317,7 @@ yyreduce: case 79: /* Line 1455 of yacc.c */ -#line 605 "glsl_parser.ypp" +#line 608 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3282,84 +3328,84 @@ yyreduce: case 80: /* Line 1455 of yacc.c */ -#line 613 "glsl_parser.ypp" +#line 616 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 614 "glsl_parser.ypp" +#line 617 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: /* Line 1455 of yacc.c */ -#line 615 "glsl_parser.ypp" +#line 618 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: /* Line 1455 of yacc.c */ -#line 616 "glsl_parser.ypp" +#line 619 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: /* Line 1455 of yacc.c */ -#line 617 "glsl_parser.ypp" +#line 620 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: /* Line 1455 of yacc.c */ -#line 618 "glsl_parser.ypp" +#line 621 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: /* Line 1455 of yacc.c */ -#line 619 "glsl_parser.ypp" +#line 622 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 620 "glsl_parser.ypp" +#line 623 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 621 "glsl_parser.ypp" +#line 624 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 622 "glsl_parser.ypp" +#line 625 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: /* Line 1455 of yacc.c */ -#line 623 "glsl_parser.ypp" +#line 626 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: /* Line 1455 of yacc.c */ -#line 628 "glsl_parser.ypp" +#line 631 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3368,7 +3414,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 632 "glsl_parser.ypp" +#line 635 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3386,7 +3432,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 652 "glsl_parser.ypp" +#line 655 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3395,7 +3441,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 656 "glsl_parser.ypp" +#line 659 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3404,7 +3450,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 660 "glsl_parser.ypp" +#line 663 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3420,7 +3466,7 @@ yyreduce: case 100: /* Line 1455 of yacc.c */ -#line 683 "glsl_parser.ypp" +#line 686 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3430,7 +3476,7 @@ yyreduce: case 101: /* Line 1455 of yacc.c */ -#line 688 "glsl_parser.ypp" +#line 691 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3440,7 +3486,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 696 "glsl_parser.ypp" +#line 699 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3453,7 +3499,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 707 "glsl_parser.ypp" +#line 710 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3468,7 +3514,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 717 "glsl_parser.ypp" +#line 720 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3485,7 +3531,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 732 "glsl_parser.ypp" +#line 735 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3497,7 +3543,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 739 "glsl_parser.ypp" +#line 742 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3507,7 +3553,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 744 "glsl_parser.ypp" +#line 747 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3523,7 +3569,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 755 "glsl_parser.ypp" +#line 758 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3537,35 +3583,35 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 766 "glsl_parser.ypp" +#line 769 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: /* Line 1455 of yacc.c */ -#line 767 "glsl_parser.ypp" +#line 770 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: /* Line 1455 of yacc.c */ -#line 768 "glsl_parser.ypp" +#line 771 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: /* Line 1455 of yacc.c */ -#line 769 "glsl_parser.ypp" +#line 772 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 115: /* Line 1455 of yacc.c */ -#line 779 "glsl_parser.ypp" +#line 782 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3579,7 +3625,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 788 "glsl_parser.ypp" +#line 791 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3593,7 +3639,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 797 "glsl_parser.ypp" +#line 800 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3607,7 +3653,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 806 "glsl_parser.ypp" +#line 809 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3621,7 +3667,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 815 "glsl_parser.ypp" +#line 818 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3635,7 +3681,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 824 "glsl_parser.ypp" +#line 827 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3649,7 +3695,7 @@ yyreduce: case 121: /* Line 1455 of yacc.c */ -#line 837 "glsl_parser.ypp" +#line 840 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3665,7 +3711,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 848 "glsl_parser.ypp" +#line 851 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3679,7 +3725,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 857 "glsl_parser.ypp" +#line 860 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3693,7 +3739,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 866 "glsl_parser.ypp" +#line 869 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3707,7 +3753,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 875 "glsl_parser.ypp" +#line 878 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3721,7 +3767,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 884 "glsl_parser.ypp" +#line 887 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3735,7 +3781,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 893 "glsl_parser.ypp" +#line 896 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3749,7 +3795,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 902 "glsl_parser.ypp" +#line 905 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3765,7 +3811,7 @@ yyreduce: case 129: /* Line 1455 of yacc.c */ -#line 916 "glsl_parser.ypp" +#line 919 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3777,7 +3823,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 923 "glsl_parser.ypp" +#line 926 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3790,127 +3836,188 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 933 "glsl_parser.ypp" +#line 936 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; ;} + break; + + case 133: + +/* Line 1455 of yacc.c */ +#line 942 "glsl_parser.ypp" + { + (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); + ;} + break; + + case 135: + +/* Line 1455 of yacc.c */ +#line 950 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; + ;} + break; + + case 136: + +/* Line 1455 of yacc.c */ +#line 957 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = 0; + + if (state->ARB_fragment_coord_conventions_enable) { + bool got_one = false; + + if (strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) { + got_one = true; + (yyval.type_qualifier).q.origin_upper_left = 1; + } else if (strcmp((yyvsp[(1) - (1)].identifier), "pixel_center_integer") == 0) { + got_one = true; + (yyval.type_qualifier).q.pixel_center_integer = 1; + } + + if (state->ARB_fragment_coord_conventions_warn && got_one) { + _mesa_glsl_warning(& (yylsp[(1) - (1)]), state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier)); + } + } + + /* If the identifier didn't match any known layout identifiers, + * emit an error. + */ + if ((yyval.type_qualifier).i == 0) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "unrecognized layout identifier " + "`%s'\n", (yyvsp[(1) - (1)].identifier)); + YYERROR; + } + ;} + break; + + case 137: + +/* Line 1455 of yacc.c */ +#line 990 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; - case 132: + case 138: /* Line 1455 of yacc.c */ -#line 934 "glsl_parser.ypp" +#line 991 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; - case 133: + case 139: /* Line 1455 of yacc.c */ -#line 935 "glsl_parser.ypp" +#line 992 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; - case 134: + case 140: /* Line 1455 of yacc.c */ -#line 939 "glsl_parser.ypp" +#line 996 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; - case 136: + case 142: /* Line 1455 of yacc.c */ -#line 945 "glsl_parser.ypp" +#line 1002 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} break; - case 137: + case 143: /* Line 1455 of yacc.c */ -#line 949 "glsl_parser.ypp" +#line 1006 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; ;} break; - case 138: + case 144: /* Line 1455 of yacc.c */ -#line 956 "glsl_parser.ypp" +#line 1013 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; - case 139: + case 145: /* Line 1455 of yacc.c */ -#line 957 "glsl_parser.ypp" +#line 1014 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; - case 140: + case 146: /* Line 1455 of yacc.c */ -#line 958 "glsl_parser.ypp" - { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.varying = 1; ;} +#line 1015 "glsl_parser.ypp" + { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; - case 141: + case 147: /* Line 1455 of yacc.c */ -#line 959 "glsl_parser.ypp" +#line 1016 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; - case 142: + case 148: /* Line 1455 of yacc.c */ -#line 960 "glsl_parser.ypp" +#line 1017 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; - case 143: + case 149: /* Line 1455 of yacc.c */ -#line 961 "glsl_parser.ypp" +#line 1018 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; - case 144: + case 150: /* Line 1455 of yacc.c */ -#line 962 "glsl_parser.ypp" +#line 1019 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; - case 145: + case 151: /* Line 1455 of yacc.c */ -#line 963 "glsl_parser.ypp" +#line 1020 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; - case 146: + case 152: /* Line 1455 of yacc.c */ -#line 964 "glsl_parser.ypp" +#line 1021 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; - case 148: + case 154: /* Line 1455 of yacc.c */ -#line 970 "glsl_parser.ypp" +#line 1027 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); ;} break; - case 150: + case 156: /* Line 1455 of yacc.c */ -#line 979 "glsl_parser.ypp" +#line 1036 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -3918,10 +4025,10 @@ yyreduce: ;} break; - case 151: + case 157: /* Line 1455 of yacc.c */ -#line 985 "glsl_parser.ypp" +#line 1042 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -3929,10 +4036,10 @@ yyreduce: ;} break; - case 152: + case 158: /* Line 1455 of yacc.c */ -#line 994 "glsl_parser.ypp" +#line 1051 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -3940,10 +4047,10 @@ yyreduce: ;} break; - case 153: + case 159: /* Line 1455 of yacc.c */ -#line 1000 "glsl_parser.ypp" +#line 1057 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -3951,10 +4058,10 @@ yyreduce: ;} break; - case 154: + case 160: /* Line 1455 of yacc.c */ -#line 1006 "glsl_parser.ypp" +#line 1063 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -3962,388 +4069,388 @@ yyreduce: ;} break; - case 155: + case 161: /* Line 1455 of yacc.c */ -#line 1014 "glsl_parser.ypp" +#line 1071 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; - case 156: + case 162: /* Line 1455 of yacc.c */ -#line 1015 "glsl_parser.ypp" +#line 1072 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; - case 157: + case 163: /* Line 1455 of yacc.c */ -#line 1016 "glsl_parser.ypp" +#line 1073 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; - case 158: + case 164: /* Line 1455 of yacc.c */ -#line 1017 "glsl_parser.ypp" +#line 1074 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; - case 159: + case 165: /* Line 1455 of yacc.c */ -#line 1018 "glsl_parser.ypp" +#line 1075 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; - case 160: + case 166: /* Line 1455 of yacc.c */ -#line 1019 "glsl_parser.ypp" +#line 1076 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; - case 161: + case 167: /* Line 1455 of yacc.c */ -#line 1020 "glsl_parser.ypp" +#line 1077 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; - case 162: + case 168: /* Line 1455 of yacc.c */ -#line 1021 "glsl_parser.ypp" +#line 1078 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; - case 163: + case 169: /* Line 1455 of yacc.c */ -#line 1022 "glsl_parser.ypp" +#line 1079 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; - case 164: + case 170: /* Line 1455 of yacc.c */ -#line 1023 "glsl_parser.ypp" +#line 1080 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; - case 165: + case 171: /* Line 1455 of yacc.c */ -#line 1024 "glsl_parser.ypp" +#line 1081 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; - case 166: + case 172: /* Line 1455 of yacc.c */ -#line 1025 "glsl_parser.ypp" +#line 1082 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; - case 167: + case 173: /* Line 1455 of yacc.c */ -#line 1026 "glsl_parser.ypp" +#line 1083 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; - case 168: + case 174: /* Line 1455 of yacc.c */ -#line 1027 "glsl_parser.ypp" +#line 1084 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; - case 169: + case 175: /* Line 1455 of yacc.c */ -#line 1028 "glsl_parser.ypp" +#line 1085 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; - case 170: + case 176: /* Line 1455 of yacc.c */ -#line 1029 "glsl_parser.ypp" +#line 1086 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; - case 171: + case 177: /* Line 1455 of yacc.c */ -#line 1030 "glsl_parser.ypp" +#line 1087 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; - case 172: + case 178: /* Line 1455 of yacc.c */ -#line 1031 "glsl_parser.ypp" +#line 1088 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; - case 173: + case 179: /* Line 1455 of yacc.c */ -#line 1032 "glsl_parser.ypp" +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; - case 174: + case 180: /* Line 1455 of yacc.c */ -#line 1033 "glsl_parser.ypp" +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; - case 175: + case 181: /* Line 1455 of yacc.c */ -#line 1034 "glsl_parser.ypp" +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; - case 176: + case 182: /* Line 1455 of yacc.c */ -#line 1035 "glsl_parser.ypp" +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; - case 177: + case 183: /* Line 1455 of yacc.c */ -#line 1036 "glsl_parser.ypp" +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; - case 178: + case 184: /* Line 1455 of yacc.c */ -#line 1037 "glsl_parser.ypp" +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; - case 179: + case 185: /* Line 1455 of yacc.c */ -#line 1038 "glsl_parser.ypp" +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; - case 180: + case 186: /* Line 1455 of yacc.c */ -#line 1039 "glsl_parser.ypp" +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; - case 181: + case 187: /* Line 1455 of yacc.c */ -#line 1040 "glsl_parser.ypp" +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; - case 182: + case 188: /* Line 1455 of yacc.c */ -#line 1041 "glsl_parser.ypp" +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; - case 183: + case 189: /* Line 1455 of yacc.c */ -#line 1042 "glsl_parser.ypp" +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; - case 184: + case 190: /* Line 1455 of yacc.c */ -#line 1043 "glsl_parser.ypp" +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; - case 185: + case 191: /* Line 1455 of yacc.c */ -#line 1044 "glsl_parser.ypp" +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; - case 186: + case 192: /* Line 1455 of yacc.c */ -#line 1045 "glsl_parser.ypp" +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; - case 187: + case 193: /* Line 1455 of yacc.c */ -#line 1046 "glsl_parser.ypp" +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; - case 188: + case 194: /* Line 1455 of yacc.c */ -#line 1047 "glsl_parser.ypp" +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; - case 189: + case 195: /* Line 1455 of yacc.c */ -#line 1048 "glsl_parser.ypp" +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; - case 190: + case 196: /* Line 1455 of yacc.c */ -#line 1049 "glsl_parser.ypp" +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; - case 191: + case 197: /* Line 1455 of yacc.c */ -#line 1050 "glsl_parser.ypp" +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; - case 192: + case 198: /* Line 1455 of yacc.c */ -#line 1051 "glsl_parser.ypp" +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; - case 193: + case 199: /* Line 1455 of yacc.c */ -#line 1052 "glsl_parser.ypp" +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; - case 194: + case 200: /* Line 1455 of yacc.c */ -#line 1053 "glsl_parser.ypp" +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; - case 195: + case 201: /* Line 1455 of yacc.c */ -#line 1054 "glsl_parser.ypp" +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; - case 196: + case 202: /* Line 1455 of yacc.c */ -#line 1055 "glsl_parser.ypp" +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; - case 197: + case 203: /* Line 1455 of yacc.c */ -#line 1056 "glsl_parser.ypp" +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; - case 198: + case 204: /* Line 1455 of yacc.c */ -#line 1057 "glsl_parser.ypp" +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; - case 199: + case 205: /* Line 1455 of yacc.c */ -#line 1058 "glsl_parser.ypp" +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; - case 200: + case 206: /* Line 1455 of yacc.c */ -#line 1059 "glsl_parser.ypp" +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; - case 201: + case 207: /* Line 1455 of yacc.c */ -#line 1060 "glsl_parser.ypp" +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; - case 202: + case 208: /* Line 1455 of yacc.c */ -#line 1061 "glsl_parser.ypp" +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; - case 203: + case 209: /* Line 1455 of yacc.c */ -#line 1062 "glsl_parser.ypp" +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; - case 204: + case 210: /* Line 1455 of yacc.c */ -#line 1063 "glsl_parser.ypp" +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; - case 205: + case 211: /* Line 1455 of yacc.c */ -#line 1064 "glsl_parser.ypp" +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; - case 206: + case 212: /* Line 1455 of yacc.c */ -#line 1065 "glsl_parser.ypp" +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; - case 207: + case 213: /* Line 1455 of yacc.c */ -#line 1066 "glsl_parser.ypp" +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; - case 208: + case 214: /* Line 1455 of yacc.c */ -#line 1067 "glsl_parser.ypp" +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; - case 209: + case 215: /* Line 1455 of yacc.c */ -#line 1071 "glsl_parser.ypp" +#line 1128 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4357,10 +4464,10 @@ yyreduce: ;} break; - case 210: + case 216: /* Line 1455 of yacc.c */ -#line 1082 "glsl_parser.ypp" +#line 1139 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4374,10 +4481,10 @@ yyreduce: ;} break; - case 211: + case 217: /* Line 1455 of yacc.c */ -#line 1093 "glsl_parser.ypp" +#line 1150 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4391,10 +4498,10 @@ yyreduce: ;} break; - case 212: + case 218: /* Line 1455 of yacc.c */ -#line 1108 "glsl_parser.ypp" +#line 1165 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4402,10 +4509,10 @@ yyreduce: ;} break; - case 213: + case 219: /* Line 1455 of yacc.c */ -#line 1114 "glsl_parser.ypp" +#line 1171 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4413,30 +4520,30 @@ yyreduce: ;} break; - case 214: + case 220: /* Line 1455 of yacc.c */ -#line 1123 "glsl_parser.ypp" +#line 1180 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); ;} break; - case 215: + case 221: /* Line 1455 of yacc.c */ -#line 1128 "glsl_parser.ypp" +#line 1185 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); ;} break; - case 216: + case 222: /* Line 1455 of yacc.c */ -#line 1136 "glsl_parser.ypp" +#line 1193 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4450,30 +4557,30 @@ yyreduce: ;} break; - case 217: + case 223: /* Line 1455 of yacc.c */ -#line 1151 "glsl_parser.ypp" +#line 1208 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); ;} break; - case 218: + case 224: /* Line 1455 of yacc.c */ -#line 1156 "glsl_parser.ypp" +#line 1213 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); ;} break; - case 219: + case 225: /* Line 1455 of yacc.c */ -#line 1164 "glsl_parser.ypp" +#line 1221 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4481,10 +4588,10 @@ yyreduce: ;} break; - case 220: + case 226: /* Line 1455 of yacc.c */ -#line 1170 "glsl_parser.ypp" +#line 1227 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4492,31 +4599,31 @@ yyreduce: ;} break; - case 225: + case 231: /* Line 1455 of yacc.c */ -#line 1193 "glsl_parser.ypp" +#line 1250 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 231: + case 237: /* Line 1455 of yacc.c */ -#line 1205 "glsl_parser.ypp" +#line 1262 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 232: + case 238: /* Line 1455 of yacc.c */ -#line 1206 "glsl_parser.ypp" +#line 1263 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 235: + case 241: /* Line 1455 of yacc.c */ -#line 1213 "glsl_parser.ypp" +#line 1270 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4524,10 +4631,10 @@ yyreduce: ;} break; - case 236: + case 242: /* Line 1455 of yacc.c */ -#line 1219 "glsl_parser.ypp" +#line 1276 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4535,17 +4642,17 @@ yyreduce: ;} break; - case 237: + case 243: /* Line 1455 of yacc.c */ -#line 1227 "glsl_parser.ypp" +#line 1284 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 239: + case 245: /* Line 1455 of yacc.c */ -#line 1233 "glsl_parser.ypp" +#line 1290 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4553,10 +4660,10 @@ yyreduce: ;} break; - case 240: + case 246: /* Line 1455 of yacc.c */ -#line 1239 "glsl_parser.ypp" +#line 1296 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4564,10 +4671,10 @@ yyreduce: ;} break; - case 241: + case 247: /* Line 1455 of yacc.c */ -#line 1248 "glsl_parser.ypp" +#line 1305 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4579,10 +4686,10 @@ yyreduce: ;} break; - case 242: + case 248: /* Line 1455 of yacc.c */ -#line 1258 "glsl_parser.ypp" +#line 1315 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4593,10 +4700,10 @@ yyreduce: ;} break; - case 243: + case 249: /* Line 1455 of yacc.c */ -#line 1270 "glsl_parser.ypp" +#line 1327 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4604,10 +4711,10 @@ yyreduce: ;} break; - case 244: + case 250: /* Line 1455 of yacc.c */ -#line 1276 "glsl_parser.ypp" +#line 1333 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4615,10 +4722,10 @@ yyreduce: ;} break; - case 245: + case 251: /* Line 1455 of yacc.c */ -#line 1285 "glsl_parser.ypp" +#line 1342 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4626,10 +4733,10 @@ yyreduce: ;} break; - case 246: + case 252: /* Line 1455 of yacc.c */ -#line 1294 "glsl_parser.ypp" +#line 1351 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4637,10 +4744,10 @@ yyreduce: ;} break; - case 247: + case 253: /* Line 1455 of yacc.c */ -#line 1300 "glsl_parser.ypp" +#line 1357 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4648,10 +4755,10 @@ yyreduce: ;} break; - case 248: + case 254: /* Line 1455 of yacc.c */ -#line 1306 "glsl_parser.ypp" +#line 1363 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4659,19 +4766,19 @@ yyreduce: ;} break; - case 249: + case 255: /* Line 1455 of yacc.c */ -#line 1315 "glsl_parser.ypp" +#line 1372 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} break; - case 250: + case 256: /* Line 1455 of yacc.c */ -#line 1319 "glsl_parser.ypp" +#line 1376 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4684,10 +4791,10 @@ yyreduce: ;} break; - case 254: + case 260: /* Line 1455 of yacc.c */ -#line 1342 "glsl_parser.ypp" +#line 1399 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4696,10 +4803,10 @@ yyreduce: ;} break; - case 255: + case 261: /* Line 1455 of yacc.c */ -#line 1349 "glsl_parser.ypp" +#line 1406 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4708,10 +4815,10 @@ yyreduce: ;} break; - case 256: + case 262: /* Line 1455 of yacc.c */ -#line 1356 "glsl_parser.ypp" +#line 1413 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4720,39 +4827,39 @@ yyreduce: ;} break; - case 260: + case 266: /* Line 1455 of yacc.c */ -#line 1372 "glsl_parser.ypp" +#line 1429 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 261: + case 267: /* Line 1455 of yacc.c */ -#line 1379 "glsl_parser.ypp" +#line 1436 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; ;} break; - case 262: + case 268: /* Line 1455 of yacc.c */ -#line 1384 "glsl_parser.ypp" +#line 1441 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); ;} break; - case 263: + case 269: /* Line 1455 of yacc.c */ -#line 1393 "glsl_parser.ypp" +#line 1450 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -4760,10 +4867,10 @@ yyreduce: ;} break; - case 264: + case 270: /* Line 1455 of yacc.c */ -#line 1399 "glsl_parser.ypp" +#line 1456 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -4771,10 +4878,10 @@ yyreduce: ;} break; - case 265: + case 271: /* Line 1455 of yacc.c */ -#line 1405 "glsl_parser.ypp" +#line 1462 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -4782,10 +4889,10 @@ yyreduce: ;} break; - case 266: + case 272: /* Line 1455 of yacc.c */ -#line 1411 "glsl_parser.ypp" +#line 1468 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -4793,10 +4900,10 @@ yyreduce: ;} break; - case 267: + case 273: /* Line 1455 of yacc.c */ -#line 1417 "glsl_parser.ypp" +#line 1474 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -4804,24 +4911,24 @@ yyreduce: ;} break; - case 268: + case 274: /* Line 1455 of yacc.c */ -#line 1425 "glsl_parser.ypp" +#line 1482 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; - case 269: + case 275: /* Line 1455 of yacc.c */ -#line 1426 "glsl_parser.ypp" +#line 1483 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 270: + case 276: /* Line 1455 of yacc.c */ -#line 1431 "glsl_parser.ypp" +#line 1488 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -4834,7 +4941,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4838 "glsl_parser.cpp" +#line 4945 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 6cbab40557..9c4e12fd7e 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -155,46 +155,47 @@ EOL = 371, INTERFACE = 372, OUTPUT = 373, - ASM = 374, - CLASS = 375, - UNION = 376, - ENUM = 377, - TYPEDEF = 378, - TEMPLATE = 379, - THIS = 380, - PACKED = 381, - GOTO = 382, - INLINE_TOK = 383, - NOINLINE = 384, - VOLATILE = 385, - PUBLIC_TOK = 386, - STATIC = 387, - EXTERN = 388, - EXTERNAL = 389, - LONG = 390, - SHORT = 391, - DOUBLE = 392, - HALF = 393, - FIXED = 394, - UNSIGNED = 395, - INPUT = 396, - OUPTUT = 397, - HVEC2 = 398, - HVEC3 = 399, - HVEC4 = 400, - DVEC2 = 401, - DVEC3 = 402, - DVEC4 = 403, - FVEC2 = 404, - FVEC3 = 405, - FVEC4 = 406, - SAMPLER2DRECT = 407, - SAMPLER3DRECT = 408, - SAMPLER2DRECTSHADOW = 409, - SIZEOF = 410, - CAST = 411, - NAMESPACE = 412, - USING = 413 + LAYOUT_TOK = 374, + ASM = 375, + CLASS = 376, + UNION = 377, + ENUM = 378, + TYPEDEF = 379, + TEMPLATE = 380, + THIS = 381, + PACKED = 382, + GOTO = 383, + INLINE_TOK = 384, + NOINLINE = 385, + VOLATILE = 386, + PUBLIC_TOK = 387, + STATIC = 388, + EXTERN = 389, + EXTERNAL = 390, + LONG = 391, + SHORT = 392, + DOUBLE = 393, + HALF = 394, + FIXED = 395, + UNSIGNED = 396, + INPUT = 397, + OUPTUT = 398, + HVEC2 = 399, + HVEC3 = 400, + HVEC4 = 401, + DVEC2 = 402, + DVEC3 = 403, + DVEC4 = 404, + FVEC2 = 405, + FVEC3 = 406, + FVEC4 = 407, + SAMPLER2DRECT = 408, + SAMPLER3DRECT = 409, + SAMPLER2DRECTSHADOW = 410, + SIZEOF = 411, + CAST = 412, + NAMESPACE = 413, + USING = 414 }; #endif @@ -236,7 +237,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 240 "glsl_parser.h" +#line 241 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 6782255d45..53132d9067 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -97,6 +97,7 @@ %token LOWP MEDIUMP HIGHP PRECISION %token VERSION EXTENSION LINE PRAGMA COLON EOL INTERFACE OUTPUT +%token LAYOUT_TOK /* Reserved words that are not actually used in the grammar. */ @@ -117,6 +118,8 @@ %type type_qualifier %type storage_qualifier %type interpolation_qualifier +%type opt_layout_qualifier layout_qualifier +%type layout_qualifier_id_list layout_qualifier_id %type type_specifier %type type_specifier_no_prec %type type_specifier_nonarray @@ -929,6 +932,60 @@ fully_specified_type: } ; +opt_layout_qualifier: + { $$.i = 0; } + | layout_qualifier + ; + +layout_qualifier: + LAYOUT_TOK '(' layout_qualifier_id_list ')' + { + $$ = $3; + } + ; + +layout_qualifier_id_list: + layout_qualifier_id + | layout_qualifier_id_list ',' layout_qualifier_id + { + $$.i = $1.i | $3.i; + } + ; + +layout_qualifier_id: + IDENTIFIER + { + $$.i = 0; + + if (state->ARB_fragment_coord_conventions_enable) { + bool got_one = false; + + if (strcmp($1, "origin_upper_left") == 0) { + got_one = true; + $$.q.origin_upper_left = 1; + } else if (strcmp($1, "pixel_center_integer") == 0) { + got_one = true; + $$.q.pixel_center_integer = 1; + } + + if (state->ARB_fragment_coord_conventions_warn && got_one) { + _mesa_glsl_warning(& @1, state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", $1); + } + } + + /* If the identifier didn't match any known layout identifiers, + * emit an error. + */ + if ($$.i == 0) { + _mesa_glsl_error(& @1, state, "unrecognized layout identifier " + "`%s'\n", $1); + YYERROR; + } + } + ; + interpolation_qualifier: SMOOTH { $$.i = 0; $$.q.smooth = 1; } | FLAT { $$.i = 0; $$.q.flat = 1; } @@ -955,9 +1012,9 @@ type_qualifier: storage_qualifier: CONST_TOK { $$.i = 0; $$.q.constant = 1; } | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } - | VARYING { $$.i = 0; $$.q.varying = 1; } + | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; } | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } - | IN { $$.i = 0; $$.q.in = 1; } + | opt_layout_qualifier IN { $$.i = 0; $$.q.in = 1; } | OUT { $$.i = 0; $$.q.out = 1; } | CENTROID IN { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } | CENTROID OUT { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 009aabcd35..20a5021b14 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -198,6 +198,13 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, state->ARB_draw_buffers_enable = (ext_mode != extension_disable); state->ARB_draw_buffers_warn = (ext_mode == extension_warn); } + } else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) { + state->ARB_fragment_coord_conventions_enable = + (ext_mode != extension_disable); + state->ARB_fragment_coord_conventions_warn = + (ext_mode == extension_warn); + + unsupported = !state->extensions->ARB_fragment_coord_conventions; } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) { state->ARB_texture_rectangle_enable = (ext_mode != extension_disable); state->ARB_texture_rectangle_warn = (ext_mode == extension_warn); diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 3865843fd1..3b53ba07f6 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -118,6 +118,8 @@ struct _mesa_glsl_parse_state { /*@{*/ unsigned ARB_draw_buffers_enable:1; unsigned ARB_draw_buffers_warn:1; + unsigned ARB_fragment_coord_conventions_enable:1; + unsigned ARB_fragment_coord_conventions_warn:1; unsigned ARB_texture_rectangle_enable:1; unsigned ARB_texture_rectangle_warn:1; unsigned EXT_texture_array_enable:1; -- cgit v1.2.3 From 8d8469eb2ade4fd48188403351a38f740987fb80 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 30 Jun 2010 17:48:09 -0700 Subject: glsl2: Perform some semantic checking of ARB_fcc layout qualifiers The rest cannot be handled until built-in variables (i.e., gl_FragCoord) can be redeclared to add qualifiers. --- src/glsl/ast_to_hir.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 98ea789249..d82cf33389 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1542,6 +1542,19 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, else var->interpolation = ir_var_smooth; + /* FINISHME: Apply the fragment coord convetion layout qualifiers. + */ + if ((qual->origin_upper_left || qual->pixel_center_integer) + && (strcmp(var->name, "gl_FragCoord") != 0)) { + const char *const qual_string = (qual->origin_upper_left) + ? "origin_upper_left" : "pixel_center_integer"; + + _mesa_glsl_error(loc, state, + "layout qualifier `%s' can only be applied to " + "fragment shader input `gl_FragCoord'", + qual_string); + } + if (var->type->is_array() && (state->language_version >= 120)) { var->array_lvalue = true; } -- cgit v1.2.3 From 4a962170d7cf4243d6ae156fca20a6167388925d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 14:41:51 -0700 Subject: glsl2: Add support for redeclaring layout of gl_FragCoord for ARB_fcc. Fixes: glsl-arb-fragment-coord-conventions --- src/glsl/ast_to_hir.cpp | 15 +++++++++++++-- src/glsl/ir.h | 4 ++++ src/glsl/ir_clone.cpp | 2 ++ src/mesa/program/ir_to_mesa.cpp | 7 ++++++- 4 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index d82cf33389..8e8690c628 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -50,6 +50,7 @@ */ #include "main/imports.h" +#include "main/extensions.h" #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" @@ -1542,8 +1543,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, else var->interpolation = ir_var_smooth; - /* FINISHME: Apply the fragment coord convetion layout qualifiers. - */ + var->pixel_center_integer = qual->pixel_center_integer; + var->origin_upper_left = qual->origin_upper_left; if ((qual->origin_upper_left || qual->pixel_center_integer) && (strcmp(var->name, "gl_FragCoord") != 0)) { const char *const qual_string = (qual->origin_upper_left) @@ -1932,6 +1933,16 @@ ast_declarator_list::hir(exec_list *instructions, earlier->type = var->type; delete var; var = NULL; + } else if (state->extensions->ARB_fragment_coord_conventions && + (earlier != NULL) && + (strcmp(var->name, "gl_FragCoord") == 0) && + earlier->type == var->type && + earlier->mode == var->mode) { + /* Allow redeclaration of gl_FragCoord for ARB_fcc layout + * qualifiers. + */ + earlier->origin_upper_left = var->origin_upper_left; + earlier->pixel_center_integer = var->pixel_center_integer; } else { YYLTYPE loc = this->get_location(); diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 7e8363106d..202685d145 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -238,6 +238,10 @@ public: */ unsigned array_lvalue:1; + /* ARB_fragment_coord_conventions */ + unsigned origin_upper_left:1; + unsigned pixel_center_integer:1; + /** * Storage location of the base of this variable * diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index c49a732481..f97080d205 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -52,6 +52,8 @@ ir_variable::clone(struct hash_table *ht) const var->array_lvalue = this->array_lvalue; var->location = this->location; var->warn_extension = this->warn_extension; + var->origin_upper_left = this->origin_upper_left; + var->pixel_center_integer = this->pixel_center_integer; if (this->constant_value) var->constant_value = this->constant_value->clone(ht); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index c53381e29d..a3019cc650 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -557,7 +557,12 @@ ir_to_mesa_visitor::find_variable_storage(ir_variable *var) void ir_to_mesa_visitor::visit(ir_variable *ir) { - (void)ir; + if (strcmp(ir->name, "gl_FragCoord") == 0) { + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + + fp->OriginUpperLeft = ir->origin_upper_left; + fp->PixelCenterInteger = ir->pixel_center_integer; + } } void -- cgit v1.2.3 From 0c7b37c8367e72e7b4295cd249561e5c3079d161 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 14:58:31 -0700 Subject: glsl2: Add the define for ARB_fragment_coord_conventions when present. Fixes: glsl-arb-fragment-coord-conventions-define --- src/glsl/glcpp/glcpp-parse.c | 8 ++++++++ src/glsl/glcpp/glcpp-parse.y | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 2f08ff8112..8fbbdab52f 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -3242,6 +3242,14 @@ glcpp_parser_create (const struct gl_extensions *extensions) "GL_EXT_texture_array", list); } + if ((extensions != NULL) && + extensions->ARB_fragment_coord_conventions) { + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, + "GL_ARB_fragment_coord_conventions", list); + } + talloc_unlink(parser, tok); return parser; diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 41cfff5551..c6ff32e544 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -937,6 +937,14 @@ glcpp_parser_create (const struct gl_extensions *extensions) "GL_EXT_texture_array", list); } + if ((extensions != NULL) && + extensions->ARB_fragment_coord_conventions) { + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, + "GL_ARB_fragment_coord_conventions", list); + } + talloc_unlink(parser, tok); return parser; -- cgit v1.2.3 From ee9a3a51b61f0afe75b4b8b0c3025310140437ec Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 15:54:15 -0700 Subject: glsl2: Add new ir_constant::zero static method. This conveniently creates a zero value of whatever type you want. --- src/glsl/ir.cpp | 12 ++++++++++++ src/glsl/ir.h | 5 +++++ 2 files changed, 17 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index c75d560c48..bb58d95624 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -326,6 +326,18 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) } } +ir_constant * +ir_constant::zero(void *mem_ctx, const glsl_type *type) +{ + assert(type->is_numeric()); + + ir_constant *c = new(mem_ctx) ir_constant; + c->type = type; + memset(&c->value, 0, sizeof(c->value)); + + return c; +} + bool ir_constant::get_bool_component(unsigned i) const { diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 202685d145..bee9f6a2de 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1248,6 +1248,11 @@ public: */ ir_constant(const ir_constant *c, unsigned i); + /** + * Return a new ir_constant of the specified type containing all zeros. + */ + static ir_constant *zero(void *mem_ctx, const glsl_type *type); + virtual ir_constant *clone(struct hash_table *) const; virtual ir_constant *constant_expression_value(); -- cgit v1.2.3 From f7b94f32a22a769fc71065ca6515186e5a8e3a96 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 28 Jul 2010 12:20:38 -0700 Subject: ir_algebraic: Use ir_constant::zero. --- src/glsl/ir_algebraic.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index 5b065b086e..a6ecad7b65 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -213,13 +213,9 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) return ir->operands[0]; } - if (is_vec_zero(op_const[0]) || - is_vec_zero(op_const[1])) { - ir_constant_data zero_data; - memset(&zero_data, 0, sizeof(zero_data)); - + if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { this->progress = true; - return new(ir) ir_constant(ir->type, &zero_data); + return ir_constant::zero(ir, ir->type); } break; -- cgit v1.2.3 From f914915d8e86f492cfcbbf834df601251bbba033 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 21:56:13 -0700 Subject: ir_constant_expression: Use Mesa's MIN2/MAX2 instead of our own. --- src/glsl/ir_constant_expression.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 6a07f4e189..9309b61898 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -34,13 +34,11 @@ */ #include +#include "main/macros.h" #include "ir.h" #include "ir_visitor.h" #include "glsl_types.h" -#define min(x,y) (x) < (y) ? (x) : (y) -#define max(x,y) (x) > (y) ? (x) : (y) - ir_constant * ir_expression::constant_expression_value() { @@ -355,13 +353,13 @@ ir_expression::constant_expression_value() switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: - data.u[c] = min(op[0]->value.u[c0], op[1]->value.u[c1]); + data.u[c] = MIN2(op[0]->value.u[c0], op[1]->value.u[c1]); break; case GLSL_TYPE_INT: - data.i[c] = min(op[0]->value.i[c0], op[1]->value.i[c1]); + data.i[c] = MIN2(op[0]->value.i[c0], op[1]->value.i[c1]); break; case GLSL_TYPE_FLOAT: - data.f[c] = min(op[0]->value.f[c0], op[1]->value.f[c1]); + data.f[c] = MIN2(op[0]->value.f[c0], op[1]->value.f[c1]); break; default: assert(0); @@ -377,13 +375,13 @@ ir_expression::constant_expression_value() switch (op[0]->type->base_type) { case GLSL_TYPE_UINT: - data.u[c] = max(op[0]->value.u[c0], op[1]->value.u[c1]); + data.u[c] = MAX2(op[0]->value.u[c0], op[1]->value.u[c1]); break; case GLSL_TYPE_INT: - data.i[c] = max(op[0]->value.i[c0], op[1]->value.i[c1]); + data.i[c] = MAX2(op[0]->value.i[c0], op[1]->value.i[c1]); break; case GLSL_TYPE_FLOAT: - data.f[c] = max(op[0]->value.f[c0], op[1]->value.f[c1]); + data.f[c] = MAX2(op[0]->value.f[c0], op[1]->value.f[c1]); break; default: assert(0); -- cgit v1.2.3 From bafd89fa0f026cef12024382b154a41d90d00373 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 16:55:46 -0700 Subject: ir_constant_expression: Stub out support for constant builtins. --- src/glsl/ir_constant_expression.cpp | 151 +++++++++++++++++++++++++++++++++++- 1 file changed, 148 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 9309b61898..aa53d8d186 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -764,7 +764,152 @@ ir_constant::constant_expression_value() ir_constant * ir_call::constant_expression_value() { - /* FINISHME: Handle CEs involving builtin function calls. */ - return NULL; -} + if (this->type == glsl_type::error_type) + return NULL; + + /* From the GLSL 1.20 spec, page 23: + * "Function calls to user-defined functions (non-built-in functions) + * cannot be used to form constant expressions." + */ + if (!this->callee->is_built_in) + return NULL; + + unsigned num_parameters = 0; + + /* Check if all parameters are constant */ + ir_constant *op[3]; + foreach_list(n, &this->actual_parameters) { + ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value(); + if (constant == NULL) + return NULL; + + op[num_parameters] = constant; + + assert(num_parameters < 3); + num_parameters++; + } + /* Individual cases below can either: + * - Assign "expr" a new ir_expression to evaluate (for basic opcodes) + * - Fill "data" with appopriate constant data + * - Return an ir_constant directly. + */ + void *mem_ctx = talloc_parent(this); + ir_expression *expr = NULL; + + ir_constant_data data; + memset(&data, 0, sizeof(data)); + + const char *callee = this->callee_name(); + if (strcmp(callee, "abs") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "all") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "any") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "asin") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "atan") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "ceil") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "clamp") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "cos") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "cosh") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "cross") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "degrees") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "distance") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "dot") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "equal") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "exp") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "exp2") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "faceforward") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "floor") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "fract") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "fwidth") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "greaterThan") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "greaterThanEqual") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "inversesqrt") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "length") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "lessThan") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "lessThanEqual") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "log") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "log2") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "matrixCompMult") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "max") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "min") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "mix") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "mod") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "normalize") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "not") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "notEqual") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "outerProduct") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "pow") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "radians") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "reflect") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "refract") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "sign") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "sin") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "sinh") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "smoothstep") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "sqrt") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "step") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "tan") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "tanh") == 0) { + return NULL; /* FINISHME: implement this */ + } else if (strcmp(callee, "transpose") == 0) { + return NULL; /* FINISHME: implement this */ + } else { + /* Unsupported builtin - some are not allowed in constant expressions. */ + return NULL; + } + + if (expr != NULL) + return expr->constant_expression_value(); + + return new(mem_ctx) ir_constant(this->type, &data); +} -- cgit v1.2.3 From 46d91615a2f6e1beaee98f40af957ba1a1a6b349 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 18:29:29 -0700 Subject: ast_function: Set constant_value on return value temporaries in 1.20+. --- src/glsl/ast_function.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 855f27f175..bb45e2530d 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -122,6 +122,8 @@ process_call(exec_list *instructions, ir_function *f, deref = new(ctx) ir_dereference_variable(var); ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL); instructions->push_tail(assign); + if (state->language_version >= 120) + var->constant_value = call->constant_expression_value(); deref = new(ctx) ir_dereference_variable(var); return deref; -- cgit v1.2.3 From 38cb1b273f55f98349d981445cfe06351322b032 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 16:57:10 -0700 Subject: ir_constant_expression: Add support for builtins dFdx, dFdy, and fwidth. These always return zero (the derivative of a constant). --- src/glsl/ir_constant_expression.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index aa53d8d186..641589ed07 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -812,7 +812,7 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "atan") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { - return NULL; /* FINISHME: implement this */ + return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "ceil") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "clamp") == 0) { @@ -842,7 +842,7 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "fract") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "fwidth") == 0) { - return NULL; /* FINISHME: implement this */ + return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "greaterThan") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "greaterThanEqual") == 0) { -- cgit v1.2.3 From 8b1680acc38cfbb6d2fc80ddab3f3eed24e2522a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 16:57:53 -0700 Subject: ir_constant_expression: Implement builtins that wrap an expression. These builtin functions are represented by ir_expression_operations, so we can just create one of those and ask for its value. --- src/glsl/ir_constant_expression.cpp | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 641589ed07..0ffa1f0097 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -802,7 +802,7 @@ ir_call::constant_expression_value() const char *callee = this->callee_name(); if (strcmp(callee, "abs") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL); } else if (strcmp(callee, "all") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "any") == 0) { @@ -814,33 +814,33 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "ceil") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL); } else if (strcmp(callee, "clamp") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "cos") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL); } else if (strcmp(callee, "cosh") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "cross") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]); } else if (strcmp(callee, "degrees") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "distance") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "dot") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_dot, type, op[0], op[1]); } else if (strcmp(callee, "equal") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "exp") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_exp, type, op[0], NULL); } else if (strcmp(callee, "exp2") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL); } else if (strcmp(callee, "faceforward") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "floor") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL); } else if (strcmp(callee, "fract") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_fract, type, op[0], NULL); } else if (strcmp(callee, "fwidth") == 0) { return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "greaterThan") == 0) { @@ -848,7 +848,7 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "greaterThanEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "inversesqrt") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL); } else if (strcmp(callee, "length") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "lessThan") == 0) { @@ -856,29 +856,29 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "lessThanEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "log") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL); } else if (strcmp(callee, "log2") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_log2, type, op[0], NULL); } else if (strcmp(callee, "matrixCompMult") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "max") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_max, type, op[0], op[1]); } else if (strcmp(callee, "min") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_min, type, op[0], op[1]); } else if (strcmp(callee, "mix") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "mod") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]); } else if (strcmp(callee, "normalize") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "not") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL); } else if (strcmp(callee, "notEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "outerProduct") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "pow") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]); } else if (strcmp(callee, "radians") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "reflect") == 0) { @@ -886,15 +886,15 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "refract") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "sign") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL); } else if (strcmp(callee, "sin") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_sin, type, op[0], NULL); } else if (strcmp(callee, "sinh") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "smoothstep") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "sqrt") == 0) { - return NULL; /* FINISHME: implement this */ + expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL); } else if (strcmp(callee, "step") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "tan") == 0) { -- cgit v1.2.3 From aca7e95222ac33e5eda84ecc566da609f6f6ce8e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:34:32 -0700 Subject: ir_constant_expression: Add support for "all" builtin. --- src/glsl/ir_constant_expression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 0ffa1f0097..bce6747e87 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -804,7 +804,12 @@ ir_call::constant_expression_value() if (strcmp(callee, "abs") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL); } else if (strcmp(callee, "all") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (!op[0]->value.b[c]) + return new(mem_ctx) ir_constant(false); + } + return new(mem_ctx) ir_constant(true); } else if (strcmp(callee, "any") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "asin") == 0) { -- cgit v1.2.3 From d6792a7f7c2b73486987d2bc07fc77d46456b65d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:35:52 -0700 Subject: ir_constant_expression: Add support for "any" builtin. --- src/glsl/ir_constant_expression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index bce6747e87..e4c4a4d897 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -811,7 +811,12 @@ ir_call::constant_expression_value() } return new(mem_ctx) ir_constant(true); } else if (strcmp(callee, "any") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (op[0]->value.b[c]) + return new(mem_ctx) ir_constant(true); + } + return new(mem_ctx) ir_constant(false); } else if (strcmp(callee, "asin") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "atan") == 0) { -- cgit v1.2.3 From 3b6c29b8f00a2475b24022cace69f372b470a9b1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:38:38 -0700 Subject: ir_constant_expression: Add support for "asin" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index e4c4a4d897..2276f4d32e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -818,7 +818,9 @@ ir_call::constant_expression_value() } return new(mem_ctx) ir_constant(false); } else if (strcmp(callee, "asin") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = asinf(op[0]->value.f[c]); } else if (strcmp(callee, "atan") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { -- cgit v1.2.3 From f6ea9dfe473ccb0b5121461653696fe07ee4f328 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:39:47 -0700 Subject: ir_constant_expression: Add support for "acos" builtin. --- src/glsl/ir_constant_expression.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 2276f4d32e..301bfa8025 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -817,6 +817,10 @@ ir_call::constant_expression_value() return new(mem_ctx) ir_constant(true); } return new(mem_ctx) ir_constant(false); + } else if (strcmp(callee, "acos") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = acosf(op[0]->value.f[c]); } else if (strcmp(callee, "asin") == 0) { assert(op[0]->type->is_float()); for (unsigned c = 0; c < op[0]->type->components(); c++) -- cgit v1.2.3 From 13f8758e9c3babdee3fc0b8b8e1d4a7e13ef9694 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:42:23 -0700 Subject: ir_constant_expression: Add support for "atan" builtins. --- src/glsl/ir_constant_expression.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 301bfa8025..a6ce339e3e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -826,7 +826,15 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = asinf(op[0]->value.f[c]); } else if (strcmp(callee, "atan") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + if (num_parameters == 2) { + assert(op[1]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = atan2f(op[0]->value.f[c], op[1]->value.f[c]); + } else { + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = atanf(op[0]->value.f[c]); + } } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "ceil") == 0) { -- cgit v1.2.3 From ba4178345a1eb8e697a8cb01b5594c0a3b4b1d29 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:47:55 -0700 Subject: ir_constant_expression: Add support for the "cosh" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index a6ce339e3e..ee99ed2cdd 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -844,7 +844,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "cos") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL); } else if (strcmp(callee, "cosh") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = coshf(op[0]->value.f[c]); } else if (strcmp(callee, "cross") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]); } else if (strcmp(callee, "degrees") == 0) { -- cgit v1.2.3 From 5d551daf38e30d6cb863038afe1a8e32c806e6ae Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:49:56 -0700 Subject: ir_constant_expression: Add support for the "sinh" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ee99ed2cdd..b7ceefc393 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -916,7 +916,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "sin") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_sin, type, op[0], NULL); } else if (strcmp(callee, "sinh") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = sinhf(op[0]->value.f[c]); } else if (strcmp(callee, "smoothstep") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "sqrt") == 0) { -- cgit v1.2.3 From 9c9f8b2d69094fb308de0d6a28bcd60cdf8aedf6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:50:50 -0700 Subject: ir_constant_expression: Add support for the "tan" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index b7ceefc393..bcf87e000f 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -926,7 +926,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "step") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "tan") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = tanf(op[0]->value.f[c]); } else if (strcmp(callee, "tanh") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "transpose") == 0) { -- cgit v1.2.3 From 20970f7dea220a2f44c180579630f453729ab31b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:51:23 -0700 Subject: ir_constant_expression: Add support for the "tanh" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index bcf87e000f..aedc661025 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -930,7 +930,9 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = tanf(op[0]->value.f[c]); } else if (strcmp(callee, "tanh") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = tanhf(op[0]->value.f[c]); } else if (strcmp(callee, "transpose") == 0) { return NULL; /* FINISHME: implement this */ } else { -- cgit v1.2.3 From 0afe3493221c6a676bcc045aca508bb08f58a4f4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:58:03 -0700 Subject: ir_constant_expression: Add support for the "radians" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index aedc661025..bc1261b0b9 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -906,7 +906,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "pow") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]); } else if (strcmp(callee, "radians") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = M_PI/180.0 * op[0]->value.f[c]; } else if (strcmp(callee, "reflect") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "refract") == 0) { -- cgit v1.2.3 From 7bcaa3828f8d3d39cfece5d91e47ed2a135a9471 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 17:59:00 -0700 Subject: ir_constant_expression: Add support for the "degrees" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index bc1261b0b9..e68a7b1a2a 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -850,7 +850,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "cross") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]); } else if (strcmp(callee, "degrees") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = 180.0/M_PI * op[0]->value.f[c]; } else if (strcmp(callee, "distance") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "dot") == 0) { -- cgit v1.2.3 From 2eaf31642c83086b06dce057997ae4bc4b1bce2c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:01:22 -0700 Subject: ir_constant_expression: Add support for the "distance" builtin. --- src/glsl/ir_constant_expression.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index e68a7b1a2a..52f53d9ff4 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -854,7 +854,13 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = 180.0/M_PI * op[0]->value.f[c]; } else if (strcmp(callee, "distance") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float() && op[1]->type->is_float()); + float length_squared = 0.0; + for (unsigned c = 0; c < op[0]->type->components(); c++) { + float t = op[0]->value.f[c] - op[1]->value.f[c]; + length_squared += t * t; + } + return new(mem_ctx) ir_constant(sqrtf(length_squared)); } else if (strcmp(callee, "dot") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_dot, type, op[0], op[1]); } else if (strcmp(callee, "equal") == 0) { -- cgit v1.2.3 From 0b6ef6ef6e1930b6ec03dae7ace53372bb239981 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:04:22 -0700 Subject: ir_constant_expression: Add support for the "equal" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 52f53d9ff4..e6f9558b62 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -864,7 +864,22 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "dot") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_dot, type, op[0], op[1]); } else if (strcmp(callee, "equal") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "exp") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_exp, type, op[0], NULL); } else if (strcmp(callee, "exp2") == 0) { -- cgit v1.2.3 From 48a69ba05794f3d253114b452174710a15eefadf Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:05:36 -0700 Subject: ir_constant_expression: Add support for the "notEqual" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index e6f9558b62..4a5eb7540a 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -923,7 +923,22 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "not") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL); } else if (strcmp(callee, "notEqual") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "outerProduct") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "pow") == 0) { -- cgit v1.2.3 From 6d897f07cf7ed8492ef5f0da90259856fdac5bf6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:06:18 -0700 Subject: ir_constant_expression: Add support for the "lessThan" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 4a5eb7540a..032214eb3c 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -901,7 +901,22 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "length") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "lessThan") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] < op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] < op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] < op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "lessThanEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "log") == 0) { -- cgit v1.2.3 From 319f4949e0a5f1daa3a760fc84096c041e3ce815 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:07:09 -0700 Subject: ir_constant_expression: Add support for the "lessThanEqual" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 032214eb3c..9c543d48ed 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -918,7 +918,22 @@ ir_call::constant_expression_value() } } } else if (strcmp(callee, "lessThanEqual") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "log") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL); } else if (strcmp(callee, "log2") == 0) { -- cgit v1.2.3 From 7f042b98126b1710c819091512621c642f8fcbbc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:07:43 -0700 Subject: ir_constant_expression: Add support for the "greaterThan" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 9c543d48ed..d40322252e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -893,7 +893,22 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "fwidth") == 0) { return ir_constant::zero(mem_ctx, this->type); } else if (strcmp(callee, "greaterThan") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] > op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] > op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] > op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "greaterThanEqual") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "inversesqrt") == 0) { -- cgit v1.2.3 From 557827340aedbf64d2486226924d00c94107c9e8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:08:05 -0700 Subject: ir_constant_expression: Add support for the "greaterThanEqual" builtin. --- src/glsl/ir_constant_expression.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index d40322252e..cce13139b7 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -910,7 +910,22 @@ ir_call::constant_expression_value() } } } else if (strcmp(callee, "greaterThanEqual") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] >= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] >= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] >= op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "inversesqrt") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL); } else if (strcmp(callee, "length") == 0) { -- cgit v1.2.3 From 4b1d77ea966771dc5fbdac90dfec1b6066afe3f8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:18:16 -0700 Subject: ir_constant_expression: Remove support for dot products of integers. This shouldn't be required since dot is only defined for floating point types, even in GLSL 4.0. --- src/glsl/ir_constant_expression.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index cce13139b7..799bd4a60b 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -327,21 +327,10 @@ ir_expression::constant_expression_value() case ir_binop_dot: assert(op[0]->type->is_vector() && op[1]->type->is_vector()); + assert(op[0]->type->is_float() && op[1]->type->is_float()); data.f[0] = 0; for (unsigned c = 0; c < op[0]->type->components(); c++) { - switch (op[0]->type->base_type) { - case GLSL_TYPE_UINT: - data.u[0] += op[0]->value.u[c] * op[1]->value.u[c]; - break; - case GLSL_TYPE_INT: - data.i[0] += op[0]->value.i[c] * op[1]->value.i[c]; - break; - case GLSL_TYPE_FLOAT: - data.f[0] += op[0]->value.f[c] * op[1]->value.f[c]; - break; - default: - assert(0); - } + data.f[0] += op[0]->value.f[c] * op[1]->value.f[c]; } break; -- cgit v1.2.3 From ffcec135997545b4dc2b3393ccb02558083373a0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:09:21 -0700 Subject: ir_constant_expression: Extract dot product calculation for reuse. --- src/glsl/ir_constant_expression.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 799bd4a60b..c4a416aa35 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -39,6 +39,18 @@ #include "ir_visitor.h" #include "glsl_types.h" +static float +dot(ir_constant *op0, ir_constant *op1) +{ + assert(op0->type->is_float() && op1->type->is_float()); + + float result = 0; + for (unsigned c = 0; c < op0->type->components(); c++) + result += op0->value.f[c] * op1->value.f[c]; + + return result; +} + ir_constant * ir_expression::constant_expression_value() { @@ -326,14 +338,9 @@ ir_expression::constant_expression_value() break; case ir_binop_dot: - assert(op[0]->type->is_vector() && op[1]->type->is_vector()); - assert(op[0]->type->is_float() && op[1]->type->is_float()); - data.f[0] = 0; - for (unsigned c = 0; c < op[0]->type->components(); c++) { - data.f[0] += op[0]->value.f[c] * op[1]->value.f[c]; - } - + data.f[0] = dot(op[0], op[1]); break; + case ir_binop_min: assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); for (unsigned c = 0, c0 = 0, c1 = 0; -- cgit v1.2.3 From 5489ad086f77e548905c98ccd27cd626d706d5f9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 18:26:00 -0700 Subject: ir_constant_expression: Add support for the "length" builtin. --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c4a416aa35..83d1b34bed 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -925,7 +925,7 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "inversesqrt") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL); } else if (strcmp(callee, "length") == 0) { - return NULL; /* FINISHME: implement this */ + return new(mem_ctx) ir_constant(sqrtf(dot(op[0], op[0]))); } else if (strcmp(callee, "lessThan") == 0) { assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); for (unsigned c = 0; c < op[0]->type->components(); c++) { -- cgit v1.2.3 From a7650af706b359056db8b9da6d1d83669106d463 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:12:43 -0700 Subject: ir_constant_expression: Simplify code that implements the "dot" builtin. There's no need to use an ir_expression; we have a handy C function. --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 83d1b34bed..d20d1953e2 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -858,7 +858,7 @@ ir_call::constant_expression_value() } return new(mem_ctx) ir_constant(sqrtf(length_squared)); } else if (strcmp(callee, "dot") == 0) { - expr = new(mem_ctx) ir_expression(ir_binop_dot, type, op[0], op[1]); + return new(mem_ctx) ir_constant(dot(op[0], op[1])); } else if (strcmp(callee, "equal") == 0) { assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); for (unsigned c = 0; c < op[0]->type->components(); c++) { -- cgit v1.2.3 From 8fe5f30645e1b6a87497c1abc408ade633e9ebc1 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:03:55 -0700 Subject: ir_constant_expression: Add support for the "matrixCompMult" builtin. --- src/glsl/ir_constant_expression.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index d20d1953e2..2c80c8b5e0 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -965,7 +965,9 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "log2") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_log2, type, op[0], NULL); } else if (strcmp(callee, "matrixCompMult") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float() && op[1]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]; } else if (strcmp(callee, "max") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_max, type, op[0], op[1]); } else if (strcmp(callee, "min") == 0) { -- cgit v1.2.3 From 53f306d573ce6393062cf86d4fe31148eacc5e1e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:19:32 -0700 Subject: ir_constant_expression: Add support for the "normalize" builtin. --- src/glsl/ir_constant_expression.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 2c80c8b5e0..809ea609a3 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -977,7 +977,14 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "mod") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]); } else if (strcmp(callee, "normalize") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + float length = sqrtf(dot(op[0], op[0])); + + if (length == 0) + return ir_constant::zero(mem_ctx, this->type); + + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] / length; } else if (strcmp(callee, "not") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL); } else if (strcmp(callee, "notEqual") == 0) { -- cgit v1.2.3 From d60b2b03da30093ae85458f1d0be3cc5c33d992c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:24:29 -0700 Subject: ir_constant_expression: Add support for the "reflect" builtin. --- src/glsl/ir_constant_expression.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 809ea609a3..c8320814a3 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1013,7 +1013,10 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = M_PI/180.0 * op[0]->value.f[c]; } else if (strcmp(callee, "reflect") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float()); + float dot_NI = dot(op[1], op[0]); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] - 2 * dot_NI * op[1]->value.f[c]; } else if (strcmp(callee, "refract") == 0) { return NULL; /* FINISHME: implement this */ } else if (strcmp(callee, "sign") == 0) { -- cgit v1.2.3 From 04b3643dbf2e0d25e67c86845b2506ad1d26939d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 20:33:42 -0700 Subject: ir_constant_expression: Add support for the "refract" builtin. --- src/glsl/ir_constant_expression.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c8320814a3..580ef1d4fa 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1018,7 +1018,17 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = op[0]->value.f[c] - 2 * dot_NI * op[1]->value.f[c]; } else if (strcmp(callee, "refract") == 0) { - return NULL; /* FINISHME: implement this */ + const float eta = op[2]->value.f[0]; + const float dot_NI = dot(op[1], op[0]); + const float k = 1.0 - eta * eta * (1.0 - dot_NI * dot_NI); + if (k < 0.0) { + return ir_constant::zero(mem_ctx, this->type); + } else { + for (unsigned c = 0; c < type->components(); c++) { + data.f[c] = eta * op[0]->value.f[c] - (eta * dot_NI + sqrtf(k)) + * op[1]->value.f[c]; + } + } } else if (strcmp(callee, "sign") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL); } else if (strcmp(callee, "sin") == 0) { -- cgit v1.2.3 From 3d5c2f0adbd72a68d4fe3900b0d3e267510950ef Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 21:46:16 -0700 Subject: ir_constant_expression: Add support for the "faceforward" builtin. --- src/glsl/ir_constant_expression.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 580ef1d4fa..c939690129 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -881,7 +881,10 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "exp2") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL); } else if (strcmp(callee, "faceforward") == 0) { - return NULL; /* FINISHME: implement this */ + if (dot(op[2], op[1]) < 0) + return op[0]; + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = -op[0]->value.f[c]; } else if (strcmp(callee, "floor") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL); } else if (strcmp(callee, "fract") == 0) { -- cgit v1.2.3 From ff58b7c9b6f513ed8bf57b3e4283b67b06fd9d34 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 21:53:40 -0700 Subject: ir_constant_expression: Add support for the "step" builtin. --- src/glsl/ir_constant_expression.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c939690129..5485d79a88 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1045,7 +1045,11 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "sqrt") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL); } else if (strcmp(callee, "step") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float() && op[1]->type->is_float()); + /* op[0] (edge) may be either a scalar or a vector */ + const unsigned c0_inc = op[0]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c0 = 0; c < type->components(); c0 += c0_inc, c++) + data.f[c] = (op[1]->value.f[c] < op[0]->value.f[c0]) ? 0.0 : 1.0; } else if (strcmp(callee, "tan") == 0) { assert(op[0]->type->is_float()); for (unsigned c = 0; c < op[0]->type->components(); c++) -- cgit v1.2.3 From a4ca1cfb66160c4ea2325f503ff025a4adc35084 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 22:23:17 -0700 Subject: ir_constant_expression: Add support for the "clamp" builtin. --- src/glsl/ir_constant_expression.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 5485d79a88..a2748a726c 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -836,7 +836,30 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "ceil") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL); } else if (strcmp(callee, "clamp") == 0) { - return NULL; /* FINISHME: implement this */ + assert(num_parameters == 3); + unsigned c1_inc = op[1]->type->is_scalar() ? 0 : 1; + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c1 = 0, c2 = 0; + c < op[0]->type->components(); + c1 += c1_inc, c2 += c2_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = CLAMP(op[0]->value.u[c], op[1]->value.u[c1], + op[2]->value.u[c2]); + break; + case GLSL_TYPE_INT: + data.i[c] = CLAMP(op[0]->value.i[c], op[1]->value.i[c1], + op[2]->value.u[c2]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = CLAMP(op[0]->value.f[c], op[1]->value.f[c1], + op[2]->value.f[c2]); + break; + default: + assert(!"Should not get here."); + } + } } else if (strcmp(callee, "cos") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL); } else if (strcmp(callee, "cosh") == 0) { -- cgit v1.2.3 From 546f3a27540c408c9d83368c5f6144e13167dcb3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 21 Jul 2010 22:37:50 -0700 Subject: ir_constant_expression: Add support for the "smoothstep" builtin. --- src/glsl/ir_constant_expression.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index a2748a726c..b6cb2d8672 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1064,7 +1064,21 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = sinhf(op[0]->value.f[c]); } else if (strcmp(callee, "smoothstep") == 0) { - return NULL; /* FINISHME: implement this */ + assert(num_parameters == 3); + assert(op[1]->type == op[0]->type); + unsigned edge_inc = op[0]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, e = 0; c < type->components(); e += edge_inc, c++) { + const float edge0 = op[0]->value.f[e]; + const float edge1 = op[1]->value.f[e]; + if (edge0 == edge1) { + data.f[c] = 0.0; /* Avoid a crash - results are undefined anyway */ + } else { + const float numerator = op[2]->value.f[c] - edge0; + const float denominator = edge1 - edge0; + const float t = CLAMP(numerator/denominator, 0, 1); + data.f[c] = t * t * (3 - 2 * t); + } + } } else if (strcmp(callee, "sqrt") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL); } else if (strcmp(callee, "step") == 0) { -- cgit v1.2.3 From b09ae5dd3f9b8e380e2608f4ee3a7902f5ecc15e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 22 Jul 2010 15:34:49 -0700 Subject: ir_constant_expression: Add support for the "transpose" builtin. --- src/glsl/ir_constant_expression.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index b6cb2d8672..c4e6d837b0 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1096,7 +1096,14 @@ ir_call::constant_expression_value() for (unsigned c = 0; c < op[0]->type->components(); c++) data.f[c] = tanhf(op[0]->value.f[c]); } else if (strcmp(callee, "transpose") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_matrix()); + const unsigned n = op[0]->type->vector_elements; + const unsigned m = op[0]->type->matrix_columns; + for (unsigned j = 0; j < m; j++) { + for (unsigned i = 0; i < n; i++) { + data.f[m*i+j] += op[0]->value.f[i+n*j]; + } + } } else { /* Unsupported builtin - some are not allowed in constant expressions. */ return NULL; -- cgit v1.2.3 From 5d255e24b29930e78321c1ba807df71fea12174a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 23 Jul 2010 12:36:50 -0700 Subject: ir_constant_expression: Add support for the "mix" builtin. Both 1.10 and 1.30 variants. --- src/glsl/ir_constant_expression.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index c4e6d837b0..9fc37b3777 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -999,7 +999,19 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "min") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_min, type, op[0], op[1]); } else if (strcmp(callee, "mix") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_float() && op[1]->type->is_float()); + if (op[2]->type->is_float()) { + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + unsigned components = op[0]->type->components(); + for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) { + data.f[c] = op[0]->value.f[c] * (1 - op[2]->value.f[c2]) + + op[1]->value.f[c] * op[2]->value.f[c2]; + } + } else { + assert(op[2]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[op[2]->value.b[c] ? 1 : 0]->value.f[c]; + } } else if (strcmp(callee, "mod") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]); } else if (strcmp(callee, "normalize") == 0) { -- cgit v1.2.3 From 7ddee6a535f7323d7c6131e52e7933130d886ae4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 23 Jul 2010 13:24:09 -0700 Subject: ir_constant_expression: Add support for the "outerProduct" builtin. --- src/glsl/ir_constant_expression.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 9fc37b3777..f02cd3127e 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1043,7 +1043,14 @@ ir_call::constant_expression_value() } } } else if (strcmp(callee, "outerProduct") == 0) { - return NULL; /* FINISHME: implement this */ + assert(op[0]->type->is_vector() && op[1]->type->is_vector()); + const unsigned m = op[0]->type->vector_elements; + const unsigned n = op[1]->type->vector_elements; + for (unsigned j = 0; j < n; j++) { + for (unsigned i = 0; i < m; i++) { + data.f[i+m*j] = op[0]->value.f[i] * op[1]->value.f[j]; + } + } } else if (strcmp(callee, "pow") == 0) { expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]); } else if (strcmp(callee, "radians") == 0) { -- cgit v1.2.3 From 56af4e56e3852363a810174c64650df6f0ae4f53 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 28 Jul 2010 11:58:27 -0700 Subject: glsl2: Fix outerProduct builtin. The type signatures were completely backwards. --- src/glsl/builtin_function.cpp | 98 +++++++++++----------- src/glsl/builtins/120/outerProduct | 98 +++++++++++----------- .../builtins/tools/generate_outerProductGLSL.py | 4 +- 3 files changed, 100 insertions(+), 100 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index cc957e4b66..3343cf5638 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -2666,92 +2666,92 @@ static const char *builtins_120_outerProduct = { " (declare (in) vec2 u)\n" " (declare (in) vec2 v))\n" " ((declare () mat2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in) vec2 u)\n" - " (declare (in) vec3 v))\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec2 v))\n" " ((declare () mat2x3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in) vec2 u)\n" - " (declare (in) vec4 v))\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec2 v))\n" " ((declare () mat2x4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in) vec3 u)\n" - " (declare (in) vec2 v))\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec3 v))\n" " ((declare () mat3x2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))\n" + " ))\n" "\n" " (signature mat3\n" " (parameters\n" " (declare (in) vec3 u)\n" " (declare (in) vec3 v))\n" " ((declare () mat3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in) vec3 u)\n" - " (declare (in) vec4 v))\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec3 v))\n" " ((declare () mat3x4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in) vec4 u)\n" - " (declare (in) vec2 v))\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec4 v))\n" " ((declare () mat4x2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in) vec4 u)\n" - " (declare (in) vec3 v))\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec4 v))\n" " ((declare () mat4x3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" " (signature mat4\n" " (parameters\n" " (declare (in) vec4 u)\n" " (declare (in) vec4 v))\n" " ((declare () mat4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) \n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u)))) \n" - "(return (var_ref m))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" "))\n" - "\n" }; static const char *builtins_120_transpose = { diff --git a/src/glsl/builtins/120/outerProduct b/src/glsl/builtins/120/outerProduct index b401ba0233..69ae741e17 100644 --- a/src/glsl/builtins/120/outerProduct +++ b/src/glsl/builtins/120/outerProduct @@ -4,89 +4,89 @@ (declare (in) vec2 u) (declare (in) vec2 v)) ((declare () mat2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) (signature mat2x3 (parameters - (declare (in) vec2 u) - (declare (in) vec3 v)) + (declare (in) vec3 u) + (declare (in) vec2 v)) ((declare () mat2x3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) (signature mat2x4 (parameters - (declare (in) vec2 u) - (declare (in) vec4 v)) + (declare (in) vec4 u) + (declare (in) vec2 v)) ((declare () mat2x4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) (signature mat3x2 (parameters - (declare (in) vec3 u) - (declare (in) vec2 v)) + (declare (in) vec2 u) + (declare (in) vec3 v)) ((declare () mat3x2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)) + )) (signature mat3 (parameters (declare (in) vec3 u) (declare (in) vec3 v)) ((declare () mat3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)))) (signature mat3x4 (parameters - (declare (in) vec3 u) - (declare (in) vec4 v)) + (declare (in) vec4 u) + (declare (in) vec3 v)) ((declare () mat3x4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)))) (signature mat4x2 (parameters - (declare (in) vec4 u) - (declare (in) vec2 v)) + (declare (in) vec2 u) + (declare (in) vec4 v)) ((declare () mat4x2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref v) (swiz z (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref v) (swiz w (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) (signature mat4x3 (parameters - (declare (in) vec4 u) - (declare (in) vec3 v)) + (declare (in) vec3 u) + (declare (in) vec4 v)) ((declare () mat4x3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref v) (swiz z (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref v) (swiz w (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) (signature mat4 (parameters (declare (in) vec4 u) (declare (in) vec4 v)) ((declare () mat4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref v) (swiz x (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref v) (swiz y (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref v) (swiz z (var_ref u)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref v) (swiz w (var_ref u)))) -(return (var_ref m)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) )) - diff --git a/src/glsl/builtins/tools/generate_outerProductGLSL.py b/src/glsl/builtins/tools/generate_outerProductGLSL.py index 48fb72197c..c561cc3ba1 100755 --- a/src/glsl/builtins/tools/generate_outerProductGLSL.py +++ b/src/glsl/builtins/tools/generate_outerProductGLSL.py @@ -4,11 +4,11 @@ def gen(x, y): type = "mat" + str(x) if x != y: type = type + "x" + str(y) - print type + " outerProduct(vec" + str(x) + " u, vec" + str(y) + " v)\n{" + print type + " outerProduct(vec" + str(y) + " u, vec" + str(x) + " v)\n{" print " " + type + " m;" for i in range(x): - print " m[" + str(i) + "] = v * u[" + str(i) + "];" + print " m[" + str(i) + "] = u * v[" + str(i) + "];" print " return m;\n}" print "#version 120" -- cgit v1.2.3 From 35cc8b98ec4d898417de5b820dcbcf62c74b3599 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 28 Jul 2010 16:44:56 -0700 Subject: glsl2/Makefile: Append to DEFINES rather than replacing them. Otherwise, we lose DEBUG, which causes mtypes.h to set NDEBUG, which causes assertions to not happen, which is no fun for anyone. --- src/glsl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 4c85af8906..cbdd0f9a7a 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -82,7 +82,7 @@ GLSL2_OBJECTS = \ ### Basic defines ### -DEFINES = \ +DEFINES += \ $(LIBRARY_DEFINES) \ $(API_DEFINES) -- cgit v1.2.3 From 192b57df8c451c7ae39e5471124a9bab36ec17f8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 16:11:26 -0700 Subject: glsl2: Make lowp, mediump, highp, and precision identifiers pre-1.20. Fixes glsl-precision-110. --- src/glsl/glsl_lexer.cpp | 52 +++++++++++++++++++++++++++++++++++++------------ src/glsl/glsl_lexer.lpp | 36 ++++++++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 16 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index ecb4b857bb..e5ca1bd0a5 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -1994,26 +1994,54 @@ return USING; case 140: YY_RULE_SETUP #line 321 "glsl_lexer.lpp" -return LOWP; +{ + if (yyextra->language_version >= 120){ + return LOWP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } YY_BREAK case 141: YY_RULE_SETUP -#line 322 "glsl_lexer.lpp" -return MEDIUMP; +#line 329 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 120){ + return MEDIUMP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + }return MEDIUMP; YY_BREAK case 142: YY_RULE_SETUP -#line 323 "glsl_lexer.lpp" -return HIGHP; +#line 337 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 120){ + return HIGHP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } YY_BREAK case 143: YY_RULE_SETUP -#line 324 "glsl_lexer.lpp" -return PRECISION; +#line 345 "glsl_lexer.lpp" +{ + if (yyextra->language_version >= 120){ + return PRECISION; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } YY_BREAK case 144: YY_RULE_SETUP -#line 326 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2023,15 +2051,15 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" +#line 361 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 146: YY_RULE_SETUP -#line 335 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2035 "glsl_lexer.cpp" +#line 2063 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -3173,7 +3201,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 335 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index ebfea37597..702e79a363 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -318,10 +318,38 @@ namespace return NAMESPACE; using return USING; /* Additional reserved words in GLSL 1.20. */ -lowp return LOWP; -mediump return MEDIUMP; -highp return HIGHP; -precision return PRECISION; +lowp { + if (yyextra->language_version >= 120){ + return LOWP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } +mediump { + if (yyextra->language_version >= 120){ + return MEDIUMP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + }return MEDIUMP; +highp { + if (yyextra->language_version >= 120){ + return HIGHP; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } +precision { + if (yyextra->language_version >= 120){ + return PRECISION; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; -- cgit v1.2.3 From 8605c297cfb8068737991601f163f866395c41c9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 16:53:51 -0700 Subject: glcpp: Print integer tokens as decimal, not hex. --- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 8fbbdab52f..bfbd97f3d8 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -3041,7 +3041,7 @@ _token_print (char **out, token_t *token) switch (token->type) { case INTEGER: - glcpp_printf (*out, "%" PRIxMAX, token->value.ival); + glcpp_printf (*out, "%" PRIiMAX, token->value.ival); break; case IDENTIFIER: case INTEGER_STRING: diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c6ff32e544..2009aeaf8a 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -736,7 +736,7 @@ _token_print (char **out, token_t *token) switch (token->type) { case INTEGER: - glcpp_printf (*out, "%" PRIxMAX, token->value.ival); + glcpp_printf (*out, "%" PRIiMAX, token->value.ival); break; case IDENTIFIER: case INTEGER_STRING: -- cgit v1.2.3 From d4a04f315560704bf1103df0b93723e468725df7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 16:58:39 -0700 Subject: glcpp: Add __VERSION__ define to the current language version. Fixes: glsl-version-define glsl-version-define-110 glsl-version-define-120 --- src/glsl/glcpp/glcpp-lex.c | 400 +++++++++--------- src/glsl/glcpp/glcpp-lex.l | 10 +- src/glsl/glcpp/glcpp-parse.c | 968 ++++++++++++++++++++++--------------------- src/glsl/glcpp/glcpp-parse.h | 37 +- src/glsl/glcpp/glcpp-parse.y | 73 ++-- 5 files changed, 774 insertions(+), 714 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index edf98a4afd..40db2c27c5 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -358,8 +358,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 40 -#define YY_END_OF_BUFFER 41 +#define YY_NUM_RULES 41 +#define YY_END_OF_BUFFER 42 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,26 +367,26 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[132] = +static yyconst flex_int16_t yy_acclist[133] = { 0, - 3, 3, 41, 36, 40, 37, 40, 38, 40, 40, - 35, 40, 40, 35, 40, 35, 40, 35, 40, 22, - 36, 40, 21, 36, 40, 35, 40, 35, 40, 35, - 40, 34, 36, 40, 34, 36, 40, 35, 40, 37, - 40, 20, 40, 40, 3, 40, 4, 40, 5, 40, - 39, 40, 36, 15, 37, 29, 32, 30, 2, 22, - 36, 22, 36, 36, 21, 36, 21, 36, 24, 26, - 28, 27, 25, 34, 36, 34, 36, 31, 37, 20, - 20, 3, 4, 5, 6, 5, 7, 1, 15, 23, - 36, 34, 36,16395, 23, 36, 34, 36, 15, 34, - - 36,16396,16397, 8203, 15, 8203, 34, 36, 8204, 15, - 8205, 15,16398, 16,16393, 19, 33, 34, 36, 18, - 8206, 15, 16, 8201, 15,16394,16401, 8202, 15, 8, - 8209 + 3, 3, 42, 37, 41, 38, 41, 39, 41, 41, + 36, 41, 41, 36, 41, 36, 41, 36, 41, 23, + 37, 41, 22, 37, 41, 36, 41, 36, 41, 36, + 41, 35, 37, 41, 35, 37, 41, 36, 41, 38, + 41, 21, 41, 41, 3, 41, 4, 41, 5, 41, + 40, 41, 37, 16, 38, 30, 33, 31, 2, 23, + 37, 23, 37, 37, 22, 37, 22, 37, 25, 27, + 29, 28, 26, 35, 37, 35, 37, 32, 38, 21, + 21, 3, 4, 5, 6, 5, 7, 1, 16, 24, + 37, 35, 37,16396, 24, 37, 35, 37, 16, 35, + + 37,16397,16398, 8204, 16, 8204, 35, 37, 8205, 16, + 8206, 16,16399, 17,16394, 20, 34, 35, 37, 19, + 8207, 16, 17, 8202, 16,16395,16402, 8203, 16, 9, + 8, 8210 } ; -static yyconst flex_int16_t yy_accept[151] = +static yyconst flex_int16_t yy_accept[152] = { 0, 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, 6, 8, 10, 11, 13, 14, 16, 18, 20, 23, @@ -403,7 +403,8 @@ static yyconst flex_int16_t yy_accept[151] = 107, 107, 107, 107, 107, 109, 109, 109, 111, 111, 113, 114, 115, 115, 116, 116, 116, 117, 117, 120, 121, 121, 123, 124, 124, 124, 126, 127, 127, 127, - 128, 128, 128, 130, 131, 131, 131, 132, 132, 132 + 128, 128, 128, 130, 131, 132, 132, 132, 133, 133, + 133 } ; static yyconst flex_int32_t yy_ec[256] = @@ -446,48 +447,48 @@ static yyconst flex_int32_t yy_meta[40] = 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[169] = +static yyconst flex_int16_t yy_base[170] = { 0, - 0, 38, 0, 0, 38, 39, 426, 425, 427, 48, - 43, 549, 423, 44, 63, 422, 59, 65, 87, 125, - 58, 67, 68, 164, 203, 40, 75, 241, 549, 421, - 549, 140, 549, 140, 420, 549, 144, 419, 418, 417, - 415, 414, 156, 179, 267, 0, 209, 413, 412, 411, - 410, 409, 387, 124, 407, 153, 403, 402, 154, 198, - 159, 155, 160, 192, 404, 549, 186, 549, 214, 549, - 359, 549, 162, 159, 227, 229, 230, 234, 199, 303, + 0, 38, 0, 0, 38, 39, 427, 426, 428, 48, + 43, 549, 424, 44, 63, 423, 59, 65, 87, 125, + 58, 67, 68, 164, 203, 40, 75, 241, 549, 422, + 549, 140, 549, 140, 421, 549, 144, 420, 419, 418, + 417, 415, 156, 179, 267, 0, 209, 414, 413, 412, + 411, 410, 388, 124, 408, 153, 404, 403, 154, 198, + 159, 155, 160, 192, 405, 549, 186, 549, 214, 549, + 404, 549, 162, 159, 227, 229, 230, 234, 199, 303, 232, 235, 236, 262, 56, 243, 237, 247, 245, 252, - 291, 358, 357, 292, 238, 296, 293, 254, 335, 256, - - 355, 354, 298, 294, 263, 352, 549, 350, 549, 299, - 297, 322, 325, 257, 306, 328, 346, 549, 345, 549, - 344, 343, 329, 342, 331, 332, 341, 333, 319, 335, - 337, 549, 248, 338, 246, 549, 197, 184, 336, 366, - 403, 182, 549, 141, 434, 416, 79, 473, 549, 512, - 514, 516, 518, 520, 522, 71, 524, 526, 528, 530, - 532, 534, 536, 538, 540, 542, 544, 546 + 291, 359, 358, 292, 238, 296, 293, 254, 336, 256, + + 356, 355, 298, 294, 263, 354, 549, 352, 549, 299, + 297, 322, 325, 257, 306, 328, 350, 549, 346, 549, + 345, 344, 329, 343, 331, 332, 342, 333, 320, 335, + 340, 549, 337, 338, 248, 549, 246, 197, 336, 366, + 403, 184, 549, 182, 141, 434, 416, 79, 473, 549, + 512, 514, 516, 518, 520, 522, 71, 524, 526, 528, + 530, 532, 534, 536, 538, 540, 542, 544, 546 } ; -static yyconst flex_int16_t yy_def[169] = +static yyconst flex_int16_t yy_def[170] = { 0, - 149, 1, 150, 150, 151, 151, 152, 152, 149, 153, - 154, 149, 154, 154, 154, 154, 154, 154, 149, 153, - 154, 154, 154, 155, 155, 154, 154, 154, 149, 156, - 149, 157, 149, 20, 154, 149, 154, 154, 154, 154, - 154, 158, 19, 20, 20, 20, 20, 154, 154, 154, - 154, 154, 25, 25, 154, 154, 28, 28, 154, 154, - 154, 154, 154, 154, 156, 149, 157, 149, 157, 149, - 158, 149, 45, 25, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 20, 25, 154, 154, 154, 154, 154, - 154, 159, 160, 154, 154, 154, 154, 154, 25, 154, - - 161, 162, 154, 154, 154, 159, 149, 160, 149, 154, - 154, 154, 154, 154, 25, 154, 161, 149, 162, 149, - 163, 164, 154, 165, 154, 154, 154, 154, 25, 154, - 163, 149, 164, 154, 165, 149, 166, 167, 154, 149, - 154, 166, 149, 167, 168, 154, 154, 168, 0, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149 + 150, 1, 151, 151, 152, 152, 153, 153, 150, 154, + 155, 150, 155, 155, 155, 155, 155, 155, 150, 154, + 155, 155, 155, 156, 156, 155, 155, 155, 150, 157, + 150, 158, 150, 20, 155, 150, 155, 155, 155, 155, + 155, 159, 19, 20, 20, 20, 20, 155, 155, 155, + 155, 155, 25, 25, 155, 155, 28, 28, 155, 155, + 155, 155, 155, 155, 157, 150, 158, 150, 158, 150, + 159, 150, 45, 25, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 20, 25, 155, 155, 155, 155, 155, + 155, 160, 161, 155, 155, 155, 155, 155, 25, 155, + + 162, 163, 155, 155, 155, 160, 150, 161, 150, 155, + 155, 155, 155, 155, 25, 155, 162, 150, 163, 150, + 164, 165, 155, 166, 155, 155, 155, 155, 25, 155, + 164, 150, 165, 155, 166, 150, 167, 168, 155, 150, + 155, 167, 150, 168, 155, 169, 155, 155, 169, 0, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150 } ; static yyconst flex_int16_t yy_nxt[589] = @@ -511,15 +512,15 @@ static yyconst flex_int16_t yy_nxt[589] = 70, 34, 34, 34, 56, 36, 36, 36, 57, 34, 47, 36, 36, 35, 34, 35, 36, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 75, 35, 35, - 35, 84, 53, 80, 143, 85, 36, 81, 68, 82, - 34, 34, 34, 34, 36, 149, 149, 84, 34, 143, + 35, 84, 53, 80, 36, 85, 143, 81, 68, 82, + 34, 34, 34, 34, 36, 150, 150, 84, 34, 36, 36, 36, 35, 34, 35, 36, 35, 35, 35, 35, 35, 35, 35, 35, 34, 83, 68, 35, 35, 35, 34, 34, 34, 69, 70, 76, 54, 77, 34, 36, 78, 36, 36, 91, 36, 79, 36, 36, 36, 36, - 36, 35, 58, 36, 34, 36, 39, 36, 136, 36, - 36, 86, 89, 96, 36, 87, 36, 97, 36, 36, + 36, 35, 58, 36, 34, 36, 39, 36, 143, 36, + 136, 86, 89, 96, 36, 87, 36, 97, 36, 36, 111, 101, 88, 59, 60, 36, 90, 61, 98, 100, 102, 103, 62, 34, 34, 34, 63, 64, 73, 73, 73, 34, 104, 128, 73, 116, 34, 114, 73, 73, @@ -528,34 +529,34 @@ static yyconst flex_int16_t yy_nxt[589] = 36, 36, 34, 92, 92, 93, 92, 92, 92, 92, 92, 92, 92, 92, 105, 110, 113, 92, 92, 92, 125, 112, 121, 124, 36, 94, 122, 36, 129, 53, - 36, 36, 95, 36, 36, 36, 140, 36, 36, 132, - 36, 92, 53, 36, 136, 36, 132, 120, 118, 127, - 126, 130, 109, 138, 107, 137, 120, 118, 115, 109, - 107, 72, 134, 139, 141, 138, 35, 140, 36, 35, + 36, 36, 95, 36, 36, 36, 140, 36, 36, 36, + 36, 92, 132, 53, 36, 136, 36, 132, 120, 127, + 126, 130, 118, 138, 109, 137, 107, 120, 118, 115, + 109, 107, 134, 139, 141, 145, 35, 140, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - - 145, 145, 145, 145, 35, 36, 66, 35, 35, 36, - 53, 36, 36, 36, 36, 36, 72, 36, 36, 36, - 36, 36, 36, 66, 36, 36, 149, 29, 29, 149, - 149, 149, 149, 146, 35, 35, 36, 35, 35, 35, - 35, 35, 147, 35, 35, 138, 149, 149, 35, 35, - 35, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 35, 35, 35, 36, 35, 35, 35, 35, - 35, 147, 35, 35, 149, 149, 149, 35, 35, 35, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 35, 29, 29, 30, 30, 33, 33, 34, 34, + 35, 35, 35, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + + 146, 146, 146, 146, 35, 36, 72, 66, 35, 35, + 36, 53, 36, 36, 36, 36, 36, 72, 36, 36, + 36, 36, 36, 36, 66, 36, 36, 150, 29, 29, + 150, 150, 150, 147, 35, 35, 36, 35, 35, 35, + 35, 35, 148, 35, 35, 138, 150, 150, 35, 35, + 35, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 35, 35, 35, 36, 35, 35, 35, 35, + 35, 148, 35, 35, 150, 150, 150, 35, 35, 35, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 35, 29, 29, 30, 30, 33, 33, 34, 34, 35, 35, 53, 53, 67, 67, 71, 71, 106, 106, 108, 108, 117, 117, 119, 119, 131, 131, 133, 133, - 135, 135, 142, 142, 144, 144, 148, 148, 9, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149 + 135, 135, 142, 142, 144, 144, 149, 149, 9, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150 } ; static yyconst flex_int16_t yy_chk[589] = @@ -567,27 +568,27 @@ static yyconst flex_int16_t yy_chk[589] = 5, 6, 26, 2, 11, 11, 14, 5, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 14, 21, 17, 10, 10, 10, 15, 17, 18, 15, 22, - 23, 156, 21, 21, 18, 18, 27, 27, 26, 85, - 27, 147, 22, 23, 23, 85, 10, 19, 19, 19, + 23, 157, 21, 21, 18, 18, 27, 27, 26, 85, + 27, 148, 22, 23, 23, 85, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 32, 144, 20, 37, 37, 54, 54, 32, + 20, 20, 32, 145, 20, 37, 37, 54, 54, 32, 32, 34, 34, 34, 56, 56, 59, 62, 56, 34, 20, 61, 63, 20, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 34, 43, 59, 24, 24, - 24, 73, 74, 61, 142, 74, 138, 62, 67, 63, - 44, 44, 44, 43, 64, 67, 67, 73, 44, 137, + 24, 73, 74, 61, 144, 74, 142, 62, 67, 63, + 44, 44, 44, 43, 64, 67, 67, 73, 44, 138, 60, 79, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 44, 64, 69, 25, 25, 25, 47, 47, 47, 69, 69, 60, 25, 60, 47, 75, 60, 76, 77, 79, 81, 60, 78, 82, 83, 87, - 95, 25, 28, 28, 47, 86, 28, 89, 135, 88, - 133, 75, 77, 81, 90, 76, 98, 82, 100, 114, + 95, 25, 28, 28, 47, 86, 28, 89, 137, 88, + 135, 75, 77, 81, 90, 76, 98, 82, 100, 114, 95, 87, 76, 28, 28, 105, 78, 28, 83, 86, 88, 89, 28, 84, 84, 84, 28, 28, 45, 45, 45, 84, 90, 114, 45, 100, 45, 98, 45, 45, @@ -596,34 +597,34 @@ static yyconst flex_int16_t yy_chk[589] = 103, 110, 45, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 91, 94, 97, 80, 80, 80, 111, 96, 103, 110, 112, 80, 104, 113, 115, 115, - 116, 123, 80, 125, 126, 128, 130, 130, 139, 131, - 134, 80, 129, 127, 124, 122, 121, 119, 117, 113, - 112, 116, 108, 126, 106, 125, 102, 101, 99, 93, - 92, 71, 123, 128, 134, 139, 140, 140, 140, 140, + 116, 123, 80, 125, 126, 128, 130, 130, 139, 133, + 134, 80, 131, 129, 127, 124, 122, 121, 119, 113, + 112, 116, 117, 126, 108, 125, 106, 102, 101, 99, + 93, 92, 123, 128, 134, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 141, 65, 58, 57, 55, - 53, 52, 51, 50, 49, 48, 42, 41, 146, 40, - 39, 38, 35, 30, 16, 13, 9, 8, 7, 0, - 0, 0, 0, 141, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 146, 0, 0, 145, 145, - 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 140, 140, 140, 140, 140, 141, 71, 65, 58, 57, + 55, 53, 52, 51, 50, 49, 48, 42, 147, 41, + 40, 39, 38, 35, 30, 16, 13, 9, 8, 7, + 0, 0, 0, 141, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 147, 0, 0, 146, 146, + 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 145, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 0, 0, 0, 148, 148, 148, + 0, 0, 146, 149, 149, 149, 149, 149, 149, 149, + 149, 149, 149, 149, 0, 0, 0, 149, 149, 149, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 148, 150, 150, 151, 151, 152, 152, 153, 153, - 154, 154, 155, 155, 157, 157, 158, 158, 159, 159, - 160, 160, 161, 161, 162, 162, 163, 163, 164, 164, - 165, 165, 166, 166, 167, 167, 168, 168, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149 + 0, 149, 151, 151, 152, 152, 153, 153, 154, 154, + 155, 155, 156, 156, 158, 158, 159, 159, 160, 160, + 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, + 166, 166, 167, 167, 168, 168, 169, 169, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150 } ; #define YY_TRAILING_MASK 0x2000 @@ -690,7 +691,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 0; yycolumn = 0; -#line 694 "glcpp/glcpp-lex.c" +#line 695 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -961,7 +962,7 @@ YY_DECL /* Single-line comments */ -#line 965 "glcpp/glcpp-lex.c" +#line 966 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1024,7 +1025,7 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 150 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1128,71 +1129,82 @@ YY_RULE_SETUP return SPACE; } YY_BREAK -/* glcpp doesn't handle #extension, #version, or #pragma directives. - * Simply pass them through to the main compiler's lexer/parser. */ case 8: YY_RULE_SETUP -#line 92 "glcpp/glcpp-lex.l" +#line 90 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; - return OTHER; + yyextra->space_tokens = 0; + return HASH_VERSION; } YY_BREAK +/* glcpp doesn't handle #extension, #version, or #pragma directives. + * Simply pass them through to the main compiler's lexer/parser. */ case 9: -/* rule 9 can match eol */ YY_RULE_SETUP -#line 99 "glcpp/glcpp-lex.l" +#line 100 "glcpp/glcpp-lex.l" { - yyextra->lexing_if = 1; - yyextra->space_tokens = 0; - return HASH_IFDEF; + yylval->str = xtalloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + return OTHER; } YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 105 "glcpp/glcpp-lex.l" +#line 107 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_IFNDEF; + return HASH_IFDEF; } YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 111 "glcpp/glcpp-lex.l" +#line 113 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_IF; + return HASH_IFNDEF; } YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 117 "glcpp/glcpp-lex.l" +#line 119 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_ELIF; + return HASH_IF; } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 123 "glcpp/glcpp-lex.l" +#line 125 "glcpp/glcpp-lex.l" { + yyextra->lexing_if = 1; yyextra->space_tokens = 0; - return HASH_ELSE; + return HASH_ELIF; } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 128 "glcpp/glcpp-lex.l" +#line 131 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ELSE; +} + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 136 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1206,13 +1218,13 @@ YY_RULE_SETUP * * We use the lexing_if flag to avoid skipping any part of an * if conditional expression. */ -case 15: -/* rule 15 can match eol */ +case 16: +/* rule 16 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 141 "glcpp/glcpp-lex.l" +#line 149 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1225,9 +1237,9 @@ YY_RULE_SETUP } } YY_BREAK -case 16: +case 17: YY_RULE_SETUP -#line 153 "glcpp/glcpp-lex.l" +#line 161 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1235,168 +1247,168 @@ YY_RULE_SETUP glcpp_error(yylloc, yyextra, "#error%s", p); } YY_BREAK -case 17: +case 18: YY_RULE_SETUP -#line 160 "glcpp/glcpp-lex.l" +#line 168 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; } YY_BREAK -case 18: +case 19: YY_RULE_SETUP -#line 165 "glcpp/glcpp-lex.l" +#line 173 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; } YY_BREAK -case 19: +case 20: YY_RULE_SETUP -#line 170 "glcpp/glcpp-lex.l" +#line 178 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; } YY_BREAK -case 20: +case 21: YY_RULE_SETUP -#line 175 "glcpp/glcpp-lex.l" +#line 183 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; } YY_BREAK -case 21: +case 22: YY_RULE_SETUP -#line 180 "glcpp/glcpp-lex.l" +#line 188 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 22: +case 23: YY_RULE_SETUP -#line 185 "glcpp/glcpp-lex.l" +#line 193 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 23: +case 24: YY_RULE_SETUP -#line 190 "glcpp/glcpp-lex.l" +#line 198 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK -case 24: +case 25: YY_RULE_SETUP -#line 195 "glcpp/glcpp-lex.l" +#line 203 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK -case 25: +case 26: YY_RULE_SETUP -#line 199 "glcpp/glcpp-lex.l" +#line 207 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK -case 26: +case 27: YY_RULE_SETUP -#line 203 "glcpp/glcpp-lex.l" +#line 211 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK -case 27: +case 28: YY_RULE_SETUP -#line 207 "glcpp/glcpp-lex.l" +#line 215 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK -case 28: +case 29: YY_RULE_SETUP -#line 211 "glcpp/glcpp-lex.l" +#line 219 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK -case 29: +case 30: YY_RULE_SETUP -#line 215 "glcpp/glcpp-lex.l" +#line 223 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK -case 30: +case 31: YY_RULE_SETUP -#line 219 "glcpp/glcpp-lex.l" +#line 227 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK -case 31: +case 32: YY_RULE_SETUP -#line 223 "glcpp/glcpp-lex.l" +#line 231 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK -case 32: +case 33: YY_RULE_SETUP -#line 227 "glcpp/glcpp-lex.l" +#line 235 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK -case 33: +case 34: YY_RULE_SETUP -#line 231 "glcpp/glcpp-lex.l" +#line 239 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK -case 34: +case 35: YY_RULE_SETUP -#line 235 "glcpp/glcpp-lex.l" +#line 243 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); return IDENTIFIER; } YY_BREAK -case 35: +case 36: YY_RULE_SETUP -#line 240 "glcpp/glcpp-lex.l" +#line 248 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 244 "glcpp/glcpp-lex.l" +#line 252 "glcpp/glcpp-lex.l" { yylval->str = xtalloc_strdup (yyextra, yytext); return OTHER; } YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 249 "glcpp/glcpp-lex.l" +#line 257 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; } } YY_BREAK -case 38: -/* rule 38 can match eol */ +case 39: +/* rule 39 can match eol */ YY_RULE_SETUP -#line 255 "glcpp/glcpp-lex.l" +#line 263 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1406,7 +1418,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 263 "glcpp/glcpp-lex.l" +#line 271 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1417,20 +1429,20 @@ case YY_STATE_EOF(INITIAL): only have this action here so that we can pretend to call some generated functions, (to avoid "defined but not used" warnings. */ -case 39: +case 40: YY_RULE_SETUP -#line 273 "glcpp/glcpp-lex.l" +#line 281 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 278 "glcpp/glcpp-lex.l" +#line 286 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1434 "glcpp/glcpp-lex.c" +#line 1446 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -1696,7 +1708,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 150 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1720,11 +1732,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 150 ) + if ( yy_current_state >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 149); + yy_is_jam = (yy_current_state == 150); if ( ! yy_is_jam ) *yyg->yy_state_ptr++ = yy_current_state; @@ -2624,7 +2636,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 278 "glcpp/glcpp-lex.l" +#line 286 "glcpp/glcpp-lex.l" diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index a4c891bdc6..17a097e633 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -87,9 +87,17 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return SPACE; } +{HASH}(version) { + yylval->str = xtalloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + yyextra->space_tokens = 0; + return HASH_VERSION; +} + /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ -{HASH}(extension|version|pragma)[^\n]+ { +{HASH}(extension|pragma)[^\n]+ { yylval->str = xtalloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index bfbd97f3d8..f0ad4a08ec 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -203,10 +203,13 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); static void glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); +static void +add_builtin_define(glcpp_parser_t *parser, const char *name, int value); + /* Line 189 of yacc.c */ -#line 210 "glcpp/glcpp-parse.c" +#line 213 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -246,24 +249,25 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); HASH_IFDEF = 268, HASH_IFNDEF = 269, HASH_UNDEF = 270, - IDENTIFIER = 271, - IF_EXPANDED = 272, - INTEGER = 273, - INTEGER_STRING = 274, - NEWLINE = 275, - OTHER = 276, - PLACEHOLDER = 277, - SPACE = 278, - PASTE = 279, - OR = 280, - AND = 281, - NOT_EQUAL = 282, - EQUAL = 283, - GREATER_OR_EQUAL = 284, - LESS_OR_EQUAL = 285, - RIGHT_SHIFT = 286, - LEFT_SHIFT = 287, - UNARY = 288 + HASH_VERSION = 271, + IDENTIFIER = 272, + IF_EXPANDED = 273, + INTEGER = 274, + INTEGER_STRING = 275, + NEWLINE = 276, + OTHER = 277, + PLACEHOLDER = 278, + SPACE = 279, + PASTE = 280, + OR = 281, + AND = 282, + NOT_EQUAL = 283, + EQUAL = 284, + GREATER_OR_EQUAL = 285, + LESS_OR_EQUAL = 286, + RIGHT_SHIFT = 287, + LEFT_SHIFT = 288, + UNARY = 289 }; #endif @@ -293,7 +297,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 297 "glcpp/glcpp-parse.c" +#line 301 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -510,20 +514,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 673 +#define YYLAST 604 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 56 +#define YYNTOKENS 57 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 16 +#define YYNNTS 17 /* YYNRULES -- Number of rules. */ -#define YYNRULES 98 +#define YYNRULES 100 /* YYNRULES -- Number of states. */ -#define YYNSTATES 157 +#define YYNSTATES 161 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 288 +#define YYMAXUTOK 289 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -534,16 +538,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 46, 2, 2, 2, 42, 29, 2, - 44, 45, 40, 38, 48, 39, 53, 41, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 54, - 32, 55, 33, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 47, 2, 2, 2, 43, 30, 2, + 45, 46, 41, 39, 49, 40, 54, 42, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 55, + 33, 56, 34, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 49, 2, 50, 28, 2, 2, 2, 2, 2, + 2, 50, 2, 51, 29, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 51, 27, 52, 47, 2, 2, 2, + 2, 2, 2, 52, 28, 53, 48, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -559,7 +563,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 30, 31, 34, 35, 36, 37, 43 + 25, 26, 27, 31, 32, 35, 36, 37, 38, 44 }; #if YYDEBUG @@ -569,63 +573,65 @@ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 16, 20, 24, 29, 36, 44, 48, 52, 57, 62, 66, 69, - 72, 75, 78, 80, 82, 86, 90, 94, 98, 102, - 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, - 146, 150, 154, 157, 160, 163, 166, 170, 172, 176, - 178, 181, 184, 185, 187, 188, 190, 193, 198, 200, - 202, 205, 207, 210, 212, 214, 216, 218, 220, 222, - 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, - 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, - 264, 266, 268, 270, 272, 274, 276, 278, 280 + 72, 75, 79, 82, 84, 86, 88, 92, 96, 100, + 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, + 144, 148, 152, 156, 160, 163, 166, 169, 172, 176, + 178, 182, 184, 187, 190, 191, 193, 194, 196, 199, + 204, 206, 208, 211, 213, 216, 218, 220, 222, 224, + 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, + 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, + 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, + 286 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 57, 0, -1, -1, 57, 58, -1, 60, -1, 63, - -1, 59, -1, 6, 64, -1, 17, 61, 20, -1, - 5, 61, 20, -1, 8, 16, 65, 20, -1, 7, - 16, 44, 45, 65, 20, -1, 7, 16, 44, 62, - 45, 65, 20, -1, 15, 16, 20, -1, 12, 68, - 20, -1, 13, 16, 66, 20, -1, 14, 16, 66, - 20, -1, 9, 68, 20, -1, 9, 20, -1, 10, - 20, -1, 11, 20, -1, 6, 20, -1, 19, -1, - 18, -1, 61, 25, 61, -1, 61, 26, 61, -1, - 61, 27, 61, -1, 61, 28, 61, -1, 61, 29, - 61, -1, 61, 30, 61, -1, 61, 31, 61, -1, - 61, 34, 61, -1, 61, 35, 61, -1, 61, 33, - 61, -1, 61, 32, 61, -1, 61, 36, 61, -1, - 61, 37, 61, -1, 61, 39, 61, -1, 61, 38, - 61, -1, 61, 42, 61, -1, 61, 41, 61, -1, - 61, 40, 61, -1, 46, 61, -1, 47, 61, -1, - 39, 61, -1, 38, 61, -1, 44, 61, 45, -1, - 16, -1, 62, 48, 16, -1, 20, -1, 69, 20, - -1, 69, 20, -1, -1, 69, -1, -1, 69, -1, - 4, 16, -1, 4, 44, 16, 45, -1, 70, -1, - 67, -1, 68, 67, -1, 70, -1, 69, 70, -1, - 16, -1, 19, -1, 71, -1, 21, -1, 23, -1, - 49, -1, 50, -1, 44, -1, 45, -1, 51, -1, - 52, -1, 53, -1, 29, -1, 40, -1, 38, -1, - 39, -1, 47, -1, 46, -1, 41, -1, 42, -1, - 37, -1, 36, -1, 32, -1, 33, -1, 35, -1, - 34, -1, 31, -1, 30, -1, 28, -1, 27, -1, - 26, -1, 25, -1, 54, -1, 48, -1, 55, -1, - 24, -1 + 58, 0, -1, -1, 58, 59, -1, 61, -1, 65, + -1, 60, -1, 6, 66, -1, 18, 63, 21, -1, + 5, 63, 21, -1, 8, 17, 67, 21, -1, 7, + 17, 45, 46, 67, 21, -1, 7, 17, 45, 64, + 46, 67, 21, -1, 15, 17, 21, -1, 12, 70, + 21, -1, 13, 17, 68, 21, -1, 14, 17, 68, + 21, -1, 9, 70, 21, -1, 9, 21, -1, 10, + 21, -1, 11, 21, -1, 16, 62, 21, -1, 6, + 21, -1, 20, -1, 19, -1, 62, -1, 63, 26, + 63, -1, 63, 27, 63, -1, 63, 28, 63, -1, + 63, 29, 63, -1, 63, 30, 63, -1, 63, 31, + 63, -1, 63, 32, 63, -1, 63, 35, 63, -1, + 63, 36, 63, -1, 63, 34, 63, -1, 63, 33, + 63, -1, 63, 37, 63, -1, 63, 38, 63, -1, + 63, 40, 63, -1, 63, 39, 63, -1, 63, 43, + 63, -1, 63, 42, 63, -1, 63, 41, 63, -1, + 47, 63, -1, 48, 63, -1, 40, 63, -1, 39, + 63, -1, 45, 63, 46, -1, 17, -1, 64, 49, + 17, -1, 21, -1, 71, 21, -1, 71, 21, -1, + -1, 71, -1, -1, 71, -1, 4, 17, -1, 4, + 45, 17, 46, -1, 72, -1, 69, -1, 70, 69, + -1, 72, -1, 71, 72, -1, 17, -1, 20, -1, + 73, -1, 22, -1, 24, -1, 50, -1, 51, -1, + 45, -1, 46, -1, 52, -1, 53, -1, 54, -1, + 30, -1, 41, -1, 39, -1, 40, -1, 48, -1, + 47, -1, 42, -1, 43, -1, 38, -1, 37, -1, + 33, -1, 34, -1, 36, -1, 35, -1, 32, -1, + 31, -1, 29, -1, 28, -1, 27, -1, 26, -1, + 55, -1, 49, -1, 56, -1, 25, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 166, 166, 168, 172, 175, 180, 181, 185, 188, - 194, 197, 200, 203, 211, 223, 228, 233, 245, 256, - 259, 262, 266, 275, 278, 281, 284, 287, 290, 293, - 296, 299, 302, 305, 308, 311, 314, 317, 320, 323, - 326, 329, 332, 335, 338, 341, 344, 350, 355, 363, - 364, 368, 374, 375, 378, 380, 387, 391, 395, 400, - 406, 414, 420, 428, 432, 436, 440, 444, 451, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 473, 474, 475, 476, 477, 478, 479, 480, 481 + 0, 169, 169, 171, 175, 178, 183, 184, 188, 191, + 197, 200, 203, 206, 214, 226, 231, 236, 248, 259, + 262, 265, 274, 278, 287, 292, 293, 296, 299, 302, + 305, 308, 311, 314, 317, 320, 323, 326, 329, 332, + 335, 338, 341, 344, 347, 350, 353, 356, 359, 365, + 370, 378, 379, 383, 389, 390, 393, 395, 402, 406, + 410, 415, 421, 429, 435, 443, 447, 451, 455, 459, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, + 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, + 496 }; #endif @@ -637,16 +643,16 @@ static const char *const yytname[] = "$end", "error", "$undefined", "COMMA_FINAL", "DEFINED", "ELIF_EXPANDED", "HASH", "HASH_DEFINE_FUNC", "HASH_DEFINE_OBJ", "HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF", "HASH_IFDEF", - "HASH_IFNDEF", "HASH_UNDEF", "IDENTIFIER", "IF_EXPANDED", "INTEGER", - "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", "PASTE", - "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'", "'>'", - "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT", "'+'", - "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", "','", - "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", "input", - "line", "expanded_line", "control_line", "expression", "identifier_list", - "text_line", "non_directive", "replacement_list", "junk", - "conditional_token", "conditional_tokens", "pp_tokens", - "preprocessing_token", "operator", 0 + "HASH_IFNDEF", "HASH_UNDEF", "HASH_VERSION", "IDENTIFIER", "IF_EXPANDED", + "INTEGER", "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", + "PASTE", "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'", + "'>'", "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT", + "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", + "','", "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", + "input", "line", "expanded_line", "control_line", "integer_constant", + "expression", "identifier_list", "text_line", "non_directive", + "replacement_list", "junk", "conditional_token", "conditional_tokens", + "pp_tokens", "preprocessing_token", "operator", 0 }; #endif @@ -657,26 +663,27 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 124, 94, 38, - 282, 283, 60, 62, 284, 285, 286, 287, 43, 45, - 42, 47, 37, 288, 40, 41, 33, 126, 44, 91, - 93, 123, 125, 46, 59, 61 + 275, 276, 277, 278, 279, 280, 281, 282, 124, 94, + 38, 283, 284, 60, 62, 285, 286, 287, 288, 43, + 45, 42, 47, 37, 289, 40, 41, 33, 126, 44, + 91, 93, 123, 125, 46, 59, 61 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 56, 57, 57, 58, 58, 58, 58, 59, 59, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, + 0, 57, 58, 58, 59, 59, 59, 59, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 62, 62, 63, - 63, 64, 65, 65, 66, 66, 67, 67, 67, 68, - 68, 69, 69, 70, 70, 70, 70, 70, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71 + 61, 61, 61, 62, 62, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, + 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, + 69, 70, 70, 71, 71, 72, 72, 72, 72, 72, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -684,14 +691,15 @@ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 2, 3, 3, 4, 6, 7, 3, 3, 4, 4, 3, 2, 2, - 2, 2, 1, 1, 3, 3, 3, 3, 3, 3, + 2, 3, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 2, 2, 2, 2, 3, 1, 3, 1, - 2, 2, 0, 1, 0, 1, 2, 4, 1, 1, - 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 2, 2, 2, 2, 3, 1, + 3, 1, 2, 2, 0, 1, 0, 1, 2, 4, + 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -700,58 +708,60 @@ static const yytype_uint8 yyr2[] = static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 63, 0, 64, 49, 66, 67, - 98, 94, 93, 92, 91, 75, 90, 89, 85, 86, - 88, 87, 84, 83, 77, 78, 76, 81, 82, 70, - 71, 80, 79, 96, 68, 69, 72, 73, 74, 95, - 97, 3, 6, 4, 5, 0, 61, 65, 23, 22, - 0, 0, 0, 0, 0, 0, 21, 7, 0, 0, - 52, 0, 18, 59, 0, 58, 19, 20, 0, 54, - 54, 0, 0, 50, 62, 45, 44, 0, 42, 43, - 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, - 0, 0, 53, 56, 0, 17, 60, 14, 0, 55, - 0, 13, 8, 46, 24, 25, 26, 27, 28, 29, - 30, 34, 33, 31, 32, 35, 36, 38, 37, 41, - 40, 39, 47, 52, 0, 10, 0, 15, 16, 0, - 52, 0, 57, 11, 0, 48, 12 + 0, 0, 0, 0, 0, 65, 0, 66, 51, 68, + 69, 100, 96, 95, 94, 93, 77, 92, 91, 87, + 88, 90, 89, 86, 85, 79, 80, 78, 83, 84, + 72, 73, 82, 81, 98, 70, 71, 74, 75, 76, + 97, 99, 3, 6, 4, 5, 0, 63, 67, 24, + 23, 0, 0, 0, 0, 0, 25, 0, 22, 7, + 0, 0, 54, 0, 18, 61, 0, 60, 19, 20, + 0, 56, 56, 0, 0, 0, 52, 64, 47, 46, + 0, 44, 45, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 53, 0, 0, 55, 58, 0, 17, 62, + 14, 0, 57, 0, 13, 21, 8, 48, 26, 27, + 28, 29, 30, 31, 32, 36, 35, 33, 34, 37, + 38, 40, 39, 43, 42, 41, 49, 54, 0, 10, + 0, 15, 16, 0, 54, 0, 59, 11, 0, 50, + 12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 51, 52, 53, 65, 144, 54, 67, 111, - 118, 73, 74, 112, 56, 57 + -1, 1, 52, 53, 54, 66, 67, 148, 55, 69, + 114, 121, 75, 76, 115, 57, 58 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -120 +#define YYPACT_NINF -146 static const yytype_int16 yypact[] = { - -120, 108, -120, -17, 356, -9, 9, 160, -15, 6, - 316, 17, 18, 29, -120, -17, -120, -120, -120, -120, - -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, - -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, - -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, - -120, -120, -120, -120, -120, 396, -120, -120, -120, -120, - -17, -17, -17, -17, -17, 512, -120, -120, 436, 2, - 476, -8, -120, -120, 212, -120, -120, -120, 264, 476, - 476, 39, 535, -120, -120, -120, -120, 553, -120, -120, - -120, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17, -17, -120, - -10, 40, 476, -120, 49, -120, -120, -120, 46, 476, - 48, -120, -120, -120, 573, 589, 604, 618, 631, -23, - -23, 1, 1, 1, 1, 16, 16, 22, 22, -120, - -120, -120, -120, 476, -1, -120, 24, -120, -120, 50, - 476, 56, -120, -120, 53, -120, -120 + -146, 111, -146, 429, -10, -9, -4, 151, -15, 27, + 271, 54, 63, 86, 82, -146, 429, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, + -146, -146, -146, -146, -146, -146, 311, -146, -146, -146, + -146, 429, 429, 429, 429, 429, -146, 452, -146, -146, + 351, 59, 391, 17, -146, -146, 191, -146, -146, -146, + 231, 391, 391, 84, 85, 475, -146, -146, -146, -146, + 424, -146, -146, -146, 429, 429, 429, 429, 429, 429, + 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, + 429, 429, -146, 30, 88, 391, -146, 90, -146, -146, + -146, 89, 391, 91, -146, -146, -146, -146, 492, 508, + 523, 537, 550, 561, 561, 18, 18, 18, 18, 25, + 25, 36, 36, -146, -146, -146, -146, 391, 26, -146, + 67, -146, -146, 93, 391, 113, -146, -146, 148, -146, + -146 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yytype_int16 yypgoto[] = { - -120, -120, -120, -120, -120, -11, -120, -120, -120, -119, - -6, -46, 65, 19, -7, -120 + -146, -146, -146, -146, -146, 120, -11, -146, -146, -146, + -145, 92, -6, 160, 0, -7, -146 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -761,168 +771,155 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 75, 58, 59, 75, 82, 76, 142, 69, 113, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 55, 60, 61, 68, 149, 70, 77, 62, 116, 63, - 64, 154, 116, 79, 80, 143, 114, 102, 103, 104, - 105, 106, 107, 108, 150, 81, 110, 151, 84, 85, - 86, 87, 88, 89, 104, 105, 106, 107, 108, 121, - 145, 84, 106, 107, 108, 146, 147, 75, 148, 152, - 153, 75, 155, 156, 120, 78, 0, 0, 0, 0, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 119, 119, - 0, 0, 0, 0, 0, 84, 0, 0, 2, 0, - 0, 0, 84, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 0, 16, 17, 18, - 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 71, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 0, 0, 16, - 72, 18, 0, 19, 20, 21, 22, 23, 24, 25, + 77, 56, 153, 77, 70, 85, 78, 15, 71, 158, + 17, 68, 19, 72, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 71, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, - 0, 16, 115, 18, 0, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 0, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 71, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 14, 0, 0, 16, 117, 18, 0, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 0, 0, 16, 0, 18, 0, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 14, 0, 0, 16, 66, 18, 0, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 14, 0, 0, 16, 83, 18, 0, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 14, 0, 0, 16, 109, 18, 0, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 14, 0, 0, 16, 0, 18, 0, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 90, 0, 0, 0, 0, 91, 92, 93, + 36, 37, 38, 39, 116, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 146, 79, 87, + 88, 89, 90, 91, 92, 105, 106, 107, 108, 109, + 110, 111, 117, 87, 107, 108, 109, 110, 111, 77, + 119, 81, 154, 77, 119, 155, 147, 109, 110, 111, + 82, 122, 122, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 59, 60, 83, 113, 124, 125, 150, 87, 149, + 151, 2, 152, 156, 157, 87, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 159, 17, 18, 19, 84, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 160, + 80, 17, 74, 19, 123, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 118, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 120, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 0, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 86, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 112, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, + 0, 17, 0, 19, 0, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 59, 60, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 122, 0, 0, 0, 0, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 0, 0, 123, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108 + 104, 105, 106, 107, 108, 109, 110, 111, 61, 62, + 127, 0, 0, 93, 63, 0, 64, 65, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 126, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111 }; static const yytype_int16 yycheck[] = { - 7, 18, 19, 10, 15, 20, 16, 16, 16, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 1, 38, 39, 4, 143, 16, 20, 44, 74, 46, - 47, 150, 78, 16, 16, 45, 44, 36, 37, 38, - 39, 40, 41, 42, 45, 16, 44, 48, 55, 60, - 61, 62, 63, 64, 38, 39, 40, 41, 42, 20, - 20, 68, 40, 41, 42, 16, 20, 74, 20, 45, - 20, 78, 16, 20, 80, 10, -1, -1, -1, -1, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 79, 80, - -1, -1, -1, -1, -1, 112, -1, -1, 0, -1, - -1, -1, 119, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, 21, - -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, -1, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 4, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 16, -1, -1, 19, - 20, 21, -1, 23, 24, 25, 26, 27, 28, 29, + 7, 1, 147, 10, 4, 16, 21, 17, 17, 154, + 20, 21, 22, 17, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, -1, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 4, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, - -1, 19, 20, 21, -1, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, -1, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 4, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 16, -1, -1, 19, 20, 21, -1, 23, 24, 25, + 40, 41, 42, 43, 17, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 17, 21, 56, + 61, 62, 63, 64, 65, 37, 38, 39, 40, 41, + 42, 43, 45, 70, 39, 40, 41, 42, 43, 76, + 76, 17, 46, 80, 80, 49, 46, 41, 42, 43, + 17, 81, 82, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 19, 20, 17, 45, 21, 21, 17, 115, 21, + 21, 0, 21, 46, 21, 122, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 17, 20, 21, 22, 14, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, 21, + 10, 20, 21, 22, 82, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, -1, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, + -1, 20, -1, 22, -1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 19, 20, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, -1, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 16, -1, -1, 19, -1, 21, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 16, -1, -1, 19, 20, 21, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 16, -1, -1, 19, -1, 21, -1, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 20, -1, -1, -1, -1, 25, 26, 27, + 36, 37, 38, 39, 40, 41, 42, 43, 39, 40, + 46, -1, -1, 21, 45, -1, 47, 48, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 20, -1, -1, -1, -1, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, -1, -1, 45, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 29, 30, 31, + 38, 39, 40, 41, 42, 43, 21, -1, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42 + 42, 43, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 57, 0, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 19, 20, 21, 23, + 0, 58, 0, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 58, 59, 60, 63, 69, 70, 71, 18, 19, - 38, 39, 44, 46, 47, 61, 20, 64, 69, 16, - 16, 4, 20, 67, 68, 70, 20, 20, 68, 16, - 16, 16, 61, 20, 70, 61, 61, 61, 61, 61, - 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 20, - 44, 65, 69, 16, 44, 20, 67, 20, 66, 69, - 66, 20, 20, 45, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 16, 45, 62, 20, 16, 20, 20, 65, - 45, 48, 45, 20, 65, 16, 20 + 55, 56, 59, 60, 61, 65, 71, 72, 73, 19, + 20, 39, 40, 45, 47, 48, 62, 63, 21, 66, + 71, 17, 17, 4, 21, 69, 70, 72, 21, 21, + 70, 17, 17, 17, 62, 63, 21, 72, 63, 63, + 63, 63, 63, 21, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 21, 45, 67, 71, 17, 45, 21, 69, + 21, 68, 71, 68, 21, 21, 21, 46, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 17, 46, 64, 21, + 17, 21, 21, 67, 46, 49, 46, 21, 67, 17, + 21 }; #define yyerrok (yyerrstatus = 0) @@ -1776,7 +1773,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 172 "glcpp/glcpp-parse.y" +#line 175 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); ;} @@ -1785,7 +1782,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 175 "glcpp/glcpp-parse.y" +#line 178 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); glcpp_print(parser->output, "\n"); @@ -1796,7 +1793,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 185 "glcpp/glcpp-parse.y" +#line 188 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1805,7 +1802,7 @@ yyreduce: case 9: /* Line 1455 of yacc.c */ -#line 188 "glcpp/glcpp-parse.y" +#line 191 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1814,7 +1811,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 194 "glcpp/glcpp-parse.y" +#line 197 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1823,7 +1820,7 @@ yyreduce: case 11: /* Line 1455 of yacc.c */ -#line 197 "glcpp/glcpp-parse.y" +#line 200 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1832,7 +1829,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 200 "glcpp/glcpp-parse.y" +#line 203 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); ;} @@ -1841,7 +1838,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 203 "glcpp/glcpp-parse.y" +#line 206 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { @@ -1855,7 +1852,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 211 "glcpp/glcpp-parse.y" +#line 214 "glcpp/glcpp-parse.y" { token_list_t *expanded; token_t *token; @@ -1873,7 +1870,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 223 "glcpp/glcpp-parse.y" +#line 226 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1884,7 +1881,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 228 "glcpp/glcpp-parse.y" +#line 231 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1895,7 +1892,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 233 "glcpp/glcpp-parse.y" +#line 236 "glcpp/glcpp-parse.y" { token_list_t *expanded; token_t *token; @@ -1913,7 +1910,7 @@ yyreduce: case 18: /* Line 1455 of yacc.c */ -#line 245 "glcpp/glcpp-parse.y" +#line 248 "glcpp/glcpp-parse.y" { /* #elif without an expression results in a warning if the * condition doesn't matter (we just handled #if 1 or such) @@ -1930,7 +1927,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 256 "glcpp/glcpp-parse.y" +#line 259 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1939,16 +1936,31 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 259 "glcpp/glcpp-parse.y" +#line 262 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} break; - case 22: + case 21: /* Line 1455 of yacc.c */ -#line 266 "glcpp/glcpp-parse.y" +#line 265 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); + if (macro) { + hash_table_remove (parser->defines, "__VERSION__"); + talloc_free (macro); + } + add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival)); + glcpp_printf(parser->output, "#version %" PRIiMAX "\n", (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 278 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -1960,226 +1972,226 @@ yyreduce: ;} break; - case 23: + case 24: /* Line 1455 of yacc.c */ -#line 275 "glcpp/glcpp-parse.y" +#line 287 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 24: + case 26: /* Line 1455 of yacc.c */ -#line 278 "glcpp/glcpp-parse.y" +#line 293 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} break; - case 25: + case 27: /* Line 1455 of yacc.c */ -#line 281 "glcpp/glcpp-parse.y" +#line 296 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} break; - case 26: + case 28: /* Line 1455 of yacc.c */ -#line 284 "glcpp/glcpp-parse.y" +#line 299 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 27: + case 29: /* Line 1455 of yacc.c */ -#line 287 "glcpp/glcpp-parse.y" +#line 302 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} break; - case 28: + case 30: /* Line 1455 of yacc.c */ -#line 290 "glcpp/glcpp-parse.y" +#line 305 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} break; - case 29: + case 31: /* Line 1455 of yacc.c */ -#line 293 "glcpp/glcpp-parse.y" +#line 308 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} break; - case 30: + case 32: /* Line 1455 of yacc.c */ -#line 296 "glcpp/glcpp-parse.y" +#line 311 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} break; - case 31: + case 33: /* Line 1455 of yacc.c */ -#line 299 "glcpp/glcpp-parse.y" +#line 314 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} break; - case 32: + case 34: /* Line 1455 of yacc.c */ -#line 302 "glcpp/glcpp-parse.y" +#line 317 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} break; - case 33: + case 35: /* Line 1455 of yacc.c */ -#line 305 "glcpp/glcpp-parse.y" +#line 320 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} break; - case 34: + case 36: /* Line 1455 of yacc.c */ -#line 308 "glcpp/glcpp-parse.y" +#line 323 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} break; - case 35: + case 37: /* Line 1455 of yacc.c */ -#line 311 "glcpp/glcpp-parse.y" +#line 326 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} break; - case 36: + case 38: /* Line 1455 of yacc.c */ -#line 314 "glcpp/glcpp-parse.y" +#line 329 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} break; - case 37: + case 39: /* Line 1455 of yacc.c */ -#line 317 "glcpp/glcpp-parse.y" +#line 332 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} break; - case 38: + case 40: /* Line 1455 of yacc.c */ -#line 320 "glcpp/glcpp-parse.y" +#line 335 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} break; - case 39: + case 41: /* Line 1455 of yacc.c */ -#line 323 "glcpp/glcpp-parse.y" +#line 338 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} break; - case 40: + case 42: /* Line 1455 of yacc.c */ -#line 326 "glcpp/glcpp-parse.y" +#line 341 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} break; - case 41: + case 43: /* Line 1455 of yacc.c */ -#line 329 "glcpp/glcpp-parse.y" +#line 344 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} break; - case 42: + case 44: /* Line 1455 of yacc.c */ -#line 332 "glcpp/glcpp-parse.y" +#line 347 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} break; - case 43: + case 45: /* Line 1455 of yacc.c */ -#line 335 "glcpp/glcpp-parse.y" +#line 350 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} break; - case 44: + case 46: /* Line 1455 of yacc.c */ -#line 338 "glcpp/glcpp-parse.y" +#line 353 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} break; - case 45: + case 47: /* Line 1455 of yacc.c */ -#line 341 "glcpp/glcpp-parse.y" +#line 356 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} break; - case 46: + case 48: /* Line 1455 of yacc.c */ -#line 344 "glcpp/glcpp-parse.y" +#line 359 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} break; - case 47: + case 49: /* Line 1455 of yacc.c */ -#line 350 "glcpp/glcpp-parse.y" +#line 365 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2187,10 +2199,10 @@ yyreduce: ;} break; - case 48: + case 50: /* Line 1455 of yacc.c */ -#line 355 "glcpp/glcpp-parse.y" +#line 370 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2198,62 +2210,62 @@ yyreduce: ;} break; - case 49: + case 51: /* Line 1455 of yacc.c */ -#line 363 "glcpp/glcpp-parse.y" +#line 378 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; - case 51: + case 53: /* Line 1455 of yacc.c */ -#line 368 "glcpp/glcpp-parse.y" +#line 383 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} break; - case 52: + case 54: /* Line 1455 of yacc.c */ -#line 374 "glcpp/glcpp-parse.y" +#line 389 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; - case 55: + case 57: /* Line 1455 of yacc.c */ -#line 380 "glcpp/glcpp-parse.y" +#line 395 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} break; - case 56: + case 58: /* Line 1455 of yacc.c */ -#line 387 "glcpp/glcpp-parse.y" +#line 402 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); ;} break; - case 57: + case 59: /* Line 1455 of yacc.c */ -#line 391 "glcpp/glcpp-parse.y" +#line 406 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); ;} break; - case 59: + case 61: /* Line 1455 of yacc.c */ -#line 400 "glcpp/glcpp-parse.y" +#line 415 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2262,10 +2274,10 @@ yyreduce: ;} break; - case 60: + case 62: /* Line 1455 of yacc.c */ -#line 406 "glcpp/glcpp-parse.y" +#line 421 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2273,10 +2285,10 @@ yyreduce: ;} break; - case 61: + case 63: /* Line 1455 of yacc.c */ -#line 414 "glcpp/glcpp-parse.y" +#line 429 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2285,10 +2297,10 @@ yyreduce: ;} break; - case 62: + case 64: /* Line 1455 of yacc.c */ -#line 420 "glcpp/glcpp-parse.y" +#line 435 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2296,277 +2308,277 @@ yyreduce: ;} break; - case 63: + case 65: /* Line 1455 of yacc.c */ -#line 428 "glcpp/glcpp-parse.y" +#line 443 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 64: + case 66: /* Line 1455 of yacc.c */ -#line 432 "glcpp/glcpp-parse.y" +#line 447 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 65: + case 67: /* Line 1455 of yacc.c */ -#line 436 "glcpp/glcpp-parse.y" +#line 451 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; ;} break; - case 66: + case 68: /* Line 1455 of yacc.c */ -#line 440 "glcpp/glcpp-parse.y" +#line 455 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 67: + case 69: /* Line 1455 of yacc.c */ -#line 444 "glcpp/glcpp-parse.y" +#line 459 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; ;} break; - case 68: + case 70: /* Line 1455 of yacc.c */ -#line 451 "glcpp/glcpp-parse.y" +#line 466 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; - case 69: + case 71: /* Line 1455 of yacc.c */ -#line 452 "glcpp/glcpp-parse.y" +#line 467 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; - case 70: + case 72: /* Line 1455 of yacc.c */ -#line 453 "glcpp/glcpp-parse.y" +#line 468 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; - case 71: + case 73: /* Line 1455 of yacc.c */ -#line 454 "glcpp/glcpp-parse.y" +#line 469 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; - case 72: + case 74: /* Line 1455 of yacc.c */ -#line 455 "glcpp/glcpp-parse.y" +#line 470 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; - case 73: + case 75: /* Line 1455 of yacc.c */ -#line 456 "glcpp/glcpp-parse.y" +#line 471 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; - case 74: + case 76: /* Line 1455 of yacc.c */ -#line 457 "glcpp/glcpp-parse.y" +#line 472 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; - case 75: + case 77: /* Line 1455 of yacc.c */ -#line 458 "glcpp/glcpp-parse.y" +#line 473 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; - case 76: + case 78: /* Line 1455 of yacc.c */ -#line 459 "glcpp/glcpp-parse.y" +#line 474 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; - case 77: + case 79: /* Line 1455 of yacc.c */ -#line 460 "glcpp/glcpp-parse.y" +#line 475 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; - case 78: + case 80: /* Line 1455 of yacc.c */ -#line 461 "glcpp/glcpp-parse.y" +#line 476 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; - case 79: + case 81: /* Line 1455 of yacc.c */ -#line 462 "glcpp/glcpp-parse.y" +#line 477 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; - case 80: + case 82: /* Line 1455 of yacc.c */ -#line 463 "glcpp/glcpp-parse.y" +#line 478 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; - case 81: + case 83: /* Line 1455 of yacc.c */ -#line 464 "glcpp/glcpp-parse.y" +#line 479 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; - case 82: + case 84: /* Line 1455 of yacc.c */ -#line 465 "glcpp/glcpp-parse.y" +#line 480 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; - case 83: + case 85: /* Line 1455 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +#line 481 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; - case 84: + case 86: /* Line 1455 of yacc.c */ -#line 467 "glcpp/glcpp-parse.y" +#line 482 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; - case 85: + case 87: /* Line 1455 of yacc.c */ -#line 468 "glcpp/glcpp-parse.y" +#line 483 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; - case 86: + case 88: /* Line 1455 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +#line 484 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; - case 87: + case 89: /* Line 1455 of yacc.c */ -#line 470 "glcpp/glcpp-parse.y" +#line 485 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; - case 88: + case 90: /* Line 1455 of yacc.c */ -#line 471 "glcpp/glcpp-parse.y" +#line 486 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; - case 89: + case 91: /* Line 1455 of yacc.c */ -#line 472 "glcpp/glcpp-parse.y" +#line 487 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; - case 90: + case 92: /* Line 1455 of yacc.c */ -#line 473 "glcpp/glcpp-parse.y" +#line 488 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; - case 91: + case 93: /* Line 1455 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +#line 489 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; - case 92: + case 94: /* Line 1455 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +#line 490 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; - case 93: + case 95: /* Line 1455 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +#line 491 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; - case 94: + case 96: /* Line 1455 of yacc.c */ -#line 477 "glcpp/glcpp-parse.y" +#line 492 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; - case 95: + case 97: /* Line 1455 of yacc.c */ -#line 478 "glcpp/glcpp-parse.y" +#line 493 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; - case 96: + case 98: /* Line 1455 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +#line 494 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; - case 97: + case 99: /* Line 1455 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +#line 495 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; - case 98: + case 100: /* Line 1455 of yacc.c */ -#line 481 "glcpp/glcpp-parse.y" +#line 496 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1455 of yacc.c */ -#line 2570 "glcpp/glcpp-parse.c" +#line 2582 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2785,7 +2797,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +#line 499 "glcpp/glcpp-parse.y" string_list_t * @@ -3196,12 +3208,26 @@ yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) glcpp_error(locp, parser, "%s", error); } +static void add_builtin_define(glcpp_parser_t *parser, + const char *name, int value) +{ + token_t *tok; + token_list_t *list; + + tok = _token_create_ival (parser, INTEGER, value); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, name, list); + + talloc_unlink(parser, tok); +} + glcpp_parser_t * glcpp_parser_create (const struct gl_extensions *extensions) { glcpp_parser_t *parser; - token_t *tok; - token_list_t *list; + int language_version; parser = xtalloc (NULL, glcpp_parser_t); @@ -3225,32 +3251,24 @@ glcpp_parser_create (const struct gl_extensions *extensions) parser->error = 0; /* Add pre-defined macros. */ - tok = _token_create_ival (parser, INTEGER, 1); + add_builtin_define(parser, "GL_ARB_draw_buffers", 1); + add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list); + if (extensions != NULL) { + if (extensions->EXT_texture_array) { + add_builtin_define(parser, "GL_EXT_texture_array", 1); + } - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list); - - if ((extensions != NULL) && extensions->EXT_texture_array) { - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, - "GL_EXT_texture_array", list); + if (extensions->ARB_fragment_coord_conventions) + add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", + 1); } - if ((extensions != NULL) && - extensions->ARB_fragment_coord_conventions) { - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, - "GL_ARB_fragment_coord_conventions", list); + language_version = 110; + if (extensions && extensions->ARB_shading_language_120) { + language_version = 120; } - - talloc_unlink(parser, tok); + add_builtin_define(parser, "__VERSION__", language_version); return parser; } diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 6365068ad0..50758930e9 100644 --- a/src/glsl/glcpp/glcpp-parse.h +++ b/src/glsl/glcpp/glcpp-parse.h @@ -52,24 +52,25 @@ HASH_IFDEF = 268, HASH_IFNDEF = 269, HASH_UNDEF = 270, - IDENTIFIER = 271, - IF_EXPANDED = 272, - INTEGER = 273, - INTEGER_STRING = 274, - NEWLINE = 275, - OTHER = 276, - PLACEHOLDER = 277, - SPACE = 278, - PASTE = 279, - OR = 280, - AND = 281, - NOT_EQUAL = 282, - EQUAL = 283, - GREATER_OR_EQUAL = 284, - LESS_OR_EQUAL = 285, - RIGHT_SHIFT = 286, - LEFT_SHIFT = 287, - UNARY = 288 + HASH_VERSION = 271, + IDENTIFIER = 272, + IF_EXPANDED = 273, + INTEGER = 274, + INTEGER_STRING = 275, + NEWLINE = 276, + OTHER = 277, + PLACEHOLDER = 278, + SPACE = 279, + PASTE = 280, + OR = 281, + AND = 282, + NOT_EQUAL = 283, + EQUAL = 284, + GREATER_OR_EQUAL = 285, + LESS_OR_EQUAL = 286, + RIGHT_SHIFT = 287, + LEFT_SHIFT = 288, + UNARY = 289 }; #endif diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 2009aeaf8a..e82fc92c8c 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -132,6 +132,9 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); static void glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); +static void +add_builtin_define(glcpp_parser_t *parser, const char *name, int value); + %} %pure-parser @@ -142,9 +145,9 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); %lex-param {glcpp_parser_t *parser} %expect 0 -%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE %token PASTE -%type expression INTEGER operator SPACE +%type expression INTEGER operator SPACE integer_constant %type IDENTIFIER INTEGER_STRING OTHER %type identifier_list %type preprocessing_token conditional_token @@ -259,10 +262,19 @@ control_line: | HASH_ENDIF NEWLINE { _glcpp_parser_skip_stack_pop (parser, & @1); } +| HASH_VERSION integer_constant NEWLINE { + macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); + if (macro) { + hash_table_remove (parser->defines, "__VERSION__"); + talloc_free (macro); + } + add_builtin_define (parser, "__VERSION__", $2); + glcpp_printf(parser->output, "#version %" PRIiMAX "\n", $2); + } | HASH NEWLINE ; -expression: +integer_constant: INTEGER_STRING { if (strlen ($1) >= 3 && strncmp ($1, "0x", 2) == 0) { $$ = strtoll ($1 + 2, NULL, 16); @@ -275,6 +287,9 @@ expression: | INTEGER { $$ = $1; } + +expression: + integer_constant | expression OR expression { $$ = $1 || $3; } @@ -891,12 +906,26 @@ yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) glcpp_error(locp, parser, "%s", error); } +static void add_builtin_define(glcpp_parser_t *parser, + const char *name, int value) +{ + token_t *tok; + token_list_t *list; + + tok = _token_create_ival (parser, INTEGER, value); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, name, list); + + talloc_unlink(parser, tok); +} + glcpp_parser_t * glcpp_parser_create (const struct gl_extensions *extensions) { glcpp_parser_t *parser; - token_t *tok; - token_list_t *list; + int language_version; parser = xtalloc (NULL, glcpp_parser_t); @@ -920,32 +949,24 @@ glcpp_parser_create (const struct gl_extensions *extensions) parser->error = 0; /* Add pre-defined macros. */ - tok = _token_create_ival (parser, INTEGER, 1); + add_builtin_define(parser, "GL_ARB_draw_buffers", 1); + add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list); + if (extensions != NULL) { + if (extensions->EXT_texture_array) { + add_builtin_define(parser, "GL_EXT_texture_array", 1); + } - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list); - - if ((extensions != NULL) && extensions->EXT_texture_array) { - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, - "GL_EXT_texture_array", list); + if (extensions->ARB_fragment_coord_conventions) + add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", + 1); } - if ((extensions != NULL) && - extensions->ARB_fragment_coord_conventions) { - list = _token_list_create(parser); - _token_list_append(list, tok); - _define_object_macro(parser, NULL, - "GL_ARB_fragment_coord_conventions", list); + language_version = 110; + if (extensions && extensions->ARB_shading_language_120) { + language_version = 120; } - - talloc_unlink(parser, tok); + add_builtin_define(parser, "__VERSION__", language_version); return parser; } -- cgit v1.2.3 From d6942460cec5ffb69dfee7492f7dac59872735de Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Jul 2010 17:36:07 -0700 Subject: glsl2: Actually fix glsl-version-define. --- src/glsl/glcpp/glcpp-parse.c | 3 --- src/glsl/glcpp/glcpp-parse.y | 3 --- 2 files changed, 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index f0ad4a08ec..9dc4bfb3ab 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -3265,9 +3265,6 @@ glcpp_parser_create (const struct gl_extensions *extensions) } language_version = 110; - if (extensions && extensions->ARB_shading_language_120) { - language_version = 120; - } add_builtin_define(parser, "__VERSION__", language_version); return parser; diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e82fc92c8c..855448ff20 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -963,9 +963,6 @@ glcpp_parser_create (const struct gl_extensions *extensions) } language_version = 110; - if (extensions && extensions->ARB_shading_language_120) { - language_version = 120; - } add_builtin_define(parser, "__VERSION__", language_version); return parser; -- cgit v1.2.3 From 4285247f12d45b0505da06773d7cafcd2c296fb5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 13:42:39 -0700 Subject: glsl2: Remove an inlined unvalued return statement. We already have asserts that it was the last call in the function, so it's safe to remove after it got cloned in. Fixes: glsl-fs-functions-4. --- src/glsl/ir_function_inlining.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index b143190ff6..9daffeb017 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -97,6 +97,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) * have reached here. (see can_inline()). */ assert(!ret->next->is_tail_sentinal()); + ret->remove(); } } } -- cgit v1.2.3 From fa33d0b85403da94e3f4a7e6c868af215c076b4b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 13:50:17 -0700 Subject: glsl2: Fix spelling of "initializer." --- src/glsl/ast_to_hir.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 8e8690c628..9591d36de8 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1800,7 +1800,7 @@ ast_declarator_list::hir(exec_list *instructions, * redeclarations) the declaration may not actually be added to the * instruction stream. */ - exec_list intializer_instructions; + exec_list initializer_instructions; if (decl->initializer != NULL) { YYLTYPE initializer_loc = decl->initializer->get_location(); @@ -1830,7 +1830,7 @@ ast_declarator_list::hir(exec_list *instructions, } ir_dereference *const lhs = new(ctx) ir_dereference_variable(var); - ir_rvalue *rhs = decl->initializer->hir(&intializer_instructions, + ir_rvalue *rhs = decl->initializer->hir(&initializer_instructions, state); /* Calculate the constant value if this is a const or uniform @@ -1869,7 +1869,8 @@ ast_declarator_list::hir(exec_list *instructions, /* Never emit code to initialize a uniform. */ if (!this->type->qualifier.uniform) - result = do_assignment(&intializer_instructions, state, lhs, rhs, + result = do_assignment(&initializer_instructions, state, + lhs, rhs, this->get_location()); var->read_only = temp; } @@ -1969,7 +1970,7 @@ ast_declarator_list::hir(exec_list *instructions, } instructions->push_tail(var); - instructions->append_list(&intializer_instructions); + instructions->append_list(&initializer_instructions); /* Add the variable to the symbol table after processing the initializer. * This differs from most C-like languages, but it follows the GLSL -- cgit v1.2.3 From 62c4763b707e2227409f81b09dd5cf6e4410ea6a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 13:52:25 -0700 Subject: glsl2: Fix spelling of "sentinel." --- src/glsl/ast_function.cpp | 6 +++--- src/glsl/ir.cpp | 8 ++++---- src/glsl/ir_clone.cpp | 2 +- src/glsl/ir_function.cpp | 10 +++++----- src/glsl/ir_function_inlining.cpp | 2 +- src/glsl/linker.cpp | 2 +- src/glsl/list.h | 32 ++++++++++++++++---------------- 7 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index bb45e2530d..bbc3bc1a59 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -398,7 +398,7 @@ constant_record_constructor(const glsl_type *constructor_type, for (unsigned i = 0; i < constructor_type->length; i++) { ir_instruction *ir = (ir_instruction *) node; - if (node->is_tail_sentinal()) { + if (node->is_tail_sentinel()) { _mesa_glsl_error(loc, state, "insufficient parameters to constructor for `%s'", constructor_type->name); @@ -531,7 +531,7 @@ 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_sentinal()); + return (p->type->is_scalar() && p->next->is_tail_sentinel()); } @@ -763,7 +763,7 @@ emit_inline_matrix_constructor(const glsl_type *type, * 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_sentinal()); + 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 diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index bb58d95624..7178c68e6b 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -295,7 +295,7 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) */ for (unsigned i = 0; i < type->components(); /* empty */) { assert(value->as_constant() != NULL); - assert(!value->is_tail_sentinal()); + assert(!value->is_tail_sentinel()); for (unsigned j = 0; j < value->type->components(); j++) { switch (type->base_type) { @@ -433,7 +433,7 @@ ir_constant::get_record_field(const char *name) /* If the end of the list is encountered before the element matching the * requested field is found, return NULL. */ - if (node->is_tail_sentinal()) + if (node->is_tail_sentinel()) return NULL; } @@ -459,8 +459,8 @@ ir_constant::has_value(const ir_constant *c) const const exec_node *a_node = this->components.head; const exec_node *b_node = c->components.head; - while (!a_node->is_tail_sentinal()) { - assert(!b_node->is_tail_sentinal()); + while (!a_node->is_tail_sentinel()) { + assert(!b_node->is_tail_sentinel()); const ir_constant *const a_field = (ir_constant *) a_node; const ir_constant *const b_field = (ir_constant *) b_node; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index f97080d205..6be3e59a95 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -330,7 +330,7 @@ ir_constant::clone(struct hash_table *ht) const c->type = this->type; for (exec_node *node = this->components.head - ; !node->is_tail_sentinal() + ; !node->is_tail_sentinel() ; node = node->next) { ir_constant *const orig = (ir_constant *) node; diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index 28a5c399f1..0a97e01424 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -94,13 +94,13 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) int total_score = 0; for (/* empty */ - ; !node_a->is_tail_sentinal() + ; !node_a->is_tail_sentinel() ; node_a = node_a->next, node_b = node_b->next) { /* If all of the parameters from the other parameter list have been * exhausted, the lists have different length and, by definition, * do not match. */ - if (node_b->is_tail_sentinal()) + if (node_b->is_tail_sentinel()) return -1; @@ -151,7 +151,7 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) * exhausted, the lists have different length and, by definition, do not * match. */ - if (!node_b->is_tail_sentinal()) + if (!node_b->is_tail_sentinel()) return -1; return total_score; @@ -192,7 +192,7 @@ parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b) const exec_node *node_b = list_b->head; for (/* empty */ - ; !node_a->is_tail_sentinal() && !node_b->is_tail_sentinal() + ; !node_a->is_tail_sentinel() && !node_b->is_tail_sentinel() ; node_a = node_a->next, node_b = node_b->next) { ir_variable *a = (ir_variable *) node_a; ir_variable *b = (ir_variable *) node_b; @@ -207,7 +207,7 @@ parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b) /* Unless both lists are exhausted, they differ in length and, by * definition, do not match. */ - return (node_a->is_tail_sentinal() == node_b->is_tail_sentinal()); + return (node_a->is_tail_sentinel() == node_b->is_tail_sentinel()); } ir_function_signature * diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 9daffeb017..77c264f288 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -96,7 +96,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) /* un-valued return has to be the last return, or we shouldn't * have reached here. (see can_inline()). */ - assert(!ret->next->is_tail_sentinal()); + assert(!ret->next->is_tail_sentinel()); ret->remove(); } } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index fa4fb493f2..e9daad28ec 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -542,7 +542,7 @@ remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, * Move non-declarations from one instruction stream to another * * The intended usage pattern of this function is to pass the pointer to the - * head sentinal of a list (i.e., a pointer to the list cast to an \c exec_node + * head sentinel of a list (i.e., a pointer to the list cast to an \c exec_node * pointer) for \c last and \c false for \c make_copies on the first * call. Successive calls pass the return value of the previous call for * \c last and \c true for \c make_copies. diff --git a/src/glsl/list.h b/src/glsl/list.h index 7348e323c1..a70b79d571 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -25,28 +25,28 @@ * \file list.h * \brief Doubly-linked list abstract container type. * - * Each doubly-linked list has a sentinal head and tail node. These nodes - * contain no data. The head sentinal can be identified by its \c prev - * pointer being \c NULL. The tail sentinal can be identified by its + * Each doubly-linked list has a sentinel head and tail node. These nodes + * contain no data. The head sentinel can be identified by its \c prev + * pointer being \c NULL. The tail sentinel can be identified by its * \c next pointer being \c NULL. * - * A list is empty if either the head sentinal's \c next pointer points to the - * tail sentinal or the tail sentinal's \c prev poiner points to the head - * sentinal. + * A list is empty if either the head sentinel's \c next pointer points to the + * tail sentinel or the tail sentinel's \c prev poiner points to the head + * sentinel. * * Instead of tracking two separate \c node structures and a \c list structure - * that points to them, the sentinal nodes are in a single structure. Noting - * that each sentinal node always has one \c NULL pointer, the \c NULL + * that points to them, the sentinel nodes are in a single structure. Noting + * that each sentinel node always has one \c NULL pointer, the \c NULL * pointers occupy the same memory location. In the \c list structure * contains a the following: * * - A \c head pointer that represents the \c next pointer of the - * head sentinal node. + * head sentinel node. * - A \c tail pointer that represents the \c prev pointer of the head - * sentinal node and the \c next pointer of the tail sentinal node. This + * sentinel node and the \c next pointer of the tail sentinel node. This * pointer is \b always \c NULL. * - A \c tail_prev pointer that represents the \c prev pointer of the - * tail sentinal node. + * tail sentinel node. * * Therefore, if \c head->next is \c NULL or \c tail_prev->prev is \c NULL, * the list is empty. @@ -178,17 +178,17 @@ struct exec_node { } /** - * Is this the sentinal at the tail of the list? + * Is this the sentinel at the tail of the list? */ - bool is_tail_sentinal() const + bool is_tail_sentinel() const { return this->next == NULL; } /** - * Is this the sentinal at the head of the list? + * Is this the sentinel at the head of the list? */ - bool is_head_sentinal() const + bool is_head_sentinel() const { return this->prev == NULL; } @@ -320,7 +320,7 @@ struct exec_list { * * - Check to see if the \c head points to the \c tail. * - Check to see if the \c tail_pred points to the \c head. - * - Check to see if the \c head is the sentinal node by test whether its + * - Check to see if the \c head is the sentinel node by test whether its * \c next pointer is \c NULL. * * The first two methods tend to generate better code on modern systems -- cgit v1.2.3 From 9a8eb684d4cd602b6c5e6876cd1eceabc3a8896c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 14:20:39 -0700 Subject: glsl2: When dumping IR for debug, skip all the empty builtin prototypes. --- src/glsl/ir_print_visitor.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index ee489cda7f..88a0a6f0c8 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -57,8 +57,10 @@ _mesa_print_ir(exec_list *instructions, printf("(\n"); foreach_iter(exec_list_iterator, iter, *instructions) { - ((ir_instruction *)iter.get())->print(); - printf("\n"); + ir_instruction *ir = (ir_instruction *)iter.get(); + ir->print(); + if (ir->ir_type != ir_type_function) + printf("\n"); } printf("\n)"); } @@ -122,6 +124,16 @@ void ir_print_visitor::visit(ir_function_signature *ir) void ir_print_visitor::visit(ir_function *ir) { + bool found_non_builtin_proto = false; + + foreach_iter(exec_list_iterator, iter, *ir) { + ir_function_signature *const sig = (ir_function_signature *) iter.get(); + if (sig->is_defined || !sig->is_built_in) + found_non_builtin_proto = true; + } + if (!found_non_builtin_proto) + return; + printf("(function %s\n", ir->name); foreach_iter(exec_list_iterator, iter, *ir) { ir_function_signature *const sig = (ir_function_signature *) iter.get(); @@ -130,7 +142,7 @@ void ir_print_visitor::visit(ir_function *ir) printf("\n"); } - printf(")\n"); + printf(")\n\n"); } -- cgit v1.2.3 From bf496862be1ba863285aa2c1a2262b2d764c3e53 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 14:36:59 -0700 Subject: glsl2: When dumping IR for debug, indent nested blocks. No more trying to match parens in my head when looking at the body of a short function containing an if statement. --- src/glsl/ir_print_visitor.cpp | 53 ++++++++++++++++++++++++++++++++++++++++--- src/glsl/ir_print_visitor.h | 7 +++--- 2 files changed, 54 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 88a0a6f0c8..7df9d8adcd 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -65,6 +65,13 @@ _mesa_print_ir(exec_list *instructions, printf("\n)"); } + +void ir_print_visitor::indent(void) +{ + for (int i = 0; i < indentation; i++) + printf(" "); +} + static void print_type(const glsl_type *t) { @@ -102,23 +109,43 @@ void ir_print_visitor::visit(ir_variable *ir) void ir_print_visitor::visit(ir_function_signature *ir) { printf("(signature "); + indentation++; + print_type(ir->return_type); - printf("\n (parameters\n"); + printf("\n"); + indent(); + + printf("(parameters\n"); + indentation++; + foreach_iter(exec_list_iterator, iter, ir->parameters) { ir_variable *const inst = (ir_variable *) iter.get(); + indent(); inst->accept(this); printf("\n"); } - printf(" )\n("); + indentation--; + + indent(); + printf(")\n"); + + indent(); + + printf("(\n"); + indentation++; foreach_iter(exec_list_iterator, iter, ir->body) { ir_instruction *const inst = (ir_instruction *) iter.get(); + indent(); inst->accept(this); printf("\n"); } + indentation--; + indent(); printf("))\n"); + indentation--; } @@ -135,13 +162,16 @@ void ir_print_visitor::visit(ir_function *ir) return; printf("(function %s\n", ir->name); + indentation++; foreach_iter(exec_list_iterator, iter, *ir) { ir_function_signature *const sig = (ir_function_signature *) iter.get(); + indent(); sig->accept(this); printf("\n"); } - + indentation--; + indent(); printf(")\n\n"); } @@ -352,21 +382,33 @@ ir_print_visitor::visit(ir_if *ir) ir->condition->accept(this); printf("(\n"); + indentation++; + foreach_iter(exec_list_iterator, iter, ir->then_instructions) { ir_instruction *const inst = (ir_instruction *) iter.get(); + indent(); inst->accept(this); printf("\n"); } + + indentation--; + indent(); printf(")\n"); + indent(); printf("(\n"); + indentation++; + foreach_iter(exec_list_iterator, iter, ir->else_instructions) { ir_instruction *const inst = (ir_instruction *) iter.get(); + indent(); inst->accept(this); printf("\n"); } + indentation--; + indent(); printf("))\n"); } @@ -387,12 +429,17 @@ ir_print_visitor::visit(ir_loop *ir) if (ir->increment != NULL) ir->increment->accept(this); printf(") (\n"); + indentation++; + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { ir_instruction *const inst = (ir_instruction *) iter.get(); + indent(); inst->accept(this); printf("\n"); } + indentation--; + indent(); printf("))\n"); } diff --git a/src/glsl/ir_print_visitor.h b/src/glsl/ir_print_visitor.h index 3db42e24ca..4feeb8c184 100644 --- a/src/glsl/ir_print_visitor.h +++ b/src/glsl/ir_print_visitor.h @@ -38,9 +38,8 @@ extern void _mesa_print_ir(exec_list *instructions, class ir_print_visitor : public ir_visitor { public: ir_print_visitor() - : deref_depth(0) { - /* empty */ + indentation = 0; } virtual ~ir_print_visitor() @@ -48,6 +47,8 @@ public: /* empty */ } + void indent(void); + /** * \name Visit methods * @@ -76,7 +77,7 @@ public: /*@}*/ private: - int deref_depth; + int indentation; }; #endif /* IR_PRINT_VISITOR_H */ -- cgit v1.2.3 From ee4b4bab682ca64740b78d99d421e3d676eec447 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 14:54:01 -0700 Subject: ir_constant_variable: Don't mark variable from outside our scope as constant. Fixes (with software, except for alpha): glsl1-function with early return(3) --- src/glsl/ir_constant_variable.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp index c5ccd52e5d..749e2cf809 100644 --- a/src/glsl/ir_constant_variable.cpp +++ b/src/glsl/ir_constant_variable.cpp @@ -42,10 +42,13 @@ struct assignment_entry { int assignment_count; ir_variable *var; ir_constant *constval; + bool our_scope; }; class ir_constant_variable_visitor : public ir_hierarchical_visitor { public: + virtual ir_visitor_status visit_enter(ir_dereference_variable *); + virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit_enter(ir_assignment *); virtual ir_visitor_status visit_enter(ir_call *); @@ -68,6 +71,22 @@ get_assignment_entry(ir_variable *var, exec_list *list) return entry; } +ir_visitor_status +ir_constant_variable_visitor::visit(ir_variable *ir) +{ + struct assignment_entry *entry = get_assignment_entry(ir, &this->list); + entry->our_scope = true; + return visit_continue; +} + +/* Skip derefs of variables so that we can detect declarations. */ +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_dereference_variable *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + ir_visitor_status ir_constant_variable_visitor::visit_enter(ir_assignment *ir) { @@ -146,7 +165,7 @@ do_constant_variable(exec_list *instructions) struct assignment_entry *entry; entry = exec_node_data(struct assignment_entry, v.list.head, link); - if (entry->assignment_count == 1 && entry->constval) { + if (entry->assignment_count == 1 && entry->constval && entry->our_scope) { entry->var->constant_value = entry->constval; progress = true; } -- cgit v1.2.3 From 0e1992255837c88ba3c6631d5282fe944703ba56 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 15:04:45 -0700 Subject: glsl2: Allow use of _mesa_print_ir without a parse state on hand. --- src/glsl/ir_print_visitor.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 7df9d8adcd..73476e7e9b 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -40,19 +40,21 @@ void _mesa_print_ir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { - for (unsigned i = 0; i < state->num_user_structures; i++) { - const glsl_type *const s = state->user_structures[i]; + if (state) { + for (unsigned i = 0; i < state->num_user_structures; i++) { + const glsl_type *const s = state->user_structures[i]; - printf("(structure (%s) (%s@%p) (%u) (\n", - s->name, s->name, s, s->length); + printf("(structure (%s) (%s@%p) (%u) (\n", + s->name, s->name, s, s->length); - for (unsigned j = 0; j < s->length; j++) { - printf("\t(("); - print_type(s->fields.structure[j].type); - printf(")(%s))\n", s->fields.structure[j].name); - } + for (unsigned j = 0; j < s->length; j++) { + printf("\t(("); + print_type(s->fields.structure[j].type); + printf(")(%s))\n", s->fields.structure[j].name); + } - printf(")\n"); + printf(")\n"); + } } printf("(\n"); -- cgit v1.2.3 From 92a3768cef122c699b0121ab168def6eaa0faa7a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 12:15:04 -0700 Subject: glsl2: Refactor a bit of ir_if_return for the next changes. --- src/glsl/ir_if_return.cpp | 56 ++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index bfb52e7e68..8b8ff85d82 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -54,11 +54,39 @@ do_if_return(exec_list *instructions) { ir_if_return_visitor v; - visit_list_elements(&v, instructions); + do { + v.progress = false; + visit_list_elements(&v, instructions); + } while (v.progress); return v.progress; } +/** + * Removes any instructions after a (unconditional) return, since they will + * never be executed. + */ +static void +truncate_after_instruction(ir_instruction *ir) +{ + while (!ir->get_next()->is_tail_sentinel()) + ((ir_instruction *)ir->get_next())->remove(); +} + +/** + * Returns an ir_instruction of the first ir_return in the exec_list, or NULL. + */ +static ir_return * +find_return_in_block(exec_list *instructions) +{ + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + if (ir->ir_type == ir_type_return) + return (ir_return *)ir; + } + + return NULL; +} ir_visitor_status ir_if_return_visitor::visit_enter(ir_if *ir) @@ -66,32 +94,16 @@ ir_if_return_visitor::visit_enter(ir_if *ir) ir_return *then_return = NULL; ir_return *else_return = NULL; - /* Try to find a return statement on both sides. */ - foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { - ir_instruction *then_ir = (ir_instruction *)then_iter.get(); - then_return = then_ir->as_return(); - if (then_return) - break; - } - if (!then_return) - return visit_continue; - - foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { - ir_instruction *else_ir = (ir_instruction *)else_iter.get(); - else_return = else_ir->as_return(); - if (else_return) - break; - } - if (!else_return) + then_return = find_return_in_block(&ir->then_instructions); + else_return = find_return_in_block(&ir->else_instructions); + if (!then_return || !else_return) return visit_continue; /* Trim off any trailing instructions after the return statements * on both sides. */ - while (then_return->get_next()->get_next()) - ((ir_instruction *)then_return->get_next())->remove(); - while (else_return->get_next()->get_next()) - ((ir_instruction *)else_return->get_next())->remove(); + truncate_after_instruction(then_return); + truncate_after_instruction(else_return); this->progress = true; -- cgit v1.2.3 From 18964618a14996fff7ab5a5db75c85cd64865ef4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 12:36:06 -0700 Subject: glsl2: Make ir_if_return handle if () { return } else { not return } This makes many remaining functions inlinable. Fixes for i965: glsl1-function with early return (1) glsl1-function with early return (2) --- src/glsl/ir_if_return.cpp | 103 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 77 insertions(+), 26 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index 8b8ff85d82..4d59e70786 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -24,15 +24,11 @@ /** * \file ir_if_return.cpp * - * If a function includes an if statement that returns from both - * branches, then make the branches write the return val to a temp and - * return the temp after the if statement. + * This pass tries to normalize functions to always return from one place. * - * This allows inlinining in the common case of short functions that - * return one of two values based on a condition. This helps on - * hardware with no branching support, and may even be a useful - * transform on hardware supporting control flow by masked returns - * with normal returns. + * This helps on hardware with no branching support, and may even be a + * useful transform on hardware supporting control flow by turning + * masked returns into normal returns. */ #include "ir.h" @@ -46,6 +42,11 @@ public: ir_visitor_status visit_enter(ir_if *); + void move_outer_block_inside(ir_instruction *ir, + exec_list *inner_block); + void move_returns_after_block(ir_instruction *ir, + ir_return *then_return, + ir_return *else_return); bool progress; }; @@ -69,6 +70,9 @@ do_if_return(exec_list *instructions) static void truncate_after_instruction(ir_instruction *ir) { + if (!ir) + return; + while (!ir->get_next()->is_tail_sentinel()) ((ir_instruction *)ir->get_next())->remove(); } @@ -88,24 +92,11 @@ find_return_in_block(exec_list *instructions) return NULL; } -ir_visitor_status -ir_if_return_visitor::visit_enter(ir_if *ir) +void +ir_if_return_visitor::move_returns_after_block(ir_instruction *ir, + ir_return *then_return, + ir_return *else_return) { - ir_return *then_return = NULL; - ir_return *else_return = NULL; - - then_return = find_return_in_block(&ir->then_instructions); - else_return = find_return_in_block(&ir->else_instructions); - if (!then_return || !else_return) - return visit_continue; - - /* Trim off any trailing instructions after the return statements - * on both sides. - */ - truncate_after_instruction(then_return); - truncate_after_instruction(else_return); - - this->progress = true; if (!then_return->value) { then_return->remove(); @@ -129,6 +120,66 @@ ir_if_return_visitor::visit_enter(ir_if *ir) ir_dereference_variable *deref = new(ir) ir_dereference_variable(new_var); ir->insert_after(new(ir) ir_return(deref)); } + this->progress = true; +} + +void +ir_if_return_visitor::move_outer_block_inside(ir_instruction *ir, + exec_list *inner_block) +{ + if (!ir->get_next()->is_tail_sentinel()) + this->progress = true; + + while (!ir->get_next()->is_tail_sentinel()) { + ir_instruction *move_ir = (ir_instruction *)ir->get_next(); + + move_ir->remove(); + inner_block->push_tail(move_ir); + } +} + +ir_visitor_status +ir_if_return_visitor::visit_enter(ir_if *ir) +{ + ir_return *then_return; + ir_return *else_return; + + then_return = find_return_in_block(&ir->then_instructions); + else_return = find_return_in_block(&ir->else_instructions); + if (!then_return && !else_return) + return visit_continue; + + /* Trim off any trailing instructions after the return statements + * on both sides. + */ + truncate_after_instruction(then_return); + truncate_after_instruction(else_return); + + /* If both sides return, then we can move the returns to a single + * one outside the if statement. + */ + if (then_return && else_return) { + move_returns_after_block(ir, then_return, else_return); + return visit_continue; + } - return visit_continue; + /* If only one side returns, then the block of code after the "if" + * is only executed by the other side, so those instructions don't + * need to be anywhere but that other side. + * + * This will usually pull a return statement up into the other + * side, so we'll trigger the above case on the next pass. + */ + if (then_return) { + move_outer_block_inside(ir, &ir->else_instructions); + } else { + assert(else_return); + move_outer_block_inside(ir, &ir->then_instructions); + } + + /* If we move the instructions following ir inside the block, it + * will confuse the exec_list iteration in the parent that visited + * us. So stop the visit at this point. + */ + return visit_stop; } -- cgit v1.2.3 From a62ef12ef242ecd48887df2aa2052d2ecb0979f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 13:29:17 -0700 Subject: glsl2: Make sure functions end with a return before doing ir_if_return. This catches a few remaining functions that weren't getting inlined, generally operating on global or out variables and using an early return to skip work when possible. Fixes for i965: glsl1-function with early return (3) --- src/glsl/ir_if_return.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index 4d59e70786..293f7aa628 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -24,13 +24,16 @@ /** * \file ir_if_return.cpp * - * This pass tries to normalize functions to always return from one place. + * This pass tries to normalize functions to always return from one + * place by moving around blocks of code in if statements. * * This helps on hardware with no branching support, and may even be a * useful transform on hardware supporting control flow by turning * masked returns into normal returns. */ +#include +#include "glsl_types.h" #include "ir.h" class ir_if_return_visitor : public ir_hierarchical_visitor { @@ -40,6 +43,7 @@ public: this->progress = false; } + ir_visitor_status visit_enter(ir_function_signature *); ir_visitor_status visit_enter(ir_if *); void move_outer_block_inside(ir_instruction *ir, @@ -138,6 +142,62 @@ ir_if_return_visitor::move_outer_block_inside(ir_instruction *ir, } } +/* Normalize a function to always have a return statement at the end. + * + * This avoids the ir_if handler needing to know whether it is at the + * top level of the function to know if there's an implicit return at + * the end of the outer block. + */ +ir_visitor_status +ir_if_return_visitor::visit_enter(ir_function_signature *ir) +{ + ir_return *ret; + + if (!ir->is_defined) + return visit_continue_with_parent; + if (strcmp(ir->function_name(), "main") == 0) + return visit_continue_with_parent; + + ret = find_return_in_block(&ir->body); + + if (ret) { + truncate_after_instruction(ret); + } else { + if (ir->return_type->is_void()) { + ir->body.push_tail(new(ir) ir_return(NULL)); + } else { + /* Probably, if we've got a function with a return value + * hitting this point, it's something like: + * + * float reduce_below_half(float val) + * { + * while () { + * if (val >= 0.5) + * val /= 2.0; + * else + * return val; + * } + * } + * + * So we gain a junk return statement of an undefined value + * at the end that never gets executed. However, a backend + * using this pass is probably desperate to get rid of + * function calls, so go ahead and do it for their sake in + * case it fixes apps. + */ + ir_variable *undef = new(ir) ir_variable(ir->return_type, + "if_return_undef", + ir_var_temporary); + ir->body.push_tail(undef); + + ir_dereference_variable *deref = new(ir) ir_dereference_variable(undef); + ir->body.push_tail(new(ir) ir_return(deref)); + } + } + + return visit_continue; +} + ir_visitor_status ir_if_return_visitor::visit_enter(ir_if *ir) { -- cgit v1.2.3 From 0cf545ec696ab450c3f5ee65d7a0c2a5d9dca409 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Jul 2010 15:49:14 -0700 Subject: glsl2: Do ir_if_return on the way out, not the way in. The problem with doing it on the way in is that for a function with multiple early returns, we'll move an outer block in, then restart the pass, then move the two inside returns out, then never move outer blocks in again because the remaining early returns are inside an else block and they don't know that there's a return just after their block. By going inside-out, we get the early returns stacked up so that they all move out with a series of move_returns_after_block(). Fixes (on i965): glsl-fs-raytrace-bug27060 glsl-vs-raytrace-bug26691 --- src/glsl/ir_if_return.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp index 293f7aa628..5ab8759958 100644 --- a/src/glsl/ir_if_return.cpp +++ b/src/glsl/ir_if_return.cpp @@ -44,10 +44,10 @@ public: } ir_visitor_status visit_enter(ir_function_signature *); - ir_visitor_status visit_enter(ir_if *); + ir_visitor_status visit_leave(ir_if *); - void move_outer_block_inside(ir_instruction *ir, - exec_list *inner_block); + ir_visitor_status move_outer_block_inside(ir_instruction *ir, + exec_list *inner_block); void move_returns_after_block(ir_instruction *ir, ir_return *then_return, ir_return *else_return); @@ -127,18 +127,25 @@ ir_if_return_visitor::move_returns_after_block(ir_instruction *ir, this->progress = true; } -void +ir_visitor_status ir_if_return_visitor::move_outer_block_inside(ir_instruction *ir, exec_list *inner_block) { - if (!ir->get_next()->is_tail_sentinel()) - this->progress = true; + if (!ir->get_next()->is_tail_sentinel()) { + while (!ir->get_next()->is_tail_sentinel()) { + ir_instruction *move_ir = (ir_instruction *)ir->get_next(); - while (!ir->get_next()->is_tail_sentinel()) { - ir_instruction *move_ir = (ir_instruction *)ir->get_next(); + move_ir->remove(); + inner_block->push_tail(move_ir); + } - move_ir->remove(); - inner_block->push_tail(move_ir); + /* If we move the instructions following ir inside the block, it + * will confuse the exec_list iteration in the parent that visited + * us. So stop the visit at this point. + */ + return visit_stop; + } else { + return visit_continue; } } @@ -199,7 +206,7 @@ ir_if_return_visitor::visit_enter(ir_function_signature *ir) } ir_visitor_status -ir_if_return_visitor::visit_enter(ir_if *ir) +ir_if_return_visitor::visit_leave(ir_if *ir) { ir_return *then_return; ir_return *else_return; @@ -231,15 +238,9 @@ ir_if_return_visitor::visit_enter(ir_if *ir) * side, so we'll trigger the above case on the next pass. */ if (then_return) { - move_outer_block_inside(ir, &ir->else_instructions); + return move_outer_block_inside(ir, &ir->else_instructions); } else { assert(else_return); - move_outer_block_inside(ir, &ir->then_instructions); + return move_outer_block_inside(ir, &ir->then_instructions); } - - /* If we move the instructions following ir inside the block, it - * will confuse the exec_list iteration in the parent that visited - * us. So stop the visit at this point. - */ - return visit_stop; } -- cgit v1.2.3 From 805cbf39224580fdb85b09a21be7cbc658f0ecf6 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 30 Jul 2010 13:24:50 -0700 Subject: glcpp: Don't look for backslashes before the beginning of the string. Fixes a valgrind error. --- src/glsl/glcpp/pp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 1ce829a2c9..7aa1a968de 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -93,12 +93,16 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) const char *newline; while ((newline = strchr(search_start, '\n')) != NULL) { const char *backslash = NULL; + + /* # of characters preceding the newline. */ + int n = newline - shader; + /* Find the preceding '\', if it exists */ - if (newline[-1] == '\\') { + if (n >= 1 && newline[-1] == '\\') backslash = newline - 1; - } else if (newline[-1] == '\r' && newline[-2] == '\\') { + else if (n >= 2 && newline[-1] == '\r' && newline[-2] == '\\') backslash = newline - 2; - } + /* Double backslashes don't count (the backslash is escaped) */ if (backslash != NULL && backslash[-1] == '\\') { backslash = NULL; -- cgit v1.2.3 From 939a1807fe5a70db25725335ba0acccce8b01db3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 30 Jul 2010 13:30:11 -0700 Subject: glsl2: Initialize ir_function_signature::is_built_in. Fixes a valgrind error. --- src/glsl/ir.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 7178c68e6b..2b5f441ddd 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -837,6 +837,7 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type) : return_type(return_type), is_defined(false), _function(NULL) { this->ir_type = ir_type_function_signature; + this->is_built_in = false; } -- cgit v1.2.3 From 5e5583ee06cff53db48151c13b21916a166ea2ed Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Jul 2010 11:24:23 -0700 Subject: glsl2: Update the callee pointer of calls to newly-linked-in functions. Otherwise, ir_function_inlining will see the body of the function from the unlinked version of the shader, which won't have had the lowering passes done on it or linking's variable remapping. --- src/glsl/link_functions.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index a9ed49a349..327be73afe 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -164,6 +164,8 @@ public: */ linked_sig->accept(this); + ir->set_callee(linked_sig); + return visit_continue; } -- cgit v1.2.3 From ec9675ec533cc0c0c7b1c738280e9b9adf2591fb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 29 Jul 2010 16:39:36 -0700 Subject: ast: Initialize location data in constructor of all ast_node objects. This prevents using uninitialized data in _msea_glsl_error in some cases, (including at least 6 piglit tests). Thanks to valgrind for pointing out the problem! --- src/glsl/glsl_parser_extras.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 20a5021b14..15fa61d950 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -280,7 +280,9 @@ ast_node::print(void) const ast_node::ast_node(void) { - /* empty */ + this->location.source = 0; + this->location.line = 0; + this->location.column = 0; } -- cgit v1.2.3 From 3fa1b85196b7d57c6c139e62000ac519b1b2320c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Jul 2010 10:20:34 -0700 Subject: glsl2: Fix the implementation of atan(y, x). So many problems here. One is that we can't do the quadrant handling for all the channels at the same time, so we call the float(y, x) version multiple times. I'd also left out the x == 0 handling. Also, the quadrant handling was broken for y == 0, so there was a funny discontinuity on the +x side if you plugged in obvious values to test. I generated the atan(float y, float x) code from a short segment of GLSL and pasted it in by hand. It would be nice to automate that somehow. Fixes: glsl-fs-atan-1 glsl-fs-atan-2 --- src/glsl/builtin_function.cpp | 166 +++++++++++++++++++++--------------------- src/glsl/builtins/110/atan | 166 +++++++++++++++++++++--------------------- 2 files changed, 166 insertions(+), 166 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 3343cf5638..eade72ad3a 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -299,56 +299,66 @@ static const char *builtins_110_atan = { " (var_ref y_over_x))\n" " (constant float (1.0))))))))))\n" "\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float y)\n" - " (declare (in) float x))\n" - " ((declare () float r)\n" - " (if (expression bool >\n" - " (expression float abs (var_ref x))\n" - " (constant float (.0001)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r) (call atan ((expression float /\n" - " (var_ref y)\n" - " (var_ref x)))))\n" - " (if (expression bool <\n" - " (var_ref x)\n" - " (constant float (0.0)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r)\n" - " (expression float +\n" - " (var_ref r)\n" - " (expression float *\n" - " (expression float sign (var_ref y))\n" - " (constant float (3.1415926))))))\n" - " ()))\n" - " ())\n" - " (return (var_ref r))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y)\n" + " (declare (in ) float x)\n" + " )\n" + " (\n" + " (declare () float r)\n" + " (declare ( ) float abs_retval)\n" + " (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))\n" + ") \n" + " (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (\n" + " (declare ( ) float atan_retval)\n" + " (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n" + ") \n" + " (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) \n" + " (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n" + " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) \n" + " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" + " )\n" + " (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) \n" + " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" + " ))\n" + "\n" + " )\n" + " (\n" + " ))\n" + "\n" + " )\n" + " (\n" + " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" + " (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) \n" + " )\n" + " (\n" + " (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) \n" + " ))\n" + "\n" + " ))\n" + "\n" + " (return (var_ref r) )\n" + " ))\n" + "\n" + "\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 y)\n" " (declare (in) vec2 x))\n" " ((declare () vec2 r)\n" - " (if (expression bool >\n" - " (expression vec2 abs (var_ref x))\n" - " (constant float (.0001)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r) (call atan ((expression vec2 /\n" - " (var_ref y)\n" - " (var_ref x)))))\n" - " (if (expression bool <\n" - " (var_ref x)\n" - " (constant float (0.0)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r)\n" - " (expression vec2 +\n" - " (var_ref r)\n" - " (expression vec2 *\n" - " (expression float sign (var_ref y))\n" - " (constant float (3.1415926))))))\n" - " ()))\n" - " ())\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" " (return (var_ref r))))\n" "\n" " (signature vec3\n" @@ -356,25 +366,18 @@ static const char *builtins_110_atan = { " (declare (in) vec3 y)\n" " (declare (in) vec3 x))\n" " ((declare () vec3 r)\n" - " (if (expression bool >\n" - " (expression vec3 abs (var_ref x))\n" - " (constant float (.0001)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r) (call atan ((expression vec3 /\n" - " (var_ref y)\n" - " (var_ref x)))))\n" - " (if (expression bool <\n" - " (var_ref x)\n" - " (constant float (0.0)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r)\n" - " (expression vec3 +\n" - " (var_ref r)\n" - " (expression vec3 *\n" - " (expression float sign (var_ref y))\n" - " (constant float (3.1415926))))))\n" - " ()))\n" - " ())\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz z (var_ref r))\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" " (return (var_ref r))))\n" "\n" " (signature vec4\n" @@ -382,26 +385,23 @@ static const char *builtins_110_atan = { " (declare (in) vec4 y)\n" " (declare (in) vec4 x))\n" " ((declare () vec4 r)\n" - " (if (expression bool >\n" - " (expression vec4 abs (var_ref x))\n" - " (constant float (.0001)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r) (call atan ((expression vec4 /\n" - " (var_ref y)\n" - " (var_ref x)))))\n" - " (if (expression bool <\n" - " (var_ref x)\n" - " (constant float (0.0)))\n" - " ((assign (constant bool (1))\n" - " (var_ref r)\n" - " (expression vec4 +\n" - " (var_ref r)\n" - " (expression vec4 *\n" - " (expression float sign (var_ref y))\n" - " (constant float (3.1415926))))))\n" - " ()))\n" - " ())\n" - " (return (var_ref r))))\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz z (var_ref r))\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz w (var_ref r))\n" + " (call atan ((swiz w (var_ref y))\n" + " (swiz w (var_ref x)))))\n" + " (return (var_ref r)))))\n" "\n" "))\n" }; diff --git a/src/glsl/builtins/110/atan b/src/glsl/builtins/110/atan index bcf75718e4..8404829387 100644 --- a/src/glsl/builtins/110/atan +++ b/src/glsl/builtins/110/atan @@ -47,56 +47,66 @@ (var_ref y_over_x)) (constant float (1.0)))))))))) - (signature float - (parameters - (declare (in) float y) - (declare (in) float x)) - ((declare () float r) - (if (expression bool > - (expression float abs (var_ref x)) - (constant float (.0001))) - ((assign (constant bool (1)) - (var_ref r) (call atan ((expression float / - (var_ref y) - (var_ref x))))) - (if (expression bool < - (var_ref x) - (constant float (0.0))) - ((assign (constant bool (1)) - (var_ref r) - (expression float + - (var_ref r) - (expression float * - (expression float sign (var_ref y)) - (constant float (3.1415926)))))) - ())) - ()) - (return (var_ref r)))) + (signature float + (parameters + (declare (in ) float y) + (declare (in ) float x) + ) + ( + (declare () float r) + (declare ( ) float abs_retval) + (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) )) +) + (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) ( + (declare ( ) float atan_retval) + (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) )) +) + (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) + (if (expression bool < (var_ref x) (constant float (0.000000)) ) ( + (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( + (declare ( ) float assignment_tmp) + (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) + (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) + ) + ( + (declare ( ) float assignment_tmp) + (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) + (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) + )) + + ) + ( + )) + + ) + ( + (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( + (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) + ) + ( + (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) + )) + + )) + + (return (var_ref r) ) + )) + + (signature vec2 (parameters (declare (in) vec2 y) (declare (in) vec2 x)) ((declare () vec2 r) - (if (expression bool > - (expression vec2 abs (var_ref x)) - (constant float (.0001))) - ((assign (constant bool (1)) - (var_ref r) (call atan ((expression vec2 / - (var_ref y) - (var_ref x))))) - (if (expression bool < - (var_ref x) - (constant float (0.0))) - ((assign (constant bool (1)) - (var_ref r) - (expression vec2 + - (var_ref r) - (expression vec2 * - (expression float sign (var_ref y)) - (constant float (3.1415926)))))) - ())) - ()) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) (return (var_ref r)))) (signature vec3 @@ -104,25 +114,18 @@ (declare (in) vec3 y) (declare (in) vec3 x)) ((declare () vec3 r) - (if (expression bool > - (expression vec3 abs (var_ref x)) - (constant float (.0001))) - ((assign (constant bool (1)) - (var_ref r) (call atan ((expression vec3 / - (var_ref y) - (var_ref x))))) - (if (expression bool < - (var_ref x) - (constant float (0.0))) - ((assign (constant bool (1)) - (var_ref r) - (expression vec3 + - (var_ref r) - (expression vec3 * - (expression float sign (var_ref y)) - (constant float (3.1415926)))))) - ())) - ()) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) + (assign (constant bool (1)) + (swiz z (var_ref r)) + (call atan ((swiz z (var_ref y)) + (swiz z (var_ref x))))) (return (var_ref r)))) (signature vec4 @@ -130,25 +133,22 @@ (declare (in) vec4 y) (declare (in) vec4 x)) ((declare () vec4 r) - (if (expression bool > - (expression vec4 abs (var_ref x)) - (constant float (.0001))) - ((assign (constant bool (1)) - (var_ref r) (call atan ((expression vec4 / - (var_ref y) - (var_ref x))))) - (if (expression bool < - (var_ref x) - (constant float (0.0))) - ((assign (constant bool (1)) - (var_ref r) - (expression vec4 + - (var_ref r) - (expression vec4 * - (expression float sign (var_ref y)) - (constant float (3.1415926)))))) - ())) - ()) - (return (var_ref r)))) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) + (assign (constant bool (1)) + (swiz z (var_ref r)) + (call atan ((swiz z (var_ref y)) + (swiz z (var_ref x))))) + (assign (constant bool (1)) + (swiz w (var_ref r)) + (call atan ((swiz w (var_ref y)) + (swiz w (var_ref x))))) + (return (var_ref r))))) )) -- cgit v1.2.3 From 1c325af4d6b907e0a47ab7f868a2a78f054f153f Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Thu, 29 Jul 2010 15:35:22 +0300 Subject: glsl2: Fix stack smash when ternary selection is used. --- src/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9591d36de8..3522f55aac 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -658,7 +658,7 @@ ast_expression::hir(exec_list *instructions, -1, /* ast_sequence doesn't convert to ir_expression. */ }; ir_rvalue *result = NULL; - ir_rvalue *op[2]; + ir_rvalue *op[3]; const struct glsl_type *type = glsl_type::error_type; bool error_emitted = false; YYLTYPE loc; -- cgit v1.2.3 From d72edc4dddb6dd7908ef0d3f2cec353b028bf6c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Jul 2010 16:05:27 -0700 Subject: glsl2: Factor out the variable refcounting part of ir_dead_code.cpp. --- src/glsl/Makefile | 1 + src/glsl/ir_dead_code.cpp | 114 +------------------------------------- src/glsl/ir_variable_refcount.cpp | 100 +++++++++++++++++++++++++++++++++ src/glsl/ir_variable_refcount.h | 87 +++++++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 112 deletions(-) create mode 100644 src/glsl/ir_variable_refcount.cpp create mode 100644 src/glsl/ir_variable_refcount.h (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index cbdd0f9a7a..aa1922f3be 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -58,6 +58,7 @@ CXX_SOURCES = \ ir_swizzle_swizzle.cpp \ ir_validate.cpp \ ir_variable.cpp \ + ir_variable_refcount.cpp \ ir_vec_index_to_cond_assign.cpp \ ir_vec_index_to_swizzle.cpp \ linker.cpp \ diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index eab459b920..2b971b7aaa 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -29,118 +29,9 @@ #include "ir.h" #include "ir_visitor.h" -#include "ir_expression_flattening.h" +#include "ir_variable_refcount.h" #include "glsl_types.h" -class variable_entry : public exec_node -{ -public: - variable_entry(ir_variable *var) - { - this->var = var; - assign = NULL; - referenced_count = 0; - assigned_count = 0; - declaration = false; - } - - ir_variable *var; /* The key: the variable's pointer. */ - ir_assignment *assign; /* An assignment to the variable, if any */ - - /** Number of times the variable is referenced, including assignments. */ - unsigned referenced_count; - - /** Number of times the variable is assignmened. */ - unsigned assigned_count; - - bool declaration; /* If the variable had a decl in the instruction stream */ -}; - -class ir_dead_code_visitor : public ir_hierarchical_visitor { -public: - virtual ir_visitor_status visit(ir_variable *); - virtual ir_visitor_status visit(ir_dereference_variable *); - - virtual ir_visitor_status visit_enter(ir_function_signature *); - virtual ir_visitor_status visit_leave(ir_assignment *); - - variable_entry *get_variable_entry(ir_variable *var); - - bool (*predicate)(ir_instruction *ir); - - /* List of variable_entry */ - exec_list variable_list; - - void *mem_ctx; -}; - - -variable_entry * -ir_dead_code_visitor::get_variable_entry(ir_variable *var) -{ - assert(var); - foreach_iter(exec_list_iterator, iter, this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); - if (entry->var == var) - return entry; - } - - variable_entry *entry = new(mem_ctx) variable_entry(var); - this->variable_list.push_tail(entry); - return entry; -} - - -ir_visitor_status -ir_dead_code_visitor::visit(ir_variable *ir) -{ - variable_entry *entry = this->get_variable_entry(ir); - if (entry) - entry->declaration = true; - - return visit_continue; -} - - -ir_visitor_status -ir_dead_code_visitor::visit(ir_dereference_variable *ir) -{ - ir_variable *const var = ir->variable_referenced(); - variable_entry *entry = this->get_variable_entry(var); - - if (entry) - entry->referenced_count++; - - return visit_continue; -} - - -ir_visitor_status -ir_dead_code_visitor::visit_enter(ir_function_signature *ir) -{ - /* We don't want to descend into the function parameters and - * dead-code eliminate them, so just accept the body here. - */ - visit_list_elements(this, &ir->body); - return visit_continue_with_parent; -} - - -ir_visitor_status -ir_dead_code_visitor::visit_leave(ir_assignment *ir) -{ - variable_entry *entry; - entry = this->get_variable_entry(ir->lhs->variable_referenced()); - if (entry) { - entry->assigned_count++; - if (entry->assign == NULL) - entry->assign = ir; - } - - return visit_continue; -} - - /** * Do a dead code pass over instructions and everything that instructions * references. @@ -151,10 +42,9 @@ ir_dead_code_visitor::visit_leave(ir_assignment *ir) bool do_dead_code(exec_list *instructions) { - ir_dead_code_visitor v; + ir_variable_refcount_visitor v; bool progress = false; - v.mem_ctx = talloc_new(NULL); v.run(instructions); foreach_iter(exec_list_iterator, iter, v.variable_list) { diff --git a/src/glsl/ir_variable_refcount.cpp b/src/glsl/ir_variable_refcount.cpp new file mode 100644 index 0000000000..20c2f6602b --- /dev/null +++ b/src/glsl/ir_variable_refcount.cpp @@ -0,0 +1,100 @@ +/* + * 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 ir_variable_refcount.cpp + * + * Provides a visitor which produces a list of variables referenced, + * how many times they were referenced and assigned, and whether they + * were defined in the scope. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_variable_refcount.h" +#include "glsl_types.h" + +variable_entry * +ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) + return entry; + } + + variable_entry *entry = new(mem_ctx) variable_entry(var); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit(ir_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir); + if (entry) + entry->declaration = true; + + return visit_continue; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->variable_referenced(); + variable_entry *entry = this->get_variable_entry(var); + + if (entry) + entry->referenced_count++; + + return visit_continue; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit_leave(ir_assignment *ir) +{ + variable_entry *entry; + entry = this->get_variable_entry(ir->lhs->variable_referenced()); + if (entry) { + entry->assigned_count++; + if (entry->assign == NULL) + entry->assign = ir; + } + + return visit_continue; +} diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h new file mode 100644 index 0000000000..d69cab563e --- /dev/null +++ b/src/glsl/ir_variable_refcount.h @@ -0,0 +1,87 @@ +/* + * 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 ir_variable_refcount.h + * + * Provides a visitor which produces a list of variables referenced, + * how many times they were referenced and assigned, and whether they + * were defined in the scope. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var) + { + this->var = var; + assign = NULL; + referenced_count = 0; + assigned_count = 0; + declaration = false; + } + + ir_variable *var; /* The key: the variable's pointer. */ + ir_assignment *assign; /* An assignment to the variable, if any */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned referenced_count; + + /** Number of times the variable is assigned. */ + unsigned assigned_count; + + bool declaration; /* If the variable had a decl in the instruction stream */ +}; + +class ir_variable_refcount_visitor : public ir_hierarchical_visitor { +public: + ir_variable_refcount_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + this->variable_list.make_empty(); + } + + ~ir_variable_refcount_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + } + + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit_leave(ir_assignment *); + + variable_entry *get_variable_entry(ir_variable *var); + + bool (*predicate)(ir_instruction *ir); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; -- cgit v1.2.3 From 784695442c415cf0be882434a25671ecfb635d34 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Jul 2010 17:04:49 -0700 Subject: glsl2: Add new tree grafting optimization pass. --- src/glsl/Makefile | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/ir_tree_grafting.cpp | 356 ++++++++++++++++++++++++++++++++++++++++ src/glsl/linker.cpp | 1 + src/glsl/main.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 1 + 6 files changed, 361 insertions(+) create mode 100644 src/glsl/ir_tree_grafting.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index aa1922f3be..0254fec756 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -56,6 +56,7 @@ CXX_SOURCES = \ ir_print_visitor.cpp \ ir_reader.cpp \ ir_swizzle_swizzle.cpp \ + ir_tree_grafting.cpp \ ir_validate.cpp \ ir_variable.cpp \ ir_variable_refcount.cpp \ diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 5dbb025d35..55ec327193 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -44,5 +44,6 @@ bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); +bool do_tree_grafting(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions); diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp new file mode 100644 index 0000000000..6f62de758b --- /dev/null +++ b/src/glsl/ir_tree_grafting.cpp @@ -0,0 +1,356 @@ +/* + * 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 ir_tree_grafting.cpp + * + * Takes assignments to variables that are dereferenced only once and + * pastes the RHS expression into where the variable is dereferenced. + * + * In the process of various operations like function inlining and + * tertiary op handling, we'll end up with our expression trees having + * been chopped up into a series of assignments of short expressions + * to temps. Other passes like ir_algebraic.cpp would prefer to see + * the deepest expression trees they can to try to optimize them. + * + * This is a lot like copy propagaton. In comparison, copy + * propagation only acts on plain copies, not arbitrary expressions on + * the RHS. Generally, we wouldn't want to go pasting some + * complicated expression everywhere it got used, though, so we don't + * handle expressions in that pass. + * + * The hard part is making sure we don't move an expression across + * some other assignments that would change the value of the + * expression. So we split this into two passes: First, find the + * variables in our scope which are written to once and read once, and + * then go through basic blocks seeing if we find an opportunity to + * move those expressions safely. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_variable_refcount.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +static bool debug = false; + +class ir_tree_grafting_visitor : public ir_hierarchical_visitor { +public: + ir_tree_grafting_visitor(ir_assignment *graft_assign, + ir_variable *graft_var) + { + this->progress = false; + this->graft_assign = graft_assign; + this->graft_var = graft_var; + } + + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_swizzle *); + virtual ir_visitor_status visit_enter(class ir_texture *); + + bool do_graft(ir_rvalue **rvalue); + + bool progress; + ir_variable *graft_var; + ir_assignment *graft_assign; +}; + +struct find_deref_info { + ir_variable *var; + bool found; +}; + +void +dereferences_variable_callback(ir_instruction *ir, void *data) +{ + struct find_deref_info *info = (struct find_deref_info *)data; + + if (ir == info->var) + info->found = true; +} + +static bool +dereferences_variable(ir_instruction *ir, ir_variable *var) +{ + struct find_deref_info info; + + info.var = var; + info.found = false; + + visit_tree(ir, dereferences_variable_callback, &info); + + return info.found; +} + +bool +ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue) +{ + if (!*rvalue) + return false; + + ir_dereference_variable *deref = (*rvalue)->as_dereference_variable(); + + if (!deref || deref->var != this->graft_var) + return false; + + if (debug) { + printf("GRAFTING:\n"); + this->graft_assign->rhs->print(); + printf("\n"); + printf("TO:\n"); + (*rvalue)->print(); + printf("\n"); + } + + this->graft_assign->remove(); + *rvalue = this->graft_assign->rhs; + + this->progress = true; + return true; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_loop *ir) +{ + (void)ir; + /* Do not traverse into the body of the loop since that is a + * different basic block. + */ + return visit_stop; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_leave(ir_assignment *ir) +{ + if (do_graft(&ir->rhs) || + do_graft(&ir->condition)) + return visit_stop; + + /* If this assignment updates a variable used in the assignment + * we're trying to graft, then we're done. + */ + if (dereferences_variable(this->graft_assign->rhs, + ir->lhs->variable_referenced())) { + if (debug) { + printf("graft killed by: "); + ir->print(); + printf("\n"); + } + return visit_stop; + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_function_signature *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_call *ir) +{ + /* Reminder: iterating ir_call iterates its parameters. */ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *ir = (ir_rvalue *)iter.get(); + ir_rvalue *new_ir = ir; + + if (do_graft(&new_ir)) { + ir->replace_with(new_ir); + return visit_stop; + } + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_expression *ir) +{ + for (unsigned int i = 0; i < ir->get_num_operands(); i++) { + if (do_graft(&ir->operands[i])) + return visit_stop; + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_if *ir) +{ + if (do_graft(&ir->condition)) + return visit_stop; + + /* Do not traverse into the body of the if-statement since that is a + * different basic block. + */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_swizzle *ir) +{ + if (do_graft(&ir->val)) + return visit_stop; + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_texture *ir) +{ + if (do_graft(&ir->coordinate) || + do_graft(&ir->projector) || + do_graft(&ir->shadow_comparitor)) + return visit_stop; + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + if (do_graft(&ir->lod_info.bias)) + return visit_stop; + break; + case ir_txf: + case ir_txl: + if (do_graft(&ir->lod_info.lod)) + return visit_stop; + break; + case ir_txd: + if (do_graft(&ir->lod_info.grad.dPdx) || + do_graft(&ir->lod_info.grad.dPdy)) + return visit_stop; + break; + } + + return visit_continue; +} + +struct tree_grafting_info { + ir_variable_refcount_visitor *refs; + bool progress; +}; + +static bool +try_tree_grafting(ir_assignment *start, + ir_variable *lhs_var, + ir_instruction *bb_last) +{ + ir_tree_grafting_visitor v(start, lhs_var); + + if (debug) { + printf("trying to graft: "); + lhs_var->print(); + printf("\n"); + } + + for (ir_instruction *ir = (ir_instruction *)start->next; + ir != bb_last->next; + ir = (ir_instruction *)ir->next) { + + if (debug) { + printf("- "); + ir->print(); + printf("\n"); + } + + ir_visitor_status s = ir->accept(&v); + if (s == visit_stop) + return v.progress; + } + + return false; +} + +static void +tree_grafting_basic_block(ir_instruction *bb_first, + ir_instruction *bb_last, + void *data) +{ + struct tree_grafting_info *info = (struct tree_grafting_info *)data; + ir_instruction *ir, *next; + + for (ir = bb_first, next = (ir_instruction *)ir->next; + ir != bb_last->next; + ir = next, next = (ir_instruction *)ir->next) { + ir_assignment *assign = ir->as_assignment(); + + if (!assign) + continue; + + ir_variable *lhs_var = assign->lhs->whole_variable_referenced(); + if (!lhs_var) + continue; + + struct variable_entry *entry = info->refs->get_variable_entry(lhs_var); + + if (!entry->declaration || + entry->assigned_count != 1 || + entry->referenced_count != 2) + continue; + + assert(assign == entry->assign); + + /* Found a possibly graftable assignment. Now, walk through the + * rest of the BB seeing if the deref is here, and if nothing interfered with + * pasting its expression's values in between. + */ + info->progress |= try_tree_grafting(assign, lhs_var, bb_last); + } +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_tree_grafting(exec_list *instructions) +{ + ir_variable_refcount_visitor refs; + struct tree_grafting_info info; + + info.progress = false; + info.refs = &refs; + + visit_list_elements(info.refs, instructions); + + call_for_basic_blocks(instructions, tree_grafting_basic_block, &info); + + return info.progress; +} diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e9daad28ec..9b47e4788f 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1286,6 +1286,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_copy_propagation(ir) || progress; progress = do_dead_code_local(ir) || progress; progress = do_dead_code(ir) || progress; + progress = do_tree_grafting(ir) || progress; progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_if_return(ir) || progress; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 08b133f124..d557dcc493 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -163,6 +163,7 @@ compile_shader(struct gl_shader *shader) progress = do_copy_propagation(shader->ir) || progress; progress = do_dead_code_local(shader->ir) || progress; progress = do_dead_code_unlinked(shader->ir) || progress; + progress = do_tree_grafting(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index e62395a3b9..9274723eb7 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2485,6 +2485,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_copy_propagation(shader->ir) || progress; progress = do_dead_code_local(shader->ir) || progress; progress = do_dead_code_unlinked(shader->ir) || progress; + progress = do_tree_grafting(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; -- cgit v1.2.3 From f6b03f323500c71fc20c0d64c618d9aa73ced5b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 31 Jul 2010 15:47:35 -0700 Subject: glsl2: Do algebraic optimizations after linking as well. Linking brings in inlining of builtins, so we weren't catching the (rcp(/sqrt(x)) -> rsq(x)) without it. --- src/glsl/linker.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 9b47e4788f..9d53197fdd 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1289,6 +1289,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_tree_grafting(ir) || progress; progress = do_constant_variable_unlinked(ir) || progress; progress = do_constant_folding(ir) || progress; + progress = do_algebraic(ir) || progress; progress = do_if_return(ir) || progress; #if 0 if (ctx->Shader.EmitNoIfs) -- cgit v1.2.3 From 93b10bd353e98670b627873e1da130c789646a4e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 1 Aug 2010 11:40:07 -0700 Subject: glcpp: Add a testcase for the failure in compiling xonotic's shader. gcc and mesa master agree that this is OK. --- src/glsl/glcpp/tests/073-if-in-ifdef.c | 4 ++++ src/glsl/glcpp/tests/073-if-in-ifdef.c.expected | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 src/glsl/glcpp/tests/073-if-in-ifdef.c create mode 100644 src/glsl/glcpp/tests/073-if-in-ifdef.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c b/src/glsl/glcpp/tests/073-if-in-ifdef.c new file mode 100644 index 0000000000..b9155b521e --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c @@ -0,0 +1,4 @@ +#if UNDEF +#if UNDEF > 1 +#endif +#endif diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected new file mode 100644 index 0000000000..3f2ff2d6cc --- /dev/null +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c.expected @@ -0,0 +1,5 @@ + + + + + -- cgit v1.2.3 From 6a41626e90f75318e17d9907f4f57a8c3c315fea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 1 Aug 2010 18:44:21 -0700 Subject: glsl2: Make non-square matrix keywords not keywords pre-120. Fixes glsl-mat-110. --- src/glsl/glsl_lexer.cpp | 411 +++++++++++++++++++++--------------------------- src/glsl/glsl_lexer.lpp | 109 ++++--------- 2 files changed, 207 insertions(+), 313 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index e5ca1bd0a5..af29dce337 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -845,8 +845,18 @@ static yyconst flex_int16_t yy_chk[875] = #define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define TOKEN_OR_IDENTIFIER(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + yylval->identifier = strdup(yytext); \ + return IDENTIFIER; \ + } \ + } while (0) -#line 850 "glsl_lexer.cpp" + +#line 860 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1092,10 +1102,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 56 "glsl_lexer.lpp" +#line 66 "glsl_lexer.lpp" -#line 1099 "glsl_lexer.cpp" +#line 1109 "glsl_lexer.cpp" yylval = yylval_param; @@ -1181,7 +1191,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 58 "glsl_lexer.lpp" +#line 68 "glsl_lexer.lpp" ; YY_BREAK /* Preprocessor tokens. */ @@ -1190,17 +1200,17 @@ case 2: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 61 "glsl_lexer.lpp" +#line 71 "glsl_lexer.lpp" ; YY_BREAK case 3: YY_RULE_SETUP -#line 62 "glsl_lexer.lpp" +#line 72 "glsl_lexer.lpp" { BEGIN PP; return VERSION; } YY_BREAK case 4: YY_RULE_SETUP -#line 63 "glsl_lexer.lpp" +#line 73 "glsl_lexer.lpp" { BEGIN PP; return EXTENSION; } YY_BREAK case 5: @@ -1208,7 +1218,7 @@ case 5: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 64 "glsl_lexer.lpp" +#line 74 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1230,7 +1240,7 @@ case 6: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 79 "glsl_lexer.lpp" +#line 89 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1248,27 +1258,27 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 93 "glsl_lexer.lpp" +#line 103 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA; } YY_BREAK case 8: YY_RULE_SETUP -#line 94 "glsl_lexer.lpp" +#line 104 "glsl_lexer.lpp" { } YY_BREAK case 9: YY_RULE_SETUP -#line 95 "glsl_lexer.lpp" +#line 105 "glsl_lexer.lpp" { } YY_BREAK case 10: YY_RULE_SETUP -#line 96 "glsl_lexer.lpp" +#line 106 "glsl_lexer.lpp" return COLON; YY_BREAK case 11: YY_RULE_SETUP -#line 97 "glsl_lexer.lpp" +#line 107 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; @@ -1276,7 +1286,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 101 "glsl_lexer.lpp" +#line 111 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1285,318 +1295,283 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 105 "glsl_lexer.lpp" +#line 115 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 107 "glsl_lexer.lpp" +#line 117 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK case 15: YY_RULE_SETUP -#line 109 "glsl_lexer.lpp" +#line 119 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK case 16: YY_RULE_SETUP -#line 110 "glsl_lexer.lpp" +#line 120 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK case 17: YY_RULE_SETUP -#line 111 "glsl_lexer.lpp" +#line 121 "glsl_lexer.lpp" return BOOL; YY_BREAK case 18: YY_RULE_SETUP -#line 112 "glsl_lexer.lpp" +#line 122 "glsl_lexer.lpp" return FLOAT; YY_BREAK case 19: YY_RULE_SETUP -#line 113 "glsl_lexer.lpp" +#line 123 "glsl_lexer.lpp" return INT; YY_BREAK case 20: YY_RULE_SETUP -#line 115 "glsl_lexer.lpp" +#line 125 "glsl_lexer.lpp" return BREAK; YY_BREAK case 21: YY_RULE_SETUP -#line 116 "glsl_lexer.lpp" +#line 126 "glsl_lexer.lpp" return CONTINUE; YY_BREAK case 22: YY_RULE_SETUP -#line 117 "glsl_lexer.lpp" +#line 127 "glsl_lexer.lpp" return DO; YY_BREAK case 23: YY_RULE_SETUP -#line 118 "glsl_lexer.lpp" +#line 128 "glsl_lexer.lpp" return WHILE; YY_BREAK case 24: YY_RULE_SETUP -#line 119 "glsl_lexer.lpp" +#line 129 "glsl_lexer.lpp" return ELSE; YY_BREAK case 25: YY_RULE_SETUP -#line 120 "glsl_lexer.lpp" +#line 130 "glsl_lexer.lpp" return FOR; YY_BREAK case 26: YY_RULE_SETUP -#line 121 "glsl_lexer.lpp" +#line 131 "glsl_lexer.lpp" return IF; YY_BREAK case 27: YY_RULE_SETUP -#line 122 "glsl_lexer.lpp" +#line 132 "glsl_lexer.lpp" return DISCARD; YY_BREAK case 28: YY_RULE_SETUP -#line 123 "glsl_lexer.lpp" +#line 133 "glsl_lexer.lpp" return RETURN; YY_BREAK case 29: YY_RULE_SETUP -#line 125 "glsl_lexer.lpp" +#line 135 "glsl_lexer.lpp" return BVEC2; YY_BREAK case 30: YY_RULE_SETUP -#line 126 "glsl_lexer.lpp" +#line 136 "glsl_lexer.lpp" return BVEC3; YY_BREAK case 31: YY_RULE_SETUP -#line 127 "glsl_lexer.lpp" +#line 137 "glsl_lexer.lpp" return BVEC4; YY_BREAK case 32: YY_RULE_SETUP -#line 128 "glsl_lexer.lpp" +#line 138 "glsl_lexer.lpp" return IVEC2; YY_BREAK case 33: YY_RULE_SETUP -#line 129 "glsl_lexer.lpp" +#line 139 "glsl_lexer.lpp" return IVEC3; YY_BREAK case 34: YY_RULE_SETUP -#line 130 "glsl_lexer.lpp" +#line 140 "glsl_lexer.lpp" return IVEC4; YY_BREAK case 35: YY_RULE_SETUP -#line 131 "glsl_lexer.lpp" +#line 141 "glsl_lexer.lpp" return VEC2; YY_BREAK case 36: YY_RULE_SETUP -#line 132 "glsl_lexer.lpp" +#line 142 "glsl_lexer.lpp" return VEC3; YY_BREAK case 37: YY_RULE_SETUP -#line 133 "glsl_lexer.lpp" +#line 143 "glsl_lexer.lpp" return VEC4; YY_BREAK case 38: YY_RULE_SETUP -#line 134 "glsl_lexer.lpp" +#line 144 "glsl_lexer.lpp" return MAT2; YY_BREAK case 39: YY_RULE_SETUP -#line 135 "glsl_lexer.lpp" +#line 145 "glsl_lexer.lpp" return MAT3; YY_BREAK case 40: YY_RULE_SETUP -#line 136 "glsl_lexer.lpp" +#line 146 "glsl_lexer.lpp" return MAT4; YY_BREAK case 41: YY_RULE_SETUP -#line 137 "glsl_lexer.lpp" -return MAT2X2; +#line 147 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X2); YY_BREAK case 42: YY_RULE_SETUP -#line 138 "glsl_lexer.lpp" -return MAT2X3; +#line 148 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X3); YY_BREAK case 43: YY_RULE_SETUP -#line 139 "glsl_lexer.lpp" -return MAT2X4; +#line 149 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X4); YY_BREAK case 44: YY_RULE_SETUP -#line 140 "glsl_lexer.lpp" -return MAT3X2; +#line 150 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X2); YY_BREAK case 45: YY_RULE_SETUP -#line 141 "glsl_lexer.lpp" -return MAT3X3; +#line 151 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X3); YY_BREAK case 46: YY_RULE_SETUP -#line 142 "glsl_lexer.lpp" -return MAT3X4; +#line 152 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X4); YY_BREAK case 47: YY_RULE_SETUP -#line 143 "glsl_lexer.lpp" -return MAT4X2; +#line 153 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X2); YY_BREAK case 48: YY_RULE_SETUP -#line 144 "glsl_lexer.lpp" -return MAT4X3; +#line 154 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X3); YY_BREAK case 49: YY_RULE_SETUP -#line 145 "glsl_lexer.lpp" -return MAT4X4; +#line 155 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X4); YY_BREAK case 50: YY_RULE_SETUP -#line 147 "glsl_lexer.lpp" +#line 157 "glsl_lexer.lpp" return IN; YY_BREAK case 51: YY_RULE_SETUP -#line 148 "glsl_lexer.lpp" +#line 158 "glsl_lexer.lpp" return OUT; YY_BREAK case 52: YY_RULE_SETUP -#line 149 "glsl_lexer.lpp" +#line 159 "glsl_lexer.lpp" return INOUT; YY_BREAK case 53: YY_RULE_SETUP -#line 150 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" return UNIFORM; YY_BREAK case 54: YY_RULE_SETUP -#line 151 "glsl_lexer.lpp" +#line 161 "glsl_lexer.lpp" return VARYING; YY_BREAK case 55: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120) { - return CENTROID; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 162 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, CENTROID); YY_BREAK case 56: YY_RULE_SETUP -#line 160 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120) { - return INVARIANT; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 163 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, INVARIANT); YY_BREAK case 57: YY_RULE_SETUP -#line 169 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 130) { - return FLAT; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 165 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, FLAT); YY_BREAK case 58: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 130) { - return SMOOTH; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 166 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, SMOOTH); YY_BREAK case 59: YY_RULE_SETUP -#line 185 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 130) { - return NOPERSPECTIVE; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 167 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); YY_BREAK case 60: YY_RULE_SETUP -#line 194 "glsl_lexer.lpp" +#line 169 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK case 61: YY_RULE_SETUP -#line 195 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK case 62: YY_RULE_SETUP -#line 196 "glsl_lexer.lpp" +#line 171 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK case 63: YY_RULE_SETUP -#line 197 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK case 64: YY_RULE_SETUP -#line 198 "glsl_lexer.lpp" +#line 173 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK case 65: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 174 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK case 66: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" return STRUCT; YY_BREAK case 67: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" return VOID; YY_BREAK case 68: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) || (yyextra->ARB_fragment_coord_conventions_enable)){ @@ -1609,102 +1584,102 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" return INC_OP; YY_BREAK case 70: YY_RULE_SETUP -#line 215 "glsl_lexer.lpp" +#line 190 "glsl_lexer.lpp" return DEC_OP; YY_BREAK case 71: YY_RULE_SETUP -#line 216 "glsl_lexer.lpp" +#line 191 "glsl_lexer.lpp" return LE_OP; YY_BREAK case 72: YY_RULE_SETUP -#line 217 "glsl_lexer.lpp" +#line 192 "glsl_lexer.lpp" return GE_OP; YY_BREAK case 73: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" +#line 193 "glsl_lexer.lpp" return EQ_OP; YY_BREAK case 74: YY_RULE_SETUP -#line 219 "glsl_lexer.lpp" +#line 194 "glsl_lexer.lpp" return NE_OP; YY_BREAK case 75: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" +#line 195 "glsl_lexer.lpp" return AND_OP; YY_BREAK case 76: YY_RULE_SETUP -#line 221 "glsl_lexer.lpp" +#line 196 "glsl_lexer.lpp" return OR_OP; YY_BREAK case 77: YY_RULE_SETUP -#line 222 "glsl_lexer.lpp" +#line 197 "glsl_lexer.lpp" return XOR_OP; YY_BREAK case 78: YY_RULE_SETUP -#line 224 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK case 79: YY_RULE_SETUP -#line 225 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK case 80: YY_RULE_SETUP -#line 226 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK case 81: YY_RULE_SETUP -#line 227 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK case 82: YY_RULE_SETUP -#line 228 "glsl_lexer.lpp" +#line 203 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK case 83: YY_RULE_SETUP -#line 229 "glsl_lexer.lpp" +#line 204 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK case 84: YY_RULE_SETUP -#line 230 "glsl_lexer.lpp" +#line 205 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK case 85: YY_RULE_SETUP -#line 231 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK case 86: YY_RULE_SETUP -#line 232 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK case 87: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 208 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK case 88: YY_RULE_SETUP -#line 235 "glsl_lexer.lpp" +#line 210 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1712,7 +1687,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 239 "glsl_lexer.lpp" +#line 214 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return INTCONSTANT; @@ -1720,7 +1695,7 @@ YY_RULE_SETUP YY_BREAK case 90: YY_RULE_SETUP -#line 243 "glsl_lexer.lpp" +#line 218 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; @@ -1728,7 +1703,7 @@ YY_RULE_SETUP YY_BREAK case 91: YY_RULE_SETUP -#line 248 "glsl_lexer.lpp" +#line 223 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1736,7 +1711,7 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 252 "glsl_lexer.lpp" +#line 227 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1744,7 +1719,7 @@ YY_RULE_SETUP YY_BREAK case 93: YY_RULE_SETUP -#line 256 "glsl_lexer.lpp" +#line 231 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1752,7 +1727,7 @@ YY_RULE_SETUP YY_BREAK case 94: YY_RULE_SETUP -#line 260 "glsl_lexer.lpp" +#line 235 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1760,7 +1735,7 @@ YY_RULE_SETUP YY_BREAK case 95: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 240 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; @@ -1768,7 +1743,7 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 244 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; @@ -1777,271 +1752,243 @@ YY_RULE_SETUP /* Reserved words in GLSL 1.10. */ case 97: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 251 "glsl_lexer.lpp" return ASM; YY_BREAK case 98: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 252 "glsl_lexer.lpp" return CLASS; YY_BREAK case 99: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 253 "glsl_lexer.lpp" return UNION; YY_BREAK case 100: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 254 "glsl_lexer.lpp" return ENUM; YY_BREAK case 101: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 255 "glsl_lexer.lpp" return TYPEDEF; YY_BREAK case 102: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" +#line 256 "glsl_lexer.lpp" return TEMPLATE; YY_BREAK case 103: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 257 "glsl_lexer.lpp" return THIS; YY_BREAK case 104: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" +#line 258 "glsl_lexer.lpp" return PACKED; YY_BREAK case 105: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" +#line 259 "glsl_lexer.lpp" return GOTO; YY_BREAK case 106: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 260 "glsl_lexer.lpp" return SWITCH; YY_BREAK case 107: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 261 "glsl_lexer.lpp" return DEFAULT; YY_BREAK case 108: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 262 "glsl_lexer.lpp" return INLINE_TOK; YY_BREAK case 109: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" +#line 263 "glsl_lexer.lpp" return NOINLINE; YY_BREAK case 110: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" +#line 264 "glsl_lexer.lpp" return VOLATILE; YY_BREAK case 111: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 265 "glsl_lexer.lpp" return PUBLIC_TOK; YY_BREAK case 112: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 266 "glsl_lexer.lpp" return STATIC; YY_BREAK case 113: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" +#line 267 "glsl_lexer.lpp" return EXTERN; YY_BREAK case 114: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 268 "glsl_lexer.lpp" return EXTERNAL; YY_BREAK case 115: YY_RULE_SETUP -#line 294 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" return INTERFACE; YY_BREAK case 116: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 270 "glsl_lexer.lpp" return LONG; YY_BREAK case 117: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" +#line 271 "glsl_lexer.lpp" return SHORT; YY_BREAK case 118: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" +#line 272 "glsl_lexer.lpp" return DOUBLE; YY_BREAK case 119: YY_RULE_SETUP -#line 298 "glsl_lexer.lpp" +#line 273 "glsl_lexer.lpp" return HALF; YY_BREAK case 120: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 274 "glsl_lexer.lpp" return FIXED; YY_BREAK case 121: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 275 "glsl_lexer.lpp" return UNSIGNED; YY_BREAK case 122: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 276 "glsl_lexer.lpp" return INPUT; YY_BREAK case 123: YY_RULE_SETUP -#line 302 "glsl_lexer.lpp" +#line 277 "glsl_lexer.lpp" return OUTPUT; YY_BREAK case 124: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 278 "glsl_lexer.lpp" return HVEC2; YY_BREAK case 125: YY_RULE_SETUP -#line 304 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" return HVEC3; YY_BREAK case 126: YY_RULE_SETUP -#line 305 "glsl_lexer.lpp" +#line 280 "glsl_lexer.lpp" return HVEC4; YY_BREAK case 127: YY_RULE_SETUP -#line 306 "glsl_lexer.lpp" +#line 281 "glsl_lexer.lpp" return DVEC2; YY_BREAK case 128: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 282 "glsl_lexer.lpp" return DVEC3; YY_BREAK case 129: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 283 "glsl_lexer.lpp" return DVEC4; YY_BREAK case 130: YY_RULE_SETUP -#line 309 "glsl_lexer.lpp" +#line 284 "glsl_lexer.lpp" return FVEC2; YY_BREAK case 131: YY_RULE_SETUP -#line 310 "glsl_lexer.lpp" +#line 285 "glsl_lexer.lpp" return FVEC3; YY_BREAK case 132: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 286 "glsl_lexer.lpp" return FVEC4; YY_BREAK case 133: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK case 134: YY_RULE_SETUP -#line 313 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" return SAMPLER3DRECT; YY_BREAK case 135: YY_RULE_SETUP -#line 314 "glsl_lexer.lpp" +#line 289 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK case 136: YY_RULE_SETUP -#line 315 "glsl_lexer.lpp" +#line 290 "glsl_lexer.lpp" return SIZEOF; YY_BREAK case 137: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 291 "glsl_lexer.lpp" return CAST; YY_BREAK case 138: YY_RULE_SETUP -#line 317 "glsl_lexer.lpp" +#line 292 "glsl_lexer.lpp" return NAMESPACE; YY_BREAK case 139: YY_RULE_SETUP -#line 318 "glsl_lexer.lpp" +#line 293 "glsl_lexer.lpp" return USING; YY_BREAK /* Additional reserved words in GLSL 1.20. */ case 140: YY_RULE_SETUP -#line 321 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120){ - return LOWP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 296 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, LOWP); YY_BREAK case 141: YY_RULE_SETUP -#line 329 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120){ - return MEDIUMP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - }return MEDIUMP; +#line 297 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MEDIUMP); YY_BREAK case 142: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120){ - return HIGHP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 298 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, HIGHP); YY_BREAK case 143: YY_RULE_SETUP -#line 345 "glsl_lexer.lpp" -{ - if (yyextra->language_version >= 120){ - return PRECISION; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +#line 299 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, PRECISION); YY_BREAK case 144: YY_RULE_SETUP -#line 354 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2051,15 +1998,15 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 361 "glsl_lexer.lpp" +#line 308 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 146: YY_RULE_SETUP -#line 363 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2063 "glsl_lexer.cpp" +#line 2010 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -3201,7 +3148,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 363 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 702e79a363..21c81a2663 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -36,6 +36,16 @@ #define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define TOKEN_OR_IDENTIFIER(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + yylval->identifier = strdup(yytext); \ + return IDENTIFIER; \ + } \ + } while (0) + %} %option bison-bridge bison-locations reentrant noyywrap @@ -134,62 +144,27 @@ vec4 return VEC4; mat2 return MAT2; mat3 return MAT3; mat4 return MAT4; -mat2x2 return MAT2X2; -mat2x3 return MAT2X3; -mat2x4 return MAT2X4; -mat3x2 return MAT3X2; -mat3x3 return MAT3X3; -mat3x4 return MAT3X4; -mat4x2 return MAT4X2; -mat4x3 return MAT4X3; -mat4x4 return MAT4X4; +mat2x2 TOKEN_OR_IDENTIFIER(120, MAT2X2); +mat2x3 TOKEN_OR_IDENTIFIER(120, MAT2X3); +mat2x4 TOKEN_OR_IDENTIFIER(120, MAT2X4); +mat3x2 TOKEN_OR_IDENTIFIER(120, MAT3X2); +mat3x3 TOKEN_OR_IDENTIFIER(120, MAT3X3); +mat3x4 TOKEN_OR_IDENTIFIER(120, MAT3X4); +mat4x2 TOKEN_OR_IDENTIFIER(120, MAT4X2); +mat4x3 TOKEN_OR_IDENTIFIER(120, MAT4X3); +mat4x4 TOKEN_OR_IDENTIFIER(120, MAT4X4); in return IN; out return OUT; inout return INOUT; uniform return UNIFORM; varying return VARYING; -centroid { - if (yyextra->language_version >= 120) { - return CENTROID; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } -invariant { - if (yyextra->language_version >= 120) { - return INVARIANT; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +centroid TOKEN_OR_IDENTIFIER(120, CENTROID); +invariant TOKEN_OR_IDENTIFIER(120, INVARIANT); -flat { - if (yyextra->language_version >= 130) { - return FLAT; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } -smooth { - if (yyextra->language_version >= 130) { - return SMOOTH; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } -noperspective { - if (yyextra->language_version >= 130) { - return NOPERSPECTIVE; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +flat TOKEN_OR_IDENTIFIER(130, FLAT); +smooth TOKEN_OR_IDENTIFIER(130, SMOOTH); +noperspective TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); sampler1D return SAMPLER1D; sampler2D return SAMPLER2D; @@ -318,38 +293,10 @@ namespace return NAMESPACE; using return USING; /* Additional reserved words in GLSL 1.20. */ -lowp { - if (yyextra->language_version >= 120){ - return LOWP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } -mediump { - if (yyextra->language_version >= 120){ - return MEDIUMP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - }return MEDIUMP; -highp { - if (yyextra->language_version >= 120){ - return HIGHP; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } -precision { - if (yyextra->language_version >= 120){ - return PRECISION; - } else { - yylval->identifier = strdup(yytext); - return IDENTIFIER; - } - } +lowp TOKEN_OR_IDENTIFIER(120, LOWP); +mediump TOKEN_OR_IDENTIFIER(120, MEDIUMP); +highp TOKEN_OR_IDENTIFIER(120, HIGHP); +precision TOKEN_OR_IDENTIFIER(120, PRECISION); [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; -- cgit v1.2.3 From b35703df107b50b2c3f5cd4d56790921e8106324 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Mon, 2 Aug 2010 10:22:26 +0300 Subject: glsl2: initialize is_array and array_size of ast_parameter_declarator The non-array path of glsl_parser.ypp wasn't setting is_array to false. --- src/glsl/ast.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 655054ff6f..aa769da3f6 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -455,6 +455,12 @@ public: class ast_parameter_declarator : public ast_node { public: + ast_parameter_declarator() + { + this->is_array = false; + this->array_size = 0; + } + virtual void print(void) const; virtual ir_rvalue *hir(exec_list *instructions, -- cgit v1.2.3 From 31747155ea3a24190277b125bd188ac8689af719 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Thu, 29 Jul 2010 12:40:49 +0300 Subject: glsl2: Give the path within src/mesa/ for headers instead of relying on -I. --- src/glsl/ast_type.cpp | 2 +- src/glsl/glcpp/glcpp.h | 2 +- src/glsl/glsl_types.cpp | 2 +- src/glsl/hir_field_selection.cpp | 2 +- src/glsl/ir_clone.cpp | 2 +- src/glsl/ir_function_inlining.cpp | 2 +- src/glsl/ir_validate.cpp | 2 +- src/glsl/link_functions.cpp | 2 +- src/glsl/linker.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp index e2510a10c6..9a957044e7 100644 --- a/src/glsl/ast_type.cpp +++ b/src/glsl/ast_type.cpp @@ -24,7 +24,7 @@ #include #include "ast.h" extern "C" { -#include "symbol_table.h" +#include "program/symbol_table.h" } void diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h index 869de2efbc..0ccd957eda 100644 --- a/src/glsl/glcpp/glcpp.h +++ b/src/glsl/glcpp/glcpp.h @@ -28,7 +28,7 @@ #include -#include "hash_table.h" +#include "program/hash_table.h" #define yyscan_t void* diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 8192b86dfc..ce47b8167f 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -28,7 +28,7 @@ #include "glsl_types.h" #include "builtin_types.h" extern "C" { -#include "hash_table.h" +#include "program/hash_table.h" } hash_table *glsl_type::array_types = NULL; diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index db1e06932f..6dd910d581 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -23,7 +23,7 @@ #include "ir.h" #include "main/imports.h" -#include "symbol_table.h" +#include "program/symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" #include "glsl_types.h" diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 6be3e59a95..5ea3a79afc 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -25,7 +25,7 @@ #include "ir.h" #include "glsl_types.h" extern "C" { -#include "hash_table.h" +#include "program/hash_table.h" } /** diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 77c264f288..9599306243 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -33,7 +33,7 @@ #include "ir_function_inlining.h" #include "ir_expression_flattening.h" #include "glsl_types.h" -#include "hash_table.h" +#include "program/hash_table.h" class ir_function_inlining_visitor : public ir_hierarchical_visitor { public: diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 1fa6e19ce9..85417a1dbc 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -36,7 +36,7 @@ #include #include "ir.h" #include "ir_hierarchical_visitor.h" -#include "hash_table.h" +#include "program/hash_table.h" #include "glsl_types.h" class ir_validate : public ir_hierarchical_visitor { diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index 327be73afe..fdf886f662 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -34,7 +34,7 @@ extern "C" { #include "glsl_parser_extras.h" #include "ir.h" #include "program.h" -#include "hash_table.h" +#include "program/hash_table.h" #include "linker.h" static ir_function_signature * diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 9d53197fdd..a5faff2be7 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -78,7 +78,7 @@ extern "C" { #include "glsl_symbol_table.h" #include "ir.h" #include "program.h" -#include "hash_table.h" +#include "program/hash_table.h" #include "linker.h" #include "ir_optimization.h" -- cgit v1.2.3 From f311d8e9e9ef79fde762fbd7817f7fe51b37dc45 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 10:49:29 -0700 Subject: glsl2: Don't add mesa/program/ as an include dir. Let includes say program/. --- src/glsl/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 0254fec756..f98b772a2f 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -100,7 +100,6 @@ INCLUDES = \ -I. \ -I../mesa \ -I../mapi \ - -I../mesa/program \ -I../../include \ $(LIBRARY_INCLUDES) -- cgit v1.2.3 From 004e924014f749e8ae5cc7a40e1bb431af0b9041 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 10:54:22 -0700 Subject: glsl2: Fix spelling of "precision" in error output. --- src/glsl/glsl_parser.cpp | 6 +++--- src/glsl/glsl_parser.ypp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index b31f558168..bf83b81603 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -4454,7 +4454,7 @@ yyreduce: { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, @@ -4471,7 +4471,7 @@ yyreduce: { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, @@ -4488,7 +4488,7 @@ yyreduce: { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 53132d9067..7cabefbd34 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -1128,7 +1128,7 @@ precision_qualifier: HIGHP { if (state->language_version < 130) _mesa_glsl_error(& @1, state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, @@ -1139,7 +1139,7 @@ precision_qualifier: | MEDIUMP { if (state->language_version < 130) _mesa_glsl_error(& @1, state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, @@ -1150,7 +1150,7 @@ precision_qualifier: | LOWP { if (state->language_version < 130) _mesa_glsl_error(& @1, state, - "precission qualifier forbidden " + "precision qualifier forbidden " "in GLSL %d.%d (1.30 or later " "required)\n", state->language_version / 100, -- cgit v1.2.3 From b8db38e1c4f639cb0a063250d43f5a0ef6afd50f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 11:04:54 -0700 Subject: glsl2: Also initialize the identifier field of parameter_declarator. The non-named parameter grammar understandably doesn't set the identifier field. Fixes intermittent failures about void main(void) {} having a named void parameter. --- src/glsl/ast.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index aa769da3f6..1de285bb46 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -457,6 +457,7 @@ class ast_parameter_declarator : public ast_node { public: ast_parameter_declarator() { + this->identifier = NULL; this->is_array = false; this->array_size = 0; } -- cgit v1.2.3 From 960ba0014af7009f8543c55f455271cf3cb45cd6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 11:20:32 -0700 Subject: glsl2: Initialize the ARB_fcc fields of ir_variable. Fixes intermittent failure in glsl-arb-fragment-coord-conventions. --- src/glsl/ir.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 2b5f441ddd..79cbaa9ea0 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -802,6 +802,8 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, this->location = -1; this->warn_extension = NULL; this->constant_value = NULL; + this->origin_upper_left = false; + this->pixel_center_integer = false; if (type && type->base_type == GLSL_TYPE_SAMPLER) this->read_only = true; -- cgit v1.2.3 From 47f3f223119739efd337ce1757c2e00d61be34cb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 11:26:43 -0700 Subject: glsl2: Add support for floating constants like "1f". Fixes glsl-floating-constant-120. --- src/glsl/glsl_lexer.cpp | 860 ++++++++++++++++++++++++------------------------ src/glsl/glsl_lexer.lpp | 4 + 2 files changed, 438 insertions(+), 426 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index af29dce337..43be3170ba 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -358,8 +358,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 146 -#define YY_END_OF_BUFFER 147 +#define YY_NUM_RULES 147 +#define YY_END_OF_BUFFER 148 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,66 +367,66 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[524] = +static yyconst flex_int16_t yy_accept[525] = { 0, - 0, 0, 9, 9, 147, 145, 1, 14, 145, 145, - 145, 145, 145, 145, 145, 145, 90, 88, 145, 145, - 145, 144, 145, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 145, 1, 145, 85, 146, 9, 13, - 146, 12, 10, 11, 1, 74, 81, 75, 84, 78, + 0, 0, 9, 9, 148, 146, 1, 14, 146, 146, + 146, 146, 146, 146, 146, 146, 90, 88, 146, 146, + 146, 145, 146, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 146, 1, 146, 85, 147, 9, 13, + 147, 12, 10, 11, 1, 74, 81, 75, 84, 78, 69, 80, 70, 87, 92, 79, 93, 90, 0, 0, - 0, 88, 0, 71, 73, 72, 0, 144, 77, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 22, 144, 144, 144, 144, 144, 144, 144, 144, 144, - - 144, 144, 144, 144, 26, 50, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 86, 76, 1, 0, 0, 2, - 0, 0, 0, 0, 9, 8, 12, 11, 0, 92, - 91, 0, 93, 0, 94, 89, 82, 83, 97, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 25, 144, - 144, 144, 144, 144, 144, 144, 144, 19, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 51, 144, - - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 0, 0, 0, 0, 8, 0, 92, 0, - 91, 0, 93, 94, 144, 17, 144, 144, 137, 144, - 144, 144, 144, 144, 144, 144, 144, 24, 100, 144, - 144, 144, 57, 144, 144, 105, 119, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 116, 140, 38, 39, - 40, 144, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 144, 144, 103, 95, - 144, 144, 144, 144, 144, 144, 35, 36, 37, 67, - - 144, 144, 0, 0, 0, 0, 0, 91, 144, 20, - 29, 30, 31, 144, 98, 16, 144, 144, 144, 144, - 127, 128, 129, 144, 96, 120, 18, 130, 131, 132, - 142, 124, 125, 126, 144, 52, 122, 144, 144, 32, - 33, 34, 144, 144, 144, 144, 144, 144, 144, 144, - 144, 144, 144, 144, 144, 144, 117, 144, 144, 144, - 144, 144, 144, 144, 144, 99, 144, 139, 144, 144, - 23, 0, 0, 0, 0, 144, 144, 144, 144, 144, - 118, 113, 108, 144, 144, 68, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 144, 144, 144, 144, 123, - - 104, 144, 111, 28, 144, 136, 58, 112, 66, 106, - 144, 144, 144, 144, 144, 144, 0, 0, 0, 0, - 144, 144, 144, 107, 27, 144, 144, 144, 141, 144, - 144, 144, 144, 144, 144, 101, 53, 144, 54, 144, - 0, 0, 0, 7, 0, 144, 55, 21, 114, 144, - 144, 144, 109, 144, 144, 144, 144, 144, 144, 102, - 121, 110, 0, 0, 6, 0, 0, 0, 3, 15, - 115, 56, 138, 144, 143, 60, 61, 62, 144, 0, - 0, 0, 0, 144, 144, 144, 144, 144, 144, 4, - 0, 5, 0, 0, 0, 144, 144, 144, 144, 144, - - 63, 0, 144, 144, 144, 144, 144, 59, 144, 133, - 144, 134, 144, 144, 144, 64, 144, 65, 144, 144, - 144, 135, 0 + 95, 0, 88, 0, 71, 73, 72, 0, 145, 77, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 22, 145, 145, 145, 145, 145, 145, 145, 145, + + 145, 145, 145, 145, 145, 26, 50, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 86, 76, 1, 0, 0, + 2, 0, 0, 0, 0, 9, 8, 12, 11, 0, + 92, 91, 0, 93, 0, 94, 89, 82, 83, 98, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 25, + 145, 145, 145, 145, 145, 145, 145, 145, 19, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 51, + + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 0, 0, 0, 0, 8, 0, 92, + 0, 91, 0, 93, 94, 145, 17, 145, 145, 138, + 145, 145, 145, 145, 145, 145, 145, 145, 24, 101, + 145, 145, 145, 57, 145, 145, 106, 120, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 117, 141, 38, + 39, 40, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 104, + 96, 145, 145, 145, 145, 145, 145, 35, 36, 37, + + 67, 145, 145, 0, 0, 0, 0, 0, 91, 145, + 20, 29, 30, 31, 145, 99, 16, 145, 145, 145, + 145, 128, 129, 130, 145, 97, 121, 18, 131, 132, + 133, 143, 125, 126, 127, 145, 52, 123, 145, 145, + 32, 33, 34, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 118, 145, 145, + 145, 145, 145, 145, 145, 145, 100, 145, 140, 145, + 145, 23, 0, 0, 0, 0, 145, 145, 145, 145, + 145, 119, 114, 109, 145, 145, 68, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 145, 145, 145, 145, + + 124, 105, 145, 112, 28, 145, 137, 58, 113, 66, + 107, 145, 145, 145, 145, 145, 145, 0, 0, 0, + 0, 145, 145, 145, 108, 27, 145, 145, 145, 142, + 145, 145, 145, 145, 145, 145, 102, 53, 145, 54, + 145, 0, 0, 0, 7, 0, 145, 55, 21, 115, + 145, 145, 145, 110, 145, 145, 145, 145, 145, 145, + 103, 122, 111, 0, 0, 6, 0, 0, 0, 3, + 15, 116, 56, 139, 145, 144, 60, 61, 62, 145, + 0, 0, 0, 0, 145, 145, 145, 145, 145, 145, + 4, 0, 5, 0, 0, 0, 145, 145, 145, 145, + + 145, 63, 0, 145, 145, 145, 145, 145, 59, 145, + 134, 145, 135, 145, 145, 145, 64, 145, 65, 145, + 145, 145, 136, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -464,96 +464,96 @@ static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_meta[60] = { 0, 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, - 4, 5, 1, 6, 6, 6, 6, 6, 6, 7, - 1, 1, 1, 1, 8, 8, 8, 9, 10, 11, - 11, 11, 12, 1, 8, 8, 8, 8, 9, 10, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 11, 11, 1 + 4, 1, 1, 5, 5, 5, 5, 5, 5, 6, + 1, 1, 1, 1, 7, 7, 7, 8, 8, 9, + 9, 9, 10, 1, 7, 7, 7, 7, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 10, 9, 9, 1 } ; -static yyconst flex_int16_t yy_base[543] = +static yyconst flex_int16_t yy_base[542] = { 0, 0, 58, 81, 0, 814, 815, 59, 815, 790, 789, - 54, 788, 55, 56, 54, 787, 129, 130, 53, 786, - 127, 0, 774, 101, 106, 126, 116, 128, 143, 759, - 144, 136, 132, 142, 147, 753, 154, 766, 157, 163, - 159, 176, 762, 149, 212, 191, 780, 815, 215, 815, - 789, 232, 815, 0, 219, 815, 815, 815, 815, 815, - 815, 815, 815, 815, 198, 815, 203, 200, 216, 224, - 0, 229, 778, 815, 815, 815, 777, 0, 815, 753, - 746, 749, 757, 756, 743, 746, 757, 744, 750, 738, - 735, 748, 735, 732, 732, 738, 726, 218, 731, 741, - - 727, 733, 736, 737, 0, 213, 736, 717, 216, 721, - 734, 725, 211, 718, 732, 729, 731, 714, 719, 716, - 705, 714, 224, 718, 714, 716, 705, 708, 221, 713, - 705, 717, 230, 710, 815, 815, 274, 267, 279, 815, - 696, 708, 700, 710, 275, 0, 269, 0, 280, 815, - 264, 284, 815, 282, 297, 0, 815, 815, 0, 698, - 702, 711, 708, 692, 691, 691, 258, 706, 703, 703, - 701, 698, 690, 696, 683, 694, 680, 696, 0, 693, - 681, 688, 685, 689, 682, 671, 670, 683, 686, 683, - 671, 677, 668, 297, 673, 676, 667, 674, 663, 667, - - 673, 664, 655, 658, 656, 666, 656, 651, 649, 649, - 651, 648, 659, 658, 271, 653, 648, 637, 313, 655, - 657, 646, 638, 642, 653, 637, 0, 324, 324, 312, - 815, 331, 344, 815, 643, 0, 641, 340, 0, 634, - 632, 630, 638, 627, 644, 633, 343, 0, 0, 627, - 637, 637, 0, 622, 349, 0, 0, 624, 352, 625, - 619, 618, 619, 618, 358, 614, 0, 0, 610, 609, - 608, 610, 611, 616, 610, 606, 619, 614, 613, 605, - 609, 601, 604, 599, 607, 612, 611, 602, 0, 0, - 608, 597, 597, 602, 601, 598, 0, 0, 0, 0, - - 588, 600, 599, 598, 595, 584, 363, 361, 598, 0, - 0, 0, 0, 585, 0, 0, 585, 586, 580, 590, - 0, 0, 0, 581, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 588, 0, 0, 586, 582, 0, - 0, 0, 572, 369, 375, 378, 577, 573, 578, 569, - 567, 580, 566, 579, 568, 575, 0, 573, 570, 574, - 558, 567, 573, 568, 556, 0, 558, 0, 557, 560, - 0, 555, 599, 554, 556, 545, 554, 543, 543, 556, - 0, 551, 0, 550, 546, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 531, 544, 531, 528, 0, - - 0, 532, 0, 0, 524, 0, 0, 0, 0, 0, - 512, 523, 512, 518, 512, 507, 500, 395, 515, 501, - 495, 508, 502, 0, 0, 492, 496, 475, 0, 475, - 470, 464, 450, 390, 441, 0, 0, 437, 0, 435, - 430, 386, 360, 815, 425, 432, 0, 0, 0, 431, - 417, 429, 0, 430, 419, 438, 437, 436, 409, 0, - 0, 0, 413, 415, 815, 418, 0, 396, 815, 0, - 0, 0, 0, 402, 0, 420, 371, 420, 414, 402, - 420, 422, 424, 405, 405, 407, 403, 389, 369, 815, - 428, 815, 441, 0, 436, 350, 365, 315, 301, 295, - - 0, 438, 288, 287, 268, 279, 253, 0, 191, 197, - 177, 0, 167, 159, 141, 0, 131, 0, 125, 32, - 11, 0, 815, 472, 476, 483, 490, 495, 501, 507, - 509, 519, 528, 532, 536, 542, 553, 559, 561, 570, - 581, 583 + 54, 788, 55, 56, 54, 787, 129, 174, 53, 786, + 127, 0, 774, 101, 106, 126, 116, 128, 152, 759, + 161, 158, 128, 142, 131, 753, 166, 766, 175, 181, + 131, 187, 762, 149, 205, 222, 780, 815, 230, 815, + 789, 225, 815, 0, 244, 815, 815, 815, 815, 815, + 815, 815, 815, 815, 223, 815, 225, 200, 265, 218, + 815, 0, 0, 778, 815, 815, 815, 777, 0, 815, + 753, 746, 749, 757, 756, 743, 746, 757, 744, 750, + 738, 735, 748, 735, 732, 732, 738, 726, 132, 731, + + 741, 727, 733, 736, 737, 0, 221, 736, 717, 200, + 721, 734, 725, 225, 718, 732, 729, 731, 714, 719, + 716, 705, 714, 222, 718, 714, 716, 705, 708, 207, + 713, 705, 717, 243, 710, 815, 815, 285, 257, 295, + 815, 696, 708, 700, 710, 288, 0, 298, 0, 226, + 815, 280, 289, 815, 307, 318, 0, 815, 815, 0, + 698, 702, 711, 708, 692, 691, 691, 279, 706, 703, + 703, 701, 698, 690, 696, 683, 694, 680, 696, 0, + 693, 681, 688, 685, 689, 682, 671, 670, 683, 686, + 683, 671, 677, 668, 319, 673, 676, 667, 674, 663, + + 667, 673, 664, 655, 658, 656, 666, 656, 651, 649, + 649, 651, 648, 659, 658, 255, 653, 648, 637, 325, + 655, 657, 646, 638, 642, 653, 637, 0, 336, 328, + 322, 815, 345, 356, 815, 643, 0, 641, 353, 0, + 634, 632, 630, 638, 627, 644, 633, 356, 0, 0, + 627, 637, 637, 0, 622, 359, 0, 0, 624, 362, + 625, 619, 618, 619, 618, 365, 614, 0, 0, 610, + 609, 608, 610, 611, 616, 610, 606, 619, 614, 613, + 605, 609, 601, 604, 599, 607, 612, 611, 602, 0, + 0, 608, 597, 597, 602, 601, 598, 0, 0, 0, + + 0, 588, 600, 599, 598, 595, 584, 372, 383, 598, + 0, 0, 0, 0, 585, 0, 0, 585, 586, 580, + 590, 0, 0, 0, 581, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 588, 0, 0, 586, 582, + 0, 0, 0, 572, 381, 384, 387, 577, 573, 578, + 569, 567, 580, 566, 579, 568, 575, 0, 573, 570, + 574, 558, 567, 573, 568, 556, 0, 558, 0, 557, + 560, 0, 555, 599, 554, 556, 545, 554, 543, 543, + 556, 0, 558, 0, 557, 556, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 541, 554, 541, 538, + + 0, 0, 543, 0, 0, 535, 0, 0, 0, 0, + 0, 532, 543, 536, 542, 539, 534, 527, 411, 542, + 522, 514, 527, 525, 0, 0, 518, 524, 505, 0, + 510, 504, 503, 493, 391, 501, 0, 0, 500, 0, + 480, 465, 407, 343, 815, 457, 449, 0, 0, 0, + 448, 434, 446, 0, 447, 436, 455, 454, 453, 426, + 0, 0, 0, 430, 418, 815, 431, 0, 412, 815, + 0, 0, 0, 0, 425, 0, 444, 387, 444, 438, + 426, 433, 435, 439, 422, 422, 423, 419, 421, 420, + 815, 441, 815, 453, 0, 449, 404, 422, 402, 389, + + 385, 0, 451, 377, 373, 343, 346, 296, 0, 262, + 275, 253, 0, 223, 207, 144, 0, 148, 0, 104, + 32, 11, 0, 815, 485, 491, 497, 501, 506, 508, + 516, 523, 526, 529, 534, 543, 548, 550, 557, 566, + 568 } ; -static yyconst flex_int16_t yy_def[543] = +static yyconst flex_int16_t yy_def[542] = { 0, - 523, 1, 523, 3, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 524, 523, 523, - 523, 525, 523, 525, 525, 525, 525, 525, 525, 525, + 524, 1, 524, 3, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 525, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 526, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 527, 523, 528, 17, 529, 530, - 531, 524, 523, 523, 523, 523, 523, 525, 523, 525, + 525, 525, 525, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 526, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 527, 524, 528, 17, 524, 529, + 524, 530, 18, 524, 524, 524, 524, 524, 525, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 532, 523, 526, 533, 523, - 528, 534, 523, 523, 530, 531, 523, 523, 525, 525, + 525, 525, 525, 525, 525, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 531, 524, 526, 532, + 524, 528, 533, 524, 524, 529, 530, 524, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, @@ -561,8 +561,8 @@ static yyconst flex_int16_t yy_def[543] = 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 523, 523, 523, 523, 532, 523, 533, 535, - 523, 523, 534, 523, 525, 525, 525, 525, 525, 525, + 525, 525, 525, 524, 524, 524, 524, 531, 524, 532, + 534, 524, 524, 533, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, @@ -570,33 +570,33 @@ static yyconst flex_int16_t yy_def[543] = 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 523, 523, 523, 523, 523, 535, 525, 525, + 525, 525, 525, 524, 524, 524, 524, 524, 534, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 523, 523, 523, 523, 525, 525, 525, 525, 525, + 525, 525, 524, 524, 524, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 523, 523, 523, 523, + 525, 525, 525, 525, 525, 525, 525, 524, 524, 524, + 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 524, 535, 536, 524, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 523, 536, 537, 523, 523, 525, 525, 525, 525, 525, + 525, 525, 525, 524, 537, 524, 524, 538, 536, 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 523, 538, 523, 523, 539, 537, 523, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 523, - 540, 541, 539, 525, 525, 525, 525, 525, 525, 523, - 523, 523, 523, 542, 541, 525, 525, 525, 525, 525, + 524, 539, 540, 538, 525, 525, 525, 525, 525, 525, + 524, 524, 524, 524, 541, 540, 525, 525, 525, 525, - 525, 542, 525, 525, 525, 525, 525, 525, 525, 525, + 525, 525, 541, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 0, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523 + 525, 525, 525, 0, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524 } ; static yyconst flex_int16_t yy_nxt[875] = @@ -607,8 +607,8 @@ static yyconst flex_int16_t yy_nxt[875] = 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 22, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 22, 22, 22, 44, 45, - 55, 58, 55, 46, 61, 522, 63, 65, 65, 65, - 65, 65, 65, 65, 73, 74, 59, 62, 64, 521, + 55, 58, 55, 46, 61, 523, 63, 65, 65, 65, + 65, 65, 65, 65, 74, 75, 59, 62, 64, 522, 47, 48, 49, 50, 49, 48, 48, 48, 48, 48, 48, 48, 48, 51, 48, 52, 52, 52, 52, 52, @@ -616,87 +616,87 @@ static yyconst flex_int16_t yy_nxt[875] = 54, 54, 54, 54, 48, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 48, - 67, 67, 68, 68, 68, 68, 68, 68, 69, 76, - 77, 80, 81, 82, 89, 83, 70, 70, 90, 84, - 85, 71, 520, 91, 86, 519, 108, 70, 70, 92, - 87, 135, 93, 88, 94, 105, 110, 96, 102, 109, - 111, 112, 106, 95, 71, 97, 103, 98, 115, 107, - 99, 119, 139, 140, 113, 518, 100, 104, 120, 121, - - 517, 125, 122, 116, 126, 129, 117, 136, 123, 130, - 131, 124, 127, 137, 132, 55, 145, 138, 145, 128, - 55, 516, 55, 133, 515, 149, 150, 67, 514, 141, - 152, 153, 523, 154, 154, 142, 149, 150, 513, 143, - 67, 152, 153, 70, 144, 147, 147, 147, 147, 147, - 147, 147, 177, 197, 70, 523, 70, 185, 208, 198, - 186, 187, 192, 215, 188, 178, 189, 70, 139, 140, - 193, 216, 220, 209, 221, 137, 145, 55, 145, 138, - 139, 140, 147, 147, 147, 147, 147, 147, 147, 228, - 228, 230, 231, 232, 232, 155, 155, 155, 155, 155, - - 155, 155, 230, 231, 512, 141, 523, 523, 242, 243, - 292, 142, 269, 270, 271, 143, 511, 141, 293, 510, - 144, 307, 307, 142, 509, 234, 508, 143, 297, 298, - 299, 507, 144, 523, 523, 506, 234, 229, 229, 229, - 229, 229, 229, 229, 233, 233, 233, 233, 233, 233, - 233, 505, 150, 523, 523, 311, 312, 313, 321, 322, - 323, 464, 465, 150, 328, 329, 330, 332, 333, 334, - 523, 523, 153, 340, 341, 342, 308, 308, 308, 308, - 308, 308, 308, 153, 387, 388, 389, 464, 465, 231, - 390, 391, 392, 393, 394, 395, 418, 464, 465, 504, - - 231, 486, 487, 503, 456, 457, 458, 501, 442, 443, - 443, 443, 443, 443, 443, 459, 464, 465, 467, 464, - 465, 491, 492, 491, 492, 464, 465, 500, 481, 491, - 492, 466, 466, 466, 466, 466, 466, 491, 492, 491, - 492, 467, 491, 492, 499, 498, 497, 496, 490, 489, - 488, 485, 494, 484, 493, 493, 493, 493, 493, 493, - 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, - 470, 469, 463, 462, 461, 494, 72, 72, 72, 460, - 72, 78, 78, 78, 78, 78, 78, 78, 148, 148, - 148, 148, 148, 148, 148, 65, 65, 455, 65, 65, - - 151, 151, 454, 151, 151, 69, 69, 69, 453, 69, - 155, 452, 155, 155, 156, 156, 156, 156, 156, 227, - 227, 451, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 229, 450, 229, 229, 233, 449, 233, 233, 308, - 448, 308, 308, 466, 466, 447, 446, 466, 445, 444, - 441, 440, 439, 466, 468, 468, 438, 437, 468, 468, - 482, 482, 436, 435, 482, 482, 483, 483, 483, 483, - 483, 493, 493, 434, 433, 493, 432, 431, 430, 429, - 428, 493, 495, 495, 427, 426, 495, 495, 502, 502, - 502, 502, 502, 425, 424, 423, 422, 421, 420, 419, - - 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, - 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, - 398, 397, 396, 386, 385, 384, 383, 382, 381, 380, - 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, - 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, - 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, - 349, 348, 347, 346, 345, 344, 343, 339, 338, 337, - 336, 335, 331, 327, 326, 325, 324, 320, 319, 318, - 317, 316, 315, 314, 310, 309, 306, 305, 304, 303, - 302, 301, 300, 296, 295, 294, 291, 290, 289, 288, - - 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, - 277, 276, 275, 274, 273, 272, 268, 267, 266, 265, - 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, - 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, - 244, 241, 240, 239, 238, 237, 236, 235, 226, 225, - 224, 223, 222, 219, 218, 217, 214, 213, 212, 211, - 210, 207, 206, 205, 204, 203, 202, 201, 200, 199, - 196, 195, 194, 191, 190, 184, 183, 182, 181, 180, - 179, 176, 175, 174, 173, 172, 171, 170, 169, 168, - 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, - - 157, 146, 75, 134, 118, 114, 101, 79, 75, 66, - 60, 57, 56, 523, 5, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523 + 67, 521, 68, 68, 68, 68, 68, 68, 69, 77, + 78, 81, 82, 83, 90, 84, 70, 71, 91, 85, + 86, 72, 109, 92, 87, 113, 178, 70, 71, 93, + 88, 136, 94, 89, 95, 110, 111, 130, 114, 179, + 112, 131, 520, 96, 72, 67, 97, 73, 73, 73, + 73, 73, 73, 73, 98, 103, 99, 106, 519, 100, + + 116, 70, 71, 104, 107, 101, 138, 137, 55, 120, + 139, 108, 70, 71, 105, 117, 121, 122, 118, 126, + 123, 132, 127, 140, 141, 133, 124, 155, 155, 125, + 128, 146, 524, 146, 134, 229, 229, 129, 148, 148, + 148, 148, 148, 148, 148, 55, 193, 55, 518, 216, + 150, 151, 153, 154, 194, 524, 209, 217, 140, 141, + 142, 150, 151, 153, 154, 186, 143, 198, 187, 188, + 144, 210, 189, 199, 190, 145, 67, 517, 69, 69, + 69, 69, 69, 69, 69, 221, 138, 222, 55, 146, + 139, 146, 70, 71, 293, 142, 140, 141, 233, 233, + + 516, 143, 294, 70, 71, 144, 515, 231, 232, 514, + 145, 148, 148, 148, 148, 148, 148, 148, 231, 232, + 156, 156, 156, 156, 156, 156, 156, 524, 524, 243, + 244, 308, 308, 142, 270, 271, 272, 524, 524, 143, + 298, 299, 300, 144, 465, 466, 235, 513, 145, 230, + 230, 230, 230, 230, 230, 230, 151, 235, 234, 234, + 234, 234, 234, 234, 234, 524, 524, 151, 312, 313, + 314, 322, 323, 324, 329, 330, 331, 333, 334, 335, + 341, 342, 343, 512, 154, 309, 309, 309, 309, 309, + 309, 309, 524, 524, 511, 154, 388, 389, 390, 391, + + 392, 393, 394, 395, 396, 457, 458, 459, 465, 466, + 510, 232, 419, 465, 466, 509, 460, 487, 488, 465, + 466, 508, 232, 507, 443, 444, 444, 444, 444, 444, + 444, 482, 465, 466, 492, 493, 492, 493, 506, 468, + 465, 466, 492, 493, 467, 467, 467, 467, 467, 467, + 492, 493, 492, 493, 492, 493, 505, 504, 502, 501, + 500, 499, 468, 498, 497, 495, 494, 494, 494, 494, + 494, 494, 491, 490, 489, 486, 485, 481, 480, 479, + 478, 477, 476, 475, 474, 473, 472, 471, 495, 79, + 79, 79, 79, 79, 79, 149, 149, 149, 149, 149, + + 149, 65, 65, 470, 65, 152, 152, 464, 152, 156, + 156, 156, 157, 157, 157, 157, 228, 228, 463, 228, + 228, 228, 228, 228, 228, 228, 230, 230, 230, 234, + 234, 234, 309, 309, 309, 467, 467, 462, 467, 461, + 456, 455, 454, 467, 469, 469, 453, 469, 469, 483, + 483, 452, 483, 483, 484, 484, 484, 484, 494, 494, + 451, 494, 450, 449, 448, 447, 494, 496, 496, 446, + 496, 496, 503, 503, 503, 503, 445, 442, 441, 440, + 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, + 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, + + 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, + 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, + 399, 398, 397, 387, 386, 385, 384, 383, 382, 381, + 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, + 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, + 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, + 350, 349, 348, 347, 346, 345, 344, 340, 339, 338, + 337, 336, 332, 328, 327, 326, 325, 321, 320, 319, + 318, 317, 316, 315, 311, 310, 307, 306, 305, 304, + 303, 302, 301, 297, 296, 295, 292, 291, 290, 289, + + 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, + 278, 277, 276, 275, 274, 273, 269, 268, 267, 266, + 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, + 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, + 245, 242, 241, 240, 239, 238, 237, 236, 227, 226, + 225, 224, 223, 220, 219, 218, 215, 214, 213, 212, + 211, 208, 207, 206, 205, 204, 203, 202, 201, 200, + 197, 196, 195, 192, 191, 185, 184, 183, 182, 181, + 180, 177, 176, 175, 174, 173, 172, 171, 170, 169, + 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, + + 158, 147, 76, 135, 119, 115, 102, 80, 76, 66, + 60, 57, 56, 524, 5, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524 } ; static yyconst flex_int16_t yy_chk[875] = @@ -707,8 +707,8 @@ static yyconst flex_int16_t yy_chk[875] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 7, 11, 7, 2, 13, 521, 14, 15, 15, 15, - 15, 15, 15, 15, 19, 19, 11, 13, 14, 520, + 7, 11, 7, 2, 13, 522, 14, 15, 15, 15, + 15, 15, 15, 15, 19, 19, 11, 13, 14, 521, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -716,87 +716,87 @@ static yyconst flex_int16_t yy_chk[875] = 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 17, 18, 17, 17, 17, 17, 17, 17, 17, 21, - 21, 24, 24, 25, 27, 25, 17, 18, 27, 25, - 26, 17, 519, 27, 26, 517, 33, 17, 18, 27, - 26, 44, 28, 26, 28, 32, 34, 29, 31, 33, - 34, 35, 32, 28, 17, 29, 31, 29, 37, 32, - 29, 39, 46, 46, 35, 515, 29, 31, 39, 39, - - 514, 40, 39, 37, 40, 41, 37, 44, 39, 41, - 42, 39, 40, 45, 42, 45, 49, 45, 49, 40, - 55, 513, 55, 42, 511, 65, 65, 69, 510, 46, - 67, 67, 68, 70, 70, 46, 65, 65, 509, 46, - 72, 67, 67, 69, 46, 52, 52, 52, 52, 52, - 52, 52, 98, 113, 69, 68, 72, 106, 123, 113, - 106, 106, 109, 129, 106, 98, 106, 72, 138, 138, - 109, 129, 133, 123, 133, 137, 145, 137, 145, 137, - 139, 139, 147, 147, 147, 147, 147, 147, 147, 149, - 149, 151, 151, 152, 152, 154, 154, 154, 154, 154, - - 154, 154, 151, 151, 507, 138, 155, 155, 167, 167, - 215, 138, 194, 194, 194, 138, 506, 139, 215, 505, - 138, 230, 230, 139, 504, 155, 503, 139, 219, 219, - 219, 500, 139, 229, 229, 499, 155, 228, 228, 228, - 228, 228, 228, 228, 232, 232, 232, 232, 232, 232, - 232, 498, 229, 233, 233, 238, 238, 238, 247, 247, - 247, 443, 443, 229, 255, 255, 255, 259, 259, 259, - 308, 308, 233, 265, 265, 265, 307, 307, 307, 307, - 307, 307, 307, 233, 344, 344, 344, 442, 442, 308, - 345, 345, 345, 346, 346, 346, 418, 468, 468, 497, - - 308, 477, 477, 496, 434, 434, 434, 489, 418, 418, - 418, 418, 418, 418, 418, 434, 464, 464, 442, 466, - 466, 481, 481, 482, 482, 483, 483, 488, 464, 491, - 491, 466, 466, 466, 466, 466, 466, 495, 495, 502, - 502, 442, 493, 493, 487, 486, 485, 484, 480, 479, - 478, 476, 481, 474, 493, 493, 493, 493, 493, 493, - 463, 459, 458, 457, 456, 455, 454, 452, 451, 450, - 446, 445, 441, 440, 438, 481, 524, 524, 524, 435, - 524, 525, 525, 525, 525, 525, 525, 525, 526, 526, - 526, 526, 526, 526, 526, 527, 527, 433, 527, 527, - - 528, 528, 432, 528, 528, 529, 529, 529, 431, 529, - 530, 430, 530, 530, 531, 531, 531, 531, 531, 532, - 532, 428, 532, 532, 532, 532, 532, 532, 532, 532, - 532, 533, 427, 533, 533, 534, 426, 534, 534, 535, - 423, 535, 535, 536, 536, 422, 421, 536, 420, 419, - 417, 416, 415, 536, 537, 537, 414, 413, 537, 537, - 538, 538, 412, 411, 538, 538, 539, 539, 539, 539, - 539, 540, 540, 405, 402, 540, 399, 398, 397, 396, - 385, 540, 541, 541, 384, 382, 541, 541, 542, 542, - 542, 542, 542, 380, 379, 378, 377, 376, 375, 374, - - 373, 372, 370, 369, 367, 365, 364, 363, 362, 361, - 360, 359, 358, 356, 355, 354, 353, 352, 351, 350, - 349, 348, 347, 343, 339, 338, 335, 324, 320, 319, - 318, 317, 314, 309, 306, 305, 304, 303, 302, 301, - 296, 295, 294, 293, 292, 291, 288, 287, 286, 285, - 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, - 274, 273, 272, 271, 270, 269, 266, 264, 263, 262, - 261, 260, 258, 254, 252, 251, 250, 246, 245, 244, - 243, 242, 241, 240, 237, 235, 226, 225, 224, 223, - 222, 221, 220, 218, 217, 216, 214, 213, 212, 211, - - 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, - 200, 199, 198, 197, 196, 195, 193, 192, 191, 190, - 189, 188, 187, 186, 185, 184, 183, 182, 181, 180, - 178, 177, 176, 175, 174, 173, 172, 171, 170, 169, - 168, 166, 165, 164, 163, 162, 161, 160, 144, 143, - 142, 141, 134, 132, 131, 130, 128, 127, 126, 125, - 124, 122, 121, 120, 119, 118, 117, 116, 115, 114, - 112, 111, 110, 108, 107, 104, 103, 102, 101, 100, - 99, 97, 96, 95, 94, 93, 92, 91, 90, 89, - 88, 87, 86, 85, 84, 83, 82, 81, 80, 77, - - 73, 51, 47, 43, 38, 36, 30, 23, 20, 16, - 12, 10, 9, 5, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523, 523, 523, 523, 523, 523, 523, - 523, 523, 523, 523 + 17, 520, 17, 17, 17, 17, 17, 17, 17, 21, + 21, 24, 24, 25, 27, 25, 17, 17, 27, 25, + 26, 17, 33, 27, 26, 35, 99, 17, 17, 27, + 26, 44, 28, 26, 28, 33, 34, 41, 35, 99, + 34, 41, 518, 28, 17, 18, 29, 18, 18, 18, + 18, 18, 18, 18, 29, 31, 29, 32, 516, 29, + + 37, 18, 18, 31, 32, 29, 45, 44, 45, 39, + 45, 32, 18, 18, 31, 37, 39, 39, 37, 40, + 39, 42, 40, 46, 46, 42, 39, 70, 70, 39, + 40, 49, 68, 49, 42, 150, 150, 40, 52, 52, + 52, 52, 52, 52, 52, 55, 110, 55, 515, 130, + 65, 65, 67, 67, 110, 68, 124, 130, 139, 139, + 46, 65, 65, 67, 67, 107, 46, 114, 107, 107, + 46, 124, 107, 114, 107, 46, 69, 514, 69, 69, + 69, 69, 69, 69, 69, 134, 138, 134, 138, 146, + 138, 146, 69, 69, 216, 139, 140, 140, 153, 153, + + 512, 139, 216, 69, 69, 139, 511, 152, 152, 510, + 139, 148, 148, 148, 148, 148, 148, 148, 152, 152, + 155, 155, 155, 155, 155, 155, 155, 156, 156, 168, + 168, 231, 231, 140, 195, 195, 195, 230, 230, 140, + 220, 220, 220, 140, 444, 444, 156, 508, 140, 229, + 229, 229, 229, 229, 229, 229, 230, 156, 233, 233, + 233, 233, 233, 233, 233, 234, 234, 230, 239, 239, + 239, 248, 248, 248, 256, 256, 256, 260, 260, 260, + 266, 266, 266, 507, 234, 308, 308, 308, 308, 308, + 308, 308, 309, 309, 506, 234, 345, 345, 345, 346, + + 346, 346, 347, 347, 347, 435, 435, 435, 443, 443, + 505, 309, 419, 469, 469, 504, 435, 478, 478, 465, + 465, 501, 309, 500, 419, 419, 419, 419, 419, 419, + 419, 465, 467, 467, 482, 482, 483, 483, 499, 443, + 484, 484, 492, 492, 467, 467, 467, 467, 467, 467, + 496, 496, 503, 503, 494, 494, 498, 497, 490, 489, + 488, 487, 443, 486, 485, 482, 494, 494, 494, 494, + 494, 494, 481, 480, 479, 477, 475, 464, 460, 459, + 458, 457, 456, 455, 453, 452, 451, 447, 482, 525, + 525, 525, 525, 525, 525, 526, 526, 526, 526, 526, + + 526, 527, 527, 446, 527, 528, 528, 442, 528, 529, + 529, 529, 530, 530, 530, 530, 531, 531, 441, 531, + 531, 531, 531, 531, 531, 531, 532, 532, 532, 533, + 533, 533, 534, 534, 534, 535, 535, 439, 535, 436, + 434, 433, 432, 535, 536, 536, 431, 536, 536, 537, + 537, 429, 537, 537, 538, 538, 538, 538, 539, 539, + 428, 539, 427, 424, 423, 422, 539, 540, 540, 421, + 540, 540, 541, 541, 541, 541, 420, 418, 417, 416, + 415, 414, 413, 412, 406, 403, 400, 399, 398, 397, + 386, 385, 383, 381, 380, 379, 378, 377, 376, 375, + + 374, 373, 371, 370, 368, 366, 365, 364, 363, 362, + 361, 360, 359, 357, 356, 355, 354, 353, 352, 351, + 350, 349, 348, 344, 340, 339, 336, 325, 321, 320, + 319, 318, 315, 310, 307, 306, 305, 304, 303, 302, + 297, 296, 295, 294, 293, 292, 289, 288, 287, 286, + 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, + 275, 274, 273, 272, 271, 270, 267, 265, 264, 263, + 262, 261, 259, 255, 253, 252, 251, 247, 246, 245, + 244, 243, 242, 241, 238, 236, 227, 226, 225, 224, + 223, 222, 221, 219, 218, 217, 215, 214, 213, 212, + + 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, + 201, 200, 199, 198, 197, 196, 194, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, + 169, 167, 166, 165, 164, 163, 162, 161, 145, 144, + 143, 142, 135, 133, 132, 131, 129, 128, 127, 126, + 125, 123, 122, 121, 120, 119, 118, 117, 116, 115, + 113, 112, 111, 109, 108, 105, 104, 103, 102, 101, + 100, 98, 97, 96, 95, 94, 93, 92, 91, 90, + 89, 88, 87, 86, 85, 84, 83, 82, 81, 78, + + 74, 51, 47, 43, 38, 36, 30, 23, 20, 16, + 12, 10, 9, 5, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + 524, 524, 524, 524 } ; /* The intent behind this definition is that it'll catch @@ -1163,13 +1163,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 524 ) + if ( yy_current_state >= 525 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 523 ); + while ( yy_current_state != 524 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1735,260 +1735,268 @@ YY_RULE_SETUP YY_BREAK case 95: YY_RULE_SETUP -#line 240 "glsl_lexer.lpp" +#line 239 "glsl_lexer.lpp" { - yylval->n = 1; - return BOOLCONSTANT; + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; } YY_BREAK case 96: YY_RULE_SETUP #line 244 "glsl_lexer.lpp" +{ + yylval->n = 1; + return BOOLCONSTANT; + } + YY_BREAK +case 97: +YY_RULE_SETUP +#line 248 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; } YY_BREAK /* Reserved words in GLSL 1.10. */ -case 97: +case 98: YY_RULE_SETUP -#line 251 "glsl_lexer.lpp" +#line 255 "glsl_lexer.lpp" return ASM; YY_BREAK -case 98: +case 99: YY_RULE_SETUP -#line 252 "glsl_lexer.lpp" +#line 256 "glsl_lexer.lpp" return CLASS; YY_BREAK -case 99: +case 100: YY_RULE_SETUP -#line 253 "glsl_lexer.lpp" +#line 257 "glsl_lexer.lpp" return UNION; YY_BREAK -case 100: +case 101: YY_RULE_SETUP -#line 254 "glsl_lexer.lpp" +#line 258 "glsl_lexer.lpp" return ENUM; YY_BREAK -case 101: +case 102: YY_RULE_SETUP -#line 255 "glsl_lexer.lpp" +#line 259 "glsl_lexer.lpp" return TYPEDEF; YY_BREAK -case 102: +case 103: YY_RULE_SETUP -#line 256 "glsl_lexer.lpp" +#line 260 "glsl_lexer.lpp" return TEMPLATE; YY_BREAK -case 103: +case 104: YY_RULE_SETUP -#line 257 "glsl_lexer.lpp" +#line 261 "glsl_lexer.lpp" return THIS; YY_BREAK -case 104: +case 105: YY_RULE_SETUP -#line 258 "glsl_lexer.lpp" +#line 262 "glsl_lexer.lpp" return PACKED; YY_BREAK -case 105: +case 106: YY_RULE_SETUP -#line 259 "glsl_lexer.lpp" +#line 263 "glsl_lexer.lpp" return GOTO; YY_BREAK -case 106: +case 107: YY_RULE_SETUP -#line 260 "glsl_lexer.lpp" +#line 264 "glsl_lexer.lpp" return SWITCH; YY_BREAK -case 107: +case 108: YY_RULE_SETUP -#line 261 "glsl_lexer.lpp" +#line 265 "glsl_lexer.lpp" return DEFAULT; YY_BREAK -case 108: +case 109: YY_RULE_SETUP -#line 262 "glsl_lexer.lpp" +#line 266 "glsl_lexer.lpp" return INLINE_TOK; YY_BREAK -case 109: +case 110: YY_RULE_SETUP -#line 263 "glsl_lexer.lpp" +#line 267 "glsl_lexer.lpp" return NOINLINE; YY_BREAK -case 110: +case 111: YY_RULE_SETUP -#line 264 "glsl_lexer.lpp" +#line 268 "glsl_lexer.lpp" return VOLATILE; YY_BREAK -case 111: +case 112: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" return PUBLIC_TOK; YY_BREAK -case 112: +case 113: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" +#line 270 "glsl_lexer.lpp" return STATIC; YY_BREAK -case 113: +case 114: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" +#line 271 "glsl_lexer.lpp" return EXTERN; YY_BREAK -case 114: +case 115: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" +#line 272 "glsl_lexer.lpp" return EXTERNAL; YY_BREAK -case 115: +case 116: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 273 "glsl_lexer.lpp" return INTERFACE; YY_BREAK -case 116: +case 117: YY_RULE_SETUP -#line 270 "glsl_lexer.lpp" +#line 274 "glsl_lexer.lpp" return LONG; YY_BREAK -case 117: +case 118: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" +#line 275 "glsl_lexer.lpp" return SHORT; YY_BREAK -case 118: +case 119: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" +#line 276 "glsl_lexer.lpp" return DOUBLE; YY_BREAK -case 119: +case 120: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" +#line 277 "glsl_lexer.lpp" return HALF; YY_BREAK -case 120: +case 121: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 278 "glsl_lexer.lpp" return FIXED; YY_BREAK -case 121: +case 122: YY_RULE_SETUP -#line 275 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" return UNSIGNED; YY_BREAK -case 122: +case 123: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 280 "glsl_lexer.lpp" return INPUT; YY_BREAK -case 123: +case 124: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 281 "glsl_lexer.lpp" return OUTPUT; YY_BREAK -case 124: +case 125: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 282 "glsl_lexer.lpp" return HVEC2; YY_BREAK -case 125: +case 126: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 283 "glsl_lexer.lpp" return HVEC3; YY_BREAK -case 126: +case 127: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 284 "glsl_lexer.lpp" return HVEC4; YY_BREAK -case 127: +case 128: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" +#line 285 "glsl_lexer.lpp" return DVEC2; YY_BREAK -case 128: +case 129: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 286 "glsl_lexer.lpp" return DVEC3; YY_BREAK -case 129: +case 130: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" return DVEC4; YY_BREAK -case 130: +case 131: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" +#line 288 "glsl_lexer.lpp" return FVEC2; YY_BREAK -case 131: +case 132: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" +#line 289 "glsl_lexer.lpp" return FVEC3; YY_BREAK -case 132: +case 133: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 290 "glsl_lexer.lpp" return FVEC4; YY_BREAK -case 133: +case 134: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" +#line 291 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK -case 134: +case 135: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" +#line 292 "glsl_lexer.lpp" return SAMPLER3DRECT; YY_BREAK -case 135: +case 136: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" +#line 293 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK -case 136: +case 137: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 294 "glsl_lexer.lpp" return SIZEOF; YY_BREAK -case 137: +case 138: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 295 "glsl_lexer.lpp" return CAST; YY_BREAK -case 138: +case 139: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" +#line 296 "glsl_lexer.lpp" return NAMESPACE; YY_BREAK -case 139: +case 140: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 297 "glsl_lexer.lpp" return USING; YY_BREAK /* Additional reserved words in GLSL 1.20. */ -case 140: +case 141: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" +#line 300 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, LOWP); YY_BREAK -case 141: +case 142: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MEDIUMP); YY_BREAK -case 142: +case 143: YY_RULE_SETUP -#line 298 "glsl_lexer.lpp" +#line 302 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, HIGHP); YY_BREAK -case 143: +case 144: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, PRECISION); YY_BREAK -case 144: +case 145: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 305 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -1996,17 +2004,17 @@ YY_RULE_SETUP return IDENTIFIER; } YY_BREAK -case 145: +case 146: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK -case 146: +case 147: YY_RULE_SETUP -#line 310 "glsl_lexer.lpp" +#line 314 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2010 "glsl_lexer.cpp" +#line 2018 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -2303,7 +2311,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 524 ) + if ( yy_current_state >= 525 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2332,11 +2340,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 524 ) + if ( yy_current_state >= 525 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 523); + yy_is_jam = (yy_current_state == 524); return yy_is_jam ? 0 : yy_current_state; } @@ -3148,7 +3156,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 310 "glsl_lexer.lpp" +#line 314 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 21c81a2663..9fd9b53c5c 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -236,6 +236,10 @@ layout { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; } +[0-9]+[fF] { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } true { yylval->n = 1; -- cgit v1.2.3 From e75dbf66d011d76b6944dc4ee55e339ee285510c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 12:06:34 -0700 Subject: glsl2: Fix validation for ir_unop_not. We use vector ir_unop_not to implement builtin not(), and that seems fine. --- src/glsl/ir_validate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 85417a1dbc..1dfac82826 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -171,8 +171,8 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[0]->type == ir->type); break; case ir_unop_logic_not: - assert(ir->type == glsl_type::bool_type); - assert(ir->operands[0]->type == glsl_type::bool_type); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); break; case ir_unop_neg: -- cgit v1.2.3 From ee7666b5ac2fc7de64baf60835271e15baf89474 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 12:08:52 -0700 Subject: glsl2: Add validation that talloc ownership of ir_* names is right. --- src/glsl/ir_validate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 1dfac82826..f9f781b36a 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -139,7 +139,7 @@ ir_validate::visit_enter(ir_function *ir) ir_visitor_status ir_validate::visit_leave(ir_function *ir) { - (void) ir; + assert(talloc_parent(ir->name) == ir); this->current_function = NULL; return visit_continue; @@ -313,6 +313,8 @@ ir_validate::visit(ir_variable *ir) * in the ir_dereference_variable handler to ensure that a variable is * declared before it is dereferenced. */ + assert(talloc_parent(ir->name) == ir); + hash_table_insert(ht, ir, ir); return visit_continue; } -- cgit v1.2.3 From eb7e120f0f342541716882c211eca115c2cd0d21 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 12:28:38 -0700 Subject: glsl2: Fix expression type in builtin tan(). Fixes glsl-fs-tan-1. --- src/glsl/builtin_function.cpp | 6 +++--- src/glsl/builtins/110/tan | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index eade72ad3a..a8acff4731 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -2097,17 +2097,17 @@ static const char *builtins_110_tan = { " (signature vec2\n" " (parameters\n" " (declare (in) vec2 angle))\n" - " ((return (expression float / (expression float sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" + " ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 angle))\n" - " ((return (expression float / (expression float sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" + " ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 angle))\n" - " ((return (expression float / (expression float sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" + " ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" "))\n" }; diff --git a/src/glsl/builtins/110/tan b/src/glsl/builtins/110/tan index 3e04892a76..9979863185 100644 --- a/src/glsl/builtins/110/tan +++ b/src/glsl/builtins/110/tan @@ -7,15 +7,15 @@ (signature vec2 (parameters (declare (in) vec2 angle)) - ((return (expression float / (expression float sin (var_ref angle)) (expression vec2 cos (var_ref angle)))))) + ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle)))))) (signature vec3 (parameters (declare (in) vec3 angle)) - ((return (expression float / (expression float sin (var_ref angle)) (expression vec3 cos (var_ref angle)))))) + ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle)))))) (signature vec4 (parameters (declare (in) vec4 angle)) - ((return (expression float / (expression float sin (var_ref angle)) (expression vec4 cos (var_ref angle)))))) + ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle)))))) )) -- cgit v1.2.3 From cf41c8a0d8dac52bafb7c3e85171566c492786ab Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Aug 2010 11:35:14 -0700 Subject: glsl2: Make glsl_types::ctx private again --- src/glsl/glsl_types.cpp | 4 ++-- src/glsl/glsl_types.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index ce47b8167f..d8e291c881 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -35,8 +35,8 @@ hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; void *glsl_type::ctx = NULL; -static void -init_talloc_type_ctx(void) +void +glsl_type::init_talloc_type_ctx(void) { if (glsl_type::ctx == NULL) { glsl_type::ctx = talloc_init("glsl_type"); diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 4bec318167..bae8cdb233 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -388,6 +388,7 @@ struct glsl_type { return is_array() ? length : -1; } +private: /** * talloc context for all glsl_type allocations * @@ -395,7 +396,8 @@ struct glsl_type { */ static TALLOC_CTX *ctx; -private: + void init_talloc_type_ctx(void); + /** Constructor for vector and matrix types */ glsl_type(GLenum gl_type, unsigned base_type, unsigned vector_elements, -- cgit v1.2.3 From 7ffe40532f6b22d9b80caeac0fc3b9495619186a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Aug 2010 11:46:22 -0700 Subject: glsl2: Clean-up two 'unused variable' warnings --- src/glsl/ir_validate.cpp | 2 ++ src/glsl/main.cpp | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index f9f781b36a..712e1376fa 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -336,6 +336,8 @@ ir_validate::validate_ir(ir_instruction *ir, void *data) void check_node_type(ir_instruction *ir, void *data) { + (void) data; + if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) { printf("Instruction node with unset type\n"); ir->print(); printf("\n"); diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index d557dcc493..bc7292d155 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -45,6 +45,9 @@ struct gl_shader * _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) { struct gl_shader *shader; + + (void) ctx; + assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); shader = talloc_zero(NULL, struct gl_shader); if (shader) { -- cgit v1.2.3 From 42f3e7b6d7b42218feafe85a2328d8ce86fcce93 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Aug 2010 13:41:04 -0700 Subject: glsl_type: Use string key for array type hash --- src/glsl/glsl_types.cpp | 49 ++++++++++++------------------------------------- src/glsl/glsl_types.h | 3 --- 2 files changed, 12 insertions(+), 40 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index d8e291c881..40a5b6c482 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -384,53 +384,28 @@ glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns) } -int -glsl_type::array_key_compare(const void *a, const void *b) -{ - const glsl_type *const key1 = (glsl_type *) a; - const glsl_type *const key2 = (glsl_type *) b; - - /* Return zero is the types match (there is zero difference) or non-zero - * otherwise. - */ - return ((key1->fields.array == key2->fields.array) - && (key1->length == key2->length)) ? 0 : 1; -} - - -unsigned -glsl_type::array_key_hash(const void *a) -{ - const glsl_type *const key = (glsl_type *) a; - - const struct { - const glsl_type *t; - unsigned l; - char nul; - } hash_key = { - key->fields.array, - key->length, - '\0' - }; - - return hash_table_string_hash(& hash_key); -} - - const glsl_type * glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) { - const glsl_type key(base, array_size); if (array_types == NULL) { - array_types = hash_table_ctor(64, array_key_hash, array_key_compare); + array_types = hash_table_ctor(64, hash_table_string_hash, + hash_table_string_compare); } - const glsl_type *t = (glsl_type *) hash_table_find(array_types, & key); + /* Generate a name using the base type pointer in the key. This is + * done because the name of the base type may not be unique across + * shaders. For example, two shaders may have different record types + * named 'foo'. + */ + char key[128]; + snprintf(key, sizeof(key), "%p[%u]", base, array_size); + + const glsl_type *t = (glsl_type *) hash_table_find(array_types, key); if (t == NULL) { t = new glsl_type(base, array_size); - hash_table_insert(array_types, (void *) t, t); + hash_table_insert(array_types, (void *) t, talloc_strdup(ctx, key)); } assert(t->base_type == GLSL_TYPE_ARRAY); diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index bae8cdb233..c3f81b82aa 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -418,9 +418,6 @@ private: /** Hash table containing the known array types. */ static struct hash_table *array_types; - static int array_key_compare(const void *a, const void *b); - static unsigned array_key_hash(const void *key); - /** Hash table containing the known record types. */ static struct hash_table *record_types; -- cgit v1.2.3 From 1575070bfeedbc7decb7e44ac81abaeec0497a07 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 2 Aug 2010 17:27:56 -0700 Subject: glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects. This is a zero-ing function, (like calloc), to avoid bugs due to accessing uninitialized values. Thanks to valgrind for noticing the use of uninitialized values. --- src/glsl/ast.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1de285bb46..7ce879bb79 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -42,7 +42,7 @@ public: { void *node; - node = talloc_size(ctx, size); + node = talloc_zero_size(ctx, size); assert(node != NULL); return node; -- cgit v1.2.3 From 5704ed27dd2ebc88639cbd32ac971939ef3c267a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 15:31:28 -0700 Subject: glsl2: Don't consider uniform initializers as constant expressions. We were happily optimizing away the body of glsl-uniform-initializer-* to never use the uniforms. --- src/glsl/ir_constant_expression.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index f02cd3127e..915d362b15 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -674,6 +674,12 @@ ir_dereference_variable::constant_expression_value() if (!var) return NULL; + /* The constant_value of a uniform variable is its initializer, + * not the lifetime constant value of the uniform. + */ + if (var->mode == ir_var_uniform) + return NULL; + return var->constant_value ? var->constant_value->clone(NULL) : NULL; } -- cgit v1.2.3 From c8babd5d9bba75c9f38f384f9cb3587e3543cc28 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Aug 2010 17:49:01 -0700 Subject: glsl2: Fix typo in clamp() constant builtin using uint instead of int. I take back the bad things I've said about the signed/unsigned comparison warning now. --- src/glsl/ir_constant_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 915d362b15..06bea2bef6 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -856,7 +856,7 @@ ir_call::constant_expression_value() break; case GLSL_TYPE_INT: data.i[c] = CLAMP(op[0]->value.i[c], op[1]->value.i[c1], - op[2]->value.u[c2]); + op[2]->value.i[c2]); break; case GLSL_TYPE_FLOAT: data.f[c] = CLAMP(op[0]->value.f[c], op[1]->value.f[c1], -- cgit v1.2.3 From 900ab2f564018856133c19b68713a6dfd206c184 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Aug 2010 11:40:26 -0700 Subject: glsl2: No need to strdup the name passed in to ir_variable constructor. ir_variable always strdups the incoming name so that it matches the lifetime of the ir_variable. --- src/glsl/ast_function.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index bbc3bc1a59..661f8f6160 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -554,9 +554,7 @@ emit_inline_vector_constructor(const glsl_type *type, { assert(!parameters->is_empty()); - ir_variable *var = new(ctx) ir_variable(type, - talloc_strdup(ctx, "vec_ctor"), - ir_var_temporary); + ir_variable *var = new(ctx) ir_variable(type, "vec_ctor", ir_var_temporary); instructions->push_tail(var); /* There are two kinds of vector constructors. @@ -667,9 +665,7 @@ emit_inline_matrix_constructor(const glsl_type *type, { assert(!parameters->is_empty()); - ir_variable *var = new(ctx) ir_variable(type, - talloc_strdup(ctx, "mat_ctor"), - ir_var_temporary); + ir_variable *var = new(ctx) ir_variable(type, "mat_ctor", ir_var_temporary); instructions->push_tail(var); /* There are three kinds of matrix constructors. @@ -692,8 +688,7 @@ emit_inline_matrix_constructor(const glsl_type *type, * components with zero. */ ir_variable *rhs_var = - new(ctx) ir_variable(glsl_type::vec4_type, - talloc_strdup(ctx, "mat_ctor_vec"), + new(ctx) ir_variable(glsl_type::vec4_type, "mat_ctor_vec", ir_var_temporary); instructions->push_tail(rhs_var); @@ -807,8 +802,7 @@ emit_inline_matrix_constructor(const glsl_type *type, * generate a temporary and copy the paramter there. */ ir_variable *const rhs_var = - new(ctx) ir_variable(first_param->type, - talloc_strdup(ctx, "mat_ctor_mat"), + new(ctx) ir_variable(first_param->type, "mat_ctor_mat", ir_var_temporary); instructions->push_tail(rhs_var); @@ -874,9 +868,7 @@ emit_inline_matrix_constructor(const glsl_type *type, * generate a temporary and copy the paramter there. */ ir_variable *rhs_var = - new(ctx) ir_variable(rhs->type, - talloc_strdup(ctx, "mat_ctor_vec"), - ir_var_temporary); + new(ctx) ir_variable(rhs->type, "mat_ctor_vec", ir_var_temporary); instructions->push_tail(rhs_var); ir_dereference *rhs_var_ref = -- cgit v1.2.3 From c22dee721695402d9f2678c100d2fff5c0c3f21f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Aug 2010 11:43:25 -0700 Subject: glsl2: Fix ir_validate validating null variable names. An unnamed variable in a prototype will have a NULL ->name, so don't worry about storage then. Fixes: CorrectFunction1.vert CorrectParse1.frag --- src/glsl/ir_validate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 712e1376fa..89bcd1c481 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -313,7 +313,8 @@ ir_validate::visit(ir_variable *ir) * in the ir_dereference_variable handler to ensure that a variable is * declared before it is dereferenced. */ - assert(talloc_parent(ir->name) == ir); + if (ir->name) + assert(talloc_parent(ir->name) == ir); hash_table_insert(ht, ir, ir); return visit_continue; -- cgit v1.2.3 From 84ee01f40acf88185484df386b7715034e7685c9 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 4 Aug 2010 16:31:04 +0200 Subject: glsl2: Set ir_discard::ir_type when cloning it Fixes unset ir_type after inlining. --- src/glsl/ir.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index bee9f6a2de..f88a243cc0 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -889,6 +889,7 @@ public: ir_discard(ir_rvalue *cond) { + this->ir_type = ir_type_discard; this->condition = cond; } -- cgit v1.2.3 From 8273bd46877e2ea2b8a02b87a11c68102d07e1f2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 12:34:56 -0700 Subject: glsl2: Make the clone() method take a talloc context. In most cases, we needed to be reparenting the cloned IR to a different context (for example, to the linked shader instead of the unlinked shader), or optimization before the reparent would cause memory usage of the original object to grow and grow. --- src/glsl/ast_to_hir.cpp | 10 +-- src/glsl/ir.h | 47 +++++----- src/glsl/ir_clone.cpp | 150 ++++++++++++++----------------- src/glsl/ir_constant_expression.cpp | 7 +- src/glsl/ir_function_inlining.cpp | 6 +- src/glsl/ir_import_prototypes.cpp | 2 +- src/glsl/ir_vec_index_to_cond_assign.cpp | 8 +- src/glsl/link_functions.cpp | 6 +- src/glsl/linker.cpp | 25 +++--- 9 files changed, 130 insertions(+), 131 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 3522f55aac..b65a323a8d 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -966,7 +966,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - op[0]->clone(NULL), temp_rhs, + op[0]->clone(ctx, NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = (op[0]->type->is_error()); @@ -992,7 +992,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - op[0]->clone(NULL), temp_rhs, + op[0]->clone(ctx, NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = type->is_error(); @@ -1113,7 +1113,7 @@ ast_expression::hir(exec_list *instructions, op[0], op[1]); result = do_assignment(instructions, state, - op[0]->clone(NULL), temp_rhs, + op[0]->clone(ctx, NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; error_emitted = op[0]->type->is_error(); @@ -1139,10 +1139,10 @@ ast_expression::hir(exec_list *instructions, /* 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(NULL)); + result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL)); (void)do_assignment(instructions, state, - op[0]->clone(NULL), temp_rhs, + op[0]->clone(ctx, NULL), temp_rhs, this->subexpressions[0]->get_location()); type = result->type; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index f88a243cc0..f964b36083 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -76,7 +76,8 @@ public: virtual void accept(ir_visitor *) = 0; virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0; - virtual ir_instruction *clone(struct hash_table *ht) const = 0; + virtual ir_instruction *clone(void *mem_ctx, + struct hash_table *ht) const = 0; /** * \name IR instruction downcast functions @@ -113,7 +114,7 @@ protected: class ir_rvalue : public ir_instruction { public: - virtual ir_rvalue *clone(struct hash_table *) const = 0; + virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const = 0; virtual ir_constant *constant_expression_value() = 0; @@ -175,7 +176,7 @@ class ir_variable : public ir_instruction { public: ir_variable(const struct glsl_type *, const char *, ir_variable_mode); - virtual ir_variable *clone(struct hash_table *ht) const; + virtual ir_variable *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_variable *as_variable() { @@ -283,7 +284,8 @@ class ir_function_signature : public ir_instruction { public: ir_function_signature(const glsl_type *return_type); - virtual ir_function_signature *clone(struct hash_table *ht) const; + virtual ir_function_signature *clone(void *mem_ctx, + struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -369,7 +371,7 @@ class ir_function : public ir_instruction { public: ir_function(const char *name); - virtual ir_function *clone(struct hash_table *ht) const; + virtual ir_function *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_function *as_function() { @@ -439,7 +441,7 @@ public: ir_type = ir_type_if; } - virtual ir_if *clone(struct hash_table *ht) const; + virtual ir_if *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_if *as_if() { @@ -471,7 +473,7 @@ public: ir_type = ir_type_loop; } - virtual ir_loop *clone(struct hash_table *ht) const; + virtual ir_loop *clone(void *mem_ctx, struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -512,7 +514,7 @@ class ir_assignment : public ir_instruction { public: ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); - virtual ir_assignment *clone(struct hash_table *ht) const; + virtual ir_assignment *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_constant *constant_expression_value(); @@ -662,7 +664,7 @@ public: return this; } - virtual ir_expression *clone(struct hash_table *ht) const; + virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_constant *constant_expression_value(); @@ -708,7 +710,7 @@ public: actual_parameters->move_nodes_to(& this->actual_parameters); } - virtual ir_call *clone(struct hash_table *ht) const; + virtual ir_call *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_constant *constant_expression_value(); @@ -805,7 +807,7 @@ public: this->ir_type = ir_type_return; } - virtual ir_return *clone(struct hash_table *) const; + virtual ir_return *clone(void *mem_ctx, struct hash_table *) const; virtual ir_return *as_return() { @@ -850,7 +852,7 @@ public: this->loop = loop; } - virtual ir_loop_jump *clone(struct hash_table *) const; + virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const; virtual void accept(ir_visitor *v) { @@ -893,7 +895,7 @@ public: this->condition = cond; } - virtual ir_discard *clone(struct hash_table *ht) const; + virtual ir_discard *clone(void *mem_ctx, struct hash_table *ht) const; virtual void accept(ir_visitor *v) { @@ -945,7 +947,7 @@ public: this->ir_type = ir_type_texture; } - virtual ir_texture *clone(struct hash_table *) const; + virtual ir_texture *clone(void *mem_ctx, struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1037,7 +1039,7 @@ public: ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask); - virtual ir_swizzle *clone(struct hash_table *) const; + virtual ir_swizzle *clone(void *mem_ctx, struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1083,7 +1085,7 @@ private: class ir_dereference : public ir_rvalue { public: - virtual ir_dereference *clone(struct hash_table *) const = 0; + virtual ir_dereference *clone(void *mem_ctx, struct hash_table *) const = 0; virtual ir_dereference *as_dereference() { @@ -1103,7 +1105,8 @@ class ir_dereference_variable : public ir_dereference { public: ir_dereference_variable(ir_variable *var); - virtual ir_dereference_variable *clone(struct hash_table *) const; + virtual ir_dereference_variable *clone(void *mem_ctx, + struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1151,7 +1154,8 @@ public: ir_dereference_array(ir_variable *var, ir_rvalue *array_index); - virtual ir_dereference_array *clone(struct hash_table *) const; + virtual ir_dereference_array *clone(void *mem_ctx, + struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1189,7 +1193,8 @@ public: ir_dereference_record(ir_variable *var, const char *field); - virtual ir_dereference_record *clone(struct hash_table *) const; + virtual ir_dereference_record *clone(void *mem_ctx, + struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1254,7 +1259,7 @@ public: */ static ir_constant *zero(void *mem_ctx, const glsl_type *type); - virtual ir_constant *clone(struct hash_table *) const; + virtual ir_constant *clone(void *mem_ctx, struct hash_table *) const; virtual ir_constant *constant_expression_value(); @@ -1327,7 +1332,7 @@ void validate_ir_tree(exec_list *instructions); * \param out List to hold the cloned instructions */ void -clone_ir_list(exec_list *out, const exec_list *in); +clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in); extern void _mesa_glsl_initialize_variables(exec_list *instructions, diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 5ea3a79afc..59831834bd 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -36,11 +36,10 @@ extern "C" { * eventually. */ ir_variable * -ir_variable::clone(struct hash_table *ht) const +ir_variable::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - ir_variable *var = new(ctx) ir_variable(this->type, this->name, - (ir_variable_mode) this->mode); + ir_variable *var = new(mem_ctx) ir_variable(this->type, this->name, + (ir_variable_mode) this->mode); var->max_array_access = this->max_array_access; var->read_only = this->read_only; @@ -56,7 +55,7 @@ ir_variable::clone(struct hash_table *ht) const var->pixel_center_integer = this->pixel_center_integer; if (this->constant_value) - var->constant_value = this->constant_value->clone(ht); + var->constant_value = this->constant_value->clone(mem_ctx, ht); if (ht) { hash_table_insert(ht, var, (void *)const_cast(this)); @@ -66,118 +65,109 @@ ir_variable::clone(struct hash_table *ht) const } ir_swizzle * -ir_swizzle::clone(struct hash_table *ht) const +ir_swizzle::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - return new(ctx) ir_swizzle(this->val->clone(ht), this->mask); + return new(mem_ctx) ir_swizzle(this->val->clone(mem_ctx, ht), this->mask); } ir_return * -ir_return::clone(struct hash_table *ht) const +ir_return::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); ir_rvalue *new_value = NULL; if (this->value) - new_value = this->value->clone(ht); + new_value = this->value->clone(mem_ctx, ht); - return new(ctx) ir_return(new_value); + return new(mem_ctx) ir_return(new_value); } ir_discard * -ir_discard::clone(struct hash_table *ht) const +ir_discard::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); ir_rvalue *new_condition = NULL; if (this->condition != NULL) - new_condition = this->condition->clone(ht); + new_condition = this->condition->clone(mem_ctx, ht); - return new(ctx) ir_discard(new_condition); + return new(mem_ctx) ir_discard(new_condition); } ir_loop_jump * -ir_loop_jump::clone(struct hash_table *ht) const +ir_loop_jump::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); (void)ht; - return new(ctx) ir_loop_jump(this->mode); + return new(mem_ctx) ir_loop_jump(this->mode); } ir_if * -ir_if::clone(struct hash_table *ht) const +ir_if::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - ir_if *new_if = new(ctx) ir_if(this->condition->clone(ht)); + ir_if *new_if = new(mem_ctx) ir_if(this->condition->clone(mem_ctx, ht)); foreach_iter(exec_list_iterator, iter, this->then_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - new_if->then_instructions.push_tail(ir->clone(ht)); + new_if->then_instructions.push_tail(ir->clone(mem_ctx, ht)); } foreach_iter(exec_list_iterator, iter, this->else_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - new_if->else_instructions.push_tail(ir->clone(ht)); + new_if->else_instructions.push_tail(ir->clone(mem_ctx, ht)); } return new_if; } ir_loop * -ir_loop::clone(struct hash_table *ht) const +ir_loop::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - ir_loop *new_loop = new(ctx) ir_loop(); + ir_loop *new_loop = new(mem_ctx) ir_loop(); if (this->from) - new_loop->from = this->from->clone(ht); + new_loop->from = this->from->clone(mem_ctx, ht); if (this->to) - new_loop->to = this->to->clone(ht); + new_loop->to = this->to->clone(mem_ctx, ht); if (this->increment) - new_loop->increment = this->increment->clone(ht); + new_loop->increment = this->increment->clone(mem_ctx, ht); new_loop->counter = counter; foreach_iter(exec_list_iterator, iter, this->body_instructions) { ir_instruction *ir = (ir_instruction *)iter.get(); - new_loop->body_instructions.push_tail(ir->clone(ht)); + new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht)); } return new_loop; } ir_call * -ir_call::clone(struct hash_table *ht) const +ir_call::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); exec_list new_parameters; foreach_iter(exec_list_iterator, iter, this->actual_parameters) { ir_instruction *ir = (ir_instruction *)iter.get(); - new_parameters.push_tail(ir->clone(ht)); + new_parameters.push_tail(ir->clone(mem_ctx, ht)); } - return new(ctx) ir_call(this->callee, &new_parameters); + return new(mem_ctx) ir_call(this->callee, &new_parameters); } ir_expression * -ir_expression::clone(struct hash_table *ht) const +ir_expression::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); ir_rvalue *op[2] = {NULL, NULL}; unsigned int i; for (i = 0; i < get_num_operands(); i++) { - op[i] = this->operands[i]->clone(ht); + op[i] = this->operands[i]->clone(mem_ctx, ht); } - return new(ctx) ir_expression(this->operation, this->type, op[0], op[1]); + return new(mem_ctx) ir_expression(this->operation, this->type, op[0], op[1]); } ir_dereference_variable * -ir_dereference_variable::clone(struct hash_table *ht) const +ir_dereference_variable::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); ir_variable *new_var; if (ht) { @@ -188,38 +178,36 @@ ir_dereference_variable::clone(struct hash_table *ht) const new_var = this->var; } - return new(ctx) ir_dereference_variable(new_var); + return new(mem_ctx) ir_dereference_variable(new_var); } ir_dereference_array * -ir_dereference_array::clone(struct hash_table *ht) const +ir_dereference_array::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - return new(ctx) ir_dereference_array(this->array->clone(ht), - this->array_index->clone(ht)); + return new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, ht), + this->array_index->clone(mem_ctx, + ht)); } ir_dereference_record * -ir_dereference_record::clone(struct hash_table *ht) const +ir_dereference_record::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - return new(ctx) ir_dereference_record(this->record->clone(ht), - this->field); + return new(mem_ctx) ir_dereference_record(this->record->clone(mem_ctx, ht), + this->field); } ir_texture * -ir_texture::clone(struct hash_table *ht) const +ir_texture::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); - ir_texture *new_tex = new(ctx) ir_texture(this->op); + ir_texture *new_tex = new(mem_ctx) ir_texture(this->op); new_tex->type = this->type; - new_tex->sampler = this->sampler->clone(ht); - new_tex->coordinate = this->coordinate->clone(ht); + new_tex->sampler = this->sampler->clone(mem_ctx, ht); + new_tex->coordinate = this->coordinate->clone(mem_ctx, ht); if (this->projector) - new_tex->projector = this->projector->clone(ht); + new_tex->projector = this->projector->clone(mem_ctx, ht); if (this->shadow_comparitor) { - new_tex->shadow_comparitor = this->shadow_comparitor->clone(ht); + new_tex->shadow_comparitor = this->shadow_comparitor->clone(mem_ctx, ht); } for (int i = 0; i < 3; i++) @@ -229,15 +217,15 @@ ir_texture::clone(struct hash_table *ht) const case ir_tex: break; case ir_txb: - new_tex->lod_info.bias = this->lod_info.bias->clone(ht); + new_tex->lod_info.bias = this->lod_info.bias->clone(mem_ctx, ht); break; case ir_txl: case ir_txf: - new_tex->lod_info.lod = this->lod_info.lod->clone(ht); + new_tex->lod_info.lod = this->lod_info.lod->clone(mem_ctx, ht); break; case ir_txd: - new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(ht); - new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(ht); + new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(mem_ctx, ht); + new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(mem_ctx, ht); break; } @@ -245,30 +233,28 @@ ir_texture::clone(struct hash_table *ht) const } ir_assignment * -ir_assignment::clone(struct hash_table *ht) const +ir_assignment::clone(void *mem_ctx, struct hash_table *ht) const { ir_rvalue *new_condition = NULL; if (this->condition) - new_condition = this->condition->clone(ht); + new_condition = this->condition->clone(mem_ctx, ht); - void *ctx = talloc_parent(this); - return new(ctx) ir_assignment(this->lhs->clone(ht), - this->rhs->clone(ht), - new_condition); + return new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht), + this->rhs->clone(mem_ctx, ht), + new_condition); } ir_function * -ir_function::clone(struct hash_table *ht) const +ir_function::clone(void *mem_ctx, struct hash_table *ht) const { - void *mem_ctx = talloc_parent(this); ir_function *copy = new(mem_ctx) ir_function(this->name); foreach_list_const(node, &this->signatures) { const ir_function_signature *const sig = (const ir_function_signature *const) node; - ir_function_signature *sig_copy = sig->clone(ht); + ir_function_signature *sig_copy = sig->clone(mem_ctx, ht); copy->add_signature(sig_copy); if (ht != NULL) @@ -280,9 +266,8 @@ ir_function::clone(struct hash_table *ht) const } ir_function_signature * -ir_function_signature::clone(struct hash_table *ht) const +ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const { - void *mem_ctx = talloc_parent(this); ir_function_signature *copy = new(mem_ctx) ir_function_signature(this->return_type); @@ -296,7 +281,7 @@ ir_function_signature::clone(struct hash_table *ht) const assert(const_cast(param)->as_variable() != NULL); - ir_variable *const param_copy = param->clone(ht); + ir_variable *const param_copy = param->clone(mem_ctx, ht); copy->parameters.push_tail(param_copy); } @@ -305,7 +290,7 @@ ir_function_signature::clone(struct hash_table *ht) const foreach_list_const(node, &this->body) { const ir_instruction *const inst = (const ir_instruction *) node; - ir_instruction *const inst_copy = inst->clone(ht); + ir_instruction *const inst_copy = inst->clone(mem_ctx, ht); copy->body.push_tail(inst_copy); } @@ -313,9 +298,8 @@ ir_function_signature::clone(struct hash_table *ht) const } ir_constant * -ir_constant::clone(struct hash_table *ht) const +ir_constant::clone(void *mem_ctx, struct hash_table *ht) const { - void *ctx = talloc_parent(this); (void)ht; switch (this->type->base_type) { @@ -323,10 +307,10 @@ ir_constant::clone(struct hash_table *ht) const case GLSL_TYPE_INT: case GLSL_TYPE_FLOAT: case GLSL_TYPE_BOOL: - return new(ctx) ir_constant(this->type, &this->value); + return new(mem_ctx) ir_constant(this->type, &this->value); case GLSL_TYPE_STRUCT: { - ir_constant *c = new(ctx) ir_constant; + ir_constant *c = new(mem_ctx) ir_constant; c->type = this->type; for (exec_node *node = this->components.head @@ -334,19 +318,19 @@ ir_constant::clone(struct hash_table *ht) const ; node = node->next) { ir_constant *const orig = (ir_constant *) node; - c->components.push_tail(orig->clone(NULL)); + c->components.push_tail(orig->clone(mem_ctx, NULL)); } return c; } case GLSL_TYPE_ARRAY: { - ir_constant *c = new(ctx) ir_constant; + ir_constant *c = new(mem_ctx) ir_constant; c->type = this->type; c->array_elements = talloc_array(c, ir_constant *, this->type->length); for (unsigned i = 0; i < this->type->length; i++) { - c->array_elements[i] = this->array_elements[i]->clone(NULL); + c->array_elements[i] = this->array_elements[i]->clone(mem_ctx, NULL); } return c; } @@ -395,14 +379,14 @@ fixup_function_calls(struct hash_table *ht, exec_list *instructions) void -clone_ir_list(exec_list *out, const exec_list *in) +clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) { struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); foreach_list_const(node, in) { const ir_instruction *const original = (ir_instruction *) node; - ir_instruction *copy = original->clone(ht); + ir_instruction *copy = original->clone(mem_ctx, ht); out->push_tail(copy); } diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 06bea2bef6..677353e542 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -680,7 +680,10 @@ ir_dereference_variable::constant_expression_value() if (var->mode == ir_var_uniform) return NULL; - return var->constant_value ? var->constant_value->clone(NULL) : NULL; + if (!var->constant_value) + return NULL; + + return var->constant_value->clone(talloc_parent(var), NULL); } @@ -732,7 +735,7 @@ ir_dereference_array::constant_expression_value() return new(ctx) ir_constant(array, component); } else { const unsigned index = idx->value.u[0]; - return array->get_array_element(index)->clone(NULL); + return array->get_array_element(index)->clone(ctx, NULL); } } return NULL; diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 9599306243..973813774e 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -147,7 +147,7 @@ ir_call::generate_inline(ir_instruction *next_ir) parameters[i] = NULL; hash_table_insert(ht, param->variable_referenced(), sig_param); } else { - parameters[i] = sig_param->clone(ht); + parameters[i] = sig_param->clone(ctx, ht); parameters[i]->mode = ir_var_auto; next_ir->insert_before(parameters[i]); } @@ -169,7 +169,7 @@ ir_call::generate_inline(ir_instruction *next_ir) /* Generate the inlined body of the function. */ foreach_iter(exec_list_iterator, iter, callee->body) { ir_instruction *ir = (ir_instruction *)iter.get(); - ir_instruction *new_ir = ir->clone(ht); + ir_instruction *new_ir = ir->clone(ctx, ht); next_ir->insert_before(new_ir); visit_tree(new_ir, replace_return_with_assignment, retval); @@ -190,7 +190,7 @@ ir_call::generate_inline(ir_instruction *next_ir) sig_param->mode == ir_var_inout)) { ir_assignment *assign; - assign = new(ctx) ir_assignment(param->clone(NULL)->as_rvalue(), + assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(), new(ctx) ir_dereference_variable(parameters[i]), NULL); next_ir->insert_before(assign); diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index 5c5dc00ad7..e553e12a49 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/src/glsl/ir_import_prototypes.cpp @@ -95,7 +95,7 @@ public: assert(const_cast(param)->as_variable() != NULL); - ir_variable *const param_copy = param->clone(NULL); + ir_variable *const param_copy = param->clone(mem_ctx, NULL); copy->parameters.push_tail(param_copy); } diff --git a/src/glsl/ir_vec_index_to_cond_assign.cpp b/src/glsl/ir_vec_index_to_cond_assign.cpp index dbc6f9ada8..cd8dedf2fe 100644 --- a/src/glsl/ir_vec_index_to_cond_assign.cpp +++ b/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -82,6 +82,8 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue orig_deref->array->type->is_array()) return ir; + void *mem_ctx = talloc_parent(ir); + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); /* Store the index to a temporary to avoid reusing its tree. */ @@ -109,7 +111,7 @@ ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue /* Just clone the rest of the deref chain when trying to get at the * underlying variable. */ - swizzle = new(base_ir) ir_swizzle(orig_deref->array->clone(NULL), + swizzle = new(base_ir) ir_swizzle(orig_deref->array->clone(mem_ctx, NULL), i, 0, 0, 0, 1); deref = new(base_ir) ir_dereference_variable(var); @@ -165,6 +167,8 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) orig_deref->array->type->is_array()) return visit_continue; + void *mem_ctx = talloc_parent(ir); + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); /* Store the index to a temporary to avoid reusing its tree. */ @@ -196,7 +200,7 @@ ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) /* Just clone the rest of the deref chain when trying to get at the * underlying variable. */ - swizzle = new(ir) ir_swizzle(orig_deref->array->clone(NULL), + swizzle = new(ir) ir_swizzle(orig_deref->array->clone(mem_ctx, NULL), i, 0, 0, 0, 1); deref = new(ir) ir_dereference_variable(var); diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index fdf886f662..dfda05fcbe 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -143,7 +143,7 @@ public: const ir_instruction *const original = (ir_instruction *) node; assert(const_cast(original)->as_variable()); - ir_instruction *copy = original->clone(ht); + ir_instruction *copy = original->clone(linked, ht); formal_parameters.push_tail(copy); } @@ -152,7 +152,7 @@ public: foreach_list_const(node, &sig->body) { const ir_instruction *const original = (ir_instruction *) node; - ir_instruction *copy = original->clone(ht); + ir_instruction *copy = original->clone(linked, ht); linked_sig->body.push_tail(copy); } @@ -182,7 +182,7 @@ public: /* Clone the ir_variable that the dereference already has and add * it to the linked shader. */ - var = ir->var->clone(NULL); + var = ir->var->clone(linked, NULL); linked->symbols->add_variable(var->name, var); linked->ir->push_head(var); } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index a5faff2be7..65f3697d35 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -323,7 +323,8 @@ cross_validate_globals(struct gl_shader_program *prog, * FINISHME: modify the shader, and linking with the second * FINISHME: will fail. */ - existing->constant_value = var->constant_value->clone(NULL); + existing->constant_value = + var->constant_value->clone(talloc_parent(existing), NULL); } } else variables.add_variable(var->name, var); @@ -488,16 +489,17 @@ populate_symbol_table(gl_shader *sh) * should be added. */ void -remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, - exec_list *instructions, hash_table *temps) +remap_variables(ir_instruction *inst, struct gl_shader *target, + hash_table *temps) { class remap_visitor : public ir_hierarchical_visitor { public: - remap_visitor(glsl_symbol_table *symbols, exec_list *instructions, + remap_visitor(struct gl_shader *target, hash_table *temps) { - this->symbols = symbols; - this->instructions = instructions; + this->target = target; + this->symbols = target->symbols; + this->instructions = target->ir; this->temps = temps; } @@ -516,7 +518,7 @@ remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, if (existing != NULL) ir->var = existing; else { - ir_variable *copy = ir->var->clone(NULL); + ir_variable *copy = ir->var->clone(this->target, NULL); this->symbols->add_variable(copy->name, copy); this->instructions->push_head(copy); @@ -527,12 +529,13 @@ remap_variables(ir_instruction *inst, glsl_symbol_table *symbols, } private: + struct gl_shader *target; glsl_symbol_table *symbols; exec_list *instructions; hash_table *temps; }; - remap_visitor v(symbols, instructions, temps); + remap_visitor v(target, temps); inst->accept(&v); } @@ -583,12 +586,12 @@ move_non_declarations(exec_list *instructions, exec_node *last, || ((var != NULL) && (var->mode == ir_var_temporary))); if (make_copies) { - inst = inst->clone(NULL); + inst = inst->clone(target, NULL); if (var != NULL) hash_table_insert(temps, inst, var); else - remap_variables(inst, target->symbols, target->ir, temps); + remap_variables(inst, target, temps); } else { inst->remove(); } @@ -713,7 +716,7 @@ link_intrastage_shaders(struct gl_shader_program *prog, gl_shader *const linked = _mesa_new_shader(NULL, 0, main->Type); linked->ir = new(linked) exec_list; - clone_ir_list(linked->ir, main->ir); + clone_ir_list(linked, linked->ir, main->ir); populate_symbol_table(linked); -- cgit v1.2.3 From 952d0f88e1741d51b641be75f7c5a6565e245a69 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 12:57:58 -0700 Subject: glsl2: Skip talloc_parent in constant_expression of non-constant arrays. --- src/glsl/ir_constant_expression.cpp | 2 +- src/mesa/program/ir_to_mesa.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 677353e542..0a924246da 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -690,11 +690,11 @@ ir_dereference_variable::constant_expression_value() ir_constant * ir_dereference_array::constant_expression_value() { - void *ctx = talloc_parent(this); ir_constant *array = this->array->constant_expression_value(); ir_constant *idx = this->array_index->constant_expression_value(); if ((array != NULL) && (idx != NULL)) { + void *ctx = talloc_parent(this); if (array->type->is_matrix()) { /* Array access of a matrix results in a vector. */ diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ba0934c446..dcf8c497c6 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2622,7 +2622,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; progress = do_if_return(shader->ir) || progress; - if (ctx->Shader.EmitNoIfs) + if (1 || ctx->Shader.EmitNoIfs) progress = do_if_to_cond_assign(shader->ir) || progress; progress = do_vec_index_to_swizzle(shader->ir) || progress; -- cgit v1.2.3 From b6ceddc371d026dc30f2cc0f377bc0214e11d768 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 14:26:15 -0700 Subject: glsl2: Don't try to assign locations for samplers during linking. Mesa will do the mapping at _mesa_add_sampler() time. Fixes assertion failures in debug builds, which might have caught real problems with multiple samplers linked in a row. --- src/glsl/linker.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 65f3697d35..10fd2d5ab9 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -793,6 +793,9 @@ assign_uniform_locations(struct gl_shader_program *prog) if ((var == NULL) || (var->mode != ir_var_uniform)) continue; + if (var->type->is_sampler()) + continue; + const unsigned vec4_slots = (var->component_slots() + 3) / 4; assert(vec4_slots != 0); -- cgit v1.2.3 From ea3a9eb53a3c9ed99998ead645e2b2e6a3261626 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 4 Aug 2010 17:11:32 +0200 Subject: glsl2: add gl_LightModel built-in uniform. --- src/glsl/builtin_variables.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h index 9551e1accf..2ec7d621bb 100644 --- a/src/glsl/builtin_variables.h +++ b/src/glsl/builtin_variables.h @@ -93,5 +93,6 @@ static const builtin_variable builtin_110_deprecated_uniforms[] = { { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, { ir_var_uniform, -1, "float", "gl_NormalScale" }, + { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, }; -- cgit v1.2.3 From ad98aa9d93646600cc95b3e45a40eec26f18988a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 3 Aug 2010 20:05:53 -0700 Subject: glsl2: Remove uses of deprecated TALLOC_CTX type. --- src/glsl/ast_function.cpp | 12 ++++++------ src/glsl/glsl_types.cpp | 26 +++++++++++++------------- src/glsl/glsl_types.h | 12 ++++++------ 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 661f8f6160..c22dfa81eb 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -629,20 +629,20 @@ emit_inline_vector_constructor(const glsl_type *type, ir_instruction * assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base, ir_rvalue *src, unsigned src_base, unsigned count, - TALLOC_CTX *ctx) + void *mem_ctx) { const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 }; - ir_constant *col_idx = new(ctx) ir_constant(column); - ir_rvalue *column_ref = new(ctx) ir_dereference_array(var, col_idx); + ir_constant *col_idx = new(mem_ctx) ir_constant(column); + ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx); assert(column_ref->type->components() >= (row_base + count)); - ir_rvalue *lhs = new(ctx) ir_swizzle(column_ref, &mask[row_base], count); + ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], count); assert(src->type->components() >= (src_base + count)); - ir_rvalue *rhs = new(ctx) ir_swizzle(src, &mask[src_base], count); + ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count); - return new(ctx) ir_assignment(lhs, rhs, NULL); + return new(mem_ctx) ir_assignment(lhs, rhs, NULL); } diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 40a5b6c482..88f305ac25 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -33,14 +33,14 @@ extern "C" { hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; -void *glsl_type::ctx = NULL; +void *glsl_type::mem_ctx = NULL; void glsl_type::init_talloc_type_ctx(void) { - if (glsl_type::ctx == NULL) { - glsl_type::ctx = talloc_init("glsl_type"); - assert(glsl_type::ctx != NULL); + if (glsl_type::mem_ctx == NULL) { + glsl_type::mem_ctx = talloc_init("glsl_type"); + assert(glsl_type::mem_ctx != NULL); } } @@ -55,7 +55,7 @@ glsl_type::glsl_type(GLenum gl_type, length(0) { init_talloc_type_ctx(); - this->name = talloc_strdup(this->ctx, name); + this->name = talloc_strdup(this->mem_ctx, name); /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); @@ -73,7 +73,7 @@ glsl_type::glsl_type(GLenum gl_type, length(0) { init_talloc_type_ctx(); - this->name = talloc_strdup(this->ctx, name); + this->name = talloc_strdup(this->mem_ctx, name); memset(& fields, 0, sizeof(fields)); } @@ -88,8 +88,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, unsigned int i; init_talloc_type_ctx(); - this->name = talloc_strdup(this->ctx, name); - this->fields.structure = talloc_array(this->ctx, + this->name = talloc_strdup(this->mem_ctx, name); + this->fields.structure = talloc_array(this->mem_ctx, glsl_struct_field, length); for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; @@ -228,9 +228,9 @@ _mesa_glsl_release_types(void) glsl_type::record_types = NULL; } - if (glsl_type::ctx != NULL) { - talloc_free(glsl_type::ctx); - glsl_type::ctx = NULL; + if (glsl_type::mem_ctx != NULL) { + talloc_free(glsl_type::mem_ctx); + glsl_type::mem_ctx = NULL; } } @@ -315,7 +315,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : * NUL. */ const unsigned name_length = strlen(array->name) + 10 + 3; - char *const n = (char *) talloc_size(this->ctx, name_length); + char *const n = (char *) talloc_size(this->mem_ctx, name_length); if (length == 0) snprintf(n, name_length, "%s[]", array->name); @@ -405,7 +405,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) if (t == NULL) { t = new glsl_type(base, array_size); - hash_table_insert(array_types, (void *) t, talloc_strdup(ctx, key)); + hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key)); } assert(t->base_type == GLSL_TYPE_ARRAY); diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index c3f81b82aa..97d0d98c62 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -76,17 +76,17 @@ struct glsl_type { */ /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + * easier to just talloc_free 'mem_ctx' (or any of its ancestors). */ static void* operator new(size_t size) { - if (glsl_type::ctx == NULL) { - glsl_type::ctx = talloc_init("glsl_type"); - assert(glsl_type::ctx != NULL); + if (glsl_type::mem_ctx == NULL) { + glsl_type::mem_ctx = talloc_init("glsl_type"); + assert(glsl_type::mem_ctx != NULL); } void *type; - type = talloc_size(glsl_type::ctx, size); + type = talloc_size(glsl_type::mem_ctx, size); assert(type != NULL); return type; @@ -394,7 +394,7 @@ private: * * Set on the first call to \c glsl_type::new. */ - static TALLOC_CTX *ctx; + static void *mem_ctx; void init_talloc_type_ctx(void); -- cgit v1.2.3 From 1ffc1cd86186ae5d03bb28a1e041c4a57761515e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 3 Aug 2010 20:21:52 -0700 Subject: glcpp: Remove xtalloc wrappers in favor of plain talloc. Calling exit() on a memory failure probably made sense for the standalone preprocessor, but doesn't seem too appealing as part of the GL library. Also, we don't use it in the main compiler. --- src/glsl/Makefile | 3 +- src/glsl/glcpp/Makefile.am | 3 +- src/glsl/glcpp/glcpp-lex.l | 14 +++---- src/glsl/glcpp/glcpp-parse.y | 38 ++++++++--------- src/glsl/glcpp/glcpp.h | 24 ----------- src/glsl/glcpp/xtalloc.c | 99 -------------------------------------------- 6 files changed, 28 insertions(+), 153 deletions(-) delete mode 100644 src/glsl/glcpp/xtalloc.c (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index f98b772a2f..3102947494 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -9,8 +9,7 @@ LIBNAME = glsl LIBGLCPP_SOURCES = \ glcpp/glcpp-lex.c \ glcpp/glcpp-parse.c \ - glcpp/pp.c \ - glcpp/xtalloc.c + glcpp/pp.c GLCPP_SOURCES = \ $(LIBGLCPP_SOURCES) \ diff --git a/src/glsl/glcpp/Makefile.am b/src/glsl/glcpp/Makefile.am index 00c6c5610e..81147e6e12 100644 --- a/src/glsl/glcpp/Makefile.am +++ b/src/glsl/glcpp/Makefile.am @@ -25,8 +25,7 @@ libglcpp_la_SOURCES = \ glcpp-lex.l \ glcpp-parse.y \ glcpp.h \ - pp.c \ - xtalloc.c + pp.c BUILT_SOURCES = glcpp-parse.h glcpp-parse.c glcpp-lex.c CLEANFILES = $(BUILT_SOURCES) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 17a097e633..1a0052d689 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -88,7 +88,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {HASH}(version) { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; yyextra->space_tokens = 0; @@ -98,7 +98,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? /* glcpp doesn't handle #extension, #version, or #pragma directives. * Simply pass them through to the main compiler's lexer/parser. */ {HASH}(extension|pragma)[^\n]+ { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; return OTHER; @@ -186,17 +186,17 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {DECIMAL_INTEGER} { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } {OCTAL_INTEGER} { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } {HEXADECIMAL_INTEGER} { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } @@ -241,7 +241,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {IDENTIFIER} { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; } @@ -250,7 +250,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? } {OTHER}+ { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return OTHER; } diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 855448ff20..55a8d1761e 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -503,7 +503,7 @@ _string_list_create (void *ctx) { string_list_t *list; - list = xtalloc (ctx, string_list_t); + list = talloc (ctx, string_list_t); list->head = NULL; list->tail = NULL; @@ -515,8 +515,8 @@ _string_list_append_item (string_list_t *list, const char *str) { string_node_t *node; - node = xtalloc (list, string_node_t); - node->str = xtalloc_strdup (node, str); + node = talloc (list, string_node_t); + node->str = talloc_strdup (node, str); node->next = NULL; @@ -569,7 +569,7 @@ _argument_list_create (void *ctx) { argument_list_t *list; - list = xtalloc (ctx, argument_list_t); + list = talloc (ctx, argument_list_t); list->head = NULL; list->tail = NULL; @@ -581,7 +581,7 @@ _argument_list_append (argument_list_t *list, token_list_t *argument) { argument_node_t *node; - node = xtalloc (list, argument_node_t); + node = talloc (list, argument_node_t); node->argument = argument; node->next = NULL; @@ -638,7 +638,7 @@ _token_create_str (void *ctx, int type, char *str) { token_t *token; - token = xtalloc (ctx, token_t); + token = talloc (ctx, token_t); token->type = type; token->value.str = talloc_steal (token, str); @@ -650,7 +650,7 @@ _token_create_ival (void *ctx, int type, int ival) { token_t *token; - token = xtalloc (ctx, token_t); + token = talloc (ctx, token_t); token->type = type; token->value.ival = ival; @@ -662,7 +662,7 @@ _token_list_create (void *ctx) { token_list_t *list; - list = xtalloc (ctx, token_list_t); + list = talloc (ctx, token_list_t); list->head = NULL; list->tail = NULL; list->non_space_tail = NULL; @@ -675,8 +675,8 @@ _token_list_append (token_list_t *list, token_t *token) { token_node_t *node; - node = xtalloc (list, token_node_t); - node->token = xtalloc_reference (list, token); + node = talloc (list, token_node_t); + node->token = talloc_reference (list, token); node->next = NULL; @@ -871,8 +871,8 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) { char *str; - str = xtalloc_asprintf (token, "%s%s", - token->value.str, other->value.str); + str = talloc_asprintf (token, "%s%s", token->value.str, + other->value.str); combined = _token_create_str (token, token->type, str); combined->location = token->location; return combined; @@ -927,7 +927,7 @@ glcpp_parser_create (const struct gl_extensions *extensions) glcpp_parser_t *parser; int language_version; - parser = xtalloc (NULL, glcpp_parser_t); + parser = talloc (NULL, glcpp_parser_t); glcpp_lex_init_extra (parser, &parser->scanner); parser->defines = hash_table_ctor (32, hash_table_string_hash, @@ -1294,7 +1294,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, token_list_t *expansion; token_t *final; - str = xtalloc_strdup (parser, token->value.str); + str = talloc_strdup (parser, token->value.str); final = _token_create_str (parser, OTHER, str); expansion = _token_list_create (parser); _token_list_append (expansion, final); @@ -1330,8 +1330,8 @@ _active_list_push (active_list_t *list, { active_list_t *node; - node = xtalloc (list, active_list_t); - node->identifier = xtalloc_strdup (node, identifier); + node = talloc (list, active_list_t); + node->identifier = talloc_strdup (node, identifier); node->marker = marker; node->next = list; @@ -1481,7 +1481,7 @@ _define_object_macro (glcpp_parser_t *parser, if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); - macro = xtalloc (parser, macro_t); + macro = talloc (parser, macro_t); macro->is_function = 0; macro->parameters = NULL; @@ -1502,7 +1502,7 @@ _define_function_macro (glcpp_parser_t *parser, _check_for_reserved_macro_name(parser, loc, identifier); - macro = xtalloc (parser, macro_t); + macro = talloc (parser, macro_t); macro->is_function = 1; macro->parameters = talloc_steal (macro, parameters); @@ -1628,7 +1628,7 @@ _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, if (parser->skip_stack) current = parser->skip_stack->type; - node = xtalloc (parser, skip_node_t); + node = talloc (parser, skip_node_t); node->loc = *loc; if (current == SKIP_NO_SKIP) { diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h index 0ccd957eda..0bebdb9ae8 100644 --- a/src/glsl/glcpp/glcpp.h +++ b/src/glsl/glcpp/glcpp.h @@ -219,28 +219,4 @@ glcpp_lex_destroy (yyscan_t scanner); int yyparse (glcpp_parser_t *parser); -/* xtalloc - wrappers around talloc to check for out-of-memory */ - -#define xtalloc(ctx, type) (type *)xtalloc_named_const(ctx, sizeof(type), #type) - -#define xtalloc_size(ctx, size) xtalloc_named_const(ctx, size, __location__) - -void * -xtalloc_named_const (const void *context, size_t size, const char *name); - -char * -xtalloc_strdup (const void *t, const char *p); - -char * -xtalloc_strndup (const void *t, const char *p, size_t n); - -char * -xtalloc_asprintf (const void *t, const char *fmt, ...); - -void * -_xtalloc_reference_loc (const void *context, - const void *ptr, const char *location); - -#define xtalloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_xtalloc_reference_loc((ctx),(ptr), __location__) - #endif diff --git a/src/glsl/glcpp/xtalloc.c b/src/glsl/glcpp/xtalloc.c deleted file mode 100644 index a20ea8b93f..0000000000 --- a/src/glsl/glcpp/xtalloc.c +++ /dev/null @@ -1,99 +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 "glcpp.h" - -void * -xtalloc_named_const (const void *context, size_t size, const char *name) -{ - void *ret; - - ret = talloc_named_const (context, size, name); - if (ret == NULL) { - fprintf (stderr, "Out of memory.\n"); - exit (1); - } - - return ret; -} - -char * -xtalloc_strdup (const void *t, const char *p) -{ - char *ret; - - ret = talloc_strdup (t, p); - if (ret == NULL) { - fprintf (stderr, "Out of memory.\n"); - exit (1); - } - - return ret; -} - -char * -xtalloc_strndup (const void *t, const char *p, size_t n) -{ - char *ret; - - ret = talloc_strndup (t, p, n); - if (ret == NULL) { - fprintf (stderr, "Out of memory.\n"); - exit (1); - } - - return ret; -} - -char * -xtalloc_asprintf (const void *t, const char *fmt, ...) -{ - va_list ap; - char *ret; - - va_start(ap, fmt); - - ret = talloc_vasprintf(t, fmt, ap); - if (ret == NULL) { - fprintf (stderr, "Out of memory.\n"); - exit (1); - } - - va_end(ap); - return ret; -} - -void * -_xtalloc_reference_loc (const void *context, - const void *ptr, const char *location) -{ - void *ret; - - ret = _talloc_reference_loc (context, ptr, location); - if (ret == NULL) { - fprintf (stderr, "Out of memory.\n"); - exit (1); - } - - return ret; -} -- cgit v1.2.3 From 0ef79a5f115659b3719a330d01a365e8ca8144c4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 3 Aug 2010 20:25:13 -0700 Subject: glcpp: Refresh autogenerated lexer and parser. --- src/glsl/glcpp/glcpp-lex.c | 44 +++----- src/glsl/glcpp/glcpp-parse.c | 252 ++++++++++++++++++++++--------------------- src/glsl/glcpp/glcpp-parse.h | 7 +- 3 files changed, 148 insertions(+), 155 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index 40db2c27c5..d976904135 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -691,7 +682,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 0; yycolumn = 0; -#line 695 "glcpp/glcpp-lex.c" +#line 686 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -846,12 +837,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -859,7 +845,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -870,7 +856,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -962,7 +948,7 @@ YY_DECL /* Single-line comments */ -#line 966 "glcpp/glcpp-lex.c" +#line 952 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1133,7 +1119,7 @@ case 8: YY_RULE_SETUP #line 90 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; yyextra->space_tokens = 0; @@ -1146,7 +1132,7 @@ case 9: YY_RULE_SETUP #line 100 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); yylineno++; yycolumn = 0; return OTHER; @@ -1283,7 +1269,7 @@ case 22: YY_RULE_SETUP #line 188 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1291,7 +1277,7 @@ case 23: YY_RULE_SETUP #line 193 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1299,7 +1285,7 @@ case 24: YY_RULE_SETUP #line 198 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; } YY_BREAK @@ -1377,7 +1363,7 @@ case 35: YY_RULE_SETUP #line 243 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; } YY_BREAK @@ -1392,7 +1378,7 @@ case 37: YY_RULE_SETUP #line 252 "glcpp/glcpp-lex.l" { - yylval->str = xtalloc_strdup (yyextra, yytext); + yylval->str = talloc_strdup (yyextra, yytext); return OTHER; } YY_BREAK @@ -1442,7 +1428,7 @@ YY_RULE_SETUP #line 286 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1446 "glcpp/glcpp-lex.c" +#line 1432 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -2181,8 +2167,8 @@ YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 9dc4bfb3ab..5ea07c2555 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -209,7 +208,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 213 "glcpp/glcpp-parse.c" +#line 212 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -297,7 +296,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 301 "glcpp/glcpp-parse.c" +#line 300 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -347,7 +346,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -934,9 +933,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -993,7 +1001,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1582,7 +1590,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1772,7 +1780,7 @@ yyreduce: { case 4: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 175 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); @@ -1781,7 +1789,7 @@ yyreduce: case 5: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 178 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); @@ -1792,7 +1800,7 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 188 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); @@ -1801,7 +1809,7 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 191 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); @@ -1810,7 +1818,7 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 197 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); @@ -1819,7 +1827,7 @@ yyreduce: case 11: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 200 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); @@ -1828,7 +1836,7 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 203 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); @@ -1837,7 +1845,7 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 206 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); @@ -1851,7 +1859,7 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 214 "glcpp/glcpp-parse.y" { token_list_t *expanded; @@ -1869,7 +1877,7 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 226 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1880,7 +1888,7 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 231 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1891,7 +1899,7 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 236 "glcpp/glcpp-parse.y" { token_list_t *expanded; @@ -1909,7 +1917,7 @@ yyreduce: case 18: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 248 "glcpp/glcpp-parse.y" { /* #elif without an expression results in a warning if the @@ -1926,7 +1934,7 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 259 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); @@ -1935,7 +1943,7 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 262 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); @@ -1944,7 +1952,7 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 265 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); @@ -1959,7 +1967,7 @@ yyreduce: case 23: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 278 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { @@ -1974,7 +1982,7 @@ yyreduce: case 24: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 287 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); @@ -1983,7 +1991,7 @@ yyreduce: case 26: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 293 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); @@ -1992,7 +2000,7 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 296 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); @@ -2001,7 +2009,7 @@ yyreduce: case 28: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 299 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); @@ -2010,7 +2018,7 @@ yyreduce: case 29: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 302 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); @@ -2019,7 +2027,7 @@ yyreduce: case 30: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 305 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); @@ -2028,7 +2036,7 @@ yyreduce: case 31: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 308 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); @@ -2037,7 +2045,7 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 311 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); @@ -2046,7 +2054,7 @@ yyreduce: case 33: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 314 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); @@ -2055,7 +2063,7 @@ yyreduce: case 34: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 317 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); @@ -2064,7 +2072,7 @@ yyreduce: case 35: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 320 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); @@ -2073,7 +2081,7 @@ yyreduce: case 36: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 323 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); @@ -2082,7 +2090,7 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 326 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); @@ -2091,7 +2099,7 @@ yyreduce: case 38: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 329 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); @@ -2100,7 +2108,7 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 332 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); @@ -2109,7 +2117,7 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 335 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); @@ -2118,7 +2126,7 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 338 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); @@ -2127,7 +2135,7 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 341 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); @@ -2136,7 +2144,7 @@ yyreduce: case 43: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 344 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); @@ -2145,7 +2153,7 @@ yyreduce: case 44: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 347 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); @@ -2154,7 +2162,7 @@ yyreduce: case 45: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 350 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); @@ -2163,7 +2171,7 @@ yyreduce: case 46: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 353 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); @@ -2172,7 +2180,7 @@ yyreduce: case 47: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 356 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); @@ -2181,7 +2189,7 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 359 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); @@ -2190,7 +2198,7 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 365 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); @@ -2201,7 +2209,7 @@ yyreduce: case 50: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 370 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); @@ -2212,14 +2220,14 @@ yyreduce: case 51: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 378 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 53: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 383 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); @@ -2228,14 +2236,14 @@ yyreduce: case 54: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 389 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 57: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 395 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); @@ -2244,7 +2252,7 @@ yyreduce: case 58: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 402 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; @@ -2254,7 +2262,7 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 406 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; @@ -2264,7 +2272,7 @@ yyreduce: case 61: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 415 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2276,7 +2284,7 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 421 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2287,7 +2295,7 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 429 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2299,7 +2307,7 @@ yyreduce: case 64: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 435 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2310,7 +2318,7 @@ yyreduce: case 65: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 443 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); @@ -2320,7 +2328,7 @@ yyreduce: case 66: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 447 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); @@ -2330,7 +2338,7 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 451 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); @@ -2340,7 +2348,7 @@ yyreduce: case 68: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 455 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); @@ -2350,7 +2358,7 @@ yyreduce: case 69: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 459 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); @@ -2360,225 +2368,225 @@ yyreduce: case 70: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 466 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 71: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 467 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 72: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 468 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 73: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 469 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 74: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 470 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 75: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 471 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 76: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 472 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 77: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 473 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 78: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 474 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 79: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 475 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 80: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 476 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 81: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 477 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 82: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 478 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 83: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 479 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 84: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 480 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 85: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 481 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 86: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 482 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 87: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 483 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 88: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 484 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 89: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 485 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 90: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 486 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 91: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 487 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 92: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 488 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 93: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 489 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 94: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 490 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 95: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 491 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 96: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 492 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 97: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 493 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 98: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 494 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 99: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 495 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 100: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 496 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1455 of yacc.c */ -#line 2582 "glcpp/glcpp-parse.c" +/* Line 1464 of yacc.c */ +#line 2590 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2796,7 +2804,7 @@ yyreturn: -/* Line 1675 of yacc.c */ +/* Line 1684 of yacc.c */ #line 499 "glcpp/glcpp-parse.y" @@ -2805,7 +2813,7 @@ _string_list_create (void *ctx) { string_list_t *list; - list = xtalloc (ctx, string_list_t); + list = talloc (ctx, string_list_t); list->head = NULL; list->tail = NULL; @@ -2817,8 +2825,8 @@ _string_list_append_item (string_list_t *list, const char *str) { string_node_t *node; - node = xtalloc (list, string_node_t); - node->str = xtalloc_strdup (node, str); + node = talloc (list, string_node_t); + node->str = talloc_strdup (node, str); node->next = NULL; @@ -2871,7 +2879,7 @@ _argument_list_create (void *ctx) { argument_list_t *list; - list = xtalloc (ctx, argument_list_t); + list = talloc (ctx, argument_list_t); list->head = NULL; list->tail = NULL; @@ -2883,7 +2891,7 @@ _argument_list_append (argument_list_t *list, token_list_t *argument) { argument_node_t *node; - node = xtalloc (list, argument_node_t); + node = talloc (list, argument_node_t); node->argument = argument; node->next = NULL; @@ -2940,7 +2948,7 @@ _token_create_str (void *ctx, int type, char *str) { token_t *token; - token = xtalloc (ctx, token_t); + token = talloc (ctx, token_t); token->type = type; token->value.str = talloc_steal (token, str); @@ -2952,7 +2960,7 @@ _token_create_ival (void *ctx, int type, int ival) { token_t *token; - token = xtalloc (ctx, token_t); + token = talloc (ctx, token_t); token->type = type; token->value.ival = ival; @@ -2964,7 +2972,7 @@ _token_list_create (void *ctx) { token_list_t *list; - list = xtalloc (ctx, token_list_t); + list = talloc (ctx, token_list_t); list->head = NULL; list->tail = NULL; list->non_space_tail = NULL; @@ -2977,8 +2985,8 @@ _token_list_append (token_list_t *list, token_t *token) { token_node_t *node; - node = xtalloc (list, token_node_t); - node->token = xtalloc_reference (list, token); + node = talloc (list, token_node_t); + node->token = talloc_reference (list, token); node->next = NULL; @@ -3173,8 +3181,8 @@ _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) { char *str; - str = xtalloc_asprintf (token, "%s%s", - token->value.str, other->value.str); + str = talloc_asprintf (token, "%s%s", token->value.str, + other->value.str); combined = _token_create_str (token, token->type, str); combined->location = token->location; return combined; @@ -3229,7 +3237,7 @@ glcpp_parser_create (const struct gl_extensions *extensions) glcpp_parser_t *parser; int language_version; - parser = xtalloc (NULL, glcpp_parser_t); + parser = talloc (NULL, glcpp_parser_t); glcpp_lex_init_extra (parser, &parser->scanner); parser->defines = hash_table_ctor (32, hash_table_string_hash, @@ -3596,7 +3604,7 @@ _glcpp_parser_expand_node (glcpp_parser_t *parser, token_list_t *expansion; token_t *final; - str = xtalloc_strdup (parser, token->value.str); + str = talloc_strdup (parser, token->value.str); final = _token_create_str (parser, OTHER, str); expansion = _token_list_create (parser); _token_list_append (expansion, final); @@ -3632,8 +3640,8 @@ _active_list_push (active_list_t *list, { active_list_t *node; - node = xtalloc (list, active_list_t); - node->identifier = xtalloc_strdup (node, identifier); + node = talloc (list, active_list_t); + node->identifier = talloc_strdup (node, identifier); node->marker = marker; node->next = list; @@ -3783,7 +3791,7 @@ _define_object_macro (glcpp_parser_t *parser, if (loc != NULL) _check_for_reserved_macro_name(parser, loc, identifier); - macro = xtalloc (parser, macro_t); + macro = talloc (parser, macro_t); macro->is_function = 0; macro->parameters = NULL; @@ -3804,7 +3812,7 @@ _define_function_macro (glcpp_parser_t *parser, _check_for_reserved_macro_name(parser, loc, identifier); - macro = xtalloc (parser, macro_t); + macro = talloc (parser, macro_t); macro->is_function = 1; macro->parameters = talloc_steal (macro, parameters); @@ -3930,7 +3938,7 @@ _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, if (parser->skip_stack) current = parser->skip_stack->type; - node = xtalloc (parser, skip_node_t); + node = talloc (parser, skip_node_t); node->loc = *loc; if (current == SKIP_NO_SKIP) { diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 50758930e9..53e7af0305 100644 --- a/src/glsl/glcpp/glcpp-parse.h +++ b/src/glsl/glcpp/glcpp-parse.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3 From 3d23f0a90c982ad43a6f18ef69a23b2fcdb1d1d2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 16:06:00 -0700 Subject: glsl2: Refactor constant folding of rvalues to a function. --- src/glsl/ir_constant_folding.cpp | 47 ++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 26 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 66a92e9f3b..492036e9a6 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -73,8 +73,24 @@ public: virtual void visit(ir_loop *); virtual void visit(ir_loop_jump *); /*@}*/ + + void fold_constant(ir_rvalue **rvalue); }; +void +ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue) +{ + if ((*rvalue)->ir_type == ir_type_constant) + return; + + ir_constant *constant = (*rvalue)->constant_expression_value(); + if (constant) { + *rvalue = constant; + } else { + (*rvalue)->accept(this); + } +} + void ir_constant_folding_visitor::visit(ir_variable *ir) { @@ -101,16 +117,10 @@ ir_constant_folding_visitor::visit(ir_function *ir) void ir_constant_folding_visitor::visit(ir_expression *ir) { - ir_constant *op[2]; unsigned int operand; for (operand = 0; operand < ir->get_num_operands(); operand++) { - op[operand] = ir->operands[operand]->constant_expression_value(); - if (op[operand]) { - ir->operands[operand] = op[operand]; - } else { - ir->operands[operand]->accept(this); - } + fold_constant(&ir->operands[operand]); } } @@ -140,14 +150,7 @@ ir_constant_folding_visitor::visit(ir_dereference_variable *ir) void ir_constant_folding_visitor::visit(ir_dereference_array *ir) { - ir_constant *const_val = - ir->array_index->constant_expression_value(); - - if (const_val) - ir->array_index = const_val; - else - ir->array_index->accept(this); - + fold_constant(&ir->array_index); ir->array->accept(this); } @@ -162,17 +165,13 @@ ir_constant_folding_visitor::visit(ir_dereference_record *ir) void ir_constant_folding_visitor::visit(ir_assignment *ir) { - ir_constant *const_val = ir->rhs->constant_expression_value(); - if (const_val) - ir->rhs = const_val; - else - ir->rhs->accept(this); + fold_constant(&ir->rhs); if (ir->condition) { /* If the condition is constant, either remove the condition or * remove the never-executed assignment. */ - const_val = ir->condition->constant_expression_value(); + ir_constant *const_val = ir->condition->constant_expression_value(); if (const_val) { if (const_val->value.b[0]) ir->condition = NULL; @@ -214,11 +213,7 @@ ir_constant_folding_visitor::visit(ir_discard *ir) void ir_constant_folding_visitor::visit(ir_if *ir) { - ir_constant *const_val = ir->condition->constant_expression_value(); - if (const_val) - ir->condition = const_val; - else - ir->condition->accept(this); + fold_constant(&ir->condition); visit_exec_list(&ir->then_instructions, this); visit_exec_list(&ir->else_instructions, this); -- cgit v1.2.3 From 6ecf62f673bf90d0969f8db032781b49a988975a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 16:07:41 -0700 Subject: glsl2: Return a real progress value from constant folding. --- src/glsl/ir_constant_folding.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index 492036e9a6..a6d82e33ec 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -39,7 +39,7 @@ class ir_constant_folding_visitor : public ir_visitor { public: ir_constant_folding_visitor() { - /* empty */ + this->progress = false; } virtual ~ir_constant_folding_visitor() @@ -75,6 +75,8 @@ public: /*@}*/ void fold_constant(ir_rvalue **rvalue); + + bool progress; }; void @@ -86,6 +88,7 @@ ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue) ir_constant *constant = (*rvalue)->constant_expression_value(); if (constant) { *rvalue = constant; + this->progress = true; } else { (*rvalue)->accept(this); } @@ -178,6 +181,7 @@ ir_constant_folding_visitor::visit(ir_assignment *ir) else ir->remove(); } + this->progress = true; } } @@ -240,6 +244,5 @@ do_constant_folding(exec_list *instructions) visit_exec_list(instructions, &constant_folding); - /* FINISHME: Return real progress. */ - return false; + return constant_folding.progress; } -- cgit v1.2.3 From 8dbdcb0b43c8749018ff62dd5751190e54fe2445 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 16:18:18 -0700 Subject: glsl2: Constant fold the children of many more ir_instruction types. --- src/glsl/ir_constant_folding.cpp | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_folding.cpp b/src/glsl/ir_constant_folding.cpp index a6d82e33ec..11260423d9 100644 --- a/src/glsl/ir_constant_folding.cpp +++ b/src/glsl/ir_constant_folding.cpp @@ -82,7 +82,7 @@ public: void ir_constant_folding_visitor::fold_constant(ir_rvalue **rvalue) { - if ((*rvalue)->ir_type == ir_type_constant) + if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant) return; ir_constant *constant = (*rvalue)->constant_expression_value(); @@ -131,15 +131,32 @@ ir_constant_folding_visitor::visit(ir_expression *ir) void ir_constant_folding_visitor::visit(ir_texture *ir) { - // FINISHME: Do stuff with texture lookups - (void) ir; + fold_constant(&ir->coordinate); + fold_constant(&ir->projector); + fold_constant(&ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + fold_constant(&ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + fold_constant(&ir->lod_info.lod); + break; + case ir_txd: + fold_constant(&ir->lod_info.grad.dPdx); + fold_constant(&ir->lod_info.grad.dPdy); + break; + } } void ir_constant_folding_visitor::visit(ir_swizzle *ir) { - ir->val->accept(this); + fold_constant(&ir->val); } @@ -180,8 +197,8 @@ ir_constant_folding_visitor::visit(ir_assignment *ir) ir->condition = NULL; else ir->remove(); + this->progress = true; } - this->progress = true; } } @@ -196,14 +213,22 @@ ir_constant_folding_visitor::visit(ir_constant *ir) void ir_constant_folding_visitor::visit(ir_call *ir) { - (void) ir; + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + fold_constant(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } } void ir_constant_folding_visitor::visit(ir_return *ir) { - (void) ir; + fold_constant(&ir->value); } -- cgit v1.2.3 From 8e9ce2eb56a087c2544112700ae1abe3f96648dd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 3 Aug 2010 15:02:35 -0700 Subject: glsl2: Don't try to construct an ir_assignment with an invalid LHS --- src/glsl/ast_to_hir.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b65a323a8d..14c528075b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -555,9 +555,8 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, NULL)); deref_var = new(ctx) ir_dereference_variable(var); - instructions->push_tail(new(ctx) ir_assignment(lhs, - deref_var, - NULL)); + if (!error_emitted) + instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var, NULL)); return new(ctx) ir_dereference_variable(var); } -- cgit v1.2.3 From 5a7758efbe14dee026245a4f4f4fb3ccf7b2c23b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Aug 2010 18:48:25 -0700 Subject: glsl2: Add ir_assignment::write_mask and associated methods Replace swizzles on the LHS with additional swizzles on the RHS and a write mask in the assignment instruction. As part of this add ir_assignment::set_lhs. Ideally we'd make ir_assignment::lhs private to prevent erroneous writes, but that would require a lot of code butchery at this point. Add ir_assignment constructor that takes an explicit write mask. This is required for ir_assignment::clone, but it can also be used in other places. Without this, ir_assignment clones lose their write masks, and incorrect IR is generated in optimization passes. Add ir_assignment::whole_variable_written method. This method gets the variable on the LHS if the whole variable is written or NULL otherwise. This is different from ir->lhs->whole_variable_referenced() because the latter has no knowledge of the write mask stored in the ir_assignment. Gut all code from ir_to_mesa that handled swizzles on the LHS of assignments. There is probably some other refactoring that could be done here, but that can be left for another day. --- src/glsl/ir.cpp | 113 ++++++++++++++++++++++++++++++++++- src/glsl/ir.h | 44 +++++++++++++- src/glsl/ir_clone.cpp | 3 +- src/glsl/ir_constant_variable.cpp | 2 +- src/glsl/ir_copy_propagation.cpp | 2 +- src/glsl/ir_dead_code_local.cpp | 2 +- src/glsl/ir_print_visitor.cpp | 14 ++++- src/glsl/ir_tree_grafting.cpp | 2 +- src/glsl/ir_vec_index_to_swizzle.cpp | 2 +- src/mesa/program/ir_to_mesa.cpp | 67 ++++++++------------- 10 files changed, 199 insertions(+), 52 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 79cbaa9ea0..c3bade8d54 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -22,6 +22,7 @@ */ #include #include "main/imports.h" +#include "main/macros.h" #include "ir.h" #include "ir_visitor.h" #include "glsl_types.h" @@ -31,13 +32,121 @@ ir_rvalue::ir_rvalue() this->type = glsl_type::error_type; } +/** + * Modify the swizzle make to move one component to another + * + * \param m IR swizzle to be modified + * \param from Component in the RHS that is to be swizzled + * \param to Desired swizzle location of \c from + */ +static void +update_rhs_swizzle(ir_swizzle_mask &m, unsigned from, unsigned to) +{ + switch (to) { + case 0: m.x = from; break; + case 1: m.y = from; break; + case 2: m.z = from; break; + case 3: m.w = from; break; + default: assert(!"Should not get here."); + } + + m.num_components = MAX2(m.num_components, (to + 1)); +} + +void +ir_assignment::set_lhs(ir_rvalue *lhs) +{ + while (lhs != NULL) { + ir_swizzle *swiz = lhs->as_swizzle(); + + if (swiz == NULL) + break; + + unsigned write_mask = 0; + ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 }; + + for (unsigned i = 0; i < swiz->mask.num_components; i++) { + unsigned c = 0; + + switch (i) { + case 0: c = swiz->mask.x; break; + case 1: c = swiz->mask.y; break; + case 2: c = swiz->mask.z; break; + case 3: c = swiz->mask.w; break; + default: assert(!"Should not get here."); + } + + write_mask |= (((this->write_mask >> i) & 1) << c); + update_rhs_swizzle(rhs_swiz, i, c); + } + + this->write_mask = write_mask; + lhs = swiz->val; + + this->rhs = new(this) ir_swizzle(this->rhs, rhs_swiz); + } + + assert((lhs == NULL) || lhs->as_dereference()); + + this->lhs = (ir_dereference *) lhs; +} + +ir_variable * +ir_assignment::whole_variable_written() +{ + ir_variable *v = this->lhs->whole_variable_referenced(); + + if (v == NULL) + return NULL; + + if (v->type->is_scalar()) + return v; + + if (v->type->is_vector()) { + const unsigned mask = (1U << v->type->vector_elements) - 1; + + if (mask != this->write_mask) + return NULL; + } + + /* Either all the vector components are assigned or the variable is some + * composite type (and the whole thing is assigned. + */ + return v; +} + +ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs, + ir_rvalue *condition, unsigned write_mask) +{ + this->ir_type = ir_type_assignment; + this->condition = condition; + this->rhs = rhs; + this->lhs = lhs; + this->write_mask = write_mask; +} + ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition) { this->ir_type = ir_type_assignment; - this->lhs = lhs; - this->rhs = rhs; this->condition = condition; + this->rhs = rhs; + + /* If the RHS is a vector type, assume that all components of the vector + * type are being written to the LHS. The write mask comes from the RHS + * because we can have a case where the LHS is a vec4 and the RHS is a + * vec3. In that case, the assignment is: + * + * (assign (...) (xyz) (var_ref lhs) (var_ref rhs)) + */ + if (rhs->type->is_vector()) + this->write_mask = (1U << rhs->type->vector_elements) - 1; + else if (rhs->type->is_scalar()) + this->write_mask = 1; + else + this->write_mask = 0; + + this->set_lhs(lhs); } diff --git a/src/glsl/ir.h b/src/glsl/ir.h index f964b36083..98789503e0 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -514,6 +514,16 @@ class ir_assignment : public ir_instruction { public: ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); + /** + * Construct an assignment with an explicit write mask + * + * \note + * Since a write mask is supplied, the LHS must already be a bare + * \c ir_dereference. The cannot be any swizzles in the LHS. + */ + ir_assignment(ir_dereference *lhs, ir_rvalue *rhs, ir_rvalue *condition, + unsigned write_mask); + virtual ir_assignment *clone(void *mem_ctx, struct hash_table *ht) const; virtual ir_constant *constant_expression_value(); @@ -530,10 +540,32 @@ public: return this; } + /** + * Get a whole variable written by an assignment + * + * If the LHS of the assignment writes a whole variable, the variable is + * returned. Otherwise \c NULL is returned. Examples of whole-variable + * assignment are: + * + * - Assigning to a scalar + * - Assigning to all components of a vector + * - Whole array (or matrix) assignment + * - Whole structure assignment + */ + ir_variable *whole_variable_written(); + + /** + * Set the LHS of an assignment + */ + void set_lhs(ir_rvalue *lhs); + /** * Left-hand side of the assignment. + * + * This should be treated as read only. If you need to set the LHS of an + * assignment, use \c ir_assignment::set_lhs. */ - ir_rvalue *lhs; + ir_dereference *lhs; /** * Value being assigned @@ -544,6 +576,16 @@ public: * Optional condition for the assignment. */ ir_rvalue *condition; + + + /** + * Component mask written + * + * For non-vector types in the LHS, this field will be zero. For vector + * types, a bit will be set for each component that is written. Note that + * for \c vec2 and \c vec3 types only the lower bits will ever be set. + */ + unsigned write_mask:4; }; /* Update ir_expression::num_operands() and operator_strs when diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 59831834bd..0e202164b3 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -242,7 +242,8 @@ ir_assignment::clone(void *mem_ctx, struct hash_table *ht) const return new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht), this->rhs->clone(mem_ctx, ht), - new_condition); + new_condition, + this->write_mask); } ir_function * diff --git a/src/glsl/ir_constant_variable.cpp b/src/glsl/ir_constant_variable.cpp index 749e2cf809..1fb73e765e 100644 --- a/src/glsl/ir_constant_variable.cpp +++ b/src/glsl/ir_constant_variable.cpp @@ -110,7 +110,7 @@ ir_constant_variable_visitor::visit_enter(ir_assignment *ir) return visit_continue; } - ir_variable *var = ir->lhs->whole_variable_referenced(); + ir_variable *var = ir->whole_variable_written(); if (!var) return visit_continue; diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 5712398732..26588a352c 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -224,7 +224,7 @@ add_copy(void *ctx, ir_assignment *ir, exec_list *acp) return; } - ir_variable *lhs_var = ir->lhs->whole_variable_referenced(); + ir_variable *lhs_var = ir->whole_variable_written(); ir_variable *rhs_var = ir->rhs->whole_variable_referenced(); if ((lhs_var != NULL) && (rhs_var != NULL)) { diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp index 7a44ec8a4a..b22cc558df 100644 --- a/src/glsl/ir_dead_code_local.cpp +++ b/src/glsl/ir_dead_code_local.cpp @@ -137,7 +137,7 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) } /* Now, check if we did a whole-variable assignment. */ - if (always_assign && (ir->lhs->whole_variable_referenced() != NULL)) { + if (always_assign && (ir->whole_variable_written() != NULL)) { /* We did a whole-variable assignment. So, any instruction in * the assignment list with the same LHS is dead. */ diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 73476e7e9b..39b11bb32c 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -296,7 +296,19 @@ void ir_print_visitor::visit(ir_assignment *ir) else printf("(constant bool (1))"); - printf(" "); + + char mask[5]; + unsigned j = 0; + + for (unsigned i = 0; i < 4; i++) { + if ((ir->write_mask & (1 << i)) != 0) { + mask[j] = "xyzw"[i]; + j++; + } + } + mask[j] = '\0'; + + printf(" (%s) ", mask); ir->lhs->accept(this); diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index 6f62de758b..38034a6197 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -315,7 +315,7 @@ tree_grafting_basic_block(ir_instruction *bb_first, if (!assign) continue; - ir_variable *lhs_var = assign->lhs->whole_variable_referenced(); + ir_variable *lhs_var = assign->whole_variable_written(); if (!lhs_var) continue; diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp index 1e170cbae6..b3de91f8ab 100644 --- a/src/glsl/ir_vec_index_to_swizzle.cpp +++ b/src/glsl/ir_vec_index_to_swizzle.cpp @@ -107,7 +107,7 @@ ir_vec_index_to_swizzle_visitor::visit_enter(ir_swizzle *ir) ir_visitor_status ir_vec_index_to_swizzle_visitor::visit_enter(ir_assignment *ir) { - ir->lhs = convert_vec_index_to_swizzle(ir->lhs); + ir->set_lhs(convert_vec_index_to_swizzle(ir->lhs)); ir->rhs = convert_vec_index_to_swizzle(ir->rhs); return visit_continue; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 777b4d91f4..1cec4aa621 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -356,6 +356,7 @@ ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, ir_to_mesa_dst_reg dst, ir_to_mesa_src_reg src0) { + assert(dst.writemask != 0); return ir_to_mesa_emit_op3(ir, op, dst, src0, ir_to_mesa_undef, ir_to_mesa_undef); } @@ -1615,21 +1616,17 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) * We want to be careful in assignment setup to hit the actual storage * instead of potentially using a temporary like we might with the * ir_dereference handler. - * - * Thanks to ir_swizzle_swizzle, and ir_vec_index_to_swizzle, we - * should only see potentially one variable array index of a vector, - * and one swizzle, before getting to actual vec4 storage. So handle - * those, then go use ir_dereference to handle the rest. */ static struct ir_to_mesa_dst_reg -get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v, +get_assignment_lhs(ir_dereference *ir, ir_to_mesa_visitor *v, ir_to_mesa_src_reg *r) { - struct ir_to_mesa_dst_reg dst_reg; - ir_swizzle *swiz; - + /* The LHS must be a dereference. If the LHS is a variable indexed array + * access of a vector, it must be separated into a series conditional moves + * before reaching this point (see ir_vec_index_to_cond_assign). + */ + assert(ir->as_dereference()); ir_dereference_array *deref_array = ir->as_dereference_array(); - /* This should have been handled by ir_vec_index_to_cond_assign */ if (deref_array) { assert(!deref_array->array->type->is_vector()); } @@ -1638,38 +1635,7 @@ get_assignment_lhs(ir_instruction *ir, ir_to_mesa_visitor *v, * swizzles in it and write swizzles using writemask, though. */ ir->accept(v); - dst_reg = ir_to_mesa_dst_reg_from_src(v->result); - - if ((swiz = ir->as_swizzle())) { - int swizzles[4] = { - swiz->mask.x, - swiz->mask.y, - swiz->mask.z, - swiz->mask.w - }; - int new_r_swizzle[4]; - int orig_r_swizzle = r->swizzle; - int i; - - for (i = 0; i < 4; i++) { - new_r_swizzle[i] = GET_SWZ(orig_r_swizzle, 0); - } - - dst_reg.writemask = 0; - for (i = 0; i < 4; i++) { - if (i < swiz->mask.num_components) { - dst_reg.writemask |= 1 << swizzles[i]; - new_r_swizzle[swizzles[i]] = GET_SWZ(orig_r_swizzle, i); - } - } - - r->swizzle = MAKE_SWIZZLE4(new_r_swizzle[0], - new_r_swizzle[1], - new_r_swizzle[2], - new_r_swizzle[3]); - } - - return dst_reg; + return ir_to_mesa_dst_reg_from_src(v->result); } void @@ -1684,6 +1650,23 @@ ir_to_mesa_visitor::visit(ir_assignment *ir) l = get_assignment_lhs(ir->lhs, this, &r); + /* FINISHME: This should really set to the correct maximal writemask for each + * FINISHME: component written (in the loops below). This case can only + * FINISHME: occur for matrices, arrays, and structures. + */ + if (ir->write_mask == 0) { + assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); + l.writemask = WRITEMASK_XYZW; + } else if (ir->lhs->type->is_scalar()) { + /* FINISHME: This hack makes writing to gl_FragData, which lives in the + * FINISHME: W component of fragment shader output zero, work correctly. + */ + l.writemask = WRITEMASK_XYZW; + } else { + assert(ir->lhs->type->is_vector()); + l.writemask = ir->write_mask; + } + assert(l.file != PROGRAM_UNDEFINED); assert(r.file != PROGRAM_UNDEFINED); -- cgit v1.2.3 From 6235c6a83855fe2818affda3c82e1a245bd0232e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 4 Aug 2010 16:27:17 -0700 Subject: glsl2: Additional validation of write masks --- src/glsl/ir_validate.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 89bcd1c481..701bf21ea6 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -67,6 +67,8 @@ public: virtual ir_visitor_status visit_leave(ir_expression *ir); + virtual ir_visitor_status visit_enter(ir_assignment *ir); + static void validate_ir(ir_instruction *ir, void *data); ir_function *current_function; @@ -320,6 +322,36 @@ ir_validate::visit(ir_variable *ir) return visit_continue; } +ir_visitor_status +ir_validate::visit_enter(ir_assignment *ir) +{ + const ir_dereference *const lhs = ir->lhs; + if (lhs->type->is_scalar() || lhs->type->is_vector()) { + if (ir->write_mask == 0) { + printf("Assignment LHS is %s, but write mask is 0:\n", + lhs->type->is_scalar() ? "scalar" : "vector"); + ir->print(); + abort(); + } + + /* Mask of fields that do not exist in the destination. These should + * not be written by the assignment. + */ + const unsigned invalid_mask = ~((1U << lhs->type->components()) - 1); + + if ((invalid_mask & ir->write_mask) != 0) { + printf("Assignment write mask enables invalid components for " + "type %s:\n", lhs->type->name); + ir->print(); + abort(); + } + } + + this->validate_ir(ir, this->data); + + return visit_continue; +} + void ir_validate::validate_ir(ir_instruction *ir, void *data) { -- cgit v1.2.3 From 3d58be6135e71e6105ae65850f2dbeaf9ecff5c3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 3 Aug 2010 16:05:54 -0700 Subject: glsl2: Generate masked assignments in vector and matrix constructors Previously the in-line matrix and vector constructors would generate swizzles in the LHS. The code is actually more clear if it just generates the masked assignments instead of relying on the ir_assignment constructor to convert the swizzles to write masks. --- src/glsl/ast_function.cpp | 82 ++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 36 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index c22dfa81eb..1b8b3195e5 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -572,16 +572,17 @@ emit_inline_vector_constructor(const glsl_type *type, 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); + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask); instructions->push_tail(inst); } else { unsigned base_component = 0; foreach_list(node, parameters) { - ir_rvalue *rhs = (ir_rvalue *) node; - unsigned rhs_components = rhs->type->components(); + 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! */ @@ -589,19 +590,23 @@ emit_inline_vector_constructor(const glsl_type *type, rhs_components = lhs_components - base_component; } - /* Emit an assignment of the constructor parameter to the next set of - * components in the temporary variable. + /* Generate a swizzle that puts the first element of the source at + * the location of the first element of the destination. */ - unsigned mask[4] = { 0, 0, 0, 0 }; - for (unsigned i = 0; i < rhs_components; i++) { - mask[i] = i + base_component; - } + unsigned swiz[4] = { 0, 0, 0, 0 }; + for (unsigned i = 0; i < rhs_components; i++) + swiz[i + base_component] = i; + /* Mask of fields to be written in the assignment. + */ + const unsigned write_mask = ((1U << rhs_components) - 1) + << base_component; - ir_rvalue *lhs_ref = new(ctx) ir_dereference_variable(var); - ir_swizzle *lhs = new(ctx) ir_swizzle(lhs_ref, mask, rhs_components); + ir_dereference *lhs = new(ctx) ir_dereference_variable(var); + ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, lhs_components); - ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + 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 @@ -631,18 +636,27 @@ assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base, ir_rvalue *src, unsigned src_base, unsigned count, void *mem_ctx) { - const unsigned mask[8] = { 0, 1, 2, 3, 0, 0, 0, 0 }; - ir_constant *col_idx = new(mem_ctx) ir_constant(column); - ir_rvalue *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx); + ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx); assert(column_ref->type->components() >= (row_base + count)); - ir_rvalue *lhs = new(mem_ctx) ir_swizzle(column_ref, &mask[row_base], count); - assert(src->type->components() >= (src_base + count)); - ir_rvalue *rhs = new(mem_ctx) ir_swizzle(src, &mask[src_base], count); - return new(mem_ctx) ir_assignment(lhs, rhs, NULL); + /* Generate a swizzle that puts the first element of the source at the + * location of the first element of the destination. + */ + unsigned swiz[4] = { src_base, src_base, src_base, src_base }; + for (unsigned i = 0; i < count; i++) + swiz[i + row_base] = src_base + i; + + ir_rvalue *const rhs = + new(mem_ctx) ir_swizzle(src, swiz, column_ref->type->components()); + + /* 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, rhs, NULL, write_mask); } @@ -704,10 +718,9 @@ emit_inline_matrix_constructor(const glsl_type *type, NULL); instructions->push_tail(inst); - ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); - ir_rvalue *const x_of_rhs = new(ctx) ir_swizzle(rhs_ref, 0, 0, 0, 0, 1); + ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); - inst = new(ctx) ir_assignment(x_of_rhs, first_param, NULL); + 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 @@ -813,11 +826,16 @@ emit_inline_matrix_constructor(const glsl_type *type, instructions->push_tail(inst); - const unsigned swiz[4] = { 0, 1, 2, 3 }; + unsigned swiz[4] = { 0, 0, 0, 0 }; + for (unsigned i = 1; i < src_matrix->type->vector_elements; i++) + swiz[i] = i; + const unsigned last_col = min(src_matrix->type->matrix_columns, var->type->matrix_columns); + const unsigned write_mask = (1U << var->type->vector_elements) - 1; + for (unsigned i = 0; i < last_col; i++) { - ir_rvalue *const lhs_col = + 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)); @@ -830,26 +848,18 @@ emit_inline_matrix_constructor(const glsl_type *type, * It would be perfectly valid to unconditionally generate the * swizzles, this this will typically result in a more compact IR tree. */ - ir_rvalue *lhs; ir_rvalue *rhs; - if (lhs_col->type->vector_elements < rhs_col->type->vector_elements) { - lhs = lhs_col; - + if (lhs->type->vector_elements != rhs_col->type->vector_elements) { rhs = new(ctx) ir_swizzle(rhs_col, swiz, - lhs_col->type->vector_elements); - } else if (lhs_col->type->vector_elements - > rhs_col->type->vector_elements) { - lhs = new(ctx) ir_swizzle(lhs_col, swiz, - rhs_col->type->vector_elements); - rhs = rhs_col; + lhs->type->vector_elements); } else { - lhs = lhs_col; rhs = rhs_col; } assert(lhs->type == rhs->type); - ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + ir_instruction *inst = + new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); instructions->push_tail(inst); } } else { -- cgit v1.2.3 From 83cb310dbb47357c4b3065ca0d6739796d9e371f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 4 Aug 2010 16:27:55 -0700 Subject: glsl2: Generate masked assignments in some expanded matrix operations --- src/glsl/ir_mat_op_to_vec.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 742fc2a295..880454c007 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -44,7 +44,7 @@ public: ir_visitor_status visit_leave(ir_assignment *); - ir_rvalue *get_column(ir_variable *var, int col); + ir_dereference *get_column(ir_variable *var, int col); ir_rvalue *get_element(ir_variable *var, int col, int row); void do_mul_mat_mat(ir_variable *result_var, @@ -109,7 +109,7 @@ ir_mat_op_to_vec_visitor::get_element(ir_variable *var, int col, int row) return new(base_ir) ir_swizzle(deref, row, 0, 0, 0, 1); } -ir_rvalue * +ir_dereference * ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int row) { ir_dereference *deref; @@ -314,7 +314,9 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) case ir_binop_add: case ir_binop_sub: case ir_binop_div: - case ir_binop_mod: + case ir_binop_mod: { + const unsigned mask = (1U << result_var->type->vector_elements) - 1; + /* For most operations, the matrix version is just going * column-wise through and applying the operation to each column * if available. @@ -322,7 +324,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) for (i = 0; i < matrix_columns; i++) { ir_rvalue *op0 = get_column(op_var[0], i); ir_rvalue *op1 = get_column(op_var[1], i); - ir_rvalue *result = get_column(result_var, i); + ir_dereference *result = get_column(result_var, i); ir_expression *column_expr; ir_assignment *column_assign; @@ -333,10 +335,13 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) column_assign = new(base_ir) ir_assignment(result, column_expr, - NULL); + NULL, + mask); + assert(column_assign->write_mask != 0); base_ir->insert_before(column_assign); } break; + } case ir_binop_mul: if (op_var[0]->type->is_matrix()) { if (op_var[1]->type->is_matrix()) { -- cgit v1.2.3 From 022f79e49648d465d2db0240554f58ac42754584 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 16:32:12 -0700 Subject: glsl2: Return progress from ir_vec_index_to_swizzle. --- src/glsl/ir_vec_index_to_swizzle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_vec_index_to_swizzle.cpp b/src/glsl/ir_vec_index_to_swizzle.cpp index b3de91f8ab..969dc8f94a 100644 --- a/src/glsl/ir_vec_index_to_swizzle.cpp +++ b/src/glsl/ir_vec_index_to_swizzle.cpp @@ -153,5 +153,5 @@ do_vec_index_to_swizzle(exec_list *instructions) v.run(instructions); - return false; + return v.progress; } -- cgit v1.2.3 From e3a90b8e38b1d0de9f473caca96779e215071315 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 17:12:14 -0700 Subject: glsl2: Use linked ir_constant_variable after linking, instead of unlinked. --- src/glsl/linker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 10fd2d5ab9..b2953c67d1 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1293,7 +1293,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_dead_code_local(ir) || progress; progress = do_dead_code(ir) || progress; progress = do_tree_grafting(ir) || progress; - progress = do_constant_variable_unlinked(ir) || progress; + progress = do_constant_variable(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_algebraic(ir) || progress; progress = do_if_return(ir) || progress; -- cgit v1.2.3 From a08f27940ac72538ce0b264917207111d629f097 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 20:03:15 -0700 Subject: glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor. --- src/glsl/ir_variable_refcount.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable_refcount.h b/src/glsl/ir_variable_refcount.h index d69cab563e..30dd2bd587 100644 --- a/src/glsl/ir_variable_refcount.h +++ b/src/glsl/ir_variable_refcount.h @@ -78,8 +78,6 @@ public: variable_entry *get_variable_entry(ir_variable *var); - bool (*predicate)(ir_instruction *ir); - /* List of variable_entry */ exec_list variable_list; -- cgit v1.2.3 From 046bef235744e891e4a48076e1a3ff9a61a63092 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 20:33:57 -0700 Subject: glsl2: Remove the shader_in/shader_out tracking separate from var->mode. I introduced this for ir_dead_code to distinguish function parameter outvals from varying outputs. Only, since ast_to_hir's current_function is unset when setting up function parameters (they're needed for making the function signature in the first place), all function parameter outvals were marked as shader outputs anyway. This meant that an inlined function's cloned outval was marked as a shader output and couldn't be dead-code eliminated. Instead, since ir_dead_code doesn't even look at function parameters, just use var->mode. The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from 725 instructions to 636. --- src/glsl/ast_to_hir.cpp | 37 ++++++++++--------------------------- src/glsl/ir.cpp | 4 ---- src/glsl/ir.h | 14 ++++---------- src/glsl/ir_clone.cpp | 2 -- src/glsl/ir_dead_code.cpp | 3 ++- src/glsl/ir_variable.cpp | 12 +----------- src/glsl/linker.cpp | 2 -- 7 files changed, 17 insertions(+), 57 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 14c528075b..292c7be621 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1510,31 +1510,6 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, else if (qual->uniform) var->mode = ir_var_uniform; - if (qual->uniform) - var->shader_in = true; - - /* Any 'in' or 'inout' variables at global scope must be marked as being - * shader inputs. Likewise, any 'out' or 'inout' variables at global scope - * must be marked as being shader outputs. - */ - if (state->current_function == NULL) { - switch (var->mode) { - case ir_var_in: - case ir_var_uniform: - var->shader_in = true; - break; - case ir_var_out: - var->shader_out = true; - break; - case ir_var_inout: - var->shader_in = true; - var->shader_out = true; - break; - default: - break; - } - } - if (qual->flat) var->interpolation = ir_var_flat; else if (qual->noperspective) @@ -1702,11 +1677,19 @@ ast_declarator_list::hir(exec_list *instructions, & loc); if (this->type->qualifier.invariant) { - if ((state->target == vertex_shader) && !var->shader_out) { + 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->shader_in) { + } 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); diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index c3bade8d54..dd059e470d 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -902,7 +902,6 @@ ir_swizzle::variable_referenced() ir_variable::ir_variable(const struct glsl_type *type, const char *name, ir_variable_mode mode) : max_array_access(0), read_only(false), centroid(false), invariant(false), - shader_in(false), shader_out(false), mode(mode), interpolation(ir_var_smooth), array_lvalue(false) { this->ir_type = ir_type_variable; @@ -922,9 +921,6 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name, const char * ir_variable::interpolation_string() const { - if (!this->shader_in && !this->shader_out) - return ""; - switch (this->interpolation) { case ir_var_smooth: return "smooth"; case ir_var_flat: return "flat"; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 98789503e0..e61485813d 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -194,10 +194,10 @@ public: /** * Get the string value for the interpolation qualifier * - * \return - * If none of \c shader_in or \c shader_out is set, an empty string will - * be returned. Otherwise the string that would be used in a shader to - * specify \c mode will be returned. + * \return The string that would be used in a shader to specify \c + * mode will be returned. + * + * This function should only be used on a shader input or output variable. */ const char *interpolation_string() const; @@ -221,12 +221,6 @@ public: unsigned read_only:1; unsigned centroid:1; unsigned invariant:1; - /** If the variable is initialized outside of the scope of the shader */ - unsigned shader_in:1; - /** - * If the variable value is later used outside of the scope of the shader. - */ - unsigned shader_out:1; unsigned mode:3; unsigned interpolation:2; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 0e202164b3..a72609601a 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -45,8 +45,6 @@ ir_variable::clone(void *mem_ctx, struct hash_table *ht) const var->read_only = this->read_only; var->centroid = this->centroid; var->invariant = this->invariant; - var->shader_in = this->shader_in; - var->shader_out = this->shader_out; var->interpolation = this->interpolation; var->array_lvalue = this->array_lvalue; var->location = this->location; diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 2b971b7aaa..bf032f1dc2 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -68,7 +68,8 @@ do_dead_code(exec_list *instructions) /* Remove a single dead assignment to the variable we found. * Don't do so if it's a shader output, though. */ - if (!entry->var->shader_out) { + if (entry->var->mode != ir_var_out && + entry->var->mode != ir_var_inout) { entry->assign->remove(); progress = true; } diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 478cefc5a6..d9a16d4287 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -43,22 +43,12 @@ add_variable(const char *name, enum ir_variable_mode mode, int slot, switch (var->mode) { case ir_var_auto: - var->read_only = true; - break; case ir_var_in: - var->shader_in = true; + case ir_var_uniform: var->read_only = true; break; case ir_var_inout: - var->shader_in = true; - var->shader_out = true; - break; case ir_var_out: - var->shader_out = true; - break; - case ir_var_uniform: - var->shader_in = true; - var->read_only = true; break; default: assert(0); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index b2953c67d1..94db57d6a5 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1124,7 +1124,6 @@ assign_varying_locations(struct gl_shader_program *prog, * by the following stage. */ if (var->location == -1) { - var->shader_out = false; var->mode = ir_var_auto; } } @@ -1158,7 +1157,6 @@ assign_varying_locations(struct gl_shader_program *prog, /* An 'in' variable is only really a shader input if its * value is written by the previous stage. */ - var->shader_in = false; var->mode = ir_var_auto; } } -- cgit v1.2.3 From 16b4eed59a07f5e07587f4f9b0cdc304a08a685c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:10:03 -0700 Subject: glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code. --- src/glsl/glcpp/glcpp-parse.c | 247 +++++++++++++++++++++---------------------- src/glsl/glcpp/glcpp-parse.y | 39 ++++--- 2 files changed, 142 insertions(+), 144 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 5ea07c2555..df16cabeeb 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -175,6 +175,9 @@ _active_list_pop (active_list_t *list); int _active_list_contains (active_list_t *list, const char *identifier); +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list); + static void _glcpp_parser_expand_token_list (glcpp_parser_t *parser, token_list_t *list); @@ -208,7 +211,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 212 "glcpp/glcpp-parse.c" +#line 215 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -296,7 +299,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 300 "glcpp/glcpp-parse.c" +#line 303 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -620,17 +623,17 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 169, 169, 171, 175, 178, 183, 184, 188, 191, - 197, 200, 203, 206, 214, 226, 231, 236, 248, 259, - 262, 265, 274, 278, 287, 292, 293, 296, 299, 302, - 305, 308, 311, 314, 317, 320, 323, 326, 329, 332, - 335, 338, 341, 344, 347, 350, 353, 356, 359, 365, - 370, 378, 379, 383, 389, 390, 393, 395, 402, 406, - 410, 415, 421, 429, 435, 443, 447, 451, 455, 459, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, - 496 + 0, 172, 172, 174, 178, 181, 186, 187, 191, 194, + 200, 203, 206, 209, 217, 220, 225, 230, 233, 244, + 247, 250, 259, 263, 272, 277, 278, 281, 284, 287, + 290, 293, 296, 299, 302, 305, 308, 311, 314, 317, + 320, 323, 326, 329, 332, 335, 338, 341, 344, 350, + 355, 363, 364, 368, 374, 375, 378, 380, 387, 391, + 395, 400, 406, 414, 420, 428, 432, 436, 440, 444, + 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, + 481 }; #endif @@ -1781,7 +1784,7 @@ yyreduce: case 4: /* Line 1464 of yacc.c */ -#line 175 "glcpp/glcpp-parse.y" +#line 178 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); ;} @@ -1790,7 +1793,7 @@ yyreduce: case 5: /* Line 1464 of yacc.c */ -#line 178 "glcpp/glcpp-parse.y" +#line 181 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); glcpp_print(parser->output, "\n"); @@ -1801,7 +1804,7 @@ yyreduce: case 8: /* Line 1464 of yacc.c */ -#line 188 "glcpp/glcpp-parse.y" +#line 191 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1810,7 +1813,7 @@ yyreduce: case 9: /* Line 1464 of yacc.c */ -#line 191 "glcpp/glcpp-parse.y" +#line 194 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1819,7 +1822,7 @@ yyreduce: case 10: /* Line 1464 of yacc.c */ -#line 197 "glcpp/glcpp-parse.y" +#line 200 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1828,7 +1831,7 @@ yyreduce: case 11: /* Line 1464 of yacc.c */ -#line 200 "glcpp/glcpp-parse.y" +#line 203 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1837,7 +1840,7 @@ yyreduce: case 12: /* Line 1464 of yacc.c */ -#line 203 "glcpp/glcpp-parse.y" +#line 206 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); ;} @@ -1846,7 +1849,7 @@ yyreduce: case 13: /* Line 1464 of yacc.c */ -#line 206 "glcpp/glcpp-parse.y" +#line 209 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { @@ -1860,25 +1863,16 @@ yyreduce: case 14: /* Line 1464 of yacc.c */ -#line 214 "glcpp/glcpp-parse.y" +#line 217 "glcpp/glcpp-parse.y" { - token_list_t *expanded; - token_t *token; - - expanded = _token_list_create (parser); - token = _token_create_ival (parser, IF_EXPANDED, IF_EXPANDED); - _token_list_append (expanded, token); - talloc_unlink (parser, token); - _glcpp_parser_expand_token_list (parser, (yyvsp[(2) - (3)].token_list)); - _token_list_append_list (expanded, (yyvsp[(2) - (3)].token_list)); - glcpp_parser_lex_from (parser, expanded); + _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); ;} break; case 15: /* Line 1464 of yacc.c */ -#line 226 "glcpp/glcpp-parse.y" +#line 220 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1889,7 +1883,7 @@ yyreduce: case 16: /* Line 1464 of yacc.c */ -#line 231 "glcpp/glcpp-parse.y" +#line 225 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1900,25 +1894,16 @@ yyreduce: case 17: /* Line 1464 of yacc.c */ -#line 236 "glcpp/glcpp-parse.y" +#line 230 "glcpp/glcpp-parse.y" { - token_list_t *expanded; - token_t *token; - - expanded = _token_list_create (parser); - token = _token_create_ival (parser, ELIF_EXPANDED, ELIF_EXPANDED); - _token_list_append (expanded, token); - talloc_unlink (parser, token); - _glcpp_parser_expand_token_list (parser, (yyvsp[(2) - (3)].token_list)); - _token_list_append_list (expanded, (yyvsp[(2) - (3)].token_list)); - glcpp_parser_lex_from (parser, expanded); + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list)); ;} break; case 18: /* Line 1464 of yacc.c */ -#line 248 "glcpp/glcpp-parse.y" +#line 233 "glcpp/glcpp-parse.y" { /* #elif without an expression results in a warning if the * condition doesn't matter (we just handled #if 1 or such) @@ -1935,7 +1920,7 @@ yyreduce: case 19: /* Line 1464 of yacc.c */ -#line 259 "glcpp/glcpp-parse.y" +#line 244 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1944,7 +1929,7 @@ yyreduce: case 20: /* Line 1464 of yacc.c */ -#line 262 "glcpp/glcpp-parse.y" +#line 247 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -1953,7 +1938,7 @@ yyreduce: case 21: /* Line 1464 of yacc.c */ -#line 265 "glcpp/glcpp-parse.y" +#line 250 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -1968,7 +1953,7 @@ yyreduce: case 23: /* Line 1464 of yacc.c */ -#line 278 "glcpp/glcpp-parse.y" +#line 263 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -1983,7 +1968,7 @@ yyreduce: case 24: /* Line 1464 of yacc.c */ -#line 287 "glcpp/glcpp-parse.y" +#line 272 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -1992,7 +1977,7 @@ yyreduce: case 26: /* Line 1464 of yacc.c */ -#line 293 "glcpp/glcpp-parse.y" +#line 278 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -2001,7 +1986,7 @@ yyreduce: case 27: /* Line 1464 of yacc.c */ -#line 296 "glcpp/glcpp-parse.y" +#line 281 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2010,7 +1995,7 @@ yyreduce: case 28: /* Line 1464 of yacc.c */ -#line 299 "glcpp/glcpp-parse.y" +#line 284 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2019,7 +2004,7 @@ yyreduce: case 29: /* Line 1464 of yacc.c */ -#line 302 "glcpp/glcpp-parse.y" +#line 287 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2028,7 +2013,7 @@ yyreduce: case 30: /* Line 1464 of yacc.c */ -#line 305 "glcpp/glcpp-parse.y" +#line 290 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2037,7 +2022,7 @@ yyreduce: case 31: /* Line 1464 of yacc.c */ -#line 308 "glcpp/glcpp-parse.y" +#line 293 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2046,7 +2031,7 @@ yyreduce: case 32: /* Line 1464 of yacc.c */ -#line 311 "glcpp/glcpp-parse.y" +#line 296 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2055,7 +2040,7 @@ yyreduce: case 33: /* Line 1464 of yacc.c */ -#line 314 "glcpp/glcpp-parse.y" +#line 299 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2064,7 +2049,7 @@ yyreduce: case 34: /* Line 1464 of yacc.c */ -#line 317 "glcpp/glcpp-parse.y" +#line 302 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2073,7 +2058,7 @@ yyreduce: case 35: /* Line 1464 of yacc.c */ -#line 320 "glcpp/glcpp-parse.y" +#line 305 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2082,7 +2067,7 @@ yyreduce: case 36: /* Line 1464 of yacc.c */ -#line 323 "glcpp/glcpp-parse.y" +#line 308 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2091,7 +2076,7 @@ yyreduce: case 37: /* Line 1464 of yacc.c */ -#line 326 "glcpp/glcpp-parse.y" +#line 311 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2100,7 +2085,7 @@ yyreduce: case 38: /* Line 1464 of yacc.c */ -#line 329 "glcpp/glcpp-parse.y" +#line 314 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2109,7 +2094,7 @@ yyreduce: case 39: /* Line 1464 of yacc.c */ -#line 332 "glcpp/glcpp-parse.y" +#line 317 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2118,7 +2103,7 @@ yyreduce: case 40: /* Line 1464 of yacc.c */ -#line 335 "glcpp/glcpp-parse.y" +#line 320 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2127,7 +2112,7 @@ yyreduce: case 41: /* Line 1464 of yacc.c */ -#line 338 "glcpp/glcpp-parse.y" +#line 323 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2136,7 +2121,7 @@ yyreduce: case 42: /* Line 1464 of yacc.c */ -#line 341 "glcpp/glcpp-parse.y" +#line 326 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2145,7 +2130,7 @@ yyreduce: case 43: /* Line 1464 of yacc.c */ -#line 344 "glcpp/glcpp-parse.y" +#line 329 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2154,7 +2139,7 @@ yyreduce: case 44: /* Line 1464 of yacc.c */ -#line 347 "glcpp/glcpp-parse.y" +#line 332 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2163,7 +2148,7 @@ yyreduce: case 45: /* Line 1464 of yacc.c */ -#line 350 "glcpp/glcpp-parse.y" +#line 335 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2172,7 +2157,7 @@ yyreduce: case 46: /* Line 1464 of yacc.c */ -#line 353 "glcpp/glcpp-parse.y" +#line 338 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2181,7 +2166,7 @@ yyreduce: case 47: /* Line 1464 of yacc.c */ -#line 356 "glcpp/glcpp-parse.y" +#line 341 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2190,7 +2175,7 @@ yyreduce: case 48: /* Line 1464 of yacc.c */ -#line 359 "glcpp/glcpp-parse.y" +#line 344 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2199,7 +2184,7 @@ yyreduce: case 49: /* Line 1464 of yacc.c */ -#line 365 "glcpp/glcpp-parse.y" +#line 350 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2210,7 +2195,7 @@ yyreduce: case 50: /* Line 1464 of yacc.c */ -#line 370 "glcpp/glcpp-parse.y" +#line 355 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2221,14 +2206,14 @@ yyreduce: case 51: /* Line 1464 of yacc.c */ -#line 378 "glcpp/glcpp-parse.y" +#line 363 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 53: /* Line 1464 of yacc.c */ -#line 383 "glcpp/glcpp-parse.y" +#line 368 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2237,14 +2222,14 @@ yyreduce: case 54: /* Line 1464 of yacc.c */ -#line 389 "glcpp/glcpp-parse.y" +#line 374 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 57: /* Line 1464 of yacc.c */ -#line 395 "glcpp/glcpp-parse.y" +#line 380 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2253,7 +2238,7 @@ yyreduce: case 58: /* Line 1464 of yacc.c */ -#line 402 "glcpp/glcpp-parse.y" +#line 387 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2263,7 +2248,7 @@ yyreduce: case 59: /* Line 1464 of yacc.c */ -#line 406 "glcpp/glcpp-parse.y" +#line 391 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2273,7 +2258,7 @@ yyreduce: case 61: /* Line 1464 of yacc.c */ -#line 415 "glcpp/glcpp-parse.y" +#line 400 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2285,7 +2270,7 @@ yyreduce: case 62: /* Line 1464 of yacc.c */ -#line 421 "glcpp/glcpp-parse.y" +#line 406 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2296,7 +2281,7 @@ yyreduce: case 63: /* Line 1464 of yacc.c */ -#line 429 "glcpp/glcpp-parse.y" +#line 414 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2308,7 +2293,7 @@ yyreduce: case 64: /* Line 1464 of yacc.c */ -#line 435 "glcpp/glcpp-parse.y" +#line 420 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2319,7 +2304,7 @@ yyreduce: case 65: /* Line 1464 of yacc.c */ -#line 443 "glcpp/glcpp-parse.y" +#line 428 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2329,7 +2314,7 @@ yyreduce: case 66: /* Line 1464 of yacc.c */ -#line 447 "glcpp/glcpp-parse.y" +#line 432 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2339,7 +2324,7 @@ yyreduce: case 67: /* Line 1464 of yacc.c */ -#line 451 "glcpp/glcpp-parse.y" +#line 436 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2349,7 +2334,7 @@ yyreduce: case 68: /* Line 1464 of yacc.c */ -#line 455 "glcpp/glcpp-parse.y" +#line 440 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2359,7 +2344,7 @@ yyreduce: case 69: /* Line 1464 of yacc.c */ -#line 459 "glcpp/glcpp-parse.y" +#line 444 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2369,224 +2354,224 @@ yyreduce: case 70: /* Line 1464 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +#line 451 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 71: /* Line 1464 of yacc.c */ -#line 467 "glcpp/glcpp-parse.y" +#line 452 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 72: /* Line 1464 of yacc.c */ -#line 468 "glcpp/glcpp-parse.y" +#line 453 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 73: /* Line 1464 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +#line 454 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 74: /* Line 1464 of yacc.c */ -#line 470 "glcpp/glcpp-parse.y" +#line 455 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 75: /* Line 1464 of yacc.c */ -#line 471 "glcpp/glcpp-parse.y" +#line 456 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 76: /* Line 1464 of yacc.c */ -#line 472 "glcpp/glcpp-parse.y" +#line 457 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 77: /* Line 1464 of yacc.c */ -#line 473 "glcpp/glcpp-parse.y" +#line 458 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 78: /* Line 1464 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +#line 459 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 79: /* Line 1464 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +#line 460 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 80: /* Line 1464 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +#line 461 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 81: /* Line 1464 of yacc.c */ -#line 477 "glcpp/glcpp-parse.y" +#line 462 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 82: /* Line 1464 of yacc.c */ -#line 478 "glcpp/glcpp-parse.y" +#line 463 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 83: /* Line 1464 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +#line 464 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 84: /* Line 1464 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +#line 465 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 85: /* Line 1464 of yacc.c */ -#line 481 "glcpp/glcpp-parse.y" +#line 466 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 86: /* Line 1464 of yacc.c */ -#line 482 "glcpp/glcpp-parse.y" +#line 467 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 87: /* Line 1464 of yacc.c */ -#line 483 "glcpp/glcpp-parse.y" +#line 468 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 88: /* Line 1464 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +#line 469 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 89: /* Line 1464 of yacc.c */ -#line 485 "glcpp/glcpp-parse.y" +#line 470 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 90: /* Line 1464 of yacc.c */ -#line 486 "glcpp/glcpp-parse.y" +#line 471 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 91: /* Line 1464 of yacc.c */ -#line 487 "glcpp/glcpp-parse.y" +#line 472 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 92: /* Line 1464 of yacc.c */ -#line 488 "glcpp/glcpp-parse.y" +#line 473 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 93: /* Line 1464 of yacc.c */ -#line 489 "glcpp/glcpp-parse.y" +#line 474 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 94: /* Line 1464 of yacc.c */ -#line 490 "glcpp/glcpp-parse.y" +#line 475 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 95: /* Line 1464 of yacc.c */ -#line 491 "glcpp/glcpp-parse.y" +#line 476 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 96: /* Line 1464 of yacc.c */ -#line 492 "glcpp/glcpp-parse.y" +#line 477 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 97: /* Line 1464 of yacc.c */ -#line 493 "glcpp/glcpp-parse.y" +#line 478 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 98: /* Line 1464 of yacc.c */ -#line 494 "glcpp/glcpp-parse.y" +#line 479 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 99: /* Line 1464 of yacc.c */ -#line 495 "glcpp/glcpp-parse.y" +#line 480 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 100: /* Line 1464 of yacc.c */ -#line 496 "glcpp/glcpp-parse.y" +#line 481 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1464 of yacc.c */ -#line 2590 "glcpp/glcpp-parse.c" +#line 2575 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2805,7 +2790,7 @@ yyreturn: /* Line 1684 of yacc.c */ -#line 499 "glcpp/glcpp-parse.y" +#line 484 "glcpp/glcpp-parse.y" string_list_t * @@ -3397,6 +3382,20 @@ _token_list_create_with_one_space (void *ctx) return list; } +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list) +{ + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, type, type); + _token_list_append (expanded, token); + _glcpp_parser_expand_token_list (parser, list); + _token_list_append_list (expanded, list); + glcpp_parser_lex_from (parser, expanded); +} + /* This is a helper function that's essentially part of the * implementation of _glcpp_parser_expand_node. It shouldn't be called * except for by that function. diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 55a8d1761e..e19da432ee 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -105,6 +105,9 @@ _active_list_pop (active_list_t *list); int _active_list_contains (active_list_t *list, const char *identifier); +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list); + static void _glcpp_parser_expand_token_list (glcpp_parser_t *parser, token_list_t *list); @@ -212,16 +215,7 @@ control_line: talloc_free ($2); } | HASH_IF conditional_tokens NEWLINE { - token_list_t *expanded; - token_t *token; - - expanded = _token_list_create (parser); - token = _token_create_ival (parser, IF_EXPANDED, IF_EXPANDED); - _token_list_append (expanded, token); - talloc_unlink (parser, token); - _glcpp_parser_expand_token_list (parser, $2); - _token_list_append_list (expanded, $2); - glcpp_parser_lex_from (parser, expanded); + _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); } | HASH_IFDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); @@ -234,16 +228,7 @@ control_line: _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { - token_list_t *expanded; - token_t *token; - - expanded = _token_list_create (parser); - token = _token_create_ival (parser, ELIF_EXPANDED, ELIF_EXPANDED); - _token_list_append (expanded, token); - talloc_unlink (parser, token); - _glcpp_parser_expand_token_list (parser, $2); - _token_list_append_list (expanded, $2); - glcpp_parser_lex_from (parser, expanded); + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); } | HASH_ELIF NEWLINE { /* #elif without an expression results in a warning if the @@ -1087,6 +1072,20 @@ _token_list_create_with_one_space (void *ctx) return list; } +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list) +{ + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, type, type); + _token_list_append (expanded, token); + _glcpp_parser_expand_token_list (parser, list); + _token_list_append_list (expanded, list); + glcpp_parser_lex_from (parser, expanded); +} + /* This is a helper function that's essentially part of the * implementation of _glcpp_parser_expand_node. It shouldn't be called * except for by that function. -- cgit v1.2.3 From c52b2be16689fbbe8a8ec190dbe9dc7e469956a0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:21:33 -0700 Subject: glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if. The original intention was to use #ifdef. --- src/glsl/glcpp/tests/073-if-in-ifdef.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/073-if-in-ifdef.c b/src/glsl/glcpp/tests/073-if-in-ifdef.c index b9155b521e..61a48097ca 100644 --- a/src/glsl/glcpp/tests/073-if-in-ifdef.c +++ b/src/glsl/glcpp/tests/073-if-in-ifdef.c @@ -1,4 +1,4 @@ -#if UNDEF +#ifdef UNDEF #if UNDEF > 1 #endif #endif -- cgit v1.2.3 From d65135a7661c320c618151df0a94c852dc9bc621 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:22:31 -0700 Subject: glcpp/tests: Add a corollary to testcase 073 for testing #elif. --- src/glsl/glcpp/tests/074-elif-undef.c | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/glsl/glcpp/tests/074-elif-undef.c (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/074-elif-undef.c b/src/glsl/glcpp/tests/074-elif-undef.c new file mode 100644 index 0000000000..67aac8977e --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c @@ -0,0 +1,3 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#endif -- cgit v1.2.3 From f4239872c9cb56d1e5735b62ea53bedf3f39dfb0 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 4 Aug 2010 16:24:39 -0700 Subject: glcpp: Ignore #if and #elif expressions when skipping. Fixes glcpp test cases 073 and 074, as well as piglit test xonotic-vs-generic-diffuse.vert. --- src/glsl/glcpp/glcpp-parse.c | 202 +++++++++++++++++++++++-------------------- src/glsl/glcpp/glcpp-parse.y | 18 +++- 2 files changed, 124 insertions(+), 96 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index df16cabeeb..e93f83263d 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -624,16 +624,16 @@ static const yytype_int8 yyrhs[] = static const yytype_uint16 yyrline[] = { 0, 172, 172, 174, 178, 181, 186, 187, 191, 194, - 200, 203, 206, 209, 217, 220, 225, 230, 233, 244, - 247, 250, 259, 263, 272, 277, 278, 281, 284, 287, - 290, 293, 296, 299, 302, 305, 308, 311, 314, 317, - 320, 323, 326, 329, 332, 335, 338, 341, 344, 350, - 355, 363, 364, 368, 374, 375, 378, 380, 387, 391, - 395, 400, 406, 414, 420, 428, 432, 436, 440, 444, - 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, - 481 + 200, 203, 206, 209, 217, 228, 233, 238, 247, 258, + 261, 264, 273, 277, 286, 291, 292, 295, 298, 301, + 304, 307, 310, 313, 316, 319, 322, 325, 328, 331, + 334, 337, 340, 343, 346, 349, 352, 355, 358, 364, + 369, 377, 378, 382, 388, 389, 392, 394, 401, 405, + 409, 414, 420, 428, 434, 442, 446, 450, 454, 458, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, + 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, + 495 }; #endif @@ -1865,14 +1865,22 @@ yyreduce: /* Line 1464 of yacc.c */ #line 217 "glcpp/glcpp-parse.y" { - _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + /* If we're skipping to the next #elif/#else case or to #endif, + * don't bother expanding or parsing the expression. + */ + if (parser->skip_stack != NULL && parser->skip_stack->type != SKIP_NO_SKIP) { + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), 0); + parser->skip_stack->type = SKIP_TO_ENDIF; + } else { + _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + } ;} break; case 15: /* Line 1464 of yacc.c */ -#line 220 "glcpp/glcpp-parse.y" +#line 228 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1883,7 +1891,7 @@ yyreduce: case 16: /* Line 1464 of yacc.c */ -#line 225 "glcpp/glcpp-parse.y" +#line 233 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1894,16 +1902,22 @@ yyreduce: case 17: /* Line 1464 of yacc.c */ -#line 230 "glcpp/glcpp-parse.y" +#line 238 "glcpp/glcpp-parse.y" { - _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + /* If we just finished a non-skipped #if/#ifdef/#ifndef block, + * don't bother expanding or parsing the expression. + */ + if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) + parser->skip_stack->type = SKIP_TO_ENDIF; + else + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list)); ;} break; case 18: /* Line 1464 of yacc.c */ -#line 233 "glcpp/glcpp-parse.y" +#line 247 "glcpp/glcpp-parse.y" { /* #elif without an expression results in a warning if the * condition doesn't matter (we just handled #if 1 or such) @@ -1920,7 +1934,7 @@ yyreduce: case 19: /* Line 1464 of yacc.c */ -#line 244 "glcpp/glcpp-parse.y" +#line 258 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1929,7 +1943,7 @@ yyreduce: case 20: /* Line 1464 of yacc.c */ -#line 247 "glcpp/glcpp-parse.y" +#line 261 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -1938,7 +1952,7 @@ yyreduce: case 21: /* Line 1464 of yacc.c */ -#line 250 "glcpp/glcpp-parse.y" +#line 264 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -1953,7 +1967,7 @@ yyreduce: case 23: /* Line 1464 of yacc.c */ -#line 263 "glcpp/glcpp-parse.y" +#line 277 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -1968,7 +1982,7 @@ yyreduce: case 24: /* Line 1464 of yacc.c */ -#line 272 "glcpp/glcpp-parse.y" +#line 286 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -1977,7 +1991,7 @@ yyreduce: case 26: /* Line 1464 of yacc.c */ -#line 278 "glcpp/glcpp-parse.y" +#line 292 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -1986,7 +2000,7 @@ yyreduce: case 27: /* Line 1464 of yacc.c */ -#line 281 "glcpp/glcpp-parse.y" +#line 295 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -1995,7 +2009,7 @@ yyreduce: case 28: /* Line 1464 of yacc.c */ -#line 284 "glcpp/glcpp-parse.y" +#line 298 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2004,7 +2018,7 @@ yyreduce: case 29: /* Line 1464 of yacc.c */ -#line 287 "glcpp/glcpp-parse.y" +#line 301 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2013,7 +2027,7 @@ yyreduce: case 30: /* Line 1464 of yacc.c */ -#line 290 "glcpp/glcpp-parse.y" +#line 304 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2022,7 +2036,7 @@ yyreduce: case 31: /* Line 1464 of yacc.c */ -#line 293 "glcpp/glcpp-parse.y" +#line 307 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2031,7 +2045,7 @@ yyreduce: case 32: /* Line 1464 of yacc.c */ -#line 296 "glcpp/glcpp-parse.y" +#line 310 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2040,7 +2054,7 @@ yyreduce: case 33: /* Line 1464 of yacc.c */ -#line 299 "glcpp/glcpp-parse.y" +#line 313 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2049,7 +2063,7 @@ yyreduce: case 34: /* Line 1464 of yacc.c */ -#line 302 "glcpp/glcpp-parse.y" +#line 316 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2058,7 +2072,7 @@ yyreduce: case 35: /* Line 1464 of yacc.c */ -#line 305 "glcpp/glcpp-parse.y" +#line 319 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2067,7 +2081,7 @@ yyreduce: case 36: /* Line 1464 of yacc.c */ -#line 308 "glcpp/glcpp-parse.y" +#line 322 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2076,7 +2090,7 @@ yyreduce: case 37: /* Line 1464 of yacc.c */ -#line 311 "glcpp/glcpp-parse.y" +#line 325 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2085,7 +2099,7 @@ yyreduce: case 38: /* Line 1464 of yacc.c */ -#line 314 "glcpp/glcpp-parse.y" +#line 328 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2094,7 +2108,7 @@ yyreduce: case 39: /* Line 1464 of yacc.c */ -#line 317 "glcpp/glcpp-parse.y" +#line 331 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2103,7 +2117,7 @@ yyreduce: case 40: /* Line 1464 of yacc.c */ -#line 320 "glcpp/glcpp-parse.y" +#line 334 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2112,7 +2126,7 @@ yyreduce: case 41: /* Line 1464 of yacc.c */ -#line 323 "glcpp/glcpp-parse.y" +#line 337 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2121,7 +2135,7 @@ yyreduce: case 42: /* Line 1464 of yacc.c */ -#line 326 "glcpp/glcpp-parse.y" +#line 340 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2130,7 +2144,7 @@ yyreduce: case 43: /* Line 1464 of yacc.c */ -#line 329 "glcpp/glcpp-parse.y" +#line 343 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2139,7 +2153,7 @@ yyreduce: case 44: /* Line 1464 of yacc.c */ -#line 332 "glcpp/glcpp-parse.y" +#line 346 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2148,7 +2162,7 @@ yyreduce: case 45: /* Line 1464 of yacc.c */ -#line 335 "glcpp/glcpp-parse.y" +#line 349 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2157,7 +2171,7 @@ yyreduce: case 46: /* Line 1464 of yacc.c */ -#line 338 "glcpp/glcpp-parse.y" +#line 352 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2166,7 +2180,7 @@ yyreduce: case 47: /* Line 1464 of yacc.c */ -#line 341 "glcpp/glcpp-parse.y" +#line 355 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2175,7 +2189,7 @@ yyreduce: case 48: /* Line 1464 of yacc.c */ -#line 344 "glcpp/glcpp-parse.y" +#line 358 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2184,7 +2198,7 @@ yyreduce: case 49: /* Line 1464 of yacc.c */ -#line 350 "glcpp/glcpp-parse.y" +#line 364 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2195,7 +2209,7 @@ yyreduce: case 50: /* Line 1464 of yacc.c */ -#line 355 "glcpp/glcpp-parse.y" +#line 369 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2206,14 +2220,14 @@ yyreduce: case 51: /* Line 1464 of yacc.c */ -#line 363 "glcpp/glcpp-parse.y" +#line 377 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 53: /* Line 1464 of yacc.c */ -#line 368 "glcpp/glcpp-parse.y" +#line 382 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2222,14 +2236,14 @@ yyreduce: case 54: /* Line 1464 of yacc.c */ -#line 374 "glcpp/glcpp-parse.y" +#line 388 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 57: /* Line 1464 of yacc.c */ -#line 380 "glcpp/glcpp-parse.y" +#line 394 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2238,7 +2252,7 @@ yyreduce: case 58: /* Line 1464 of yacc.c */ -#line 387 "glcpp/glcpp-parse.y" +#line 401 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2248,7 +2262,7 @@ yyreduce: case 59: /* Line 1464 of yacc.c */ -#line 391 "glcpp/glcpp-parse.y" +#line 405 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2258,7 +2272,7 @@ yyreduce: case 61: /* Line 1464 of yacc.c */ -#line 400 "glcpp/glcpp-parse.y" +#line 414 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2270,7 +2284,7 @@ yyreduce: case 62: /* Line 1464 of yacc.c */ -#line 406 "glcpp/glcpp-parse.y" +#line 420 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2281,7 +2295,7 @@ yyreduce: case 63: /* Line 1464 of yacc.c */ -#line 414 "glcpp/glcpp-parse.y" +#line 428 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2293,7 +2307,7 @@ yyreduce: case 64: /* Line 1464 of yacc.c */ -#line 420 "glcpp/glcpp-parse.y" +#line 434 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2304,7 +2318,7 @@ yyreduce: case 65: /* Line 1464 of yacc.c */ -#line 428 "glcpp/glcpp-parse.y" +#line 442 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2314,7 +2328,7 @@ yyreduce: case 66: /* Line 1464 of yacc.c */ -#line 432 "glcpp/glcpp-parse.y" +#line 446 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2324,7 +2338,7 @@ yyreduce: case 67: /* Line 1464 of yacc.c */ -#line 436 "glcpp/glcpp-parse.y" +#line 450 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2334,7 +2348,7 @@ yyreduce: case 68: /* Line 1464 of yacc.c */ -#line 440 "glcpp/glcpp-parse.y" +#line 454 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2344,7 +2358,7 @@ yyreduce: case 69: /* Line 1464 of yacc.c */ -#line 444 "glcpp/glcpp-parse.y" +#line 458 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2354,224 +2368,224 @@ yyreduce: case 70: /* Line 1464 of yacc.c */ -#line 451 "glcpp/glcpp-parse.y" +#line 465 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 71: /* Line 1464 of yacc.c */ -#line 452 "glcpp/glcpp-parse.y" +#line 466 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 72: /* Line 1464 of yacc.c */ -#line 453 "glcpp/glcpp-parse.y" +#line 467 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 73: /* Line 1464 of yacc.c */ -#line 454 "glcpp/glcpp-parse.y" +#line 468 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 74: /* Line 1464 of yacc.c */ -#line 455 "glcpp/glcpp-parse.y" +#line 469 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 75: /* Line 1464 of yacc.c */ -#line 456 "glcpp/glcpp-parse.y" +#line 470 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 76: /* Line 1464 of yacc.c */ -#line 457 "glcpp/glcpp-parse.y" +#line 471 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 77: /* Line 1464 of yacc.c */ -#line 458 "glcpp/glcpp-parse.y" +#line 472 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 78: /* Line 1464 of yacc.c */ -#line 459 "glcpp/glcpp-parse.y" +#line 473 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 79: /* Line 1464 of yacc.c */ -#line 460 "glcpp/glcpp-parse.y" +#line 474 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 80: /* Line 1464 of yacc.c */ -#line 461 "glcpp/glcpp-parse.y" +#line 475 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 81: /* Line 1464 of yacc.c */ -#line 462 "glcpp/glcpp-parse.y" +#line 476 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 82: /* Line 1464 of yacc.c */ -#line 463 "glcpp/glcpp-parse.y" +#line 477 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 83: /* Line 1464 of yacc.c */ -#line 464 "glcpp/glcpp-parse.y" +#line 478 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 84: /* Line 1464 of yacc.c */ -#line 465 "glcpp/glcpp-parse.y" +#line 479 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 85: /* Line 1464 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +#line 480 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 86: /* Line 1464 of yacc.c */ -#line 467 "glcpp/glcpp-parse.y" +#line 481 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 87: /* Line 1464 of yacc.c */ -#line 468 "glcpp/glcpp-parse.y" +#line 482 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 88: /* Line 1464 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +#line 483 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 89: /* Line 1464 of yacc.c */ -#line 470 "glcpp/glcpp-parse.y" +#line 484 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 90: /* Line 1464 of yacc.c */ -#line 471 "glcpp/glcpp-parse.y" +#line 485 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 91: /* Line 1464 of yacc.c */ -#line 472 "glcpp/glcpp-parse.y" +#line 486 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 92: /* Line 1464 of yacc.c */ -#line 473 "glcpp/glcpp-parse.y" +#line 487 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 93: /* Line 1464 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +#line 488 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 94: /* Line 1464 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +#line 489 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 95: /* Line 1464 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +#line 490 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 96: /* Line 1464 of yacc.c */ -#line 477 "glcpp/glcpp-parse.y" +#line 491 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 97: /* Line 1464 of yacc.c */ -#line 478 "glcpp/glcpp-parse.y" +#line 492 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 98: /* Line 1464 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +#line 493 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 99: /* Line 1464 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +#line 494 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 100: /* Line 1464 of yacc.c */ -#line 481 "glcpp/glcpp-parse.y" +#line 495 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1464 of yacc.c */ -#line 2575 "glcpp/glcpp-parse.c" +#line 2589 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2790,7 +2804,7 @@ yyreturn: /* Line 1684 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +#line 498 "glcpp/glcpp-parse.y" string_list_t * diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index e19da432ee..df1a649d9b 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -215,7 +215,15 @@ control_line: talloc_free ($2); } | HASH_IF conditional_tokens NEWLINE { - _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); + /* If we're skipping to the next #elif/#else case or to #endif, + * don't bother expanding or parsing the expression. + */ + if (parser->skip_stack != NULL && parser->skip_stack->type != SKIP_NO_SKIP) { + _glcpp_parser_skip_stack_push_if (parser, & @1, 0); + parser->skip_stack->type = SKIP_TO_ENDIF; + } else { + _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); + } } | HASH_IFDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); @@ -228,7 +236,13 @@ control_line: _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { - _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); + /* If we just finished a non-skipped #if/#ifdef/#ifndef block, + * don't bother expanding or parsing the expression. + */ + if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) + parser->skip_stack->type = SKIP_TO_ENDIF; + else + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); } | HASH_ELIF NEWLINE { /* #elif without an expression results in a warning if the -- cgit v1.2.3 From c5b9cab49900cbcab78911361976a3678d49e853 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Aug 2010 23:23:15 -0700 Subject: glsl2: Catch pointless copies in copy propagation. We wouldn't want to go rewriting dereferences to variables to point at the same variable it did before. While I didn't find a way to trigger that, a shader in Yo Frankie managed to produce a self-assignment by passing a constant to a function doing self assignment like this. Cleans up the IR for glsl-deadcode-self-assign.shader_test --- src/glsl/ir_copy_propagation.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 26588a352c..1d28392d7c 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -213,7 +213,7 @@ kill_invalidated_copies(ir_assignment *ir, exec_list *acp) * Adds an entry to the available copy list if it's a plain assignment * of a variable to a variable. */ -static void +static bool add_copy(void *ctx, ir_assignment *ir, exec_list *acp) { acp_entry *entry; @@ -221,16 +221,28 @@ add_copy(void *ctx, ir_assignment *ir, exec_list *acp) if (ir->condition) { ir_constant *condition = ir->condition->as_constant(); if (!condition || !condition->value.b[0]) - return; + return false; } ir_variable *lhs_var = ir->whole_variable_written(); ir_variable *rhs_var = ir->rhs->whole_variable_referenced(); if ((lhs_var != NULL) && (rhs_var != NULL)) { - entry = new(ctx) acp_entry(lhs_var, rhs_var); - acp->push_tail(entry); + if (lhs_var == rhs_var) { + /* This is a dumb assignment, but we've conveniently noticed + * it here. Removing it now would mess up the loop iteration + * calling us. Just flag it to not execute, and someone else + * will clean up the mess. + */ + ir->condition = new(talloc_parent(ir)) ir_constant(false); + return true; + } else { + entry = new(ctx) acp_entry(lhs_var, rhs_var); + acp->push_tail(entry); + } } + + return false; } static void @@ -253,7 +265,7 @@ copy_propagation_basic_block(ir_instruction *first, if (ir_assign) { kill_invalidated_copies(ir_assign, &acp); - add_copy(ctx, ir_assign, &acp); + progress = add_copy(ctx, ir_assign, &acp) || progress; } if (ir == last) break; -- cgit v1.2.3 From 2e853ca23c8670246dd4efcee0706f68097652f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 10:09:12 -0700 Subject: glsl2: Add a pass for removing unused functions. For a shader involving many small functions, this avoids running optimization across all of them after they've been inlined post-linking. Reduces the runtime of linking and running a fragment shader from Yo Frankie from 1.6 seconds to 0.9 seconds (-44.9%, +/- 3.3%). --- src/glsl/Makefile | 1 + src/glsl/glsl_symbol_table.h | 6 ++ src/glsl/ir.h | 1 - src/glsl/ir_dead_functions.cpp | 151 +++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/glsl/linker.cpp | 1 + 6 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/glsl/ir_dead_functions.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 3102947494..844385792a 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -39,6 +39,7 @@ CXX_SOURCES = \ ir.cpp \ ir_dead_code.cpp \ ir_dead_code_local.cpp \ + ir_dead_functions.cpp \ ir_div_to_mul_rcp.cpp \ ir_expression_flattening.cpp \ ir_function_can_inline.cpp \ diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 27e825597c..02e4542cf3 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -133,6 +133,12 @@ public: return _mesa_symbol_table_add_symbol(table, glsl_function_name_space, name, f) == 0; } + + bool remove_function(const char *name, ir_function *f) + { + return _mesa_symbol_table_add_symbol(table, glsl_function_name_space, + name, f) == 0; + } /*@}*/ /** diff --git a/src/glsl/ir.h b/src/glsl/ir.h index e61485813d..f58602515e 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -410,7 +410,6 @@ public: */ const char *name; -private: /** * List of ir_function_signature for each overloaded function with this name. */ diff --git a/src/glsl/ir_dead_functions.cpp b/src/glsl/ir_dead_functions.cpp new file mode 100644 index 0000000000..26554441d3 --- /dev/null +++ b/src/glsl/ir_dead_functions.cpp @@ -0,0 +1,151 @@ + /* + * 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 ir_dead_functions.cpp + * + * Eliminates unused functions from the linked program. + */ + + #include "ir.h" + #include "ir_visitor.h" + #include "ir_expression_flattening.h" + #include "glsl_types.h" + + class signature_entry : public exec_node + { + public: + signature_entry(ir_function_signature *sig) + { + this->signature = sig; + this->used = false; + } + + ir_function_signature *signature; + bool used; + }; + + class ir_dead_functions_visitor : public ir_hierarchical_visitor { + public: + ir_dead_functions_visitor() + { + this->mem_ctx = talloc_new(NULL); + } + + ~ir_dead_functions_visitor() + { + talloc_free(this->mem_ctx); + } + + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit_enter(ir_call *); + + signature_entry *get_signature_entry(ir_function_signature *var); + + bool (*predicate)(ir_instruction *ir); + + /* List of signature_entry */ + exec_list signature_list; + void *mem_ctx; + }; + + + signature_entry * + ir_dead_functions_visitor::get_signature_entry(ir_function_signature *sig) + { + foreach_iter(exec_list_iterator, iter, this->signature_list) { + signature_entry *entry = (signature_entry *)iter.get(); + if (entry->signature == sig) + return entry; + } + + signature_entry *entry = new(mem_ctx) signature_entry(sig); + this->signature_list.push_tail(entry); + return entry; + } + + + ir_visitor_status + ir_dead_functions_visitor::visit_enter(ir_function_signature *ir) + { + signature_entry *entry = this->get_signature_entry(ir); + + if (strcmp(ir->function_name(), "main") == 0) { + entry->used = true; + } + + return visit_continue; + } + + + ir_visitor_status + ir_dead_functions_visitor::visit_enter(ir_call *ir) + { + signature_entry *entry = this->get_signature_entry(ir->get_callee()); + + entry->used = true; + + return visit_continue; +} + +bool +do_dead_functions(exec_list *instructions) +{ + ir_dead_functions_visitor v; + bool progress = false; + + visit_list_elements(&v, instructions); + + /* Now that we've figured out which function signatures are used, remove + * the unused ones, and remove function definitions that have no more + * signatures. + */ + foreach_iter(exec_list_iterator, iter, v.signature_list) { + signature_entry *entry = (signature_entry *)iter.get(); + + if (!entry->used) { + entry->signature->remove(); + progress = true; + } + delete(entry); + } + + /* We don't just do this above when we nuked a signature because of + * const pointers. + */ + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *func = ir->as_function(); + + if (func && func->signatures.is_empty()) { + /* At this point (post-linking), the symbol table is no + * longer in use, so not removing the function from the + * symbol table should be OK. + */ + func->remove(); + progress = true; + } + } + + return progress; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 55ec327193..e0c0715cf5 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -36,6 +36,7 @@ bool do_copy_propagation(exec_list *instructions); bool do_dead_code(exec_list *instructions); bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(exec_list *instructions); +bool do_dead_functions(exec_list *instructions); bool do_div_to_mul_rcp(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_return(exec_list *instructions); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 94db57d6a5..f9e24ca0f1 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1286,6 +1286,7 @@ link_shaders(struct gl_shader_program *prog) progress = false; progress = do_function_inlining(ir) || progress; + progress = do_dead_functions(ir) || progress; progress = do_if_simplification(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_dead_code_local(ir) || progress; -- cgit v1.2.3 From 3bd7e70bf7c4a9a52b425284c9f23689f00de93c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 12:07:23 -0700 Subject: glsl2: Add some easy-to-enable debug printfs to ir_dead_code.cpp. --- src/glsl/ir_dead_code.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index bf032f1dc2..a8d264f39a 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -32,6 +32,8 @@ #include "ir_variable_refcount.h" #include "glsl_types.h" +static bool debug = false; + /** * Do a dead code pass over instructions and everything that instructions * references. @@ -60,6 +62,13 @@ do_dead_code(exec_list *instructions) */ assert(entry->referenced_count >= entry->assigned_count); + if (debug) { + printf("%s@%p: %d refs, %d assigns, %sdeclared in our scope\n", + entry->var->name, entry->var, + entry->referenced_count, entry->assigned_count, + entry->declaration ? "" : "not "); + } + if ((entry->referenced_count > entry->assigned_count) || !entry->declaration) continue; @@ -72,6 +81,11 @@ do_dead_code(exec_list *instructions) entry->var->mode != ir_var_inout) { entry->assign->remove(); progress = true; + + if (debug) { + printf("Removed assignment to %s@%p\n", + entry->var->name, entry->var); + } } } else { /* If there are no assignments or references to the variable left, @@ -79,6 +93,11 @@ do_dead_code(exec_list *instructions) */ entry->var->remove(); progress = true; + + if (debug) { + printf("Removed declaration of %s@%p\n", + entry->var->name, entry->var); + } } } talloc_free(v.mem_ctx); -- cgit v1.2.3 From 9f82806c7b5109553cf806a5652e6b6198665094 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 12:10:31 -0700 Subject: glsl2: Don't dead-code eliminate a call where the return value is unused. This showed up since the disabling of inlining at compile time, which I apparently didn't regenerate piglit summary for. Fixes: glsl-deadcode-call. --- src/glsl/ir.h | 3 +++ src/glsl/ir_basic_block.cpp | 13 +++++++++---- src/glsl/ir_dead_code.cpp | 3 ++- src/glsl/ir_dead_code_local.cpp | 7 ++++++- 4 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index f58602515e..ef8339ce19 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1389,4 +1389,7 @@ extern void import_prototypes(const exec_list *source, exec_list *dest, class glsl_symbol_table *symbols, void *mem_ctx); +extern bool +ir_has_call(ir_instruction *ir); + #endif /* IR_H */ diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index f9953ea42d..a833825962 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -49,6 +49,14 @@ public: bool has_call; }; +bool +ir_has_call(ir_instruction *ir) +{ + ir_has_call_visitor v; + ir->accept(&v); + return v.has_call; +} + /** * Calls a user function for every basic block in the instruction stream. * @@ -115,8 +123,6 @@ void call_for_basic_blocks(exec_list *instructions, call_for_basic_blocks(&ir_sig->body, callback, data); } } else if (ir->as_assignment()) { - ir_has_call_visitor v; - /* If there's a call in the expression tree being assigned, * then that ends the BB too. * @@ -130,8 +136,7 @@ void call_for_basic_blocks(exec_list *instructions, * expression flattener may be useful before using the basic * block finder to get more maximal basic blocks out. */ - ir->accept(&v); - if (v.has_call) { + if (ir_has_call(ir)) { callback(leader, ir, data); leader = NULL; } diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index a8d264f39a..87988871c7 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -78,7 +78,8 @@ do_dead_code(exec_list *instructions) * Don't do so if it's a shader output, though. */ if (entry->var->mode != ir_var_out && - entry->var->mode != ir_var_inout) { + entry->var->mode != ir_var_inout && + !ir_has_call(entry->assign)) { entry->assign->remove(); progress = true; diff --git a/src/glsl/ir_dead_code_local.cpp b/src/glsl/ir_dead_code_local.cpp index b22cc558df..4bbedf0ff9 100644 --- a/src/glsl/ir_dead_code_local.cpp +++ b/src/glsl/ir_dead_code_local.cpp @@ -156,7 +156,12 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) } } - /* Add this instruction to the assignment list. */ + /* Add this instruction to the assignment list available to be removed. + * But not if the assignment has other side effects. + */ + if (ir_has_call(ir)) + return progress; + assignment_entry *entry = new(ctx) assignment_entry(var, ir); assignments->push_tail(entry); -- cgit v1.2.3 From b259eb28049fc06ebc75a7714834b9ed037a3454 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 12:24:36 -0700 Subject: glsl2: Don't tree-grafting out assignment to an out variable. Fixes: glsl-deadcode-varying. --- src/glsl/ir_tree_grafting.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index 38034a6197..1a742f412c 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -319,6 +319,10 @@ tree_grafting_basic_block(ir_instruction *bb_first, if (!lhs_var) continue; + if (lhs_var->mode == ir_var_out || + lhs_var->mode == ir_var_inout) + continue; + struct variable_entry *entry = info->refs->get_variable_entry(lhs_var); if (!entry->declaration || -- cgit v1.2.3 From c314c8f2310fa0ac51b8953e139f9504e08eb48f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 12:52:29 -0700 Subject: glsl2: Fix the dereferences_variable check in ir_tree_grafting. The HV doesn't descend into ir_variable, which is generally a good thing (allowing one to distinguish between variable declarations and refs), but here we never saw tree grafting opportunities killed because we were looking for the ir_variable child of a dereference to get visited. Fixes: glsl1-function call with inout params --- src/glsl/ir_tree_grafting.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index 1a742f412c..e80db31cb3 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -92,8 +92,9 @@ void dereferences_variable_callback(ir_instruction *ir, void *data) { struct find_deref_info *info = (struct find_deref_info *)data; + ir_dereference_variable *deref = ir->as_dereference_variable(); - if (ir == info->var) + if (deref && deref->var == info->var) info->found = true; } @@ -123,7 +124,7 @@ ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue) if (debug) { printf("GRAFTING:\n"); - this->graft_assign->rhs->print(); + this->graft_assign->print(); printf("\n"); printf("TO:\n"); (*rvalue)->print(); -- cgit v1.2.3 From 7f7eaf0285d011f7cc7e1a63133184a50b24ecaa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 11:01:09 -0700 Subject: ir_structure_splitting: New pass to chop structures into their components. This doesn't do anything if your structure goes through an uninlined function call or if whole-structure assignment occurs. As such, the impact is limited, at least until we do some global copy propagation to reduce whole-structure assignment. --- src/glsl/Makefile | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/ir_structure_splitting.cpp | 378 ++++++++++++++++++++++++++++++++++++ src/glsl/linker.cpp | 1 + 4 files changed, 381 insertions(+) create mode 100644 src/glsl/ir_structure_splitting.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 844385792a..53567508a0 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -55,6 +55,7 @@ CXX_SOURCES = \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ + ir_structure_splitting.cpp \ ir_swizzle_swizzle.cpp \ ir_tree_grafting.cpp \ ir_validate.cpp \ diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index e0c0715cf5..eac28dc64c 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -44,6 +44,7 @@ bool do_if_simplification(exec_list *instructions); bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); +bool do_structure_splitting(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); bool do_tree_grafting(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp new file mode 100644 index 0000000000..f57ae44aae --- /dev/null +++ b/src/glsl/ir_structure_splitting.cpp @@ -0,0 +1,378 @@ +/* + * 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 ir_structure_splitting.cpp + * + * If a structure is only ever referenced by its components, then + * split those components out to individual variables so they can be + * handled normally by other optimization passes. + * + * This skips structures like uniforms, which need to be accessible as + * structures for their access by the GL. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var) + { + this->var = var; + this->whole_structure_access = 0; + this->declaration = false; + this->components = NULL; + this->mem_ctx = NULL; + } + + ir_variable *var; /* The key: the variable's pointer. */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned whole_structure_access; + + bool declaration; /* If the variable had a decl in the instruction stream */ + + ir_variable **components; + + /** talloc_parent(this->var) -- the shader's talloc context. */ + void *mem_ctx; +}; + +class ir_structure_reference_visitor : public ir_hierarchical_visitor { +public: + ir_structure_reference_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + this->variable_list.make_empty(); + } + + ~ir_structure_reference_visitor(void) + { + talloc_free(mem_ctx); + } + + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit(ir_dereference_record *); + + virtual ir_visitor_status visit_enter(ir_function_signature *); + + variable_entry *get_variable_entry(ir_variable *var); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; + +variable_entry * +ir_structure_reference_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + + if (!var->type->is_record()) + return NULL; + + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) + return entry; + } + + variable_entry *entry = new(mem_ctx) variable_entry(var); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_structure_reference_visitor::visit(ir_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir); + + if (entry) + entry->declaration = true; + + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->variable_referenced(); + variable_entry *entry = this->get_variable_entry(var); + + if (entry) + entry->whole_structure_access++; + + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit(ir_dereference_record *ir) +{ + /* Don't descend into the ir_dereference_variable below. */ + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + +class ir_structure_splitting_visitor : public ir_hierarchical_visitor { +public: + ir_structure_splitting_visitor(exec_list *vars) + { + this->variable_list = vars; + } + + virtual ~ir_structure_splitting_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_expression *); + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_return *); + virtual ir_visitor_status visit_leave(ir_swizzle *); + virtual ir_visitor_status visit_leave(ir_texture *); + + void split_deref(ir_dereference **deref); + void split_rvalue(ir_rvalue **rvalue); + struct variable_entry *get_splitting_entry(ir_variable *var); + + exec_list *variable_list; + void *mem_ctx; +}; + +struct variable_entry * +ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) +{ + assert(var); + + if (!var->type->is_record()) + return NULL; + + foreach_iter(exec_list_iterator, iter, *this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) { + return entry; + } + } + + return NULL; +} + +void +ir_structure_splitting_visitor::split_deref(ir_dereference **deref) +{ + if ((*deref)->ir_type != ir_type_dereference_record) + return; + + ir_dereference_record *deref_record = (ir_dereference_record *)deref; + ir_dereference_variable *deref_var = deref_record->as_dereference_variable(); + if (!deref_var) + return; + + variable_entry *entry = get_splitting_entry(deref_var->var); + if (entry) + return; + + unsigned int i; + for (i = 0; i < entry->var->type->length; i++) { + if (strcmp(deref_record->field, + entry->var->type->fields.structure[i].name) == 0) + break; + } + assert(i != entry->var->type->length); + + *deref = new(entry->mem_ctx) ir_dereference_variable(entry->components[i]); +} + +void +ir_structure_splitting_visitor::split_rvalue(ir_rvalue **rvalue) +{ + ir_dereference *deref = (*rvalue)->as_dereference(); + + if (!deref) + return; + + split_deref(&deref); + *rvalue = deref; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_expression *ir) +{ + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + split_rvalue(&ir->operands[operand]); + } + + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_texture *ir) +{ + split_rvalue(&ir->coordinate); + split_rvalue(&ir->projector); + split_rvalue(&ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + split_rvalue(&ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + split_rvalue(&ir->lod_info.lod); + break; + case ir_txd: + split_rvalue(&ir->lod_info.grad.dPdx); + split_rvalue(&ir->lod_info.grad.dPdy); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_swizzle *ir) +{ + split_rvalue(&ir->val); + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_dereference_array *ir) +{ + split_rvalue(&ir->array_index); + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) +{ + split_rvalue(&ir->rhs); + split_rvalue(&ir->condition); + split_deref(&ir->lhs); + + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + split_rvalue(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_return *ir) +{ + split_rvalue(&ir->value);; + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_if *ir) +{ + split_rvalue(&ir->condition); + return visit_continue; +} + + +bool +do_structure_splitting(exec_list *instructions) +{ + ir_structure_reference_visitor refs; + void *mem_ctx = talloc_new(NULL); + + /* Trim out variables we can't split. */ + foreach_iter(exec_list_iterator, iter, refs.variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (!entry->declaration || entry->whole_structure_access) { + entry->remove(); + } + } + + if (refs.variable_list.is_empty()) + return false; + + /* Replace the decls of the structures to be split with their split + * components. + */ + foreach_iter(exec_list_iterator, iter, refs.variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + const struct glsl_type *type = entry->var->type; + + entry->mem_ctx = talloc_parent(entry->var); + + entry->components = talloc_array(mem_ctx, + ir_variable *, + type->length); + + for (unsigned int i = 0; i < entry->var->type->length; i++) { + const char *name = talloc_asprintf(mem_ctx, "%s_%s", + type->name, + type->fields.structure[i].name); + + entry->components[i] = + new(entry->mem_ctx) ir_variable(type->fields.structure[i].type, + name, + ir_var_temporary); + entry->var->insert_before(entry->components[i]); + } + + entry->var->remove(); + } + + ir_structure_splitting_visitor split(&refs.variable_list); + visit_list_elements(&split, instructions); + + talloc_free(mem_ctx); + + return true; +} diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index f9e24ca0f1..050116954a 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1287,6 +1287,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_function_inlining(ir) || progress; progress = do_dead_functions(ir) || progress; + progress = do_structure_splitting(ir) || progress; progress = do_if_simplification(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_dead_code_local(ir) || progress; -- cgit v1.2.3 From 748f81a8eacabf07e1d26372a61683e6759a61a3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 13:33:38 -0700 Subject: glsl2: Make the HV actually call ir_texture's visit_leave. --- src/glsl/ir_hv_accept.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp index 8989605e26..6dae4ed2f3 100644 --- a/src/glsl/ir_hv_accept.cpp +++ b/src/glsl/ir_hv_accept.cpp @@ -212,7 +212,7 @@ ir_texture::accept(ir_hierarchical_visitor *v) break; } - return visit_continue_with_parent; + return (s == visit_stop) ? s : v->visit_leave(this); } -- cgit v1.2.3 From 0a0ab121f87a3b00e29c20a38fdd28e2fc31bae7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 13:25:39 -0700 Subject: ir_structure_splitting: Massive fixing to this. I'd missed putting in the actual "find structures to split" part, so most of the code didn't do anything. I was running on too large of an app and assuming the lack of progress was elsewhere. --- src/glsl/ir_structure_splitting.cpp | 43 +++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index f57ae44aae..902eeadb2a 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -34,8 +34,11 @@ #include "ir.h" #include "ir_visitor.h" +#include "ir_print_visitor.h" #include "glsl_types.h" +static bool debug = false; + class variable_entry : public exec_node { public: @@ -76,7 +79,7 @@ public: virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit(ir_dereference_variable *); - virtual ir_visitor_status visit(ir_dereference_record *); + virtual ir_visitor_status visit_enter(ir_dereference_record *); virtual ir_visitor_status visit_enter(ir_function_signature *); @@ -93,7 +96,7 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var) { assert(var); - if (!var->type->is_record()) + if (!var->type->is_record() || var->mode == ir_var_uniform) return NULL; foreach_iter(exec_list_iterator, iter, this->variable_list) { @@ -132,10 +135,10 @@ ir_structure_reference_visitor::visit(ir_dereference_variable *ir) } ir_visitor_status -ir_structure_reference_visitor::visit(ir_dereference_record *ir) +ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir) { /* Don't descend into the ir_dereference_variable below. */ - return visit_continue; + return visit_continue_with_parent; } ir_visitor_status @@ -162,6 +165,7 @@ public: virtual ir_visitor_status visit_leave(ir_assignment *); virtual ir_visitor_status visit_leave(ir_call *); virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_dereference_record *); virtual ir_visitor_status visit_leave(ir_expression *); virtual ir_visitor_status visit_leave(ir_if *); virtual ir_visitor_status visit_leave(ir_return *); @@ -200,13 +204,13 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref) if ((*deref)->ir_type != ir_type_dereference_record) return; - ir_dereference_record *deref_record = (ir_dereference_record *)deref; - ir_dereference_variable *deref_var = deref_record->as_dereference_variable(); + ir_dereference_record *deref_record = (ir_dereference_record *)*deref; + ir_dereference_variable *deref_var = deref_record->record->as_dereference_variable(); if (!deref_var) return; variable_entry *entry = get_splitting_entry(deref_var->var); - if (entry) + if (!entry) return; unsigned int i; @@ -223,6 +227,9 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref) void ir_structure_splitting_visitor::split_rvalue(ir_rvalue **rvalue) { + if (!*rvalue) + return; + ir_dereference *deref = (*rvalue)->as_dereference(); if (!deref) @@ -281,6 +288,14 @@ ir_visitor_status ir_structure_splitting_visitor::visit_leave(ir_dereference_array *ir) { split_rvalue(&ir->array_index); + split_rvalue(&ir->array); + return visit_continue; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_dereference_record *ir) +{ + split_rvalue(&ir->record); return visit_continue; } @@ -328,11 +343,19 @@ bool do_structure_splitting(exec_list *instructions) { ir_structure_reference_visitor refs; - void *mem_ctx = talloc_new(NULL); + + visit_list_elements(&refs, instructions); /* Trim out variables we can't split. */ foreach_iter(exec_list_iterator, iter, refs.variable_list) { variable_entry *entry = (variable_entry *)iter.get(); + + if (debug) { + printf("structure %s@%p: decl %d, whole_access %d\n", + entry->var->name, entry->var, entry->declaration, + entry->whole_structure_access); + } + if (!entry->declaration || entry->whole_structure_access) { entry->remove(); } @@ -341,6 +364,8 @@ do_structure_splitting(exec_list *instructions) if (refs.variable_list.is_empty()) return false; + void *mem_ctx = talloc_new(NULL); + /* Replace the decls of the structures to be split with their split * components. */ @@ -356,7 +381,7 @@ do_structure_splitting(exec_list *instructions) for (unsigned int i = 0; i < entry->var->type->length; i++) { const char *name = talloc_asprintf(mem_ctx, "%s_%s", - type->name, + entry->var->name, type->fields.structure[i].name); entry->components[i] = -- cgit v1.2.3 From 8048226b7b1bbe8fd89f9c32fa4fadca4b8760c4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 14:41:09 -0700 Subject: glsl2: Insert global declarations at the top of the instruction stream. Fixes use-before-decl in glslparsertest shaders. Fixes: CorrectFull.frag CorrectModule.frag --- src/glsl/ast_to_hir.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 292c7be621..f14341c8f7 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1951,7 +1951,14 @@ ast_declarator_list::hir(exec_list *instructions, decl->identifier); } - instructions->push_tail(var); + /* Push the variable declaration to the top. It means that all + * the variable declarations will appear in a funny + * last-to-first order, but otherwise we run into trouble if a + * function is prototyped, a global var is decled, then the + * function is defined with usage of the global var. See + * glslparsertest's CorrectModule.frag. + */ + instructions->push_head(var); instructions->append_list(&initializer_instructions); /* Add the variable to the symbol table after processing the initializer. -- cgit v1.2.3 From bc4034b243975089c06c4415d4e26edaaaec7a46 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 15:22:05 -0700 Subject: glsl2: Add a pass to convert exp and log to exp2 and log2. Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG opcode that doesn't do what we want. This also lets the multiplication coefficients in there get constant-folded, possibly. Fixes: glsl-fs-log --- src/glsl/Makefile | 1 + src/glsl/ir.h | 4 +- src/glsl/ir_explog_to_explog2.cpp | 85 +++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/glsl/ir_validate.cpp | 4 ++ src/glsl/linker.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 7 +--- 7 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 src/glsl/ir_explog_to_explog2.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 53567508a0..752e60a79f 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -41,6 +41,7 @@ CXX_SOURCES = \ ir_dead_code_local.cpp \ ir_dead_functions.cpp \ ir_div_to_mul_rcp.cpp \ + ir_explog_to_explog2.cpp \ ir_expression_flattening.cpp \ ir_function_can_inline.cpp \ ir_function.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index ef8339ce19..5dc3c6b918 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -593,8 +593,8 @@ enum ir_expression_operation { ir_unop_rcp, ir_unop_rsq, ir_unop_sqrt, - ir_unop_exp, - ir_unop_log, + ir_unop_exp, /**< Log base e on gentype */ + ir_unop_log, /**< Natural log on gentype */ ir_unop_exp2, ir_unop_log2, ir_unop_f2i, /**< Float-to-integer conversion. */ diff --git a/src/glsl/ir_explog_to_explog2.cpp b/src/glsl/ir_explog_to_explog2.cpp new file mode 100644 index 0000000000..4fe1daaee9 --- /dev/null +++ b/src/glsl/ir_explog_to_explog2.cpp @@ -0,0 +1,85 @@ +/* + * 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 ir_explog_to_explog2.cpp + * + * Many GPUs don't have a base e log or exponent instruction, but they + * do have base 2 versions, so this pass converts exp and log to exp2 + * and log2 operations. + */ + +#include +#include "ir.h" +#include "glsl_types.h" + +class ir_explog_to_explog2_visitor : public ir_hierarchical_visitor { +public: + ir_explog_to_explog2_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool progress; +}; + +bool +do_explog_to_explog2(exec_list *instructions) +{ + ir_explog_to_explog2_visitor v; + + visit_list_elements(&v, instructions); + return v.progress; +} + +ir_visitor_status +ir_explog_to_explog2_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation == ir_unop_exp) { + void *mem_ctx = talloc_parent(ir); + ir_constant *log2_e = new(mem_ctx) ir_constant(log2f(M_E)); + + ir->operation = ir_unop_exp2; + ir->operands[0] = new(mem_ctx) ir_expression(ir_binop_mul, + ir->operands[0]->type, + ir->operands[0], + log2_e); + this->progress = true; + } + + if (ir->operation == ir_unop_log) { + void *mem_ctx = talloc_parent(ir); + + ir->operation = ir_binop_mul; + ir->operands[0] = new(mem_ctx) ir_expression(ir_unop_log2, + ir->operands[0]->type, + ir->operands[0], + NULL); + ir->operands[1] = new(mem_ctx) ir_constant(1.0f / log2f(M_E)); + this->progress = true; + } + + return visit_continue; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index eac28dc64c..c6e7beb447 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -38,6 +38,7 @@ bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(exec_list *instructions); bool do_dead_functions(exec_list *instructions); bool do_div_to_mul_rcp(exec_list *instructions); +bool do_explog_to_explog2(exec_list *instructions); bool do_function_inlining(exec_list *instructions); bool do_if_return(exec_list *instructions); bool do_if_simplification(exec_list *instructions); diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 701bf21ea6..545fe2799f 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -183,10 +183,14 @@ ir_validate::visit_leave(ir_expression *ir) case ir_unop_rcp: case ir_unop_rsq: case ir_unop_sqrt: + assert(ir->type == ir->operands[0]->type); + break; + case ir_unop_exp: case ir_unop_log: case ir_unop_exp2: case ir_unop_log2: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); assert(ir->type == ir->operands[0]->type); break; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 050116954a..9d6de242f5 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1281,6 +1281,7 @@ link_shaders(struct gl_shader_program *prog) do_mat_op_to_vec(ir); do_mod_to_fract(ir); do_div_to_mul_rcp(ir); + do_explog_to_explog2(ir); do { progress = false; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 299b11d274..26fbc4349a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -752,15 +752,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[0]); break; - case ir_unop_exp: - ir_to_mesa_emit_scalar_op2(ir, OPCODE_POW, result_dst, - src_reg_for_float(M_E), op[0]); - break; case ir_unop_exp2: ir_to_mesa_emit_scalar_op1(ir, OPCODE_EX2, result_dst, op[0]); break; + case ir_unop_exp: case ir_unop_log: - ir_to_mesa_emit_scalar_op1(ir, OPCODE_LOG, result_dst, op[0]); + assert(!"not reached: should be handled by ir_explog_to_explog2"); break; case ir_unop_log2: ir_to_mesa_emit_scalar_op1(ir, OPCODE_LG2, result_dst, op[0]); -- cgit v1.2.3 From 1e0f0459e0ca8b9f0c67f8178e5189b8cfd6078c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Aug 2010 17:21:39 -0700 Subject: glsl2: Log a better error message when a matching function cannot be found --- src/glsl/ast_function.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 6 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 1b8b3195e5..ca7d087727 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -57,6 +57,41 @@ process_parameters(exec_list *instructions, exec_list *actual_parameters, } +/** + * 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 Parameter list for the function. This may be either a + * formal or actual parameter list. Only the type is used. + * + * \return + * A talloced 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 = talloc_asprintf(str, "%s ", return_type->name); + + str = talloc_asprintf_append(str, "%s(", name); + + const char *comma = ""; + foreach_list(node, parameters) { + const ir_instruction *const param = (ir_instruction *) node; + + str = talloc_asprintf_append(str, "%s%s", comma, param->type->name); + comma = ", "; + } + + str = talloc_strdup_append(str, ")"); + return str; +} + + static ir_rvalue * process_call(exec_list *instructions, ir_function *f, YYLTYPE *loc, exec_list *actual_parameters, @@ -132,13 +167,23 @@ process_call(exec_list *instructions, ir_function *f, return NULL; } } else { - /* FINISHME: Log a better error message here. G++ will show the types - * FINISHME: of the actual parameters and the set of candidate - * FINISHME: functions. A different error should also be logged when - * FINISHME: multiple functions match. - */ + char *str = prototype_string(NULL, f->name, actual_parameters); + _mesa_glsl_error(loc, state, "no matching function for call to `%s'", - f->name); + str); + talloc_free(str); + + const char *prefix = "candidates are: "; + 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\n", prefix, str); + talloc_free(str); + + prefix = " "; + } + return ir_call::get_error_instruction(ctx); } } -- cgit v1.2.3 From 0a09d679ca97dcb634a939df2110a90c9504e2ec Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Aug 2010 17:29:15 -0700 Subject: glsl_type: Don't have two versions of a type with the same name Previously some sampler types were duplicated in GLSL 1.30 and GL_EXT_texture_array. This resulted in not being able to find the built-in sampler functions when the extension was used. When the built-in functions were compiled, they bound to the 1.30 version. This caused a type mismatch when trying to find the function. It also resulted in a confusing error message: 0:0(0): error: no matching function for call to `texture2DArray(sampler2DArray, vec3)' 0:0(0): error: candidates are: vec4 texture2DArray(sampler2DArray, vec3) 0:0(0): error: vec4 texture2DArray(sampler2DArray, vec3, float) --- src/glsl/builtin_types.h | 12 +++--------- src/glsl/glsl_types.cpp | 1 + 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index bd8f8b583a..bfa4f3f540 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -212,23 +212,17 @@ const glsl_type glsl_type::builtin_130_types[] = { glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"), glsl_type(GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1, "uvec4"), - /* 1D and 2D texture arrays */ - glsl_type(GL_SAMPLER_1D_ARRAY, - GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + /* 1D and 2D texture arrays - several of these are included only in + * builtin_EXT_texture_array_types. + */ glsl_type(GL_INT_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"), glsl_type(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"), - glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW, - GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), - glsl_type(GL_SAMPLER_2D_ARRAY, - GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), glsl_type(GL_INT_SAMPLER_2D_ARRAY, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"), glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"), - glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW, - GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), /* cube shadow samplers */ glsl_type(GL_SAMPLER_CUBE_SHADOW, diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 88f305ac25..03f84603b5 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -144,6 +144,7 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab) add_types_to_symbol_table(symtab, builtin_130_types, Elements(builtin_130_types), false); + generate_EXT_texture_array_types(symtab, false); } -- cgit v1.2.3 From 4f397e1d641bf265b395f7dec062dab451fb5a54 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Aug 2010 17:50:13 -0700 Subject: glsl2: Enable all supported extensions in stand-alone compiler --- src/glsl/glsl_parser_extras.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 15fa61d950..dbf6f53156 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -74,6 +74,11 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, static struct gl_extensions null_extensions; memset(&null_extensions, 0, sizeof(null_extensions)); + null_extensions.ARB_draw_buffers = GL_TRUE; + null_extensions.ARB_fragment_coord_conventions = GL_TRUE; + null_extensions.EXT_texture_array = GL_TRUE; + null_extensions.NV_texture_rectangle = GL_TRUE; + this->extensions = &null_extensions; /* 1.10 minimums. */ -- cgit v1.2.3 From 8d61a23b1a1d0d4b21f0fab64f6d863a8ee3d7f1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Aug 2010 16:00:46 -0700 Subject: glsl2: Don't assert in a couple of places when encountering sampler arrays. Fixes glean shaderAPI. --- src/glsl/linker.cpp | 10 ++++++---- src/mesa/program/ir_to_mesa.cpp | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 9d6de242f5..e93c2f5554 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -793,11 +793,13 @@ assign_uniform_locations(struct gl_shader_program *prog) if ((var == NULL) || (var->mode != ir_var_uniform)) continue; - if (var->type->is_sampler()) - continue; - const unsigned vec4_slots = (var->component_slots() + 3) / 4; - assert(vec4_slots != 0); + if (vec4_slots == 0) { + /* If we've got a sampler or an aggregate of them, the size can + * end up zero. Don't allocate any space. + */ + continue; + } uniform_node *n = (uniform_node *) hash_table_find(ht, var->name); if (n == NULL) { diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 9979e6e3e0..66b1a2f9d9 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -518,6 +518,11 @@ type_size(const struct glsl_type *type) size += type_size(type->fields.structure[i].type); } return size; + case GLSL_TYPE_SAMPLER: + /* Samplers take up no register space, since they're baked in at + * link time. + */ + return 0; default: assert(0); } -- cgit v1.2.3 From 199c441239762eec86b3cb4b558aef486907a8b6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Aug 2010 00:21:12 -0700 Subject: glsl2: Fix inlining with sampler array or struct dereferences as arguments. Previously, we'd replace an argument of mysampler[2] with a plain reference to mysampler by using the cloning hash table. Instead, use a visitor to clone whatever complicated sampler dereference into the sampler parameter derefs in the inlined function body. --- src/glsl/ir_function_inlining.cpp | 143 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 138 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 973813774e..35eb2b38ea 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -35,6 +35,11 @@ #include "glsl_types.h" #include "program/hash_table.h" +static void +do_sampler_replacement(exec_list *instructions, + ir_variable *sampler, + ir_dereference *deref); + class ir_function_inlining_visitor : public ir_hierarchical_visitor { public: ir_function_inlining_visitor() @@ -96,7 +101,7 @@ replace_return_with_assignment(ir_instruction *ir, void *data) /* un-valued return has to be the last return, or we shouldn't * have reached here. (see can_inline()). */ - assert(!ret->next->is_tail_sentinel()); + assert(ret->next->is_tail_sentinel()); ret->remove(); } } @@ -142,10 +147,9 @@ ir_call::generate_inline(ir_instruction *next_ir) /* For samplers, we want the inlined sampler references * referencing the passed in sampler variable, since that * will have the location information, which an assignment of - * a sampler wouldn't. + * a sampler wouldn't. Fix it up below. */ parameters[i] = NULL; - hash_table_insert(ht, param->variable_referenced(), sig_param); } else { parameters[i] = sig_param->clone(ctx, ht); parameters[i]->mode = ir_var_auto; @@ -166,15 +170,40 @@ ir_call::generate_inline(ir_instruction *next_ir) param_iter.next(); } - /* Generate the inlined body of the function. */ + exec_list new_instructions; + + /* Generate the inlined body of the function to a new list */ foreach_iter(exec_list_iterator, iter, callee->body) { ir_instruction *ir = (ir_instruction *)iter.get(); ir_instruction *new_ir = ir->clone(ctx, ht); - next_ir->insert_before(new_ir); + new_instructions.push_tail(new_ir); visit_tree(new_ir, replace_return_with_assignment, retval); } + /* If any samplers were passed in, replace any deref of the sampler + * with a deref of the sampler argument. + */ + param_iter = this->actual_parameters.iterator(); + sig_param_iter = this->callee->parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + ir_instruction *const param = (ir_instruction *) param_iter.get(); + ir_variable *sig_param = (ir_variable *) sig_param_iter.get(); + + if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) { + ir_dereference *deref = param->as_dereference(); + + assert(deref); + do_sampler_replacement(&new_instructions, sig_param, deref); + } + } + + /* Now push those new instructions in. */ + foreach_iter(exec_list_iterator, iter, new_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + next_ir->insert_before(ir); + } + /* Copy back the value of any 'out' parameters from the function body * variables to our own. */ @@ -280,3 +309,107 @@ ir_function_inlining_visitor::visit_enter(ir_assignment *ir) return visit_continue; } + +/** + * Replaces references to the "sampler" variable with a clone of "deref." + * + * From the spec, samplers can appear in the tree as function + * (non-out) parameters and as the result of array indexing and + * structure field selection. In our builtin implementation, they + * also appear in the sampler field of an ir_tex instruction. + */ + +class ir_sampler_replacement_visitor : public ir_hierarchical_visitor { +public: + ir_sampler_replacement_visitor(ir_variable *sampler, ir_dereference *deref) + { + this->sampler = sampler; + this->deref = deref; + } + + virtual ~ir_sampler_replacement_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_dereference_record *); + virtual ir_visitor_status visit_leave(ir_texture *); + + void replace_deref(ir_dereference **deref); + void replace_rvalue(ir_rvalue **rvalue); + + ir_variable *sampler; + ir_dereference *deref; +}; + +void +ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref) +{ + ir_dereference_variable *deref_var = (*deref)->as_dereference_variable(); + if (deref_var && deref_var->var == this->sampler) { + *deref = this->deref->clone(talloc_parent(*deref), NULL); + } +} + +void +ir_sampler_replacement_visitor::replace_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_dereference *deref = (*rvalue)->as_dereference(); + + if (!deref) + return; + + replace_deref(&deref); + *rvalue = deref; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_texture *ir) +{ + replace_deref(&ir->sampler); + + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_dereference_array *ir) +{ + replace_rvalue(&ir->array); + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_dereference_record *ir) +{ + replace_rvalue(&ir->record); + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + replace_rvalue(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +static void +do_sampler_replacement(exec_list *instructions, + ir_variable *sampler, + ir_dereference *deref) +{ + ir_sampler_replacement_visitor v(sampler, deref); + + visit_list_elements(&v, instructions); +} -- cgit v1.2.3 From 925b49ff310bf0b307add7c34627cddf87e6a554 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Aug 2010 13:07:25 -0700 Subject: glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass. This lets us handle arrays much better than trying to work backwards from assembly. Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling) --- src/glsl/Makefile | 1 + src/glsl/ir.h | 3 + src/glsl/ir_set_program_inouts.cpp | 167 +++++++++++++++++++++++++++++++++++++ src/mesa/program/ir_to_mesa.cpp | 71 +--------------- 4 files changed, 175 insertions(+), 67 deletions(-) create mode 100644 src/glsl/ir_set_program_inouts.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 752e60a79f..0f8b290b65 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -56,6 +56,7 @@ CXX_SOURCES = \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ + ir_set_program_inouts.cpp \ ir_structure_splitting.cpp \ ir_swizzle_swizzle.cpp \ ir_tree_grafting.cpp \ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 5dc3c6b918..d852a6a93b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1392,4 +1392,7 @@ import_prototypes(const exec_list *source, exec_list *dest, extern bool ir_has_call(ir_instruction *ir); +extern void +do_set_program_inouts(exec_list *instructions, struct gl_program *prog); + #endif /* IR_H */ diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp new file mode 100644 index 0000000000..658637775a --- /dev/null +++ b/src/glsl/ir_set_program_inouts.cpp @@ -0,0 +1,167 @@ +/* + * 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 ir_set_program_inouts.cpp + * + * Sets the InputsRead and OutputsWritten of Mesa programs. + * + * Mesa programs (gl_program, not gl_shader_program) have a set of + * flags indicating which varyings are read and written. Computing + * which are actually read from some sort of backend code can be + * tricky when variable array indexing involved. So this pass + * provides support for setting InputsRead and OutputsWritten right + * from the GLSL IR. + */ + +extern "C" { +#include "main/mtypes.h" +#include "program/hash_table.h" +} +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +class ir_set_program_inouts_visitor : public ir_hierarchical_visitor { +public: + ir_set_program_inouts_visitor(struct gl_program *prog) + { + this->prog = prog; + this->ht = hash_table_ctor(0, + hash_table_pointer_hash, + hash_table_pointer_compare); + } + ir_set_program_inouts_visitor() + { + hash_table_dtor(this->ht); + } + + virtual ir_visitor_status visit_enter(ir_dereference_array *); + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit(ir_variable *); + + struct gl_program *prog; + struct hash_table *ht; +}; + +static void +mark(struct gl_program *prog, ir_variable *var, int index) +{ + /* As of GLSL 1.20, varyings can only be floats, floating-point + * vectors or matrices, or arrays of them. For Mesa programs using + * InputsRead/OutputsWritten, everything but matrices uses one + * slot, while matrices use a slot per column. Presumably + * something doing a more clever packing would use something other + * than InputsRead/OutputsWritten. + */ + const glsl_type *element_type; + int element_size; + + if (var->type->is_array()) + element_type = var->type->fields.array; + else + element_type = var->type; + + if (element_type->is_matrix()) + element_size = element_type->matrix_columns; + else + element_size = 1; + + index *= element_size; + for (int i = 0; i < element_size; i++) { + if (var->mode == ir_var_in) + prog->InputsRead |= BITFIELD64_BIT(var->location + index + i); + else + prog->OutputsWritten |= BITFIELD64_BIT(var->location + index + i); + } +} + +/* Default handler: Mark all the locations in the variable as used. */ +ir_visitor_status +ir_set_program_inouts_visitor::visit(ir_dereference_variable *ir) +{ + if (hash_table_find(this->ht, ir->var) == NULL) + return visit_continue; + + if (ir->type->is_array()) { + for (unsigned int i = 0; i < ir->type->length; i++) { + mark(this->prog, ir->var, i); + } + } else { + mark(this->prog, ir->var, 0); + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) +{ + ir_dereference_variable *deref_var; + ir_constant *index = ir->array_index->as_constant(); + deref_var = ir->array->as_dereference_variable(); + ir_variable *var = NULL; + + /* Check that we're dereferencing a shader in or out */ + if (deref_var) + var = (ir_variable *)hash_table_find(this->ht, deref_var->var); + + if (index && var) { + mark(this->prog, var, index->value.i[0]); + return visit_continue_with_parent; + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit(ir_variable *ir) +{ + if (ir->mode == ir_var_in || + ir->mode == ir_var_out) { + hash_table_insert(this->ht, ir, ir); + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * consider them as shader inputs or outputs. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + +void +do_set_program_inouts(exec_list *instructions, struct gl_program *prog) +{ + ir_set_program_inouts_visitor v(prog); + + prog->InputsRead = 0; + prog->OutputsWritten = 0; + visit_list_elements(&v, instructions); +} diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index d8a13220ae..c6856eb5a4 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2323,81 +2323,15 @@ print_program(struct prog_instruction *mesa_instructions, } } -static void -mark_input(struct gl_program *prog, - int index, - GLboolean reladdr) -{ - prog->InputsRead |= BITFIELD64_BIT(index); - int i; - - if (reladdr) { - if (index >= FRAG_ATTRIB_TEX0 && index <= FRAG_ATTRIB_TEX7) { - for (i = 0; i < 8; i++) { - prog->InputsRead |= BITFIELD64_BIT(FRAG_ATTRIB_TEX0 + i); - } - } else { - assert(!"FINISHME: Mark InputsRead for varying arrays"); - } - } -} - -static void -mark_output(struct gl_program *prog, - int index, - GLboolean reladdr) -{ - prog->OutputsWritten |= BITFIELD64_BIT(index); - int i; - - if (reladdr) { - if (index >= VERT_RESULT_TEX0 && index <= VERT_RESULT_TEX7) { - for (i = 0; i < 8; i++) { - prog->OutputsWritten |= BITFIELD64_BIT(FRAG_ATTRIB_TEX0 + i); - } - } else { - assert(!"FINISHME: Mark OutputsWritten for varying arrays"); - } - } -} - static void count_resources(struct gl_program *prog) { unsigned int i; - prog->InputsRead = 0; - prog->OutputsWritten = 0; prog->SamplersUsed = 0; for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = &prog->Instructions[i]; - unsigned int reg; - - switch (inst->DstReg.File) { - case PROGRAM_OUTPUT: - mark_output(prog, inst->DstReg.Index, inst->DstReg.RelAddr); - break; - case PROGRAM_INPUT: - mark_input(prog, inst->DstReg.Index, inst->DstReg.RelAddr); - break; - default: - break; - } - - for (reg = 0; reg < _mesa_num_inst_src_regs(inst->Opcode); reg++) { - switch (inst->SrcReg[reg].File) { - case PROGRAM_OUTPUT: - mark_output(prog, inst->SrcReg[reg].Index, - inst->SrcReg[reg].RelAddr); - break; - case PROGRAM_INPUT: - mark_input(prog, inst->SrcReg[reg].Index, inst->SrcReg[reg].RelAddr); - break; - default: - break; - } - } /* Instead of just using the uniform's value to map to a * sampler, Mesa first allocates a separate number for the @@ -2578,6 +2512,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, } set_branchtargets(&v, mesa_instructions, num_instructions); + if (ctx->Shader.Flags & GLSL_DUMP) { printf("\n"); printf("GLSL IR for linked %s program %d:\n", target_string, @@ -2594,6 +2529,9 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, prog->Instructions = mesa_instructions; prog->NumInstructions = num_instructions; + do_set_program_inouts(shader->ir, prog); + count_resources(prog); + _mesa_reference_program(ctx, &shader->Program, prog); if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) { @@ -2731,7 +2669,6 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); - count_resources(linked_prog); link_uniforms_to_shared_uniform_list(prog->Uniforms, linked_prog); -- cgit v1.2.3 From 63cddb27d7e0f8d3fd71ccdf719341432a0ca970 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Fri, 6 Aug 2010 16:09:02 +0200 Subject: copy_propagation: do propagation into non-out call params --- src/glsl/ir_copy_propagation.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 1d28392d7c..90a49d5a82 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -164,11 +164,17 @@ ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_call *ir) { - (void)ir; - - /* Note, if we were to do copy propagation to parameters of calls, we'd - * have to be careful about out params. - */ + /* Do copy propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_instruction *ir = (ir_instruction *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout && + sig_param->mode != ir_var_uniform) { + ir->accept(this); + } + sig_param_iter.next(); + } return visit_continue_with_parent; } -- cgit v1.2.3 From 58f1ffdd7c64c0c0962d2aaacdde8f55edefbb2c Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Fri, 6 Aug 2010 12:31:56 +0200 Subject: ir_function_inlining: Fix missing iter.next() in inlining sampler params. Fixes glsl-fs-function-samplers. --- src/glsl/ir_function_inlining.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 35eb2b38ea..fd52d106b1 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -196,6 +196,8 @@ ir_call::generate_inline(ir_instruction *next_ir) assert(deref); do_sampler_replacement(&new_instructions, sig_param, deref); } + param_iter.next(); + sig_param_iter.next(); } /* Now push those new instructions in. */ -- cgit v1.2.3 From b7e63c34e74ecfb1c4af8132471ca9cb70d28d1f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 7 Aug 2010 00:50:08 -0700 Subject: glsl2: Add the 1.30 reserved keywords. --- src/glsl/glsl_lexer.cpp | 1043 +++++++++++------- src/glsl/glsl_lexer.lpp | 32 + src/glsl/glsl_parser.cpp | 2645 ++++++++++++++++++++++++---------------------- src/glsl/glsl_parser.h | 143 ++- src/glsl/glsl_parser.ypp | 9 +- 5 files changed, 2162 insertions(+), 1710 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 43be3170ba..672b0b1359 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -358,8 +349,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 147 -#define YY_END_OF_BUFFER 148 +#define YY_NUM_RULES 177 +#define YY_END_OF_BUFFER 178 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -367,66 +358,81 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[525] = +static yyconst flex_int16_t yy_accept[668] = { 0, - 0, 0, 9, 9, 148, 146, 1, 14, 146, 146, - 146, 146, 146, 146, 146, 146, 90, 88, 146, 146, - 146, 145, 146, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 146, 1, 146, 85, 147, 9, 13, - 147, 12, 10, 11, 1, 74, 81, 75, 84, 78, + 0, 0, 9, 9, 178, 176, 1, 14, 176, 176, + 176, 176, 176, 176, 176, 176, 90, 88, 176, 176, + 176, 175, 176, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 176, 1, 176, 85, 177, 9, 13, + 177, 12, 10, 11, 1, 74, 81, 75, 84, 78, 69, 80, 70, 87, 92, 79, 93, 90, 0, 0, - 95, 0, 88, 0, 71, 73, 72, 0, 145, 77, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 22, 145, 145, 145, 145, 145, 145, 145, 145, - - 145, 145, 145, 145, 145, 26, 50, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 86, 76, 1, 0, 0, - 2, 0, 0, 0, 0, 9, 8, 12, 11, 0, - 92, 91, 0, 93, 0, 94, 89, 82, 83, 98, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 25, - 145, 145, 145, 145, 145, 145, 145, 145, 19, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 51, - - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 0, 0, 0, 0, 8, 0, 92, - 0, 91, 0, 93, 94, 145, 17, 145, 145, 138, - 145, 145, 145, 145, 145, 145, 145, 145, 24, 101, - 145, 145, 145, 57, 145, 145, 106, 120, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 117, 141, 38, - 39, 40, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 104, - 96, 145, 145, 145, 145, 145, 145, 35, 36, 37, - - 67, 145, 145, 0, 0, 0, 0, 0, 91, 145, - 20, 29, 30, 31, 145, 99, 16, 145, 145, 145, - 145, 128, 129, 130, 145, 97, 121, 18, 131, 132, - 133, 143, 125, 126, 127, 145, 52, 123, 145, 145, - 32, 33, 34, 145, 145, 145, 145, 145, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 118, 145, 145, - 145, 145, 145, 145, 145, 145, 100, 145, 140, 145, - 145, 23, 0, 0, 0, 0, 145, 145, 145, 145, - 145, 119, 114, 109, 145, 145, 68, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 145, 145, 145, 145, - - 124, 105, 145, 112, 28, 145, 137, 58, 113, 66, - 107, 145, 145, 145, 145, 145, 145, 0, 0, 0, - 0, 145, 145, 145, 108, 27, 145, 145, 145, 142, - 145, 145, 145, 145, 145, 145, 102, 53, 145, 54, - 145, 0, 0, 0, 7, 0, 145, 55, 21, 115, - 145, 145, 145, 110, 145, 145, 145, 145, 145, 145, - 103, 122, 111, 0, 0, 6, 0, 0, 0, 3, - 15, 116, 56, 139, 145, 144, 60, 61, 62, 145, - 0, 0, 0, 0, 145, 145, 145, 145, 145, 145, - 4, 0, 5, 0, 0, 0, 145, 145, 145, 145, - - 145, 63, 0, 145, 145, 145, 145, 145, 59, 145, - 134, 145, 135, 145, 145, 145, 64, 145, 65, 145, - 145, 145, 136, 0 + 95, 0, 88, 0, 71, 73, 72, 0, 175, 77, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 22, 175, 175, 175, 175, 175, 175, 175, + + 175, 175, 175, 175, 175, 175, 26, 175, 175, 50, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 86, 76, 1, 0, 0, 2, 0, 0, 0, + 0, 9, 8, 12, 11, 0, 92, 91, 0, 93, + 0, 94, 89, 82, 83, 175, 98, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 25, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 19, + + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 51, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 0, 0, + 0, 0, 8, 0, 92, 0, 91, 0, 93, 94, + 175, 175, 17, 175, 175, 138, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 24, 101, 175, 175, 175, + 175, 57, 175, 175, 106, 120, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 117, 141, 38, + 39, 40, 175, 175, 175, 175, 175, 175, 175, 175, + + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 104, 96, 175, 175, 175, 175, 175, 175, + 175, 35, 36, 37, 67, 175, 175, 0, 0, 0, + 0, 0, 91, 175, 175, 20, 29, 30, 31, 175, + 99, 175, 16, 175, 175, 175, 175, 128, 129, 130, + 175, 97, 175, 121, 18, 131, 132, 133, 143, 125, + 126, 127, 175, 175, 175, 52, 123, 175, 175, 32, + 33, 34, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 118, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 100, + + 175, 140, 175, 175, 23, 0, 0, 0, 0, 147, + 175, 175, 145, 175, 175, 175, 119, 114, 150, 175, + 175, 175, 175, 175, 175, 109, 175, 175, 68, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 175, 175, + 175, 175, 124, 105, 175, 175, 112, 28, 175, 175, + 137, 58, 113, 66, 148, 107, 175, 175, 175, 175, + 175, 175, 175, 0, 0, 0, 0, 175, 175, 175, + 108, 27, 175, 175, 175, 175, 175, 175, 151, 152, + 153, 175, 175, 175, 175, 142, 175, 175, 175, 175, + 175, 175, 175, 175, 102, 175, 175, 175, 175, 175, + + 53, 175, 54, 175, 0, 0, 0, 7, 0, 175, + 55, 21, 115, 155, 156, 157, 175, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 110, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 103, 159, 160, + 161, 175, 175, 122, 111, 0, 0, 6, 0, 0, + 0, 3, 15, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 154, 116, 56, 139, 175, 146, 144, 174, + 60, 61, 62, 175, 175, 175, 175, 175, 175, 0, + 0, 0, 0, 175, 175, 175, 158, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + + 175, 175, 162, 4, 0, 5, 0, 0, 0, 175, + 175, 175, 175, 175, 175, 175, 171, 175, 175, 175, + 175, 175, 175, 63, 175, 175, 175, 0, 175, 175, + 172, 163, 175, 164, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 173, 165, 166, 169, 170, 59, 175, + 134, 175, 135, 149, 167, 168, 175, 175, 175, 64, + 175, 65, 175, 175, 175, 136, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -437,14 +443,14 @@ static yyconst flex_int32_t yy_ec[256] = 1, 2, 5, 1, 6, 1, 7, 8, 1, 1, 1, 9, 10, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19, 20, 20, 21, 1, 22, - 23, 24, 1, 1, 25, 25, 26, 27, 28, 29, - 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, - 30, 31, 32, 30, 30, 30, 30, 33, 30, 30, - 1, 1, 1, 34, 30, 1, 35, 36, 37, 38, - - 39, 40, 41, 42, 43, 30, 44, 45, 46, 47, - 48, 49, 30, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 1, 59, 1, 1, 1, 1, 1, 1, + 23, 24, 1, 1, 25, 26, 27, 28, 29, 30, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, 32, 33, 31, 31, 31, 31, 34, 31, 31, + 1, 1, 1, 35, 36, 1, 37, 38, 39, 40, + + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 31, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 1, 62, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -461,342 +467,415 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[60] = +static yyconst flex_int32_t yy_meta[63] = { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, - 4, 1, 1, 5, 5, 5, 5, 5, 5, 6, - 1, 1, 1, 1, 7, 7, 7, 8, 8, 9, - 9, 9, 10, 1, 7, 7, 7, 7, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 10, 9, 9, 1 + 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 5, + 1, 1, 1, 1, 6, 6, 6, 6, 5, 5, + 7, 7, 7, 8, 1, 7, 6, 6, 6, 6, + 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, + 7, 1 } ; -static yyconst flex_int16_t yy_base[542] = +static yyconst flex_int16_t yy_base[678] = { 0, - 0, 58, 81, 0, 814, 815, 59, 815, 790, 789, - 54, 788, 55, 56, 54, 787, 129, 174, 53, 786, - 127, 0, 774, 101, 106, 126, 116, 128, 152, 759, - 161, 158, 128, 142, 131, 753, 166, 766, 175, 181, - 131, 187, 762, 149, 205, 222, 780, 815, 230, 815, - 789, 225, 815, 0, 244, 815, 815, 815, 815, 815, - 815, 815, 815, 815, 223, 815, 225, 200, 265, 218, - 815, 0, 0, 778, 815, 815, 815, 777, 0, 815, - 753, 746, 749, 757, 756, 743, 746, 757, 744, 750, - 738, 735, 748, 735, 732, 732, 738, 726, 132, 731, - - 741, 727, 733, 736, 737, 0, 221, 736, 717, 200, - 721, 734, 725, 225, 718, 732, 729, 731, 714, 719, - 716, 705, 714, 222, 718, 714, 716, 705, 708, 207, - 713, 705, 717, 243, 710, 815, 815, 285, 257, 295, - 815, 696, 708, 700, 710, 288, 0, 298, 0, 226, - 815, 280, 289, 815, 307, 318, 0, 815, 815, 0, - 698, 702, 711, 708, 692, 691, 691, 279, 706, 703, - 703, 701, 698, 690, 696, 683, 694, 680, 696, 0, - 693, 681, 688, 685, 689, 682, 671, 670, 683, 686, - 683, 671, 677, 668, 319, 673, 676, 667, 674, 663, - - 667, 673, 664, 655, 658, 656, 666, 656, 651, 649, - 649, 651, 648, 659, 658, 255, 653, 648, 637, 325, - 655, 657, 646, 638, 642, 653, 637, 0, 336, 328, - 322, 815, 345, 356, 815, 643, 0, 641, 353, 0, - 634, 632, 630, 638, 627, 644, 633, 356, 0, 0, - 627, 637, 637, 0, 622, 359, 0, 0, 624, 362, - 625, 619, 618, 619, 618, 365, 614, 0, 0, 610, - 609, 608, 610, 611, 616, 610, 606, 619, 614, 613, - 605, 609, 601, 604, 599, 607, 612, 611, 602, 0, - 0, 608, 597, 597, 602, 601, 598, 0, 0, 0, - - 0, 588, 600, 599, 598, 595, 584, 372, 383, 598, - 0, 0, 0, 0, 585, 0, 0, 585, 586, 580, - 590, 0, 0, 0, 581, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 588, 0, 0, 586, 582, - 0, 0, 0, 572, 381, 384, 387, 577, 573, 578, - 569, 567, 580, 566, 579, 568, 575, 0, 573, 570, - 574, 558, 567, 573, 568, 556, 0, 558, 0, 557, - 560, 0, 555, 599, 554, 556, 545, 554, 543, 543, - 556, 0, 558, 0, 557, 556, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 541, 554, 541, 538, - - 0, 0, 543, 0, 0, 535, 0, 0, 0, 0, - 0, 532, 543, 536, 542, 539, 534, 527, 411, 542, - 522, 514, 527, 525, 0, 0, 518, 524, 505, 0, - 510, 504, 503, 493, 391, 501, 0, 0, 500, 0, - 480, 465, 407, 343, 815, 457, 449, 0, 0, 0, - 448, 434, 446, 0, 447, 436, 455, 454, 453, 426, - 0, 0, 0, 430, 418, 815, 431, 0, 412, 815, - 0, 0, 0, 0, 425, 0, 444, 387, 444, 438, - 426, 433, 435, 439, 422, 422, 423, 419, 421, 420, - 815, 441, 815, 453, 0, 449, 404, 422, 402, 389, - - 385, 0, 451, 377, 373, 343, 346, 296, 0, 262, - 275, 253, 0, 223, 207, 144, 0, 148, 0, 104, - 32, 11, 0, 815, 485, 491, 497, 501, 506, 508, - 516, 523, 526, 529, 534, 543, 548, 550, 557, 566, - 568 + 0, 61, 84, 0, 1012, 1013, 62, 1013, 988, 987, + 57, 986, 58, 59, 57, 985, 135, 183, 56, 984, + 133, 0, 971, 119, 109, 130, 134, 111, 135, 954, + 151, 165, 32, 152, 131, 948, 153, 170, 182, 176, + 178, 193, 959, 125, 237, 243, 979, 1013, 214, 1013, + 988, 233, 1013, 0, 231, 1013, 1013, 1013, 1013, 1013, + 1013, 1013, 1013, 1013, 225, 1013, 227, 224, 289, 260, + 1013, 0, 0, 977, 1013, 1013, 1013, 976, 0, 1013, + 943, 948, 941, 944, 953, 952, 938, 941, 953, 155, + 947, 934, 931, 945, 931, 928, 928, 934, 213, 222, + + 928, 939, 924, 930, 934, 935, 0, 926, 937, 237, + 932, 912, 232, 916, 930, 920, 241, 913, 257, 926, + 928, 910, 906, 914, 911, 900, 909, 228, 907, 913, + 908, 911, 899, 902, 904, 257, 907, 898, 911, 215, + 904, 1013, 1013, 310, 295, 318, 1013, 889, 902, 893, + 904, 260, 0, 308, 0, 362, 1013, 303, 373, 1013, + 380, 387, 0, 1013, 1013, 899, 0, 890, 894, 904, + 901, 884, 883, 883, 887, 280, 898, 895, 895, 893, + 890, 881, 888, 874, 872, 885, 870, 887, 0, 884, + 871, 879, 876, 880, 881, 874, 871, 859, 858, 872, + + 875, 872, 859, 866, 856, 321, 862, 865, 855, 863, + 851, 855, 846, 861, 851, 842, 861, 844, 842, 853, + 842, 837, 835, 849, 834, 836, 833, 845, 844, 847, + 298, 838, 832, 821, 337, 840, 842, 830, 822, 826, + 838, 821, 0, 394, 404, 421, 1013, 433, 440, 1013, + 816, 827, 0, 824, 340, 0, 817, 815, 817, 812, + 821, 809, 827, 815, 344, 0, 0, 809, 820, 819, + 819, 0, 803, 347, 0, 0, 805, 351, 813, 814, + 804, 798, 797, 798, 797, 409, 793, 0, 0, 789, + 788, 787, 789, 790, 795, 789, 785, 799, 794, 793, + + 792, 783, 786, 786, 778, 781, 776, 785, 790, 775, + 788, 778, 0, 0, 785, 781, 772, 772, 778, 777, + 774, 0, 0, 0, 0, 763, 776, 775, 774, 771, + 759, 447, 457, 771, 773, 0, 0, 0, 0, 759, + 0, 759, 0, 758, 759, 753, 764, 0, 0, 0, + 754, 0, 750, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 761, 463, 760, 0, 0, 758, 754, 0, + 0, 0, 743, 426, 467, 475, 748, 744, 750, 740, + 738, 752, 736, 736, 750, 738, 750, 745, 0, 743, + 740, 744, 727, 729, 736, 742, 737, 736, 723, 0, + + 725, 0, 724, 728, 0, 722, 769, 721, 724, 0, + 712, 722, 0, 710, 710, 724, 0, 726, 0, 479, + 734, 733, 732, 703, 702, 0, 720, 719, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 703, 717, + 703, 700, 0, 0, 706, 705, 0, 0, 703, 695, + 0, 0, 0, 0, 0, 0, 692, 704, 485, 696, + 703, 700, 694, 687, 501, 703, 688, 683, 697, 695, + 0, 0, 687, 706, 705, 704, 675, 674, 317, 489, + 0, 687, 690, 688, 676, 0, 686, 683, 682, 671, + 670, 669, 508, 678, 0, 690, 689, 688, 659, 658, + + 0, 673, 0, 671, 666, 495, 524, 1013, 660, 668, + 0, 0, 0, 683, 682, 0, 664, 667, 651, 659, + 649, 657, 658, 658, 657, 642, 655, 0, 656, 644, + 643, 639, 663, 662, 661, 632, 631, 0, 661, 660, + 0, 642, 645, 0, 0, 631, 543, 1013, 534, 0, + 553, 1013, 0, 628, 627, 637, 637, 624, 639, 622, + 637, 632, 0, 0, 0, 0, 617, 0, 0, 0, + 638, 353, 638, 627, 630, 614, 613, 623, 623, 613, + 530, 563, 413, 609, 608, 619, 0, 622, 618, 620, + 616, 602, 609, 605, 607, 603, 598, 596, 596, 575, + + 542, 553, 0, 1013, 466, 1013, 582, 0, 588, 556, + 555, 535, 527, 535, 516, 524, 0, 517, 510, 492, + 493, 489, 472, 0, 473, 472, 451, 505, 428, 426, + 0, 0, 423, 0, 387, 392, 390, 373, 334, 316, + 298, 288, 286, 0, 0, 0, 0, 0, 0, 290, + 296, 266, 0, 0, 0, 0, 257, 269, 241, 0, + 250, 0, 202, 133, 105, 0, 1013, 605, 610, 615, + 617, 619, 625, 632, 637, 642, 647 } ; -static yyconst flex_int16_t yy_def[542] = +static yyconst flex_int16_t yy_def[678] = { 0, - 524, 1, 524, 3, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 525, 524, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 526, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 527, 524, 528, 17, 524, 529, - 524, 530, 18, 524, 524, 524, 524, 524, 525, 524, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 531, 524, 526, 532, - 524, 528, 533, 524, 524, 529, 530, 524, 524, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 524, 524, 524, 524, 531, 524, 532, - 534, 524, 524, 533, 524, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - - 525, 525, 525, 524, 524, 524, 524, 524, 534, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 524, 524, 524, 524, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 524, 524, 524, - 524, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 524, 535, 536, 524, 524, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 524, 537, 524, 524, 538, 536, 524, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 524, 539, 540, 538, 525, 525, 525, 525, 525, 525, - 524, 524, 524, 524, 541, 540, 525, 525, 525, 525, - - 525, 525, 541, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, - 525, 525, 525, 0, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524 + 667, 1, 667, 3, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 668, 667, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 669, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 670, 667, 671, 17, 667, 667, + 667, 672, 18, 667, 667, 667, 667, 667, 668, 667, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 673, 667, 669, 667, 667, 671, 667, 667, + 667, 667, 672, 667, 667, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 667, 667, + 667, 667, 673, 667, 667, 667, 667, 667, 667, 667, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 667, 667, 667, + 667, 667, 667, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 668, 668, 667, 667, 667, 667, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 667, 667, 667, 667, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 668, 667, 674, 667, 667, 667, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 667, 667, 667, 667, 675, + 667, 667, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 667, + 676, 667, 675, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + + 668, 668, 668, 667, 667, 667, 667, 677, 667, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 677, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, + 668, 668, 668, 668, 668, 668, 0, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667 } ; -static yyconst flex_int16_t yy_nxt[875] = +static yyconst flex_int16_t yy_nxt[1076] = { 0, 6, 7, 8, 7, 9, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 6, 19, 20, 21, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 22, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 22, 22, 22, 44, 45, - 55, 58, 55, 46, 61, 523, 63, 65, 65, 65, - 65, 65, 65, 65, 74, 75, 59, 62, 64, 522, - 47, 48, 49, 50, 49, 48, 48, 48, 48, 48, - 48, 48, 48, 51, 48, 52, 52, 52, 52, 52, - - 52, 53, 48, 48, 48, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 48, 54, 54, 54, 54, 54, + 22, 22, 22, 22, 23, 22, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 22, 22, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 22, 22, + 22, 44, 45, 55, 58, 55, 46, 61, 112, 63, + 65, 65, 65, 65, 65, 65, 65, 74, 75, 59, + 62, 64, 113, 47, 48, 49, 50, 49, 48, 48, + 48, 48, 48, 48, 48, 48, 51, 48, 52, 52, + + 52, 52, 52, 52, 53, 48, 48, 48, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 48, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 48, - 67, 521, 68, 68, 68, 68, 68, 68, 69, 77, - 78, 81, 82, 83, 90, 84, 70, 71, 91, 85, - 86, 72, 109, 92, 87, 113, 178, 70, 71, 93, - 88, 136, 94, 89, 95, 110, 111, 130, 114, 179, - 112, 131, 520, 96, 72, 67, 97, 73, 73, 73, - 73, 73, 73, 73, 98, 103, 99, 106, 519, 100, - - 116, 70, 71, 104, 107, 101, 138, 137, 55, 120, - 139, 108, 70, 71, 105, 117, 121, 122, 118, 126, - 123, 132, 127, 140, 141, 133, 124, 155, 155, 125, - 128, 146, 524, 146, 134, 229, 229, 129, 148, 148, - 148, 148, 148, 148, 148, 55, 193, 55, 518, 216, - 150, 151, 153, 154, 194, 524, 209, 217, 140, 141, - 142, 150, 151, 153, 154, 186, 143, 198, 187, 188, - 144, 210, 189, 199, 190, 145, 67, 517, 69, 69, - 69, 69, 69, 69, 69, 221, 138, 222, 55, 146, - 139, 146, 70, 71, 293, 142, 140, 141, 233, 233, - - 516, 143, 294, 70, 71, 144, 515, 231, 232, 514, - 145, 148, 148, 148, 148, 148, 148, 148, 231, 232, - 156, 156, 156, 156, 156, 156, 156, 524, 524, 243, - 244, 308, 308, 142, 270, 271, 272, 524, 524, 143, - 298, 299, 300, 144, 465, 466, 235, 513, 145, 230, - 230, 230, 230, 230, 230, 230, 151, 235, 234, 234, - 234, 234, 234, 234, 234, 524, 524, 151, 312, 313, - 314, 322, 323, 324, 329, 330, 331, 333, 334, 335, - 341, 342, 343, 512, 154, 309, 309, 309, 309, 309, - 309, 309, 524, 524, 511, 154, 388, 389, 390, 391, - - 392, 393, 394, 395, 396, 457, 458, 459, 465, 466, - 510, 232, 419, 465, 466, 509, 460, 487, 488, 465, - 466, 508, 232, 507, 443, 444, 444, 444, 444, 444, - 444, 482, 465, 466, 492, 493, 492, 493, 506, 468, - 465, 466, 492, 493, 467, 467, 467, 467, 467, 467, - 492, 493, 492, 493, 492, 493, 505, 504, 502, 501, - 500, 499, 468, 498, 497, 495, 494, 494, 494, 494, - 494, 494, 491, 490, 489, 486, 485, 481, 480, 479, - 478, 477, 476, 475, 474, 473, 472, 471, 495, 79, - 79, 79, 79, 79, 79, 149, 149, 149, 149, 149, - - 149, 65, 65, 470, 65, 152, 152, 464, 152, 156, - 156, 156, 157, 157, 157, 157, 228, 228, 463, 228, - 228, 228, 228, 228, 228, 228, 230, 230, 230, 234, - 234, 234, 309, 309, 309, 467, 467, 462, 467, 461, - 456, 455, 454, 467, 469, 469, 453, 469, 469, 483, - 483, 452, 483, 483, 484, 484, 484, 484, 494, 494, - 451, 494, 450, 449, 448, 447, 494, 496, 496, 446, - 496, 496, 503, 503, 503, 503, 445, 442, 441, 440, - 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, - 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, - - 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, - 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, - 399, 398, 397, 387, 386, 385, 384, 383, 382, 381, - 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, - 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, - 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, - 350, 349, 348, 347, 346, 345, 344, 340, 339, 338, - 337, 336, 332, 328, 327, 326, 325, 321, 320, 319, - 318, 317, 316, 315, 311, 310, 307, 306, 305, 304, - 303, 302, 301, 297, 296, 295, 292, 291, 290, 289, - - 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, - 278, 277, 276, 275, 274, 273, 269, 268, 267, 266, - 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, - 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, - 245, 242, 241, 240, 239, 238, 237, 236, 227, 226, - 225, 224, 223, 220, 219, 218, 215, 214, 213, 212, - 211, 208, 207, 206, 205, 204, 203, 202, 201, 200, - 197, 196, 195, 192, 191, 185, 184, 183, 182, 181, - 180, 177, 176, 175, 174, 173, 172, 171, 170, 169, - 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, - - 158, 147, 76, 135, 119, 115, 102, 80, 76, 66, - 60, 57, 56, 524, 5, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524 + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 48, 67, 142, 68, 68, + 68, 68, 68, 68, 69, 77, 78, 81, 95, 84, + 96, 85, 666, 70, 71, 86, 87, 116, 72, 97, + 88, 98, 82, 83, 91, 70, 71, 89, 92, 99, + 90, 117, 100, 665, 93, 101, 143, 104, 114, 119, + 94, 102, 115, 72, 67, 105, 73, 73, 73, 73, + + 73, 73, 73, 175, 176, 120, 107, 106, 121, 108, + 122, 70, 71, 109, 110, 152, 131, 152, 124, 132, + 123, 111, 135, 70, 71, 125, 126, 136, 133, 138, + 127, 137, 55, 139, 55, 134, 128, 129, 144, 130, + 55, 664, 145, 140, 146, 147, 154, 154, 154, 154, + 154, 154, 154, 156, 157, 159, 160, 667, 187, 236, + 185, 152, 237, 152, 222, 156, 157, 159, 160, 161, + 161, 186, 188, 162, 162, 162, 162, 162, 162, 162, + 223, 204, 667, 148, 197, 209, 663, 198, 199, 205, + 149, 200, 210, 201, 150, 212, 146, 147, 662, 151, + + 67, 231, 69, 69, 69, 69, 69, 69, 69, 213, + 232, 144, 661, 55, 660, 145, 659, 70, 71, 146, + 147, 154, 154, 154, 154, 154, 154, 154, 658, 70, + 71, 246, 247, 260, 261, 148, 290, 291, 292, 317, + 657, 519, 149, 246, 247, 656, 150, 655, 318, 520, + 654, 151, 322, 323, 324, 337, 338, 339, 148, 348, + 349, 350, 356, 357, 358, 149, 360, 361, 362, 150, + 653, 244, 244, 652, 151, 245, 245, 245, 245, 245, + 245, 245, 248, 248, 595, 596, 249, 249, 249, 249, + 249, 249, 249, 162, 162, 162, 162, 162, 162, 162, + + 162, 162, 162, 162, 162, 162, 162, 245, 245, 245, + 245, 245, 245, 245, 547, 548, 250, 245, 245, 245, + 245, 245, 245, 245, 370, 371, 372, 651, 250, 650, + 332, 332, 649, 157, 333, 333, 333, 333, 333, 333, + 333, 430, 431, 432, 648, 157, 249, 249, 249, 249, + 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, + 333, 333, 333, 333, 333, 333, 333, 605, 606, 160, + 333, 333, 333, 333, 333, 333, 333, 421, 422, 423, + 647, 160, 433, 434, 435, 646, 247, 645, 424, 425, + 436, 437, 438, 474, 475, 476, 547, 548, 247, 496, + + 497, 498, 465, 644, 477, 478, 605, 606, 643, 642, + 499, 500, 641, 521, 506, 507, 507, 507, 507, 507, + 507, 522, 533, 534, 535, 547, 548, 640, 550, 639, + 638, 605, 606, 536, 537, 547, 548, 551, 551, 551, + 551, 551, 551, 551, 547, 548, 637, 549, 549, 549, + 549, 549, 549, 550, 547, 548, 581, 582, 582, 582, + 582, 582, 582, 608, 605, 606, 551, 551, 551, 551, + 551, 551, 551, 636, 635, 634, 609, 609, 609, 609, + 609, 609, 609, 605, 606, 633, 632, 631, 608, 605, + 606, 630, 629, 627, 626, 607, 607, 607, 607, 607, + + 607, 609, 609, 609, 609, 609, 609, 609, 79, 79, + 79, 79, 79, 155, 155, 155, 155, 155, 65, 65, + 158, 158, 163, 163, 163, 243, 243, 625, 243, 243, + 243, 243, 243, 549, 549, 549, 624, 623, 622, 549, + 583, 583, 583, 607, 607, 607, 621, 620, 619, 607, + 628, 628, 628, 618, 617, 616, 615, 614, 613, 612, + 611, 610, 604, 603, 602, 601, 600, 599, 598, 597, + 594, 593, 592, 591, 590, 589, 588, 587, 586, 585, + 584, 580, 579, 578, 577, 576, 575, 574, 573, 572, + 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, + + 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, + 546, 545, 544, 543, 542, 541, 540, 539, 538, 532, + 531, 530, 529, 528, 527, 526, 525, 524, 523, 518, + 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, + 505, 504, 503, 502, 501, 495, 494, 493, 492, 491, + 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, + 480, 479, 473, 472, 471, 470, 469, 468, 467, 466, + 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, + 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, + 445, 444, 443, 442, 441, 440, 439, 429, 428, 427, + + 426, 420, 419, 418, 417, 416, 415, 414, 413, 412, + 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, + 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, + 391, 390, 389, 388, 387, 386, 385, 384, 383, 382, + 381, 380, 379, 378, 377, 376, 375, 374, 373, 369, + 368, 367, 366, 365, 364, 363, 359, 355, 354, 353, + 352, 351, 347, 346, 345, 344, 343, 342, 341, 340, + 336, 335, 334, 331, 330, 329, 328, 327, 326, 325, + 321, 320, 319, 316, 315, 314, 313, 312, 311, 310, + 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, + + 299, 298, 297, 296, 295, 294, 293, 289, 288, 287, + 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, + 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, + 266, 265, 264, 263, 262, 259, 258, 257, 256, 255, + 254, 253, 252, 251, 242, 241, 240, 239, 238, 235, + 234, 233, 230, 229, 228, 227, 226, 225, 224, 221, + 220, 219, 218, 217, 216, 215, 214, 211, 208, 207, + 206, 203, 202, 196, 195, 194, 193, 192, 191, 190, + 189, 184, 183, 182, 181, 180, 179, 178, 177, 174, + 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, + + 153, 76, 141, 118, 103, 80, 76, 66, 60, 57, + 56, 667, 5, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667 } ; -static yyconst flex_int16_t yy_chk[875] = +static yyconst flex_int16_t yy_chk[1076] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 7, 11, 7, 2, 13, 522, 14, 15, 15, 15, - 15, 15, 15, 15, 19, 19, 11, 13, 14, 521, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 7, 11, 7, 2, 13, 33, 14, + 15, 15, 15, 15, 15, 15, 15, 19, 19, 11, + 13, 14, 33, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 17, 520, 17, 17, 17, 17, 17, 17, 17, 21, - 21, 24, 24, 25, 27, 25, 17, 17, 27, 25, - 26, 17, 33, 27, 26, 35, 99, 17, 17, 27, - 26, 44, 28, 26, 28, 33, 34, 41, 35, 99, - 34, 41, 518, 28, 17, 18, 29, 18, 18, 18, - 18, 18, 18, 18, 29, 31, 29, 32, 516, 29, - - 37, 18, 18, 31, 32, 29, 45, 44, 45, 39, - 45, 32, 18, 18, 31, 37, 39, 39, 37, 40, - 39, 42, 40, 46, 46, 42, 39, 70, 70, 39, - 40, 49, 68, 49, 42, 150, 150, 40, 52, 52, - 52, 52, 52, 52, 52, 55, 110, 55, 515, 130, - 65, 65, 67, 67, 110, 68, 124, 130, 139, 139, - 46, 65, 65, 67, 67, 107, 46, 114, 107, 107, - 46, 124, 107, 114, 107, 46, 69, 514, 69, 69, - 69, 69, 69, 69, 69, 134, 138, 134, 138, 146, - 138, 146, 69, 69, 216, 139, 140, 140, 153, 153, - - 512, 139, 216, 69, 69, 139, 511, 152, 152, 510, - 139, 148, 148, 148, 148, 148, 148, 148, 152, 152, - 155, 155, 155, 155, 155, 155, 155, 156, 156, 168, - 168, 231, 231, 140, 195, 195, 195, 230, 230, 140, - 220, 220, 220, 140, 444, 444, 156, 508, 140, 229, - 229, 229, 229, 229, 229, 229, 230, 156, 233, 233, - 233, 233, 233, 233, 233, 234, 234, 230, 239, 239, - 239, 248, 248, 248, 256, 256, 256, 260, 260, 260, - 266, 266, 266, 507, 234, 308, 308, 308, 308, 308, - 308, 308, 309, 309, 506, 234, 345, 345, 345, 346, - - 346, 346, 347, 347, 347, 435, 435, 435, 443, 443, - 505, 309, 419, 469, 469, 504, 435, 478, 478, 465, - 465, 501, 309, 500, 419, 419, 419, 419, 419, 419, - 419, 465, 467, 467, 482, 482, 483, 483, 499, 443, - 484, 484, 492, 492, 467, 467, 467, 467, 467, 467, - 496, 496, 503, 503, 494, 494, 498, 497, 490, 489, - 488, 487, 443, 486, 485, 482, 494, 494, 494, 494, - 494, 494, 481, 480, 479, 477, 475, 464, 460, 459, - 458, 457, 456, 455, 453, 452, 451, 447, 482, 525, - 525, 525, 525, 525, 525, 526, 526, 526, 526, 526, - - 526, 527, 527, 446, 527, 528, 528, 442, 528, 529, - 529, 529, 530, 530, 530, 530, 531, 531, 441, 531, - 531, 531, 531, 531, 531, 531, 532, 532, 532, 533, - 533, 533, 534, 534, 534, 535, 535, 439, 535, 436, - 434, 433, 432, 535, 536, 536, 431, 536, 536, 537, - 537, 429, 537, 537, 538, 538, 538, 538, 539, 539, - 428, 539, 427, 424, 423, 422, 539, 540, 540, 421, - 540, 540, 541, 541, 541, 541, 420, 418, 417, 416, - 415, 414, 413, 412, 406, 403, 400, 399, 398, 397, - 386, 385, 383, 381, 380, 379, 378, 377, 376, 375, - - 374, 373, 371, 370, 368, 366, 365, 364, 363, 362, - 361, 360, 359, 357, 356, 355, 354, 353, 352, 351, - 350, 349, 348, 344, 340, 339, 336, 325, 321, 320, - 319, 318, 315, 310, 307, 306, 305, 304, 303, 302, - 297, 296, 295, 294, 293, 292, 289, 288, 287, 286, - 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, - 275, 274, 273, 272, 271, 270, 267, 265, 264, 263, - 262, 261, 259, 255, 253, 252, 251, 247, 246, 245, - 244, 243, 242, 241, 238, 236, 227, 226, 225, 224, - 223, 222, 221, 219, 218, 217, 215, 214, 213, 212, - - 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, - 201, 200, 199, 198, 197, 196, 194, 193, 192, 191, - 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, - 179, 178, 177, 176, 175, 174, 173, 172, 171, 170, - 169, 167, 166, 165, 164, 163, 162, 161, 145, 144, - 143, 142, 135, 133, 132, 131, 129, 128, 127, 126, - 125, 123, 122, 121, 120, 119, 118, 117, 116, 115, - 113, 112, 111, 109, 108, 105, 104, 103, 102, 101, - 100, 98, 97, 96, 95, 94, 93, 92, 91, 90, - 89, 88, 87, 86, 85, 84, 83, 82, 81, 78, - - 74, 51, 47, 43, 38, 36, 30, 23, 20, 16, - 12, 10, 9, 5, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 524 + 3, 3, 3, 3, 3, 3, 17, 44, 17, 17, + 17, 17, 17, 17, 17, 21, 21, 24, 28, 25, + 28, 25, 665, 17, 17, 25, 26, 35, 17, 28, + 26, 29, 24, 24, 27, 17, 17, 26, 27, 29, + 26, 35, 29, 664, 27, 29, 44, 31, 34, 37, + 27, 29, 34, 17, 18, 31, 18, 18, 18, 18, + + 18, 18, 18, 90, 90, 37, 32, 31, 37, 32, + 38, 18, 18, 32, 32, 49, 40, 49, 39, 40, + 38, 32, 41, 18, 18, 39, 39, 41, 40, 42, + 39, 41, 55, 42, 55, 40, 39, 39, 45, 39, + 45, 663, 45, 42, 46, 46, 52, 52, 52, 52, + 52, 52, 52, 65, 65, 67, 67, 68, 100, 140, + 99, 152, 140, 152, 128, 65, 65, 67, 67, 70, + 70, 99, 100, 70, 70, 70, 70, 70, 70, 70, + 128, 113, 68, 46, 110, 117, 661, 110, 110, 113, + 46, 110, 117, 110, 46, 119, 145, 145, 659, 46, + + 69, 136, 69, 69, 69, 69, 69, 69, 69, 119, + 136, 144, 658, 144, 657, 144, 652, 69, 69, 146, + 146, 154, 154, 154, 154, 154, 154, 154, 651, 69, + 69, 158, 158, 176, 176, 145, 206, 206, 206, 231, + 650, 479, 145, 158, 158, 643, 145, 642, 231, 479, + 641, 145, 235, 235, 235, 255, 255, 255, 146, 265, + 265, 265, 274, 274, 274, 146, 278, 278, 278, 146, + 640, 156, 156, 639, 146, 156, 156, 156, 156, 156, + 156, 156, 159, 159, 572, 572, 159, 159, 159, 159, + 159, 159, 159, 161, 161, 161, 161, 161, 161, 161, + + 162, 162, 162, 162, 162, 162, 162, 244, 244, 244, + 244, 244, 244, 244, 583, 583, 162, 245, 245, 245, + 245, 245, 245, 245, 286, 286, 286, 638, 162, 637, + 246, 246, 636, 245, 246, 246, 246, 246, 246, 246, + 246, 374, 374, 374, 635, 245, 248, 248, 248, 248, + 248, 248, 248, 249, 249, 249, 249, 249, 249, 249, + 332, 332, 332, 332, 332, 332, 332, 605, 605, 249, + 333, 333, 333, 333, 333, 333, 333, 364, 364, 364, + 633, 249, 375, 375, 375, 630, 333, 629, 364, 364, + 376, 376, 376, 420, 420, 420, 506, 506, 333, 459, + + 459, 459, 465, 627, 420, 420, 628, 628, 626, 625, + 459, 459, 623, 480, 465, 465, 465, 465, 465, 465, + 465, 480, 493, 493, 493, 507, 507, 622, 506, 621, + 620, 581, 581, 493, 493, 549, 549, 507, 507, 507, + 507, 507, 507, 507, 547, 547, 619, 549, 549, 549, + 549, 549, 549, 506, 551, 551, 547, 547, 547, 547, + 547, 547, 547, 581, 582, 582, 551, 551, 551, 551, + 551, 551, 551, 618, 616, 615, 582, 582, 582, 582, + 582, 582, 582, 607, 607, 614, 613, 612, 581, 609, + 609, 611, 610, 602, 601, 607, 607, 607, 607, 607, + + 607, 609, 609, 609, 609, 609, 609, 609, 668, 668, + 668, 668, 668, 669, 669, 669, 669, 669, 670, 670, + 671, 671, 672, 672, 672, 673, 673, 600, 673, 673, + 673, 673, 673, 674, 674, 674, 599, 598, 597, 674, + 675, 675, 675, 676, 676, 676, 596, 595, 594, 676, + 677, 677, 677, 593, 592, 591, 590, 589, 588, 586, + 585, 584, 580, 579, 578, 577, 576, 575, 574, 573, + 571, 567, 562, 561, 560, 559, 558, 557, 556, 555, + 554, 546, 543, 542, 540, 539, 537, 536, 535, 534, + 533, 532, 531, 530, 529, 527, 526, 525, 524, 523, + + 522, 521, 520, 519, 518, 517, 515, 514, 510, 509, + 505, 504, 502, 500, 499, 498, 497, 496, 494, 492, + 491, 490, 489, 488, 487, 485, 484, 483, 482, 478, + 477, 476, 475, 474, 473, 470, 469, 468, 467, 466, + 464, 463, 462, 461, 460, 458, 457, 450, 449, 446, + 445, 442, 441, 440, 439, 428, 427, 425, 424, 423, + 422, 421, 418, 416, 415, 414, 412, 411, 409, 408, + 407, 406, 404, 403, 401, 399, 398, 397, 396, 395, + 394, 393, 392, 391, 390, 388, 387, 386, 385, 384, + 383, 382, 381, 380, 379, 378, 377, 373, 369, 368, + + 365, 363, 353, 351, 347, 346, 345, 344, 342, 340, + 335, 334, 331, 330, 329, 328, 327, 326, 321, 320, + 319, 318, 317, 316, 315, 312, 311, 310, 309, 308, + 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, + 297, 296, 295, 294, 293, 292, 291, 290, 287, 285, + 284, 283, 282, 281, 280, 279, 277, 273, 271, 270, + 269, 268, 264, 263, 262, 261, 260, 259, 258, 257, + 254, 252, 251, 242, 241, 240, 239, 238, 237, 236, + 234, 233, 232, 230, 229, 228, 227, 226, 225, 224, + 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, + + 213, 212, 211, 210, 209, 208, 207, 205, 204, 203, + 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, + 192, 191, 190, 188, 187, 186, 185, 184, 183, 182, + 181, 180, 179, 178, 177, 175, 174, 173, 172, 171, + 170, 169, 168, 166, 151, 150, 149, 148, 141, 139, + 138, 137, 135, 134, 133, 132, 131, 130, 129, 127, + 126, 125, 124, 123, 122, 121, 120, 118, 116, 115, + 114, 112, 111, 109, 108, 106, 105, 104, 103, 102, + 101, 98, 97, 96, 95, 94, 93, 92, 91, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 78, 74, + + 51, 47, 43, 36, 30, 23, 20, 16, 12, 10, + 9, 5, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 667, 667 } ; /* The intent behind this definition is that it'll catch @@ -856,7 +935,7 @@ static yyconst flex_int16_t yy_chk[875] = } while (0) -#line 860 "glsl_lexer.cpp" +#line 939 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -990,12 +1069,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1003,7 +1077,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1014,7 +1088,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1105,7 +1179,7 @@ YY_DECL #line 66 "glsl_lexer.lpp" -#line 1109 "glsl_lexer.cpp" +#line 1183 "glsl_lexer.cpp" yylval = yylval_param; @@ -1163,13 +1237,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 525 ) + if ( yy_current_state >= 668 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 524 ); + while ( yy_current_state != 667 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1994,9 +2068,160 @@ YY_RULE_SETUP #line 303 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, PRECISION); YY_BREAK +/* Additional reserved words in GLSL 1.30. */ case 145: YY_RULE_SETUP -#line 305 "glsl_lexer.lpp" +#line 306 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, COMMON); + YY_BREAK +case 146: +YY_RULE_SETUP +#line 307 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, PARTITION); + YY_BREAK +case 147: +YY_RULE_SETUP +#line 308 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, ACTIVE); + YY_BREAK +case 148: +YY_RULE_SETUP +#line 309 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, SUPERP); + YY_BREAK +case 149: +YY_RULE_SETUP +#line 310 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); + YY_BREAK +case 150: +YY_RULE_SETUP +#line 311 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, FILTER); + YY_BREAK +case 151: +YY_RULE_SETUP +#line 312 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1D); + YY_BREAK +case 152: +YY_RULE_SETUP +#line 313 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2D); + YY_BREAK +case 153: +YY_RULE_SETUP +#line 314 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE3D); + YY_BREAK +case 154: +YY_RULE_SETUP +#line 315 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGECUBE); + YY_BREAK +case 155: +YY_RULE_SETUP +#line 316 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE1D); + YY_BREAK +case 156: +YY_RULE_SETUP +#line 317 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE2D); + YY_BREAK +case 157: +YY_RULE_SETUP +#line 318 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE3D); + YY_BREAK +case 158: +YY_RULE_SETUP +#line 319 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); + YY_BREAK +case 159: +YY_RULE_SETUP +#line 320 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE1D); + YY_BREAK +case 160: +YY_RULE_SETUP +#line 321 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE2D); + YY_BREAK +case 161: +YY_RULE_SETUP +#line 322 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE3D); + YY_BREAK +case 162: +YY_RULE_SETUP +#line 323 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); + YY_BREAK +case 163: +YY_RULE_SETUP +#line 324 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); + YY_BREAK +case 164: +YY_RULE_SETUP +#line 325 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); + YY_BREAK +case 165: +YY_RULE_SETUP +#line 326 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); + YY_BREAK +case 166: +YY_RULE_SETUP +#line 327 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); + YY_BREAK +case 167: +YY_RULE_SETUP +#line 328 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); + YY_BREAK +case 168: +YY_RULE_SETUP +#line 329 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); + YY_BREAK +case 169: +YY_RULE_SETUP +#line 330 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); + YY_BREAK +case 170: +YY_RULE_SETUP +#line 331 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); + YY_BREAK +case 171: +YY_RULE_SETUP +#line 332 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); + YY_BREAK +case 172: +YY_RULE_SETUP +#line 333 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); + YY_BREAK +case 173: +YY_RULE_SETUP +#line 334 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); + YY_BREAK +case 174: +YY_RULE_SETUP +#line 335 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); + YY_BREAK +case 175: +YY_RULE_SETUP +#line 337 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2004,17 +2229,17 @@ YY_RULE_SETUP return IDENTIFIER; } YY_BREAK -case 146: +case 176: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 344 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK -case 147: +case 177: YY_RULE_SETUP -#line 314 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2018 "glsl_lexer.cpp" +#line 2243 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -2311,7 +2536,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 525 ) + if ( yy_current_state >= 668 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2340,11 +2565,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 525 ) + if ( yy_current_state >= 668 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 524); + yy_is_jam = (yy_current_state == 667); return yy_is_jam ? 0 : yy_current_state; } @@ -2749,8 +2974,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3156,7 +3381,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 314 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 9fd9b53c5c..b78df5d84f 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -302,6 +302,38 @@ mediump TOKEN_OR_IDENTIFIER(120, MEDIUMP); highp TOKEN_OR_IDENTIFIER(120, HIGHP); precision TOKEN_OR_IDENTIFIER(120, PRECISION); + /* Additional reserved words in GLSL 1.30. */ +common TOKEN_OR_IDENTIFIER(130, COMMON); +partition TOKEN_OR_IDENTIFIER(130, PARTITION); +active TOKEN_OR_IDENTIFIER(130, ACTIVE); +superp TOKEN_OR_IDENTIFIER(130, SUPERP); +samplerBuffer TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); +filter TOKEN_OR_IDENTIFIER(130, FILTER); +image1D TOKEN_OR_IDENTIFIER(130, IMAGE1D); +image2D TOKEN_OR_IDENTIFIER(130, IMAGE2D); +image3D TOKEN_OR_IDENTIFIER(130, IMAGE3D); +imageCube TOKEN_OR_IDENTIFIER(130, IMAGECUBE); +iimage1D TOKEN_OR_IDENTIFIER(130, IIMAGE1D); +iimage2D TOKEN_OR_IDENTIFIER(130, IIMAGE2D); +iimage3D TOKEN_OR_IDENTIFIER(130, IIMAGE3D); +iimageCube TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); +uimage1D TOKEN_OR_IDENTIFIER(130, UIMAGE1D); +uimage2D TOKEN_OR_IDENTIFIER(130, UIMAGE2D); +uimage3D TOKEN_OR_IDENTIFIER(130, UIMAGE3D); +uimageCube TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); +image1DArray TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); +image2DArray TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); +iimage1DArray TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); +iimage2DArray TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); +uimage1DArray TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); +uimage2DArray TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); +image1DShadow TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); +image2DShadow TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); +imageBuffer TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); +iimageBuffer TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); +uimageBuffer TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); +row_major TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); + [_a-zA-Z][_a-zA-Z0-9]* { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index bf83b81603..4b5e3614df 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -114,7 +113,7 @@ /* Line 189 of yacc.c */ -#line 118 "glsl_parser.cpp" +#line 117 "glsl_parser.cpp" /* Enabling traces. */ #ifndef YYDEBUG @@ -248,56 +247,86 @@ LOWP = 362, MEDIUMP = 363, HIGHP = 364, - PRECISION = 365, - VERSION = 366, - EXTENSION = 367, - LINE = 368, - PRAGMA = 369, - COLON = 370, - EOL = 371, - INTERFACE = 372, - OUTPUT = 373, - LAYOUT_TOK = 374, - ASM = 375, - CLASS = 376, - UNION = 377, - ENUM = 378, - TYPEDEF = 379, - TEMPLATE = 380, - THIS = 381, - PACKED = 382, - GOTO = 383, - INLINE_TOK = 384, - NOINLINE = 385, - VOLATILE = 386, - PUBLIC_TOK = 387, - STATIC = 388, - EXTERN = 389, - EXTERNAL = 390, - LONG = 391, - SHORT = 392, - DOUBLE = 393, - HALF = 394, - FIXED = 395, - UNSIGNED = 396, - INPUT = 397, - OUPTUT = 398, - HVEC2 = 399, - HVEC3 = 400, - HVEC4 = 401, - DVEC2 = 402, - DVEC3 = 403, - DVEC4 = 404, - FVEC2 = 405, - FVEC3 = 406, - FVEC4 = 407, - SAMPLER2DRECT = 408, - SAMPLER3DRECT = 409, - SAMPLER2DRECTSHADOW = 410, - SIZEOF = 411, - CAST = 412, - NAMESPACE = 413, - USING = 414 + SUPERP = 365, + PRECISION = 366, + VERSION = 367, + EXTENSION = 368, + LINE = 369, + PRAGMA = 370, + COLON = 371, + EOL = 372, + INTERFACE = 373, + OUTPUT = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG = 392, + SHORT = 393, + DOUBLE = 394, + HALF = 395, + FIXED = 396, + UNSIGNED = 397, + INPUT = 398, + OUPTUT = 399, + HVEC2 = 400, + HVEC3 = 401, + HVEC4 = 402, + DVEC2 = 403, + DVEC3 = 404, + DVEC4 = 405, + FVEC2 = 406, + FVEC3 = 407, + FVEC4 = 408, + SAMPLER2DRECT = 409, + SAMPLER3DRECT = 410, + SAMPLER2DRECTSHADOW = 411, + SIZEOF = 412, + CAST = 413, + NAMESPACE = 414, + USING = 415, + COMMON = 416, + PARTITION = 417, + ACTIVE = 418, + SAMPLERBUFFER = 419, + FILTER = 420, + IMAGE1D = 421, + IMAGE2D = 422, + IMAGE3D = 423, + IMAGECUBE = 424, + IMAGE1DARRAY = 425, + IMAGE2DARRAY = 426, + IIMAGE1D = 427, + IIMAGE2D = 428, + IIMAGE3D = 429, + IIMAGECUBE = 430, + IIMAGE1DARRAY = 431, + IIMAGE2DARRAY = 432, + UIMAGE1D = 433, + UIMAGE2D = 434, + UIMAGE3D = 435, + UIMAGECUBE = 436, + UIMAGE1DARRAY = 437, + UIMAGE2DARRAY = 438, + IMAGE1DSHADOW = 439, + IMAGE2DSHADOW = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + ROW_MAJOR = 444 }; #endif @@ -339,7 +368,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 343 "glsl_parser.cpp" +#line 372 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -364,7 +393,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 368 "glsl_parser.cpp" +#line 397 "glsl_parser.cpp" #ifdef short # undef short @@ -414,7 +443,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -581,10 +610,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 3839 +#define YYLAST 4373 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 184 +#define YYNTOKENS 214 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 89 /* YYNRULES -- Number of rules. */ @@ -594,7 +623,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 414 +#define YYMAXUTOK 444 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -605,16 +634,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 168, 2, 2, 2, 172, 175, 2, - 160, 161, 170, 166, 165, 167, 164, 171, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 179, 181, - 173, 180, 174, 178, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 198, 2, 2, 2, 202, 205, 2, + 190, 191, 200, 196, 195, 197, 194, 201, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 209, 211, + 203, 210, 204, 208, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 162, 2, 163, 176, 2, 2, 2, 2, 2, + 2, 192, 2, 193, 206, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 182, 177, 183, 169, 2, 2, 2, + 2, 2, 2, 212, 207, 213, 199, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -643,7 +672,10 @@ static const yytype_uint8 yytranslate[] = 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159 + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189 }; #if YYDEBUG @@ -684,119 +716,119 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 185, 0, -1, -1, 187, 188, 186, 190, -1, -1, - 111, 81, 116, -1, -1, 188, 189, -1, 112, 79, - 115, 79, 116, -1, 271, -1, 190, 271, -1, 79, - -1, 191, -1, 81, -1, 82, -1, 80, -1, 83, - -1, 160, 218, 161, -1, 192, -1, 193, 162, 194, - 163, -1, 195, -1, 193, 164, 79, -1, 193, 87, - -1, 193, 88, -1, 218, -1, 196, -1, 197, -1, - 193, 164, 197, -1, 199, 161, -1, 198, 161, -1, - 200, 77, -1, 200, -1, 200, 216, -1, 199, 165, - 216, -1, 201, 160, -1, 240, -1, 79, -1, 84, - -1, 193, -1, 87, 202, -1, 88, 202, -1, 203, - 202, -1, 166, -1, 167, -1, 168, -1, 169, -1, - 202, -1, 204, 170, 202, -1, 204, 171, 202, -1, - 204, 172, 202, -1, 204, -1, 205, 166, 204, -1, - 205, 167, 204, -1, 205, -1, 206, 85, 205, -1, - 206, 86, 205, -1, 206, -1, 207, 173, 206, -1, - 207, 174, 206, -1, 207, 89, 206, -1, 207, 90, - 206, -1, 207, -1, 208, 91, 207, -1, 208, 92, - 207, -1, 208, -1, 209, 175, 208, -1, 209, -1, - 210, 176, 209, -1, 210, -1, 211, 177, 210, -1, - 211, -1, 212, 93, 211, -1, 212, -1, 213, 95, - 212, -1, 213, -1, 214, 94, 213, -1, 214, -1, - 214, 178, 218, 179, 216, -1, 215, -1, 202, 217, - 216, -1, 180, -1, 96, -1, 97, -1, 99, -1, + 215, 0, -1, -1, 217, 218, 216, 220, -1, -1, + 112, 81, 117, -1, -1, 218, 219, -1, 113, 79, + 116, 79, 117, -1, 301, -1, 220, 301, -1, 79, + -1, 221, -1, 81, -1, 82, -1, 80, -1, 83, + -1, 190, 248, 191, -1, 222, -1, 223, 192, 224, + 193, -1, 225, -1, 223, 194, 79, -1, 223, 87, + -1, 223, 88, -1, 248, -1, 226, -1, 227, -1, + 223, 194, 227, -1, 229, 191, -1, 228, 191, -1, + 230, 77, -1, 230, -1, 230, 246, -1, 229, 195, + 246, -1, 231, 190, -1, 270, -1, 79, -1, 84, + -1, 223, -1, 87, 232, -1, 88, 232, -1, 233, + 232, -1, 196, -1, 197, -1, 198, -1, 199, -1, + 232, -1, 234, 200, 232, -1, 234, 201, 232, -1, + 234, 202, 232, -1, 234, -1, 235, 196, 234, -1, + 235, 197, 234, -1, 235, -1, 236, 85, 235, -1, + 236, 86, 235, -1, 236, -1, 237, 203, 236, -1, + 237, 204, 236, -1, 237, 89, 236, -1, 237, 90, + 236, -1, 237, -1, 238, 91, 237, -1, 238, 92, + 237, -1, 238, -1, 239, 205, 238, -1, 239, -1, + 240, 206, 239, -1, 240, -1, 241, 207, 240, -1, + 241, -1, 242, 93, 241, -1, 242, -1, 243, 95, + 242, -1, 243, -1, 244, 94, 243, -1, 244, -1, + 244, 208, 248, 209, 246, -1, 245, -1, 232, 247, + 246, -1, 210, -1, 96, -1, 97, -1, 99, -1, 98, -1, 105, -1, 100, -1, 101, -1, 102, -1, - 103, -1, 104, -1, 216, -1, 218, 165, 216, -1, - 215, -1, 221, 181, -1, 229, 181, -1, 110, 244, - 241, 181, -1, 222, 161, -1, 224, -1, 223, -1, - 224, 226, -1, 223, 165, 226, -1, 231, 79, 160, - -1, 240, 79, -1, 240, 79, 162, 219, 163, -1, - 237, 227, 225, -1, 227, 225, -1, 237, 227, 228, - -1, 227, 228, -1, -1, 36, -1, 37, -1, 38, - -1, 240, -1, 230, -1, 229, 165, 79, -1, 229, - 165, 79, 162, 163, -1, 229, 165, 79, 162, 219, - 163, -1, 229, 165, 79, 162, 163, 180, 250, -1, - 229, 165, 79, 162, 219, 163, 180, 250, -1, 229, - 165, 79, 180, 250, -1, 231, -1, 231, 79, -1, - 231, 79, 162, 163, -1, 231, 79, 162, 219, 163, - -1, 231, 79, 162, 163, 180, 250, -1, 231, 79, - 162, 219, 163, 180, 250, -1, 231, 79, 180, 250, - -1, 106, 79, -1, 240, -1, 238, 240, -1, -1, - 233, -1, 119, 160, 234, 161, -1, 235, -1, 234, - 165, 235, -1, 79, -1, 43, -1, 42, -1, 41, - -1, 4, -1, 239, -1, 236, 238, -1, 106, 238, - -1, 4, -1, 3, -1, 232, 40, -1, 35, 40, - -1, 232, 36, -1, 37, -1, 35, 36, -1, 35, - 37, -1, 39, -1, 241, -1, 244, 241, -1, 242, - -1, 242, 162, 163, -1, 242, 162, 219, 163, -1, - 243, -1, 245, -1, 79, -1, 77, -1, 6, -1, + 103, -1, 104, -1, 246, -1, 248, 195, 246, -1, + 245, -1, 251, 211, -1, 259, 211, -1, 111, 274, + 271, 211, -1, 252, 191, -1, 254, -1, 253, -1, + 254, 256, -1, 253, 195, 256, -1, 261, 79, 190, + -1, 270, 79, -1, 270, 79, 192, 249, 193, -1, + 267, 257, 255, -1, 257, 255, -1, 267, 257, 258, + -1, 257, 258, -1, -1, 36, -1, 37, -1, 38, + -1, 270, -1, 260, -1, 259, 195, 79, -1, 259, + 195, 79, 192, 193, -1, 259, 195, 79, 192, 249, + 193, -1, 259, 195, 79, 192, 193, 210, 280, -1, + 259, 195, 79, 192, 249, 193, 210, 280, -1, 259, + 195, 79, 210, 280, -1, 261, -1, 261, 79, -1, + 261, 79, 192, 193, -1, 261, 79, 192, 249, 193, + -1, 261, 79, 192, 193, 210, 280, -1, 261, 79, + 192, 249, 193, 210, 280, -1, 261, 79, 210, 280, + -1, 106, 79, -1, 270, -1, 268, 270, -1, -1, + 263, -1, 120, 190, 264, 191, -1, 265, -1, 264, + 195, 265, -1, 79, -1, 43, -1, 42, -1, 41, + -1, 4, -1, 269, -1, 266, 268, -1, 106, 268, + -1, 4, -1, 3, -1, 262, 40, -1, 35, 40, + -1, 262, 36, -1, 37, -1, 35, 36, -1, 35, + 37, -1, 39, -1, 271, -1, 274, 271, -1, 272, + -1, 272, 192, 193, -1, 272, 192, 249, 193, -1, + 273, -1, 275, -1, 79, -1, 77, -1, 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, 32, -1, 33, -1, 34, -1, 44, -1, 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, 50, -1, - 51, -1, 52, -1, 53, -1, 54, -1, 153, -1, - 55, -1, 56, -1, 57, -1, 58, -1, 155, -1, + 51, -1, 52, -1, 53, -1, 54, -1, 154, -1, + 55, -1, 56, -1, 57, -1, 58, -1, 156, -1, 59, -1, 60, -1, 61, -1, 62, -1, 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, 71, -1, 72, -1, 73, -1, 74, -1, 75, -1, 109, -1, 108, -1, 107, -1, - 76, 79, 182, 246, 183, -1, 76, 182, 246, 183, - -1, 247, -1, 246, 247, -1, 240, 248, 181, -1, - 249, -1, 248, 165, 249, -1, 79, -1, 79, 162, - 219, 163, -1, 216, -1, 220, -1, 253, -1, 254, - -1, 256, -1, 255, -1, 262, -1, 251, -1, 260, - -1, 261, -1, 264, -1, 265, -1, 266, -1, 270, - -1, 182, 183, -1, 182, 259, 183, -1, 258, -1, - 255, -1, 182, 183, -1, 182, 259, 183, -1, 252, - -1, 259, 252, -1, 181, -1, 218, 181, -1, 14, - 160, 218, 161, 253, 12, 253, -1, 14, 160, 218, - 161, 253, -1, 14, 160, 218, 161, 254, -1, 14, - 160, 218, 161, 253, 12, 254, -1, 218, -1, 231, - 79, 180, 250, -1, 17, 160, 218, 161, 256, -1, - 18, 218, 179, -1, 19, 179, -1, 78, 160, 263, - 161, 257, -1, 11, 252, 78, 160, 218, 161, 181, - -1, 13, 160, 267, 269, 161, 257, -1, 260, -1, - 251, -1, 263, -1, -1, 268, 181, -1, 268, 181, - 218, -1, 10, 181, -1, 9, 181, -1, 16, 181, - -1, 16, 218, 181, -1, 15, 181, -1, 272, -1, - 220, -1, 221, 258, -1 + 76, 79, 212, 276, 213, -1, 76, 212, 276, 213, + -1, 277, -1, 276, 277, -1, 270, 278, 211, -1, + 279, -1, 278, 195, 279, -1, 79, -1, 79, 192, + 249, 193, -1, 246, -1, 250, -1, 283, -1, 284, + -1, 286, -1, 285, -1, 292, -1, 281, -1, 290, + -1, 291, -1, 294, -1, 295, -1, 296, -1, 300, + -1, 212, 213, -1, 212, 289, 213, -1, 288, -1, + 285, -1, 212, 213, -1, 212, 289, 213, -1, 282, + -1, 289, 282, -1, 211, -1, 248, 211, -1, 14, + 190, 248, 191, 283, 12, 283, -1, 14, 190, 248, + 191, 283, -1, 14, 190, 248, 191, 284, -1, 14, + 190, 248, 191, 283, 12, 284, -1, 248, -1, 261, + 79, 210, 280, -1, 17, 190, 248, 191, 286, -1, + 18, 248, 209, -1, 19, 209, -1, 78, 190, 293, + 191, 287, -1, 11, 282, 78, 190, 248, 191, 211, + -1, 13, 190, 297, 299, 191, 287, -1, 290, -1, + 281, -1, 293, -1, -1, 298, 211, -1, 298, 211, + 248, -1, 10, 211, -1, 9, 211, -1, 16, 211, + -1, 16, 248, 211, -1, 15, 211, -1, 302, -1, + 250, -1, 251, 288, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 193, 193, 192, 201, 204, 221, 223, 227, 236, - 244, 255, 259, 266, 273, 280, 287, 294, 301, 302, - 308, 312, 319, 325, 334, 338, 342, 343, 352, 353, - 357, 358, 362, 368, 380, 384, 390, 397, 408, 409, - 415, 421, 431, 432, 433, 434, 438, 439, 445, 451, - 460, 461, 467, 476, 477, 483, 492, 493, 499, 505, - 511, 520, 521, 527, 536, 537, 546, 547, 556, 557, - 566, 567, 576, 577, 586, 587, 596, 597, 606, 607, - 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, - 626, 630, 634, 650, 654, 658, 662, 676, 680, 681, - 685, 690, 698, 709, 719, 734, 741, 746, 757, 769, - 770, 771, 772, 776, 780, 781, 790, 799, 808, 817, - 826, 839, 850, 859, 868, 877, 886, 895, 904, 918, - 925, 936, 937, 941, 948, 949, 956, 990, 991, 992, - 996, 1000, 1001, 1005, 1013, 1014, 1015, 1016, 1017, 1018, - 1019, 1020, 1021, 1025, 1026, 1034, 1035, 1041, 1050, 1056, - 1062, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, - 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, - 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, - 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, - 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, - 1120, 1121, 1122, 1123, 1124, 1128, 1139, 1150, 1164, 1170, - 1179, 1184, 1192, 1207, 1212, 1220, 1226, 1235, 1239, 1245, - 1246, 1250, 1251, 1255, 1259, 1260, 1261, 1262, 1263, 1264, - 1265, 1269, 1275, 1284, 1285, 1289, 1295, 1304, 1314, 1326, - 1332, 1341, 1350, 1356, 1362, 1371, 1375, 1389, 1393, 1394, - 1398, 1405, 1412, 1422, 1423, 1427, 1429, 1435, 1440, 1449, - 1455, 1461, 1467, 1473, 1482, 1483, 1487 + 0, 200, 200, 199, 208, 211, 228, 230, 234, 243, + 251, 262, 266, 273, 280, 287, 294, 301, 308, 309, + 315, 319, 326, 332, 341, 345, 349, 350, 359, 360, + 364, 365, 369, 375, 387, 391, 397, 404, 415, 416, + 422, 428, 438, 439, 440, 441, 445, 446, 452, 458, + 467, 468, 474, 483, 484, 490, 499, 500, 506, 512, + 518, 527, 528, 534, 543, 544, 553, 554, 563, 564, + 573, 574, 583, 584, 593, 594, 603, 604, 613, 614, + 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, + 633, 637, 641, 657, 661, 665, 669, 683, 687, 688, + 692, 697, 705, 716, 726, 741, 748, 753, 764, 776, + 777, 778, 779, 783, 787, 788, 797, 806, 815, 824, + 833, 846, 857, 866, 875, 884, 893, 902, 911, 925, + 932, 943, 944, 948, 955, 956, 963, 997, 998, 999, + 1003, 1007, 1008, 1012, 1020, 1021, 1022, 1023, 1024, 1025, + 1026, 1027, 1028, 1032, 1033, 1041, 1042, 1048, 1057, 1063, + 1069, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, + 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, + 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, + 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, + 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, + 1127, 1128, 1129, 1130, 1131, 1135, 1146, 1157, 1171, 1177, + 1186, 1191, 1199, 1214, 1219, 1227, 1233, 1242, 1246, 1252, + 1253, 1257, 1258, 1262, 1266, 1267, 1268, 1269, 1270, 1271, + 1272, 1276, 1282, 1291, 1292, 1296, 1302, 1311, 1321, 1333, + 1339, 1348, 1357, 1363, 1369, 1378, 1382, 1396, 1400, 1401, + 1405, 1412, 1419, 1429, 1430, 1434, 1436, 1442, 1447, 1456, + 1462, 1468, 1474, 1480, 1489, 1490, 1494 }; #endif @@ -824,18 +856,25 @@ static const char *const yytname[] = "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", - "LOWP", "MEDIUMP", "HIGHP", "PRECISION", "VERSION", "EXTENSION", "LINE", - "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", "LAYOUT_TOK", "ASM", - "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", "THIS", "PACKED", - "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", - "EXTERN", "EXTERNAL", "LONG", "SHORT", "DOUBLE", "HALF", "FIXED", - "UNSIGNED", "INPUT", "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", - "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", "SAMPLER2DRECT", - "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", - "USING", "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", - "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", - "':'", "'='", "';'", "'{'", "'}'", "$accept", "translation_unit", "$@1", - "version_statement", "extension_statement_list", "extension_statement", + "LOWP", "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION", + "EXTENSION", "LINE", "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", + "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", + "THIS", "PACKED", "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", + "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", "LONG", "SHORT", "DOUBLE", + "HALF", "FIXED", "UNSIGNED", "INPUT", "OUPTUT", "HVEC2", "HVEC3", + "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", + "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", + "CAST", "NAMESPACE", "USING", "COMMON", "PARTITION", "ACTIVE", + "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D", "IMAGECUBE", + "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", "IIMAGE3D", + "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", "UIMAGE2D", + "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", + "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", + "UIMAGEBUFFER", "ROW_MAJOR", "'('", "')'", "'['", "']'", "'.'", "','", + "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", + "'^'", "'|'", "'?'", "':'", "'='", "';'", "'{'", "'}'", "$accept", + "translation_unit", "$@1", "version_statement", + "extension_statement_list", "extension_statement", "external_declaration_list", "variable_identifier", "primary_expression", "postfix_expression", "integer_expression", "function_call", "function_call_or_method", "function_call_generic", @@ -892,6 +931,9 @@ static const yytype_uint16 yytoknum[] = 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 40, 41, 91, 93, 46, 44, 43, 45, 33, 126, 42, 47, 37, 60, 62, 38, 94, 124, 63, 58, 61, 59, 123, 125 @@ -901,34 +943,34 @@ static const yytype_uint16 yytoknum[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 184, 186, 185, 187, 187, 188, 188, 189, 190, - 190, 191, 192, 192, 192, 192, 192, 192, 193, 193, - 193, 193, 193, 193, 194, 195, 196, 196, 197, 197, - 198, 198, 199, 199, 200, 201, 201, 201, 202, 202, - 202, 202, 203, 203, 203, 203, 204, 204, 204, 204, - 205, 205, 205, 206, 206, 206, 207, 207, 207, 207, - 207, 208, 208, 208, 209, 209, 210, 210, 211, 211, - 212, 212, 213, 213, 214, 214, 215, 215, 216, 216, - 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, - 217, 218, 218, 219, 220, 220, 220, 221, 222, 222, - 223, 223, 224, 225, 225, 226, 226, 226, 226, 227, - 227, 227, 227, 228, 229, 229, 229, 229, 229, 229, - 229, 230, 230, 230, 230, 230, 230, 230, 230, 231, - 231, 232, 232, 233, 234, 234, 235, 236, 236, 236, - 237, 238, 238, 238, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 240, 240, 241, 241, 241, 242, 242, - 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 244, 244, 244, 245, 245, - 246, 246, 247, 248, 248, 249, 249, 250, 251, 252, - 252, 253, 253, 254, 255, 255, 255, 255, 255, 255, - 255, 256, 256, 257, 257, 258, 258, 259, 259, 260, - 260, 261, 262, 262, 262, 263, 263, 264, 265, 265, - 266, 266, 266, 267, 267, 268, 268, 269, 269, 270, - 270, 270, 270, 270, 271, 271, 272 + 0, 214, 216, 215, 217, 217, 218, 218, 219, 220, + 220, 221, 222, 222, 222, 222, 222, 222, 223, 223, + 223, 223, 223, 223, 224, 225, 226, 226, 227, 227, + 228, 228, 229, 229, 230, 231, 231, 231, 232, 232, + 232, 232, 233, 233, 233, 233, 234, 234, 234, 234, + 235, 235, 235, 236, 236, 236, 237, 237, 237, 237, + 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, + 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 248, 248, 249, 250, 250, 250, 251, 252, 252, + 253, 253, 254, 255, 255, 256, 256, 256, 256, 257, + 257, 257, 257, 258, 259, 259, 259, 259, 259, 259, + 259, 260, 260, 260, 260, 260, 260, 260, 260, 261, + 261, 262, 262, 263, 264, 264, 265, 266, 266, 266, + 267, 268, 268, 268, 269, 269, 269, 269, 269, 269, + 269, 269, 269, 270, 270, 271, 271, 271, 272, 272, + 272, 273, 273, 273, 273, 273, 273, 273, 273, 273, + 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, + 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, + 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, + 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, + 273, 273, 273, 273, 273, 274, 274, 274, 275, 275, + 276, 276, 277, 278, 278, 279, 279, 280, 281, 282, + 282, 283, 283, 284, 285, 285, 285, 285, 285, 285, + 285, 286, 286, 287, 287, 288, 288, 289, 289, 290, + 290, 291, 292, 292, 292, 293, 293, 294, 295, 295, + 296, 296, 296, 297, 297, 298, 298, 299, 299, 300, + 300, 300, 300, 300, 301, 301, 302 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1029,65 +1071,65 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -353 +#define YYPACT_NINF -351 static const yytype_int16 yypact[] = { - -96, -61, 22, -353, -89, -353, -75, -353, -25, 3345, - -353, -48, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, 106, -353, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -78, -353, -353, 3, -353, -353, -353, 63, -80, - -353, -353, 3228, -353, -55, -92, -54, -2, -133, -353, - -5, 50, -353, 14, 3572, -353, -353, -353, -56, -353, - 3684, -353, -353, -353, 34, -353, -353, -353, -44, 3572, - -353, 14, -353, 3684, 62, -353, -353, 273, -353, -353, - 87, -353, -353, -353, -353, -353, 3572, 176, 85, -353, - -137, -353, -353, -353, -353, 2454, -353, 33, 3572, 89, - 1856, -353, -15, -353, -33, -353, 28, 42, 997, 43, - 64, 44, 2136, 66, 2907, 48, 69, -68, -353, -353, - -353, -353, -353, 2907, 2907, 2907, -353, -353, -353, -353, - -353, 454, -353, -353, -353, -59, -353, -353, -353, 13, - -17, 3058, 71, 270, 2907, 49, -31, 70, -76, 103, - 57, 60, 61, 144, 145, -85, -353, -353, -104, -353, - 58, 83, -353, -353, -353, -353, -353, -353, 635, -353, - -353, -353, -353, -353, -353, -353, -353, -353, -353, 165, - 3572, -102, -353, 2605, 2907, -353, -353, -353, 82, -353, - -353, 1996, 84, -100, -353, -353, -353, -353, -353, 62, - -353, -353, 172, 1524, 2907, -353, -353, -94, 2907, -90, - -353, 2303, -353, -353, -14, -353, 816, -353, -353, 2907, - 3460, -353, -353, 2907, 90, -353, -353, -353, -353, -353, - -353, -353, -353, -353, -353, -353, -353, -353, 2907, -353, - 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, - 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, 2907, - 2907, -353, -353, -353, 91, -353, -353, 2756, 2907, 72, - 93, -353, -353, -353, -353, 2907, 89, -353, -353, 97, - -353, -353, 1691, -7, -353, -4, -353, 94, 179, 99, - -353, -353, 98, 94, 102, -353, -353, -353, -353, -353, - -353, 49, 49, -31, -31, 70, 70, 70, 70, -76, - -76, 103, 57, 60, 61, 144, 145, -58, -353, 2907, - 86, 100, -353, 2907, 88, 101, -353, 2907, -353, 92, - 104, 997, 127, 95, 1177, -353, 2907, 107, 2907, 105, - -353, 2907, -353, 2, 2907, 1177, 255, -353, -353, 2907, - 109, -353, -353, -353, -353, -353, -353, 2907, -353, 130, - 94, -353, 997, -353, 2907, -353, -353, -353, -353, 4, - 1357, 259, 1357 + -85, -52, 36, -351, -60, -351, -30, -351, -31, 3875, + -351, -27, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -351, -351, 69, -351, -351, -351, -351, -351, -351, + -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -78, -351, -351, 8, -351, -351, -351, 50, -83, + -351, -351, 3757, -351, -63, 4, -44, 3, -169, -351, + 82, -5, -351, 166, 4104, -351, -351, -351, 14, -351, + 4217, -351, -351, -351, 135, -351, -351, -351, -12, 4104, + -351, 166, -351, 4217, 142, -351, -351, 401, -351, -351, + 18, -351, -351, -351, -351, -351, 4104, 127, 144, -351, + -112, -351, -351, -351, -351, 2857, -351, 107, 4104, 146, + 2254, -351, 20, -351, -99, -351, 21, 25, 1245, 39, + 47, 27, 2480, 49, 3397, 31, 53, -69, -351, -351, + -351, -351, -351, 3397, 3397, 3397, -351, -351, -351, -351, + -351, 612, -351, -351, -351, -68, -351, -351, -351, 54, + -59, 3577, 56, -36, 3397, -34, -25, 112, -81, 121, + 45, 38, 44, 159, 158, -88, -351, -351, -167, -351, + 46, 66, -351, -351, -351, -351, -351, -351, 823, -351, + -351, -351, -351, -351, -351, -351, -351, -351, -351, 179, + 4104, -178, -351, 3037, 3397, -351, -351, -351, 67, -351, + -351, 2367, 70, -121, -351, -351, -351, -351, -351, 142, + -351, -351, 181, 1862, 3397, -351, -351, -114, 3397, -172, + -351, 2677, -351, -351, -58, -351, 1034, -351, -351, 3397, + 3991, -351, -351, 3397, 72, -351, -351, -351, -351, -351, + -351, -351, -351, -351, -351, -351, -351, -351, 3397, -351, + 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, + 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, + 3397, -351, -351, -351, 73, -351, -351, 3217, 3397, 51, + 71, -351, -351, -351, -351, 3397, 146, -351, -351, 76, + -351, -351, 2059, -51, -351, -50, -351, 74, 188, 77, + -351, -351, 78, 74, 80, -351, -351, -351, -351, -351, + -351, -34, -34, -25, -25, 112, 112, 112, 112, -81, + -81, 121, 45, 38, 44, 159, 158, -125, -351, 3397, + 63, 81, -351, 3397, 65, 83, -351, 3397, -351, 68, + 86, 1245, 75, 79, 1455, -351, 3397, 85, 3397, 84, + -351, 3397, -351, -49, 3397, 1455, 268, -351, -351, 3397, + 91, -351, -351, -351, -351, -351, -351, 3397, -351, 87, + 74, -351, 1245, -351, 3397, -351, -351, -351, -351, -48, + 1665, 270, 1665 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, - -353, -353, -353, 117, -353, -353, -353, -353, -105, -353, - -86, -69, -82, -91, -21, -20, 68, 108, 67, 80, - -353, -111, -148, -353, -149, -219, 12, 32, -353, -353, - -353, 138, 239, 257, 166, -353, -353, -239, -353, -353, - -353, 146, -353, -353, -27, -353, -9, -74, -353, -353, - 309, -353, 250, -130, -353, 73, -244, 147, -140, -340, - -352, -322, 19, 9, 311, 225, 154, -353, -353, 76, - -353, -353, -353, -353, -353, -353, -353, 317, -353 + -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, + -351, -351, -351, 23, -351, -351, -351, -351, -105, -351, + -67, -66, -134, -65, -8, -10, -7, -6, -4, -3, + -351, -111, -148, -351, -149, -221, 6, 9, -351, -351, + -351, 88, 171, 165, 89, -351, -351, -247, -351, -351, + -351, 57, -351, -351, -40, -351, -9, -75, -351, -351, + 219, -351, 161, -127, -351, -16, -262, 58, -131, -299, + -350, -292, -70, -82, 220, 134, 64, -351, -351, -11, + -351, -351, -351, -351, -351, -351, -351, 224, -351 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1097,52 +1139,110 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -267 static const yytype_int16 yytable[] = { - 96, 108, 121, 247, 310, 249, 12, 13, 242, 298, - 236, -160, 328, 287, 288, 1, 254, 12, 13, 387, - 4, 83, 5, 222, 227, 223, 136, 7, 257, 258, - 226, 386, 128, 265, 122, 123, 124, 8, 33, 142, - 34, 84, 35, 224, 36, 37, 38, 112, 129, 33, - 408, 34, 391, 35, 11, 36, 37, 38, 252, 253, - 307, 300, 407, 391, 362, 316, 133, 104, 303, 119, - 411, 300, 407, 96, 130, 300, 311, 301, 308, 279, - 114, 317, 110, 328, 112, 134, 131, 324, 361, 326, - 132, 121, -36, 299, 83, 323, 365, 289, 290, 325, - 139, 236, 327, 259, 109, 260, 135, 300, 201, 111, - 333, 120, 227, 137, 84, 336, 303, 219, 226, 380, - 111, 376, 79, 122, 123, 124, 116, 117, 238, 139, - 337, 139, 239, 79, 396, 283, 284, 398, 138, 201, - 377, 143, 105, 106, 262, 403, 107, 330, 263, 230, - 357, 300, 358, 405, 371, 285, 286, 372, 300, -98, - 311, 300, 201, 399, 221, 410, 237, 300, 232, 300, - 75, 76, 77, 327, 261, 338, 339, 340, 226, 226, + 96, 108, 310, 247, 328, 249, 298, 121, 287, 288, + -160, 12, 13, 236, 307, 83, 254, 242, 84, 257, + 258, 387, 121, 300, 227, 136, 128, 1, 300, 4, + 226, 131, 308, 265, 112, 132, 5, 326, 142, 122, + 123, 124, 129, 33, 301, 34, 362, 35, 11, 36, + 37, 38, 408, 133, 122, 123, 124, 7, 252, 253, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 300, 112, 386, 96, 316, 328, 311, 303, 222, 279, + 223, 300, 391, 8, 376, 134, 361, 110, 83, 104, + 317, 84, 238, 391, 365, 323, 239, 324, 224, 325, + 139, 380, 327, 407, 236, 105, 106, 114, 201, 107, + 333, 411, 227, 407, 111, 336, 396, 219, 226, 398, + 299, -36, 289, 290, 259, 303, 260, 403, 79, 139, + 337, 139, 262, 330, 109, 405, 263, 300, 377, 201, + 371, 372, 399, 410, 300, 300, 300, 300, 116, 117, + 357, 120, 358, 345, 346, 347, 348, 75, 76, 77, + 311, 130, 201, 122, 123, 124, 280, 281, 282, 12, + 13, 283, 284, 327, 277, 338, 339, 340, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 226, 226, 226, 226, 291, 292, 227, 341, 342, 201, - 349, 350, 226, 243, 227, 345, 346, 347, 348, 240, - 226, 219, 122, 123, 124, 311, 343, 344, 383, 280, - 281, 282, 139, 241, 244, 245, 248, 250, 394, 251, - 311, 266, 293, 311, 201, 400, 294, 296, 295, 116, - 297, 311, 201, -35, 304, 313, 315, 201, 227, 311, - 319, -30, 363, 359, 226, 409, 364, 367, 373, 300, - 374, 375, -36, 379, 382, 385, 378, 402, 381, 404, - 395, 412, 351, 384, 352, 389, 12, 13, 14, 15, - 16, 17, 146, 147, 148, 397, 149, 150, 151, 152, + 226, 226, 226, 226, -98, 119, 227, 285, 286, 201, + 138, 33, 226, 34, 227, 35, 135, 36, 37, 38, + 226, 219, 291, 292, 137, 311, 341, 342, 383, 343, + 344, 143, 139, 221, 230, 232, 349, 350, 394, 243, + 311, 237, 240, 311, 201, 400, 241, 244, 245, 248, + 250, 311, 201, 251, 294, 261, 266, 201, 227, 311, + 293, 295, 296, 297, 226, 409, -35, 116, 304, 319, + 313, 363, 315, -30, 364, 359, 367, 373, 374, 300, + -36, 375, 111, 378, 379, 381, 382, 385, 395, 384, + 402, 404, 412, 335, 352, 351, 79, 171, 353, 389, + 354, 216, 220, 355, 397, 356, 318, 113, 406, 231, + 366, 320, 388, 401, 118, 256, 115, 321, 305, 306, + 0, 368, 0, 201, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 201, 0, 0, 201, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 201, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 201, 0, 0, 0, 0, 0, 0, + 0, 201, 0, 201, 12, 13, 14, 15, 16, 17, + 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, + 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, + 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 156, + 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, + 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 170, 171, 172, 12, 13, 14, 15, 16, + 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, + 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, + 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 156, 157, 158, 159, 160, 161, 162, 0, 0, 163, + 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, + 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, + 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, + 168, 169, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 170, 171, 255, 12, 13, 14, 15, + 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 171, - 34, 406, 35, 201, 36, 37, 38, 39, 40, 41, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, + 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 156, 157, 158, 159, 160, 161, 162, 305, 216, - 163, 164, 201, 353, 355, 201, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 201, 335, 356, 74, - 75, 76, 77, 78, 220, 318, 306, 113, 231, 366, - 320, 388, 79, 201, 401, 118, 256, 321, 368, 115, - 0, 201, 0, 201, 354, 0, 0, 0, 0, 0, + 72, 156, 157, 158, 159, 160, 161, 162, 0, 0, + 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, 0, - 277, 0, 0, 0, 170, 171, 172, 12, 13, 14, + 0, 0, 0, 0, 170, 171, 302, 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, @@ -1153,14 +1253,17 @@ static const yytype_int16 yytable[] = 71, 72, 156, 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 75, 76, 77, 78, 0, 0, 0, 0, 0, - 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, + 74, 75, 76, 77, 0, 78, 0, 0, 0, 0, + 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, + 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 170, 171, 255, 12, 13, + 0, 0, 0, 0, 0, 170, 171, 331, 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, @@ -1171,225 +1274,213 @@ static const yytype_int16 yytable[] = 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 78, 0, 0, 0, 0, - 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, + 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, - 81, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 170, 171, 302, 12, - 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, - 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 0, 34, 0, 35, 0, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 156, 157, 158, 159, 160, 161, - 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 170, 171, 12, 13, + 14, 15, 16, 17, 146, 147, 148, 0, 149, 390, + 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, + 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 74, 75, 76, 77, 78, 0, 0, 0, + 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, - 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 170, 171, 331, - 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, - 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, - 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 170, 117, 12, 13, + 14, 15, 16, 17, 146, 147, 148, 0, 149, 390, + 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, + 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 170, 171, - 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, - 149, 390, 151, 152, 153, 154, 155, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, - 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, + 0, 166, 167, 168, 169, 12, 13, 14, 15, 16, + 17, 0, 0, 0, 0, 0, 170, 171, 0, 0, + 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, + 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 0, 157, 158, 159, 160, 161, 162, 0, 0, 163, + 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, + 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, + 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 170, 117, - 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, - 149, 390, 151, 152, 153, 154, 155, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 76, 77, 78, 0, 0, - 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, + 168, 169, 12, 13, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 170, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 0, 34, 0, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, + 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 81, 0, 0, 0, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 12, 13, 14, - 15, 16, 17, 0, 0, 0, 0, 0, 170, 171, - 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, + 0, 0, 0, 0, 0, 111, 75, 76, 77, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, + 0, 0, 0, 0, 0, 166, 167, 168, 169, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, + -266, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 0, 157, 158, 159, 160, 161, 162, 0, - 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, + 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 75, 76, 77, 78, 0, 0, 0, 0, 0, - 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 80, 0, + 81, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 235, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 0, 157, + 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 314, 0, 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, - 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, - 166, 167, 168, 169, 12, 13, 14, 15, 16, 17, - 0, 0, 0, 0, 0, 170, 0, 0, 0, 0, - 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, - 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, - 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 111, 75, 76, - 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, - 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, - 169, 14, 15, 16, 17, 0, 0, 0, 0, 0, - 0, 0, -266, 0, 0, 0, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, + 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 246, 0, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 111, 75, 76, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 14, 15, 16, 17, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 235, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 14, 15, 16, 17, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 314, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 0, 157, 158, 159, 160, 161, - 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 165, 0, 0, 0, - 0, 0, 166, 167, 168, 169, 12, 13, 14, 15, - 16, 17, 0, 0, 0, 0, 0, 246, 0, 0, - 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, - 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 0, 157, 158, 159, 160, 161, 162, 0, 0, - 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, - 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 81, 14, - 15, 16, 17, 165, 0, 0, 0, 0, 0, 166, - 167, 168, 169, 0, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 0, 157, 158, 159, 160, 161, 162, 0, - 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, + 225, 0, 0, 166, 167, 168, 169, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, - 14, 15, 16, 17, 165, 0, 0, 225, 0, 0, - 166, 167, 168, 169, 0, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 0, 157, 158, 159, 160, 161, 162, - 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, + 309, 0, 0, 166, 167, 168, 169, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, - 81, 14, 15, 16, 17, 165, 0, 0, 309, 0, - 0, 166, 167, 168, 169, 0, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 0, 157, 158, 159, 160, 161, - 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 14, 15, 16, 17, 165, 0, 0, 360, - 0, 0, 166, 167, 168, 169, 0, 18, 19, 20, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, + 360, 0, 0, 166, 167, 168, 169, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -1403,34 +1494,38 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 81, 14, 15, 16, 17, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 0, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 264, 0, 157, 158, 159, - 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 264, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 165, 0, - 0, 0, 0, 0, 166, 167, 168, 169, -3, 0, - 0, 12, 13, 14, 15, 16, 17, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 0, 34, 0, 35, 0, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 75, 76, 77, 78, 0, + 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, + 12, 13, 14, 15, 16, 17, 0, 165, 0, 0, + 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, @@ -1442,30 +1537,19 @@ static const yytype_int16 yytable[] = 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 78, 0, 0, 0, 0, - 0, 0, 0, 0, 79, 14, 15, 16, 17, 0, + 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 79, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 0, 80, 0, - 81, 0, 0, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 0, 334, - 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, - 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, - 0, 0, 0, 80, 0, 81, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 0, 0, 0, 80, + 0, 81, 0, 0, 0, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, + 334, 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, - 76, 77, 0, 0, 0, 0, 0, 0, 0, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 77, 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, @@ -1474,63 +1558,133 @@ static const yytype_int16 yytable[] = 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 0, 0, 0, 0, 0, 0, 80, 0, + 81, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 81 }; static const yytype_int16 yycheck[] = { - 9, 79, 4, 152, 223, 154, 3, 4, 148, 94, - 140, 79, 251, 89, 90, 111, 165, 3, 4, 371, - 81, 9, 0, 160, 135, 162, 100, 116, 87, 88, - 135, 371, 165, 181, 36, 37, 38, 112, 35, 113, - 37, 9, 39, 180, 41, 42, 43, 74, 181, 35, - 402, 37, 374, 39, 79, 41, 42, 43, 163, 164, - 162, 165, 402, 385, 308, 165, 93, 115, 208, 161, - 410, 165, 412, 82, 79, 165, 224, 181, 180, 184, - 160, 181, 79, 322, 111, 94, 36, 181, 307, 179, - 40, 4, 160, 178, 82, 244, 315, 173, 174, 248, - 109, 231, 251, 162, 182, 164, 162, 165, 117, 106, - 259, 165, 223, 79, 82, 263, 256, 126, 223, 363, - 106, 179, 119, 36, 37, 38, 181, 182, 161, 138, - 278, 140, 165, 119, 378, 166, 167, 381, 182, 148, - 359, 79, 36, 37, 161, 389, 40, 161, 165, 116, - 299, 165, 300, 397, 161, 85, 86, 161, 165, 161, - 308, 165, 171, 161, 79, 161, 181, 165, 79, 165, - 107, 108, 109, 322, 161, 280, 281, 282, 283, 284, + 9, 79, 223, 152, 251, 154, 94, 4, 89, 90, + 79, 3, 4, 140, 192, 9, 165, 148, 9, 87, + 88, 371, 4, 195, 135, 100, 195, 112, 195, 81, + 135, 36, 210, 181, 74, 40, 0, 209, 113, 36, + 37, 38, 211, 35, 211, 37, 308, 39, 79, 41, + 42, 43, 402, 93, 36, 37, 38, 117, 163, 164, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 195, 111, 371, 82, 195, 322, 224, 208, 190, 184, + 192, 195, 374, 113, 209, 94, 307, 79, 82, 116, + 211, 82, 191, 385, 315, 244, 195, 211, 210, 248, + 109, 363, 251, 402, 231, 36, 37, 190, 117, 40, + 259, 410, 223, 412, 106, 263, 378, 126, 223, 381, + 208, 190, 203, 204, 192, 256, 194, 389, 120, 138, + 278, 140, 191, 191, 212, 397, 195, 195, 359, 148, + 191, 191, 191, 191, 195, 195, 195, 195, 211, 212, + 299, 195, 300, 287, 288, 289, 290, 107, 108, 109, + 308, 79, 171, 36, 37, 38, 200, 201, 202, 3, + 4, 196, 197, 322, 210, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 91, 92, 307, 283, 284, 208, - 291, 292, 307, 160, 315, 287, 288, 289, 290, 181, - 315, 220, 36, 37, 38, 363, 285, 286, 367, 170, - 171, 172, 231, 181, 160, 181, 160, 179, 376, 160, - 378, 160, 175, 381, 243, 384, 176, 93, 177, 181, - 95, 389, 251, 160, 79, 163, 162, 256, 359, 397, - 78, 161, 180, 162, 359, 404, 163, 160, 79, 165, - 161, 163, 160, 163, 163, 161, 180, 12, 180, 160, - 163, 12, 293, 181, 294, 180, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 180, 13, 14, 15, 16, + 295, 296, 297, 298, 191, 191, 307, 85, 86, 208, + 212, 35, 307, 37, 315, 39, 192, 41, 42, 43, + 315, 220, 91, 92, 79, 363, 283, 284, 367, 285, + 286, 79, 231, 79, 117, 79, 291, 292, 376, 190, + 378, 211, 211, 381, 243, 384, 211, 190, 211, 190, + 209, 389, 251, 190, 206, 191, 190, 256, 359, 397, + 205, 207, 93, 95, 359, 404, 190, 211, 79, 78, + 193, 210, 192, 191, 193, 192, 190, 79, 191, 195, + 190, 193, 106, 210, 193, 210, 193, 191, 193, 211, + 12, 190, 12, 260, 294, 293, 120, 212, 295, 210, + 296, 120, 127, 297, 210, 298, 239, 78, 211, 138, + 316, 243, 372, 385, 84, 171, 82, 243, 220, 220, + -1, 322, -1, 322, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 371, -1, -1, 374, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 385, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 402, -1, -1, -1, -1, -1, -1, + -1, 410, -1, 412, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 190, -1, -1, -1, -1, -1, 196, 197, 198, + 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 211, 212, 213, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, + -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, + 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, + 108, 109, -1, 111, -1, -1, -1, -1, -1, -1, + -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 190, -1, -1, -1, -1, -1, 196, 197, + 198, 199, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 211, 212, 213, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 182, - 37, 181, 39, 322, 41, 42, 43, 44, 45, 46, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, + 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 220, 120, - 87, 88, 371, 295, 297, 374, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 385, 260, 298, 106, - 107, 108, 109, 110, 127, 239, 220, 78, 138, 316, - 243, 372, 119, 402, 385, 84, 171, 243, 322, 82, - -1, 410, -1, 412, 296, -1, -1, -1, -1, -1, + 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, + 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, + 107, 108, 109, -1, 111, -1, -1, -1, -1, -1, + -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 153, -1, 155, -1, - -1, -1, -1, 160, -1, -1, -1, -1, -1, 166, - 167, 168, 169, -1, -1, -1, -1, -1, -1, -1, - 180, -1, -1, -1, 181, 182, 183, 3, 4, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 190, -1, -1, -1, -1, -1, 196, + 197, 198, 199, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 211, 212, 213, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, @@ -1541,14 +1695,17 @@ static const yytype_int16 yycheck[] = 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 106, 107, 108, 109, 110, -1, -1, -1, -1, -1, - -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, + 106, 107, 108, 109, -1, 111, -1, -1, -1, -1, + -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, + 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, - -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, - 166, 167, 168, 169, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 181, 182, 183, 3, 4, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 190, -1, -1, -1, -1, -1, + 196, 197, 198, 199, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 211, 212, 213, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, @@ -1559,225 +1716,213 @@ static const yytype_int16 yycheck[] = 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, - -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, + -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, - 155, -1, -1, -1, -1, 160, -1, -1, -1, -1, - -1, 166, 167, 168, 169, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 181, 182, 183, 3, - 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, -1, 37, -1, 39, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 106, 107, 108, 109, 110, -1, -1, -1, - -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, + -1, 196, 197, 198, 199, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 211, 212, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, - -1, 155, -1, -1, -1, -1, 160, -1, -1, -1, - -1, -1, 166, 167, 168, 169, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 181, 182, 183, - 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, - -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, - -1, -1, -1, 166, 167, 168, 169, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 181, 182, - 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, + -1, 196, 197, 198, 199, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 211, 212, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, - -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, + -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, - -1, -1, -1, 166, 167, 168, 169, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 181, 182, - 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, 110, -1, -1, - -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, + -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, + -1, 196, 197, 198, 199, 3, 4, 5, 6, 7, + 8, -1, -1, -1, -1, -1, 211, 212, -1, -1, + -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, + -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, + 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, + 108, 109, -1, 111, -1, -1, -1, -1, -1, -1, + -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 153, -1, 155, -1, -1, -1, -1, 160, -1, -1, - -1, -1, -1, 166, 167, 168, 169, 3, 4, 5, - 6, 7, 8, -1, -1, -1, -1, -1, 181, 182, - -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 190, -1, -1, -1, -1, -1, 196, 197, + 198, 199, 3, 4, 5, 6, 7, 8, -1, -1, + -1, -1, -1, 211, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, + 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 190, + -1, -1, -1, -1, -1, 196, 197, 198, 199, 5, + 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, + 211, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, - -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, + 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 106, 107, 108, 109, 110, -1, -1, -1, -1, -1, - -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, 154, -1, + 156, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, - -1, -1, -1, -1, 160, -1, -1, -1, -1, -1, - 166, 167, 168, 169, 3, 4, 5, 6, 7, 8, - -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, + -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + -1, 154, -1, 156, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, + 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 213, -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 153, -1, 155, -1, -1, -1, - -1, 160, -1, -1, -1, -1, -1, 166, 167, 168, - 169, 5, 6, 7, 8, -1, -1, -1, -1, -1, - -1, -1, 181, -1, -1, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, + -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 5, 6, 7, 8, -1, -1, -1, -1, 153, - -1, 155, -1, -1, -1, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, 183, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, + 190, -1, -1, -1, -1, -1, 196, 197, 198, 199, + 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, + -1, 211, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 5, 6, 7, 8, -1, -1, -1, -1, 153, - -1, 155, -1, -1, -1, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, 183, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, - 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, + -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, - -1, 155, -1, -1, -1, -1, 160, -1, -1, -1, - -1, -1, 166, 167, 168, 169, 3, 4, 5, 6, - 7, 8, -1, -1, -1, -1, -1, 181, -1, -1, - -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 153, -1, 155, 5, - 6, 7, 8, 160, -1, -1, -1, -1, -1, 166, - 167, 168, 169, -1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, - -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, + 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 153, -1, 155, - 5, 6, 7, 8, 160, -1, -1, 163, -1, -1, - 166, 167, 168, 169, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, - -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, + 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, - 155, 5, 6, 7, 8, 160, -1, -1, 163, -1, - -1, 166, 167, 168, 169, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, - 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, - -1, 155, 5, 6, 7, 8, 160, -1, -1, 163, - -1, -1, 166, 167, 168, 169, -1, 20, 21, 22, + -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, + 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, @@ -1791,132 +1936,137 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 153, -1, 155, 5, 6, 7, 8, 160, -1, -1, - -1, -1, -1, 166, 167, 168, 169, -1, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, - 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, + -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 153, -1, 155, -1, -1, -1, -1, 160, -1, - -1, -1, -1, -1, 166, 167, 168, 169, 0, -1, - -1, 3, 4, 5, 6, 7, 8, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, -1, 37, -1, 39, -1, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 106, 107, 108, 109, 110, -1, - -1, -1, -1, -1, -1, -1, -1, 119, 3, 4, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, + 3, 4, 5, 6, 7, 8, -1, 190, -1, -1, + -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, -1, 111, -1, + -1, -1, -1, -1, -1, -1, -1, 120, 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 153, 37, 155, 39, -1, 41, 42, 43, 44, + 35, 154, 37, 156, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, 110, -1, -1, -1, -1, - -1, -1, -1, -1, 119, 5, 6, 7, 8, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, 153, -1, - 155, -1, -1, -1, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, - -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, + -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, + -1, -1, -1, -1, -1, 120, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, - 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, - -1, -1, -1, 153, -1, 155, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, -1, -1, 154, + -1, 156, -1, -1, -1, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, + 79, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, - 108, 109, -1, -1, -1, -1, -1, -1, -1, 5, + -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, + 109, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - -1, -1, -1, -1, -1, 153, -1, 155, 44, 45, + -1, -1, -1, -1, -1, 154, -1, 156, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, -1, -1, -1, -1, -1, -1, 154, -1, + 156, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 153, -1, 155 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 111, 185, 187, 81, 0, 188, 116, 112, 186, - 189, 79, 3, 4, 5, 6, 7, 8, 20, 21, + 0, 112, 215, 217, 81, 0, 218, 117, 113, 216, + 219, 79, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 79, 106, 107, 108, 109, 110, 119, - 153, 155, 190, 220, 221, 222, 223, 224, 229, 230, - 231, 232, 233, 236, 238, 239, 240, 241, 242, 243, - 244, 245, 271, 272, 115, 36, 37, 40, 79, 182, - 79, 106, 238, 244, 160, 271, 181, 182, 258, 161, - 165, 4, 36, 37, 38, 226, 227, 237, 165, 181, - 79, 36, 40, 238, 240, 162, 241, 79, 182, 240, - 246, 247, 241, 79, 234, 235, 9, 10, 11, 13, + 75, 76, 77, 79, 106, 107, 108, 109, 111, 120, + 154, 156, 220, 250, 251, 252, 253, 254, 259, 260, + 261, 262, 263, 266, 268, 269, 270, 271, 272, 273, + 274, 275, 301, 302, 116, 36, 37, 40, 79, 212, + 79, 106, 268, 274, 190, 301, 211, 212, 288, 191, + 195, 4, 36, 37, 38, 256, 257, 267, 195, 211, + 79, 36, 40, 268, 270, 192, 271, 79, 212, 270, + 276, 277, 271, 79, 264, 265, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 78, 79, 80, 81, - 82, 83, 84, 87, 88, 160, 166, 167, 168, 169, - 181, 182, 183, 191, 192, 193, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 218, 220, - 221, 240, 251, 252, 253, 254, 255, 256, 259, 260, - 261, 262, 264, 265, 266, 270, 226, 225, 228, 240, - 227, 79, 160, 162, 180, 163, 202, 215, 219, 240, - 116, 246, 79, 248, 249, 183, 247, 181, 161, 165, - 181, 181, 252, 160, 160, 181, 181, 218, 160, 218, - 179, 160, 202, 202, 218, 183, 259, 87, 88, 162, - 164, 161, 161, 165, 77, 216, 160, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 180, 217, 202, - 170, 171, 172, 166, 167, 85, 86, 89, 90, 173, - 174, 91, 92, 175, 176, 177, 93, 95, 94, 178, - 165, 181, 183, 252, 79, 225, 228, 162, 180, 163, - 219, 216, 250, 163, 183, 162, 165, 181, 235, 78, - 251, 260, 267, 218, 181, 218, 179, 218, 231, 263, - 161, 183, 194, 218, 79, 197, 216, 216, 202, 202, - 202, 204, 204, 205, 205, 206, 206, 206, 206, 207, - 207, 208, 209, 210, 211, 212, 213, 218, 216, 162, - 163, 219, 250, 180, 163, 219, 249, 160, 263, 268, - 269, 161, 161, 79, 161, 163, 179, 219, 180, 163, - 250, 180, 163, 218, 181, 161, 253, 254, 256, 180, - 14, 255, 257, 258, 216, 163, 250, 180, 250, 161, - 218, 257, 12, 250, 160, 250, 181, 253, 254, 218, - 161, 253, 12 + 82, 83, 84, 87, 88, 190, 196, 197, 198, 199, + 211, 212, 213, 221, 222, 223, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 248, 250, + 251, 270, 281, 282, 283, 284, 285, 286, 289, 290, + 291, 292, 294, 295, 296, 300, 256, 255, 258, 270, + 257, 79, 190, 192, 210, 193, 232, 245, 249, 270, + 117, 276, 79, 278, 279, 213, 277, 211, 191, 195, + 211, 211, 282, 190, 190, 211, 211, 248, 190, 248, + 209, 190, 232, 232, 248, 213, 289, 87, 88, 192, + 194, 191, 191, 195, 77, 246, 190, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 210, 247, 232, + 200, 201, 202, 196, 197, 85, 86, 89, 90, 203, + 204, 91, 92, 205, 206, 207, 93, 95, 94, 208, + 195, 211, 213, 282, 79, 255, 258, 192, 210, 193, + 249, 246, 280, 193, 213, 192, 195, 211, 265, 78, + 281, 290, 297, 248, 211, 248, 209, 248, 261, 293, + 191, 213, 224, 248, 79, 227, 246, 246, 232, 232, + 232, 234, 234, 235, 235, 236, 236, 236, 236, 237, + 237, 238, 239, 240, 241, 242, 243, 248, 246, 192, + 193, 249, 280, 210, 193, 249, 279, 190, 293, 298, + 299, 191, 191, 79, 191, 193, 209, 249, 210, 193, + 280, 210, 193, 248, 211, 191, 283, 284, 286, 210, + 14, 285, 287, 288, 246, 193, 280, 210, 280, 191, + 248, 287, 12, 280, 190, 280, 211, 283, 284, 248, + 191, 283, 12 }; #define yyerrok (yyerrstatus = 0) @@ -1931,9 +2081,18 @@ static const yytype_uint16 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -1990,7 +2149,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2579,7 +2738,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -2769,8 +2928,8 @@ yyreduce: { case 2: -/* Line 1455 of yacc.c */ -#line 193 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 200 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2778,8 +2937,8 @@ yyreduce: case 4: -/* Line 1455 of yacc.c */ -#line 201 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 208 "glsl_parser.ypp" { state->language_version = 110; ;} @@ -2787,8 +2946,8 @@ yyreduce: case 5: -/* Line 1455 of yacc.c */ -#line 205 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 212 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2807,8 +2966,8 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ -#line 228 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 235 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2818,8 +2977,8 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ -#line 237 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 244 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2831,8 +2990,8 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ -#line 245 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 252 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2844,8 +3003,8 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ -#line 260 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 267 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -2856,8 +3015,8 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ -#line 267 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 274 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -2868,8 +3027,8 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ -#line 274 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 281 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -2880,8 +3039,8 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ -#line 281 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 288 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -2892,8 +3051,8 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ -#line 288 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 295 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -2904,8 +3063,8 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ -#line 295 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 302 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -2913,8 +3072,8 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ -#line 303 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 310 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -2924,8 +3083,8 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ -#line 309 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 316 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -2933,8 +3092,8 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ -#line 313 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 320 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -2945,8 +3104,8 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ -#line 320 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 327 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -2956,8 +3115,8 @@ yyreduce: case 23: -/* Line 1455 of yacc.c */ -#line 326 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 333 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -2967,8 +3126,8 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ -#line 344 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 351 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -2978,8 +3137,8 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ -#line 363 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 370 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -2989,8 +3148,8 @@ yyreduce: case 33: -/* Line 1455 of yacc.c */ -#line 369 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 376 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3000,8 +3159,8 @@ yyreduce: case 35: -/* Line 1455 of yacc.c */ -#line 385 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 392 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3011,8 +3170,8 @@ yyreduce: case 36: -/* Line 1455 of yacc.c */ -#line 391 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 398 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3023,8 +3182,8 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ -#line 398 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 405 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3035,8 +3194,8 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ -#line 410 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 417 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3046,8 +3205,8 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ -#line 416 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 423 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3057,8 +3216,8 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ -#line 422 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 429 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3068,36 +3227,36 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ -#line 431 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 438 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: -/* Line 1455 of yacc.c */ -#line 432 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 439 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: -/* Line 1455 of yacc.c */ -#line 433 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 440 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: -/* Line 1455 of yacc.c */ -#line 434 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 441 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: -/* Line 1455 of yacc.c */ -#line 440 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 447 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3107,8 +3266,8 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ -#line 446 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 453 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3118,8 +3277,8 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ -#line 452 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 459 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3129,8 +3288,8 @@ yyreduce: case 51: -/* Line 1455 of yacc.c */ -#line 462 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 469 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3140,8 +3299,8 @@ yyreduce: case 52: -/* Line 1455 of yacc.c */ -#line 468 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 475 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3151,8 +3310,8 @@ yyreduce: case 54: -/* Line 1455 of yacc.c */ -#line 478 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 485 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3162,8 +3321,8 @@ yyreduce: case 55: -/* Line 1455 of yacc.c */ -#line 484 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 491 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3173,8 +3332,8 @@ yyreduce: case 57: -/* Line 1455 of yacc.c */ -#line 494 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 501 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3184,8 +3343,8 @@ yyreduce: case 58: -/* Line 1455 of yacc.c */ -#line 500 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 507 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3195,8 +3354,8 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ -#line 506 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 513 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3206,8 +3365,8 @@ yyreduce: case 60: -/* Line 1455 of yacc.c */ -#line 512 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 519 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3217,8 +3376,8 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ -#line 522 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 529 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3228,8 +3387,8 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ -#line 528 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 535 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3239,8 +3398,8 @@ yyreduce: case 65: -/* Line 1455 of yacc.c */ -#line 538 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 545 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3250,8 +3409,8 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ -#line 548 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 555 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3261,8 +3420,8 @@ yyreduce: case 69: -/* Line 1455 of yacc.c */ -#line 558 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 565 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3272,8 +3431,8 @@ yyreduce: case 71: -/* Line 1455 of yacc.c */ -#line 568 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 575 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3283,8 +3442,8 @@ yyreduce: case 73: -/* Line 1455 of yacc.c */ -#line 578 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 585 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3294,8 +3453,8 @@ yyreduce: case 75: -/* Line 1455 of yacc.c */ -#line 588 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 595 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3305,8 +3464,8 @@ yyreduce: case 77: -/* Line 1455 of yacc.c */ -#line 598 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 605 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3316,8 +3475,8 @@ yyreduce: case 79: -/* Line 1455 of yacc.c */ -#line 608 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 615 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3327,85 +3486,85 @@ yyreduce: case 80: -/* Line 1455 of yacc.c */ -#line 616 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 623 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: -/* Line 1455 of yacc.c */ -#line 617 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 624 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: -/* Line 1455 of yacc.c */ -#line 618 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 625 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: -/* Line 1455 of yacc.c */ -#line 619 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 626 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: -/* Line 1455 of yacc.c */ -#line 620 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 627 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: -/* Line 1455 of yacc.c */ -#line 621 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 628 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: -/* Line 1455 of yacc.c */ -#line 622 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 629 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: -/* Line 1455 of yacc.c */ -#line 623 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 630 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: -/* Line 1455 of yacc.c */ -#line 624 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 631 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: -/* Line 1455 of yacc.c */ -#line 625 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 632 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: -/* Line 1455 of yacc.c */ -#line 626 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 633 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: -/* Line 1455 of yacc.c */ -#line 631 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 638 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3413,8 +3572,8 @@ yyreduce: case 92: -/* Line 1455 of yacc.c */ -#line 635 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 642 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3431,8 +3590,8 @@ yyreduce: case 94: -/* Line 1455 of yacc.c */ -#line 655 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 662 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3440,8 +3599,8 @@ yyreduce: case 95: -/* Line 1455 of yacc.c */ -#line 659 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 666 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3449,8 +3608,8 @@ yyreduce: case 96: -/* Line 1455 of yacc.c */ -#line 663 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 670 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3465,8 +3624,8 @@ yyreduce: case 100: -/* Line 1455 of yacc.c */ -#line 686 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 693 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3475,8 +3634,8 @@ yyreduce: case 101: -/* Line 1455 of yacc.c */ -#line 691 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 698 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3485,8 +3644,8 @@ yyreduce: case 102: -/* Line 1455 of yacc.c */ -#line 699 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 706 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3498,8 +3657,8 @@ yyreduce: case 103: -/* Line 1455 of yacc.c */ -#line 710 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 717 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3513,8 +3672,8 @@ yyreduce: case 104: -/* Line 1455 of yacc.c */ -#line 720 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 727 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3530,8 +3689,8 @@ yyreduce: case 105: -/* Line 1455 of yacc.c */ -#line 735 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 742 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3542,8 +3701,8 @@ yyreduce: case 106: -/* Line 1455 of yacc.c */ -#line 742 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 749 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3552,8 +3711,8 @@ yyreduce: case 107: -/* Line 1455 of yacc.c */ -#line 747 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 754 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3568,8 +3727,8 @@ yyreduce: case 108: -/* Line 1455 of yacc.c */ -#line 758 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 765 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3582,36 +3741,36 @@ yyreduce: case 109: -/* Line 1455 of yacc.c */ -#line 769 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 776 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: -/* Line 1455 of yacc.c */ -#line 770 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 777 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: -/* Line 1455 of yacc.c */ -#line 771 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 778 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: -/* Line 1455 of yacc.c */ -#line 772 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 779 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 115: -/* Line 1455 of yacc.c */ -#line 782 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 789 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3624,8 +3783,8 @@ yyreduce: case 116: -/* Line 1455 of yacc.c */ -#line 791 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 798 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3638,8 +3797,8 @@ yyreduce: case 117: -/* Line 1455 of yacc.c */ -#line 800 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 807 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3652,8 +3811,8 @@ yyreduce: case 118: -/* Line 1455 of yacc.c */ -#line 809 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 816 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3666,8 +3825,8 @@ yyreduce: case 119: -/* Line 1455 of yacc.c */ -#line 818 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 825 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3680,8 +3839,8 @@ yyreduce: case 120: -/* Line 1455 of yacc.c */ -#line 827 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 834 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3694,8 +3853,8 @@ yyreduce: case 121: -/* Line 1455 of yacc.c */ -#line 840 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 847 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3710,8 +3869,8 @@ yyreduce: case 122: -/* Line 1455 of yacc.c */ -#line 851 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 858 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3724,8 +3883,8 @@ yyreduce: case 123: -/* Line 1455 of yacc.c */ -#line 860 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 867 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3738,8 +3897,8 @@ yyreduce: case 124: -/* Line 1455 of yacc.c */ -#line 869 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 876 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3752,8 +3911,8 @@ yyreduce: case 125: -/* Line 1455 of yacc.c */ -#line 878 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 885 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3766,8 +3925,8 @@ yyreduce: case 126: -/* Line 1455 of yacc.c */ -#line 887 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 894 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3780,8 +3939,8 @@ yyreduce: case 127: -/* Line 1455 of yacc.c */ -#line 896 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 903 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3794,8 +3953,8 @@ yyreduce: case 128: -/* Line 1455 of yacc.c */ -#line 905 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 912 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3810,8 +3969,8 @@ yyreduce: case 129: -/* Line 1455 of yacc.c */ -#line 919 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 926 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3822,8 +3981,8 @@ yyreduce: case 130: -/* Line 1455 of yacc.c */ -#line 926 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 933 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3835,15 +3994,15 @@ yyreduce: case 131: -/* Line 1455 of yacc.c */ -#line 936 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 943 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 133: -/* Line 1455 of yacc.c */ -#line 942 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 949 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -3851,8 +4010,8 @@ yyreduce: case 135: -/* Line 1455 of yacc.c */ -#line 950 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 957 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} @@ -3860,8 +4019,8 @@ yyreduce: case 136: -/* Line 1455 of yacc.c */ -#line 957 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 964 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -3896,36 +4055,36 @@ yyreduce: case 137: -/* Line 1455 of yacc.c */ -#line 990 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 997 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; case 138: -/* Line 1455 of yacc.c */ -#line 991 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 998 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; case 139: -/* Line 1455 of yacc.c */ -#line 992 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 999 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; case 140: -/* Line 1455 of yacc.c */ -#line 996 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1003 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 142: -/* Line 1455 of yacc.c */ -#line 1002 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1009 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} @@ -3933,8 +4092,8 @@ yyreduce: case 143: -/* Line 1455 of yacc.c */ -#line 1006 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1013 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; @@ -3943,71 +4102,71 @@ yyreduce: case 144: -/* Line 1455 of yacc.c */ -#line 1013 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1020 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 145: -/* Line 1455 of yacc.c */ -#line 1014 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1021 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; case 146: -/* Line 1455 of yacc.c */ -#line 1015 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1022 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; case 147: -/* Line 1455 of yacc.c */ -#line 1016 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1023 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; case 148: -/* Line 1455 of yacc.c */ -#line 1017 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1024 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 149: -/* Line 1455 of yacc.c */ -#line 1018 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1025 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 150: -/* Line 1455 of yacc.c */ -#line 1019 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1026 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; case 151: -/* Line 1455 of yacc.c */ -#line 1020 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1027 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 152: -/* Line 1455 of yacc.c */ -#line 1021 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1028 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; case 154: -/* Line 1455 of yacc.c */ -#line 1027 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1034 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4016,8 +4175,8 @@ yyreduce: case 156: -/* Line 1455 of yacc.c */ -#line 1036 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1043 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4027,8 +4186,8 @@ yyreduce: case 157: -/* Line 1455 of yacc.c */ -#line 1042 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1049 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4038,8 +4197,8 @@ yyreduce: case 158: -/* Line 1455 of yacc.c */ -#line 1051 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1058 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4049,8 +4208,8 @@ yyreduce: case 159: -/* Line 1455 of yacc.c */ -#line 1057 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1064 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4060,8 +4219,8 @@ yyreduce: case 160: -/* Line 1455 of yacc.c */ -#line 1063 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1070 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4071,386 +4230,386 @@ yyreduce: case 161: -/* Line 1455 of yacc.c */ -#line 1071 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1078 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 162: -/* Line 1455 of yacc.c */ -#line 1072 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1079 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 163: -/* Line 1455 of yacc.c */ -#line 1073 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1080 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 164: -/* Line 1455 of yacc.c */ -#line 1074 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1081 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 165: -/* Line 1455 of yacc.c */ -#line 1075 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1082 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 166: -/* Line 1455 of yacc.c */ -#line 1076 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1083 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 167: -/* Line 1455 of yacc.c */ -#line 1077 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1084 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 168: -/* Line 1455 of yacc.c */ -#line 1078 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1085 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 169: -/* Line 1455 of yacc.c */ -#line 1079 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1086 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 170: -/* Line 1455 of yacc.c */ -#line 1080 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1087 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 171: -/* Line 1455 of yacc.c */ -#line 1081 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1088 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 172: -/* Line 1455 of yacc.c */ -#line 1082 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 173: -/* Line 1455 of yacc.c */ -#line 1083 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 174: -/* Line 1455 of yacc.c */ -#line 1084 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 175: -/* Line 1455 of yacc.c */ -#line 1085 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 176: -/* Line 1455 of yacc.c */ -#line 1086 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 177: -/* Line 1455 of yacc.c */ -#line 1087 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 178: -/* Line 1455 of yacc.c */ -#line 1088 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 179: -/* Line 1455 of yacc.c */ -#line 1089 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 180: -/* Line 1455 of yacc.c */ -#line 1090 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 181: -/* Line 1455 of yacc.c */ -#line 1091 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 182: -/* Line 1455 of yacc.c */ -#line 1092 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 183: -/* Line 1455 of yacc.c */ -#line 1093 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 184: -/* Line 1455 of yacc.c */ -#line 1094 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 185: -/* Line 1455 of yacc.c */ -#line 1095 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 186: -/* Line 1455 of yacc.c */ -#line 1096 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 187: -/* Line 1455 of yacc.c */ -#line 1097 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 188: -/* Line 1455 of yacc.c */ -#line 1098 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 189: -/* Line 1455 of yacc.c */ -#line 1099 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 190: -/* Line 1455 of yacc.c */ -#line 1100 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 191: -/* Line 1455 of yacc.c */ -#line 1101 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 192: -/* Line 1455 of yacc.c */ -#line 1102 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 193: -/* Line 1455 of yacc.c */ -#line 1103 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 194: -/* Line 1455 of yacc.c */ -#line 1104 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 195: -/* Line 1455 of yacc.c */ -#line 1105 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 196: -/* Line 1455 of yacc.c */ -#line 1106 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 197: -/* Line 1455 of yacc.c */ -#line 1107 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 198: -/* Line 1455 of yacc.c */ -#line 1108 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 199: -/* Line 1455 of yacc.c */ -#line 1109 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 200: -/* Line 1455 of yacc.c */ -#line 1110 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 201: -/* Line 1455 of yacc.c */ -#line 1111 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 202: -/* Line 1455 of yacc.c */ -#line 1112 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 203: -/* Line 1455 of yacc.c */ -#line 1113 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 204: -/* Line 1455 of yacc.c */ -#line 1114 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 205: -/* Line 1455 of yacc.c */ -#line 1115 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 206: -/* Line 1455 of yacc.c */ -#line 1116 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 207: -/* Line 1455 of yacc.c */ -#line 1117 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 208: -/* Line 1455 of yacc.c */ -#line 1118 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 209: -/* Line 1455 of yacc.c */ -#line 1119 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 210: -/* Line 1455 of yacc.c */ -#line 1120 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 211: -/* Line 1455 of yacc.c */ -#line 1121 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 212: -/* Line 1455 of yacc.c */ -#line 1122 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 213: -/* Line 1455 of yacc.c */ -#line 1123 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 214: -/* Line 1455 of yacc.c */ -#line 1124 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 215: -/* Line 1455 of yacc.c */ -#line 1128 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1135 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4466,8 +4625,8 @@ yyreduce: case 216: -/* Line 1455 of yacc.c */ -#line 1139 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1146 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4483,8 +4642,8 @@ yyreduce: case 217: -/* Line 1455 of yacc.c */ -#line 1150 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1157 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4500,8 +4659,8 @@ yyreduce: case 218: -/* Line 1455 of yacc.c */ -#line 1165 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1172 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4511,8 +4670,8 @@ yyreduce: case 219: -/* Line 1455 of yacc.c */ -#line 1171 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1178 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4522,8 +4681,8 @@ yyreduce: case 220: -/* Line 1455 of yacc.c */ -#line 1180 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1187 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4532,8 +4691,8 @@ yyreduce: case 221: -/* Line 1455 of yacc.c */ -#line 1185 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1192 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4542,8 +4701,8 @@ yyreduce: case 222: -/* Line 1455 of yacc.c */ -#line 1193 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1200 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4559,8 +4718,8 @@ yyreduce: case 223: -/* Line 1455 of yacc.c */ -#line 1208 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1215 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4569,8 +4728,8 @@ yyreduce: case 224: -/* Line 1455 of yacc.c */ -#line 1213 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1220 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4579,8 +4738,8 @@ yyreduce: case 225: -/* Line 1455 of yacc.c */ -#line 1221 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1228 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4590,8 +4749,8 @@ yyreduce: case 226: -/* Line 1455 of yacc.c */ -#line 1227 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1234 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4601,29 +4760,29 @@ yyreduce: case 231: -/* Line 1455 of yacc.c */ -#line 1250 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1257 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 237: -/* Line 1455 of yacc.c */ -#line 1262 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1269 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 238: -/* Line 1455 of yacc.c */ -#line 1263 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1270 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 241: -/* Line 1455 of yacc.c */ -#line 1270 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1277 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4633,8 +4792,8 @@ yyreduce: case 242: -/* Line 1455 of yacc.c */ -#line 1276 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1283 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4644,15 +4803,15 @@ yyreduce: case 243: -/* Line 1455 of yacc.c */ -#line 1284 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1291 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 245: -/* Line 1455 of yacc.c */ -#line 1290 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1297 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4662,8 +4821,8 @@ yyreduce: case 246: -/* Line 1455 of yacc.c */ -#line 1296 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1303 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4673,8 +4832,8 @@ yyreduce: case 247: -/* Line 1455 of yacc.c */ -#line 1305 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1312 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4688,8 +4847,8 @@ yyreduce: case 248: -/* Line 1455 of yacc.c */ -#line 1315 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1322 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4702,8 +4861,8 @@ yyreduce: case 249: -/* Line 1455 of yacc.c */ -#line 1327 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1334 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4713,8 +4872,8 @@ yyreduce: case 250: -/* Line 1455 of yacc.c */ -#line 1333 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1340 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4724,8 +4883,8 @@ yyreduce: case 251: -/* Line 1455 of yacc.c */ -#line 1342 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1349 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4735,8 +4894,8 @@ yyreduce: case 252: -/* Line 1455 of yacc.c */ -#line 1351 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1358 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4746,8 +4905,8 @@ yyreduce: case 253: -/* Line 1455 of yacc.c */ -#line 1357 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1364 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4757,8 +4916,8 @@ yyreduce: case 254: -/* Line 1455 of yacc.c */ -#line 1363 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1370 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4768,8 +4927,8 @@ yyreduce: case 255: -/* Line 1455 of yacc.c */ -#line 1372 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1379 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4777,8 +4936,8 @@ yyreduce: case 256: -/* Line 1455 of yacc.c */ -#line 1376 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1383 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4793,8 +4952,8 @@ yyreduce: case 260: -/* Line 1455 of yacc.c */ -#line 1399 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1406 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4805,8 +4964,8 @@ yyreduce: case 261: -/* Line 1455 of yacc.c */ -#line 1406 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1413 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4817,8 +4976,8 @@ yyreduce: case 262: -/* Line 1455 of yacc.c */ -#line 1413 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1420 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4829,8 +4988,8 @@ yyreduce: case 266: -/* Line 1455 of yacc.c */ -#line 1429 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1436 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -4838,8 +4997,8 @@ yyreduce: case 267: -/* Line 1455 of yacc.c */ -#line 1436 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1443 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -4848,8 +5007,8 @@ yyreduce: case 268: -/* Line 1455 of yacc.c */ -#line 1441 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1448 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); @@ -4858,8 +5017,8 @@ yyreduce: case 269: -/* Line 1455 of yacc.c */ -#line 1450 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1457 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -4869,8 +5028,8 @@ yyreduce: case 270: -/* Line 1455 of yacc.c */ -#line 1456 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1463 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -4880,8 +5039,8 @@ yyreduce: case 271: -/* Line 1455 of yacc.c */ -#line 1462 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1469 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -4891,8 +5050,8 @@ yyreduce: case 272: -/* Line 1455 of yacc.c */ -#line 1468 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1475 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -4902,8 +5061,8 @@ yyreduce: case 273: -/* Line 1455 of yacc.c */ -#line 1474 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1481 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -4913,22 +5072,22 @@ yyreduce: case 274: -/* Line 1455 of yacc.c */ -#line 1482 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1489 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 275: -/* Line 1455 of yacc.c */ -#line 1483 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1490 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 276: -/* Line 1455 of yacc.c */ -#line 1488 "glsl_parser.ypp" +/* Line 1464 of yacc.c */ +#line 1495 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -4940,8 +5099,8 @@ yyreduce: -/* Line 1455 of yacc.c */ -#line 4945 "glsl_parser.cpp" +/* Line 1464 of yacc.c */ +#line 5104 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 9c4e12fd7e..367b46f49e 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -146,56 +145,86 @@ LOWP = 362, MEDIUMP = 363, HIGHP = 364, - PRECISION = 365, - VERSION = 366, - EXTENSION = 367, - LINE = 368, - PRAGMA = 369, - COLON = 370, - EOL = 371, - INTERFACE = 372, - OUTPUT = 373, - LAYOUT_TOK = 374, - ASM = 375, - CLASS = 376, - UNION = 377, - ENUM = 378, - TYPEDEF = 379, - TEMPLATE = 380, - THIS = 381, - PACKED = 382, - GOTO = 383, - INLINE_TOK = 384, - NOINLINE = 385, - VOLATILE = 386, - PUBLIC_TOK = 387, - STATIC = 388, - EXTERN = 389, - EXTERNAL = 390, - LONG = 391, - SHORT = 392, - DOUBLE = 393, - HALF = 394, - FIXED = 395, - UNSIGNED = 396, - INPUT = 397, - OUPTUT = 398, - HVEC2 = 399, - HVEC3 = 400, - HVEC4 = 401, - DVEC2 = 402, - DVEC3 = 403, - DVEC4 = 404, - FVEC2 = 405, - FVEC3 = 406, - FVEC4 = 407, - SAMPLER2DRECT = 408, - SAMPLER3DRECT = 409, - SAMPLER2DRECTSHADOW = 410, - SIZEOF = 411, - CAST = 412, - NAMESPACE = 413, - USING = 414 + SUPERP = 365, + PRECISION = 366, + VERSION = 367, + EXTENSION = 368, + LINE = 369, + PRAGMA = 370, + COLON = 371, + EOL = 372, + INTERFACE = 373, + OUTPUT = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG = 392, + SHORT = 393, + DOUBLE = 394, + HALF = 395, + FIXED = 396, + UNSIGNED = 397, + INPUT = 398, + OUPTUT = 399, + HVEC2 = 400, + HVEC3 = 401, + HVEC4 = 402, + DVEC2 = 403, + DVEC3 = 404, + DVEC4 = 405, + FVEC2 = 406, + FVEC3 = 407, + FVEC4 = 408, + SAMPLER2DRECT = 409, + SAMPLER3DRECT = 410, + SAMPLER2DRECTSHADOW = 411, + SIZEOF = 412, + CAST = 413, + NAMESPACE = 414, + USING = 415, + COMMON = 416, + PARTITION = 417, + ACTIVE = 418, + SAMPLERBUFFER = 419, + FILTER = 420, + IMAGE1D = 421, + IMAGE2D = 422, + IMAGE3D = 423, + IMAGECUBE = 424, + IMAGE1DARRAY = 425, + IMAGE2DARRAY = 426, + IIMAGE1D = 427, + IIMAGE2D = 428, + IIMAGE3D = 429, + IIMAGECUBE = 430, + IIMAGE1DARRAY = 431, + IIMAGE2DARRAY = 432, + UIMAGE1D = 433, + UIMAGE2D = 434, + UIMAGE3D = 435, + UIMAGECUBE = 436, + UIMAGE1DARRAY = 437, + UIMAGE2DARRAY = 438, + IMAGE1DSHADOW = 439, + IMAGE2DSHADOW = 440, + IMAGEBUFFER = 441, + IIMAGEBUFFER = 442, + UIMAGEBUFFER = 443, + ROW_MAJOR = 444 }; #endif @@ -205,7 +234,7 @@ typedef union YYSTYPE { -/* Line 1676 of yacc.c */ +/* Line 1685 of yacc.c */ #line 45 "glsl_parser.ypp" int n; @@ -236,8 +265,8 @@ typedef union YYSTYPE -/* Line 1676 of yacc.c */ -#line 241 "glsl_parser.h" +/* Line 1685 of yacc.c */ +#line 270 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 7cabefbd34..493b74fb69 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -94,7 +94,7 @@ %token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN %token SUB_ASSIGN %token INVARIANT -%token LOWP MEDIUMP HIGHP PRECISION +%token LOWP MEDIUMP HIGHP SUPERP PRECISION %token VERSION EXTENSION LINE PRAGMA COLON EOL INTERFACE OUTPUT %token LAYOUT_TOK @@ -108,6 +108,13 @@ %token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW %token SIZEOF CAST NAMESPACE USING +%token COMMON PARTITION ACTIVE SAMPLERBUFFER FILTER +%token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY +%token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY +%token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGECUBE UIMAGE1DARRAY UIMAGE2DARRAY +%token IMAGE1DSHADOW IMAGE2DSHADOW IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER +%token ROW_MAJOR + %type variable_identifier %type statement %type statement_list -- cgit v1.2.3 From f8d2cfe4a699faebd42bd1874ef0329d37791dd7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 8 Aug 2010 23:29:54 -0700 Subject: glsl2: Handle plain variable copies in struct splitting. glsl-fs-raytrace goes from 620 Mesa IR instructions out of the compiler to 585. --- src/glsl/ir_structure_splitting.cpp | 54 ++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index 902eeadb2a..f9931670bd 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -80,7 +80,7 @@ public: virtual ir_visitor_status visit(ir_variable *); virtual ir_visitor_status visit(ir_dereference_variable *); virtual ir_visitor_status visit_enter(ir_dereference_record *); - + virtual ir_visitor_status visit_enter(ir_assignment *); virtual ir_visitor_status visit_enter(ir_function_signature *); variable_entry *get_variable_entry(ir_variable *var); @@ -141,6 +141,19 @@ ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir) return visit_continue_with_parent; } +ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_assignment *ir) +{ + if (ir->lhs->as_dereference_variable() && + ir->rhs->as_dereference_variable() && + !ir->condition) { + /* We'll split copies of a structure to copies of components, so don't + * descend to the ir_dereference_variables. + */ + return visit_continue_with_parent; + } +} + ir_visitor_status ir_structure_reference_visitor::visit_enter(ir_function_signature *ir) { @@ -302,9 +315,44 @@ ir_structure_splitting_visitor::visit_leave(ir_dereference_record *ir) ir_visitor_status ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) { - split_rvalue(&ir->rhs); + ir_dereference_variable *lhs_deref = ir->lhs->as_dereference_variable(); + ir_dereference_variable *rhs_deref = ir->rhs->as_dereference_variable(); + variable_entry *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL; + variable_entry *rhs_entry = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL; + const glsl_type *type = ir->rhs->type; + + if ((lhs_entry || rhs_entry) && !ir->condition) { + for (unsigned int i = 0; i < type->length; i++) { + ir_dereference *new_lhs, *new_rhs; + void *mem_ctx = lhs_entry ? lhs_entry->mem_ctx : rhs_entry->mem_ctx; + + if (lhs_entry) { + new_lhs = new(mem_ctx) ir_dereference_variable(lhs_entry->components[i]); + } else { + new_lhs = new(mem_ctx) + ir_dereference_record(ir->lhs->clone(mem_ctx, NULL), + type->fields.structure[i].name); + } + + if (rhs_entry) { + new_rhs = new(mem_ctx) ir_dereference_variable(rhs_entry->components[i]); + } else { + new_rhs = new(mem_ctx) + ir_dereference_record(ir->rhs->clone(mem_ctx, NULL), + type->fields.structure[i].name); + } + + ir->insert_before(new(mem_ctx) ir_assignment(new_lhs, + new_rhs, + NULL)); + } + ir->remove(); + } else { + split_rvalue(&ir->rhs); + split_deref(&ir->lhs); + } + split_rvalue(&ir->condition); - split_deref(&ir->lhs); return visit_continue; } -- cgit v1.2.3 From 5023edaf5d037c9b71f1795ac4b890f175507576 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Mon, 9 Aug 2010 11:50:24 +0300 Subject: glsl: fix missing return in ir_structure_splitting --- src/glsl/ir_structure_splitting.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index f9931670bd..9dc5941207 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -152,6 +152,7 @@ ir_structure_reference_visitor::visit_enter(ir_assignment *ir) */ return visit_continue_with_parent; } + return visit_continue; } ir_visitor_status -- cgit v1.2.3 From 3adce986c498539d9a5d8db95926e66e1315da03 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Mon, 9 Aug 2010 11:17:32 +0300 Subject: glsl2: do not use __retval name; two underscores is reserved word according to GLSL spec (and Win7 ATI drivers do complain about that) --- src/glsl/glsl_types.cpp | 8 ++++---- src/glsl/ir_function_inlining.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 03f84603b5..9b1bef6cb8 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -267,11 +267,11 @@ glsl_type::generate_constructor(glsl_symbol_table *symtab) const } /* Generate the body of the constructor. The body assigns each of the - * parameters to a portion of a local variable called __retval that has - * the same type as the constructor. After initializing __retval, - * __retval is returned. + * parameters to a portion of a local variable called _ret_val that has + * the same type as the constructor. After initializing _ret_val, + * _ret_val is returned. */ - ir_variable *retval = new(ctx) ir_variable(this, "__retval", ir_var_auto); + ir_variable *retval = new(ctx) ir_variable(this, "_ret_val", ir_var_auto); sig->body.push_tail(retval); for (unsigned i = 0; i < length; i++) { diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index fd52d106b1..874602c84f 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -127,7 +127,7 @@ ir_call::generate_inline(ir_instruction *next_ir) /* Generate storage for the return value. */ if (this->callee->return_type) { - retval = new(ctx) ir_variable(this->callee->return_type, "__retval", + retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val", ir_var_auto); next_ir->insert_before(retval); } -- cgit v1.2.3 From fe277089c7a9bb402ef40d89f641b69fb508f2dc Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Aug 2010 09:54:47 -0700 Subject: ir_algebraic: Convert ir_unop_logic_not handler to use a switch statement Currently only ir_binop_equal and ir_binop_nequal are supported, but soon all of the relational operators will be added. Making this change now will simplify those commits. --- src/glsl/ir_algebraic.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index a6ecad7b65..d9e7b680f7 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -161,22 +161,32 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) } switch (ir->operation) { - case ir_unop_logic_not: - if (op_expr[0] && op_expr[0]->operation == ir_binop_equal) { - this->progress = true; - return new(ir) ir_expression(ir_binop_nequal, - ir->type, - op_expr[0]->operands[0], - op_expr[0]->operands[1]); + case ir_unop_logic_not: { + enum ir_expression_operation new_op = ir_unop_logic_not; + + if (op_expr[0] == NULL) + break; + + switch (op_expr[0]->operation) { + case ir_binop_equal: new_op = ir_binop_nequal; break; + case ir_binop_nequal: new_op = ir_binop_equal; break; + + default: + /* The default case handler is here to silence a warning from GCC. + */ + break; } - if (op_expr[0] && op_expr[0]->operation == ir_binop_nequal) { + + if (new_op != ir_unop_logic_not) { this->progress = true; - return new(ir) ir_expression(ir_binop_equal, + return new(ir) ir_expression(new_op, ir->type, op_expr[0]->operands[0], op_expr[0]->operands[1]); } + break; + } case ir_binop_add: if (is_vec_zero(op_const[0])) { -- cgit v1.2.3 From c88e60a27b8d5675cbf488e754537739c2c40bfd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 9 Aug 2010 10:46:38 -0700 Subject: ir_algebraic: Support other comparisons in ir_unop_logic_not --- src/glsl/ir_algebraic.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index d9e7b680f7..43d8f9e699 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -168,6 +168,10 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) break; switch (op_expr[0]->operation) { + case ir_binop_less: new_op = ir_binop_gequal; break; + case ir_binop_greater: new_op = ir_binop_lequal; break; + case ir_binop_lequal: new_op = ir_binop_greater; break; + case ir_binop_gequal: new_op = ir_binop_less; break; case ir_binop_equal: new_op = ir_binop_nequal; break; case ir_binop_nequal: new_op = ir_binop_equal; break; -- cgit v1.2.3 From dbff7b541e4be26cc9363956af8595ec052c4e56 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 7 Aug 2010 02:28:40 -0700 Subject: glsl2: Use gl_DepthRange's proper name. It was being incorrectly added as gl_DepthRangeParameters, which is the type name, not the variable name. --- src/glsl/ir_variable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index d9a16d4287..d88cb515b4 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -141,7 +141,7 @@ generate_110_uniforms(exec_list *instructions, add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type); - add_uniform(instructions, state, "gl_DepthRangeParameters", + add_uniform(instructions, state, "gl_DepthRange", state->symbols->get_type("gl_DepthRangeParameters")); add_uniform(instructions, state, "gl_ClipPlane", -- cgit v1.2.3 From 2eed82ebc0435da40dd5b588efc9bef0946e8497 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 7 Aug 2010 01:11:43 -0700 Subject: texture_builtins.py: Fix cut and paste errors in function names. Some signatures were being generated with the wrong function name. --- src/glsl/builtins/130/textureProjGrad | 2 +- src/glsl/builtins/130/textureProjLod | 2 +- src/glsl/builtins/tools/texture_builtins.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/130/textureProjGrad b/src/glsl/builtins/130/textureProjGrad index a0142c5e68..b4bfa58c12 100644 --- a/src/glsl/builtins/130/textureProjGrad +++ b/src/glsl/builtins/130/textureProjGrad @@ -1,4 +1,4 @@ -((function textureLod +((function textureProjGrad (signature vec4 (parameters (declare (in) sampler1D sampler) diff --git a/src/glsl/builtins/130/textureProjLod b/src/glsl/builtins/130/textureProjLod index 9f4ce1b493..d242f7e40f 100644 --- a/src/glsl/builtins/130/textureProjLod +++ b/src/glsl/builtins/130/textureProjLod @@ -1,4 +1,4 @@ -((function textureLod +((function textureProjLod (signature vec4 (parameters (declare (in) sampler1D sampler) diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index 23d5314916..c4672ae8c1 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -156,7 +156,7 @@ with open(path.join(builtins_dir, "130", "texelFetch"), 'w') as sys.stdout: print "))" with open(path.join(builtins_dir, "130", "textureProjLod"), 'w') as sys.stdout: - print "((function textureLod" + print "((function textureProjLod" generate_fiu_sigs("txl", "1D", True) generate_fiu_sigs("txl", "1D", True, 2) generate_fiu_sigs("txl", "2D", True) @@ -175,7 +175,7 @@ with open(path.join(builtins_dir, "130", "textureGrad"), 'w') as sys.stdout: print ")\n)" with open(path.join(builtins_dir, "130", "textureProjGrad"), 'w') as sys.stdout: - print "((function textureLod" + print "((function textureProjGrad" generate_fiu_sigs("txd", "1D", True) generate_fiu_sigs("txd", "1D", True, 2) generate_fiu_sigs("txd", "2D", True) -- cgit v1.2.3 From 8aa7dbacaf61cb4dd9a436a66c138cb865d7406c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 9 Aug 2010 12:45:25 -0700 Subject: glsl2: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index a8acff4731..12e6909a28 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -4164,7 +4164,7 @@ static const char *builtins_130_textureProj = { }; static const char *builtins_130_textureProjGrad = { - "((function textureLod\n" + "((function textureProjGrad\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1D sampler)\n" @@ -4289,7 +4289,7 @@ static const char *builtins_130_textureProjGrad = { }; static const char *builtins_130_textureProjLod = { - "((function textureLod\n" + "((function textureProjLod\n" " (signature vec4\n" " (parameters\n" " (declare (in) sampler1D sampler)\n" -- cgit v1.2.3 From 2dd3ae0d4ae681cd7b6b28caf35ca45965621c79 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 8 Aug 2010 17:56:34 -0700 Subject: glsl2: Teach copy propagation about "if" and "loop" instructions. This lets us track copies across basic block boundaries. The loop doesn't get a filled out list of available copies into it yet, though. glsl-fs-raytrace drops from 585 to 535 Mesa IR instructions out of the compiler, and it appears that Yo Frankie's largest shaders decrease in Mesa IR count by about 10% as well. --- src/glsl/ir_copy_propagation.cpp | 248 +++++++++++++++++++++++++-------------- 1 file changed, 158 insertions(+), 90 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp index 90a49d5a82..6c211f0e70 100644 --- a/src/glsl/ir_copy_propagation.cpp +++ b/src/glsl/ir_copy_propagation.cpp @@ -25,7 +25,7 @@ * \file ir_copy_propagation.cpp * * Moves usage of recently-copied variables to the previous copy of - * the variable within basic blocks. + * the variable. * * This should reduce the number of MOV instructions in the generated * programs unless copy propagation is also done on the LIR, and may @@ -53,13 +53,31 @@ public: ir_variable *rhs; }; + +class kill_entry : public exec_node +{ +public: + kill_entry(ir_variable *var) + { + assert(var); + this->var = var; + } + + ir_variable *var; +}; + class ir_copy_propagation_visitor : public ir_hierarchical_visitor { public: - ir_copy_propagation_visitor(exec_list *acp) + ir_copy_propagation_visitor() { progress = false; - in_lhs = false; - this->acp = acp; + mem_ctx = talloc_new(0); + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + } + ~ir_copy_propagation_visitor() + { + talloc_free(mem_ctx); } virtual ir_visitor_status visit(class ir_dereference_variable *); @@ -70,26 +88,46 @@ public: virtual ir_visitor_status visit_enter(class ir_call *); virtual ir_visitor_status visit_enter(class ir_if *); - /** List of acp_entry */ + void add_copy(ir_assignment *ir); + void kill(ir_variable *ir); + void handle_if_block(exec_list *instructions); + + /** List of acp_entry: The available copies to propagate */ exec_list *acp; - bool progress; + /** + * List of kill_entry: The variables whose values were killed in this + * block. + */ + exec_list *kills; - /** Currently in the LHS of an assignment? */ - bool in_lhs; -}; + bool progress; + bool killed_all; -ir_visitor_status -ir_copy_propagation_visitor::visit_enter(ir_loop *ir) -{ - (void)ir; - return visit_continue_with_parent; -} + void *mem_ctx; +}; ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) { - (void)ir; + /* Treat entry into a function signature as a completely separate + * block. Any instructions at global scope will be shuffled into + * main() at link time, so they're irrelevant to us. + */ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body); + + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = orig_killed_all; + return visit_continue_with_parent; } @@ -98,34 +136,33 @@ ir_copy_propagation_visitor::visit_enter(ir_assignment *ir) { ir_visitor_status s; - /* Inline the rest of ir_assignment::accept(ir_hv *v), wrapping the - * LHS part with setting in_lhs so that we can avoid copy - * propagating into the LHS. + /* ir_assignment::accept(ir_hv *v), skipping the LHS so that we can + * avoid copy propagating into the LHS. * * Note that this means we won't copy propagate into the derefs of * an array index. Oh well. */ - this->in_lhs = true; - s = ir->lhs->accept(this); - this->in_lhs = false; - if (s != visit_continue) - return (s == visit_continue_with_parent) ? visit_continue : s; s = ir->rhs->accept(this); - if (s != visit_continue) - return (s == visit_continue_with_parent) ? visit_continue : s; + assert(s == visit_continue); - if (ir->condition) + if (ir->condition) { s = ir->condition->accept(this); + assert(s == visit_continue); + } + + kill(ir->lhs->variable_referenced()); - return (s == visit_stop) ? s : visit_continue_with_parent; + add_copy(ir); + + return visit_continue_with_parent; } ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_function *ir) { (void) ir; - return visit_continue_with_parent; + return visit_continue; } /** @@ -138,14 +175,7 @@ ir_copy_propagation_visitor::visit_enter(ir_function *ir) ir_visitor_status ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) { - /* Ignores the LHS. Don't want to rewrite the LHS to point at some - * other storage! - */ - if (this->in_lhs) { - return visit_continue; - } - - ir_variable *var = ir->variable_referenced(); + ir_variable *var = ir->var; foreach_iter(exec_list_iterator, iter, *this->acp) { acp_entry *entry = (acp_entry *)iter.get(); @@ -169,43 +199,108 @@ ir_copy_propagation_visitor::visit_enter(ir_call *ir) foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_instruction *ir = (ir_instruction *)iter.get(); - if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout && - sig_param->mode != ir_var_uniform) { + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { ir->accept(this); } sig_param_iter.next(); } + + /* Since we're unlinked, we don't (necssarily) know the side effects of + * this call. So kill all copies. + */ + acp->make_empty(); + this->killed_all = true; + return visit_continue_with_parent; } +void +ir_copy_propagation_visitor::handle_if_block(exec_list *instructions) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + /* Populate the initial acp with a copy of the original */ + foreach_iter(exec_list_iterator, iter, *orig_acp) { + acp_entry *a = (acp_entry *)iter.get(); + this->acp->push_tail(new(this->mem_ctx) acp_entry(a->lhs, a->rhs)); + } + + visit_list_elements(this, instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var); + } +} ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_if *ir) { ir->condition->accept(this); - /* Do not traverse into the body of the if-statement since that is a - * different basic block. - */ + handle_if_block(&ir->then_instructions); + handle_if_block(&ir->else_instructions); + + /* handle_if_block() already descended into the children. */ return visit_continue_with_parent; } -static bool -propagate_copies(ir_instruction *ir, exec_list *acp) +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_loop *ir) { - ir_copy_propagation_visitor v(acp); + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; - ir->accept(&v); + /* FINISHME: For now, the initial acp for loops is totally empty. + * We could go through once, then go through again with the acp + * cloned minus the killed entries after the first run through. + */ + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; - return v.progress; + visit_list_elements(this, &ir->body_instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var); + } + + /* already descended into the children. */ + return visit_continue_with_parent; } -static void -kill_invalidated_copies(ir_assignment *ir, exec_list *acp) +void +ir_copy_propagation_visitor::kill(ir_variable *var) { - ir_variable *var = ir->lhs->variable_referenced(); assert(var != NULL); + /* Remove any entries currently in the ACP for this kill. */ foreach_iter(exec_list_iterator, iter, *acp) { acp_entry *entry = (acp_entry *)iter.get(); @@ -213,21 +308,25 @@ kill_invalidated_copies(ir_assignment *ir, exec_list *acp) entry->remove(); } } + + /* Add the LHS variable to the list of killed variables in this block. + */ + this->kills->push_tail(new(this->mem_ctx) kill_entry(var)); } /** * Adds an entry to the available copy list if it's a plain assignment * of a variable to a variable. */ -static bool -add_copy(void *ctx, ir_assignment *ir, exec_list *acp) +void +ir_copy_propagation_visitor::add_copy(ir_assignment *ir) { acp_entry *entry; if (ir->condition) { ir_constant *condition = ir->condition->as_constant(); if (!condition || !condition->value.b[0]) - return false; + return; } ir_variable *lhs_var = ir->whole_variable_written(); @@ -241,43 +340,12 @@ add_copy(void *ctx, ir_assignment *ir, exec_list *acp) * will clean up the mess. */ ir->condition = new(talloc_parent(ir)) ir_constant(false); - return true; + this->progress = true; } else { - entry = new(ctx) acp_entry(lhs_var, rhs_var); - acp->push_tail(entry); + entry = new(this->mem_ctx) acp_entry(lhs_var, rhs_var); + this->acp->push_tail(entry); } } - - return false; -} - -static void -copy_propagation_basic_block(ir_instruction *first, - ir_instruction *last, - void *data) -{ - ir_instruction *ir; - /* List of avaialble_copy */ - exec_list acp; - bool *out_progress = (bool *)data; - bool progress = false; - - void *ctx = talloc_new(NULL); - for (ir = first;; ir = (ir_instruction *)ir->next) { - ir_assignment *ir_assign = ir->as_assignment(); - - progress = propagate_copies(ir, &acp) || progress; - - if (ir_assign) { - kill_invalidated_copies(ir_assign, &acp); - - progress = add_copy(ctx, ir_assign, &acp) || progress; - } - if (ir == last) - break; - } - *out_progress = progress; - talloc_free(ctx); } /** @@ -286,9 +354,9 @@ copy_propagation_basic_block(ir_instruction *first, bool do_copy_propagation(exec_list *instructions) { - bool progress = false; + ir_copy_propagation_visitor v; - call_for_basic_blocks(instructions, copy_propagation_basic_block, &progress); + visit_list_elements(&v, instructions); - return progress; + return v.progress; } -- cgit v1.2.3 From 8bebbeb7c5b26ec9166a4644a2c051238d18509b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 Aug 2010 17:03:46 -0700 Subject: glsl2: Add constant propagation. Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness. --- src/glsl/Makefile | 1 + src/glsl/ir_constant_propagation.cpp | 481 +++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + src/glsl/linker.cpp | 1 + src/glsl/main.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 1 + 6 files changed, 486 insertions(+) create mode 100644 src/glsl/ir_constant_propagation.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 0f8b290b65..841e2b9ce9 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -34,6 +34,7 @@ CXX_SOURCES = \ ir_clone.cpp \ ir_constant_expression.cpp \ ir_constant_folding.cpp \ + ir_constant_propagation.cpp \ ir_constant_variable.cpp \ ir_copy_propagation.cpp \ ir.cpp \ diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp new file mode 100644 index 0000000000..adae0aa117 --- /dev/null +++ b/src/glsl/ir_constant_propagation.cpp @@ -0,0 +1,481 @@ +/* + * Constantright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * constant of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, constant, 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 constantright 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 CONSTANTRIGHT 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 ir_constant_propagation.cpp + * + * Tracks assignments of constants to channels of variables, and + * usage of those constant channels with direct usage of the constants. + * + * This can lead to constant folding and algebraic optimizations in + * those later expressions, while causing no increase in instruction + * count (due to constants being generally free to load from a + * constant push buffer or as instruction immediate values) and + * possibly reducing register pressure. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class acp_entry : public exec_node +{ +public: + acp_entry(ir_variable *var, unsigned write_mask, ir_constant *constant) + { + assert(var); + assert(constant); + this->var = var; + this->write_mask = write_mask; + this->constant = constant; + } + + ir_variable *var; + ir_constant *constant; + unsigned write_mask; +}; + + +class kill_entry : public exec_node +{ +public: + kill_entry(ir_variable *var, unsigned write_mask) + { + assert(var); + this->var = var; + this->write_mask = write_mask; + } + + ir_variable *var; + unsigned write_mask; +}; + +class ir_constant_propagation_visitor : public ir_hierarchical_visitor { +public: + ir_constant_propagation_visitor() + { + progress = false; + mem_ctx = talloc_new(0); + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + } + ~ir_constant_propagation_visitor() + { + talloc_free(mem_ctx); + } + + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_assignment *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_enter(class ir_dereference_array *); + virtual ir_visitor_status visit_enter(class ir_texture *); + + void add_constant(ir_assignment *ir); + void kill(ir_variable *ir, unsigned write_mask); + void handle_if_block(exec_list *instructions); + void handle_rvalue(ir_rvalue **rvalue); + + /** List of acp_entry: The available constants to propagate */ + exec_list *acp; + + /** + * List of kill_entry: The masks of variables whose values were + * killed in this block. + */ + exec_list *kills; + + bool progress; + + bool killed_all; + + void *mem_ctx; +}; + + +void +ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + const glsl_type *type = (*rvalue)->type; + if (!type->is_scalar() && !type->is_vector()) + return; + + ir_swizzle *swiz = NULL; + ir_dereference_variable *deref = (*rvalue)->as_dereference_variable(); + if (!deref) { + swiz = (*rvalue)->as_swizzle(); + if (!swiz) + return; + + deref = swiz->val->as_dereference_variable(); + if (!deref) + return; + } + + ir_constant_data data; + memset(&data, 0, sizeof(data)); + + for (unsigned int i = 0; i < type->components(); i++) { + int channel; + acp_entry *found = NULL; + + if (swiz) { + switch (i) { + case 0: channel = swiz->mask.x; break; + case 1: channel = swiz->mask.y; break; + case 2: channel = swiz->mask.z; break; + case 3: channel = swiz->mask.w; break; + default: assert(!"shouldn't be reached"); channel = 0; break; + } + } else { + channel = i; + } + + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + if (entry->var == deref->var && entry->write_mask & (1 << channel)) { + found = entry; + break; + } + } + + if (!found) + return; + + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[i] = found->constant->value.f[channel]; + break; + case GLSL_TYPE_INT: + data.i[i] = found->constant->value.i[channel]; + break; + case GLSL_TYPE_UINT: + data.u[i] = found->constant->value.u[channel]; + break; + case GLSL_TYPE_BOOL: + data.b[i] = found->constant->value.b[channel]; + break; + default: + assert(!"not reached"); + break; + } + } + + *rvalue = new(talloc_parent(deref)) ir_constant(type, &data); + this->progress = true; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir) +{ + /* Treat entry into a function signature as a completely separate + * block. Any instructions at global scope will be shuffled into + * main() at link time, so they're irrelevant to us. + */ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body); + + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = orig_killed_all; + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_assignment *ir) +{ + handle_rvalue(&ir->condition); + handle_rvalue(&ir->rhs); + + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_leave(ir_assignment *ir) +{ + kill(ir->lhs->variable_referenced(), ir->write_mask); + + add_constant(ir); + + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_expression *ir) +{ + for (unsigned int i = 0; i < ir->get_num_operands(); i++) { + handle_rvalue(&ir->operands[i]); + } + + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_call *ir) +{ + /* Do constant propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_rvalue *param = (ir_rvalue *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + ir_rvalue *new_param = param; + handle_rvalue(&new_param); + if (new_param != param) + param->replace_with(new_param); + else + param->accept(this); + } + sig_param_iter.next(); + } + + /* Since we're unlinked, we don't (necssarily) know the side effects of + * this call. So kill all copies. + */ + acp->make_empty(); + this->killed_all = true; + + return visit_continue_with_parent; +} + +void +ir_constant_propagation_visitor::handle_if_block(exec_list *instructions) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + /* Populate the initial acp with a constant of the original */ + foreach_iter(exec_list_iterator, iter, *orig_acp) { + acp_entry *a = (acp_entry *)iter.get(); + this->acp->push_tail(new(this->mem_ctx) acp_entry(a->var, a->write_mask, + a->constant)); + } + + visit_list_elements(this, instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var, k->write_mask); + } +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + handle_rvalue(&ir->condition); + + handle_if_block(&ir->then_instructions); + handle_if_block(&ir->else_instructions); + + /* handle_if_block() already descended into the children. */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_dereference_array *ir) +{ + handle_rvalue(&ir->array_index); + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_texture *ir) +{ + handle_rvalue(&ir->coordinate); + handle_rvalue(&ir->projector); + handle_rvalue(&ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + handle_rvalue(&ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + handle_rvalue(&ir->lod_info.lod); + break; + case ir_txd: + handle_rvalue(&ir->lod_info.grad.dPdx); + handle_rvalue(&ir->lod_info.grad.dPdy); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_loop *ir) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + /* FINISHME: For now, the initial acp for loops is totally empty. + * We could go through once, then go through again with the acp + * cloned minus the killed entries after the first run through. + */ + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body_instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var, k->write_mask); + } + + /* already descended into the children. */ + return visit_continue_with_parent; +} + +void +ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask) +{ + assert(var != NULL); + + /* We don't track non-vectors. */ + if (!var->type->is_vector() && !var->type->is_scalar()) + return; + + /* Remove any entries currently in the ACP for this kill. */ + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (entry->var == var) { + entry->write_mask &= ~write_mask; + if (entry->write_mask == 0) + entry->remove(); + } + } + + /* Add this writemask of the variable to the list of killed + * variables in this block. + */ + foreach_iter(exec_list_iterator, iter, *this->kills) { + kill_entry *entry = (kill_entry *)iter.get(); + + if (entry->var == var) { + entry->write_mask |= write_mask; + return; + } + } + /* Not already in the list. Make new entry. */ + this->kills->push_tail(new(this->mem_ctx) kill_entry(var, write_mask)); +} + +/** + * Adds an entry to the available constant list if it's a plain assignment + * of a variable to a variable. + */ +void +ir_constant_propagation_visitor::add_constant(ir_assignment *ir) +{ + acp_entry *entry; + + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + return; + } + + if (!ir->write_mask) + return; + + ir_dereference_variable *deref = ir->lhs->as_dereference_variable(); + ir_constant *constant = ir->rhs->as_constant(); + + if (!deref || !constant) + return; + + /* Only do constant propagation on vectors. Constant matrices, + * arrays, or structures would require more work elsewhere. + */ + if (!deref->var->type->is_vector() && !deref->var->type->is_scalar()) + return; + + entry = new(this->mem_ctx) acp_entry(deref->var, ir->write_mask, constant); + this->acp->push_tail(entry); +} + +/** + * Does a constant propagation pass on the code present in the instruction stream. + */ +bool +do_constant_propagation(exec_list *instructions) +{ + ir_constant_propagation_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index c6e7beb447..97a0c25216 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -33,6 +33,7 @@ bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); bool do_constant_variable_unlinked(exec_list *instructions); bool do_copy_propagation(exec_list *instructions); +bool do_constant_propagation(exec_list *instructions); bool do_dead_code(exec_list *instructions); bool do_dead_code_local(exec_list *instructions); bool do_dead_code_unlinked(exec_list *instructions); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e93c2f5554..52c9322788 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1296,6 +1296,7 @@ link_shaders(struct gl_shader_program *prog) progress = do_dead_code_local(ir) || progress; progress = do_dead_code(ir) || progress; progress = do_tree_grafting(ir) || progress; + progress = do_constant_propagation(ir) || progress; progress = do_constant_variable(ir) || progress; progress = do_constant_folding(ir) || progress; progress = do_algebraic(ir) || progress; diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index bc7292d155..24d6076d07 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -167,6 +167,7 @@ compile_shader(struct gl_shader *shader) progress = do_dead_code_local(shader->ir) || progress; progress = do_dead_code_unlinked(shader->ir) || progress; progress = do_tree_grafting(shader->ir) || progress; + progress = do_constant_propagation(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index c6856eb5a4..5a272ab88a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2581,6 +2581,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) progress = do_dead_code_local(shader->ir) || progress; progress = do_dead_code_unlinked(shader->ir) || progress; progress = do_tree_grafting(shader->ir) || progress; + progress = do_constant_propagation(shader->ir) || progress; progress = do_constant_variable_unlinked(shader->ir) || progress; progress = do_constant_folding(shader->ir) || progress; progress = do_algebraic(shader->ir) || progress; -- cgit v1.2.3 From 5854d4583c6e8885185e12a0636f77489a62e24c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 Aug 2010 21:22:17 -0700 Subject: glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1)) All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic. --- src/glsl/Makefile | 1 + src/glsl/ir_optimization.h | 1 + src/glsl/ir_sub_to_add_neg.cpp | 76 +++++++++++++++++++++++++++++++++++++++++ src/glsl/linker.cpp | 1 + src/mesa/program/ir_to_mesa.cpp | 1 + 5 files changed, 80 insertions(+) create mode 100644 src/glsl/ir_sub_to_add_neg.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 841e2b9ce9..85298d06a0 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -59,6 +59,7 @@ CXX_SOURCES = \ ir_reader.cpp \ ir_set_program_inouts.cpp \ ir_structure_splitting.cpp \ + ir_sub_to_add_neg.cpp \ ir_swizzle_swizzle.cpp \ ir_tree_grafting.cpp \ ir_validate.cpp \ diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 97a0c25216..5997a30eab 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -47,6 +47,7 @@ bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); bool do_structure_splitting(exec_list *instructions); +bool do_sub_to_add_neg(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); bool do_tree_grafting(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions); diff --git a/src/glsl/ir_sub_to_add_neg.cpp b/src/glsl/ir_sub_to_add_neg.cpp new file mode 100644 index 0000000000..7ed8c1495e --- /dev/null +++ b/src/glsl/ir_sub_to_add_neg.cpp @@ -0,0 +1,76 @@ +/* + * 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 ir_sub_to_add_neg.cpp + * + * Breaks an ir_binop_sub expression down to add(op0, neg(op1)) + * + * This simplifies expression reassociation, and for many backends + * there is no subtract operation separate from adding the negation. + * For backends with native subtract operations, they will probably + * want to recognize add(op0, neg(op1)) or the other way around to + * produce a subtract anyway. + */ + +#include "ir.h" + +class ir_sub_to_add_neg_visitor : public ir_hierarchical_visitor { +public: + ir_sub_to_add_neg_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool progress; +}; + +bool +do_sub_to_add_neg(exec_list *instructions) +{ + ir_sub_to_add_neg_visitor v; + + visit_list_elements(&v, instructions); + return v.progress; +} + +ir_visitor_status +ir_sub_to_add_neg_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_sub) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + ir->operation = ir_binop_add; + ir->operands[1] = new(mem_ctx) ir_expression(ir_unop_neg, + ir->operands[1]->type, + ir->operands[1], + NULL); + + this->progress = true; + + return visit_continue; +} diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 52c9322788..c462d31ef3 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1284,6 +1284,7 @@ link_shaders(struct gl_shader_program *prog) do_mod_to_fract(ir); do_div_to_mul_rcp(ir); do_explog_to_explog2(ir); + do_sub_to_add_neg(ir); do { progress = false; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 5a272ab88a..a9a6f977c0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2570,6 +2570,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) do_mat_op_to_vec(shader->ir); do_mod_to_fract(shader->ir); do_div_to_mul_rcp(shader->ir); + do_sub_to_add_neg(shader->ir); /* Optimization passes */ bool progress; -- cgit v1.2.3 From 0ff3b2b344b21ae4a7b62ebba22d7358755c8dfe Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Jul 2010 23:56:19 -0700 Subject: glsl2: Make ir_algebraic reassociate add/mul operands for constant folding. It's rather easy to produce two constant multiplies separated by other multiplies while writing a BRDF shader, and non-obvious enough in the resulting codegen that I didn't catch it in my demo code until just recently. Cuts 3 965 instructions from my demo (<1%), and 20 from glsl-fs-raytrace (1.3%). --- src/glsl/ir_algebraic.cpp | 108 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index 43d8f9e699..86fb7e49c0 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -58,7 +58,14 @@ public: virtual ir_visitor_status visit_leave(ir_texture *); ir_rvalue *handle_expression(ir_rvalue *in_ir); - + bool reassociate_constant(ir_expression *ir1, + int const_index, + ir_constant *constant, + ir_expression *ir2); + void reassociate_operands(ir_expression *ir1, + int op1, + ir_expression *ir2, + int op2); bool progress; }; @@ -138,6 +145,84 @@ is_vec_one(ir_constant *ir) return true; } +static void +update_type(ir_expression *ir) +{ + if (ir->operands[0]->type->is_vector()) + ir->type = ir->operands[0]->type; + else + ir->type = ir->operands[1]->type; +} + +void +ir_algebraic_visitor::reassociate_operands(ir_expression *ir1, + int op1, + ir_expression *ir2, + int op2) +{ + ir_rvalue *temp = ir2->operands[op2]; + ir2->operands[op2] = ir1->operands[op1]; + ir1->operands[op1] = temp; + + /* Update the type of ir2. The type of ir1 won't have changed -- + * base types matched, and at least one of the operands of the 2 + * binops is still a vector if any of them were. + */ + update_type(ir2); + + this->progress = true; +} + +/** + * Reassociates a constant down a tree of adds or multiplies. + * + * Consider (2 * (a * (b * 0.5))). We want to send up with a * b. + */ +bool +ir_algebraic_visitor::reassociate_constant(ir_expression *ir1, int const_index, + ir_constant *constant, + ir_expression *ir2) +{ + if (!ir2 || ir1->operation != ir2->operation) + return false; + + /* Don't want to even think about matrices. */ + if (ir1->operands[0]->type->is_matrix() || + ir1->operands[0]->type->is_matrix() || + ir2->operands[1]->type->is_matrix() || + ir2->operands[1]->type->is_matrix()) + return false; + + ir_constant *ir2_const[2]; + ir2_const[0] = ir2->operands[0]->constant_expression_value(); + ir2_const[1] = ir2->operands[1]->constant_expression_value(); + + if (ir2_const[0] && ir2_const[1]) + return false; + + if (ir2_const[0]) { + reassociate_operands(ir1, const_index, ir2, 1); + return true; + } else if (ir2_const[1]) { + reassociate_operands(ir1, const_index, ir2, 0); + return true; + } + + if (reassociate_constant(ir1, const_index, constant, + ir2->operands[0]->as_expression())) { + update_type(ir2); + return true; + } + + if (reassociate_constant(ir1, const_index, constant, + ir2->operands[1]->as_expression())) { + update_type(ir2); + return true; + } + + return false; +} + ir_rvalue * ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) { @@ -201,6 +286,16 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) this->progress = true; return ir->operands[0]; } + + /* Reassociate addition of constants so that we can do constant + * folding. + */ + if (op_const[0] && !op_const[1]) + reassociate_constant(ir, 0, op_const[0], + ir->operands[1]->as_expression()); + if (op_const[1] && !op_const[0]) + reassociate_constant(ir, 1, op_const[1], + ir->operands[0]->as_expression()); break; case ir_binop_sub: @@ -231,6 +326,17 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) this->progress = true; return ir_constant::zero(ir, ir->type); } + + /* Reassociate multiplication of constants so that we can do + * constant folding. + */ + if (op_const[0] && !op_const[1]) + reassociate_constant(ir, 0, op_const[0], + ir->operands[1]->as_expression()); + if (op_const[1] && !op_const[0]) + reassociate_constant(ir, 1, op_const[1], + ir->operands[0]->as_expression()); + break; case ir_binop_div: -- cgit v1.2.3 From 60d8c46995aa9cf3f80592b9c9bb8e5be6e87502 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 16:52:54 -0700 Subject: glsl2: Initialize location structure at beginning of parse. Since we have a custom structure for YYLTYPE locations, we need to use an %initial-action directive to avoid triggering use of uninitialized memory when, for example, printing error messages. Thanks to valgrind for noticing this bug. --- src/glsl/glsl_parser.ypp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 493b74fb69..3e60454bb2 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -35,9 +35,17 @@ %} %pure-parser -%locations %error-verbose +%locations +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; + @$.source = 0; +} + %lex-param {void *scanner} %parse-param {struct _mesa_glsl_parse_state *state} %name-prefix "_mesa_glsl_" -- cgit v1.2.3 From a7d6c496cfe2165468c4151f0838ebfd2122a990 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 16:54:23 -0700 Subject: glsl2: Regenerate glsl_parser.cpp and glsl_parser.h After making a minor change to the .y file. --- src/glsl/glsl_parser.cpp | 986 ++++++++++++++++++++++++----------------------- src/glsl/glsl_parser.h | 15 +- 2 files changed, 505 insertions(+), 496 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 4b5e3614df..dc15891f7e 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.2" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -113,7 +114,7 @@ /* Line 189 of yacc.c */ -#line 117 "glsl_parser.cpp" +#line 118 "glsl_parser.cpp" /* Enabling traces. */ #ifndef YYDEBUG @@ -337,7 +338,7 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 45 "glsl_parser.ypp" +#line 53 "glsl_parser.ypp" int n; float real; @@ -368,7 +369,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 372 "glsl_parser.cpp" +#line 373 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -393,7 +394,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 397 "glsl_parser.cpp" +#line 398 "glsl_parser.cpp" #ifdef short # undef short @@ -443,7 +444,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -801,34 +802,34 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 200, 200, 199, 208, 211, 228, 230, 234, 243, - 251, 262, 266, 273, 280, 287, 294, 301, 308, 309, - 315, 319, 326, 332, 341, 345, 349, 350, 359, 360, - 364, 365, 369, 375, 387, 391, 397, 404, 415, 416, - 422, 428, 438, 439, 440, 441, 445, 446, 452, 458, - 467, 468, 474, 483, 484, 490, 499, 500, 506, 512, - 518, 527, 528, 534, 543, 544, 553, 554, 563, 564, - 573, 574, 583, 584, 593, 594, 603, 604, 613, 614, - 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, - 633, 637, 641, 657, 661, 665, 669, 683, 687, 688, - 692, 697, 705, 716, 726, 741, 748, 753, 764, 776, - 777, 778, 779, 783, 787, 788, 797, 806, 815, 824, - 833, 846, 857, 866, 875, 884, 893, 902, 911, 925, - 932, 943, 944, 948, 955, 956, 963, 997, 998, 999, - 1003, 1007, 1008, 1012, 1020, 1021, 1022, 1023, 1024, 1025, - 1026, 1027, 1028, 1032, 1033, 1041, 1042, 1048, 1057, 1063, - 1069, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, - 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, - 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, - 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, - 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, - 1127, 1128, 1129, 1130, 1131, 1135, 1146, 1157, 1171, 1177, - 1186, 1191, 1199, 1214, 1219, 1227, 1233, 1242, 1246, 1252, - 1253, 1257, 1258, 1262, 1266, 1267, 1268, 1269, 1270, 1271, - 1272, 1276, 1282, 1291, 1292, 1296, 1302, 1311, 1321, 1333, - 1339, 1348, 1357, 1363, 1369, 1378, 1382, 1396, 1400, 1401, - 1405, 1412, 1419, 1429, 1430, 1434, 1436, 1442, 1447, 1456, - 1462, 1468, 1474, 1480, 1489, 1490, 1494 + 0, 208, 208, 207, 216, 219, 236, 238, 242, 251, + 259, 270, 274, 281, 288, 295, 302, 309, 316, 317, + 323, 327, 334, 340, 349, 353, 357, 358, 367, 368, + 372, 373, 377, 383, 395, 399, 405, 412, 423, 424, + 430, 436, 446, 447, 448, 449, 453, 454, 460, 466, + 475, 476, 482, 491, 492, 498, 507, 508, 514, 520, + 526, 535, 536, 542, 551, 552, 561, 562, 571, 572, + 581, 582, 591, 592, 601, 602, 611, 612, 621, 622, + 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, + 641, 645, 649, 665, 669, 673, 677, 691, 695, 696, + 700, 705, 713, 724, 734, 749, 756, 761, 772, 784, + 785, 786, 787, 791, 795, 796, 805, 814, 823, 832, + 841, 854, 865, 874, 883, 892, 901, 910, 919, 933, + 940, 951, 952, 956, 963, 964, 971, 1005, 1006, 1007, + 1011, 1015, 1016, 1020, 1028, 1029, 1030, 1031, 1032, 1033, + 1034, 1035, 1036, 1040, 1041, 1049, 1050, 1056, 1065, 1071, + 1077, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, + 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, + 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, + 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, + 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, + 1135, 1136, 1137, 1138, 1139, 1143, 1154, 1165, 1179, 1185, + 1194, 1199, 1207, 1222, 1227, 1235, 1241, 1250, 1254, 1260, + 1261, 1265, 1266, 1270, 1274, 1275, 1276, 1277, 1278, 1279, + 1280, 1284, 1290, 1299, 1300, 1304, 1310, 1319, 1329, 1341, + 1347, 1356, 1365, 1371, 1377, 1386, 1390, 1404, 1408, 1409, + 1413, 1420, 1427, 1437, 1438, 1442, 1444, 1450, 1455, 1464, + 1470, 1476, 1482, 1488, 1497, 1498, 1502 }; #endif @@ -2081,18 +2082,9 @@ static const yytype_uint16 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -2149,7 +2141,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2738,12 +2730,28 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif +/* User initialization code. */ + +/* Line 1242 of yacc.c */ +#line 41 "glsl_parser.ypp" +{ + yylloc.first_line = 1; + yylloc.first_column = 1; + yylloc.last_line = 1; + yylloc.last_column = 1; + yylloc.source = 0; +} + +/* Line 1242 of yacc.c */ +#line 2753 "glsl_parser.cpp" + yylsp[0] = yylloc; + goto yysetstate; /*------------------------------------------------------------. @@ -2928,8 +2936,8 @@ yyreduce: { case 2: -/* Line 1464 of yacc.c */ -#line 200 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 208 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2937,8 +2945,8 @@ yyreduce: case 4: -/* Line 1464 of yacc.c */ -#line 208 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 216 "glsl_parser.ypp" { state->language_version = 110; ;} @@ -2946,8 +2954,8 @@ yyreduce: case 5: -/* Line 1464 of yacc.c */ -#line 212 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 220 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2966,8 +2974,8 @@ yyreduce: case 8: -/* Line 1464 of yacc.c */ -#line 235 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 243 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2977,8 +2985,8 @@ yyreduce: case 9: -/* Line 1464 of yacc.c */ -#line 244 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 252 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2990,8 +2998,8 @@ yyreduce: case 10: -/* Line 1464 of yacc.c */ -#line 252 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 260 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -3003,8 +3011,8 @@ yyreduce: case 12: -/* Line 1464 of yacc.c */ -#line 267 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 275 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -3015,8 +3023,8 @@ yyreduce: case 13: -/* Line 1464 of yacc.c */ -#line 274 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 282 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -3027,8 +3035,8 @@ yyreduce: case 14: -/* Line 1464 of yacc.c */ -#line 281 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 289 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -3039,8 +3047,8 @@ yyreduce: case 15: -/* Line 1464 of yacc.c */ -#line 288 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 296 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -3051,8 +3059,8 @@ yyreduce: case 16: -/* Line 1464 of yacc.c */ -#line 295 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 303 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -3063,8 +3071,8 @@ yyreduce: case 17: -/* Line 1464 of yacc.c */ -#line 302 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 310 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -3072,8 +3080,8 @@ yyreduce: case 19: -/* Line 1464 of yacc.c */ -#line 310 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 318 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -3083,8 +3091,8 @@ yyreduce: case 20: -/* Line 1464 of yacc.c */ -#line 316 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 324 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3092,8 +3100,8 @@ yyreduce: case 21: -/* Line 1464 of yacc.c */ -#line 320 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 328 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3104,8 +3112,8 @@ yyreduce: case 22: -/* Line 1464 of yacc.c */ -#line 327 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 335 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3115,8 +3123,8 @@ yyreduce: case 23: -/* Line 1464 of yacc.c */ -#line 333 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 341 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3126,8 +3134,8 @@ yyreduce: case 27: -/* Line 1464 of yacc.c */ -#line 351 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 359 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3137,8 +3145,8 @@ yyreduce: case 32: -/* Line 1464 of yacc.c */ -#line 370 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 378 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3148,8 +3156,8 @@ yyreduce: case 33: -/* Line 1464 of yacc.c */ -#line 376 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 384 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3159,8 +3167,8 @@ yyreduce: case 35: -/* Line 1464 of yacc.c */ -#line 392 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 400 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3170,8 +3178,8 @@ yyreduce: case 36: -/* Line 1464 of yacc.c */ -#line 398 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 406 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3182,8 +3190,8 @@ yyreduce: case 37: -/* Line 1464 of yacc.c */ -#line 405 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 413 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3194,8 +3202,8 @@ yyreduce: case 39: -/* Line 1464 of yacc.c */ -#line 417 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 425 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3205,8 +3213,8 @@ yyreduce: case 40: -/* Line 1464 of yacc.c */ -#line 423 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 431 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3216,8 +3224,8 @@ yyreduce: case 41: -/* Line 1464 of yacc.c */ -#line 429 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 437 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3227,36 +3235,36 @@ yyreduce: case 42: -/* Line 1464 of yacc.c */ -#line 438 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 446 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: -/* Line 1464 of yacc.c */ -#line 439 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 447 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: -/* Line 1464 of yacc.c */ -#line 440 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 448 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: -/* Line 1464 of yacc.c */ -#line 441 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 449 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: -/* Line 1464 of yacc.c */ -#line 447 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 455 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3266,8 +3274,8 @@ yyreduce: case 48: -/* Line 1464 of yacc.c */ -#line 453 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 461 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3277,8 +3285,8 @@ yyreduce: case 49: -/* Line 1464 of yacc.c */ -#line 459 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 467 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3288,8 +3296,8 @@ yyreduce: case 51: -/* Line 1464 of yacc.c */ -#line 469 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 477 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3299,8 +3307,8 @@ yyreduce: case 52: -/* Line 1464 of yacc.c */ -#line 475 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 483 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3310,8 +3318,8 @@ yyreduce: case 54: -/* Line 1464 of yacc.c */ -#line 485 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 493 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3321,8 +3329,8 @@ yyreduce: case 55: -/* Line 1464 of yacc.c */ -#line 491 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 499 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3332,8 +3340,8 @@ yyreduce: case 57: -/* Line 1464 of yacc.c */ -#line 501 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 509 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3343,8 +3351,8 @@ yyreduce: case 58: -/* Line 1464 of yacc.c */ -#line 507 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 515 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3354,8 +3362,8 @@ yyreduce: case 59: -/* Line 1464 of yacc.c */ -#line 513 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 521 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3365,8 +3373,8 @@ yyreduce: case 60: -/* Line 1464 of yacc.c */ -#line 519 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 527 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3376,8 +3384,8 @@ yyreduce: case 62: -/* Line 1464 of yacc.c */ -#line 529 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 537 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3387,8 +3395,8 @@ yyreduce: case 63: -/* Line 1464 of yacc.c */ -#line 535 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 543 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3398,8 +3406,8 @@ yyreduce: case 65: -/* Line 1464 of yacc.c */ -#line 545 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 553 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3409,8 +3417,8 @@ yyreduce: case 67: -/* Line 1464 of yacc.c */ -#line 555 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 563 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3420,8 +3428,8 @@ yyreduce: case 69: -/* Line 1464 of yacc.c */ -#line 565 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 573 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3431,8 +3439,8 @@ yyreduce: case 71: -/* Line 1464 of yacc.c */ -#line 575 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 583 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3442,8 +3450,8 @@ yyreduce: case 73: -/* Line 1464 of yacc.c */ -#line 585 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 593 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3453,8 +3461,8 @@ yyreduce: case 75: -/* Line 1464 of yacc.c */ -#line 595 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 603 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3464,8 +3472,8 @@ yyreduce: case 77: -/* Line 1464 of yacc.c */ -#line 605 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 613 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3475,8 +3483,8 @@ yyreduce: case 79: -/* Line 1464 of yacc.c */ -#line 615 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 623 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3486,85 +3494,85 @@ yyreduce: case 80: -/* Line 1464 of yacc.c */ -#line 623 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 631 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: -/* Line 1464 of yacc.c */ -#line 624 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 632 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: -/* Line 1464 of yacc.c */ -#line 625 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 633 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: -/* Line 1464 of yacc.c */ -#line 626 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 634 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: -/* Line 1464 of yacc.c */ -#line 627 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 635 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: -/* Line 1464 of yacc.c */ -#line 628 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 636 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: -/* Line 1464 of yacc.c */ -#line 629 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 637 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: -/* Line 1464 of yacc.c */ -#line 630 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 638 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: -/* Line 1464 of yacc.c */ -#line 631 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 639 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: -/* Line 1464 of yacc.c */ -#line 632 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 640 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: -/* Line 1464 of yacc.c */ -#line 633 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 641 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: -/* Line 1464 of yacc.c */ -#line 638 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 646 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3572,8 +3580,8 @@ yyreduce: case 92: -/* Line 1464 of yacc.c */ -#line 642 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 650 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3590,8 +3598,8 @@ yyreduce: case 94: -/* Line 1464 of yacc.c */ -#line 662 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 670 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3599,8 +3607,8 @@ yyreduce: case 95: -/* Line 1464 of yacc.c */ -#line 666 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 674 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3608,8 +3616,8 @@ yyreduce: case 96: -/* Line 1464 of yacc.c */ -#line 670 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 678 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3624,8 +3632,8 @@ yyreduce: case 100: -/* Line 1464 of yacc.c */ -#line 693 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 701 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3634,8 +3642,8 @@ yyreduce: case 101: -/* Line 1464 of yacc.c */ -#line 698 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 706 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3644,8 +3652,8 @@ yyreduce: case 102: -/* Line 1464 of yacc.c */ -#line 706 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 714 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3657,8 +3665,8 @@ yyreduce: case 103: -/* Line 1464 of yacc.c */ -#line 717 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 725 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3672,8 +3680,8 @@ yyreduce: case 104: -/* Line 1464 of yacc.c */ -#line 727 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 735 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3689,8 +3697,8 @@ yyreduce: case 105: -/* Line 1464 of yacc.c */ -#line 742 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 750 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3701,8 +3709,8 @@ yyreduce: case 106: -/* Line 1464 of yacc.c */ -#line 749 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 757 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3711,8 +3719,8 @@ yyreduce: case 107: -/* Line 1464 of yacc.c */ -#line 754 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 762 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3727,8 +3735,8 @@ yyreduce: case 108: -/* Line 1464 of yacc.c */ -#line 765 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 773 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3741,36 +3749,36 @@ yyreduce: case 109: -/* Line 1464 of yacc.c */ -#line 776 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 784 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: -/* Line 1464 of yacc.c */ -#line 777 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 785 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: -/* Line 1464 of yacc.c */ -#line 778 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 786 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: -/* Line 1464 of yacc.c */ -#line 779 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 787 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 115: -/* Line 1464 of yacc.c */ -#line 789 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 797 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3783,8 +3791,8 @@ yyreduce: case 116: -/* Line 1464 of yacc.c */ -#line 798 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 806 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3797,8 +3805,8 @@ yyreduce: case 117: -/* Line 1464 of yacc.c */ -#line 807 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 815 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3811,8 +3819,8 @@ yyreduce: case 118: -/* Line 1464 of yacc.c */ -#line 816 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 824 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3825,8 +3833,8 @@ yyreduce: case 119: -/* Line 1464 of yacc.c */ -#line 825 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 833 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3839,8 +3847,8 @@ yyreduce: case 120: -/* Line 1464 of yacc.c */ -#line 834 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 842 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3853,8 +3861,8 @@ yyreduce: case 121: -/* Line 1464 of yacc.c */ -#line 847 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 855 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3869,8 +3877,8 @@ yyreduce: case 122: -/* Line 1464 of yacc.c */ -#line 858 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 866 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3883,8 +3891,8 @@ yyreduce: case 123: -/* Line 1464 of yacc.c */ -#line 867 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 875 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3897,8 +3905,8 @@ yyreduce: case 124: -/* Line 1464 of yacc.c */ -#line 876 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 884 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3911,8 +3919,8 @@ yyreduce: case 125: -/* Line 1464 of yacc.c */ -#line 885 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 893 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3925,8 +3933,8 @@ yyreduce: case 126: -/* Line 1464 of yacc.c */ -#line 894 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 902 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3939,8 +3947,8 @@ yyreduce: case 127: -/* Line 1464 of yacc.c */ -#line 903 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 911 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3953,8 +3961,8 @@ yyreduce: case 128: -/* Line 1464 of yacc.c */ -#line 912 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 920 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3969,8 +3977,8 @@ yyreduce: case 129: -/* Line 1464 of yacc.c */ -#line 926 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 934 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3981,8 +3989,8 @@ yyreduce: case 130: -/* Line 1464 of yacc.c */ -#line 933 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 941 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3994,15 +4002,15 @@ yyreduce: case 131: -/* Line 1464 of yacc.c */ -#line 943 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 951 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 133: -/* Line 1464 of yacc.c */ -#line 949 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 957 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -4010,8 +4018,8 @@ yyreduce: case 135: -/* Line 1464 of yacc.c */ -#line 957 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 965 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} @@ -4019,8 +4027,8 @@ yyreduce: case 136: -/* Line 1464 of yacc.c */ -#line 964 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 972 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -4055,36 +4063,36 @@ yyreduce: case 137: -/* Line 1464 of yacc.c */ -#line 997 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1005 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; case 138: -/* Line 1464 of yacc.c */ -#line 998 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1006 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; case 139: -/* Line 1464 of yacc.c */ -#line 999 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1007 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; case 140: -/* Line 1464 of yacc.c */ -#line 1003 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1011 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 142: -/* Line 1464 of yacc.c */ -#line 1009 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1017 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} @@ -4092,8 +4100,8 @@ yyreduce: case 143: -/* Line 1464 of yacc.c */ -#line 1013 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1021 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; @@ -4102,71 +4110,71 @@ yyreduce: case 144: -/* Line 1464 of yacc.c */ -#line 1020 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1028 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 145: -/* Line 1464 of yacc.c */ -#line 1021 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1029 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; case 146: -/* Line 1464 of yacc.c */ -#line 1022 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1030 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; case 147: -/* Line 1464 of yacc.c */ -#line 1023 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1031 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; case 148: -/* Line 1464 of yacc.c */ -#line 1024 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1032 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 149: -/* Line 1464 of yacc.c */ -#line 1025 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1033 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 150: -/* Line 1464 of yacc.c */ -#line 1026 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1034 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; case 151: -/* Line 1464 of yacc.c */ -#line 1027 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1035 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 152: -/* Line 1464 of yacc.c */ -#line 1028 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1036 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; case 154: -/* Line 1464 of yacc.c */ -#line 1034 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1042 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4175,8 +4183,8 @@ yyreduce: case 156: -/* Line 1464 of yacc.c */ -#line 1043 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1051 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4186,8 +4194,8 @@ yyreduce: case 157: -/* Line 1464 of yacc.c */ -#line 1049 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1057 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4197,8 +4205,8 @@ yyreduce: case 158: -/* Line 1464 of yacc.c */ -#line 1058 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1066 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4208,8 +4216,8 @@ yyreduce: case 159: -/* Line 1464 of yacc.c */ -#line 1064 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1072 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4219,8 +4227,8 @@ yyreduce: case 160: -/* Line 1464 of yacc.c */ -#line 1070 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1078 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4230,386 +4238,386 @@ yyreduce: case 161: -/* Line 1464 of yacc.c */ -#line 1078 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1086 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 162: -/* Line 1464 of yacc.c */ -#line 1079 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1087 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 163: -/* Line 1464 of yacc.c */ -#line 1080 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1088 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 164: -/* Line 1464 of yacc.c */ -#line 1081 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 165: -/* Line 1464 of yacc.c */ -#line 1082 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 166: -/* Line 1464 of yacc.c */ -#line 1083 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 167: -/* Line 1464 of yacc.c */ -#line 1084 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 168: -/* Line 1464 of yacc.c */ -#line 1085 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 169: -/* Line 1464 of yacc.c */ -#line 1086 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 170: -/* Line 1464 of yacc.c */ -#line 1087 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 171: -/* Line 1464 of yacc.c */ -#line 1088 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 172: -/* Line 1464 of yacc.c */ -#line 1089 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 173: -/* Line 1464 of yacc.c */ -#line 1090 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 174: -/* Line 1464 of yacc.c */ -#line 1091 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 175: -/* Line 1464 of yacc.c */ -#line 1092 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 176: -/* Line 1464 of yacc.c */ -#line 1093 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 177: -/* Line 1464 of yacc.c */ -#line 1094 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 178: -/* Line 1464 of yacc.c */ -#line 1095 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 179: -/* Line 1464 of yacc.c */ -#line 1096 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 180: -/* Line 1464 of yacc.c */ -#line 1097 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 181: -/* Line 1464 of yacc.c */ -#line 1098 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 182: -/* Line 1464 of yacc.c */ -#line 1099 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 183: -/* Line 1464 of yacc.c */ -#line 1100 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 184: -/* Line 1464 of yacc.c */ -#line 1101 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 185: -/* Line 1464 of yacc.c */ -#line 1102 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 186: -/* Line 1464 of yacc.c */ -#line 1103 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 187: -/* Line 1464 of yacc.c */ -#line 1104 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 188: -/* Line 1464 of yacc.c */ -#line 1105 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 189: -/* Line 1464 of yacc.c */ -#line 1106 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 190: -/* Line 1464 of yacc.c */ -#line 1107 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 191: -/* Line 1464 of yacc.c */ -#line 1108 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 192: -/* Line 1464 of yacc.c */ -#line 1109 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 193: -/* Line 1464 of yacc.c */ -#line 1110 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 194: -/* Line 1464 of yacc.c */ -#line 1111 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 195: -/* Line 1464 of yacc.c */ -#line 1112 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 196: -/* Line 1464 of yacc.c */ -#line 1113 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 197: -/* Line 1464 of yacc.c */ -#line 1114 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 198: -/* Line 1464 of yacc.c */ -#line 1115 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 199: -/* Line 1464 of yacc.c */ -#line 1116 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 200: -/* Line 1464 of yacc.c */ -#line 1117 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 201: -/* Line 1464 of yacc.c */ -#line 1118 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 202: -/* Line 1464 of yacc.c */ -#line 1119 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 203: -/* Line 1464 of yacc.c */ -#line 1120 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 204: -/* Line 1464 of yacc.c */ -#line 1121 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 205: -/* Line 1464 of yacc.c */ -#line 1122 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 206: -/* Line 1464 of yacc.c */ -#line 1123 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 207: -/* Line 1464 of yacc.c */ -#line 1124 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1132 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 208: -/* Line 1464 of yacc.c */ -#line 1125 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1133 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 209: -/* Line 1464 of yacc.c */ -#line 1126 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1134 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 210: -/* Line 1464 of yacc.c */ -#line 1127 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1135 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 211: -/* Line 1464 of yacc.c */ -#line 1128 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1136 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 212: -/* Line 1464 of yacc.c */ -#line 1129 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1137 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 213: -/* Line 1464 of yacc.c */ -#line 1130 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1138 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 214: -/* Line 1464 of yacc.c */ -#line 1131 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1139 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 215: -/* Line 1464 of yacc.c */ -#line 1135 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1143 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4625,8 +4633,8 @@ yyreduce: case 216: -/* Line 1464 of yacc.c */ -#line 1146 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1154 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4642,8 +4650,8 @@ yyreduce: case 217: -/* Line 1464 of yacc.c */ -#line 1157 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1165 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4659,8 +4667,8 @@ yyreduce: case 218: -/* Line 1464 of yacc.c */ -#line 1172 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1180 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4670,8 +4678,8 @@ yyreduce: case 219: -/* Line 1464 of yacc.c */ -#line 1178 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1186 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4681,8 +4689,8 @@ yyreduce: case 220: -/* Line 1464 of yacc.c */ -#line 1187 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1195 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4691,8 +4699,8 @@ yyreduce: case 221: -/* Line 1464 of yacc.c */ -#line 1192 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1200 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4701,8 +4709,8 @@ yyreduce: case 222: -/* Line 1464 of yacc.c */ -#line 1200 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1208 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4718,8 +4726,8 @@ yyreduce: case 223: -/* Line 1464 of yacc.c */ -#line 1215 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1223 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4728,8 +4736,8 @@ yyreduce: case 224: -/* Line 1464 of yacc.c */ -#line 1220 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1228 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4738,8 +4746,8 @@ yyreduce: case 225: -/* Line 1464 of yacc.c */ -#line 1228 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1236 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4749,8 +4757,8 @@ yyreduce: case 226: -/* Line 1464 of yacc.c */ -#line 1234 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1242 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4760,29 +4768,29 @@ yyreduce: case 231: -/* Line 1464 of yacc.c */ -#line 1257 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1265 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 237: -/* Line 1464 of yacc.c */ -#line 1269 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1277 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 238: -/* Line 1464 of yacc.c */ -#line 1270 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1278 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 241: -/* Line 1464 of yacc.c */ -#line 1277 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1285 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4792,8 +4800,8 @@ yyreduce: case 242: -/* Line 1464 of yacc.c */ -#line 1283 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1291 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4803,15 +4811,15 @@ yyreduce: case 243: -/* Line 1464 of yacc.c */ -#line 1291 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1299 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 245: -/* Line 1464 of yacc.c */ -#line 1297 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1305 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4821,8 +4829,8 @@ yyreduce: case 246: -/* Line 1464 of yacc.c */ -#line 1303 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1311 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4832,8 +4840,8 @@ yyreduce: case 247: -/* Line 1464 of yacc.c */ -#line 1312 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1320 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4847,8 +4855,8 @@ yyreduce: case 248: -/* Line 1464 of yacc.c */ -#line 1322 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1330 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4861,8 +4869,8 @@ yyreduce: case 249: -/* Line 1464 of yacc.c */ -#line 1334 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1342 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4872,8 +4880,8 @@ yyreduce: case 250: -/* Line 1464 of yacc.c */ -#line 1340 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1348 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4883,8 +4891,8 @@ yyreduce: case 251: -/* Line 1464 of yacc.c */ -#line 1349 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1357 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4894,8 +4902,8 @@ yyreduce: case 252: -/* Line 1464 of yacc.c */ -#line 1358 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1366 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4905,8 +4913,8 @@ yyreduce: case 253: -/* Line 1464 of yacc.c */ -#line 1364 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1372 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4916,8 +4924,8 @@ yyreduce: case 254: -/* Line 1464 of yacc.c */ -#line 1370 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1378 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4927,8 +4935,8 @@ yyreduce: case 255: -/* Line 1464 of yacc.c */ -#line 1379 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1387 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4936,8 +4944,8 @@ yyreduce: case 256: -/* Line 1464 of yacc.c */ -#line 1383 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1391 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4952,8 +4960,8 @@ yyreduce: case 260: -/* Line 1464 of yacc.c */ -#line 1406 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1414 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4964,8 +4972,8 @@ yyreduce: case 261: -/* Line 1464 of yacc.c */ -#line 1413 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1421 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4976,8 +4984,8 @@ yyreduce: case 262: -/* Line 1464 of yacc.c */ -#line 1420 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1428 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4988,8 +4996,8 @@ yyreduce: case 266: -/* Line 1464 of yacc.c */ -#line 1436 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1444 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -4997,8 +5005,8 @@ yyreduce: case 267: -/* Line 1464 of yacc.c */ -#line 1443 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1451 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -5007,8 +5015,8 @@ yyreduce: case 268: -/* Line 1464 of yacc.c */ -#line 1448 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1456 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); @@ -5017,8 +5025,8 @@ yyreduce: case 269: -/* Line 1464 of yacc.c */ -#line 1457 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1465 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5028,8 +5036,8 @@ yyreduce: case 270: -/* Line 1464 of yacc.c */ -#line 1463 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1471 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5039,8 +5047,8 @@ yyreduce: case 271: -/* Line 1464 of yacc.c */ -#line 1469 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1477 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5050,8 +5058,8 @@ yyreduce: case 272: -/* Line 1464 of yacc.c */ -#line 1475 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1483 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5061,8 +5069,8 @@ yyreduce: case 273: -/* Line 1464 of yacc.c */ -#line 1481 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1489 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5072,22 +5080,22 @@ yyreduce: case 274: -/* Line 1464 of yacc.c */ -#line 1489 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1497 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 275: -/* Line 1464 of yacc.c */ -#line 1490 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1498 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 276: -/* Line 1464 of yacc.c */ -#line 1495 "glsl_parser.ypp" +/* Line 1455 of yacc.c */ +#line 1503 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5099,8 +5107,8 @@ yyreduce: -/* Line 1464 of yacc.c */ -#line 5104 "glsl_parser.cpp" +/* Line 1455 of yacc.c */ +#line 5112 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 367b46f49e..470c080f72 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -234,8 +235,8 @@ typedef union YYSTYPE { -/* Line 1685 of yacc.c */ -#line 45 "glsl_parser.ypp" +/* Line 1676 of yacc.c */ +#line 53 "glsl_parser.ypp" int n; float real; @@ -265,8 +266,8 @@ typedef union YYSTYPE -/* Line 1685 of yacc.c */ -#line 270 "glsl_parser.h" +/* Line 1676 of yacc.c */ +#line 271 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ -- cgit v1.2.3 From 485f84d36608b4545fc5a0061f9ab3ac71b9e36e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 16:58:28 -0700 Subject: glcpp: Initialize location structure at beginning of parse. Since we have a custom structure for YYLTYPE locations, we need to use an %initial-action directive to avoid triggering use of uninitialized memory when, for example, printing error messages. We apparently don't yet have a test case that allowed valgrind to find this bug for us, but valgrind found a similar problem in the other parser, so we fix this one as well. --- src/glsl/glcpp/glcpp-parse.y | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index df1a649d9b..a438357450 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -142,7 +142,15 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); %pure-parser %error-verbose + %locations +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; + @$.source = 0; +} %parse-param {glcpp_parser_t *parser} %lex-param {glcpp_parser_t *parser} -- cgit v1.2.3 From e29cd391253230611a26ca58849a1169045dd795 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 16:59:20 -0700 Subject: glcpp: Regnerate glcpp-parse.c and glcpp-parse.h After making a minor change to the .y file. --- src/glsl/glcpp/glcpp-parse.c | 432 ++++++++++++++++++++++--------------------- src/glsl/glcpp/glcpp-parse.h | 7 +- 2 files changed, 224 insertions(+), 215 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index e93f83263d..2ef00a0c8d 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.2" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -211,7 +212,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 215 "glcpp/glcpp-parse.c" +#line 216 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -299,7 +300,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 303 "glcpp/glcpp-parse.c" +#line 304 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -349,7 +350,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -623,17 +624,17 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 172, 172, 174, 178, 181, 186, 187, 191, 194, - 200, 203, 206, 209, 217, 228, 233, 238, 247, 258, - 261, 264, 273, 277, 286, 291, 292, 295, 298, 301, - 304, 307, 310, 313, 316, 319, 322, 325, 328, 331, - 334, 337, 340, 343, 346, 349, 352, 355, 358, 364, - 369, 377, 378, 382, 388, 389, 392, 394, 401, 405, - 409, 414, 420, 428, 434, 442, 446, 450, 454, 458, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, - 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, - 495 + 0, 180, 180, 182, 186, 189, 194, 195, 199, 202, + 208, 211, 214, 217, 225, 236, 241, 246, 255, 266, + 269, 272, 281, 285, 294, 299, 300, 303, 306, 309, + 312, 315, 318, 321, 324, 327, 330, 333, 336, 339, + 342, 345, 348, 351, 354, 357, 360, 363, 366, 372, + 377, 385, 386, 390, 396, 397, 400, 402, 409, 413, + 417, 422, 428, 436, 442, 450, 454, 458, 462, 466, + 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, + 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, + 503 }; #endif @@ -936,18 +937,9 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -1004,7 +996,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1593,12 +1585,28 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif +/* User initialization code. */ + +/* Line 1242 of yacc.c */ +#line 147 "glcpp/glcpp-parse.y" +{ + yylloc.first_line = 1; + yylloc.first_column = 1; + yylloc.last_line = 1; + yylloc.last_column = 1; + yylloc.source = 0; +} + +/* Line 1242 of yacc.c */ +#line 1608 "glcpp/glcpp-parse.c" + yylsp[0] = yylloc; + goto yysetstate; /*------------------------------------------------------------. @@ -1783,8 +1791,8 @@ yyreduce: { case 4: -/* Line 1464 of yacc.c */ -#line 178 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 186 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); ;} @@ -1792,8 +1800,8 @@ yyreduce: case 5: -/* Line 1464 of yacc.c */ -#line 181 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 189 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); glcpp_print(parser->output, "\n"); @@ -1803,8 +1811,8 @@ yyreduce: case 8: -/* Line 1464 of yacc.c */ -#line 191 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 199 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1812,8 +1820,8 @@ yyreduce: case 9: -/* Line 1464 of yacc.c */ -#line 194 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 202 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1821,8 +1829,8 @@ yyreduce: case 10: -/* Line 1464 of yacc.c */ -#line 200 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 208 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1830,8 +1838,8 @@ yyreduce: case 11: -/* Line 1464 of yacc.c */ -#line 203 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 211 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1839,8 +1847,8 @@ yyreduce: case 12: -/* Line 1464 of yacc.c */ -#line 206 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 214 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); ;} @@ -1848,8 +1856,8 @@ yyreduce: case 13: -/* Line 1464 of yacc.c */ -#line 209 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 217 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { @@ -1862,8 +1870,8 @@ yyreduce: case 14: -/* Line 1464 of yacc.c */ -#line 217 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 225 "glcpp/glcpp-parse.y" { /* If we're skipping to the next #elif/#else case or to #endif, * don't bother expanding or parsing the expression. @@ -1879,8 +1887,8 @@ yyreduce: case 15: -/* Line 1464 of yacc.c */ -#line 228 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 236 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1890,8 +1898,8 @@ yyreduce: case 16: -/* Line 1464 of yacc.c */ -#line 233 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 241 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1901,8 +1909,8 @@ yyreduce: case 17: -/* Line 1464 of yacc.c */ -#line 238 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 246 "glcpp/glcpp-parse.y" { /* If we just finished a non-skipped #if/#ifdef/#ifndef block, * don't bother expanding or parsing the expression. @@ -1916,8 +1924,8 @@ yyreduce: case 18: -/* Line 1464 of yacc.c */ -#line 247 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 255 "glcpp/glcpp-parse.y" { /* #elif without an expression results in a warning if the * condition doesn't matter (we just handled #if 1 or such) @@ -1933,8 +1941,8 @@ yyreduce: case 19: -/* Line 1464 of yacc.c */ -#line 258 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 266 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1942,8 +1950,8 @@ yyreduce: case 20: -/* Line 1464 of yacc.c */ -#line 261 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 269 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -1951,8 +1959,8 @@ yyreduce: case 21: -/* Line 1464 of yacc.c */ -#line 264 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 272 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -1966,8 +1974,8 @@ yyreduce: case 23: -/* Line 1464 of yacc.c */ -#line 277 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 285 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -1981,8 +1989,8 @@ yyreduce: case 24: -/* Line 1464 of yacc.c */ -#line 286 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 294 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -1990,8 +1998,8 @@ yyreduce: case 26: -/* Line 1464 of yacc.c */ -#line 292 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 300 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -1999,8 +2007,8 @@ yyreduce: case 27: -/* Line 1464 of yacc.c */ -#line 295 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 303 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2008,8 +2016,8 @@ yyreduce: case 28: -/* Line 1464 of yacc.c */ -#line 298 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 306 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2017,8 +2025,8 @@ yyreduce: case 29: -/* Line 1464 of yacc.c */ -#line 301 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 309 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2026,8 +2034,8 @@ yyreduce: case 30: -/* Line 1464 of yacc.c */ -#line 304 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 312 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2035,8 +2043,8 @@ yyreduce: case 31: -/* Line 1464 of yacc.c */ -#line 307 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 315 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2044,8 +2052,8 @@ yyreduce: case 32: -/* Line 1464 of yacc.c */ -#line 310 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 318 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2053,8 +2061,8 @@ yyreduce: case 33: -/* Line 1464 of yacc.c */ -#line 313 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 321 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2062,8 +2070,8 @@ yyreduce: case 34: -/* Line 1464 of yacc.c */ -#line 316 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 324 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2071,8 +2079,8 @@ yyreduce: case 35: -/* Line 1464 of yacc.c */ -#line 319 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 327 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2080,8 +2088,8 @@ yyreduce: case 36: -/* Line 1464 of yacc.c */ -#line 322 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 330 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2089,8 +2097,8 @@ yyreduce: case 37: -/* Line 1464 of yacc.c */ -#line 325 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 333 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2098,8 +2106,8 @@ yyreduce: case 38: -/* Line 1464 of yacc.c */ -#line 328 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 336 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2107,8 +2115,8 @@ yyreduce: case 39: -/* Line 1464 of yacc.c */ -#line 331 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 339 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2116,8 +2124,8 @@ yyreduce: case 40: -/* Line 1464 of yacc.c */ -#line 334 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 342 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2125,8 +2133,8 @@ yyreduce: case 41: -/* Line 1464 of yacc.c */ -#line 337 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 345 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2134,8 +2142,8 @@ yyreduce: case 42: -/* Line 1464 of yacc.c */ -#line 340 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 348 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2143,8 +2151,8 @@ yyreduce: case 43: -/* Line 1464 of yacc.c */ -#line 343 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 351 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2152,8 +2160,8 @@ yyreduce: case 44: -/* Line 1464 of yacc.c */ -#line 346 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 354 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2161,8 +2169,8 @@ yyreduce: case 45: -/* Line 1464 of yacc.c */ -#line 349 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 357 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2170,8 +2178,8 @@ yyreduce: case 46: -/* Line 1464 of yacc.c */ -#line 352 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 360 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2179,8 +2187,8 @@ yyreduce: case 47: -/* Line 1464 of yacc.c */ -#line 355 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 363 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2188,8 +2196,8 @@ yyreduce: case 48: -/* Line 1464 of yacc.c */ -#line 358 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 366 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2197,8 +2205,8 @@ yyreduce: case 49: -/* Line 1464 of yacc.c */ -#line 364 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 372 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2208,8 +2216,8 @@ yyreduce: case 50: -/* Line 1464 of yacc.c */ -#line 369 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 377 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2219,15 +2227,15 @@ yyreduce: case 51: -/* Line 1464 of yacc.c */ -#line 377 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 385 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 53: -/* Line 1464 of yacc.c */ -#line 382 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 390 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2235,15 +2243,15 @@ yyreduce: case 54: -/* Line 1464 of yacc.c */ -#line 388 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 396 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 57: -/* Line 1464 of yacc.c */ -#line 394 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 402 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2251,8 +2259,8 @@ yyreduce: case 58: -/* Line 1464 of yacc.c */ -#line 401 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 409 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2261,8 +2269,8 @@ yyreduce: case 59: -/* Line 1464 of yacc.c */ -#line 405 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 413 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2271,8 +2279,8 @@ yyreduce: case 61: -/* Line 1464 of yacc.c */ -#line 414 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 422 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2283,8 +2291,8 @@ yyreduce: case 62: -/* Line 1464 of yacc.c */ -#line 420 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 428 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2294,8 +2302,8 @@ yyreduce: case 63: -/* Line 1464 of yacc.c */ -#line 428 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 436 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2306,8 +2314,8 @@ yyreduce: case 64: -/* Line 1464 of yacc.c */ -#line 434 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 442 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2317,8 +2325,8 @@ yyreduce: case 65: -/* Line 1464 of yacc.c */ -#line 442 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 450 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2327,8 +2335,8 @@ yyreduce: case 66: -/* Line 1464 of yacc.c */ -#line 446 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 454 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2337,8 +2345,8 @@ yyreduce: case 67: -/* Line 1464 of yacc.c */ -#line 450 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 458 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2347,8 +2355,8 @@ yyreduce: case 68: -/* Line 1464 of yacc.c */ -#line 454 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 462 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2357,8 +2365,8 @@ yyreduce: case 69: -/* Line 1464 of yacc.c */ -#line 458 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 466 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2367,225 +2375,225 @@ yyreduce: case 70: -/* Line 1464 of yacc.c */ -#line 465 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 473 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 71: -/* Line 1464 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 474 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 72: -/* Line 1464 of yacc.c */ -#line 467 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 475 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 73: -/* Line 1464 of yacc.c */ -#line 468 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 476 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 74: -/* Line 1464 of yacc.c */ -#line 469 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 477 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 75: -/* Line 1464 of yacc.c */ -#line 470 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 478 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 76: -/* Line 1464 of yacc.c */ -#line 471 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 479 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 77: -/* Line 1464 of yacc.c */ -#line 472 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 480 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 78: -/* Line 1464 of yacc.c */ -#line 473 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 481 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 79: -/* Line 1464 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 482 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 80: -/* Line 1464 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 483 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 81: -/* Line 1464 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 484 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 82: -/* Line 1464 of yacc.c */ -#line 477 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 485 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 83: -/* Line 1464 of yacc.c */ -#line 478 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 486 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 84: -/* Line 1464 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 487 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 85: -/* Line 1464 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 488 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 86: -/* Line 1464 of yacc.c */ -#line 481 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 489 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 87: -/* Line 1464 of yacc.c */ -#line 482 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 490 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 88: -/* Line 1464 of yacc.c */ -#line 483 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 491 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 89: -/* Line 1464 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 492 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 90: -/* Line 1464 of yacc.c */ -#line 485 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 493 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 91: -/* Line 1464 of yacc.c */ -#line 486 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 494 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 92: -/* Line 1464 of yacc.c */ -#line 487 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 495 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 93: -/* Line 1464 of yacc.c */ -#line 488 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 496 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 94: -/* Line 1464 of yacc.c */ -#line 489 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 497 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 95: -/* Line 1464 of yacc.c */ -#line 490 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 498 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 96: -/* Line 1464 of yacc.c */ -#line 491 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 499 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 97: -/* Line 1464 of yacc.c */ -#line 492 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 500 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 98: -/* Line 1464 of yacc.c */ -#line 493 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 501 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 99: -/* Line 1464 of yacc.c */ -#line 494 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 502 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 100: -/* Line 1464 of yacc.c */ -#line 495 "glcpp/glcpp-parse.y" +/* Line 1455 of yacc.c */ +#line 503 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1464 of yacc.c */ -#line 2589 "glcpp/glcpp-parse.c" +/* Line 1455 of yacc.c */ +#line 2597 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2803,8 +2811,8 @@ yyreturn: -/* Line 1684 of yacc.c */ -#line 498 "glcpp/glcpp-parse.y" +/* Line 1675 of yacc.c */ +#line 506 "glcpp/glcpp-parse.y" string_list_t * diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 53e7af0305..50758930e9 100644 --- a/src/glsl/glcpp/glcpp-parse.h +++ b/src/glsl/glcpp/glcpp-parse.h @@ -1,9 +1,10 @@ -/* A Bison parser, made by GNU Bison 2.4.2. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3 From 4f9a64407c948a7a46d23e8d4f7caae6d0e83232 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 18:25:30 -0700 Subject: glcpp: Fix expected result for the 064-version.c test. Commit d4a04f315560704bf1103df0b93723e468725df7 caused this test case to produce an additional blank line, which is otherwise harmless, but does need to be reflected in the .expected file for the test to pass. --- src/glsl/glcpp/tests/064-version.c.expected | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/064-version.c.expected b/src/glsl/glcpp/tests/064-version.c.expected index 3af71113c8..1c53467270 100644 --- a/src/glsl/glcpp/tests/064-version.c.expected +++ b/src/glsl/glcpp/tests/064-version.c.expected @@ -1,3 +1,4 @@ #version 130 + -- cgit v1.2.3 From 9b7fd2099f926b9cc187382ca75eb8dedf3d37ca Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 10 Aug 2010 18:27:31 -0700 Subject: glcpp: Discard output of cmp when running the test suite. We're already using the return-value of cmp to print either PASS or FAIL and in the case of failure, we're subsequently running and showing the output of diff. So any warnings/errors from cmp itself are not actually needed, and can be quite confusing. --- src/glsl/glcpp/tests/glcpp-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index cfe7e97878..c09e8a96b9 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -9,7 +9,7 @@ for test in *.c; do echo -n "Testing $test..." ../glcpp < $test > $test.out total=$((total+1)) - if cmp $test.expected $test.out; then + if cmp $test.expected $test.out >/dev/null 2>&1; then echo "PASS" pass=$((pass+1)) else -- cgit v1.2.3 From 64b408529aefe0fb5968471431ec0a1b0abd7697 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 9 Aug 2010 14:03:04 -0700 Subject: texture_builtins.py: Remove useless comments. --- src/glsl/builtins/tools/texture_builtins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index c4672ae8c1..33d9642ef7 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -211,9 +211,9 @@ with open(path.join(builtins_dir, "EXT_texture_array", "textures"), 'w') as sys. with open(path.join(builtins_dir, "EXT_texture_array_fs", "textures"), 'w') as sys.stdout: print "((function texture1DArray" - generate_sigs("", "txb", "1DArray") # MOVE TO _fs + generate_sigs("", "txb", "1DArray") print ")\n (function texture2DArray" - generate_sigs("", "txb", "2DArray") # MOVE TO _fs + generate_sigs("", "txb", "2DArray") print ")\n (function shadow1DArray" generate_sigs("", "txb", "1DArrayShadow") print "))" -- cgit v1.2.3 From 298a6fcddef6a91084ae921fca0b8640eb2e2a16 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 10 Aug 2010 19:16:19 -0700 Subject: glcpp/tests: Commit forgotten file 074-elif-undef.c.expected. --- src/glsl/glcpp/tests/074-elif-undef.c.expected | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/glsl/glcpp/tests/074-elif-undef.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/074-elif-undef.c.expected b/src/glsl/glcpp/tests/074-elif-undef.c.expected new file mode 100644 index 0000000000..fd40910d9e --- /dev/null +++ b/src/glsl/glcpp/tests/074-elif-undef.c.expected @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3 From 48ba058e7a4b808271ca987b1553efd7e9792da9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 12:43:44 -0700 Subject: glcpp: Additional fixes for not evaluating skipped #if/#elif expressions. This adds a couple of test cases to expand our coverage of invalid #if and being skipped, (either by being nested inside an #if/#elif that evaluates to zero or by being after an #if/#elif that evaluates to non-zero). --- src/glsl/glcpp/glcpp-parse.y | 60 +++++++++++++++------- src/glsl/glcpp/tests/075-elif-elif-undef.c | 4 ++ .../glcpp/tests/075-elif-elif-undef.c.expected | 5 ++ src/glsl/glcpp/tests/076-elif-undef-nested.c | 5 ++ .../glcpp/tests/076-elif-undef-nested.c.expected | 6 +++ 5 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 src/glsl/glcpp/tests/075-elif-elif-undef.c create mode 100644 src/glsl/glcpp/tests/075-elif-elif-undef.c.expected create mode 100644 src/glsl/glcpp/tests/076-elif-undef-nested.c create mode 100644 src/glsl/glcpp/tests/076-elif-undef-nested.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index a438357450..643c449d0e 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -223,14 +223,22 @@ control_line: talloc_free ($2); } | HASH_IF conditional_tokens NEWLINE { - /* If we're skipping to the next #elif/#else case or to #endif, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type != SKIP_NO_SKIP) { + /* Be careful to only evaluate the 'if' expression if + * we are not skipping. When we are skipping, we + * simply push a new 0-valued 'if' onto the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); + } + else + { _glcpp_parser_skip_stack_push_if (parser, & @1, 0); parser->skip_stack->type = SKIP_TO_ENDIF; - } else { - _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); } } | HASH_IFDEF IDENTIFIER junk NEWLINE { @@ -244,24 +252,38 @@ control_line: _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); } | HASH_ELIF conditional_tokens NEWLINE { - /* If we just finished a non-skipped #if/#ifdef/#ifndef block, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) - parser->skip_stack->type = SKIP_TO_ENDIF; - else + /* Be careful to only evaluate the 'elif' expression + * if we are not skipping. When we are skipping, we + * simply change to a 0-valued 'elif' on the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + } } | HASH_ELIF NEWLINE { - /* #elif without an expression results in a warning if the - * condition doesn't matter (we just handled #if 1 or such) - * but an error otherwise. */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) { - parser->skip_stack->type = SKIP_TO_ENDIF; - glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); - } else { + /* #elif without an expression is an error unless we + * are skipping. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { glcpp_error(& @1, parser, "#elif needs an expression"); } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); + } } | HASH_ELSE NEWLINE { _glcpp_parser_skip_stack_change_if (parser, & @1, "else", 1); diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c b/src/glsl/glcpp/tests/075-elif-elif-undef.c new file mode 100644 index 0000000000..264bc4f10e --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c @@ -0,0 +1,4 @@ +#ifndef UNDEF +#elif UNDEF < 0 +#elif UNDEF == 3 +#endif diff --git a/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected new file mode 100644 index 0000000000..3f2ff2d6cc --- /dev/null +++ b/src/glsl/glcpp/tests/075-elif-elif-undef.c.expected @@ -0,0 +1,5 @@ + + + + + diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c b/src/glsl/glcpp/tests/076-elif-undef-nested.c new file mode 100644 index 0000000000..ebd550ed00 --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c @@ -0,0 +1,5 @@ +#ifdef UNDEF +#if UNDEF == 4 +#elif UNDEF == 5 +#endif +#endif diff --git a/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected new file mode 100644 index 0000000000..6fb66a5e2f --- /dev/null +++ b/src/glsl/glcpp/tests/076-elif-undef-nested.c.expected @@ -0,0 +1,6 @@ + + + + + + -- cgit v1.2.3 From 764e096647ec8c0f20ea3b5191499af806ad23f8 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 12:45:55 -0700 Subject: glcpp: Regenerate glcpp-parse.c After a recent change to glcpp-parse.y --- src/glsl/glcpp/glcpp-parse.c | 244 +++++++++++++++++++++++-------------------- 1 file changed, 133 insertions(+), 111 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 2ef00a0c8d..498d018764 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -625,16 +625,16 @@ static const yytype_int8 yyrhs[] = static const yytype_uint16 yyrline[] = { 0, 180, 180, 182, 186, 189, 194, 195, 199, 202, - 208, 211, 214, 217, 225, 236, 241, 246, 255, 266, - 269, 272, 281, 285, 294, 299, 300, 303, 306, 309, - 312, 315, 318, 321, 324, 327, 330, 333, 336, 339, - 342, 345, 348, 351, 354, 357, 360, 363, 366, 372, - 377, 385, 386, 390, 396, 397, 400, 402, 409, 413, - 417, 422, 428, 436, 442, 450, 454, 458, 462, 466, - 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, - 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503 + 208, 211, 214, 217, 225, 244, 249, 254, 273, 288, + 291, 294, 303, 307, 316, 321, 322, 325, 328, 331, + 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, + 364, 367, 370, 373, 376, 379, 382, 385, 388, 394, + 399, 407, 408, 412, 418, 419, 422, 424, 431, 435, + 439, 444, 450, 458, 464, 472, 476, 480, 484, 488, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, + 525 }; #endif @@ -1873,14 +1873,22 @@ yyreduce: /* Line 1455 of yacc.c */ #line 225 "glcpp/glcpp-parse.y" { - /* If we're skipping to the next #elif/#else case or to #endif, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type != SKIP_NO_SKIP) { + /* Be careful to only evaluate the 'if' expression if + * we are not skipping. When we are skipping, we + * simply push a new 0-valued 'if' onto the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + } + else + { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), 0); parser->skip_stack->type = SKIP_TO_ENDIF; - } else { - _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); } ;} break; @@ -1888,7 +1896,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 236 "glcpp/glcpp-parse.y" +#line 244 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1899,7 +1907,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 241 "glcpp/glcpp-parse.y" +#line 249 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1910,39 +1918,53 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 246 "glcpp/glcpp-parse.y" +#line 254 "glcpp/glcpp-parse.y" { - /* If we just finished a non-skipped #if/#ifdef/#ifndef block, - * don't bother expanding or parsing the expression. - */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) - parser->skip_stack->type = SKIP_TO_ENDIF; - else + /* Be careful to only evaluate the 'elif' expression + * if we are not skipping. When we are skipping, we + * simply change to a 0-valued 'elif' on the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), + "elif", 0); + } ;} break; case 18: /* Line 1455 of yacc.c */ -#line 255 "glcpp/glcpp-parse.y" +#line 273 "glcpp/glcpp-parse.y" { - /* #elif without an expression results in a warning if the - * condition doesn't matter (we just handled #if 1 or such) - * but an error otherwise. */ - if (parser->skip_stack != NULL && parser->skip_stack->type == SKIP_NO_SKIP) { - parser->skip_stack->type = SKIP_TO_ENDIF; - glcpp_warning(& (yylsp[(1) - (2)]), parser, "ignoring illegal #elif without expression"); - } else { + /* #elif without an expression is an error unless we + * are skipping. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif needs an expression"); } + else + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), + "elif", 0); + glcpp_warning(& (yylsp[(1) - (2)]), parser, "ignoring illegal #elif without expression"); + } ;} break; case 19: /* Line 1455 of yacc.c */ -#line 266 "glcpp/glcpp-parse.y" +#line 288 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1951,7 +1973,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 269 "glcpp/glcpp-parse.y" +#line 291 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -1960,7 +1982,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 272 "glcpp/glcpp-parse.y" +#line 294 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -1975,7 +1997,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 285 "glcpp/glcpp-parse.y" +#line 307 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -1990,7 +2012,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 294 "glcpp/glcpp-parse.y" +#line 316 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -1999,7 +2021,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 300 "glcpp/glcpp-parse.y" +#line 322 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -2008,7 +2030,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 303 "glcpp/glcpp-parse.y" +#line 325 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2017,7 +2039,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 306 "glcpp/glcpp-parse.y" +#line 328 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2026,7 +2048,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 309 "glcpp/glcpp-parse.y" +#line 331 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2035,7 +2057,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 312 "glcpp/glcpp-parse.y" +#line 334 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2044,7 +2066,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 315 "glcpp/glcpp-parse.y" +#line 337 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2053,7 +2075,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 318 "glcpp/glcpp-parse.y" +#line 340 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2062,7 +2084,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 321 "glcpp/glcpp-parse.y" +#line 343 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2071,7 +2093,7 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 324 "glcpp/glcpp-parse.y" +#line 346 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2080,7 +2102,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 327 "glcpp/glcpp-parse.y" +#line 349 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2089,7 +2111,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 330 "glcpp/glcpp-parse.y" +#line 352 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2098,7 +2120,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 333 "glcpp/glcpp-parse.y" +#line 355 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2107,7 +2129,7 @@ yyreduce: case 38: /* Line 1455 of yacc.c */ -#line 336 "glcpp/glcpp-parse.y" +#line 358 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2116,7 +2138,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 339 "glcpp/glcpp-parse.y" +#line 361 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2125,7 +2147,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 342 "glcpp/glcpp-parse.y" +#line 364 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2134,7 +2156,7 @@ yyreduce: case 41: /* Line 1455 of yacc.c */ -#line 345 "glcpp/glcpp-parse.y" +#line 367 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2143,7 +2165,7 @@ yyreduce: case 42: /* Line 1455 of yacc.c */ -#line 348 "glcpp/glcpp-parse.y" +#line 370 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2152,7 +2174,7 @@ yyreduce: case 43: /* Line 1455 of yacc.c */ -#line 351 "glcpp/glcpp-parse.y" +#line 373 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2161,7 +2183,7 @@ yyreduce: case 44: /* Line 1455 of yacc.c */ -#line 354 "glcpp/glcpp-parse.y" +#line 376 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2170,7 +2192,7 @@ yyreduce: case 45: /* Line 1455 of yacc.c */ -#line 357 "glcpp/glcpp-parse.y" +#line 379 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2179,7 +2201,7 @@ yyreduce: case 46: /* Line 1455 of yacc.c */ -#line 360 "glcpp/glcpp-parse.y" +#line 382 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2188,7 +2210,7 @@ yyreduce: case 47: /* Line 1455 of yacc.c */ -#line 363 "glcpp/glcpp-parse.y" +#line 385 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2197,7 +2219,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 366 "glcpp/glcpp-parse.y" +#line 388 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2206,7 +2228,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 372 "glcpp/glcpp-parse.y" +#line 394 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2217,7 +2239,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 377 "glcpp/glcpp-parse.y" +#line 399 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2228,14 +2250,14 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 385 "glcpp/glcpp-parse.y" +#line 407 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 53: /* Line 1455 of yacc.c */ -#line 390 "glcpp/glcpp-parse.y" +#line 412 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2244,14 +2266,14 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 396 "glcpp/glcpp-parse.y" +#line 418 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 57: /* Line 1455 of yacc.c */ -#line 402 "glcpp/glcpp-parse.y" +#line 424 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2260,7 +2282,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 409 "glcpp/glcpp-parse.y" +#line 431 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2270,7 +2292,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 413 "glcpp/glcpp-parse.y" +#line 435 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2280,7 +2302,7 @@ yyreduce: case 61: /* Line 1455 of yacc.c */ -#line 422 "glcpp/glcpp-parse.y" +#line 444 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2292,7 +2314,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 428 "glcpp/glcpp-parse.y" +#line 450 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2303,7 +2325,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 436 "glcpp/glcpp-parse.y" +#line 458 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2315,7 +2337,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 442 "glcpp/glcpp-parse.y" +#line 464 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2326,7 +2348,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 450 "glcpp/glcpp-parse.y" +#line 472 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2336,7 +2358,7 @@ yyreduce: case 66: /* Line 1455 of yacc.c */ -#line 454 "glcpp/glcpp-parse.y" +#line 476 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2346,7 +2368,7 @@ yyreduce: case 67: /* Line 1455 of yacc.c */ -#line 458 "glcpp/glcpp-parse.y" +#line 480 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2356,7 +2378,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 462 "glcpp/glcpp-parse.y" +#line 484 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2366,7 +2388,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 466 "glcpp/glcpp-parse.y" +#line 488 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2376,224 +2398,224 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 473 "glcpp/glcpp-parse.y" +#line 495 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 71: /* Line 1455 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +#line 496 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 72: /* Line 1455 of yacc.c */ -#line 475 "glcpp/glcpp-parse.y" +#line 497 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 73: /* Line 1455 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +#line 498 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 74: /* Line 1455 of yacc.c */ -#line 477 "glcpp/glcpp-parse.y" +#line 499 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 75: /* Line 1455 of yacc.c */ -#line 478 "glcpp/glcpp-parse.y" +#line 500 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 76: /* Line 1455 of yacc.c */ -#line 479 "glcpp/glcpp-parse.y" +#line 501 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 77: /* Line 1455 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +#line 502 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 78: /* Line 1455 of yacc.c */ -#line 481 "glcpp/glcpp-parse.y" +#line 503 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 79: /* Line 1455 of yacc.c */ -#line 482 "glcpp/glcpp-parse.y" +#line 504 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 80: /* Line 1455 of yacc.c */ -#line 483 "glcpp/glcpp-parse.y" +#line 505 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +#line 506 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 82: /* Line 1455 of yacc.c */ -#line 485 "glcpp/glcpp-parse.y" +#line 507 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 83: /* Line 1455 of yacc.c */ -#line 486 "glcpp/glcpp-parse.y" +#line 508 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 84: /* Line 1455 of yacc.c */ -#line 487 "glcpp/glcpp-parse.y" +#line 509 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 85: /* Line 1455 of yacc.c */ -#line 488 "glcpp/glcpp-parse.y" +#line 510 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 86: /* Line 1455 of yacc.c */ -#line 489 "glcpp/glcpp-parse.y" +#line 511 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 490 "glcpp/glcpp-parse.y" +#line 512 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 491 "glcpp/glcpp-parse.y" +#line 513 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 492 "glcpp/glcpp-parse.y" +#line 514 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 90: /* Line 1455 of yacc.c */ -#line 493 "glcpp/glcpp-parse.y" +#line 515 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 91: /* Line 1455 of yacc.c */ -#line 494 "glcpp/glcpp-parse.y" +#line 516 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 92: /* Line 1455 of yacc.c */ -#line 495 "glcpp/glcpp-parse.y" +#line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 93: /* Line 1455 of yacc.c */ -#line 496 "glcpp/glcpp-parse.y" +#line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 94: /* Line 1455 of yacc.c */ -#line 497 "glcpp/glcpp-parse.y" +#line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 95: /* Line 1455 of yacc.c */ -#line 498 "glcpp/glcpp-parse.y" +#line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 96: /* Line 1455 of yacc.c */ -#line 499 "glcpp/glcpp-parse.y" +#line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 97: /* Line 1455 of yacc.c */ -#line 500 "glcpp/glcpp-parse.y" +#line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 98: /* Line 1455 of yacc.c */ -#line 501 "glcpp/glcpp-parse.y" +#line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 99: /* Line 1455 of yacc.c */ -#line 502 "glcpp/glcpp-parse.y" +#line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 100: /* Line 1455 of yacc.c */ -#line 503 "glcpp/glcpp-parse.y" +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1455 of yacc.c */ -#line 2597 "glcpp/glcpp-parse.c" +#line 2619 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2812,7 +2834,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 506 "glcpp/glcpp-parse.y" +#line 528 "glcpp/glcpp-parse.y" string_list_t * -- cgit v1.2.3 From 8485f4d9aa6d98304bb0197dc4f1f357d81d1daa Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 12:46:16 -0700 Subject: glcpp: Clean up intermediate file when test suite is interrupted. The glcpp-test script was leaving around bogus *.valgrind-errors files if a valgrind test was interrupted. --- src/glsl/glcpp/tests/glcpp-test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index c09e8a96b9..2dca848b4a 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -1,5 +1,7 @@ #!/bin/sh +trap 'rm $test.valgrind-errors; exit 1' INT QUIT + total=0 pass=0 clean=0 -- cgit v1.2.3 From 6dc89d221d43fad5f3edbb903997160af071bec0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 13:59:28 -0600 Subject: glsl2: remove trailing comma to silence warning --- src/glsl/ir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index d852a6a93b..eb9e6cdf0e 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -60,7 +60,7 @@ enum ir_node_type { ir_type_return, ir_type_swizzle, ir_type_texture, - ir_type_max, /**< maximum ir_type enum number, for validation */ + ir_type_max /**< maximum ir_type enum number, for validation */ }; /** -- cgit v1.2.3 From d1dda951c85f65612ed6fe080728f67fdc93d232 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 13:59:45 -0600 Subject: glsl2: move declarations before code --- src/glsl/glcpp/pp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 7aa1a968de..3adccf72aa 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -28,6 +28,8 @@ void glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) { + va_list ap; + parser->error = 1; parser->info_log = talloc_asprintf_append(parser->info_log, "%u:%u(%u): " @@ -35,7 +37,6 @@ glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) locp->source, locp->first_line, locp->first_column); - va_list ap; va_start(ap, fmt); parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); va_end(ap); @@ -45,13 +46,14 @@ glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) void glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) { + va_list ap; + parser->info_log = talloc_asprintf_append(parser->info_log, "%u:%u(%u): " "preprocessor warning: ", locp->source, locp->first_line, locp->first_column); - va_list ap; va_start(ap, fmt); parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); va_end(ap); -- cgit v1.2.3 From ffd3f15e965d451b1aef032015cc2edea66c30fa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:00:15 -0600 Subject: glsl2: add cast to silence warning --- src/glsl/ir_structure_splitting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index 9dc5941207..2f83896263 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -401,7 +401,7 @@ do_structure_splitting(exec_list *instructions) if (debug) { printf("structure %s@%p: decl %d, whole_access %d\n", - entry->var->name, entry->var, entry->declaration, + entry->var->name, (void *) entry->var, entry->declaration, entry->whole_structure_access); } -- cgit v1.2.3 From d3b66be3c7a3e9e29913ea86880c516e2b7a3ce0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:00:36 -0600 Subject: glsl2: added casts to silence warnings --- src/glsl/ir_print_visitor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 39b11bb32c..83e6403272 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -45,7 +45,7 @@ _mesa_print_ir(exec_list *instructions, const glsl_type *const s = state->user_structures[i]; printf("(structure (%s) (%s@%p) (%u) (\n", - s->name, s->name, s, s->length); + s->name, s->name, (void *) s, s->length); for (unsigned j = 0; j < s->length; j++) { printf("\t(("); @@ -83,7 +83,7 @@ print_type(const glsl_type *t) printf(" %u)", t->length); } else if ((t->base_type == GLSL_TYPE_STRUCT) && (strncmp("gl_", t->name, 3) != 0)) { - printf("%s@%p", t->name, t); + printf("%s@%p", t->name, (void *) t); } else { printf("%s", t->name); } @@ -104,7 +104,7 @@ void ir_print_visitor::visit(ir_variable *ir) cent, inv, mode[ir->mode], interp[ir->interpolation]); print_type(ir->type); - printf(" %s@%p)", ir->name, ir); + printf(" %s@%p)", ir->name, (void *) ir); } @@ -266,7 +266,7 @@ void ir_print_visitor::visit(ir_swizzle *ir) void ir_print_visitor::visit(ir_dereference_variable *ir) { ir_variable *var = ir->variable_referenced(); - printf("(var_ref %s@%p) ", var->name, var); + printf("(var_ref %s@%p) ", var->name, (void *) var); } -- cgit v1.2.3 From 9f9386d22aca8d14d1b1e6d4de9b24dcb183ca10 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Aug 2010 14:04:51 -0600 Subject: glsl2: added casts to silence warnings --- src/glsl/glsl_types.cpp | 4 ++-- src/glsl/ir_dead_code.cpp | 6 +++--- src/glsl/ir_validate.cpp | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 9b1bef6cb8..2aba1e0ac1 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -400,7 +400,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) * named 'foo'. */ char key[128]; - snprintf(key, sizeof(key), "%p[%u]", base, array_size); + snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); const glsl_type *t = (glsl_type *) hash_table_find(array_types, key); if (t == NULL) { @@ -458,7 +458,7 @@ glsl_type::record_key_hash(const void *a) break; size += snprintf(& hash_key[size], sizeof(hash_key) - size, - "%p", key->fields.structure[i].type); + "%p", (void *) key->fields.structure[i].type); } return hash_table_string_hash(& hash_key); diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index 87988871c7..fce921262f 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -64,7 +64,7 @@ do_dead_code(exec_list *instructions) if (debug) { printf("%s@%p: %d refs, %d assigns, %sdeclared in our scope\n", - entry->var->name, entry->var, + entry->var->name, (void *) entry->var, entry->referenced_count, entry->assigned_count, entry->declaration ? "" : "not "); } @@ -85,7 +85,7 @@ do_dead_code(exec_list *instructions) if (debug) { printf("Removed assignment to %s@%p\n", - entry->var->name, entry->var); + entry->var->name, (void *) entry->var); } } } else { @@ -97,7 +97,7 @@ do_dead_code(exec_list *instructions) if (debug) { printf("Removed declaration of %s@%p\n", - entry->var->name, entry->var); + entry->var->name, (void *) entry->var); } } } diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 545fe2799f..6e08fa4025 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -82,14 +82,14 @@ ir_validate::visit(ir_dereference_variable *ir) { if ((ir->var == NULL) || (ir->var->as_variable() == NULL)) { printf("ir_dereference_variable @ %p does not specify a variable %p\n", - ir, ir->var); + (void *) ir, (void *) ir->var); abort(); } if (hash_table_find(ht, ir->var) == NULL) { printf("ir_dereference_variable @ %p specifies undeclared variable " "`%s' @ %p\n", - ir, ir->var->name, ir->var); + (void *) ir, ir->var->name, (void *) ir->var); abort(); } @@ -122,8 +122,8 @@ ir_validate::visit_enter(ir_function *ir) printf("Function definition nested inside another function " "definition:\n"); printf("%s %p inside %s %p\n", - ir->name, ir, - this->current_function->name, this->current_function); + ir->name, (void *) ir, + this->current_function->name, (void *) this->current_function); abort(); } @@ -154,9 +154,9 @@ ir_validate::visit_enter(ir_function_signature *ir) printf("Function signature nested inside wrong function " "definition:\n"); printf("%p inside %s %p instead of %s %p\n", - ir, - this->current_function->name, this->current_function, - ir->function_name(), ir->function()); + (void *) ir, + this->current_function->name, (void *) this->current_function, + ir->function_name(), (void *) ir->function()); abort(); } -- cgit v1.2.3 From 2bcff4c879acec31ef0b39ecf04e9df41c5cbfab Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:06:36 -0700 Subject: glcpp-test: Capture the stderr output of the preprocessor. This allows writing tests that verify diagnostics from the preprocessor. --- src/glsl/glcpp/tests/glcpp-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test index 2dca848b4a..6494d0c0e7 100755 --- a/src/glsl/glcpp/tests/glcpp-test +++ b/src/glsl/glcpp/tests/glcpp-test @@ -9,7 +9,7 @@ clean=0 echo "====== Testing for correctness ======" for test in *.c; do echo -n "Testing $test..." - ../glcpp < $test > $test.out + ../glcpp < $test > $test.out 2>&1 total=$((total+1)) if cmp $test.expected $test.out >/dev/null 2>&1; then echo "PASS" -- cgit v1.2.3 From bc64b8980803a5ba1cc91c63dc2ed1517db800c6 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:09:14 -0700 Subject: glcpp: Initialize line and column numbers to 1, not 0. Error messages make more sense this way since the convention is for the first line of a file to be numbered from 1, rather than 0. --- src/glsl/glcpp/glcpp-lex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 1a0052d689..fa62891354 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -43,7 +43,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); yylloc->first_line = yylineno; \ yycolumn += yyleng; \ } while(0); -#define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define YY_USER_INIT yylineno = 1; yycolumn = 1; %} %option bison-bridge bison-locations reentrant noyywrap -- cgit v1.2.3 From 5a6285cc862df35ef5275c3858f833e0807dee14 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:13:41 -0700 Subject: glcpp: Regenerate glcpp-lex.c After a recent change to glcpp-lex.l --- src/glsl/glcpp/glcpp-lex.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index d976904135..bdb3b2c11b 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -54,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -158,7 +159,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -680,9 +689,9 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); yylloc->first_line = yylineno; \ yycolumn += yyleng; \ } while(0); -#define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define YY_USER_INIT yylineno = 1; yycolumn = 1; -#line 686 "glcpp/glcpp-lex.c" +#line 695 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -837,7 +846,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -845,7 +859,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -856,7 +870,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -948,7 +962,7 @@ YY_DECL /* Single-line comments */ -#line 952 "glcpp/glcpp-lex.c" +#line 966 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1428,7 +1442,7 @@ YY_RULE_SETUP #line 286 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1432 "glcpp/glcpp-lex.c" +#line 1446 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -2167,8 +2181,8 @@ YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -- cgit v1.2.3 From cb5ea0c79bd74ea6263d54302ed19c243ceb05de Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:48:13 -0700 Subject: glcpp: Add several tests for diagnostics. Which are proving to be useful since some of these tests are not yet acting as desired, (in particular, the unterminated if test is not generating any diagnostic). --- src/glsl/glcpp/tests/070-undefined-macro-in-expression.c | 2 ++ .../glcpp/tests/070-undefined-macro-in-expression.c.expected | 2 ++ src/glsl/glcpp/tests/077-else-without-if.c | 1 + src/glsl/glcpp/tests/077-else-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/078-elif-without-if.c | 1 + src/glsl/glcpp/tests/078-elif-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/079-endif-without-if.c | 1 + src/glsl/glcpp/tests/079-endif-without-if.c.expected | 4 ++++ src/glsl/glcpp/tests/080-if-without-expression.c | 4 ++++ src/glsl/glcpp/tests/080-if-without-expression.c.expected | 3 +++ src/glsl/glcpp/tests/081-elif-without-expression.c | 3 +++ src/glsl/glcpp/tests/081-elif-without-expression.c.expected | 6 ++++++ src/glsl/glcpp/tests/082-invalid-paste.c | 2 ++ src/glsl/glcpp/tests/082-invalid-paste.c.expected | 5 +++++ src/glsl/glcpp/tests/083-unterminated-if.c | 2 ++ src/glsl/glcpp/tests/084-unbalanced-parentheses.c | 2 ++ src/glsl/glcpp/tests/085-incorrect-argument-count.c | 5 +++++ src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected | 12 ++++++++++++ src/glsl/glcpp/tests/086-reserved-macro-names.c | 2 ++ src/glsl/glcpp/tests/086-reserved-macro-names.c.expected | 7 +++++++ 20 files changed, 72 insertions(+) create mode 100644 src/glsl/glcpp/tests/070-undefined-macro-in-expression.c create mode 100644 src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected create mode 100644 src/glsl/glcpp/tests/077-else-without-if.c create mode 100644 src/glsl/glcpp/tests/077-else-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/078-elif-without-if.c create mode 100644 src/glsl/glcpp/tests/078-elif-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/079-endif-without-if.c create mode 100644 src/glsl/glcpp/tests/079-endif-without-if.c.expected create mode 100644 src/glsl/glcpp/tests/080-if-without-expression.c create mode 100644 src/glsl/glcpp/tests/080-if-without-expression.c.expected create mode 100644 src/glsl/glcpp/tests/081-elif-without-expression.c create mode 100644 src/glsl/glcpp/tests/081-elif-without-expression.c.expected create mode 100644 src/glsl/glcpp/tests/082-invalid-paste.c create mode 100644 src/glsl/glcpp/tests/082-invalid-paste.c.expected create mode 100644 src/glsl/glcpp/tests/083-unterminated-if.c create mode 100644 src/glsl/glcpp/tests/084-unbalanced-parentheses.c create mode 100644 src/glsl/glcpp/tests/085-incorrect-argument-count.c create mode 100644 src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected create mode 100644 src/glsl/glcpp/tests/086-reserved-macro-names.c create mode 100644 src/glsl/glcpp/tests/086-reserved-macro-names.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c new file mode 100644 index 0000000000..b6dc2ba075 --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c @@ -0,0 +1,2 @@ +#if UNDEFINED_MACRO +#endif diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected new file mode 100644 index 0000000000..2bb38a1411 --- /dev/null +++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected @@ -0,0 +1,2 @@ +0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER + diff --git a/src/glsl/glcpp/tests/077-else-without-if.c b/src/glsl/glcpp/tests/077-else-without-if.c new file mode 100644 index 0000000000..81f00bfe27 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c @@ -0,0 +1 @@ +#else diff --git a/src/glsl/glcpp/tests/077-else-without-if.c.expected b/src/glsl/glcpp/tests/077-else-without-if.c.expected new file mode 100644 index 0000000000..d289b36356 --- /dev/null +++ b/src/glsl/glcpp/tests/077-else-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: else without #if + + + diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c b/src/glsl/glcpp/tests/078-elif-without-if.c new file mode 100644 index 0000000000..60466b3890 --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c @@ -0,0 +1 @@ +#elif defined FOO diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/glsl/glcpp/tests/078-elif-without-if.c.expected new file mode 100644 index 0000000000..7d41f0ac79 --- /dev/null +++ b/src/glsl/glcpp/tests/078-elif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: elif without #if + + + diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c b/src/glsl/glcpp/tests/079-endif-without-if.c new file mode 100644 index 0000000000..69331c3ca9 --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c @@ -0,0 +1 @@ +#endif diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/glsl/glcpp/tests/079-endif-without-if.c.expected new file mode 100644 index 0000000000..08dd33546f --- /dev/null +++ b/src/glsl/glcpp/tests/079-endif-without-if.c.expected @@ -0,0 +1,4 @@ +0:1(2): preprocessor error: #endif without #if + + + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c b/src/glsl/glcpp/tests/080-if-without-expression.c new file mode 100644 index 0000000000..a27ba36a36 --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c @@ -0,0 +1,4 @@ +/* Error message for unskipped #if with no expression. */ +#if +#endif + diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected new file mode 100644 index 0000000000..1a3e383e9a --- /dev/null +++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected @@ -0,0 +1,3 @@ +0:2(1): preprocessor error: #if with no expression + + diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c b/src/glsl/glcpp/tests/081-elif-without-expression.c new file mode 100644 index 0000000000..79c78663dd --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c @@ -0,0 +1,3 @@ +#if 0 +#elif +#endif diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected new file mode 100644 index 0000000000..37dcdc3238 --- /dev/null +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected @@ -0,0 +1,6 @@ +0:2(1): preprocessor error: #elif with no expression + + + + + diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c b/src/glsl/glcpp/tests/082-invalid-paste.c new file mode 100644 index 0000000000..40bf64411c --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c @@ -0,0 +1,2 @@ +#define PASTE(x,y) x ## y +PASTE(<,>) diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c.expected b/src/glsl/glcpp/tests/082-invalid-paste.c.expected new file mode 100644 index 0000000000..2c924406b5 --- /dev/null +++ b/src/glsl/glcpp/tests/082-invalid-paste.c.expected @@ -0,0 +1,5 @@ +0:2(7): preprocessor error: +Pasting "<" and ">" does not give a valid preprocessing token. + +< + diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c b/src/glsl/glcpp/tests/083-unterminated-if.c new file mode 100644 index 0000000000..9180635092 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c @@ -0,0 +1,2 @@ +#if 1 + diff --git a/src/glsl/glcpp/tests/084-unbalanced-parentheses.c b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c new file mode 100644 index 0000000000..0789ba5e52 --- /dev/null +++ b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c @@ -0,0 +1,2 @@ +#define FUNC(x) (2*(x)) +FUNC(23 diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c b/src/glsl/glcpp/tests/085-incorrect-argument-count.c new file mode 100644 index 0000000000..91bea60061 --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c @@ -0,0 +1,5 @@ +#define MULT(x,y) ((x)*(y)) +MULT() +MULT(1) +MULT(1,2,3) + diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected new file mode 100644 index 0000000000..1df30cbb56 --- /dev/null +++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected @@ -0,0 +1,12 @@ +0:2(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:3(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2) + +0:4(1): preprocessor error: Error: macro MULT invoked with 3 arguments (expected 2) + + +MULT() +MULT(1) +MULT(1,2,3) + + diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c b/src/glsl/glcpp/tests/086-reserved-macro-names.c new file mode 100644 index 0000000000..fd0c29f0c4 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c @@ -0,0 +1,2 @@ +#define __BAD reserved +#define GL_ALSO_BAD() also reserved diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected new file mode 100644 index 0000000000..6a9df68268 --- /dev/null +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected @@ -0,0 +1,7 @@ +0:1(10): preprocessor error: Macro names starting with "__" are reserved. + +0:2(9): preprocessor error: Macro names starting with "GL_" are reserved. + + + + -- cgit v1.2.3 From 624dd585c72103e5bffbc600cdf7bdfba5305a15 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:50:51 -0700 Subject: glcpp: Reword diagnostic for #elif with no expression Rather than telling the user what to fix, the standard convention is to describe what the detected problem is. With this change, test 081-elif-without-expression now passes. --- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/glcpp/tests/081-elif-without-expression.c.expected | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 498d018764..05bb7ca48b 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1950,7 +1950,7 @@ yyreduce: if (parser->skip_stack && parser->skip_stack->type == SKIP_TO_ELSE) { - glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif needs an expression"); + glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif with no expression"); } else { diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 643c449d0e..795030ecfe 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -276,7 +276,7 @@ control_line: if (parser->skip_stack && parser->skip_stack->type == SKIP_TO_ELSE) { - glcpp_error(& @1, parser, "#elif needs an expression"); + glcpp_error(& @1, parser, "#elif with no expression"); } else { diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected index 37dcdc3238..974f0f550e 100644 --- a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected +++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected @@ -3,4 +3,3 @@ - -- cgit v1.2.3 From 253cad3f424f71f6984431e5edbde1694ccfae3f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 13:59:22 -0700 Subject: glcpp: Add an explicit diagnostic for #if with no expression. This is more clear than the previously-generated diagnostic which was something confusing like "enexpected newline". This change makse test 080-if-witout-expression.c now pass. --- src/glsl/glcpp/glcpp-parse.y | 10 ++++++++++ src/glsl/glcpp/tests/080-if-without-expression.c.expected | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 795030ecfe..0e0d9d412b 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -241,6 +241,16 @@ control_line: parser->skip_stack->type = SKIP_TO_ENDIF; } } +| HASH_IF NEWLINE { + /* #if without an expression is only an error if we + * are not skipping */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + glcpp_error(& @1, parser, "#if with no expression"); + } + _glcpp_parser_skip_stack_push_if (parser, & @1, 0); + } | HASH_IFDEF IDENTIFIER junk NEWLINE { macro_t *macro = hash_table_find (parser->defines, $2); talloc_free ($2); diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected index 1a3e383e9a..768ba0f473 100644 --- a/src/glsl/glcpp/tests/080-if-without-expression.c.expected +++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected @@ -1,3 +1,6 @@ 0:2(1): preprocessor error: #if with no expression - + + + + -- cgit v1.2.3 From 6b9e7b034ca5d10cd367a2388c5439cdb10a1a68 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 14:00:21 -0700 Subject: glccp: Regenerate glcpp-parse.c Due to a recent change to glcpp-parse.y. --- src/glsl/glcpp/glcpp-parse.c | 769 ++++++++++++++++++++++--------------------- 1 file changed, 393 insertions(+), 376 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 05bb7ca48b..fe7549e5c5 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -517,16 +517,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 604 +#define YYLAST 606 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 57 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 17 /* YYNRULES -- Number of rules. */ -#define YYNRULES 100 +#define YYNRULES 101 /* YYNRULES -- Number of states. */ -#define YYNSTATES 161 +#define YYNSTATES 162 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -575,16 +575,16 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 13, 16, 20, - 24, 29, 36, 44, 48, 52, 57, 62, 66, 69, - 72, 75, 79, 82, 84, 86, 88, 92, 96, 100, - 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, - 144, 148, 152, 156, 160, 163, 166, 169, 172, 176, - 178, 182, 184, 187, 190, 191, 193, 194, 196, 199, - 204, 206, 208, 211, 213, 216, 218, 220, 222, 224, - 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, - 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, - 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, - 286 + 24, 29, 36, 44, 48, 52, 55, 60, 65, 69, + 72, 75, 78, 82, 85, 87, 89, 91, 95, 99, + 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, + 143, 147, 151, 155, 159, 163, 166, 169, 172, 175, + 179, 181, 185, 187, 190, 193, 194, 196, 197, 199, + 202, 207, 209, 211, 214, 216, 219, 221, 223, 225, + 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, + 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, + 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, + 287, 289 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -595,46 +595,47 @@ static const yytype_int8 yyrhs[] = 5, 63, 21, -1, 8, 17, 67, 21, -1, 7, 17, 45, 46, 67, 21, -1, 7, 17, 45, 64, 46, 67, 21, -1, 15, 17, 21, -1, 12, 70, - 21, -1, 13, 17, 68, 21, -1, 14, 17, 68, - 21, -1, 9, 70, 21, -1, 9, 21, -1, 10, - 21, -1, 11, 21, -1, 16, 62, 21, -1, 6, - 21, -1, 20, -1, 19, -1, 62, -1, 63, 26, - 63, -1, 63, 27, 63, -1, 63, 28, 63, -1, - 63, 29, 63, -1, 63, 30, 63, -1, 63, 31, - 63, -1, 63, 32, 63, -1, 63, 35, 63, -1, - 63, 36, 63, -1, 63, 34, 63, -1, 63, 33, - 63, -1, 63, 37, 63, -1, 63, 38, 63, -1, - 63, 40, 63, -1, 63, 39, 63, -1, 63, 43, - 63, -1, 63, 42, 63, -1, 63, 41, 63, -1, - 47, 63, -1, 48, 63, -1, 40, 63, -1, 39, - 63, -1, 45, 63, 46, -1, 17, -1, 64, 49, - 17, -1, 21, -1, 71, 21, -1, 71, 21, -1, - -1, 71, -1, -1, 71, -1, 4, 17, -1, 4, - 45, 17, 46, -1, 72, -1, 69, -1, 70, 69, - -1, 72, -1, 71, 72, -1, 17, -1, 20, -1, - 73, -1, 22, -1, 24, -1, 50, -1, 51, -1, - 45, -1, 46, -1, 52, -1, 53, -1, 54, -1, - 30, -1, 41, -1, 39, -1, 40, -1, 48, -1, - 47, -1, 42, -1, 43, -1, 38, -1, 37, -1, - 33, -1, 34, -1, 36, -1, 35, -1, 32, -1, - 31, -1, 29, -1, 28, -1, 27, -1, 26, -1, - 55, -1, 49, -1, 56, -1, 25, -1 + 21, -1, 12, 21, -1, 13, 17, 68, 21, -1, + 14, 17, 68, 21, -1, 9, 70, 21, -1, 9, + 21, -1, 10, 21, -1, 11, 21, -1, 16, 62, + 21, -1, 6, 21, -1, 20, -1, 19, -1, 62, + -1, 63, 26, 63, -1, 63, 27, 63, -1, 63, + 28, 63, -1, 63, 29, 63, -1, 63, 30, 63, + -1, 63, 31, 63, -1, 63, 32, 63, -1, 63, + 35, 63, -1, 63, 36, 63, -1, 63, 34, 63, + -1, 63, 33, 63, -1, 63, 37, 63, -1, 63, + 38, 63, -1, 63, 40, 63, -1, 63, 39, 63, + -1, 63, 43, 63, -1, 63, 42, 63, -1, 63, + 41, 63, -1, 47, 63, -1, 48, 63, -1, 40, + 63, -1, 39, 63, -1, 45, 63, 46, -1, 17, + -1, 64, 49, 17, -1, 21, -1, 71, 21, -1, + 71, 21, -1, -1, 71, -1, -1, 71, -1, 4, + 17, -1, 4, 45, 17, 46, -1, 72, -1, 69, + -1, 70, 69, -1, 72, -1, 71, 72, -1, 17, + -1, 20, -1, 73, -1, 22, -1, 24, -1, 50, + -1, 51, -1, 45, -1, 46, -1, 52, -1, 53, + -1, 54, -1, 30, -1, 41, -1, 39, -1, 40, + -1, 48, -1, 47, -1, 42, -1, 43, -1, 38, + -1, 37, -1, 33, -1, 34, -1, 36, -1, 35, + -1, 32, -1, 31, -1, 29, -1, 28, -1, 27, + -1, 26, -1, 55, -1, 49, -1, 56, -1, 25, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 180, 180, 182, 186, 189, 194, 195, 199, 202, - 208, 211, 214, 217, 225, 244, 249, 254, 273, 288, - 291, 294, 303, 307, 316, 321, 322, 325, 328, 331, - 334, 337, 340, 343, 346, 349, 352, 355, 358, 361, - 364, 367, 370, 373, 376, 379, 382, 385, 388, 394, - 399, 407, 408, 412, 418, 419, 422, 424, 431, 435, - 439, 444, 450, 458, 464, 472, 476, 480, 484, 488, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, - 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525 + 208, 211, 214, 217, 225, 244, 254, 259, 264, 283, + 298, 301, 304, 313, 317, 326, 331, 332, 335, 338, + 341, 344, 347, 350, 353, 356, 359, 362, 365, 368, + 371, 374, 377, 380, 383, 386, 389, 392, 395, 398, + 404, 409, 417, 418, 422, 428, 429, 432, 434, 441, + 445, 449, 454, 460, 468, 474, 482, 486, 490, 494, + 498, 505, 506, 507, 508, 509, 510, 511, 512, 513, + 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, + 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, + 534, 535 }; #endif @@ -678,31 +679,31 @@ static const yytype_uint8 yyr1[] = { 0, 57, 58, 58, 59, 59, 59, 59, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 62, 62, 63, 63, 63, 63, 63, + 61, 61, 61, 61, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, - 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, - 69, 70, 70, 71, 71, 72, 72, 72, 72, 72, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, + 69, 69, 70, 70, 71, 71, 72, 72, 72, 72, + 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73 + 73, 73 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 2, 3, 3, - 4, 6, 7, 3, 3, 4, 4, 3, 2, 2, - 2, 3, 2, 1, 1, 1, 3, 3, 3, 3, + 4, 6, 7, 3, 3, 2, 4, 4, 3, 2, + 2, 2, 3, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 2, 2, 3, 1, - 3, 1, 2, 2, 0, 1, 0, 1, 2, 4, - 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, + 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, + 1, 3, 1, 2, 2, 0, 1, 0, 1, 2, + 4, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1 + 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -711,60 +712,60 @@ static const yytype_uint8 yyr2[] = static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 65, 0, 66, 51, 68, - 69, 100, 96, 95, 94, 93, 77, 92, 91, 87, - 88, 90, 89, 86, 85, 79, 80, 78, 83, 84, - 72, 73, 82, 81, 98, 70, 71, 74, 75, 76, - 97, 99, 3, 6, 4, 5, 0, 63, 67, 24, - 23, 0, 0, 0, 0, 0, 25, 0, 22, 7, - 0, 0, 54, 0, 18, 61, 0, 60, 19, 20, - 0, 56, 56, 0, 0, 0, 52, 64, 47, 46, - 0, 44, 45, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 66, 0, 67, 52, 69, + 70, 101, 97, 96, 95, 94, 78, 93, 92, 88, + 89, 91, 90, 87, 86, 80, 81, 79, 84, 85, + 73, 74, 83, 82, 99, 71, 72, 75, 76, 77, + 98, 100, 3, 6, 4, 5, 0, 64, 68, 25, + 24, 0, 0, 0, 0, 0, 26, 0, 23, 7, + 0, 0, 55, 0, 19, 62, 0, 61, 20, 21, + 15, 0, 57, 57, 0, 0, 0, 53, 65, 48, + 47, 0, 45, 46, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 53, 0, 0, 55, 58, 0, 17, 62, - 14, 0, 57, 0, 13, 21, 8, 48, 26, 27, - 28, 29, 30, 31, 32, 36, 35, 33, 34, 37, - 38, 40, 39, 43, 42, 41, 49, 54, 0, 10, - 0, 15, 16, 0, 54, 0, 59, 11, 0, 50, - 12 + 0, 0, 0, 54, 0, 0, 56, 59, 0, 18, + 63, 14, 0, 58, 0, 13, 22, 8, 49, 27, + 28, 29, 30, 31, 32, 33, 37, 36, 34, 35, + 38, 39, 41, 40, 44, 43, 42, 50, 55, 0, + 10, 0, 16, 17, 0, 55, 0, 60, 11, 0, + 51, 12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 1, 52, 53, 54, 66, 67, 148, 55, 69, - 114, 121, 75, 76, 115, 57, 58 + -1, 1, 52, 53, 54, 66, 67, 149, 55, 69, + 115, 122, 75, 76, 116, 57, 58 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -146 +#define YYPACT_NINF -147 static const yytype_int16 yypact[] = { - -146, 111, -146, 429, -10, -9, -4, 151, -15, 27, - 271, 54, 63, 86, 82, -146, 429, -146, -146, -146, - -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, - -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, - -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, - -146, -146, -146, -146, -146, -146, 311, -146, -146, -146, - -146, 429, 429, 429, 429, 429, -146, 452, -146, -146, - 351, 59, 391, 17, -146, -146, 191, -146, -146, -146, - 231, 391, 391, 84, 85, 475, -146, -146, -146, -146, - 424, -146, -146, -146, 429, 429, 429, 429, 429, 429, - 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, - 429, 429, -146, 30, 88, 391, -146, 90, -146, -146, - -146, 89, 391, 91, -146, -146, -146, -146, 492, 508, - 523, 537, 550, 561, 561, 18, 18, 18, 18, 25, - 25, 36, 36, -146, -146, -146, -146, 391, 26, -146, - 67, -146, -146, 93, 391, 113, -146, -146, 148, -146, - -146 + -147, 112, -147, 28, -10, 55, 62, 152, -15, 59, + 192, 85, 86, 87, 51, -147, 28, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, 312, -147, -147, -147, + -147, 28, 28, 28, 28, 28, -147, 428, -147, -147, + 352, 63, 392, 17, -147, -147, 232, -147, -147, -147, + -147, 272, 392, 392, 84, 89, 451, -147, -147, -147, + -147, 469, -147, -147, -147, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, -147, 60, 90, 392, -147, 96, -147, + -147, -147, 93, 392, 94, -147, -147, -147, -147, 489, + 505, 520, 534, 547, 558, 558, 18, 18, 18, 18, + 563, 563, 23, 23, -147, -147, -147, -147, 392, 32, + -147, 61, -147, -147, 110, 392, 118, -147, -147, 149, + -147, -147 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -146, -146, -146, -146, -146, 120, -11, -146, -146, -146, - -145, 92, -6, 160, 0, -7, -146 + -147, -147, -147, -147, -147, 157, -11, -147, -147, -147, + -146, 92, -68, 200, 0, -7, -147 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -774,132 +775,132 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 77, 56, 153, 77, 70, 85, 78, 15, 71, 158, - 17, 68, 19, 72, 20, 21, 22, 23, 24, 25, + 77, 56, 154, 77, 70, 86, 78, 15, 120, 159, + 17, 68, 19, 120, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 116, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 146, 79, 87, - 88, 89, 90, 91, 92, 105, 106, 107, 108, 109, - 110, 111, 117, 87, 107, 108, 109, 110, 111, 77, - 119, 81, 154, 77, 119, 155, 147, 109, 110, 111, - 82, 122, 122, 128, 129, 130, 131, 132, 133, 134, + 36, 37, 38, 39, 117, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 59, 60, 88, + 89, 90, 91, 92, 93, 106, 107, 108, 109, 110, + 111, 112, 118, 88, 110, 111, 112, 61, 62, 77, + 59, 60, 71, 63, 77, 64, 65, 147, 155, 72, + 79, 156, 123, 123, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 59, 60, 83, 113, 124, 125, 150, 87, 149, - 151, 2, 152, 156, 157, 87, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 159, 17, 18, 19, 84, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 160, - 80, 17, 74, 19, 123, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 118, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 120, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 73, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 0, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 86, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 112, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 15, 0, - 0, 17, 0, 19, 0, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 0, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 59, 60, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 61, 62, - 127, 0, 0, 93, 63, 0, 64, 65, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 126, 0, 0, 0, - 0, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 98, 99, 100, + 145, 146, 82, 83, 84, 125, 148, 157, 114, 88, + 126, 150, 2, 151, 152, 153, 88, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 158, 17, 18, 19, 160, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 161, 85, 17, 74, 19, 124, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 81, 0, 17, 80, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 119, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 121, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 87, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 113, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 0, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 94, + 0, 0, 0, 0, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111 + 111, 112, 127, 0, 0, 0, 0, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 0, 0, 128, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 108, 109, 110, 111, 112 }; static const yytype_int16 yycheck[] = { - 7, 1, 147, 10, 4, 16, 21, 17, 17, 154, - 20, 21, 22, 17, 24, 25, 26, 27, 28, 29, + 7, 1, 148, 10, 4, 16, 21, 17, 76, 155, + 20, 21, 22, 81, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 17, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 17, 21, 56, + 50, 51, 52, 53, 54, 55, 56, 19, 20, 56, 61, 62, 63, 64, 65, 37, 38, 39, 40, 41, - 42, 43, 45, 70, 39, 40, 41, 42, 43, 76, - 76, 17, 46, 80, 80, 49, 46, 41, 42, 43, - 17, 81, 82, 94, 95, 96, 97, 98, 99, 100, + 42, 43, 45, 70, 41, 42, 43, 39, 40, 76, + 19, 20, 17, 45, 81, 47, 48, 17, 46, 17, + 21, 49, 82, 83, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 19, 20, 17, 45, 21, 21, 17, 115, 21, - 21, 0, 21, 46, 21, 122, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 17, 20, 21, 22, 14, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, 21, - 10, 20, 21, 22, 82, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 4, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, -1, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 17, -1, - -1, 20, -1, 22, -1, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 19, 20, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 39, 40, - 46, -1, -1, 21, 45, -1, 47, 48, 26, 27, + 111, 112, 17, 17, 17, 21, 46, 46, 45, 116, + 21, 21, 0, 17, 21, 21, 123, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 21, 20, 21, 22, 17, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + 21, 14, 20, 21, 22, 83, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 21, -1, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 27, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + 10, -1, 20, 21, 22, -1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 28, 29, 30, 31, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, -1, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 21, + -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 30, 31, 32, + 42, 43, 21, -1, -1, -1, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, -1, -1, 46, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43 + 43, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 39, 40, 41, 42, 43 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -914,15 +915,15 @@ static const yytype_uint8 yystos[] = 55, 56, 59, 60, 61, 65, 71, 72, 73, 19, 20, 39, 40, 45, 47, 48, 62, 63, 21, 66, 71, 17, 17, 4, 21, 69, 70, 72, 21, 21, - 70, 17, 17, 17, 62, 63, 21, 72, 63, 63, - 63, 63, 63, 21, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 21, 45, 67, 71, 17, 45, 21, 69, - 21, 68, 71, 68, 21, 21, 21, 46, 63, 63, + 21, 70, 17, 17, 17, 62, 63, 21, 72, 63, + 63, 63, 63, 63, 21, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 21, 45, 67, 71, 17, 45, 21, + 69, 21, 68, 71, 68, 21, 21, 21, 46, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 17, 46, 64, 21, - 17, 21, 21, 67, 46, 49, 46, 21, 67, 17, - 21 + 63, 63, 63, 63, 63, 63, 63, 17, 46, 64, + 21, 17, 21, 21, 67, 46, 49, 46, 21, 67, + 17, 21 }; #define yyerrok (yyerrstatus = 0) @@ -1604,7 +1605,7 @@ YYLTYPE yylloc; } /* Line 1242 of yacc.c */ -#line 1608 "glcpp/glcpp-parse.c" +#line 1609 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1897,6 +1898,22 @@ yyreduce: /* Line 1455 of yacc.c */ #line 244 "glcpp/glcpp-parse.y" + { + /* #if without an expression is only an error if we + * are not skipping */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + glcpp_error(& (yylsp[(1) - (2)]), parser, "#if with no expression"); + } + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (2)]), 0); + ;} + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 254 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1904,10 +1921,10 @@ yyreduce: ;} break; - case 16: + case 17: /* Line 1455 of yacc.c */ -#line 249 "glcpp/glcpp-parse.y" +#line 259 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1915,10 +1932,10 @@ yyreduce: ;} break; - case 17: + case 18: /* Line 1455 of yacc.c */ -#line 254 "glcpp/glcpp-parse.y" +#line 264 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression * if we are not skipping. When we are skipping, we @@ -1940,10 +1957,10 @@ yyreduce: ;} break; - case 18: + case 19: /* Line 1455 of yacc.c */ -#line 273 "glcpp/glcpp-parse.y" +#line 283 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we * are skipping. */ @@ -1961,28 +1978,28 @@ yyreduce: ;} break; - case 19: + case 20: /* Line 1455 of yacc.c */ -#line 288 "glcpp/glcpp-parse.y" +#line 298 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} break; - case 20: + case 21: /* Line 1455 of yacc.c */ -#line 291 "glcpp/glcpp-parse.y" +#line 301 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} break; - case 21: + case 22: /* Line 1455 of yacc.c */ -#line 294 "glcpp/glcpp-parse.y" +#line 304 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -1994,10 +2011,10 @@ yyreduce: ;} break; - case 23: + case 24: /* Line 1455 of yacc.c */ -#line 307 "glcpp/glcpp-parse.y" +#line 317 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -2009,226 +2026,226 @@ yyreduce: ;} break; - case 24: + case 25: /* Line 1455 of yacc.c */ -#line 316 "glcpp/glcpp-parse.y" +#line 326 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 26: + case 27: /* Line 1455 of yacc.c */ -#line 322 "glcpp/glcpp-parse.y" +#line 332 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} break; - case 27: + case 28: /* Line 1455 of yacc.c */ -#line 325 "glcpp/glcpp-parse.y" +#line 335 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} break; - case 28: + case 29: /* Line 1455 of yacc.c */ -#line 328 "glcpp/glcpp-parse.y" +#line 338 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 29: + case 30: /* Line 1455 of yacc.c */ -#line 331 "glcpp/glcpp-parse.y" +#line 341 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} break; - case 30: + case 31: /* Line 1455 of yacc.c */ -#line 334 "glcpp/glcpp-parse.y" +#line 344 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} break; - case 31: + case 32: /* Line 1455 of yacc.c */ -#line 337 "glcpp/glcpp-parse.y" +#line 347 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} break; - case 32: + case 33: /* Line 1455 of yacc.c */ -#line 340 "glcpp/glcpp-parse.y" +#line 350 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} break; - case 33: + case 34: /* Line 1455 of yacc.c */ -#line 343 "glcpp/glcpp-parse.y" +#line 353 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} break; - case 34: + case 35: /* Line 1455 of yacc.c */ -#line 346 "glcpp/glcpp-parse.y" +#line 356 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} break; - case 35: + case 36: /* Line 1455 of yacc.c */ -#line 349 "glcpp/glcpp-parse.y" +#line 359 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} break; - case 36: + case 37: /* Line 1455 of yacc.c */ -#line 352 "glcpp/glcpp-parse.y" +#line 362 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} break; - case 37: + case 38: /* Line 1455 of yacc.c */ -#line 355 "glcpp/glcpp-parse.y" +#line 365 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} break; - case 38: + case 39: /* Line 1455 of yacc.c */ -#line 358 "glcpp/glcpp-parse.y" +#line 368 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} break; - case 39: + case 40: /* Line 1455 of yacc.c */ -#line 361 "glcpp/glcpp-parse.y" +#line 371 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} break; - case 40: + case 41: /* Line 1455 of yacc.c */ -#line 364 "glcpp/glcpp-parse.y" +#line 374 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} break; - case 41: + case 42: /* Line 1455 of yacc.c */ -#line 367 "glcpp/glcpp-parse.y" +#line 377 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} break; - case 42: + case 43: /* Line 1455 of yacc.c */ -#line 370 "glcpp/glcpp-parse.y" +#line 380 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} break; - case 43: + case 44: /* Line 1455 of yacc.c */ -#line 373 "glcpp/glcpp-parse.y" +#line 383 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} break; - case 44: + case 45: /* Line 1455 of yacc.c */ -#line 376 "glcpp/glcpp-parse.y" +#line 386 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} break; - case 45: + case 46: /* Line 1455 of yacc.c */ -#line 379 "glcpp/glcpp-parse.y" +#line 389 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} break; - case 46: + case 47: /* Line 1455 of yacc.c */ -#line 382 "glcpp/glcpp-parse.y" +#line 392 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} break; - case 47: + case 48: /* Line 1455 of yacc.c */ -#line 385 "glcpp/glcpp-parse.y" +#line 395 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} break; - case 48: + case 49: /* Line 1455 of yacc.c */ -#line 388 "glcpp/glcpp-parse.y" +#line 398 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} break; - case 49: + case 50: /* Line 1455 of yacc.c */ -#line 394 "glcpp/glcpp-parse.y" +#line 404 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2236,10 +2253,10 @@ yyreduce: ;} break; - case 50: + case 51: /* Line 1455 of yacc.c */ -#line 399 "glcpp/glcpp-parse.y" +#line 409 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2247,62 +2264,62 @@ yyreduce: ;} break; - case 51: + case 52: /* Line 1455 of yacc.c */ -#line 407 "glcpp/glcpp-parse.y" +#line 417 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; - case 53: + case 54: /* Line 1455 of yacc.c */ -#line 412 "glcpp/glcpp-parse.y" +#line 422 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} break; - case 54: + case 55: /* Line 1455 of yacc.c */ -#line 418 "glcpp/glcpp-parse.y" +#line 428 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; - case 57: + case 58: /* Line 1455 of yacc.c */ -#line 424 "glcpp/glcpp-parse.y" +#line 434 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} break; - case 58: + case 59: /* Line 1455 of yacc.c */ -#line 431 "glcpp/glcpp-parse.y" +#line 441 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); ;} break; - case 59: + case 60: /* Line 1455 of yacc.c */ -#line 435 "glcpp/glcpp-parse.y" +#line 445 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); ;} break; - case 61: + case 62: /* Line 1455 of yacc.c */ -#line 444 "glcpp/glcpp-parse.y" +#line 454 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2311,10 +2328,10 @@ yyreduce: ;} break; - case 62: + case 63: /* Line 1455 of yacc.c */ -#line 450 "glcpp/glcpp-parse.y" +#line 460 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2322,10 +2339,10 @@ yyreduce: ;} break; - case 63: + case 64: /* Line 1455 of yacc.c */ -#line 458 "glcpp/glcpp-parse.y" +#line 468 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2334,10 +2351,10 @@ yyreduce: ;} break; - case 64: + case 65: /* Line 1455 of yacc.c */ -#line 464 "glcpp/glcpp-parse.y" +#line 474 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2345,277 +2362,277 @@ yyreduce: ;} break; - case 65: + case 66: /* Line 1455 of yacc.c */ -#line 472 "glcpp/glcpp-parse.y" +#line 482 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 66: + case 67: /* Line 1455 of yacc.c */ -#line 476 "glcpp/glcpp-parse.y" +#line 486 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 67: + case 68: /* Line 1455 of yacc.c */ -#line 480 "glcpp/glcpp-parse.y" +#line 490 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; ;} break; - case 68: + case 69: /* Line 1455 of yacc.c */ -#line 484 "glcpp/glcpp-parse.y" +#line 494 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; ;} break; - case 69: + case 70: /* Line 1455 of yacc.c */ -#line 488 "glcpp/glcpp-parse.y" +#line 498 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; ;} break; - case 70: + case 71: /* Line 1455 of yacc.c */ -#line 495 "glcpp/glcpp-parse.y" +#line 505 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; - case 71: + case 72: /* Line 1455 of yacc.c */ -#line 496 "glcpp/glcpp-parse.y" +#line 506 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; - case 72: + case 73: /* Line 1455 of yacc.c */ -#line 497 "glcpp/glcpp-parse.y" +#line 507 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; - case 73: + case 74: /* Line 1455 of yacc.c */ -#line 498 "glcpp/glcpp-parse.y" +#line 508 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; - case 74: + case 75: /* Line 1455 of yacc.c */ -#line 499 "glcpp/glcpp-parse.y" +#line 509 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; - case 75: + case 76: /* Line 1455 of yacc.c */ -#line 500 "glcpp/glcpp-parse.y" +#line 510 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; - case 76: + case 77: /* Line 1455 of yacc.c */ -#line 501 "glcpp/glcpp-parse.y" +#line 511 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; - case 77: + case 78: /* Line 1455 of yacc.c */ -#line 502 "glcpp/glcpp-parse.y" +#line 512 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; - case 78: + case 79: /* Line 1455 of yacc.c */ -#line 503 "glcpp/glcpp-parse.y" +#line 513 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; - case 79: + case 80: /* Line 1455 of yacc.c */ -#line 504 "glcpp/glcpp-parse.y" +#line 514 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; - case 80: + case 81: /* Line 1455 of yacc.c */ -#line 505 "glcpp/glcpp-parse.y" +#line 515 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; - case 81: + case 82: /* Line 1455 of yacc.c */ -#line 506 "glcpp/glcpp-parse.y" +#line 516 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; - case 82: + case 83: /* Line 1455 of yacc.c */ -#line 507 "glcpp/glcpp-parse.y" +#line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; - case 83: + case 84: /* Line 1455 of yacc.c */ -#line 508 "glcpp/glcpp-parse.y" +#line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; - case 84: + case 85: /* Line 1455 of yacc.c */ -#line 509 "glcpp/glcpp-parse.y" +#line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; - case 85: + case 86: /* Line 1455 of yacc.c */ -#line 510 "glcpp/glcpp-parse.y" +#line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; - case 86: + case 87: /* Line 1455 of yacc.c */ -#line 511 "glcpp/glcpp-parse.y" +#line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; - case 87: + case 88: /* Line 1455 of yacc.c */ -#line 512 "glcpp/glcpp-parse.y" +#line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; - case 88: + case 89: /* Line 1455 of yacc.c */ -#line 513 "glcpp/glcpp-parse.y" +#line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; - case 89: + case 90: /* Line 1455 of yacc.c */ -#line 514 "glcpp/glcpp-parse.y" +#line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; - case 90: + case 91: /* Line 1455 of yacc.c */ -#line 515 "glcpp/glcpp-parse.y" +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; - case 91: + case 92: /* Line 1455 of yacc.c */ -#line 516 "glcpp/glcpp-parse.y" +#line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; - case 92: + case 93: /* Line 1455 of yacc.c */ -#line 517 "glcpp/glcpp-parse.y" +#line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; - case 93: + case 94: /* Line 1455 of yacc.c */ -#line 518 "glcpp/glcpp-parse.y" +#line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; - case 94: + case 95: /* Line 1455 of yacc.c */ -#line 519 "glcpp/glcpp-parse.y" +#line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; - case 95: + case 96: /* Line 1455 of yacc.c */ -#line 520 "glcpp/glcpp-parse.y" +#line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; - case 96: + case 97: /* Line 1455 of yacc.c */ -#line 521 "glcpp/glcpp-parse.y" +#line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; - case 97: + case 98: /* Line 1455 of yacc.c */ -#line 522 "glcpp/glcpp-parse.y" +#line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; - case 98: + case 99: /* Line 1455 of yacc.c */ -#line 523 "glcpp/glcpp-parse.y" +#line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; - case 99: + case 100: /* Line 1455 of yacc.c */ -#line 524 "glcpp/glcpp-parse.y" +#line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; - case 100: + case 101: /* Line 1455 of yacc.c */ -#line 525 "glcpp/glcpp-parse.y" +#line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1455 of yacc.c */ -#line 2619 "glcpp/glcpp-parse.c" +#line 2636 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2834,7 +2851,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 528 "glcpp/glcpp-parse.y" +#line 538 "glcpp/glcpp-parse.y" string_list_t * -- cgit v1.2.3 From da6b10a7eb26c8a13056cbae9015d5b84f134142 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 11 Aug 2010 14:09:11 -0700 Subject: glcpp: Fix "unterminated if" diagnostic. This was previously being appended to the output string *after* a copy of the supposedly final string was made and handed to the caller. So the diagnostic was never actually visible to the user. We fix this by moving the check for an unterminated #if from glcpp_parser_destroy to the calling function, preprocess. This fixes the test case 083-unterminated-if.c. --- src/glsl/glcpp/glcpp-parse.c | 2 -- src/glsl/glcpp/glcpp-parse.y | 2 -- src/glsl/glcpp/pp.c | 3 +++ src/glsl/glcpp/tests/083-unterminated-if.c.expected | 5 +++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/glsl/glcpp/tests/083-unterminated-if.c.expected (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index fe7549e5c5..df26899a0f 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -3333,8 +3333,6 @@ glcpp_parser_parse (glcpp_parser_t *parser) void glcpp_parser_destroy (glcpp_parser_t *parser) { - if (parser->skip_stack) - glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); talloc_free (parser); diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 0e0d9d412b..7b08cd5807 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1016,8 +1016,6 @@ glcpp_parser_parse (glcpp_parser_t *parser) void glcpp_parser_destroy (glcpp_parser_t *parser) { - if (parser->skip_stack) - glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); glcpp_lex_destroy (parser->scanner); hash_table_dtor (parser->defines); talloc_free (parser); diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 3adccf72aa..52b6e96a65 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -151,6 +151,9 @@ preprocess(void *talloc_ctx, const char **shader, char **info_log, glcpp_parser_parse (parser); + if (parser->skip_stack) + glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + *info_log = talloc_strdup_append(*info_log, parser->info_log); talloc_steal(talloc_ctx, parser->output); diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c.expected b/src/glsl/glcpp/tests/083-unterminated-if.c.expected new file mode 100644 index 0000000000..a69f8bab58 --- /dev/null +++ b/src/glsl/glcpp/tests/083-unterminated-if.c.expected @@ -0,0 +1,5 @@ +0:1(7): preprocessor error: Unterminated #if + + + + -- cgit v1.2.3 From 202604e8160157e4e80b3458175e0170d168e557 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 16:58:25 -0700 Subject: glsl2: Don't declare a variable called sig that shadows the other one Accidentally having a variable called 'sig' within an if-statement cause the higher scope 'sig' to always be NULL. As a result a new function signature was created for a function definition even when one already existed from a prototype declaration. Fixes piglit test case glsl-function-prototype (bugzilla #29520). --- src/glsl/ast_to_hir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index f14341c8f7..9d4448f89a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2128,7 +2128,7 @@ ast_function::hir(exec_list *instructions, */ f = state->symbols->get_function(name); if (f != NULL) { - ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); + sig = f->exact_matching_signature(&hir_parameters); if (sig != NULL) { const char *badvar = sig->qualifiers_match(&hir_parameters); if (badvar != NULL) { -- cgit v1.2.3 From 77215e7e7babe73e5d959ab5ad82054a8d73c538 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 17:01:31 -0700 Subject: glsl2: Emit error from lexer when illegal reserved word is encountered Without this, the parser will generate obtuse, useless error diagnostics when reservered word that are not used by the grammar are encountered in a shader. Fixes bugzilla #29519. --- src/glsl/glsl_lexer.lpp | 92 +++++++++++++++++++++++++++--------------------- src/glsl/glsl_parser.ypp | 2 ++ 2 files changed, 53 insertions(+), 41 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index b78df5d84f..7ef537b248 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -46,6 +46,16 @@ } \ } while (0) +#define RESERVED_WORD(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + _mesa_glsl_error(yylloc, yyextra, \ + "Illegal use of reserved word `%s'", yytext); \ + return ERROR_TOK; \ + } \ + } while (0) %} %option bison-bridge bison-locations reentrant noyywrap @@ -252,49 +262,49 @@ false { /* Reserved words in GLSL 1.10. */ -asm return ASM; -class return CLASS; -union return UNION; -enum return ENUM; -typedef return TYPEDEF; -template return TEMPLATE; -this return THIS; -packed return PACKED; -goto return GOTO; -switch return SWITCH; -default return DEFAULT; -inline return INLINE_TOK; -noinline return NOINLINE; -volatile return VOLATILE; -public return PUBLIC_TOK; -static return STATIC; -extern return EXTERN; -external return EXTERNAL; -interface return INTERFACE; -long return LONG; -short return SHORT; -double return DOUBLE; -half return HALF; -fixed return FIXED; -unsigned return UNSIGNED; -input return INPUT; -output return OUTPUT; -hvec2 return HVEC2; -hvec3 return HVEC3; -hvec4 return HVEC4; -dvec2 return DVEC2; -dvec3 return DVEC3; -dvec4 return DVEC4; -fvec2 return FVEC2; -fvec3 return FVEC3; -fvec4 return FVEC4; +asm RESERVED_WORD(999, ASM); +class RESERVED_WORD(999, CLASS); +union RESERVED_WORD(999, UNION); +enum RESERVED_WORD(999, ENUM); +typedef RESERVED_WORD(999, TYPEDEF); +template RESERVED_WORD(999, TEMPLATE); +this RESERVED_WORD(999, THIS); +packed RESERVED_WORD(999, PACKED); +goto RESERVED_WORD(999, GOTO); +switch RESERVED_WORD(130, SWITCH); +default RESERVED_WORD(130, DEFAULT); +inline RESERVED_WORD(999, INLINE_TOK); +noinline RESERVED_WORD(999, NOINLINE); +volatile RESERVED_WORD(999, VOLATILE); +public RESERVED_WORD(999, PUBLIC_TOK); +static RESERVED_WORD(999, STATIC); +extern RESERVED_WORD(999, EXTERN); +external RESERVED_WORD(999, EXTERNAL); +interface RESERVED_WORD(999, INTERFACE); +long RESERVED_WORD(999, LONG); +short RESERVED_WORD(999, SHORT); +double RESERVED_WORD(999, DOUBLE); +half RESERVED_WORD(999, HALF); +fixed RESERVED_WORD(999, FIXED); +unsigned RESERVED_WORD(999, UNSIGNED); +input RESERVED_WORD(999, INPUT); +output RESERVED_WORD(999, OUTPUT); +hvec2 RESERVED_WORD(999, HVEC2); +hvec3 RESERVED_WORD(999, HVEC3); +hvec4 RESERVED_WORD(999, HVEC4); +dvec2 RESERVED_WORD(999, DVEC2); +dvec3 RESERVED_WORD(999, DVEC3); +dvec4 RESERVED_WORD(999, DVEC4); +fvec2 RESERVED_WORD(999, FVEC2); +fvec3 RESERVED_WORD(999, FVEC3); +fvec4 RESERVED_WORD(999, FVEC4); sampler2DRect return SAMPLER2DRECT; -sampler3DRect return SAMPLER3DRECT; +sampler3DRect RESERVED_WORD(999, SAMPLER3DRECT); sampler2DRectShadow return SAMPLER2DRECTSHADOW; -sizeof return SIZEOF; -cast return CAST; -namespace return NAMESPACE; -using return USING; +sizeof RESERVED_WORD(999, SIZEOF); +cast RESERVED_WORD(999, CAST); +namespace RESERVED_WORD(999, NAMESPACE); +using RESERVED_WORD(999, USING); /* Additional reserved words in GLSL 1.20. */ lowp TOKEN_OR_IDENTIFIER(120, LOWP); diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 3e60454bb2..74971cfb9d 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -116,6 +116,8 @@ %token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW %token SIZEOF CAST NAMESPACE USING +%token ERROR_TOK + %token COMMON PARTITION ACTIVE SAMPLERBUFFER FILTER %token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY %token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY -- cgit v1.2.3 From db36e88052918ad383c3acdd24f2b9864e240ddb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 17:03:37 -0700 Subject: glsl2: Commit generated files changed by previous commit --- src/glsl/glsl_lexer.cpp | 480 +++++------ src/glsl/glsl_parser.cpp | 2005 +++++++++++++++++++++++----------------------- src/glsl/glsl_parser.h | 61 +- 3 files changed, 1287 insertions(+), 1259 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 672b0b1359..f75f7b5171 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -54,7 +54,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -158,7 +159,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -934,8 +943,18 @@ static yyconst flex_int16_t yy_chk[1076] = } \ } while (0) +#define RESERVED_WORD(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + _mesa_glsl_error(yylloc, yyextra, \ + "Illegal use of reserved word `%s'", yytext); \ + return ERROR_TOK; \ + } \ + } while (0) -#line 939 "glsl_lexer.cpp" +#line 958 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1069,7 +1088,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1077,7 +1101,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1088,7 +1112,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1176,10 +1200,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 66 "glsl_lexer.lpp" +#line 76 "glsl_lexer.lpp" -#line 1183 "glsl_lexer.cpp" +#line 1207 "glsl_lexer.cpp" yylval = yylval_param; @@ -1265,7 +1289,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 68 "glsl_lexer.lpp" +#line 78 "glsl_lexer.lpp" ; YY_BREAK /* Preprocessor tokens. */ @@ -1274,17 +1298,17 @@ case 2: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 71 "glsl_lexer.lpp" +#line 81 "glsl_lexer.lpp" ; YY_BREAK case 3: YY_RULE_SETUP -#line 72 "glsl_lexer.lpp" +#line 82 "glsl_lexer.lpp" { BEGIN PP; return VERSION; } YY_BREAK case 4: YY_RULE_SETUP -#line 73 "glsl_lexer.lpp" +#line 83 "glsl_lexer.lpp" { BEGIN PP; return EXTENSION; } YY_BREAK case 5: @@ -1292,7 +1316,7 @@ case 5: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 74 "glsl_lexer.lpp" +#line 84 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1314,7 +1338,7 @@ case 6: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 89 "glsl_lexer.lpp" +#line 99 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1332,27 +1356,27 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 103 "glsl_lexer.lpp" +#line 113 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA; } YY_BREAK case 8: YY_RULE_SETUP -#line 104 "glsl_lexer.lpp" +#line 114 "glsl_lexer.lpp" { } YY_BREAK case 9: YY_RULE_SETUP -#line 105 "glsl_lexer.lpp" +#line 115 "glsl_lexer.lpp" { } YY_BREAK case 10: YY_RULE_SETUP -#line 106 "glsl_lexer.lpp" +#line 116 "glsl_lexer.lpp" return COLON; YY_BREAK case 11: YY_RULE_SETUP -#line 107 "glsl_lexer.lpp" +#line 117 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; @@ -1360,7 +1384,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 111 "glsl_lexer.lpp" +#line 121 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1369,283 +1393,283 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 115 "glsl_lexer.lpp" +#line 125 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 117 "glsl_lexer.lpp" +#line 127 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK case 15: YY_RULE_SETUP -#line 119 "glsl_lexer.lpp" +#line 129 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK case 16: YY_RULE_SETUP -#line 120 "glsl_lexer.lpp" +#line 130 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK case 17: YY_RULE_SETUP -#line 121 "glsl_lexer.lpp" +#line 131 "glsl_lexer.lpp" return BOOL; YY_BREAK case 18: YY_RULE_SETUP -#line 122 "glsl_lexer.lpp" +#line 132 "glsl_lexer.lpp" return FLOAT; YY_BREAK case 19: YY_RULE_SETUP -#line 123 "glsl_lexer.lpp" +#line 133 "glsl_lexer.lpp" return INT; YY_BREAK case 20: YY_RULE_SETUP -#line 125 "glsl_lexer.lpp" +#line 135 "glsl_lexer.lpp" return BREAK; YY_BREAK case 21: YY_RULE_SETUP -#line 126 "glsl_lexer.lpp" +#line 136 "glsl_lexer.lpp" return CONTINUE; YY_BREAK case 22: YY_RULE_SETUP -#line 127 "glsl_lexer.lpp" +#line 137 "glsl_lexer.lpp" return DO; YY_BREAK case 23: YY_RULE_SETUP -#line 128 "glsl_lexer.lpp" +#line 138 "glsl_lexer.lpp" return WHILE; YY_BREAK case 24: YY_RULE_SETUP -#line 129 "glsl_lexer.lpp" +#line 139 "glsl_lexer.lpp" return ELSE; YY_BREAK case 25: YY_RULE_SETUP -#line 130 "glsl_lexer.lpp" +#line 140 "glsl_lexer.lpp" return FOR; YY_BREAK case 26: YY_RULE_SETUP -#line 131 "glsl_lexer.lpp" +#line 141 "glsl_lexer.lpp" return IF; YY_BREAK case 27: YY_RULE_SETUP -#line 132 "glsl_lexer.lpp" +#line 142 "glsl_lexer.lpp" return DISCARD; YY_BREAK case 28: YY_RULE_SETUP -#line 133 "glsl_lexer.lpp" +#line 143 "glsl_lexer.lpp" return RETURN; YY_BREAK case 29: YY_RULE_SETUP -#line 135 "glsl_lexer.lpp" +#line 145 "glsl_lexer.lpp" return BVEC2; YY_BREAK case 30: YY_RULE_SETUP -#line 136 "glsl_lexer.lpp" +#line 146 "glsl_lexer.lpp" return BVEC3; YY_BREAK case 31: YY_RULE_SETUP -#line 137 "glsl_lexer.lpp" +#line 147 "glsl_lexer.lpp" return BVEC4; YY_BREAK case 32: YY_RULE_SETUP -#line 138 "glsl_lexer.lpp" +#line 148 "glsl_lexer.lpp" return IVEC2; YY_BREAK case 33: YY_RULE_SETUP -#line 139 "glsl_lexer.lpp" +#line 149 "glsl_lexer.lpp" return IVEC3; YY_BREAK case 34: YY_RULE_SETUP -#line 140 "glsl_lexer.lpp" +#line 150 "glsl_lexer.lpp" return IVEC4; YY_BREAK case 35: YY_RULE_SETUP -#line 141 "glsl_lexer.lpp" +#line 151 "glsl_lexer.lpp" return VEC2; YY_BREAK case 36: YY_RULE_SETUP -#line 142 "glsl_lexer.lpp" +#line 152 "glsl_lexer.lpp" return VEC3; YY_BREAK case 37: YY_RULE_SETUP -#line 143 "glsl_lexer.lpp" +#line 153 "glsl_lexer.lpp" return VEC4; YY_BREAK case 38: YY_RULE_SETUP -#line 144 "glsl_lexer.lpp" +#line 154 "glsl_lexer.lpp" return MAT2; YY_BREAK case 39: YY_RULE_SETUP -#line 145 "glsl_lexer.lpp" +#line 155 "glsl_lexer.lpp" return MAT3; YY_BREAK case 40: YY_RULE_SETUP -#line 146 "glsl_lexer.lpp" +#line 156 "glsl_lexer.lpp" return MAT4; YY_BREAK case 41: YY_RULE_SETUP -#line 147 "glsl_lexer.lpp" +#line 157 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X2); YY_BREAK case 42: YY_RULE_SETUP -#line 148 "glsl_lexer.lpp" +#line 158 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X3); YY_BREAK case 43: YY_RULE_SETUP -#line 149 "glsl_lexer.lpp" +#line 159 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT2X4); YY_BREAK case 44: YY_RULE_SETUP -#line 150 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X2); YY_BREAK case 45: YY_RULE_SETUP -#line 151 "glsl_lexer.lpp" +#line 161 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X3); YY_BREAK case 46: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" +#line 162 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT3X4); YY_BREAK case 47: YY_RULE_SETUP -#line 153 "glsl_lexer.lpp" +#line 163 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X2); YY_BREAK case 48: YY_RULE_SETUP -#line 154 "glsl_lexer.lpp" +#line 164 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X3); YY_BREAK case 49: YY_RULE_SETUP -#line 155 "glsl_lexer.lpp" +#line 165 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MAT4X4); YY_BREAK case 50: YY_RULE_SETUP -#line 157 "glsl_lexer.lpp" +#line 167 "glsl_lexer.lpp" return IN; YY_BREAK case 51: YY_RULE_SETUP -#line 158 "glsl_lexer.lpp" +#line 168 "glsl_lexer.lpp" return OUT; YY_BREAK case 52: YY_RULE_SETUP -#line 159 "glsl_lexer.lpp" +#line 169 "glsl_lexer.lpp" return INOUT; YY_BREAK case 53: YY_RULE_SETUP -#line 160 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" return UNIFORM; YY_BREAK case 54: YY_RULE_SETUP -#line 161 "glsl_lexer.lpp" +#line 171 "glsl_lexer.lpp" return VARYING; YY_BREAK case 55: YY_RULE_SETUP -#line 162 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, CENTROID); YY_BREAK case 56: YY_RULE_SETUP -#line 163 "glsl_lexer.lpp" +#line 173 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, INVARIANT); YY_BREAK case 57: YY_RULE_SETUP -#line 165 "glsl_lexer.lpp" +#line 175 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, FLAT); YY_BREAK case 58: YY_RULE_SETUP -#line 166 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SMOOTH); YY_BREAK case 59: YY_RULE_SETUP -#line 167 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); YY_BREAK case 60: YY_RULE_SETUP -#line 169 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK case 61: YY_RULE_SETUP -#line 170 "glsl_lexer.lpp" +#line 180 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK case 62: YY_RULE_SETUP -#line 171 "glsl_lexer.lpp" +#line 181 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK case 63: YY_RULE_SETUP -#line 172 "glsl_lexer.lpp" +#line 182 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK case 64: YY_RULE_SETUP -#line 173 "glsl_lexer.lpp" +#line 183 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK case 65: YY_RULE_SETUP -#line 174 "glsl_lexer.lpp" +#line 184 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK case 66: YY_RULE_SETUP -#line 176 "glsl_lexer.lpp" +#line 186 "glsl_lexer.lpp" return STRUCT; YY_BREAK case 67: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" +#line 187 "glsl_lexer.lpp" return VOID; YY_BREAK case 68: YY_RULE_SETUP -#line 179 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) || (yyextra->ARB_fragment_coord_conventions_enable)){ @@ -1658,102 +1682,102 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 189 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" return INC_OP; YY_BREAK case 70: YY_RULE_SETUP -#line 190 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" return DEC_OP; YY_BREAK case 71: YY_RULE_SETUP -#line 191 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" return LE_OP; YY_BREAK case 72: YY_RULE_SETUP -#line 192 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" return GE_OP; YY_BREAK case 73: YY_RULE_SETUP -#line 193 "glsl_lexer.lpp" +#line 203 "glsl_lexer.lpp" return EQ_OP; YY_BREAK case 74: YY_RULE_SETUP -#line 194 "glsl_lexer.lpp" +#line 204 "glsl_lexer.lpp" return NE_OP; YY_BREAK case 75: YY_RULE_SETUP -#line 195 "glsl_lexer.lpp" +#line 205 "glsl_lexer.lpp" return AND_OP; YY_BREAK case 76: YY_RULE_SETUP -#line 196 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" return OR_OP; YY_BREAK case 77: YY_RULE_SETUP -#line 197 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" return XOR_OP; YY_BREAK case 78: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 209 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK case 79: YY_RULE_SETUP -#line 200 "glsl_lexer.lpp" +#line 210 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK case 80: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 211 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK case 81: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 212 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK case 82: YY_RULE_SETUP -#line 203 "glsl_lexer.lpp" +#line 213 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK case 83: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 214 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK case 84: YY_RULE_SETUP -#line 205 "glsl_lexer.lpp" +#line 215 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK case 85: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" +#line 216 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK case 86: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" +#line 217 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK case 87: YY_RULE_SETUP -#line 208 "glsl_lexer.lpp" +#line 218 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK case 88: YY_RULE_SETUP -#line 210 "glsl_lexer.lpp" +#line 220 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1761,7 +1785,7 @@ YY_RULE_SETUP YY_BREAK case 89: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" +#line 224 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return INTCONSTANT; @@ -1769,7 +1793,7 @@ YY_RULE_SETUP YY_BREAK case 90: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" +#line 228 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return INTCONSTANT; @@ -1777,7 +1801,7 @@ YY_RULE_SETUP YY_BREAK case 91: YY_RULE_SETUP -#line 223 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1785,7 +1809,7 @@ YY_RULE_SETUP YY_BREAK case 92: YY_RULE_SETUP -#line 227 "glsl_lexer.lpp" +#line 237 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1793,7 +1817,7 @@ YY_RULE_SETUP YY_BREAK case 93: YY_RULE_SETUP -#line 231 "glsl_lexer.lpp" +#line 241 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1801,7 +1825,7 @@ YY_RULE_SETUP YY_BREAK case 94: YY_RULE_SETUP -#line 235 "glsl_lexer.lpp" +#line 245 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1809,7 +1833,7 @@ YY_RULE_SETUP YY_BREAK case 95: YY_RULE_SETUP -#line 239 "glsl_lexer.lpp" +#line 249 "glsl_lexer.lpp" { yylval->real = strtod(yytext, NULL); return FLOATCONSTANT; @@ -1817,7 +1841,7 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 244 "glsl_lexer.lpp" +#line 254 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; @@ -1825,7 +1849,7 @@ YY_RULE_SETUP YY_BREAK case 97: YY_RULE_SETUP -#line 248 "glsl_lexer.lpp" +#line 258 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; @@ -1834,394 +1858,394 @@ YY_RULE_SETUP /* Reserved words in GLSL 1.10. */ case 98: YY_RULE_SETUP -#line 255 "glsl_lexer.lpp" -return ASM; +#line 265 "glsl_lexer.lpp" +RESERVED_WORD(999, ASM); YY_BREAK case 99: YY_RULE_SETUP -#line 256 "glsl_lexer.lpp" -return CLASS; +#line 266 "glsl_lexer.lpp" +RESERVED_WORD(999, CLASS); YY_BREAK case 100: YY_RULE_SETUP -#line 257 "glsl_lexer.lpp" -return UNION; +#line 267 "glsl_lexer.lpp" +RESERVED_WORD(999, UNION); YY_BREAK case 101: YY_RULE_SETUP -#line 258 "glsl_lexer.lpp" -return ENUM; +#line 268 "glsl_lexer.lpp" +RESERVED_WORD(999, ENUM); YY_BREAK case 102: YY_RULE_SETUP -#line 259 "glsl_lexer.lpp" -return TYPEDEF; +#line 269 "glsl_lexer.lpp" +RESERVED_WORD(999, TYPEDEF); YY_BREAK case 103: YY_RULE_SETUP -#line 260 "glsl_lexer.lpp" -return TEMPLATE; +#line 270 "glsl_lexer.lpp" +RESERVED_WORD(999, TEMPLATE); YY_BREAK case 104: YY_RULE_SETUP -#line 261 "glsl_lexer.lpp" -return THIS; +#line 271 "glsl_lexer.lpp" +RESERVED_WORD(999, THIS); YY_BREAK case 105: YY_RULE_SETUP -#line 262 "glsl_lexer.lpp" -return PACKED; +#line 272 "glsl_lexer.lpp" +RESERVED_WORD(999, PACKED); YY_BREAK case 106: YY_RULE_SETUP -#line 263 "glsl_lexer.lpp" -return GOTO; +#line 273 "glsl_lexer.lpp" +RESERVED_WORD(999, GOTO); YY_BREAK case 107: YY_RULE_SETUP -#line 264 "glsl_lexer.lpp" -return SWITCH; +#line 274 "glsl_lexer.lpp" +RESERVED_WORD(130, SWITCH); YY_BREAK case 108: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" -return DEFAULT; +#line 275 "glsl_lexer.lpp" +RESERVED_WORD(130, DEFAULT); YY_BREAK case 109: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" -return INLINE_TOK; +#line 276 "glsl_lexer.lpp" +RESERVED_WORD(999, INLINE_TOK); YY_BREAK case 110: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" -return NOINLINE; +#line 277 "glsl_lexer.lpp" +RESERVED_WORD(999, NOINLINE); YY_BREAK case 111: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" -return VOLATILE; +#line 278 "glsl_lexer.lpp" +RESERVED_WORD(999, VOLATILE); YY_BREAK case 112: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" -return PUBLIC_TOK; +#line 279 "glsl_lexer.lpp" +RESERVED_WORD(999, PUBLIC_TOK); YY_BREAK case 113: YY_RULE_SETUP -#line 270 "glsl_lexer.lpp" -return STATIC; +#line 280 "glsl_lexer.lpp" +RESERVED_WORD(999, STATIC); YY_BREAK case 114: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" -return EXTERN; +#line 281 "glsl_lexer.lpp" +RESERVED_WORD(999, EXTERN); YY_BREAK case 115: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" -return EXTERNAL; +#line 282 "glsl_lexer.lpp" +RESERVED_WORD(999, EXTERNAL); YY_BREAK case 116: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" -return INTERFACE; +#line 283 "glsl_lexer.lpp" +RESERVED_WORD(999, INTERFACE); YY_BREAK case 117: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" -return LONG; +#line 284 "glsl_lexer.lpp" +RESERVED_WORD(999, LONG); YY_BREAK case 118: YY_RULE_SETUP -#line 275 "glsl_lexer.lpp" -return SHORT; +#line 285 "glsl_lexer.lpp" +RESERVED_WORD(999, SHORT); YY_BREAK case 119: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" -return DOUBLE; +#line 286 "glsl_lexer.lpp" +RESERVED_WORD(999, DOUBLE); YY_BREAK case 120: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" -return HALF; +#line 287 "glsl_lexer.lpp" +RESERVED_WORD(999, HALF); YY_BREAK case 121: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" -return FIXED; +#line 288 "glsl_lexer.lpp" +RESERVED_WORD(999, FIXED); YY_BREAK case 122: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" -return UNSIGNED; +#line 289 "glsl_lexer.lpp" +RESERVED_WORD(999, UNSIGNED); YY_BREAK case 123: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" -return INPUT; +#line 290 "glsl_lexer.lpp" +RESERVED_WORD(999, INPUT); YY_BREAK case 124: YY_RULE_SETUP -#line 281 "glsl_lexer.lpp" -return OUTPUT; +#line 291 "glsl_lexer.lpp" +RESERVED_WORD(999, OUTPUT); YY_BREAK case 125: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" -return HVEC2; +#line 292 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC2); YY_BREAK case 126: YY_RULE_SETUP -#line 283 "glsl_lexer.lpp" -return HVEC3; +#line 293 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC3); YY_BREAK case 127: YY_RULE_SETUP -#line 284 "glsl_lexer.lpp" -return HVEC4; +#line 294 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC4); YY_BREAK case 128: YY_RULE_SETUP -#line 285 "glsl_lexer.lpp" -return DVEC2; +#line 295 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC2); YY_BREAK case 129: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" -return DVEC3; +#line 296 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC3); YY_BREAK case 130: YY_RULE_SETUP -#line 287 "glsl_lexer.lpp" -return DVEC4; +#line 297 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC4); YY_BREAK case 131: YY_RULE_SETUP -#line 288 "glsl_lexer.lpp" -return FVEC2; +#line 298 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC2); YY_BREAK case 132: YY_RULE_SETUP -#line 289 "glsl_lexer.lpp" -return FVEC3; +#line 299 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC3); YY_BREAK case 133: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" -return FVEC4; +#line 300 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC4); YY_BREAK case 134: YY_RULE_SETUP -#line 291 "glsl_lexer.lpp" +#line 301 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK case 135: YY_RULE_SETUP -#line 292 "glsl_lexer.lpp" -return SAMPLER3DRECT; +#line 302 "glsl_lexer.lpp" +RESERVED_WORD(999, SAMPLER3DRECT); YY_BREAK case 136: YY_RULE_SETUP -#line 293 "glsl_lexer.lpp" +#line 303 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK case 137: YY_RULE_SETUP -#line 294 "glsl_lexer.lpp" -return SIZEOF; +#line 304 "glsl_lexer.lpp" +RESERVED_WORD(999, SIZEOF); YY_BREAK case 138: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" -return CAST; +#line 305 "glsl_lexer.lpp" +RESERVED_WORD(999, CAST); YY_BREAK case 139: YY_RULE_SETUP -#line 296 "glsl_lexer.lpp" -return NAMESPACE; +#line 306 "glsl_lexer.lpp" +RESERVED_WORD(999, NAMESPACE); YY_BREAK case 140: YY_RULE_SETUP -#line 297 "glsl_lexer.lpp" -return USING; +#line 307 "glsl_lexer.lpp" +RESERVED_WORD(999, USING); YY_BREAK /* Additional reserved words in GLSL 1.20. */ case 141: YY_RULE_SETUP -#line 300 "glsl_lexer.lpp" +#line 310 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, LOWP); YY_BREAK case 142: YY_RULE_SETUP -#line 301 "glsl_lexer.lpp" +#line 311 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, MEDIUMP); YY_BREAK case 143: YY_RULE_SETUP -#line 302 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, HIGHP); YY_BREAK case 144: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 313 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(120, PRECISION); YY_BREAK /* Additional reserved words in GLSL 1.30. */ case 145: YY_RULE_SETUP -#line 306 "glsl_lexer.lpp" +#line 316 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, COMMON); YY_BREAK case 146: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 317 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, PARTITION); YY_BREAK case 147: YY_RULE_SETUP -#line 308 "glsl_lexer.lpp" +#line 318 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ACTIVE); YY_BREAK case 148: YY_RULE_SETUP -#line 309 "glsl_lexer.lpp" +#line 319 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SUPERP); YY_BREAK case 149: YY_RULE_SETUP -#line 310 "glsl_lexer.lpp" +#line 320 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); YY_BREAK case 150: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 321 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, FILTER); YY_BREAK case 151: YY_RULE_SETUP -#line 312 "glsl_lexer.lpp" +#line 322 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1D); YY_BREAK case 152: YY_RULE_SETUP -#line 313 "glsl_lexer.lpp" +#line 323 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2D); YY_BREAK case 153: YY_RULE_SETUP -#line 314 "glsl_lexer.lpp" +#line 324 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE3D); YY_BREAK case 154: YY_RULE_SETUP -#line 315 "glsl_lexer.lpp" +#line 325 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGECUBE); YY_BREAK case 155: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 326 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1D); YY_BREAK case 156: YY_RULE_SETUP -#line 317 "glsl_lexer.lpp" +#line 327 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2D); YY_BREAK case 157: YY_RULE_SETUP -#line 318 "glsl_lexer.lpp" +#line 328 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE3D); YY_BREAK case 158: YY_RULE_SETUP -#line 319 "glsl_lexer.lpp" +#line 329 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); YY_BREAK case 159: YY_RULE_SETUP -#line 320 "glsl_lexer.lpp" +#line 330 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1D); YY_BREAK case 160: YY_RULE_SETUP -#line 321 "glsl_lexer.lpp" +#line 331 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2D); YY_BREAK case 161: YY_RULE_SETUP -#line 322 "glsl_lexer.lpp" +#line 332 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE3D); YY_BREAK case 162: YY_RULE_SETUP -#line 323 "glsl_lexer.lpp" +#line 333 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); YY_BREAK case 163: YY_RULE_SETUP -#line 324 "glsl_lexer.lpp" +#line 334 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); YY_BREAK case 164: YY_RULE_SETUP -#line 325 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); YY_BREAK case 165: YY_RULE_SETUP -#line 326 "glsl_lexer.lpp" +#line 336 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); YY_BREAK case 166: YY_RULE_SETUP -#line 327 "glsl_lexer.lpp" +#line 337 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); YY_BREAK case 167: YY_RULE_SETUP -#line 328 "glsl_lexer.lpp" +#line 338 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); YY_BREAK case 168: YY_RULE_SETUP -#line 329 "glsl_lexer.lpp" +#line 339 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); YY_BREAK case 169: YY_RULE_SETUP -#line 330 "glsl_lexer.lpp" +#line 340 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); YY_BREAK case 170: YY_RULE_SETUP -#line 331 "glsl_lexer.lpp" +#line 341 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); YY_BREAK case 171: YY_RULE_SETUP -#line 332 "glsl_lexer.lpp" +#line 342 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); YY_BREAK case 172: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" +#line 343 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); YY_BREAK case 173: YY_RULE_SETUP -#line 334 "glsl_lexer.lpp" +#line 344 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); YY_BREAK case 174: YY_RULE_SETUP -#line 335 "glsl_lexer.lpp" +#line 345 "glsl_lexer.lpp" TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); YY_BREAK case 175: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" +#line 347 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2231,15 +2255,15 @@ YY_RULE_SETUP YY_BREAK case 176: YY_RULE_SETUP -#line 344 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 177: YY_RULE_SETUP -#line 346 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2243 "glsl_lexer.cpp" +#line 2267 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); @@ -2974,8 +2998,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann /** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3381,7 +3405,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 346 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index dc15891f7e..92937fdf9e 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -299,35 +299,36 @@ CAST = 413, NAMESPACE = 414, USING = 415, - COMMON = 416, - PARTITION = 417, - ACTIVE = 418, - SAMPLERBUFFER = 419, - FILTER = 420, - IMAGE1D = 421, - IMAGE2D = 422, - IMAGE3D = 423, - IMAGECUBE = 424, - IMAGE1DARRAY = 425, - IMAGE2DARRAY = 426, - IIMAGE1D = 427, - IIMAGE2D = 428, - IIMAGE3D = 429, - IIMAGECUBE = 430, - IIMAGE1DARRAY = 431, - IIMAGE2DARRAY = 432, - UIMAGE1D = 433, - UIMAGE2D = 434, - UIMAGE3D = 435, - UIMAGECUBE = 436, - UIMAGE1DARRAY = 437, - UIMAGE2DARRAY = 438, - IMAGE1DSHADOW = 439, - IMAGE2DSHADOW = 440, - IMAGEBUFFER = 441, - IIMAGEBUFFER = 442, - UIMAGEBUFFER = 443, - ROW_MAJOR = 444 + ERROR_TOK = 416, + COMMON = 417, + PARTITION = 418, + ACTIVE = 419, + SAMPLERBUFFER = 420, + FILTER = 421, + IMAGE1D = 422, + IMAGE2D = 423, + IMAGE3D = 424, + IMAGECUBE = 425, + IMAGE1DARRAY = 426, + IMAGE2DARRAY = 427, + IIMAGE1D = 428, + IIMAGE2D = 429, + IIMAGE3D = 430, + IIMAGECUBE = 431, + IIMAGE1DARRAY = 432, + IIMAGE2DARRAY = 433, + UIMAGE1D = 434, + UIMAGE2D = 435, + UIMAGE3D = 436, + UIMAGECUBE = 437, + UIMAGE1DARRAY = 438, + UIMAGE2DARRAY = 439, + IMAGE1DSHADOW = 440, + IMAGE2DSHADOW = 441, + IMAGEBUFFER = 442, + IIMAGEBUFFER = 443, + UIMAGEBUFFER = 444, + ROW_MAJOR = 445 }; #endif @@ -369,7 +370,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 373 "glsl_parser.cpp" +#line 374 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -394,7 +395,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 398 "glsl_parser.cpp" +#line 399 "glsl_parser.cpp" #ifdef short # undef short @@ -611,10 +612,10 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 4373 +#define YYLAST 4389 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 214 +#define YYNTOKENS 215 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 89 /* YYNRULES -- Number of rules. */ @@ -624,7 +625,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 444 +#define YYMAXUTOK 445 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -635,16 +636,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 198, 2, 2, 2, 202, 205, 2, - 190, 191, 200, 196, 195, 197, 194, 201, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 209, 211, - 203, 210, 204, 208, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 199, 2, 2, 2, 203, 206, 2, + 191, 192, 201, 197, 196, 198, 195, 202, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 210, 212, + 204, 211, 205, 209, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 192, 2, 193, 206, 2, 2, 2, 2, 2, + 2, 193, 2, 194, 207, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 212, 207, 213, 199, 2, 2, 2, + 2, 2, 2, 213, 208, 214, 200, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -676,7 +677,7 @@ static const yytype_uint8 yytranslate[] = 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189 + 185, 186, 187, 188, 189, 190 }; #if YYDEBUG @@ -717,55 +718,55 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 215, 0, -1, -1, 217, 218, 216, 220, -1, -1, - 112, 81, 117, -1, -1, 218, 219, -1, 113, 79, - 116, 79, 117, -1, 301, -1, 220, 301, -1, 79, - -1, 221, -1, 81, -1, 82, -1, 80, -1, 83, - -1, 190, 248, 191, -1, 222, -1, 223, 192, 224, - 193, -1, 225, -1, 223, 194, 79, -1, 223, 87, - -1, 223, 88, -1, 248, -1, 226, -1, 227, -1, - 223, 194, 227, -1, 229, 191, -1, 228, 191, -1, - 230, 77, -1, 230, -1, 230, 246, -1, 229, 195, - 246, -1, 231, 190, -1, 270, -1, 79, -1, 84, - -1, 223, -1, 87, 232, -1, 88, 232, -1, 233, - 232, -1, 196, -1, 197, -1, 198, -1, 199, -1, - 232, -1, 234, 200, 232, -1, 234, 201, 232, -1, - 234, 202, 232, -1, 234, -1, 235, 196, 234, -1, - 235, 197, 234, -1, 235, -1, 236, 85, 235, -1, - 236, 86, 235, -1, 236, -1, 237, 203, 236, -1, - 237, 204, 236, -1, 237, 89, 236, -1, 237, 90, - 236, -1, 237, -1, 238, 91, 237, -1, 238, 92, - 237, -1, 238, -1, 239, 205, 238, -1, 239, -1, - 240, 206, 239, -1, 240, -1, 241, 207, 240, -1, - 241, -1, 242, 93, 241, -1, 242, -1, 243, 95, - 242, -1, 243, -1, 244, 94, 243, -1, 244, -1, - 244, 208, 248, 209, 246, -1, 245, -1, 232, 247, - 246, -1, 210, -1, 96, -1, 97, -1, 99, -1, + 216, 0, -1, -1, 218, 219, 217, 221, -1, -1, + 112, 81, 117, -1, -1, 219, 220, -1, 113, 79, + 116, 79, 117, -1, 302, -1, 221, 302, -1, 79, + -1, 222, -1, 81, -1, 82, -1, 80, -1, 83, + -1, 191, 249, 192, -1, 223, -1, 224, 193, 225, + 194, -1, 226, -1, 224, 195, 79, -1, 224, 87, + -1, 224, 88, -1, 249, -1, 227, -1, 228, -1, + 224, 195, 228, -1, 230, 192, -1, 229, 192, -1, + 231, 77, -1, 231, -1, 231, 247, -1, 230, 196, + 247, -1, 232, 191, -1, 271, -1, 79, -1, 84, + -1, 224, -1, 87, 233, -1, 88, 233, -1, 234, + 233, -1, 197, -1, 198, -1, 199, -1, 200, -1, + 233, -1, 235, 201, 233, -1, 235, 202, 233, -1, + 235, 203, 233, -1, 235, -1, 236, 197, 235, -1, + 236, 198, 235, -1, 236, -1, 237, 85, 236, -1, + 237, 86, 236, -1, 237, -1, 238, 204, 237, -1, + 238, 205, 237, -1, 238, 89, 237, -1, 238, 90, + 237, -1, 238, -1, 239, 91, 238, -1, 239, 92, + 238, -1, 239, -1, 240, 206, 239, -1, 240, -1, + 241, 207, 240, -1, 241, -1, 242, 208, 241, -1, + 242, -1, 243, 93, 242, -1, 243, -1, 244, 95, + 243, -1, 244, -1, 245, 94, 244, -1, 245, -1, + 245, 209, 249, 210, 247, -1, 246, -1, 233, 248, + 247, -1, 211, -1, 96, -1, 97, -1, 99, -1, 98, -1, 105, -1, 100, -1, 101, -1, 102, -1, - 103, -1, 104, -1, 246, -1, 248, 195, 246, -1, - 245, -1, 251, 211, -1, 259, 211, -1, 111, 274, - 271, 211, -1, 252, 191, -1, 254, -1, 253, -1, - 254, 256, -1, 253, 195, 256, -1, 261, 79, 190, - -1, 270, 79, -1, 270, 79, 192, 249, 193, -1, - 267, 257, 255, -1, 257, 255, -1, 267, 257, 258, - -1, 257, 258, -1, -1, 36, -1, 37, -1, 38, - -1, 270, -1, 260, -1, 259, 195, 79, -1, 259, - 195, 79, 192, 193, -1, 259, 195, 79, 192, 249, - 193, -1, 259, 195, 79, 192, 193, 210, 280, -1, - 259, 195, 79, 192, 249, 193, 210, 280, -1, 259, - 195, 79, 210, 280, -1, 261, -1, 261, 79, -1, - 261, 79, 192, 193, -1, 261, 79, 192, 249, 193, - -1, 261, 79, 192, 193, 210, 280, -1, 261, 79, - 192, 249, 193, 210, 280, -1, 261, 79, 210, 280, - -1, 106, 79, -1, 270, -1, 268, 270, -1, -1, - 263, -1, 120, 190, 264, 191, -1, 265, -1, 264, - 195, 265, -1, 79, -1, 43, -1, 42, -1, 41, - -1, 4, -1, 269, -1, 266, 268, -1, 106, 268, - -1, 4, -1, 3, -1, 262, 40, -1, 35, 40, - -1, 262, 36, -1, 37, -1, 35, 36, -1, 35, - 37, -1, 39, -1, 271, -1, 274, 271, -1, 272, - -1, 272, 192, 193, -1, 272, 192, 249, 193, -1, - 273, -1, 275, -1, 79, -1, 77, -1, 6, -1, + 103, -1, 104, -1, 247, -1, 249, 196, 247, -1, + 246, -1, 252, 212, -1, 260, 212, -1, 111, 275, + 272, 212, -1, 253, 192, -1, 255, -1, 254, -1, + 255, 257, -1, 254, 196, 257, -1, 262, 79, 191, + -1, 271, 79, -1, 271, 79, 193, 250, 194, -1, + 268, 258, 256, -1, 258, 256, -1, 268, 258, 259, + -1, 258, 259, -1, -1, 36, -1, 37, -1, 38, + -1, 271, -1, 261, -1, 260, 196, 79, -1, 260, + 196, 79, 193, 194, -1, 260, 196, 79, 193, 250, + 194, -1, 260, 196, 79, 193, 194, 211, 281, -1, + 260, 196, 79, 193, 250, 194, 211, 281, -1, 260, + 196, 79, 211, 281, -1, 262, -1, 262, 79, -1, + 262, 79, 193, 194, -1, 262, 79, 193, 250, 194, + -1, 262, 79, 193, 194, 211, 281, -1, 262, 79, + 193, 250, 194, 211, 281, -1, 262, 79, 211, 281, + -1, 106, 79, -1, 271, -1, 269, 271, -1, -1, + 264, -1, 120, 191, 265, 192, -1, 266, -1, 265, + 196, 266, -1, 79, -1, 43, -1, 42, -1, 41, + -1, 4, -1, 270, -1, 267, 269, -1, 106, 269, + -1, 4, -1, 3, -1, 263, 40, -1, 35, 40, + -1, 263, 36, -1, 37, -1, 35, 36, -1, 35, + 37, -1, 39, -1, 272, -1, 275, 272, -1, 273, + -1, 273, 193, 194, -1, 273, 193, 250, 194, -1, + 274, -1, 276, -1, 79, -1, 77, -1, 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, @@ -777,59 +778,59 @@ static const yytype_int16 yyrhs[] = 64, -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, 71, -1, 72, -1, 73, -1, 74, -1, 75, -1, 109, -1, 108, -1, 107, -1, - 76, 79, 212, 276, 213, -1, 76, 212, 276, 213, - -1, 277, -1, 276, 277, -1, 270, 278, 211, -1, - 279, -1, 278, 195, 279, -1, 79, -1, 79, 192, - 249, 193, -1, 246, -1, 250, -1, 283, -1, 284, - -1, 286, -1, 285, -1, 292, -1, 281, -1, 290, - -1, 291, -1, 294, -1, 295, -1, 296, -1, 300, - -1, 212, 213, -1, 212, 289, 213, -1, 288, -1, - 285, -1, 212, 213, -1, 212, 289, 213, -1, 282, - -1, 289, 282, -1, 211, -1, 248, 211, -1, 14, - 190, 248, 191, 283, 12, 283, -1, 14, 190, 248, - 191, 283, -1, 14, 190, 248, 191, 284, -1, 14, - 190, 248, 191, 283, 12, 284, -1, 248, -1, 261, - 79, 210, 280, -1, 17, 190, 248, 191, 286, -1, - 18, 248, 209, -1, 19, 209, -1, 78, 190, 293, - 191, 287, -1, 11, 282, 78, 190, 248, 191, 211, - -1, 13, 190, 297, 299, 191, 287, -1, 290, -1, - 281, -1, 293, -1, -1, 298, 211, -1, 298, 211, - 248, -1, 10, 211, -1, 9, 211, -1, 16, 211, - -1, 16, 248, 211, -1, 15, 211, -1, 302, -1, - 250, -1, 251, 288, -1 + 76, 79, 213, 277, 214, -1, 76, 213, 277, 214, + -1, 278, -1, 277, 278, -1, 271, 279, 212, -1, + 280, -1, 279, 196, 280, -1, 79, -1, 79, 193, + 250, 194, -1, 247, -1, 251, -1, 284, -1, 285, + -1, 287, -1, 286, -1, 293, -1, 282, -1, 291, + -1, 292, -1, 295, -1, 296, -1, 297, -1, 301, + -1, 213, 214, -1, 213, 290, 214, -1, 289, -1, + 286, -1, 213, 214, -1, 213, 290, 214, -1, 283, + -1, 290, 283, -1, 212, -1, 249, 212, -1, 14, + 191, 249, 192, 284, 12, 284, -1, 14, 191, 249, + 192, 284, -1, 14, 191, 249, 192, 285, -1, 14, + 191, 249, 192, 284, 12, 285, -1, 249, -1, 262, + 79, 211, 281, -1, 17, 191, 249, 192, 287, -1, + 18, 249, 210, -1, 19, 210, -1, 78, 191, 294, + 192, 288, -1, 11, 283, 78, 191, 249, 192, 212, + -1, 13, 191, 298, 300, 192, 288, -1, 291, -1, + 282, -1, 294, -1, -1, 299, 212, -1, 299, 212, + 249, -1, 10, 212, -1, 9, 212, -1, 16, 212, + -1, 16, 249, 212, -1, 15, 212, -1, 303, -1, + 251, -1, 252, 289, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 208, 208, 207, 216, 219, 236, 238, 242, 251, - 259, 270, 274, 281, 288, 295, 302, 309, 316, 317, - 323, 327, 334, 340, 349, 353, 357, 358, 367, 368, - 372, 373, 377, 383, 395, 399, 405, 412, 423, 424, - 430, 436, 446, 447, 448, 449, 453, 454, 460, 466, - 475, 476, 482, 491, 492, 498, 507, 508, 514, 520, - 526, 535, 536, 542, 551, 552, 561, 562, 571, 572, - 581, 582, 591, 592, 601, 602, 611, 612, 621, 622, - 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, - 641, 645, 649, 665, 669, 673, 677, 691, 695, 696, - 700, 705, 713, 724, 734, 749, 756, 761, 772, 784, - 785, 786, 787, 791, 795, 796, 805, 814, 823, 832, - 841, 854, 865, 874, 883, 892, 901, 910, 919, 933, - 940, 951, 952, 956, 963, 964, 971, 1005, 1006, 1007, - 1011, 1015, 1016, 1020, 1028, 1029, 1030, 1031, 1032, 1033, - 1034, 1035, 1036, 1040, 1041, 1049, 1050, 1056, 1065, 1071, - 1077, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, - 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, - 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, - 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, - 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, - 1135, 1136, 1137, 1138, 1139, 1143, 1154, 1165, 1179, 1185, - 1194, 1199, 1207, 1222, 1227, 1235, 1241, 1250, 1254, 1260, - 1261, 1265, 1266, 1270, 1274, 1275, 1276, 1277, 1278, 1279, - 1280, 1284, 1290, 1299, 1300, 1304, 1310, 1319, 1329, 1341, - 1347, 1356, 1365, 1371, 1377, 1386, 1390, 1404, 1408, 1409, - 1413, 1420, 1427, 1437, 1438, 1442, 1444, 1450, 1455, 1464, - 1470, 1476, 1482, 1488, 1497, 1498, 1502 + 0, 210, 210, 209, 218, 221, 238, 240, 244, 253, + 261, 272, 276, 283, 290, 297, 304, 311, 318, 319, + 325, 329, 336, 342, 351, 355, 359, 360, 369, 370, + 374, 375, 379, 385, 397, 401, 407, 414, 425, 426, + 432, 438, 448, 449, 450, 451, 455, 456, 462, 468, + 477, 478, 484, 493, 494, 500, 509, 510, 516, 522, + 528, 537, 538, 544, 553, 554, 563, 564, 573, 574, + 583, 584, 593, 594, 603, 604, 613, 614, 623, 624, + 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, + 643, 647, 651, 667, 671, 675, 679, 693, 697, 698, + 702, 707, 715, 726, 736, 751, 758, 763, 774, 786, + 787, 788, 789, 793, 797, 798, 807, 816, 825, 834, + 843, 856, 867, 876, 885, 894, 903, 912, 921, 935, + 942, 953, 954, 958, 965, 966, 973, 1007, 1008, 1009, + 1013, 1017, 1018, 1022, 1030, 1031, 1032, 1033, 1034, 1035, + 1036, 1037, 1038, 1042, 1043, 1051, 1052, 1058, 1067, 1073, + 1079, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, + 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, + 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, + 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, + 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, + 1137, 1138, 1139, 1140, 1141, 1145, 1156, 1167, 1181, 1187, + 1196, 1201, 1209, 1224, 1229, 1237, 1243, 1252, 1256, 1262, + 1263, 1267, 1268, 1272, 1276, 1277, 1278, 1279, 1280, 1281, + 1282, 1286, 1292, 1301, 1302, 1306, 1312, 1321, 1331, 1343, + 1349, 1358, 1367, 1373, 1379, 1388, 1392, 1406, 1410, 1411, + 1415, 1422, 1429, 1439, 1440, 1444, 1446, 1452, 1457, 1466, + 1472, 1478, 1484, 1490, 1499, 1500, 1504 }; #endif @@ -865,11 +866,11 @@ static const char *const yytname[] = "HALF", "FIXED", "UNSIGNED", "INPUT", "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", - "CAST", "NAMESPACE", "USING", "COMMON", "PARTITION", "ACTIVE", - "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D", "IMAGECUBE", - "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", "IIMAGE3D", - "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", "UIMAGE2D", - "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", + "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", "PARTITION", + "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D", + "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", + "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", + "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", "UIMAGEBUFFER", "ROW_MAJOR", "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", @@ -935,43 +936,43 @@ static const yytype_uint16 yytoknum[] = 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 40, 41, 91, 93, 46, 44, 43, 45, 33, 126, - 42, 47, 37, 60, 62, 38, 94, 124, 63, 58, - 61, 59, 123, 125 + 445, 40, 41, 91, 93, 46, 44, 43, 45, 33, + 126, 42, 47, 37, 60, 62, 38, 94, 124, 63, + 58, 61, 59, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 214, 216, 215, 217, 217, 218, 218, 219, 220, - 220, 221, 222, 222, 222, 222, 222, 222, 223, 223, - 223, 223, 223, 223, 224, 225, 226, 226, 227, 227, - 228, 228, 229, 229, 230, 231, 231, 231, 232, 232, - 232, 232, 233, 233, 233, 233, 234, 234, 234, 234, - 235, 235, 235, 236, 236, 236, 237, 237, 237, 237, - 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, - 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 248, 248, 249, 250, 250, 250, 251, 252, 252, - 253, 253, 254, 255, 255, 256, 256, 256, 256, 257, - 257, 257, 257, 258, 259, 259, 259, 259, 259, 259, - 259, 260, 260, 260, 260, 260, 260, 260, 260, 261, - 261, 262, 262, 263, 264, 264, 265, 266, 266, 266, - 267, 268, 268, 268, 269, 269, 269, 269, 269, 269, - 269, 269, 269, 270, 270, 271, 271, 271, 272, 272, - 272, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 274, 274, 274, 275, 275, - 276, 276, 277, 278, 278, 279, 279, 280, 281, 282, - 282, 283, 283, 284, 285, 285, 285, 285, 285, 285, - 285, 286, 286, 287, 287, 288, 288, 289, 289, 290, - 290, 291, 292, 292, 292, 293, 293, 294, 295, 295, - 296, 296, 296, 297, 297, 298, 298, 299, 299, 300, - 300, 300, 300, 300, 301, 301, 302 + 0, 215, 217, 216, 218, 218, 219, 219, 220, 221, + 221, 222, 223, 223, 223, 223, 223, 223, 224, 224, + 224, 224, 224, 224, 225, 226, 227, 227, 228, 228, + 229, 229, 230, 230, 231, 232, 232, 232, 233, 233, + 233, 233, 234, 234, 234, 234, 235, 235, 235, 235, + 236, 236, 236, 237, 237, 237, 238, 238, 238, 238, + 238, 239, 239, 239, 240, 240, 241, 241, 242, 242, + 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, + 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, + 248, 249, 249, 250, 251, 251, 251, 252, 253, 253, + 254, 254, 255, 256, 256, 257, 257, 257, 257, 258, + 258, 258, 258, 259, 260, 260, 260, 260, 260, 260, + 260, 261, 261, 261, 261, 261, 261, 261, 261, 262, + 262, 263, 263, 264, 265, 265, 266, 267, 267, 267, + 268, 269, 269, 269, 270, 270, 270, 270, 270, 270, + 270, 270, 270, 271, 271, 272, 272, 272, 273, 273, + 273, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 275, 275, 275, 276, 276, + 277, 277, 278, 279, 279, 280, 280, 281, 282, 283, + 283, 284, 284, 285, 286, 286, 286, 286, 286, 286, + 286, 287, 287, 288, 288, 289, 289, 290, 290, 291, + 291, 292, 293, 293, 293, 294, 294, 295, 296, 296, + 297, 297, 297, 298, 298, 299, 299, 300, 300, 301, + 301, 301, 301, 301, 302, 302, 303 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1072,65 +1073,65 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -351 +#define YYPACT_NINF -361 static const yytype_int16 yypact[] = { - -85, -52, 36, -351, -60, -351, -30, -351, -31, 3875, - -351, -27, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, 69, -351, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -78, -351, -351, 8, -351, -351, -351, 50, -83, - -351, -351, 3757, -351, -63, 4, -44, 3, -169, -351, - 82, -5, -351, 166, 4104, -351, -351, -351, 14, -351, - 4217, -351, -351, -351, 135, -351, -351, -351, -12, 4104, - -351, 166, -351, 4217, 142, -351, -351, 401, -351, -351, - 18, -351, -351, -351, -351, -351, 4104, 127, 144, -351, - -112, -351, -351, -351, -351, 2857, -351, 107, 4104, 146, - 2254, -351, 20, -351, -99, -351, 21, 25, 1245, 39, - 47, 27, 2480, 49, 3397, 31, 53, -69, -351, -351, - -351, -351, -351, 3397, 3397, 3397, -351, -351, -351, -351, - -351, 612, -351, -351, -351, -68, -351, -351, -351, 54, - -59, 3577, 56, -36, 3397, -34, -25, 112, -81, 121, - 45, 38, 44, 159, 158, -88, -351, -351, -167, -351, - 46, 66, -351, -351, -351, -351, -351, -351, 823, -351, - -351, -351, -351, -351, -351, -351, -351, -351, -351, 179, - 4104, -178, -351, 3037, 3397, -351, -351, -351, 67, -351, - -351, 2367, 70, -121, -351, -351, -351, -351, -351, 142, - -351, -351, 181, 1862, 3397, -351, -351, -114, 3397, -172, - -351, 2677, -351, -351, -58, -351, 1034, -351, -351, 3397, - 3991, -351, -351, 3397, 72, -351, -351, -351, -351, -351, - -351, -351, -351, -351, -351, -351, -351, -351, 3397, -351, - 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, - 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, 3397, - 3397, -351, -351, -351, 73, -351, -351, 3217, 3397, 51, - 71, -351, -351, -351, -351, 3397, 146, -351, -351, 76, - -351, -351, 2059, -51, -351, -50, -351, 74, 188, 77, - -351, -351, 78, 74, 80, -351, -351, -351, -351, -351, - -351, -34, -34, -25, -25, 112, 112, 112, 112, -81, - -81, 121, 45, 38, 44, 159, 158, -125, -351, 3397, - 63, 81, -351, 3397, 65, 83, -351, 3397, -351, 68, - 86, 1245, 75, 79, 1455, -351, 3397, 85, 3397, 84, - -351, 3397, -351, -49, 3397, 1455, 268, -351, -351, 3397, - 91, -351, -351, -351, -351, -351, -351, 3397, -351, 87, - 74, -351, 1245, -351, 3397, -351, -351, -351, -351, -48, - 1665, 270, 1665 + -51, -15, 81, -361, -34, -361, -24, -361, 25, 3891, + -361, -19, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -361, -361, 69, -361, -361, -361, -361, -361, -361, + -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -78, -361, -361, 8, -361, -361, -361, 49, -80, + -361, -361, 3773, -361, -177, -79, -55, 2, -168, -361, + 70, 56, -361, 28, 4120, -361, -361, -361, -39, -361, + 4233, -361, -361, -361, 80, -361, -361, -361, -67, 4120, + -361, 28, -361, 4233, 95, -361, -361, 401, -361, -361, + 18, -361, -361, -361, -361, -361, 4120, 176, 116, -361, + -113, -361, -361, -361, -361, 2868, -361, 86, 4120, 126, + 2263, -361, 9, -361, -89, -361, 17, 24, 1249, 46, + 47, 27, 2489, 52, 3411, 30, 53, -70, -361, -361, + -361, -361, -361, 3411, 3411, 3411, -361, -361, -361, -361, + -361, 613, -361, -361, -361, -69, -361, -361, -361, 54, + -76, 3592, 59, 67, 3411, 22, 0, 115, -82, 125, + 39, 44, 45, 159, 161, -90, -361, -361, -159, -361, + 48, 66, -361, -361, -361, -361, -361, -361, 825, -361, + -361, -361, -361, -361, -361, -361, -361, -361, -361, 179, + 4120, -170, -361, 3049, 3411, -361, -361, -361, 65, -361, + -361, 2376, 68, -122, -361, -361, -361, -361, -361, 95, + -361, -361, 184, 1869, 3411, -361, -361, -121, 3411, -162, + -361, 2687, -361, -361, -60, -361, 1037, -361, -361, 3411, + 4007, -361, -361, 3411, 71, -361, -361, -361, -361, -361, + -361, -361, -361, -361, -361, -361, -361, -361, 3411, -361, + 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, + 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, + 3411, -361, -361, -361, 72, -361, -361, 3230, 3411, 55, + 73, -361, -361, -361, -361, 3411, 126, -361, -361, 77, + -361, -361, 2067, -59, -361, -52, -361, 74, 185, 79, + -361, -361, 75, 74, 82, -361, -361, -361, -361, -361, + -361, 22, 22, 0, 0, 115, 115, 115, 115, -82, + -82, 125, 39, 44, 45, 159, 161, -128, -361, 3411, + 61, 83, -361, 3411, 63, 85, -361, 3411, -361, 64, + 88, 1249, 62, 76, 1460, -361, 3411, 87, 3411, 78, + -361, 3411, -361, -49, 3411, 1460, 270, -361, -361, 3411, + 92, -361, -361, -361, -361, -361, -361, 3411, -361, 84, + 74, -361, 1249, -361, 3411, -361, -361, -361, -361, -41, + 1671, 272, 1671 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, - -351, -351, -351, 23, -351, -351, -351, -351, -105, -351, - -67, -66, -134, -65, -8, -10, -7, -6, -4, -3, - -351, -111, -148, -351, -149, -221, 6, 9, -351, -351, - -351, 88, 171, 165, 89, -351, -351, -247, -351, -351, - -351, 57, -351, -351, -40, -351, -9, -75, -351, -351, - 219, -351, 161, -127, -351, -16, -262, 58, -131, -299, - -350, -292, -70, -82, 220, 134, 64, -351, -351, -11, - -351, -351, -351, -351, -351, -351, -351, 224, -351 + -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, + -361, -361, -361, 26, -361, -361, -361, -361, -105, -361, + -64, -54, -81, -65, -8, -6, -5, -4, -3, -7, + -361, -111, -148, -361, -149, -221, 6, 11, -361, -361, + -361, 89, 173, 168, 90, -361, -361, -238, -361, -361, + -361, 58, -361, -361, -47, -361, -9, -71, -361, -361, + 220, -361, 162, -130, -361, -17, -236, 60, -131, -350, + -345, -360, -68, -84, 218, 134, 91, -361, -361, -16, + -361, -361, -361, -361, -361, -361, -361, 225, -361 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1140,40 +1141,40 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -267 static const yytype_int16 yytable[] = { - 96, 108, 310, 247, 328, 249, 298, 121, 287, 288, - -160, 12, 13, 236, 307, 83, 254, 242, 84, 257, - 258, 387, 121, 300, 227, 136, 128, 1, 300, 4, - 226, 131, 308, 265, 112, 132, 5, 326, 142, 122, - 123, 124, 129, 33, 301, 34, 362, 35, 11, 36, - 37, 38, 408, 133, 122, 123, 124, 7, 252, 253, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 300, 112, 386, 96, 316, 328, 311, 303, 222, 279, - 223, 300, 391, 8, 376, 134, 361, 110, 83, 104, - 317, 84, 238, 391, 365, 323, 239, 324, 224, 325, - 139, 380, 327, 407, 236, 105, 106, 114, 201, 107, - 333, 411, 227, 407, 111, 336, 396, 219, 226, 398, - 299, -36, 289, 290, 259, 303, 260, 403, 79, 139, - 337, 139, 262, 330, 109, 405, 263, 300, 377, 201, - 371, 372, 399, 410, 300, 300, 300, 300, 116, 117, - 357, 120, 358, 345, 346, 347, 348, 75, 76, 77, - 311, 130, 201, 122, 123, 124, 280, 281, 282, 12, - 13, 283, 284, 327, 277, 338, 339, 340, 226, 226, + 96, 108, 310, 247, 298, 249, 121, 287, 288, -160, + 236, 12, 13, 328, 391, 83, 254, 242, 257, 258, + 84, 386, 121, 307, 227, 391, 387, 112, 128, 136, + 226, 12, 13, 265, 300, 116, 117, 300, 122, 123, + 124, 308, 142, 33, 129, 34, 133, 35, 326, 36, + 37, 38, 407, 301, 122, 123, 124, 408, 252, 253, + 411, 1, 407, 33, 112, 34, 4, 35, 300, 36, + 37, 38, 362, 96, 316, 300, 311, 303, 222, 279, + 223, 5, 376, 7, 328, 134, 361, 110, 83, 8, + 317, 324, 131, 84, 365, 323, 132, 104, 224, 325, + 139, 236, 327, 238, 11, 105, 106, 239, 201, 107, + 333, 114, 227, 119, 111, 336, 262, 219, 226, 299, + 263, -36, 289, 290, 259, 303, 260, 380, 79, 139, + 337, 139, 330, 371, 111, 109, 300, 300, 377, 201, + 372, 120, 396, 399, 300, 398, 138, 300, 79, 130, + 357, 410, 358, 403, 135, 300, 75, 76, 77, 137, + 311, 405, 201, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 327, 143, 338, 339, 340, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 226, 226, 226, 226, -98, 119, 227, 285, 286, 201, - 138, 33, 226, 34, 227, 35, 135, 36, 37, 38, - 226, 219, 291, 292, 137, 311, 341, 342, 383, 343, - 344, 143, 139, 221, 230, 232, 349, 350, 394, 243, - 311, 237, 240, 311, 201, 400, 241, 244, 245, 248, - 250, 311, 201, 251, 294, 261, 266, 201, 227, 311, - 293, 295, 296, 297, 226, 409, -35, 116, 304, 319, - 313, 363, 315, -30, 364, 359, 367, 373, 374, 300, - -36, 375, 111, 378, 379, 381, 382, 385, 395, 384, - 402, 404, 412, 335, 352, 351, 79, 171, 353, 389, - 354, 216, 220, 355, 397, 356, 318, 113, 406, 231, - 366, 320, 388, 401, 118, 256, 115, 321, 305, 306, - 0, 368, 0, 201, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 226, 226, 226, 226, -98, 221, 227, 283, 284, 201, + 285, 286, 226, 230, 227, 232, 345, 346, 347, 348, + 226, 219, 122, 123, 124, 311, 291, 292, 383, 341, + 342, 237, 139, 280, 281, 282, 349, 350, 394, 240, + 311, 343, 344, 311, 201, 400, 241, 243, 244, 245, + 250, 311, 201, 248, 251, 293, 261, 201, 227, 311, + 266, 294, 296, 295, 226, 409, 297, -35, 304, 313, + 116, 315, 319, -30, 373, 359, 363, 364, 367, 375, + 300, 374, 378, -36, 381, 171, 384, 379, 277, 382, + 385, 395, 402, 404, 412, 351, 335, 389, 352, 397, + 353, 356, 354, 216, 355, 220, 406, 318, 113, 366, + 231, 401, 118, 320, 388, 256, 368, 115, 0, 305, + 306, 0, 0, 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 0, 0, 201, 0, 0, 0, 0, @@ -1199,30 +1200,9 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, - 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 170, 171, 172, 12, 13, 14, 15, 16, - 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, - 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, - 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 156, 157, 158, 159, 160, 161, 162, 0, 0, 163, - 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, - 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 170, 171, 255, 12, 13, 14, 15, + 0, 0, 0, 170, 171, 172, 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, @@ -1239,32 +1219,11 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, - 167, 168, 169, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 170, 171, 302, 12, 13, 14, - 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, - 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 156, 157, 158, 159, 160, 161, 162, 0, - 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 75, 76, 77, 0, 78, 0, 0, 0, 0, - 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, - 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 170, 171, 331, 12, 13, + 0, 0, 0, 0, 0, 170, 171, 255, 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, @@ -1283,71 +1242,94 @@ static const yytype_int16 yytable[] = 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, - 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 170, 171, 12, 13, - 14, 15, 16, 17, 146, 147, 148, 0, 149, 390, - 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, - 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, + 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 170, 171, 302, + 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, + 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, + 0, 0, 0, 74, 75, 76, 77, 0, 78, 0, + 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, - 0, 166, 167, 168, 169, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 170, 117, 12, 13, - 14, 15, 16, 17, 146, 147, 148, 0, 149, 390, - 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, - 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, + 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, + 171, 331, 12, 13, 14, 15, 16, 17, 146, 147, + 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 0, 34, 0, 35, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 156, 157, 158, + 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 74, 75, 76, 77, 0, + 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, - 0, 166, 167, 168, 169, 12, 13, 14, 15, 16, - 17, 0, 0, 0, 0, 0, 170, 171, 0, 0, - 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, - 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 0, 157, 158, 159, 160, 161, 162, 0, 0, 163, - 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, - 76, 77, 0, 78, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 170, 171, 12, 13, 14, 15, 16, 17, 146, + 147, 148, 0, 149, 390, 151, 152, 153, 154, 155, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 0, 34, 0, 35, + 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 156, 157, + 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 74, 75, 76, 77, + 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, + 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, + 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 170, 117, 12, 13, 14, 15, 16, 17, + 146, 147, 148, 0, 149, 390, 151, 152, 153, 154, + 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, + 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 156, + 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, 12, 13, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 170, 0, 0, 0, 0, 0, 18, + 0, 0, 0, 170, 171, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, @@ -1356,54 +1338,74 @@ static const yytype_int16 yytable[] = 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 111, 75, 76, 77, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, + 0, 0, 0, 0, 0, 74, 75, 76, 77, 0, + 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, - 0, 0, 0, 0, 0, 166, 167, 168, 169, 14, - 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, - -266, 0, 0, 0, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, + 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, + 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 170, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 80, 0, - 81, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, + 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, + 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 235, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 0, 0, 0, 111, 75, 76, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 0, 157, - 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 0, 0, 0, 0, 75, 76, 77, + 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, + 0, 0, 0, 0, 166, 167, 168, 169, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 0, 0, -266, + 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 235, 0, 0, + 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, + 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 80, 0, 81, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, + 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, + 314, 0, 0, 0, 0, 0, 75, 76, 77, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1426,196 +1428,196 @@ static const yytype_int16 yytable[] = 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 15, 16, 17, 0, 165, 0, + 0, 0, 0, 0, 166, 167, 168, 169, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 0, 157, 158, 159, + 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, - 225, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, + 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 14, 15, 16, 17, 0, 165, + 0, 0, 225, 0, 0, 166, 167, 168, 169, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, + 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, - 309, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 165, 0, 0, 309, 0, 0, 166, 167, 168, 169, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 0, 157, + 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, - 360, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, + 0, 165, 0, 0, 360, 0, 0, 166, 167, 168, + 169, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, + 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 264, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, + 17, 0, 165, 0, 0, 0, 0, 0, 166, 167, + 168, 169, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 264, + 0, 157, 158, 159, 160, 161, 162, 0, 0, 163, + 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, - 12, 13, 14, 15, 16, 17, 0, 165, 0, 0, - 0, 0, 0, 166, 167, 168, 169, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 76, 77, 0, 78, 0, - 0, 0, 0, 0, 0, 0, 0, 79, 12, 13, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 80, 34, 81, 35, 0, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -3, 0, 0, 12, 13, 14, 15, + 16, 17, 0, 165, 0, 0, 0, 0, 0, 166, + 167, 168, 169, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, + 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 79, 14, 15, 16, 17, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, + 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 0, 79, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 39, 40, 41, 42, 43, + 27, 28, 29, 30, 31, 32, 33, 80, 34, 81, + 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, - 334, 0, 0, 0, 0, 162, 0, 0, 0, 0, + 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, - 77, 0, 0, 0, 0, 0, 0, 0, 0, 14, - 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, - 0, 0, 0, 0, 0, 80, 0, 81, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 79, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 0, 0, 0, 80, 0, - 81, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 31, 32, 0, 0, 0, 80, 0, 81, 0, 0, + 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, + 68, 69, 70, 71, 72, 0, 334, 0, 0, 0, + 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, + 0, 80, 0, 81, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, + 0, 0, 0, 0, 80, 0, 81, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81 + 0, 0, 0, 0, 0, 0, 0, 80, 0, 81 }; static const yytype_int16 yycheck[] = { - 9, 79, 223, 152, 251, 154, 94, 4, 89, 90, - 79, 3, 4, 140, 192, 9, 165, 148, 9, 87, - 88, 371, 4, 195, 135, 100, 195, 112, 195, 81, - 135, 36, 210, 181, 74, 40, 0, 209, 113, 36, - 37, 38, 211, 35, 211, 37, 308, 39, 79, 41, - 42, 43, 402, 93, 36, 37, 38, 117, 163, 164, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 195, 111, 371, 82, 195, 322, 224, 208, 190, 184, - 192, 195, 374, 113, 209, 94, 307, 79, 82, 116, - 211, 82, 191, 385, 315, 244, 195, 211, 210, 248, - 109, 363, 251, 402, 231, 36, 37, 190, 117, 40, - 259, 410, 223, 412, 106, 263, 378, 126, 223, 381, - 208, 190, 203, 204, 192, 256, 194, 389, 120, 138, - 278, 140, 191, 191, 212, 397, 195, 195, 359, 148, - 191, 191, 191, 191, 195, 195, 195, 195, 211, 212, - 299, 195, 300, 287, 288, 289, 290, 107, 108, 109, - 308, 79, 171, 36, 37, 38, 200, 201, 202, 3, - 4, 196, 197, 322, 210, 280, 281, 282, 283, 284, + 9, 79, 223, 152, 94, 154, 4, 89, 90, 79, + 140, 3, 4, 251, 374, 9, 165, 148, 87, 88, + 9, 371, 4, 193, 135, 385, 371, 74, 196, 100, + 135, 3, 4, 181, 196, 212, 213, 196, 36, 37, + 38, 211, 113, 35, 212, 37, 93, 39, 210, 41, + 42, 43, 402, 212, 36, 37, 38, 402, 163, 164, + 410, 112, 412, 35, 111, 37, 81, 39, 196, 41, + 42, 43, 308, 82, 196, 196, 224, 208, 191, 184, + 193, 0, 210, 117, 322, 94, 307, 79, 82, 113, + 212, 212, 36, 82, 315, 244, 40, 116, 211, 248, + 109, 231, 251, 192, 79, 36, 37, 196, 117, 40, + 259, 191, 223, 192, 106, 263, 192, 126, 223, 209, + 196, 191, 204, 205, 193, 256, 195, 363, 120, 138, + 278, 140, 192, 192, 106, 213, 196, 196, 359, 148, + 192, 196, 378, 192, 196, 381, 213, 196, 120, 79, + 299, 192, 300, 389, 193, 196, 107, 108, 109, 79, + 308, 397, 171, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 322, 79, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 191, 191, 307, 85, 86, 208, - 212, 35, 307, 37, 315, 39, 192, 41, 42, 43, - 315, 220, 91, 92, 79, 363, 283, 284, 367, 285, - 286, 79, 231, 79, 117, 79, 291, 292, 376, 190, - 378, 211, 211, 381, 243, 384, 211, 190, 211, 190, - 209, 389, 251, 190, 206, 191, 190, 256, 359, 397, - 205, 207, 93, 95, 359, 404, 190, 211, 79, 78, - 193, 210, 192, 191, 193, 192, 190, 79, 191, 195, - 190, 193, 106, 210, 193, 210, 193, 191, 193, 211, - 12, 190, 12, 260, 294, 293, 120, 212, 295, 210, - 296, 120, 127, 297, 210, 298, 239, 78, 211, 138, - 316, 243, 372, 385, 84, 171, 82, 243, 220, 220, - -1, 322, -1, 322, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 295, 296, 297, 298, 192, 79, 307, 197, 198, 208, + 85, 86, 307, 117, 315, 79, 287, 288, 289, 290, + 315, 220, 36, 37, 38, 363, 91, 92, 367, 283, + 284, 212, 231, 201, 202, 203, 291, 292, 376, 212, + 378, 285, 286, 381, 243, 384, 212, 191, 191, 212, + 210, 389, 251, 191, 191, 206, 192, 256, 359, 397, + 191, 207, 93, 208, 359, 404, 95, 191, 79, 194, + 212, 193, 78, 192, 79, 193, 211, 194, 191, 194, + 196, 192, 211, 191, 211, 213, 212, 194, 211, 194, + 192, 194, 12, 191, 12, 293, 260, 211, 294, 211, + 295, 298, 296, 120, 297, 127, 212, 239, 78, 316, + 138, 385, 84, 243, 372, 171, 322, 82, -1, 220, + 220, -1, -1, 322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 371, -1, -1, 374, -1, -1, -1, -1, @@ -1641,30 +1643,9 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 190, -1, -1, -1, -1, -1, 196, 197, 198, - 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 211, 212, 213, 3, 4, 5, 6, 7, - 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, - -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, - 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, - 108, 109, -1, 111, -1, -1, -1, -1, -1, -1, - -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 190, -1, -1, -1, -1, -1, 196, 197, - 198, 199, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 211, 212, 213, 3, 4, 5, 6, + -1, -1, 191, -1, -1, -1, -1, -1, 197, 198, + 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 212, 213, 214, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, @@ -1683,30 +1664,9 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 190, -1, -1, -1, -1, -1, 196, - 197, 198, 199, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 211, 212, 213, 3, 4, 5, - 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, - -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 106, 107, 108, 109, -1, 111, -1, -1, -1, -1, - -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, - 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 190, -1, -1, -1, -1, -1, - 196, 197, 198, 199, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 211, 212, 213, 3, 4, + -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, + 197, 198, 199, 200, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 212, 213, 214, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, @@ -1725,133 +1685,114 @@ static const yytype_int16 yycheck[] = -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, - -1, 196, 197, 198, 199, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 211, 212, 3, 4, - 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, - -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, - -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, - -1, 196, 197, 198, 199, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 211, 212, 3, 4, - 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, - -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, - -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, + -1, -1, 197, 198, 199, 200, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 212, 213, 214, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, - -1, 196, 197, 198, 199, 3, 4, 5, 6, 7, - 8, -1, -1, -1, -1, -1, 211, 212, -1, -1, - -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, - -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, - 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, - 108, 109, -1, 111, -1, -1, -1, -1, -1, -1, - -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, -1, 111, -1, + -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 190, -1, -1, -1, -1, -1, 196, 197, - 198, 199, 3, 4, 5, 6, 7, 8, -1, -1, - -1, -1, -1, 211, -1, -1, -1, -1, -1, 20, + -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, + -1, -1, -1, -1, 197, 198, 199, 200, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 212, + 213, 214, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, + 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 190, - -1, -1, -1, -1, -1, 196, 197, 198, 199, 5, - 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, - 211, -1, -1, -1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, 154, -1, - 156, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 212, 213, 3, 4, 5, 6, 7, 8, 9, + 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - -1, 154, -1, 156, 44, 45, 46, 47, 48, 49, + 30, 31, 32, 33, 34, 35, -1, 37, -1, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 213, -1, -1, -1, -1, -1, -1, 107, 108, 109, + -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, + -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, + 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, + -1, 191, -1, -1, -1, -1, -1, 197, 198, 199, + 200, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 212, 213, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 190, -1, -1, -1, -1, -1, 196, 197, 198, 199, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 191, -1, -1, -1, -1, -1, 197, 198, + 199, 200, 3, 4, 5, 6, 7, 8, -1, -1, + -1, -1, -1, 212, 213, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, + 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, + 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, - -1, 211, -1, -1, -1, -1, -1, 20, 21, 22, + -1, 212, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, @@ -1868,206 +1809,268 @@ static const yytype_int16 yycheck[] = -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, - -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, + -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, + -1, -1, -1, -1, 197, 198, 199, 200, 5, 6, + 7, 8, -1, -1, -1, -1, -1, -1, -1, 212, + -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, -1, -1, -1, -1, -1, -1, 154, -1, 156, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 214, -1, -1, + -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 7, 8, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, + 154, -1, 156, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, + 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 214, -1, -1, -1, -1, -1, 107, 108, 109, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, + 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, + -1, 212, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 106, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, - 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 7, 8, -1, 191, -1, + -1, -1, -1, -1, 197, 198, 199, 200, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, + 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, - 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 7, 8, -1, 191, + -1, -1, 194, -1, -1, 197, 198, 199, 200, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, + 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, - 193, -1, -1, 196, 197, 198, 199, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + 191, -1, -1, 194, -1, -1, 197, 198, 199, 200, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, + 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, 190, -1, -1, - -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, + -1, 191, -1, -1, 194, -1, -1, 197, 198, 199, + 200, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, + 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, + 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, - 3, 4, 5, 6, 7, 8, -1, 190, -1, -1, - -1, -1, -1, 196, 197, 198, 199, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, + 8, -1, 191, -1, -1, -1, -1, -1, 197, 198, + 199, 200, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, + 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, + 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, -1, 111, -1, - -1, -1, -1, -1, -1, -1, -1, 120, 3, 4, - 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 154, 37, 156, 39, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, - -1, -1, -1, -1, -1, 120, 5, 6, 7, 8, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 0, -1, -1, 3, 4, 5, 6, + 7, 8, -1, 191, -1, -1, -1, -1, -1, 197, + 198, 199, 200, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, + 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, + 107, 108, 109, -1, 111, -1, -1, -1, -1, -1, + -1, -1, -1, 120, 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, -1, -1, -1, 154, - -1, 156, -1, -1, -1, 44, 45, 46, 47, 48, + 29, 30, 31, 32, 33, 34, 35, 154, 37, 156, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, - 79, -1, -1, -1, -1, 84, -1, -1, -1, -1, + 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, - 109, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, - -1, -1, -1, -1, -1, 154, -1, 156, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, -1, 79, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, + 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, 120, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, -1, 154, -1, - 156, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 33, 34, -1, -1, -1, 154, -1, 156, -1, -1, + -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, + -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + -1, 154, -1, 156, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, 154, -1, 156, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156 + -1, -1, -1, -1, -1, -1, -1, 154, -1, 156 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 112, 215, 217, 81, 0, 218, 117, 113, 216, - 219, 79, 3, 4, 5, 6, 7, 8, 20, 21, + 0, 112, 216, 218, 81, 0, 219, 117, 113, 217, + 220, 79, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 106, 107, 108, 109, 111, 120, - 154, 156, 220, 250, 251, 252, 253, 254, 259, 260, - 261, 262, 263, 266, 268, 269, 270, 271, 272, 273, - 274, 275, 301, 302, 116, 36, 37, 40, 79, 212, - 79, 106, 268, 274, 190, 301, 211, 212, 288, 191, - 195, 4, 36, 37, 38, 256, 257, 267, 195, 211, - 79, 36, 40, 268, 270, 192, 271, 79, 212, 270, - 276, 277, 271, 79, 264, 265, 9, 10, 11, 13, + 154, 156, 221, 251, 252, 253, 254, 255, 260, 261, + 262, 263, 264, 267, 269, 270, 271, 272, 273, 274, + 275, 276, 302, 303, 116, 36, 37, 40, 79, 213, + 79, 106, 269, 275, 191, 302, 212, 213, 289, 192, + 196, 4, 36, 37, 38, 257, 258, 268, 196, 212, + 79, 36, 40, 269, 271, 193, 272, 79, 213, 271, + 277, 278, 272, 79, 265, 266, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 78, 79, 80, 81, - 82, 83, 84, 87, 88, 190, 196, 197, 198, 199, - 211, 212, 213, 221, 222, 223, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 248, 250, - 251, 270, 281, 282, 283, 284, 285, 286, 289, 290, - 291, 292, 294, 295, 296, 300, 256, 255, 258, 270, - 257, 79, 190, 192, 210, 193, 232, 245, 249, 270, - 117, 276, 79, 278, 279, 213, 277, 211, 191, 195, - 211, 211, 282, 190, 190, 211, 211, 248, 190, 248, - 209, 190, 232, 232, 248, 213, 289, 87, 88, 192, - 194, 191, 191, 195, 77, 246, 190, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 210, 247, 232, - 200, 201, 202, 196, 197, 85, 86, 89, 90, 203, - 204, 91, 92, 205, 206, 207, 93, 95, 94, 208, - 195, 211, 213, 282, 79, 255, 258, 192, 210, 193, - 249, 246, 280, 193, 213, 192, 195, 211, 265, 78, - 281, 290, 297, 248, 211, 248, 209, 248, 261, 293, - 191, 213, 224, 248, 79, 227, 246, 246, 232, 232, - 232, 234, 234, 235, 235, 236, 236, 236, 236, 237, - 237, 238, 239, 240, 241, 242, 243, 248, 246, 192, - 193, 249, 280, 210, 193, 249, 279, 190, 293, 298, - 299, 191, 191, 79, 191, 193, 209, 249, 210, 193, - 280, 210, 193, 248, 211, 191, 283, 284, 286, 210, - 14, 285, 287, 288, 246, 193, 280, 210, 280, 191, - 248, 287, 12, 280, 190, 280, 211, 283, 284, 248, - 191, 283, 12 + 82, 83, 84, 87, 88, 191, 197, 198, 199, 200, + 212, 213, 214, 222, 223, 224, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 249, 251, + 252, 271, 282, 283, 284, 285, 286, 287, 290, 291, + 292, 293, 295, 296, 297, 301, 257, 256, 259, 271, + 258, 79, 191, 193, 211, 194, 233, 246, 250, 271, + 117, 277, 79, 279, 280, 214, 278, 212, 192, 196, + 212, 212, 283, 191, 191, 212, 212, 249, 191, 249, + 210, 191, 233, 233, 249, 214, 290, 87, 88, 193, + 195, 192, 192, 196, 77, 247, 191, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 211, 248, 233, + 201, 202, 203, 197, 198, 85, 86, 89, 90, 204, + 205, 91, 92, 206, 207, 208, 93, 95, 94, 209, + 196, 212, 214, 283, 79, 256, 259, 193, 211, 194, + 250, 247, 281, 194, 214, 193, 196, 212, 266, 78, + 282, 291, 298, 249, 212, 249, 210, 249, 262, 294, + 192, 214, 225, 249, 79, 228, 247, 247, 233, 233, + 233, 235, 235, 236, 236, 237, 237, 237, 237, 238, + 238, 239, 240, 241, 242, 243, 244, 249, 247, 193, + 194, 250, 281, 211, 194, 250, 280, 191, 294, 299, + 300, 192, 192, 79, 192, 194, 210, 250, 211, 194, + 281, 211, 194, 249, 212, 192, 284, 285, 287, 211, + 14, 286, 288, 289, 247, 194, 281, 211, 281, 192, + 249, 288, 12, 281, 191, 281, 212, 284, 285, 249, + 192, 284, 12 }; #define yyerrok (yyerrstatus = 0) @@ -2749,7 +2752,7 @@ YYLTYPE yylloc; } /* Line 1242 of yacc.c */ -#line 2753 "glsl_parser.cpp" +#line 2756 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -2937,7 +2940,7 @@ yyreduce: case 2: /* Line 1455 of yacc.c */ -#line 208 "glsl_parser.ypp" +#line 210 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2946,7 +2949,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 216 "glsl_parser.ypp" +#line 218 "glsl_parser.ypp" { state->language_version = 110; ;} @@ -2955,7 +2958,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 220 "glsl_parser.ypp" +#line 222 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2975,7 +2978,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 243 "glsl_parser.ypp" +#line 245 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2986,7 +2989,7 @@ yyreduce: case 9: /* Line 1455 of yacc.c */ -#line 252 "glsl_parser.ypp" +#line 254 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -2999,7 +3002,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 260 "glsl_parser.ypp" +#line 262 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -3012,7 +3015,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 275 "glsl_parser.ypp" +#line 277 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -3024,7 +3027,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 282 "glsl_parser.ypp" +#line 284 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -3036,7 +3039,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 289 "glsl_parser.ypp" +#line 291 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -3048,7 +3051,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 296 "glsl_parser.ypp" +#line 298 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -3060,7 +3063,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 303 "glsl_parser.ypp" +#line 305 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -3072,7 +3075,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 310 "glsl_parser.ypp" +#line 312 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -3081,7 +3084,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 318 "glsl_parser.ypp" +#line 320 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -3092,7 +3095,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 324 "glsl_parser.ypp" +#line 326 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3101,7 +3104,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 328 "glsl_parser.ypp" +#line 330 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3113,7 +3116,7 @@ yyreduce: case 22: /* Line 1455 of yacc.c */ -#line 335 "glsl_parser.ypp" +#line 337 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3124,7 +3127,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 341 "glsl_parser.ypp" +#line 343 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3135,7 +3138,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 359 "glsl_parser.ypp" +#line 361 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3146,7 +3149,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 378 "glsl_parser.ypp" +#line 380 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3157,7 +3160,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 384 "glsl_parser.ypp" +#line 386 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3168,7 +3171,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 400 "glsl_parser.ypp" +#line 402 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3179,7 +3182,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 406 "glsl_parser.ypp" +#line 408 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3191,7 +3194,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 413 "glsl_parser.ypp" +#line 415 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3203,7 +3206,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 425 "glsl_parser.ypp" +#line 427 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3214,7 +3217,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 431 "glsl_parser.ypp" +#line 433 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3225,7 +3228,7 @@ yyreduce: case 41: /* Line 1455 of yacc.c */ -#line 437 "glsl_parser.ypp" +#line 439 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3236,35 +3239,35 @@ yyreduce: case 42: /* Line 1455 of yacc.c */ -#line 446 "glsl_parser.ypp" +#line 448 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 447 "glsl_parser.ypp" +#line 449 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 448 "glsl_parser.ypp" +#line 450 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 449 "glsl_parser.ypp" +#line 451 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: /* Line 1455 of yacc.c */ -#line 455 "glsl_parser.ypp" +#line 457 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3275,7 +3278,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 461 "glsl_parser.ypp" +#line 463 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3286,7 +3289,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 467 "glsl_parser.ypp" +#line 469 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3297,7 +3300,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 477 "glsl_parser.ypp" +#line 479 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3308,7 +3311,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 483 "glsl_parser.ypp" +#line 485 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3319,7 +3322,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 493 "glsl_parser.ypp" +#line 495 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3330,7 +3333,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 499 "glsl_parser.ypp" +#line 501 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3341,7 +3344,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 509 "glsl_parser.ypp" +#line 511 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3352,7 +3355,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 515 "glsl_parser.ypp" +#line 517 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3363,7 +3366,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 521 "glsl_parser.ypp" +#line 523 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3374,7 +3377,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 527 "glsl_parser.ypp" +#line 529 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3385,7 +3388,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 537 "glsl_parser.ypp" +#line 539 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3396,7 +3399,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 543 "glsl_parser.ypp" +#line 545 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3407,7 +3410,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 553 "glsl_parser.ypp" +#line 555 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3418,7 +3421,7 @@ yyreduce: case 67: /* Line 1455 of yacc.c */ -#line 563 "glsl_parser.ypp" +#line 565 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3429,7 +3432,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 573 "glsl_parser.ypp" +#line 575 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3440,7 +3443,7 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 583 "glsl_parser.ypp" +#line 585 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3451,7 +3454,7 @@ yyreduce: case 73: /* Line 1455 of yacc.c */ -#line 593 "glsl_parser.ypp" +#line 595 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3462,7 +3465,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 603 "glsl_parser.ypp" +#line 605 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3473,7 +3476,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 613 "glsl_parser.ypp" +#line 615 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3484,7 +3487,7 @@ yyreduce: case 79: /* Line 1455 of yacc.c */ -#line 623 "glsl_parser.ypp" +#line 625 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3495,84 +3498,84 @@ yyreduce: case 80: /* Line 1455 of yacc.c */ -#line 631 "glsl_parser.ypp" +#line 633 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 632 "glsl_parser.ypp" +#line 634 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: /* Line 1455 of yacc.c */ -#line 633 "glsl_parser.ypp" +#line 635 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: /* Line 1455 of yacc.c */ -#line 634 "glsl_parser.ypp" +#line 636 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: /* Line 1455 of yacc.c */ -#line 635 "glsl_parser.ypp" +#line 637 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: /* Line 1455 of yacc.c */ -#line 636 "glsl_parser.ypp" +#line 638 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: /* Line 1455 of yacc.c */ -#line 637 "glsl_parser.ypp" +#line 639 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 638 "glsl_parser.ypp" +#line 640 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 639 "glsl_parser.ypp" +#line 641 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 640 "glsl_parser.ypp" +#line 642 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: /* Line 1455 of yacc.c */ -#line 641 "glsl_parser.ypp" +#line 643 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: /* Line 1455 of yacc.c */ -#line 646 "glsl_parser.ypp" +#line 648 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3581,7 +3584,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 650 "glsl_parser.ypp" +#line 652 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3599,7 +3602,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 670 "glsl_parser.ypp" +#line 672 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3608,7 +3611,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 674 "glsl_parser.ypp" +#line 676 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3617,7 +3620,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 678 "glsl_parser.ypp" +#line 680 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3633,7 +3636,7 @@ yyreduce: case 100: /* Line 1455 of yacc.c */ -#line 701 "glsl_parser.ypp" +#line 703 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3643,7 +3646,7 @@ yyreduce: case 101: /* Line 1455 of yacc.c */ -#line 706 "glsl_parser.ypp" +#line 708 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3653,7 +3656,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 714 "glsl_parser.ypp" +#line 716 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3666,7 +3669,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 725 "glsl_parser.ypp" +#line 727 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3681,7 +3684,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 735 "glsl_parser.ypp" +#line 737 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3698,7 +3701,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 750 "glsl_parser.ypp" +#line 752 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3710,7 +3713,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 757 "glsl_parser.ypp" +#line 759 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3720,7 +3723,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 762 "glsl_parser.ypp" +#line 764 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3736,7 +3739,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 773 "glsl_parser.ypp" +#line 775 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3750,35 +3753,35 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 784 "glsl_parser.ypp" +#line 786 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: /* Line 1455 of yacc.c */ -#line 785 "glsl_parser.ypp" +#line 787 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: /* Line 1455 of yacc.c */ -#line 786 "glsl_parser.ypp" +#line 788 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: /* Line 1455 of yacc.c */ -#line 787 "glsl_parser.ypp" +#line 789 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 115: /* Line 1455 of yacc.c */ -#line 797 "glsl_parser.ypp" +#line 799 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3792,7 +3795,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 806 "glsl_parser.ypp" +#line 808 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3806,7 +3809,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 815 "glsl_parser.ypp" +#line 817 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3820,7 +3823,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 824 "glsl_parser.ypp" +#line 826 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3834,7 +3837,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 833 "glsl_parser.ypp" +#line 835 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3848,7 +3851,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 842 "glsl_parser.ypp" +#line 844 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3862,7 +3865,7 @@ yyreduce: case 121: /* Line 1455 of yacc.c */ -#line 855 "glsl_parser.ypp" +#line 857 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3878,7 +3881,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 866 "glsl_parser.ypp" +#line 868 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3892,7 +3895,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 875 "glsl_parser.ypp" +#line 877 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3906,7 +3909,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 884 "glsl_parser.ypp" +#line 886 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3920,7 +3923,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 893 "glsl_parser.ypp" +#line 895 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3934,7 +3937,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 902 "glsl_parser.ypp" +#line 904 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3948,7 +3951,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 911 "glsl_parser.ypp" +#line 913 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3962,7 +3965,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 920 "glsl_parser.ypp" +#line 922 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3978,7 +3981,7 @@ yyreduce: case 129: /* Line 1455 of yacc.c */ -#line 934 "glsl_parser.ypp" +#line 936 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3990,7 +3993,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 941 "glsl_parser.ypp" +#line 943 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -4003,14 +4006,14 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 951 "glsl_parser.ypp" +#line 953 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 133: /* Line 1455 of yacc.c */ -#line 957 "glsl_parser.ypp" +#line 959 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -4019,7 +4022,7 @@ yyreduce: case 135: /* Line 1455 of yacc.c */ -#line 965 "glsl_parser.ypp" +#line 967 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} @@ -4028,7 +4031,7 @@ yyreduce: case 136: /* Line 1455 of yacc.c */ -#line 972 "glsl_parser.ypp" +#line 974 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -4064,35 +4067,35 @@ yyreduce: case 137: /* Line 1455 of yacc.c */ -#line 1005 "glsl_parser.ypp" +#line 1007 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1006 "glsl_parser.ypp" +#line 1008 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1007 "glsl_parser.ypp" +#line 1009 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; case 140: /* Line 1455 of yacc.c */ -#line 1011 "glsl_parser.ypp" +#line 1013 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1017 "glsl_parser.ypp" +#line 1019 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} @@ -4101,7 +4104,7 @@ yyreduce: case 143: /* Line 1455 of yacc.c */ -#line 1021 "glsl_parser.ypp" +#line 1023 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; @@ -4111,70 +4114,70 @@ yyreduce: case 144: /* Line 1455 of yacc.c */ -#line 1028 "glsl_parser.ypp" +#line 1030 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1029 "glsl_parser.ypp" +#line 1031 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; case 146: /* Line 1455 of yacc.c */ -#line 1030 "glsl_parser.ypp" +#line 1032 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; case 147: /* Line 1455 of yacc.c */ -#line 1031 "glsl_parser.ypp" +#line 1033 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; case 148: /* Line 1455 of yacc.c */ -#line 1032 "glsl_parser.ypp" +#line 1034 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 149: /* Line 1455 of yacc.c */ -#line 1033 "glsl_parser.ypp" +#line 1035 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 150: /* Line 1455 of yacc.c */ -#line 1034 "glsl_parser.ypp" +#line 1036 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; case 151: /* Line 1455 of yacc.c */ -#line 1035 "glsl_parser.ypp" +#line 1037 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 152: /* Line 1455 of yacc.c */ -#line 1036 "glsl_parser.ypp" +#line 1038 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; case 154: /* Line 1455 of yacc.c */ -#line 1042 "glsl_parser.ypp" +#line 1044 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4184,7 +4187,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1051 "glsl_parser.ypp" +#line 1053 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4195,7 +4198,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1057 "glsl_parser.ypp" +#line 1059 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4206,7 +4209,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1066 "glsl_parser.ypp" +#line 1068 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4217,7 +4220,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1072 "glsl_parser.ypp" +#line 1074 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4228,7 +4231,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1078 "glsl_parser.ypp" +#line 1080 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4239,385 +4242,385 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1086 "glsl_parser.ypp" +#line 1088 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 162: /* Line 1455 of yacc.c */ -#line 1087 "glsl_parser.ypp" +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 163: /* Line 1455 of yacc.c */ -#line 1088 "glsl_parser.ypp" +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 164: /* Line 1455 of yacc.c */ -#line 1089 "glsl_parser.ypp" +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 165: /* Line 1455 of yacc.c */ -#line 1090 "glsl_parser.ypp" +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 166: /* Line 1455 of yacc.c */ -#line 1091 "glsl_parser.ypp" +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 167: /* Line 1455 of yacc.c */ -#line 1092 "glsl_parser.ypp" +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 168: /* Line 1455 of yacc.c */ -#line 1093 "glsl_parser.ypp" +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 169: /* Line 1455 of yacc.c */ -#line 1094 "glsl_parser.ypp" +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 170: /* Line 1455 of yacc.c */ -#line 1095 "glsl_parser.ypp" +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 171: /* Line 1455 of yacc.c */ -#line 1096 "glsl_parser.ypp" +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 172: /* Line 1455 of yacc.c */ -#line 1097 "glsl_parser.ypp" +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 173: /* Line 1455 of yacc.c */ -#line 1098 "glsl_parser.ypp" +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 174: /* Line 1455 of yacc.c */ -#line 1099 "glsl_parser.ypp" +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 175: /* Line 1455 of yacc.c */ -#line 1100 "glsl_parser.ypp" +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 176: /* Line 1455 of yacc.c */ -#line 1101 "glsl_parser.ypp" +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 177: /* Line 1455 of yacc.c */ -#line 1102 "glsl_parser.ypp" +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 178: /* Line 1455 of yacc.c */ -#line 1103 "glsl_parser.ypp" +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 179: /* Line 1455 of yacc.c */ -#line 1104 "glsl_parser.ypp" +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 180: /* Line 1455 of yacc.c */ -#line 1105 "glsl_parser.ypp" +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 181: /* Line 1455 of yacc.c */ -#line 1106 "glsl_parser.ypp" +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 182: /* Line 1455 of yacc.c */ -#line 1107 "glsl_parser.ypp" +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 183: /* Line 1455 of yacc.c */ -#line 1108 "glsl_parser.ypp" +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 184: /* Line 1455 of yacc.c */ -#line 1109 "glsl_parser.ypp" +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 185: /* Line 1455 of yacc.c */ -#line 1110 "glsl_parser.ypp" +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 186: /* Line 1455 of yacc.c */ -#line 1111 "glsl_parser.ypp" +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 187: /* Line 1455 of yacc.c */ -#line 1112 "glsl_parser.ypp" +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 188: /* Line 1455 of yacc.c */ -#line 1113 "glsl_parser.ypp" +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 189: /* Line 1455 of yacc.c */ -#line 1114 "glsl_parser.ypp" +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 190: /* Line 1455 of yacc.c */ -#line 1115 "glsl_parser.ypp" +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 191: /* Line 1455 of yacc.c */ -#line 1116 "glsl_parser.ypp" +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 192: /* Line 1455 of yacc.c */ -#line 1117 "glsl_parser.ypp" +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 193: /* Line 1455 of yacc.c */ -#line 1118 "glsl_parser.ypp" +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 194: /* Line 1455 of yacc.c */ -#line 1119 "glsl_parser.ypp" +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 195: /* Line 1455 of yacc.c */ -#line 1120 "glsl_parser.ypp" +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 196: /* Line 1455 of yacc.c */ -#line 1121 "glsl_parser.ypp" +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 197: /* Line 1455 of yacc.c */ -#line 1122 "glsl_parser.ypp" +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 198: /* Line 1455 of yacc.c */ -#line 1123 "glsl_parser.ypp" +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 199: /* Line 1455 of yacc.c */ -#line 1124 "glsl_parser.ypp" +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 200: /* Line 1455 of yacc.c */ -#line 1125 "glsl_parser.ypp" +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 201: /* Line 1455 of yacc.c */ -#line 1126 "glsl_parser.ypp" +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 202: /* Line 1455 of yacc.c */ -#line 1127 "glsl_parser.ypp" +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 203: /* Line 1455 of yacc.c */ -#line 1128 "glsl_parser.ypp" +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 204: /* Line 1455 of yacc.c */ -#line 1129 "glsl_parser.ypp" +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 205: /* Line 1455 of yacc.c */ -#line 1130 "glsl_parser.ypp" +#line 1132 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 206: /* Line 1455 of yacc.c */ -#line 1131 "glsl_parser.ypp" +#line 1133 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 207: /* Line 1455 of yacc.c */ -#line 1132 "glsl_parser.ypp" +#line 1134 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 208: /* Line 1455 of yacc.c */ -#line 1133 "glsl_parser.ypp" +#line 1135 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 209: /* Line 1455 of yacc.c */ -#line 1134 "glsl_parser.ypp" +#line 1136 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 210: /* Line 1455 of yacc.c */ -#line 1135 "glsl_parser.ypp" +#line 1137 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 211: /* Line 1455 of yacc.c */ -#line 1136 "glsl_parser.ypp" +#line 1138 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 212: /* Line 1455 of yacc.c */ -#line 1137 "glsl_parser.ypp" +#line 1139 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 213: /* Line 1455 of yacc.c */ -#line 1138 "glsl_parser.ypp" +#line 1140 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 214: /* Line 1455 of yacc.c */ -#line 1139 "glsl_parser.ypp" +#line 1141 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 215: /* Line 1455 of yacc.c */ -#line 1143 "glsl_parser.ypp" +#line 1145 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4634,7 +4637,7 @@ yyreduce: case 216: /* Line 1455 of yacc.c */ -#line 1154 "glsl_parser.ypp" +#line 1156 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4651,7 +4654,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1165 "glsl_parser.ypp" +#line 1167 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4668,7 +4671,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1180 "glsl_parser.ypp" +#line 1182 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4679,7 +4682,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1186 "glsl_parser.ypp" +#line 1188 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4690,7 +4693,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1195 "glsl_parser.ypp" +#line 1197 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4700,7 +4703,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1200 "glsl_parser.ypp" +#line 1202 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4710,7 +4713,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1208 "glsl_parser.ypp" +#line 1210 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4727,7 +4730,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1223 "glsl_parser.ypp" +#line 1225 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4737,7 +4740,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1228 "glsl_parser.ypp" +#line 1230 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4747,7 +4750,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1236 "glsl_parser.ypp" +#line 1238 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4758,7 +4761,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1242 "glsl_parser.ypp" +#line 1244 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4769,28 +4772,28 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1265 "glsl_parser.ypp" +#line 1267 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 237: /* Line 1455 of yacc.c */ -#line 1277 "glsl_parser.ypp" +#line 1279 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 238: /* Line 1455 of yacc.c */ -#line 1278 "glsl_parser.ypp" +#line 1280 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1285 "glsl_parser.ypp" +#line 1287 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4801,7 +4804,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1291 "glsl_parser.ypp" +#line 1293 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4812,14 +4815,14 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1299 "glsl_parser.ypp" +#line 1301 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 245: /* Line 1455 of yacc.c */ -#line 1305 "glsl_parser.ypp" +#line 1307 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4830,7 +4833,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1311 "glsl_parser.ypp" +#line 1313 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4841,7 +4844,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1320 "glsl_parser.ypp" +#line 1322 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4856,7 +4859,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1330 "glsl_parser.ypp" +#line 1332 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4870,7 +4873,7 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1342 "glsl_parser.ypp" +#line 1344 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4881,7 +4884,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1348 "glsl_parser.ypp" +#line 1350 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4892,7 +4895,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1357 "glsl_parser.ypp" +#line 1359 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4903,7 +4906,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1366 "glsl_parser.ypp" +#line 1368 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4914,7 +4917,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1372 "glsl_parser.ypp" +#line 1374 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4925,7 +4928,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1378 "glsl_parser.ypp" +#line 1380 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4936,7 +4939,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1387 "glsl_parser.ypp" +#line 1389 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4945,7 +4948,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 1391 "glsl_parser.ypp" +#line 1393 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4961,7 +4964,7 @@ yyreduce: case 260: /* Line 1455 of yacc.c */ -#line 1414 "glsl_parser.ypp" +#line 1416 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4973,7 +4976,7 @@ yyreduce: case 261: /* Line 1455 of yacc.c */ -#line 1421 "glsl_parser.ypp" +#line 1423 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4985,7 +4988,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 1428 "glsl_parser.ypp" +#line 1430 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4997,7 +5000,7 @@ yyreduce: case 266: /* Line 1455 of yacc.c */ -#line 1444 "glsl_parser.ypp" +#line 1446 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -5006,7 +5009,7 @@ yyreduce: case 267: /* Line 1455 of yacc.c */ -#line 1451 "glsl_parser.ypp" +#line 1453 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -5016,7 +5019,7 @@ yyreduce: case 268: /* Line 1455 of yacc.c */ -#line 1456 "glsl_parser.ypp" +#line 1458 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); @@ -5026,7 +5029,7 @@ yyreduce: case 269: /* Line 1455 of yacc.c */ -#line 1465 "glsl_parser.ypp" +#line 1467 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5037,7 +5040,7 @@ yyreduce: case 270: /* Line 1455 of yacc.c */ -#line 1471 "glsl_parser.ypp" +#line 1473 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5048,7 +5051,7 @@ yyreduce: case 271: /* Line 1455 of yacc.c */ -#line 1477 "glsl_parser.ypp" +#line 1479 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5059,7 +5062,7 @@ yyreduce: case 272: /* Line 1455 of yacc.c */ -#line 1483 "glsl_parser.ypp" +#line 1485 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5070,7 +5073,7 @@ yyreduce: case 273: /* Line 1455 of yacc.c */ -#line 1489 "glsl_parser.ypp" +#line 1491 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5081,21 +5084,21 @@ yyreduce: case 274: /* Line 1455 of yacc.c */ -#line 1497 "glsl_parser.ypp" +#line 1499 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 275: /* Line 1455 of yacc.c */ -#line 1498 "glsl_parser.ypp" +#line 1500 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 276: /* Line 1455 of yacc.c */ -#line 1503 "glsl_parser.ypp" +#line 1505 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5108,7 +5111,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 5112 "glsl_parser.cpp" +#line 5115 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 470c080f72..b9f3e3fe04 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -197,35 +197,36 @@ CAST = 413, NAMESPACE = 414, USING = 415, - COMMON = 416, - PARTITION = 417, - ACTIVE = 418, - SAMPLERBUFFER = 419, - FILTER = 420, - IMAGE1D = 421, - IMAGE2D = 422, - IMAGE3D = 423, - IMAGECUBE = 424, - IMAGE1DARRAY = 425, - IMAGE2DARRAY = 426, - IIMAGE1D = 427, - IIMAGE2D = 428, - IIMAGE3D = 429, - IIMAGECUBE = 430, - IIMAGE1DARRAY = 431, - IIMAGE2DARRAY = 432, - UIMAGE1D = 433, - UIMAGE2D = 434, - UIMAGE3D = 435, - UIMAGECUBE = 436, - UIMAGE1DARRAY = 437, - UIMAGE2DARRAY = 438, - IMAGE1DSHADOW = 439, - IMAGE2DSHADOW = 440, - IMAGEBUFFER = 441, - IIMAGEBUFFER = 442, - UIMAGEBUFFER = 443, - ROW_MAJOR = 444 + ERROR_TOK = 416, + COMMON = 417, + PARTITION = 418, + ACTIVE = 419, + SAMPLERBUFFER = 420, + FILTER = 421, + IMAGE1D = 422, + IMAGE2D = 423, + IMAGE3D = 424, + IMAGECUBE = 425, + IMAGE1DARRAY = 426, + IMAGE2DARRAY = 427, + IIMAGE1D = 428, + IIMAGE2D = 429, + IIMAGE3D = 430, + IIMAGECUBE = 431, + IIMAGE1DARRAY = 432, + IIMAGE2DARRAY = 433, + UIMAGE1D = 434, + UIMAGE2D = 435, + UIMAGE3D = 436, + UIMAGECUBE = 437, + UIMAGE1DARRAY = 438, + UIMAGE2DARRAY = 439, + IMAGE1DSHADOW = 440, + IMAGE2DSHADOW = 441, + IMAGEBUFFER = 442, + IIMAGEBUFFER = 443, + UIMAGEBUFFER = 444, + ROW_MAJOR = 445 }; #endif @@ -267,7 +268,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 271 "glsl_parser.h" +#line 272 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ -- cgit v1.2.3 From 2fb94b37d2ace1170018cc36f50cf6e71fc708c4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 17:14:02 -0700 Subject: glsl2: Use bison command line option to set prefix Bison version 2.3 doesn't seem to support %name-prefix in the source. This should fix bugzilla #29207. --- src/glsl/Makefile | 2 +- src/glsl/glsl_parser.ypp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 85298d06a0..a0ab1d6d40 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -154,7 +154,7 @@ glsl_lexer.cpp: glsl_lexer.lpp flex --never-interactive --outfile="$@" $< glsl_parser.cpp: glsl_parser.ypp - bison -v -o "$@" --defines=glsl_parser.h $< + bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $< glcpp/glcpp-lex.c: glcpp/glcpp-lex.l flex --never-interactive --outfile="$@" $< diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 74971cfb9d..7c5dc017d8 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -48,7 +48,6 @@ %lex-param {void *scanner} %parse-param {struct _mesa_glsl_parse_state *state} -%name-prefix "_mesa_glsl_" %union { int n; -- cgit v1.2.3 From a43871f763043a2ed6f3ab9f52d3cff32c63e47e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 17:21:38 -0700 Subject: glsl2: Commit generated files changed by previous commit --- src/glsl/glsl_parser.cpp | 496 +++++++++++++++++++++++------------------------ src/glsl/glsl_parser.h | 2 +- 2 files changed, 249 insertions(+), 249 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 92937fdf9e..864ab0032f 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -339,7 +339,7 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 53 "glsl_parser.ypp" +#line 52 "glsl_parser.ypp" int n; float real; @@ -803,34 +803,34 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 210, 210, 209, 218, 221, 238, 240, 244, 253, - 261, 272, 276, 283, 290, 297, 304, 311, 318, 319, - 325, 329, 336, 342, 351, 355, 359, 360, 369, 370, - 374, 375, 379, 385, 397, 401, 407, 414, 425, 426, - 432, 438, 448, 449, 450, 451, 455, 456, 462, 468, - 477, 478, 484, 493, 494, 500, 509, 510, 516, 522, - 528, 537, 538, 544, 553, 554, 563, 564, 573, 574, - 583, 584, 593, 594, 603, 604, 613, 614, 623, 624, - 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, - 643, 647, 651, 667, 671, 675, 679, 693, 697, 698, - 702, 707, 715, 726, 736, 751, 758, 763, 774, 786, - 787, 788, 789, 793, 797, 798, 807, 816, 825, 834, - 843, 856, 867, 876, 885, 894, 903, 912, 921, 935, - 942, 953, 954, 958, 965, 966, 973, 1007, 1008, 1009, - 1013, 1017, 1018, 1022, 1030, 1031, 1032, 1033, 1034, 1035, - 1036, 1037, 1038, 1042, 1043, 1051, 1052, 1058, 1067, 1073, - 1079, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, - 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, - 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, - 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, - 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, - 1137, 1138, 1139, 1140, 1141, 1145, 1156, 1167, 1181, 1187, - 1196, 1201, 1209, 1224, 1229, 1237, 1243, 1252, 1256, 1262, - 1263, 1267, 1268, 1272, 1276, 1277, 1278, 1279, 1280, 1281, - 1282, 1286, 1292, 1301, 1302, 1306, 1312, 1321, 1331, 1343, - 1349, 1358, 1367, 1373, 1379, 1388, 1392, 1406, 1410, 1411, - 1415, 1422, 1429, 1439, 1440, 1444, 1446, 1452, 1457, 1466, - 1472, 1478, 1484, 1490, 1499, 1500, 1504 + 0, 209, 209, 208, 217, 220, 237, 239, 243, 252, + 260, 271, 275, 282, 289, 296, 303, 310, 317, 318, + 324, 328, 335, 341, 350, 354, 358, 359, 368, 369, + 373, 374, 378, 384, 396, 400, 406, 413, 424, 425, + 431, 437, 447, 448, 449, 450, 454, 455, 461, 467, + 476, 477, 483, 492, 493, 499, 508, 509, 515, 521, + 527, 536, 537, 543, 552, 553, 562, 563, 572, 573, + 582, 583, 592, 593, 602, 603, 612, 613, 622, 623, + 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, + 642, 646, 650, 666, 670, 674, 678, 692, 696, 697, + 701, 706, 714, 725, 735, 750, 757, 762, 773, 785, + 786, 787, 788, 792, 796, 797, 806, 815, 824, 833, + 842, 855, 866, 875, 884, 893, 902, 911, 920, 934, + 941, 952, 953, 957, 964, 965, 972, 1006, 1007, 1008, + 1012, 1016, 1017, 1021, 1029, 1030, 1031, 1032, 1033, 1034, + 1035, 1036, 1037, 1041, 1042, 1050, 1051, 1057, 1066, 1072, + 1078, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, + 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, + 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, + 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, + 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, + 1136, 1137, 1138, 1139, 1140, 1144, 1155, 1166, 1180, 1186, + 1195, 1200, 1208, 1223, 1228, 1236, 1242, 1251, 1255, 1261, + 1262, 1266, 1267, 1271, 1275, 1276, 1277, 1278, 1279, 1280, + 1281, 1285, 1291, 1300, 1301, 1305, 1311, 1320, 1330, 1342, + 1348, 1357, 1366, 1372, 1378, 1387, 1391, 1405, 1409, 1410, + 1414, 1421, 1428, 1438, 1439, 1443, 1445, 1451, 1456, 1465, + 1471, 1477, 1483, 1489, 1498, 1499, 1503 }; #endif @@ -2940,7 +2940,7 @@ yyreduce: case 2: /* Line 1455 of yacc.c */ -#line 210 "glsl_parser.ypp" +#line 209 "glsl_parser.ypp" { _mesa_glsl_initialize_types(state); ;} @@ -2949,7 +2949,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 218 "glsl_parser.ypp" +#line 217 "glsl_parser.ypp" { state->language_version = 110; ;} @@ -2958,7 +2958,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 222 "glsl_parser.ypp" +#line 221 "glsl_parser.ypp" { switch ((yyvsp[(2) - (3)].n)) { case 110: @@ -2978,7 +2978,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 245 "glsl_parser.ypp" +#line 244 "glsl_parser.ypp" { if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { YYERROR; @@ -2989,7 +2989,7 @@ yyreduce: case 9: /* Line 1455 of yacc.c */ -#line 254 "glsl_parser.ypp" +#line 253 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -3002,7 +3002,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 262 "glsl_parser.ypp" +#line 261 "glsl_parser.ypp" { /* FINISHME: The NULL test is only required because 'precision' * FINISHME: statements are not yet supported. @@ -3015,7 +3015,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 277 "glsl_parser.ypp" +#line 276 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); @@ -3027,7 +3027,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 284 "glsl_parser.ypp" +#line 283 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); @@ -3039,7 +3039,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 291 "glsl_parser.ypp" +#line 290 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); @@ -3051,7 +3051,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 298 "glsl_parser.ypp" +#line 297 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); @@ -3063,7 +3063,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 305 "glsl_parser.ypp" +#line 304 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); @@ -3075,7 +3075,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 312 "glsl_parser.ypp" +#line 311 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;} @@ -3084,7 +3084,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 320 "glsl_parser.ypp" +#line 319 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); @@ -3095,7 +3095,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 326 "glsl_parser.ypp" +#line 325 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3104,7 +3104,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 330 "glsl_parser.ypp" +#line 329 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); @@ -3116,7 +3116,7 @@ yyreduce: case 22: /* Line 1455 of yacc.c */ -#line 337 "glsl_parser.ypp" +#line 336 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3127,7 +3127,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 343 "glsl_parser.ypp" +#line 342 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); @@ -3138,7 +3138,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 361 "glsl_parser.ypp" +#line 360 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3149,7 +3149,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 380 "glsl_parser.ypp" +#line 379 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (2)].expression); (yyval.expression)->set_location(yylloc); @@ -3160,7 +3160,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 386 "glsl_parser.ypp" +#line 385 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (3)].expression); (yyval.expression)->set_location(yylloc); @@ -3171,7 +3171,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 402 "glsl_parser.ypp" +#line 401 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); @@ -3182,7 +3182,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 408 "glsl_parser.ypp" +#line 407 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3194,7 +3194,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 415 "glsl_parser.ypp" +#line 414 "glsl_parser.ypp" { void *ctx = state; ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); @@ -3206,7 +3206,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 427 "glsl_parser.ypp" +#line 426 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3217,7 +3217,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 433 "glsl_parser.ypp" +#line 432 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3228,7 +3228,7 @@ yyreduce: case 41: /* Line 1455 of yacc.c */ -#line 439 "glsl_parser.ypp" +#line 438 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); @@ -3239,35 +3239,35 @@ yyreduce: case 42: /* Line 1455 of yacc.c */ -#line 448 "glsl_parser.ypp" +#line 447 "glsl_parser.ypp" { (yyval.n) = ast_plus; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 449 "glsl_parser.ypp" +#line 448 "glsl_parser.ypp" { (yyval.n) = ast_neg; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 450 "glsl_parser.ypp" +#line 449 "glsl_parser.ypp" { (yyval.n) = ast_logic_not; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 451 "glsl_parser.ypp" +#line 450 "glsl_parser.ypp" { (yyval.n) = ast_bit_not; ;} break; case 47: /* Line 1455 of yacc.c */ -#line 457 "glsl_parser.ypp" +#line 456 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3278,7 +3278,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 463 "glsl_parser.ypp" +#line 462 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3289,7 +3289,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 469 "glsl_parser.ypp" +#line 468 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3300,7 +3300,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 479 "glsl_parser.ypp" +#line 478 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3311,7 +3311,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 485 "glsl_parser.ypp" +#line 484 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3322,7 +3322,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 495 "glsl_parser.ypp" +#line 494 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3333,7 +3333,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 501 "glsl_parser.ypp" +#line 500 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3344,7 +3344,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 511 "glsl_parser.ypp" +#line 510 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3355,7 +3355,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 517 "glsl_parser.ypp" +#line 516 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3366,7 +3366,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 523 "glsl_parser.ypp" +#line 522 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3377,7 +3377,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 529 "glsl_parser.ypp" +#line 528 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3388,7 +3388,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 539 "glsl_parser.ypp" +#line 538 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3399,7 +3399,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 545 "glsl_parser.ypp" +#line 544 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3410,7 +3410,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 555 "glsl_parser.ypp" +#line 554 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3421,7 +3421,7 @@ yyreduce: case 67: /* Line 1455 of yacc.c */ -#line 565 "glsl_parser.ypp" +#line 564 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3432,7 +3432,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 575 "glsl_parser.ypp" +#line 574 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3443,7 +3443,7 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 585 "glsl_parser.ypp" +#line 584 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3454,7 +3454,7 @@ yyreduce: case 73: /* Line 1455 of yacc.c */ -#line 595 "glsl_parser.ypp" +#line 594 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3465,7 +3465,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 605 "glsl_parser.ypp" +#line 604 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); @@ -3476,7 +3476,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 615 "glsl_parser.ypp" +#line 614 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); @@ -3487,7 +3487,7 @@ yyreduce: case 79: /* Line 1455 of yacc.c */ -#line 625 "glsl_parser.ypp" +#line 624 "glsl_parser.ypp" { void *ctx = state; (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); @@ -3498,84 +3498,84 @@ yyreduce: case 80: /* Line 1455 of yacc.c */ -#line 633 "glsl_parser.ypp" +#line 632 "glsl_parser.ypp" { (yyval.n) = ast_assign; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 634 "glsl_parser.ypp" +#line 633 "glsl_parser.ypp" { (yyval.n) = ast_mul_assign; ;} break; case 82: /* Line 1455 of yacc.c */ -#line 635 "glsl_parser.ypp" +#line 634 "glsl_parser.ypp" { (yyval.n) = ast_div_assign; ;} break; case 83: /* Line 1455 of yacc.c */ -#line 636 "glsl_parser.ypp" +#line 635 "glsl_parser.ypp" { (yyval.n) = ast_mod_assign; ;} break; case 84: /* Line 1455 of yacc.c */ -#line 637 "glsl_parser.ypp" +#line 636 "glsl_parser.ypp" { (yyval.n) = ast_add_assign; ;} break; case 85: /* Line 1455 of yacc.c */ -#line 638 "glsl_parser.ypp" +#line 637 "glsl_parser.ypp" { (yyval.n) = ast_sub_assign; ;} break; case 86: /* Line 1455 of yacc.c */ -#line 639 "glsl_parser.ypp" +#line 638 "glsl_parser.ypp" { (yyval.n) = ast_ls_assign; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 640 "glsl_parser.ypp" +#line 639 "glsl_parser.ypp" { (yyval.n) = ast_rs_assign; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 641 "glsl_parser.ypp" +#line 640 "glsl_parser.ypp" { (yyval.n) = ast_and_assign; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 642 "glsl_parser.ypp" +#line 641 "glsl_parser.ypp" { (yyval.n) = ast_xor_assign; ;} break; case 90: /* Line 1455 of yacc.c */ -#line 643 "glsl_parser.ypp" +#line 642 "glsl_parser.ypp" { (yyval.n) = ast_or_assign; ;} break; case 91: /* Line 1455 of yacc.c */ -#line 648 "glsl_parser.ypp" +#line 647 "glsl_parser.ypp" { (yyval.expression) = (yyvsp[(1) - (1)].expression); ;} @@ -3584,7 +3584,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 652 "glsl_parser.ypp" +#line 651 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { @@ -3602,7 +3602,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 672 "glsl_parser.ypp" +#line 671 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].function); ;} @@ -3611,7 +3611,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 676 "glsl_parser.ypp" +#line 675 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (2)].declarator_list); ;} @@ -3620,7 +3620,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 680 "glsl_parser.ypp" +#line 679 "glsl_parser.ypp" { if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { @@ -3636,7 +3636,7 @@ yyreduce: case 100: /* Line 1455 of yacc.c */ -#line 703 "glsl_parser.ypp" +#line 702 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (2)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); @@ -3646,7 +3646,7 @@ yyreduce: case 101: /* Line 1455 of yacc.c */ -#line 708 "glsl_parser.ypp" +#line 707 "glsl_parser.ypp" { (yyval.function) = (yyvsp[(1) - (3)].function); (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); @@ -3656,7 +3656,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 716 "glsl_parser.ypp" +#line 715 "glsl_parser.ypp" { void *ctx = state; (yyval.function) = new(ctx) ast_function(); @@ -3669,7 +3669,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 727 "glsl_parser.ypp" +#line 726 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3684,7 +3684,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 737 "glsl_parser.ypp" +#line 736 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3701,7 +3701,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 752 "glsl_parser.ypp" +#line 751 "glsl_parser.ypp" { (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3713,7 +3713,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 759 "glsl_parser.ypp" +#line 758 "glsl_parser.ypp" { (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; @@ -3723,7 +3723,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 764 "glsl_parser.ypp" +#line 763 "glsl_parser.ypp" { void *ctx = state; (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; @@ -3739,7 +3739,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 775 "glsl_parser.ypp" +#line 774 "glsl_parser.ypp" { void *ctx = state; (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); @@ -3753,35 +3753,35 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 786 "glsl_parser.ypp" +#line 785 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 110: /* Line 1455 of yacc.c */ -#line 787 "glsl_parser.ypp" +#line 786 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 111: /* Line 1455 of yacc.c */ -#line 788 "glsl_parser.ypp" +#line 787 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 112: /* Line 1455 of yacc.c */ -#line 789 "glsl_parser.ypp" +#line 788 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 115: /* Line 1455 of yacc.c */ -#line 799 "glsl_parser.ypp" +#line 798 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); @@ -3795,7 +3795,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 808 "glsl_parser.ypp" +#line 807 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); @@ -3809,7 +3809,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 817 "glsl_parser.ypp" +#line 816 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); @@ -3823,7 +3823,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 826 "glsl_parser.ypp" +#line 825 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); @@ -3837,7 +3837,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 835 "glsl_parser.ypp" +#line 834 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); @@ -3851,7 +3851,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 844 "glsl_parser.ypp" +#line 843 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); @@ -3865,7 +3865,7 @@ yyreduce: case 121: /* Line 1455 of yacc.c */ -#line 857 "glsl_parser.ypp" +#line 856 "glsl_parser.ypp" { void *ctx = state; if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { @@ -3881,7 +3881,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 868 "glsl_parser.ypp" +#line 867 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3895,7 +3895,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 877 "glsl_parser.ypp" +#line 876 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); @@ -3909,7 +3909,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 886 "glsl_parser.ypp" +#line 885 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); @@ -3923,7 +3923,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 895 "glsl_parser.ypp" +#line 894 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); @@ -3937,7 +3937,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 904 "glsl_parser.ypp" +#line 903 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); @@ -3951,7 +3951,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 913 "glsl_parser.ypp" +#line 912 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -3965,7 +3965,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 922 "glsl_parser.ypp" +#line 921 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); @@ -3981,7 +3981,7 @@ yyreduce: case 129: /* Line 1455 of yacc.c */ -#line 936 "glsl_parser.ypp" +#line 935 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -3993,7 +3993,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 943 "glsl_parser.ypp" +#line 942 "glsl_parser.ypp" { void *ctx = state; (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); @@ -4006,14 +4006,14 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 953 "glsl_parser.ypp" +#line 952 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; ;} break; case 133: /* Line 1455 of yacc.c */ -#line 959 "glsl_parser.ypp" +#line 958 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); ;} @@ -4022,7 +4022,7 @@ yyreduce: case 135: /* Line 1455 of yacc.c */ -#line 967 "glsl_parser.ypp" +#line 966 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; ;} @@ -4031,7 +4031,7 @@ yyreduce: case 136: /* Line 1455 of yacc.c */ -#line 974 "glsl_parser.ypp" +#line 973 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; @@ -4067,35 +4067,35 @@ yyreduce: case 137: /* Line 1455 of yacc.c */ -#line 1007 "glsl_parser.ypp" +#line 1006 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1008 "glsl_parser.ypp" +#line 1007 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1009 "glsl_parser.ypp" +#line 1008 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} break; case 140: /* Line 1455 of yacc.c */ -#line 1013 "glsl_parser.ypp" +#line 1012 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1019 "glsl_parser.ypp" +#line 1018 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; ;} @@ -4104,7 +4104,7 @@ yyreduce: case 143: /* Line 1455 of yacc.c */ -#line 1023 "glsl_parser.ypp" +#line 1022 "glsl_parser.ypp" { (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); (yyval.type_qualifier).q.invariant = 1; @@ -4114,70 +4114,70 @@ yyreduce: case 144: /* Line 1455 of yacc.c */ -#line 1030 "glsl_parser.ypp" +#line 1029 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1031 "glsl_parser.ypp" +#line 1030 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} break; case 146: /* Line 1455 of yacc.c */ -#line 1032 "glsl_parser.ypp" +#line 1031 "glsl_parser.ypp" { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} break; case 147: /* Line 1455 of yacc.c */ -#line 1033 "glsl_parser.ypp" +#line 1032 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} break; case 148: /* Line 1455 of yacc.c */ -#line 1034 "glsl_parser.ypp" +#line 1033 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} break; case 149: /* Line 1455 of yacc.c */ -#line 1035 "glsl_parser.ypp" +#line 1034 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} break; case 150: /* Line 1455 of yacc.c */ -#line 1036 "glsl_parser.ypp" +#line 1035 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} break; case 151: /* Line 1455 of yacc.c */ -#line 1037 "glsl_parser.ypp" +#line 1036 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} break; case 152: /* Line 1455 of yacc.c */ -#line 1038 "glsl_parser.ypp" +#line 1037 "glsl_parser.ypp" { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} break; case 154: /* Line 1455 of yacc.c */ -#line 1044 "glsl_parser.ypp" +#line 1043 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); @@ -4187,7 +4187,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1053 "glsl_parser.ypp" +#line 1052 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4198,7 +4198,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1059 "glsl_parser.ypp" +#line 1058 "glsl_parser.ypp" { (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); (yyval.type_specifier)->is_array = true; @@ -4209,7 +4209,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1068 "glsl_parser.ypp" +#line 1067 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); @@ -4220,7 +4220,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1074 "glsl_parser.ypp" +#line 1073 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); @@ -4231,7 +4231,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1080 "glsl_parser.ypp" +#line 1079 "glsl_parser.ypp" { void *ctx = state; (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); @@ -4242,385 +4242,385 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1088 "glsl_parser.ypp" +#line 1087 "glsl_parser.ypp" { (yyval.n) = ast_void; ;} break; case 162: /* Line 1455 of yacc.c */ -#line 1089 "glsl_parser.ypp" +#line 1088 "glsl_parser.ypp" { (yyval.n) = ast_float; ;} break; case 163: /* Line 1455 of yacc.c */ -#line 1090 "glsl_parser.ypp" +#line 1089 "glsl_parser.ypp" { (yyval.n) = ast_int; ;} break; case 164: /* Line 1455 of yacc.c */ -#line 1091 "glsl_parser.ypp" +#line 1090 "glsl_parser.ypp" { (yyval.n) = ast_uint; ;} break; case 165: /* Line 1455 of yacc.c */ -#line 1092 "glsl_parser.ypp" +#line 1091 "glsl_parser.ypp" { (yyval.n) = ast_bool; ;} break; case 166: /* Line 1455 of yacc.c */ -#line 1093 "glsl_parser.ypp" +#line 1092 "glsl_parser.ypp" { (yyval.n) = ast_vec2; ;} break; case 167: /* Line 1455 of yacc.c */ -#line 1094 "glsl_parser.ypp" +#line 1093 "glsl_parser.ypp" { (yyval.n) = ast_vec3; ;} break; case 168: /* Line 1455 of yacc.c */ -#line 1095 "glsl_parser.ypp" +#line 1094 "glsl_parser.ypp" { (yyval.n) = ast_vec4; ;} break; case 169: /* Line 1455 of yacc.c */ -#line 1096 "glsl_parser.ypp" +#line 1095 "glsl_parser.ypp" { (yyval.n) = ast_bvec2; ;} break; case 170: /* Line 1455 of yacc.c */ -#line 1097 "glsl_parser.ypp" +#line 1096 "glsl_parser.ypp" { (yyval.n) = ast_bvec3; ;} break; case 171: /* Line 1455 of yacc.c */ -#line 1098 "glsl_parser.ypp" +#line 1097 "glsl_parser.ypp" { (yyval.n) = ast_bvec4; ;} break; case 172: /* Line 1455 of yacc.c */ -#line 1099 "glsl_parser.ypp" +#line 1098 "glsl_parser.ypp" { (yyval.n) = ast_ivec2; ;} break; case 173: /* Line 1455 of yacc.c */ -#line 1100 "glsl_parser.ypp" +#line 1099 "glsl_parser.ypp" { (yyval.n) = ast_ivec3; ;} break; case 174: /* Line 1455 of yacc.c */ -#line 1101 "glsl_parser.ypp" +#line 1100 "glsl_parser.ypp" { (yyval.n) = ast_ivec4; ;} break; case 175: /* Line 1455 of yacc.c */ -#line 1102 "glsl_parser.ypp" +#line 1101 "glsl_parser.ypp" { (yyval.n) = ast_uvec2; ;} break; case 176: /* Line 1455 of yacc.c */ -#line 1103 "glsl_parser.ypp" +#line 1102 "glsl_parser.ypp" { (yyval.n) = ast_uvec3; ;} break; case 177: /* Line 1455 of yacc.c */ -#line 1104 "glsl_parser.ypp" +#line 1103 "glsl_parser.ypp" { (yyval.n) = ast_uvec4; ;} break; case 178: /* Line 1455 of yacc.c */ -#line 1105 "glsl_parser.ypp" +#line 1104 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 179: /* Line 1455 of yacc.c */ -#line 1106 "glsl_parser.ypp" +#line 1105 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 180: /* Line 1455 of yacc.c */ -#line 1107 "glsl_parser.ypp" +#line 1106 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 181: /* Line 1455 of yacc.c */ -#line 1108 "glsl_parser.ypp" +#line 1107 "glsl_parser.ypp" { (yyval.n) = ast_mat2; ;} break; case 182: /* Line 1455 of yacc.c */ -#line 1109 "glsl_parser.ypp" +#line 1108 "glsl_parser.ypp" { (yyval.n) = ast_mat2x3; ;} break; case 183: /* Line 1455 of yacc.c */ -#line 1110 "glsl_parser.ypp" +#line 1109 "glsl_parser.ypp" { (yyval.n) = ast_mat2x4; ;} break; case 184: /* Line 1455 of yacc.c */ -#line 1111 "glsl_parser.ypp" +#line 1110 "glsl_parser.ypp" { (yyval.n) = ast_mat3x2; ;} break; case 185: /* Line 1455 of yacc.c */ -#line 1112 "glsl_parser.ypp" +#line 1111 "glsl_parser.ypp" { (yyval.n) = ast_mat3; ;} break; case 186: /* Line 1455 of yacc.c */ -#line 1113 "glsl_parser.ypp" +#line 1112 "glsl_parser.ypp" { (yyval.n) = ast_mat3x4; ;} break; case 187: /* Line 1455 of yacc.c */ -#line 1114 "glsl_parser.ypp" +#line 1113 "glsl_parser.ypp" { (yyval.n) = ast_mat4x2; ;} break; case 188: /* Line 1455 of yacc.c */ -#line 1115 "glsl_parser.ypp" +#line 1114 "glsl_parser.ypp" { (yyval.n) = ast_mat4x3; ;} break; case 189: /* Line 1455 of yacc.c */ -#line 1116 "glsl_parser.ypp" +#line 1115 "glsl_parser.ypp" { (yyval.n) = ast_mat4; ;} break; case 190: /* Line 1455 of yacc.c */ -#line 1117 "glsl_parser.ypp" +#line 1116 "glsl_parser.ypp" { (yyval.n) = ast_sampler1d; ;} break; case 191: /* Line 1455 of yacc.c */ -#line 1118 "glsl_parser.ypp" +#line 1117 "glsl_parser.ypp" { (yyval.n) = ast_sampler2d; ;} break; case 192: /* Line 1455 of yacc.c */ -#line 1119 "glsl_parser.ypp" +#line 1118 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drect; ;} break; case 193: /* Line 1455 of yacc.c */ -#line 1120 "glsl_parser.ypp" +#line 1119 "glsl_parser.ypp" { (yyval.n) = ast_sampler3d; ;} break; case 194: /* Line 1455 of yacc.c */ -#line 1121 "glsl_parser.ypp" +#line 1120 "glsl_parser.ypp" { (yyval.n) = ast_samplercube; ;} break; case 195: /* Line 1455 of yacc.c */ -#line 1122 "glsl_parser.ypp" +#line 1121 "glsl_parser.ypp" { (yyval.n) = ast_sampler1dshadow; ;} break; case 196: /* Line 1455 of yacc.c */ -#line 1123 "glsl_parser.ypp" +#line 1122 "glsl_parser.ypp" { (yyval.n) = ast_sampler2dshadow; ;} break; case 197: /* Line 1455 of yacc.c */ -#line 1124 "glsl_parser.ypp" +#line 1123 "glsl_parser.ypp" { (yyval.n) = ast_sampler2drectshadow; ;} break; case 198: /* Line 1455 of yacc.c */ -#line 1125 "glsl_parser.ypp" +#line 1124 "glsl_parser.ypp" { (yyval.n) = ast_samplercubeshadow; ;} break; case 199: /* Line 1455 of yacc.c */ -#line 1126 "glsl_parser.ypp" +#line 1125 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darray; ;} break; case 200: /* Line 1455 of yacc.c */ -#line 1127 "glsl_parser.ypp" +#line 1126 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darray; ;} break; case 201: /* Line 1455 of yacc.c */ -#line 1128 "glsl_parser.ypp" +#line 1127 "glsl_parser.ypp" { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 202: /* Line 1455 of yacc.c */ -#line 1129 "glsl_parser.ypp" +#line 1128 "glsl_parser.ypp" { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 203: /* Line 1455 of yacc.c */ -#line 1130 "glsl_parser.ypp" +#line 1129 "glsl_parser.ypp" { (yyval.n) = ast_isampler1d; ;} break; case 204: /* Line 1455 of yacc.c */ -#line 1131 "glsl_parser.ypp" +#line 1130 "glsl_parser.ypp" { (yyval.n) = ast_isampler2d; ;} break; case 205: /* Line 1455 of yacc.c */ -#line 1132 "glsl_parser.ypp" +#line 1131 "glsl_parser.ypp" { (yyval.n) = ast_isampler3d; ;} break; case 206: /* Line 1455 of yacc.c */ -#line 1133 "glsl_parser.ypp" +#line 1132 "glsl_parser.ypp" { (yyval.n) = ast_isamplercube; ;} break; case 207: /* Line 1455 of yacc.c */ -#line 1134 "glsl_parser.ypp" +#line 1133 "glsl_parser.ypp" { (yyval.n) = ast_isampler1darray; ;} break; case 208: /* Line 1455 of yacc.c */ -#line 1135 "glsl_parser.ypp" +#line 1134 "glsl_parser.ypp" { (yyval.n) = ast_isampler2darray; ;} break; case 209: /* Line 1455 of yacc.c */ -#line 1136 "glsl_parser.ypp" +#line 1135 "glsl_parser.ypp" { (yyval.n) = ast_usampler1d; ;} break; case 210: /* Line 1455 of yacc.c */ -#line 1137 "glsl_parser.ypp" +#line 1136 "glsl_parser.ypp" { (yyval.n) = ast_usampler2d; ;} break; case 211: /* Line 1455 of yacc.c */ -#line 1138 "glsl_parser.ypp" +#line 1137 "glsl_parser.ypp" { (yyval.n) = ast_usampler3d; ;} break; case 212: /* Line 1455 of yacc.c */ -#line 1139 "glsl_parser.ypp" +#line 1138 "glsl_parser.ypp" { (yyval.n) = ast_usamplercube; ;} break; case 213: /* Line 1455 of yacc.c */ -#line 1140 "glsl_parser.ypp" +#line 1139 "glsl_parser.ypp" { (yyval.n) = ast_usampler1darray; ;} break; case 214: /* Line 1455 of yacc.c */ -#line 1141 "glsl_parser.ypp" +#line 1140 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; case 215: /* Line 1455 of yacc.c */ -#line 1145 "glsl_parser.ypp" +#line 1144 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4637,7 +4637,7 @@ yyreduce: case 216: /* Line 1455 of yacc.c */ -#line 1156 "glsl_parser.ypp" +#line 1155 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4654,7 +4654,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1167 "glsl_parser.ypp" +#line 1166 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4671,7 +4671,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1182 "glsl_parser.ypp" +#line 1181 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4682,7 +4682,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1188 "glsl_parser.ypp" +#line 1187 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4693,7 +4693,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1197 "glsl_parser.ypp" +#line 1196 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); @@ -4703,7 +4703,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1202 "glsl_parser.ypp" +#line 1201 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); @@ -4713,7 +4713,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1210 "glsl_parser.ypp" +#line 1209 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4730,7 +4730,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1225 "glsl_parser.ypp" +#line 1224 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); @@ -4740,7 +4740,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1230 "glsl_parser.ypp" +#line 1229 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); @@ -4750,7 +4750,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1238 "glsl_parser.ypp" +#line 1237 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4761,7 +4761,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1244 "glsl_parser.ypp" +#line 1243 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4772,28 +4772,28 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1267 "glsl_parser.ypp" +#line 1266 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 237: /* Line 1455 of yacc.c */ -#line 1279 "glsl_parser.ypp" +#line 1278 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 238: /* Line 1455 of yacc.c */ -#line 1280 "glsl_parser.ypp" +#line 1279 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1287 "glsl_parser.ypp" +#line 1286 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4804,7 +4804,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1293 "glsl_parser.ypp" +#line 1292 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4815,14 +4815,14 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1301 "glsl_parser.ypp" +#line 1300 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 245: /* Line 1455 of yacc.c */ -#line 1307 "glsl_parser.ypp" +#line 1306 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4833,7 +4833,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1313 "glsl_parser.ypp" +#line 1312 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4844,7 +4844,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1322 "glsl_parser.ypp" +#line 1321 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4859,7 +4859,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1332 "glsl_parser.ypp" +#line 1331 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4873,7 +4873,7 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1344 "glsl_parser.ypp" +#line 1343 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4884,7 +4884,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1350 "glsl_parser.ypp" +#line 1349 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4895,7 +4895,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1359 "glsl_parser.ypp" +#line 1358 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4906,7 +4906,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1368 "glsl_parser.ypp" +#line 1367 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4917,7 +4917,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1374 "glsl_parser.ypp" +#line 1373 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4928,7 +4928,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1380 "glsl_parser.ypp" +#line 1379 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4939,7 +4939,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1389 "glsl_parser.ypp" +#line 1388 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} @@ -4948,7 +4948,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 1393 "glsl_parser.ypp" +#line 1392 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4964,7 +4964,7 @@ yyreduce: case 260: /* Line 1455 of yacc.c */ -#line 1416 "glsl_parser.ypp" +#line 1415 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4976,7 +4976,7 @@ yyreduce: case 261: /* Line 1455 of yacc.c */ -#line 1423 "glsl_parser.ypp" +#line 1422 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4988,7 +4988,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 1430 "glsl_parser.ypp" +#line 1429 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -5000,7 +5000,7 @@ yyreduce: case 266: /* Line 1455 of yacc.c */ -#line 1446 "glsl_parser.ypp" +#line 1445 "glsl_parser.ypp" { (yyval.node) = NULL; ;} @@ -5009,7 +5009,7 @@ yyreduce: case 267: /* Line 1455 of yacc.c */ -#line 1453 "glsl_parser.ypp" +#line 1452 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; @@ -5019,7 +5019,7 @@ yyreduce: case 268: /* Line 1455 of yacc.c */ -#line 1458 "glsl_parser.ypp" +#line 1457 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); @@ -5029,7 +5029,7 @@ yyreduce: case 269: /* Line 1455 of yacc.c */ -#line 1467 "glsl_parser.ypp" +#line 1466 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5040,7 +5040,7 @@ yyreduce: case 270: /* Line 1455 of yacc.c */ -#line 1473 "glsl_parser.ypp" +#line 1472 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5051,7 +5051,7 @@ yyreduce: case 271: /* Line 1455 of yacc.c */ -#line 1479 "glsl_parser.ypp" +#line 1478 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5062,7 +5062,7 @@ yyreduce: case 272: /* Line 1455 of yacc.c */ -#line 1485 "glsl_parser.ypp" +#line 1484 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5073,7 +5073,7 @@ yyreduce: case 273: /* Line 1455 of yacc.c */ -#line 1491 "glsl_parser.ypp" +#line 1490 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5084,21 +5084,21 @@ yyreduce: case 274: /* Line 1455 of yacc.c */ -#line 1499 "glsl_parser.ypp" +#line 1498 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; case 275: /* Line 1455 of yacc.c */ -#line 1500 "glsl_parser.ypp" +#line 1499 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 276: /* Line 1455 of yacc.c */ -#line 1505 "glsl_parser.ypp" +#line 1504 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index b9f3e3fe04..2bfca6fa2f 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -237,7 +237,7 @@ typedef union YYSTYPE { /* Line 1676 of yacc.c */ -#line 53 "glsl_parser.ypp" +#line 52 "glsl_parser.ypp" int n; float real; -- cgit v1.2.3 From 5a805079a8d209e843661941730ecfebb65d2913 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Aug 2010 17:19:05 -0700 Subject: glsl2: Change command line options passed to flex Remove --never-interactive because it is already specified in the source using %option. Use -o instead of --outfile. Some of the %option commands may also need to be removed for compatibility with older versions (e.g., 2.5.4) of flex. This should fix bugzilla #29209. --- src/glsl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index a0ab1d6d40..3e480685bd 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -151,7 +151,7 @@ glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ glsl_lexer.cpp: glsl_lexer.lpp - flex --never-interactive --outfile="$@" $< + flex -o$@ $< glsl_parser.cpp: glsl_parser.ypp bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $< -- cgit v1.2.3 From 188f60fb0576c8ac06638a8fd080a2ecc551919c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Aug 2010 10:07:05 -0700 Subject: glsl2: Add missing include of string.h Makes the build happy on non-GCC platforms. --- src/glsl/glcpp/glcpp-parse.c | 215 ++++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 107 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index df26899a0f..a4d46042ff 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -95,6 +95,7 @@ #include #include +#include #include #include @@ -212,7 +213,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 216 "glcpp/glcpp-parse.c" +#line 217 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -300,7 +301,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 304 "glcpp/glcpp-parse.c" +#line 305 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -625,17 +626,17 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 180, 180, 182, 186, 189, 194, 195, 199, 202, - 208, 211, 214, 217, 225, 244, 254, 259, 264, 283, - 298, 301, 304, 313, 317, 326, 331, 332, 335, 338, - 341, 344, 347, 350, 353, 356, 359, 362, 365, 368, - 371, 374, 377, 380, 383, 386, 389, 392, 395, 398, - 404, 409, 417, 418, 422, 428, 429, 432, 434, 441, - 445, 449, 454, 460, 468, 474, 482, 486, 490, 494, - 498, 505, 506, 507, 508, 509, 510, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, - 534, 535 + 0, 181, 181, 183, 187, 190, 195, 196, 200, 203, + 209, 212, 215, 218, 226, 245, 255, 260, 265, 284, + 299, 302, 305, 314, 318, 327, 332, 333, 336, 339, + 342, 345, 348, 351, 354, 357, 360, 363, 366, 369, + 372, 375, 378, 381, 384, 387, 390, 393, 396, 399, + 405, 410, 418, 419, 423, 429, 430, 433, 435, 442, + 446, 450, 455, 461, 469, 475, 483, 487, 491, 495, + 499, 506, 507, 508, 509, 510, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, + 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, + 535, 536 }; #endif @@ -1595,7 +1596,7 @@ YYLTYPE yylloc; /* User initialization code. */ /* Line 1242 of yacc.c */ -#line 147 "glcpp/glcpp-parse.y" +#line 148 "glcpp/glcpp-parse.y" { yylloc.first_line = 1; yylloc.first_column = 1; @@ -1605,7 +1606,7 @@ YYLTYPE yylloc; } /* Line 1242 of yacc.c */ -#line 1609 "glcpp/glcpp-parse.c" +#line 1610 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1793,7 +1794,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 186 "glcpp/glcpp-parse.y" +#line 187 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); ;} @@ -1802,7 +1803,7 @@ yyreduce: case 5: /* Line 1455 of yacc.c */ -#line 189 "glcpp/glcpp-parse.y" +#line 190 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); glcpp_print(parser->output, "\n"); @@ -1813,7 +1814,7 @@ yyreduce: case 8: /* Line 1455 of yacc.c */ -#line 199 "glcpp/glcpp-parse.y" +#line 200 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); ;} @@ -1822,7 +1823,7 @@ yyreduce: case 9: /* Line 1455 of yacc.c */ -#line 202 "glcpp/glcpp-parse.y" +#line 203 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); ;} @@ -1831,7 +1832,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 208 "glcpp/glcpp-parse.y" +#line 209 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); ;} @@ -1840,7 +1841,7 @@ yyreduce: case 11: /* Line 1455 of yacc.c */ -#line 211 "glcpp/glcpp-parse.y" +#line 212 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); ;} @@ -1849,7 +1850,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 214 "glcpp/glcpp-parse.y" +#line 215 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); ;} @@ -1858,7 +1859,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 217 "glcpp/glcpp-parse.y" +#line 218 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); if (macro) { @@ -1872,7 +1873,7 @@ yyreduce: case 14: /* Line 1455 of yacc.c */ -#line 225 "glcpp/glcpp-parse.y" +#line 226 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we @@ -1897,7 +1898,7 @@ yyreduce: case 15: /* Line 1455 of yacc.c */ -#line 244 "glcpp/glcpp-parse.y" +#line 245 "glcpp/glcpp-parse.y" { /* #if without an expression is only an error if we * are not skipping */ @@ -1913,7 +1914,7 @@ yyreduce: case 16: /* Line 1455 of yacc.c */ -#line 254 "glcpp/glcpp-parse.y" +#line 255 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1924,7 +1925,7 @@ yyreduce: case 17: /* Line 1455 of yacc.c */ -#line 259 "glcpp/glcpp-parse.y" +#line 260 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); talloc_free ((yyvsp[(2) - (4)].str)); @@ -1935,7 +1936,7 @@ yyreduce: case 18: /* Line 1455 of yacc.c */ -#line 264 "glcpp/glcpp-parse.y" +#line 265 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression * if we are not skipping. When we are skipping, we @@ -1960,7 +1961,7 @@ yyreduce: case 19: /* Line 1455 of yacc.c */ -#line 283 "glcpp/glcpp-parse.y" +#line 284 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we * are skipping. */ @@ -1981,7 +1982,7 @@ yyreduce: case 20: /* Line 1455 of yacc.c */ -#line 298 "glcpp/glcpp-parse.y" +#line 299 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); ;} @@ -1990,7 +1991,7 @@ yyreduce: case 21: /* Line 1455 of yacc.c */ -#line 301 "glcpp/glcpp-parse.y" +#line 302 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); ;} @@ -1999,7 +2000,7 @@ yyreduce: case 22: /* Line 1455 of yacc.c */ -#line 304 "glcpp/glcpp-parse.y" +#line 305 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); if (macro) { @@ -2014,7 +2015,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 317 "glcpp/glcpp-parse.y" +#line 318 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); @@ -2029,7 +2030,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 326 "glcpp/glcpp-parse.y" +#line 327 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} @@ -2038,7 +2039,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 332 "glcpp/glcpp-parse.y" +#line 333 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); ;} @@ -2047,7 +2048,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 335 "glcpp/glcpp-parse.y" +#line 336 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); ;} @@ -2056,7 +2057,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 338 "glcpp/glcpp-parse.y" +#line 339 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} @@ -2065,7 +2066,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 341 "glcpp/glcpp-parse.y" +#line 342 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); ;} @@ -2074,7 +2075,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 344 "glcpp/glcpp-parse.y" +#line 345 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); ;} @@ -2083,7 +2084,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 347 "glcpp/glcpp-parse.y" +#line 348 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); ;} @@ -2092,7 +2093,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 350 "glcpp/glcpp-parse.y" +#line 351 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); ;} @@ -2101,7 +2102,7 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 353 "glcpp/glcpp-parse.y" +#line 354 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); ;} @@ -2110,7 +2111,7 @@ yyreduce: case 35: /* Line 1455 of yacc.c */ -#line 356 "glcpp/glcpp-parse.y" +#line 357 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); ;} @@ -2119,7 +2120,7 @@ yyreduce: case 36: /* Line 1455 of yacc.c */ -#line 359 "glcpp/glcpp-parse.y" +#line 360 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); ;} @@ -2128,7 +2129,7 @@ yyreduce: case 37: /* Line 1455 of yacc.c */ -#line 362 "glcpp/glcpp-parse.y" +#line 363 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); ;} @@ -2137,7 +2138,7 @@ yyreduce: case 38: /* Line 1455 of yacc.c */ -#line 365 "glcpp/glcpp-parse.y" +#line 366 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); ;} @@ -2146,7 +2147,7 @@ yyreduce: case 39: /* Line 1455 of yacc.c */ -#line 368 "glcpp/glcpp-parse.y" +#line 369 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); ;} @@ -2155,7 +2156,7 @@ yyreduce: case 40: /* Line 1455 of yacc.c */ -#line 371 "glcpp/glcpp-parse.y" +#line 372 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); ;} @@ -2164,7 +2165,7 @@ yyreduce: case 41: /* Line 1455 of yacc.c */ -#line 374 "glcpp/glcpp-parse.y" +#line 375 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); ;} @@ -2173,7 +2174,7 @@ yyreduce: case 42: /* Line 1455 of yacc.c */ -#line 377 "glcpp/glcpp-parse.y" +#line 378 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); ;} @@ -2182,7 +2183,7 @@ yyreduce: case 43: /* Line 1455 of yacc.c */ -#line 380 "glcpp/glcpp-parse.y" +#line 381 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); ;} @@ -2191,7 +2192,7 @@ yyreduce: case 44: /* Line 1455 of yacc.c */ -#line 383 "glcpp/glcpp-parse.y" +#line 384 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); ;} @@ -2200,7 +2201,7 @@ yyreduce: case 45: /* Line 1455 of yacc.c */ -#line 386 "glcpp/glcpp-parse.y" +#line 387 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); ;} @@ -2209,7 +2210,7 @@ yyreduce: case 46: /* Line 1455 of yacc.c */ -#line 389 "glcpp/glcpp-parse.y" +#line 390 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); ;} @@ -2218,7 +2219,7 @@ yyreduce: case 47: /* Line 1455 of yacc.c */ -#line 392 "glcpp/glcpp-parse.y" +#line 393 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} @@ -2227,7 +2228,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 395 "glcpp/glcpp-parse.y" +#line 396 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} @@ -2236,7 +2237,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 398 "glcpp/glcpp-parse.y" +#line 399 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); ;} @@ -2245,7 +2246,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 404 "glcpp/glcpp-parse.y" +#line 405 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); @@ -2256,7 +2257,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 409 "glcpp/glcpp-parse.y" +#line 410 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); @@ -2267,14 +2268,14 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 417 "glcpp/glcpp-parse.y" +#line 418 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: /* Line 1455 of yacc.c */ -#line 422 "glcpp/glcpp-parse.y" +#line 423 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); ;} @@ -2283,14 +2284,14 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 428 "glcpp/glcpp-parse.y" +#line 429 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: /* Line 1455 of yacc.c */ -#line 434 "glcpp/glcpp-parse.y" +#line 435 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); ;} @@ -2299,7 +2300,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 441 "glcpp/glcpp-parse.y" +#line 442 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2309,7 +2310,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 445 "glcpp/glcpp-parse.y" +#line 446 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; (yyval.token) = _token_create_ival (parser, INTEGER, v); @@ -2319,7 +2320,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 454 "glcpp/glcpp-parse.y" +#line 455 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2331,7 +2332,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 460 "glcpp/glcpp-parse.y" +#line 461 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2342,7 +2343,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 468 "glcpp/glcpp-parse.y" +#line 469 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; (yyval.token_list) = _token_list_create (parser); @@ -2354,7 +2355,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 474 "glcpp/glcpp-parse.y" +#line 475 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); @@ -2365,7 +2366,7 @@ yyreduce: case 66: /* Line 1455 of yacc.c */ -#line 482 "glcpp/glcpp-parse.y" +#line 483 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2375,7 +2376,7 @@ yyreduce: case 67: /* Line 1455 of yacc.c */ -#line 486 "glcpp/glcpp-parse.y" +#line 487 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2385,7 +2386,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 490 "glcpp/glcpp-parse.y" +#line 491 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); (yyval.token)->location = yylloc; @@ -2395,7 +2396,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 494 "glcpp/glcpp-parse.y" +#line 495 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); (yyval.token)->location = yylloc; @@ -2405,7 +2406,7 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 498 "glcpp/glcpp-parse.y" +#line 499 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); (yyval.token)->location = yylloc; @@ -2415,224 +2416,224 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 505 "glcpp/glcpp-parse.y" +#line 506 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: /* Line 1455 of yacc.c */ -#line 506 "glcpp/glcpp-parse.y" +#line 507 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: /* Line 1455 of yacc.c */ -#line 507 "glcpp/glcpp-parse.y" +#line 508 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: /* Line 1455 of yacc.c */ -#line 508 "glcpp/glcpp-parse.y" +#line 509 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: /* Line 1455 of yacc.c */ -#line 509 "glcpp/glcpp-parse.y" +#line 510 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: /* Line 1455 of yacc.c */ -#line 510 "glcpp/glcpp-parse.y" +#line 511 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: /* Line 1455 of yacc.c */ -#line 511 "glcpp/glcpp-parse.y" +#line 512 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: /* Line 1455 of yacc.c */ -#line 512 "glcpp/glcpp-parse.y" +#line 513 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: /* Line 1455 of yacc.c */ -#line 513 "glcpp/glcpp-parse.y" +#line 514 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: /* Line 1455 of yacc.c */ -#line 514 "glcpp/glcpp-parse.y" +#line 515 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 515 "glcpp/glcpp-parse.y" +#line 516 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: /* Line 1455 of yacc.c */ -#line 516 "glcpp/glcpp-parse.y" +#line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: /* Line 1455 of yacc.c */ -#line 517 "glcpp/glcpp-parse.y" +#line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: /* Line 1455 of yacc.c */ -#line 518 "glcpp/glcpp-parse.y" +#line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: /* Line 1455 of yacc.c */ -#line 519 "glcpp/glcpp-parse.y" +#line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: /* Line 1455 of yacc.c */ -#line 520 "glcpp/glcpp-parse.y" +#line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 521 "glcpp/glcpp-parse.y" +#line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 522 "glcpp/glcpp-parse.y" +#line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 523 "glcpp/glcpp-parse.y" +#line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: /* Line 1455 of yacc.c */ -#line 524 "glcpp/glcpp-parse.y" +#line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: /* Line 1455 of yacc.c */ -#line 525 "glcpp/glcpp-parse.y" +#line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: /* Line 1455 of yacc.c */ -#line 526 "glcpp/glcpp-parse.y" +#line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: /* Line 1455 of yacc.c */ -#line 527 "glcpp/glcpp-parse.y" +#line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: /* Line 1455 of yacc.c */ -#line 528 "glcpp/glcpp-parse.y" +#line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: /* Line 1455 of yacc.c */ -#line 529 "glcpp/glcpp-parse.y" +#line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: /* Line 1455 of yacc.c */ -#line 530 "glcpp/glcpp-parse.y" +#line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: /* Line 1455 of yacc.c */ -#line 531 "glcpp/glcpp-parse.y" +#line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: /* Line 1455 of yacc.c */ -#line 532 "glcpp/glcpp-parse.y" +#line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: /* Line 1455 of yacc.c */ -#line 533 "glcpp/glcpp-parse.y" +#line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: /* Line 1455 of yacc.c */ -#line 534 "glcpp/glcpp-parse.y" +#line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: /* Line 1455 of yacc.c */ -#line 535 "glcpp/glcpp-parse.y" +#line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; /* Line 1455 of yacc.c */ -#line 2636 "glcpp/glcpp-parse.c" +#line 2637 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2851,7 +2852,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 538 "glcpp/glcpp-parse.y" +#line 539 "glcpp/glcpp-parse.y" string_list_t * -- cgit v1.2.3 From 4ca4edd20e10415d7aabcf2ba6ca89e9401854ef Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Aug 2010 10:07:29 -0700 Subject: glsl2: Commit generated file changed by previous commit --- src/glsl/glcpp/glcpp-parse.y | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 7b08cd5807..b05a925a09 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -24,6 +24,7 @@ #include #include +#include #include #include -- cgit v1.2.3 From 261bbc011d11ab9e390cd5fe9f5151821eefaffa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Aug 2010 15:05:39 -0700 Subject: glsl2: Use Elements from main/compiler.h instead of open-coding --- src/glsl/builtin_function.cpp | 5 +---- src/glsl/builtin_types.h | 4 ---- src/glsl/builtins/tools/generate_builtins.pl | 5 +---- src/glsl/glsl_types.cpp | 1 + src/glsl/ir_variable.cpp | 5 +---- src/mesa/program/ir_to_mesa.cpp | 1 + 6 files changed, 5 insertions(+), 16 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 12e6909a28..1d9a58a5ca 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -23,6 +23,7 @@ */ #include +#include "main/compiler.h" #include "glsl_parser_extras.h" #include "ir_reader.h" #include "program.h" @@ -4799,10 +4800,6 @@ static const char *functions_for_EXT_texture_array_fs [] = { builtins_EXT_texture_array_fs_textures, }; -#ifndef Elements -#define Elements(x) (sizeof(x)/sizeof(*(x))) -#endif - void *builtin_mem_ctx = NULL; void diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index bfa4f3f540..7b94aac666 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -21,10 +21,6 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef Elements -#define Elements(x) (sizeof(x)/sizeof(*(x))) -#endif - const glsl_type glsl_type::_error_type = glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, ""); diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl index 61d511da1d..91ef8917b0 100755 --- a/src/glsl/builtins/tools/generate_builtins.pl +++ b/src/glsl/builtins/tools/generate_builtins.pl @@ -62,6 +62,7 @@ print << 'EOF'; */ #include +#include "main/compiler.h" #include "glsl_parser_extras.h" #include "ir_reader.h" #include "program.h" @@ -110,10 +111,6 @@ foreach $version (@versions) { } print << 'EOF'; -#ifndef Elements -#define Elements(x) (sizeof(x)/sizeof(*(x))) -#endif - void *builtin_mem_ctx = NULL; void diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 2aba1e0ac1..8e80cf99e9 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -23,6 +23,7 @@ #include #include +#include "main/compiler.h" #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "glsl_types.h" diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index d88cb515b4..917c06743b 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -21,15 +21,12 @@ * DEALINGS IN THE SOFTWARE. */ +#include "main/compiler.h" #include "ir.h" #include "glsl_parser_extras.h" #include "glsl_symbol_table.h" #include "builtin_variables.h" -#ifndef Elements -#define Elements(x) (sizeof(x)/sizeof(*(x))) -#endif - static void generate_ARB_draw_buffers_variables(exec_list *, struct _mesa_glsl_parse_state *, bool, _mesa_glsl_parser_targets); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a9a6f977c0..ecb13069cb 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -31,6 +31,7 @@ */ #include +#include "main/compiler.h" #include "ir.h" #include "ir_visitor.h" #include "ir_print_visitor.h" -- cgit v1.2.3 From 0dc39f481ab98d2114590103928b7403386c13cf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Aug 2010 18:00:35 -0700 Subject: glsl2: Use MIN2 from macros.h instead of open coding it --- src/glsl/ast_function.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index ca7d087727..6c36a04889 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -25,11 +25,7 @@ #include "ast.h" #include "glsl_types.h" #include "ir.h" - -inline unsigned min(unsigned a, unsigned b) -{ - return (a < b) ? a : b; -} +#include "main/macros.h" static ir_rvalue * convert_component(ir_rvalue *src, const glsl_type *desired_type); @@ -781,8 +777,8 @@ emit_inline_matrix_constructor(const glsl_type *type, { 1, 1, 1, 0 } }; - const unsigned cols_to_init = min(type->matrix_columns, - type->vector_elements); + 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); @@ -875,8 +871,8 @@ emit_inline_matrix_constructor(const glsl_type *type, for (unsigned i = 1; i < src_matrix->type->vector_elements; i++) swiz[i] = i; - const unsigned last_col = min(src_matrix->type->matrix_columns, - var->type->matrix_columns); + const unsigned last_col = MIN2(src_matrix->type->matrix_columns, + var->type->matrix_columns); const unsigned write_mask = (1U << var->type->vector_elements) - 1; for (unsigned i = 0; i < last_col; i++) { @@ -938,8 +934,8 @@ emit_inline_matrix_constructor(const glsl_type *type, * single vec4, for example, can completely fill a mat2. */ if (rhs_components >= components_remaining_this_column) { - const unsigned count = min(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); -- cgit v1.2.3 From 3a3cdb909da5b02edf921fcb5a009dfc2868d23d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 13 Aug 2010 13:55:34 +0100 Subject: scons: Build the new glsl2 code. --- SConstruct | 22 ------ src/gallium/targets/libgl-gdi/SConscript | 1 + src/glsl/SConscript | 112 ++++++++++++++++++++----------- src/mesa/SConscript | 8 ++- 4 files changed, 78 insertions(+), 65 deletions(-) (limited to 'src/glsl') diff --git a/SConstruct b/SConstruct index a187d8d1b6..bb03e5055e 100644 --- a/SConstruct +++ b/SConstruct @@ -206,28 +206,6 @@ Export('env') # TODO: Build several variants at the same time? # http://www.scons.org/wiki/SimultaneousVariantBuilds -if env['platform'] != common.default_platform: - # GLSL code has to be built twice -- one for the host OS, another for the target OS... - - host_env = Environment( - # options are ignored - # default tool is used - tools = ['default', 'custom'], - toolpath = ['#scons'], - ENV = os.environ, - ) - - host_env['platform'] = common.default_platform - host_env['machine'] = common.default_machine - host_env['debug'] = env['debug'] - - SConscript( - 'src/glsl/SConscript', - variant_dir = os.path.join(env['build'], 'host'), - duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html - exports={'env':host_env}, - ) - SConscript( 'src/SConscript', variant_dir = env['build'], diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index 144084f74f..12fe403f62 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -17,6 +17,7 @@ if env['platform'] == 'windows': 'user32', 'kernel32', 'ws2_32', + talloc, ]) sources = [] diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 8e18626c40..90759275ca 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -4,23 +4,69 @@ Import('*') env = env.Clone() +env.Prepend(CPPPATH = [ + '#src/mapi', + '#src/mesa', +]) + +if env['platform'] == 'windows': + env.Prepend(CPPPATH = ['#src/talloc']) + sources = [ - 'pp/sl_pp_context.c', - 'pp/sl_pp_define.c', - 'pp/sl_pp_dict.c', - 'pp/sl_pp_error.c', - 'pp/sl_pp_expression.c', - 'pp/sl_pp_extension.c', - 'pp/sl_pp_if.c', - 'pp/sl_pp_line.c', - 'pp/sl_pp_macro.c', - 'pp/sl_pp_pragma.c', - 'pp/sl_pp_process.c', - 'pp/sl_pp_purify.c', - 'pp/sl_pp_token.c', - 'pp/sl_pp_token_util.c', - 'pp/sl_pp_version.c', - 'cl/sl_cl_parse.c', + 'glcpp/glcpp-lex.c', + 'glcpp/glcpp-parse.c', + 'glcpp/pp.c', + 'ast_expr.cpp', + 'ast_function.cpp', + 'ast_to_hir.cpp', + 'ast_type.cpp', + 'builtin_function.cpp', + 'glsl_lexer.cpp', + 'glsl_parser.cpp', + 'glsl_parser_extras.cpp', + 'glsl_types.cpp', + 'hir_field_selection.cpp', + 'ir_algebraic.cpp', + 'ir_basic_block.cpp', + 'ir_clone.cpp', + 'ir_constant_expression.cpp', + 'ir_constant_folding.cpp', + 'ir_constant_propagation.cpp', + 'ir_constant_variable.cpp', + 'ir_copy_propagation.cpp', + 'ir.cpp', + 'ir_dead_code.cpp', + 'ir_dead_code_local.cpp', + 'ir_dead_functions.cpp', + 'ir_div_to_mul_rcp.cpp', + 'ir_explog_to_explog2.cpp', + 'ir_expression_flattening.cpp', + 'ir_function_can_inline.cpp', + 'ir_function.cpp', + 'ir_function_inlining.cpp', + 'ir_hierarchical_visitor.cpp', + 'ir_hv_accept.cpp', + 'ir_if_return.cpp', + 'ir_if_simplification.cpp', + 'ir_if_to_cond_assign.cpp', + 'ir_import_prototypes.cpp', + 'ir_mat_op_to_vec.cpp', + 'ir_mod_to_fract.cpp', + 'ir_print_visitor.cpp', + 'ir_reader.cpp', + 'ir_set_program_inouts.cpp', + 'ir_structure_splitting.cpp', + 'ir_sub_to_add_neg.cpp', + 'ir_swizzle_swizzle.cpp', + 'ir_tree_grafting.cpp', + 'ir_validate.cpp', + 'ir_variable.cpp', + 'ir_variable_refcount.cpp', + 'ir_vec_index_to_cond_assign.cpp', + 'ir_vec_index_to_swizzle.cpp', + 'linker.cpp', + 'link_functions.cpp', + 's_expression.cpp', ] glsl = env.ConvenienceLibrary( @@ -30,6 +76,9 @@ glsl = env.ConvenienceLibrary( Export('glsl') +# FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa +Return() + env = env.Clone() if env['platform'] == 'windows': @@ -37,33 +86,16 @@ if env['platform'] == 'windows': 'user32', ]) -env.Prepend(LIBS = [glsl]) - -env.Program( - target = 'purify', - source = ['apps/purify.c'], -) +env.Prepend(LIBS = [glsl, talloc]) env.Program( - target = 'tokenise', - source = ['apps/tokenise.c'], + target = 'glsl2', + source = [ + 'main.cpp', + ] ) env.Program( - target = 'version', - source = ['apps/version.c'], + target = 'glcpp', + source = ['glcpp/glcpp.c'], ) - -env.Program( - target = 'process', - source = ['apps/process.c'], -) - -glsl_compile = env.Program( - target = 'compile', - source = ['apps/compile.c'], -) - -if env['platform'] == common.default_platform: - # Only export the GLSL compiler when building for the host platform - Export('glsl_compile') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 79e9b4553b..5200a244f2 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -10,6 +10,7 @@ if env['platform'] != 'winddk': env.Append(CPPPATH = [ '#/src/mapi', + '#/src/glsl', '#/src/mesa', ]) @@ -19,6 +20,7 @@ if env['platform'] != 'winddk': 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers 'WIN32_THREADS', # use Win32 thread API ]) + env.Prepend(CPPPATH = ['#src/talloc']) # # Source files @@ -200,6 +202,7 @@ if env['platform'] != 'winddk': program_sources = [ 'program/arbprogparse.c', 'program/hash_table.c', + 'program/ir_to_mesa.cpp', 'program/lex.yy.c', 'program/nvfragparse.c', 'program/nvvertparse.c', @@ -248,8 +251,7 @@ if env['platform'] != 'winddk': program_sources + vbo_sources + vf_sources + - statetracker_sources + - slang_sources + statetracker_sources ) # @@ -327,7 +329,7 @@ if env['platform'] != 'winddk': # build dir) to the include path env.Append(CPPPATH = [matypes[0].dir]) - SConscript('slang/library/SConscript') + #SConscript('slang/library/SConscript') # # Libraries -- cgit v1.2.3 From 5b9f3db71996a1296c7da8501dd3b159bfe8c2b2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 09:26:01 -0700 Subject: glsl2: Eliminate tokens for square matrix short names MAT2 and MAT2X2, for example, are treated identically by the parser. The language version based error checking (becuase mat2x2 is not available in GLSL 1.10) is already done in the lexer. --- src/glsl/glsl_lexer.lpp | 6 +++--- src/glsl/glsl_parser.ypp | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 7ef537b248..a96078e481 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -151,9 +151,9 @@ ivec4 return IVEC4; vec2 return VEC2; vec3 return VEC3; vec4 return VEC4; -mat2 return MAT2; -mat3 return MAT3; -mat4 return MAT4; +mat2 return MAT2X2; +mat3 return MAT3X3; +mat4 return MAT4X4; mat2x2 TOKEN_OR_IDENTIFIER(120, MAT2X2); mat2x3 TOKEN_OR_IDENTIFIER(120, MAT2X3); mat2x4 TOKEN_OR_IDENTIFIER(120, MAT2X4); diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 7c5dc017d8..30c43d2474 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -80,7 +80,7 @@ %token ATTRIBUTE CONST_TOK BOOL FLOAT INT UINT %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 -%token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT UNIFORM VARYING +%token CENTROID IN OUT INOUT UNIFORM VARYING %token NOPERSPECTIVE FLAT SMOOTH %token MAT2X2 MAT2X3 MAT2X4 %token MAT3X2 MAT3X3 MAT3X4 @@ -1101,9 +1101,6 @@ basic_type_specifier_nonarray: | UVEC2 { $$ = ast_uvec2; } | UVEC3 { $$ = ast_uvec3; } | UVEC4 { $$ = ast_uvec4; } - | MAT2 { $$ = ast_mat2; } - | MAT3 { $$ = ast_mat3; } - | MAT4 { $$ = ast_mat4; } | MAT2X2 { $$ = ast_mat2; } | MAT2X3 { $$ = ast_mat2x3; } | MAT2X4 { $$ = ast_mat2x4; } -- cgit v1.2.3 From 5c77efc0b28dceaa2420b900822f475422a378d1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 09:23:54 -0700 Subject: glsl2: Avoid token name collisions with names used by Windows header files --- src/glsl/glsl_lexer.lpp | 26 +++++++++++++------------- src/glsl/glsl_parser.ypp | 36 ++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index a96078e481..3128cdd3a7 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -128,9 +128,9 @@ HASH ^{SPC}#{SPC} attribute return ATTRIBUTE; const return CONST_TOK; -bool return BOOL; -float return FLOAT; -int return INT; +bool return BOOL_TOK; +float return FLOAT_TOK; +int return INT_TOK; break return BREAK; continue return CONTINUE; @@ -164,9 +164,9 @@ mat4x2 TOKEN_OR_IDENTIFIER(120, MAT4X2); mat4x3 TOKEN_OR_IDENTIFIER(120, MAT4X3); mat4x4 TOKEN_OR_IDENTIFIER(120, MAT4X4); -in return IN; -out return OUT; -inout return INOUT; +in return IN_TOK; +out return OUT_TOK; +inout return INOUT_TOK; uniform return UNIFORM; varying return VARYING; centroid TOKEN_OR_IDENTIFIER(120, CENTROID); @@ -184,7 +184,7 @@ sampler1DShadow return SAMPLER1DSHADOW; sampler2DShadow return SAMPLER2DSHADOW; struct return STRUCT; -void return VOID; +void return VOID_TOK; layout { if ((yyextra->language_version >= 140) @@ -269,7 +269,7 @@ enum RESERVED_WORD(999, ENUM); typedef RESERVED_WORD(999, TYPEDEF); template RESERVED_WORD(999, TEMPLATE); this RESERVED_WORD(999, THIS); -packed RESERVED_WORD(999, PACKED); +packed RESERVED_WORD(999, PACKED_TOK); goto RESERVED_WORD(999, GOTO); switch RESERVED_WORD(130, SWITCH); default RESERVED_WORD(130, DEFAULT); @@ -281,13 +281,13 @@ static RESERVED_WORD(999, STATIC); extern RESERVED_WORD(999, EXTERN); external RESERVED_WORD(999, EXTERNAL); interface RESERVED_WORD(999, INTERFACE); -long RESERVED_WORD(999, LONG); -short RESERVED_WORD(999, SHORT); -double RESERVED_WORD(999, DOUBLE); +long RESERVED_WORD(999, LONG_TOK); +short RESERVED_WORD(999, SHORT_TOK); +double RESERVED_WORD(999, DOUBLE_TOK); half RESERVED_WORD(999, HALF); -fixed RESERVED_WORD(999, FIXED); +fixed RESERVED_WORD(999, FIXED_TOK); unsigned RESERVED_WORD(999, UNSIGNED); -input RESERVED_WORD(999, INPUT); +input RESERVED_WORD(999, INPUT_TOK); output RESERVED_WORD(999, OUTPUT); hvec2 RESERVED_WORD(999, HVEC2); hvec3 RESERVED_WORD(999, HVEC3); diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 30c43d2474..1ee6da1d23 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -77,10 +77,10 @@ } for_rest_statement; } -%token ATTRIBUTE CONST_TOK BOOL FLOAT INT UINT +%token ATTRIBUTE CONST_TOK BOOL_TOK FLOAT_TOK INT_TOK UINT_TOK %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 -%token CENTROID IN OUT INOUT UNIFORM VARYING +%token CENTROID IN_TOK OUT_TOK INOUT_TOK UNIFORM VARYING %token NOPERSPECTIVE FLAT SMOOTH %token MAT2X2 MAT2X3 MAT2X4 %token MAT3X2 MAT3X3 MAT3X4 @@ -90,7 +90,7 @@ %token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE %token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D %token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY -%token STRUCT VOID WHILE +%token STRUCT VOID_TOK WHILE %token IDENTIFIER %token FLOATCONSTANT %token INTCONSTANT UINTCONSTANT BOOLCONSTANT @@ -108,9 +108,9 @@ /* Reserved words that are not actually used in the grammar. */ -%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED GOTO +%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED_TOK GOTO %token INLINE_TOK NOINLINE VOLATILE PUBLIC_TOK STATIC EXTERN EXTERNAL -%token LONG SHORT DOUBLE HALF FIXED UNSIGNED INPUT OUPTUT +%token LONG_TOK SHORT_TOK DOUBLE_TOK HALF FIXED_TOK UNSIGNED INPUT_TOK OUPTUT %token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4 %token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW %token SIZEOF CAST NAMESPACE USING @@ -370,7 +370,7 @@ function_call_generic: ; function_call_header_no_parameters: - function_call_header VOID + function_call_header VOID_TOK | function_call_header ; @@ -783,9 +783,9 @@ parameter_declaration: parameter_qualifier: /* empty */ { $$.i = 0; } - | IN { $$.i = 0; $$.q.in = 1; } - | OUT { $$.i = 0; $$.q.out = 1; } - | INOUT { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } + | IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | INOUT_TOK { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } ; parameter_type_specifier: @@ -1030,10 +1030,10 @@ storage_qualifier: | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; } | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } - | opt_layout_qualifier IN { $$.i = 0; $$.q.in = 1; } - | OUT { $$.i = 0; $$.q.out = 1; } - | CENTROID IN { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } - | CENTROID OUT { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } + | opt_layout_qualifier IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } + | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } | UNIFORM { $$.i = 0; $$.q.uniform = 1; } ; @@ -1084,11 +1084,11 @@ type_specifier_nonarray: ; basic_type_specifier_nonarray: - VOID { $$ = ast_void; } - | FLOAT { $$ = ast_float; } - | INT { $$ = ast_int; } - | UINT { $$ = ast_uint; } - | BOOL { $$ = ast_bool; } + VOID_TOK { $$ = ast_void; } + | FLOAT_TOK { $$ = ast_float; } + | INT_TOK { $$ = ast_int; } + | UINT_TOK { $$ = ast_uint; } + | BOOL_TOK { $$ = ast_bool; } | VEC2 { $$ = ast_vec2; } | VEC3 { $$ = ast_vec3; } | VEC4 { $$ = ast_vec4; } -- cgit v1.2.3 From 103453659dbb21dd49e700e4b6ba9aac83b5a3f4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 09:34:52 -0700 Subject: glsl2: Commit generated files changed by previous two commits --- src/glsl/glsl_lexer.cpp | 32 +- src/glsl/glsl_parser.cpp | 2360 ++++++++++++++++++++++------------------------ src/glsl/glsl_parser.h | 325 ++++--- 3 files changed, 1314 insertions(+), 1403 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index f75f7b5171..2c502e8803 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -1415,17 +1415,17 @@ return CONST_TOK; case 17: YY_RULE_SETUP #line 131 "glsl_lexer.lpp" -return BOOL; +return BOOL_TOK; YY_BREAK case 18: YY_RULE_SETUP #line 132 "glsl_lexer.lpp" -return FLOAT; +return FLOAT_TOK; YY_BREAK case 19: YY_RULE_SETUP #line 133 "glsl_lexer.lpp" -return INT; +return INT_TOK; YY_BREAK case 20: YY_RULE_SETUP @@ -1520,17 +1520,17 @@ return VEC4; case 38: YY_RULE_SETUP #line 154 "glsl_lexer.lpp" -return MAT2; +return MAT2X2; YY_BREAK case 39: YY_RULE_SETUP #line 155 "glsl_lexer.lpp" -return MAT3; +return MAT3X3; YY_BREAK case 40: YY_RULE_SETUP #line 156 "glsl_lexer.lpp" -return MAT4; +return MAT4X4; YY_BREAK case 41: YY_RULE_SETUP @@ -1580,17 +1580,17 @@ TOKEN_OR_IDENTIFIER(120, MAT4X4); case 50: YY_RULE_SETUP #line 167 "glsl_lexer.lpp" -return IN; +return IN_TOK; YY_BREAK case 51: YY_RULE_SETUP #line 168 "glsl_lexer.lpp" -return OUT; +return OUT_TOK; YY_BREAK case 52: YY_RULE_SETUP #line 169 "glsl_lexer.lpp" -return INOUT; +return INOUT_TOK; YY_BREAK case 53: YY_RULE_SETUP @@ -1665,7 +1665,7 @@ return STRUCT; case 67: YY_RULE_SETUP #line 187 "glsl_lexer.lpp" -return VOID; +return VOID_TOK; YY_BREAK case 68: YY_RULE_SETUP @@ -1894,7 +1894,7 @@ RESERVED_WORD(999, THIS); case 105: YY_RULE_SETUP #line 272 "glsl_lexer.lpp" -RESERVED_WORD(999, PACKED); +RESERVED_WORD(999, PACKED_TOK); YY_BREAK case 106: YY_RULE_SETUP @@ -1954,17 +1954,17 @@ RESERVED_WORD(999, INTERFACE); case 117: YY_RULE_SETUP #line 284 "glsl_lexer.lpp" -RESERVED_WORD(999, LONG); +RESERVED_WORD(999, LONG_TOK); YY_BREAK case 118: YY_RULE_SETUP #line 285 "glsl_lexer.lpp" -RESERVED_WORD(999, SHORT); +RESERVED_WORD(999, SHORT_TOK); YY_BREAK case 119: YY_RULE_SETUP #line 286 "glsl_lexer.lpp" -RESERVED_WORD(999, DOUBLE); +RESERVED_WORD(999, DOUBLE_TOK); YY_BREAK case 120: YY_RULE_SETUP @@ -1974,7 +1974,7 @@ RESERVED_WORD(999, HALF); case 121: YY_RULE_SETUP #line 288 "glsl_lexer.lpp" -RESERVED_WORD(999, FIXED); +RESERVED_WORD(999, FIXED_TOK); YY_BREAK case 122: YY_RULE_SETUP @@ -1984,7 +1984,7 @@ RESERVED_WORD(999, UNSIGNED); case 123: YY_RULE_SETUP #line 290 "glsl_lexer.lpp" -RESERVED_WORD(999, INPUT); +RESERVED_WORD(999, INPUT_TOK); YY_BREAK case 124: YY_RULE_SETUP diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 864ab0032f..8756fcb721 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -143,10 +143,10 @@ enum yytokentype { ATTRIBUTE = 258, CONST_TOK = 259, - BOOL = 260, - FLOAT = 261, - INT = 262, - UINT = 263, + BOOL_TOK = 260, + FLOAT_TOK = 261, + INT_TOK = 262, + UINT_TOK = 263, BREAK = 264, CONTINUE = 265, DO = 266, @@ -170,165 +170,162 @@ VEC2 = 284, VEC3 = 285, VEC4 = 286, - MAT2 = 287, - MAT3 = 288, - MAT4 = 289, - CENTROID = 290, - IN = 291, - OUT = 292, - INOUT = 293, - UNIFORM = 294, - VARYING = 295, - NOPERSPECTIVE = 296, - FLAT = 297, - SMOOTH = 298, - MAT2X2 = 299, - MAT2X3 = 300, - MAT2X4 = 301, - MAT3X2 = 302, - MAT3X3 = 303, - MAT3X4 = 304, - MAT4X2 = 305, - MAT4X3 = 306, - MAT4X4 = 307, - SAMPLER1D = 308, - SAMPLER2D = 309, - SAMPLER3D = 310, - SAMPLERCUBE = 311, - SAMPLER1DSHADOW = 312, - SAMPLER2DSHADOW = 313, - SAMPLERCUBESHADOW = 314, - SAMPLER1DARRAY = 315, - SAMPLER2DARRAY = 316, - SAMPLER1DARRAYSHADOW = 317, - SAMPLER2DARRAYSHADOW = 318, - ISAMPLER1D = 319, - ISAMPLER2D = 320, - ISAMPLER3D = 321, - ISAMPLERCUBE = 322, - ISAMPLER1DARRAY = 323, - ISAMPLER2DARRAY = 324, - USAMPLER1D = 325, - USAMPLER2D = 326, - USAMPLER3D = 327, - USAMPLERCUBE = 328, - USAMPLER1DARRAY = 329, - USAMPLER2DARRAY = 330, - STRUCT = 331, - VOID = 332, - WHILE = 333, - IDENTIFIER = 334, - FLOATCONSTANT = 335, - INTCONSTANT = 336, - UINTCONSTANT = 337, - BOOLCONSTANT = 338, - FIELD_SELECTION = 339, - LEFT_OP = 340, - RIGHT_OP = 341, - INC_OP = 342, - DEC_OP = 343, - LE_OP = 344, - GE_OP = 345, - EQ_OP = 346, - NE_OP = 347, - AND_OP = 348, - OR_OP = 349, - XOR_OP = 350, - MUL_ASSIGN = 351, - DIV_ASSIGN = 352, - ADD_ASSIGN = 353, - MOD_ASSIGN = 354, - LEFT_ASSIGN = 355, - RIGHT_ASSIGN = 356, - AND_ASSIGN = 357, - XOR_ASSIGN = 358, - OR_ASSIGN = 359, - SUB_ASSIGN = 360, - INVARIANT = 361, - LOWP = 362, - MEDIUMP = 363, - HIGHP = 364, - SUPERP = 365, - PRECISION = 366, - VERSION = 367, - EXTENSION = 368, - LINE = 369, - PRAGMA = 370, - COLON = 371, - EOL = 372, - INTERFACE = 373, - OUTPUT = 374, - LAYOUT_TOK = 375, - ASM = 376, - CLASS = 377, - UNION = 378, - ENUM = 379, - TYPEDEF = 380, - TEMPLATE = 381, - THIS = 382, - PACKED = 383, - GOTO = 384, - INLINE_TOK = 385, - NOINLINE = 386, - VOLATILE = 387, - PUBLIC_TOK = 388, - STATIC = 389, - EXTERN = 390, - EXTERNAL = 391, - LONG = 392, - SHORT = 393, - DOUBLE = 394, - HALF = 395, - FIXED = 396, - UNSIGNED = 397, - INPUT = 398, - OUPTUT = 399, - HVEC2 = 400, - HVEC3 = 401, - HVEC4 = 402, - DVEC2 = 403, - DVEC3 = 404, - DVEC4 = 405, - FVEC2 = 406, - FVEC3 = 407, - FVEC4 = 408, - SAMPLER2DRECT = 409, - SAMPLER3DRECT = 410, - SAMPLER2DRECTSHADOW = 411, - SIZEOF = 412, - CAST = 413, - NAMESPACE = 414, - USING = 415, - ERROR_TOK = 416, - COMMON = 417, - PARTITION = 418, - ACTIVE = 419, - SAMPLERBUFFER = 420, - FILTER = 421, - IMAGE1D = 422, - IMAGE2D = 423, - IMAGE3D = 424, - IMAGECUBE = 425, - IMAGE1DARRAY = 426, - IMAGE2DARRAY = 427, - IIMAGE1D = 428, - IIMAGE2D = 429, - IIMAGE3D = 430, - IIMAGECUBE = 431, - IIMAGE1DARRAY = 432, - IIMAGE2DARRAY = 433, - UIMAGE1D = 434, - UIMAGE2D = 435, - UIMAGE3D = 436, - UIMAGECUBE = 437, - UIMAGE1DARRAY = 438, - UIMAGE2DARRAY = 439, - IMAGE1DSHADOW = 440, - IMAGE2DSHADOW = 441, - IMAGEBUFFER = 442, - IIMAGEBUFFER = 443, - UIMAGEBUFFER = 444, - ROW_MAJOR = 445 + CENTROID = 287, + IN_TOK = 288, + OUT_TOK = 289, + INOUT_TOK = 290, + UNIFORM = 291, + VARYING = 292, + NOPERSPECTIVE = 293, + FLAT = 294, + SMOOTH = 295, + MAT2X2 = 296, + MAT2X3 = 297, + MAT2X4 = 298, + MAT3X2 = 299, + MAT3X3 = 300, + MAT3X4 = 301, + MAT4X2 = 302, + MAT4X3 = 303, + MAT4X4 = 304, + SAMPLER1D = 305, + SAMPLER2D = 306, + SAMPLER3D = 307, + SAMPLERCUBE = 308, + SAMPLER1DSHADOW = 309, + SAMPLER2DSHADOW = 310, + SAMPLERCUBESHADOW = 311, + SAMPLER1DARRAY = 312, + SAMPLER2DARRAY = 313, + SAMPLER1DARRAYSHADOW = 314, + SAMPLER2DARRAYSHADOW = 315, + ISAMPLER1D = 316, + ISAMPLER2D = 317, + ISAMPLER3D = 318, + ISAMPLERCUBE = 319, + ISAMPLER1DARRAY = 320, + ISAMPLER2DARRAY = 321, + USAMPLER1D = 322, + USAMPLER2D = 323, + USAMPLER3D = 324, + USAMPLERCUBE = 325, + USAMPLER1DARRAY = 326, + USAMPLER2DARRAY = 327, + STRUCT = 328, + VOID_TOK = 329, + WHILE = 330, + IDENTIFIER = 331, + FLOATCONSTANT = 332, + INTCONSTANT = 333, + UINTCONSTANT = 334, + BOOLCONSTANT = 335, + FIELD_SELECTION = 336, + LEFT_OP = 337, + RIGHT_OP = 338, + INC_OP = 339, + DEC_OP = 340, + LE_OP = 341, + GE_OP = 342, + EQ_OP = 343, + NE_OP = 344, + AND_OP = 345, + OR_OP = 346, + XOR_OP = 347, + MUL_ASSIGN = 348, + DIV_ASSIGN = 349, + ADD_ASSIGN = 350, + MOD_ASSIGN = 351, + LEFT_ASSIGN = 352, + RIGHT_ASSIGN = 353, + AND_ASSIGN = 354, + XOR_ASSIGN = 355, + OR_ASSIGN = 356, + SUB_ASSIGN = 357, + INVARIANT = 358, + LOWP = 359, + MEDIUMP = 360, + HIGHP = 361, + SUPERP = 362, + PRECISION = 363, + VERSION = 364, + EXTENSION = 365, + LINE = 366, + PRAGMA = 367, + COLON = 368, + EOL = 369, + INTERFACE = 370, + OUTPUT = 371, + LAYOUT_TOK = 372, + ASM = 373, + CLASS = 374, + UNION = 375, + ENUM = 376, + TYPEDEF = 377, + TEMPLATE = 378, + THIS = 379, + PACKED_TOK = 380, + GOTO = 381, + INLINE_TOK = 382, + NOINLINE = 383, + VOLATILE = 384, + PUBLIC_TOK = 385, + STATIC = 386, + EXTERN = 387, + EXTERNAL = 388, + LONG_TOK = 389, + SHORT_TOK = 390, + DOUBLE_TOK = 391, + HALF = 392, + FIXED_TOK = 393, + UNSIGNED = 394, + INPUT_TOK = 395, + OUPTUT = 396, + HVEC2 = 397, + HVEC3 = 398, + HVEC4 = 399, + DVEC2 = 400, + DVEC3 = 401, + DVEC4 = 402, + FVEC2 = 403, + FVEC3 = 404, + FVEC4 = 405, + SAMPLER2DRECT = 406, + SAMPLER3DRECT = 407, + SAMPLER2DRECTSHADOW = 408, + SIZEOF = 409, + CAST = 410, + NAMESPACE = 411, + USING = 412, + ERROR_TOK = 413, + COMMON = 414, + PARTITION = 415, + ACTIVE = 416, + SAMPLERBUFFER = 417, + FILTER = 418, + IMAGE1D = 419, + IMAGE2D = 420, + IMAGE3D = 421, + IMAGECUBE = 422, + IMAGE1DARRAY = 423, + IMAGE2DARRAY = 424, + IIMAGE1D = 425, + IIMAGE2D = 426, + IIMAGE3D = 427, + IIMAGECUBE = 428, + IIMAGE1DARRAY = 429, + IIMAGE2DARRAY = 430, + UIMAGE1D = 431, + UIMAGE2D = 432, + UIMAGE3D = 433, + UIMAGECUBE = 434, + UIMAGE1DARRAY = 435, + UIMAGE2DARRAY = 436, + IMAGE1DSHADOW = 437, + IMAGE2DSHADOW = 438, + IMAGEBUFFER = 439, + IIMAGEBUFFER = 440, + UIMAGEBUFFER = 441, + ROW_MAJOR = 442 }; #endif @@ -370,7 +367,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 374 "glsl_parser.cpp" +#line 371 "glsl_parser.cpp" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -395,7 +392,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 399 "glsl_parser.cpp" +#line 396 "glsl_parser.cpp" #ifdef short # undef short @@ -612,20 +609,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 4389 +#define YYLAST 4096 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 215 +#define YYNTOKENS 212 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 89 /* YYNRULES -- Number of rules. */ -#define YYNRULES 276 +#define YYNRULES 273 /* YYNRULES -- Number of states. */ -#define YYNSTATES 413 +#define YYNSTATES 410 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 445 +#define YYMAXUTOK 442 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -636,16 +633,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 199, 2, 2, 2, 203, 206, 2, - 191, 192, 201, 197, 196, 198, 195, 202, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 210, 212, - 204, 211, 205, 209, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 196, 2, 2, 2, 200, 203, 2, + 188, 189, 198, 194, 193, 195, 192, 199, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 207, 209, + 201, 208, 202, 206, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 193, 2, 194, 207, 2, 2, 2, 2, 2, + 2, 190, 2, 191, 204, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 213, 208, 214, 200, 2, 2, 2, + 2, 2, 2, 210, 205, 211, 197, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -677,7 +674,7 @@ static const yytype_uint8 yytranslate[] = 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190 + 185, 186, 187 }; #if YYDEBUG @@ -706,98 +703,97 @@ static const yytype_uint16 yyprhs[] = 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, - 584, 586, 588, 590, 592, 594, 596, 598, 600, 606, - 611, 613, 616, 620, 622, 626, 628, 633, 635, 637, - 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, - 659, 661, 664, 668, 670, 672, 675, 679, 681, 684, - 686, 689, 697, 703, 709, 717, 719, 724, 730, 734, - 737, 743, 751, 758, 760, 762, 764, 765, 768, 772, - 775, 778, 781, 785, 788, 790, 792 + 584, 586, 588, 590, 592, 594, 600, 605, 607, 610, + 614, 616, 620, 622, 627, 629, 631, 633, 635, 637, + 639, 641, 643, 645, 647, 649, 651, 653, 655, 658, + 662, 664, 666, 669, 673, 675, 678, 680, 683, 691, + 697, 703, 711, 713, 718, 724, 728, 731, 737, 745, + 752, 754, 756, 758, 759, 762, 766, 769, 772, 775, + 779, 782, 784, 786 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 216, 0, -1, -1, 218, 219, 217, 221, -1, -1, - 112, 81, 117, -1, -1, 219, 220, -1, 113, 79, - 116, 79, 117, -1, 302, -1, 221, 302, -1, 79, - -1, 222, -1, 81, -1, 82, -1, 80, -1, 83, - -1, 191, 249, 192, -1, 223, -1, 224, 193, 225, - 194, -1, 226, -1, 224, 195, 79, -1, 224, 87, - -1, 224, 88, -1, 249, -1, 227, -1, 228, -1, - 224, 195, 228, -1, 230, 192, -1, 229, 192, -1, - 231, 77, -1, 231, -1, 231, 247, -1, 230, 196, - 247, -1, 232, 191, -1, 271, -1, 79, -1, 84, - -1, 224, -1, 87, 233, -1, 88, 233, -1, 234, - 233, -1, 197, -1, 198, -1, 199, -1, 200, -1, - 233, -1, 235, 201, 233, -1, 235, 202, 233, -1, - 235, 203, 233, -1, 235, -1, 236, 197, 235, -1, - 236, 198, 235, -1, 236, -1, 237, 85, 236, -1, - 237, 86, 236, -1, 237, -1, 238, 204, 237, -1, - 238, 205, 237, -1, 238, 89, 237, -1, 238, 90, - 237, -1, 238, -1, 239, 91, 238, -1, 239, 92, - 238, -1, 239, -1, 240, 206, 239, -1, 240, -1, - 241, 207, 240, -1, 241, -1, 242, 208, 241, -1, - 242, -1, 243, 93, 242, -1, 243, -1, 244, 95, - 243, -1, 244, -1, 245, 94, 244, -1, 245, -1, - 245, 209, 249, 210, 247, -1, 246, -1, 233, 248, - 247, -1, 211, -1, 96, -1, 97, -1, 99, -1, - 98, -1, 105, -1, 100, -1, 101, -1, 102, -1, - 103, -1, 104, -1, 247, -1, 249, 196, 247, -1, - 246, -1, 252, 212, -1, 260, 212, -1, 111, 275, - 272, 212, -1, 253, 192, -1, 255, -1, 254, -1, - 255, 257, -1, 254, 196, 257, -1, 262, 79, 191, - -1, 271, 79, -1, 271, 79, 193, 250, 194, -1, - 268, 258, 256, -1, 258, 256, -1, 268, 258, 259, - -1, 258, 259, -1, -1, 36, -1, 37, -1, 38, - -1, 271, -1, 261, -1, 260, 196, 79, -1, 260, - 196, 79, 193, 194, -1, 260, 196, 79, 193, 250, - 194, -1, 260, 196, 79, 193, 194, 211, 281, -1, - 260, 196, 79, 193, 250, 194, 211, 281, -1, 260, - 196, 79, 211, 281, -1, 262, -1, 262, 79, -1, - 262, 79, 193, 194, -1, 262, 79, 193, 250, 194, - -1, 262, 79, 193, 194, 211, 281, -1, 262, 79, - 193, 250, 194, 211, 281, -1, 262, 79, 211, 281, - -1, 106, 79, -1, 271, -1, 269, 271, -1, -1, - 264, -1, 120, 191, 265, 192, -1, 266, -1, 265, - 196, 266, -1, 79, -1, 43, -1, 42, -1, 41, - -1, 4, -1, 270, -1, 267, 269, -1, 106, 269, - -1, 4, -1, 3, -1, 263, 40, -1, 35, 40, - -1, 263, 36, -1, 37, -1, 35, 36, -1, 35, - 37, -1, 39, -1, 272, -1, 275, 272, -1, 273, - -1, 273, 193, 194, -1, 273, 193, 250, 194, -1, - 274, -1, 276, -1, 79, -1, 77, -1, 6, -1, + 213, 0, -1, -1, 215, 216, 214, 218, -1, -1, + 109, 78, 114, -1, -1, 216, 217, -1, 110, 76, + 113, 76, 114, -1, 299, -1, 218, 299, -1, 76, + -1, 219, -1, 78, -1, 79, -1, 77, -1, 80, + -1, 188, 246, 189, -1, 220, -1, 221, 190, 222, + 191, -1, 223, -1, 221, 192, 76, -1, 221, 84, + -1, 221, 85, -1, 246, -1, 224, -1, 225, -1, + 221, 192, 225, -1, 227, 189, -1, 226, 189, -1, + 228, 74, -1, 228, -1, 228, 244, -1, 227, 193, + 244, -1, 229, 188, -1, 268, -1, 76, -1, 81, + -1, 221, -1, 84, 230, -1, 85, 230, -1, 231, + 230, -1, 194, -1, 195, -1, 196, -1, 197, -1, + 230, -1, 232, 198, 230, -1, 232, 199, 230, -1, + 232, 200, 230, -1, 232, -1, 233, 194, 232, -1, + 233, 195, 232, -1, 233, -1, 234, 82, 233, -1, + 234, 83, 233, -1, 234, -1, 235, 201, 234, -1, + 235, 202, 234, -1, 235, 86, 234, -1, 235, 87, + 234, -1, 235, -1, 236, 88, 235, -1, 236, 89, + 235, -1, 236, -1, 237, 203, 236, -1, 237, -1, + 238, 204, 237, -1, 238, -1, 239, 205, 238, -1, + 239, -1, 240, 90, 239, -1, 240, -1, 241, 92, + 240, -1, 241, -1, 242, 91, 241, -1, 242, -1, + 242, 206, 246, 207, 244, -1, 243, -1, 230, 245, + 244, -1, 208, -1, 93, -1, 94, -1, 96, -1, + 95, -1, 102, -1, 97, -1, 98, -1, 99, -1, + 100, -1, 101, -1, 244, -1, 246, 193, 244, -1, + 243, -1, 249, 209, -1, 257, 209, -1, 108, 272, + 269, 209, -1, 250, 189, -1, 252, -1, 251, -1, + 252, 254, -1, 251, 193, 254, -1, 259, 76, 188, + -1, 268, 76, -1, 268, 76, 190, 247, 191, -1, + 265, 255, 253, -1, 255, 253, -1, 265, 255, 256, + -1, 255, 256, -1, -1, 33, -1, 34, -1, 35, + -1, 268, -1, 258, -1, 257, 193, 76, -1, 257, + 193, 76, 190, 191, -1, 257, 193, 76, 190, 247, + 191, -1, 257, 193, 76, 190, 191, 208, 278, -1, + 257, 193, 76, 190, 247, 191, 208, 278, -1, 257, + 193, 76, 208, 278, -1, 259, -1, 259, 76, -1, + 259, 76, 190, 191, -1, 259, 76, 190, 247, 191, + -1, 259, 76, 190, 191, 208, 278, -1, 259, 76, + 190, 247, 191, 208, 278, -1, 259, 76, 208, 278, + -1, 103, 76, -1, 268, -1, 266, 268, -1, -1, + 261, -1, 117, 188, 262, 189, -1, 263, -1, 262, + 193, 263, -1, 76, -1, 40, -1, 39, -1, 38, + -1, 4, -1, 267, -1, 264, 266, -1, 103, 266, + -1, 4, -1, 3, -1, 260, 37, -1, 32, 37, + -1, 260, 33, -1, 34, -1, 32, 33, -1, 32, + 34, -1, 36, -1, 269, -1, 272, 269, -1, 270, + -1, 270, 190, 191, -1, 270, 190, 247, 191, -1, + 271, -1, 273, -1, 76, -1, 74, -1, 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, - 32, -1, 33, -1, 34, -1, 44, -1, 45, -1, + 41, -1, 42, -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, 50, -1, - 51, -1, 52, -1, 53, -1, 54, -1, 154, -1, - 55, -1, 56, -1, 57, -1, 58, -1, 156, -1, + 51, -1, 151, -1, 52, -1, 53, -1, 54, -1, + 55, -1, 153, -1, 56, -1, 57, -1, 58, -1, 59, -1, 60, -1, 61, -1, 62, -1, 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, 68, -1, - 69, -1, 70, -1, 71, -1, 72, -1, 73, -1, - 74, -1, 75, -1, 109, -1, 108, -1, 107, -1, - 76, 79, 213, 277, 214, -1, 76, 213, 277, 214, - -1, 278, -1, 277, 278, -1, 271, 279, 212, -1, - 280, -1, 279, 196, 280, -1, 79, -1, 79, 193, - 250, 194, -1, 247, -1, 251, -1, 284, -1, 285, - -1, 287, -1, 286, -1, 293, -1, 282, -1, 291, - -1, 292, -1, 295, -1, 296, -1, 297, -1, 301, - -1, 213, 214, -1, 213, 290, 214, -1, 289, -1, - 286, -1, 213, 214, -1, 213, 290, 214, -1, 283, - -1, 290, 283, -1, 212, -1, 249, 212, -1, 14, - 191, 249, 192, 284, 12, 284, -1, 14, 191, 249, - 192, 284, -1, 14, 191, 249, 192, 285, -1, 14, - 191, 249, 192, 284, 12, 285, -1, 249, -1, 262, - 79, 211, 281, -1, 17, 191, 249, 192, 287, -1, - 18, 249, 210, -1, 19, 210, -1, 78, 191, 294, - 192, 288, -1, 11, 283, 78, 191, 249, 192, 212, - -1, 13, 191, 298, 300, 192, 288, -1, 291, -1, - 282, -1, 294, -1, -1, 299, 212, -1, 299, 212, - 249, -1, 10, 212, -1, 9, 212, -1, 16, 212, - -1, 16, 249, 212, -1, 15, 212, -1, 303, -1, - 251, -1, 252, 289, -1 + 69, -1, 70, -1, 71, -1, 72, -1, 106, -1, + 105, -1, 104, -1, 73, 76, 210, 274, 211, -1, + 73, 210, 274, 211, -1, 275, -1, 274, 275, -1, + 268, 276, 209, -1, 277, -1, 276, 193, 277, -1, + 76, -1, 76, 190, 247, 191, -1, 244, -1, 248, + -1, 281, -1, 282, -1, 284, -1, 283, -1, 290, + -1, 279, -1, 288, -1, 289, -1, 292, -1, 293, + -1, 294, -1, 298, -1, 210, 211, -1, 210, 287, + 211, -1, 286, -1, 283, -1, 210, 211, -1, 210, + 287, 211, -1, 280, -1, 287, 280, -1, 209, -1, + 246, 209, -1, 14, 188, 246, 189, 281, 12, 281, + -1, 14, 188, 246, 189, 281, -1, 14, 188, 246, + 189, 282, -1, 14, 188, 246, 189, 281, 12, 282, + -1, 246, -1, 259, 76, 208, 278, -1, 17, 188, + 246, 189, 284, -1, 18, 246, 207, -1, 19, 207, + -1, 75, 188, 291, 189, 285, -1, 11, 280, 75, + 188, 246, 189, 209, -1, 13, 188, 295, 297, 189, + 285, -1, 288, -1, 279, -1, 291, -1, -1, 296, + 209, -1, 296, 209, 246, -1, 10, 209, -1, 9, + 209, -1, 16, 209, -1, 16, 246, 209, -1, 15, + 209, -1, 300, -1, 248, -1, 249, 286, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -824,13 +820,13 @@ static const yytype_uint16 yyrline[] = 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, - 1136, 1137, 1138, 1139, 1140, 1144, 1155, 1166, 1180, 1186, - 1195, 1200, 1208, 1223, 1228, 1236, 1242, 1251, 1255, 1261, - 1262, 1266, 1267, 1271, 1275, 1276, 1277, 1278, 1279, 1280, - 1281, 1285, 1291, 1300, 1301, 1305, 1311, 1320, 1330, 1342, - 1348, 1357, 1366, 1372, 1378, 1387, 1391, 1405, 1409, 1410, - 1414, 1421, 1428, 1438, 1439, 1443, 1445, 1451, 1456, 1465, - 1471, 1477, 1483, 1489, 1498, 1499, 1503 + 1136, 1137, 1141, 1152, 1163, 1177, 1183, 1192, 1197, 1205, + 1220, 1225, 1233, 1239, 1248, 1252, 1258, 1259, 1263, 1264, + 1268, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1282, 1288, + 1297, 1298, 1302, 1308, 1317, 1327, 1339, 1345, 1354, 1363, + 1369, 1375, 1384, 1388, 1402, 1406, 1407, 1411, 1418, 1425, + 1435, 1436, 1440, 1442, 1448, 1453, 1462, 1468, 1474, 1480, + 1486, 1495, 1496, 1500 }; #endif @@ -839,11 +835,11 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "ATTRIBUTE", "CONST_TOK", "BOOL", - "FLOAT", "INT", "UINT", "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", - "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", - "BVEC4", "IVEC2", "IVEC3", "IVEC4", "UVEC2", "UVEC3", "UVEC4", "VEC2", - "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", "IN", "OUT", "INOUT", + "$end", "error", "$undefined", "ATTRIBUTE", "CONST_TOK", "BOOL_TOK", + "FLOAT_TOK", "INT_TOK", "UINT_TOK", "BREAK", "CONTINUE", "DO", "ELSE", + "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "BVEC2", + "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", "UVEC2", "UVEC3", "UVEC4", + "VEC2", "VEC3", "VEC4", "CENTROID", "IN_TOK", "OUT_TOK", "INOUT_TOK", "UNIFORM", "VARYING", "NOPERSPECTIVE", "FLAT", "SMOOTH", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", "MAT4X4", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", @@ -852,7 +848,7 @@ static const char *const yytname[] = "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", - "USAMPLER2DARRAY", "STRUCT", "VOID", "WHILE", "IDENTIFIER", + "USAMPLER2DARRAY", "STRUCT", "VOID_TOK", "WHILE", "IDENTIFIER", "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", @@ -861,21 +857,21 @@ static const char *const yytname[] = "LOWP", "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION", "EXTENSION", "LINE", "PRAGMA", "COLON", "EOL", "INTERFACE", "OUTPUT", "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", "TYPEDEF", "TEMPLATE", - "THIS", "PACKED", "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", - "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", "LONG", "SHORT", "DOUBLE", - "HALF", "FIXED", "UNSIGNED", "INPUT", "OUPTUT", "HVEC2", "HVEC3", - "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", "FVEC4", - "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", "SIZEOF", - "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", "PARTITION", - "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", "IMAGE3D", - "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", - "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", - "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", - "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", - "UIMAGEBUFFER", "ROW_MAJOR", "'('", "')'", "'['", "']'", "'.'", "','", - "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", - "'^'", "'|'", "'?'", "':'", "'='", "';'", "'{'", "'}'", "$accept", - "translation_unit", "$@1", "version_statement", + "THIS", "PACKED_TOK", "GOTO", "INLINE_TOK", "NOINLINE", "VOLATILE", + "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", "LONG_TOK", "SHORT_TOK", + "DOUBLE_TOK", "HALF", "FIXED_TOK", "UNSIGNED", "INPUT_TOK", "OUPTUT", + "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", "DVEC4", "FVEC2", "FVEC3", + "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", "SAMPLER2DRECTSHADOW", + "SIZEOF", "CAST", "NAMESPACE", "USING", "ERROR_TOK", "COMMON", + "PARTITION", "ACTIVE", "SAMPLERBUFFER", "FILTER", "IMAGE1D", "IMAGE2D", + "IMAGE3D", "IMAGECUBE", "IMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE1D", + "IIMAGE2D", "IIMAGE3D", "IIMAGECUBE", "IIMAGE1DARRAY", "IIMAGE2DARRAY", + "UIMAGE1D", "UIMAGE2D", "UIMAGE3D", "UIMAGECUBE", "UIMAGE1DARRAY", + "UIMAGE2DARRAY", "IMAGE1DSHADOW", "IMAGE2DSHADOW", "IMAGEBUFFER", + "IIMAGEBUFFER", "UIMAGEBUFFER", "ROW_MAJOR", "'('", "')'", "'['", "']'", + "'.'", "','", "'+'", "'-'", "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", + "'>'", "'&'", "'^'", "'|'", "'?'", "':'", "'='", "';'", "'{'", "'}'", + "$accept", "translation_unit", "$@1", "version_statement", "extension_statement_list", "extension_statement", "external_declaration_list", "variable_identifier", "primary_expression", "postfix_expression", "integer_expression", "function_call", @@ -935,44 +931,44 @@ static const yytype_uint16 yytoknum[] = 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, 40, 41, 91, 93, 46, 44, 43, 45, 33, - 126, 42, 47, 37, 60, 62, 38, 94, 124, 63, - 58, 61, 59, 123, 125 + 435, 436, 437, 438, 439, 440, 441, 442, 40, 41, + 91, 93, 46, 44, 43, 45, 33, 126, 42, 47, + 37, 60, 62, 38, 94, 124, 63, 58, 61, 59, + 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 215, 217, 216, 218, 218, 219, 219, 220, 221, - 221, 222, 223, 223, 223, 223, 223, 223, 224, 224, - 224, 224, 224, 224, 225, 226, 227, 227, 228, 228, - 229, 229, 230, 230, 231, 232, 232, 232, 233, 233, - 233, 233, 234, 234, 234, 234, 235, 235, 235, 235, - 236, 236, 236, 237, 237, 237, 238, 238, 238, 238, - 238, 239, 239, 239, 240, 240, 241, 241, 242, 242, - 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 249, 249, 250, 251, 251, 251, 252, 253, 253, - 254, 254, 255, 256, 256, 257, 257, 257, 257, 258, - 258, 258, 258, 259, 260, 260, 260, 260, 260, 260, - 260, 261, 261, 261, 261, 261, 261, 261, 261, 262, - 262, 263, 263, 264, 265, 265, 266, 267, 267, 267, - 268, 269, 269, 269, 270, 270, 270, 270, 270, 270, - 270, 270, 270, 271, 271, 272, 272, 272, 273, 273, - 273, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - 274, 274, 274, 274, 274, 275, 275, 275, 276, 276, - 277, 277, 278, 279, 279, 280, 280, 281, 282, 283, - 283, 284, 284, 285, 286, 286, 286, 286, 286, 286, - 286, 287, 287, 288, 288, 289, 289, 290, 290, 291, - 291, 292, 293, 293, 293, 294, 294, 295, 296, 296, - 297, 297, 297, 298, 298, 299, 299, 300, 300, 301, - 301, 301, 301, 301, 302, 302, 303 + 0, 212, 214, 213, 215, 215, 216, 216, 217, 218, + 218, 219, 220, 220, 220, 220, 220, 220, 221, 221, + 221, 221, 221, 221, 222, 223, 224, 224, 225, 225, + 226, 226, 227, 227, 228, 229, 229, 229, 230, 230, + 230, 230, 231, 231, 231, 231, 232, 232, 232, 232, + 233, 233, 233, 234, 234, 234, 235, 235, 235, 235, + 235, 236, 236, 236, 237, 237, 238, 238, 239, 239, + 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, + 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, + 245, 246, 246, 247, 248, 248, 248, 249, 250, 250, + 251, 251, 252, 253, 253, 254, 254, 254, 254, 255, + 255, 255, 255, 256, 257, 257, 257, 257, 257, 257, + 257, 258, 258, 258, 258, 258, 258, 258, 258, 259, + 259, 260, 260, 261, 262, 262, 263, 264, 264, 264, + 265, 266, 266, 266, 267, 267, 267, 267, 267, 267, + 267, 267, 267, 268, 268, 269, 269, 269, 270, 270, + 270, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 272, 272, 272, 273, 273, 274, 274, 275, + 276, 276, 277, 277, 278, 279, 280, 280, 281, 281, + 282, 283, 283, 283, 283, 283, 283, 283, 284, 284, + 285, 285, 286, 286, 287, 287, 288, 288, 289, 290, + 290, 290, 291, 291, 292, 293, 293, 294, 294, 294, + 295, 295, 296, 296, 297, 297, 298, 298, 298, 298, + 298, 299, 299, 300 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -999,13 +995,13 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, - 1, 2, 3, 1, 3, 1, 4, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 1, 1, 2, 3, 1, 2, 1, - 2, 7, 5, 5, 7, 1, 4, 5, 3, 2, - 5, 7, 6, 1, 1, 1, 0, 2, 3, 2, - 2, 2, 3, 2, 1, 1, 2 + 1, 1, 1, 1, 1, 5, 4, 1, 2, 3, + 1, 3, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 3, 1, 2, 1, 2, 7, 5, + 5, 7, 1, 4, 5, 3, 2, 5, 7, 6, + 1, 1, 1, 0, 2, 3, 2, 2, 2, 3, + 2, 1, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1016,1061 +1012,1000 @@ static const yytype_uint16 yydefact[] = 4, 0, 0, 6, 0, 1, 2, 5, 0, 131, 7, 0, 145, 144, 165, 162, 163, 164, 169, 170, 171, 172, 173, 174, 175, 176, 177, 166, 167, 168, - 178, 179, 180, 0, 149, 152, 139, 138, 137, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 193, 194, 195, 196, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 0, 161, 160, 131, 217, 216, 215, 0, 0, - 192, 197, 131, 275, 0, 0, 99, 109, 0, 114, - 121, 0, 132, 131, 0, 141, 129, 153, 155, 158, - 0, 159, 9, 274, 0, 150, 151, 147, 0, 0, - 128, 131, 143, 0, 0, 10, 94, 131, 276, 97, - 109, 140, 110, 111, 112, 100, 0, 109, 0, 95, - 122, 148, 146, 142, 130, 0, 154, 0, 0, 0, - 0, 220, 0, 136, 0, 134, 0, 0, 131, 0, - 0, 0, 0, 0, 0, 0, 0, 11, 15, 13, - 14, 16, 37, 0, 0, 0, 42, 43, 44, 45, - 249, 131, 245, 12, 18, 38, 20, 25, 26, 0, - 0, 31, 0, 46, 0, 50, 53, 56, 61, 64, - 66, 68, 70, 72, 74, 76, 78, 91, 0, 228, - 0, 129, 234, 247, 229, 230, 232, 231, 131, 235, - 236, 233, 237, 238, 239, 240, 101, 106, 108, 113, - 0, 115, 102, 0, 0, 156, 46, 93, 0, 35, - 8, 0, 225, 0, 223, 219, 221, 96, 133, 0, - 270, 269, 0, 131, 0, 273, 271, 0, 0, 0, - 259, 131, 39, 40, 0, 241, 131, 22, 23, 0, - 0, 29, 28, 0, 161, 32, 34, 81, 82, 84, - 83, 86, 87, 88, 89, 90, 85, 80, 0, 41, + 0, 149, 152, 139, 138, 137, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, + 193, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 0, 161, + 160, 131, 214, 213, 212, 0, 0, 189, 194, 131, + 272, 0, 0, 99, 109, 0, 114, 121, 0, 132, + 131, 0, 141, 129, 153, 155, 158, 0, 159, 9, + 271, 0, 150, 151, 147, 0, 0, 128, 131, 143, + 0, 0, 10, 94, 131, 273, 97, 109, 140, 110, + 111, 112, 100, 0, 109, 0, 95, 122, 148, 146, + 142, 130, 0, 154, 0, 0, 0, 0, 217, 0, + 136, 0, 134, 0, 0, 131, 0, 0, 0, 0, + 0, 0, 0, 0, 11, 15, 13, 14, 16, 37, + 0, 0, 0, 42, 43, 44, 45, 246, 131, 242, + 12, 18, 38, 20, 25, 26, 0, 0, 31, 0, + 46, 0, 50, 53, 56, 61, 64, 66, 68, 70, + 72, 74, 76, 78, 91, 0, 225, 0, 129, 231, + 244, 226, 227, 229, 228, 131, 232, 233, 230, 234, + 235, 236, 237, 101, 106, 108, 113, 0, 115, 102, + 0, 0, 156, 46, 93, 0, 35, 8, 0, 222, + 0, 220, 216, 218, 96, 133, 0, 267, 266, 0, + 131, 0, 270, 268, 0, 0, 0, 256, 131, 39, + 40, 0, 238, 131, 22, 23, 0, 0, 29, 28, + 0, 161, 32, 34, 81, 82, 84, 83, 86, 87, + 88, 89, 90, 85, 80, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 250, 246, 248, 103, 105, 107, 0, 0, 123, - 0, 227, 127, 157, 218, 0, 0, 222, 135, 0, - 264, 263, 131, 0, 272, 0, 258, 255, 0, 0, - 17, 242, 0, 24, 21, 27, 33, 79, 47, 48, - 49, 51, 52, 54, 55, 59, 60, 57, 58, 62, - 63, 65, 67, 69, 71, 73, 75, 0, 92, 0, - 116, 0, 120, 0, 124, 0, 224, 0, 265, 0, - 0, 131, 0, 0, 131, 19, 0, 0, 0, 117, - 125, 0, 226, 0, 267, 131, 252, 253, 257, 0, - 0, 244, 260, 243, 77, 104, 118, 0, 126, 0, - 268, 262, 131, 256, 0, 119, 261, 251, 254, 0, - 131, 0, 131 + 0, 0, 0, 0, 0, 0, 0, 0, 247, 243, + 245, 103, 105, 107, 0, 0, 123, 0, 224, 127, + 157, 215, 0, 0, 219, 135, 0, 261, 260, 131, + 0, 269, 0, 255, 252, 0, 0, 17, 239, 0, + 24, 21, 27, 33, 79, 47, 48, 49, 51, 52, + 54, 55, 59, 60, 57, 58, 62, 63, 65, 67, + 69, 71, 73, 75, 0, 92, 0, 116, 0, 120, + 0, 124, 0, 221, 0, 262, 0, 0, 131, 0, + 0, 131, 19, 0, 0, 0, 117, 125, 0, 223, + 0, 264, 131, 249, 250, 254, 0, 0, 241, 257, + 240, 77, 104, 118, 0, 126, 0, 265, 259, 131, + 253, 0, 119, 258, 248, 251, 0, 131, 0, 131 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 2, 9, 3, 6, 10, 82, 173, 174, 175, - 332, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 278, 198, 228, 199, 200, 85, 86, - 87, 217, 125, 126, 218, 88, 89, 90, 91, 92, - 144, 145, 93, 127, 94, 95, 229, 97, 98, 99, - 100, 101, 140, 141, 233, 234, 312, 202, 203, 204, - 205, 206, 207, 392, 393, 208, 209, 210, 211, 329, - 212, 213, 214, 322, 369, 370, 215, 102, 103 + -1, 2, 9, 3, 6, 10, 79, 170, 171, 172, + 329, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 275, 195, 225, 196, 197, 82, 83, + 84, 214, 122, 123, 215, 85, 86, 87, 88, 89, + 141, 142, 90, 124, 91, 92, 226, 94, 95, 96, + 97, 98, 137, 138, 230, 231, 309, 199, 200, 201, + 202, 203, 204, 389, 390, 205, 206, 207, 208, 326, + 209, 210, 211, 319, 366, 367, 212, 99, 100 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -361 +#define YYPACT_NINF -345 static const yytype_int16 yypact[] = { - -51, -15, 81, -361, -34, -361, -24, -361, 25, 3891, - -361, -19, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -361, -361, 69, -361, -361, -361, -361, -361, -361, - -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -78, -361, -361, 8, -361, -361, -361, 49, -80, - -361, -361, 3773, -361, -177, -79, -55, 2, -168, -361, - 70, 56, -361, 28, 4120, -361, -361, -361, -39, -361, - 4233, -361, -361, -361, 80, -361, -361, -361, -67, 4120, - -361, 28, -361, 4233, 95, -361, -361, 401, -361, -361, - 18, -361, -361, -361, -361, -361, 4120, 176, 116, -361, - -113, -361, -361, -361, -361, 2868, -361, 86, 4120, 126, - 2263, -361, 9, -361, -89, -361, 17, 24, 1249, 46, - 47, 27, 2489, 52, 3411, 30, 53, -70, -361, -361, - -361, -361, -361, 3411, 3411, 3411, -361, -361, -361, -361, - -361, 613, -361, -361, -361, -69, -361, -361, -361, 54, - -76, 3592, 59, 67, 3411, 22, 0, 115, -82, 125, - 39, 44, 45, 159, 161, -90, -361, -361, -159, -361, - 48, 66, -361, -361, -361, -361, -361, -361, 825, -361, - -361, -361, -361, -361, -361, -361, -361, -361, -361, 179, - 4120, -170, -361, 3049, 3411, -361, -361, -361, 65, -361, - -361, 2376, 68, -122, -361, -361, -361, -361, -361, 95, - -361, -361, 184, 1869, 3411, -361, -361, -121, 3411, -162, - -361, 2687, -361, -361, -60, -361, 1037, -361, -361, 3411, - 4007, -361, -361, 3411, 71, -361, -361, -361, -361, -361, - -361, -361, -361, -361, -361, -361, -361, -361, 3411, -361, - 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, - 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, 3411, - 3411, -361, -361, -361, 72, -361, -361, 3230, 3411, 55, - 73, -361, -361, -361, -361, 3411, 126, -361, -361, 77, - -361, -361, 2067, -59, -361, -52, -361, 74, 185, 79, - -361, -361, 75, 74, 82, -361, -361, -361, -361, -361, - -361, 22, 22, 0, 0, 115, 115, 115, 115, -82, - -82, 125, 39, 44, 45, 159, 161, -128, -361, 3411, - 61, 83, -361, 3411, 63, 85, -361, 3411, -361, 64, - 88, 1249, 62, 76, 1460, -361, 3411, 87, 3411, 78, - -361, 3411, -361, -49, 3411, 1460, 270, -361, -361, 3411, - 92, -361, -361, -361, -361, -361, -361, 3411, -361, 84, - 74, -361, 1249, -361, 3411, -361, -361, -361, -361, -41, - 1671, 272, 1671 + -30, 29, 120, -345, 15, -345, 22, -345, 59, 3758, + -345, 25, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, + 79, -345, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, -345, -345, -345, -345, -345, -71, -345, + -345, 130, -345, -345, -345, -79, -42, -345, -345, 3642, + -345, -5, -38, -32, 4, -181, -345, 87, 62, -345, + 27, 3871, -345, -345, -345, -25, -345, 3943, -345, -345, + -345, 91, -345, -345, -345, -37, 3871, -345, 27, -345, + 3943, 95, -345, -345, 398, -345, -345, 19, -345, -345, + -345, -345, -345, 3871, 0, 119, -345, -128, -345, -345, + -345, -345, 2752, -345, 86, 3871, 131, 2153, -345, 11, + -345, -87, -345, 21, 23, 1234, 40, 50, 36, 2379, + 63, 3286, 43, 64, -73, -345, -345, -345, -345, -345, + 3286, 3286, 3286, -345, -345, -345, -345, -345, 607, -345, + -345, -345, -67, -345, -345, -345, 78, -62, 3464, 80, + -53, 3286, -1, 20, 140, -80, 136, 66, 67, 65, + 182, 181, -82, -345, -345, -173, -345, 103, 125, -345, + -345, -345, -345, -345, -345, 816, -345, -345, -345, -345, + -345, -345, -345, -345, -345, -345, 198, 3871, -140, -345, + 2930, 3286, -345, -345, -345, 84, -345, -345, 2266, 124, + -137, -345, -345, -345, -345, -345, 95, -345, -345, 240, + 1845, 3286, -345, -345, -118, 3286, -120, -345, 2574, -345, + -345, -48, -345, 1025, -345, -345, 3286, 235, -345, -345, + 3286, 128, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, -345, -345, 3286, -345, 3286, 3286, 3286, + 3286, 3286, 3286, 3286, 3286, 3286, 3286, 3286, 3286, 3286, + 3286, 3286, 3286, 3286, 3286, 3286, 3286, 3286, -345, -345, + -345, 129, -345, -345, 3108, 3286, 110, 132, -345, -345, + -345, -345, 3286, 131, -345, -345, 133, -345, -345, 2040, + -46, -345, -36, -345, 127, 246, 135, -345, -345, 134, + 127, 138, -345, -345, -345, -345, -345, -345, -1, -1, + 20, 20, 140, 140, 140, 140, -80, -80, 136, 66, + 67, 65, 182, 181, -117, -345, 3286, 121, 137, -345, + 3286, 122, 141, -345, 3286, -345, 118, 142, 1234, 123, + 126, 1442, -345, 3286, 144, 3286, 139, -345, 3286, -345, + -35, 3286, 1442, 324, -345, -345, 3286, 149, -345, -345, + -345, -345, -345, -345, 3286, -345, 143, 127, -345, 1234, + -345, 3286, -345, -345, -345, -345, -33, 1650, 326, 1650 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, - -361, -361, -361, 26, -361, -361, -361, -361, -105, -361, - -64, -54, -81, -65, -8, -6, -5, -4, -3, -7, - -361, -111, -148, -361, -149, -221, 6, 11, -361, -361, - -361, 89, 173, 168, 90, -361, -361, -238, -361, -361, - -361, 58, -361, -361, -47, -361, -9, -71, -361, -361, - 220, -361, 162, -130, -361, -17, -236, 60, -131, -350, - -345, -360, -68, -84, 218, 134, 91, -361, -361, -16, - -361, -361, -361, -361, -361, -361, -361, 225, -361 + -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, + -345, -345, -345, 85, -345, -345, -345, -345, -103, -345, + -54, -47, -74, -40, 53, 54, 52, 55, 56, 51, + -345, -110, -157, -345, -147, -219, 5, 7, -345, -345, + -345, 146, 232, 227, 147, -345, -345, -238, -345, -345, + -345, 117, -345, -345, -39, -345, -9, -14, -345, -345, + 279, -345, 220, -124, -345, 44, -286, 116, -134, -257, + -344, -294, -11, -22, 280, 197, 145, -345, -345, 47, + -345, -345, -345, -345, -345, -345, -345, 288, -345 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -267 +#define YYTABLE_NINF -264 static const yytype_int16 yytable[] = { - 96, 108, 310, 247, 298, 249, 121, 287, 288, -160, - 236, 12, 13, 328, 391, 83, 254, 242, 257, 258, - 84, 386, 121, 307, 227, 391, 387, 112, 128, 136, - 226, 12, 13, 265, 300, 116, 117, 300, 122, 123, - 124, 308, 142, 33, 129, 34, 133, 35, 326, 36, - 37, 38, 407, 301, 122, 123, 124, 408, 252, 253, - 411, 1, 407, 33, 112, 34, 4, 35, 300, 36, - 37, 38, 362, 96, 316, 300, 311, 303, 222, 279, - 223, 5, 376, 7, 328, 134, 361, 110, 83, 8, - 317, 324, 131, 84, 365, 323, 132, 104, 224, 325, - 139, 236, 327, 238, 11, 105, 106, 239, 201, 107, - 333, 114, 227, 119, 111, 336, 262, 219, 226, 299, - 263, -36, 289, 290, 259, 303, 260, 380, 79, 139, - 337, 139, 330, 371, 111, 109, 300, 300, 377, 201, - 372, 120, 396, 399, 300, 398, 138, 300, 79, 130, - 357, 410, 358, 403, 135, 300, 75, 76, 77, 137, - 311, 405, 201, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 327, 143, 338, 339, 340, 226, 226, - 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 226, 226, 226, 226, -98, 221, 227, 283, 284, 201, - 285, 286, 226, 230, 227, 232, 345, 346, 347, 348, - 226, 219, 122, 123, 124, 311, 291, 292, 383, 341, - 342, 237, 139, 280, 281, 282, 349, 350, 394, 240, - 311, 343, 344, 311, 201, 400, 241, 243, 244, 245, - 250, 311, 201, 248, 251, 293, 261, 201, 227, 311, - 266, 294, 296, 295, 226, 409, 297, -35, 304, 313, - 116, 315, 319, -30, 373, 359, 363, 364, 367, 375, - 300, 374, 378, -36, 381, 171, 384, 379, 277, 382, - 385, 395, 402, 404, 412, 351, 335, 389, 352, 397, - 353, 356, 354, 216, 355, 220, 406, 318, 113, 366, - 231, 401, 118, 320, 388, 256, 368, 115, 0, 305, - 306, 0, 0, 201, 0, 0, 0, 0, 0, 0, + 93, 307, 244, -160, 246, 105, 284, 285, 118, 295, + 325, 239, 125, 233, 80, 251, 81, 254, 255, 359, + 297, 262, 224, 118, 384, 72, 73, 74, 126, 223, + 12, 13, 109, 119, 120, 121, 298, 119, 120, 121, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 304, 130, 119, 120, 121, 405, 313, 249, 250, 30, + 219, 31, 220, 32, 308, 33, 34, 35, 305, 109, + 93, 300, 314, 297, 377, 297, 297, 388, 276, 1, + 221, 325, 131, 133, 80, 358, 81, 323, 388, 393, + 373, 321, 395, 362, 320, 128, 139, 136, 322, 129, + 400, 324, 235, 333, 233, 198, 236, 4, 402, 330, + 224, 383, 102, 103, 216, -36, 104, 223, 334, 300, + 5, 286, 287, 256, 296, 257, 136, 259, 136, 7, + 108, 260, 8, 12, 13, 11, 198, 374, 101, 106, + 355, 327, 404, 368, 76, 297, 111, 297, 308, 354, + 408, 116, 404, 369, 396, 274, 407, 297, 297, 198, + 297, 117, 30, 127, 31, 132, 32, 134, 33, 34, + 35, 140, 324, 135, 335, 336, 337, 223, 223, 223, + 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, + 223, 223, 223, -98, 224, 218, 198, 277, 278, 279, + 227, 223, 224, 308, 113, 114, 107, 229, 216, 223, + 342, 343, 344, 345, 280, 281, 391, 380, 308, 136, + 234, 308, 282, 283, 288, 289, 338, 339, 240, 308, + 237, 198, 238, 108, 397, 340, 341, 308, 241, 198, + 14, 15, 16, 17, 198, 242, 224, 76, 346, 347, + 247, 245, 248, 223, 406, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 258, 263, 290, + 292, 291, 293, 294, 301, 310, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 198, 331, 113, -35, 312, 316, 159, -30, 360, 356, + 297, 364, 370, 361, 371, 372, -36, 381, 376, 375, + 378, 382, 379, 168, 386, 392, 399, 401, 409, 72, + 73, 74, 332, 348, 350, 349, 353, 394, 351, 213, + 352, 217, 403, 315, 110, 228, 317, 363, 385, 198, + 398, 115, 198, 302, 303, 253, 365, 112, 0, 0, + 0, 0, 0, 198, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 318, 77, 0, 78, 0, + 198, 0, 0, 0, 0, 0, 0, 0, 198, 0, + 198, 12, 13, 14, 15, 16, 17, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 152, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 0, 31, 0, 32, 0, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 153, 154, 155, 156, 157, 158, 159, + 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, + 0, 71, 72, 73, 74, 0, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 201, 0, 0, 201, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 201, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 201, 0, 0, 0, 0, 0, 0, - 0, 201, 0, 201, 12, 13, 14, 15, 16, 17, - 146, 147, 148, 0, 149, 150, 151, 152, 153, 154, - 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, - 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 156, - 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, - 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, - 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 162, 0, 0, 0, + 0, 0, 163, 164, 165, 166, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 167, 168, 169, + 12, 13, 14, 15, 16, 17, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 152, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 0, 31, 0, 32, 0, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 153, 154, 155, 156, 157, 158, 159, 0, + 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 72, 73, 74, 0, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, + 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, - 168, 169, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 170, 171, 172, 12, 13, 14, 15, - 16, 17, 146, 147, 148, 0, 149, 150, 151, 152, - 153, 154, 155, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, - 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 156, 157, 158, 159, 160, 161, 162, 0, 0, - 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, - 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, - 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 162, 0, 0, 0, 0, + 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 167, 168, 252, 12, + 13, 14, 15, 16, 17, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 152, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, + 31, 0, 32, 0, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 153, 154, 155, 156, 157, 158, 159, 0, 0, + 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, + 72, 73, 74, 0, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 0, 0, 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 165, 0, 0, 0, 0, 0, - 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 170, 171, 255, 12, 13, - 14, 15, 16, 17, 146, 147, 148, 0, 149, 150, - 151, 152, 153, 154, 155, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 0, 34, 0, 35, 0, 36, 37, 38, 39, + 0, 0, 0, 0, 162, 0, 0, 0, 0, 0, + 163, 164, 165, 166, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 168, 299, 12, 13, + 14, 15, 16, 17, 143, 144, 145, 0, 146, 147, + 148, 149, 150, 151, 152, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 0, 31, + 0, 32, 0, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 156, 157, 158, 159, 160, 161, 162, - 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, + 153, 154, 155, 156, 157, 158, 159, 0, 0, 160, + 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, + 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 74, 75, 76, 77, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, - 0, 0, 166, 167, 168, 169, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 170, 171, 302, - 12, 13, 14, 15, 16, 17, 146, 147, 148, 0, - 149, 150, 151, 152, 153, 154, 155, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 156, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, + 0, 0, 0, 162, 0, 0, 0, 0, 0, 163, + 164, 165, 166, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 167, 168, 328, 12, 13, 14, + 15, 16, 17, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 152, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 0, 31, 0, + 32, 0, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 153, + 154, 155, 156, 157, 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 76, 77, 0, 78, 0, - 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 71, 72, 73, + 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, - 0, 0, 0, 0, 166, 167, 168, 169, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, - 171, 331, 12, 13, 14, 15, 16, 17, 146, 147, - 148, 0, 149, 150, 151, 152, 153, 154, 155, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 0, 34, 0, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 156, 157, 158, - 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, + 0, 0, 162, 0, 0, 0, 0, 0, 163, 164, + 165, 166, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 167, 168, 12, 13, 14, 15, 16, + 17, 143, 144, 145, 0, 146, 387, 148, 149, 150, + 151, 152, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 0, 31, 0, 32, 0, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 153, 154, 155, + 156, 157, 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 74, 75, 76, 77, 0, - 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, + 0, 0, 0, 0, 0, 71, 72, 73, 74, 0, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, + 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, + 162, 0, 0, 0, 0, 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 170, 171, 12, 13, 14, 15, 16, 17, 146, - 147, 148, 0, 149, 390, 151, 152, 153, 154, 155, + 0, 167, 114, 12, 13, 14, 15, 16, 17, 143, + 144, 145, 0, 146, 387, 148, 149, 150, 151, 152, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 0, 34, 0, 35, - 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 28, 29, 30, 0, 31, 0, 32, 0, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 156, 157, - 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 74, 75, 76, 77, - 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, - 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 65, 66, 67, 68, 69, 153, 154, 155, 156, 157, + 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, + 0, 0, 0, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 165, 0, 0, 0, 0, 0, 166, 167, 168, - 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 170, 117, 12, 13, 14, 15, 16, 17, - 146, 147, 148, 0, 149, 390, 151, 152, 153, 154, - 155, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 0, 34, 0, - 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 156, - 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, - 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, - 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, + 0, 0, 0, 0, 163, 164, 165, 166, 12, 13, + 14, 15, 16, 17, 0, 0, 0, 0, 0, 167, + 168, 0, 0, 0, 0, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 0, 31, + 0, 32, 0, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 154, 155, 156, 157, 158, 159, 0, 0, 160, + 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, + 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 165, 0, 0, 0, 0, 0, 166, 167, - 168, 169, 12, 13, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 170, 171, 0, 0, 0, 0, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 0, 34, 0, 35, 0, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, - 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 74, 75, 76, 77, 0, - 78, 0, 0, 0, 0, 0, 0, 0, 0, 79, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, - 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 170, 0, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 75, 76, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 162, 0, 0, 0, 0, 0, 163, + 164, 165, 166, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 167, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 0, 31, 0, 32, 0, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 154, 155, 156, 157, + 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 165, 0, - 0, 0, 0, 0, 166, 167, 168, 169, 14, 15, - 16, 17, 0, 0, 0, 0, 0, 0, 0, -266, + 0, 0, 0, 108, 72, 73, 74, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, + 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, + 0, 77, 0, 78, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, + 62, 63, 64, 65, 66, 67, 68, 69, 162, 70, + 0, 0, 0, 0, 163, 164, 165, 166, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -263, + 0, 0, 0, 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 0, 0, 0, 0, 0, 0, 80, 0, 81, + 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, + 0, 0, 0, 0, 77, 0, 78, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 0, 73, 0, 0, 0, 0, + 69, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 235, 0, 0, - 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, + 0, 0, 0, 0, 232, 0, 0, 0, 0, 0, + 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, - 80, 0, 81, 39, 40, 41, 42, 43, 44, 45, + 29, 0, 0, 0, 0, 0, 0, 77, 0, 78, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, - 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, + 66, 67, 68, 69, 0, 154, 155, 156, 157, 158, + 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 311, 0, 0, + 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 162, 0, 0, + 0, 0, 0, 163, 164, 165, 166, 12, 13, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 243, 0, + 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 0, 31, 0, + 32, 0, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, + 154, 155, 156, 157, 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 108, 72, 73, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 165, 0, 0, 0, 0, 0, 166, 167, 168, 169, - 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 246, 0, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 0, 34, 0, 35, 0, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 157, 158, 159, 160, - 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 75, 76, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 79, 0, 0, + 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, + 17, 0, 162, 0, 0, 0, 0, 0, 163, 164, + 165, 166, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 0, 154, 155, + 156, 157, 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 0, 165, 0, - 0, 0, 0, 0, 166, 167, 168, 169, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 0, 157, 158, 159, - 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 162, 0, 0, 222, 0, 0, 163, 164, 165, 166, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 154, 155, 156, 157, + 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 15, 16, 17, 0, 165, - 0, 0, 225, 0, 0, 166, 167, 168, 169, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 0, 157, 158, - 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 15, 16, 17, 0, 162, 0, + 0, 306, 0, 0, 163, 164, 165, 166, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 0, 154, 155, 156, 157, 158, 159, + 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, + 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 165, 0, 0, 309, 0, 0, 166, 167, 168, 169, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 0, 157, - 158, 159, 160, 161, 162, 0, 0, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 162, 0, 0, 357, + 0, 0, 163, 164, 165, 166, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 0, 154, 155, 156, 157, 158, 159, 0, 0, + 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, - 0, 165, 0, 0, 360, 0, 0, 166, 167, 168, - 169, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, - 157, 158, 159, 160, 161, 162, 0, 0, 163, 164, + 0, 0, 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, - 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, + 15, 16, 17, 0, 162, 0, 0, 0, 0, 0, + 163, 164, 165, 166, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 261, 0, + 154, 155, 156, 157, 158, 159, 0, 0, 160, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 165, 0, 0, 0, 0, 0, 166, 167, - 168, 169, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 264, - 0, 157, 158, 159, 160, 161, 162, 0, 0, 163, - 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, - 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -3, 0, 0, 12, 13, 14, 15, 16, + 17, 0, 162, 0, 0, 0, 0, 0, 163, 164, + 165, 166, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 0, 31, 0, 32, 0, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 71, 72, 73, 74, 0, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 76, + 0, 12, 13, 14, 15, 16, 17, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 0, 31, 77, 32, 78, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -3, 0, 0, 12, 13, 14, 15, - 16, 17, 0, 165, 0, 0, 0, 0, 0, 166, - 167, 168, 169, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, - 34, 0, 35, 0, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, - 75, 76, 77, 0, 78, 0, 0, 0, 0, 0, - 0, 0, 0, 79, 12, 13, 14, 15, 16, 17, + 0, 71, 72, 73, 74, 0, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 80, 34, 81, - 35, 0, 36, 37, 38, 39, 40, 41, 42, 43, + 27, 28, 29, 0, 0, 0, 0, 0, 0, 77, + 0, 78, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, - 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 75, 76, - 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, - 0, 79, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 0, 0, 0, 80, 0, 81, 0, 0, - 0, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 0, 334, 0, 0, 0, - 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, - 0, 80, 0, 81, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 0, 73, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 15, + 64, 65, 66, 67, 68, 69, 0, 70, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, - 0, 0, 0, 0, 80, 0, 81, 39, 40, 41, + 25, 26, 27, 28, 29, 72, 73, 74, 0, 0, + 0, 0, 0, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 0, 73, 0, 0, 0, 0, 0, 0, 0, + 62, 63, 64, 65, 66, 67, 68, 69, 0, 70, + 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 80, 0, 81 + 0, 0, 0, 0, 77, 0, 78 }; static const yytype_int16 yycheck[] = { - 9, 79, 223, 152, 94, 154, 4, 89, 90, 79, - 140, 3, 4, 251, 374, 9, 165, 148, 87, 88, - 9, 371, 4, 193, 135, 385, 371, 74, 196, 100, - 135, 3, 4, 181, 196, 212, 213, 196, 36, 37, - 38, 211, 113, 35, 212, 37, 93, 39, 210, 41, - 42, 43, 402, 212, 36, 37, 38, 402, 163, 164, - 410, 112, 412, 35, 111, 37, 81, 39, 196, 41, - 42, 43, 308, 82, 196, 196, 224, 208, 191, 184, - 193, 0, 210, 117, 322, 94, 307, 79, 82, 113, - 212, 212, 36, 82, 315, 244, 40, 116, 211, 248, - 109, 231, 251, 192, 79, 36, 37, 196, 117, 40, - 259, 191, 223, 192, 106, 263, 192, 126, 223, 209, - 196, 191, 204, 205, 193, 256, 195, 363, 120, 138, - 278, 140, 192, 192, 106, 213, 196, 196, 359, 148, - 192, 196, 378, 192, 196, 381, 213, 196, 120, 79, - 299, 192, 300, 389, 193, 196, 107, 108, 109, 79, - 308, 397, 171, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 322, 79, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 192, 79, 307, 197, 198, 208, - 85, 86, 307, 117, 315, 79, 287, 288, 289, 290, - 315, 220, 36, 37, 38, 363, 91, 92, 367, 283, - 284, 212, 231, 201, 202, 203, 291, 292, 376, 212, - 378, 285, 286, 381, 243, 384, 212, 191, 191, 212, - 210, 389, 251, 191, 191, 206, 192, 256, 359, 397, - 191, 207, 93, 208, 359, 404, 95, 191, 79, 194, - 212, 193, 78, 192, 79, 193, 211, 194, 191, 194, - 196, 192, 211, 191, 211, 213, 212, 194, 211, 194, - 192, 194, 12, 191, 12, 293, 260, 211, 294, 211, - 295, 298, 296, 120, 297, 127, 212, 239, 78, 316, - 138, 385, 84, 243, 372, 171, 322, 82, -1, 220, - 220, -1, -1, 322, -1, -1, -1, -1, -1, -1, + 9, 220, 149, 76, 151, 76, 86, 87, 4, 91, + 248, 145, 193, 137, 9, 162, 9, 84, 85, 305, + 193, 178, 132, 4, 368, 104, 105, 106, 209, 132, + 3, 4, 71, 33, 34, 35, 209, 33, 34, 35, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 190, 90, 33, 34, 35, 399, 193, 160, 161, 32, + 188, 34, 190, 36, 221, 38, 39, 40, 208, 108, + 79, 205, 209, 193, 360, 193, 193, 371, 181, 109, + 208, 319, 91, 97, 79, 304, 79, 207, 382, 375, + 207, 209, 378, 312, 241, 33, 110, 106, 245, 37, + 386, 248, 189, 260, 228, 114, 193, 78, 394, 256, + 220, 368, 33, 34, 123, 188, 37, 220, 275, 253, + 0, 201, 202, 190, 206, 192, 135, 189, 137, 114, + 103, 193, 110, 3, 4, 76, 145, 356, 113, 210, + 297, 189, 399, 189, 117, 193, 188, 193, 305, 296, + 407, 189, 409, 189, 189, 208, 189, 193, 193, 168, + 193, 193, 32, 76, 34, 190, 36, 76, 38, 39, + 40, 76, 319, 210, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 189, 304, 76, 205, 198, 199, 200, + 114, 304, 312, 360, 209, 210, 76, 76, 217, 312, + 284, 285, 286, 287, 194, 195, 373, 364, 375, 228, + 209, 378, 82, 83, 88, 89, 280, 281, 188, 386, + 209, 240, 209, 103, 381, 282, 283, 394, 188, 248, + 5, 6, 7, 8, 253, 209, 356, 117, 288, 289, + 207, 188, 188, 356, 401, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 189, 188, 203, + 205, 204, 90, 92, 76, 191, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 319, 76, 209, 188, 190, 75, 81, 189, 208, 190, + 193, 188, 76, 191, 189, 191, 188, 209, 191, 208, + 208, 189, 191, 210, 208, 191, 12, 188, 12, 104, + 105, 106, 257, 290, 292, 291, 295, 208, 293, 117, + 294, 124, 209, 236, 75, 135, 240, 313, 369, 368, + 382, 81, 371, 217, 217, 168, 319, 79, -1, -1, + -1, -1, -1, 382, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 240, 151, -1, 153, -1, + 399, -1, -1, -1, -1, -1, -1, -1, 407, -1, + 409, 3, 4, 5, 6, 7, 8, 9, 10, 11, + -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, -1, 34, -1, 36, -1, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, + -1, 103, 104, 105, 106, -1, 108, -1, -1, -1, + -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 371, -1, -1, 374, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 385, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, + -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 402, -1, -1, -1, -1, -1, -1, - -1, 410, -1, 412, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, - -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 188, -1, -1, -1, + -1, -1, 194, 195, 196, 197, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 209, 210, 211, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + -1, 34, -1, 36, -1, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, -1, + -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 103, 104, 105, 106, -1, 108, -1, -1, -1, -1, + -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, + 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 191, -1, -1, -1, -1, -1, 197, 198, - 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 212, 213, 214, 3, 4, 5, 6, - 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, -1, -1, - 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, - 107, 108, 109, -1, 111, -1, -1, -1, -1, -1, - -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 188, -1, -1, -1, -1, + -1, 194, 195, 196, 197, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 209, 210, 211, 3, + 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + 34, -1, 36, -1, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, -1, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, + 104, 105, 106, -1, 108, -1, -1, -1, -1, -1, + -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 154, -1, 156, + -1, -1, -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, - 197, 198, 199, 200, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 212, 213, 214, 3, 4, + -1, -1, -1, -1, 188, -1, -1, -1, -1, -1, + 194, 195, 196, 197, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 209, 210, 211, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, -1, 37, -1, 39, -1, 41, 42, 43, 44, + 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, + -1, 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, + 75, 76, 77, 78, 79, 80, 81, -1, -1, 84, + 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, + 105, 106, -1, 108, -1, -1, -1, -1, -1, -1, + -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 106, 107, 108, 109, -1, 111, -1, -1, -1, - -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, - -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, - -1, -1, 197, 198, 199, 200, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 212, 213, 214, - 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, + -1, -1, -1, 188, -1, -1, -1, -1, -1, 194, + 195, 196, 197, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 209, 210, 211, 3, 4, 5, + 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, + 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, -1, 111, -1, - -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, -1, 108, -1, -1, -1, -1, -1, -1, -1, + -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, - -1, -1, -1, -1, 197, 198, 199, 200, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 212, - 213, 214, 3, 4, 5, 6, 7, 8, 9, 10, - 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + -1, -1, 188, -1, -1, -1, -1, -1, 194, 195, + 196, 197, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 209, 210, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, -1, 36, -1, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, - 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, + -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, + 108, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, + 188, -1, -1, -1, -1, -1, 194, 195, 196, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 212, 213, 3, 4, 5, 6, 7, 8, 9, + -1, 209, 210, 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, -1, 37, -1, 39, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 30, 31, 32, -1, 34, -1, 36, -1, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 106, 107, 108, 109, - -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, - 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, + 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 103, 104, 105, 106, -1, 108, -1, + -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 191, -1, -1, -1, -1, -1, 197, 198, 199, - 200, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 212, 213, 3, 4, 5, 6, 7, 8, - 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, 37, -1, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, - -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 191, -1, -1, -1, -1, -1, 197, 198, - 199, 200, 3, 4, 5, 6, 7, 8, -1, -1, - -1, -1, -1, 212, 213, -1, -1, -1, -1, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -1, 37, -1, 39, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, - 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 106, 107, 108, 109, -1, - 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, + -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 188, -1, + -1, -1, -1, -1, 194, 195, 196, 197, 3, 4, + 5, 6, 7, 8, -1, -1, -1, -1, -1, 209, + 210, -1, -1, -1, -1, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, + -1, 36, -1, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, 81, -1, -1, 84, + 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, + 105, 106, -1, 108, -1, -1, -1, -1, -1, -1, + -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, - 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, - -1, 212, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 188, -1, -1, -1, -1, -1, 194, + 195, 196, 197, 3, 4, 5, 6, 7, 8, -1, + -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, 34, -1, 36, -1, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, + 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, - -1, -1, -1, -1, 197, 198, 199, 200, 5, 6, - 7, 8, -1, -1, -1, -1, -1, -1, -1, 212, + -1, -1, -1, 103, 104, 105, 106, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 117, 5, 6, + 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, + 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, + -1, 151, -1, 153, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 67, 68, 69, 70, 71, 72, 73, 74, 188, 76, + -1, -1, -1, -1, 194, 195, 196, 197, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 209, + -1, -1, -1, -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, -1, -1, -1, -1, -1, -1, 154, -1, 156, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, + -1, -1, -1, -1, 151, -1, 153, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, -1, 79, -1, -1, -1, -1, + 74, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 214, -1, -1, - -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, + -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, + 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, - 154, -1, 156, 44, 45, 46, 47, 48, 49, 50, + 31, -1, -1, -1, -1, -1, -1, 151, -1, 153, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, - 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, + 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, + -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 214, -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 188, -1, -1, + -1, -1, -1, 194, 195, 196, 197, 3, 4, 5, + 6, 7, 8, -1, -1, -1, -1, -1, 209, -1, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, + 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, - 3, 4, 5, 6, 7, 8, -1, -1, -1, -1, - -1, 212, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, -1, 37, -1, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, 80, 81, 82, - 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 106, 107, 108, 109, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, + -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, + 8, -1, 188, -1, -1, -1, -1, -1, 194, 195, + 196, 197, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, + 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 7, 8, -1, 191, -1, - -1, -1, -1, -1, 197, 198, 199, 200, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, -1, 79, 80, 81, - 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, + -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + 188, -1, -1, 191, -1, -1, 194, 195, 196, 197, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, + 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 5, 6, 7, 8, -1, 191, - -1, -1, 194, -1, -1, 197, 198, 199, 200, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, -1, 79, 80, - 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, + -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 7, 8, -1, 188, -1, + -1, 191, -1, -1, 194, 195, 196, 197, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, -1, 76, 77, 78, 79, 80, 81, + -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, - 191, -1, -1, 194, -1, -1, 197, 198, 199, 200, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, - 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, + -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, 188, -1, -1, 191, + -1, -1, 194, 195, 196, 197, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 5, 6, 7, 8, - -1, 191, -1, -1, 194, -1, -1, 197, 198, 199, - 200, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, - 79, 80, 81, 82, 83, 84, -1, -1, 87, 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, - 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 7, 8, -1, 188, -1, -1, -1, -1, -1, + 194, 195, 196, 197, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 104, 105, + 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 7, - 8, -1, 191, -1, -1, -1, -1, -1, 197, 198, - 199, 200, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 0, -1, -1, 3, 4, 5, 6, 7, + 8, -1, 188, -1, -1, -1, -1, -1, 194, 195, + 196, 197, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, -1, 36, -1, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - -1, 79, 80, 81, 82, 83, 84, -1, -1, 87, - 88, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, - 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 68, 69, 70, 71, 72, 73, 74, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, + 108, -1, -1, -1, -1, -1, -1, -1, -1, 117, + -1, 3, 4, 5, 6, 7, 8, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, -1, 34, 151, 36, 153, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 0, -1, -1, 3, 4, 5, 6, - 7, 8, -1, 191, -1, -1, -1, -1, -1, 197, - 198, 199, 200, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, - 37, -1, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, - 107, 108, 109, -1, 111, -1, -1, -1, -1, -1, - -1, -1, -1, 120, 3, 4, 5, 6, 7, 8, + -1, 103, 104, 105, 106, -1, 108, -1, -1, -1, + -1, -1, -1, -1, -1, 117, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 154, 37, 156, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 29, 30, 31, -1, -1, -1, -1, -1, -1, 151, + -1, 153, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, - 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, 107, 108, - 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, - -1, 120, 5, 6, 7, 8, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, 154, -1, 156, -1, -1, - -1, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, 79, -1, -1, -1, - -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 107, 108, 109, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - -1, 154, -1, 156, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, -1, 79, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 107, 108, 109, - -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 69, 70, 71, 72, 73, 74, -1, 76, 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, 154, -1, 156, 44, 45, 46, + 27, 28, 29, 30, 31, 104, 105, 106, -1, -1, + -1, -1, -1, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, -1, 79, -1, -1, -1, -1, -1, -1, -1, + 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, + -1, -1, 151, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 154, -1, 156 + -1, -1, -1, -1, 151, -1, 153 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { - 0, 112, 216, 218, 81, 0, 219, 117, 113, 217, - 220, 79, 3, 4, 5, 6, 7, 8, 20, 21, + 0, 109, 213, 215, 78, 0, 216, 114, 110, 214, + 217, 76, 3, 4, 5, 6, 7, 8, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 37, 39, 41, 42, 43, 44, + 32, 34, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 79, 106, 107, 108, 109, 111, 120, - 154, 156, 221, 251, 252, 253, 254, 255, 260, 261, - 262, 263, 264, 267, 269, 270, 271, 272, 273, 274, - 275, 276, 302, 303, 116, 36, 37, 40, 79, 213, - 79, 106, 269, 275, 191, 302, 212, 213, 289, 192, - 196, 4, 36, 37, 38, 257, 258, 268, 196, 212, - 79, 36, 40, 269, 271, 193, 272, 79, 213, 271, - 277, 278, 272, 79, 265, 266, 9, 10, 11, 13, - 14, 15, 16, 17, 18, 19, 78, 79, 80, 81, - 82, 83, 84, 87, 88, 191, 197, 198, 199, 200, - 212, 213, 214, 222, 223, 224, 226, 227, 228, 229, + 76, 103, 104, 105, 106, 108, 117, 151, 153, 218, + 248, 249, 250, 251, 252, 257, 258, 259, 260, 261, + 264, 266, 267, 268, 269, 270, 271, 272, 273, 299, + 300, 113, 33, 34, 37, 76, 210, 76, 103, 266, + 272, 188, 299, 209, 210, 286, 189, 193, 4, 33, + 34, 35, 254, 255, 265, 193, 209, 76, 33, 37, + 266, 268, 190, 269, 76, 210, 268, 274, 275, 269, + 76, 262, 263, 9, 10, 11, 13, 14, 15, 16, + 17, 18, 19, 75, 76, 77, 78, 79, 80, 81, + 84, 85, 188, 194, 195, 196, 197, 209, 210, 211, + 219, 220, 221, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 249, 251, - 252, 271, 282, 283, 284, 285, 286, 287, 290, 291, - 292, 293, 295, 296, 297, 301, 257, 256, 259, 271, - 258, 79, 191, 193, 211, 194, 233, 246, 250, 271, - 117, 277, 79, 279, 280, 214, 278, 212, 192, 196, - 212, 212, 283, 191, 191, 212, 212, 249, 191, 249, - 210, 191, 233, 233, 249, 214, 290, 87, 88, 193, - 195, 192, 192, 196, 77, 247, 191, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 211, 248, 233, - 201, 202, 203, 197, 198, 85, 86, 89, 90, 204, - 205, 91, 92, 206, 207, 208, 93, 95, 94, 209, - 196, 212, 214, 283, 79, 256, 259, 193, 211, 194, - 250, 247, 281, 194, 214, 193, 196, 212, 266, 78, - 282, 291, 298, 249, 212, 249, 210, 249, 262, 294, - 192, 214, 225, 249, 79, 228, 247, 247, 233, 233, - 233, 235, 235, 236, 236, 237, 237, 237, 237, 238, - 238, 239, 240, 241, 242, 243, 244, 249, 247, 193, - 194, 250, 281, 211, 194, 250, 280, 191, 294, 299, - 300, 192, 192, 79, 192, 194, 210, 250, 211, 194, - 281, 211, 194, 249, 212, 192, 284, 285, 287, 211, - 14, 286, 288, 289, 247, 194, 281, 211, 281, 192, - 249, 288, 12, 281, 191, 281, 212, 284, 285, 249, - 192, 284, 12 + 240, 241, 242, 243, 244, 246, 248, 249, 268, 279, + 280, 281, 282, 283, 284, 287, 288, 289, 290, 292, + 293, 294, 298, 254, 253, 256, 268, 255, 76, 188, + 190, 208, 191, 230, 243, 247, 268, 114, 274, 76, + 276, 277, 211, 275, 209, 189, 193, 209, 209, 280, + 188, 188, 209, 209, 246, 188, 246, 207, 188, 230, + 230, 246, 211, 287, 84, 85, 190, 192, 189, 189, + 193, 74, 244, 188, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 208, 245, 230, 198, 199, 200, + 194, 195, 82, 83, 86, 87, 201, 202, 88, 89, + 203, 204, 205, 90, 92, 91, 206, 193, 209, 211, + 280, 76, 253, 256, 190, 208, 191, 247, 244, 278, + 191, 211, 190, 193, 209, 263, 75, 279, 288, 295, + 246, 209, 246, 207, 246, 259, 291, 189, 211, 222, + 246, 76, 225, 244, 244, 230, 230, 230, 232, 232, + 233, 233, 234, 234, 234, 234, 235, 235, 236, 237, + 238, 239, 240, 241, 246, 244, 190, 191, 247, 278, + 208, 191, 247, 277, 188, 291, 296, 297, 189, 189, + 76, 189, 191, 207, 247, 208, 191, 278, 208, 191, + 246, 209, 189, 281, 282, 284, 208, 14, 283, 285, + 286, 244, 191, 278, 208, 278, 189, 246, 285, 12, + 278, 188, 278, 209, 281, 282, 246, 189, 281, 12 }; #define yyerrok (yyerrstatus = 0) @@ -2752,7 +2687,7 @@ YYLTYPE yylloc; } /* Line 1242 of yacc.c */ -#line 2756 "glsl_parser.cpp" +#line 2691 "glsl_parser.cpp" yylsp[0] = yylloc; goto yysetstate; @@ -4369,258 +4304,237 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1105 "glsl_parser.ypp" - { (yyval.n) = ast_mat3; ;} + { (yyval.n) = ast_mat2x3; ;} break; case 180: /* Line 1455 of yacc.c */ #line 1106 "glsl_parser.ypp" - { (yyval.n) = ast_mat4; ;} + { (yyval.n) = ast_mat2x4; ;} break; case 181: /* Line 1455 of yacc.c */ #line 1107 "glsl_parser.ypp" - { (yyval.n) = ast_mat2; ;} + { (yyval.n) = ast_mat3x2; ;} break; case 182: /* Line 1455 of yacc.c */ #line 1108 "glsl_parser.ypp" - { (yyval.n) = ast_mat2x3; ;} + { (yyval.n) = ast_mat3; ;} break; case 183: /* Line 1455 of yacc.c */ #line 1109 "glsl_parser.ypp" - { (yyval.n) = ast_mat2x4; ;} + { (yyval.n) = ast_mat3x4; ;} break; case 184: /* Line 1455 of yacc.c */ #line 1110 "glsl_parser.ypp" - { (yyval.n) = ast_mat3x2; ;} + { (yyval.n) = ast_mat4x2; ;} break; case 185: /* Line 1455 of yacc.c */ #line 1111 "glsl_parser.ypp" - { (yyval.n) = ast_mat3; ;} + { (yyval.n) = ast_mat4x3; ;} break; case 186: /* Line 1455 of yacc.c */ #line 1112 "glsl_parser.ypp" - { (yyval.n) = ast_mat3x4; ;} + { (yyval.n) = ast_mat4; ;} break; case 187: /* Line 1455 of yacc.c */ #line 1113 "glsl_parser.ypp" - { (yyval.n) = ast_mat4x2; ;} + { (yyval.n) = ast_sampler1d; ;} break; case 188: /* Line 1455 of yacc.c */ #line 1114 "glsl_parser.ypp" - { (yyval.n) = ast_mat4x3; ;} + { (yyval.n) = ast_sampler2d; ;} break; case 189: /* Line 1455 of yacc.c */ #line 1115 "glsl_parser.ypp" - { (yyval.n) = ast_mat4; ;} + { (yyval.n) = ast_sampler2drect; ;} break; case 190: /* Line 1455 of yacc.c */ #line 1116 "glsl_parser.ypp" - { (yyval.n) = ast_sampler1d; ;} + { (yyval.n) = ast_sampler3d; ;} break; case 191: /* Line 1455 of yacc.c */ #line 1117 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2d; ;} + { (yyval.n) = ast_samplercube; ;} break; case 192: /* Line 1455 of yacc.c */ #line 1118 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2drect; ;} + { (yyval.n) = ast_sampler1dshadow; ;} break; case 193: /* Line 1455 of yacc.c */ #line 1119 "glsl_parser.ypp" - { (yyval.n) = ast_sampler3d; ;} + { (yyval.n) = ast_sampler2dshadow; ;} break; case 194: /* Line 1455 of yacc.c */ #line 1120 "glsl_parser.ypp" - { (yyval.n) = ast_samplercube; ;} + { (yyval.n) = ast_sampler2drectshadow; ;} break; case 195: /* Line 1455 of yacc.c */ #line 1121 "glsl_parser.ypp" - { (yyval.n) = ast_sampler1dshadow; ;} + { (yyval.n) = ast_samplercubeshadow; ;} break; case 196: /* Line 1455 of yacc.c */ #line 1122 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2dshadow; ;} + { (yyval.n) = ast_sampler1darray; ;} break; case 197: /* Line 1455 of yacc.c */ #line 1123 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2drectshadow; ;} + { (yyval.n) = ast_sampler2darray; ;} break; case 198: /* Line 1455 of yacc.c */ #line 1124 "glsl_parser.ypp" - { (yyval.n) = ast_samplercubeshadow; ;} + { (yyval.n) = ast_sampler1darrayshadow; ;} break; case 199: /* Line 1455 of yacc.c */ #line 1125 "glsl_parser.ypp" - { (yyval.n) = ast_sampler1darray; ;} + { (yyval.n) = ast_sampler2darrayshadow; ;} break; case 200: /* Line 1455 of yacc.c */ #line 1126 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2darray; ;} + { (yyval.n) = ast_isampler1d; ;} break; case 201: /* Line 1455 of yacc.c */ #line 1127 "glsl_parser.ypp" - { (yyval.n) = ast_sampler1darrayshadow; ;} + { (yyval.n) = ast_isampler2d; ;} break; case 202: /* Line 1455 of yacc.c */ #line 1128 "glsl_parser.ypp" - { (yyval.n) = ast_sampler2darrayshadow; ;} + { (yyval.n) = ast_isampler3d; ;} break; case 203: /* Line 1455 of yacc.c */ #line 1129 "glsl_parser.ypp" - { (yyval.n) = ast_isampler1d; ;} + { (yyval.n) = ast_isamplercube; ;} break; case 204: /* Line 1455 of yacc.c */ #line 1130 "glsl_parser.ypp" - { (yyval.n) = ast_isampler2d; ;} + { (yyval.n) = ast_isampler1darray; ;} break; case 205: /* Line 1455 of yacc.c */ #line 1131 "glsl_parser.ypp" - { (yyval.n) = ast_isampler3d; ;} + { (yyval.n) = ast_isampler2darray; ;} break; case 206: /* Line 1455 of yacc.c */ #line 1132 "glsl_parser.ypp" - { (yyval.n) = ast_isamplercube; ;} + { (yyval.n) = ast_usampler1d; ;} break; case 207: /* Line 1455 of yacc.c */ #line 1133 "glsl_parser.ypp" - { (yyval.n) = ast_isampler1darray; ;} + { (yyval.n) = ast_usampler2d; ;} break; case 208: /* Line 1455 of yacc.c */ #line 1134 "glsl_parser.ypp" - { (yyval.n) = ast_isampler2darray; ;} + { (yyval.n) = ast_usampler3d; ;} break; case 209: /* Line 1455 of yacc.c */ #line 1135 "glsl_parser.ypp" - { (yyval.n) = ast_usampler1d; ;} + { (yyval.n) = ast_usamplercube; ;} break; case 210: /* Line 1455 of yacc.c */ #line 1136 "glsl_parser.ypp" - { (yyval.n) = ast_usampler2d; ;} + { (yyval.n) = ast_usampler1darray; ;} break; case 211: /* Line 1455 of yacc.c */ #line 1137 "glsl_parser.ypp" - { (yyval.n) = ast_usampler3d; ;} - break; - - case 212: - -/* Line 1455 of yacc.c */ -#line 1138 "glsl_parser.ypp" - { (yyval.n) = ast_usamplercube; ;} - break; - - case 213: - -/* Line 1455 of yacc.c */ -#line 1139 "glsl_parser.ypp" - { (yyval.n) = ast_usampler1darray; ;} - break; - - case 214: - -/* Line 1455 of yacc.c */ -#line 1140 "glsl_parser.ypp" { (yyval.n) = ast_usampler2darray; ;} break; - case 215: + case 212: /* Line 1455 of yacc.c */ -#line 1144 "glsl_parser.ypp" +#line 1141 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4634,10 +4548,10 @@ yyreduce: ;} break; - case 216: + case 213: /* Line 1455 of yacc.c */ -#line 1155 "glsl_parser.ypp" +#line 1152 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4651,10 +4565,10 @@ yyreduce: ;} break; - case 217: + case 214: /* Line 1455 of yacc.c */ -#line 1166 "glsl_parser.ypp" +#line 1163 "glsl_parser.ypp" { if (state->language_version < 130) _mesa_glsl_error(& (yylsp[(1) - (1)]), state, @@ -4668,10 +4582,10 @@ yyreduce: ;} break; - case 218: + case 215: /* Line 1455 of yacc.c */ -#line 1181 "glsl_parser.ypp" +#line 1178 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); @@ -4679,10 +4593,10 @@ yyreduce: ;} break; - case 219: + case 216: /* Line 1455 of yacc.c */ -#line 1187 "glsl_parser.ypp" +#line 1184 "glsl_parser.ypp" { void *ctx = state; (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); @@ -4690,30 +4604,30 @@ yyreduce: ;} break; - case 220: + case 217: /* Line 1455 of yacc.c */ -#line 1196 "glsl_parser.ypp" +#line 1193 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); ;} break; - case 221: + case 218: /* Line 1455 of yacc.c */ -#line 1201 "glsl_parser.ypp" +#line 1198 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); ;} break; - case 222: + case 219: /* Line 1455 of yacc.c */ -#line 1209 "glsl_parser.ypp" +#line 1206 "glsl_parser.ypp" { void *ctx = state; ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); @@ -4727,30 +4641,30 @@ yyreduce: ;} break; - case 223: + case 220: /* Line 1455 of yacc.c */ -#line 1224 "glsl_parser.ypp" +#line 1221 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (1)].declaration); (yyvsp[(1) - (1)].declaration)->link.self_link(); ;} break; - case 224: + case 221: /* Line 1455 of yacc.c */ -#line 1229 "glsl_parser.ypp" +#line 1226 "glsl_parser.ypp" { (yyval.declaration) = (yyvsp[(1) - (3)].declaration); (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); ;} break; - case 225: + case 222: /* Line 1455 of yacc.c */ -#line 1237 "glsl_parser.ypp" +#line 1234 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); @@ -4758,10 +4672,10 @@ yyreduce: ;} break; - case 226: + case 223: /* Line 1455 of yacc.c */ -#line 1243 "glsl_parser.ypp" +#line 1240 "glsl_parser.ypp" { void *ctx = state; (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); @@ -4769,31 +4683,31 @@ yyreduce: ;} break; - case 231: + case 228: /* Line 1455 of yacc.c */ -#line 1266 "glsl_parser.ypp" +#line 1263 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 237: + case 234: /* Line 1455 of yacc.c */ -#line 1278 "glsl_parser.ypp" +#line 1275 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 238: + case 235: /* Line 1455 of yacc.c */ -#line 1279 "glsl_parser.ypp" +#line 1276 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 241: + case 238: /* Line 1455 of yacc.c */ -#line 1286 "glsl_parser.ypp" +#line 1283 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); @@ -4801,10 +4715,10 @@ yyreduce: ;} break; - case 242: + case 239: /* Line 1455 of yacc.c */ -#line 1292 "glsl_parser.ypp" +#line 1289 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); @@ -4812,17 +4726,17 @@ yyreduce: ;} break; - case 243: + case 240: /* Line 1455 of yacc.c */ -#line 1300 "glsl_parser.ypp" +#line 1297 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; - case 245: + case 242: /* Line 1455 of yacc.c */ -#line 1306 "glsl_parser.ypp" +#line 1303 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); @@ -4830,10 +4744,10 @@ yyreduce: ;} break; - case 246: + case 243: /* Line 1455 of yacc.c */ -#line 1312 "glsl_parser.ypp" +#line 1309 "glsl_parser.ypp" { void *ctx = state; (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); @@ -4841,10 +4755,10 @@ yyreduce: ;} break; - case 247: + case 244: /* Line 1455 of yacc.c */ -#line 1321 "glsl_parser.ypp" +#line 1318 "glsl_parser.ypp" { if ((yyvsp[(1) - (1)].node) == NULL) { _mesa_glsl_error(& (yylsp[(1) - (1)]), state, " statement\n"); @@ -4856,10 +4770,10 @@ yyreduce: ;} break; - case 248: + case 245: /* Line 1455 of yacc.c */ -#line 1331 "glsl_parser.ypp" +#line 1328 "glsl_parser.ypp" { if ((yyvsp[(2) - (2)].node) == NULL) { _mesa_glsl_error(& (yylsp[(2) - (2)]), state, " statement\n"); @@ -4870,10 +4784,10 @@ yyreduce: ;} break; - case 249: + case 246: /* Line 1455 of yacc.c */ -#line 1343 "glsl_parser.ypp" +#line 1340 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement(NULL); @@ -4881,10 +4795,10 @@ yyreduce: ;} break; - case 250: + case 247: /* Line 1455 of yacc.c */ -#line 1349 "glsl_parser.ypp" +#line 1346 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); @@ -4892,10 +4806,10 @@ yyreduce: ;} break; - case 251: + case 248: /* Line 1455 of yacc.c */ -#line 1358 "glsl_parser.ypp" +#line 1355 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4903,10 +4817,10 @@ yyreduce: ;} break; - case 252: + case 249: /* Line 1455 of yacc.c */ -#line 1367 "glsl_parser.ypp" +#line 1364 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4914,10 +4828,10 @@ yyreduce: ;} break; - case 253: + case 250: /* Line 1455 of yacc.c */ -#line 1373 "glsl_parser.ypp" +#line 1370 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL); @@ -4925,10 +4839,10 @@ yyreduce: ;} break; - case 254: + case 251: /* Line 1455 of yacc.c */ -#line 1379 "glsl_parser.ypp" +#line 1376 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)); @@ -4936,19 +4850,19 @@ yyreduce: ;} break; - case 255: + case 252: /* Line 1455 of yacc.c */ -#line 1388 "glsl_parser.ypp" +#line 1385 "glsl_parser.ypp" { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); ;} break; - case 256: + case 253: /* Line 1455 of yacc.c */ -#line 1392 "glsl_parser.ypp" +#line 1389 "glsl_parser.ypp" { void *ctx = state; ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); @@ -4961,10 +4875,10 @@ yyreduce: ;} break; - case 260: + case 257: /* Line 1455 of yacc.c */ -#line 1415 "glsl_parser.ypp" +#line 1412 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, @@ -4973,10 +4887,10 @@ yyreduce: ;} break; - case 261: + case 258: /* Line 1455 of yacc.c */ -#line 1422 "glsl_parser.ypp" +#line 1419 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, @@ -4985,10 +4899,10 @@ yyreduce: ;} break; - case 262: + case 259: /* Line 1455 of yacc.c */ -#line 1429 "glsl_parser.ypp" +#line 1426 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, @@ -4997,39 +4911,39 @@ yyreduce: ;} break; - case 266: + case 263: /* Line 1455 of yacc.c */ -#line 1445 "glsl_parser.ypp" +#line 1442 "glsl_parser.ypp" { (yyval.node) = NULL; ;} break; - case 267: + case 264: /* Line 1455 of yacc.c */ -#line 1452 "glsl_parser.ypp" +#line 1449 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); (yyval.for_rest_statement).rest = NULL; ;} break; - case 268: + case 265: /* Line 1455 of yacc.c */ -#line 1457 "glsl_parser.ypp" +#line 1454 "glsl_parser.ypp" { (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); ;} break; - case 269: + case 266: /* Line 1455 of yacc.c */ -#line 1466 "glsl_parser.ypp" +#line 1463 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); @@ -5037,10 +4951,10 @@ yyreduce: ;} break; - case 270: + case 267: /* Line 1455 of yacc.c */ -#line 1472 "glsl_parser.ypp" +#line 1469 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); @@ -5048,10 +4962,10 @@ yyreduce: ;} break; - case 271: + case 268: /* Line 1455 of yacc.c */ -#line 1478 "glsl_parser.ypp" +#line 1475 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); @@ -5059,10 +4973,10 @@ yyreduce: ;} break; - case 272: + case 269: /* Line 1455 of yacc.c */ -#line 1484 "glsl_parser.ypp" +#line 1481 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); @@ -5070,10 +4984,10 @@ yyreduce: ;} break; - case 273: + case 270: /* Line 1455 of yacc.c */ -#line 1490 "glsl_parser.ypp" +#line 1487 "glsl_parser.ypp" { void *ctx = state; (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); @@ -5081,24 +4995,24 @@ yyreduce: ;} break; - case 274: + case 271: /* Line 1455 of yacc.c */ -#line 1498 "glsl_parser.ypp" +#line 1495 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} break; - case 275: + case 272: /* Line 1455 of yacc.c */ -#line 1499 "glsl_parser.ypp" +#line 1496 "glsl_parser.ypp" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 276: + case 273: /* Line 1455 of yacc.c */ -#line 1504 "glsl_parser.ypp" +#line 1501 "glsl_parser.ypp" { void *ctx = state; (yyval.function_definition) = new(ctx) ast_function_definition(); @@ -5111,7 +5025,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 5115 "glsl_parser.cpp" +#line 5029 "glsl_parser.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 2bfca6fa2f..4124c7f1d2 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -41,10 +41,10 @@ enum yytokentype { ATTRIBUTE = 258, CONST_TOK = 259, - BOOL = 260, - FLOAT = 261, - INT = 262, - UINT = 263, + BOOL_TOK = 260, + FLOAT_TOK = 261, + INT_TOK = 262, + UINT_TOK = 263, BREAK = 264, CONTINUE = 265, DO = 266, @@ -68,165 +68,162 @@ VEC2 = 284, VEC3 = 285, VEC4 = 286, - MAT2 = 287, - MAT3 = 288, - MAT4 = 289, - CENTROID = 290, - IN = 291, - OUT = 292, - INOUT = 293, - UNIFORM = 294, - VARYING = 295, - NOPERSPECTIVE = 296, - FLAT = 297, - SMOOTH = 298, - MAT2X2 = 299, - MAT2X3 = 300, - MAT2X4 = 301, - MAT3X2 = 302, - MAT3X3 = 303, - MAT3X4 = 304, - MAT4X2 = 305, - MAT4X3 = 306, - MAT4X4 = 307, - SAMPLER1D = 308, - SAMPLER2D = 309, - SAMPLER3D = 310, - SAMPLERCUBE = 311, - SAMPLER1DSHADOW = 312, - SAMPLER2DSHADOW = 313, - SAMPLERCUBESHADOW = 314, - SAMPLER1DARRAY = 315, - SAMPLER2DARRAY = 316, - SAMPLER1DARRAYSHADOW = 317, - SAMPLER2DARRAYSHADOW = 318, - ISAMPLER1D = 319, - ISAMPLER2D = 320, - ISAMPLER3D = 321, - ISAMPLERCUBE = 322, - ISAMPLER1DARRAY = 323, - ISAMPLER2DARRAY = 324, - USAMPLER1D = 325, - USAMPLER2D = 326, - USAMPLER3D = 327, - USAMPLERCUBE = 328, - USAMPLER1DARRAY = 329, - USAMPLER2DARRAY = 330, - STRUCT = 331, - VOID = 332, - WHILE = 333, - IDENTIFIER = 334, - FLOATCONSTANT = 335, - INTCONSTANT = 336, - UINTCONSTANT = 337, - BOOLCONSTANT = 338, - FIELD_SELECTION = 339, - LEFT_OP = 340, - RIGHT_OP = 341, - INC_OP = 342, - DEC_OP = 343, - LE_OP = 344, - GE_OP = 345, - EQ_OP = 346, - NE_OP = 347, - AND_OP = 348, - OR_OP = 349, - XOR_OP = 350, - MUL_ASSIGN = 351, - DIV_ASSIGN = 352, - ADD_ASSIGN = 353, - MOD_ASSIGN = 354, - LEFT_ASSIGN = 355, - RIGHT_ASSIGN = 356, - AND_ASSIGN = 357, - XOR_ASSIGN = 358, - OR_ASSIGN = 359, - SUB_ASSIGN = 360, - INVARIANT = 361, - LOWP = 362, - MEDIUMP = 363, - HIGHP = 364, - SUPERP = 365, - PRECISION = 366, - VERSION = 367, - EXTENSION = 368, - LINE = 369, - PRAGMA = 370, - COLON = 371, - EOL = 372, - INTERFACE = 373, - OUTPUT = 374, - LAYOUT_TOK = 375, - ASM = 376, - CLASS = 377, - UNION = 378, - ENUM = 379, - TYPEDEF = 380, - TEMPLATE = 381, - THIS = 382, - PACKED = 383, - GOTO = 384, - INLINE_TOK = 385, - NOINLINE = 386, - VOLATILE = 387, - PUBLIC_TOK = 388, - STATIC = 389, - EXTERN = 390, - EXTERNAL = 391, - LONG = 392, - SHORT = 393, - DOUBLE = 394, - HALF = 395, - FIXED = 396, - UNSIGNED = 397, - INPUT = 398, - OUPTUT = 399, - HVEC2 = 400, - HVEC3 = 401, - HVEC4 = 402, - DVEC2 = 403, - DVEC3 = 404, - DVEC4 = 405, - FVEC2 = 406, - FVEC3 = 407, - FVEC4 = 408, - SAMPLER2DRECT = 409, - SAMPLER3DRECT = 410, - SAMPLER2DRECTSHADOW = 411, - SIZEOF = 412, - CAST = 413, - NAMESPACE = 414, - USING = 415, - ERROR_TOK = 416, - COMMON = 417, - PARTITION = 418, - ACTIVE = 419, - SAMPLERBUFFER = 420, - FILTER = 421, - IMAGE1D = 422, - IMAGE2D = 423, - IMAGE3D = 424, - IMAGECUBE = 425, - IMAGE1DARRAY = 426, - IMAGE2DARRAY = 427, - IIMAGE1D = 428, - IIMAGE2D = 429, - IIMAGE3D = 430, - IIMAGECUBE = 431, - IIMAGE1DARRAY = 432, - IIMAGE2DARRAY = 433, - UIMAGE1D = 434, - UIMAGE2D = 435, - UIMAGE3D = 436, - UIMAGECUBE = 437, - UIMAGE1DARRAY = 438, - UIMAGE2DARRAY = 439, - IMAGE1DSHADOW = 440, - IMAGE2DSHADOW = 441, - IMAGEBUFFER = 442, - IIMAGEBUFFER = 443, - UIMAGEBUFFER = 444, - ROW_MAJOR = 445 + CENTROID = 287, + IN_TOK = 288, + OUT_TOK = 289, + INOUT_TOK = 290, + UNIFORM = 291, + VARYING = 292, + NOPERSPECTIVE = 293, + FLAT = 294, + SMOOTH = 295, + MAT2X2 = 296, + MAT2X3 = 297, + MAT2X4 = 298, + MAT3X2 = 299, + MAT3X3 = 300, + MAT3X4 = 301, + MAT4X2 = 302, + MAT4X3 = 303, + MAT4X4 = 304, + SAMPLER1D = 305, + SAMPLER2D = 306, + SAMPLER3D = 307, + SAMPLERCUBE = 308, + SAMPLER1DSHADOW = 309, + SAMPLER2DSHADOW = 310, + SAMPLERCUBESHADOW = 311, + SAMPLER1DARRAY = 312, + SAMPLER2DARRAY = 313, + SAMPLER1DARRAYSHADOW = 314, + SAMPLER2DARRAYSHADOW = 315, + ISAMPLER1D = 316, + ISAMPLER2D = 317, + ISAMPLER3D = 318, + ISAMPLERCUBE = 319, + ISAMPLER1DARRAY = 320, + ISAMPLER2DARRAY = 321, + USAMPLER1D = 322, + USAMPLER2D = 323, + USAMPLER3D = 324, + USAMPLERCUBE = 325, + USAMPLER1DARRAY = 326, + USAMPLER2DARRAY = 327, + STRUCT = 328, + VOID_TOK = 329, + WHILE = 330, + IDENTIFIER = 331, + FLOATCONSTANT = 332, + INTCONSTANT = 333, + UINTCONSTANT = 334, + BOOLCONSTANT = 335, + FIELD_SELECTION = 336, + LEFT_OP = 337, + RIGHT_OP = 338, + INC_OP = 339, + DEC_OP = 340, + LE_OP = 341, + GE_OP = 342, + EQ_OP = 343, + NE_OP = 344, + AND_OP = 345, + OR_OP = 346, + XOR_OP = 347, + MUL_ASSIGN = 348, + DIV_ASSIGN = 349, + ADD_ASSIGN = 350, + MOD_ASSIGN = 351, + LEFT_ASSIGN = 352, + RIGHT_ASSIGN = 353, + AND_ASSIGN = 354, + XOR_ASSIGN = 355, + OR_ASSIGN = 356, + SUB_ASSIGN = 357, + INVARIANT = 358, + LOWP = 359, + MEDIUMP = 360, + HIGHP = 361, + SUPERP = 362, + PRECISION = 363, + VERSION = 364, + EXTENSION = 365, + LINE = 366, + PRAGMA = 367, + COLON = 368, + EOL = 369, + INTERFACE = 370, + OUTPUT = 371, + LAYOUT_TOK = 372, + ASM = 373, + CLASS = 374, + UNION = 375, + ENUM = 376, + TYPEDEF = 377, + TEMPLATE = 378, + THIS = 379, + PACKED_TOK = 380, + GOTO = 381, + INLINE_TOK = 382, + NOINLINE = 383, + VOLATILE = 384, + PUBLIC_TOK = 385, + STATIC = 386, + EXTERN = 387, + EXTERNAL = 388, + LONG_TOK = 389, + SHORT_TOK = 390, + DOUBLE_TOK = 391, + HALF = 392, + FIXED_TOK = 393, + UNSIGNED = 394, + INPUT_TOK = 395, + OUPTUT = 396, + HVEC2 = 397, + HVEC3 = 398, + HVEC4 = 399, + DVEC2 = 400, + DVEC3 = 401, + DVEC4 = 402, + FVEC2 = 403, + FVEC3 = 404, + FVEC4 = 405, + SAMPLER2DRECT = 406, + SAMPLER3DRECT = 407, + SAMPLER2DRECTSHADOW = 408, + SIZEOF = 409, + CAST = 410, + NAMESPACE = 411, + USING = 412, + ERROR_TOK = 413, + COMMON = 414, + PARTITION = 415, + ACTIVE = 416, + SAMPLERBUFFER = 417, + FILTER = 418, + IMAGE1D = 419, + IMAGE2D = 420, + IMAGE3D = 421, + IMAGECUBE = 422, + IMAGE1DARRAY = 423, + IMAGE2DARRAY = 424, + IIMAGE1D = 425, + IIMAGE2D = 426, + IIMAGE3D = 427, + IIMAGECUBE = 428, + IIMAGE1DARRAY = 429, + IIMAGE2DARRAY = 430, + UIMAGE1D = 431, + UIMAGE2D = 432, + UIMAGE3D = 433, + UIMAGECUBE = 434, + UIMAGE1DARRAY = 435, + UIMAGE2DARRAY = 436, + IMAGE1DSHADOW = 437, + IMAGE2DSHADOW = 438, + IMAGEBUFFER = 439, + IIMAGEBUFFER = 440, + UIMAGEBUFFER = 441, + ROW_MAJOR = 442 }; #endif @@ -268,7 +265,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 272 "glsl_parser.h" +#line 269 "glsl_parser.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ -- cgit v1.2.3 From 204d4cbea0de81f6f162ae0348e476de6c916ca8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 13 Aug 2010 18:36:55 +0100 Subject: glsl2: Include string.h in preprocessor --- src/glsl/glcpp/pp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c index 52b6e96a65..7672490958 100644 --- a/src/glsl/glcpp/pp.c +++ b/src/glsl/glcpp/pp.c @@ -22,6 +22,7 @@ */ #include +#include #include #include "glcpp.h" -- cgit v1.2.3 From c33e78f62bed762d8e5987e111a6e0424dc26c76 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 12:30:41 -0700 Subject: linker: Assign attrib location 0 if gl_Vertex is not used If gl_Vertex is not used in the shader, then attribute location 0 is available for use. Fixes piglit test case glsl-getattriblocation (bugzilla #29540). --- src/glsl/linker.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index c462d31ef3..7bff859d55 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -116,6 +116,38 @@ private: }; +/** + * Visitor that determines whether or not a variable is ever read. + */ +class find_deref_visitor : public ir_hierarchical_visitor { +public: + find_deref_visitor(const char *name) + : name(name), found(false) + { + /* empty */ + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + if (strcmp(this->name, ir->var->name) == 0) { + this->found = true; + return visit_stop; + } + + return visit_continue; + } + + bool variable_found() const + { + return this->found; + } + +private: + const char *name; /**< Find writes to a variable with this name. */ + bool found; /**< Was a write to the variable found? */ +}; + + void linker_error_printf(gl_shader_program *prog, const char *fmt, ...) { @@ -1042,7 +1074,10 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index * be explicitly assigned by via glBindAttribLocation. Mark it as reserved * to prevent it from being automatically allocated below. */ - used_locations |= (1 << 0); + find_deref_visitor find("gl_Vertex"); + find.run(sh->ir); + if (find.variable_found()) + used_locations |= (1 << 0); for (unsigned i = 0; i < num_attr; i++) { /* Mask representing the contiguous slots that will be used by this -- cgit v1.2.3 From ab18be74ac5f95ba1ebe6a52259d77e0940b2dbd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 13:08:54 -0700 Subject: glsl2: Use --nounistd to fix MSVC build Also remove the --never-interactive command line option for the preprocessor lexer. This was already done for main compiler lexer. --- src/glsl/Makefile | 4 ++-- src/glsl/glcpp/glcpp-lex.l | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 3e480685bd..2f62517e95 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -151,13 +151,13 @@ glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ glsl_lexer.cpp: glsl_lexer.lpp - flex -o$@ $< + flex --nounistd -o$@ $< glsl_parser.cpp: glsl_parser.ypp bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $< glcpp/glcpp-lex.c: glcpp/glcpp-lex.l - flex --never-interactive --outfile="$@" $< + flex --nounistd -o$@ $< glcpp/glcpp-parse.c: glcpp/glcpp-parse.y bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index fa62891354..1cd95b238d 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -50,6 +50,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); %option extra-type="glcpp_parser_t *" %option prefix="glcpp_" %option stack +%option never-interactive %x DONE COMMENT UNREACHABLE -- cgit v1.2.3 From 23f6017d70a705479b9bc3a1bf2ef401ac519fb9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 13:13:24 -0700 Subject: glsl2: Commit generated file changed by previous commit --- src/glsl/glcpp/glcpp-lex.c | 102 +++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 55 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index bdb3b2c11b..6b6aa12d8f 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -698,14 +698,6 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); #define COMMENT 2 #define UNREACHABLE 3 -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - #define YY_EXTRA_TYPE glcpp_parser_t * /* Holds the entire state of the reentrant scanner. */ @@ -958,11 +950,11 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 69 "glcpp/glcpp-lex.l" +#line 70 "glcpp/glcpp-lex.l" /* Single-line comments */ -#line 966 "glcpp/glcpp-lex.c" +#line 958 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1032,7 +1024,7 @@ yy_match: *yyg->yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 549 ); + while ( yy_current_state != 150 ); yy_find_action: yy_current_state = *--yyg->yy_state_ptr; @@ -1085,7 +1077,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 72 "glcpp/glcpp-lex.l" +#line 73 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; @@ -1095,34 +1087,34 @@ YY_RULE_SETUP /* Multi-line comments */ case 2: YY_RULE_SETUP -#line 79 "glcpp/glcpp-lex.l" +#line 80 "glcpp/glcpp-lex.l" { yy_push_state(COMMENT, yyscanner); } YY_BREAK case 3: YY_RULE_SETUP -#line 80 "glcpp/glcpp-lex.l" +#line 81 "glcpp/glcpp-lex.l" YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 81 "glcpp/glcpp-lex.l" +#line 82 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 5: YY_RULE_SETUP -#line 82 "glcpp/glcpp-lex.l" +#line 83 "glcpp/glcpp-lex.l" YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 83 "glcpp/glcpp-lex.l" +#line 84 "glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; } YY_BREAK case 7: YY_RULE_SETUP -#line 84 "glcpp/glcpp-lex.l" +#line 85 "glcpp/glcpp-lex.l" { yy_pop_state(yyscanner); if (yyextra->space_tokens) @@ -1131,7 +1123,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 90 "glcpp/glcpp-lex.l" +#line 91 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1144,7 +1136,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 9: YY_RULE_SETUP -#line 100 "glcpp/glcpp-lex.l" +#line 101 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1155,7 +1147,7 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 107 "glcpp/glcpp-lex.l" +#line 108 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1165,7 +1157,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 113 "glcpp/glcpp-lex.l" +#line 114 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1175,7 +1167,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 119 "glcpp/glcpp-lex.l" +#line 120 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1185,7 +1177,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 125 "glcpp/glcpp-lex.l" +#line 126 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1195,7 +1187,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 131 "glcpp/glcpp-lex.l" +#line 132 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ELSE; @@ -1204,7 +1196,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 136 "glcpp/glcpp-lex.l" +#line 137 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1224,7 +1216,7 @@ case 16: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 149 "glcpp/glcpp-lex.l" +#line 150 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1239,7 +1231,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 161 "glcpp/glcpp-lex.l" +#line 162 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1249,7 +1241,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 168 "glcpp/glcpp-lex.l" +#line 169 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; @@ -1257,7 +1249,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 173 "glcpp/glcpp-lex.l" +#line 174 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; @@ -1265,7 +1257,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 178 "glcpp/glcpp-lex.l" +#line 179 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; @@ -1273,7 +1265,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 183 "glcpp/glcpp-lex.l" +#line 184 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; @@ -1281,7 +1273,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 188 "glcpp/glcpp-lex.l" +#line 189 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1289,7 +1281,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 193 "glcpp/glcpp-lex.l" +#line 194 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1297,7 +1289,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 198 "glcpp/glcpp-lex.l" +#line 199 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1305,77 +1297,77 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 203 "glcpp/glcpp-lex.l" +#line 204 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK case 26: YY_RULE_SETUP -#line 207 "glcpp/glcpp-lex.l" +#line 208 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK case 27: YY_RULE_SETUP -#line 211 "glcpp/glcpp-lex.l" +#line 212 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK case 28: YY_RULE_SETUP -#line 215 "glcpp/glcpp-lex.l" +#line 216 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK case 29: YY_RULE_SETUP -#line 219 "glcpp/glcpp-lex.l" +#line 220 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK case 30: YY_RULE_SETUP -#line 223 "glcpp/glcpp-lex.l" +#line 224 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP -#line 227 "glcpp/glcpp-lex.l" +#line 228 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK case 32: YY_RULE_SETUP -#line 231 "glcpp/glcpp-lex.l" +#line 232 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK case 33: YY_RULE_SETUP -#line 235 "glcpp/glcpp-lex.l" +#line 236 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK case 34: YY_RULE_SETUP -#line 239 "glcpp/glcpp-lex.l" +#line 240 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK case 35: YY_RULE_SETUP -#line 243 "glcpp/glcpp-lex.l" +#line 244 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; @@ -1383,14 +1375,14 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 248 "glcpp/glcpp-lex.l" +#line 249 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK case 37: YY_RULE_SETUP -#line 252 "glcpp/glcpp-lex.l" +#line 253 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; @@ -1398,7 +1390,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 257 "glcpp/glcpp-lex.l" +#line 258 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; @@ -1408,7 +1400,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 263 "glcpp/glcpp-lex.l" +#line 264 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1418,7 +1410,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 271 "glcpp/glcpp-lex.l" +#line 272 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1431,7 +1423,7 @@ case YY_STATE_EOF(INITIAL): warnings. */ case 40: YY_RULE_SETUP -#line 281 "glcpp/glcpp-lex.l" +#line 282 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); @@ -1439,10 +1431,10 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 286 "glcpp/glcpp-lex.l" +#line 287 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1446 "glcpp/glcpp-lex.c" +#line 1438 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -2636,7 +2628,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 286 "glcpp/glcpp-lex.l" +#line 287 "glcpp/glcpp-lex.l" -- cgit v1.2.3 From a77a6bc008b3146c56431fa520a00e1f8dfa3938 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 16:22:21 -0700 Subject: glsl2: Use stdint.h instead of inttypes.h --- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/ir_function_inlining.cpp | 2 +- src/glsl/ir_validate.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index a4d46042ff..b081d22e75 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -97,7 +97,7 @@ #include #include #include -#include +#include #include "glcpp.h" #include "main/mtypes.h" diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index b05a925a09..0d70afd779 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "glcpp.h" #include "main/mtypes.h" diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 874602c84f..56d29e3fd1 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -27,7 +27,7 @@ * Replaces calls to functions with the body of the function. */ -#include +#include #include "ir.h" #include "ir_visitor.h" #include "ir_function_inlining.h" diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 6e08fa4025..905b3c7672 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -33,7 +33,7 @@ * a dereference chain. */ -#include +#include #include "ir.h" #include "ir_hierarchical_visitor.h" #include "program/hash_table.h" -- cgit v1.2.3 From 768b55a5268572ff9fd03e57e92775882eb0a821 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 16:46:43 -0700 Subject: glsl2: Remove unnecessary use of 'struct' before type names In C++ you don't have to say 'struct' or 'class' if the declaration of the type has been seen. Some compilers will complain if you use 'struct' when 'class' should have been used and vice versa. Fixes bugzilla #29539. --- src/glsl/ast.h | 5 ++--- src/glsl/ast_to_hir.cpp | 10 +++++----- src/glsl/glsl_parser.cpp | 36 ++++++++++++++++++------------------ src/glsl/glsl_parser.h | 26 +++++++++++++------------- src/glsl/glsl_parser.ypp | 36 ++++++++++++++++++------------------ src/glsl/hir_field_selection.cpp | 2 +- 6 files changed, 57 insertions(+), 58 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 7ce879bb79..44c31b6e62 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -29,7 +29,6 @@ #include "list.h" #include "glsl_parser_extras.h" -struct ir_instruction; struct _mesa_glsl_parse_state; struct YYLTYPE; @@ -657,8 +656,8 @@ public: extern void _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); -extern struct ir_rvalue * -_mesa_ast_field_selection_to_hir(const struct ast_expression *expr, +extern ir_rvalue * +_mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, struct _mesa_glsl_parse_state *state); diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9d4448f89a..6e5d01ee26 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -986,7 +986,7 @@ ast_expression::hir(exec_list *instructions, assert(operations[this->oper] == ir_binop_mod); - struct ir_rvalue *temp_rhs; + ir_rvalue *temp_rhs; temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); @@ -1107,7 +1107,7 @@ ast_expression::hir(exec_list *instructions, type = arithmetic_result_type(op[0], op[1], false, state, & loc); - struct ir_rvalue *temp_rhs; + ir_rvalue *temp_rhs; temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); @@ -1131,7 +1131,7 @@ ast_expression::hir(exec_list *instructions, type = arithmetic_result_type(op[0], op[1], false, state, & loc); - struct ir_rvalue *temp_rhs; + ir_rvalue *temp_rhs; temp_rhs = new(ctx) ir_expression(operations[this->oper], type, op[0], op[1]); @@ -1453,7 +1453,7 @@ ast_type_specifier::glsl_type(const char **name, static void apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, - struct ir_variable *var, + ir_variable *var, struct _mesa_glsl_parse_state *state, YYLTYPE *loc) { @@ -1620,7 +1620,7 @@ ast_declarator_list::hir(exec_list *instructions, foreach_list_typed (ast_declaration, decl, link, &this->declarations) { const struct glsl_type *var_type; - struct ir_variable *var; + ir_variable *var; /* FINISHME: Emit a warning if a variable declaration shadows a * FINISHME: declaration at a higher scope. diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp index 8756fcb721..7df9e96d16 100644 --- a/src/glsl/glsl_parser.cpp +++ b/src/glsl/glsl_parser.cpp @@ -347,21 +347,21 @@ typedef union YYSTYPE unsigned i; } type_qualifier; - struct ast_node *node; - struct ast_type_specifier *type_specifier; - struct ast_fully_specified_type *fully_specified_type; - struct ast_function *function; - struct ast_parameter_declarator *parameter_declarator; - struct ast_function_definition *function_definition; - struct ast_compound_statement *compound_statement; - struct ast_expression *expression; - struct ast_declarator_list *declarator_list; - struct ast_struct_specifier *struct_specifier; - struct ast_declaration *declaration; + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; struct { - struct ast_node *cond; - struct ast_expression *rest; + ast_node *cond; + ast_expression *rest; } for_rest_statement; @@ -4609,7 +4609,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1193 "glsl_parser.ypp" { - (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list); + (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); (yyvsp[(1) - (1)].declarator_list)->link.self_link(); ;} break; @@ -4619,7 +4619,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1198 "glsl_parser.ypp" { - (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node); + (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); ;} break; @@ -4687,7 +4687,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1263 "glsl_parser.ypp" - { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 234: @@ -4730,7 +4730,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1297 "glsl_parser.ypp" - { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} break; case 242: @@ -4855,7 +4855,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1385 "glsl_parser.ypp" { - (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression); + (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); ;} break; diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h index 4124c7f1d2..48a0a5fb3a 100644 --- a/src/glsl/glsl_parser.h +++ b/src/glsl/glsl_parser.h @@ -245,21 +245,21 @@ typedef union YYSTYPE unsigned i; } type_qualifier; - struct ast_node *node; - struct ast_type_specifier *type_specifier; - struct ast_fully_specified_type *fully_specified_type; - struct ast_function *function; - struct ast_parameter_declarator *parameter_declarator; - struct ast_function_definition *function_definition; - struct ast_compound_statement *compound_statement; - struct ast_expression *expression; - struct ast_declarator_list *declarator_list; - struct ast_struct_specifier *struct_specifier; - struct ast_declaration *declaration; + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; struct { - struct ast_node *cond; - struct ast_expression *rest; + ast_node *cond; + ast_expression *rest; } for_rest_statement; diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 1ee6da1d23..e0b1d28504 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -59,21 +59,21 @@ unsigned i; } type_qualifier; - struct ast_node *node; - struct ast_type_specifier *type_specifier; - struct ast_fully_specified_type *fully_specified_type; - struct ast_function *function; - struct ast_parameter_declarator *parameter_declarator; - struct ast_function_definition *function_definition; - struct ast_compound_statement *compound_statement; - struct ast_expression *expression; - struct ast_declarator_list *declarator_list; - struct ast_struct_specifier *struct_specifier; - struct ast_declaration *declaration; + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; struct { - struct ast_node *cond; - struct ast_expression *rest; + ast_node *cond; + ast_expression *rest; } for_rest_statement; } @@ -1191,12 +1191,12 @@ struct_specifier: struct_declaration_list: struct_declaration { - $$ = (struct ast_node *) $1; + $$ = (ast_node *) $1; $1->link.self_link(); } | struct_declaration_list struct_declaration { - $$ = (struct ast_node *) $1; + $$ = (ast_node *) $1; $$->link.insert_before(& $2->link); } ; @@ -1260,7 +1260,7 @@ statement: ; statement_matched: - compound_statement { $$ = (struct ast_node *) $1; } + compound_statement { $$ = (ast_node *) $1; } | simple_statement ; @@ -1294,7 +1294,7 @@ compound_statement: ; statement_no_new_scope: - compound_statement_no_new_scope { $$ = (struct ast_node *) $1; } + compound_statement_no_new_scope { $$ = (ast_node *) $1; } | simple_statement ; @@ -1383,7 +1383,7 @@ selection_statement_unmatched: condition: expression { - $$ = (struct ast_node *) $1; + $$ = (ast_node *) $1; } | fully_specified_type IDENTIFIER '=' initializer { diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 6dd910d581..23045ff182 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -28,7 +28,7 @@ #include "ast.h" #include "glsl_types.h" -struct ir_rvalue * +ir_rvalue * _mesa_ast_field_selection_to_hir(const ast_expression *expr, exec_list *instructions, struct _mesa_glsl_parse_state *state) -- cgit v1.2.3 From 07ca55b7fa09b8b5c08f8e2e45f9060020593783 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 13 Aug 2010 17:11:21 -0700 Subject: Fix an MSVC build error (bugzilla 29570). --- src/glsl/glcpp/glcpp-parse.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 0d70afd779..ce4197e240 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -32,7 +32,7 @@ #include "main/mtypes.h" #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) -#define glcpp_printf(stream, fmt, args...) \ +#define glcpp_printf(stream, fmt, args, ...) \ stream = talloc_asprintf_append(stream, fmt, args) static void -- cgit v1.2.3 From c55aa4292f35a6d08b0660e23f248a37988a5f99 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 13 Aug 2010 17:16:43 -0700 Subject: glsl2: Refresh autogenerated bison parser. --- src/glsl/glcpp/glcpp-parse.c | 236 ++++++++++++++++++++++--------------------- src/glsl/glcpp/glcpp-parse.h | 7 +- 2 files changed, 125 insertions(+), 118 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index b081d22e75..579fe7c7ad 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.1" +#define YYBISON_VERSION "2.4.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -103,7 +102,7 @@ #include "main/mtypes.h" #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) -#define glcpp_printf(stream, fmt, args...) \ +#define glcpp_printf(stream, fmt, args, ...) \ stream = talloc_asprintf_append(stream, fmt, args) static void @@ -213,7 +212,7 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); /* Line 189 of yacc.c */ -#line 217 "glcpp/glcpp-parse.c" +#line 216 "glcpp/glcpp-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -301,7 +300,7 @@ typedef struct YYLTYPE /* Line 264 of yacc.c */ -#line 305 "glcpp/glcpp-parse.c" +#line 304 "glcpp/glcpp-parse.c" #ifdef short # undef short @@ -351,7 +350,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -939,9 +938,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -998,7 +1006,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1540,7 +1548,7 @@ YYLTYPE yylloc; YYLTYPE *yylsp; /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + YYLTYPE yyerror_range[3]; YYSIZE_T yystacksize; @@ -1587,7 +1595,7 @@ YYLTYPE yylloc; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; @@ -1595,7 +1603,7 @@ YYLTYPE yylloc; /* User initialization code. */ -/* Line 1242 of yacc.c */ +/* Line 1251 of yacc.c */ #line 148 "glcpp/glcpp-parse.y" { yylloc.first_line = 1; @@ -1605,8 +1613,8 @@ YYLTYPE yylloc; yylloc.source = 0; } -/* Line 1242 of yacc.c */ -#line 1610 "glcpp/glcpp-parse.c" +/* Line 1251 of yacc.c */ +#line 1618 "glcpp/glcpp-parse.c" yylsp[0] = yylloc; goto yysetstate; @@ -1793,7 +1801,7 @@ yyreduce: { case 4: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 187 "glcpp/glcpp-parse.y" { glcpp_print(parser->output, "\n"); @@ -1802,7 +1810,7 @@ yyreduce: case 5: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 190 "glcpp/glcpp-parse.y" { _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); @@ -1813,7 +1821,7 @@ yyreduce: case 8: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 200 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); @@ -1822,7 +1830,7 @@ yyreduce: case 9: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 203 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); @@ -1831,7 +1839,7 @@ yyreduce: case 10: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 209 "glcpp/glcpp-parse.y" { _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); @@ -1840,7 +1848,7 @@ yyreduce: case 11: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 212 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); @@ -1849,7 +1857,7 @@ yyreduce: case 12: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 215 "glcpp/glcpp-parse.y" { _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); @@ -1858,7 +1866,7 @@ yyreduce: case 13: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 218 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); @@ -1872,7 +1880,7 @@ yyreduce: case 14: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 226 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'if' expression if @@ -1897,7 +1905,7 @@ yyreduce: case 15: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 245 "glcpp/glcpp-parse.y" { /* #if without an expression is only an error if we @@ -1913,7 +1921,7 @@ yyreduce: case 16: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 255 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1924,7 +1932,7 @@ yyreduce: case 17: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 260 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); @@ -1935,7 +1943,7 @@ yyreduce: case 18: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 265 "glcpp/glcpp-parse.y" { /* Be careful to only evaluate the 'elif' expression @@ -1960,7 +1968,7 @@ yyreduce: case 19: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 284 "glcpp/glcpp-parse.y" { /* #elif without an expression is an error unless we @@ -1981,7 +1989,7 @@ yyreduce: case 20: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 299 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); @@ -1990,7 +1998,7 @@ yyreduce: case 21: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 302 "glcpp/glcpp-parse.y" { _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); @@ -1999,7 +2007,7 @@ yyreduce: case 22: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 305 "glcpp/glcpp-parse.y" { macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); @@ -2014,7 +2022,7 @@ yyreduce: case 24: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 318 "glcpp/glcpp-parse.y" { if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { @@ -2029,7 +2037,7 @@ yyreduce: case 25: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 327 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); @@ -2038,7 +2046,7 @@ yyreduce: case 27: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 333 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); @@ -2047,7 +2055,7 @@ yyreduce: case 28: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 336 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); @@ -2056,7 +2064,7 @@ yyreduce: case 29: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 339 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); @@ -2065,7 +2073,7 @@ yyreduce: case 30: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 342 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); @@ -2074,7 +2082,7 @@ yyreduce: case 31: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 345 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); @@ -2083,7 +2091,7 @@ yyreduce: case 32: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 348 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); @@ -2092,7 +2100,7 @@ yyreduce: case 33: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 351 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); @@ -2101,7 +2109,7 @@ yyreduce: case 34: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 354 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); @@ -2110,7 +2118,7 @@ yyreduce: case 35: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 357 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); @@ -2119,7 +2127,7 @@ yyreduce: case 36: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 360 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); @@ -2128,7 +2136,7 @@ yyreduce: case 37: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 363 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); @@ -2137,7 +2145,7 @@ yyreduce: case 38: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 366 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); @@ -2146,7 +2154,7 @@ yyreduce: case 39: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 369 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); @@ -2155,7 +2163,7 @@ yyreduce: case 40: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 372 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); @@ -2164,7 +2172,7 @@ yyreduce: case 41: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 375 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); @@ -2173,7 +2181,7 @@ yyreduce: case 42: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 378 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); @@ -2182,7 +2190,7 @@ yyreduce: case 43: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 381 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); @@ -2191,7 +2199,7 @@ yyreduce: case 44: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 384 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); @@ -2200,7 +2208,7 @@ yyreduce: case 45: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 387 "glcpp/glcpp-parse.y" { (yyval.ival) = ! (yyvsp[(2) - (2)].ival); @@ -2209,7 +2217,7 @@ yyreduce: case 46: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 390 "glcpp/glcpp-parse.y" { (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); @@ -2218,7 +2226,7 @@ yyreduce: case 47: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 393 "glcpp/glcpp-parse.y" { (yyval.ival) = - (yyvsp[(2) - (2)].ival); @@ -2227,7 +2235,7 @@ yyreduce: case 48: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 396 "glcpp/glcpp-parse.y" { (yyval.ival) = + (yyvsp[(2) - (2)].ival); @@ -2236,7 +2244,7 @@ yyreduce: case 49: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 399 "glcpp/glcpp-parse.y" { (yyval.ival) = (yyvsp[(2) - (3)].ival); @@ -2245,7 +2253,7 @@ yyreduce: case 50: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 405 "glcpp/glcpp-parse.y" { (yyval.string_list) = _string_list_create (parser); @@ -2256,7 +2264,7 @@ yyreduce: case 51: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 410 "glcpp/glcpp-parse.y" { (yyval.string_list) = (yyvsp[(1) - (3)].string_list); @@ -2267,14 +2275,14 @@ yyreduce: case 52: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 418 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 54: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 423 "glcpp/glcpp-parse.y" { yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); @@ -2283,14 +2291,14 @@ yyreduce: case 55: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 429 "glcpp/glcpp-parse.y" { (yyval.token_list) = NULL; ;} break; case 58: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 435 "glcpp/glcpp-parse.y" { glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); @@ -2299,7 +2307,7 @@ yyreduce: case 59: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 442 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; @@ -2309,7 +2317,7 @@ yyreduce: case 60: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 446 "glcpp/glcpp-parse.y" { int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; @@ -2319,7 +2327,7 @@ yyreduce: case 62: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 455 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2331,7 +2339,7 @@ yyreduce: case 63: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 461 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2342,7 +2350,7 @@ yyreduce: case 64: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 469 "glcpp/glcpp-parse.y" { parser->space_tokens = 1; @@ -2354,7 +2362,7 @@ yyreduce: case 65: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 475 "glcpp/glcpp-parse.y" { (yyval.token_list) = (yyvsp[(1) - (2)].token_list); @@ -2365,7 +2373,7 @@ yyreduce: case 66: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 483 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); @@ -2375,7 +2383,7 @@ yyreduce: case 67: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 487 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); @@ -2385,7 +2393,7 @@ yyreduce: case 68: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 491 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); @@ -2395,7 +2403,7 @@ yyreduce: case 69: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 495 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); @@ -2405,7 +2413,7 @@ yyreduce: case 70: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 499 "glcpp/glcpp-parse.y" { (yyval.token) = _token_create_ival (parser, SPACE, SPACE); @@ -2415,225 +2423,225 @@ yyreduce: case 71: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 506 "glcpp/glcpp-parse.y" { (yyval.ival) = '['; ;} break; case 72: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 507 "glcpp/glcpp-parse.y" { (yyval.ival) = ']'; ;} break; case 73: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 508 "glcpp/glcpp-parse.y" { (yyval.ival) = '('; ;} break; case 74: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 509 "glcpp/glcpp-parse.y" { (yyval.ival) = ')'; ;} break; case 75: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 510 "glcpp/glcpp-parse.y" { (yyval.ival) = '{'; ;} break; case 76: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 511 "glcpp/glcpp-parse.y" { (yyval.ival) = '}'; ;} break; case 77: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 512 "glcpp/glcpp-parse.y" { (yyval.ival) = '.'; ;} break; case 78: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 513 "glcpp/glcpp-parse.y" { (yyval.ival) = '&'; ;} break; case 79: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 514 "glcpp/glcpp-parse.y" { (yyval.ival) = '*'; ;} break; case 80: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 515 "glcpp/glcpp-parse.y" { (yyval.ival) = '+'; ;} break; case 81: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 516 "glcpp/glcpp-parse.y" { (yyval.ival) = '-'; ;} break; case 82: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 517 "glcpp/glcpp-parse.y" { (yyval.ival) = '~'; ;} break; case 83: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 518 "glcpp/glcpp-parse.y" { (yyval.ival) = '!'; ;} break; case 84: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 519 "glcpp/glcpp-parse.y" { (yyval.ival) = '/'; ;} break; case 85: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 520 "glcpp/glcpp-parse.y" { (yyval.ival) = '%'; ;} break; case 86: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 521 "glcpp/glcpp-parse.y" { (yyval.ival) = LEFT_SHIFT; ;} break; case 87: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 522 "glcpp/glcpp-parse.y" { (yyval.ival) = RIGHT_SHIFT; ;} break; case 88: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 523 "glcpp/glcpp-parse.y" { (yyval.ival) = '<'; ;} break; case 89: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 524 "glcpp/glcpp-parse.y" { (yyval.ival) = '>'; ;} break; case 90: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 525 "glcpp/glcpp-parse.y" { (yyval.ival) = LESS_OR_EQUAL; ;} break; case 91: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 526 "glcpp/glcpp-parse.y" { (yyval.ival) = GREATER_OR_EQUAL; ;} break; case 92: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 527 "glcpp/glcpp-parse.y" { (yyval.ival) = EQUAL; ;} break; case 93: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 528 "glcpp/glcpp-parse.y" { (yyval.ival) = NOT_EQUAL; ;} break; case 94: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 529 "glcpp/glcpp-parse.y" { (yyval.ival) = '^'; ;} break; case 95: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 530 "glcpp/glcpp-parse.y" { (yyval.ival) = '|'; ;} break; case 96: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 531 "glcpp/glcpp-parse.y" { (yyval.ival) = AND; ;} break; case 97: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 532 "glcpp/glcpp-parse.y" { (yyval.ival) = OR; ;} break; case 98: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 533 "glcpp/glcpp-parse.y" { (yyval.ival) = ';'; ;} break; case 99: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 534 "glcpp/glcpp-parse.y" { (yyval.ival) = ','; ;} break; case 100: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 535 "glcpp/glcpp-parse.y" { (yyval.ival) = '='; ;} break; case 101: -/* Line 1455 of yacc.c */ +/* Line 1464 of yacc.c */ #line 536 "glcpp/glcpp-parse.y" { (yyval.ival) = PASTE; ;} break; -/* Line 1455 of yacc.c */ -#line 2637 "glcpp/glcpp-parse.c" +/* Line 1464 of yacc.c */ +#line 2645 "glcpp/glcpp-parse.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2705,7 +2713,7 @@ yyerrlab: #endif } - yyerror_range[0] = yylloc; + yyerror_range[1] = yylloc; if (yyerrstatus == 3) { @@ -2742,7 +2750,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + yyerror_range[1] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); @@ -2776,7 +2784,7 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - yyerror_range[0] = *yylsp; + yyerror_range[1] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp, parser); YYPOPSTACK (1); @@ -2786,10 +2794,10 @@ yyerrlab1: *++yyvsp = yylval; - yyerror_range[1] = yylloc; + yyerror_range[2] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); *++yylsp = yyloc; /* Shift the error token. */ @@ -2851,7 +2859,7 @@ yyreturn: -/* Line 1675 of yacc.c */ +/* Line 1684 of yacc.c */ #line 539 "glcpp/glcpp-parse.y" diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h index 50758930e9..40556854f3 100644 --- a/src/glsl/glcpp/glcpp-parse.h +++ b/src/glsl/glcpp/glcpp-parse.h @@ -1,10 +1,9 @@ - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.4.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3 From 2f4fe151681a6f6afe1d452eece6cf4144f44e49 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 13:06:49 -0700 Subject: glsl2: Move the common optimization passes to a helper function. These are passes that we expect all codegen to be happy with. The other lowering passes for Mesa IR are moved to the Mesa IR generator. --- src/glsl/glsl_parser_extras.cpp | 35 +++++++++++++++++++++++ src/glsl/ir_optimization.h | 2 ++ src/glsl/linker.cpp | 47 ++++--------------------------- src/mesa/program/ir_to_mesa.cpp | 61 ++++++++++++++++++++--------------------- 4 files changed, 72 insertions(+), 73 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index dbf6f53156..2ed3905abc 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -33,6 +33,7 @@ extern "C" { #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" +#include "ir_optimization.h" _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target, void *mem_ctx) @@ -705,3 +706,37 @@ ast_struct_specifier::ast_struct_specifier(char *identifier, name = identifier; this->declarations.push_degenerate_list_at_head(&declarator_list->link); } + +bool +do_common_optimization(exec_list *ir, bool linked) +{ + GLboolean progress = GL_FALSE; + + progress = do_sub_to_add_neg(ir) || progress; + + if (linked) { + progress = do_function_inlining(ir) || progress; + progress = do_dead_functions(ir) || progress; + } + progress = do_structure_splitting(ir) || progress; + progress = do_if_simplification(ir) || progress; + progress = do_copy_propagation(ir) || progress; + if (linked) + progress = do_dead_code(ir) || progress; + else + progress = do_dead_code_unlinked(ir) || progress; + progress = do_dead_code_local(ir) || progress; + progress = do_tree_grafting(ir) || progress; + progress = do_constant_propagation(ir) || progress; + if (linked) + progress = do_constant_variable(ir) || progress; + else + progress = do_constant_variable_unlinked(ir) || progress; + progress = do_constant_folding(ir) || progress; + progress = do_algebraic(ir) || progress; + progress = do_if_return(ir) || progress; + progress = do_vec_index_to_swizzle(ir) || progress; + progress = do_swizzle_swizzle(ir) || progress; + + return progress; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 5997a30eab..0c4e548e44 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -28,6 +28,8 @@ * Prototypes for optimization passes to be called by the compiler and drivers. */ +bool do_common_optimization(exec_list *ir, bool linked); + bool do_algebraic(exec_list *instructions); bool do_constant_folding(exec_list *instructions); bool do_constant_variable(exec_list *instructions); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 7bff859d55..9931251f40 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1308,48 +1308,13 @@ link_shaders(struct gl_shader_program *prog) prog->LinkStatus = true; } - /* FINISHME: Perform whole-program optimization here. */ + /* Do common optimization before assigning storage for attributes, + * uniforms, and varyings. Later optimization could possibly make + * some of that unused. + */ for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { - /* Optimization passes */ - bool progress; - exec_list *ir = prog->_LinkedShaders[i]->ir; - - /* Lowering */ - do_mat_op_to_vec(ir); - do_mod_to_fract(ir); - do_div_to_mul_rcp(ir); - do_explog_to_explog2(ir); - do_sub_to_add_neg(ir); - - do { - progress = false; - - progress = do_function_inlining(ir) || progress; - progress = do_dead_functions(ir) || progress; - progress = do_structure_splitting(ir) || progress; - progress = do_if_simplification(ir) || progress; - progress = do_copy_propagation(ir) || progress; - progress = do_dead_code_local(ir) || progress; - progress = do_dead_code(ir) || progress; - progress = do_tree_grafting(ir) || progress; - progress = do_constant_propagation(ir) || progress; - progress = do_constant_variable(ir) || progress; - progress = do_constant_folding(ir) || progress; - progress = do_algebraic(ir) || progress; - progress = do_if_return(ir) || progress; -#if 0 - if (ctx->Shader.EmitNoIfs) - progress = do_if_to_cond_assign(ir) || progress; -#endif - - progress = do_vec_index_to_swizzle(ir) || progress; - /* Do this one after the previous to let the easier pass handle - * constant vector indexing. - */ - progress = do_vec_index_to_cond_assign(ir) || progress; - - progress = do_swizzle_swizzle(ir) || progress; - } while (progress); + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true)) + ; } assign_uniform_locations(prog); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index ecb13069cb..c8c655b296 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2567,38 +2567,11 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) if (!state->error && !shader->ir->is_empty()) { validate_ir_tree(shader->ir); - /* Lowering */ - do_mat_op_to_vec(shader->ir); - do_mod_to_fract(shader->ir); - do_div_to_mul_rcp(shader->ir); - do_sub_to_add_neg(shader->ir); - - /* Optimization passes */ - bool progress; - do { - progress = false; - - progress = do_if_simplification(shader->ir) || progress; - progress = do_copy_propagation(shader->ir) || progress; - progress = do_dead_code_local(shader->ir) || progress; - progress = do_dead_code_unlinked(shader->ir) || progress; - progress = do_tree_grafting(shader->ir) || progress; - progress = do_constant_propagation(shader->ir) || progress; - progress = do_constant_variable_unlinked(shader->ir) || progress; - progress = do_constant_folding(shader->ir) || progress; - progress = do_algebraic(shader->ir) || progress; - progress = do_if_return(shader->ir) || progress; - if (ctx->Shader.EmitNoIfs) - progress = do_if_to_cond_assign(shader->ir) || progress; - - progress = do_vec_index_to_swizzle(shader->ir) || progress; - /* Do this one after the previous to let the easier pass handle - * constant vector indexing. - */ - progress = do_vec_index_to_cond_assign(shader->ir) || progress; - - progress = do_swizzle_swizzle(shader->ir) || progress; - } while (progress); + /* Do some optimization at compile time to reduce shader IR size + * and reduce later work if the same shader is linked multiple times + */ + while (do_common_optimization(shader->ir, false)) + ; validate_ir_tree(shader->ir); } @@ -2665,6 +2638,30 @@ _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) prog->Uniforms = _mesa_new_uniform_list(); } + if (prog->LinkStatus) { + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + bool progress; + exec_list *ir = prog->_LinkedShaders[i]->ir; + + do { + progress = false; + + /* Lowering */ + do_mat_op_to_vec(ir); + do_mod_to_fract(ir); + do_div_to_mul_rcp(ir); + do_explog_to_explog2(ir); + + progress = do_common_optimization(ir, true) || progress; + + if (ctx->Shader.EmitNoIfs) + progress = do_if_to_cond_assign(ir) || progress; + + progress = do_vec_index_to_cond_assign(ir) || progress; + } while (progress); + } + } + if (prog->LinkStatus) { for (i = 0; i < prog->_NumLinkedShaders; i++) { struct gl_program *linked_prog; -- cgit v1.2.3 From 013bbbbb0ac52a12d1e4413700dc40dee70186f8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Aug 2010 19:52:02 -0700 Subject: glsl2: Add support for ir_unop_neg to ir_mat_op_to_vec --- src/glsl/ir_mat_op_to_vec.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp index 880454c007..80e0579986 100644 --- a/src/glsl/ir_mat_op_to_vec.cpp +++ b/src/glsl/ir_mat_op_to_vec.cpp @@ -311,6 +311,30 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *assign) /* OK, time to break down this matrix operation. */ switch (expr->operation) { + case ir_unop_neg: { + const unsigned mask = (1U << result_var->type->vector_elements) - 1; + + /* Apply the operation to each column.*/ + for (i = 0; i < matrix_columns; i++) { + ir_rvalue *op0 = get_column(op_var[0], i); + ir_dereference *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(base_ir) ir_expression(expr->operation, + result->type, + op0, + NULL); + + column_assign = new(base_ir) ir_assignment(result, + column_expr, + NULL, + mask); + assert(column_assign->write_mask != 0); + base_ir->insert_before(column_assign); + } + break; + } case ir_binop_add: case ir_binop_sub: case ir_binop_div: -- cgit v1.2.3 From b3b0cf6a4c6b23e0ebe7e5f5ab1b7cacf27268b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Aug 2010 20:39:24 -0700 Subject: glsl2: Add a generic visitor class to call back with pointers to each rvalue. I keep copy and pasting this code all over, so consolidate it in one place. --- src/glsl/Makefile | 1 + src/glsl/ir_algebraic.cpp | 120 ++++---------------------------- src/glsl/ir_rvalue_visitor.cpp | 134 ++++++++++++++++++++++++++++++++++++ src/glsl/ir_rvalue_visitor.h | 47 +++++++++++++ src/glsl/ir_structure_splitting.cpp | 109 ++--------------------------- 5 files changed, 203 insertions(+), 208 deletions(-) create mode 100644 src/glsl/ir_rvalue_visitor.cpp create mode 100644 src/glsl/ir_rvalue_visitor.h (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 2f62517e95..48b7c8f66b 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -57,6 +57,7 @@ CXX_SOURCES = \ ir_mod_to_fract.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ + ir_rvalue_visitor.cpp \ ir_set_program_inouts.cpp \ ir_structure_splitting.cpp \ ir_sub_to_add_neg.cpp \ diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp index 86fb7e49c0..a66c820a27 100644 --- a/src/glsl/ir_algebraic.cpp +++ b/src/glsl/ir_algebraic.cpp @@ -30,6 +30,7 @@ #include "ir.h" #include "ir_visitor.h" +#include "ir_rvalue_visitor.h" #include "ir_optimization.h" #include "glsl_types.h" @@ -37,7 +38,7 @@ * Visitor class for replacing expressions with ir_constant values. */ -class ir_algebraic_visitor : public ir_hierarchical_visitor { +class ir_algebraic_visitor : public ir_rvalue_visitor { public: ir_algebraic_visitor() { @@ -48,16 +49,8 @@ public: { } - virtual ir_visitor_status visit_leave(ir_assignment *); - virtual ir_visitor_status visit_leave(ir_call *); - virtual ir_visitor_status visit_leave(ir_dereference_array *); - virtual ir_visitor_status visit_leave(ir_expression *); - virtual ir_visitor_status visit_leave(ir_if *); - virtual ir_visitor_status visit_leave(ir_return *); - virtual ir_visitor_status visit_leave(ir_swizzle *); - virtual ir_visitor_status visit_leave(ir_texture *); - - ir_rvalue *handle_expression(ir_rvalue *in_ir); + ir_rvalue *handle_expression(ir_expression *ir); + void handle_rvalue(ir_rvalue **rvalue); bool reassociate_constant(ir_expression *ir1, int const_index, ir_constant *constant, @@ -224,22 +217,15 @@ ir_algebraic_visitor::reassociate_constant(ir_expression *ir1, int const_index, } ir_rvalue * -ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) +ir_algebraic_visitor::handle_expression(ir_expression *ir) { - ir_expression *ir = (ir_expression *)in_ir; ir_constant *op_const[2] = {NULL, NULL}; ir_expression *op_expr[2] = {NULL, NULL}; unsigned int i; - if (!in_ir) - return NULL; - - if (in_ir->ir_type != ir_type_expression) - return in_ir; - for (i = 0; i < ir->get_num_operands(); i++) { if (ir->operands[i]->type->is_matrix()) - return in_ir; + return ir; op_const[i] = ir->operands[i]->constant_expression_value(); op_expr[i] = ir->operands[i]->as_expression(); @@ -379,98 +365,22 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir) break; } - return in_ir; -} - -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_expression *ir) -{ - unsigned int operand; - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - ir->operands[operand] = handle_expression(ir->operands[operand]); - } - - return visit_continue; -} - -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_texture *ir) -{ - ir->coordinate = handle_expression(ir->coordinate); - ir->projector = handle_expression(ir->projector); - ir->shadow_comparitor = handle_expression(ir->shadow_comparitor); - - switch (ir->op) { - case ir_tex: - break; - case ir_txb: - ir->lod_info.bias = handle_expression(ir->lod_info.bias); - break; - case ir_txf: - case ir_txl: - ir->lod_info.lod = handle_expression(ir->lod_info.lod); - break; - case ir_txd: - ir->lod_info.grad.dPdx = handle_expression(ir->lod_info.grad.dPdx); - ir->lod_info.grad.dPdy = handle_expression(ir->lod_info.grad.dPdy); - break; - } - - return visit_continue; + return ir; } -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_swizzle *ir) -{ - ir->val = handle_expression(ir->val); - return visit_continue; -} - -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_dereference_array *ir) -{ - ir->array_index = handle_expression(ir->array_index); - return visit_continue; -} - -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_assignment *ir) -{ - ir->rhs = handle_expression(ir->rhs); - ir->condition = handle_expression(ir->condition); - return visit_continue; -} - -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_call *ir) +void +ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue) { - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); - ir_rvalue *new_param = handle_expression(param); + if (!*rvalue) + return; - if (new_param != param) { - param->replace_with(new_param); - } - } - return visit_continue; -} + ir_expression *expr = (*rvalue)->as_expression(); + if (!expr) + return; -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_return *ir) -{ - ir->value = handle_expression(ir->value);; - return visit_continue; + *rvalue = handle_expression(expr); } -ir_visitor_status -ir_algebraic_visitor::visit_leave(ir_if *ir) -{ - ir->condition = handle_expression(ir->condition); - return visit_continue; -} - - bool do_algebraic(exec_list *instructions) { diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp new file mode 100644 index 0000000000..613b07c302 --- /dev/null +++ b/src/glsl/ir_rvalue_visitor.cpp @@ -0,0 +1,134 @@ +/* + * 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 ir_rvalue_visitor.cpp + * + * Generic class to implement the common pattern we have of wanting to + * visit each ir_rvalue * and possibly change that node to a different + * class. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_expression *ir) +{ + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + handle_rvalue(&ir->operands[operand]); + } + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_texture *ir) +{ + handle_rvalue(&ir->coordinate); + handle_rvalue(&ir->projector); + handle_rvalue(&ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + handle_rvalue(&ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + handle_rvalue(&ir->lod_info.lod); + break; + case ir_txd: + handle_rvalue(&ir->lod_info.grad.dPdx); + handle_rvalue(&ir->lod_info.grad.dPdy); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_swizzle *ir) +{ + handle_rvalue(&ir->val); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_dereference_array *ir) +{ + handle_rvalue(&ir->array_index); + handle_rvalue(&ir->array); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_dereference_record *ir) +{ + handle_rvalue(&ir->record); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_assignment *ir) +{ + handle_rvalue(&ir->rhs); + handle_rvalue(&ir->condition); + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + handle_rvalue(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_return *ir) +{ + handle_rvalue(&ir->value);; + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_if *ir) +{ + handle_rvalue(&ir->condition); + return visit_continue; +} diff --git a/src/glsl/ir_rvalue_visitor.h b/src/glsl/ir_rvalue_visitor.h new file mode 100644 index 0000000000..31a56beb9b --- /dev/null +++ b/src/glsl/ir_rvalue_visitor.h @@ -0,0 +1,47 @@ +/* + * 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 ir_rvalue_visitor.h + * + * Generic class to implement the common pattern we have of wanting to + * visit each ir_rvalue * and possibly change that node to a different + * class. Just implement handle_rvalue() and you will be called with + * a pointer to each rvalue in the tree. + */ + +class ir_rvalue_visitor : public ir_hierarchical_visitor { +public: + + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_dereference_record *); + virtual ir_visitor_status visit_leave(ir_expression *); + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_return *); + virtual ir_visitor_status visit_leave(ir_swizzle *); + virtual ir_visitor_status visit_leave(ir_texture *); + + virtual void handle_rvalue(ir_rvalue **rvalue) = 0; +}; diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index 2f83896263..e257defb1a 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -35,6 +35,7 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_print_visitor.h" +#include "ir_rvalue_visitor.h" #include "glsl_types.h" static bool debug = false; @@ -165,7 +166,7 @@ ir_structure_reference_visitor::visit_enter(ir_function_signature *ir) return visit_continue_with_parent; } -class ir_structure_splitting_visitor : public ir_hierarchical_visitor { +class ir_structure_splitting_visitor : public ir_rvalue_visitor { public: ir_structure_splitting_visitor(exec_list *vars) { @@ -177,17 +178,9 @@ public: } virtual ir_visitor_status visit_leave(ir_assignment *); - virtual ir_visitor_status visit_leave(ir_call *); - virtual ir_visitor_status visit_leave(ir_dereference_array *); - virtual ir_visitor_status visit_leave(ir_dereference_record *); - virtual ir_visitor_status visit_leave(ir_expression *); - virtual ir_visitor_status visit_leave(ir_if *); - virtual ir_visitor_status visit_leave(ir_return *); - virtual ir_visitor_status visit_leave(ir_swizzle *); - virtual ir_visitor_status visit_leave(ir_texture *); void split_deref(ir_dereference **deref); - void split_rvalue(ir_rvalue **rvalue); + void handle_rvalue(ir_rvalue **rvalue); struct variable_entry *get_splitting_entry(ir_variable *var); exec_list *variable_list; @@ -239,7 +232,7 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref) } void -ir_structure_splitting_visitor::split_rvalue(ir_rvalue **rvalue) +ir_structure_splitting_visitor::handle_rvalue(ir_rvalue **rvalue) { if (!*rvalue) return; @@ -253,66 +246,6 @@ ir_structure_splitting_visitor::split_rvalue(ir_rvalue **rvalue) *rvalue = deref; } -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_expression *ir) -{ - unsigned int operand; - - for (operand = 0; operand < ir->get_num_operands(); operand++) { - split_rvalue(&ir->operands[operand]); - } - - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_texture *ir) -{ - split_rvalue(&ir->coordinate); - split_rvalue(&ir->projector); - split_rvalue(&ir->shadow_comparitor); - - switch (ir->op) { - case ir_tex: - break; - case ir_txb: - split_rvalue(&ir->lod_info.bias); - break; - case ir_txf: - case ir_txl: - split_rvalue(&ir->lod_info.lod); - break; - case ir_txd: - split_rvalue(&ir->lod_info.grad.dPdx); - split_rvalue(&ir->lod_info.grad.dPdy); - break; - } - - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_swizzle *ir) -{ - split_rvalue(&ir->val); - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_dereference_array *ir) -{ - split_rvalue(&ir->array_index); - split_rvalue(&ir->array); - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_dereference_record *ir) -{ - split_rvalue(&ir->record); - return visit_continue; -} - ir_visitor_status ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) { @@ -349,45 +282,15 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) } ir->remove(); } else { - split_rvalue(&ir->rhs); + handle_rvalue(&ir->rhs); split_deref(&ir->lhs); } - split_rvalue(&ir->condition); - - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_call *ir) -{ - foreach_iter(exec_list_iterator, iter, *ir) { - ir_rvalue *param = (ir_rvalue *)iter.get(); - ir_rvalue *new_param = param; - split_rvalue(&new_param); - - if (new_param != param) { - param->replace_with(new_param); - } - } - return visit_continue; -} - -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_return *ir) -{ - split_rvalue(&ir->value);; - return visit_continue; -} + handle_rvalue(&ir->condition); -ir_visitor_status -ir_structure_splitting_visitor::visit_leave(ir_if *ir) -{ - split_rvalue(&ir->condition); return visit_continue; } - bool do_structure_splitting(exec_list *instructions) { -- cgit v1.2.3 From 42cab131dac469475c67ab38a2c29f2f66e6ff49 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Aug 2010 20:50:10 -0700 Subject: glsl2: Convert ir_constant_propagation to ir_rvalue_visitor. This one is a little tricky because of the LHS handling. --- src/glsl/ir_constant_propagation.cpp | 64 +++++------------------------------- 1 file changed, 9 insertions(+), 55 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp index adae0aa117..76c1ce7013 100644 --- a/src/glsl/ir_constant_propagation.cpp +++ b/src/glsl/ir_constant_propagation.cpp @@ -36,6 +36,7 @@ #include "ir.h" #include "ir_visitor.h" +#include "ir_rvalue_visitor.h" #include "ir_basic_block.h" #include "ir_optimization.h" #include "glsl_types.h" @@ -72,7 +73,7 @@ public: unsigned write_mask; }; -class ir_constant_propagation_visitor : public ir_hierarchical_visitor { +class ir_constant_propagation_visitor : public ir_rvalue_visitor { public: ir_constant_propagation_visitor() { @@ -90,12 +91,8 @@ public: virtual ir_visitor_status visit_enter(class ir_function_signature *); virtual ir_visitor_status visit_enter(class ir_function *); virtual ir_visitor_status visit_enter(class ir_assignment *); - virtual ir_visitor_status visit_leave(class ir_assignment *); - virtual ir_visitor_status visit_enter(class ir_expression *); virtual ir_visitor_status visit_enter(class ir_call *); virtual ir_visitor_status visit_enter(class ir_if *); - virtual ir_visitor_status visit_enter(class ir_dereference_array *); - virtual ir_visitor_status visit_enter(class ir_texture *); void add_constant(ir_assignment *ir); void kill(ir_variable *ir, unsigned write_mask); @@ -221,30 +218,20 @@ ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_constant_propagation_visitor::visit_enter(ir_assignment *ir) { - handle_rvalue(&ir->condition); + /* Inline accepting children, skipping the LHS. */ + ir->rhs->accept(this); handle_rvalue(&ir->rhs); - return visit_continue; -} + if (ir->condition) { + ir->condition->accept(this); + handle_rvalue(&ir->condition); + } -ir_visitor_status -ir_constant_propagation_visitor::visit_leave(ir_assignment *ir) -{ kill(ir->lhs->variable_referenced(), ir->write_mask); add_constant(ir); - return visit_continue; -} - -ir_visitor_status -ir_constant_propagation_visitor::visit_enter(ir_expression *ir) -{ - for (unsigned int i = 0; i < ir->get_num_operands(); i++) { - handle_rvalue(&ir->operands[i]); - } - - return visit_continue; + return visit_continue_with_parent; } ir_visitor_status @@ -330,39 +317,6 @@ ir_constant_propagation_visitor::visit_enter(ir_if *ir) return visit_continue_with_parent; } -ir_visitor_status -ir_constant_propagation_visitor::visit_enter(ir_dereference_array *ir) -{ - handle_rvalue(&ir->array_index); - return visit_continue; -} - -ir_visitor_status -ir_constant_propagation_visitor::visit_enter(ir_texture *ir) -{ - handle_rvalue(&ir->coordinate); - handle_rvalue(&ir->projector); - handle_rvalue(&ir->shadow_comparitor); - - switch (ir->op) { - case ir_tex: - break; - case ir_txb: - handle_rvalue(&ir->lod_info.bias); - break; - case ir_txf: - case ir_txl: - handle_rvalue(&ir->lod_info.lod); - break; - case ir_txd: - handle_rvalue(&ir->lod_info.grad.dPdx); - handle_rvalue(&ir->lod_info.grad.dPdy); - break; - } - - return visit_continue; -} - ir_visitor_status ir_constant_propagation_visitor::visit_enter(ir_loop *ir) { -- cgit v1.2.3 From 8f8cdbfba43550d0b8985fb087961864e4cd92b6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Aug 2010 07:16:38 -0700 Subject: glsl2: Add a pass to strip out noop swizzles. With the glsl2-965 branch, the optimization of glsl-algebraic-rcp-rcp regressed due to noop swizzles hiding information from ir_algebraic. This cleans up those noop swizzles for us. --- src/glsl/Makefile | 1 + src/glsl/glsl_parser_extras.cpp | 1 + src/glsl/ir_noop_swizzle.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ src/glsl/ir_optimization.h | 1 + 4 files changed, 83 insertions(+) create mode 100644 src/glsl/ir_noop_swizzle.cpp (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 48b7c8f66b..110228e72a 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -55,6 +55,7 @@ CXX_SOURCES = \ ir_import_prototypes.cpp \ ir_mat_op_to_vec.cpp \ ir_mod_to_fract.cpp \ + ir_noop_swizzle.cpp \ ir_print_visitor.cpp \ ir_reader.cpp \ ir_rvalue_visitor.cpp \ diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 2ed3905abc..d1bb1ae5ec 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -737,6 +737,7 @@ do_common_optimization(exec_list *ir, bool linked) progress = do_if_return(ir) || progress; progress = do_vec_index_to_swizzle(ir) || progress; progress = do_swizzle_swizzle(ir) || progress; + progress = do_noop_swizzle(ir) || progress; return progress; } diff --git a/src/glsl/ir_noop_swizzle.cpp b/src/glsl/ir_noop_swizzle.cpp new file mode 100644 index 0000000000..b78c87b47f --- /dev/null +++ b/src/glsl/ir_noop_swizzle.cpp @@ -0,0 +1,80 @@ +/* + * 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 ir_noop_swizzle.cpp + * + * If a swizzle doesn't change the order or count of components, then + * remove the swizzle so that other optimization passes see the value + * behind it. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +class ir_noop_swizzle_visitor : public ir_rvalue_visitor { +public: + ir_noop_swizzle_visitor() + { + this->progress = false; + } + + void handle_rvalue(ir_rvalue **rvalue); + bool progress; +}; + +void +ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_swizzle *swiz = (*rvalue)->as_swizzle(); + if (!swiz || swiz->type != swiz->val->type) + return; + + int elems = swiz->val->type->vector_elements; + if (swiz->mask.x != 0) + return; + if (elems >= 2 && swiz->mask.y != 1) + return; + if (elems >= 3 && swiz->mask.z != 1) + return; + if (elems >= 4 && swiz->mask.w != 1) + return; + + this->progress = true; + *rvalue = swiz->val; +} + +bool +do_noop_swizzle(exec_list *instructions) +{ + ir_noop_swizzle_visitor v; + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 0c4e548e44..33f4bc78f7 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -48,6 +48,7 @@ bool do_if_simplification(exec_list *instructions); bool do_if_to_cond_assign(exec_list *instructions); bool do_mat_op_to_vec(exec_list *instructions); bool do_mod_to_fract(exec_list *instructions); +bool do_noop_swizzle(exec_list *instructions); bool do_structure_splitting(exec_list *instructions); bool do_sub_to_add_neg(exec_list *instructions); bool do_swizzle_swizzle(exec_list *instructions); -- cgit v1.2.3 From d01bf822dd7f28dc56705407e7c3b9de1f292794 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 13 Aug 2010 19:05:54 -0700 Subject: glsl2: Commit generated file change by commit ab18be74 This would have been included in commit 23f6017d, but make wisely did not regenerate the file when the .lpp file did not change. --- src/glsl/glsl_lexer.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index 2c502e8803..3cdce995e2 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -959,14 +959,6 @@ static yyconst flex_int16_t yy_chk[1076] = #define INITIAL 0 #define PP 1 -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - #define YY_EXTRA_TYPE struct _mesa_glsl_parse_state * /* Holds the entire state of the reentrant scanner. */ @@ -1203,7 +1195,7 @@ YY_DECL #line 76 "glsl_lexer.lpp" -#line 1207 "glsl_lexer.cpp" +#line 1199 "glsl_lexer.cpp" yylval = yylval_param; @@ -2263,7 +2255,7 @@ YY_RULE_SETUP #line 356 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2267 "glsl_lexer.cpp" +#line 2259 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): yyterminate(); -- cgit v1.2.3 From d802ba110f78c3eee9541867cde819ada1b2c449 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 12 Aug 2010 13:17:53 -0700 Subject: ir_reader: Don't mark functions as defined if their body is empty. --- src/glsl/ir_reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 14bd2d62fd..2def3efff5 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -297,7 +297,7 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, sig->replace_parameters(&hir_parameters); - if (!skip_body) { + if (!skip_body && !body_list->subexpressions.is_empty()) { if (sig->is_defined) { ir_read_error(st, list, "function %s redefined", f->name); return; -- cgit v1.2.3 From 43ff8f1a4b90554eae489cebb7e05f983dd9ad66 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 11 Aug 2010 16:53:52 -0700 Subject: glsl2: Rework builtin function generation. Each language version/extension and target now has a "profile" containing all of the available builtin function prototypes. These are written in GLSL, and come directly out of the GLSL spec (except for expanding genType). A new builtins/ir/ folder contains the hand-written IR for each builtin, regardless of what version includes it. Only those definitions that have prototypes in the profile will be included. The autogenerated IR for texture builtins is no longer written to disk, so there's no longer any confusion as to what's hand-written or generated. All scripts are now in python instead of perl. --- src/glsl/Makefile | 5 +- src/glsl/builtin_function.cpp | 17087 +++++++++++++++---- src/glsl/builtins/110/abs | 21 - src/glsl/builtins/110/all | 16 - src/glsl/builtins/110/any | 16 - src/glsl/builtins/110/asin | 120 - src/glsl/builtins/110/atan | 154 - src/glsl/builtins/110/ceil | 21 - src/glsl/builtins/110/clamp | 50 - src/glsl/builtins/110/cos | 21 - src/glsl/builtins/110/cross | 7 - src/glsl/builtins/110/degrees | 21 - src/glsl/builtins/110/distance | 33 - src/glsl/builtins/110/dot | 25 - src/glsl/builtins/110/equal | 61 - src/glsl/builtins/110/exp | 21 - src/glsl/builtins/110/exp2 | 21 - src/glsl/builtins/110/faceforward | 37 - src/glsl/builtins/110/floor | 21 - src/glsl/builtins/110/fract | 22 - src/glsl/builtins/110/greaterThan | 61 - src/glsl/builtins/110/greaterThanEqual | 61 - src/glsl/builtins/110/inversesqrt | 21 - src/glsl/builtins/110/length | 21 - src/glsl/builtins/110/lessThan | 61 - src/glsl/builtins/110/lessThanEqual | 61 - src/glsl/builtins/110/log | 21 - src/glsl/builtins/110/log2 | 21 - src/glsl/builtins/110/matrixCompMult | 32 - src/glsl/builtins/110/max | 43 - src/glsl/builtins/110/min | 43 - src/glsl/builtins/110/mix | 50 - src/glsl/builtins/110/mod | 43 - src/glsl/builtins/110/noise_fake | 76 - src/glsl/builtins/110/normalize | 21 - src/glsl/builtins/110/not | 16 - src/glsl/builtins/110/notEqual | 61 - src/glsl/builtins/110/pow | 25 - src/glsl/builtins/110/radians | 21 - src/glsl/builtins/110/reflect | 58 - src/glsl/builtins/110/refract | 102 - src/glsl/builtins/110/sign | 21 - src/glsl/builtins/110/sin | 21 - src/glsl/builtins/110/smoothstep | 153 - src/glsl/builtins/110/sqrt | 21 - src/glsl/builtins/110/step | 68 - src/glsl/builtins/110/tan | 21 - src/glsl/builtins/110/textures | 213 - src/glsl/builtins/110_fs/derivatives | 73 - src/glsl/builtins/110_fs/textures | 113 - src/glsl/builtins/110_vs/ftransform | 9 - src/glsl/builtins/120/matrixCompMult | 61 - src/glsl/builtins/120/outerProduct | 92 - src/glsl/builtins/120/transpose | 139 - src/glsl/builtins/130/clamp | 99 - src/glsl/builtins/130/cosh | 30 - src/glsl/builtins/130/equal | 31 - src/glsl/builtins/130/greaterThan | 31 - src/glsl/builtins/130/greaterThanEqual | 31 - src/glsl/builtins/130/lessThan | 31 - src/glsl/builtins/130/lessThanEqual | 31 - src/glsl/builtins/130/max | 85 - src/glsl/builtins/130/min | 85 - src/glsl/builtins/130/mix | 39 - src/glsl/builtins/130/notEqual | 31 - src/glsl/builtins/130/sign | 22 - src/glsl/builtins/130/sinh | 30 - src/glsl/builtins/130/tanh | 42 - src/glsl/builtins/130/texelFetch | 107 - src/glsl/builtins/130/texture | 110 - src/glsl/builtins/130/textureGrad | 147 - src/glsl/builtins/130/textureLod | 128 - src/glsl/builtins/130/textureProj | 92 - src/glsl/builtins/130/textureProjGrad | 122 - src/glsl/builtins/130/textureProjLod | 107 - src/glsl/builtins/130_fs/texture | 128 - src/glsl/builtins/130_fs/textureProj | 107 - src/glsl/builtins/ARB_texture_rectangle/textures | 16 - src/glsl/builtins/EXT_texture_array/textures | 59 - src/glsl/builtins/EXT_texture_array_fs/textures | 27 - src/glsl/builtins/ir/abs | 21 + src/glsl/builtins/ir/acos | 22 + src/glsl/builtins/ir/all | 16 + src/glsl/builtins/ir/any | 16 + src/glsl/builtins/ir/asin | 97 + src/glsl/builtins/ir/atan | 154 + src/glsl/builtins/ir/ceil | 21 + src/glsl/builtins/ir/clamp | 148 + src/glsl/builtins/ir/cos | 21 + src/glsl/builtins/ir/cosh | 30 + src/glsl/builtins/ir/cross | 7 + src/glsl/builtins/ir/dFdx | 21 + src/glsl/builtins/ir/dFdy | 21 + src/glsl/builtins/ir/degrees | 21 + src/glsl/builtins/ir/distance | 33 + src/glsl/builtins/ir/dot | 25 + src/glsl/builtins/ir/equal | 91 + src/glsl/builtins/ir/exp | 21 + src/glsl/builtins/ir/exp2 | 21 + src/glsl/builtins/ir/faceforward | 37 + src/glsl/builtins/ir/floor | 21 + src/glsl/builtins/ir/fract | 22 + src/glsl/builtins/ir/ftransform | 9 + src/glsl/builtins/ir/fwidth | 29 + src/glsl/builtins/ir/greaterThan | 91 + src/glsl/builtins/ir/greaterThanEqual | 91 + src/glsl/builtins/ir/inversesqrt | 21 + src/glsl/builtins/ir/length | 21 + src/glsl/builtins/ir/lessThan | 91 + src/glsl/builtins/ir/lessThanEqual | 91 + src/glsl/builtins/ir/log | 21 + src/glsl/builtins/ir/log2 | 21 + src/glsl/builtins/ir/matrixCompMult | 91 + src/glsl/builtins/ir/max | 127 + src/glsl/builtins/ir/min | 127 + src/glsl/builtins/ir/mix | 88 + src/glsl/builtins/ir/mod | 43 + src/glsl/builtins/ir/noise1 | 18 + src/glsl/builtins/ir/noise2 | 18 + src/glsl/builtins/ir/noise3 | 18 + src/glsl/builtins/ir/noise4 | 18 + src/glsl/builtins/ir/normalize | 21 + src/glsl/builtins/ir/not | 16 + src/glsl/builtins/ir/notEqual | 91 + src/glsl/builtins/ir/outerProduct | 92 + src/glsl/builtins/ir/pow | 25 + src/glsl/builtins/ir/radians | 21 + src/glsl/builtins/ir/reflect | 58 + src/glsl/builtins/ir/refract | 102 + src/glsl/builtins/ir/sign | 42 + src/glsl/builtins/ir/sin | 21 + src/glsl/builtins/ir/sinh | 30 + src/glsl/builtins/ir/smoothstep | 153 + src/glsl/builtins/ir/sqrt | 21 + src/glsl/builtins/ir/step | 68 + src/glsl/builtins/ir/tan | 21 + src/glsl/builtins/ir/tanh | 42 + src/glsl/builtins/ir/transpose | 139 + src/glsl/builtins/profiles/110.frag | 364 + src/glsl/builtins/profiles/110.vert | 351 + src/glsl/builtins/profiles/120.frag | 396 + src/glsl/builtins/profiles/120.vert | 383 + .../builtins/profiles/ARB_texture_rectangle.frag | 7 + .../builtins/profiles/ARB_texture_rectangle.vert | 7 + src/glsl/builtins/profiles/EXT_texture_array.frag | 11 + src/glsl/builtins/profiles/EXT_texture_array.vert | 11 + src/glsl/builtins/tools/builtin_function.cpp | 39 + src/glsl/builtins/tools/generate_builtins.pl | 164 - src/glsl/builtins/tools/generate_builtins.py | 207 + src/glsl/builtins/tools/texture_builtins.py | 261 +- src/glsl/ir_reader.cpp | 24 +- src/glsl/ir_reader.h | 2 +- 152 files changed, 18318 insertions(+), 8265 deletions(-) delete mode 100644 src/glsl/builtins/110/abs delete mode 100644 src/glsl/builtins/110/all delete mode 100644 src/glsl/builtins/110/any delete mode 100644 src/glsl/builtins/110/asin delete mode 100644 src/glsl/builtins/110/atan delete mode 100644 src/glsl/builtins/110/ceil delete mode 100644 src/glsl/builtins/110/clamp delete mode 100644 src/glsl/builtins/110/cos delete mode 100644 src/glsl/builtins/110/cross delete mode 100644 src/glsl/builtins/110/degrees delete mode 100644 src/glsl/builtins/110/distance delete mode 100644 src/glsl/builtins/110/dot delete mode 100644 src/glsl/builtins/110/equal delete mode 100644 src/glsl/builtins/110/exp delete mode 100644 src/glsl/builtins/110/exp2 delete mode 100644 src/glsl/builtins/110/faceforward delete mode 100644 src/glsl/builtins/110/floor delete mode 100644 src/glsl/builtins/110/fract delete mode 100644 src/glsl/builtins/110/greaterThan delete mode 100644 src/glsl/builtins/110/greaterThanEqual delete mode 100644 src/glsl/builtins/110/inversesqrt delete mode 100644 src/glsl/builtins/110/length delete mode 100644 src/glsl/builtins/110/lessThan delete mode 100644 src/glsl/builtins/110/lessThanEqual delete mode 100644 src/glsl/builtins/110/log delete mode 100644 src/glsl/builtins/110/log2 delete mode 100644 src/glsl/builtins/110/matrixCompMult delete mode 100644 src/glsl/builtins/110/max delete mode 100644 src/glsl/builtins/110/min delete mode 100644 src/glsl/builtins/110/mix delete mode 100644 src/glsl/builtins/110/mod delete mode 100644 src/glsl/builtins/110/noise_fake delete mode 100644 src/glsl/builtins/110/normalize delete mode 100644 src/glsl/builtins/110/not delete mode 100644 src/glsl/builtins/110/notEqual delete mode 100644 src/glsl/builtins/110/pow delete mode 100644 src/glsl/builtins/110/radians delete mode 100644 src/glsl/builtins/110/reflect delete mode 100644 src/glsl/builtins/110/refract delete mode 100644 src/glsl/builtins/110/sign delete mode 100644 src/glsl/builtins/110/sin delete mode 100644 src/glsl/builtins/110/smoothstep delete mode 100644 src/glsl/builtins/110/sqrt delete mode 100644 src/glsl/builtins/110/step delete mode 100644 src/glsl/builtins/110/tan delete mode 100644 src/glsl/builtins/110/textures delete mode 100644 src/glsl/builtins/110_fs/derivatives delete mode 100644 src/glsl/builtins/110_fs/textures delete mode 100644 src/glsl/builtins/110_vs/ftransform delete mode 100644 src/glsl/builtins/120/matrixCompMult delete mode 100644 src/glsl/builtins/120/outerProduct delete mode 100644 src/glsl/builtins/120/transpose delete mode 100644 src/glsl/builtins/130/clamp delete mode 100644 src/glsl/builtins/130/cosh delete mode 100644 src/glsl/builtins/130/equal delete mode 100644 src/glsl/builtins/130/greaterThan delete mode 100644 src/glsl/builtins/130/greaterThanEqual delete mode 100644 src/glsl/builtins/130/lessThan delete mode 100644 src/glsl/builtins/130/lessThanEqual delete mode 100644 src/glsl/builtins/130/max delete mode 100644 src/glsl/builtins/130/min delete mode 100644 src/glsl/builtins/130/mix delete mode 100644 src/glsl/builtins/130/notEqual delete mode 100644 src/glsl/builtins/130/sign delete mode 100644 src/glsl/builtins/130/sinh delete mode 100644 src/glsl/builtins/130/tanh delete mode 100644 src/glsl/builtins/130/texelFetch delete mode 100644 src/glsl/builtins/130/texture delete mode 100644 src/glsl/builtins/130/textureGrad delete mode 100644 src/glsl/builtins/130/textureLod delete mode 100644 src/glsl/builtins/130/textureProj delete mode 100644 src/glsl/builtins/130/textureProjGrad delete mode 100644 src/glsl/builtins/130/textureProjLod delete mode 100644 src/glsl/builtins/130_fs/texture delete mode 100644 src/glsl/builtins/130_fs/textureProj delete mode 100644 src/glsl/builtins/ARB_texture_rectangle/textures delete mode 100644 src/glsl/builtins/EXT_texture_array/textures delete mode 100644 src/glsl/builtins/EXT_texture_array_fs/textures create mode 100644 src/glsl/builtins/ir/abs create mode 100644 src/glsl/builtins/ir/acos create mode 100644 src/glsl/builtins/ir/all create mode 100644 src/glsl/builtins/ir/any create mode 100644 src/glsl/builtins/ir/asin create mode 100644 src/glsl/builtins/ir/atan create mode 100644 src/glsl/builtins/ir/ceil create mode 100644 src/glsl/builtins/ir/clamp create mode 100644 src/glsl/builtins/ir/cos create mode 100644 src/glsl/builtins/ir/cosh create mode 100644 src/glsl/builtins/ir/cross create mode 100644 src/glsl/builtins/ir/dFdx create mode 100644 src/glsl/builtins/ir/dFdy create mode 100644 src/glsl/builtins/ir/degrees create mode 100644 src/glsl/builtins/ir/distance create mode 100644 src/glsl/builtins/ir/dot create mode 100644 src/glsl/builtins/ir/equal create mode 100644 src/glsl/builtins/ir/exp create mode 100644 src/glsl/builtins/ir/exp2 create mode 100644 src/glsl/builtins/ir/faceforward create mode 100644 src/glsl/builtins/ir/floor create mode 100644 src/glsl/builtins/ir/fract create mode 100644 src/glsl/builtins/ir/ftransform create mode 100644 src/glsl/builtins/ir/fwidth create mode 100644 src/glsl/builtins/ir/greaterThan create mode 100644 src/glsl/builtins/ir/greaterThanEqual create mode 100644 src/glsl/builtins/ir/inversesqrt create mode 100644 src/glsl/builtins/ir/length create mode 100644 src/glsl/builtins/ir/lessThan create mode 100644 src/glsl/builtins/ir/lessThanEqual create mode 100644 src/glsl/builtins/ir/log create mode 100644 src/glsl/builtins/ir/log2 create mode 100644 src/glsl/builtins/ir/matrixCompMult create mode 100644 src/glsl/builtins/ir/max create mode 100644 src/glsl/builtins/ir/min create mode 100644 src/glsl/builtins/ir/mix create mode 100644 src/glsl/builtins/ir/mod create mode 100644 src/glsl/builtins/ir/noise1 create mode 100644 src/glsl/builtins/ir/noise2 create mode 100644 src/glsl/builtins/ir/noise3 create mode 100644 src/glsl/builtins/ir/noise4 create mode 100644 src/glsl/builtins/ir/normalize create mode 100644 src/glsl/builtins/ir/not create mode 100644 src/glsl/builtins/ir/notEqual create mode 100644 src/glsl/builtins/ir/outerProduct create mode 100644 src/glsl/builtins/ir/pow create mode 100644 src/glsl/builtins/ir/radians create mode 100644 src/glsl/builtins/ir/reflect create mode 100644 src/glsl/builtins/ir/refract create mode 100644 src/glsl/builtins/ir/sign create mode 100644 src/glsl/builtins/ir/sin create mode 100644 src/glsl/builtins/ir/sinh create mode 100644 src/glsl/builtins/ir/smoothstep create mode 100644 src/glsl/builtins/ir/sqrt create mode 100644 src/glsl/builtins/ir/step create mode 100644 src/glsl/builtins/ir/tan create mode 100644 src/glsl/builtins/ir/tanh create mode 100644 src/glsl/builtins/ir/transpose create mode 100644 src/glsl/builtins/profiles/110.frag create mode 100644 src/glsl/builtins/profiles/110.vert create mode 100644 src/glsl/builtins/profiles/120.frag create mode 100644 src/glsl/builtins/profiles/120.vert create mode 100644 src/glsl/builtins/profiles/ARB_texture_rectangle.frag create mode 100644 src/glsl/builtins/profiles/ARB_texture_rectangle.vert create mode 100644 src/glsl/builtins/profiles/EXT_texture_array.frag create mode 100644 src/glsl/builtins/profiles/EXT_texture_array.vert create mode 100644 src/glsl/builtins/tools/builtin_function.cpp delete mode 100755 src/glsl/builtins/tools/generate_builtins.pl create mode 100755 src/glsl/builtins/tools/generate_builtins.py (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 110228e72a..b13a612591 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -164,7 +164,8 @@ glcpp/glcpp-lex.c: glcpp/glcpp-lex.l glcpp/glcpp-parse.c: glcpp/glcpp-parse.y bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< -builtin_function.cpp: builtins/*/* - ./builtins/tools/generate_builtins.pl > builtin_function.cpp +builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py + cp builtins/tools/builtin_function.cpp . + ./builtins/tools/generate_builtins.py > builtin_function.cpp -include depend diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 1d9a58a5ca..f2abea961d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1,4 +1,4 @@ -/* DO NOT MODIFY - automatically generated by generate_builtins.pl */ +/* DO NOT MODIFY - automatically generated by generate_builtins.py */ /* * Copyright © 2010 Intel Corporation * @@ -27,12 +27,13 @@ #include "glsl_parser_extras.h" #include "ir_reader.h" #include "program.h" +#include "ast.h" extern "C" struct gl_shader * _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); gl_shader * -read_builtins(GLenum target, const char **functions, unsigned count) +read_builtins(GLenum target, const char *protos, const char **functions, unsigned count) { gl_shader *sh = _mesa_new_shader(NULL, 0, target); struct _mesa_glsl_parse_state *st = @@ -46,13 +47,19 @@ read_builtins(GLenum target, const char **functions, unsigned count) sh->ir = new(sh) exec_list; sh->symbols = st->symbols; + /* Read the IR containing the prototypes */ + _mesa_glsl_read_ir(st, sh->ir, protos, true); + + /* Read ALL the function bodies, telling the IR reader not to scan for + * prototypes (we've already created them). The IR reader will skip any + * signature that does not already exist as a prototype. + */ for (unsigned i = 0; i < count; i++) { - _mesa_glsl_read_ir(st, sh->ir, functions[i]); + _mesa_glsl_read_ir(st, sh->ir, functions[i], false); if (st->error) { - printf("error reading builtin: %.35s ...\n", functions[i]); - delete st; - talloc_free(sh); + printf("error reading builtin: %.35s ...\n", functions[i]); + talloc_free(sh); return NULL; } } @@ -63,33 +70,7 @@ read_builtins(GLenum target, const char **functions, unsigned count) return sh; } -/* 110 builtins */ - -static const char *builtins_110_abs = { - "((function abs\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float abs (var_ref arg0)))))\n" - "\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 abs (var_ref arg0)))))\n" - "\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 abs (var_ref arg0)))))\n" - "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 abs (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_all = { +static const char *builtin_all = "((function all\n" " (signature bool\n" " (parameters\n" @@ -106,2498 +87,2450 @@ static const char *builtins_110_all = { " (declare (in) bvec4 arg0))\n" " ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" "))\n" -}; - -static const char *builtins_110_any = { - "((function any\n" - " (signature bool\n" + "" +; +static const char *builtin_textureProj = + "((function textureProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) bvec2 arg0))\n" - " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" "\n" - " (signature bool\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) bvec3 arg0))\n" - " ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" "\n" - " (signature bool\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) bvec4 arg0))\n" - " ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" - "))\n" -}; - -static const char *builtins_110_asin = { - "((function asin\n" - " (signature float\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (expression float *\n" - " (expression float sign (var_ref x))\n" - " (expression float -\n" - " (expression float *\n" - " (constant float (3.1415926))\n" - " (constant float (0.5)))\n" - " (expression float *\n" - " (expression float sqrt\n" - " (expression float -\n" - " (constant float (1.0))\n" - " (expression float abs (var_ref x))))\n" - " (expression float +\n" - " (constant float (1.5707288))\n" - " (expression float *\n" - " (expression float abs (var_ref x))\n" - " (expression float +\n" - " (constant float (-0.2121144))\n" - " (expression float *\n" - " (constant float (0.0742610))\n" - " (expression float abs (var_ref x))))))))))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 *\n" - " (expression vec2 sign (var_ref x))\n" - " (expression vec2 -\n" - " (expression float *\n" - " (constant float (3.1415926))\n" - " (constant float (0.5)))\n" - " (expression vec2 *\n" - " (expression vec2 sqrt\n" - " (expression vec2 -\n" - " (constant float (1.0))\n" - " (expression vec2 abs (var_ref x))))\n" - " (expression vec2 +\n" - " (constant float (1.5707288))\n" - " (expression vec2 *\n" - " (expression vec2 abs (var_ref x))\n" - " (expression vec2 +\n" - " (constant float (-0.2121144))\n" - " (expression vec2 *\n" - " (constant float (0.0742610))\n" - " (expression vec2 abs (var_ref x))))))))))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 *\n" - " (expression vec3 sign (var_ref x))\n" - " (expression vec3 -\n" - " (expression float *\n" - " (constant float (3.1415926))\n" - " (constant float (0.5)))\n" - " (expression vec3 *\n" - " (expression vec3 sqrt\n" - " (expression vec3 -\n" - " (constant float (1.0))\n" - " (expression vec3 abs (var_ref x))))\n" - " (expression vec3 +\n" - " (constant float (1.5707288))\n" - " (expression vec3 *\n" - " (expression vec3 abs (var_ref x))\n" - " (expression vec3 +\n" - " (constant float (-0.2121144))\n" - " (expression vec3 *\n" - " (constant float (0.0742610))\n" - " (expression vec3 abs (var_ref x))))))))))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 *\n" - " (expression vec4 sign (var_ref x))\n" - " (expression vec4 -\n" - " (expression float *\n" - " (constant float (3.1415926))\n" - " (constant float (0.5)))\n" - " (expression vec4 *\n" - " (expression vec4 sqrt\n" - " (expression vec4 -\n" - " (constant float (1.0))\n" - " (expression vec4 abs (var_ref x))))\n" - " (expression vec4 +\n" - " (constant float (1.5707288))\n" - " (expression vec4 *\n" - " (expression vec4 abs (var_ref x))\n" - " (expression vec4 +\n" - " (constant float (-0.2121144))\n" - " (expression vec4 *\n" - " (constant float (0.0742610))\n" - " (expression vec4 abs (var_ref x)))))))))))\n" - "))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" "\n" - " (function acos\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (expression float - (constant float (1.5707963))\n" - " (call asin ((var_ref x)))))))\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 - (constant float (1.5707963))\n" - " (call asin ((var_ref x)))))))\n" - " (signature vec3\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 - (constant float (1.5707963))\n" - " (call asin ((var_ref x)))))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 - (constant float (1.5707963))\n" - " (call asin ((var_ref x)))))))\n" - "))\n" -}; - -static const char *builtins_110_atan = { - "((function atan\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (call asin ((expression float *\n" - " (var_ref x)\n" - " (expression float rsq\n" - " (expression float +\n" - " (expression float *\n" - " (var_ref x)\n" - " (var_ref x))\n" - " (constant float (1.0))))))))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 y_over_x))\n" - " ((return (call asin ((expression vec2 *\n" - " (var_ref y_over_x)\n" - " (expression vec2 rsq\n" - " (expression vec2 +\n" - " (expression vec2 *\n" - " (var_ref y_over_x)\n" - " (var_ref y_over_x))\n" - " (constant float (1.0))))))))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 y_over_x))\n" - " ((return (call asin ((expression vec3 *\n" - " (var_ref y_over_x)\n" - " (expression vec3 rsq\n" - " (expression vec3 +\n" - " (expression vec3 *\n" - " (var_ref y_over_x)\n" - " (var_ref y_over_x))\n" - " (constant float (1.0))))))))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 y_over_x))\n" - " ((return (call asin ((expression vec4 *\n" - " (var_ref y_over_x)\n" - " (expression vec4 rsq\n" - " (expression vec4 +\n" - " (expression vec4 *\n" - " (var_ref y_over_x)\n" - " (var_ref y_over_x))\n" - " (constant float (1.0))))))))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature float\n" - " (parameters\n" - " (declare (in ) float y)\n" - " (declare (in ) float x)\n" - " )\n" - " (\n" - " (declare () float r)\n" - " (declare ( ) float abs_retval)\n" - " (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))\n" - ") \n" - " (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (\n" - " (declare ( ) float atan_retval)\n" - " (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n" - ") \n" - " (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) \n" - " (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n" - " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" - " (declare ( ) float assignment_tmp)\n" - " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) \n" - " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" - " )\n" - " (\n" - " (declare ( ) float assignment_tmp)\n" - " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) \n" - " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" - " ))\n" - "\n" - " )\n" - " (\n" - " ))\n" - "\n" - " )\n" - " (\n" - " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" - " (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) \n" - " )\n" - " (\n" - " (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) \n" - " ))\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " ))\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (return (var_ref r) )\n" - " ))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 y)\n" - " (declare (in) vec2 x))\n" - " ((declare () vec2 r)\n" - " (assign (constant bool (1))\n" - " (swiz x (var_ref r))\n" - " (call atan ((swiz x (var_ref y))\n" - " (swiz x (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz y (var_ref r))\n" - " (call atan ((swiz y (var_ref y))\n" - " (swiz y (var_ref x)))))\n" - " (return (var_ref r))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 y)\n" - " (declare (in) vec3 x))\n" - " ((declare () vec3 r)\n" - " (assign (constant bool (1))\n" - " (swiz x (var_ref r))\n" - " (call atan ((swiz x (var_ref y))\n" - " (swiz x (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz y (var_ref r))\n" - " (call atan ((swiz y (var_ref y))\n" - " (swiz y (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz z (var_ref r))\n" - " (call atan ((swiz z (var_ref y))\n" - " (swiz z (var_ref x)))))\n" - " (return (var_ref r))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 y)\n" - " (declare (in) vec4 x))\n" - " ((declare () vec4 r)\n" - " (assign (constant bool (1))\n" - " (swiz x (var_ref r))\n" - " (call atan ((swiz x (var_ref y))\n" - " (swiz x (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz y (var_ref r))\n" - " (call atan ((swiz y (var_ref y))\n" - " (swiz y (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz z (var_ref r))\n" - " (call atan ((swiz z (var_ref y))\n" - " (swiz z (var_ref x)))))\n" - " (assign (constant bool (1))\n" - " (swiz w (var_ref r))\n" - " (call atan ((swiz w (var_ref y))\n" - " (swiz w (var_ref x)))))\n" - " (return (var_ref r)))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - "))\n" -}; - -static const char *builtins_110_ceil = { - "((function ceil\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float ceil (var_ref arg0)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 ceil (var_ref arg0)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 ceil (var_ref arg0)))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 ceil (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_clamp = { - "((function clamp\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1)\n" - " (declare (in) vec2 arg2))\n" - " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1)\n" - " (declare (in) vec3 arg2))\n" - " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1)\n" - " (declare (in) vec4 arg2))\n" - " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) float arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) float arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) float arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "))\n" -}; - -static const char *builtins_110_cos = { - "((function cos\n" + "" +; +static const char *builtin_fwidth = + "((function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in) float angle))\n" - " ((return (expression float cos (var_ref angle)))))\n" + " (declare (in) float p))\n" + " ((return (expression float +\n" + " (expression float abs (expression float dFdx (var_ref p)))\n" + " (expression float abs (expression float dFdy (var_ref p)))))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 angle))\n" - " ((return (expression vec2 cos (var_ref angle)))))\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 +\n" + " (expression vec2 abs (expression vec2 dFdx (var_ref p)))\n" + " (expression vec2 abs (expression vec2 dFdy (var_ref p)))))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 angle))\n" - " ((return (expression vec3 cos (var_ref angle)))))\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 +\n" + " (expression vec3 abs (expression vec3 dFdx (var_ref p)))\n" + " (expression vec3 abs (expression vec3 dFdy (var_ref p)))))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ((return (expression vec4 cos (var_ref angle)))))\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 +\n" + " (expression vec4 abs (expression vec4 dFdx (var_ref p)))\n" + " (expression vec4 abs (expression vec4 dFdy (var_ref p)))))))\n" "))\n" -}; - -static const char *builtins_110_cross = { - "((function cross\n" - " (signature vec3\n" + "" +; +static const char *builtin_texture2DProj = + "((function texture2DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_110_degrees = { - "((function degrees\n" - " (signature float\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_shadow1DProjLod = + "((function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_110_distance = { - "((function distance\n" - " (signature float\n" + "" +; +static const char *builtin_texture3DLod = + "((function texture3DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float p0)\n" - " (declare (in) float p1))\n" - " ((declare () float p)\n" - " (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))\n" - " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature float\n" + "))\n" + "" +; +static const char *builtin_textureCubeLod = + "((function textureCubeLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 p0)\n" - " (declare (in) vec2 p1))\n" - " ((declare () vec2 p)\n" - " (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n" - " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature float\n" + "))\n" + "" +; +static const char *builtin_texture = + "((function texture\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 p0)\n" - " (declare (in) vec3 p1))\n" - " ((declare () vec3 p)\n" - " (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n" - " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 p0)\n" - " (declare (in) vec4 p1))\n" - " ((declare () vec4 p)\n" - " (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n" - " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" - "))\n" -}; - -static const char *builtins_110_dot = { - "((function dot\n" - " (signature float\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature float\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_110_equal = { - "((function equal\n" - " (signature bvec2\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_110_exp = { - "((function exp\n" - " (signature float\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float exp (var_ref arg0)))))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 exp (var_ref arg0)))))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 exp (var_ref arg0)))))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 exp (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_exp2 = { - "((function exp2\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float exp2 (var_ref arg0)))))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 exp2 (var_ref arg0)))))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 exp2 (var_ref arg0)))))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 exp2 (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_faceforward = { - "((function faceforward\n" - " (signature float\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float N)\n" - " (declare (in) float I)\n" - " (declare (in) float Nref))\n" - " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" - " ((return (var_ref N)))\n" - " ((return (expression float neg (var_ref N)))))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" - " (signature vec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 N)\n" - " (declare (in) vec2 I)\n" - " (declare (in) vec2 Nref))\n" - " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" - " ((return (var_ref N)))\n" - " ((return (expression vec2 neg (var_ref N)))))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 N)\n" - " (declare (in) vec3 I)\n" - " (declare (in) vec3 Nref))\n" - " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" - " ((return (var_ref N)))\n" - " ((return (expression vec3 neg (var_ref N)))))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 N)\n" - " (declare (in) vec4 I)\n" - " (declare (in) vec4 Nref))\n" - " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" - " ((return (var_ref N)))\n" - " ((return (expression vec4 neg (var_ref N)))))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_110_floor = { - "((function floor\n" + "" +; +static const char *builtin_degrees = + "((function degrees\n" " (signature float\n" " (parameters\n" " (declare (in) float arg0))\n" - " ((return (expression float floor (var_ref arg0)))))\n" + " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 floor (var_ref arg0)))))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 floor (var_ref arg0)))))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 floor (var_ref arg0)))))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" "))\n" -}; - -static const char *builtins_110_fract = { - "((function fract\n" + "" +; +static const char *builtin_texture2DArrayLod = + "((function texture2DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_ceil = + "((function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (expression float fract (var_ref x)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float ceil (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 fract (var_ref x)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 ceil (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 fract (var_ref x)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 ceil (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 fract (var_ref x)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 ceil (var_ref arg0)))))\n" "))\n" - "\n" -}; - -static const char *builtins_110_greaterThan = { - "((function greaterThan\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "\n" - " (signature bvec3\n" + "" +; +static const char *builtin_texture1D = + "((function texture1D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_not = + "((function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bvec2 ! (var_ref arg0)))))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bvec3 ! (var_ref arg0)))))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bvec4 ! (var_ref arg0)))))\n" "))\n" -}; - -static const char *builtins_110_greaterThanEqual = { - "((function greaterThanEqual\n" - " (signature bvec2\n" + "" +; +static const char *builtin_texture2DRectProj = + "((function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_mod = + "((function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" " (parameters\n" " (declare (in) vec2 arg0)\n" " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0)\n" " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0)\n" " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" "))\n" -}; - -static const char *builtins_110_inversesqrt = { - "((function inversesqrt\n" + "" +; +static const char *builtin_radians = + "((function radians\n" " (signature float\n" " (parameters\n" " (declare (in) float arg0))\n" - " ((return (expression float rsq (var_ref arg0)))))\n" + " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 rsq (var_ref arg0)))))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 rsq (var_ref arg0)))))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 rsq (var_ref arg0)))))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" "))\n" -}; - -static const char *builtins_110_length = { - "((function length\n" + "" +; +static const char *builtin_smoothstep = + "((function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ((declare () float t)\n" "\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + " (assign (constant bool (1)) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n" "\n" - " (signature float\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (declare () vec2 retval)\n" "\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" - "))\n" -}; - -static const char *builtins_110_lessThan = { - "((function lessThan\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" "\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" "\n" - " (signature bvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (declare () vec3 retval)\n" "\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" "\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_110_lessThanEqual = { - "((function lessThanEqual\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" "\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" "\n" - " (signature bvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (declare () vec4 retval)\n" "\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz x (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" "\n" - " (signature bvec3\n" - " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_110_log = { - "((function log\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float log (var_ref arg0)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (swiz w (var_ref t))\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 log (var_ref arg0)))))\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 max\n" + " (expression vec2 min\n" + " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec2 (1.0 1.0)))\n" + " (constant vec2 (0.0 0.0))))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 log (var_ref arg0)))))\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 max\n" + " (expression vec3 min\n" + " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec3 (1.0 1.0 1.0)))\n" + " (constant vec3 (0.0 0.0 0.0))))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 log (var_ref arg0)))))\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 max\n" + " (expression vec4 min\n" + " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec4 (1.0 1.0 1.0 1.0)))\n" + " (constant vec4 (0.0 0.0 0.0 0.0))))))\n" "))\n" -}; - -static const char *builtins_110_log2 = { - "((function log2\n" - " (signature float\n" + "\n" + "" +; +static const char *builtin_textureProjGrad = + "((function textureProjGrad\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float log2 (var_ref arg0)))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 log2 (var_ref arg0)))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 log2 (var_ref arg0)))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 log2 (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_matrixCompMult = { - "((function matrixCompMult\n" - " (signature mat2\n" - " (parameters\n" - " (declare (in) mat2 x)\n" - " (declare (in) mat2 y))\n" - " ((declare () mat2 z)\n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" - "(return (var_ref z))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3 x)\n" - " (declare (in) mat3 y))\n" - " ((declare () mat3 z)\n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" - "(return (var_ref z))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4 x)\n" - " (declare (in) mat4 y))\n" - " ((declare () mat4 z)\n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" - " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" - "(return (var_ref z))))\n" - "))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" -}; - -static const char *builtins_110_max = { - "((function max\n" - " (signature float\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_110_min = { - "((function min\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec4\n" + "))\n" + "" +; +static const char *builtin_dFdx = + "((function dFdx\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) float p))\n" + " ((return (expression float dFdx (var_ref p)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdx (var_ref p)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdx (var_ref p)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdx (var_ref p)))))\n" "))\n" -}; - -static const char *builtins_110_mix = { - "((function mix\n" + "" +; +static const char *builtin_dFdy = + "((function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) float p))\n" + " ((return (expression float dFdy (var_ref p)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1)\n" - " (declare (in) vec2 arg2))\n" - " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdy (var_ref p)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1)\n" - " (declare (in) vec3 arg2))\n" - " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdy (var_ref p)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1)\n" - " (declare (in) vec4 arg2))\n" - " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdy (var_ref p)))))\n" + "))\n" + "" +; +static const char *builtin_textureGrad = + "((function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1)\n" - " (declare (in) float arg2))\n" - " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" - "))\n" -}; - -static const char *builtins_110_mod = { - "((function mod\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_110_noise_fake = { - "((function noise1\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant float (0)))))\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (constant float (0)))))\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (constant float (0)))))\n" - " (signature float\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (constant float (0)))))\n" - " )\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (function noise2\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant vec2 (0 0)))))\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (constant vec2 (0 0)))))\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (constant vec2 (0 0)))))\n" - " (signature vec2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (constant vec2 (0 0)))))\n" - " )\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (function noise3\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (constant vec3 (0 0 0)))))\n" - " )\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" "\n" - " (function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (constant vec4 (0 0 0 0)))))\n" - " (signature vec4\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (constant vec4 (0 0 0 0)))))\n" - " (signature vec4\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (constant vec4 (0 0 0 0)))))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (constant vec4 (0 0 0 0)))))\n" - " )\n" - ")\n" -}; - -static const char *builtins_110_normalize = { - "((function normalize\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_clamp = + "((function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" - "))\n" -}; - -static const char *builtins_110_not = { - "((function not\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) bvec2 arg0))\n" - " ((return (expression bvec2 ! (var_ref arg0)))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) bvec3 arg0))\n" - " ((return (expression bvec3 ! (var_ref arg0)))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) bvec4 arg0))\n" - " ((return (expression bvec4 ! (var_ref arg0)))))\n" - "))\n" -}; - -static const char *builtins_110_notEqual = { - "((function notEqual\n" - " (signature bvec2\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec2\n" + " (signature ivec2\n" " (parameters\n" " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " (declare (in) ivec2 arg1)\n" + " (declare (in) ivec2 arg2))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec3\n" + " (signature ivec3\n" " (parameters\n" " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (return (var_ref temp))))\n" + " (declare (in) ivec3 arg1)\n" + " (declare (in) ivec3 arg2))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_110_pow = { - "((function pow\n" - " (signature float\n" + " (declare (in) ivec4 arg1)\n" + " (declare (in) ivec4 arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) float arg0)\n" - " (declare (in) float arg1))\n" - " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec2\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) vec2 arg0)\n" - " (declare (in) vec2 arg1))\n" - " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 arg0)\n" - " (declare (in) vec3 arg1))\n" - " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) vec4 arg0)\n" - " (declare (in) vec4 arg1))\n" - " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_110_radians = { - "((function radians\n" - " (signature float\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1)\n" + " (declare (in) uvec2 arg2))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec2\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1)\n" + " (declare (in) uvec3 arg2))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1)\n" + " (declare (in) uvec4 arg2))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" - "))\n" -}; - -static const char *builtins_110_reflect = { - "((function reflect\n" - " (signature float\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) float i)\n" - " (declare (in) float n))\n" - " ((return (expression float -\n" - " (var_ref i)\n" - " (expression float *\n" - " (constant float (2.0))\n" - " (expression float *\n" - " (expression float dot\n" - " (var_ref n)\n" - " (var_ref i))\n" - " (var_ref n)))))))\n" - "\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 i)\n" - " (declare (in) vec2 n))\n" - " ((return (expression vec2 -\n" - " (var_ref i)\n" - " (expression vec2 *\n" - " (constant float (2.0))\n" - " (expression vec2 *\n" - " (expression float dot\n" - " (var_ref n)\n" - " (var_ref i))\n" - " (var_ref n)))))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" "\n" - " (signature vec3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec3 i)\n" - " (declare (in) vec3 n))\n" - " ((return (expression vec3 -\n" - " (var_ref i)\n" - " (expression vec3 *\n" - " (constant float (2.0))\n" - " (expression vec3 *\n" - " (expression float dot\n" - " (var_ref n)\n" - " (var_ref i))\n" - " (var_ref n)))))))\n" - "\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_texture2DRect = + "((function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 i)\n" - " (declare (in) vec4 n))\n" - " ((return (expression vec4 -\n" - " (var_ref i)\n" - " (expression vec4 *\n" - " (constant float (2.0))\n" - " (expression vec4 *\n" - " (expression float dot\n" - " (var_ref n)\n" - " (var_ref i))\n" - " (var_ref n)))))))\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" "))\n" -}; - -static const char *builtins_110_refract = { - "((function refract\n" + "" +; +static const char *builtin_cosh = + "((function cosh\n" " (signature float\n" " (parameters\n" - " (declare (in) float i)\n" - " (declare (in) float n)\n" - " (declare (in) float eta))\n" - " ((declare () float k)\n" - " (assign (constant bool (1)) (var_ref k)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * (var_ref eta)\n" - " (expression float * (var_ref eta)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * \n" - " (expression float dot (var_ref n) (var_ref i))\n" - " (expression float dot (var_ref n) (var_ref i))))))))\n" - " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant float (0.0))))\n" - " ((return (expression float -\n" - " (expression float * (var_ref eta) (var_ref i))\n" - " (expression float *\n" - " (expression float +\n" - " (expression float * (var_ref eta)\n" - " (expression float dot (var_ref n) (var_ref i)))\n" - " (expression float sqrt (var_ref k)))\n" - " (var_ref n))))))))\n" - "\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 i)\n" - " (declare (in) vec2 n)\n" - " (declare (in) float eta))\n" - " ((declare () float k)\n" - " (assign (constant bool (1)) (var_ref k)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * (var_ref eta)\n" - " (expression float * (var_ref eta)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * \n" - " (expression float dot (var_ref n) (var_ref i))\n" - " (expression float dot (var_ref n) (var_ref i))))))))\n" - " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec2 (0.0 0.0))))\n" - " ((return (expression vec2 -\n" - " (expression vec2 * (var_ref eta) (var_ref i))\n" - " (expression vec2 *\n" - " (expression float +\n" - " (expression float * (var_ref eta)\n" - " (expression float dot (var_ref n) (var_ref i)))\n" - " (expression float sqrt (var_ref k)))\n" - " (var_ref n))))))))\n" - "\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 i)\n" - " (declare (in) vec3 n)\n" - " (declare (in) float eta))\n" - " ((declare () float k)\n" - " (assign (constant bool (1)) (var_ref k)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * (var_ref eta)\n" - " (expression float * (var_ref eta)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * \n" - " (expression float dot (var_ref n) (var_ref i))\n" - " (expression float dot (var_ref n) (var_ref i))))))))\n" - " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec3 (0.0 0.0 0.0))))\n" - " ((return (expression vec3 -\n" - " (expression vec3 * (var_ref eta) (var_ref i))\n" - " (expression vec3 *\n" - " (expression float +\n" - " (expression float * (var_ref eta)\n" - " (expression float dot (var_ref n) (var_ref i)))\n" - " (expression float sqrt (var_ref k)))\n" - " (var_ref n))))))))\n" - "\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 i)\n" - " (declare (in) vec4 n)\n" - " (declare (in) float eta))\n" - " ((declare () float k)\n" - " (assign (constant bool (1)) (var_ref k)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * (var_ref eta)\n" - " (expression float * (var_ref eta)\n" - " (expression float - (constant float (1.0))\n" - " (expression float * \n" - " (expression float dot (var_ref n) (var_ref i))\n" - " (expression float dot (var_ref n) (var_ref i))))))))\n" - " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n" - " ((return (expression vec4 -\n" - " (expression vec4 * (var_ref eta) (var_ref i))\n" - " (expression vec4 *\n" - " (expression float +\n" - " (expression float * (var_ref eta)\n" - " (expression float dot (var_ref n) (var_ref i)))\n" - " (expression float sqrt (var_ref k)))\n" - " (var_ref n))))))))\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_texture1DArrayLod = + "((function texture1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" "))\n" -}; - -static const char *builtins_110_sign = { - "((function sign\n" + "" +; +static const char *builtin_asin = + "((function asin\n" " (signature float\n" " (parameters\n" " (declare (in) float x))\n" - " ((return (expression float sign (var_ref x)))))\n" + " ((return (expression float *\n" + " (expression float sign (var_ref x))\n" + " (expression float -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression float *\n" + " (expression float sqrt\n" + " (expression float -\n" + " (constant float (1.0))\n" + " (expression float abs (var_ref x))))\n" + " (expression float +\n" + " (constant float (1.5707288))\n" + " (expression float *\n" + " (expression float abs (var_ref x))\n" + " (expression float +\n" + " (constant float (-0.2121144))\n" + " (expression float *\n" + " (constant float (0.0742610))\n" + " (expression float abs (var_ref x))))))))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" - " ((return (expression vec2 sign (var_ref x)))))\n" + " ((return (expression vec2 *\n" + " (expression vec2 sign (var_ref x))\n" + " (expression vec2 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec2 *\n" + " (expression vec2 sqrt\n" + " (expression vec2 -\n" + " (constant float (1.0))\n" + " (expression vec2 abs (var_ref x))))\n" + " (expression vec2 +\n" + " (constant float (1.5707288))\n" + " (expression vec2 *\n" + " (expression vec2 abs (var_ref x))\n" + " (expression vec2 +\n" + " (constant float (-0.2121144))\n" + " (expression vec2 *\n" + " (constant float (0.0742610))\n" + " (expression vec2 abs (var_ref x))))))))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" - " ((return (expression vec3 sign (var_ref x)))))\n" + " ((return (expression vec3 *\n" + " (expression vec3 sign (var_ref x))\n" + " (expression vec3 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec3 *\n" + " (expression vec3 sqrt\n" + " (expression vec3 -\n" + " (constant float (1.0))\n" + " (expression vec3 abs (var_ref x))))\n" + " (expression vec3 +\n" + " (constant float (1.5707288))\n" + " (expression vec3 *\n" + " (expression vec3 abs (var_ref x))\n" + " (expression vec3 +\n" + " (constant float (-0.2121144))\n" + " (expression vec3 *\n" + " (constant float (0.0742610))\n" + " (expression vec3 abs (var_ref x))))))))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ((return (expression vec4 sign (var_ref x)))))\n" - "))\n" -}; - -static const char *builtins_110_sin = { - "((function sin\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float angle))\n" - " ((return (expression float sin (var_ref angle)))))\n" + " ((return (expression vec4 *\n" + " (expression vec4 sign (var_ref x))\n" + " (expression vec4 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec4 *\n" + " (expression vec4 sqrt\n" + " (expression vec4 -\n" + " (constant float (1.0))\n" + " (expression vec4 abs (var_ref x))))\n" + " (expression vec4 +\n" + " (constant float (1.5707288))\n" + " (expression vec4 *\n" + " (expression vec4 abs (var_ref x))\n" + " (expression vec4 +\n" + " (constant float (-0.2121144))\n" + " (expression vec4 *\n" + " (constant float (0.0742610))\n" + " (expression vec4 abs (var_ref x))))))))))))\n" + "))\n" + "" +; +static const char *builtin_texture1DProj = + "((function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" "\n" - " (signature vec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 angle))\n" - " ((return (expression vec2 sin (var_ref angle)))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 angle))\n" - " ((return (expression vec3 sin (var_ref angle)))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ((return (expression vec4 sin (var_ref angle)))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_110_smoothstep = { - "((function smoothstep\n" - " (signature float\n" + "" +; +static const char *builtin_lessThan = + "((function lessThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) float x))\n" - " ((declare () float t)\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec2\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (declare () vec2 retval)\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec3\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (declare () vec3 retval)\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (assign (constant bool (1)) (swiz z (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" + "" +; +static const char *builtin_shadow2DProj = + "((function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_textureLod = + "((function textureLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge0)\n" - " (declare (in) float edge1)\n" - " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (declare () vec4 retval)\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (assign (constant bool (1)) (swiz x (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (assign (constant bool (1)) (swiz y (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (assign (constant bool (1)) (swiz z (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (assign (constant bool (1)) (swiz w (var_ref t))\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature vec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 edge0)\n" - " (declare (in) vec2 edge1)\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 max\n" - " (expression vec2 min\n" - " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec2 (1.0 1.0)))\n" - " (constant vec2 (0.0 0.0))))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 edge0)\n" - " (declare (in) vec3 edge1)\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 max\n" - " (expression vec3 min\n" - " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec3 (1.0 1.0 1.0)))\n" - " (constant vec3 (0.0 0.0 0.0))))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge0)\n" - " (declare (in) vec4 edge1)\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 max\n" - " (expression vec4 min\n" - " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec4 (1.0 1.0 1.0 1.0)))\n" - " (constant vec4 (0.0 0.0 0.0 0.0))))))\n" - "))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" -}; - -static const char *builtins_110_sqrt = { - "((function sqrt\n" - " (signature float\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) float arg0))\n" - " ((return (expression float sqrt (var_ref arg0)))))\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature vec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec2 arg0))\n" - " ((return (expression vec2 sqrt (var_ref arg0)))))\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature vec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 arg0))\n" - " ((return (expression vec3 sqrt (var_ref arg0)))))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 arg0))\n" - " ((return (expression vec4 sqrt (var_ref arg0)))))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_110_step = { - "((function step\n" + "" +; +static const char *builtin_faceforward = + "((function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) float x))\n" - " ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression float neg (var_ref N)))))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec2 neg (var_ref N)))))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec3 neg (var_ref N)))))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) float edge)\n" - " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec4 neg (var_ref N)))))))\n" + "))\n" + "" +; +static const char *builtin_abs = + "((function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float abs (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 edge)\n" - " (declare (in) vec2 x))\n" - " ((declare () vec2 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 abs (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 edge)\n" - " (declare (in) vec3 x))\n" - " ((declare () vec3 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 abs (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 edge)\n" - " (declare (in) vec4 x))\n" - " ((declare () vec4 t)\n" - " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))\n" - " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" - " (return (var_ref t))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 abs (var_ref arg0)))))\n" "))\n" - "\n" -}; - -static const char *builtins_110_tan = { - "((function tan\n" + "" +; +static const char *builtin_log2 = + "((function log2\n" " (signature float\n" " (parameters\n" - " (declare (in) float angle))\n" - " ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float log2 (var_ref arg0)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 angle))\n" - " ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log2 (var_ref arg0)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 angle))\n" - " ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log2 (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 angle))\n" - " ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log2 (var_ref arg0)))))\n" "))\n" -}; - -static const char *builtins_110_textures = { - "((function texture1D\n" + "" +; +static const char *builtin_shadow2DRect = + "((function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" - ")\n" - " (function texture1DLod\n" - " (signature vec4\n" + "))\n" + "" +; +static const char *builtin_lessThanEqual = + "((function lessThanEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture1DProj\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture1DProjLod\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture2D\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - "(function texture2DLod\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture2DProj\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" - "\n" - ")\n" - " (function texture2DProjLod\n" - " (signature vec4\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" + "" +; +static const char *builtin_transpose = + "((function transpose\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) mat2 m))\n" + " ((declare () mat2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" "\n" - " (signature vec4\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) mat2x3 m))\n" + " ((declare () mat3x2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function texture3D\n" - " (signature vec4\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) mat2x4 m))\n" + " ((declare () mat4x2 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function texture3DLod\n" - " (signature vec4\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) mat3x2 m))\n" + " ((declare () mat2x3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function texture3DProj\n" - " (signature vec4\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) mat3 m))\n" + " ((declare () mat3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function texture3DProjLod\n" - " (signature vec4\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) mat3x4 m))\n" + " ((declare () mat4x3 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function textureCube\n" - " (signature vec4\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) mat4x2 m))\n" + " ((declare () mat2x4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function textureCubeLod\n" - " (signature vec4\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) mat4x3 m))\n" + " ((declare () mat3x4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" "\n" - ")\n" - " (function shadow1D\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" - "\n" - ")\n" - " (function shadow1DLod\n" - " (signature vec4\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" - "\n" + " (declare (in) mat4 m))\n" + " ((declare () mat4 t)\n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" + " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) \n" + "(return (var_ref t))))\n" ")\n" - " (function shadow1DProj\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" "\n" ")\n" - " (function shadow1DProjLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" "\n" - ")\n" - " (function shadow2D\n" - " (signature vec4\n" + "" +; +static const char *builtin_step = + "((function step\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n" "\n" - ")\n" - " (function shadow2DLod\n" - " (signature vec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" "\n" - ")\n" - " (function shadow2DProj\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" "\n" - ")\n" - " (function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" - "\n" - "))\n" -}; - -static const char *functions_for_110 [] = { - builtins_110_abs, - builtins_110_all, - builtins_110_any, - builtins_110_asin, - builtins_110_atan, - builtins_110_ceil, - builtins_110_clamp, - builtins_110_cos, - builtins_110_cross, - builtins_110_degrees, - builtins_110_distance, - builtins_110_dot, - builtins_110_equal, - builtins_110_exp, - builtins_110_exp2, - builtins_110_faceforward, - builtins_110_floor, - builtins_110_fract, - builtins_110_greaterThan, - builtins_110_greaterThanEqual, - builtins_110_inversesqrt, - builtins_110_length, - builtins_110_lessThan, - builtins_110_lessThanEqual, - builtins_110_log, - builtins_110_log2, - builtins_110_matrixCompMult, - builtins_110_max, - builtins_110_min, - builtins_110_mix, - builtins_110_mod, - builtins_110_noise_fake, - builtins_110_normalize, - builtins_110_not, - builtins_110_notEqual, - builtins_110_pow, - builtins_110_radians, - builtins_110_reflect, - builtins_110_refract, - builtins_110_sign, - builtins_110_sin, - builtins_110_smoothstep, - builtins_110_sqrt, - builtins_110_step, - builtins_110_tan, - builtins_110_textures, -}; - -/* 110_fs builtins */ - -static const char *builtins_110_fs_derivatives = { - "((function dFdx\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float p))\n" - " ((return (expression float dFdx (var_ref p)))))\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" - " ((return (expression vec2 dFdx (var_ref p)))))\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (return (var_ref t))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" - " ((return (expression vec3 dFdx (var_ref p)))))\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" + " (return (var_ref t))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" - " ((return (expression vec4 dFdx (var_ref p)))))\n" - " )\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))\n" + " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "))\n" "\n" - " (function dFdy\n" + "" +; +static const char *builtin_sinh = + "((function sinh\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" - " ((return (expression float dFdy (var_ref p)))))\n" - "\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" - " ((return (expression vec2 dFdy (var_ref p)))))\n" - "\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" - " ((return (expression vec3 dFdy (var_ref p)))))\n" - "\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" - " ((return (expression vec4 dFdy (var_ref p)))))\n" - " )\n" - "\n" - " (function fwidth\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_cos = + "((function cos\n" " (signature float\n" " (parameters\n" - " (declare (in) float p))\n" - " ((return (expression float +\n" - " (expression float abs (expression float dFdx (var_ref p)))\n" - " (expression float abs (expression float dFdy (var_ref p)))))))\n" + " (declare (in) float angle))\n" + " ((return (expression float cos (var_ref angle)))))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 p))\n" - " ((return (expression vec2 +\n" - " (expression vec2 abs (expression vec2 dFdx (var_ref p)))\n" - " (expression vec2 abs (expression vec2 dFdy (var_ref p)))))))\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 cos (var_ref angle)))))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 p))\n" - " ((return (expression vec3 +\n" - " (expression vec3 abs (expression vec3 dFdx (var_ref p)))\n" - " (expression vec3 abs (expression vec3 dFdy (var_ref p)))))))\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 cos (var_ref angle)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 p))\n" - " ((return (expression vec4 +\n" - " (expression vec4 abs (expression vec4 dFdx (var_ref p)))\n" - " (expression vec4 abs (expression vec4 dFdy (var_ref p)))))))\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 cos (var_ref angle)))))\n" "))\n" -}; - -static const char *builtins_110_fs_textures = { - "((function texture1D\n" + "" +; +static const char *builtin_shadow2DProjLod = + "((function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" "\n" - ")\n" - " (function texture1DProj\n" + "))\n" + "" +; +static const char *builtin_shadow2DArray = + "((function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) ))))\n" "\n" - " (signature vec4\n" + "))\n" + "" +; +static const char *builtin_equal = + "((function equal\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture2D\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture2DProj\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture3D\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function texture3DProj\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function textureCube\n" - " (signature vec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function shadow1D\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - ")\n" - " (function shadow1DProj\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler1DShadow sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" + "" +; +static const char *builtin_length = + "((function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" - ")\n" - " (function shadow2D\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" - ")\n" - " (function shadow2DProj\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DShadow sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" "))\n" -}; - -static const char *functions_for_110_fs [] = { - builtins_110_fs_derivatives, - builtins_110_fs_textures, -}; - -/* 110_vs builtins */ - -static const char *builtins_110_vs_ftransform = { - "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n" - " (declare (in) vec4 gl_Vertex)\n" - " (function ftransform\n" + "" +; +static const char *builtin_acos = + "((function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" " (signature vec4\n" - " (parameters)\n" - " ((return (expression vec4 *\n" - " (var_ref gl_ModelViewProjectionMatrix)\n" - " (var_ref gl_Vertex)))))\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" "))\n" -}; - -static const char *functions_for_110_vs [] = { - builtins_110_vs_ftransform, -}; - -/* 120 builtins */ - -static const char *builtins_120_matrixCompMult = { + "" +; +static const char *builtin_matrixCompMult = "((function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ((declare () mat2 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ((declare () mat3 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ((declare () mat4 z)\n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n" + " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" + "(return (var_ref z))))\n" + "\n" " (signature mat2x3\n" " (parameters\n" " (declare (in) mat2x3 x)\n" @@ -2658,533 +2591,593 @@ static const char *builtins_120_matrixCompMult = { " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n" "(return (var_ref z))))\n" "))\n" -}; - -static const char *builtins_120_outerProduct = { - "((function outerProduct\n" - " (signature mat2\n" + "" +; +static const char *builtin_pow = + "((function pow\n" + " (signature float\n" " (parameters\n" - " (declare (in) vec2 u)\n" - " (declare (in) vec2 v))\n" - " ((declare () mat2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature mat2x3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) vec3 u)\n" - " (declare (in) vec2 v))\n" - " ((declare () mat2x3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature mat2x4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) vec4 u)\n" - " (declare (in) vec2 v))\n" - " ((declare () mat2x4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature mat3x2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 u)\n" - " (declare (in) vec3 v))\n" - " ((declare () mat3x2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" - " (return (var_ref m))\n" - " ))\n" - "\n" - " (signature mat3\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_texture2DProjLod = + "((function texture2DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec3 u)\n" - " (declare (in) vec3 v))\n" - " ((declare () mat3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat3x4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 u)\n" - " (declare (in) vec3 v))\n" - " ((declare () mat3x4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4x2\n" + "))\n" + "" +; +static const char *builtin_textureProjLod = + "((function textureProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) vec2 u)\n" - " (declare (in) vec4 v))\n" - " ((declare () mat4x2 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4x3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) vec3 u)\n" - " (declare (in) vec4 v))\n" - " ((declare () mat4x3 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n" - " (return (var_ref m))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) vec4 u)\n" - " (declare (in) vec4 v))\n" - " ((declare () mat4 m)\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" - " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n" - " (return (var_ref m))))\n" - "))\n" -}; - -static const char *builtins_120_transpose = { - "((function transpose\n" - " (signature mat2\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat2 m))\n" - " ((declare () mat2 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - "(return (var_ref t))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat3x2\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat2x3 m))\n" - " ((declare () mat3x2 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - "(return (var_ref t))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4x2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat2x4 m))\n" - " ((declare () mat4x2 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" - "(return (var_ref t))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat2x3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat3x2 m))\n" - " ((declare () mat2x3 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - "(return (var_ref t))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat3\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat3 m))\n" - " ((declare () mat3 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" - "(return (var_ref t))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4x3\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat3x4 m))\n" - " ((declare () mat4x3 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" - "(return (var_ref t))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat2x4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) mat4x2 m))\n" - " ((declare () mat2x4 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" - "(return (var_ref t))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat3x4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) mat4x3 m))\n" - " ((declare () mat3x4 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" - "(return (var_ref t))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature mat4\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) mat4 m))\n" - " ((declare () mat4 t)\n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n" - " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) \n" - "(return (var_ref t))))\n" - ")\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - ")\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" -}; - -static const char *functions_for_120 [] = { - builtins_120_matrixCompMult, - builtins_120_outerProduct, - builtins_120_transpose, -}; - -/* 130 builtins */ - -static const char *builtins_130_clamp = { - "((function clamp\n" - " (signature int\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) int arg0)\n" - " (declare (in) int arg1)\n" - " (declare (in) int arg2))\n" - " ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature ivec2\n" + " (signature uvec4\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1)\n" - " (declare (in) ivec2 arg2))\n" - " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature ivec3\n" + "))\n" + "" +; +static const char *builtin_log = + "((function log\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1)\n" - " (declare (in) ivec3 arg2))\n" - " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float log (var_ref arg0)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1)\n" - " (declare (in) ivec4 arg2))\n" - " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log (var_ref arg0)))))\n" "\n" - " (signature ivec2\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) int arg1)\n" - " (declare (in) int arg2))\n" - " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log (var_ref arg0)))))\n" "\n" - " (signature ivec3\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) int arg1)\n" - " (declare (in) int arg2))\n" - " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_exp2 = + "((function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp2 (var_ref arg0)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) int arg1)\n" - " (declare (in) int arg2))\n" - " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp2 (var_ref arg0)))))\n" "\n" - " (signature uint\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uint arg0)\n" - " (declare (in) uint arg1)\n" - " (declare (in) uint arg2))\n" - " ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp2 (var_ref arg0)))))\n" "\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1)\n" - " (declare (in) uvec2 arg2))\n" - " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp2 (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_fract = + "((function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float fract (var_ref x)))))\n" "\n" - " (signature uvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1)\n" - " (declare (in) uvec3 arg2))\n" - " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 fract (var_ref x)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1)\n" - " (declare (in) uvec4 arg2))\n" - " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 fract (var_ref x)))))\n" "\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uint arg1)\n" - " (declare (in) uint arg2))\n" - " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 fract (var_ref x)))))\n" + "))\n" "\n" - " (signature uvec3\n" + "" +; +static const char *builtin_shadow1DLod = + "((function shadow1DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uint arg1)\n" - " (declare (in) uint arg2))\n" - " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" "\n" - " (signature uvec4\n" + "))\n" + "" +; +static const char *builtin_texture1DLod = + "((function texture1DLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uint arg1)\n" - " (declare (in) uint arg2))\n" - " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_130_cosh = { - "((function cosh\n" + "" +; +static const char *builtin_texture2DArray = + "((function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture3DProj = + "((function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_sign = + "((function sign\n" " (signature float\n" " (parameters\n" " (declare (in) float x))\n" - " ((return (expression float * (constant float (0.5))\n" - " (expression float +\n" - " (expression float exp (var_ref x))\n" - " (expression float exp (expression float neg (var_ref x))))))))\n" + " ((return (expression float sign (var_ref x)))))\n" + "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 x))\n" - " ((return (expression vec2 * (constant vec2 (0.5))\n" - " (expression vec2 +\n" - " (expression vec2 exp (var_ref x))\n" - " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " ((return (expression vec2 sign (var_ref x)))))\n" + "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 x))\n" - " ((return (expression vec3 * (constant vec3 (0.5))\n" - " (expression vec3 +\n" - " (expression vec3 exp (var_ref x))\n" - " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " ((return (expression vec3 sign (var_ref x)))))\n" + "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 x))\n" - " ((return (expression vec4 * (constant vec4 (0.5))\n" - " (expression vec4 +\n" - " (expression vec4 exp (var_ref x))\n" - " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" - "))\n" -}; - -static const char *builtins_130_equal = { - "((function equal\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " ((return (expression vec4 sign (var_ref x)))))\n" "\n" - " (signature bvec3\n" + " (signature int\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) int x))\n" + " ((return (expression int sign (var_ref x)))))\n" "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_130_greaterThan = { - "((function greaterThan\n" - " (signature bvec2\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) ivec2 x))\n" + " ((return (expression ivec2 sign (var_ref x)))))\n" "\n" - " (signature bvec3\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) ivec3 x))\n" + " ((return (expression ivec3 sign (var_ref x)))))\n" "\n" - " (signature bvec4\n" + " (signature ivec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) ivec4 x))\n" + " ((return (expression ivec4 sign (var_ref x)))))\n" "))\n" -}; - -static const char *builtins_130_greaterThanEqual = { - "((function greaterThanEqual\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" "\n" - " (signature bvec3\n" + "" +; +static const char *builtin_inversesqrt = + "((function inversesqrt\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float rsq (var_ref arg0)))))\n" "\n" - " (signature bvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 rsq (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_distance = + "((function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ((declare () float p)\n" + " (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ((declare () vec2 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ((declare () vec3 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ((declare () vec4 p)\n" + " (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "))\n" + "" +; +static const char *builtin_noise2 = + "((function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec2 (0 0)))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec2 (0 0)))))\n" + "))\n" + "" +; +static const char *builtin_tanh = + "((function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float /\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 /\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 /\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 /\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_texture1DProjLod = + "((function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DArray = + "((function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2D = + "((function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_greaterThanEqual = + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" " ((declare () bvec4 temp)\n" " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_130_lessThan = { - "((function lessThan\n" + "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" " (return (var_ref temp))))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" " (return (var_ref temp))))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_130_lessThanEqual = { - "((function lessThanEqual\n" + "\n" " (signature bvec2\n" " (parameters\n" " (declare (in) uvec2 arg0)\n" " (declare (in) uvec2 arg1))\n" " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" " (return (var_ref temp))))\n" "\n" " (signature bvec3\n" @@ -3192,9 +3185,9 @@ static const char *builtins_130_lessThanEqual = { " (declare (in) uvec3 arg0)\n" " (declare (in) uvec3 arg1))\n" " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" " (return (var_ref temp))))\n" "\n" " (signature bvec4\n" @@ -3202,192 +3195,220 @@ static const char *builtins_130_lessThanEqual = { " (declare (in) uvec4 arg0)\n" " (declare (in) uvec4 arg1))\n" " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" " (return (var_ref temp))))\n" "))\n" -}; - -static const char *builtins_130_max = { - "((function max\n" - " (signature int\n" + "" +; +static const char *builtin_texture3DProjLod = + "((function texture3DProjLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) int arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression int max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" "\n" - " (signature ivec2\n" + "))\n" + "" +; +static const char *builtin_tan = + "((function tan\n" + " (signature float\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) float angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))\n" "\n" - " (signature ivec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" "\n" - " (signature ivec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" "\n" - " (signature ivec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" - "\n" - " (signature ivec3\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" + "))\n" + "" +; +static const char *builtin_any = + "((function any\n" + " (signature bool\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" "\n" - " (signature ivec4\n" + " (signature bool\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" "\n" - " (signature uint\n" + " (signature bool\n" " (parameters\n" - " (declare (in) uint arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uint max (var_ref arg0) (var_ref arg1)))))\n" - "\n" - " (signature uvec2\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" + "" +; +static const char *builtin_normalize = + "((function normalize\n" + " (signature float\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" "\n" - " (signature uvec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" "\n" - " (signature uvec2\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" - "\n" - " (signature uvec3\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "))\n" + "" +; +static const char *builtin_shadow1DProj = + "((function shadow1DProj\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" "\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" "))\n" -}; - -static const char *builtins_130_min = { - "((function min\n" - " (signature int\n" + "" +; +static const char *builtin_floor = + "((function floor\n" + " (signature float\n" " (parameters\n" - " (declare (in) int arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float floor (var_ref arg0)))))\n" "\n" - " (signature ivec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) ivec2 arg1))\n" - " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 floor (var_ref arg0)))))\n" "\n" - " (signature ivec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) ivec3 arg1))\n" - " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 floor (var_ref arg0)))))\n" "\n" - " (signature ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) ivec4 arg1))\n" - " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" - "\n" - " (signature ivec2\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 floor (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_cross = + "((function cross\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec2 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_sqrt = + "((function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (var_ref arg0)))))\n" "\n" - " (signature ivec3\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) ivec3 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 sqrt (var_ref arg0)))))\n" "\n" - " (signature ivec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) ivec4 arg0)\n" - " (declare (in) int arg1))\n" - " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 sqrt (var_ref arg0)))))\n" "\n" - " (signature uint\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uint arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 sqrt (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_mix = + "((function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec2\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" "\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uint arg1))\n" - " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" - "))\n" -}; - -static const char *builtins_130_mix = { - "((function mix\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" " (signature float\n" " (parameters\n" " (declare (in) float v1)\n" @@ -3426,1378 +3447,11231 @@ static const char *builtins_130_mix = { " (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))\n" " (return (var_ref v1))))\n" "))\n" -}; - -static const char *builtins_130_notEqual = { - "((function notEqual\n" - " (signature bvec2\n" - " (parameters\n" - " (declare (in) uvec2 arg0)\n" - " (declare (in) uvec2 arg1))\n" - " ((declare () bvec2 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "\n" - " (signature bvec3\n" + "" +; +static const char *builtin_shadow1DArrayLod = + "((function shadow1DArrayLod\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) uvec3 arg0)\n" - " (declare (in) uvec3 arg1))\n" - " ((declare () bvec3 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" "\n" - " (signature bvec4\n" - " (parameters\n" - " (declare (in) uvec4 arg0)\n" - " (declare (in) uvec4 arg1))\n" - " ((declare () bvec4 temp)\n" - " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" - " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" - " (return (var_ref temp))))\n" - "))\n" -}; - -static const char *builtins_130_sign = { - "((function sign\n" - " (signature int\n" - " (parameters\n" - " (declare (in) int x))\n" - " ((return (expression int sign (var_ref x)))))\n" - "\n" - " (signature ivec2\n" - " (parameters\n" - " (declare (in) ivec2 x))\n" - " ((return (expression ivec2 sign (var_ref x)))))\n" - "\n" - " (signature ivec3\n" - " (parameters\n" - " (declare (in) ivec3 x))\n" - " ((return (expression ivec3 sign (var_ref x)))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) ivec4 x))\n" - " ((return (expression ivec4 sign (var_ref x)))))\n" "))\n" - "\n" -}; - -static const char *builtins_130_sinh = { - "((function sinh\n" - " (signature float\n" - " (parameters\n" - " (declare (in) float x))\n" - " ((return (expression float * (constant float (0.5))\n" - " (expression float -\n" - " (expression float exp (var_ref x))\n" - " (expression float exp (expression float neg (var_ref x))))))))\n" - " (signature vec2\n" - " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 * (constant vec2 (0.5))\n" - " (expression vec2 -\n" - " (expression vec2 exp (var_ref x))\n" - " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" - " (signature vec3\n" - " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 * (constant vec3 (0.5))\n" - " (expression vec3 -\n" - " (expression vec3 exp (var_ref x))\n" - " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + "" +; +static const char *builtin_ftransform = + "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n" + " (declare (in) vec4 gl_Vertex)\n" + " (function ftransform\n" " (signature vec4\n" - " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 * (constant vec4 (0.5))\n" - " (expression vec4 -\n" - " (expression vec4 exp (var_ref x))\n" - " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + " (parameters)\n" + " ((return (expression vec4 *\n" + " (var_ref gl_ModelViewProjectionMatrix)\n" + " (var_ref gl_Vertex)))))\n" "))\n" -}; - -static const char *builtins_130_tanh = { - "((function tanh\n" + "" +; +static const char *builtin_sin = + "((function sin\n" " (signature float\n" " (parameters\n" - " (declare (in) float x))\n" - " ((return (expression float /\n" - " (expression float -\n" - " (expression float exp (var_ref x))\n" - " (expression float exp (expression float neg (var_ref x))))\n" - " (expression float +\n" - " (expression float exp (var_ref x))\n" - " (expression float exp (expression float neg (var_ref x))))))))\n" + " (declare (in) float angle))\n" + " ((return (expression float sin (var_ref angle)))))\n" + "\n" " (signature vec2\n" " (parameters\n" - " (declare (in) vec2 x))\n" - " ((return (expression vec2 /\n" - " (expression vec2 -\n" - " (expression vec2 exp (var_ref x))\n" - " (expression vec2 exp (expression vec2 neg (var_ref x))))\n" - " (expression vec2 +\n" - " (expression vec2 exp (var_ref x))\n" - " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 sin (var_ref angle)))))\n" + "\n" " (signature vec3\n" " (parameters\n" - " (declare (in) vec3 x))\n" - " ((return (expression vec3 /\n" - " (expression vec3 -\n" - " (expression vec3 exp (var_ref x))\n" - " (expression vec3 exp (expression vec3 neg (var_ref x))))\n" - " (expression vec3 +\n" - " (expression vec3 exp (var_ref x))\n" - " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 sin (var_ref angle)))))\n" + "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) vec4 x))\n" - " ((return (expression vec4 /\n" - " (expression vec4 -\n" - " (expression vec4 exp (var_ref x))\n" - " (expression vec4 exp (expression vec4 neg (var_ref x))))\n" - " (expression vec4 +\n" - " (expression vec4 exp (var_ref x))\n" - " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 sin (var_ref angle)))))\n" "))\n" -}; - -static const char *builtins_130_texelFetch = { - "((function texelFetch\n" + "" +; +static const char *builtin_shadow2D = + "((function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) int P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) int P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) int P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_shadow2DLod = + "((function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_shadow2DRectProj = + "((function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_atan = + "((function atan\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) float x))\n" + " ((return (call asin ((expression float *\n" + " (var_ref x)\n" + " (expression float rsq\n" + " (expression float +\n" + " (expression float *\n" + " (var_ref x)\n" + " (var_ref x))\n" + " (constant float (1.0))))))))))\n" "\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) ivec2 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) vec2 y_over_x))\n" + " ((return (call asin ((expression vec2 *\n" + " (var_ref y_over_x)\n" + " (expression vec2 rsq\n" + " (expression vec2 +\n" + " (expression vec2 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" "\n" - " (signature vec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) vec3 y_over_x))\n" + " ((return (call asin ((expression vec3 *\n" + " (var_ref y_over_x)\n" + " (expression vec3 rsq\n" + " (expression vec3 +\n" + " (expression vec3 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" "\n" - " (signature ivec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) vec4 y_over_x))\n" + " ((return (call asin ((expression vec4 *\n" + " (var_ref y_over_x)\n" + " (expression vec4 rsq\n" + " (expression vec4 +\n" + " (expression vec4 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" "\n" - " (signature uvec4\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y)\n" + " (declare (in ) float x)\n" + " )\n" + " (\n" + " (declare () float r)\n" + " (declare ( ) float abs_retval)\n" + " (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))\n" + ") \n" + " (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (\n" + " (declare ( ) float atan_retval)\n" + " (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n" + ") \n" + " (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) \n" + " (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n" + " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) \n" + " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" + " )\n" + " (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) \n" + " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n" + " ))\n" + "\n" + " )\n" + " (\n" + " ))\n" + "\n" + " )\n" + " (\n" + " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" + " (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) \n" + " )\n" + " (\n" + " (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) \n" + " ))\n" + "\n" + " ))\n" + "\n" + " (return (var_ref r) )\n" + " ))\n" + "\n" + "\n" + "\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) ivec3 P) \n" - " (declare (in) int lod) )\n" - " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 r)\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 r)\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz z (var_ref r))\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" + " (return (var_ref r))))\n" "\n" - "))\n" -}; - -static const char *builtins_130_texture = { - "((function texture\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 r)\n" + " (assign (constant bool (1))\n" + " (swiz x (var_ref r))\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz y (var_ref r))\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz z (var_ref r))\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" + " (assign (constant bool (1))\n" + " (swiz w (var_ref r))\n" + " (call atan ((swiz w (var_ref y))\n" + " (swiz w (var_ref x)))))\n" + " (return (var_ref r)))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_max = + "((function max\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - "))\n" -}; - -static const char *builtins_130_textureGrad = { - "((function textureGrad\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" - "\n" - " (signature vec4\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_reflect = + "((function reflect\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) float i)\n" + " (declare (in) float n))\n" + " ((return (expression float -\n" + " (var_ref i)\n" + " (expression float *\n" + " (constant float (2.0))\n" + " (expression float *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n))\n" + " ((return (expression vec2 -\n" + " (var_ref i)\n" + " (expression vec2 *\n" + " (constant float (2.0))\n" + " (expression vec2 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n))\n" + " ((return (expression vec3 -\n" + " (var_ref i)\n" + " (expression vec3 *\n" + " (constant float (2.0))\n" + " (expression vec3 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n))\n" + " ((return (expression vec4 -\n" + " (var_ref i)\n" + " (expression vec4 *\n" + " (constant float (2.0))\n" + " (expression vec4 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_texture3D = + "((function texture3D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" + " (declare (in) sampler3D sampler)\n" " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_texelFetch = + "((function texelFetch\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" - ")\n" - ")\n" -}; - -static const char *builtins_130_textureLod = { - "((function textureLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" "\n" + "))\n" + "" +; +static const char *builtin_noise4 = + "((function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" + " (declare (in) float x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" - "\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" " (signature vec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec4 (0 0 0 0)))))\n" + "))\n" + "" +; +static const char *builtin_notEqual = + "((function notEqual\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature ivec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature uvec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature ivec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n" + " (return (var_ref temp))))\n" "\n" - " (signature uvec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - "))\n" -}; - -static const char *builtins_130_textureProj = { - "((function textureProj\n" - " (signature vec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature ivec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" - "\n" - " (signature uvec4\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" + "" +; +static const char *builtin_outerProduct = + "((function outerProduct\n" + " (signature mat2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature vec4\n" + " (signature mat2x3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2x3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature ivec4\n" + " (signature mat2x4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2x4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature uvec4\n" + " (signature mat3x2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3x2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))\n" + " ))\n" "\n" - " (signature vec4\n" + " (signature mat3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature ivec4\n" + " (signature mat3x4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3x4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature uvec4\n" + " (signature mat4x2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4x2 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature vec4\n" + " (signature mat4x3\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4x3 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" "\n" - " (signature ivec4\n" + " (signature mat4\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" - "\n" - " (signature uvec4\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4 m)\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" + "))\n" + "" +; +static const char *builtin_shadow1D = + "((function shadow1D\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_noise1 = + "((function noise1\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" - "\n" - " (signature uvec4\n" + " (declare (in) float x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" - "\n" + " (declare (in) vec2 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant float (0)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant float (0)))))\n" "))\n" -}; - -static const char *builtins_130_textureProjGrad = { - "((function textureProjGrad\n" - " (signature vec4\n" + "" +; +static const char *builtin_refract = + "((function refract\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) float i)\n" + " (declare (in) float n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant float (0.0))))\n" + " ((return (expression float -\n" + " (expression float * (var_ref eta) (var_ref i))\n" + " (expression float *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec2 (0.0 0.0))))\n" + " ((return (expression vec2 -\n" + " (expression vec2 * (var_ref eta) (var_ref i))\n" + " (expression vec2 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec3 (0.0 0.0 0.0))))\n" + " ((return (expression vec3 -\n" + " (expression vec3 * (var_ref eta) (var_ref i))\n" + " (expression vec3 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n" + " ((return (expression vec4 -\n" + " (expression vec4 * (var_ref eta) (var_ref i))\n" + " (expression vec4 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_noise3 = + "((function noise3\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) float x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (constant vec3 (0 0 0)))))\n" + "))\n" + "" +; +static const char *builtin_min = + "((function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float dPdx) \n" - " (declare (in) float dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature int\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec2 dPdx) \n" - " (declare (in) vec2 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature ivec2\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) vec3 dPdx) \n" - " (declare (in) vec3 dPdy) )\n" - " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - "))\n" -}; - -static const char *builtins_130_textureProjLod = { - "((function textureProjLod\n" - " (signature vec4\n" + " (signature ivec3\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature ivec4\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature uint\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature uvec2\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature uvec3\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" "\n" " (signature uvec4\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" - "\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_textureCube = + "((function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" - "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" - "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_shadow1DArray = + "((function shadow1DArray\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" - " (signature uvec4\n" + " (signature vec4\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" "\n" "))\n" -}; - -static const char *functions_for_130 [] = { - builtins_130_clamp, - builtins_130_cosh, - builtins_130_equal, - builtins_130_greaterThan, - builtins_130_greaterThanEqual, - builtins_130_lessThan, - builtins_130_lessThanEqual, - builtins_130_max, - builtins_130_min, - builtins_130_mix, - builtins_130_notEqual, - builtins_130_sign, - builtins_130_sinh, - builtins_130_tanh, - builtins_130_texelFetch, - builtins_130_texture, - builtins_130_textureGrad, - builtins_130_textureLod, - builtins_130_textureProj, - builtins_130_textureProjGrad, - builtins_130_textureProjLod, -}; - -/* 130_fs builtins */ - -static const char *builtins_130_fs_texture = { - "((function texture\n" - " (signature vec4\n" + "" +; +static const char *builtin_exp = + "((function exp\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp (var_ref arg0)))))\n" "\n" - " (signature ivec4\n" + " (signature vec2\n" " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp (var_ref arg0)))))\n" "\n" - " (signature uvec4\n" + " (signature vec3\n" " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) float P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp (var_ref arg0)))))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" - "\n" - " (signature ivec4\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_greaterThan = + "((function greaterThan\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature uvec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature ivec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature uvec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature vec4\n" + " (signature bvec4\n" " (parameters\n" - " (declare (in) samplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature ivec4\n" + " (signature bvec2\n" " (parameters\n" - " (declare (in) isamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" - " (signature uvec4\n" + " (signature bvec3\n" " (parameters\n" - " (declare (in) usamplerCube sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" + "" +; +static const char *builtin_texture2DLod = + "((function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" + " (declare (in) sampler2D sampler)\n" " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" "\n" - " (signature ivec4\n" + "))\n" + "" +; +static const char *builtin_dot = + "((function dot\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature uvec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) usampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature vec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" "\n" - " (signature ivec4\n" + " (signature float\n" " (parameters\n" - " (declare (in) isampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *prototypes_for_120_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x22143e0)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x22147b0)\n" + " )\n" + " (\n" + " ))\n" "\n" - "))\n" -}; - -static const char *builtins_130_fs_textureProj = { - "((function textureProj\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x22149a0)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x2214b90)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + ")\n" "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x2214d80)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x2215150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x2215340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x2215530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x2215720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x2215ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x2215cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x2215e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x2216070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x2216420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x2216600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x22167e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x22169c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x2216d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x2216f50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x2217130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x2217310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x22176c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x22178a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x2217a80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x2217c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x2218010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x22181f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x22183d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x22185b0)\n" + " (declare (in ) float x@0x22186c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x2218a70)\n" + " (declare (in ) vec2 x@0x2218b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x2218d60)\n" + " (declare (in ) vec3 x@0x2218e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x2219050)\n" + " (declare (in ) vec4 x@0x2219160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x2219340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x2219530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x2219720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x2219910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2219b00)\n" + " (declare (in ) float y@0x2219c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2219fc0)\n" + " (declare (in ) vec2 y@0x221a0d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221a2b0)\n" + " (declare (in ) vec3 y@0x221a3c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221a5a0)\n" + " (declare (in ) vec4 y@0x221a6b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221a890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221ac40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221ae20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221b000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221b1e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221b590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221b770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221b950)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221bb30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221bee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221c0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221c2a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221c480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221c830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221ca10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221cbf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221cdd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221d180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221d360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221d540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221d720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221dae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221dcc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221dea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221e080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221e430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221e610)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221e7f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221e9d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221ed80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221ef60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221f140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221f320)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x221f6d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x221f8b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x221fa90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x221fc70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2220020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2220200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x22203e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x22205c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2220970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2220b50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2220d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2220f10)\n" + " (declare (in ) float y@0x2221020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x22213d0)\n" + " (declare (in ) float y@0x22214e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x22216c0)\n" + " (declare (in ) float y@0x22217d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x22219b0)\n" + " (declare (in ) float y@0x2221ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2221ca0)\n" + " (declare (in ) vec2 y@0x2221db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2221f90)\n" + " (declare (in ) vec3 y@0x22220a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2222280)\n" + " (declare (in ) vec4 y@0x2222390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2222570)\n" + " (declare (in ) float y@0x2222680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2222a30)\n" + " (declare (in ) vec2 y@0x2222b40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2222d20)\n" + " (declare (in ) vec3 y@0x2222e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2223010)\n" + " (declare (in ) vec4 y@0x2223120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2223300)\n" + " (declare (in ) float y@0x2223410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x22235f0)\n" + " (declare (in ) float y@0x2223700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x22238e0)\n" + " (declare (in ) float y@0x22239f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2223bd0)\n" + " (declare (in ) float y@0x2223ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2224090)\n" + " (declare (in ) vec2 y@0x22241a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2224380)\n" + " (declare (in ) vec3 y@0x2224490)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2224670)\n" + " (declare (in ) vec4 y@0x2224780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2224960)\n" + " (declare (in ) float y@0x2224a70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2224c50)\n" + " (declare (in ) float y@0x2224d60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2224f40)\n" + " (declare (in ) float y@0x2225050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2225230)\n" + " (declare (in ) float minVal@0x2225340)\n" + " (declare (in ) float maxVal@0x2225450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2225800)\n" + " (declare (in ) vec2 minVal@0x2225910)\n" + " (declare (in ) vec2 maxVal@0x2225a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2225c00)\n" + " (declare (in ) vec3 minVal@0x2225d10)\n" + " (declare (in ) vec3 maxVal@0x2225e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2226000)\n" + " (declare (in ) vec4 minVal@0x2226110)\n" + " (declare (in ) vec4 maxVal@0x2226220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2226400)\n" + " (declare (in ) float minVal@0x2226510)\n" + " (declare (in ) float maxVal@0x2226620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2226800)\n" + " (declare (in ) float minVal@0x2226910)\n" + " (declare (in ) float maxVal@0x2226a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2226c00)\n" + " (declare (in ) float minVal@0x2226d10)\n" + " (declare (in ) float maxVal@0x2226e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2227000)\n" + " (declare (in ) float y@0x2227110)\n" + " (declare (in ) float a@0x2227220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x22275d0)\n" + " (declare (in ) vec2 y@0x22276e0)\n" + " (declare (in ) vec2 a@0x22277f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x22279d0)\n" + " (declare (in ) vec3 y@0x2227ae0)\n" + " (declare (in ) vec3 a@0x2227bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2227dd0)\n" + " (declare (in ) vec4 y@0x2227ee0)\n" + " (declare (in ) vec4 a@0x2227ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x22281d0)\n" + " (declare (in ) vec2 y@0x22282e0)\n" + " (declare (in ) float a@0x22283f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x22285d0)\n" + " (declare (in ) vec3 y@0x22286e0)\n" + " (declare (in ) float a@0x22287f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x22289d0)\n" + " (declare (in ) vec4 y@0x2228ae0)\n" + " (declare (in ) float a@0x2228bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x2228dd0)\n" + " (declare (in ) float x@0x2228ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x2229290)\n" + " (declare (in ) vec2 x@0x22293a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x2229580)\n" + " (declare (in ) vec3 x@0x2229690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x2229870)\n" + " (declare (in ) vec4 x@0x2229980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x2229b60)\n" + " (declare (in ) vec2 x@0x2229c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x2229e50)\n" + " (declare (in ) vec3 x@0x2229f60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x222a140)\n" + " (declare (in ) vec4 x@0x222a250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x222a430)\n" + " (declare (in ) float edge1@0x222a540)\n" + " (declare (in ) float x@0x222a650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x222aa10)\n" + " (declare (in ) vec2 edge1@0x222ab20)\n" + " (declare (in ) vec2 x@0x222ac30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x222ae10)\n" + " (declare (in ) vec3 edge1@0x222af20)\n" + " (declare (in ) vec3 x@0x222b030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x222b210)\n" + " (declare (in ) vec4 edge1@0x222b320)\n" + " (declare (in ) vec4 x@0x222b430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x222b610)\n" + " (declare (in ) float edge1@0x222b720)\n" + " (declare (in ) vec2 x@0x222b830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x222ba10)\n" + " (declare (in ) float edge1@0x222bb20)\n" + " (declare (in ) vec3 x@0x222bc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x222be10)\n" + " (declare (in ) float edge1@0x222bf20)\n" + " (declare (in ) vec4 x@0x222c030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x222c210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x222c5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x222c7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x222c980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x222cb60)\n" + " (declare (in ) float p1@0x222cc70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x222d030)\n" + " (declare (in ) vec2 p1@0x222d140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x222d320)\n" + " (declare (in ) vec3 p1@0x222d430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x222d610)\n" + " (declare (in ) vec4 p1@0x222d720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x222d900)\n" + " (declare (in ) float y@0x222da10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x222ddc0)\n" + " (declare (in ) vec2 y@0x222ded0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x222e0b0)\n" + " (declare (in ) vec3 y@0x222e1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x222e3a0)\n" + " (declare (in ) vec4 y@0x222e4b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x222e690)\n" + " (declare (in ) vec3 y@0x222e7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x222eb50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x222ef10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x222f0f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x222f2d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x222f760)\n" + " (declare (in ) float I@0x222f870)\n" + " (declare (in ) float Nref@0x222f980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x222fd40)\n" + " (declare (in ) vec2 I@0x222fe50)\n" + " (declare (in ) vec2 Nref@0x222ff60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x2230140)\n" + " (declare (in ) vec3 I@0x2230250)\n" + " (declare (in ) vec3 Nref@0x2230360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x2230540)\n" + " (declare (in ) vec4 I@0x2230650)\n" + " (declare (in ) vec4 Nref@0x2230760)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x2230940)\n" + " (declare (in ) float N@0x2230a50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x2230e10)\n" + " (declare (in ) vec2 N@0x2230f20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x2231100)\n" + " (declare (in ) vec3 N@0x2231210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x22313f0)\n" + " (declare (in ) vec4 N@0x2231500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x22316e0)\n" + " (declare (in ) float N@0x22317f0)\n" + " (declare (in ) float eta@0x2231900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x2231cc0)\n" + " (declare (in ) vec2 N@0x2231dd0)\n" + " (declare (in ) float eta@0x2231ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x22320c0)\n" + " (declare (in ) vec3 N@0x22321d0)\n" + " (declare (in ) float eta@0x22322e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x22324c0)\n" + " (declare (in ) vec4 N@0x22325d0)\n" + " (declare (in ) float eta@0x22326e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0x22328c0)\n" + " (declare (in ) mat2 y@0x22329d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0x2232d90)\n" + " (declare (in ) mat3 y@0x2232ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0x2233080)\n" + " (declare (in ) mat4 y@0x2233190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat2x3 x@0x2233370)\n" + " (declare (in ) mat2x3 y@0x2233480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat2x4 x@0x2233660)\n" + " (declare (in ) mat2x4 y@0x2233770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat3x2 x@0x2233950)\n" + " (declare (in ) mat3x2 y@0x2233a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat3x4 x@0x2233c40)\n" + " (declare (in ) mat3x4 y@0x2233d50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat4x2 x@0x2233f30)\n" + " (declare (in ) mat4x2 y@0x2234040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat4x3 x@0x2234220)\n" + " (declare (in ) mat4x3 y@0x2234330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x2234510)\n" + " (declare (in ) vec2 r@0x2234620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x22349e0)\n" + " (declare (in ) vec3 r@0x2234af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x2234cd0)\n" + " (declare (in ) vec4 r@0x2234de0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x2234fc0)\n" + " (declare (in ) vec2 r@0x22350d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x22352b0)\n" + " (declare (in ) vec3 r@0x22353c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x22355a0)\n" + " (declare (in ) vec2 r@0x22356b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x2235890)\n" + " (declare (in ) vec4 r@0x22359a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x2235b80)\n" + " (declare (in ) vec3 r@0x2235c90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x2235e70)\n" + " (declare (in ) vec4 r@0x2235f80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 m@0x2236160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 m@0x2236520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 m@0x2236700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat3x2 m@0x22368e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat2x3 m@0x2236ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat4x2 m@0x2236ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat2x4 m@0x2236e80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat4x3 m@0x2237060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat3x4 m@0x2237240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2237420)\n" + " (declare (in ) vec2 y@0x2237530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x22378f0)\n" + " (declare (in ) vec3 y@0x2237a00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2237be0)\n" + " (declare (in ) vec4 y@0x2237cf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x2237ed0)\n" + " (declare (in ) ivec2 y@0x2237fe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x22381c0)\n" + " (declare (in ) ivec3 y@0x22382d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x22384b0)\n" + " (declare (in ) ivec4 y@0x22385c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x22387a0)\n" + " (declare (in ) vec2 y@0x22388b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2238c70)\n" + " (declare (in ) vec3 y@0x2238d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2238f60)\n" + " (declare (in ) vec4 y@0x2239070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x2239250)\n" + " (declare (in ) ivec2 y@0x2239360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x2239540)\n" + " (declare (in ) ivec3 y@0x2239650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x2239830)\n" + " (declare (in ) ivec4 y@0x2239940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x2239b20)\n" + " (declare (in ) vec2 y@0x2239c30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2239ff0)\n" + " (declare (in ) vec3 y@0x223a100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x223a2e0)\n" + " (declare (in ) vec4 y@0x223a3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x223a5d0)\n" + " (declare (in ) ivec2 y@0x223a6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x223a8c0)\n" + " (declare (in ) ivec3 y@0x223a9d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x223abb0)\n" + " (declare (in ) ivec4 y@0x223acc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x223aea0)\n" + " (declare (in ) vec2 y@0x223afb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x223b370)\n" + " (declare (in ) vec3 y@0x223b480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x223b660)\n" + " (declare (in ) vec4 y@0x223b770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x223b950)\n" + " (declare (in ) ivec2 y@0x223ba60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x223bc40)\n" + " (declare (in ) ivec3 y@0x223bd50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x223bf30)\n" + " (declare (in ) ivec4 y@0x223c040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x223c220)\n" + " (declare (in ) vec2 y@0x223c330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x223c6e0)\n" + " (declare (in ) vec3 y@0x223c7f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x223c9d0)\n" + " (declare (in ) vec4 y@0x223cae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x223ccc0)\n" + " (declare (in ) ivec2 y@0x223cdd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x223cfb0)\n" + " (declare (in ) ivec3 y@0x223d0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x223d2a0)\n" + " (declare (in ) ivec4 y@0x223d3b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x223d590)\n" + " (declare (in ) bvec2 y@0x223d6a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x223d880)\n" + " (declare (in ) bvec3 y@0x223d990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x223db70)\n" + " (declare (in ) bvec4 y@0x223dc80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x223de60)\n" + " (declare (in ) vec2 y@0x223df70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x223e330)\n" + " (declare (in ) vec3 y@0x223e440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x223e620)\n" + " (declare (in ) vec4 y@0x223e730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x223e910)\n" + " (declare (in ) ivec2 y@0x223ea20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x223ec00)\n" + " (declare (in ) ivec3 y@0x223ed10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x223eef0)\n" + " (declare (in ) ivec4 y@0x223f000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x223f1e0)\n" + " (declare (in ) bvec2 y@0x223f2f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x223f4d0)\n" + " (declare (in ) bvec3 y@0x223f5e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x223f7c0)\n" + " (declare (in ) bvec4 y@0x223f8d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x223fab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x223fe60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x2240040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x2240220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x22405d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x22407b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x2240990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x2240d40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x2240f20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x2241100)\n" + " (declare (in ) float coord@0x2241220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x22415e0)\n" + " (declare (in ) vec2 coord@0x2241700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x2241ac0)\n" + " (declare (in ) vec4 coord@0x2241be0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x2241dc0)\n" + " (declare (in ) float coord@0x2241ee0)\n" + " (declare (in ) float lod@0x2241ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x22423b0)\n" + " (declare (in ) vec2 coord@0x22424d0)\n" + " (declare (in ) float lod@0x22425e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x22429a0)\n" + " (declare (in ) vec4 coord@0x2242ac0)\n" + " (declare (in ) float lod@0x2242bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2242db0)\n" + " (declare (in ) vec2 coord@0x2242ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2243290)\n" + " (declare (in ) vec3 coord@0x22433b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2243770)\n" + " (declare (in ) vec4 coord@0x2243890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2243a70)\n" + " (declare (in ) vec2 coord@0x2243b90)\n" + " (declare (in ) float lod@0x2243ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2244060)\n" + " (declare (in ) vec3 coord@0x2244180)\n" + " (declare (in ) float lod@0x2244290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x2244650)\n" + " (declare (in ) vec4 coord@0x2244770)\n" + " (declare (in ) float lod@0x2244880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x2244a60)\n" + " (declare (in ) vec3 coord@0x2244b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x2244f40)\n" + " (declare (in ) vec4 coord@0x2245060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x2245420)\n" + " (declare (in ) vec3 coord@0x2245540)\n" + " (declare (in ) float lod@0x2245650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x2245a10)\n" + " (declare (in ) vec4 coord@0x2245b30)\n" + " (declare (in ) float lod@0x2245c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x2246000)\n" + " (declare (in ) vec3 coord@0x2246120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x22464e0)\n" + " (declare (in ) vec3 coord@0x2246600)\n" + " (declare (in ) float lod@0x2246710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x2246ad0)\n" + " (declare (in ) vec3 coord@0x2246bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x2246fb0)\n" + " (declare (in ) vec3 coord@0x22470d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x2247490)\n" + " (declare (in ) vec4 coord@0x22475b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x2247970)\n" + " (declare (in ) vec4 coord@0x2247a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x2247e50)\n" + " (declare (in ) vec3 coord@0x2247f70)\n" + " (declare (in ) float lod@0x2248080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x2248440)\n" + " (declare (in ) vec3 coord@0x2248560)\n" + " (declare (in ) float lod@0x2248670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x2248a30)\n" + " (declare (in ) vec4 coord@0x2248b50)\n" + " (declare (in ) float lod@0x2248c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x2249020)\n" + " (declare (in ) vec4 coord@0x2249140)\n" + " (declare (in ) float lod@0x2249250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x2249610)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x22499c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x2249ba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x2249d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0x2249f60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x224a310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0x224a4f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0x224a6d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0x224a8b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0x224ac60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x224ae40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0x224b020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0x224b200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0x224b5b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0x224b790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x224b970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_120_vert [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_shadow2DProjLod, + builtin_noise2, + builtin_texture3DProjLod, + builtin_pow, + builtin_texture2DProj, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_shadow2DProj, + builtin_shadow1DProjLod, + builtin_any, + builtin_shadow1DProj, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_texture3DLod, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_shadow1DLod, + builtin_ftransform, + builtin_sin, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_all, + builtin_log2, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_transpose, + builtin_outerProduct, + builtin_ceil, + builtin_reflect, + builtin_textureCubeLod, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_not, + builtin_texture2DProjLod, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_texture2DLod, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_texture1DProjLod, + builtin_textureCube, + builtin_length, + builtin_texture1DLod, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, +}; +static const char *prototypes_for_EXT_texture_array_frag = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0xb9bd60)\n" + " (declare (in ) vec2 coord@0xb9be80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0xb9c240)\n" + " (declare (in ) vec2 coord@0xb9c360)\n" + " (declare (in ) float bias@0xb9c470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0xb9c650)\n" + " (declare (in ) vec2 coord@0xb9c770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0xb9cb30)\n" + " (declare (in ) vec2 coord@0xb9cc50)\n" + " (declare (in ) float bias@0xb9cd60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0xb9cf40)\n" + " (declare (in ) vec3 coord@0xb9d060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0xb9d420)\n" + " (declare (in ) vec3 coord@0xb9d540)\n" + " (declare (in ) float bias@0xb9d650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0xb9d830)\n" + " (declare (in ) vec4 coord@0xb9d950)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_EXT_texture_array_frag [] = { + builtin_shadow2DArray, + builtin_shadow1DArray, + builtin_texture1DArray, + builtin_texture2DArray, +}; +static const char *prototypes_for_110_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x9e3c50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x9e4020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x9e4210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x9e4400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x9e45f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x9e49c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x9e4bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x9e4da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x9e4f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x9e5340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x9e5520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x9e5700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x9e58e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x9e5c90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x9e5e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x9e6050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x9e6230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x9e65e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x9e67c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x9e69a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x9e6b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x9e6f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x9e7110)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x9e72f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x9e74d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x9e7880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x9e7a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x9e7c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x9e7e20)\n" + " (declare (in ) float x@0x9e7f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x9e82e0)\n" + " (declare (in ) vec2 x@0x9e83f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x9e85d0)\n" + " (declare (in ) vec3 x@0x9e86e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x9e88c0)\n" + " (declare (in ) vec4 x@0x9e89d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x9e8bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x9e8da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x9e8f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x9e9180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9e9370)\n" + " (declare (in ) float y@0x9e9480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9e9830)\n" + " (declare (in ) vec2 y@0x9e9940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9e9b20)\n" + " (declare (in ) vec3 y@0x9e9c30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9e9e10)\n" + " (declare (in ) vec4 y@0x9e9f20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ea100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ea4b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ea690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ea870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9eaa50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9eae00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9eafe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9eb1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9eb3a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9eb750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9eb930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ebb10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ebcf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ec0a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ec280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ec460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ec640)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ec9f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ecbd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ecdb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ecf90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ed350)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ed530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ed710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ed8f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9edca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ede80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ee060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ee240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ee5f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ee7d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ee9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9eeb90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9eef40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9ef120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9ef300)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9ef4e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9ef890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9efa70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9efc50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9efe30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f01e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f03c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f05a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9f0780)\n" + " (declare (in ) float y@0x9f0890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f0c40)\n" + " (declare (in ) float y@0x9f0d50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f0f30)\n" + " (declare (in ) float y@0x9f1040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f1220)\n" + " (declare (in ) float y@0x9f1330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f1510)\n" + " (declare (in ) vec2 y@0x9f1620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f1800)\n" + " (declare (in ) vec3 y@0x9f1910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f1af0)\n" + " (declare (in ) vec4 y@0x9f1c00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9f1de0)\n" + " (declare (in ) float y@0x9f1ef0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f22a0)\n" + " (declare (in ) vec2 y@0x9f23b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f2590)\n" + " (declare (in ) vec3 y@0x9f26a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f2880)\n" + " (declare (in ) vec4 y@0x9f2990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f2b70)\n" + " (declare (in ) float y@0x9f2c80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f2e60)\n" + " (declare (in ) float y@0x9f2f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f3150)\n" + " (declare (in ) float y@0x9f3260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9f3440)\n" + " (declare (in ) float y@0x9f3550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f3900)\n" + " (declare (in ) vec2 y@0x9f3a10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f3bf0)\n" + " (declare (in ) vec3 y@0x9f3d00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f3ee0)\n" + " (declare (in ) vec4 y@0x9f3ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f41d0)\n" + " (declare (in ) float y@0x9f42e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f44c0)\n" + " (declare (in ) float y@0x9f45d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f47b0)\n" + " (declare (in ) float y@0x9f48c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9f4aa0)\n" + " (declare (in ) float minVal@0x9f4bb0)\n" + " (declare (in ) float maxVal@0x9f4cc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f5070)\n" + " (declare (in ) vec2 minVal@0x9f5180)\n" + " (declare (in ) vec2 maxVal@0x9f5290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f5470)\n" + " (declare (in ) vec3 minVal@0x9f5580)\n" + " (declare (in ) vec3 maxVal@0x9f5690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f5870)\n" + " (declare (in ) vec4 minVal@0x9f5980)\n" + " (declare (in ) vec4 maxVal@0x9f5a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f5c70)\n" + " (declare (in ) float minVal@0x9f5d80)\n" + " (declare (in ) float maxVal@0x9f5e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f6070)\n" + " (declare (in ) float minVal@0x9f6180)\n" + " (declare (in ) float maxVal@0x9f6290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f6470)\n" + " (declare (in ) float minVal@0x9f6580)\n" + " (declare (in ) float maxVal@0x9f6690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9f6870)\n" + " (declare (in ) float y@0x9f6980)\n" + " (declare (in ) float a@0x9f6a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f6e40)\n" + " (declare (in ) vec2 y@0x9f6f50)\n" + " (declare (in ) vec2 a@0x9f7060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f7240)\n" + " (declare (in ) vec3 y@0x9f7350)\n" + " (declare (in ) vec3 a@0x9f7460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f7640)\n" + " (declare (in ) vec4 y@0x9f7750)\n" + " (declare (in ) vec4 a@0x9f7860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9f7a40)\n" + " (declare (in ) vec2 y@0x9f7b50)\n" + " (declare (in ) float a@0x9f7c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9f7e40)\n" + " (declare (in ) vec3 y@0x9f7f50)\n" + " (declare (in ) float a@0x9f8060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9f8240)\n" + " (declare (in ) vec4 y@0x9f8350)\n" + " (declare (in ) float a@0x9f8460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x9f8640)\n" + " (declare (in ) float x@0x9f8750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x9f8b00)\n" + " (declare (in ) vec2 x@0x9f8c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x9f8df0)\n" + " (declare (in ) vec3 x@0x9f8f00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x9f90e0)\n" + " (declare (in ) vec4 x@0x9f91f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x9f93d0)\n" + " (declare (in ) vec2 x@0x9f94e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x9f96c0)\n" + " (declare (in ) vec3 x@0x9f97d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x9f99b0)\n" + " (declare (in ) vec4 x@0x9f9ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x9f9ca0)\n" + " (declare (in ) float edge1@0x9f9db0)\n" + " (declare (in ) float x@0x9f9ec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x9fa280)\n" + " (declare (in ) vec2 edge1@0x9fa390)\n" + " (declare (in ) vec2 x@0x9fa4a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x9fa680)\n" + " (declare (in ) vec3 edge1@0x9fa790)\n" + " (declare (in ) vec3 x@0x9fa8a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x9faa80)\n" + " (declare (in ) vec4 edge1@0x9fab90)\n" + " (declare (in ) vec4 x@0x9faca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x9fae80)\n" + " (declare (in ) float edge1@0x9faf90)\n" + " (declare (in ) vec2 x@0x9fb0a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x9fb280)\n" + " (declare (in ) float edge1@0x9fb390)\n" + " (declare (in ) vec3 x@0x9fb4a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x9fb680)\n" + " (declare (in ) float edge1@0x9fb790)\n" + " (declare (in ) vec4 x@0x9fb8a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9fba80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9fbe30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9fc010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9fc1f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x9fc3d0)\n" + " (declare (in ) float p1@0x9fc4e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x9fc8a0)\n" + " (declare (in ) vec2 p1@0x9fc9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x9fcb90)\n" + " (declare (in ) vec3 p1@0x9fcca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x9fce80)\n" + " (declare (in ) vec4 p1@0x9fcf90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9fd170)\n" + " (declare (in ) float y@0x9fd280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9fd630)\n" + " (declare (in ) vec2 y@0x9fd740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9fd920)\n" + " (declare (in ) vec3 y@0x9fda30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9fdc10)\n" + " (declare (in ) vec4 y@0x9fdd20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9fdf00)\n" + " (declare (in ) vec3 y@0x9fe010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x9fe3c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x9fe780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x9fe960)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x9feb40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x9fefd0)\n" + " (declare (in ) float I@0x9ff0e0)\n" + " (declare (in ) float Nref@0x9ff1f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x9ff5b0)\n" + " (declare (in ) vec2 I@0x9ff6c0)\n" + " (declare (in ) vec2 Nref@0x9ff7d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x9ff9b0)\n" + " (declare (in ) vec3 I@0x9ffac0)\n" + " (declare (in ) vec3 Nref@0x9ffbd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x9ffdb0)\n" + " (declare (in ) vec4 I@0x9ffec0)\n" + " (declare (in ) vec4 Nref@0x9fffd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0xa001b0)\n" + " (declare (in ) float N@0xa002c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0xa00680)\n" + " (declare (in ) vec2 N@0xa00790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0xa00970)\n" + " (declare (in ) vec3 N@0xa00a80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0xa00c60)\n" + " (declare (in ) vec4 N@0xa00d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0xa00f50)\n" + " (declare (in ) float N@0xa01060)\n" + " (declare (in ) float eta@0xa01170)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0xa01530)\n" + " (declare (in ) vec2 N@0xa01640)\n" + " (declare (in ) float eta@0xa01750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0xa01930)\n" + " (declare (in ) vec3 N@0xa01a40)\n" + " (declare (in ) float eta@0xa01b50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0xa01d30)\n" + " (declare (in ) vec4 N@0xa01e40)\n" + " (declare (in ) float eta@0xa01f50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0xa02130)\n" + " (declare (in ) mat2 y@0xa02240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0xa02600)\n" + " (declare (in ) mat3 y@0xa02710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0xa028f0)\n" + " (declare (in ) mat4 y@0xa02a00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa02be0)\n" + " (declare (in ) vec2 y@0xa02cf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa030b0)\n" + " (declare (in ) vec3 y@0xa031c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa033a0)\n" + " (declare (in ) vec4 y@0xa034b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa03690)\n" + " (declare (in ) ivec2 y@0xa037a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa03980)\n" + " (declare (in ) ivec3 y@0xa03a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa03c70)\n" + " (declare (in ) ivec4 y@0xa03d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa03f60)\n" + " (declare (in ) vec2 y@0xa04070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa04430)\n" + " (declare (in ) vec3 y@0xa04540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa04720)\n" + " (declare (in ) vec4 y@0xa04830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa04a10)\n" + " (declare (in ) ivec2 y@0xa04b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa04d00)\n" + " (declare (in ) ivec3 y@0xa04e10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa04ff0)\n" + " (declare (in ) ivec4 y@0xa05100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa052e0)\n" + " (declare (in ) vec2 y@0xa053f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa057b0)\n" + " (declare (in ) vec3 y@0xa058c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa05aa0)\n" + " (declare (in ) vec4 y@0xa05bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa05d90)\n" + " (declare (in ) ivec2 y@0xa05ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa06080)\n" + " (declare (in ) ivec3 y@0xa06190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa06370)\n" + " (declare (in ) ivec4 y@0xa06480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa06660)\n" + " (declare (in ) vec2 y@0xa06770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa06b30)\n" + " (declare (in ) vec3 y@0xa06c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa06e20)\n" + " (declare (in ) vec4 y@0xa06f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa07110)\n" + " (declare (in ) ivec2 y@0xa07220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa07400)\n" + " (declare (in ) ivec3 y@0xa07510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa076f0)\n" + " (declare (in ) ivec4 y@0xa07800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa079e0)\n" + " (declare (in ) vec2 y@0xa07af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa07ea0)\n" + " (declare (in ) vec3 y@0xa07fb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa08190)\n" + " (declare (in ) vec4 y@0xa082a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa08480)\n" + " (declare (in ) ivec2 y@0xa08590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa08770)\n" + " (declare (in ) ivec3 y@0xa08880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa08a60)\n" + " (declare (in ) ivec4 y@0xa08b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0xa08d50)\n" + " (declare (in ) bvec2 y@0xa08e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0xa09040)\n" + " (declare (in ) bvec3 y@0xa09150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0xa09330)\n" + " (declare (in ) bvec4 y@0xa09440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa09620)\n" + " (declare (in ) vec2 y@0xa09730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa09af0)\n" + " (declare (in ) vec3 y@0xa09c00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa09de0)\n" + " (declare (in ) vec4 y@0xa09ef0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0xa0a0d0)\n" + " (declare (in ) ivec2 y@0xa0a1e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0xa0a3c0)\n" + " (declare (in ) ivec3 y@0xa0a4d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0xa0a6b0)\n" + " (declare (in ) ivec4 y@0xa0a7c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0xa0a9a0)\n" + " (declare (in ) bvec2 y@0xa0aab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0xa0ac90)\n" + " (declare (in ) bvec3 y@0xa0ada0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0xa0af80)\n" + " (declare (in ) bvec4 y@0xa0b090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0xa0b270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0xa0b620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0xa0b800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0xa0b9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0xa0bd90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0xa0bf70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0xa0c150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0xa0c500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0xa0c6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0c8c0)\n" + " (declare (in ) float coord@0xa0c9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0cda0)\n" + " (declare (in ) vec2 coord@0xa0cec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0d280)\n" + " (declare (in ) vec4 coord@0xa0d3a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0d580)\n" + " (declare (in ) float coord@0xa0d6a0)\n" + " (declare (in ) float lod@0xa0d7b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0db70)\n" + " (declare (in ) vec2 coord@0xa0dc90)\n" + " (declare (in ) float lod@0xa0dda0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0xa0e160)\n" + " (declare (in ) vec4 coord@0xa0e280)\n" + " (declare (in ) float lod@0xa0e390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0e570)\n" + " (declare (in ) vec2 coord@0xa0e690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0ea50)\n" + " (declare (in ) vec3 coord@0xa0eb70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0ef30)\n" + " (declare (in ) vec4 coord@0xa0f050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0f230)\n" + " (declare (in ) vec2 coord@0xa0f350)\n" + " (declare (in ) float lod@0xa0f460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0f820)\n" + " (declare (in ) vec3 coord@0xa0f940)\n" + " (declare (in ) float lod@0xa0fa50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0xa0fe10)\n" + " (declare (in ) vec4 coord@0xa0ff30)\n" + " (declare (in ) float lod@0xa10040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0xa10220)\n" + " (declare (in ) vec3 coord@0xa10340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0xa10700)\n" + " (declare (in ) vec4 coord@0xa10820)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0xa10be0)\n" + " (declare (in ) vec3 coord@0xa10d00)\n" + " (declare (in ) float lod@0xa10e10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0xa111d0)\n" + " (declare (in ) vec4 coord@0xa112f0)\n" + " (declare (in ) float lod@0xa11400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0xa117c0)\n" + " (declare (in ) vec3 coord@0xa118e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0xa11ca0)\n" + " (declare (in ) vec3 coord@0xa11dc0)\n" + " (declare (in ) float lod@0xa11ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0xa12290)\n" + " (declare (in ) vec3 coord@0xa123b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0xa12770)\n" + " (declare (in ) vec3 coord@0xa12890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0xa12c50)\n" + " (declare (in ) vec4 coord@0xa12d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0xa13130)\n" + " (declare (in ) vec4 coord@0xa13250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0xa13610)\n" + " (declare (in ) vec3 coord@0xa13730)\n" + " (declare (in ) float lod@0xa13840)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0xa13c00)\n" + " (declare (in ) vec3 coord@0xa13d20)\n" + " (declare (in ) float lod@0xa13e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0xa141f0)\n" + " (declare (in ) vec4 coord@0xa14310)\n" + " (declare (in ) float lod@0xa14420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0xa147e0)\n" + " (declare (in ) vec4 coord@0xa14900)\n" + " (declare (in ) float lod@0xa14a10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0xa14dd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa15180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa15360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa15540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0xa15720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa15ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa15cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa15e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0xa16070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa16420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa16600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa167e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0xa169c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0xa16d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0xa16f50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0xa17130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_110_vert [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_shadow2DProjLod, + builtin_noise2, + builtin_texture3DProjLod, + builtin_pow, + builtin_texture2DProj, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_shadow2DProj, + builtin_shadow1DProjLod, + builtin_any, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_texture3DLod, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_shadow1DLod, + builtin_ftransform, + builtin_sin, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_all, + builtin_log2, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_shadow1DProj, + builtin_ceil, + builtin_reflect, + builtin_textureCubeLod, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_not, + builtin_texture2DProjLod, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_texture2DLod, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_texture1DProjLod, + builtin_textureCube, + builtin_length, + builtin_texture1DLod, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, +}; +static const char *prototypes_for_110_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x151ee40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x151f210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x151f400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x151f5f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x151f7e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x151fbb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x151fda0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x151ff90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x1520180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1520530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1520710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x15208f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x1520ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1520e80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1521060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x1521240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x1521420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x15217d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x15219b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x1521b90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x1521d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1522120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1522300)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x15224e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x15226c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1522a70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1522c50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x1522e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x1523010)\n" + " (declare (in ) float x@0x1523120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x15234d0)\n" + " (declare (in ) vec2 x@0x15235e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x15237c0)\n" + " (declare (in ) vec3 x@0x15238d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x1523ab0)\n" + " (declare (in ) vec4 x@0x1523bc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x1523da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x1523f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x1524180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x1524370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1524560)\n" + " (declare (in ) float y@0x1524670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1524a20)\n" + " (declare (in ) vec2 y@0x1524b30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1524d10)\n" + " (declare (in ) vec3 y@0x1524e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1525000)\n" + " (declare (in ) vec4 y@0x1525110)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x15252f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x15256a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1525880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1525a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1525c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1525ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15261d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x15263b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1526590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1526940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1526b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1526d00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1526ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1527290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1527470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1527650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1527830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1527be0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1527dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1527fa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1528180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1528540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1528720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1528900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1528ae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1528e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1529070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1529250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1529430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x15297e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15299c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1529ba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1529d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152a130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152a310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152a4f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152a6d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152aa80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152ac60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152ae40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152b020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152b3d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152b5b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152b790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152b970)\n" + " (declare (in ) float y@0x152ba80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152be30)\n" + " (declare (in ) float y@0x152bf40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152c120)\n" + " (declare (in ) float y@0x152c230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152c410)\n" + " (declare (in ) float y@0x152c520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152c700)\n" + " (declare (in ) vec2 y@0x152c810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152c9f0)\n" + " (declare (in ) vec3 y@0x152cb00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152cce0)\n" + " (declare (in ) vec4 y@0x152cdf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152cfd0)\n" + " (declare (in ) float y@0x152d0e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152d490)\n" + " (declare (in ) vec2 y@0x152d5a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152d780)\n" + " (declare (in ) vec3 y@0x152d890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152da70)\n" + " (declare (in ) vec4 y@0x152db80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152dd60)\n" + " (declare (in ) float y@0x152de70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152e050)\n" + " (declare (in ) float y@0x152e160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152e340)\n" + " (declare (in ) float y@0x152e450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152e630)\n" + " (declare (in ) float y@0x152e740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152eaf0)\n" + " (declare (in ) vec2 y@0x152ec00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152ede0)\n" + " (declare (in ) vec3 y@0x152eef0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152f0d0)\n" + " (declare (in ) vec4 y@0x152f1e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x152f3c0)\n" + " (declare (in ) float y@0x152f4d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x152f6b0)\n" + " (declare (in ) float y@0x152f7c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x152f9a0)\n" + " (declare (in ) float y@0x152fab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x152fc90)\n" + " (declare (in ) float minVal@0x152fda0)\n" + " (declare (in ) float maxVal@0x152feb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1530260)\n" + " (declare (in ) vec2 minVal@0x1530370)\n" + " (declare (in ) vec2 maxVal@0x1530480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1530660)\n" + " (declare (in ) vec3 minVal@0x1530770)\n" + " (declare (in ) vec3 maxVal@0x1530880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1530a60)\n" + " (declare (in ) vec4 minVal@0x1530b70)\n" + " (declare (in ) vec4 maxVal@0x1530c80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1530e60)\n" + " (declare (in ) float minVal@0x1530f70)\n" + " (declare (in ) float maxVal@0x1531080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1531260)\n" + " (declare (in ) float minVal@0x1531370)\n" + " (declare (in ) float maxVal@0x1531480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1531660)\n" + " (declare (in ) float minVal@0x1531770)\n" + " (declare (in ) float maxVal@0x1531880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1531a60)\n" + " (declare (in ) float y@0x1531b70)\n" + " (declare (in ) float a@0x1531c80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1532030)\n" + " (declare (in ) vec2 y@0x1532140)\n" + " (declare (in ) vec2 a@0x1532250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1532430)\n" + " (declare (in ) vec3 y@0x1532540)\n" + " (declare (in ) vec3 a@0x1532650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1532830)\n" + " (declare (in ) vec4 y@0x1532940)\n" + " (declare (in ) vec4 a@0x1532a50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1532c30)\n" + " (declare (in ) vec2 y@0x1532d40)\n" + " (declare (in ) float a@0x1532e50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1533030)\n" + " (declare (in ) vec3 y@0x1533140)\n" + " (declare (in ) float a@0x1533250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1533430)\n" + " (declare (in ) vec4 y@0x1533540)\n" + " (declare (in ) float a@0x1533650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x1533830)\n" + " (declare (in ) float x@0x1533940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x1533cf0)\n" + " (declare (in ) vec2 x@0x1533e00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x1533fe0)\n" + " (declare (in ) vec3 x@0x15340f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x15342d0)\n" + " (declare (in ) vec4 x@0x15343e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x15345c0)\n" + " (declare (in ) vec2 x@0x15346d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x15348b0)\n" + " (declare (in ) vec3 x@0x15349c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x1534ba0)\n" + " (declare (in ) vec4 x@0x1534cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x1534e90)\n" + " (declare (in ) float edge1@0x1534fa0)\n" + " (declare (in ) float x@0x15350b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x1535470)\n" + " (declare (in ) vec2 edge1@0x1535580)\n" + " (declare (in ) vec2 x@0x1535690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x1535870)\n" + " (declare (in ) vec3 edge1@0x1535980)\n" + " (declare (in ) vec3 x@0x1535a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x1535c70)\n" + " (declare (in ) vec4 edge1@0x1535d80)\n" + " (declare (in ) vec4 x@0x1535e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x1536070)\n" + " (declare (in ) float edge1@0x1536180)\n" + " (declare (in ) vec2 x@0x1536290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x1536470)\n" + " (declare (in ) float edge1@0x1536580)\n" + " (declare (in ) vec3 x@0x1536690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x1536870)\n" + " (declare (in ) float edge1@0x1536980)\n" + " (declare (in ) vec4 x@0x1536a90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1536c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1537020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1537200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x15373e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x15375c0)\n" + " (declare (in ) float p1@0x15376d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x1537a90)\n" + " (declare (in ) vec2 p1@0x1537ba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x1537d80)\n" + " (declare (in ) vec3 p1@0x1537e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x1538070)\n" + " (declare (in ) vec4 p1@0x1538180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1538360)\n" + " (declare (in ) float y@0x1538470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1538820)\n" + " (declare (in ) vec2 y@0x1538930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1538b10)\n" + " (declare (in ) vec3 y@0x1538c20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1538e00)\n" + " (declare (in ) vec4 y@0x1538f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15390f0)\n" + " (declare (in ) vec3 y@0x1539200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x15395b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1539970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1539b50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1539d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x1539f10)\n" + " (declare (in ) float I@0x153a020)\n" + " (declare (in ) float Nref@0x153a130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x153a4f0)\n" + " (declare (in ) vec2 I@0x153a600)\n" + " (declare (in ) vec2 Nref@0x153a710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x153a8f0)\n" + " (declare (in ) vec3 I@0x153aa00)\n" + " (declare (in ) vec3 Nref@0x153ab10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x153acf0)\n" + " (declare (in ) vec4 I@0x153ae00)\n" + " (declare (in ) vec4 Nref@0x153af10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x153b0f0)\n" + " (declare (in ) float N@0x153b200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x153b5c0)\n" + " (declare (in ) vec2 N@0x153b6d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x153b8b0)\n" + " (declare (in ) vec3 N@0x153b9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x153bba0)\n" + " (declare (in ) vec4 N@0x153bcb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x153be90)\n" + " (declare (in ) float N@0x153bfa0)\n" + " (declare (in ) float eta@0x153c0b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x153c470)\n" + " (declare (in ) vec2 N@0x153c580)\n" + " (declare (in ) float eta@0x153c690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x153c870)\n" + " (declare (in ) vec3 N@0x153c980)\n" + " (declare (in ) float eta@0x153ca90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x153cc70)\n" + " (declare (in ) vec4 N@0x153cd80)\n" + " (declare (in ) float eta@0x153ce90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0x153d070)\n" + " (declare (in ) mat2 y@0x153d180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0x153d540)\n" + " (declare (in ) mat3 y@0x153d650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0x153d830)\n" + " (declare (in ) mat4 y@0x153d940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x153db20)\n" + " (declare (in ) vec2 y@0x153dc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x153dff0)\n" + " (declare (in ) vec3 y@0x153e100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x153e2e0)\n" + " (declare (in ) vec4 y@0x153e3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x153e5d0)\n" + " (declare (in ) ivec2 y@0x153e6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x153e8c0)\n" + " (declare (in ) ivec3 y@0x153e9d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x153ebb0)\n" + " (declare (in ) ivec4 y@0x153ecc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x153eea0)\n" + " (declare (in ) vec2 y@0x153efb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x153f370)\n" + " (declare (in ) vec3 y@0x153f480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x153f660)\n" + " (declare (in ) vec4 y@0x153f770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x153f950)\n" + " (declare (in ) ivec2 y@0x153fa60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x153fc40)\n" + " (declare (in ) ivec3 y@0x153fd50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x153ff30)\n" + " (declare (in ) ivec4 y@0x1540040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1540220)\n" + " (declare (in ) vec2 y@0x1540330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15406f0)\n" + " (declare (in ) vec3 y@0x1540800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x15409e0)\n" + " (declare (in ) vec4 y@0x1540af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1540cd0)\n" + " (declare (in ) ivec2 y@0x1540de0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1540fc0)\n" + " (declare (in ) ivec3 y@0x15410d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x15412b0)\n" + " (declare (in ) ivec4 y@0x15413c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x15415a0)\n" + " (declare (in ) vec2 y@0x15416b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1541a70)\n" + " (declare (in ) vec3 y@0x1541b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1541d60)\n" + " (declare (in ) vec4 y@0x1541e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1542050)\n" + " (declare (in ) ivec2 y@0x1542160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1542340)\n" + " (declare (in ) ivec3 y@0x1542450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1542630)\n" + " (declare (in ) ivec4 y@0x1542740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1542920)\n" + " (declare (in ) vec2 y@0x1542a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1542de0)\n" + " (declare (in ) vec3 y@0x1542ef0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x15430d0)\n" + " (declare (in ) vec4 y@0x15431e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x15433c0)\n" + " (declare (in ) ivec2 y@0x15434d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x15436b0)\n" + " (declare (in ) ivec3 y@0x15437c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x15439a0)\n" + " (declare (in ) ivec4 y@0x1543ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x1543c90)\n" + " (declare (in ) bvec2 y@0x1543da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1543f80)\n" + " (declare (in ) bvec3 y@0x1544090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1544270)\n" + " (declare (in ) bvec4 y@0x1544380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1544560)\n" + " (declare (in ) vec2 y@0x1544670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1544a30)\n" + " (declare (in ) vec3 y@0x1544b40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1544d20)\n" + " (declare (in ) vec4 y@0x1544e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1545010)\n" + " (declare (in ) ivec2 y@0x1545120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1545300)\n" + " (declare (in ) ivec3 y@0x1545410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x15455f0)\n" + " (declare (in ) ivec4 y@0x1545700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x15458e0)\n" + " (declare (in ) bvec2 y@0x15459f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1545bd0)\n" + " (declare (in ) bvec3 y@0x1545ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1545ec0)\n" + " (declare (in ) bvec4 y@0x1545fd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x15461b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1546560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1546740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x1546920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1546cd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1546eb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x1547090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1547440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1547620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1547800)\n" + " (declare (in ) float coord@0x1547920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x15484c0)\n" + " (declare (in ) float coord@0x15485e0)\n" + " (declare (in ) float bias@0x15486f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1547ce0)\n" + " (declare (in ) vec2 coord@0x1547e00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x15481c0)\n" + " (declare (in ) vec4 coord@0x15482e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x15488d0)\n" + " (declare (in ) vec2 coord@0x15489f0)\n" + " (declare (in ) float bias@0x1548b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1548ce0)\n" + " (declare (in ) vec4 coord@0x1548e00)\n" + " (declare (in ) float bias@0x1548f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x15490f0)\n" + " (declare (in ) vec2 coord@0x1549210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1549db0)\n" + " (declare (in ) vec2 coord@0x1549ed0)\n" + " (declare (in ) float bias@0x1549fe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x15495d0)\n" + " (declare (in ) vec3 coord@0x15496f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1549ab0)\n" + " (declare (in ) vec4 coord@0x1549bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x154a1c0)\n" + " (declare (in ) vec3 coord@0x154a2e0)\n" + " (declare (in ) float bias@0x154a3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x154a5d0)\n" + " (declare (in ) vec4 coord@0x154a6f0)\n" + " (declare (in ) float bias@0x154a800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x154a9e0)\n" + " (declare (in ) vec3 coord@0x154ab00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x154b3a0)\n" + " (declare (in ) vec3 coord@0x154b4c0)\n" + " (declare (in ) float bias@0x154b5d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x154aec0)\n" + " (declare (in ) vec4 coord@0x154afe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x154b7b0)\n" + " (declare (in ) vec4 coord@0x154b8d0)\n" + " (declare (in ) float bias@0x154b9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x154bbc0)\n" + " (declare (in ) vec3 coord@0x154bce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x154c0a0)\n" + " (declare (in ) vec3 coord@0x154c1c0)\n" + " (declare (in ) float bias@0x154c2d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x154c4b0)\n" + " (declare (in ) vec3 coord@0x154c5d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x154d830)\n" + " (declare (in ) vec3 coord@0x154d950)\n" + " (declare (in ) float bias@0x154da60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x154c990)\n" + " (declare (in ) vec3 coord@0x154cab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x154dc40)\n" + " (declare (in ) vec3 coord@0x154dd60)\n" + " (declare (in ) float bias@0x154de70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x154ce70)\n" + " (declare (in ) vec4 coord@0x154cf90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x154e050)\n" + " (declare (in ) vec4 coord@0x154e170)\n" + " (declare (in ) float bias@0x154e280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x154d350)\n" + " (declare (in ) vec4 coord@0x154d470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x154e460)\n" + " (declare (in ) vec4 coord@0x154e580)\n" + " (declare (in ) float bias@0x154e690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x154e870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x154ec20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x154ee00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x154efe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x154f1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x154f570)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x154f750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x154f930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x154fb10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x154fec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x15500a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x1550280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1550460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1550810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15509f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1550bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0x1550db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1551160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1551340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1551520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0x1551700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1551ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1551c90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1551e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0x1552050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1552400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0x15525e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x15527c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_110_frag [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_noise2, + builtin_pow, + builtin_texture2DProj, + builtin_fwidth, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_any, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_shadow2DProj, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_dFdx, + builtin_sin, + builtin_shadow2D, + builtin_all, + builtin_log2, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_shadow1DProj, + builtin_ceil, + builtin_reflect, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_not, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_textureCube, + builtin_length, + builtin_dFdy, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, +}; +static const char *prototypes_for_EXT_texture_array_vert = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x25ee5c0)\n" + " (declare (in ) vec2 coord@0x25ee6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x25eeaa0)\n" + " (declare (in ) vec2 coord@0x25eebc0)\n" + " (declare (in ) float lod@0x25eecd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x25ef090)\n" + " (declare (in ) vec2 coord@0x25ef1b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x25ef570)\n" + " (declare (in ) vec2 coord@0x25ef690)\n" + " (declare (in ) float lod@0x25ef7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x25efb60)\n" + " (declare (in ) vec3 coord@0x25efc80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x25f0040)\n" + " (declare (in ) vec3 coord@0x25f0160)\n" + " (declare (in ) float lod@0x25f0270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0x25f0630)\n" + " (declare (in ) vec4 coord@0x25f0750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_EXT_texture_array_vert [] = { + builtin_texture1DArrayLod, + builtin_shadow2DArray, + builtin_texture2DArrayLod, + builtin_shadow1DArrayLod, + builtin_shadow1DArray, + builtin_texture2DArray, + builtin_texture1DArray, +}; +static const char *prototypes_for_ARB_texture_rectangle_vert = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x1cc28a0)\n" + " (declare (in ) vec2 coord@0x1cc29c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x1cc2d80)\n" + " (declare (in ) vec3 coord@0x1cc2ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x1cc3260)\n" + " (declare (in ) vec4 coord@0x1cc3380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x1cc3560)\n" + " (declare (in ) vec3 coord@0x1cc3680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x1cc3a40)\n" + " (declare (in ) vec4 coord@0x1cc3b60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_ARB_texture_rectangle_vert [] = { + builtin_texture2DRect, + builtin_shadow2DRectProj, + builtin_shadow2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_ARB_texture_rectangle_frag = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x13d0040)\n" + " (declare (in ) vec2 coord@0x13d0160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x13d0520)\n" + " (declare (in ) vec3 coord@0x13d0640)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x13d0a00)\n" + " (declare (in ) vec4 coord@0x13d0b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x13d0d00)\n" + " (declare (in ) vec3 coord@0x13d0e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x13d11e0)\n" + " (declare (in ) vec4 coord@0x13d1300)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_ARB_texture_rectangle_frag [] = { + builtin_texture2DRect, + builtin_shadow2DRectProj, + builtin_shadow2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_120_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x8b57e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x8b5bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x8b5da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x8b5f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x8b6180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x8b6550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x8b6740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x8b6930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x8b6b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x8b6ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x8b70b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x8b7290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x8b7470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x8b7820)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x8b7a00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x8b7be0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x8b7dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x8b8170)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x8b8350)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x8b8530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x8b8710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x8b8ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x8b8ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x8b8e80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x8b9060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x8b9410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x8b95f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x8b97d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x8b99b0)\n" + " (declare (in ) float x@0x8b9ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x8b9e70)\n" + " (declare (in ) vec2 x@0x8b9f80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x8ba160)\n" + " (declare (in ) vec3 x@0x8ba270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x8ba450)\n" + " (declare (in ) vec4 x@0x8ba560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x8ba740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x8ba930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x8bab20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x8bad10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8baf00)\n" + " (declare (in ) float y@0x8bb010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bb3c0)\n" + " (declare (in ) vec2 y@0x8bb4d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bb6b0)\n" + " (declare (in ) vec3 y@0x8bb7c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bb9a0)\n" + " (declare (in ) vec4 y@0x8bbab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bbc90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bc040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bc220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bc400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bc5e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bc990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bcb70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bcd50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bcf30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bd2e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bd4c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bd6a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bd880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bdc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bde10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bdff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8be1d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8be580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8be760)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8be940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8beb20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8beee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bf0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bf2a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bf480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8bf830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8bfa10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8bfbf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8bfdd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c0180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c0360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c0540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c0720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c0ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c0cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c0e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c1070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c1420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c1600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c17e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c19c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c1d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c1f50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c2130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c2310)\n" + " (declare (in ) float y@0x8c2420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c27d0)\n" + " (declare (in ) float y@0x8c28e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c2ac0)\n" + " (declare (in ) float y@0x8c2bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c2db0)\n" + " (declare (in ) float y@0x8c2ec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c30a0)\n" + " (declare (in ) vec2 y@0x8c31b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c3390)\n" + " (declare (in ) vec3 y@0x8c34a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c3680)\n" + " (declare (in ) vec4 y@0x8c3790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c3970)\n" + " (declare (in ) float y@0x8c3a80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c3e30)\n" + " (declare (in ) vec2 y@0x8c3f40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c4120)\n" + " (declare (in ) vec3 y@0x8c4230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c4410)\n" + " (declare (in ) vec4 y@0x8c4520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c4700)\n" + " (declare (in ) float y@0x8c4810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c49f0)\n" + " (declare (in ) float y@0x8c4b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c4ce0)\n" + " (declare (in ) float y@0x8c4df0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c4fd0)\n" + " (declare (in ) float y@0x8c50e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c5490)\n" + " (declare (in ) vec2 y@0x8c55a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c5780)\n" + " (declare (in ) vec3 y@0x8c5890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c5a70)\n" + " (declare (in ) vec4 y@0x8c5b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c5d60)\n" + " (declare (in ) float y@0x8c5e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c6050)\n" + " (declare (in ) float y@0x8c6160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c6340)\n" + " (declare (in ) float y@0x8c6450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c6630)\n" + " (declare (in ) float minVal@0x8c6740)\n" + " (declare (in ) float maxVal@0x8c6850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c6c00)\n" + " (declare (in ) vec2 minVal@0x8c6d10)\n" + " (declare (in ) vec2 maxVal@0x8c6e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c7000)\n" + " (declare (in ) vec3 minVal@0x8c7110)\n" + " (declare (in ) vec3 maxVal@0x8c7220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c7400)\n" + " (declare (in ) vec4 minVal@0x8c7510)\n" + " (declare (in ) vec4 maxVal@0x8c7620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c7800)\n" + " (declare (in ) float minVal@0x8c7910)\n" + " (declare (in ) float maxVal@0x8c7a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c7c00)\n" + " (declare (in ) float minVal@0x8c7d10)\n" + " (declare (in ) float maxVal@0x8c7e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c8000)\n" + " (declare (in ) float minVal@0x8c8110)\n" + " (declare (in ) float maxVal@0x8c8220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8c8400)\n" + " (declare (in ) float y@0x8c8510)\n" + " (declare (in ) float a@0x8c8620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c89d0)\n" + " (declare (in ) vec2 y@0x8c8ae0)\n" + " (declare (in ) vec2 a@0x8c8bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c8dd0)\n" + " (declare (in ) vec3 y@0x8c8ee0)\n" + " (declare (in ) vec3 a@0x8c8ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c91d0)\n" + " (declare (in ) vec4 y@0x8c92e0)\n" + " (declare (in ) vec4 a@0x8c93f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8c95d0)\n" + " (declare (in ) vec2 y@0x8c96e0)\n" + " (declare (in ) float a@0x8c97f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8c99d0)\n" + " (declare (in ) vec3 y@0x8c9ae0)\n" + " (declare (in ) float a@0x8c9bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8c9dd0)\n" + " (declare (in ) vec4 y@0x8c9ee0)\n" + " (declare (in ) float a@0x8c9ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x8ca1d0)\n" + " (declare (in ) float x@0x8ca2e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x8ca690)\n" + " (declare (in ) vec2 x@0x8ca7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x8ca980)\n" + " (declare (in ) vec3 x@0x8caa90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x8cac70)\n" + " (declare (in ) vec4 x@0x8cad80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x8caf60)\n" + " (declare (in ) vec2 x@0x8cb070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x8cb250)\n" + " (declare (in ) vec3 x@0x8cb360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x8cb540)\n" + " (declare (in ) vec4 x@0x8cb650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x8cb830)\n" + " (declare (in ) float edge1@0x8cb940)\n" + " (declare (in ) float x@0x8cba50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x8cbe10)\n" + " (declare (in ) vec2 edge1@0x8cbf20)\n" + " (declare (in ) vec2 x@0x8cc030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x8cc210)\n" + " (declare (in ) vec3 edge1@0x8cc320)\n" + " (declare (in ) vec3 x@0x8cc430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x8cc610)\n" + " (declare (in ) vec4 edge1@0x8cc720)\n" + " (declare (in ) vec4 x@0x8cc830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x8cca10)\n" + " (declare (in ) float edge1@0x8ccb20)\n" + " (declare (in ) vec2 x@0x8ccc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x8cce10)\n" + " (declare (in ) float edge1@0x8ccf20)\n" + " (declare (in ) vec3 x@0x8cd030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x8cd210)\n" + " (declare (in ) float edge1@0x8cd320)\n" + " (declare (in ) vec4 x@0x8cd430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8cd610)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8cd9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8cdba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8cdd80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x8cdf60)\n" + " (declare (in ) float p1@0x8ce070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x8ce430)\n" + " (declare (in ) vec2 p1@0x8ce540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x8ce720)\n" + " (declare (in ) vec3 p1@0x8ce830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x8cea10)\n" + " (declare (in ) vec4 p1@0x8ceb20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8ced00)\n" + " (declare (in ) float y@0x8cee10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8cf1c0)\n" + " (declare (in ) vec2 y@0x8cf2d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8cf4b0)\n" + " (declare (in ) vec3 y@0x8cf5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8cf7a0)\n" + " (declare (in ) vec4 y@0x8cf8b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8cfa90)\n" + " (declare (in ) vec3 y@0x8cfba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8cff50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8d0310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8d04f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8d06d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x8d08b0)\n" + " (declare (in ) float I@0x8d09c0)\n" + " (declare (in ) float Nref@0x8d0ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x8d0e90)\n" + " (declare (in ) vec2 I@0x8d0fa0)\n" + " (declare (in ) vec2 Nref@0x8d10b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x8d1290)\n" + " (declare (in ) vec3 I@0x8d13a0)\n" + " (declare (in ) vec3 Nref@0x8d14b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x8d1690)\n" + " (declare (in ) vec4 I@0x8d17a0)\n" + " (declare (in ) vec4 Nref@0x8d18b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x8d1a90)\n" + " (declare (in ) float N@0x8d1ba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x8d1f60)\n" + " (declare (in ) vec2 N@0x8d2070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x8d2250)\n" + " (declare (in ) vec3 N@0x8d2360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x8d2540)\n" + " (declare (in ) vec4 N@0x8d2650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x8d2830)\n" + " (declare (in ) float N@0x8d2940)\n" + " (declare (in ) float eta@0x8d2a50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x8d2e10)\n" + " (declare (in ) vec2 N@0x8d2f20)\n" + " (declare (in ) float eta@0x8d3030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x8d3210)\n" + " (declare (in ) vec3 N@0x8d3320)\n" + " (declare (in ) float eta@0x8d3430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x8d3610)\n" + " (declare (in ) vec4 N@0x8d3720)\n" + " (declare (in ) float eta@0x8d3830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0x8d3a10)\n" + " (declare (in ) mat2 y@0x8d3b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0x8d3ee0)\n" + " (declare (in ) mat3 y@0x8d3ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0x8d41d0)\n" + " (declare (in ) mat4 y@0x8d42e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat2x3 x@0x8d44c0)\n" + " (declare (in ) mat2x3 y@0x8d45d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat2x4 x@0x8d47b0)\n" + " (declare (in ) mat2x4 y@0x8d48c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat3x2 x@0x8d4aa0)\n" + " (declare (in ) mat3x2 y@0x8d4bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat3x4 x@0x8d4d90)\n" + " (declare (in ) mat3x4 y@0x8d4ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat4x2 x@0x8d5080)\n" + " (declare (in ) mat4x2 y@0x8d5190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat4x3 x@0x8d5370)\n" + " (declare (in ) mat4x3 y@0x8d5480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x8d5660)\n" + " (declare (in ) vec2 r@0x8d5770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x8d5b30)\n" + " (declare (in ) vec3 r@0x8d5c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x8d5e20)\n" + " (declare (in ) vec4 r@0x8d5f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x8d6110)\n" + " (declare (in ) vec2 r@0x8d6220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x8d6400)\n" + " (declare (in ) vec3 r@0x8d6510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x8d66f0)\n" + " (declare (in ) vec2 r@0x8d6800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x8d69e0)\n" + " (declare (in ) vec4 r@0x8d6af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x8d6cd0)\n" + " (declare (in ) vec3 r@0x8d6de0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x8d6fc0)\n" + " (declare (in ) vec4 r@0x8d70d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 m@0x8d72b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 m@0x8d7670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 m@0x8d7850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat3x2 m@0x8d7a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat2x3 m@0x8d7c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat4x2 m@0x8d7df0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat2x4 m@0x8d7fd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat4x3 m@0x8d81b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat3x4 m@0x8d8390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8d8570)\n" + " (declare (in ) vec2 y@0x8d8680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8d8a40)\n" + " (declare (in ) vec3 y@0x8d8b50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8d8d30)\n" + " (declare (in ) vec4 y@0x8d8e40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8d9020)\n" + " (declare (in ) ivec2 y@0x8d9130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8d9310)\n" + " (declare (in ) ivec3 y@0x8d9420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8d9600)\n" + " (declare (in ) ivec4 y@0x8d9710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8d98f0)\n" + " (declare (in ) vec2 y@0x8d9a00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8d9dc0)\n" + " (declare (in ) vec3 y@0x8d9ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8da0b0)\n" + " (declare (in ) vec4 y@0x8da1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8da3a0)\n" + " (declare (in ) ivec2 y@0x8da4b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8da690)\n" + " (declare (in ) ivec3 y@0x8da7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8da980)\n" + " (declare (in ) ivec4 y@0x8daa90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8dac70)\n" + " (declare (in ) vec2 y@0x8dad80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8db140)\n" + " (declare (in ) vec3 y@0x8db250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8db430)\n" + " (declare (in ) vec4 y@0x8db540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8db720)\n" + " (declare (in ) ivec2 y@0x8db830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8dba10)\n" + " (declare (in ) ivec3 y@0x8dbb20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8dbd00)\n" + " (declare (in ) ivec4 y@0x8dbe10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8dbff0)\n" + " (declare (in ) vec2 y@0x8dc100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8dc4c0)\n" + " (declare (in ) vec3 y@0x8dc5d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8dc7b0)\n" + " (declare (in ) vec4 y@0x8dc8c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8dcaa0)\n" + " (declare (in ) ivec2 y@0x8dcbb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8dcd90)\n" + " (declare (in ) ivec3 y@0x8dcea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8dd080)\n" + " (declare (in ) ivec4 y@0x8dd190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8dd370)\n" + " (declare (in ) vec2 y@0x8dd480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8dd830)\n" + " (declare (in ) vec3 y@0x8dd940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8ddb20)\n" + " (declare (in ) vec4 y@0x8ddc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8dde10)\n" + " (declare (in ) ivec2 y@0x8ddf20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8de100)\n" + " (declare (in ) ivec3 y@0x8de210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8de3f0)\n" + " (declare (in ) ivec4 y@0x8de500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x8de6e0)\n" + " (declare (in ) bvec2 y@0x8de7f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x8de9d0)\n" + " (declare (in ) bvec3 y@0x8deae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x8decc0)\n" + " (declare (in ) bvec4 y@0x8dedd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8defb0)\n" + " (declare (in ) vec2 y@0x8df0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8df480)\n" + " (declare (in ) vec3 y@0x8df590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8df770)\n" + " (declare (in ) vec4 y@0x8df880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x8dfa60)\n" + " (declare (in ) ivec2 y@0x8dfb70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x8dfd50)\n" + " (declare (in ) ivec3 y@0x8dfe60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x8e0040)\n" + " (declare (in ) ivec4 y@0x8e0150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x8e0330)\n" + " (declare (in ) bvec2 y@0x8e0440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x8e0620)\n" + " (declare (in ) bvec3 y@0x8e0730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x8e0910)\n" + " (declare (in ) bvec4 y@0x8e0a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x8e0c00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x8e0fb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x8e1190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x8e1370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x8e1720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x8e1900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x8e1ae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x8e1e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x8e2070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e2250)\n" + " (declare (in ) float coord@0x8e2370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e2f10)\n" + " (declare (in ) float coord@0x8e3030)\n" + " (declare (in ) float bias@0x8e3140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e2730)\n" + " (declare (in ) vec2 coord@0x8e2850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e2c10)\n" + " (declare (in ) vec4 coord@0x8e2d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e3320)\n" + " (declare (in ) vec2 coord@0x8e3440)\n" + " (declare (in ) float bias@0x8e3550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x8e3730)\n" + " (declare (in ) vec4 coord@0x8e3850)\n" + " (declare (in ) float bias@0x8e3960)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e3b40)\n" + " (declare (in ) vec2 coord@0x8e3c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e4800)\n" + " (declare (in ) vec2 coord@0x8e4920)\n" + " (declare (in ) float bias@0x8e4a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e4020)\n" + " (declare (in ) vec3 coord@0x8e4140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e4500)\n" + " (declare (in ) vec4 coord@0x8e4620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e4c10)\n" + " (declare (in ) vec3 coord@0x8e4d30)\n" + " (declare (in ) float bias@0x8e4e40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x8e5020)\n" + " (declare (in ) vec4 coord@0x8e5140)\n" + " (declare (in ) float bias@0x8e5250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x8e5430)\n" + " (declare (in ) vec3 coord@0x8e5550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x8e5df0)\n" + " (declare (in ) vec3 coord@0x8e5f10)\n" + " (declare (in ) float bias@0x8e6020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x8e5910)\n" + " (declare (in ) vec4 coord@0x8e5a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x8e6200)\n" + " (declare (in ) vec4 coord@0x8e6320)\n" + " (declare (in ) float bias@0x8e6430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x8e6610)\n" + " (declare (in ) vec3 coord@0x8e6730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x8e6af0)\n" + " (declare (in ) vec3 coord@0x8e6c10)\n" + " (declare (in ) float bias@0x8e6d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x8e6f00)\n" + " (declare (in ) vec3 coord@0x8e7020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x8e8280)\n" + " (declare (in ) vec3 coord@0x8e83a0)\n" + " (declare (in ) float bias@0x8e84b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x8e73e0)\n" + " (declare (in ) vec3 coord@0x8e7500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x8e8690)\n" + " (declare (in ) vec3 coord@0x8e87b0)\n" + " (declare (in ) float bias@0x8e88c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x8e78c0)\n" + " (declare (in ) vec4 coord@0x8e79e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x8e8aa0)\n" + " (declare (in ) vec4 coord@0x8e8bc0)\n" + " (declare (in ) float bias@0x8e8cd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x8e7da0)\n" + " (declare (in ) vec4 coord@0x8e7ec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x8e8eb0)\n" + " (declare (in ) vec4 coord@0x8e8fd0)\n" + " (declare (in ) float bias@0x8e90e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x8e92c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x8e9670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x8e9850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x8e9a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x8e9c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x8e9fc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x8ea1a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x8ea380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x8ea560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x8ea910)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler1D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x8eaaf0)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x8eacd0)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + ")\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x8eaeb0)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8eb260)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8eb440)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler2D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8eb620)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + ")\n" "\n" - " (signature ivec4\n" - " (parameters\n" - " (declare (in) isampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0x8eb800)\n" + " )\n" + " (\n" + " ))\n" "\n" - " (signature uvec4\n" - " (parameters\n" - " (declare (in) usampler3D sampler)\n" - " (declare (in) vec4 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8ebbb0)\n" + " )\n" + " (\n" + " ))\n" "\n" - "))\n" -}; - -static const char *functions_for_130_fs [] = { - builtins_130_fs_texture, - builtins_130_fs_textureProj, -}; - -/* ARB_texture_rectangle builtins */ - -static const char *builtins_ARB_texture_rectangle_textures = { - "((function texture2DRect\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DRect sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8ebd90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8ebf70)\n" + " )\n" + " (\n" + " ))\n" "\n" ")\n" - " (function shadow2DRect\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DRectShadow sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" - "))\n" -}; - -static const char *functions_for_ARB_texture_rectangle [] = { - builtins_ARB_texture_rectangle_textures, -}; - -/* EXT_texture_array builtins */ - -static const char *builtins_EXT_texture_array_textures = { - "((function texture1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0x8ec150)\n" + " )\n" + " (\n" + " ))\n" "\n" - ")\n" - " (function texture1DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8ec500)\n" + " )\n" + " (\n" + " ))\n" "\n" - ")\n" - " (function texture2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8ec6e0)\n" + " )\n" + " (\n" + " ))\n" "\n" - ")\n" - " (function texture2DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8ec8c0)\n" + " )\n" + " (\n" + " ))\n" "\n" ")\n" - " (function shadow1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P) )\n" - " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" "\n" - ")\n" - " (function shadow1DArrayLod\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float lod) )\n" - " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0x8ecaa0)\n" + " )\n" + " (\n" + " ))\n" "\n" - ")\n" - " (function shadow2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArrayShadow sampler)\n" - " (declare (in) vec4 P) )\n" - " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) ))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0x8ece50)\n" + " )\n" + " (\n" + " ))\n" "\n" - "))\n" -}; - -static const char *functions_for_EXT_texture_array [] = { - builtins_EXT_texture_array_textures, -}; - -/* EXT_texture_array_fs builtins */ - -static const char *builtins_EXT_texture_array_fs_textures = { - "((function texture1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArray sampler)\n" - " (declare (in) vec2 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0x8ed030)\n" + " )\n" + " (\n" + " ))\n" "\n" - ")\n" - " (function texture2DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler2DArray sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x8ed210)\n" + " )\n" + " (\n" + " ))\n" "\n" ")\n" - " (function shadow1DArray\n" - " (signature vec4\n" - " (parameters\n" - " (declare (in) sampler1DArrayShadow sampler)\n" - " (declare (in) vec3 P) \n" - " (declare (in) float bias) )\n" - " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" "\n" - "))\n" -}; - -static const char *functions_for_EXT_texture_array_fs [] = { - builtins_EXT_texture_array_fs_textures, + "\n" + ")" +; +static const char *functions_for_120_frag [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_noise2, + builtin_pow, + builtin_texture2DProj, + builtin_fwidth, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_any, + builtin_shadow1DProj, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_shadow2DProj, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_dFdx, + builtin_sin, + builtin_shadow2D, + builtin_all, + builtin_log2, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_transpose, + builtin_outerProduct, + builtin_ceil, + builtin_reflect, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_not, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_textureCube, + builtin_length, + builtin_dFdy, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, }; void *builtin_mem_ctx = NULL; @@ -4810,134 +14684,137 @@ _mesa_glsl_release_functions(void) void _mesa_glsl_initialize_functions(exec_list *instructions, - struct _mesa_glsl_parse_state *state) + struct _mesa_glsl_parse_state *state) { if (builtin_mem_ctx == NULL) builtin_mem_ctx = talloc_init("GLSL built-in functions"); state->num_builtins_to_link = 0; - if (state->language_version >= 110) { - static gl_shader *sh = NULL; - - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_110, - Elements(functions_for_110)); - talloc_steal(builtin_mem_ctx, sh); - } - - import_prototypes(sh->ir, instructions, state->symbols, state); - state->builtins_to_link[state->num_builtins_to_link] = sh; - state->num_builtins_to_link++; - } - if (state->target == fragment_shader && state->language_version >= 110) { + if (state->target == vertex_shader && state->language_version == 120) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_110_fs, - Elements(functions_for_110_fs)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_120_vert, + functions_for_120_vert, + Elements(functions_for_120_vert )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->target == vertex_shader && state->language_version >= 110) { + if (state->target == fragment_shader && state->EXT_texture_array_enable) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_110_vs, - Elements(functions_for_110_vs)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_EXT_texture_array_frag, + functions_for_EXT_texture_array_frag, + Elements(functions_for_EXT_texture_array_frag )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->language_version >= 120) { + if (state->target == vertex_shader && state->language_version == 110) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_120, - Elements(functions_for_120)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_110_vert, + functions_for_110_vert, + Elements(functions_for_110_vert )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->language_version >= 130) { + if (state->target == fragment_shader && state->language_version == 110) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_130, - Elements(functions_for_130)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_110_frag, + functions_for_110_frag, + Elements(functions_for_110_frag )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->language_version >= 130) { + if (state->target == vertex_shader && state->EXT_texture_array_enable) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_130_fs, - Elements(functions_for_130_fs)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_EXT_texture_array_vert, + functions_for_EXT_texture_array_vert, + Elements(functions_for_EXT_texture_array_vert )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->ARB_texture_rectangle_enable) { + if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_ARB_texture_rectangle, - Elements(functions_for_ARB_texture_rectangle)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_ARB_texture_rectangle_vert, + functions_for_ARB_texture_rectangle_vert, + Elements(functions_for_ARB_texture_rectangle_vert )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->EXT_texture_array_enable) { + if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_EXT_texture_array, - Elements(functions_for_EXT_texture_array)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_ARB_texture_rectangle_frag, + functions_for_ARB_texture_rectangle_frag, + Elements(functions_for_ARB_texture_rectangle_frag )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } - if (state->target == fragment_shader && state->EXT_texture_array_enable) { + if (state->target == fragment_shader && state->language_version == 120) { static gl_shader *sh = NULL; - if (sh == NULL) { - sh = read_builtins(GL_VERTEX_SHADER, functions_for_EXT_texture_array_fs, - Elements(functions_for_EXT_texture_array_fs)); - talloc_steal(builtin_mem_ctx, sh); + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_120_frag, + functions_for_120_frag, + Elements(functions_for_120_frag )); + talloc_steal(builtin_mem_ctx, sh); } - import_prototypes(sh->ir, instructions, state->symbols, state); + import_prototypes(sh->ir, instructions, state->symbols, + state); state->builtins_to_link[state->num_builtins_to_link] = sh; state->num_builtins_to_link++; } diff --git a/src/glsl/builtins/110/abs b/src/glsl/builtins/110/abs deleted file mode 100644 index 904845307c..0000000000 --- a/src/glsl/builtins/110/abs +++ /dev/null @@ -1,21 +0,0 @@ -((function abs - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float abs (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 abs (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 abs (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 abs (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/all b/src/glsl/builtins/110/all deleted file mode 100644 index 2cac0dfb68..0000000000 --- a/src/glsl/builtins/110/all +++ /dev/null @@ -1,16 +0,0 @@ -((function all - (signature bool - (parameters - (declare (in) bvec2 arg0)) - ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) - - (signature bool - (parameters - (declare (in) bvec3 arg0)) - ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) - - (signature bool - (parameters - (declare (in) bvec4 arg0)) - ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) -)) diff --git a/src/glsl/builtins/110/any b/src/glsl/builtins/110/any deleted file mode 100644 index f10e8a7b47..0000000000 --- a/src/glsl/builtins/110/any +++ /dev/null @@ -1,16 +0,0 @@ -((function any - (signature bool - (parameters - (declare (in) bvec2 arg0)) - ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) - - (signature bool - (parameters - (declare (in) bvec3 arg0)) - ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) - - (signature bool - (parameters - (declare (in) bvec4 arg0)) - ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) -)) diff --git a/src/glsl/builtins/110/asin b/src/glsl/builtins/110/asin deleted file mode 100644 index d26bde364b..0000000000 --- a/src/glsl/builtins/110/asin +++ /dev/null @@ -1,120 +0,0 @@ -((function asin - (signature float - (parameters - (declare (in) float x)) - ((return (expression float * - (expression float sign (var_ref x)) - (expression float - - (expression float * - (constant float (3.1415926)) - (constant float (0.5))) - (expression float * - (expression float sqrt - (expression float - - (constant float (1.0)) - (expression float abs (var_ref x)))) - (expression float + - (constant float (1.5707288)) - (expression float * - (expression float abs (var_ref x)) - (expression float + - (constant float (-0.2121144)) - (expression float * - (constant float (0.0742610)) - (expression float abs (var_ref x)))))))))))) - - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 * - (expression vec2 sign (var_ref x)) - (expression vec2 - - (expression float * - (constant float (3.1415926)) - (constant float (0.5))) - (expression vec2 * - (expression vec2 sqrt - (expression vec2 - - (constant float (1.0)) - (expression vec2 abs (var_ref x)))) - (expression vec2 + - (constant float (1.5707288)) - (expression vec2 * - (expression vec2 abs (var_ref x)) - (expression vec2 + - (constant float (-0.2121144)) - (expression vec2 * - (constant float (0.0742610)) - (expression vec2 abs (var_ref x)))))))))))) - - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 * - (expression vec3 sign (var_ref x)) - (expression vec3 - - (expression float * - (constant float (3.1415926)) - (constant float (0.5))) - (expression vec3 * - (expression vec3 sqrt - (expression vec3 - - (constant float (1.0)) - (expression vec3 abs (var_ref x)))) - (expression vec3 + - (constant float (1.5707288)) - (expression vec3 * - (expression vec3 abs (var_ref x)) - (expression vec3 + - (constant float (-0.2121144)) - (expression vec3 * - (constant float (0.0742610)) - (expression vec3 abs (var_ref x)))))))))))) - - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 * - (expression vec4 sign (var_ref x)) - (expression vec4 - - (expression float * - (constant float (3.1415926)) - (constant float (0.5))) - (expression vec4 * - (expression vec4 sqrt - (expression vec4 - - (constant float (1.0)) - (expression vec4 abs (var_ref x)))) - (expression vec4 + - (constant float (1.5707288)) - (expression vec4 * - (expression vec4 abs (var_ref x)) - (expression vec4 + - (constant float (-0.2121144)) - (expression vec4 * - (constant float (0.0742610)) - (expression vec4 abs (var_ref x))))))))))) -)) - - (function acos - (signature float - (parameters - (declare (in) float x)) - ((return (expression float - (constant float (1.5707963)) - (call asin ((var_ref x))))))) - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 - (constant float (1.5707963)) - (call asin ((var_ref x))))))) - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 - (constant float (1.5707963)) - (call asin ((var_ref x))))))) - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 - (constant float (1.5707963)) - (call asin ((var_ref x))))))) -)) diff --git a/src/glsl/builtins/110/atan b/src/glsl/builtins/110/atan deleted file mode 100644 index 8404829387..0000000000 --- a/src/glsl/builtins/110/atan +++ /dev/null @@ -1,154 +0,0 @@ -((function atan - (signature float - (parameters - (declare (in) float x)) - ((return (call asin ((expression float * - (var_ref x) - (expression float rsq - (expression float + - (expression float * - (var_ref x) - (var_ref x)) - (constant float (1.0)))))))))) - - (signature vec2 - (parameters - (declare (in) vec2 y_over_x)) - ((return (call asin ((expression vec2 * - (var_ref y_over_x) - (expression vec2 rsq - (expression vec2 + - (expression vec2 * - (var_ref y_over_x) - (var_ref y_over_x)) - (constant float (1.0)))))))))) - - (signature vec3 - (parameters - (declare (in) vec3 y_over_x)) - ((return (call asin ((expression vec3 * - (var_ref y_over_x) - (expression vec3 rsq - (expression vec3 + - (expression vec3 * - (var_ref y_over_x) - (var_ref y_over_x)) - (constant float (1.0)))))))))) - - (signature vec4 - (parameters - (declare (in) vec4 y_over_x)) - ((return (call asin ((expression vec4 * - (var_ref y_over_x) - (expression vec4 rsq - (expression vec4 + - (expression vec4 * - (var_ref y_over_x) - (var_ref y_over_x)) - (constant float (1.0)))))))))) - - (signature float - (parameters - (declare (in ) float y) - (declare (in ) float x) - ) - ( - (declare () float r) - (declare ( ) float abs_retval) - (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) )) -) - (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) ( - (declare ( ) float atan_retval) - (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) )) -) - (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) - (if (expression bool < (var_ref x) (constant float (0.000000)) ) ( - (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( - (declare ( ) float assignment_tmp) - (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) - (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) - ) - ( - (declare ( ) float assignment_tmp) - (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) - (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) - )) - - ) - ( - )) - - ) - ( - (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( - (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) - ) - ( - (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) - )) - - )) - - (return (var_ref r) ) - )) - - - - (signature vec2 - (parameters - (declare (in) vec2 y) - (declare (in) vec2 x)) - ((declare () vec2 r) - (assign (constant bool (1)) - (swiz x (var_ref r)) - (call atan ((swiz x (var_ref y)) - (swiz x (var_ref x))))) - (assign (constant bool (1)) - (swiz y (var_ref r)) - (call atan ((swiz y (var_ref y)) - (swiz y (var_ref x))))) - (return (var_ref r)))) - - (signature vec3 - (parameters - (declare (in) vec3 y) - (declare (in) vec3 x)) - ((declare () vec3 r) - (assign (constant bool (1)) - (swiz x (var_ref r)) - (call atan ((swiz x (var_ref y)) - (swiz x (var_ref x))))) - (assign (constant bool (1)) - (swiz y (var_ref r)) - (call atan ((swiz y (var_ref y)) - (swiz y (var_ref x))))) - (assign (constant bool (1)) - (swiz z (var_ref r)) - (call atan ((swiz z (var_ref y)) - (swiz z (var_ref x))))) - (return (var_ref r)))) - - (signature vec4 - (parameters - (declare (in) vec4 y) - (declare (in) vec4 x)) - ((declare () vec4 r) - (assign (constant bool (1)) - (swiz x (var_ref r)) - (call atan ((swiz x (var_ref y)) - (swiz x (var_ref x))))) - (assign (constant bool (1)) - (swiz y (var_ref r)) - (call atan ((swiz y (var_ref y)) - (swiz y (var_ref x))))) - (assign (constant bool (1)) - (swiz z (var_ref r)) - (call atan ((swiz z (var_ref y)) - (swiz z (var_ref x))))) - (assign (constant bool (1)) - (swiz w (var_ref r)) - (call atan ((swiz w (var_ref y)) - (swiz w (var_ref x))))) - (return (var_ref r))))) - -)) diff --git a/src/glsl/builtins/110/ceil b/src/glsl/builtins/110/ceil deleted file mode 100644 index a26a775049..0000000000 --- a/src/glsl/builtins/110/ceil +++ /dev/null @@ -1,21 +0,0 @@ -((function ceil - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float ceil (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 ceil (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 ceil (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 ceil (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/clamp b/src/glsl/builtins/110/clamp deleted file mode 100644 index d05cc76dc2..0000000000 --- a/src/glsl/builtins/110/clamp +++ /dev/null @@ -1,50 +0,0 @@ -((function clamp - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1) - (declare (in) float arg2)) - ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1) - (declare (in) vec2 arg2)) - ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1) - (declare (in) vec3 arg2)) - ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1) - (declare (in) vec4 arg2)) - ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) float arg1) - (declare (in) float arg2)) - ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) float arg1) - (declare (in) float arg2)) - ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) float arg1) - (declare (in) float arg2)) - ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/cos b/src/glsl/builtins/110/cos deleted file mode 100644 index 88f266eccb..0000000000 --- a/src/glsl/builtins/110/cos +++ /dev/null @@ -1,21 +0,0 @@ -((function cos - (signature float - (parameters - (declare (in) float angle)) - ((return (expression float cos (var_ref angle))))) - - (signature vec2 - (parameters - (declare (in) vec2 angle)) - ((return (expression vec2 cos (var_ref angle))))) - - (signature vec3 - (parameters - (declare (in) vec3 angle)) - ((return (expression vec3 cos (var_ref angle))))) - - (signature vec4 - (parameters - (declare (in) vec4 angle)) - ((return (expression vec4 cos (var_ref angle))))) -)) diff --git a/src/glsl/builtins/110/cross b/src/glsl/builtins/110/cross deleted file mode 100644 index 24717a2183..0000000000 --- a/src/glsl/builtins/110/cross +++ /dev/null @@ -1,7 +0,0 @@ -((function cross - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression vec3 cross (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/degrees b/src/glsl/builtins/110/degrees deleted file mode 100644 index dc0d7b9e20..0000000000 --- a/src/glsl/builtins/110/degrees +++ /dev/null @@ -1,21 +0,0 @@ -((function degrees - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float * (var_ref arg0) (constant float (57.295780)))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 * (var_ref arg0) (constant float (57.295780)))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 * (var_ref arg0) (constant float (57.295780)))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 * (var_ref arg0) (constant float (57.295780)))))) -)) diff --git a/src/glsl/builtins/110/distance b/src/glsl/builtins/110/distance deleted file mode 100644 index a2309c484f..0000000000 --- a/src/glsl/builtins/110/distance +++ /dev/null @@ -1,33 +0,0 @@ -((function distance - (signature float - (parameters - (declare (in) float p0) - (declare (in) float p1)) - ((declare () float p) - (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1))) - (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) - - (signature float - (parameters - (declare (in) vec2 p0) - (declare (in) vec2 p1)) - ((declare () vec2 p) - (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1))) - (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) - - (signature float - (parameters - (declare (in) vec3 p0) - (declare (in) vec3 p1)) - ((declare () vec3 p) - (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1))) - (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) - - (signature float - (parameters - (declare (in) vec4 p0) - (declare (in) vec4 p1)) - ((declare () vec4 p) - (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1))) - (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) -)) diff --git a/src/glsl/builtins/110/dot b/src/glsl/builtins/110/dot deleted file mode 100644 index a91a6d2c56..0000000000 --- a/src/glsl/builtins/110/dot +++ /dev/null @@ -1,25 +0,0 @@ -((function dot - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1)) - ((return (expression float dot (var_ref arg0) (var_ref arg1))))) - - (signature float - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((return (expression float dot (var_ref arg0) (var_ref arg1))))) - - (signature float - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression float dot (var_ref arg0) (var_ref arg1))))) - - (signature float - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((return (expression float dot (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/equal b/src/glsl/builtins/110/equal deleted file mode 100644 index ae7ddc53bd..0000000000 --- a/src/glsl/builtins/110/equal +++ /dev/null @@ -1,61 +0,0 @@ -((function equal - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/exp b/src/glsl/builtins/110/exp deleted file mode 100644 index a73bd6a7f8..0000000000 --- a/src/glsl/builtins/110/exp +++ /dev/null @@ -1,21 +0,0 @@ -((function exp - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float exp (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 exp (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 exp (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 exp (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/exp2 b/src/glsl/builtins/110/exp2 deleted file mode 100644 index a842d3fe65..0000000000 --- a/src/glsl/builtins/110/exp2 +++ /dev/null @@ -1,21 +0,0 @@ -((function exp2 - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float exp2 (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 exp2 (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 exp2 (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 exp2 (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/faceforward b/src/glsl/builtins/110/faceforward deleted file mode 100644 index d170397238..0000000000 --- a/src/glsl/builtins/110/faceforward +++ /dev/null @@ -1,37 +0,0 @@ -((function faceforward - (signature float - (parameters - (declare (in) float N) - (declare (in) float I) - (declare (in) float Nref)) - ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) - ((return (var_ref N))) - ((return (expression float neg (var_ref N))))))) - - (signature vec2 - (parameters - (declare (in) vec2 N) - (declare (in) vec2 I) - (declare (in) vec2 Nref)) - ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) - ((return (var_ref N))) - ((return (expression vec2 neg (var_ref N))))))) - - (signature vec3 - (parameters - (declare (in) vec3 N) - (declare (in) vec3 I) - (declare (in) vec3 Nref)) - ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) - ((return (var_ref N))) - ((return (expression vec3 neg (var_ref N))))))) - - (signature vec4 - (parameters - (declare (in) vec4 N) - (declare (in) vec4 I) - (declare (in) vec4 Nref)) - ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) - ((return (var_ref N))) - ((return (expression vec4 neg (var_ref N))))))) -)) diff --git a/src/glsl/builtins/110/floor b/src/glsl/builtins/110/floor deleted file mode 100644 index 8dd8052799..0000000000 --- a/src/glsl/builtins/110/floor +++ /dev/null @@ -1,21 +0,0 @@ -((function floor - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float floor (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 floor (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 floor (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 floor (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/fract b/src/glsl/builtins/110/fract deleted file mode 100644 index 3f0763d1b3..0000000000 --- a/src/glsl/builtins/110/fract +++ /dev/null @@ -1,22 +0,0 @@ -((function fract - (signature float - (parameters - (declare (in) float x)) - ((return (expression float fract (var_ref x))))) - - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 fract (var_ref x))))) - - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 fract (var_ref x))))) - - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 fract (var_ref x))))) -)) - diff --git a/src/glsl/builtins/110/greaterThan b/src/glsl/builtins/110/greaterThan deleted file mode 100644 index ae03030e49..0000000000 --- a/src/glsl/builtins/110/greaterThan +++ /dev/null @@ -1,61 +0,0 @@ -((function greaterThan - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/greaterThanEqual b/src/glsl/builtins/110/greaterThanEqual deleted file mode 100644 index 204d5fd143..0000000000 --- a/src/glsl/builtins/110/greaterThanEqual +++ /dev/null @@ -1,61 +0,0 @@ -((function greaterThanEqual - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/inversesqrt b/src/glsl/builtins/110/inversesqrt deleted file mode 100644 index 5b66d2b369..0000000000 --- a/src/glsl/builtins/110/inversesqrt +++ /dev/null @@ -1,21 +0,0 @@ -((function inversesqrt - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float rsq (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 rsq (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 rsq (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 rsq (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/length b/src/glsl/builtins/110/length deleted file mode 100644 index 89ff7f3ef1..0000000000 --- a/src/glsl/builtins/110/length +++ /dev/null @@ -1,21 +0,0 @@ -((function length - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) - - (signature float - (parameters - (declare (in) vec2 arg0)) - ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) - - (signature float - (parameters - (declare (in) vec3 arg0)) - ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) - - (signature float - (parameters - (declare (in) vec4 arg0)) - ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) -)) diff --git a/src/glsl/builtins/110/lessThan b/src/glsl/builtins/110/lessThan deleted file mode 100644 index 5c4254165c..0000000000 --- a/src/glsl/builtins/110/lessThan +++ /dev/null @@ -1,61 +0,0 @@ -((function lessThan - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/lessThanEqual b/src/glsl/builtins/110/lessThanEqual deleted file mode 100644 index ccb955b8a7..0000000000 --- a/src/glsl/builtins/110/lessThanEqual +++ /dev/null @@ -1,61 +0,0 @@ -((function lessThanEqual - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/log b/src/glsl/builtins/110/log deleted file mode 100644 index d168abb5a7..0000000000 --- a/src/glsl/builtins/110/log +++ /dev/null @@ -1,21 +0,0 @@ -((function log - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float log (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 log (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 log (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 log (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/log2 b/src/glsl/builtins/110/log2 deleted file mode 100644 index b96c6276f0..0000000000 --- a/src/glsl/builtins/110/log2 +++ /dev/null @@ -1,21 +0,0 @@ -((function log2 - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float log2 (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 log2 (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 log2 (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 log2 (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/matrixCompMult b/src/glsl/builtins/110/matrixCompMult deleted file mode 100644 index cb5a2cb1f7..0000000000 --- a/src/glsl/builtins/110/matrixCompMult +++ /dev/null @@ -1,32 +0,0 @@ -((function matrixCompMult - (signature mat2 - (parameters - (declare (in) mat2 x) - (declare (in) mat2 y)) - ((declare () mat2 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) -(return (var_ref z)))) - - (signature mat3 - (parameters - (declare (in) mat3 x) - (declare (in) mat3 y)) - ((declare () mat3 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) -(return (var_ref z)))) - - (signature mat4 - (parameters - (declare (in) mat4 x) - (declare (in) mat4 y)) - ((declare () mat4 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) -(return (var_ref z)))) -)) - diff --git a/src/glsl/builtins/110/max b/src/glsl/builtins/110/max deleted file mode 100644 index f91ae417e4..0000000000 --- a/src/glsl/builtins/110/max +++ /dev/null @@ -1,43 +0,0 @@ -((function max - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1)) - ((return (expression float max (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) float arg1)) - ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) float arg1)) - ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) float arg1)) - ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/min b/src/glsl/builtins/110/min deleted file mode 100644 index 78fc44120a..0000000000 --- a/src/glsl/builtins/110/min +++ /dev/null @@ -1,43 +0,0 @@ -((function min - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1)) - ((return (expression float min (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) float arg1)) - ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) float arg1)) - ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) float arg1)) - ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/mix b/src/glsl/builtins/110/mix deleted file mode 100644 index 8638d06887..0000000000 --- a/src/glsl/builtins/110/mix +++ /dev/null @@ -1,50 +0,0 @@ -((function mix - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1) - (declare (in) float arg2)) - ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2)))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1) - (declare (in) vec2 arg2)) - ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1) - (declare (in) vec3 arg2)) - ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1) - (declare (in) vec4 arg2)) - ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1) - (declare (in) float arg2)) - ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1) - (declare (in) float arg2)) - ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1) - (declare (in) float arg2)) - ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) -)) diff --git a/src/glsl/builtins/110/mod b/src/glsl/builtins/110/mod deleted file mode 100644 index aeaea240e2..0000000000 --- a/src/glsl/builtins/110/mod +++ /dev/null @@ -1,43 +0,0 @@ -((function mod - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1)) - ((return (expression float % (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) float arg1)) - ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) float arg1)) - ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) float arg1)) - ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/noise_fake b/src/glsl/builtins/110/noise_fake deleted file mode 100644 index bcfb17b04b..0000000000 --- a/src/glsl/builtins/110/noise_fake +++ /dev/null @@ -1,76 +0,0 @@ -((function noise1 - (signature float - (parameters - (declare (in) float x)) - ((return (constant float (0))))) - (signature float - (parameters - (declare (in) vec2 x)) - ((return (constant float (0))))) - (signature float - (parameters - (declare (in) vec3 x)) - ((return (constant float (0))))) - (signature float - (parameters - (declare (in) vec4 x)) - ((return (constant float (0))))) - ) - - (function noise2 - (signature vec2 - (parameters - (declare (in) float x)) - ((return (constant vec2 (0 0))))) - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (constant vec2 (0 0))))) - (signature vec2 - (parameters - (declare (in) vec3 x)) - ((return (constant vec2 (0 0))))) - (signature vec2 - (parameters - (declare (in) vec4 x)) - ((return (constant vec2 (0 0))))) - ) - - (function noise3 - (signature vec3 - (parameters - (declare (in) float x)) - ((return (constant vec3 (0 0 0))))) - (signature vec3 - (parameters - (declare (in) vec2 x)) - ((return (constant vec3 (0 0 0))))) - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (constant vec3 (0 0 0))))) - (signature vec3 - (parameters - (declare (in) vec4 x)) - ((return (constant vec3 (0 0 0))))) - ) - - (function noise4 - (signature vec4 - (parameters - (declare (in) float x)) - ((return (constant vec4 (0 0 0 0))))) - (signature vec4 - (parameters - (declare (in) vec2 x)) - ((return (constant vec4 (0 0 0 0))))) - (signature vec4 - (parameters - (declare (in) vec3 x)) - ((return (constant vec4 (0 0 0 0))))) - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (constant vec4 (0 0 0 0))))) - ) -) diff --git a/src/glsl/builtins/110/normalize b/src/glsl/builtins/110/normalize deleted file mode 100644 index be88a9830d..0000000000 --- a/src/glsl/builtins/110/normalize +++ /dev/null @@ -1,21 +0,0 @@ -((function normalize - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) -)) diff --git a/src/glsl/builtins/110/not b/src/glsl/builtins/110/not deleted file mode 100644 index b696b06557..0000000000 --- a/src/glsl/builtins/110/not +++ /dev/null @@ -1,16 +0,0 @@ -((function not - (signature bvec2 - (parameters - (declare (in) bvec2 arg0)) - ((return (expression bvec2 ! (var_ref arg0))))) - - (signature bvec3 - (parameters - (declare (in) bvec3 arg0)) - ((return (expression bvec3 ! (var_ref arg0))))) - - (signature bvec4 - (parameters - (declare (in) bvec4 arg0)) - ((return (expression bvec4 ! (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/notEqual b/src/glsl/builtins/110/notEqual deleted file mode 100644 index ccdcaa3aaf..0000000000 --- a/src/glsl/builtins/110/notEqual +++ /dev/null @@ -1,61 +0,0 @@ -((function notEqual - (signature bvec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/110/pow b/src/glsl/builtins/110/pow deleted file mode 100644 index a61bc4418e..0000000000 --- a/src/glsl/builtins/110/pow +++ /dev/null @@ -1,25 +0,0 @@ -((function pow - (signature float - (parameters - (declare (in) float arg0) - (declare (in) float arg1)) - ((return (expression float pow (var_ref arg0) (var_ref arg1))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0) - (declare (in) vec2 arg1)) - ((return (expression vec2 pow (var_ref arg0) (var_ref arg1))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0) - (declare (in) vec3 arg1)) - ((return (expression vec3 pow (var_ref arg0) (var_ref arg1))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0) - (declare (in) vec4 arg1)) - ((return (expression vec4 pow (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/110/radians b/src/glsl/builtins/110/radians deleted file mode 100644 index 6a0f5d2e21..0000000000 --- a/src/glsl/builtins/110/radians +++ /dev/null @@ -1,21 +0,0 @@ -((function radians - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float * (var_ref arg0) (constant float (0.017453)))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 * (var_ref arg0) (constant float (0.017453)))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 * (var_ref arg0) (constant float (0.017453)))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 * (var_ref arg0) (constant float (0.017453)))))) -)) diff --git a/src/glsl/builtins/110/reflect b/src/glsl/builtins/110/reflect deleted file mode 100644 index 8238fdc93f..0000000000 --- a/src/glsl/builtins/110/reflect +++ /dev/null @@ -1,58 +0,0 @@ -((function reflect - (signature float - (parameters - (declare (in) float i) - (declare (in) float n)) - ((return (expression float - - (var_ref i) - (expression float * - (constant float (2.0)) - (expression float * - (expression float dot - (var_ref n) - (var_ref i)) - (var_ref n))))))) - - (signature vec2 - (parameters - (declare (in) vec2 i) - (declare (in) vec2 n)) - ((return (expression vec2 - - (var_ref i) - (expression vec2 * - (constant float (2.0)) - (expression vec2 * - (expression float dot - (var_ref n) - (var_ref i)) - (var_ref n))))))) - - (signature vec3 - (parameters - (declare (in) vec3 i) - (declare (in) vec3 n)) - ((return (expression vec3 - - (var_ref i) - (expression vec3 * - (constant float (2.0)) - (expression vec3 * - (expression float dot - (var_ref n) - (var_ref i)) - (var_ref n))))))) - - (signature vec4 - (parameters - (declare (in) vec4 i) - (declare (in) vec4 n)) - ((return (expression vec4 - - (var_ref i) - (expression vec4 * - (constant float (2.0)) - (expression vec4 * - (expression float dot - (var_ref n) - (var_ref i)) - (var_ref n))))))) - -)) diff --git a/src/glsl/builtins/110/refract b/src/glsl/builtins/110/refract deleted file mode 100644 index 522ab41173..0000000000 --- a/src/glsl/builtins/110/refract +++ /dev/null @@ -1,102 +0,0 @@ -((function refract - (signature float - (parameters - (declare (in) float i) - (declare (in) float n) - (declare (in) float eta)) - ((declare () float k) - (assign (constant bool (1)) (var_ref k) - (expression float - (constant float (1.0)) - (expression float * (var_ref eta) - (expression float * (var_ref eta) - (expression float - (constant float (1.0)) - (expression float * - (expression float dot (var_ref n) (var_ref i)) - (expression float dot (var_ref n) (var_ref i)))))))) - (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant float (0.0)))) - ((return (expression float - - (expression float * (var_ref eta) (var_ref i)) - (expression float * - (expression float + - (expression float * (var_ref eta) - (expression float dot (var_ref n) (var_ref i))) - (expression float sqrt (var_ref k))) - (var_ref n)))))))) - - (signature vec2 - (parameters - (declare (in) vec2 i) - (declare (in) vec2 n) - (declare (in) float eta)) - ((declare () float k) - (assign (constant bool (1)) (var_ref k) - (expression float - (constant float (1.0)) - (expression float * (var_ref eta) - (expression float * (var_ref eta) - (expression float - (constant float (1.0)) - (expression float * - (expression float dot (var_ref n) (var_ref i)) - (expression float dot (var_ref n) (var_ref i)))))))) - (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec2 (0.0 0.0)))) - ((return (expression vec2 - - (expression vec2 * (var_ref eta) (var_ref i)) - (expression vec2 * - (expression float + - (expression float * (var_ref eta) - (expression float dot (var_ref n) (var_ref i))) - (expression float sqrt (var_ref k))) - (var_ref n)))))))) - - (signature vec3 - (parameters - (declare (in) vec3 i) - (declare (in) vec3 n) - (declare (in) float eta)) - ((declare () float k) - (assign (constant bool (1)) (var_ref k) - (expression float - (constant float (1.0)) - (expression float * (var_ref eta) - (expression float * (var_ref eta) - (expression float - (constant float (1.0)) - (expression float * - (expression float dot (var_ref n) (var_ref i)) - (expression float dot (var_ref n) (var_ref i)))))))) - (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec3 (0.0 0.0 0.0)))) - ((return (expression vec3 - - (expression vec3 * (var_ref eta) (var_ref i)) - (expression vec3 * - (expression float + - (expression float * (var_ref eta) - (expression float dot (var_ref n) (var_ref i))) - (expression float sqrt (var_ref k))) - (var_ref n)))))))) - - (signature vec4 - (parameters - (declare (in) vec4 i) - (declare (in) vec4 n) - (declare (in) float eta)) - ((declare () float k) - (assign (constant bool (1)) (var_ref k) - (expression float - (constant float (1.0)) - (expression float * (var_ref eta) - (expression float * (var_ref eta) - (expression float - (constant float (1.0)) - (expression float * - (expression float dot (var_ref n) (var_ref i)) - (expression float dot (var_ref n) (var_ref i)))))))) - (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec4 (0.0 0.0 0.0 0.0)))) - ((return (expression vec4 - - (expression vec4 * (var_ref eta) (var_ref i)) - (expression vec4 * - (expression float + - (expression float * (var_ref eta) - (expression float dot (var_ref n) (var_ref i))) - (expression float sqrt (var_ref k))) - (var_ref n)))))))) - -)) diff --git a/src/glsl/builtins/110/sign b/src/glsl/builtins/110/sign deleted file mode 100644 index fa475197cf..0000000000 --- a/src/glsl/builtins/110/sign +++ /dev/null @@ -1,21 +0,0 @@ -((function sign - (signature float - (parameters - (declare (in) float x)) - ((return (expression float sign (var_ref x))))) - - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 sign (var_ref x))))) - - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 sign (var_ref x))))) - - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 sign (var_ref x))))) -)) diff --git a/src/glsl/builtins/110/sin b/src/glsl/builtins/110/sin deleted file mode 100644 index e6009d8ef1..0000000000 --- a/src/glsl/builtins/110/sin +++ /dev/null @@ -1,21 +0,0 @@ -((function sin - (signature float - (parameters - (declare (in) float angle)) - ((return (expression float sin (var_ref angle))))) - - (signature vec2 - (parameters - (declare (in) vec2 angle)) - ((return (expression vec2 sin (var_ref angle))))) - - (signature vec3 - (parameters - (declare (in) vec3 angle)) - ((return (expression vec3 sin (var_ref angle))))) - - (signature vec4 - (parameters - (declare (in) vec4 angle)) - ((return (expression vec4 sin (var_ref angle))))) -)) diff --git a/src/glsl/builtins/110/smoothstep b/src/glsl/builtins/110/smoothstep deleted file mode 100644 index 663eec6341..0000000000 --- a/src/glsl/builtins/110/smoothstep +++ /dev/null @@ -1,153 +0,0 @@ -((function smoothstep - (signature float - (parameters - (declare (in) float edge0) - (declare (in) float edge1) - (declare (in) float x)) - ((declare () float t) - - (assign (constant bool (1)) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t)))))))) - - (signature vec2 - (parameters - (declare (in) float edge0) - (declare (in) float edge1) - (declare (in) vec2 x)) - ((declare () vec2 t) - (declare () vec2 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - (return (var_ref retval)) - )) - - (signature vec3 - (parameters - (declare (in) float edge0) - (declare (in) float edge1) - (declare (in) vec3 x)) - ((declare () vec3 t) - (declare () vec3 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (swiz z (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - (return (var_ref retval)) - )) - - - (signature vec4 - (parameters - (declare (in) float edge0) - (declare (in) float edge1) - (declare (in) vec4 x)) - ((declare () vec4 t) - (declare () vec4 retval) - - (assign (constant bool (1)) (swiz x (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (swiz y (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (swiz z (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - - (assign (constant bool (1)) (swiz w (var_ref t)) - (expression float max - (expression float min - (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) - (return (var_ref retval)) - )) - - (signature vec2 - (parameters - (declare (in) vec2 edge0) - (declare (in) vec2 edge1) - (declare (in) vec2 x)) - ((return (expression vec2 max - (expression vec2 min - (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0))) - (constant vec2 (1.0 1.0))) - (constant vec2 (0.0 0.0)))))) - - (signature vec3 - (parameters - (declare (in) vec3 edge0) - (declare (in) vec3 edge1) - (declare (in) vec3 x)) - ((return (expression vec3 max - (expression vec3 min - (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0))) - (constant vec3 (1.0 1.0 1.0))) - (constant vec3 (0.0 0.0 0.0)))))) - - (signature vec4 - (parameters - (declare (in) vec4 edge0) - (declare (in) vec4 edge1) - (declare (in) vec4 x)) - ((return (expression vec4 max - (expression vec4 min - (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0))) - (constant vec4 (1.0 1.0 1.0 1.0))) - (constant vec4 (0.0 0.0 0.0 0.0)))))) -)) - diff --git a/src/glsl/builtins/110/sqrt b/src/glsl/builtins/110/sqrt deleted file mode 100644 index 0302d164ae..0000000000 --- a/src/glsl/builtins/110/sqrt +++ /dev/null @@ -1,21 +0,0 @@ -((function sqrt - (signature float - (parameters - (declare (in) float arg0)) - ((return (expression float sqrt (var_ref arg0))))) - - (signature vec2 - (parameters - (declare (in) vec2 arg0)) - ((return (expression vec2 sqrt (var_ref arg0))))) - - (signature vec3 - (parameters - (declare (in) vec3 arg0)) - ((return (expression vec3 sqrt (var_ref arg0))))) - - (signature vec4 - (parameters - (declare (in) vec4 arg0)) - ((return (expression vec4 sqrt (var_ref arg0))))) -)) diff --git a/src/glsl/builtins/110/step b/src/glsl/builtins/110/step deleted file mode 100644 index ce6f435422..0000000000 --- a/src/glsl/builtins/110/step +++ /dev/null @@ -1,68 +0,0 @@ -((function step - (signature float - (parameters - (declare (in) float edge) - (declare (in) float x)) - ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge)))))) - - (signature vec2 - (parameters - (declare (in) float edge) - (declare (in) vec2 x)) - ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) - (return (var_ref t)))) - - (signature vec3 - (parameters - (declare (in) float edge) - (declare (in) vec3 x)) - ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) - (return (var_ref t)))) - - (signature vec4 - (parameters - (declare (in) float edge) - (declare (in) vec4 x)) - ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) - (return (var_ref t)))) - - (signature vec2 - (parameters - (declare (in) vec2 edge) - (declare (in) vec2 x)) - ((declare () vec2 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) - (return (var_ref t)))) - - (signature vec3 - (parameters - (declare (in) vec3 edge) - (declare (in) vec3 x)) - ((declare () vec3 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge))))) - (return (var_ref t)))) - - (signature vec4 - (parameters - (declare (in) vec4 edge) - (declare (in) vec4 x)) - ((declare () vec4 t) - (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) - (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) - (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge))))) - (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge))))) - (return (var_ref t)))) -)) - diff --git a/src/glsl/builtins/110/tan b/src/glsl/builtins/110/tan deleted file mode 100644 index 9979863185..0000000000 --- a/src/glsl/builtins/110/tan +++ /dev/null @@ -1,21 +0,0 @@ -((function tan - (signature float - (parameters - (declare (in) float angle)) - ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle)))))) - - (signature vec2 - (parameters - (declare (in) vec2 angle)) - ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle)))))) - - (signature vec3 - (parameters - (declare (in) vec3 angle)) - ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle)))))) - - (signature vec4 - (parameters - (declare (in) vec4 angle)) - ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle)))))) -)) diff --git a/src/glsl/builtins/110/textures b/src/glsl/builtins/110/textures deleted file mode 100644 index c81b7e8ad4..0000000000 --- a/src/glsl/builtins/110/textures +++ /dev/null @@ -1,213 +0,0 @@ -((function texture1D - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function texture1DLod - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function texture1DProj - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - -) - (function texture1DProjLod - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - -) - (function texture2D - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) -(function texture2DLod - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function texture2DProj - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - -) - (function texture2DProjLod - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - -) - (function texture3D - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function texture3DLod - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function texture3DProj - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - -) - (function texture3DProjLod - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - -) - (function textureCube - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function textureCubeLod - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function shadow1D - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) - -) - (function shadow1DLod - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) - -) - (function shadow1DProj - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) )))) - -) - (function shadow1DProjLod - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) )))) - -) - (function shadow2D - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) - -) - (function shadow2DLod - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) - -) - (function shadow2DProj - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) )))) - -) - (function shadow2DProjLod - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) )))) - -)) diff --git a/src/glsl/builtins/110_fs/derivatives b/src/glsl/builtins/110_fs/derivatives deleted file mode 100644 index b79852ee1f..0000000000 --- a/src/glsl/builtins/110_fs/derivatives +++ /dev/null @@ -1,73 +0,0 @@ -((function dFdx - (signature float - (parameters - (declare (in) float p)) - ((return (expression float dFdx (var_ref p))))) - - (signature vec2 - (parameters - (declare (in) vec2 p)) - ((return (expression vec2 dFdx (var_ref p))))) - - (signature vec3 - (parameters - (declare (in) vec3 p)) - ((return (expression vec3 dFdx (var_ref p))))) - - (signature vec4 - (parameters - (declare (in) vec4 p)) - ((return (expression vec4 dFdx (var_ref p))))) - ) - - (function dFdy - (signature float - (parameters - (declare (in) float p)) - ((return (expression float dFdy (var_ref p))))) - - (signature vec2 - (parameters - (declare (in) vec2 p)) - ((return (expression vec2 dFdy (var_ref p))))) - - (signature vec3 - (parameters - (declare (in) vec3 p)) - ((return (expression vec3 dFdy (var_ref p))))) - - (signature vec4 - (parameters - (declare (in) vec4 p)) - ((return (expression vec4 dFdy (var_ref p))))) - ) - - (function fwidth - (signature float - (parameters - (declare (in) float p)) - ((return (expression float + - (expression float abs (expression float dFdx (var_ref p))) - (expression float abs (expression float dFdy (var_ref p))))))) - - (signature vec2 - (parameters - (declare (in) vec2 p)) - ((return (expression vec2 + - (expression vec2 abs (expression vec2 dFdx (var_ref p))) - (expression vec2 abs (expression vec2 dFdy (var_ref p))))))) - - (signature vec3 - (parameters - (declare (in) vec3 p)) - ((return (expression vec3 + - (expression vec3 abs (expression vec3 dFdx (var_ref p))) - (expression vec3 abs (expression vec3 dFdy (var_ref p))))))) - - (signature vec4 - (parameters - (declare (in) vec4 p)) - ((return (expression vec4 + - (expression vec4 abs (expression vec4 dFdx (var_ref p))) - (expression vec4 abs (expression vec4 dFdy (var_ref p))))))) -)) diff --git a/src/glsl/builtins/110_fs/textures b/src/glsl/builtins/110_fs/textures deleted file mode 100644 index 38f3787e9e..0000000000 --- a/src/glsl/builtins/110_fs/textures +++ /dev/null @@ -1,113 +0,0 @@ -((function texture1D - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function texture1DProj - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - -) - (function texture2D - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function texture2DProj - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - -) - (function texture3D - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function texture3DProj - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - -) - (function textureCube - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function shadow1D - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) - -) - (function shadow1DProj - (signature vec4 - (parameters - (declare (in) sampler1DShadow sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) )))) - -) - (function shadow2D - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) - -) - (function shadow2DProj - (signature vec4 - (parameters - (declare (in) sampler2DShadow sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) )))) - -)) diff --git a/src/glsl/builtins/110_vs/ftransform b/src/glsl/builtins/110_vs/ftransform deleted file mode 100644 index 9ca63dc1e3..0000000000 --- a/src/glsl/builtins/110_vs/ftransform +++ /dev/null @@ -1,9 +0,0 @@ -((declare (uniform) mat4 gl_ModelViewProjectionMatrix) - (declare (in) vec4 gl_Vertex) - (function ftransform - (signature vec4 - (parameters) - ((return (expression vec4 * - (var_ref gl_ModelViewProjectionMatrix) - (var_ref gl_Vertex))))) -)) diff --git a/src/glsl/builtins/120/matrixCompMult b/src/glsl/builtins/120/matrixCompMult deleted file mode 100644 index 69331e2652..0000000000 --- a/src/glsl/builtins/120/matrixCompMult +++ /dev/null @@ -1,61 +0,0 @@ -((function matrixCompMult - (signature mat2x3 - (parameters - (declare (in) mat2x3 x) - (declare (in) mat2x3 y)) - ((declare () mat2x3 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) -(return (var_ref z)))) - - (signature mat3x2 - (parameters - (declare (in) mat3x2 x) - (declare (in) mat3x2 y)) - ((declare () mat3x2 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) -(return (var_ref z)))) - - (signature mat2x4 - (parameters - (declare (in) mat2x4 x) - (declare (in) mat2x4 y)) - ((declare () mat2x4 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) -(return (var_ref z)))) - - (signature mat4x2 - (parameters - (declare (in) mat4x2 x) - (declare (in) mat4x2 y)) - ((declare () mat4x2 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) -(return (var_ref z)))) - - (signature mat3x4 - (parameters - (declare (in) mat3x4 x) - (declare (in) mat3x4 y)) - ((declare () mat3x4 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) -(return (var_ref z)))) - - (signature mat4x3 - (parameters - (declare (in) mat4x3 x) - (declare (in) mat4x3 y)) - ((declare () mat4x3 z) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) - (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) -(return (var_ref z)))) -)) diff --git a/src/glsl/builtins/120/outerProduct b/src/glsl/builtins/120/outerProduct deleted file mode 100644 index 69ae741e17..0000000000 --- a/src/glsl/builtins/120/outerProduct +++ /dev/null @@ -1,92 +0,0 @@ -((function outerProduct - (signature mat2 - (parameters - (declare (in) vec2 u) - (declare (in) vec2 v)) - ((declare () mat2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) - (return (var_ref m)))) - - (signature mat2x3 - (parameters - (declare (in) vec3 u) - (declare (in) vec2 v)) - ((declare () mat2x3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) - (return (var_ref m)))) - - (signature mat2x4 - (parameters - (declare (in) vec4 u) - (declare (in) vec2 v)) - ((declare () mat2x4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) - (return (var_ref m)))) - - (signature mat3x2 - (parameters - (declare (in) vec2 u) - (declare (in) vec3 v)) - ((declare () mat3x2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) - (return (var_ref m)) - )) - - (signature mat3 - (parameters - (declare (in) vec3 u) - (declare (in) vec3 v)) - ((declare () mat3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) - (return (var_ref m)))) - - (signature mat3x4 - (parameters - (declare (in) vec4 u) - (declare (in) vec3 v)) - ((declare () mat3x4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) - (return (var_ref m)))) - - (signature mat4x2 - (parameters - (declare (in) vec2 u) - (declare (in) vec4 v)) - ((declare () mat4x2 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v)))) - (return (var_ref m)))) - - (signature mat4x3 - (parameters - (declare (in) vec3 u) - (declare (in) vec4 v)) - ((declare () mat4x3 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v)))) - (return (var_ref m)))) - - (signature mat4 - (parameters - (declare (in) vec4 u) - (declare (in) vec4 v)) - ((declare () mat4 m) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) - (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v)))) - (return (var_ref m)))) -)) diff --git a/src/glsl/builtins/120/transpose b/src/glsl/builtins/120/transpose deleted file mode 100644 index 416a0ee467..0000000000 --- a/src/glsl/builtins/120/transpose +++ /dev/null @@ -1,139 +0,0 @@ -((function transpose - (signature mat2 - (parameters - (declare (in) mat2 m)) - ((declare () mat2 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) -(return (var_ref t)))) - - (signature mat3x2 - (parameters - (declare (in) mat2x3 m)) - ((declare () mat3x2 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) -(return (var_ref t)))) - - (signature mat4x2 - (parameters - (declare (in) mat2x4 m)) - ((declare () mat4x2 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) -(return (var_ref t)))) - - (signature mat2x3 - (parameters - (declare (in) mat3x2 m)) - ((declare () mat2x3 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) -(return (var_ref t)))) - - (signature mat3 - (parameters - (declare (in) mat3 m)) - ((declare () mat3 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) -(return (var_ref t)))) - - (signature mat4x3 - (parameters - (declare (in) mat3x4 m)) - ((declare () mat4x3 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) -(return (var_ref t)))) - - (signature mat2x4 - (parameters - (declare (in) mat4x2 m)) - ((declare () mat2x4 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) -(return (var_ref t)))) - - (signature mat3x4 - (parameters - (declare (in) mat4x3 m)) - ((declare () mat3x4 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) -(return (var_ref t)))) - - (signature mat4 - (parameters - (declare (in) mat4 m)) - ((declare () mat4 t) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) - (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) -(return (var_ref t)))) -) - -) - diff --git a/src/glsl/builtins/130/clamp b/src/glsl/builtins/130/clamp deleted file mode 100644 index e1aad5c8d9..0000000000 --- a/src/glsl/builtins/130/clamp +++ /dev/null @@ -1,99 +0,0 @@ -((function clamp - (signature int - (parameters - (declare (in) int arg0) - (declare (in) int arg1) - (declare (in) int arg2)) - ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1) - (declare (in) ivec2 arg2)) - ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1) - (declare (in) ivec3 arg2)) - ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1) - (declare (in) ivec4 arg2)) - ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) int arg1) - (declare (in) int arg2)) - ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) int arg1) - (declare (in) int arg2)) - ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) int arg1) - (declare (in) int arg2)) - ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uint - (parameters - (declare (in) uint arg0) - (declare (in) uint arg1) - (declare (in) uint arg2)) - ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1) - (declare (in) uvec2 arg2)) - ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1) - (declare (in) uvec3 arg2)) - ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1) - (declare (in) uvec4 arg2)) - ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uint arg1) - (declare (in) uint arg2)) - ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uint arg1) - (declare (in) uint arg2)) - ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uint arg1) - (declare (in) uint arg2)) - ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/130/cosh b/src/glsl/builtins/130/cosh deleted file mode 100644 index 45e0ae427d..0000000000 --- a/src/glsl/builtins/130/cosh +++ /dev/null @@ -1,30 +0,0 @@ -((function cosh - (signature float - (parameters - (declare (in) float x)) - ((return (expression float * (constant float (0.5)) - (expression float + - (expression float exp (var_ref x)) - (expression float exp (expression float neg (var_ref x)))))))) - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 * (constant vec2 (0.5)) - (expression vec2 + - (expression vec2 exp (var_ref x)) - (expression vec2 exp (expression vec2 neg (var_ref x)))))))) - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 * (constant vec3 (0.5)) - (expression vec3 + - (expression vec3 exp (var_ref x)) - (expression vec3 exp (expression vec3 neg (var_ref x)))))))) - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 * (constant vec4 (0.5)) - (expression vec4 + - (expression vec4 exp (var_ref x)) - (expression vec4 exp (expression vec4 neg (var_ref x)))))))) -)) diff --git a/src/glsl/builtins/130/equal b/src/glsl/builtins/130/equal deleted file mode 100644 index 079c3e97fb..0000000000 --- a/src/glsl/builtins/130/equal +++ /dev/null @@ -1,31 +0,0 @@ -((function equal - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/greaterThan b/src/glsl/builtins/130/greaterThan deleted file mode 100644 index a9fb7b3a43..0000000000 --- a/src/glsl/builtins/130/greaterThan +++ /dev/null @@ -1,31 +0,0 @@ -((function greaterThan - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/greaterThanEqual b/src/glsl/builtins/130/greaterThanEqual deleted file mode 100644 index 293c93c7cc..0000000000 --- a/src/glsl/builtins/130/greaterThanEqual +++ /dev/null @@ -1,31 +0,0 @@ -((function greaterThanEqual - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/lessThan b/src/glsl/builtins/130/lessThan deleted file mode 100644 index d9f693fd63..0000000000 --- a/src/glsl/builtins/130/lessThan +++ /dev/null @@ -1,31 +0,0 @@ -((function lessThan - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/lessThanEqual b/src/glsl/builtins/130/lessThanEqual deleted file mode 100644 index 494411b869..0000000000 --- a/src/glsl/builtins/130/lessThanEqual +++ /dev/null @@ -1,31 +0,0 @@ -((function lessThanEqual - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/max b/src/glsl/builtins/130/max deleted file mode 100644 index 0863e411a3..0000000000 --- a/src/glsl/builtins/130/max +++ /dev/null @@ -1,85 +0,0 @@ -((function max - (signature int - (parameters - (declare (in) int arg0) - (declare (in) int arg1)) - ((return (expression int max (var_ref arg0) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) int arg1)) - ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) int arg1)) - ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) int arg1)) - ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) - - (signature uint - (parameters - (declare (in) uint arg0) - (declare (in) uint arg1)) - ((return (expression uint max (var_ref arg0) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uint arg1)) - ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uint arg1)) - ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uint arg1)) - ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/130/min b/src/glsl/builtins/130/min deleted file mode 100644 index 576546f6f2..0000000000 --- a/src/glsl/builtins/130/min +++ /dev/null @@ -1,85 +0,0 @@ -((function min - (signature int - (parameters - (declare (in) int arg0) - (declare (in) int arg1)) - ((return (expression int min (var_ref arg0) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) ivec2 arg1)) - ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) ivec3 arg1)) - ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) ivec4 arg1)) - ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 arg0) - (declare (in) int arg1)) - ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 arg0) - (declare (in) int arg1)) - ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 arg0) - (declare (in) int arg1)) - ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) - - (signature uint - (parameters - (declare (in) uint arg0) - (declare (in) uint arg1)) - ((return (expression uint min (var_ref arg0) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) - - (signature uvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uint arg1)) - ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) - - (signature uvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uint arg1)) - ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) - - (signature uvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uint arg1)) - ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) -)) diff --git a/src/glsl/builtins/130/mix b/src/glsl/builtins/130/mix deleted file mode 100644 index 9a1fcd70ff..0000000000 --- a/src/glsl/builtins/130/mix +++ /dev/null @@ -1,39 +0,0 @@ -((function mix - (signature float - (parameters - (declare (in) float v1) - (declare (in) float v2) - (declare (in) bool a)) - ((assign (var_ref a) (var_ref v1) (var_ref v2)) - (return (var_ref v1)))) - - (signature vec2 - (parameters - (declare (in) vec2 v1) - (declare (in) vec2 v2) - (declare (in) bvec2 a)) - ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) - (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) - (return (var_ref v1)))) - - (signature vec3 - (parameters - (declare (in) vec3 v1) - (declare (in) vec3 v2) - (declare (in) bvec3 a)) - ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) - (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) - (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) - (return (var_ref v1)))) - - (signature vec4 - (parameters - (declare (in) vec4 v1) - (declare (in) vec4 v2) - (declare (in) bvec4 a)) - ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) - (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) - (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) - (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2))) - (return (var_ref v1)))) -)) diff --git a/src/glsl/builtins/130/notEqual b/src/glsl/builtins/130/notEqual deleted file mode 100644 index 81e6376bd9..0000000000 --- a/src/glsl/builtins/130/notEqual +++ /dev/null @@ -1,31 +0,0 @@ -((function notEqual - (signature bvec2 - (parameters - (declare (in) uvec2 arg0) - (declare (in) uvec2 arg1)) - ((declare () bvec2 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec3 - (parameters - (declare (in) uvec3 arg0) - (declare (in) uvec3 arg1)) - ((declare () bvec3 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (return (var_ref temp)))) - - (signature bvec4 - (parameters - (declare (in) uvec4 arg0) - (declare (in) uvec4 arg1)) - ((declare () bvec4 temp) - (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) - (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) - (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) - (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) - (return (var_ref temp)))) -)) diff --git a/src/glsl/builtins/130/sign b/src/glsl/builtins/130/sign deleted file mode 100644 index f86062a244..0000000000 --- a/src/glsl/builtins/130/sign +++ /dev/null @@ -1,22 +0,0 @@ -((function sign - (signature int - (parameters - (declare (in) int x)) - ((return (expression int sign (var_ref x))))) - - (signature ivec2 - (parameters - (declare (in) ivec2 x)) - ((return (expression ivec2 sign (var_ref x))))) - - (signature ivec3 - (parameters - (declare (in) ivec3 x)) - ((return (expression ivec3 sign (var_ref x))))) - - (signature ivec4 - (parameters - (declare (in) ivec4 x)) - ((return (expression ivec4 sign (var_ref x))))) -)) - diff --git a/src/glsl/builtins/130/sinh b/src/glsl/builtins/130/sinh deleted file mode 100644 index 7ad4f58e20..0000000000 --- a/src/glsl/builtins/130/sinh +++ /dev/null @@ -1,30 +0,0 @@ -((function sinh - (signature float - (parameters - (declare (in) float x)) - ((return (expression float * (constant float (0.5)) - (expression float - - (expression float exp (var_ref x)) - (expression float exp (expression float neg (var_ref x)))))))) - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 * (constant vec2 (0.5)) - (expression vec2 - - (expression vec2 exp (var_ref x)) - (expression vec2 exp (expression vec2 neg (var_ref x)))))))) - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 * (constant vec3 (0.5)) - (expression vec3 - - (expression vec3 exp (var_ref x)) - (expression vec3 exp (expression vec3 neg (var_ref x)))))))) - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 * (constant vec4 (0.5)) - (expression vec4 - - (expression vec4 exp (var_ref x)) - (expression vec4 exp (expression vec4 neg (var_ref x)))))))) -)) diff --git a/src/glsl/builtins/130/tanh b/src/glsl/builtins/130/tanh deleted file mode 100644 index 3b7271bf77..0000000000 --- a/src/glsl/builtins/130/tanh +++ /dev/null @@ -1,42 +0,0 @@ -((function tanh - (signature float - (parameters - (declare (in) float x)) - ((return (expression float / - (expression float - - (expression float exp (var_ref x)) - (expression float exp (expression float neg (var_ref x)))) - (expression float + - (expression float exp (var_ref x)) - (expression float exp (expression float neg (var_ref x)))))))) - (signature vec2 - (parameters - (declare (in) vec2 x)) - ((return (expression vec2 / - (expression vec2 - - (expression vec2 exp (var_ref x)) - (expression vec2 exp (expression vec2 neg (var_ref x)))) - (expression vec2 + - (expression vec2 exp (var_ref x)) - (expression vec2 exp (expression vec2 neg (var_ref x)))))))) - (signature vec3 - (parameters - (declare (in) vec3 x)) - ((return (expression vec3 / - (expression vec3 - - (expression vec3 exp (var_ref x)) - (expression vec3 exp (expression vec3 neg (var_ref x)))) - (expression vec3 + - (expression vec3 exp (var_ref x)) - (expression vec3 exp (expression vec3 neg (var_ref x)))))))) - (signature vec4 - (parameters - (declare (in) vec4 x)) - ((return (expression vec4 / - (expression vec4 - - (expression vec4 exp (var_ref x)) - (expression vec4 exp (expression vec4 neg (var_ref x)))) - (expression vec4 + - (expression vec4 exp (var_ref x)) - (expression vec4 exp (expression vec4 neg (var_ref x)))))))) -)) diff --git a/src/glsl/builtins/130/texelFetch b/src/glsl/builtins/130/texelFetch deleted file mode 100644 index d51ce65a89..0000000000 --- a/src/glsl/builtins/130/texelFetch +++ /dev/null @@ -1,107 +0,0 @@ -((function texelFetch - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) int P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) int P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) int P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1DArray sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1DArray sampler) - (declare (in) ivec2 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2DArray sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2DArray sampler) - (declare (in) ivec3 P) - (declare (in) int lod) ) - ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) )))) - -)) diff --git a/src/glsl/builtins/130/texture b/src/glsl/builtins/130/texture deleted file mode 100644 index b170b58309..0000000000 --- a/src/glsl/builtins/130/texture +++ /dev/null @@ -1,110 +0,0 @@ -((function texture - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) float P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) float P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isamplerCube sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usamplerCube sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isampler1DArray sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usampler1DArray sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature ivec4 - (parameters - (declare (in) isampler2DArray sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - - (signature uvec4 - (parameters - (declare (in) usampler2DArray sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -)) diff --git a/src/glsl/builtins/130/textureGrad b/src/glsl/builtins/130/textureGrad deleted file mode 100644 index 0ef428c224..0000000000 --- a/src/glsl/builtins/130/textureGrad +++ /dev/null @@ -1,147 +0,0 @@ -((function textureGrad - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) float P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) float P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isamplerCube sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usamplerCube sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) )))) - -) -) diff --git a/src/glsl/builtins/130/textureLod b/src/glsl/builtins/130/textureLod deleted file mode 100644 index 7d7059d848..0000000000 --- a/src/glsl/builtins/130/textureLod +++ /dev/null @@ -1,128 +0,0 @@ -((function textureLod - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) float P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) float P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isamplerCube sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usamplerCube sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -)) diff --git a/src/glsl/builtins/130/textureProj b/src/glsl/builtins/130/textureProj deleted file mode 100644 index 40ea1c2af6..0000000000 --- a/src/glsl/builtins/130/textureProj +++ /dev/null @@ -1,92 +0,0 @@ -((function textureProj - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () )))) - -)) diff --git a/src/glsl/builtins/130/textureProjGrad b/src/glsl/builtins/130/textureProjGrad deleted file mode 100644 index b4bfa58c12..0000000000 --- a/src/glsl/builtins/130/textureProjGrad +++ /dev/null @@ -1,122 +0,0 @@ -((function textureProjGrad - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec2 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec2 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec4 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec4 P) - (declare (in) float dPdx) - (declare (in) float dPdy) ) - ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec3 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec3 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec4 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec4 P) - (declare (in) vec2 dPdx) - (declare (in) vec2 dPdy) ) - ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec4 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec4 P) - (declare (in) vec3 dPdx) - (declare (in) vec3 dPdy) ) - ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) )))) - -)) diff --git a/src/glsl/builtins/130/textureProjLod b/src/glsl/builtins/130/textureProjLod deleted file mode 100644 index d242f7e40f..0000000000 --- a/src/glsl/builtins/130/textureProjLod +++ /dev/null @@ -1,107 +0,0 @@ -((function textureProjLod - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec4 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) )))) - -)) diff --git a/src/glsl/builtins/130_fs/texture b/src/glsl/builtins/130_fs/texture deleted file mode 100644 index 0de981397f..0000000000 --- a/src/glsl/builtins/130_fs/texture +++ /dev/null @@ -1,128 +0,0 @@ -((function texture - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) float P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) float P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) float P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) samplerCube sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isamplerCube sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usamplerCube sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -)) diff --git a/src/glsl/builtins/130_fs/textureProj b/src/glsl/builtins/130_fs/textureProj deleted file mode 100644 index b1d8f0a2f3..0000000000 --- a/src/glsl/builtins/130_fs/textureProj +++ /dev/null @@ -1,107 +0,0 @@ -((function textureProj - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler1D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler1D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler1D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler2D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler2D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler2D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature vec4 - (parameters - (declare (in) sampler3D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature ivec4 - (parameters - (declare (in) isampler3D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - - (signature uvec4 - (parameters - (declare (in) usampler3D sampler) - (declare (in) vec4 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) )))) - -)) diff --git a/src/glsl/builtins/ARB_texture_rectangle/textures b/src/glsl/builtins/ARB_texture_rectangle/textures deleted file mode 100644 index 161d8c4a54..0000000000 --- a/src/glsl/builtins/ARB_texture_rectangle/textures +++ /dev/null @@ -1,16 +0,0 @@ -((function texture2DRect - (signature vec4 - (parameters - (declare (in) sampler2DRect sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function shadow2DRect - (signature vec4 - (parameters - (declare (in) sampler2DRectShadow sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) - -)) diff --git a/src/glsl/builtins/EXT_texture_array/textures b/src/glsl/builtins/EXT_texture_array/textures deleted file mode 100644 index 8a91f90140..0000000000 --- a/src/glsl/builtins/EXT_texture_array/textures +++ /dev/null @@ -1,59 +0,0 @@ -((function texture1DArray - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function texture1DArrayLod - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function texture2DArray - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () )))) - -) - (function texture2DArrayLod - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) )))) - -) - (function shadow1DArray - (signature vec4 - (parameters - (declare (in) sampler1DArrayShadow sampler) - (declare (in) vec3 P) ) - ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) )))) - -) - (function shadow1DArrayLod - (signature vec4 - (parameters - (declare (in) sampler1DArrayShadow sampler) - (declare (in) vec3 P) - (declare (in) float lod) ) - ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) )))) - -) - (function shadow2DArray - (signature vec4 - (parameters - (declare (in) sampler2DArrayShadow sampler) - (declare (in) vec4 P) ) - ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) )))) - -)) diff --git a/src/glsl/builtins/EXT_texture_array_fs/textures b/src/glsl/builtins/EXT_texture_array_fs/textures deleted file mode 100644 index 74e184387a..0000000000 --- a/src/glsl/builtins/EXT_texture_array_fs/textures +++ /dev/null @@ -1,27 +0,0 @@ -((function texture1DArray - (signature vec4 - (parameters - (declare (in) sampler1DArray sampler) - (declare (in) vec2 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function texture2DArray - (signature vec4 - (parameters - (declare (in) sampler2DArray sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) )))) - -) - (function shadow1DArray - (signature vec4 - (parameters - (declare (in) sampler1DArrayShadow sampler) - (declare (in) vec3 P) - (declare (in) float bias) ) - ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) )))) - -)) diff --git a/src/glsl/builtins/ir/abs b/src/glsl/builtins/ir/abs new file mode 100644 index 0000000000..904845307c --- /dev/null +++ b/src/glsl/builtins/ir/abs @@ -0,0 +1,21 @@ +((function abs + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float abs (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 abs (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 abs (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 abs (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/acos b/src/glsl/builtins/ir/acos new file mode 100644 index 0000000000..d1cfebeff8 --- /dev/null +++ b/src/glsl/builtins/ir/acos @@ -0,0 +1,22 @@ +((function acos + (signature float + (parameters + (declare (in) float x)) + ((return (expression float - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 - (constant float (1.5707963)) + (call asin ((var_ref x))))))) +)) diff --git a/src/glsl/builtins/ir/all b/src/glsl/builtins/ir/all new file mode 100644 index 0000000000..2cac0dfb68 --- /dev/null +++ b/src/glsl/builtins/ir/all @@ -0,0 +1,16 @@ +((function all + (signature bool + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/ir/any b/src/glsl/builtins/ir/any new file mode 100644 index 0000000000..f10e8a7b47 --- /dev/null +++ b/src/glsl/builtins/ir/any @@ -0,0 +1,16 @@ +((function any + (signature bool + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0)))))) + + (signature bool + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/ir/asin b/src/glsl/builtins/ir/asin new file mode 100644 index 0000000000..e230ad614e --- /dev/null +++ b/src/glsl/builtins/ir/asin @@ -0,0 +1,97 @@ +((function asin + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * + (expression float sign (var_ref x)) + (expression float - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression float * + (expression float sqrt + (expression float - + (constant float (1.0)) + (expression float abs (var_ref x)))) + (expression float + + (constant float (1.5707288)) + (expression float * + (expression float abs (var_ref x)) + (expression float + + (constant float (-0.2121144)) + (expression float * + (constant float (0.0742610)) + (expression float abs (var_ref x)))))))))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * + (expression vec2 sign (var_ref x)) + (expression vec2 - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec2 * + (expression vec2 sqrt + (expression vec2 - + (constant float (1.0)) + (expression vec2 abs (var_ref x)))) + (expression vec2 + + (constant float (1.5707288)) + (expression vec2 * + (expression vec2 abs (var_ref x)) + (expression vec2 + + (constant float (-0.2121144)) + (expression vec2 * + (constant float (0.0742610)) + (expression vec2 abs (var_ref x)))))))))))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * + (expression vec3 sign (var_ref x)) + (expression vec3 - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec3 * + (expression vec3 sqrt + (expression vec3 - + (constant float (1.0)) + (expression vec3 abs (var_ref x)))) + (expression vec3 + + (constant float (1.5707288)) + (expression vec3 * + (expression vec3 abs (var_ref x)) + (expression vec3 + + (constant float (-0.2121144)) + (expression vec3 * + (constant float (0.0742610)) + (expression vec3 abs (var_ref x)))))))))))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * + (expression vec4 sign (var_ref x)) + (expression vec4 - + (expression float * + (constant float (3.1415926)) + (constant float (0.5))) + (expression vec4 * + (expression vec4 sqrt + (expression vec4 - + (constant float (1.0)) + (expression vec4 abs (var_ref x)))) + (expression vec4 + + (constant float (1.5707288)) + (expression vec4 * + (expression vec4 abs (var_ref x)) + (expression vec4 + + (constant float (-0.2121144)) + (expression vec4 * + (constant float (0.0742610)) + (expression vec4 abs (var_ref x)))))))))))) +)) diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan new file mode 100644 index 0000000000..8404829387 --- /dev/null +++ b/src/glsl/builtins/ir/atan @@ -0,0 +1,154 @@ +((function atan + (signature float + (parameters + (declare (in) float x)) + ((return (call asin ((expression float * + (var_ref x) + (expression float rsq + (expression float + + (expression float * + (var_ref x) + (var_ref x)) + (constant float (1.0)))))))))) + + (signature vec2 + (parameters + (declare (in) vec2 y_over_x)) + ((return (call asin ((expression vec2 * + (var_ref y_over_x) + (expression vec2 rsq + (expression vec2 + + (expression vec2 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature vec3 + (parameters + (declare (in) vec3 y_over_x)) + ((return (call asin ((expression vec3 * + (var_ref y_over_x) + (expression vec3 rsq + (expression vec3 + + (expression vec3 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature vec4 + (parameters + (declare (in) vec4 y_over_x)) + ((return (call asin ((expression vec4 * + (var_ref y_over_x) + (expression vec4 rsq + (expression vec4 + + (expression vec4 * + (var_ref y_over_x) + (var_ref y_over_x)) + (constant float (1.0)))))))))) + + (signature float + (parameters + (declare (in ) float y) + (declare (in ) float x) + ) + ( + (declare () float r) + (declare ( ) float abs_retval) + (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) )) +) + (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) ( + (declare ( ) float atan_retval) + (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) )) +) + (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) + (if (expression bool < (var_ref x) (constant float (0.000000)) ) ( + (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( + (declare ( ) float assignment_tmp) + (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) + (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) + ) + ( + (declare ( ) float assignment_tmp) + (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) + (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) + )) + + ) + ( + )) + + ) + ( + (if (expression bool >= (var_ref y) (constant float (0.000000)) ) ( + (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) ) + ) + ( + (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) ) + )) + + )) + + (return (var_ref r) ) + )) + + + + (signature vec2 + (parameters + (declare (in) vec2 y) + (declare (in) vec2 x)) + ((declare () vec2 r) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) + (return (var_ref r)))) + + (signature vec3 + (parameters + (declare (in) vec3 y) + (declare (in) vec3 x)) + ((declare () vec3 r) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) + (assign (constant bool (1)) + (swiz z (var_ref r)) + (call atan ((swiz z (var_ref y)) + (swiz z (var_ref x))))) + (return (var_ref r)))) + + (signature vec4 + (parameters + (declare (in) vec4 y) + (declare (in) vec4 x)) + ((declare () vec4 r) + (assign (constant bool (1)) + (swiz x (var_ref r)) + (call atan ((swiz x (var_ref y)) + (swiz x (var_ref x))))) + (assign (constant bool (1)) + (swiz y (var_ref r)) + (call atan ((swiz y (var_ref y)) + (swiz y (var_ref x))))) + (assign (constant bool (1)) + (swiz z (var_ref r)) + (call atan ((swiz z (var_ref y)) + (swiz z (var_ref x))))) + (assign (constant bool (1)) + (swiz w (var_ref r)) + (call atan ((swiz w (var_ref y)) + (swiz w (var_ref x))))) + (return (var_ref r))))) + +)) diff --git a/src/glsl/builtins/ir/ceil b/src/glsl/builtins/ir/ceil new file mode 100644 index 0000000000..a26a775049 --- /dev/null +++ b/src/glsl/builtins/ir/ceil @@ -0,0 +1,21 @@ +((function ceil + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float ceil (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 ceil (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 ceil (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 ceil (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/clamp b/src/glsl/builtins/ir/clamp new file mode 100644 index 0000000000..2bdc466b26 --- /dev/null +++ b/src/glsl/builtins/ir/clamp @@ -0,0 +1,148 @@ +((function clamp + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) vec2 arg2)) + ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) vec3 arg2)) + ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) vec4 arg2)) + ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1) + (declare (in) ivec2 arg2)) + ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1) + (declare (in) ivec3 arg2)) + ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1) + (declare (in) ivec4 arg2)) + ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1) + (declare (in) int arg2)) + ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1) + (declare (in) uvec2 arg2)) + ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1) + (declare (in) uvec3 arg2)) + ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1) + (declare (in) uvec4 arg2)) + ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1) + (declare (in) uint arg2)) + ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/cos b/src/glsl/builtins/ir/cos new file mode 100644 index 0000000000..88f266eccb --- /dev/null +++ b/src/glsl/builtins/ir/cos @@ -0,0 +1,21 @@ +((function cos + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float cos (var_ref angle))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression vec2 cos (var_ref angle))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression vec3 cos (var_ref angle))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression vec4 cos (var_ref angle))))) +)) diff --git a/src/glsl/builtins/ir/cosh b/src/glsl/builtins/ir/cosh new file mode 100644 index 0000000000..45e0ae427d --- /dev/null +++ b/src/glsl/builtins/ir/cosh @@ -0,0 +1,30 @@ +((function cosh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * (constant float (0.5)) + (expression float + + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * (constant vec2 (0.5)) + (expression vec2 + + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * (constant vec3 (0.5)) + (expression vec3 + + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * (constant vec4 (0.5)) + (expression vec4 + + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/ir/cross b/src/glsl/builtins/ir/cross new file mode 100644 index 0000000000..24717a2183 --- /dev/null +++ b/src/glsl/builtins/ir/cross @@ -0,0 +1,7 @@ +((function cross + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 cross (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/dFdx b/src/glsl/builtins/ir/dFdx new file mode 100644 index 0000000000..30594d33c7 --- /dev/null +++ b/src/glsl/builtins/ir/dFdx @@ -0,0 +1,21 @@ +((function dFdx + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdx (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdx (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdx (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdx (var_ref p))))) +)) diff --git a/src/glsl/builtins/ir/dFdy b/src/glsl/builtins/ir/dFdy new file mode 100644 index 0000000000..fb5798d3cb --- /dev/null +++ b/src/glsl/builtins/ir/dFdy @@ -0,0 +1,21 @@ +((function dFdy + (signature float + (parameters + (declare (in) float p)) + ((return (expression float dFdy (var_ref p))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 dFdy (var_ref p))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 dFdy (var_ref p))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 dFdy (var_ref p))))) +)) diff --git a/src/glsl/builtins/ir/degrees b/src/glsl/builtins/ir/degrees new file mode 100644 index 0000000000..dc0d7b9e20 --- /dev/null +++ b/src/glsl/builtins/ir/degrees @@ -0,0 +1,21 @@ +((function degrees + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (constant float (57.295780)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (constant float (57.295780)))))) +)) diff --git a/src/glsl/builtins/ir/distance b/src/glsl/builtins/ir/distance new file mode 100644 index 0000000000..a2309c484f --- /dev/null +++ b/src/glsl/builtins/ir/distance @@ -0,0 +1,33 @@ +((function distance + (signature float + (parameters + (declare (in) float p0) + (declare (in) float p1)) + ((declare () float p) + (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec2 p0) + (declare (in) vec2 p1)) + ((declare () vec2 p) + (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec3 p0) + (declare (in) vec3 p1)) + ((declare () vec3 p) + (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) + + (signature float + (parameters + (declare (in) vec4 p0) + (declare (in) vec4 p1)) + ((declare () vec4 p) + (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1))) + (return (expression float sqrt (expression float dot (var_ref p) (var_ref p)))))) +)) diff --git a/src/glsl/builtins/ir/dot b/src/glsl/builtins/ir/dot new file mode 100644 index 0000000000..a91a6d2c56 --- /dev/null +++ b/src/glsl/builtins/ir/dot @@ -0,0 +1,25 @@ +((function dot + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) + + (signature float + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression float dot (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/equal b/src/glsl/builtins/ir/equal new file mode 100644 index 0000000000..d7a4bc6063 --- /dev/null +++ b/src/glsl/builtins/ir/equal @@ -0,0 +1,91 @@ +((function equal + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/exp b/src/glsl/builtins/ir/exp new file mode 100644 index 0000000000..a73bd6a7f8 --- /dev/null +++ b/src/glsl/builtins/ir/exp @@ -0,0 +1,21 @@ +((function exp + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float exp (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 exp (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 exp (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 exp (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/exp2 b/src/glsl/builtins/ir/exp2 new file mode 100644 index 0000000000..a842d3fe65 --- /dev/null +++ b/src/glsl/builtins/ir/exp2 @@ -0,0 +1,21 @@ +((function exp2 + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float exp2 (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 exp2 (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 exp2 (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 exp2 (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/faceforward b/src/glsl/builtins/ir/faceforward new file mode 100644 index 0000000000..d170397238 --- /dev/null +++ b/src/glsl/builtins/ir/faceforward @@ -0,0 +1,37 @@ +((function faceforward + (signature float + (parameters + (declare (in) float N) + (declare (in) float I) + (declare (in) float Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression float neg (var_ref N))))))) + + (signature vec2 + (parameters + (declare (in) vec2 N) + (declare (in) vec2 I) + (declare (in) vec2 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec2 neg (var_ref N))))))) + + (signature vec3 + (parameters + (declare (in) vec3 N) + (declare (in) vec3 I) + (declare (in) vec3 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec3 neg (var_ref N))))))) + + (signature vec4 + (parameters + (declare (in) vec4 N) + (declare (in) vec4 I) + (declare (in) vec4 Nref)) + ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0))) + ((return (var_ref N))) + ((return (expression vec4 neg (var_ref N))))))) +)) diff --git a/src/glsl/builtins/ir/floor b/src/glsl/builtins/ir/floor new file mode 100644 index 0000000000..8dd8052799 --- /dev/null +++ b/src/glsl/builtins/ir/floor @@ -0,0 +1,21 @@ +((function floor + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float floor (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 floor (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 floor (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 floor (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/fract b/src/glsl/builtins/ir/fract new file mode 100644 index 0000000000..3f0763d1b3 --- /dev/null +++ b/src/glsl/builtins/ir/fract @@ -0,0 +1,22 @@ +((function fract + (signature float + (parameters + (declare (in) float x)) + ((return (expression float fract (var_ref x))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 fract (var_ref x))))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 fract (var_ref x))))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 fract (var_ref x))))) +)) + diff --git a/src/glsl/builtins/ir/ftransform b/src/glsl/builtins/ir/ftransform new file mode 100644 index 0000000000..9ca63dc1e3 --- /dev/null +++ b/src/glsl/builtins/ir/ftransform @@ -0,0 +1,9 @@ +((declare (uniform) mat4 gl_ModelViewProjectionMatrix) + (declare (in) vec4 gl_Vertex) + (function ftransform + (signature vec4 + (parameters) + ((return (expression vec4 * + (var_ref gl_ModelViewProjectionMatrix) + (var_ref gl_Vertex))))) +)) diff --git a/src/glsl/builtins/ir/fwidth b/src/glsl/builtins/ir/fwidth new file mode 100644 index 0000000000..385e05d6a1 --- /dev/null +++ b/src/glsl/builtins/ir/fwidth @@ -0,0 +1,29 @@ +((function fwidth + (signature float + (parameters + (declare (in) float p)) + ((return (expression float + + (expression float abs (expression float dFdx (var_ref p))) + (expression float abs (expression float dFdy (var_ref p))))))) + + (signature vec2 + (parameters + (declare (in) vec2 p)) + ((return (expression vec2 + + (expression vec2 abs (expression vec2 dFdx (var_ref p))) + (expression vec2 abs (expression vec2 dFdy (var_ref p))))))) + + (signature vec3 + (parameters + (declare (in) vec3 p)) + ((return (expression vec3 + + (expression vec3 abs (expression vec3 dFdx (var_ref p))) + (expression vec3 abs (expression vec3 dFdy (var_ref p))))))) + + (signature vec4 + (parameters + (declare (in) vec4 p)) + ((return (expression vec4 + + (expression vec4 abs (expression vec4 dFdx (var_ref p))) + (expression vec4 abs (expression vec4 dFdy (var_ref p))))))) +)) diff --git a/src/glsl/builtins/ir/greaterThan b/src/glsl/builtins/ir/greaterThan new file mode 100644 index 0000000000..ce7bd29bed --- /dev/null +++ b/src/glsl/builtins/ir/greaterThan @@ -0,0 +1,91 @@ +((function greaterThan + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/greaterThanEqual b/src/glsl/builtins/ir/greaterThanEqual new file mode 100644 index 0000000000..de1a9f9516 --- /dev/null +++ b/src/glsl/builtins/ir/greaterThanEqual @@ -0,0 +1,91 @@ +((function greaterThanEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/inversesqrt b/src/glsl/builtins/ir/inversesqrt new file mode 100644 index 0000000000..5b66d2b369 --- /dev/null +++ b/src/glsl/builtins/ir/inversesqrt @@ -0,0 +1,21 @@ +((function inversesqrt + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float rsq (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 rsq (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 rsq (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 rsq (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/length b/src/glsl/builtins/ir/length new file mode 100644 index 0000000000..89ff7f3ef1 --- /dev/null +++ b/src/glsl/builtins/ir/length @@ -0,0 +1,21 @@ +((function length + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec2 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec3 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) + + (signature float + (parameters + (declare (in) vec4 arg0)) + ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0)))))) +)) diff --git a/src/glsl/builtins/ir/lessThan b/src/glsl/builtins/ir/lessThan new file mode 100644 index 0000000000..52113b7046 --- /dev/null +++ b/src/glsl/builtins/ir/lessThan @@ -0,0 +1,91 @@ +((function lessThan + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/lessThanEqual b/src/glsl/builtins/ir/lessThanEqual new file mode 100644 index 0000000000..4b240be5d1 --- /dev/null +++ b/src/glsl/builtins/ir/lessThanEqual @@ -0,0 +1,91 @@ +((function lessThanEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/log b/src/glsl/builtins/ir/log new file mode 100644 index 0000000000..d168abb5a7 --- /dev/null +++ b/src/glsl/builtins/ir/log @@ -0,0 +1,21 @@ +((function log + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float log (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 log (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 log (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 log (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/log2 b/src/glsl/builtins/ir/log2 new file mode 100644 index 0000000000..b96c6276f0 --- /dev/null +++ b/src/glsl/builtins/ir/log2 @@ -0,0 +1,21 @@ +((function log2 + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float log2 (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 log2 (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 log2 (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 log2 (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/matrixCompMult b/src/glsl/builtins/ir/matrixCompMult new file mode 100644 index 0000000000..538da18a79 --- /dev/null +++ b/src/glsl/builtins/ir/matrixCompMult @@ -0,0 +1,91 @@ +((function matrixCompMult + (signature mat2 + (parameters + (declare (in) mat2 x) + (declare (in) mat2 y)) + ((declare () mat2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat3 + (parameters + (declare (in) mat3 x) + (declare (in) mat3 y)) + ((declare () mat3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat4 + (parameters + (declare (in) mat4 x) + (declare (in) mat4 y)) + ((declare () mat4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) + + (signature mat2x3 + (parameters + (declare (in) mat2x3 x) + (declare (in) mat2x3 y)) + ((declare () mat2x3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat3x2 + (parameters + (declare (in) mat3x2 x) + (declare (in) mat3x2 y)) + ((declare () mat3x2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat2x4 + (parameters + (declare (in) mat2x4 x) + (declare (in) mat2x4 y)) + ((declare () mat2x4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) +(return (var_ref z)))) + + (signature mat4x2 + (parameters + (declare (in) mat4x2 x) + (declare (in) mat4x2 y)) + ((declare () mat4x2 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) + + (signature mat3x4 + (parameters + (declare (in) mat3x4 x) + (declare (in) mat3x4 y)) + ((declare () mat3x4 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) +(return (var_ref z)))) + + (signature mat4x3 + (parameters + (declare (in) mat4x3 x) + (declare (in) mat4x3 y)) + ((declare () mat4x3 z) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) + (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) +(return (var_ref z)))) +)) diff --git a/src/glsl/builtins/ir/max b/src/glsl/builtins/ir/max new file mode 100644 index 0000000000..2b5a02868c --- /dev/null +++ b/src/glsl/builtins/ir/max @@ -0,0 +1,127 @@ +((function max + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float max (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((return (expression vec2 max (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((return (expression vec3 max (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((return (expression vec4 max (var_ref arg0) (var_ref arg1))))) + + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1)) + ((return (expression int max (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1)) + ((return (expression ivec2 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1)) + ((return (expression ivec3 max (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1)) + ((return (expression ivec4 max (var_ref arg0) (var_ref arg1))))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1)) + ((return (expression uint max (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1)) + ((return (expression uvec2 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1)) + ((return (expression uvec3 max (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1)) + ((return (expression uvec4 max (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/min b/src/glsl/builtins/ir/min new file mode 100644 index 0000000000..2deef1118a --- /dev/null +++ b/src/glsl/builtins/ir/min @@ -0,0 +1,127 @@ +((function min + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float min (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((return (expression vec2 min (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((return (expression vec3 min (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((return (expression vec4 min (var_ref arg0) (var_ref arg1))))) + + (signature int + (parameters + (declare (in) int arg0) + (declare (in) int arg1)) + ((return (expression int min (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) int arg1)) + ((return (expression ivec2 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) int arg1)) + ((return (expression ivec3 min (var_ref arg0) (var_ref arg1))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) int arg1)) + ((return (expression ivec4 min (var_ref arg0) (var_ref arg1))))) + + (signature uint + (parameters + (declare (in) uint arg0) + (declare (in) uint arg1)) + ((return (expression uint min (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uint arg1)) + ((return (expression uvec2 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uint arg1)) + ((return (expression uvec3 min (var_ref arg0) (var_ref arg1))))) + + (signature uvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uint arg1)) + ((return (expression uvec4 min (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/mix b/src/glsl/builtins/ir/mix new file mode 100644 index 0000000000..6bc6f0a43e --- /dev/null +++ b/src/glsl/builtins/ir/mix @@ -0,0 +1,88 @@ +((function mix + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1) + (declare (in) float arg2)) + ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) vec2 arg2)) + ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) vec3 arg2)) + ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) vec4 arg2)) + ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1) + (declare (in) float arg2)) + ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1) + (declare (in) float arg2)) + ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1) + (declare (in) float arg2)) + ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2)))))) + + (signature float + (parameters + (declare (in) float v1) + (declare (in) float v2) + (declare (in) bool a)) + ((assign (var_ref a) (var_ref v1) (var_ref v2)) + (return (var_ref v1)))) + + (signature vec2 + (parameters + (declare (in) vec2 v1) + (declare (in) vec2 v2) + (declare (in) bvec2 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (return (var_ref v1)))) + + (signature vec3 + (parameters + (declare (in) vec3 v1) + (declare (in) vec3 v2) + (declare (in) bvec3 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) + (return (var_ref v1)))) + + (signature vec4 + (parameters + (declare (in) vec4 v1) + (declare (in) vec4 v2) + (declare (in) bvec4 a)) + ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2))) + (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2))) + (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2))) + (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2))) + (return (var_ref v1)))) +)) diff --git a/src/glsl/builtins/ir/mod b/src/glsl/builtins/ir/mod new file mode 100644 index 0000000000..aeaea240e2 --- /dev/null +++ b/src/glsl/builtins/ir/mod @@ -0,0 +1,43 @@ +((function mod + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float % (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) float arg1)) + ((return (expression vec2 % (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) float arg1)) + ((return (expression vec3 % (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) float arg1)) + ((return (expression vec4 % (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/noise1 b/src/glsl/builtins/ir/noise1 new file mode 100644 index 0000000000..eb7be35857 --- /dev/null +++ b/src/glsl/builtins/ir/noise1 @@ -0,0 +1,18 @@ +((function noise1 + (signature float + (parameters + (declare (in) float x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec2 x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec3 x)) + ((return (constant float (0))))) + (signature float + (parameters + (declare (in) vec4 x)) + ((return (constant float (0))))) +)) diff --git a/src/glsl/builtins/ir/noise2 b/src/glsl/builtins/ir/noise2 new file mode 100644 index 0000000000..ae4443a704 --- /dev/null +++ b/src/glsl/builtins/ir/noise2 @@ -0,0 +1,18 @@ +((function noise2 + (signature vec2 + (parameters + (declare (in) float x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec3 x)) + ((return (constant vec2 (0 0))))) + (signature vec2 + (parameters + (declare (in) vec4 x)) + ((return (constant vec2 (0 0))))) +)) diff --git a/src/glsl/builtins/ir/noise3 b/src/glsl/builtins/ir/noise3 new file mode 100644 index 0000000000..30d9681890 --- /dev/null +++ b/src/glsl/builtins/ir/noise3 @@ -0,0 +1,18 @@ +((function noise3 + (signature vec3 + (parameters + (declare (in) float x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec2 x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (constant vec3 (0 0 0))))) + (signature vec3 + (parameters + (declare (in) vec4 x)) + ((return (constant vec3 (0 0 0))))) +)) diff --git a/src/glsl/builtins/ir/noise4 b/src/glsl/builtins/ir/noise4 new file mode 100644 index 0000000000..913bef2aa1 --- /dev/null +++ b/src/glsl/builtins/ir/noise4 @@ -0,0 +1,18 @@ +((function noise4 + (signature vec4 + (parameters + (declare (in) float x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec2 x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec3 x)) + ((return (constant vec4 (0 0 0 0))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (constant vec4 (0 0 0 0))))) +)) diff --git a/src/glsl/builtins/ir/normalize b/src/glsl/builtins/ir/normalize new file mode 100644 index 0000000000..be88a9830d --- /dev/null +++ b/src/glsl/builtins/ir/normalize @@ -0,0 +1,21 @@ +((function normalize + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0))))))) +)) diff --git a/src/glsl/builtins/ir/not b/src/glsl/builtins/ir/not new file mode 100644 index 0000000000..b696b06557 --- /dev/null +++ b/src/glsl/builtins/ir/not @@ -0,0 +1,16 @@ +((function not + (signature bvec2 + (parameters + (declare (in) bvec2 arg0)) + ((return (expression bvec2 ! (var_ref arg0))))) + + (signature bvec3 + (parameters + (declare (in) bvec3 arg0)) + ((return (expression bvec3 ! (var_ref arg0))))) + + (signature bvec4 + (parameters + (declare (in) bvec4 arg0)) + ((return (expression bvec4 ! (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/notEqual b/src/glsl/builtins/ir/notEqual new file mode 100644 index 0000000000..bcc7339bb6 --- /dev/null +++ b/src/glsl/builtins/ir/notEqual @@ -0,0 +1,91 @@ +((function notEqual + (signature bvec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) ivec2 arg0) + (declare (in) ivec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) ivec3 arg0) + (declare (in) ivec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) ivec4 arg0) + (declare (in) ivec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec2 + (parameters + (declare (in) uvec2 arg0) + (declare (in) uvec2 arg1)) + ((declare () bvec2 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec3 + (parameters + (declare (in) uvec3 arg0) + (declare (in) uvec3 arg1)) + ((declare () bvec3 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (return (var_ref temp)))) + + (signature bvec4 + (parameters + (declare (in) uvec4 arg0) + (declare (in) uvec4 arg1)) + ((declare () bvec4 temp) + (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) + (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) + (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) + (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) + (return (var_ref temp)))) +)) diff --git a/src/glsl/builtins/ir/outerProduct b/src/glsl/builtins/ir/outerProduct new file mode 100644 index 0000000000..69ae741e17 --- /dev/null +++ b/src/glsl/builtins/ir/outerProduct @@ -0,0 +1,92 @@ +((function outerProduct + (signature mat2 + (parameters + (declare (in) vec2 u) + (declare (in) vec2 v)) + ((declare () mat2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) + + (signature mat2x3 + (parameters + (declare (in) vec3 u) + (declare (in) vec2 v)) + ((declare () mat2x3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) + + (signature mat2x4 + (parameters + (declare (in) vec4 u) + (declare (in) vec2 v)) + ((declare () mat2x4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (return (var_ref m)))) + + (signature mat3x2 + (parameters + (declare (in) vec2 u) + (declare (in) vec3 v)) + ((declare () mat3x2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)) + )) + + (signature mat3 + (parameters + (declare (in) vec3 u) + (declare (in) vec3 v)) + ((declare () mat3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)))) + + (signature mat3x4 + (parameters + (declare (in) vec4 u) + (declare (in) vec3 v)) + ((declare () mat3x4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) + (return (var_ref m)))) + + (signature mat4x2 + (parameters + (declare (in) vec2 u) + (declare (in) vec4 v)) + ((declare () mat4x2 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) + + (signature mat4x3 + (parameters + (declare (in) vec3 u) + (declare (in) vec4 v)) + ((declare () mat4x3 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) + + (signature mat4 + (parameters + (declare (in) vec4 u) + (declare (in) vec4 v)) + ((declare () mat4 m) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v)))) + (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v)))) + (return (var_ref m)))) +)) diff --git a/src/glsl/builtins/ir/pow b/src/glsl/builtins/ir/pow new file mode 100644 index 0000000000..a61bc4418e --- /dev/null +++ b/src/glsl/builtins/ir/pow @@ -0,0 +1,25 @@ +((function pow + (signature float + (parameters + (declare (in) float arg0) + (declare (in) float arg1)) + ((return (expression float pow (var_ref arg0) (var_ref arg1))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0) + (declare (in) vec2 arg1)) + ((return (expression vec2 pow (var_ref arg0) (var_ref arg1))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0) + (declare (in) vec3 arg1)) + ((return (expression vec3 pow (var_ref arg0) (var_ref arg1))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0) + (declare (in) vec4 arg1)) + ((return (expression vec4 pow (var_ref arg0) (var_ref arg1))))) +)) diff --git a/src/glsl/builtins/ir/radians b/src/glsl/builtins/ir/radians new file mode 100644 index 0000000000..6a0f5d2e21 --- /dev/null +++ b/src/glsl/builtins/ir/radians @@ -0,0 +1,21 @@ +((function radians + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 * (var_ref arg0) (constant float (0.017453)))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 * (var_ref arg0) (constant float (0.017453)))))) +)) diff --git a/src/glsl/builtins/ir/reflect b/src/glsl/builtins/ir/reflect new file mode 100644 index 0000000000..8238fdc93f --- /dev/null +++ b/src/glsl/builtins/ir/reflect @@ -0,0 +1,58 @@ +((function reflect + (signature float + (parameters + (declare (in) float i) + (declare (in) float n)) + ((return (expression float - + (var_ref i) + (expression float * + (constant float (2.0)) + (expression float * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec2 + (parameters + (declare (in) vec2 i) + (declare (in) vec2 n)) + ((return (expression vec2 - + (var_ref i) + (expression vec2 * + (constant float (2.0)) + (expression vec2 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec3 + (parameters + (declare (in) vec3 i) + (declare (in) vec3 n)) + ((return (expression vec3 - + (var_ref i) + (expression vec3 * + (constant float (2.0)) + (expression vec3 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + + (signature vec4 + (parameters + (declare (in) vec4 i) + (declare (in) vec4 n)) + ((return (expression vec4 - + (var_ref i) + (expression vec4 * + (constant float (2.0)) + (expression vec4 * + (expression float dot + (var_ref n) + (var_ref i)) + (var_ref n))))))) + +)) diff --git a/src/glsl/builtins/ir/refract b/src/glsl/builtins/ir/refract new file mode 100644 index 0000000000..522ab41173 --- /dev/null +++ b/src/glsl/builtins/ir/refract @@ -0,0 +1,102 @@ +((function refract + (signature float + (parameters + (declare (in) float i) + (declare (in) float n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant float (0.0)))) + ((return (expression float - + (expression float * (var_ref eta) (var_ref i)) + (expression float * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec2 + (parameters + (declare (in) vec2 i) + (declare (in) vec2 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec2 (0.0 0.0)))) + ((return (expression vec2 - + (expression vec2 * (var_ref eta) (var_ref i)) + (expression vec2 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec3 + (parameters + (declare (in) vec3 i) + (declare (in) vec3 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec3 (0.0 0.0 0.0)))) + ((return (expression vec3 - + (expression vec3 * (var_ref eta) (var_ref i)) + (expression vec3 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + + (signature vec4 + (parameters + (declare (in) vec4 i) + (declare (in) vec4 n) + (declare (in) float eta)) + ((declare () float k) + (assign (constant bool (1)) (var_ref k) + (expression float - (constant float (1.0)) + (expression float * (var_ref eta) + (expression float * (var_ref eta) + (expression float - (constant float (1.0)) + (expression float * + (expression float dot (var_ref n) (var_ref i)) + (expression float dot (var_ref n) (var_ref i)))))))) + (if (expression bool < (var_ref k) (constant float (0.0))) + ((return (constant vec4 (0.0 0.0 0.0 0.0)))) + ((return (expression vec4 - + (expression vec4 * (var_ref eta) (var_ref i)) + (expression vec4 * + (expression float + + (expression float * (var_ref eta) + (expression float dot (var_ref n) (var_ref i))) + (expression float sqrt (var_ref k))) + (var_ref n)))))))) + +)) diff --git a/src/glsl/builtins/ir/sign b/src/glsl/builtins/ir/sign new file mode 100644 index 0000000000..1f51718dab --- /dev/null +++ b/src/glsl/builtins/ir/sign @@ -0,0 +1,42 @@ +((function sign + (signature float + (parameters + (declare (in) float x)) + ((return (expression float sign (var_ref x))))) + + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 sign (var_ref x))))) + + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 sign (var_ref x))))) + + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 sign (var_ref x))))) + + (signature int + (parameters + (declare (in) int x)) + ((return (expression int sign (var_ref x))))) + + (signature ivec2 + (parameters + (declare (in) ivec2 x)) + ((return (expression ivec2 sign (var_ref x))))) + + (signature ivec3 + (parameters + (declare (in) ivec3 x)) + ((return (expression ivec3 sign (var_ref x))))) + + (signature ivec4 + (parameters + (declare (in) ivec4 x)) + ((return (expression ivec4 sign (var_ref x))))) +)) + diff --git a/src/glsl/builtins/ir/sin b/src/glsl/builtins/ir/sin new file mode 100644 index 0000000000..e6009d8ef1 --- /dev/null +++ b/src/glsl/builtins/ir/sin @@ -0,0 +1,21 @@ +((function sin + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float sin (var_ref angle))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression vec2 sin (var_ref angle))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression vec3 sin (var_ref angle))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression vec4 sin (var_ref angle))))) +)) diff --git a/src/glsl/builtins/ir/sinh b/src/glsl/builtins/ir/sinh new file mode 100644 index 0000000000..7ad4f58e20 --- /dev/null +++ b/src/glsl/builtins/ir/sinh @@ -0,0 +1,30 @@ +((function sinh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float * (constant float (0.5)) + (expression float - + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 * (constant vec2 (0.5)) + (expression vec2 - + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 * (constant vec3 (0.5)) + (expression vec3 - + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 * (constant vec4 (0.5)) + (expression vec4 - + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/ir/smoothstep b/src/glsl/builtins/ir/smoothstep new file mode 100644 index 0000000000..663eec6341 --- /dev/null +++ b/src/glsl/builtins/ir/smoothstep @@ -0,0 +1,153 @@ +((function smoothstep + (signature float + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) float x)) + ((declare () float t) + + (assign (constant bool (1)) (var_ref t) + (expression float max + (expression float min + (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t)))))))) + + (signature vec2 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec2 x)) + ((declare () vec2 t) + (declare () vec2 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + (return (var_ref retval)) + )) + + (signature vec3 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec3 x)) + ((declare () vec3 t) + (declare () vec3 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + (return (var_ref retval)) + )) + + + (signature vec4 + (parameters + (declare (in) float edge0) + (declare (in) float edge1) + (declare (in) vec4 x)) + ((declare () vec4 t) + (declare () vec4 retval) + + (assign (constant bool (1)) (swiz x (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) + + (assign (constant bool (1)) (swiz y (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) + + (assign (constant bool (1)) (swiz z (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) + + (assign (constant bool (1)) (swiz w (var_ref t)) + (expression float max + (expression float min + (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (constant float (1.0))) + (constant float (0.0)))) + (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) + (return (var_ref retval)) + )) + + (signature vec2 + (parameters + (declare (in) vec2 edge0) + (declare (in) vec2 edge1) + (declare (in) vec2 x)) + ((return (expression vec2 max + (expression vec2 min + (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0))) + (constant vec2 (1.0 1.0))) + (constant vec2 (0.0 0.0)))))) + + (signature vec3 + (parameters + (declare (in) vec3 edge0) + (declare (in) vec3 edge1) + (declare (in) vec3 x)) + ((return (expression vec3 max + (expression vec3 min + (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0))) + (constant vec3 (1.0 1.0 1.0))) + (constant vec3 (0.0 0.0 0.0)))))) + + (signature vec4 + (parameters + (declare (in) vec4 edge0) + (declare (in) vec4 edge1) + (declare (in) vec4 x)) + ((return (expression vec4 max + (expression vec4 min + (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0))) + (constant vec4 (1.0 1.0 1.0 1.0))) + (constant vec4 (0.0 0.0 0.0 0.0)))))) +)) + diff --git a/src/glsl/builtins/ir/sqrt b/src/glsl/builtins/ir/sqrt new file mode 100644 index 0000000000..0302d164ae --- /dev/null +++ b/src/glsl/builtins/ir/sqrt @@ -0,0 +1,21 @@ +((function sqrt + (signature float + (parameters + (declare (in) float arg0)) + ((return (expression float sqrt (var_ref arg0))))) + + (signature vec2 + (parameters + (declare (in) vec2 arg0)) + ((return (expression vec2 sqrt (var_ref arg0))))) + + (signature vec3 + (parameters + (declare (in) vec3 arg0)) + ((return (expression vec3 sqrt (var_ref arg0))))) + + (signature vec4 + (parameters + (declare (in) vec4 arg0)) + ((return (expression vec4 sqrt (var_ref arg0))))) +)) diff --git a/src/glsl/builtins/ir/step b/src/glsl/builtins/ir/step new file mode 100644 index 0000000000..ce6f435422 --- /dev/null +++ b/src/glsl/builtins/ir/step @@ -0,0 +1,68 @@ +((function step + (signature float + (parameters + (declare (in) float edge) + (declare (in) float x)) + ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge)))))) + + (signature vec2 + (parameters + (declare (in) float edge) + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) float edge) + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) float edge) + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge)))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) + (return (var_ref t)))) + + (signature vec2 + (parameters + (declare (in) vec2 edge) + (declare (in) vec2 x)) + ((declare () vec2 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) + (return (var_ref t)))) + + (signature vec3 + (parameters + (declare (in) vec3 edge) + (declare (in) vec3 x)) + ((declare () vec3 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge))))) + (return (var_ref t)))) + + (signature vec4 + (parameters + (declare (in) vec4 edge) + (declare (in) vec4 x)) + ((declare () vec4 t) + (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge))))) + (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge))))) + (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge))))) + (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge))))) + (return (var_ref t)))) +)) + diff --git a/src/glsl/builtins/ir/tan b/src/glsl/builtins/ir/tan new file mode 100644 index 0000000000..9979863185 --- /dev/null +++ b/src/glsl/builtins/ir/tan @@ -0,0 +1,21 @@ +((function tan + (signature float + (parameters + (declare (in) float angle)) + ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle)))))) + + (signature vec2 + (parameters + (declare (in) vec2 angle)) + ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle)))))) + + (signature vec3 + (parameters + (declare (in) vec3 angle)) + ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle)))))) + + (signature vec4 + (parameters + (declare (in) vec4 angle)) + ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle)))))) +)) diff --git a/src/glsl/builtins/ir/tanh b/src/glsl/builtins/ir/tanh new file mode 100644 index 0000000000..3b7271bf77 --- /dev/null +++ b/src/glsl/builtins/ir/tanh @@ -0,0 +1,42 @@ +((function tanh + (signature float + (parameters + (declare (in) float x)) + ((return (expression float / + (expression float - + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))) + (expression float + + (expression float exp (var_ref x)) + (expression float exp (expression float neg (var_ref x)))))))) + (signature vec2 + (parameters + (declare (in) vec2 x)) + ((return (expression vec2 / + (expression vec2 - + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))) + (expression vec2 + + (expression vec2 exp (var_ref x)) + (expression vec2 exp (expression vec2 neg (var_ref x)))))))) + (signature vec3 + (parameters + (declare (in) vec3 x)) + ((return (expression vec3 / + (expression vec3 - + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))) + (expression vec3 + + (expression vec3 exp (var_ref x)) + (expression vec3 exp (expression vec3 neg (var_ref x)))))))) + (signature vec4 + (parameters + (declare (in) vec4 x)) + ((return (expression vec4 / + (expression vec4 - + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))) + (expression vec4 + + (expression vec4 exp (var_ref x)) + (expression vec4 exp (expression vec4 neg (var_ref x)))))))) +)) diff --git a/src/glsl/builtins/ir/transpose b/src/glsl/builtins/ir/transpose new file mode 100644 index 0000000000..416a0ee467 --- /dev/null +++ b/src/glsl/builtins/ir/transpose @@ -0,0 +1,139 @@ +((function transpose + (signature mat2 + (parameters + (declare (in) mat2 m)) + ((declare () mat2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat3x2 + (parameters + (declare (in) mat2x3 m)) + ((declare () mat3x2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat4x2 + (parameters + (declare (in) mat2x4 m)) + ((declare () mat4x2 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) +(return (var_ref t)))) + + (signature mat2x3 + (parameters + (declare (in) mat3x2 m)) + ((declare () mat2x3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat3 + (parameters + (declare (in) mat3 m)) + ((declare () mat3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat4x3 + (parameters + (declare (in) mat3x4 m)) + ((declare () mat4x3 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) +(return (var_ref t)))) + + (signature mat2x4 + (parameters + (declare (in) mat4x2 m)) + ((declare () mat2x4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) + + (signature mat3x4 + (parameters + (declare (in) mat4x3 m)) + ((declare () mat3x4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) + + (signature mat4 + (parameters + (declare (in) mat4 m)) + ((declare () mat4 t) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) + (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) +(return (var_ref t)))) +) + +) + diff --git a/src/glsl/builtins/profiles/110.frag b/src/glsl/builtins/profiles/110.frag new file mode 100644 index 0000000000..25bc62c093 --- /dev/null +++ b/src/glsl/builtins/profiles/110.frag @@ -0,0 +1,364 @@ +#version 110 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1D (sampler1D sampler, float coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2D (sampler2D sampler, vec2 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3D (sampler3D sampler, vec3 coord, float bias); +vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCube (samplerCube sampler, vec3 coord, float bias); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias); + + +/* + * 8.8 - Fragment Processing Functions + */ +float dFdx(float p); +vec2 dFdx(vec2 p); +vec3 dFdx(vec3 p); +vec4 dFdx(vec4 p); + +float dFdy(float p); +vec2 dFdy(vec2 p); +vec3 dFdy(vec3 p); +vec4 dFdy(vec4 p); + +float fwidth(float p); +vec2 fwidth(vec2 p); +vec3 fwidth(vec3 p); +vec4 fwidth(vec4 p); + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); diff --git a/src/glsl/builtins/profiles/110.vert b/src/glsl/builtins/profiles/110.vert new file mode 100644 index 0000000000..545e59c539 --- /dev/null +++ b/src/glsl/builtins/profiles/110.vert @@ -0,0 +1,351 @@ +#version 110 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +vec4 ftransform(); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1DLod (sampler1D sampler, float coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod); +vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod); +vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod); +vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod); +vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod); + +/* + * 8.8 - Fragment Processing Functions (none in vertex shader) + */ + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); diff --git a/src/glsl/builtins/profiles/120.frag b/src/glsl/builtins/profiles/120.frag new file mode 100644 index 0000000000..a207435f33 --- /dev/null +++ b/src/glsl/builtins/profiles/120.frag @@ -0,0 +1,396 @@ +#version 120 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); +mat2x3 matrixCompMult(mat2x3 x, mat2x3 y); +mat2x4 matrixCompMult(mat2x4 x, mat2x4 y); +mat3x2 matrixCompMult(mat3x2 x, mat3x2 y); +mat3x4 matrixCompMult(mat3x4 x, mat3x4 y); +mat4x2 matrixCompMult(mat4x2 x, mat4x2 y); +mat4x3 matrixCompMult(mat4x3 x, mat4x3 y); + +mat2 outerProduct(vec2 c, vec2 r); +mat3 outerProduct(vec3 c, vec3 r); +mat4 outerProduct(vec4 c, vec4 r); + +mat2x3 outerProduct(vec3 c, vec2 r); +mat3x2 outerProduct(vec2 c, vec3 r); + +mat2x4 outerProduct(vec4 c, vec2 r); +mat4x2 outerProduct(vec2 c, vec4 r); + +mat3x4 outerProduct(vec4 c, vec3 r); +mat4x3 outerProduct(vec3 c, vec4 r); + +mat2 transpose(mat2 m); +mat3 transpose(mat3 m); +mat4 transpose(mat4 m); + +mat2x3 transpose(mat3x2 m); +mat3x2 transpose(mat2x3 m); + +mat2x4 transpose(mat4x2 m); +mat4x2 transpose(mat2x4 m); + +mat3x4 transpose(mat4x3 m); +mat4x3 transpose(mat3x4 m); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1D (sampler1D sampler, float coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2D (sampler2D sampler, vec2 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3D (sampler3D sampler, vec3 coord, float bias); +vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCube (samplerCube sampler, vec3 coord, float bias); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias); + + +/* + * 8.8 - Fragment Processing Functions + */ +float dFdx(float p); +vec2 dFdx(vec2 p); +vec3 dFdx(vec3 p); +vec4 dFdx(vec4 p); + +float dFdy(float p); +vec2 dFdy(vec2 p); +vec3 dFdy(vec3 p); +vec4 dFdy(vec4 p); + +float fwidth(float p); +vec2 fwidth(vec2 p); +vec3 fwidth(vec3 p); +vec4 fwidth(vec4 p); + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); diff --git a/src/glsl/builtins/profiles/120.vert b/src/glsl/builtins/profiles/120.vert new file mode 100644 index 0000000000..e14c931647 --- /dev/null +++ b/src/glsl/builtins/profiles/120.vert @@ -0,0 +1,383 @@ +#version 120 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +vec4 ftransform(); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); +mat2x3 matrixCompMult(mat2x3 x, mat2x3 y); +mat2x4 matrixCompMult(mat2x4 x, mat2x4 y); +mat3x2 matrixCompMult(mat3x2 x, mat3x2 y); +mat3x4 matrixCompMult(mat3x4 x, mat3x4 y); +mat4x2 matrixCompMult(mat4x2 x, mat4x2 y); +mat4x3 matrixCompMult(mat4x3 x, mat4x3 y); + +mat2 outerProduct(vec2 c, vec2 r); +mat3 outerProduct(vec3 c, vec3 r); +mat4 outerProduct(vec4 c, vec4 r); + +mat2x3 outerProduct(vec3 c, vec2 r); +mat3x2 outerProduct(vec2 c, vec3 r); + +mat2x4 outerProduct(vec4 c, vec2 r); +mat4x2 outerProduct(vec2 c, vec4 r); + +mat3x4 outerProduct(vec4 c, vec3 r); +mat4x3 outerProduct(vec3 c, vec4 r); + +mat2 transpose(mat2 m); +mat3 transpose(mat3 m); +mat4 transpose(mat4 m); + +mat2x3 transpose(mat3x2 m); +mat3x2 transpose(mat2x3 m); + +mat2x4 transpose(mat4x2 m); +mat4x2 transpose(mat2x4 m); + +mat3x4 transpose(mat4x3 m); +mat4x3 transpose(mat3x4 m); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1DLod (sampler1D sampler, float coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod); +vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod); +vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod); +vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod); +vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod); + +/* + * 8.8 - Fragment Processing Functions (none in vertex shader) + */ + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); diff --git a/src/glsl/builtins/profiles/ARB_texture_rectangle.frag b/src/glsl/builtins/profiles/ARB_texture_rectangle.frag new file mode 100644 index 0000000000..8938aa3e97 --- /dev/null +++ b/src/glsl/builtins/profiles/ARB_texture_rectangle.frag @@ -0,0 +1,7 @@ +#extension GL_ARB_texture_rectangle : enable +vec4 texture2DRect(sampler2DRect sampler, vec2 coord); +vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord); +vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord); + +vec4 shadow2DRect(sampler2DRectShadow sampler, vec3 coord); +vec4 shadow2DRectProj(sampler2DRectShadow sampler, vec4 coord); diff --git a/src/glsl/builtins/profiles/ARB_texture_rectangle.vert b/src/glsl/builtins/profiles/ARB_texture_rectangle.vert new file mode 100644 index 0000000000..8938aa3e97 --- /dev/null +++ b/src/glsl/builtins/profiles/ARB_texture_rectangle.vert @@ -0,0 +1,7 @@ +#extension GL_ARB_texture_rectangle : enable +vec4 texture2DRect(sampler2DRect sampler, vec2 coord); +vec4 texture2DRectProj(sampler2DRect sampler, vec3 coord); +vec4 texture2DRectProj(sampler2DRect sampler, vec4 coord); + +vec4 shadow2DRect(sampler2DRectShadow sampler, vec3 coord); +vec4 shadow2DRectProj(sampler2DRectShadow sampler, vec4 coord); diff --git a/src/glsl/builtins/profiles/EXT_texture_array.frag b/src/glsl/builtins/profiles/EXT_texture_array.frag new file mode 100644 index 0000000000..d133132191 --- /dev/null +++ b/src/glsl/builtins/profiles/EXT_texture_array.frag @@ -0,0 +1,11 @@ +#extension GL_EXT_texture_array : enable +vec4 texture1DArray(sampler1DArray sampler, vec2 coord); +vec4 texture1DArray(sampler1DArray sampler, vec2 coord, float bias); + +vec4 texture2DArray(sampler1DArray sampler, vec2 coord); +vec4 texture2DArray(sampler1DArray sampler, vec2 coord, float bias); + +vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord); +vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord, float bias); + +vec4 shadow2DArray(sampler2DArrayShadow sampler, vec4 coord); diff --git a/src/glsl/builtins/profiles/EXT_texture_array.vert b/src/glsl/builtins/profiles/EXT_texture_array.vert new file mode 100644 index 0000000000..4f7b2b5f8b --- /dev/null +++ b/src/glsl/builtins/profiles/EXT_texture_array.vert @@ -0,0 +1,11 @@ +#extension GL_EXT_texture_array : enable +vec4 texture1DArray(sampler1DArray sampler, vec2 coord); +vec4 texture1DArrayLod(sampler1DArray sampler, vec2 coord, float lod); + +vec4 texture2DArray(sampler1DArray sampler, vec2 coord); +vec4 texture2DArrayLod(sampler1DArray sampler, vec2 coord, float lod); + +vec4 shadow1DArray(sampler1DArrayShadow sampler, vec3 coord); +vec4 shadow1DArrayLod(sampler1DArrayShadow sampler, vec3 coord, float lod); + +vec4 shadow2DArray(sampler2DArrayShadow sampler, vec4 coord); diff --git a/src/glsl/builtins/tools/builtin_function.cpp b/src/glsl/builtins/tools/builtin_function.cpp new file mode 100644 index 0000000000..c44804f2ef --- /dev/null +++ b/src/glsl/builtins/tools/builtin_function.cpp @@ -0,0 +1,39 @@ +/* + * 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 +#include "glsl_parser_extras.h" + +/* A dummy file. When compiling prototypes, we don't care about builtins. + * We really don't want to half-compile builtin_functions.cpp and fail, though. + */ +void +_mesa_glsl_release_functions(void) +{ +} + +void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ +} diff --git a/src/glsl/builtins/tools/generate_builtins.pl b/src/glsl/builtins/tools/generate_builtins.pl deleted file mode 100755 index 91ef8917b0..0000000000 --- a/src/glsl/builtins/tools/generate_builtins.pl +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env perl - -sub process_version { - my ($version) = @_; - my @vars; - print "/* $version builtins */\n\n"; - - my @files = ; - foreach $file (@files) { - push(@vars, process_file($file)); - } - - print "static const char *functions_for_$version [] = {\n"; - foreach $var (@vars) { - print " $var,\n"; - } - print "};\n\n" -} - -sub process_file { - my ($file) = @_; - - # Change from builtins/110/foo to builtins_110_foo - my $var = $file; $var =~ s!/!_!g; - - print "static const char *$var = {\n"; - open SRC, "<", "$file" or die $!; - while () { - s/\\/\\\\/g; - s/\"/\\\"/g; - s/\n/\\n/g; - print " \"$_\"\n"; - } - print "};\n\n"; - close SRC or die $!; - return $var; -} - -print << 'EOF'; -/* DO NOT MODIFY - automatically generated by generate_builtins.pl */ -/* - * 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 -#include "main/compiler.h" -#include "glsl_parser_extras.h" -#include "ir_reader.h" -#include "program.h" - -extern "C" struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); - -gl_shader * -read_builtins(GLenum target, const char **functions, unsigned count) -{ - gl_shader *sh = _mesa_new_shader(NULL, 0, target); - struct _mesa_glsl_parse_state *st = - new(sh) _mesa_glsl_parse_state(NULL, target, sh); - - st->language_version = 130; - st->ARB_texture_rectangle_enable = true; - st->EXT_texture_array_enable = true; - _mesa_glsl_initialize_types(st); - - sh->ir = new(sh) exec_list; - sh->symbols = st->symbols; - - for (unsigned i = 0; i < count; i++) { - _mesa_glsl_read_ir(st, sh->ir, functions[i]); - - if (st->error) { - printf("error reading builtin: %.35s ...\n", functions[i]); - delete st; - talloc_free(sh); - return NULL; - } - } - - reparent_ir(sh->ir, sh); - delete st; - - return sh; -} - -EOF - -@versions = sort(); -foreach $version (@versions) { - $version =~ s!builtins/!!g; - process_version($version); -} - -print << 'EOF'; -void *builtin_mem_ctx = NULL; - -void -_mesa_glsl_release_functions(void) -{ - talloc_free(builtin_mem_ctx); -} - -void -_mesa_glsl_initialize_functions(exec_list *instructions, - struct _mesa_glsl_parse_state *state) -{ - if (builtin_mem_ctx == NULL) - builtin_mem_ctx = talloc_init("GLSL built-in functions"); - - state->num_builtins_to_link = 0; -EOF - -foreach $version_xs (@versions) { - $check = ""; - if ($version_xs =~ /_vs/) { - $check = "state->target == vertex_shader && "; - } elsif ($version_xs =~ /_fs/) { - $check = "state->target == fragment_shader && "; - } - $version = $version_xs; - $version =~ s/_[vf]s//g; - - if ($version =~ /^[1-9][0-9][0-9]/) { - $check = "${check}state->language_version >= $version"; - } else { - # Not a version...an extension name - $check = "${check}state->${version}_enable"; - } - print " if ($check) {\n"; - print " static gl_shader *sh = NULL;\n"; - print "\n"; - print " if (sh == NULL) {\n"; - print " sh = read_builtins(GL_VERTEX_SHADER, functions_for_$version_xs,\n"; - print " Elements(functions_for_$version_xs));\n"; - print " talloc_steal(builtin_mem_ctx, sh);\n"; - print " }\n"; - print "\n"; - print " import_prototypes(sh->ir, instructions, state->symbols, state);\n"; - print " state->builtins_to_link[state->num_builtins_to_link] = sh;\n"; - print " state->num_builtins_to_link++;\n"; - print " }\n"; - print "\n"; -} - -print "}\n"; diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py new file mode 100755 index 0000000000..2eb67e398a --- /dev/null +++ b/src/glsl/builtins/tools/generate_builtins.py @@ -0,0 +1,207 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +import re, glob, sys +from os import path +from subprocess import Popen, PIPE + +# Local module: generator for texture lookup builtins +from texture_builtins import generate_texture_functions + +builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..") + +# Read the files in builtins/ir/*...add them to the supplied dictionary. +def read_ir_files(fs): + for filename in glob.glob(path.join(path.join(builtins_dir, 'ir'), '*')): + with open(filename) as f: + fs[path.basename(filename)] = f.read() + +# Return a dictionary containing all builtin definitions (even generated) +def get_builtin_definitions(): + fs = {} + generate_texture_functions(fs) + read_ir_files(fs) + return fs + +def stringify(s): + t = s.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n"\n "') + return ' "' + t + '"\n' + +def write_function_definitions(): + fs = get_builtin_definitions() + for k, v in fs.iteritems(): + print 'static const char *builtin_' + k + ' =' + print stringify(v), ';' + +def run_compiler(args): + compiler_path = path.join(path.join(builtins_dir, '..'), 'glsl_compiler') + command = [compiler_path, '--dump-lir'] + args + p = Popen(command, 1, stdout=PIPE, shell=False) + output = p.communicate()[0] + return (output, p.returncode) + +def write_profile(filename, profile): + (proto_ir, returncode) = run_compiler([filename]) + + if returncode != 0: + print '#error builtins profile', profile, 'failed to compile' + return + + # Kill any global variable declarations. We don't want them. + kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE); + proto_ir = kill_globals.sub('', proto_ir) + + print 'static const char *prototypes_for_' + profile + ' =' + print stringify(proto_ir), ';' + + # Print a table of all the functions (not signatures) referenced. + # This is done so we can avoid bothering with a hash table in the C++ code. + + function_names = set() + for func in re.finditer(r'\(function (.+)\n', proto_ir): + function_names.add(func.group(1)) + + print 'static const char *functions_for_' + profile + ' [] = {' + for func in function_names: + print ' builtin_' + func + ',' + print '};' + +def write_profiles(): + profiles = get_profile_list() + for (filename, profile) in profiles: + write_profile(filename, profile) + +def get_profile_list(): + profiles = [] + for pfile in glob.glob(path.join(path.join(builtins_dir, 'profiles'), '*')): + profiles.append((pfile, path.basename(pfile).replace('.', '_'))) + return profiles + +if __name__ == "__main__": + print """/* DO NOT MODIFY - automatically generated by generate_builtins.py */ +/* + * 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 +#include "main/compiler.h" +#include "glsl_parser_extras.h" +#include "ir_reader.h" +#include "program.h" +#include "ast.h" + +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +gl_shader * +read_builtins(GLenum target, const char *protos, const char **functions, unsigned count) +{ + gl_shader *sh = _mesa_new_shader(NULL, 0, target); + struct _mesa_glsl_parse_state *st = + new(sh) _mesa_glsl_parse_state(NULL, target, sh); + + st->language_version = 130; + st->ARB_texture_rectangle_enable = true; + st->EXT_texture_array_enable = true; + _mesa_glsl_initialize_types(st); + + sh->ir = new(sh) exec_list; + sh->symbols = st->symbols; + + /* Read the IR containing the prototypes */ + _mesa_glsl_read_ir(st, sh->ir, protos, true); + + /* Read ALL the function bodies, telling the IR reader not to scan for + * prototypes (we've already created them). The IR reader will skip any + * signature that does not already exist as a prototype. + */ + for (unsigned i = 0; i < count; i++) { + _mesa_glsl_read_ir(st, sh->ir, functions[i], false); + + if (st->error) { + printf("error reading builtin: %.35s ...\\n", functions[i]); + talloc_free(sh); + return NULL; + } + } + + reparent_ir(sh->ir, sh); + delete st; + + return sh; +} +""" + + write_function_definitions() + write_profiles() + + print """ +void *builtin_mem_ctx = NULL; + +void +_mesa_glsl_release_functions(void) +{ + talloc_free(builtin_mem_ctx); +} + +void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (builtin_mem_ctx == NULL) + builtin_mem_ctx = talloc_init("GLSL built-in functions"); + + state->num_builtins_to_link = 0; +""" + + profiles = get_profile_list() + for (filename, profile) in profiles: + if profile.endswith('_vert'): + check = 'state->target == vertex_shader && ' + elif profile.endswith('_frag'): + check = 'state->target == fragment_shader && ' + + version = re.sub(r'_(vert|frag)$', '', profile) + if version.isdigit(): + check += 'state->language_version == ' + version + else: # an extension name + check += 'state->' + version + '_enable' + + print ' if (' + check + ') {' + print ' static gl_shader *sh = NULL;' + print ' if (sh == NULL) {' + print ' sh = read_builtins(GL_VERTEX_SHADER,' + print ' prototypes_for_' + profile + ',' + print ' functions_for_' + profile + ',' + print ' Elements(functions_for_' + profile, + print '));' + print ' talloc_steal(builtin_mem_ctx, sh);' + print ' }' + print + print ' import_prototypes(sh->ir, instructions, state->symbols,' + print ' state);' + print ' state->builtins_to_link[state->num_builtins_to_link] = sh;' + print ' state->num_builtins_to_link++;' + print ' }' + print + print '}' + diff --git a/src/glsl/builtins/tools/texture_builtins.py b/src/glsl/builtins/tools/texture_builtins.py index 33d9642ef7..8bf708b5aa 100755 --- a/src/glsl/builtins/tools/texture_builtins.py +++ b/src/glsl/builtins/tools/texture_builtins.py @@ -1,7 +1,7 @@ #!/usr/bin/python -from os import path import sys +import StringIO def vec_type(g, size): if size == 1: @@ -95,204 +95,255 @@ def generate_fiu_sigs(tex_inst, sampler_type, use_proj = False, unused_fields = generate_sigs("i", tex_inst, sampler_type, use_proj, unused_fields) generate_sigs("u", tex_inst, sampler_type, use_proj, unused_fields) -builtins_dir = path.join(path.dirname(path.abspath(__file__)), "..") +def start_function(name): + sys.stdout = StringIO.StringIO() + print "((function " + name -with open(path.join(builtins_dir, "130", "texture"), 'w') as sys.stdout: - print "((function texture" +def end_function(fs, name): + print "))" + fs[name] = sys.stdout.getvalue(); + sys.stdout.close() + +# Generate all the functions and store them in the supplied dictionary. +# This is better than writing them to actual files since they should never be +# edited; it'd also be easy to confuse them with the many hand-generated files. +# +# Takes a dictionary as an argument. +def generate_texture_functions(fs): + start_function("texture") generate_fiu_sigs("tex", "1D") generate_fiu_sigs("tex", "2D") generate_fiu_sigs("tex", "3D") generate_fiu_sigs("tex", "Cube") generate_fiu_sigs("tex", "1DArray") generate_fiu_sigs("tex", "2DArray") - print "))" -# txb variants are only allowed within a fragment shader (GLSL 1.30 p. 86) -with open(path.join(builtins_dir, "130_fs", "texture"), 'w') as sys.stdout: - print "((function texture" generate_fiu_sigs("txb", "1D") generate_fiu_sigs("txb", "2D") generate_fiu_sigs("txb", "3D") generate_fiu_sigs("txb", "Cube") generate_fiu_sigs("txb", "1DArray") generate_fiu_sigs("txb", "2DArray") - print "))" + end_function(fs, "texture") -with open(path.join(builtins_dir, "130", "textureProj"), 'w') as sys.stdout: - print "((function textureProj" + start_function("textureProj") generate_fiu_sigs("tex", "1D", True) generate_fiu_sigs("tex", "1D", True, 2) generate_fiu_sigs("tex", "2D", True) generate_fiu_sigs("tex", "2D", True, 1) generate_fiu_sigs("tex", "3D", True) - print "))" -with open(path.join(builtins_dir, "130_fs", "textureProj"), 'w') as sys.stdout: - print "((function textureProj" generate_fiu_sigs("txb", "1D", True) generate_fiu_sigs("txb", "1D", True, 2) generate_fiu_sigs("txb", "2D", True) generate_fiu_sigs("txb", "2D", True, 1) generate_fiu_sigs("txb", "3D", True) - print "))" + end_function(fs, "textureProj") -with open(path.join(builtins_dir, "130", "textureLod"), 'w') as sys.stdout: - print "((function textureLod" + start_function("textureLod") generate_fiu_sigs("txl", "1D") generate_fiu_sigs("txl", "2D") generate_fiu_sigs("txl", "3D") generate_fiu_sigs("txl", "Cube") generate_fiu_sigs("txl", "1DArray") generate_fiu_sigs("txl", "2DArray") - print "))" + end_function(fs, "textureLod") -with open(path.join(builtins_dir, "130", "texelFetch"), 'w') as sys.stdout: - print "((function texelFetch" + start_function("texelFetch") generate_fiu_sigs("txf", "1D") generate_fiu_sigs("txf", "2D") generate_fiu_sigs("txf", "3D") generate_fiu_sigs("txf", "1DArray") generate_fiu_sigs("txf", "2DArray") - print "))" + end_function(fs, "texelFetch") -with open(path.join(builtins_dir, "130", "textureProjLod"), 'w') as sys.stdout: - print "((function textureProjLod" + start_function("textureProjLod") generate_fiu_sigs("txl", "1D", True) generate_fiu_sigs("txl", "1D", True, 2) generate_fiu_sigs("txl", "2D", True) generate_fiu_sigs("txl", "2D", True, 1) generate_fiu_sigs("txl", "3D", True) - print "))" + end_function(fs, "textureProjLod") -with open(path.join(builtins_dir, "130", "textureGrad"), 'w') as sys.stdout: - print "((function textureGrad" + start_function("textureGrad") generate_fiu_sigs("txd", "1D") generate_fiu_sigs("txd", "2D") generate_fiu_sigs("txd", "3D") generate_fiu_sigs("txd", "Cube") generate_fiu_sigs("txd", "1DArray") generate_fiu_sigs("txd", "2DArray") - print ")\n)" + end_function(fs, "textureGrad") -with open(path.join(builtins_dir, "130", "textureProjGrad"), 'w') as sys.stdout: - print "((function textureProjGrad" + start_function("textureProjGrad") generate_fiu_sigs("txd", "1D", True) generate_fiu_sigs("txd", "1D", True, 2) generate_fiu_sigs("txd", "2D", True) generate_fiu_sigs("txd", "2D", True, 1) generate_fiu_sigs("txd", "3D", True) - print "))" + end_function(fs, "textureProjGrad") -# ARB_texture_rectangle extension -with open(path.join(builtins_dir, "ARB_texture_rectangle", "textures"), 'w') as sys.stdout: - print "((function texture2DRect" + # ARB_texture_rectangle extension + start_function("texture2DRect") generate_sigs("", "tex", "2DRect") - print ")\n (function shadow2DRect" + end_function(fs, "texture2DRect") + + start_function("texture2DRectProj") + generate_sigs("", "tex", "2DRect", True) + generate_sigs("", "tex", "2DRect", True, 1) + end_function(fs, "texture2DRectProj") + + start_function("shadow2DRect") generate_sigs("", "tex", "2DRectShadow") - print "))" + end_function(fs, "shadow2DRect") -# EXT_texture_array extension -with open(path.join(builtins_dir, "EXT_texture_array", "textures"), 'w') as sys.stdout: - print "((function texture1DArray" + start_function("shadow2DRectProj") + generate_sigs("", "tex", "2DRectShadow", True) + end_function(fs, "shadow2DRectProj") + + # EXT_texture_array extension + start_function("texture1DArray") generate_sigs("", "tex", "1DArray") - print ")\n (function texture1DArrayLod" + generate_sigs("", "txb", "1DArray") + end_function(fs, "texture1DArray") + + start_function("texture1DArrayLod") generate_sigs("", "txl", "1DArray") - print ")\n (function texture2DArray" + end_function(fs, "texture1DArrayLod") + + start_function("texture2DArray") generate_sigs("", "tex", "2DArray") - print ")\n (function texture2DArrayLod" + generate_sigs("", "txb", "2DArray") + end_function(fs, "texture2DArray") + + start_function("texture2DArrayLod") generate_sigs("", "txl", "2DArray") - print ")\n (function shadow1DArray" + end_function(fs, "texture2DArrayLod") + + start_function("shadow1DArray") generate_sigs("", "tex", "1DArrayShadow") - print ")\n (function shadow1DArrayLod" + generate_sigs("", "txb", "1DArrayShadow") + end_function(fs, "shadow1DArray") + + start_function("shadow1DArrayLod") generate_sigs("", "txl", "1DArrayShadow") - print ")\n (function shadow2DArray" - generate_sigs("", "tex", "2DArrayShadow") - print "))" + end_function(fs, "shadow1DArrayLod") -with open(path.join(builtins_dir, "EXT_texture_array_fs", "textures"), 'w') as sys.stdout: - print "((function texture1DArray" - generate_sigs("", "txb", "1DArray") - print ")\n (function texture2DArray" - generate_sigs("", "txb", "2DArray") - print ")\n (function shadow1DArray" - generate_sigs("", "txb", "1DArrayShadow") - print "))" + start_function("shadow2DArray") + generate_sigs("", "tex", "2DArrayShadow") + end_function(fs, "shadow2DArray") -# Deprecated (110/120 style) functions with silly names: -with open(path.join(builtins_dir, "110", "textures"), 'w') as sys.stdout: - print "((function texture1D" + # Deprecated (110/120 style) functions with silly names: + start_function("texture1D") generate_sigs("", "tex", "1D") - print ")\n (function texture1DLod" + generate_sigs("", "txb", "1D") + end_function(fs, "texture1D") + + start_function("texture1DLod") generate_sigs("", "txl", "1D") - print ")\n (function texture1DProj" + end_function(fs, "texture1DLod") + + start_function("texture1DProj") generate_sigs("", "tex", "1D", True) generate_sigs("", "tex", "1D", True, 2) - print ")\n (function texture1DProjLod" + generate_sigs("", "txb", "1D", True) + generate_sigs("", "txb", "1D", True, 2) + end_function(fs, "texture1DProj") + + start_function("texture1DProjLod") generate_sigs("", "txl", "1D", True) generate_sigs("", "txl", "1D", True, 2) - print ")\n (function texture2D" + end_function(fs, "texture1DProjLod") + + start_function("texture2D") generate_sigs("", "tex", "2D") - print ")\n(function texture2DLod" + generate_sigs("", "txb", "2D") + end_function(fs, "texture2D") + + start_function("texture2DLod") generate_sigs("", "txl", "2D") - print ")\n (function texture2DProj" + end_function(fs, "texture2DLod") + + start_function("texture2DProj") generate_sigs("", "tex", "2D", True) generate_sigs("", "tex", "2D", True, 1) - print ")\n (function texture2DProjLod" + generate_sigs("", "txb", "2D", True) + generate_sigs("", "txb", "2D", True, 1) + end_function(fs, "texture2DProj") + + start_function("texture2DProjLod") generate_sigs("", "txl", "2D", True) generate_sigs("", "txl", "2D", True, 1) - print ")\n (function texture3D" + end_function(fs, "texture2DProjLod") + + start_function("texture3D") generate_sigs("", "tex", "3D") - print ")\n (function texture3DLod" + generate_sigs("", "txb", "3D") + end_function(fs, "texture3D") + + start_function("texture3DLod") generate_sigs("", "txl", "3D") - print ")\n (function texture3DProj" + end_function(fs, "texture3DLod") + + start_function("texture3DProj") generate_sigs("", "tex", "3D", True) - print ")\n (function texture3DProjLod" + generate_sigs("", "txb", "3D", True) + end_function(fs, "texture3DProj") + + start_function("texture3DProjLod") generate_sigs("", "txl", "3D", True) - print ")\n (function textureCube" + end_function(fs, "texture3DProjLod") + + start_function("textureCube") generate_sigs("", "tex", "Cube") - print ")\n (function textureCubeLod" + generate_sigs("", "txb", "Cube") + end_function(fs, "textureCube") + + start_function("textureCubeLod") generate_sigs("", "txl", "Cube") - print ")\n (function shadow1D" + end_function(fs, "textureCubeLod") + + start_function("shadow1D") generate_sigs("", "tex", "1DShadow", False, 1) - print ")\n (function shadow1DLod" + generate_sigs("", "txb", "1DShadow", False, 1) + end_function(fs, "shadow1D") + + start_function("shadow1DLod") generate_sigs("", "txl", "1DShadow", False, 1) - print ")\n (function shadow1DProj" + end_function(fs, "shadow1DLod") + + start_function("shadow1DProj") generate_sigs("", "tex", "1DShadow", True, 1) - print ")\n (function shadow1DProjLod" + generate_sigs("", "txb", "1DShadow", True, 1) + end_function(fs, "shadow1DProj") + + start_function("shadow1DProjLod") generate_sigs("", "txl", "1DShadow", True, 1) - print ")\n (function shadow2D" + end_function(fs, "shadow1DProjLod") + + start_function("shadow2D") generate_sigs("", "tex", "2DShadow") - print ")\n (function shadow2DLod" + generate_sigs("", "txb", "2DShadow") + end_function(fs, "shadow2D") + + start_function("shadow2DLod") generate_sigs("", "txl", "2DShadow") - print ")\n (function shadow2DProj" + end_function(fs, "shadow2DLod") + + start_function("shadow2DProj") generate_sigs("", "tex", "2DShadow", True) - print ")\n (function shadow2DProjLod" + generate_sigs("", "txb", "2DShadow", True) + end_function(fs, "shadow2DProj") + + start_function("shadow2DProjLod") generate_sigs("", "txl", "2DShadow", True) - print "))" + end_function(fs, "shadow2DProjLod") -with open(path.join(builtins_dir, "110_fs", "textures"), 'w') as sys.stdout: - print "((function texture1D" - generate_sigs("", "txb", "1D") - print ")\n (function texture1DProj" - generate_sigs("", "txb", "1D", True) - generate_sigs("", "txb", "1D", True, 2) - print ")\n (function texture2D" - generate_sigs("", "txb", "2D") - print ")\n (function texture2DProj" - generate_sigs("", "txb", "2D", True) - generate_sigs("", "txb", "2D", True, 1) - print ")\n (function texture3D" - generate_sigs("", "txb", "3D") - print ")\n (function texture3DProj" - generate_sigs("", "txb", "3D", True) - print ")\n (function textureCube" - generate_sigs("", "txb", "Cube") - print ")\n (function shadow1D" - generate_sigs("", "txb", "1DShadow", False, 1) - print ")\n (function shadow1DProj" - generate_sigs("", "txb", "1DShadow", True, 1) - print ")\n (function shadow2D" - generate_sigs("", "txb", "2DShadow") - print ")\n (function shadow2DProj" - generate_sigs("", "txb", "2DShadow", True) - print "))" + sys.stdout = sys.__stdout__ + return fs + +# If you actually run this script, it'll print out all the functions. +if __name__ == "__main__": + fs = {} + generate_texture_functions(fs); + for k, v in fs.iteritems(): + print v diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 2def3efff5..3e221c0e5f 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -68,7 +68,7 @@ static ir_dereference *read_record_ref(_mesa_glsl_parse_state *, s_list *); void _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, - const char *src) + const char *src, bool scan_for_protos) { s_expression *expr = s_expression::read_expression(state, src); if (expr == NULL) { @@ -76,9 +76,11 @@ _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, return; } - scan_for_prototypes(state, instructions, expr); - if (state->error) - return; + if (scan_for_protos) { + scan_for_prototypes(state, instructions, expr); + if (state->error) + return; + } read_instructions(state, instructions, expr, NULL); talloc_free(expr); @@ -276,7 +278,12 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, } ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); - if (sig != NULL) { + if (sig == NULL && skip_body) { + /* If scanning for prototypes, generate a new signature. */ + sig = new(ctx) ir_function_signature(return_type); + sig->is_built_in = true; + f->add_signature(sig); + } else if (sig != NULL) { const char *badvar = sig->qualifiers_match(&hir_parameters); if (badvar != NULL) { ir_read_error(st, list, "function `%s' parameter `%s' qualifiers " @@ -290,10 +297,11 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, return; } } else { - sig = new(ctx) ir_function_signature(return_type); - sig->is_built_in = true; - f->add_signature(sig); + /* No prototype for this body exists - skip it. */ + st->symbols->pop_scope(); + return; } + assert(sig != NULL); sig->replace_parameters(&hir_parameters); diff --git a/src/glsl/ir_reader.h b/src/glsl/ir_reader.h index b6afdc81ab..aef2ca23bd 100644 --- a/src/glsl/ir_reader.h +++ b/src/glsl/ir_reader.h @@ -29,6 +29,6 @@ #include "ir.h" void _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, - const char *src); + const char *src, bool scan_for_prototypes); #endif /* IR_READER_H */ -- cgit v1.2.3 From 9364ad8528b8482afd01aab9b5ebe8c9176883df Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 13 Aug 2010 17:46:25 -0700 Subject: glsl2/Makefile: Add a 'make builtins' target. This copies over a dummy builtin_functions.cpp and rebuilds a bootstrapped version of the compiler, then uses that to generate the proper list of builtins. Finally, it rebuilds the compiler with the new list. Unfortunately, it's no longer automatic, but at least it works. --- src/glsl/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/Makefile b/src/glsl/Makefile index b13a612591..1d200b47b4 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -164,8 +164,13 @@ glcpp/glcpp-lex.c: glcpp/glcpp-lex.l glcpp/glcpp-parse.c: glcpp/glcpp-parse.y bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< -builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py +builtins: builtin_function.cpp builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py + @echo Bootstrapping the compiler... cp builtins/tools/builtin_function.cpp . + make glsl_compiler + @echo Regenerating builtin_function.cpp... ./builtins/tools/generate_builtins.py > builtin_function.cpp + @echo Rebuilding the real compiler... + make glsl_compiler -include depend -- cgit v1.2.3 From 2322404b5537b04c111bb985e07826d6b898dbcf Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 12:45:14 +0100 Subject: scons: Add new source files. --- src/glsl/SConscript | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl') diff --git a/src/glsl/SConscript b/src/glsl/SConscript index 90759275ca..96a226d0dd 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -52,8 +52,10 @@ sources = [ 'ir_import_prototypes.cpp', 'ir_mat_op_to_vec.cpp', 'ir_mod_to_fract.cpp', + 'ir_noop_swizzle.cpp', 'ir_print_visitor.cpp', 'ir_reader.cpp', + 'ir_rvalue_visitor.cpp', 'ir_set_program_inouts.cpp', 'ir_structure_splitting.cpp', 'ir_sub_to_add_neg.cpp', -- cgit v1.2.3 From 4b1721eaf35ccb60d90850ab34a99d6ab1f89a05 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 14:40:39 +0100 Subject: glsl: Silence gcc warning "control reaches end of non-void function". --- src/glsl/ir_clone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl') diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index a72609601a..0a9e25a295 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -335,7 +335,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const } default: - assert(!"Should not get here."); break; + assert(!"Should not get here."); return NULL; } } -- cgit v1.2.3 From 1cbcf6693aa490c4dcb56712bfb9998deb270f08 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 15:35:57 +0100 Subject: glsl: Standardize a few more uses of struct vs class keyword. --- src/glsl/glsl_symbol_table.h | 2 +- src/glsl/glsl_types.h | 13 +++++++------ src/glsl/ir.h | 4 ++-- src/glsl/ir_structure_splitting.cpp | 4 ++-- src/glsl/ir_tree_grafting.cpp | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 02e4542cf3..4cb7559e9a 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -40,7 +40,7 @@ extern "C" { * Wraps the existing \c _mesa_symbol_table data structure to enforce some * type safe and some symbol table invariants. */ -class glsl_symbol_table { +struct glsl_symbol_table { private: enum glsl_symbol_name_space { glsl_variable_name_space = 0, diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 97d0d98c62..80cec635d9 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -35,6 +35,7 @@ extern "C" { } struct _mesa_glsl_parse_state; +struct glsl_symbol_table; extern "C" void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); @@ -209,7 +210,7 @@ struct glsl_type { /** * Generate the constructor for this type and add it to the symbol table */ - class ir_function *generate_constructor(class glsl_symbol_table *) const; + class ir_function *generate_constructor(glsl_symbol_table *) const; /** * Query the total number of scalars that make up a scalar, vector or matrix @@ -449,12 +450,12 @@ private: * the world in a public header file. */ /*@{*/ - static void generate_110_types(class glsl_symbol_table *); - static void generate_120_types(class glsl_symbol_table *); - static void generate_130_types(class glsl_symbol_table *); - static void generate_ARB_texture_rectangle_types(class glsl_symbol_table *, + static void generate_110_types(glsl_symbol_table *); + static void generate_120_types(glsl_symbol_table *); + static void generate_130_types(glsl_symbol_table *); + static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool); - static void generate_EXT_texture_array_types(class glsl_symbol_table *, + static void generate_EXT_texture_array_types(glsl_symbol_table *, bool); /*@}*/ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index eb9e6cdf0e..b04222893c 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1383,11 +1383,11 @@ _mesa_glsl_release_functions(void); extern void reparent_ir(exec_list *list, void *mem_ctx); -class glsl_symbol_table; +struct glsl_symbol_table; extern void import_prototypes(const exec_list *source, exec_list *dest, - class glsl_symbol_table *symbols, void *mem_ctx); + struct glsl_symbol_table *symbols, void *mem_ctx); extern bool ir_has_call(ir_instruction *ir); diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index e257defb1a..c0244071ee 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -181,13 +181,13 @@ public: void split_deref(ir_dereference **deref); void handle_rvalue(ir_rvalue **rvalue); - struct variable_entry *get_splitting_entry(ir_variable *var); + variable_entry *get_splitting_entry(ir_variable *var); exec_list *variable_list; void *mem_ctx; }; -struct variable_entry * +variable_entry * ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) { assert(var); diff --git a/src/glsl/ir_tree_grafting.cpp b/src/glsl/ir_tree_grafting.cpp index e80db31cb3..6acc5b86c5 100644 --- a/src/glsl/ir_tree_grafting.cpp +++ b/src/glsl/ir_tree_grafting.cpp @@ -324,7 +324,7 @@ tree_grafting_basic_block(ir_instruction *bb_first, lhs_var->mode == ir_var_inout) continue; - struct variable_entry *entry = info->refs->get_variable_entry(lhs_var); + variable_entry *entry = info->refs->get_variable_entry(lhs_var); if (!entry->declaration || entry->assigned_count != 1 || -- cgit v1.2.3 From 9349379d1acca23e7a2442549e49e9b58515d731 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 14 Aug 2010 16:01:24 +0100 Subject: Revert "glsl2: Use stdint.h instead of inttypes.h" This reverts commit a77a6bc008b3146c56431fa520a00e1f8dfa3938. --- src/glsl/glcpp/glcpp-parse.c | 2 +- src/glsl/glcpp/glcpp-parse.y | 2 +- src/glsl/ir_function_inlining.cpp | 2 +- src/glsl/ir_validate.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index 579fe7c7ad..bd0fbc4fcf 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -96,7 +96,7 @@ #include #include #include -#include +#include #include "glcpp.h" #include "main/mtypes.h" diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index ce4197e240..3d08ce6c75 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "glcpp.h" #include "main/mtypes.h" diff --git a/src/glsl/ir_function_inlining.cpp b/src/glsl/ir_function_inlining.cpp index 56d29e3fd1..874602c84f 100644 --- a/src/glsl/ir_function_inlining.cpp +++ b/src/glsl/ir_function_inlining.cpp @@ -27,7 +27,7 @@ * Replaces calls to functions with the body of the function. */ -#include +#include #include "ir.h" #include "ir_visitor.h" #include "ir_function_inlining.h" diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 905b3c7672..6e08fa4025 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -33,7 +33,7 @@ * a dereference chain. */ -#include +#include #include "ir.h" #include "ir_hierarchical_visitor.h" #include "program/hash_table.h" -- cgit v1.2.3 From 6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 16 Aug 2010 13:42:04 -0700 Subject: glcpp: Remove spurious newline generated by #version handling. This was causing line numbering to be off by one. The newline comes from the NEWLINE token at the end of the line; there's no need to insert one. --- src/glsl/glcpp/glcpp-lex.l | 4 +--- src/glsl/glcpp/glcpp-parse.y | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 1cd95b238d..9187926146 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -88,10 +88,8 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? return SPACE; } -{HASH}(version) { +{HASH}version { yylval->str = talloc_strdup (yyextra, yytext); - yylineno++; - yycolumn = 0; yyextra->space_tokens = 0; return HASH_VERSION; } diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 3d08ce6c75..c91da15519 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -309,7 +309,7 @@ control_line: talloc_free (macro); } add_builtin_define (parser, "__VERSION__", $2); - glcpp_printf(parser->output, "#version %" PRIiMAX "\n", $2); + glcpp_printf(parser->output, "#version %" PRIiMAX, $2); } | HASH NEWLINE ; -- cgit v1.2.3 From 2e2614586225b3fff3c21f37817064a90dd320ad Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 16 Aug 2010 13:43:10 -0700 Subject: glcpp: Refresh autogenerated lexer and parser. --- src/glsl/glcpp/glcpp-lex.c | 102 ++++++++++++++++++------------------------- src/glsl/glcpp/glcpp-parse.c | 2 +- 2 files changed, 44 insertions(+), 60 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c index 6b6aa12d8f..de37c11be8 100644 --- a/src/glsl/glcpp/glcpp-lex.c +++ b/src/glsl/glcpp/glcpp-lex.c @@ -54,6 +54,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -159,15 +158,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -691,7 +682,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); } while(0); #define YY_USER_INIT yylineno = 1; yycolumn = 1; -#line 695 "glcpp/glcpp-lex.c" +#line 686 "glcpp/glcpp-lex.c" #define INITIAL 0 #define DONE 1 @@ -838,12 +829,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -851,7 +837,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -862,7 +848,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -954,7 +940,7 @@ YY_DECL /* Single-line comments */ -#line 958 "glcpp/glcpp-lex.c" +#line 944 "glcpp/glcpp-lex.c" yylval = yylval_param; @@ -1126,8 +1112,6 @@ YY_RULE_SETUP #line 91 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); - yylineno++; - yycolumn = 0; yyextra->space_tokens = 0; return HASH_VERSION; } @@ -1136,7 +1120,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 9: YY_RULE_SETUP -#line 101 "glcpp/glcpp-lex.l" +#line 99 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); yylineno++; @@ -1147,7 +1131,7 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 108 "glcpp/glcpp-lex.l" +#line 106 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1157,7 +1141,7 @@ YY_RULE_SETUP case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 114 "glcpp/glcpp-lex.l" +#line 112 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1167,7 +1151,7 @@ YY_RULE_SETUP case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 120 "glcpp/glcpp-lex.l" +#line 118 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1177,7 +1161,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 126 "glcpp/glcpp-lex.l" +#line 124 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 1; yyextra->space_tokens = 0; @@ -1187,7 +1171,7 @@ YY_RULE_SETUP case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 132 "glcpp/glcpp-lex.l" +#line 130 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ELSE; @@ -1196,7 +1180,7 @@ YY_RULE_SETUP case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 137 "glcpp/glcpp-lex.l" +#line 135 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_ENDIF; @@ -1216,7 +1200,7 @@ case 16: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 150 "glcpp/glcpp-lex.l" +#line 148 "glcpp/glcpp-lex.l" { /* Since this rule always matches, YY_USER_ACTION gets called for it, * wrongly incrementing yycolumn. We undo that effect here. */ @@ -1231,7 +1215,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 162 "glcpp/glcpp-lex.l" +#line 160 "glcpp/glcpp-lex.l" { char *p; for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ @@ -1241,7 +1225,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 169 "glcpp/glcpp-lex.l" +#line 167 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_FUNC; @@ -1249,7 +1233,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 174 "glcpp/glcpp-lex.l" +#line 172 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_DEFINE_OBJ; @@ -1257,7 +1241,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 179 "glcpp/glcpp-lex.l" +#line 177 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH_UNDEF; @@ -1265,7 +1249,7 @@ YY_RULE_SETUP YY_BREAK case 21: YY_RULE_SETUP -#line 184 "glcpp/glcpp-lex.l" +#line 182 "glcpp/glcpp-lex.l" { yyextra->space_tokens = 0; return HASH; @@ -1273,7 +1257,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 189 "glcpp/glcpp-lex.l" +#line 187 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1281,7 +1265,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 194 "glcpp/glcpp-lex.l" +#line 192 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1289,7 +1273,7 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 199 "glcpp/glcpp-lex.l" +#line 197 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return INTEGER_STRING; @@ -1297,77 +1281,77 @@ YY_RULE_SETUP YY_BREAK case 25: YY_RULE_SETUP -#line 204 "glcpp/glcpp-lex.l" +#line 202 "glcpp/glcpp-lex.l" { return LEFT_SHIFT; } YY_BREAK case 26: YY_RULE_SETUP -#line 208 "glcpp/glcpp-lex.l" +#line 206 "glcpp/glcpp-lex.l" { return RIGHT_SHIFT; } YY_BREAK case 27: YY_RULE_SETUP -#line 212 "glcpp/glcpp-lex.l" +#line 210 "glcpp/glcpp-lex.l" { return LESS_OR_EQUAL; } YY_BREAK case 28: YY_RULE_SETUP -#line 216 "glcpp/glcpp-lex.l" +#line 214 "glcpp/glcpp-lex.l" { return GREATER_OR_EQUAL; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "glcpp/glcpp-lex.l" +#line 218 "glcpp/glcpp-lex.l" { return EQUAL; } YY_BREAK case 30: YY_RULE_SETUP -#line 224 "glcpp/glcpp-lex.l" +#line 222 "glcpp/glcpp-lex.l" { return NOT_EQUAL; } YY_BREAK case 31: YY_RULE_SETUP -#line 228 "glcpp/glcpp-lex.l" +#line 226 "glcpp/glcpp-lex.l" { return AND; } YY_BREAK case 32: YY_RULE_SETUP -#line 232 "glcpp/glcpp-lex.l" +#line 230 "glcpp/glcpp-lex.l" { return OR; } YY_BREAK case 33: YY_RULE_SETUP -#line 236 "glcpp/glcpp-lex.l" +#line 234 "glcpp/glcpp-lex.l" { return PASTE; } YY_BREAK case 34: YY_RULE_SETUP -#line 240 "glcpp/glcpp-lex.l" +#line 238 "glcpp/glcpp-lex.l" { return DEFINED; } YY_BREAK case 35: YY_RULE_SETUP -#line 244 "glcpp/glcpp-lex.l" +#line 242 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return IDENTIFIER; @@ -1375,14 +1359,14 @@ YY_RULE_SETUP YY_BREAK case 36: YY_RULE_SETUP -#line 249 "glcpp/glcpp-lex.l" +#line 247 "glcpp/glcpp-lex.l" { return yytext[0]; } YY_BREAK case 37: YY_RULE_SETUP -#line 253 "glcpp/glcpp-lex.l" +#line 251 "glcpp/glcpp-lex.l" { yylval->str = talloc_strdup (yyextra, yytext); return OTHER; @@ -1390,7 +1374,7 @@ YY_RULE_SETUP YY_BREAK case 38: YY_RULE_SETUP -#line 258 "glcpp/glcpp-lex.l" +#line 256 "glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { return SPACE; @@ -1400,7 +1384,7 @@ YY_RULE_SETUP case 39: /* rule 39 can match eol */ YY_RULE_SETUP -#line 264 "glcpp/glcpp-lex.l" +#line 262 "glcpp/glcpp-lex.l" { yyextra->lexing_if = 0; yylineno++; @@ -1410,7 +1394,7 @@ YY_RULE_SETUP YY_BREAK /* Handle missing newline at EOF. */ case YY_STATE_EOF(INITIAL): -#line 272 "glcpp/glcpp-lex.l" +#line 270 "glcpp/glcpp-lex.l" { BEGIN DONE; /* Don't keep matching this rule forever. */ yyextra->lexing_if = 0; @@ -1423,7 +1407,7 @@ case YY_STATE_EOF(INITIAL): warnings. */ case 40: YY_RULE_SETUP -#line 282 "glcpp/glcpp-lex.l" +#line 280 "glcpp/glcpp-lex.l" { unput('.'); yy_top_state(yyextra); @@ -1431,10 +1415,10 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 287 "glcpp/glcpp-lex.l" +#line 285 "glcpp/glcpp-lex.l" ECHO; YY_BREAK -#line 1438 "glcpp/glcpp-lex.c" +#line 1422 "glcpp/glcpp-lex.c" case YY_STATE_EOF(DONE): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(UNREACHABLE): @@ -2173,8 +2157,8 @@ YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -2628,7 +2612,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 287 "glcpp/glcpp-lex.l" +#line 285 "glcpp/glcpp-lex.l" diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c index bd0fbc4fcf..a19a02a867 100644 --- a/src/glsl/glcpp/glcpp-parse.c +++ b/src/glsl/glcpp/glcpp-parse.c @@ -2016,7 +2016,7 @@ yyreduce: talloc_free (macro); } add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival)); - glcpp_printf(parser->output, "#version %" PRIiMAX "\n", (yyvsp[(2) - (3)].ival)); + glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); ;} break; -- cgit v1.2.3 From d0a9cbd20ee0a1b5c350fed1c470946e4500f793 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Aug 2010 13:59:01 -0700 Subject: glsl2: Silence unused variable warning --- src/glsl/ir_structure_splitting.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/ir_structure_splitting.cpp b/src/glsl/ir_structure_splitting.cpp index c0244071ee..91f6dac23e 100644 --- a/src/glsl/ir_structure_splitting.cpp +++ b/src/glsl/ir_structure_splitting.cpp @@ -138,6 +138,7 @@ ir_structure_reference_visitor::visit(ir_dereference_variable *ir) ir_visitor_status ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir) { + (void) ir; /* Don't descend into the ir_dereference_variable below. */ return visit_continue_with_parent; } -- cgit v1.2.3 From 45d97dd6d5467d96acee1ba33052836b45668564 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Aug 2010 13:59:34 -0700 Subject: linker: Include compiler.h to avoid spurious warnings about INLINE --- src/glsl/linker.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl') diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 9931251f40..22cdd76015 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -72,6 +72,7 @@ extern "C" { #include } +#include "main/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "main/shaderobj.h" -- cgit v1.2.3 From 2f9ecc818d67b8ea7496fd1dd0cb8bc7b9f8f8a4 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 16 Aug 2010 15:14:04 -0700 Subject: glsl2: Add builtins profile for GLSL 1.30. Many functions are currently wrapped with #if 0 since we haven't implemented them yet. --- src/glsl/builtins/profiles/130.frag | 999 ++++++++++++++++++++++++++++++++++++ src/glsl/builtins/profiles/130.vert | 987 +++++++++++++++++++++++++++++++++++ 2 files changed, 1986 insertions(+) create mode 100644 src/glsl/builtins/profiles/130.frag create mode 100644 src/glsl/builtins/profiles/130.vert (limited to 'src/glsl') diff --git a/src/glsl/builtins/profiles/130.frag b/src/glsl/builtins/profiles/130.frag new file mode 100644 index 0000000000..39c73c4eef --- /dev/null +++ b/src/glsl/builtins/profiles/130.frag @@ -0,0 +1,999 @@ +#version 130 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); +int abs(int x); +ivec2 abs(ivec2 x); +ivec3 abs(ivec3 x); +ivec4 abs(ivec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); +int sign(int x); +ivec2 sign(ivec2 x); +ivec3 sign(ivec3 x); +ivec4 sign(ivec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +int min(int x, int y); +ivec2 min(ivec2 x, ivec2 y); +ivec3 min(ivec3 x, ivec3 y); +ivec4 min(ivec4 x, ivec4 y); + +ivec2 min(ivec2 x, int y); +ivec3 min(ivec3 x, int y); +ivec4 min(ivec4 x, int y); + +uint min(uint x, uint y); +uvec2 min(uvec2 x, uvec2 y); +uvec3 min(uvec3 x, uvec3 y); +uvec4 min(uvec4 x, uvec4 y); + +uvec2 min(uvec2 x, uint y); +uvec3 min(uvec3 x, uint y); +uvec4 min(uvec4 x, uint y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +int max(int x, int y); +ivec2 max(ivec2 x, ivec2 y); +ivec3 max(ivec3 x, ivec3 y); +ivec4 max(ivec4 x, ivec4 y); + +ivec2 max(ivec2 x, int y); +ivec3 max(ivec3 x, int y); +ivec4 max(ivec4 x, int y); + +uint max(uint x, uint y); +uvec2 max(uvec2 x, uvec2 y); +uvec3 max(uvec3 x, uvec3 y); +uvec4 max(uvec4 x, uvec4 y); + +uvec2 max(uvec2 x, uint y); +uvec3 max(uvec3 x, uint y); +uvec4 max(uvec4 x, uint y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +int clamp(int x, int minVal, int maxVal); +ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal); +ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal); +ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal); + +ivec2 clamp(ivec2 x, int minVal, int maxVal); +ivec3 clamp(ivec3 x, int minVal, int maxVal); +ivec4 clamp(ivec4 x, int minVal, int maxVal); + +uint clamp(uint x, uint minVal, uint maxVal); +uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal); +uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal); +uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal); + +uvec2 clamp(uvec2 x, uint minVal, uint maxVal); +uvec3 clamp(uvec3 x, uint minVal, uint maxVal); +uvec4 clamp(uvec4 x, uint minVal, uint maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +#if 0 +bool isnan(float x); +bvec2 isnan(vec2 x); +bvec3 isnan(vec3 x); +bvec4 isnan(vec4 x); + +bool isinf(float x); +bvec2 isinf(vec2 x); +bvec3 isinf(vec3 x); +bvec4 isinf(vec4 x); +#endif + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); +mat2x3 matrixCompMult(mat2x3 x, mat2x3 y); +mat2x4 matrixCompMult(mat2x4 x, mat2x4 y); +mat3x2 matrixCompMult(mat3x2 x, mat3x2 y); +mat3x4 matrixCompMult(mat3x4 x, mat3x4 y); +mat4x2 matrixCompMult(mat4x2 x, mat4x2 y); +mat4x3 matrixCompMult(mat4x3 x, mat4x3 y); + +mat2 outerProduct(vec2 c, vec2 r); +mat3 outerProduct(vec3 c, vec3 r); +mat4 outerProduct(vec4 c, vec4 r); + +mat2x3 outerProduct(vec3 c, vec2 r); +mat3x2 outerProduct(vec2 c, vec3 r); + +mat2x4 outerProduct(vec4 c, vec2 r); +mat4x2 outerProduct(vec2 c, vec4 r); + +mat3x4 outerProduct(vec4 c, vec3 r); +mat4x3 outerProduct(vec3 c, vec4 r); + +mat2 transpose(mat2 m); +mat3 transpose(mat3 m); +mat4 transpose(mat4 m); + +mat2x3 transpose(mat3x2 m); +mat3x2 transpose(mat2x3 m); + +mat2x4 transpose(mat4x2 m); +mat4x2 transpose(mat2x4 m); + +mat3x4 transpose(mat4x3 m); +mat4x3 transpose(mat3x4 m); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); +bvec2 lessThan(uvec2 x, uvec2 y); +bvec3 lessThan(uvec3 x, uvec3 y); +bvec4 lessThan(uvec4 x, uvec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); +bvec2 lessThanEqual(uvec2 x, uvec2 y); +bvec3 lessThanEqual(uvec3 x, uvec3 y); +bvec4 lessThanEqual(uvec4 x, uvec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); +bvec2 greaterThan(uvec2 x, uvec2 y); +bvec3 greaterThan(uvec3 x, uvec3 y); +bvec4 greaterThan(uvec4 x, uvec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); +bvec2 greaterThanEqual(uvec2 x, uvec2 y); +bvec3 greaterThanEqual(uvec3 x, uvec3 y); +bvec4 greaterThanEqual(uvec4 x, uvec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(uvec2 x, uvec2 y); +bvec3 equal(uvec3 x, uvec3 y); +bvec4 equal(uvec4 x, uvec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(uvec2 x, uvec2 y); +bvec3 notEqual(uvec3 x, uvec3 y); +bvec4 notEqual(uvec4 x, uvec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ + +#if 0 +/* textureSize */ +int textureSize( sampler1D sampler, int lod); +int textureSize(isampler1D sampler, int lod); +int textureSize(usampler1D sampler, int lod); + +ivec2 textureSize( sampler2D sampler, int lod); +ivec2 textureSize(isampler2D sampler, int lod); +ivec2 textureSize(usampler2D sampler, int lod); + +ivec3 textureSize( sampler3D sampler, int lod); +ivec3 textureSize(isampler3D sampler, int lod); +ivec3 textureSize(usampler3D sampler, int lod); + +ivec2 textureSize( samplerCube sampler, int lod); +ivec2 textureSize(isamplerCube sampler, int lod); +ivec2 textureSize(usamplerCube sampler, int lod); + +int textureSize(sampler1DShadow sampler, int lod); +ivec2 textureSize(sampler2DShadow sampler, int lod); +ivec2 textureSize(samplerCubeShadow sampler, int lod); + +ivec2 textureSize( sampler1DArray sampler, int lod); +ivec2 textureSize(isampler1DArray sampler, int lod); +ivec2 textureSize(usampler1DArray sampler, int lod); +ivec3 textureSize( sampler2DArray sampler, int lod); +ivec2 textureSize(isampler2DArray sampler, int lod); +ivec2 textureSize(usampler2DArray sampler, int lod); + +ivec2 textureSize(sampler1DArrayShadow sampler, int lod); +ivec3 textureSize(sampler2DArrayShadow sampler, int lod); +#endif + +/* texture - no bias */ + vec4 texture( sampler1D sampler, float P); +ivec4 texture(isampler1D sampler, float P); +uvec4 texture(usampler1D sampler, float P); + + vec4 texture( sampler2D sampler, vec2 P); +ivec4 texture(isampler2D sampler, vec2 P); +uvec4 texture(usampler2D sampler, vec2 P); + + vec4 texture( sampler3D sampler, vec3 P); +ivec4 texture(isampler3D sampler, vec3 P); +uvec4 texture(usampler3D sampler, vec3 P); + + vec4 texture( samplerCube sampler, vec3 P); +ivec4 texture(isamplerCube sampler, vec3 P); +uvec4 texture(usamplerCube sampler, vec3 P); + +float texture(sampler1DShadow sampler, vec3 P); +float texture(sampler2DShadow sampler, vec3 P); +float texture(samplerCubeShadow sampler, vec4 P); + + vec4 texture( sampler1DArray sampler, vec2 P); +ivec4 texture(isampler1DArray sampler, vec2 P); +uvec4 texture(usampler1DArray sampler, vec2 P); + + vec4 texture( sampler2DArray sampler, vec3 P); +ivec4 texture(isampler2DArray sampler, vec3 P); +uvec4 texture(usampler2DArray sampler, vec3 P); + +float texture(sampler1DArrayShadow sampler, vec3 P); +float texture(sampler2DArrayShadow sampler, vec4 P); + +/* texture - bias variants */ + vec4 texture( sampler1D sampler, float P, float bias); +ivec4 texture(isampler1D sampler, float P, float bias); +uvec4 texture(usampler1D sampler, float P, float bias); + + vec4 texture( sampler2D sampler, vec2 P, float bias); +ivec4 texture(isampler2D sampler, vec2 P, float bias); +uvec4 texture(usampler2D sampler, vec2 P, float bias); + + vec4 texture( sampler3D sampler, vec3 P, float bias); +ivec4 texture(isampler3D sampler, vec3 P, float bias); +uvec4 texture(usampler3D sampler, vec3 P, float bias); + + vec4 texture( samplerCube sampler, vec3 P, float bias); +ivec4 texture(isamplerCube sampler, vec3 P, float bias); +uvec4 texture(usamplerCube sampler, vec3 P, float bias); + +float texture(sampler1DShadow sampler, vec3 P, float bias); +float texture(sampler2DShadow sampler, vec3 P, float bias); +float texture(samplerCubeShadow sampler, vec4 P, float bias); + + vec4 texture( sampler1DArray sampler, vec2 P, float bias); +ivec4 texture(isampler1DArray sampler, vec2 P, float bias); +uvec4 texture(usampler1DArray sampler, vec2 P, float bias); + + vec4 texture( sampler2DArray sampler, vec3 P, float bias); +ivec4 texture(isampler2DArray sampler, vec3 P, float bias); +uvec4 texture(usampler2DArray sampler, vec3 P, float bias); + +float texture(sampler1DArrayShadow sampler, vec3 P, float bias); + +/* textureProj - no bias */ + vec4 textureProj( sampler1D sampler, vec2 P); +ivec4 textureProj(isampler1D sampler, vec2 P); +uvec4 textureProj(usampler1D sampler, vec2 P); + vec4 textureProj( sampler1D sampler, vec4 P); +ivec4 textureProj(isampler1D sampler, vec4 P); +uvec4 textureProj(usampler1D sampler, vec4 P); + + vec4 textureProj( sampler2D sampler, vec3 P); +ivec4 textureProj(isampler2D sampler, vec3 P); +uvec4 textureProj(usampler2D sampler, vec3 P); + vec4 textureProj( sampler2D sampler, vec4 P); +ivec4 textureProj(isampler2D sampler, vec4 P); +uvec4 textureProj(usampler2D sampler, vec4 P); + + vec4 textureProj( sampler3D sampler, vec4 P); +ivec4 textureProj(isampler3D sampler, vec4 P); +uvec4 textureProj(usampler3D sampler, vec4 P); + +float textureProj(sampler1DShadow sampler, vec4 P); +float textureProj(sampler2DShadow sampler, vec4 P); + +/* textureProj - bias variants */ + vec4 textureProj( sampler1D sampler, vec2 P, float bias); +ivec4 textureProj(isampler1D sampler, vec2 P, float bias); +uvec4 textureProj(usampler1D sampler, vec2 P, float bias); + vec4 textureProj( sampler1D sampler, vec4 P, float bias); +ivec4 textureProj(isampler1D sampler, vec4 P, float bias); +uvec4 textureProj(usampler1D sampler, vec4 P, float bias); + + vec4 textureProj( sampler2D sampler, vec3 P, float bias); +ivec4 textureProj(isampler2D sampler, vec3 P, float bias); +uvec4 textureProj(usampler2D sampler, vec3 P, float bias); + vec4 textureProj( sampler2D sampler, vec4 P, float bias); +ivec4 textureProj(isampler2D sampler, vec4 P, float bias); +uvec4 textureProj(usampler2D sampler, vec4 P, float bias); + + vec4 textureProj( sampler3D sampler, vec4 P, float bias); +ivec4 textureProj(isampler3D sampler, vec4 P, float bias); +uvec4 textureProj(usampler3D sampler, vec4 P, float bias); + +float textureProj(sampler1DShadow sampler, vec4 P, float bias); +float textureProj(sampler2DShadow sampler, vec4 P, float bias); + +/* textureLod */ + vec4 textureLod( sampler1D sampler, float P, float lod); +ivec4 textureLod(isampler1D sampler, float P, float lod); +uvec4 textureLod(usampler1D sampler, float P, float lod); + + vec4 textureLod( sampler2D sampler, vec2 P, float lod); +ivec4 textureLod(isampler2D sampler, vec2 P, float lod); +uvec4 textureLod(usampler2D sampler, vec2 P, float lod); + + vec4 textureLod( sampler3D sampler, vec3 P, float lod); +ivec4 textureLod(isampler3D sampler, vec3 P, float lod); +uvec4 textureLod(usampler3D sampler, vec3 P, float lod); + + vec4 textureLod( samplerCube sampler, vec3 P, float lod); +ivec4 textureLod(isamplerCube sampler, vec3 P, float lod); +uvec4 textureLod(usamplerCube sampler, vec3 P, float lod); + +float textureLod(sampler1DShadow sampler, vec3 P, float lod); +float textureLod(sampler2DShadow sampler, vec3 P, float lod); + + vec4 textureLod( sampler1DArray sampler, vec2 P, float lod); +ivec4 textureLod(isampler1DArray sampler, vec2 P, float lod); +uvec4 textureLod(usampler1DArray sampler, vec2 P, float lod); + + vec4 textureLod( sampler2DArray sampler, vec3 P, float lod); +ivec4 textureLod(isampler2DArray sampler, vec3 P, float lod); +uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod); + +float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod); + +#if 0 +/* textureOffset - no bias */ + vec4 textureOffset( sampler1D sampler, float P, int offset); +ivec4 textureOffset(isampler1D sampler, float P, int offset); +uvec4 textureOffset(usampler1D sampler, float P, int offset); + + vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset); +ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset); +uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset); + + vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset); +ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset); +uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset); + +float textureOffset(sampler1DShadow sampler, vec3 P, int offset); +float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset); + + vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset); +ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset); +uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset); + + vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset); +ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset); +uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset); + +float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset); + +/* textureOffset - bias variants */ + vec4 textureOffset( sampler1D sampler, float P, int offset, float bias); +ivec4 textureOffset(isampler1D sampler, float P, int offset, float bias); +uvec4 textureOffset(usampler1D sampler, float P, int offset, float bias); + + vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset, float bias); +ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset, float bias); +uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset, float bias); + + vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset, float bias); +ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias); +uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias); + +float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias); +float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias); + + vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset, float bias); +ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset, float bias); +uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset, float bias); + + vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset, float bias); +ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias); +uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias); + +float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias); +#endif + +/* texelFetch */ + vec4 texelFetch( sampler1D sampler, int P, int lod); +ivec4 texelFetch(isampler1D sampler, int P, int lod); +uvec4 texelFetch(usampler1D sampler, int P, int lod); + + vec4 texelFetch( sampler2D sampler, ivec2 P, int lod); +ivec4 texelFetch(isampler2D sampler, ivec2 P, int lod); +uvec4 texelFetch(usampler2D sampler, ivec2 P, int lod); + + vec4 texelFetch( sampler3D sampler, ivec3 P, int lod); +ivec4 texelFetch(isampler3D sampler, ivec3 P, int lod); +uvec4 texelFetch(usampler3D sampler, ivec3 P, int lod); + + vec4 texelFetch( sampler1DArray sampler, ivec2 P, int lod); +ivec4 texelFetch(isampler1DArray sampler, ivec2 P, int lod); +uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); + + vec4 texelFetch( sampler2DArray sampler, ivec3 P, int lod); +ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); +uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + +#if 0 +/* texelFetchOffset */ + vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); +ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); +uvec4 texelFetchOffset(usampler1D sampler, int P, int lod, int offset); + + vec4 texelFetchOffset( sampler2D sampler, ivec2 P, int lod, ivec2 offset); +ivec4 texelFetchOffset(isampler2D sampler, ivec2 P, int lod, ivec2 offset); +uvec4 texelFetchOffset(usampler2D sampler, ivec2 P, int lod, ivec2 offset); + + vec4 texelFetchOffset( sampler3D sampler, ivec3 P, int lod, ivec3 offset); +ivec4 texelFetchOffset(isampler3D sampler, ivec3 P, int lod, ivec3 offset); +uvec4 texelFetchOffset(usampler3D sampler, ivec3 P, int lod, ivec3 offset); + + vec4 texelFetchOffset( sampler1DArray sampler, ivec2 P, int lod, int offset); +ivec4 texelFetchOffset(isampler1DArray sampler, ivec2 P, int lod, int offset); +uvec4 texelFetchOffset(usampler1DArray sampler, ivec2 P, int lod, int offset); + + vec4 texelFetchOffset( sampler2DArray sampler, ivec3 P, int lod, ivec2 offset); +ivec4 texelFetchOffset(isampler2DArray sampler, ivec3 P, int lod, ivec2 offset); +uvec4 texelFetchOffset(usampler2DArray sampler, ivec3 P, int lod, ivec2 offset); + +/* textureProjOffset - no bias */ + vec4 textureProj( sampler1D sampler, vec2 P, int offset); +ivec4 textureProj(isampler1D sampler, vec2 P, int offset); +uvec4 textureProj(usampler1D sampler, vec2 P, int offset); + vec4 textureProj( sampler1D sampler, vec4 P, int offset); +ivec4 textureProj(isampler1D sampler, vec4 P, int offset); +uvec4 textureProj(usampler1D sampler, vec4 P, int offset); + + vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset); +ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset); +uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset); + vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset); +ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset); +uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset); + + vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset); +ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset); +uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset); + +float textureProj(sampler1DShadow sampler, vec4 P, int offset); +float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset); + +/* textureProjOffset - bias variants */ + vec4 textureProj( sampler1D sampler, vec2 P, int offset, float bias); +ivec4 textureProj(isampler1D sampler, vec2 P, int offset, float bias); +uvec4 textureProj(usampler1D sampler, vec2 P, int offset, float bias); + vec4 textureProj( sampler1D sampler, vec4 P, int offset, float bias); +ivec4 textureProj(isampler1D sampler, vec4 P, int offset, float bias); +uvec4 textureProj(usampler1D sampler, vec4 P, int offset, float bias); + + vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset, float bias); +ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset, float bias); +uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset, float bias); + vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset, float bias); +ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset, float bias); +uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset, float bias); + + vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset, float bias); +ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset, float bias); +uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset, float bias); + +float textureProj(sampler1DShadow sampler, vec4 P, int offset, float bias); +float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias); + +/* textureLodOffset */ + vec4 textureLodOffset( sampler1D sampler, float P, float lod, int offset); +ivec4 textureLodOffset(isampler1D sampler, float P, float lod, int offset); +uvec4 textureLodOffset(usampler1D sampler, float P, float lod, int offset); + + vec4 textureLodOffset( sampler2D sampler, vec2 P, float lod, ivec2 offset); +ivec4 textureLodOffset(isampler2D sampler, vec2 P, float lod, ivec2 offset); +uvec4 textureLodOffset(usampler2D sampler, vec2 P, float lod, ivec2 offset); + + vec4 textureLodOffset( sampler3D sampler, vec3 P, float lod, ivec3 offset); +ivec4 textureLodOffset(isampler3D sampler, vec3 P, float lod, ivec3 offset); +uvec4 textureLodOffset(usampler3D sampler, vec3 P, float lod, ivec3 offset); + +float textureLodOffset(sampler1DShadow samp, vec3 P, float lod, int offset); +float textureLodOffset(sampler2DShadow samp, vec3 P, float lod, ivec2 offset); + + vec4 textureLodOffset( sampler1DArray sampler, vec2 P, float lod, int offset); +ivec4 textureLodOffset(isampler1DArray sampler, vec2 P, float lod, int offset); +uvec4 textureLodOffset(usampler1DArray sampler, vec2 P, float lod, int offset); + + vec4 textureLodOffset( sampler2DArray samp, vec3 P, float lod, ivec2 offset); +ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset); +uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset); + +float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset); +#endif + +/* textureProjLod */ + vec4 textureProjLod( sampler1D sampler, vec2 P, float lod); +ivec4 textureProjLod(isampler1D sampler, vec2 P, float lod); +uvec4 textureProjLod(usampler1D sampler, vec2 P, float lod); + vec4 textureProjLod( sampler1D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler1D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler1D sampler, vec4 P, float lod); + + vec4 textureProjLod( sampler2D sampler, vec3 P, float lod); +ivec4 textureProjLod(isampler2D sampler, vec3 P, float lod); +uvec4 textureProjLod(usampler2D sampler, vec3 P, float lod); + vec4 textureProjLod( sampler2D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler2D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler2D sampler, vec4 P, float lod); + + vec4 textureProjLod( sampler3D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler3D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod); + +float textureProjLod(sampler1DShadow sampler, vec4 P, float lod); +float textureProjLod(sampler2DShadow sampler, vec4 P, float lod); + +#if 0 +/* textureProjLodOffset */ + vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset); +ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset); +uvec4 textureProjLodOffset(usampler1D sampler, vec2 P, float lod, int offset); + vec4 textureProjLodOffset( sampler1D sampler, vec4 P, float lod, int offset); +ivec4 textureProjLodOffset(isampler1D sampler, vec4 P, float lod, int offset); +uvec4 textureProjLodOffset(usampler1D sampler, vec4 P, float lod, int offset); + + vec4 textureProjLodOffset( sampler2D sampler, vec3 P, float lod, ivec2 offset); +ivec4 textureProjLodOffset(isampler2D sampler, vec3 P, float lod, ivec2 offset); +uvec4 textureProjLodOffset(usampler2D sampler, vec3 P, float lod, ivec2 offset); + vec4 textureProjLodOffset( sampler2D sampler, vec4 P, float lod, ivec2 offset); +ivec4 textureProjLodOffset(isampler2D sampler, vec4 P, float lod, ivec2 offset); +uvec4 textureProjLodOffset(usampler2D sampler, vec4 P, float lod, ivec2 offset); + + vec4 textureProjLodOffset( sampler3D sampler, vec4 P, float lod, ivec3 offset); +ivec4 textureProjLodOffset(isampler3D sampler, vec4 P, float lod, ivec3 offset); +uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset); + +float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset); +float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset); +#endif + +/* textureGrad */ + vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy); +ivec4 textureGrad(isampler1D sampler, float P, float dPdx, float dPdy); +uvec4 textureGrad(usampler1D sampler, float P, float dPdx, float dPdy); + + vec4 textureGrad( sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); +ivec4 textureGrad(isampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); +uvec4 textureGrad(usampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); + + vec4 textureGrad( sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); +ivec4 textureGrad(isampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); +uvec4 textureGrad(usampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); + + vec4 textureGrad( samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); +ivec4 textureGrad(isamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); +uvec4 textureGrad(usamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); + +float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy); +float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy); +float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy); + + vec4 textureGrad( sampler1DArray sampler, vec2 P, float dPdx, float dPdy); +ivec4 textureGrad(isampler1DArray sampler, vec2 P, float dPdx, float dPdy); +uvec4 textureGrad(usampler1DArray sampler, vec2 P, float dPdx, float dPdy); + + vec4 textureGrad( sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); +ivec4 textureGrad(isampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); +uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); + +float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy); +float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); + +#if 0 +/* textureGradOffset */ + vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off); +ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset); +uvec4 textureGradOffset(usampler1D s, float P, float dx, float dy, int offset); + + vec4 textureGradOffset( sampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); +ivec4 textureGradOffset(isampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); +uvec4 textureGradOffset(usampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); + + vec4 textureGradOffset( sampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +ivec4 textureGradOffset(isampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +uvec4 textureGradOffset(usampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); + + vec4 textureGradOffset( samplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +ivec4 textureGradOffset(isamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +uvec4 textureGradOffset(usamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); + +float textureGradOffset(sampler1DShadow s, vec3 P, float dx, float dy, int off); +float textureGradOffset(sampler2DShadow s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + + vec4 textureGradOffset( sampler1DArray s, vec2 P, float dx, float dy, int off); +ivec4 textureGradOffset(isampler1DArray s, vec2 P, float dx, float dy, int off); +uvec4 textureGradOffset(usampler1DArray s, vec2 P, float dx, float dy, int off); + + vec4 textureGradOffset( sampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureGradOffset(isampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + +float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o); +float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o); +#endif + +/* textureProjGrad */ + vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy); +ivec4 textureProjGrad(isampler1D sampler, vec2 P, float dPdx, float dPdy); +uvec4 textureProjGrad(usampler1D sampler, vec2 P, float dPdx, float dPdy); + vec4 textureProjGrad( sampler1D sampler, vec4 P, float dPdx, float dPdy); +ivec4 textureProjGrad(isampler1D sampler, vec4 P, float dPdx, float dPdy); +uvec4 textureProjGrad(usampler1D sampler, vec4 P, float dPdx, float dPdy); + + vec4 textureProjGrad( sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); +ivec4 textureProjGrad(isampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); +uvec4 textureProjGrad(usampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); + vec4 textureProjGrad( sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); +ivec4 textureProjGrad(isampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); +uvec4 textureProjGrad(usampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); + + vec4 textureProjGrad( sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); +ivec4 textureProjGrad(isampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); +uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); + +float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy); +float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); + +#if 0 +/* textureProjGradOffset */ + vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off); +ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off); +uvec4 textureProjGradOffset(usampler1D s, vec2 P, float dx, float dy, int off); + vec4 textureProjGradOffset( sampler1D s, vec4 P, float dx, float dy, int off); +ivec4 textureProjGradOffset(isampler1D s, vec4 P, float dx, float dy, int off); +uvec4 textureProjGradOffset(usampler1D s, vec4 P, float dx, float dy, int off); + + vec4 textureProjGradOffset( sampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureProjGradOffset(isampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureProjGradOffset(usampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + vec4 textureProjGradOffset( sampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureProjGradOffset(isampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureProjGradOffset(usampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); + + vec4 textureProjGradOffset( sampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); +ivec4 textureProjGradOffset(isampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); +uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); + +float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o); +float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o); +#endif + +/* + * The following texture functions are deprecated: + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1D (sampler1D sampler, float coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias); +vec4 texture1DLod (sampler1D sampler, float coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2D (sampler2D sampler, vec2 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias); +vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3D (sampler3D sampler, vec3 coord, float bias); +vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias); +vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod); +vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCube (samplerCube sampler, vec3 coord, float bias); +vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias); +vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod); +vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod); +vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod); +vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod); + +/* + * 8.8 - Fragment Processing Functions + */ +float dFdx(float p); +vec2 dFdx(vec2 p); +vec3 dFdx(vec3 p); +vec4 dFdx(vec4 p); + +float dFdy(float p); +vec2 dFdy(vec2 p); +vec3 dFdy(vec3 p); +vec4 dFdy(vec4 p); + +float fwidth(float p); +vec2 fwidth(vec2 p); +vec3 fwidth(vec3 p); +vec4 fwidth(vec4 p); + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); diff --git a/src/glsl/builtins/profiles/130.vert b/src/glsl/builtins/profiles/130.vert new file mode 100644 index 0000000000..1aaad190d5 --- /dev/null +++ b/src/glsl/builtins/profiles/130.vert @@ -0,0 +1,987 @@ +#version 130 +/* + * 8.1 - Angle and Trigonometry Functions + */ +float radians(float degrees); +vec2 radians(vec2 degrees); +vec3 radians(vec3 degrees); +vec4 radians(vec4 degrees); + +float degrees(float radians); +vec2 degrees(vec2 radians); +vec3 degrees(vec3 radians); +vec4 degrees(vec4 radians); + +float sin(float angle); +vec2 sin(vec2 angle); +vec3 sin(vec3 angle); +vec4 sin(vec4 angle); + +float cos(float angle); +vec2 cos(vec2 angle); +vec3 cos(vec3 angle); +vec4 cos(vec4 angle); + +float tan(float angle); +vec2 tan(vec2 angle); +vec3 tan(vec3 angle); +vec4 tan(vec4 angle); + +float asin(float angle); +vec2 asin(vec2 angle); +vec3 asin(vec3 angle); +vec4 asin(vec4 angle); + +float acos(float angle); +vec2 acos(vec2 angle); +vec3 acos(vec3 angle); +vec4 acos(vec4 angle); + +float atan(float y, float x); +vec2 atan(vec2 y, vec2 x); +vec3 atan(vec3 y, vec3 x); +vec4 atan(vec4 y, vec4 x); + +float atan(float y_over_x); +vec2 atan(vec2 y_over_x); +vec3 atan(vec3 y_over_x); +vec4 atan(vec4 y_over_x); + +/* + * 8.2 - Exponential Functions + */ +float pow(float x, float y); +vec2 pow(vec2 x, vec2 y); +vec3 pow(vec3 x, vec3 y); +vec4 pow(vec4 x, vec4 y); + +float exp(float x); +vec2 exp(vec2 x); +vec3 exp(vec3 x); +vec4 exp(vec4 x); + +float log(float x); +vec2 log(vec2 x); +vec3 log(vec3 x); +vec4 log(vec4 x); + +float exp2(float x); +vec2 exp2(vec2 x); +vec3 exp2(vec3 x); +vec4 exp2(vec4 x); + +float log2(float x); +vec2 log2(vec2 x); +vec3 log2(vec3 x); +vec4 log2(vec4 x); + +float sqrt(float x); +vec2 sqrt(vec2 x); +vec3 sqrt(vec3 x); +vec4 sqrt(vec4 x); + +float inversesqrt(float x); +vec2 inversesqrt(vec2 x); +vec3 inversesqrt(vec3 x); +vec4 inversesqrt(vec4 x); + +/* + * 8.3 - Common Functions + */ +float abs(float x); +vec2 abs(vec2 x); +vec3 abs(vec3 x); +vec4 abs(vec4 x); +int abs(int x); +ivec2 abs(ivec2 x); +ivec3 abs(ivec3 x); +ivec4 abs(ivec4 x); + +float sign(float x); +vec2 sign(vec2 x); +vec3 sign(vec3 x); +vec4 sign(vec4 x); +int sign(int x); +ivec2 sign(ivec2 x); +ivec3 sign(ivec3 x); +ivec4 sign(ivec4 x); + +float floor(float x); +vec2 floor(vec2 x); +vec3 floor(vec3 x); +vec4 floor(vec4 x); + +float ceil(float x); +vec2 ceil(vec2 x); +vec3 ceil(vec3 x); +vec4 ceil(vec4 x); + +float fract(float x); +vec2 fract(vec2 x); +vec3 fract(vec3 x); +vec4 fract(vec4 x); + +float mod(float x, float y); +vec2 mod(vec2 x, float y); +vec3 mod(vec3 x, float y); +vec4 mod(vec4 x, float y); + +vec2 mod(vec2 x, vec2 y); +vec3 mod(vec3 x, vec3 y); +vec4 mod(vec4 x, vec4 y); + +float min(float x, float y); +vec2 min(vec2 x, vec2 y); +vec3 min(vec3 x, vec3 y); +vec4 min(vec4 x, vec4 y); + +vec2 min(vec2 x, float y); +vec3 min(vec3 x, float y); +vec4 min(vec4 x, float y); + +int min(int x, int y); +ivec2 min(ivec2 x, ivec2 y); +ivec3 min(ivec3 x, ivec3 y); +ivec4 min(ivec4 x, ivec4 y); + +ivec2 min(ivec2 x, int y); +ivec3 min(ivec3 x, int y); +ivec4 min(ivec4 x, int y); + +uint min(uint x, uint y); +uvec2 min(uvec2 x, uvec2 y); +uvec3 min(uvec3 x, uvec3 y); +uvec4 min(uvec4 x, uvec4 y); + +uvec2 min(uvec2 x, uint y); +uvec3 min(uvec3 x, uint y); +uvec4 min(uvec4 x, uint y); + +float max(float x, float y); +vec2 max(vec2 x, vec2 y); +vec3 max(vec3 x, vec3 y); +vec4 max(vec4 x, vec4 y); + +vec2 max(vec2 x, float y); +vec3 max(vec3 x, float y); +vec4 max(vec4 x, float y); + +int max(int x, int y); +ivec2 max(ivec2 x, ivec2 y); +ivec3 max(ivec3 x, ivec3 y); +ivec4 max(ivec4 x, ivec4 y); + +ivec2 max(ivec2 x, int y); +ivec3 max(ivec3 x, int y); +ivec4 max(ivec4 x, int y); + +uint max(uint x, uint y); +uvec2 max(uvec2 x, uvec2 y); +uvec3 max(uvec3 x, uvec3 y); +uvec4 max(uvec4 x, uvec4 y); + +uvec2 max(uvec2 x, uint y); +uvec3 max(uvec3 x, uint y); +uvec4 max(uvec4 x, uint y); + +float clamp(float x, float minVal, float maxVal); +vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal); +vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal); +vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal); + +vec2 clamp(vec2 x, float minVal, float maxVal); +vec3 clamp(vec3 x, float minVal, float maxVal); +vec4 clamp(vec4 x, float minVal, float maxVal); + +int clamp(int x, int minVal, int maxVal); +ivec2 clamp(ivec2 x, ivec2 minVal, ivec2 maxVal); +ivec3 clamp(ivec3 x, ivec3 minVal, ivec3 maxVal); +ivec4 clamp(ivec4 x, ivec4 minVal, ivec4 maxVal); + +ivec2 clamp(ivec2 x, int minVal, int maxVal); +ivec3 clamp(ivec3 x, int minVal, int maxVal); +ivec4 clamp(ivec4 x, int minVal, int maxVal); + +uint clamp(uint x, uint minVal, uint maxVal); +uvec2 clamp(uvec2 x, uvec2 minVal, uvec2 maxVal); +uvec3 clamp(uvec3 x, uvec3 minVal, uvec3 maxVal); +uvec4 clamp(uvec4 x, uvec4 minVal, uvec4 maxVal); + +uvec2 clamp(uvec2 x, uint minVal, uint maxVal); +uvec3 clamp(uvec3 x, uint minVal, uint maxVal); +uvec4 clamp(uvec4 x, uint minVal, uint maxVal); + +float mix(float x, float y, float a); +vec2 mix(vec2 x, vec2 y, vec2 a); +vec3 mix(vec3 x, vec3 y, vec3 a); +vec4 mix(vec4 x, vec4 y, vec4 a); + +vec2 mix(vec2 x, vec2 y, float a); +vec3 mix(vec3 x, vec3 y, float a); +vec4 mix(vec4 x, vec4 y, float a); + +float step(float edge, float x); +vec2 step(vec2 edge, vec2 x); +vec3 step(vec3 edge, vec3 x); +vec4 step(vec4 edge, vec4 x); + +vec2 step(float edge, vec2 x); +vec3 step(float edge, vec3 x); +vec4 step(float edge, vec4 x); + +float smoothstep(float edge0, float edge1, float x); +vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x); +vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x); +vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x); + +vec2 smoothstep(float edge0, float edge1, vec2 x); +vec3 smoothstep(float edge0, float edge1, vec3 x); +vec4 smoothstep(float edge0, float edge1, vec4 x); + +#if 0 +bool isnan(float x); +bvec2 isnan(vec2 x); +bvec3 isnan(vec3 x); +bvec4 isnan(vec4 x); + +bool isinf(float x); +bvec2 isinf(vec2 x); +bvec3 isinf(vec3 x); +bvec4 isinf(vec4 x); +#endif + +/* + * 8.4 - Geometric Functions + */ +float length(float x); +float length(vec2 x); +float length(vec3 x); +float length(vec4 x); + +float distance(float p0, float p1); +float distance(vec2 p0, vec2 p1); +float distance(vec3 p0, vec3 p1); +float distance(vec4 p0, vec4 p1); + +float dot(float x, float y); +float dot(vec2 x, vec2 y); +float dot(vec3 x, vec3 y); +float dot(vec4 x, vec4 y); + +vec3 cross(vec3 x, vec3 y); + +float normalize(float x); +vec2 normalize(vec2 x); +vec3 normalize(vec3 x); +vec4 normalize(vec4 x); + +vec4 ftransform(); + +float faceforward(float N, float I, float Nref); +vec2 faceforward(vec2 N, vec2 I, vec2 Nref); +vec3 faceforward(vec3 N, vec3 I, vec3 Nref); +vec4 faceforward(vec4 N, vec4 I, vec4 Nref); + +float reflect(float I, float N); +vec2 reflect(vec2 I, vec2 N); +vec3 reflect(vec3 I, vec3 N); +vec4 reflect(vec4 I, vec4 N); + +float refract(float I, float N, float eta); +vec2 refract(vec2 I, vec2 N, float eta); +vec3 refract(vec3 I, vec3 N, float eta); +vec4 refract(vec4 I, vec4 N, float eta); + + +/* + * 8.5 - Matrix Functions + */ +mat2 matrixCompMult(mat2 x, mat2 y); +mat3 matrixCompMult(mat3 x, mat3 y); +mat4 matrixCompMult(mat4 x, mat4 y); +mat2x3 matrixCompMult(mat2x3 x, mat2x3 y); +mat2x4 matrixCompMult(mat2x4 x, mat2x4 y); +mat3x2 matrixCompMult(mat3x2 x, mat3x2 y); +mat3x4 matrixCompMult(mat3x4 x, mat3x4 y); +mat4x2 matrixCompMult(mat4x2 x, mat4x2 y); +mat4x3 matrixCompMult(mat4x3 x, mat4x3 y); + +mat2 outerProduct(vec2 c, vec2 r); +mat3 outerProduct(vec3 c, vec3 r); +mat4 outerProduct(vec4 c, vec4 r); + +mat2x3 outerProduct(vec3 c, vec2 r); +mat3x2 outerProduct(vec2 c, vec3 r); + +mat2x4 outerProduct(vec4 c, vec2 r); +mat4x2 outerProduct(vec2 c, vec4 r); + +mat3x4 outerProduct(vec4 c, vec3 r); +mat4x3 outerProduct(vec3 c, vec4 r); + +mat2 transpose(mat2 m); +mat3 transpose(mat3 m); +mat4 transpose(mat4 m); + +mat2x3 transpose(mat3x2 m); +mat3x2 transpose(mat2x3 m); + +mat2x4 transpose(mat4x2 m); +mat4x2 transpose(mat2x4 m); + +mat3x4 transpose(mat4x3 m); +mat4x3 transpose(mat3x4 m); + +/* + * 8.6 - Vector Relational Functions + */ +bvec2 lessThan( vec2 x, vec2 y); +bvec3 lessThan( vec3 x, vec3 y); +bvec4 lessThan( vec4 x, vec4 y); +bvec2 lessThan(ivec2 x, ivec2 y); +bvec3 lessThan(ivec3 x, ivec3 y); +bvec4 lessThan(ivec4 x, ivec4 y); +bvec2 lessThan(uvec2 x, uvec2 y); +bvec3 lessThan(uvec3 x, uvec3 y); +bvec4 lessThan(uvec4 x, uvec4 y); + +bvec2 lessThanEqual( vec2 x, vec2 y); +bvec3 lessThanEqual( vec3 x, vec3 y); +bvec4 lessThanEqual( vec4 x, vec4 y); +bvec2 lessThanEqual(ivec2 x, ivec2 y); +bvec3 lessThanEqual(ivec3 x, ivec3 y); +bvec4 lessThanEqual(ivec4 x, ivec4 y); +bvec2 lessThanEqual(uvec2 x, uvec2 y); +bvec3 lessThanEqual(uvec3 x, uvec3 y); +bvec4 lessThanEqual(uvec4 x, uvec4 y); + +bvec2 greaterThan( vec2 x, vec2 y); +bvec3 greaterThan( vec3 x, vec3 y); +bvec4 greaterThan( vec4 x, vec4 y); +bvec2 greaterThan(ivec2 x, ivec2 y); +bvec3 greaterThan(ivec3 x, ivec3 y); +bvec4 greaterThan(ivec4 x, ivec4 y); +bvec2 greaterThan(uvec2 x, uvec2 y); +bvec3 greaterThan(uvec3 x, uvec3 y); +bvec4 greaterThan(uvec4 x, uvec4 y); + +bvec2 greaterThanEqual( vec2 x, vec2 y); +bvec3 greaterThanEqual( vec3 x, vec3 y); +bvec4 greaterThanEqual( vec4 x, vec4 y); +bvec2 greaterThanEqual(ivec2 x, ivec2 y); +bvec3 greaterThanEqual(ivec3 x, ivec3 y); +bvec4 greaterThanEqual(ivec4 x, ivec4 y); +bvec2 greaterThanEqual(uvec2 x, uvec2 y); +bvec3 greaterThanEqual(uvec3 x, uvec3 y); +bvec4 greaterThanEqual(uvec4 x, uvec4 y); + +bvec2 equal( vec2 x, vec2 y); +bvec3 equal( vec3 x, vec3 y); +bvec4 equal( vec4 x, vec4 y); +bvec2 equal(ivec2 x, ivec2 y); +bvec3 equal(ivec3 x, ivec3 y); +bvec4 equal(ivec4 x, ivec4 y); +bvec2 equal(uvec2 x, uvec2 y); +bvec3 equal(uvec3 x, uvec3 y); +bvec4 equal(uvec4 x, uvec4 y); +bvec2 equal(bvec2 x, bvec2 y); +bvec3 equal(bvec3 x, bvec3 y); +bvec4 equal(bvec4 x, bvec4 y); + +bvec2 notEqual( vec2 x, vec2 y); +bvec3 notEqual( vec3 x, vec3 y); +bvec4 notEqual( vec4 x, vec4 y); +bvec2 notEqual(ivec2 x, ivec2 y); +bvec3 notEqual(ivec3 x, ivec3 y); +bvec4 notEqual(ivec4 x, ivec4 y); +bvec2 notEqual(uvec2 x, uvec2 y); +bvec3 notEqual(uvec3 x, uvec3 y); +bvec4 notEqual(uvec4 x, uvec4 y); +bvec2 notEqual(bvec2 x, bvec2 y); +bvec3 notEqual(bvec3 x, bvec3 y); +bvec4 notEqual(bvec4 x, bvec4 y); + +bool any(bvec2 x); +bool any(bvec3 x); +bool any(bvec4 x); + +bool all(bvec2 x); +bool all(bvec3 x); +bool all(bvec4 x); + +bvec2 not(bvec2 x); +bvec3 not(bvec3 x); +bvec4 not(bvec4 x); + +/* + * 8.7 - Texture Lookup Functions + */ + +#if 0 +/* textureSize */ +int textureSize( sampler1D sampler, int lod); +int textureSize(isampler1D sampler, int lod); +int textureSize(usampler1D sampler, int lod); + +ivec2 textureSize( sampler2D sampler, int lod); +ivec2 textureSize(isampler2D sampler, int lod); +ivec2 textureSize(usampler2D sampler, int lod); + +ivec3 textureSize( sampler3D sampler, int lod); +ivec3 textureSize(isampler3D sampler, int lod); +ivec3 textureSize(usampler3D sampler, int lod); + +ivec2 textureSize( samplerCube sampler, int lod); +ivec2 textureSize(isamplerCube sampler, int lod); +ivec2 textureSize(usamplerCube sampler, int lod); + +int textureSize(sampler1DShadow sampler, int lod); +ivec2 textureSize(sampler2DShadow sampler, int lod); +ivec2 textureSize(samplerCubeShadow sampler, int lod); + +ivec2 textureSize( sampler1DArray sampler, int lod); +ivec2 textureSize(isampler1DArray sampler, int lod); +ivec2 textureSize(usampler1DArray sampler, int lod); +ivec3 textureSize( sampler2DArray sampler, int lod); +ivec2 textureSize(isampler2DArray sampler, int lod); +ivec2 textureSize(usampler2DArray sampler, int lod); + +ivec2 textureSize(sampler1DArrayShadow sampler, int lod); +ivec3 textureSize(sampler2DArrayShadow sampler, int lod); +#endif + +/* texture - no bias */ + vec4 texture( sampler1D sampler, float P); +ivec4 texture(isampler1D sampler, float P); +uvec4 texture(usampler1D sampler, float P); + + vec4 texture( sampler2D sampler, vec2 P); +ivec4 texture(isampler2D sampler, vec2 P); +uvec4 texture(usampler2D sampler, vec2 P); + + vec4 texture( sampler3D sampler, vec3 P); +ivec4 texture(isampler3D sampler, vec3 P); +uvec4 texture(usampler3D sampler, vec3 P); + + vec4 texture( samplerCube sampler, vec3 P); +ivec4 texture(isamplerCube sampler, vec3 P); +uvec4 texture(usamplerCube sampler, vec3 P); + +float texture(sampler1DShadow sampler, vec3 P); +float texture(sampler2DShadow sampler, vec3 P); +float texture(samplerCubeShadow sampler, vec4 P); + + vec4 texture( sampler1DArray sampler, vec2 P); +ivec4 texture(isampler1DArray sampler, vec2 P); +uvec4 texture(usampler1DArray sampler, vec2 P); + + vec4 texture( sampler2DArray sampler, vec3 P); +ivec4 texture(isampler2DArray sampler, vec3 P); +uvec4 texture(usampler2DArray sampler, vec3 P); + +float texture(sampler1DArrayShadow sampler, vec3 P); +float texture(sampler2DArrayShadow sampler, vec4 P); + +/* texture - bias variants */ + vec4 texture( sampler1D sampler, float P, float bias); +ivec4 texture(isampler1D sampler, float P, float bias); +uvec4 texture(usampler1D sampler, float P, float bias); + + vec4 texture( sampler2D sampler, vec2 P, float bias); +ivec4 texture(isampler2D sampler, vec2 P, float bias); +uvec4 texture(usampler2D sampler, vec2 P, float bias); + + vec4 texture( sampler3D sampler, vec3 P, float bias); +ivec4 texture(isampler3D sampler, vec3 P, float bias); +uvec4 texture(usampler3D sampler, vec3 P, float bias); + + vec4 texture( samplerCube sampler, vec3 P, float bias); +ivec4 texture(isamplerCube sampler, vec3 P, float bias); +uvec4 texture(usamplerCube sampler, vec3 P, float bias); + +float texture(sampler1DShadow sampler, vec3 P, float bias); +float texture(sampler2DShadow sampler, vec3 P, float bias); +float texture(samplerCubeShadow sampler, vec4 P, float bias); + + vec4 texture( sampler1DArray sampler, vec2 P, float bias); +ivec4 texture(isampler1DArray sampler, vec2 P, float bias); +uvec4 texture(usampler1DArray sampler, vec2 P, float bias); + + vec4 texture( sampler2DArray sampler, vec3 P, float bias); +ivec4 texture(isampler2DArray sampler, vec3 P, float bias); +uvec4 texture(usampler2DArray sampler, vec3 P, float bias); + +float texture(sampler1DArrayShadow sampler, vec3 P, float bias); + +/* textureProj - no bias */ + vec4 textureProj( sampler1D sampler, vec2 P); +ivec4 textureProj(isampler1D sampler, vec2 P); +uvec4 textureProj(usampler1D sampler, vec2 P); + vec4 textureProj( sampler1D sampler, vec4 P); +ivec4 textureProj(isampler1D sampler, vec4 P); +uvec4 textureProj(usampler1D sampler, vec4 P); + + vec4 textureProj( sampler2D sampler, vec3 P); +ivec4 textureProj(isampler2D sampler, vec3 P); +uvec4 textureProj(usampler2D sampler, vec3 P); + vec4 textureProj( sampler2D sampler, vec4 P); +ivec4 textureProj(isampler2D sampler, vec4 P); +uvec4 textureProj(usampler2D sampler, vec4 P); + + vec4 textureProj( sampler3D sampler, vec4 P); +ivec4 textureProj(isampler3D sampler, vec4 P); +uvec4 textureProj(usampler3D sampler, vec4 P); + +float textureProj(sampler1DShadow sampler, vec4 P); +float textureProj(sampler2DShadow sampler, vec4 P); + +/* textureProj - bias variants */ + vec4 textureProj( sampler1D sampler, vec2 P, float bias); +ivec4 textureProj(isampler1D sampler, vec2 P, float bias); +uvec4 textureProj(usampler1D sampler, vec2 P, float bias); + vec4 textureProj( sampler1D sampler, vec4 P, float bias); +ivec4 textureProj(isampler1D sampler, vec4 P, float bias); +uvec4 textureProj(usampler1D sampler, vec4 P, float bias); + + vec4 textureProj( sampler2D sampler, vec3 P, float bias); +ivec4 textureProj(isampler2D sampler, vec3 P, float bias); +uvec4 textureProj(usampler2D sampler, vec3 P, float bias); + vec4 textureProj( sampler2D sampler, vec4 P, float bias); +ivec4 textureProj(isampler2D sampler, vec4 P, float bias); +uvec4 textureProj(usampler2D sampler, vec4 P, float bias); + + vec4 textureProj( sampler3D sampler, vec4 P, float bias); +ivec4 textureProj(isampler3D sampler, vec4 P, float bias); +uvec4 textureProj(usampler3D sampler, vec4 P, float bias); + +float textureProj(sampler1DShadow sampler, vec4 P, float bias); +float textureProj(sampler2DShadow sampler, vec4 P, float bias); + +/* textureLod */ + vec4 textureLod( sampler1D sampler, float P, float lod); +ivec4 textureLod(isampler1D sampler, float P, float lod); +uvec4 textureLod(usampler1D sampler, float P, float lod); + + vec4 textureLod( sampler2D sampler, vec2 P, float lod); +ivec4 textureLod(isampler2D sampler, vec2 P, float lod); +uvec4 textureLod(usampler2D sampler, vec2 P, float lod); + + vec4 textureLod( sampler3D sampler, vec3 P, float lod); +ivec4 textureLod(isampler3D sampler, vec3 P, float lod); +uvec4 textureLod(usampler3D sampler, vec3 P, float lod); + + vec4 textureLod( samplerCube sampler, vec3 P, float lod); +ivec4 textureLod(isamplerCube sampler, vec3 P, float lod); +uvec4 textureLod(usamplerCube sampler, vec3 P, float lod); + +float textureLod(sampler1DShadow sampler, vec3 P, float lod); +float textureLod(sampler2DShadow sampler, vec3 P, float lod); + + vec4 textureLod( sampler1DArray sampler, vec2 P, float lod); +ivec4 textureLod(isampler1DArray sampler, vec2 P, float lod); +uvec4 textureLod(usampler1DArray sampler, vec2 P, float lod); + + vec4 textureLod( sampler2DArray sampler, vec3 P, float lod); +ivec4 textureLod(isampler2DArray sampler, vec3 P, float lod); +uvec4 textureLod(usampler2DArray sampler, vec3 P, float lod); + +float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod); + +#if 0 +/* textureOffset - no bias */ + vec4 textureOffset( sampler1D sampler, float P, int offset); +ivec4 textureOffset(isampler1D sampler, float P, int offset); +uvec4 textureOffset(usampler1D sampler, float P, int offset); + + vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset); +ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset); +uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset); + + vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset); +ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset); +uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset); + +float textureOffset(sampler1DShadow sampler, vec3 P, int offset); +float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset); + + vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset); +ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset); +uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset); + + vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset); +ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset); +uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset); + +float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset); + +/* textureOffset - bias variants */ + vec4 textureOffset( sampler1D sampler, float P, int offset, float bias); +ivec4 textureOffset(isampler1D sampler, float P, int offset, float bias); +uvec4 textureOffset(usampler1D sampler, float P, int offset, float bias); + + vec4 textureOffset( sampler2D sampler, vec2 P, ivec2 offset, float bias); +ivec4 textureOffset(isampler2D sampler, vec2 P, ivec2 offset, float bias); +uvec4 textureOffset(usampler2D sampler, vec2 P, ivec2 offset, float bias); + + vec4 textureOffset( sampler3D sampler, vec3 P, ivec3 offset, float bias); +ivec4 textureOffset(isampler3D sampler, vec3 P, ivec3 offset, float bias); +uvec4 textureOffset(usampler3D sampler, vec3 P, ivec3 offset, float bias); + +float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias); +float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias); + + vec4 textureOffset( sampler1DArray sampler, vec2 P, int offset, float bias); +ivec4 textureOffset(isampler1DArray sampler, vec2 P, int offset, float bias); +uvec4 textureOffset(usampler1DArray sampler, vec2 P, int offset, float bias); + + vec4 textureOffset( sampler2DArray sampler, vec3 P, ivec2 offset, float bias); +ivec4 textureOffset(isampler2DArray sampler, vec3 P, ivec2 offset, float bias); +uvec4 textureOffset(usampler2DArray sampler, vec3 P, ivec2 offset, float bias); + +float textureOffset(sampler1DArrayShadow samp, vec3 P, int offset, float bias); +#endif + +/* texelFetch */ + vec4 texelFetch( sampler1D sampler, int P, int lod); +ivec4 texelFetch(isampler1D sampler, int P, int lod); +uvec4 texelFetch(usampler1D sampler, int P, int lod); + + vec4 texelFetch( sampler2D sampler, ivec2 P, int lod); +ivec4 texelFetch(isampler2D sampler, ivec2 P, int lod); +uvec4 texelFetch(usampler2D sampler, ivec2 P, int lod); + + vec4 texelFetch( sampler3D sampler, ivec3 P, int lod); +ivec4 texelFetch(isampler3D sampler, ivec3 P, int lod); +uvec4 texelFetch(usampler3D sampler, ivec3 P, int lod); + + vec4 texelFetch( sampler1DArray sampler, ivec2 P, int lod); +ivec4 texelFetch(isampler1DArray sampler, ivec2 P, int lod); +uvec4 texelFetch(usampler1DArray sampler, ivec2 P, int lod); + + vec4 texelFetch( sampler2DArray sampler, ivec3 P, int lod); +ivec4 texelFetch(isampler2DArray sampler, ivec3 P, int lod); +uvec4 texelFetch(usampler2DArray sampler, ivec3 P, int lod); + +#if 0 +/* texelFetchOffset */ + vec4 texelFetchOffset( sampler1D sampler, int P, int lod, int offset); +ivec4 texelFetchOffset(isampler1D sampler, int P, int lod, int offset); +uvec4 texelFetchOffset(usampler1D sampler, int P, int lod, int offset); + + vec4 texelFetchOffset( sampler2D sampler, ivec2 P, int lod, ivec2 offset); +ivec4 texelFetchOffset(isampler2D sampler, ivec2 P, int lod, ivec2 offset); +uvec4 texelFetchOffset(usampler2D sampler, ivec2 P, int lod, ivec2 offset); + + vec4 texelFetchOffset( sampler3D sampler, ivec3 P, int lod, ivec3 offset); +ivec4 texelFetchOffset(isampler3D sampler, ivec3 P, int lod, ivec3 offset); +uvec4 texelFetchOffset(usampler3D sampler, ivec3 P, int lod, ivec3 offset); + + vec4 texelFetchOffset( sampler1DArray sampler, ivec2 P, int lod, int offset); +ivec4 texelFetchOffset(isampler1DArray sampler, ivec2 P, int lod, int offset); +uvec4 texelFetchOffset(usampler1DArray sampler, ivec2 P, int lod, int offset); + + vec4 texelFetchOffset( sampler2DArray sampler, ivec3 P, int lod, ivec2 offset); +ivec4 texelFetchOffset(isampler2DArray sampler, ivec3 P, int lod, ivec2 offset); +uvec4 texelFetchOffset(usampler2DArray sampler, ivec3 P, int lod, ivec2 offset); + +/* textureProjOffset - no bias */ + vec4 textureProj( sampler1D sampler, vec2 P, int offset); +ivec4 textureProj(isampler1D sampler, vec2 P, int offset); +uvec4 textureProj(usampler1D sampler, vec2 P, int offset); + vec4 textureProj( sampler1D sampler, vec4 P, int offset); +ivec4 textureProj(isampler1D sampler, vec4 P, int offset); +uvec4 textureProj(usampler1D sampler, vec4 P, int offset); + + vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset); +ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset); +uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset); + vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset); +ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset); +uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset); + + vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset); +ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset); +uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset); + +float textureProj(sampler1DShadow sampler, vec4 P, int offset); +float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset); + +/* textureProjOffset - bias variants */ + vec4 textureProj( sampler1D sampler, vec2 P, int offset, float bias); +ivec4 textureProj(isampler1D sampler, vec2 P, int offset, float bias); +uvec4 textureProj(usampler1D sampler, vec2 P, int offset, float bias); + vec4 textureProj( sampler1D sampler, vec4 P, int offset, float bias); +ivec4 textureProj(isampler1D sampler, vec4 P, int offset, float bias); +uvec4 textureProj(usampler1D sampler, vec4 P, int offset, float bias); + + vec4 textureProj( sampler2D sampler, vec3 P, ivec2 offset, float bias); +ivec4 textureProj(isampler2D sampler, vec3 P, ivec2 offset, float bias); +uvec4 textureProj(usampler2D sampler, vec3 P, ivec2 offset, float bias); + vec4 textureProj( sampler2D sampler, vec4 P, ivec2 offset, float bias); +ivec4 textureProj(isampler2D sampler, vec4 P, ivec2 offset, float bias); +uvec4 textureProj(usampler2D sampler, vec4 P, ivec2 offset, float bias); + + vec4 textureProj( sampler3D sampler, vec4 P, ivec3 offset, float bias); +ivec4 textureProj(isampler3D sampler, vec4 P, ivec3 offset, float bias); +uvec4 textureProj(usampler3D sampler, vec4 P, ivec3 offset, float bias); + +float textureProj(sampler1DShadow sampler, vec4 P, int offset, float bias); +float textureProj(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias); + +/* textureLodOffset */ + vec4 textureLodOffset( sampler1D sampler, float P, float lod, int offset); +ivec4 textureLodOffset(isampler1D sampler, float P, float lod, int offset); +uvec4 textureLodOffset(usampler1D sampler, float P, float lod, int offset); + + vec4 textureLodOffset( sampler2D sampler, vec2 P, float lod, ivec2 offset); +ivec4 textureLodOffset(isampler2D sampler, vec2 P, float lod, ivec2 offset); +uvec4 textureLodOffset(usampler2D sampler, vec2 P, float lod, ivec2 offset); + + vec4 textureLodOffset( sampler3D sampler, vec3 P, float lod, ivec3 offset); +ivec4 textureLodOffset(isampler3D sampler, vec3 P, float lod, ivec3 offset); +uvec4 textureLodOffset(usampler3D sampler, vec3 P, float lod, ivec3 offset); + +float textureLodOffset(sampler1DShadow samp, vec3 P, float lod, int offset); +float textureLodOffset(sampler2DShadow samp, vec3 P, float lod, ivec2 offset); + + vec4 textureLodOffset( sampler1DArray sampler, vec2 P, float lod, int offset); +ivec4 textureLodOffset(isampler1DArray sampler, vec2 P, float lod, int offset); +uvec4 textureLodOffset(usampler1DArray sampler, vec2 P, float lod, int offset); + + vec4 textureLodOffset( sampler2DArray samp, vec3 P, float lod, ivec2 offset); +ivec4 textureLodOffset(isampler2DArray samp, vec3 P, float lod, ivec2 offset); +uvec4 textureLodOffset(usampler2DArray samp, vec3 P, float lod, ivec2 offset); + +float textureLodOffset(sampler1DArrayShadow s, vec3 P, float lod, int offset); +#endif + +/* textureProjLod */ + vec4 textureProjLod( sampler1D sampler, vec2 P, float lod); +ivec4 textureProjLod(isampler1D sampler, vec2 P, float lod); +uvec4 textureProjLod(usampler1D sampler, vec2 P, float lod); + vec4 textureProjLod( sampler1D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler1D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler1D sampler, vec4 P, float lod); + + vec4 textureProjLod( sampler2D sampler, vec3 P, float lod); +ivec4 textureProjLod(isampler2D sampler, vec3 P, float lod); +uvec4 textureProjLod(usampler2D sampler, vec3 P, float lod); + vec4 textureProjLod( sampler2D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler2D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler2D sampler, vec4 P, float lod); + + vec4 textureProjLod( sampler3D sampler, vec4 P, float lod); +ivec4 textureProjLod(isampler3D sampler, vec4 P, float lod); +uvec4 textureProjLod(usampler3D sampler, vec4 P, float lod); + +float textureProjLod(sampler1DShadow sampler, vec4 P, float lod); +float textureProjLod(sampler2DShadow sampler, vec4 P, float lod); + +#if 0 +/* textureProjLodOffset */ + vec4 textureProjLodOffset( sampler1D sampler, vec2 P, float lod, int offset); +ivec4 textureProjLodOffset(isampler1D sampler, vec2 P, float lod, int offset); +uvec4 textureProjLodOffset(usampler1D sampler, vec2 P, float lod, int offset); + vec4 textureProjLodOffset( sampler1D sampler, vec4 P, float lod, int offset); +ivec4 textureProjLodOffset(isampler1D sampler, vec4 P, float lod, int offset); +uvec4 textureProjLodOffset(usampler1D sampler, vec4 P, float lod, int offset); + + vec4 textureProjLodOffset( sampler2D sampler, vec3 P, float lod, ivec2 offset); +ivec4 textureProjLodOffset(isampler2D sampler, vec3 P, float lod, ivec2 offset); +uvec4 textureProjLodOffset(usampler2D sampler, vec3 P, float lod, ivec2 offset); + vec4 textureProjLodOffset( sampler2D sampler, vec4 P, float lod, ivec2 offset); +ivec4 textureProjLodOffset(isampler2D sampler, vec4 P, float lod, ivec2 offset); +uvec4 textureProjLodOffset(usampler2D sampler, vec4 P, float lod, ivec2 offset); + + vec4 textureProjLodOffset( sampler3D sampler, vec4 P, float lod, ivec3 offset); +ivec4 textureProjLodOffset(isampler3D sampler, vec4 P, float lod, ivec3 offset); +uvec4 textureProjLodOffset(usampler3D sampler, vec4 P, float lod, ivec3 offset); + +float textureProjLodOffset(sampler1DShadow s, vec4 P, float lod, int offset); +float textureProjLodOffset(sampler2DShadow s, vec4 P, float lod, ivec2 offset); +#endif + +/* textureGrad */ + vec4 textureGrad( sampler1D sampler, float P, float dPdx, float dPdy); +ivec4 textureGrad(isampler1D sampler, float P, float dPdx, float dPdy); +uvec4 textureGrad(usampler1D sampler, float P, float dPdx, float dPdy); + + vec4 textureGrad( sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); +ivec4 textureGrad(isampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); +uvec4 textureGrad(usampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy); + + vec4 textureGrad( sampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); +ivec4 textureGrad(isampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); +uvec4 textureGrad(usampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy); + + vec4 textureGrad( samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); +ivec4 textureGrad(isamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); +uvec4 textureGrad(usamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy); + +float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy); +float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy); +float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy); + + vec4 textureGrad( sampler1DArray sampler, vec2 P, float dPdx, float dPdy); +ivec4 textureGrad(isampler1DArray sampler, vec2 P, float dPdx, float dPdy); +uvec4 textureGrad(usampler1DArray sampler, vec2 P, float dPdx, float dPdy); + + vec4 textureGrad( sampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); +ivec4 textureGrad(isampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); +uvec4 textureGrad(usampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy); + +float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy); +float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); + +#if 0 +/* textureGradOffset */ + vec4 textureGradOffset( sampler1D s, float P, float dx, float dy, int off); +ivec4 textureGradOffset(isampler1D s, float P, float dx, float dy, int offset); +uvec4 textureGradOffset(usampler1D s, float P, float dx, float dy, int offset); + + vec4 textureGradOffset( sampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); +ivec4 textureGradOffset(isampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); +uvec4 textureGradOffset(usampler2D s, vec2 P, vec2 dx, vec2 dy, ivec2 offset); + + vec4 textureGradOffset( sampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +ivec4 textureGradOffset(isampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +uvec4 textureGradOffset(usampler3D s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); + + vec4 textureGradOffset( samplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +ivec4 textureGradOffset(isamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); +uvec4 textureGradOffset(usamplerCube s, vec3 P, vec3 dx, vec3 dy, ivec3 offset); + +float textureGradOffset(sampler1DShadow s, vec3 P, float dx, float dy, int off); +float textureGradOffset(sampler2DShadow s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + + vec4 textureGradOffset( sampler1DArray s, vec2 P, float dx, float dy, int off); +ivec4 textureGradOffset(isampler1DArray s, vec2 P, float dx, float dy, int off); +uvec4 textureGradOffset(usampler1DArray s, vec2 P, float dx, float dy, int off); + + vec4 textureGradOffset( sampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureGradOffset(isampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureGradOffset(usampler2DArray s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + +float textureGradOffset(sampler1DArrayShadow s, vec3 P, float dx, float dy, int o); +float textureGradOffset(sampler2DArrayShadow s, vec4 P, vec2 dx, vec2 dy, ivec2 o); +#endif + +/* textureProjGrad */ + vec4 textureProjGrad( sampler1D sampler, vec2 P, float dPdx, float dPdy); +ivec4 textureProjGrad(isampler1D sampler, vec2 P, float dPdx, float dPdy); +uvec4 textureProjGrad(usampler1D sampler, vec2 P, float dPdx, float dPdy); + vec4 textureProjGrad( sampler1D sampler, vec4 P, float dPdx, float dPdy); +ivec4 textureProjGrad(isampler1D sampler, vec4 P, float dPdx, float dPdy); +uvec4 textureProjGrad(usampler1D sampler, vec4 P, float dPdx, float dPdy); + + vec4 textureProjGrad( sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); +ivec4 textureProjGrad(isampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); +uvec4 textureProjGrad(usampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy); + vec4 textureProjGrad( sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); +ivec4 textureProjGrad(isampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); +uvec4 textureProjGrad(usampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy); + + vec4 textureProjGrad( sampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); +ivec4 textureProjGrad(isampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); +uvec4 textureProjGrad(usampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy); + +float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy); +float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy); + +#if 0 +/* textureProjGradOffset */ + vec4 textureProjGradOffset( sampler1D s, vec2 P, float dx, float dy, int off); +ivec4 textureProjGradOffset(isampler1D s, vec2 P, float dx, float dy, int off); +uvec4 textureProjGradOffset(usampler1D s, vec2 P, float dx, float dy, int off); + vec4 textureProjGradOffset( sampler1D s, vec4 P, float dx, float dy, int off); +ivec4 textureProjGradOffset(isampler1D s, vec4 P, float dx, float dy, int off); +uvec4 textureProjGradOffset(usampler1D s, vec4 P, float dx, float dy, int off); + + vec4 textureProjGradOffset( sampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureProjGradOffset(isampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureProjGradOffset(usampler2D s, vec3 P, vec2 dx, vec2 dy, ivec2 off); + vec4 textureProjGradOffset( sampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); +ivec4 textureProjGradOffset(isampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); +uvec4 textureProjGradOffset(usampler2D s, vec4 P, vec2 dx, vec2 dy, ivec2 off); + + vec4 textureProjGradOffset( sampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); +ivec4 textureProjGradOffset(isampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); +uvec4 textureProjGradOffset(usampler3D s, vec4 P, vec3 dx, vec3 dy, ivec3 off); + +float textureProjGradOffset(sampler1DShadow s, vec4 P, float dx, float dy, int o); +float textureProjGradOffset(sampler2DShadow s, vec4 P, vec2 dx, vec2 dy, vec2 o); +#endif + +/* + * The following texture functions are deprecated: + */ +vec4 texture1D (sampler1D sampler, float coord); +vec4 texture1DProj (sampler1D sampler, vec2 coord); +vec4 texture1DProj (sampler1D sampler, vec4 coord); +vec4 texture1D (sampler1D sampler, float coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec2 coord, float bias); +vec4 texture1DProj (sampler1D sampler, vec4 coord, float bias); +vec4 texture1DLod (sampler1D sampler, float coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod); +vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod); + +vec4 texture2D (sampler2D sampler, vec2 coord); +vec4 texture2DProj (sampler2D sampler, vec3 coord); +vec4 texture2DProj (sampler2D sampler, vec4 coord); +vec4 texture2D (sampler2D sampler, vec2 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias); +vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias); +vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod); +vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod); + +vec4 texture3D (sampler3D sampler, vec3 coord); +vec4 texture3DProj (sampler3D sampler, vec4 coord); +vec4 texture3D (sampler3D sampler, vec3 coord, float bias); +vec4 texture3DProj (sampler3D sampler, vec4 coord, float bias); +vec4 texture3DLod (sampler3D sampler, vec3 coord, float lod); +vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod); + +vec4 textureCube (samplerCube sampler, vec3 coord); +vec4 textureCube (samplerCube sampler, vec3 coord, float bias); +vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod); + +vec4 shadow1D (sampler1DShadow sampler, vec3 coord); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord); +vec4 shadow1D (sampler1DShadow sampler, vec3 coord, float bias); +vec4 shadow2D (sampler2DShadow sampler, vec3 coord, float bias); +vec4 shadow1DProj (sampler1DShadow sampler, vec4 coord, float bias); +vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord, float bias); +vec4 shadow1DLod (sampler1DShadow sampler, vec3 coord, float lod); +vec4 shadow2DLod (sampler2DShadow sampler, vec3 coord, float lod); +vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod); +vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod); + +/* + * 8.8 - Fragment Processing Functions (none in vertex shader) + */ + +/* + * 8.9 - Noise Functions + */ +float noise1(float x); +float noise1(vec2 x); +float noise1(vec3 x); +float noise1(vec4 x); + +vec2 noise2(float x); +vec2 noise2(vec2 x); +vec2 noise2(vec3 x); +vec2 noise2(vec4 x); + +vec3 noise3(float x); +vec3 noise3(vec2 x); +vec3 noise3(vec3 x); +vec3 noise3(vec4 x); + +vec4 noise4(float x); +vec4 noise4(vec2 x); +vec4 noise4(vec3 x); +vec4 noise4(vec4 x); -- cgit v1.2.3 From a433cd286c60eb9d4c2114f042709eda0f3de676 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 16 Aug 2010 15:18:23 -0700 Subject: glsl2: Refresh autogenerated file builtin_function.cpp. --- src/glsl/builtin_function.cpp | 13506 ++++++++++++++++++++++++++++++++++------ 1 file changed, 11544 insertions(+), 1962 deletions(-) (limited to 'src/glsl') diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index f2abea961d..652e4f61bb 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -4718,28 +4718,28 @@ static const char *prototypes_for_120_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x22143e0)\n" + " (declare (in ) float degrees@0x13d20b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x22147b0)\n" + " (declare (in ) vec2 degrees@0x13d2430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x22149a0)\n" + " (declare (in ) vec3 degrees@0x13d2610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x2214b90)\n" + " (declare (in ) vec4 degrees@0x13d27f0)\n" " )\n" " (\n" " ))\n" @@ -4749,28 +4749,28 @@ static const char *prototypes_for_120_vert = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x2214d80)\n" + " (declare (in ) float radians@0x13d29d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x2215150)\n" + " (declare (in ) vec2 radians@0x13d2d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x2215340)\n" + " (declare (in ) vec3 radians@0x13d2f30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x2215530)\n" + " (declare (in ) vec4 radians@0x13d3110)\n" " )\n" " (\n" " ))\n" @@ -4780,28 +4780,28 @@ static const char *prototypes_for_120_vert = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2215720)\n" + " (declare (in ) float angle@0x13d32f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2215ad0)\n" + " (declare (in ) vec2 angle@0x13d3670)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2215cb0)\n" + " (declare (in ) vec3 angle@0x13d3850)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2215e90)\n" + " (declare (in ) vec4 angle@0x13d3a30)\n" " )\n" " (\n" " ))\n" @@ -4811,28 +4811,28 @@ static const char *prototypes_for_120_vert = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2216070)\n" + " (declare (in ) float angle@0x13d3c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2216420)\n" + " (declare (in ) vec2 angle@0x13d3f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2216600)\n" + " (declare (in ) vec3 angle@0x13d4170)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x22167e0)\n" + " (declare (in ) vec4 angle@0x13d4350)\n" " )\n" " (\n" " ))\n" @@ -4842,28 +4842,28 @@ static const char *prototypes_for_120_vert = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x22169c0)\n" + " (declare (in ) float angle@0x13d4530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2216d70)\n" + " (declare (in ) vec2 angle@0x13d48b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x2216f50)\n" + " (declare (in ) vec3 angle@0x13d4a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2217130)\n" + " (declare (in ) vec4 angle@0x13d4c70)\n" " )\n" " (\n" " ))\n" @@ -4873,28 +4873,28 @@ static const char *prototypes_for_120_vert = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2217310)\n" + " (declare (in ) float angle@0x13d4e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x22176c0)\n" + " (declare (in ) vec2 angle@0x13d51d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x22178a0)\n" + " (declare (in ) vec3 angle@0x13d53b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x2217a80)\n" + " (declare (in ) vec4 angle@0x13d5590)\n" " )\n" " (\n" " ))\n" @@ -4904,28 +4904,28 @@ static const char *prototypes_for_120_vert = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x2217c60)\n" + " (declare (in ) float angle@0x13d5770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x2218010)\n" + " (declare (in ) vec2 angle@0x13d5af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x22181f0)\n" + " (declare (in ) vec3 angle@0x13d5cd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x22183d0)\n" + " (declare (in ) vec4 angle@0x13d5eb0)\n" " )\n" " (\n" " ))\n" @@ -4935,60 +4935,60 @@ static const char *prototypes_for_120_vert = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x22185b0)\n" - " (declare (in ) float x@0x22186c0)\n" + " (declare (in ) float y@0x13d6090)\n" + " (declare (in ) float x@0x13d61a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x2218a70)\n" - " (declare (in ) vec2 x@0x2218b80)\n" + " (declare (in ) vec2 y@0x13d6520)\n" + " (declare (in ) vec2 x@0x13d6630)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x2218d60)\n" - " (declare (in ) vec3 x@0x2218e70)\n" + " (declare (in ) vec3 y@0x13d6810)\n" + " (declare (in ) vec3 x@0x13d6920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x2219050)\n" - " (declare (in ) vec4 x@0x2219160)\n" + " (declare (in ) vec4 y@0x13d6b00)\n" + " (declare (in ) vec4 x@0x13d6c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x2219340)\n" + " (declare (in ) float y_over_x@0x13d6df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x2219530)\n" + " (declare (in ) vec2 y_over_x@0x13d6fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x2219720)\n" + " (declare (in ) vec3 y_over_x@0x13d71d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x2219910)\n" + " (declare (in ) vec4 y_over_x@0x13d73c0)\n" " )\n" " (\n" " ))\n" @@ -4998,32 +4998,32 @@ static const char *prototypes_for_120_vert = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2219b00)\n" - " (declare (in ) float y@0x2219c10)\n" + " (declare (in ) float x@0x13d75b0)\n" + " (declare (in ) float y@0x13d76c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2219fc0)\n" - " (declare (in ) vec2 y@0x221a0d0)\n" + " (declare (in ) vec2 x@0x13d7a40)\n" + " (declare (in ) vec2 y@0x13d7b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221a2b0)\n" - " (declare (in ) vec3 y@0x221a3c0)\n" + " (declare (in ) vec3 x@0x13d7d30)\n" + " (declare (in ) vec3 y@0x13d7e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221a5a0)\n" - " (declare (in ) vec4 y@0x221a6b0)\n" + " (declare (in ) vec4 x@0x13d8020)\n" + " (declare (in ) vec4 y@0x13d8130)\n" " )\n" " (\n" " ))\n" @@ -5033,28 +5033,28 @@ static const char *prototypes_for_120_vert = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221a890)\n" + " (declare (in ) float x@0x13d8310)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221ac40)\n" + " (declare (in ) vec2 x@0x13d8690)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221ae20)\n" + " (declare (in ) vec3 x@0x13d8870)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221b000)\n" + " (declare (in ) vec4 x@0x13d8a50)\n" " )\n" " (\n" " ))\n" @@ -5064,28 +5064,28 @@ static const char *prototypes_for_120_vert = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221b1e0)\n" + " (declare (in ) float x@0x13d8c30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221b590)\n" + " (declare (in ) vec2 x@0x13d8fb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221b770)\n" + " (declare (in ) vec3 x@0x13d9190)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221b950)\n" + " (declare (in ) vec4 x@0x13d9370)\n" " )\n" " (\n" " ))\n" @@ -5095,28 +5095,28 @@ static const char *prototypes_for_120_vert = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221bb30)\n" + " (declare (in ) float x@0x13d9550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221bee0)\n" + " (declare (in ) vec2 x@0x13d98d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221c0c0)\n" + " (declare (in ) vec3 x@0x13d9ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221c2a0)\n" + " (declare (in ) vec4 x@0x13d9c90)\n" " )\n" " (\n" " ))\n" @@ -5126,28 +5126,28 @@ static const char *prototypes_for_120_vert = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221c480)\n" + " (declare (in ) float x@0x13d9e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221c830)\n" + " (declare (in ) vec2 x@0x13da1f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221ca10)\n" + " (declare (in ) vec3 x@0x13da3d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221cbf0)\n" + " (declare (in ) vec4 x@0x13da5b0)\n" " )\n" " (\n" " ))\n" @@ -5157,28 +5157,28 @@ static const char *prototypes_for_120_vert = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221cdd0)\n" + " (declare (in ) float x@0x13da790)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221d180)\n" + " (declare (in ) vec2 x@0x13dab10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221d360)\n" + " (declare (in ) vec3 x@0x13dacf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221d540)\n" + " (declare (in ) vec4 x@0x13daed0)\n" " )\n" " (\n" " ))\n" @@ -5188,28 +5188,28 @@ static const char *prototypes_for_120_vert = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221d720)\n" + " (declare (in ) float x@0x13db0b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221dae0)\n" + " (declare (in ) vec2 x@0x13db440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221dcc0)\n" + " (declare (in ) vec3 x@0x13db620)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221dea0)\n" + " (declare (in ) vec4 x@0x13db800)\n" " )\n" " (\n" " ))\n" @@ -5219,28 +5219,28 @@ static const char *prototypes_for_120_vert = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221e080)\n" + " (declare (in ) float x@0x13db9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221e430)\n" + " (declare (in ) vec2 x@0x13dbd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221e610)\n" + " (declare (in ) vec3 x@0x13dbf40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221e7f0)\n" + " (declare (in ) vec4 x@0x13dc120)\n" " )\n" " (\n" " ))\n" @@ -5250,28 +5250,28 @@ static const char *prototypes_for_120_vert = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221e9d0)\n" + " (declare (in ) float x@0x13dc300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221ed80)\n" + " (declare (in ) vec2 x@0x13dc680)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221ef60)\n" + " (declare (in ) vec3 x@0x13dc860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221f140)\n" + " (declare (in ) vec4 x@0x13dca40)\n" " )\n" " (\n" " ))\n" @@ -5281,28 +5281,28 @@ static const char *prototypes_for_120_vert = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221f320)\n" + " (declare (in ) float x@0x13dcc20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x221f6d0)\n" + " (declare (in ) vec2 x@0x13dcfa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x221f8b0)\n" + " (declare (in ) vec3 x@0x13dd180)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x221fa90)\n" + " (declare (in ) vec4 x@0x13dd360)\n" " )\n" " (\n" " ))\n" @@ -5312,28 +5312,28 @@ static const char *prototypes_for_120_vert = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x221fc70)\n" + " (declare (in ) float x@0x13dd540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2220020)\n" + " (declare (in ) vec2 x@0x13dd8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2220200)\n" + " (declare (in ) vec3 x@0x13ddaa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x22203e0)\n" + " (declare (in ) vec4 x@0x13ddc80)\n" " )\n" " (\n" " ))\n" @@ -5343,28 +5343,28 @@ static const char *prototypes_for_120_vert = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x22205c0)\n" + " (declare (in ) float x@0x13dde60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2220970)\n" + " (declare (in ) vec2 x@0x13de1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2220b50)\n" + " (declare (in ) vec3 x@0x13de3c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2220d30)\n" + " (declare (in ) vec4 x@0x13de5a0)\n" " )\n" " (\n" " ))\n" @@ -5374,56 +5374,56 @@ static const char *prototypes_for_120_vert = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2220f10)\n" - " (declare (in ) float y@0x2221020)\n" + " (declare (in ) float x@0x13de780)\n" + " (declare (in ) float y@0x13de890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x22213d0)\n" - " (declare (in ) float y@0x22214e0)\n" + " (declare (in ) vec2 x@0x13dec10)\n" + " (declare (in ) float y@0x13ded20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x22216c0)\n" - " (declare (in ) float y@0x22217d0)\n" + " (declare (in ) vec3 x@0x13def00)\n" + " (declare (in ) float y@0x13df010)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x22219b0)\n" - " (declare (in ) float y@0x2221ac0)\n" + " (declare (in ) vec4 x@0x13df1f0)\n" + " (declare (in ) float y@0x13df300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2221ca0)\n" - " (declare (in ) vec2 y@0x2221db0)\n" + " (declare (in ) vec2 x@0x13df4e0)\n" + " (declare (in ) vec2 y@0x13df5f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2221f90)\n" - " (declare (in ) vec3 y@0x22220a0)\n" + " (declare (in ) vec3 x@0x13df7d0)\n" + " (declare (in ) vec3 y@0x13df8e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2222280)\n" - " (declare (in ) vec4 y@0x2222390)\n" + " (declare (in ) vec4 x@0x13dfac0)\n" + " (declare (in ) vec4 y@0x13dfbd0)\n" " )\n" " (\n" " ))\n" @@ -5433,56 +5433,56 @@ static const char *prototypes_for_120_vert = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2222570)\n" - " (declare (in ) float y@0x2222680)\n" + " (declare (in ) float x@0x13dfdb0)\n" + " (declare (in ) float y@0x13dfec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2222a30)\n" - " (declare (in ) vec2 y@0x2222b40)\n" + " (declare (in ) vec2 x@0x13e0240)\n" + " (declare (in ) vec2 y@0x13e0350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2222d20)\n" - " (declare (in ) vec3 y@0x2222e30)\n" + " (declare (in ) vec3 x@0x13e0530)\n" + " (declare (in ) vec3 y@0x13e0640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2223010)\n" - " (declare (in ) vec4 y@0x2223120)\n" + " (declare (in ) vec4 x@0x13e0820)\n" + " (declare (in ) vec4 y@0x13e0930)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2223300)\n" - " (declare (in ) float y@0x2223410)\n" + " (declare (in ) vec2 x@0x13e0b10)\n" + " (declare (in ) float y@0x13e0c20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x22235f0)\n" - " (declare (in ) float y@0x2223700)\n" + " (declare (in ) vec3 x@0x13e0e00)\n" + " (declare (in ) float y@0x13e0f10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x22238e0)\n" - " (declare (in ) float y@0x22239f0)\n" + " (declare (in ) vec4 x@0x13e10f0)\n" + " (declare (in ) float y@0x13e1200)\n" " )\n" " (\n" " ))\n" @@ -5492,56 +5492,56 @@ static const char *prototypes_for_120_vert = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2223bd0)\n" - " (declare (in ) float y@0x2223ce0)\n" + " (declare (in ) float x@0x13e13e0)\n" + " (declare (in ) float y@0x13e14f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2224090)\n" - " (declare (in ) vec2 y@0x22241a0)\n" + " (declare (in ) vec2 x@0x13e1870)\n" + " (declare (in ) vec2 y@0x13e1980)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2224380)\n" - " (declare (in ) vec3 y@0x2224490)\n" + " (declare (in ) vec3 x@0x13e1b60)\n" + " (declare (in ) vec3 y@0x13e1c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2224670)\n" - " (declare (in ) vec4 y@0x2224780)\n" + " (declare (in ) vec4 x@0x13e1e50)\n" + " (declare (in ) vec4 y@0x13e1f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2224960)\n" - " (declare (in ) float y@0x2224a70)\n" + " (declare (in ) vec2 x@0x13e2140)\n" + " (declare (in ) float y@0x13e2250)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2224c50)\n" - " (declare (in ) float y@0x2224d60)\n" + " (declare (in ) vec3 x@0x13e2430)\n" + " (declare (in ) float y@0x13e2540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2224f40)\n" - " (declare (in ) float y@0x2225050)\n" + " (declare (in ) vec4 x@0x13e2720)\n" + " (declare (in ) float y@0x13e2830)\n" " )\n" " (\n" " ))\n" @@ -5551,63 +5551,63 @@ static const char *prototypes_for_120_vert = "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2225230)\n" - " (declare (in ) float minVal@0x2225340)\n" - " (declare (in ) float maxVal@0x2225450)\n" + " (declare (in ) float x@0x13e2a10)\n" + " (declare (in ) float minVal@0x13e2b20)\n" + " (declare (in ) float maxVal@0x13e2c30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2225800)\n" - " (declare (in ) vec2 minVal@0x2225910)\n" - " (declare (in ) vec2 maxVal@0x2225a20)\n" + " (declare (in ) vec2 x@0x13e2fb0)\n" + " (declare (in ) vec2 minVal@0x13e30c0)\n" + " (declare (in ) vec2 maxVal@0x13e31d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2225c00)\n" - " (declare (in ) vec3 minVal@0x2225d10)\n" - " (declare (in ) vec3 maxVal@0x2225e20)\n" + " (declare (in ) vec3 x@0x13e33b0)\n" + " (declare (in ) vec3 minVal@0x13e34c0)\n" + " (declare (in ) vec3 maxVal@0x13e35d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2226000)\n" - " (declare (in ) vec4 minVal@0x2226110)\n" - " (declare (in ) vec4 maxVal@0x2226220)\n" + " (declare (in ) vec4 x@0x13e37b0)\n" + " (declare (in ) vec4 minVal@0x13e38c0)\n" + " (declare (in ) vec4 maxVal@0x13e39d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2226400)\n" - " (declare (in ) float minVal@0x2226510)\n" - " (declare (in ) float maxVal@0x2226620)\n" + " (declare (in ) vec2 x@0x13e3bb0)\n" + " (declare (in ) float minVal@0x13e3cc0)\n" + " (declare (in ) float maxVal@0x13e3dd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2226800)\n" - " (declare (in ) float minVal@0x2226910)\n" - " (declare (in ) float maxVal@0x2226a20)\n" + " (declare (in ) vec3 x@0x13e3fb0)\n" + " (declare (in ) float minVal@0x13e40c0)\n" + " (declare (in ) float maxVal@0x13e41d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2226c00)\n" - " (declare (in ) float minVal@0x2226d10)\n" - " (declare (in ) float maxVal@0x2226e20)\n" + " (declare (in ) vec4 x@0x13e43b0)\n" + " (declare (in ) float minVal@0x13e44c0)\n" + " (declare (in ) float maxVal@0x13e45d0)\n" " )\n" " (\n" " ))\n" @@ -5617,63 +5617,63 @@ static const char *prototypes_for_120_vert = "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2227000)\n" - " (declare (in ) float y@0x2227110)\n" - " (declare (in ) float a@0x2227220)\n" + " (declare (in ) float x@0x13e47b0)\n" + " (declare (in ) float y@0x13e48c0)\n" + " (declare (in ) float a@0x13e49d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x22275d0)\n" - " (declare (in ) vec2 y@0x22276e0)\n" - " (declare (in ) vec2 a@0x22277f0)\n" + " (declare (in ) vec2 x@0x13e4d50)\n" + " (declare (in ) vec2 y@0x13e4e60)\n" + " (declare (in ) vec2 a@0x13e4f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x22279d0)\n" - " (declare (in ) vec3 y@0x2227ae0)\n" - " (declare (in ) vec3 a@0x2227bf0)\n" + " (declare (in ) vec3 x@0x13e5150)\n" + " (declare (in ) vec3 y@0x13e5260)\n" + " (declare (in ) vec3 a@0x13e5370)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2227dd0)\n" - " (declare (in ) vec4 y@0x2227ee0)\n" - " (declare (in ) vec4 a@0x2227ff0)\n" + " (declare (in ) vec4 x@0x13e5550)\n" + " (declare (in ) vec4 y@0x13e5660)\n" + " (declare (in ) vec4 a@0x13e5770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x22281d0)\n" - " (declare (in ) vec2 y@0x22282e0)\n" - " (declare (in ) float a@0x22283f0)\n" + " (declare (in ) vec2 x@0x13e5950)\n" + " (declare (in ) vec2 y@0x13e5a60)\n" + " (declare (in ) float a@0x13e5b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x22285d0)\n" - " (declare (in ) vec3 y@0x22286e0)\n" - " (declare (in ) float a@0x22287f0)\n" + " (declare (in ) vec3 x@0x13e5d50)\n" + " (declare (in ) vec3 y@0x13e5e60)\n" + " (declare (in ) float a@0x13e5f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x22289d0)\n" - " (declare (in ) vec4 y@0x2228ae0)\n" - " (declare (in ) float a@0x2228bf0)\n" + " (declare (in ) vec4 x@0x13e6150)\n" + " (declare (in ) vec4 y@0x13e6260)\n" + " (declare (in ) float a@0x13e6370)\n" " )\n" " (\n" " ))\n" @@ -5683,56 +5683,56 @@ static const char *prototypes_for_120_vert = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x2228dd0)\n" - " (declare (in ) float x@0x2228ee0)\n" + " (declare (in ) float edge@0x13e6550)\n" + " (declare (in ) float x@0x13e6660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x2229290)\n" - " (declare (in ) vec2 x@0x22293a0)\n" + " (declare (in ) vec2 edge@0x13e69e0)\n" + " (declare (in ) vec2 x@0x13e6af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x2229580)\n" - " (declare (in ) vec3 x@0x2229690)\n" + " (declare (in ) vec3 edge@0x13e6cd0)\n" + " (declare (in ) vec3 x@0x13e6de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x2229870)\n" - " (declare (in ) vec4 x@0x2229980)\n" + " (declare (in ) vec4 edge@0x13e6fc0)\n" + " (declare (in ) vec4 x@0x13e70d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x2229b60)\n" - " (declare (in ) vec2 x@0x2229c70)\n" + " (declare (in ) float edge@0x13e72b0)\n" + " (declare (in ) vec2 x@0x13e73c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x2229e50)\n" - " (declare (in ) vec3 x@0x2229f60)\n" + " (declare (in ) float edge@0x13e75a0)\n" + " (declare (in ) vec3 x@0x13e76b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x222a140)\n" - " (declare (in ) vec4 x@0x222a250)\n" + " (declare (in ) float edge@0x13e7890)\n" + " (declare (in ) vec4 x@0x13e79a0)\n" " )\n" " (\n" " ))\n" @@ -5742,63 +5742,63 @@ static const char *prototypes_for_120_vert = "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x222a430)\n" - " (declare (in ) float edge1@0x222a540)\n" - " (declare (in ) float x@0x222a650)\n" + " (declare (in ) float edge0@0x13e7b80)\n" + " (declare (in ) float edge1@0x13e7c90)\n" + " (declare (in ) float x@0x13e7da0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x222aa10)\n" - " (declare (in ) vec2 edge1@0x222ab20)\n" - " (declare (in ) vec2 x@0x222ac30)\n" + " (declare (in ) vec2 edge0@0x13e8130)\n" + " (declare (in ) vec2 edge1@0x13e8240)\n" + " (declare (in ) vec2 x@0x13e8350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x222ae10)\n" - " (declare (in ) vec3 edge1@0x222af20)\n" - " (declare (in ) vec3 x@0x222b030)\n" + " (declare (in ) vec3 edge0@0x13e8530)\n" + " (declare (in ) vec3 edge1@0x13e8640)\n" + " (declare (in ) vec3 x@0x13e8750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x222b210)\n" - " (declare (in ) vec4 edge1@0x222b320)\n" - " (declare (in ) vec4 x@0x222b430)\n" + " (declare (in ) vec4 edge0@0x13e8930)\n" + " (declare (in ) vec4 edge1@0x13e8a40)\n" + " (declare (in ) vec4 x@0x13e8b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x222b610)\n" - " (declare (in ) float edge1@0x222b720)\n" - " (declare (in ) vec2 x@0x222b830)\n" + " (declare (in ) float edge0@0x13e8d30)\n" + " (declare (in ) float edge1@0x13e8e40)\n" + " (declare (in ) vec2 x@0x13e8f50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x222ba10)\n" - " (declare (in ) float edge1@0x222bb20)\n" - " (declare (in ) vec3 x@0x222bc30)\n" + " (declare (in ) float edge0@0x13e9130)\n" + " (declare (in ) float edge1@0x13e9240)\n" + " (declare (in ) vec3 x@0x13e9350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x222be10)\n" - " (declare (in ) float edge1@0x222bf20)\n" - " (declare (in ) vec4 x@0x222c030)\n" + " (declare (in ) float edge0@0x13e9530)\n" + " (declare (in ) float edge1@0x13e9640)\n" + " (declare (in ) vec4 x@0x13e9750)\n" " )\n" " (\n" " ))\n" @@ -5808,28 +5808,28 @@ static const char *prototypes_for_120_vert = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x222c210)\n" + " (declare (in ) float x@0x13e9930)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x222c5c0)\n" + " (declare (in ) vec2 x@0x13e9cb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x222c7a0)\n" + " (declare (in ) vec3 x@0x13e9e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x222c980)\n" + " (declare (in ) vec4 x@0x13ea070)\n" " )\n" " (\n" " ))\n" @@ -5839,32 +5839,32 @@ static const char *prototypes_for_120_vert = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x222cb60)\n" - " (declare (in ) float p1@0x222cc70)\n" + " (declare (in ) float p0@0x13ea250)\n" + " (declare (in ) float p1@0x13ea360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x222d030)\n" - " (declare (in ) vec2 p1@0x222d140)\n" + " (declare (in ) vec2 p0@0x13ea6f0)\n" + " (declare (in ) vec2 p1@0x13ea800)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x222d320)\n" - " (declare (in ) vec3 p1@0x222d430)\n" + " (declare (in ) vec3 p0@0x13ea9e0)\n" + " (declare (in ) vec3 p1@0x13eaaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x222d610)\n" - " (declare (in ) vec4 p1@0x222d720)\n" + " (declare (in ) vec4 p0@0x13eacd0)\n" + " (declare (in ) vec4 p1@0x13eade0)\n" " )\n" " (\n" " ))\n" @@ -5874,32 +5874,32 @@ static const char *prototypes_for_120_vert = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x222d900)\n" - " (declare (in ) float y@0x222da10)\n" + " (declare (in ) float x@0x13eafc0)\n" + " (declare (in ) float y@0x13eb0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x222ddc0)\n" - " (declare (in ) vec2 y@0x222ded0)\n" + " (declare (in ) vec2 x@0x13eb450)\n" + " (declare (in ) vec2 y@0x13eb560)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x222e0b0)\n" - " (declare (in ) vec3 y@0x222e1c0)\n" + " (declare (in ) vec3 x@0x13eb740)\n" + " (declare (in ) vec3 y@0x13eb850)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x222e3a0)\n" - " (declare (in ) vec4 y@0x222e4b0)\n" + " (declare (in ) vec4 x@0x13eba30)\n" + " (declare (in ) vec4 y@0x13ebb40)\n" " )\n" " (\n" " ))\n" @@ -5909,8 +5909,8 @@ static const char *prototypes_for_120_vert = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x222e690)\n" - " (declare (in ) vec3 y@0x222e7a0)\n" + " (declare (in ) vec3 x@0x13ebd20)\n" + " (declare (in ) vec3 y@0x13ebe30)\n" " )\n" " (\n" " ))\n" @@ -5920,28 +5920,28 @@ static const char *prototypes_for_120_vert = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x222eb50)\n" + " (declare (in ) float x@0x13ec1b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x222ef10)\n" + " (declare (in ) vec2 x@0x13ec540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x222f0f0)\n" + " (declare (in ) vec3 x@0x13ec720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x222f2d0)\n" + " (declare (in ) vec4 x@0x13ec900)\n" " )\n" " (\n" " ))\n" @@ -5960,36 +5960,36 @@ static const char *prototypes_for_120_vert = "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x222f760)\n" - " (declare (in ) float I@0x222f870)\n" - " (declare (in ) float Nref@0x222f980)\n" + " (declare (in ) float N@0x13ecd60)\n" + " (declare (in ) float I@0x13ece70)\n" + " (declare (in ) float Nref@0x13ecf80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x222fd40)\n" - " (declare (in ) vec2 I@0x222fe50)\n" - " (declare (in ) vec2 Nref@0x222ff60)\n" + " (declare (in ) vec2 N@0x13ed310)\n" + " (declare (in ) vec2 I@0x13ed420)\n" + " (declare (in ) vec2 Nref@0x13ed530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x2230140)\n" - " (declare (in ) vec3 I@0x2230250)\n" - " (declare (in ) vec3 Nref@0x2230360)\n" + " (declare (in ) vec3 N@0x13ed710)\n" + " (declare (in ) vec3 I@0x13ed820)\n" + " (declare (in ) vec3 Nref@0x13ed930)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x2230540)\n" - " (declare (in ) vec4 I@0x2230650)\n" - " (declare (in ) vec4 Nref@0x2230760)\n" + " (declare (in ) vec4 N@0x13edb10)\n" + " (declare (in ) vec4 I@0x13edc20)\n" + " (declare (in ) vec4 Nref@0x13edd30)\n" " )\n" " (\n" " ))\n" @@ -5999,32 +5999,32 @@ static const char *prototypes_for_120_vert = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x2230940)\n" - " (declare (in ) float N@0x2230a50)\n" + " (declare (in ) float I@0x13edf10)\n" + " (declare (in ) float N@0x13ee020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x2230e10)\n" - " (declare (in ) vec2 N@0x2230f20)\n" + " (declare (in ) vec2 I@0x13ee3a0)\n" + " (declare (in ) vec2 N@0x13ee4b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x2231100)\n" - " (declare (in ) vec3 N@0x2231210)\n" + " (declare (in ) vec3 I@0x13ee690)\n" + " (declare (in ) vec3 N@0x13ee7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x22313f0)\n" - " (declare (in ) vec4 N@0x2231500)\n" + " (declare (in ) vec4 I@0x13ee980)\n" + " (declare (in ) vec4 N@0x13eea90)\n" " )\n" " (\n" " ))\n" @@ -6034,36 +6034,36 @@ static const char *prototypes_for_120_vert = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x22316e0)\n" - " (declare (in ) float N@0x22317f0)\n" - " (declare (in ) float eta@0x2231900)\n" + " (declare (in ) float I@0x13eec70)\n" + " (declare (in ) float N@0x13eed80)\n" + " (declare (in ) float eta@0x13eee90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x2231cc0)\n" - " (declare (in ) vec2 N@0x2231dd0)\n" - " (declare (in ) float eta@0x2231ee0)\n" + " (declare (in ) vec2 I@0x13ef210)\n" + " (declare (in ) vec2 N@0x13ef320)\n" + " (declare (in ) float eta@0x13ef430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x22320c0)\n" - " (declare (in ) vec3 N@0x22321d0)\n" - " (declare (in ) float eta@0x22322e0)\n" + " (declare (in ) vec3 I@0x13ef610)\n" + " (declare (in ) vec3 N@0x13ef720)\n" + " (declare (in ) float eta@0x13ef830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x22324c0)\n" - " (declare (in ) vec4 N@0x22325d0)\n" - " (declare (in ) float eta@0x22326e0)\n" + " (declare (in ) vec4 I@0x13efa10)\n" + " (declare (in ) vec4 N@0x13efb20)\n" + " (declare (in ) float eta@0x13efc30)\n" " )\n" " (\n" " ))\n" @@ -6073,72 +6073,72 @@ static const char *prototypes_for_120_vert = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x22328c0)\n" - " (declare (in ) mat2 y@0x22329d0)\n" + " (declare (in ) mat2 x@0x13efe10)\n" + " (declare (in ) mat2 y@0x13eff20)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x2232d90)\n" - " (declare (in ) mat3 y@0x2232ea0)\n" + " (declare (in ) mat3 x@0x13f02b0)\n" + " (declare (in ) mat3 y@0x13f03c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x2233080)\n" - " (declare (in ) mat4 y@0x2233190)\n" + " (declare (in ) mat4 x@0x13f05a0)\n" + " (declare (in ) mat4 y@0x13f06b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x2233370)\n" - " (declare (in ) mat2x3 y@0x2233480)\n" + " (declare (in ) mat2x3 x@0x13f0890)\n" + " (declare (in ) mat2x3 y@0x13f09a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x2233660)\n" - " (declare (in ) mat2x4 y@0x2233770)\n" + " (declare (in ) mat2x4 x@0x13f0b80)\n" + " (declare (in ) mat2x4 y@0x13f0c90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x2233950)\n" - " (declare (in ) mat3x2 y@0x2233a60)\n" + " (declare (in ) mat3x2 x@0x13f0e70)\n" + " (declare (in ) mat3x2 y@0x13f0f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x2233c40)\n" - " (declare (in ) mat3x4 y@0x2233d50)\n" + " (declare (in ) mat3x4 x@0x13f1160)\n" + " (declare (in ) mat3x4 y@0x13f1270)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x2233f30)\n" - " (declare (in ) mat4x2 y@0x2234040)\n" + " (declare (in ) mat4x2 x@0x13f1450)\n" + " (declare (in ) mat4x2 y@0x13f1560)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x2234220)\n" - " (declare (in ) mat4x3 y@0x2234330)\n" + " (declare (in ) mat4x3 x@0x13f1740)\n" + " (declare (in ) mat4x3 y@0x13f1850)\n" " )\n" " (\n" " ))\n" @@ -6148,72 +6148,72 @@ static const char *prototypes_for_120_vert = "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x2234510)\n" - " (declare (in ) vec2 r@0x2234620)\n" + " (declare (in ) vec2 c@0x13f1a30)\n" + " (declare (in ) vec2 r@0x13f1b40)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x22349e0)\n" - " (declare (in ) vec3 r@0x2234af0)\n" + " (declare (in ) vec3 c@0x13f1ed0)\n" + " (declare (in ) vec3 r@0x13f1fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x2234cd0)\n" - " (declare (in ) vec4 r@0x2234de0)\n" + " (declare (in ) vec4 c@0x13f21c0)\n" + " (declare (in ) vec4 r@0x13f22d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x2234fc0)\n" - " (declare (in ) vec2 r@0x22350d0)\n" + " (declare (in ) vec3 c@0x13f24b0)\n" + " (declare (in ) vec2 r@0x13f25c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x22352b0)\n" - " (declare (in ) vec3 r@0x22353c0)\n" + " (declare (in ) vec2 c@0x13f27a0)\n" + " (declare (in ) vec3 r@0x13f28b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x22355a0)\n" - " (declare (in ) vec2 r@0x22356b0)\n" + " (declare (in ) vec4 c@0x13f2a90)\n" + " (declare (in ) vec2 r@0x13f2ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x2235890)\n" - " (declare (in ) vec4 r@0x22359a0)\n" + " (declare (in ) vec2 c@0x13f2d80)\n" + " (declare (in ) vec4 r@0x13f2e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x2235b80)\n" - " (declare (in ) vec3 r@0x2235c90)\n" + " (declare (in ) vec4 c@0x13f3070)\n" + " (declare (in ) vec3 r@0x13f3180)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x2235e70)\n" - " (declare (in ) vec4 r@0x2235f80)\n" + " (declare (in ) vec3 c@0x13f3360)\n" + " (declare (in ) vec4 r@0x13f3470)\n" " )\n" " (\n" " ))\n" @@ -6223,63 +6223,63 @@ static const char *prototypes_for_120_vert = "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x2236160)\n" + " (declare (in ) mat2 m@0x13f3650)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x2236520)\n" + " (declare (in ) mat3 m@0x13f39e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x2236700)\n" + " (declare (in ) mat4 m@0x13f3bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x22368e0)\n" + " (declare (in ) mat3x2 m@0x13f3da0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x2236ac0)\n" + " (declare (in ) mat2x3 m@0x13f3f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x2236ca0)\n" + " (declare (in ) mat4x2 m@0x13f4160)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x2236e80)\n" + " (declare (in ) mat2x4 m@0x13f4340)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x2237060)\n" + " (declare (in ) mat4x3 m@0x13f4520)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x2237240)\n" + " (declare (in ) mat3x4 m@0x13f4700)\n" " )\n" " (\n" " ))\n" @@ -6289,48 +6289,48 @@ static const char *prototypes_for_120_vert = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2237420)\n" - " (declare (in ) vec2 y@0x2237530)\n" + " (declare (in ) vec2 x@0x13f48e0)\n" + " (declare (in ) vec2 y@0x13f49f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x22378f0)\n" - " (declare (in ) vec3 y@0x2237a00)\n" + " (declare (in ) vec3 x@0x13f4d80)\n" + " (declare (in ) vec3 y@0x13f4e90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2237be0)\n" - " (declare (in ) vec4 y@0x2237cf0)\n" + " (declare (in ) vec4 x@0x13f5070)\n" + " (declare (in ) vec4 y@0x13f5180)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x2237ed0)\n" - " (declare (in ) ivec2 y@0x2237fe0)\n" + " (declare (in ) ivec2 x@0x13f5360)\n" + " (declare (in ) ivec2 y@0x13f5470)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x22381c0)\n" - " (declare (in ) ivec3 y@0x22382d0)\n" + " (declare (in ) ivec3 x@0x13f5650)\n" + " (declare (in ) ivec3 y@0x13f5760)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x22384b0)\n" - " (declare (in ) ivec4 y@0x22385c0)\n" + " (declare (in ) ivec4 x@0x13f5940)\n" + " (declare (in ) ivec4 y@0x13f5a50)\n" " )\n" " (\n" " ))\n" @@ -6340,48 +6340,48 @@ static const char *prototypes_for_120_vert = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x22387a0)\n" - " (declare (in ) vec2 y@0x22388b0)\n" + " (declare (in ) vec2 x@0x13f5c30)\n" + " (declare (in ) vec2 y@0x13f5d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2238c70)\n" - " (declare (in ) vec3 y@0x2238d80)\n" + " (declare (in ) vec3 x@0x13f60d0)\n" + " (declare (in ) vec3 y@0x13f61e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x2238f60)\n" - " (declare (in ) vec4 y@0x2239070)\n" + " (declare (in ) vec4 x@0x13f63c0)\n" + " (declare (in ) vec4 y@0x13f64d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x2239250)\n" - " (declare (in ) ivec2 y@0x2239360)\n" + " (declare (in ) ivec2 x@0x13f66b0)\n" + " (declare (in ) ivec2 y@0x13f67c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x2239540)\n" - " (declare (in ) ivec3 y@0x2239650)\n" + " (declare (in ) ivec3 x@0x13f69a0)\n" + " (declare (in ) ivec3 y@0x13f6ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x2239830)\n" - " (declare (in ) ivec4 y@0x2239940)\n" + " (declare (in ) ivec4 x@0x13f6c90)\n" + " (declare (in ) ivec4 y@0x13f6da0)\n" " )\n" " (\n" " ))\n" @@ -6391,48 +6391,48 @@ static const char *prototypes_for_120_vert = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x2239b20)\n" - " (declare (in ) vec2 y@0x2239c30)\n" + " (declare (in ) vec2 x@0x13f6f80)\n" + " (declare (in ) vec2 y@0x13f7090)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x2239ff0)\n" - " (declare (in ) vec3 y@0x223a100)\n" + " (declare (in ) vec3 x@0x13f7420)\n" + " (declare (in ) vec3 y@0x13f7530)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x223a2e0)\n" - " (declare (in ) vec4 y@0x223a3f0)\n" + " (declare (in ) vec4 x@0x13f7710)\n" + " (declare (in ) vec4 y@0x13f7820)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x223a5d0)\n" - " (declare (in ) ivec2 y@0x223a6e0)\n" + " (declare (in ) ivec2 x@0x13f7a00)\n" + " (declare (in ) ivec2 y@0x13f7b10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x223a8c0)\n" - " (declare (in ) ivec3 y@0x223a9d0)\n" + " (declare (in ) ivec3 x@0x13f7cf0)\n" + " (declare (in ) ivec3 y@0x13f7e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x223abb0)\n" - " (declare (in ) ivec4 y@0x223acc0)\n" + " (declare (in ) ivec4 x@0x13f7fe0)\n" + " (declare (in ) ivec4 y@0x13f80f0)\n" " )\n" " (\n" " ))\n" @@ -6442,48 +6442,48 @@ static const char *prototypes_for_120_vert = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x223aea0)\n" - " (declare (in ) vec2 y@0x223afb0)\n" + " (declare (in ) vec2 x@0x13f82d0)\n" + " (declare (in ) vec2 y@0x13f83e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x223b370)\n" - " (declare (in ) vec3 y@0x223b480)\n" + " (declare (in ) vec3 x@0x13f8770)\n" + " (declare (in ) vec3 y@0x13f8880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x223b660)\n" - " (declare (in ) vec4 y@0x223b770)\n" + " (declare (in ) vec4 x@0x13f8a60)\n" + " (declare (in ) vec4 y@0x13f8b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x223b950)\n" - " (declare (in ) ivec2 y@0x223ba60)\n" + " (declare (in ) ivec2 x@0x13f8d50)\n" + " (declare (in ) ivec2 y@0x13f8e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x223bc40)\n" - " (declare (in ) ivec3 y@0x223bd50)\n" + " (declare (in ) ivec3 x@0x13f9040)\n" + " (declare (in ) ivec3 y@0x13f9150)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x223bf30)\n" - " (declare (in ) ivec4 y@0x223c040)\n" + " (declare (in ) ivec4 x@0x13f9330)\n" + " (declare (in ) ivec4 y@0x13f9440)\n" " )\n" " (\n" " ))\n" @@ -6493,72 +6493,72 @@ static const char *prototypes_for_120_vert = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x223c220)\n" - " (declare (in ) vec2 y@0x223c330)\n" + " (declare (in ) vec2 x@0x13f9620)\n" + " (declare (in ) vec2 y@0x13f9730)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x223c6e0)\n" - " (declare (in ) vec3 y@0x223c7f0)\n" + " (declare (in ) vec3 x@0x13f9ab0)\n" + " (declare (in ) vec3 y@0x13f9bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x223c9d0)\n" - " (declare (in ) vec4 y@0x223cae0)\n" + " (declare (in ) vec4 x@0x13f9da0)\n" + " (declare (in ) vec4 y@0x13f9eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x223ccc0)\n" - " (declare (in ) ivec2 y@0x223cdd0)\n" + " (declare (in ) ivec2 x@0x13fa090)\n" + " (declare (in ) ivec2 y@0x13fa1a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x223cfb0)\n" - " (declare (in ) ivec3 y@0x223d0c0)\n" + " (declare (in ) ivec3 x@0x13fa380)\n" + " (declare (in ) ivec3 y@0x13fa490)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x223d2a0)\n" - " (declare (in ) ivec4 y@0x223d3b0)\n" + " (declare (in ) ivec4 x@0x13fa670)\n" + " (declare (in ) ivec4 y@0x13fa780)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x223d590)\n" - " (declare (in ) bvec2 y@0x223d6a0)\n" + " (declare (in ) bvec2 x@0x13fa960)\n" + " (declare (in ) bvec2 y@0x13faa70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x223d880)\n" - " (declare (in ) bvec3 y@0x223d990)\n" + " (declare (in ) bvec3 x@0x13fac50)\n" + " (declare (in ) bvec3 y@0x13fad60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x223db70)\n" - " (declare (in ) bvec4 y@0x223dc80)\n" + " (declare (in ) bvec4 x@0x13faf40)\n" + " (declare (in ) bvec4 y@0x13fb050)\n" " )\n" " (\n" " ))\n" @@ -6568,72 +6568,72 @@ static const char *prototypes_for_120_vert = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x223de60)\n" - " (declare (in ) vec2 y@0x223df70)\n" + " (declare (in ) vec2 x@0x13fb230)\n" + " (declare (in ) vec2 y@0x13fb340)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x223e330)\n" - " (declare (in ) vec3 y@0x223e440)\n" + " (declare (in ) vec3 x@0x13fb6d0)\n" + " (declare (in ) vec3 y@0x13fb7e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x223e620)\n" - " (declare (in ) vec4 y@0x223e730)\n" + " (declare (in ) vec4 x@0x13fb9c0)\n" + " (declare (in ) vec4 y@0x13fbad0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x223e910)\n" - " (declare (in ) ivec2 y@0x223ea20)\n" + " (declare (in ) ivec2 x@0x13fbcb0)\n" + " (declare (in ) ivec2 y@0x13fbdc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x223ec00)\n" - " (declare (in ) ivec3 y@0x223ed10)\n" + " (declare (in ) ivec3 x@0x13fbfa0)\n" + " (declare (in ) ivec3 y@0x13fc0b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x223eef0)\n" - " (declare (in ) ivec4 y@0x223f000)\n" + " (declare (in ) ivec4 x@0x13fc290)\n" + " (declare (in ) ivec4 y@0x13fc3a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x223f1e0)\n" - " (declare (in ) bvec2 y@0x223f2f0)\n" + " (declare (in ) bvec2 x@0x13fc580)\n" + " (declare (in ) bvec2 y@0x13fc690)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x223f4d0)\n" - " (declare (in ) bvec3 y@0x223f5e0)\n" + " (declare (in ) bvec3 x@0x13fc870)\n" + " (declare (in ) bvec3 y@0x13fc980)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x223f7c0)\n" - " (declare (in ) bvec4 y@0x223f8d0)\n" + " (declare (in ) bvec4 x@0x13fcb60)\n" + " (declare (in ) bvec4 y@0x13fcc70)\n" " )\n" " (\n" " ))\n" @@ -6643,21 +6643,21 @@ static const char *prototypes_for_120_vert = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x223fab0)\n" + " (declare (in ) bvec2 x@0x13fce50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x223fe60)\n" + " (declare (in ) bvec3 x@0x13fd1d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x2240040)\n" + " (declare (in ) bvec4 x@0x13fd3b0)\n" " )\n" " (\n" " ))\n" @@ -6667,21 +6667,21 @@ static const char *prototypes_for_120_vert = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x2240220)\n" + " (declare (in ) bvec2 x@0x13fd590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x22405d0)\n" + " (declare (in ) bvec3 x@0x13fd910)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x22407b0)\n" + " (declare (in ) bvec4 x@0x13fdaf0)\n" " )\n" " (\n" " ))\n" @@ -6691,21 +6691,21 @@ static const char *prototypes_for_120_vert = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x2240990)\n" + " (declare (in ) bvec2 x@0x13fdcd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x2240d40)\n" + " (declare (in ) bvec3 x@0x13fe050)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x2240f20)\n" + " (declare (in ) bvec4 x@0x13fe230)\n" " )\n" " (\n" " ))\n" @@ -6715,8 +6715,8 @@ static const char *prototypes_for_120_vert = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x2241100)\n" - " (declare (in ) float coord@0x2241220)\n" + " (declare (in ) sampler1D sampler@0x13fe410)\n" + " (declare (in ) float coord@0x13fe520)\n" " )\n" " (\n" " ))\n" @@ -6726,16 +6726,16 @@ static const char *prototypes_for_120_vert = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x22415e0)\n" - " (declare (in ) vec2 coord@0x2241700)\n" + " (declare (in ) sampler1D sampler@0x13fe8b0)\n" + " (declare (in ) vec2 coord@0x13fe9c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x2241ac0)\n" - " (declare (in ) vec4 coord@0x2241be0)\n" + " (declare (in ) sampler1D sampler@0x13fed50)\n" + " (declare (in ) vec4 coord@0x13fee60)\n" " )\n" " (\n" " ))\n" @@ -6745,9 +6745,9 @@ static const char *prototypes_for_120_vert = "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x2241dc0)\n" - " (declare (in ) float coord@0x2241ee0)\n" - " (declare (in ) float lod@0x2241ff0)\n" + " (declare (in ) sampler1D sampler@0x13ff040)\n" + " (declare (in ) float coord@0x13ff150)\n" + " (declare (in ) float lod@0x13ff260)\n" " )\n" " (\n" " ))\n" @@ -6757,18 +6757,18 @@ static const char *prototypes_for_120_vert = "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x22423b0)\n" - " (declare (in ) vec2 coord@0x22424d0)\n" - " (declare (in ) float lod@0x22425e0)\n" + " (declare (in ) sampler1D sampler@0x13ff5f0)\n" + " (declare (in ) vec2 coord@0x13ff700)\n" + " (declare (in ) float lod@0x13ff810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x22429a0)\n" - " (declare (in ) vec4 coord@0x2242ac0)\n" - " (declare (in ) float lod@0x2242bd0)\n" + " (declare (in ) sampler1D sampler@0x13ffba0)\n" + " (declare (in ) vec4 coord@0x13ffcb0)\n" + " (declare (in ) float lod@0x13ffdc0)\n" " )\n" " (\n" " ))\n" @@ -6778,8 +6778,8 @@ static const char *prototypes_for_120_vert = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2242db0)\n" - " (declare (in ) vec2 coord@0x2242ed0)\n" + " (declare (in ) sampler2D sampler@0x13fffa0)\n" + " (declare (in ) vec2 coord@0x14000b0)\n" " )\n" " (\n" " ))\n" @@ -6789,16 +6789,16 @@ static const char *prototypes_for_120_vert = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2243290)\n" - " (declare (in ) vec3 coord@0x22433b0)\n" + " (declare (in ) sampler2D sampler@0x1400440)\n" + " (declare (in ) vec3 coord@0x1400550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2243770)\n" - " (declare (in ) vec4 coord@0x2243890)\n" + " (declare (in ) sampler2D sampler@0x14008e0)\n" + " (declare (in ) vec4 coord@0x14009f0)\n" " )\n" " (\n" " ))\n" @@ -6808,9 +6808,9 @@ static const char *prototypes_for_120_vert = "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2243a70)\n" - " (declare (in ) vec2 coord@0x2243b90)\n" - " (declare (in ) float lod@0x2243ca0)\n" + " (declare (in ) sampler2D sampler@0x1400bd0)\n" + " (declare (in ) vec2 coord@0x1400ce0)\n" + " (declare (in ) float lod@0x1400df0)\n" " )\n" " (\n" " ))\n" @@ -6820,18 +6820,18 @@ static const char *prototypes_for_120_vert = "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2244060)\n" - " (declare (in ) vec3 coord@0x2244180)\n" - " (declare (in ) float lod@0x2244290)\n" + " (declare (in ) sampler2D sampler@0x1401180)\n" + " (declare (in ) vec3 coord@0x1401290)\n" + " (declare (in ) float lod@0x14013a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x2244650)\n" - " (declare (in ) vec4 coord@0x2244770)\n" - " (declare (in ) float lod@0x2244880)\n" + " (declare (in ) sampler2D sampler@0x1401730)\n" + " (declare (in ) vec4 coord@0x1401840)\n" + " (declare (in ) float lod@0x1401950)\n" " )\n" " (\n" " ))\n" @@ -6841,8 +6841,8 @@ static const char *prototypes_for_120_vert = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2244a60)\n" - " (declare (in ) vec3 coord@0x2244b80)\n" + " (declare (in ) sampler3D sampler@0x1401b30)\n" + " (declare (in ) vec3 coord@0x1401c40)\n" " )\n" " (\n" " ))\n" @@ -6852,8 +6852,8 @@ static const char *prototypes_for_120_vert = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2244f40)\n" - " (declare (in ) vec4 coord@0x2245060)\n" + " (declare (in ) sampler3D sampler@0x1401fd0)\n" + " (declare (in ) vec4 coord@0x14020e0)\n" " )\n" " (\n" " ))\n" @@ -6863,9 +6863,9 @@ static const char *prototypes_for_120_vert = "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2245420)\n" - " (declare (in ) vec3 coord@0x2245540)\n" - " (declare (in ) float lod@0x2245650)\n" + " (declare (in ) sampler3D sampler@0x1402470)\n" + " (declare (in ) vec3 coord@0x1402580)\n" + " (declare (in ) float lod@0x1402690)\n" " )\n" " (\n" " ))\n" @@ -6875,9 +6875,9 @@ static const char *prototypes_for_120_vert = "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x2245a10)\n" - " (declare (in ) vec4 coord@0x2245b30)\n" - " (declare (in ) float lod@0x2245c40)\n" + " (declare (in ) sampler3D sampler@0x1402a20)\n" + " (declare (in ) vec4 coord@0x1402b30)\n" + " (declare (in ) float lod@0x1402c40)\n" " )\n" " (\n" " ))\n" @@ -6887,8 +6887,8 @@ static const char *prototypes_for_120_vert = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x2246000)\n" - " (declare (in ) vec3 coord@0x2246120)\n" + " (declare (in ) samplerCube sampler@0x1402fd0)\n" + " (declare (in ) vec3 coord@0x14030e0)\n" " )\n" " (\n" " ))\n" @@ -6898,9 +6898,9 @@ static const char *prototypes_for_120_vert = "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x22464e0)\n" - " (declare (in ) vec3 coord@0x2246600)\n" - " (declare (in ) float lod@0x2246710)\n" + " (declare (in ) samplerCube sampler@0x1403470)\n" + " (declare (in ) vec3 coord@0x1403580)\n" + " (declare (in ) float lod@0x1403690)\n" " )\n" " (\n" " ))\n" @@ -6910,8 +6910,8 @@ static const char *prototypes_for_120_vert = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x2246ad0)\n" - " (declare (in ) vec3 coord@0x2246bf0)\n" + " (declare (in ) sampler1DShadow sampler@0x1403a20)\n" + " (declare (in ) vec3 coord@0x1403b30)\n" " )\n" " (\n" " ))\n" @@ -6921,8 +6921,8 @@ static const char *prototypes_for_120_vert = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2246fb0)\n" - " (declare (in ) vec3 coord@0x22470d0)\n" + " (declare (in ) sampler2DShadow sampler@0x1403ec0)\n" + " (declare (in ) vec3 coord@0x1403fd0)\n" " )\n" " (\n" " ))\n" @@ -6932,8 +6932,8 @@ static const char *prototypes_for_120_vert = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x2247490)\n" - " (declare (in ) vec4 coord@0x22475b0)\n" + " (declare (in ) sampler1DShadow sampler@0x1404360)\n" + " (declare (in ) vec4 coord@0x1404470)\n" " )\n" " (\n" " ))\n" @@ -6943,8 +6943,8 @@ static const char *prototypes_for_120_vert = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2247970)\n" - " (declare (in ) vec4 coord@0x2247a90)\n" + " (declare (in ) sampler2DShadow sampler@0x1404800)\n" + " (declare (in ) vec4 coord@0x1404910)\n" " )\n" " (\n" " ))\n" @@ -6954,9 +6954,9 @@ static const char *prototypes_for_120_vert = "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x2247e50)\n" - " (declare (in ) vec3 coord@0x2247f70)\n" - " (declare (in ) float lod@0x2248080)\n" + " (declare (in ) sampler1DShadow sampler@0x1404ca0)\n" + " (declare (in ) vec3 coord@0x1404db0)\n" + " (declare (in ) float lod@0x1404ec0)\n" " )\n" " (\n" " ))\n" @@ -6966,9 +6966,9 @@ static const char *prototypes_for_120_vert = "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2248440)\n" - " (declare (in ) vec3 coord@0x2248560)\n" - " (declare (in ) float lod@0x2248670)\n" + " (declare (in ) sampler2DShadow sampler@0x1405250)\n" + " (declare (in ) vec3 coord@0x1405360)\n" + " (declare (in ) float lod@0x1405470)\n" " )\n" " (\n" " ))\n" @@ -6978,9 +6978,9 @@ static const char *prototypes_for_120_vert = "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x2248a30)\n" - " (declare (in ) vec4 coord@0x2248b50)\n" - " (declare (in ) float lod@0x2248c60)\n" + " (declare (in ) sampler1DShadow sampler@0x1405800)\n" + " (declare (in ) vec4 coord@0x1405910)\n" + " (declare (in ) float lod@0x1405a20)\n" " )\n" " (\n" " ))\n" @@ -6990,9 +6990,9 @@ static const char *prototypes_for_120_vert = "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x2249020)\n" - " (declare (in ) vec4 coord@0x2249140)\n" - " (declare (in ) float lod@0x2249250)\n" + " (declare (in ) sampler2DShadow sampler@0x1405db0)\n" + " (declare (in ) vec4 coord@0x1405ec0)\n" + " (declare (in ) float lod@0x1405fd0)\n" " )\n" " (\n" " ))\n" @@ -7002,28 +7002,28 @@ static const char *prototypes_for_120_vert = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x2249610)\n" + " (declare (in ) float x@0x1406360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x22499c0)\n" + " (declare (in ) vec2 x@0x14066e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x2249ba0)\n" + " (declare (in ) vec3 x@0x14068c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x2249d80)\n" + " (declare (in ) vec4 x@0x1406aa0)\n" " )\n" " (\n" " ))\n" @@ -7033,28 +7033,28 @@ static const char *prototypes_for_120_vert = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x2249f60)\n" + " (declare (in ) float x@0x1406c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x224a310)\n" + " (declare (in ) vec2 x@0x1407000)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x224a4f0)\n" + " (declare (in ) vec3 x@0x14071e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x224a6d0)\n" + " (declare (in ) vec4 x@0x14073c0)\n" " )\n" " (\n" " ))\n" @@ -7064,28 +7064,28 @@ static const char *prototypes_for_120_vert = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x224a8b0)\n" + " (declare (in ) float x@0x14075a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x224ac60)\n" + " (declare (in ) vec2 x@0x1407920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x224ae40)\n" + " (declare (in ) vec3 x@0x1407b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x224b020)\n" + " (declare (in ) vec4 x@0x1407ce0)\n" " )\n" " (\n" " ))\n" @@ -7095,28 +7095,28 @@ static const char *prototypes_for_120_vert = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x224b200)\n" + " (declare (in ) float x@0x1407ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x224b5b0)\n" + " (declare (in ) vec2 x@0x1408240)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x224b790)\n" + " (declare (in ) vec3 x@0x1408420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x224b970)\n" + " (declare (in ) vec4 x@0x1408600)\n" " )\n" " (\n" " ))\n" @@ -7207,17 +7207,17 @@ static const char *prototypes_for_EXT_texture_array_frag = "(function texture1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xb9bd60)\n" - " (declare (in ) vec2 coord@0xb9be80)\n" + " (declare (in ) sampler1DArray sampler@0xbe3bd0)\n" + " (declare (in ) vec2 coord@0xbe3ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xb9c240)\n" - " (declare (in ) vec2 coord@0xb9c360)\n" - " (declare (in ) float bias@0xb9c470)\n" + " (declare (in ) sampler1DArray sampler@0xbe4070)\n" + " (declare (in ) vec2 coord@0xbe4180)\n" + " (declare (in ) float bias@0xbe4290)\n" " )\n" " (\n" " ))\n" @@ -7227,17 +7227,17 @@ static const char *prototypes_for_EXT_texture_array_frag = "(function texture2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xb9c650)\n" - " (declare (in ) vec2 coord@0xb9c770)\n" + " (declare (in ) sampler1DArray sampler@0xbe4470)\n" + " (declare (in ) vec2 coord@0xbe4580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0xb9cb30)\n" - " (declare (in ) vec2 coord@0xb9cc50)\n" - " (declare (in ) float bias@0xb9cd60)\n" + " (declare (in ) sampler1DArray sampler@0xbe4910)\n" + " (declare (in ) vec2 coord@0xbe4a20)\n" + " (declare (in ) float bias@0xbe4b30)\n" " )\n" " (\n" " ))\n" @@ -7247,17 +7247,17 @@ static const char *prototypes_for_EXT_texture_array_frag = "(function shadow1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0xb9cf40)\n" - " (declare (in ) vec3 coord@0xb9d060)\n" + " (declare (in ) sampler1DArrayShadow sampler@0xbe4d10)\n" + " (declare (in ) vec3 coord@0xbe4e20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0xb9d420)\n" - " (declare (in ) vec3 coord@0xb9d540)\n" - " (declare (in ) float bias@0xb9d650)\n" + " (declare (in ) sampler1DArrayShadow sampler@0xbe51b0)\n" + " (declare (in ) vec3 coord@0xbe52c0)\n" + " (declare (in ) float bias@0xbe53d0)\n" " )\n" " (\n" " ))\n" @@ -7267,8 +7267,8 @@ static const char *prototypes_for_EXT_texture_array_frag = "(function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0xb9d830)\n" - " (declare (in ) vec4 coord@0xb9d950)\n" + " (declare (in ) sampler2DArrayShadow sampler@0xbe55b0)\n" + " (declare (in ) vec4 coord@0xbe56c0)\n" " )\n" " (\n" " ))\n" @@ -7289,28 +7289,28 @@ static const char *prototypes_for_110_vert = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x9e3c50)\n" + " (declare (in ) float degrees@0x1aa51c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x9e4020)\n" + " (declare (in ) vec2 degrees@0x1aa5540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x9e4210)\n" + " (declare (in ) vec3 degrees@0x1aa5720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x9e4400)\n" + " (declare (in ) vec4 degrees@0x1aa5900)\n" " )\n" " (\n" " ))\n" @@ -7320,28 +7320,28 @@ static const char *prototypes_for_110_vert = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x9e45f0)\n" + " (declare (in ) float radians@0x1aa5ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x9e49c0)\n" + " (declare (in ) vec2 radians@0x1aa5e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x9e4bb0)\n" + " (declare (in ) vec3 radians@0x1aa6040)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x9e4da0)\n" + " (declare (in ) vec4 radians@0x1aa6220)\n" " )\n" " (\n" " ))\n" @@ -7351,28 +7351,28 @@ static const char *prototypes_for_110_vert = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x9e4f90)\n" + " (declare (in ) float angle@0x1aa6400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x9e5340)\n" + " (declare (in ) vec2 angle@0x1aa6780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x9e5520)\n" + " (declare (in ) vec3 angle@0x1aa6960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x9e5700)\n" + " (declare (in ) vec4 angle@0x1aa6b40)\n" " )\n" " (\n" " ))\n" @@ -7382,28 +7382,28 @@ static const char *prototypes_for_110_vert = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x9e58e0)\n" + " (declare (in ) float angle@0x1aa6d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x9e5c90)\n" + " (declare (in ) vec2 angle@0x1aa70a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x9e5e70)\n" + " (declare (in ) vec3 angle@0x1aa7280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x9e6050)\n" + " (declare (in ) vec4 angle@0x1aa7460)\n" " )\n" " (\n" " ))\n" @@ -7413,28 +7413,28 @@ static const char *prototypes_for_110_vert = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x9e6230)\n" + " (declare (in ) float angle@0x1aa7640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x9e65e0)\n" + " (declare (in ) vec2 angle@0x1aa79c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x9e67c0)\n" + " (declare (in ) vec3 angle@0x1aa7ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x9e69a0)\n" + " (declare (in ) vec4 angle@0x1aa7d80)\n" " )\n" " (\n" " ))\n" @@ -7444,28 +7444,28 @@ static const char *prototypes_for_110_vert = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x9e6b80)\n" + " (declare (in ) float angle@0x1aa7f60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x9e6f30)\n" + " (declare (in ) vec2 angle@0x1aa82e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x9e7110)\n" + " (declare (in ) vec3 angle@0x1aa84c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x9e72f0)\n" + " (declare (in ) vec4 angle@0x1aa86a0)\n" " )\n" " (\n" " ))\n" @@ -7475,28 +7475,28 @@ static const char *prototypes_for_110_vert = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x9e74d0)\n" + " (declare (in ) float angle@0x1aa8880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x9e7880)\n" + " (declare (in ) vec2 angle@0x1aa8c00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x9e7a60)\n" + " (declare (in ) vec3 angle@0x1aa8de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x9e7c40)\n" + " (declare (in ) vec4 angle@0x1aa8fc0)\n" " )\n" " (\n" " ))\n" @@ -7506,60 +7506,60 @@ static const char *prototypes_for_110_vert = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x9e7e20)\n" - " (declare (in ) float x@0x9e7f30)\n" + " (declare (in ) float y@0x1aa91a0)\n" + " (declare (in ) float x@0x1aa92b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x9e82e0)\n" - " (declare (in ) vec2 x@0x9e83f0)\n" + " (declare (in ) vec2 y@0x1aa9630)\n" + " (declare (in ) vec2 x@0x1aa9740)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x9e85d0)\n" - " (declare (in ) vec3 x@0x9e86e0)\n" + " (declare (in ) vec3 y@0x1aa9920)\n" + " (declare (in ) vec3 x@0x1aa9a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x9e88c0)\n" - " (declare (in ) vec4 x@0x9e89d0)\n" + " (declare (in ) vec4 y@0x1aa9c10)\n" + " (declare (in ) vec4 x@0x1aa9d20)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x9e8bb0)\n" + " (declare (in ) float y_over_x@0x1aa9f00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x9e8da0)\n" + " (declare (in ) vec2 y_over_x@0x1aaa0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x9e8f90)\n" + " (declare (in ) vec3 y_over_x@0x1aaa2e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x9e9180)\n" + " (declare (in ) vec4 y_over_x@0x1aaa4d0)\n" " )\n" " (\n" " ))\n" @@ -7569,32 +7569,32 @@ static const char *prototypes_for_110_vert = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9e9370)\n" - " (declare (in ) float y@0x9e9480)\n" + " (declare (in ) float x@0x1aaa6c0)\n" + " (declare (in ) float y@0x1aaa7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9e9830)\n" - " (declare (in ) vec2 y@0x9e9940)\n" + " (declare (in ) vec2 x@0x1aaab50)\n" + " (declare (in ) vec2 y@0x1aaac60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9e9b20)\n" - " (declare (in ) vec3 y@0x9e9c30)\n" + " (declare (in ) vec3 x@0x1aaae40)\n" + " (declare (in ) vec3 y@0x1aaaf50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9e9e10)\n" - " (declare (in ) vec4 y@0x9e9f20)\n" + " (declare (in ) vec4 x@0x1aab130)\n" + " (declare (in ) vec4 y@0x1aab240)\n" " )\n" " (\n" " ))\n" @@ -7604,28 +7604,28 @@ static const char *prototypes_for_110_vert = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ea100)\n" + " (declare (in ) float x@0x1aab420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ea4b0)\n" + " (declare (in ) vec2 x@0x1aab7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ea690)\n" + " (declare (in ) vec3 x@0x1aab980)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ea870)\n" + " (declare (in ) vec4 x@0x1aabb60)\n" " )\n" " (\n" " ))\n" @@ -7635,28 +7635,28 @@ static const char *prototypes_for_110_vert = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9eaa50)\n" + " (declare (in ) float x@0x1aabd40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9eae00)\n" + " (declare (in ) vec2 x@0x1aac0c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9eafe0)\n" + " (declare (in ) vec3 x@0x1aac2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9eb1c0)\n" + " (declare (in ) vec4 x@0x1aac480)\n" " )\n" " (\n" " ))\n" @@ -7666,28 +7666,28 @@ static const char *prototypes_for_110_vert = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9eb3a0)\n" + " (declare (in ) float x@0x1aac660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9eb750)\n" + " (declare (in ) vec2 x@0x1aac9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9eb930)\n" + " (declare (in ) vec3 x@0x1aacbc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ebb10)\n" + " (declare (in ) vec4 x@0x1aacda0)\n" " )\n" " (\n" " ))\n" @@ -7697,28 +7697,28 @@ static const char *prototypes_for_110_vert = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ebcf0)\n" + " (declare (in ) float x@0x1aacf80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ec0a0)\n" + " (declare (in ) vec2 x@0x1aad300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ec280)\n" + " (declare (in ) vec3 x@0x1aad4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ec460)\n" + " (declare (in ) vec4 x@0x1aad6c0)\n" " )\n" " (\n" " ))\n" @@ -7728,28 +7728,28 @@ static const char *prototypes_for_110_vert = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ec640)\n" + " (declare (in ) float x@0x1aad8a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ec9f0)\n" + " (declare (in ) vec2 x@0x1aadc20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ecbd0)\n" + " (declare (in ) vec3 x@0x1aade00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ecdb0)\n" + " (declare (in ) vec4 x@0x1aadfe0)\n" " )\n" " (\n" " ))\n" @@ -7759,28 +7759,28 @@ static const char *prototypes_for_110_vert = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ecf90)\n" + " (declare (in ) float x@0x1aae1c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ed350)\n" + " (declare (in ) vec2 x@0x1aae550)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ed530)\n" + " (declare (in ) vec3 x@0x1aae730)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ed710)\n" + " (declare (in ) vec4 x@0x1aae910)\n" " )\n" " (\n" " ))\n" @@ -7790,28 +7790,28 @@ static const char *prototypes_for_110_vert = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ed8f0)\n" + " (declare (in ) float x@0x1aaeaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9edca0)\n" + " (declare (in ) vec2 x@0x1aaee70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ede80)\n" + " (declare (in ) vec3 x@0x1aaf050)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ee060)\n" + " (declare (in ) vec4 x@0x1aaf230)\n" " )\n" " (\n" " ))\n" @@ -7821,28 +7821,28 @@ static const char *prototypes_for_110_vert = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ee240)\n" + " (declare (in ) float x@0x1aaf410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ee5f0)\n" + " (declare (in ) vec2 x@0x1aaf790)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ee7d0)\n" + " (declare (in ) vec3 x@0x1aaf970)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ee9b0)\n" + " (declare (in ) vec4 x@0x1aafb50)\n" " )\n" " (\n" " ))\n" @@ -7852,28 +7852,28 @@ static const char *prototypes_for_110_vert = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9eeb90)\n" + " (declare (in ) float x@0x1aafd30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9eef40)\n" + " (declare (in ) vec2 x@0x1ab00b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9ef120)\n" + " (declare (in ) vec3 x@0x1ab0290)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9ef300)\n" + " (declare (in ) vec4 x@0x1ab0470)\n" " )\n" " (\n" " ))\n" @@ -7883,28 +7883,28 @@ static const char *prototypes_for_110_vert = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9ef4e0)\n" + " (declare (in ) float x@0x1ab0650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9ef890)\n" + " (declare (in ) vec2 x@0x1ab09d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9efa70)\n" + " (declare (in ) vec3 x@0x1ab0bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9efc50)\n" + " (declare (in ) vec4 x@0x1ab0d90)\n" " )\n" " (\n" " ))\n" @@ -7914,28 +7914,28 @@ static const char *prototypes_for_110_vert = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9efe30)\n" + " (declare (in ) float x@0x1ab0f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f01e0)\n" + " (declare (in ) vec2 x@0x1ab12f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f03c0)\n" + " (declare (in ) vec3 x@0x1ab14d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f05a0)\n" + " (declare (in ) vec4 x@0x1ab16b0)\n" " )\n" " (\n" " ))\n" @@ -7945,56 +7945,56 @@ static const char *prototypes_for_110_vert = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9f0780)\n" - " (declare (in ) float y@0x9f0890)\n" + " (declare (in ) float x@0x1ab1890)\n" + " (declare (in ) float y@0x1ab19a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f0c40)\n" - " (declare (in ) float y@0x9f0d50)\n" + " (declare (in ) vec2 x@0x1ab1d20)\n" + " (declare (in ) float y@0x1ab1e30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f0f30)\n" - " (declare (in ) float y@0x9f1040)\n" + " (declare (in ) vec3 x@0x1ab2010)\n" + " (declare (in ) float y@0x1ab2120)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f1220)\n" - " (declare (in ) float y@0x9f1330)\n" + " (declare (in ) vec4 x@0x1ab2300)\n" + " (declare (in ) float y@0x1ab2410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f1510)\n" - " (declare (in ) vec2 y@0x9f1620)\n" + " (declare (in ) vec2 x@0x1ab25f0)\n" + " (declare (in ) vec2 y@0x1ab2700)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f1800)\n" - " (declare (in ) vec3 y@0x9f1910)\n" + " (declare (in ) vec3 x@0x1ab28e0)\n" + " (declare (in ) vec3 y@0x1ab29f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f1af0)\n" - " (declare (in ) vec4 y@0x9f1c00)\n" + " (declare (in ) vec4 x@0x1ab2bd0)\n" + " (declare (in ) vec4 y@0x1ab2ce0)\n" " )\n" " (\n" " ))\n" @@ -8004,56 +8004,56 @@ static const char *prototypes_for_110_vert = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9f1de0)\n" - " (declare (in ) float y@0x9f1ef0)\n" + " (declare (in ) float x@0x1ab2ec0)\n" + " (declare (in ) float y@0x1ab2fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f22a0)\n" - " (declare (in ) vec2 y@0x9f23b0)\n" + " (declare (in ) vec2 x@0x1ab3350)\n" + " (declare (in ) vec2 y@0x1ab3460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f2590)\n" - " (declare (in ) vec3 y@0x9f26a0)\n" + " (declare (in ) vec3 x@0x1ab3640)\n" + " (declare (in ) vec3 y@0x1ab3750)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f2880)\n" - " (declare (in ) vec4 y@0x9f2990)\n" + " (declare (in ) vec4 x@0x1ab3930)\n" + " (declare (in ) vec4 y@0x1ab3a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f2b70)\n" - " (declare (in ) float y@0x9f2c80)\n" + " (declare (in ) vec2 x@0x1ab3c20)\n" + " (declare (in ) float y@0x1ab3d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f2e60)\n" - " (declare (in ) float y@0x9f2f70)\n" + " (declare (in ) vec3 x@0x1ab3f10)\n" + " (declare (in ) float y@0x1ab4020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f3150)\n" - " (declare (in ) float y@0x9f3260)\n" + " (declare (in ) vec4 x@0x1ab4200)\n" + " (declare (in ) float y@0x1ab4310)\n" " )\n" " (\n" " ))\n" @@ -8063,56 +8063,56 @@ static const char *prototypes_for_110_vert = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9f3440)\n" - " (declare (in ) float y@0x9f3550)\n" + " (declare (in ) float x@0x1ab44f0)\n" + " (declare (in ) float y@0x1ab4600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f3900)\n" - " (declare (in ) vec2 y@0x9f3a10)\n" + " (declare (in ) vec2 x@0x1ab4980)\n" + " (declare (in ) vec2 y@0x1ab4a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f3bf0)\n" - " (declare (in ) vec3 y@0x9f3d00)\n" + " (declare (in ) vec3 x@0x1ab4c70)\n" + " (declare (in ) vec3 y@0x1ab4d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f3ee0)\n" - " (declare (in ) vec4 y@0x9f3ff0)\n" + " (declare (in ) vec4 x@0x1ab4f60)\n" + " (declare (in ) vec4 y@0x1ab5070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f41d0)\n" - " (declare (in ) float y@0x9f42e0)\n" + " (declare (in ) vec2 x@0x1ab5250)\n" + " (declare (in ) float y@0x1ab5360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f44c0)\n" - " (declare (in ) float y@0x9f45d0)\n" + " (declare (in ) vec3 x@0x1ab5540)\n" + " (declare (in ) float y@0x1ab5650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f47b0)\n" - " (declare (in ) float y@0x9f48c0)\n" + " (declare (in ) vec4 x@0x1ab5830)\n" + " (declare (in ) float y@0x1ab5940)\n" " )\n" " (\n" " ))\n" @@ -8122,63 +8122,63 @@ static const char *prototypes_for_110_vert = "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9f4aa0)\n" - " (declare (in ) float minVal@0x9f4bb0)\n" - " (declare (in ) float maxVal@0x9f4cc0)\n" + " (declare (in ) float x@0x1ab5b20)\n" + " (declare (in ) float minVal@0x1ab5c30)\n" + " (declare (in ) float maxVal@0x1ab5d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f5070)\n" - " (declare (in ) vec2 minVal@0x9f5180)\n" - " (declare (in ) vec2 maxVal@0x9f5290)\n" + " (declare (in ) vec2 x@0x1ab60c0)\n" + " (declare (in ) vec2 minVal@0x1ab61d0)\n" + " (declare (in ) vec2 maxVal@0x1ab62e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f5470)\n" - " (declare (in ) vec3 minVal@0x9f5580)\n" - " (declare (in ) vec3 maxVal@0x9f5690)\n" + " (declare (in ) vec3 x@0x1ab64c0)\n" + " (declare (in ) vec3 minVal@0x1ab65d0)\n" + " (declare (in ) vec3 maxVal@0x1ab66e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f5870)\n" - " (declare (in ) vec4 minVal@0x9f5980)\n" - " (declare (in ) vec4 maxVal@0x9f5a90)\n" + " (declare (in ) vec4 x@0x1ab68c0)\n" + " (declare (in ) vec4 minVal@0x1ab69d0)\n" + " (declare (in ) vec4 maxVal@0x1ab6ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f5c70)\n" - " (declare (in ) float minVal@0x9f5d80)\n" - " (declare (in ) float maxVal@0x9f5e90)\n" + " (declare (in ) vec2 x@0x1ab6cc0)\n" + " (declare (in ) float minVal@0x1ab6dd0)\n" + " (declare (in ) float maxVal@0x1ab6ee0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f6070)\n" - " (declare (in ) float minVal@0x9f6180)\n" - " (declare (in ) float maxVal@0x9f6290)\n" + " (declare (in ) vec3 x@0x1ab70c0)\n" + " (declare (in ) float minVal@0x1ab71d0)\n" + " (declare (in ) float maxVal@0x1ab72e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f6470)\n" - " (declare (in ) float minVal@0x9f6580)\n" - " (declare (in ) float maxVal@0x9f6690)\n" + " (declare (in ) vec4 x@0x1ab74c0)\n" + " (declare (in ) float minVal@0x1ab75d0)\n" + " (declare (in ) float maxVal@0x1ab76e0)\n" " )\n" " (\n" " ))\n" @@ -8188,63 +8188,63 @@ static const char *prototypes_for_110_vert = "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9f6870)\n" - " (declare (in ) float y@0x9f6980)\n" - " (declare (in ) float a@0x9f6a90)\n" + " (declare (in ) float x@0x1ab78c0)\n" + " (declare (in ) float y@0x1ab79d0)\n" + " (declare (in ) float a@0x1ab7ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f6e40)\n" - " (declare (in ) vec2 y@0x9f6f50)\n" - " (declare (in ) vec2 a@0x9f7060)\n" + " (declare (in ) vec2 x@0x1ab7e60)\n" + " (declare (in ) vec2 y@0x1ab7f70)\n" + " (declare (in ) vec2 a@0x1ab8080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f7240)\n" - " (declare (in ) vec3 y@0x9f7350)\n" - " (declare (in ) vec3 a@0x9f7460)\n" + " (declare (in ) vec3 x@0x1ab8260)\n" + " (declare (in ) vec3 y@0x1ab8370)\n" + " (declare (in ) vec3 a@0x1ab8480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f7640)\n" - " (declare (in ) vec4 y@0x9f7750)\n" - " (declare (in ) vec4 a@0x9f7860)\n" + " (declare (in ) vec4 x@0x1ab8660)\n" + " (declare (in ) vec4 y@0x1ab8770)\n" + " (declare (in ) vec4 a@0x1ab8880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9f7a40)\n" - " (declare (in ) vec2 y@0x9f7b50)\n" - " (declare (in ) float a@0x9f7c60)\n" + " (declare (in ) vec2 x@0x1ab8a60)\n" + " (declare (in ) vec2 y@0x1ab8b70)\n" + " (declare (in ) float a@0x1ab8c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9f7e40)\n" - " (declare (in ) vec3 y@0x9f7f50)\n" - " (declare (in ) float a@0x9f8060)\n" + " (declare (in ) vec3 x@0x1ab8e60)\n" + " (declare (in ) vec3 y@0x1ab8f70)\n" + " (declare (in ) float a@0x1ab9080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9f8240)\n" - " (declare (in ) vec4 y@0x9f8350)\n" - " (declare (in ) float a@0x9f8460)\n" + " (declare (in ) vec4 x@0x1ab9260)\n" + " (declare (in ) vec4 y@0x1ab9370)\n" + " (declare (in ) float a@0x1ab9480)\n" " )\n" " (\n" " ))\n" @@ -8254,56 +8254,56 @@ static const char *prototypes_for_110_vert = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x9f8640)\n" - " (declare (in ) float x@0x9f8750)\n" + " (declare (in ) float edge@0x1ab9660)\n" + " (declare (in ) float x@0x1ab9770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x9f8b00)\n" - " (declare (in ) vec2 x@0x9f8c10)\n" + " (declare (in ) vec2 edge@0x1ab9af0)\n" + " (declare (in ) vec2 x@0x1ab9c00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x9f8df0)\n" - " (declare (in ) vec3 x@0x9f8f00)\n" + " (declare (in ) vec3 edge@0x1ab9de0)\n" + " (declare (in ) vec3 x@0x1ab9ef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x9f90e0)\n" - " (declare (in ) vec4 x@0x9f91f0)\n" + " (declare (in ) vec4 edge@0x1aba0d0)\n" + " (declare (in ) vec4 x@0x1aba1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x9f93d0)\n" - " (declare (in ) vec2 x@0x9f94e0)\n" + " (declare (in ) float edge@0x1aba3c0)\n" + " (declare (in ) vec2 x@0x1aba4d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x9f96c0)\n" - " (declare (in ) vec3 x@0x9f97d0)\n" + " (declare (in ) float edge@0x1aba6b0)\n" + " (declare (in ) vec3 x@0x1aba7c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x9f99b0)\n" - " (declare (in ) vec4 x@0x9f9ac0)\n" + " (declare (in ) float edge@0x1aba9a0)\n" + " (declare (in ) vec4 x@0x1abaab0)\n" " )\n" " (\n" " ))\n" @@ -8313,63 +8313,63 @@ static const char *prototypes_for_110_vert = "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x9f9ca0)\n" - " (declare (in ) float edge1@0x9f9db0)\n" - " (declare (in ) float x@0x9f9ec0)\n" + " (declare (in ) float edge0@0x1abac90)\n" + " (declare (in ) float edge1@0x1abada0)\n" + " (declare (in ) float x@0x1abaeb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x9fa280)\n" - " (declare (in ) vec2 edge1@0x9fa390)\n" - " (declare (in ) vec2 x@0x9fa4a0)\n" + " (declare (in ) vec2 edge0@0x1abb240)\n" + " (declare (in ) vec2 edge1@0x1abb350)\n" + " (declare (in ) vec2 x@0x1abb460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x9fa680)\n" - " (declare (in ) vec3 edge1@0x9fa790)\n" - " (declare (in ) vec3 x@0x9fa8a0)\n" + " (declare (in ) vec3 edge0@0x1abb640)\n" + " (declare (in ) vec3 edge1@0x1abb750)\n" + " (declare (in ) vec3 x@0x1abb860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x9faa80)\n" - " (declare (in ) vec4 edge1@0x9fab90)\n" - " (declare (in ) vec4 x@0x9faca0)\n" + " (declare (in ) vec4 edge0@0x1abba40)\n" + " (declare (in ) vec4 edge1@0x1abbb50)\n" + " (declare (in ) vec4 x@0x1abbc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x9fae80)\n" - " (declare (in ) float edge1@0x9faf90)\n" - " (declare (in ) vec2 x@0x9fb0a0)\n" + " (declare (in ) float edge0@0x1abbe40)\n" + " (declare (in ) float edge1@0x1abbf50)\n" + " (declare (in ) vec2 x@0x1abc060)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x9fb280)\n" - " (declare (in ) float edge1@0x9fb390)\n" - " (declare (in ) vec3 x@0x9fb4a0)\n" + " (declare (in ) float edge0@0x1abc240)\n" + " (declare (in ) float edge1@0x1abc350)\n" + " (declare (in ) vec3 x@0x1abc460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x9fb680)\n" - " (declare (in ) float edge1@0x9fb790)\n" - " (declare (in ) vec4 x@0x9fb8a0)\n" + " (declare (in ) float edge0@0x1abc640)\n" + " (declare (in ) float edge1@0x1abc750)\n" + " (declare (in ) vec4 x@0x1abc860)\n" " )\n" " (\n" " ))\n" @@ -8379,28 +8379,28 @@ static const char *prototypes_for_110_vert = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9fba80)\n" + " (declare (in ) float x@0x1abca40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x9fbe30)\n" + " (declare (in ) vec2 x@0x1abcdc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x9fc010)\n" + " (declare (in ) vec3 x@0x1abcfa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x9fc1f0)\n" + " (declare (in ) vec4 x@0x1abd180)\n" " )\n" " (\n" " ))\n" @@ -8410,32 +8410,32 @@ static const char *prototypes_for_110_vert = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x9fc3d0)\n" - " (declare (in ) float p1@0x9fc4e0)\n" + " (declare (in ) float p0@0x1abd360)\n" + " (declare (in ) float p1@0x1abd470)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x9fc8a0)\n" - " (declare (in ) vec2 p1@0x9fc9b0)\n" + " (declare (in ) vec2 p0@0x1abd800)\n" + " (declare (in ) vec2 p1@0x1abd910)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x9fcb90)\n" - " (declare (in ) vec3 p1@0x9fcca0)\n" + " (declare (in ) vec3 p0@0x1abdaf0)\n" + " (declare (in ) vec3 p1@0x1abdc00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x9fce80)\n" - " (declare (in ) vec4 p1@0x9fcf90)\n" + " (declare (in ) vec4 p0@0x1abdde0)\n" + " (declare (in ) vec4 p1@0x1abdef0)\n" " )\n" " (\n" " ))\n" @@ -8445,32 +8445,32 @@ static const char *prototypes_for_110_vert = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9fd170)\n" - " (declare (in ) float y@0x9fd280)\n" + " (declare (in ) float x@0x1abe0d0)\n" + " (declare (in ) float y@0x1abe1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x9fd630)\n" - " (declare (in ) vec2 y@0x9fd740)\n" + " (declare (in ) vec2 x@0x1abe560)\n" + " (declare (in ) vec2 y@0x1abe670)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x9fd920)\n" - " (declare (in ) vec3 y@0x9fda30)\n" + " (declare (in ) vec3 x@0x1abe850)\n" + " (declare (in ) vec3 y@0x1abe960)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x9fdc10)\n" - " (declare (in ) vec4 y@0x9fdd20)\n" + " (declare (in ) vec4 x@0x1abeb40)\n" + " (declare (in ) vec4 y@0x1abec50)\n" " )\n" " (\n" " ))\n" @@ -8480,8 +8480,8 @@ static const char *prototypes_for_110_vert = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9fdf00)\n" - " (declare (in ) vec3 y@0x9fe010)\n" + " (declare (in ) vec3 x@0x1abee30)\n" + " (declare (in ) vec3 y@0x1abef40)\n" " )\n" " (\n" " ))\n" @@ -8491,28 +8491,28 @@ static const char *prototypes_for_110_vert = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x9fe3c0)\n" + " (declare (in ) float x@0x1abf2c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x9fe780)\n" + " (declare (in ) vec2 x@0x1abf650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x9fe960)\n" + " (declare (in ) vec3 x@0x1abf830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x9feb40)\n" + " (declare (in ) vec4 x@0x1abfa10)\n" " )\n" " (\n" " ))\n" @@ -8531,36 +8531,36 @@ static const char *prototypes_for_110_vert = "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x9fefd0)\n" - " (declare (in ) float I@0x9ff0e0)\n" - " (declare (in ) float Nref@0x9ff1f0)\n" + " (declare (in ) float N@0x1abfe70)\n" + " (declare (in ) float I@0x1abff80)\n" + " (declare (in ) float Nref@0x1ac0090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x9ff5b0)\n" - " (declare (in ) vec2 I@0x9ff6c0)\n" - " (declare (in ) vec2 Nref@0x9ff7d0)\n" + " (declare (in ) vec2 N@0x1ac0420)\n" + " (declare (in ) vec2 I@0x1ac0530)\n" + " (declare (in ) vec2 Nref@0x1ac0640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x9ff9b0)\n" - " (declare (in ) vec3 I@0x9ffac0)\n" - " (declare (in ) vec3 Nref@0x9ffbd0)\n" + " (declare (in ) vec3 N@0x1ac0820)\n" + " (declare (in ) vec3 I@0x1ac0930)\n" + " (declare (in ) vec3 Nref@0x1ac0a40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x9ffdb0)\n" - " (declare (in ) vec4 I@0x9ffec0)\n" - " (declare (in ) vec4 Nref@0x9fffd0)\n" + " (declare (in ) vec4 N@0x1ac0c20)\n" + " (declare (in ) vec4 I@0x1ac0d30)\n" + " (declare (in ) vec4 Nref@0x1ac0e40)\n" " )\n" " (\n" " ))\n" @@ -8570,32 +8570,32 @@ static const char *prototypes_for_110_vert = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0xa001b0)\n" - " (declare (in ) float N@0xa002c0)\n" + " (declare (in ) float I@0x1ac1020)\n" + " (declare (in ) float N@0x1ac1130)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0xa00680)\n" - " (declare (in ) vec2 N@0xa00790)\n" + " (declare (in ) vec2 I@0x1ac14b0)\n" + " (declare (in ) vec2 N@0x1ac15c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0xa00970)\n" - " (declare (in ) vec3 N@0xa00a80)\n" + " (declare (in ) vec3 I@0x1ac17a0)\n" + " (declare (in ) vec3 N@0x1ac18b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0xa00c60)\n" - " (declare (in ) vec4 N@0xa00d70)\n" + " (declare (in ) vec4 I@0x1ac1a90)\n" + " (declare (in ) vec4 N@0x1ac1ba0)\n" " )\n" " (\n" " ))\n" @@ -8605,36 +8605,36 @@ static const char *prototypes_for_110_vert = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0xa00f50)\n" - " (declare (in ) float N@0xa01060)\n" - " (declare (in ) float eta@0xa01170)\n" + " (declare (in ) float I@0x1ac1d80)\n" + " (declare (in ) float N@0x1ac1e90)\n" + " (declare (in ) float eta@0x1ac1fa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0xa01530)\n" - " (declare (in ) vec2 N@0xa01640)\n" - " (declare (in ) float eta@0xa01750)\n" + " (declare (in ) vec2 I@0x1ac2320)\n" + " (declare (in ) vec2 N@0x1ac2430)\n" + " (declare (in ) float eta@0x1ac2540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0xa01930)\n" - " (declare (in ) vec3 N@0xa01a40)\n" - " (declare (in ) float eta@0xa01b50)\n" + " (declare (in ) vec3 I@0x1ac2720)\n" + " (declare (in ) vec3 N@0x1ac2830)\n" + " (declare (in ) float eta@0x1ac2940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0xa01d30)\n" - " (declare (in ) vec4 N@0xa01e40)\n" - " (declare (in ) float eta@0xa01f50)\n" + " (declare (in ) vec4 I@0x1ac2b20)\n" + " (declare (in ) vec4 N@0x1ac2c30)\n" + " (declare (in ) float eta@0x1ac2d40)\n" " )\n" " (\n" " ))\n" @@ -8644,24 +8644,24 @@ static const char *prototypes_for_110_vert = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0xa02130)\n" - " (declare (in ) mat2 y@0xa02240)\n" + " (declare (in ) mat2 x@0x1ac2f20)\n" + " (declare (in ) mat2 y@0x1ac3030)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0xa02600)\n" - " (declare (in ) mat3 y@0xa02710)\n" + " (declare (in ) mat3 x@0x1ac33c0)\n" + " (declare (in ) mat3 y@0x1ac34d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0xa028f0)\n" - " (declare (in ) mat4 y@0xa02a00)\n" + " (declare (in ) mat4 x@0x1ac36b0)\n" + " (declare (in ) mat4 y@0x1ac37c0)\n" " )\n" " (\n" " ))\n" @@ -8671,48 +8671,48 @@ static const char *prototypes_for_110_vert = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa02be0)\n" - " (declare (in ) vec2 y@0xa02cf0)\n" + " (declare (in ) vec2 x@0x1ac39a0)\n" + " (declare (in ) vec2 y@0x1ac3ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa030b0)\n" - " (declare (in ) vec3 y@0xa031c0)\n" + " (declare (in ) vec3 x@0x1ac3e40)\n" + " (declare (in ) vec3 y@0x1ac3f50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa033a0)\n" - " (declare (in ) vec4 y@0xa034b0)\n" + " (declare (in ) vec4 x@0x1ac4130)\n" + " (declare (in ) vec4 y@0x1ac4240)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa03690)\n" - " (declare (in ) ivec2 y@0xa037a0)\n" + " (declare (in ) ivec2 x@0x1ac4420)\n" + " (declare (in ) ivec2 y@0x1ac4530)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa03980)\n" - " (declare (in ) ivec3 y@0xa03a90)\n" + " (declare (in ) ivec3 x@0x1ac4710)\n" + " (declare (in ) ivec3 y@0x1ac4820)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa03c70)\n" - " (declare (in ) ivec4 y@0xa03d80)\n" + " (declare (in ) ivec4 x@0x1ac4a00)\n" + " (declare (in ) ivec4 y@0x1ac4b10)\n" " )\n" " (\n" " ))\n" @@ -8722,48 +8722,48 @@ static const char *prototypes_for_110_vert = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa03f60)\n" - " (declare (in ) vec2 y@0xa04070)\n" + " (declare (in ) vec2 x@0x1ac4cf0)\n" + " (declare (in ) vec2 y@0x1ac4e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa04430)\n" - " (declare (in ) vec3 y@0xa04540)\n" + " (declare (in ) vec3 x@0x1ac5190)\n" + " (declare (in ) vec3 y@0x1ac52a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa04720)\n" - " (declare (in ) vec4 y@0xa04830)\n" + " (declare (in ) vec4 x@0x1ac5480)\n" + " (declare (in ) vec4 y@0x1ac5590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa04a10)\n" - " (declare (in ) ivec2 y@0xa04b20)\n" + " (declare (in ) ivec2 x@0x1ac5770)\n" + " (declare (in ) ivec2 y@0x1ac5880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa04d00)\n" - " (declare (in ) ivec3 y@0xa04e10)\n" + " (declare (in ) ivec3 x@0x1ac5a60)\n" + " (declare (in ) ivec3 y@0x1ac5b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa04ff0)\n" - " (declare (in ) ivec4 y@0xa05100)\n" + " (declare (in ) ivec4 x@0x1ac5d50)\n" + " (declare (in ) ivec4 y@0x1ac5e60)\n" " )\n" " (\n" " ))\n" @@ -8773,48 +8773,48 @@ static const char *prototypes_for_110_vert = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa052e0)\n" - " (declare (in ) vec2 y@0xa053f0)\n" + " (declare (in ) vec2 x@0x1ac6040)\n" + " (declare (in ) vec2 y@0x1ac6150)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa057b0)\n" - " (declare (in ) vec3 y@0xa058c0)\n" + " (declare (in ) vec3 x@0x1ac64e0)\n" + " (declare (in ) vec3 y@0x1ac65f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa05aa0)\n" - " (declare (in ) vec4 y@0xa05bb0)\n" + " (declare (in ) vec4 x@0x1ac67d0)\n" + " (declare (in ) vec4 y@0x1ac68e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa05d90)\n" - " (declare (in ) ivec2 y@0xa05ea0)\n" + " (declare (in ) ivec2 x@0x1ac6ac0)\n" + " (declare (in ) ivec2 y@0x1ac6bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa06080)\n" - " (declare (in ) ivec3 y@0xa06190)\n" + " (declare (in ) ivec3 x@0x1ac6db0)\n" + " (declare (in ) ivec3 y@0x1ac6ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa06370)\n" - " (declare (in ) ivec4 y@0xa06480)\n" + " (declare (in ) ivec4 x@0x1ac70a0)\n" + " (declare (in ) ivec4 y@0x1ac71b0)\n" " )\n" " (\n" " ))\n" @@ -8824,48 +8824,48 @@ static const char *prototypes_for_110_vert = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa06660)\n" - " (declare (in ) vec2 y@0xa06770)\n" + " (declare (in ) vec2 x@0x1ac7390)\n" + " (declare (in ) vec2 y@0x1ac74a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa06b30)\n" - " (declare (in ) vec3 y@0xa06c40)\n" + " (declare (in ) vec3 x@0x1ac7830)\n" + " (declare (in ) vec3 y@0x1ac7940)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa06e20)\n" - " (declare (in ) vec4 y@0xa06f30)\n" + " (declare (in ) vec4 x@0x1ac7b20)\n" + " (declare (in ) vec4 y@0x1ac7c30)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa07110)\n" - " (declare (in ) ivec2 y@0xa07220)\n" + " (declare (in ) ivec2 x@0x1ac7e10)\n" + " (declare (in ) ivec2 y@0x1ac7f20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa07400)\n" - " (declare (in ) ivec3 y@0xa07510)\n" + " (declare (in ) ivec3 x@0x1ac8100)\n" + " (declare (in ) ivec3 y@0x1ac8210)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa076f0)\n" - " (declare (in ) ivec4 y@0xa07800)\n" + " (declare (in ) ivec4 x@0x1ac83f0)\n" + " (declare (in ) ivec4 y@0x1ac8500)\n" " )\n" " (\n" " ))\n" @@ -8875,72 +8875,72 @@ static const char *prototypes_for_110_vert = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa079e0)\n" - " (declare (in ) vec2 y@0xa07af0)\n" + " (declare (in ) vec2 x@0x1ac86e0)\n" + " (declare (in ) vec2 y@0x1ac87f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa07ea0)\n" - " (declare (in ) vec3 y@0xa07fb0)\n" + " (declare (in ) vec3 x@0x1ac8b70)\n" + " (declare (in ) vec3 y@0x1ac8c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa08190)\n" - " (declare (in ) vec4 y@0xa082a0)\n" + " (declare (in ) vec4 x@0x1ac8e60)\n" + " (declare (in ) vec4 y@0x1ac8f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa08480)\n" - " (declare (in ) ivec2 y@0xa08590)\n" + " (declare (in ) ivec2 x@0x1ac9150)\n" + " (declare (in ) ivec2 y@0x1ac9260)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa08770)\n" - " (declare (in ) ivec3 y@0xa08880)\n" + " (declare (in ) ivec3 x@0x1ac9440)\n" + " (declare (in ) ivec3 y@0x1ac9550)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa08a60)\n" - " (declare (in ) ivec4 y@0xa08b70)\n" + " (declare (in ) ivec4 x@0x1ac9730)\n" + " (declare (in ) ivec4 y@0x1ac9840)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xa08d50)\n" - " (declare (in ) bvec2 y@0xa08e60)\n" + " (declare (in ) bvec2 x@0x1ac9a20)\n" + " (declare (in ) bvec2 y@0x1ac9b30)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xa09040)\n" - " (declare (in ) bvec3 y@0xa09150)\n" + " (declare (in ) bvec3 x@0x1ac9d10)\n" + " (declare (in ) bvec3 y@0x1ac9e20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xa09330)\n" - " (declare (in ) bvec4 y@0xa09440)\n" + " (declare (in ) bvec4 x@0x1aca000)\n" + " (declare (in ) bvec4 y@0x1aca110)\n" " )\n" " (\n" " ))\n" @@ -8950,72 +8950,72 @@ static const char *prototypes_for_110_vert = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa09620)\n" - " (declare (in ) vec2 y@0xa09730)\n" + " (declare (in ) vec2 x@0x1aca2f0)\n" + " (declare (in ) vec2 y@0x1aca400)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa09af0)\n" - " (declare (in ) vec3 y@0xa09c00)\n" + " (declare (in ) vec3 x@0x1aca790)\n" + " (declare (in ) vec3 y@0x1aca8a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa09de0)\n" - " (declare (in ) vec4 y@0xa09ef0)\n" + " (declare (in ) vec4 x@0x1acaa80)\n" + " (declare (in ) vec4 y@0x1acab90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0xa0a0d0)\n" - " (declare (in ) ivec2 y@0xa0a1e0)\n" + " (declare (in ) ivec2 x@0x1acad70)\n" + " (declare (in ) ivec2 y@0x1acae80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0xa0a3c0)\n" - " (declare (in ) ivec3 y@0xa0a4d0)\n" + " (declare (in ) ivec3 x@0x1acb060)\n" + " (declare (in ) ivec3 y@0x1acb170)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0xa0a6b0)\n" - " (declare (in ) ivec4 y@0xa0a7c0)\n" + " (declare (in ) ivec4 x@0x1acb350)\n" + " (declare (in ) ivec4 y@0x1acb460)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xa0a9a0)\n" - " (declare (in ) bvec2 y@0xa0aab0)\n" + " (declare (in ) bvec2 x@0x1acb640)\n" + " (declare (in ) bvec2 y@0x1acb750)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xa0ac90)\n" - " (declare (in ) bvec3 y@0xa0ada0)\n" + " (declare (in ) bvec3 x@0x1acb930)\n" + " (declare (in ) bvec3 y@0x1acba40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xa0af80)\n" - " (declare (in ) bvec4 y@0xa0b090)\n" + " (declare (in ) bvec4 x@0x1acbc20)\n" + " (declare (in ) bvec4 y@0x1acbd30)\n" " )\n" " (\n" " ))\n" @@ -9025,21 +9025,21 @@ static const char *prototypes_for_110_vert = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0xa0b270)\n" + " (declare (in ) bvec2 x@0x1acbf10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0xa0b620)\n" + " (declare (in ) bvec3 x@0x1acc290)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0xa0b800)\n" + " (declare (in ) bvec4 x@0x1acc470)\n" " )\n" " (\n" " ))\n" @@ -9049,21 +9049,21 @@ static const char *prototypes_for_110_vert = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0xa0b9e0)\n" + " (declare (in ) bvec2 x@0x1acc650)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0xa0bd90)\n" + " (declare (in ) bvec3 x@0x1acc9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0xa0bf70)\n" + " (declare (in ) bvec4 x@0x1accbb0)\n" " )\n" " (\n" " ))\n" @@ -9073,21 +9073,21 @@ static const char *prototypes_for_110_vert = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0xa0c150)\n" + " (declare (in ) bvec2 x@0x1accd90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0xa0c500)\n" + " (declare (in ) bvec3 x@0x1acd110)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0xa0c6e0)\n" + " (declare (in ) bvec4 x@0x1acd2f0)\n" " )\n" " (\n" " ))\n" @@ -9097,8 +9097,8 @@ static const char *prototypes_for_110_vert = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0c8c0)\n" - " (declare (in ) float coord@0xa0c9e0)\n" + " (declare (in ) sampler1D sampler@0x1acd4d0)\n" + " (declare (in ) float coord@0x1acd5e0)\n" " )\n" " (\n" " ))\n" @@ -9108,16 +9108,16 @@ static const char *prototypes_for_110_vert = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0cda0)\n" - " (declare (in ) vec2 coord@0xa0cec0)\n" + " (declare (in ) sampler1D sampler@0x1acd970)\n" + " (declare (in ) vec2 coord@0x1acda80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0d280)\n" - " (declare (in ) vec4 coord@0xa0d3a0)\n" + " (declare (in ) sampler1D sampler@0x1acde10)\n" + " (declare (in ) vec4 coord@0x1acdf20)\n" " )\n" " (\n" " ))\n" @@ -9127,9 +9127,9 @@ static const char *prototypes_for_110_vert = "(function texture1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0d580)\n" - " (declare (in ) float coord@0xa0d6a0)\n" - " (declare (in ) float lod@0xa0d7b0)\n" + " (declare (in ) sampler1D sampler@0x1ace100)\n" + " (declare (in ) float coord@0x1ace210)\n" + " (declare (in ) float lod@0x1ace320)\n" " )\n" " (\n" " ))\n" @@ -9139,18 +9139,18 @@ static const char *prototypes_for_110_vert = "(function texture1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0db70)\n" - " (declare (in ) vec2 coord@0xa0dc90)\n" - " (declare (in ) float lod@0xa0dda0)\n" + " (declare (in ) sampler1D sampler@0x1ace6b0)\n" + " (declare (in ) vec2 coord@0x1ace7c0)\n" + " (declare (in ) float lod@0x1ace8d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0xa0e160)\n" - " (declare (in ) vec4 coord@0xa0e280)\n" - " (declare (in ) float lod@0xa0e390)\n" + " (declare (in ) sampler1D sampler@0x1acec60)\n" + " (declare (in ) vec4 coord@0x1aced70)\n" + " (declare (in ) float lod@0x1acee80)\n" " )\n" " (\n" " ))\n" @@ -9160,8 +9160,8 @@ static const char *prototypes_for_110_vert = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0e570)\n" - " (declare (in ) vec2 coord@0xa0e690)\n" + " (declare (in ) sampler2D sampler@0x1acf060)\n" + " (declare (in ) vec2 coord@0x1acf170)\n" " )\n" " (\n" " ))\n" @@ -9171,16 +9171,16 @@ static const char *prototypes_for_110_vert = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0ea50)\n" - " (declare (in ) vec3 coord@0xa0eb70)\n" + " (declare (in ) sampler2D sampler@0x1acf500)\n" + " (declare (in ) vec3 coord@0x1acf610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0ef30)\n" - " (declare (in ) vec4 coord@0xa0f050)\n" + " (declare (in ) sampler2D sampler@0x1acf9a0)\n" + " (declare (in ) vec4 coord@0x1acfab0)\n" " )\n" " (\n" " ))\n" @@ -9190,9 +9190,9 @@ static const char *prototypes_for_110_vert = "(function texture2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0f230)\n" - " (declare (in ) vec2 coord@0xa0f350)\n" - " (declare (in ) float lod@0xa0f460)\n" + " (declare (in ) sampler2D sampler@0x1acfc90)\n" + " (declare (in ) vec2 coord@0x1acfda0)\n" + " (declare (in ) float lod@0x1acfeb0)\n" " )\n" " (\n" " ))\n" @@ -9202,18 +9202,18 @@ static const char *prototypes_for_110_vert = "(function texture2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0f820)\n" - " (declare (in ) vec3 coord@0xa0f940)\n" - " (declare (in ) float lod@0xa0fa50)\n" + " (declare (in ) sampler2D sampler@0x1ad0240)\n" + " (declare (in ) vec3 coord@0x1ad0350)\n" + " (declare (in ) float lod@0x1ad0460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0xa0fe10)\n" - " (declare (in ) vec4 coord@0xa0ff30)\n" - " (declare (in ) float lod@0xa10040)\n" + " (declare (in ) sampler2D sampler@0x1ad07f0)\n" + " (declare (in ) vec4 coord@0x1ad0900)\n" + " (declare (in ) float lod@0x1ad0a10)\n" " )\n" " (\n" " ))\n" @@ -9223,8 +9223,8 @@ static const char *prototypes_for_110_vert = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xa10220)\n" - " (declare (in ) vec3 coord@0xa10340)\n" + " (declare (in ) sampler3D sampler@0x1ad0bf0)\n" + " (declare (in ) vec3 coord@0x1ad0d00)\n" " )\n" " (\n" " ))\n" @@ -9234,8 +9234,8 @@ static const char *prototypes_for_110_vert = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xa10700)\n" - " (declare (in ) vec4 coord@0xa10820)\n" + " (declare (in ) sampler3D sampler@0x1ad1090)\n" + " (declare (in ) vec4 coord@0x1ad11a0)\n" " )\n" " (\n" " ))\n" @@ -9245,9 +9245,9 @@ static const char *prototypes_for_110_vert = "(function texture3DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xa10be0)\n" - " (declare (in ) vec3 coord@0xa10d00)\n" - " (declare (in ) float lod@0xa10e10)\n" + " (declare (in ) sampler3D sampler@0x1ad1530)\n" + " (declare (in ) vec3 coord@0x1ad1640)\n" + " (declare (in ) float lod@0x1ad1750)\n" " )\n" " (\n" " ))\n" @@ -9257,9 +9257,9 @@ static const char *prototypes_for_110_vert = "(function texture3DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0xa111d0)\n" - " (declare (in ) vec4 coord@0xa112f0)\n" - " (declare (in ) float lod@0xa11400)\n" + " (declare (in ) sampler3D sampler@0x1ad1ae0)\n" + " (declare (in ) vec4 coord@0x1ad1bf0)\n" + " (declare (in ) float lod@0x1ad1d00)\n" " )\n" " (\n" " ))\n" @@ -9269,8 +9269,8 @@ static const char *prototypes_for_110_vert = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0xa117c0)\n" - " (declare (in ) vec3 coord@0xa118e0)\n" + " (declare (in ) samplerCube sampler@0x1ad2090)\n" + " (declare (in ) vec3 coord@0x1ad21a0)\n" " )\n" " (\n" " ))\n" @@ -9280,9 +9280,9 @@ static const char *prototypes_for_110_vert = "(function textureCubeLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0xa11ca0)\n" - " (declare (in ) vec3 coord@0xa11dc0)\n" - " (declare (in ) float lod@0xa11ed0)\n" + " (declare (in ) samplerCube sampler@0x1ad2530)\n" + " (declare (in ) vec3 coord@0x1ad2640)\n" + " (declare (in ) float lod@0x1ad2750)\n" " )\n" " (\n" " ))\n" @@ -9292,8 +9292,8 @@ static const char *prototypes_for_110_vert = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xa12290)\n" - " (declare (in ) vec3 coord@0xa123b0)\n" + " (declare (in ) sampler1DShadow sampler@0x1ad2ae0)\n" + " (declare (in ) vec3 coord@0x1ad2bf0)\n" " )\n" " (\n" " ))\n" @@ -9303,8 +9303,8 @@ static const char *prototypes_for_110_vert = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xa12770)\n" - " (declare (in ) vec3 coord@0xa12890)\n" + " (declare (in ) sampler2DShadow sampler@0x1ad2f80)\n" + " (declare (in ) vec3 coord@0x1ad3090)\n" " )\n" " (\n" " ))\n" @@ -9314,8 +9314,8 @@ static const char *prototypes_for_110_vert = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xa12c50)\n" - " (declare (in ) vec4 coord@0xa12d70)\n" + " (declare (in ) sampler1DShadow sampler@0x1ad3420)\n" + " (declare (in ) vec4 coord@0x1ad3530)\n" " )\n" " (\n" " ))\n" @@ -9325,8 +9325,8 @@ static const char *prototypes_for_110_vert = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xa13130)\n" - " (declare (in ) vec4 coord@0xa13250)\n" + " (declare (in ) sampler2DShadow sampler@0x1ad38c0)\n" + " (declare (in ) vec4 coord@0x1ad39d0)\n" " )\n" " (\n" " ))\n" @@ -9336,9 +9336,9 @@ static const char *prototypes_for_110_vert = "(function shadow1DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xa13610)\n" - " (declare (in ) vec3 coord@0xa13730)\n" - " (declare (in ) float lod@0xa13840)\n" + " (declare (in ) sampler1DShadow sampler@0x1ad3d60)\n" + " (declare (in ) vec3 coord@0x1ad3e70)\n" + " (declare (in ) float lod@0x1ad3f80)\n" " )\n" " (\n" " ))\n" @@ -9348,9 +9348,9 @@ static const char *prototypes_for_110_vert = "(function shadow2DLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xa13c00)\n" - " (declare (in ) vec3 coord@0xa13d20)\n" - " (declare (in ) float lod@0xa13e30)\n" + " (declare (in ) sampler2DShadow sampler@0x1ad4310)\n" + " (declare (in ) vec3 coord@0x1ad4420)\n" + " (declare (in ) float lod@0x1ad4530)\n" " )\n" " (\n" " ))\n" @@ -9360,9 +9360,9 @@ static const char *prototypes_for_110_vert = "(function shadow1DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0xa141f0)\n" - " (declare (in ) vec4 coord@0xa14310)\n" - " (declare (in ) float lod@0xa14420)\n" + " (declare (in ) sampler1DShadow sampler@0x1ad48c0)\n" + " (declare (in ) vec4 coord@0x1ad49d0)\n" + " (declare (in ) float lod@0x1ad4ae0)\n" " )\n" " (\n" " ))\n" @@ -9372,9 +9372,9 @@ static const char *prototypes_for_110_vert = "(function shadow2DProjLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0xa147e0)\n" - " (declare (in ) vec4 coord@0xa14900)\n" - " (declare (in ) float lod@0xa14a10)\n" + " (declare (in ) sampler2DShadow sampler@0x1ad4e70)\n" + " (declare (in ) vec4 coord@0x1ad4f80)\n" + " (declare (in ) float lod@0x1ad5090)\n" " )\n" " (\n" " ))\n" @@ -9384,28 +9384,28 @@ static const char *prototypes_for_110_vert = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0xa14dd0)\n" + " (declare (in ) float x@0x1ad5420)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0xa15180)\n" + " (declare (in ) vec2 x@0x1ad57a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0xa15360)\n" + " (declare (in ) vec3 x@0x1ad5980)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0xa15540)\n" + " (declare (in ) vec4 x@0x1ad5b60)\n" " )\n" " (\n" " ))\n" @@ -9415,28 +9415,28 @@ static const char *prototypes_for_110_vert = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0xa15720)\n" + " (declare (in ) float x@0x1ad5d40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0xa15ad0)\n" + " (declare (in ) vec2 x@0x1ad60c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0xa15cb0)\n" + " (declare (in ) vec3 x@0x1ad62a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0xa15e90)\n" + " (declare (in ) vec4 x@0x1ad6480)\n" " )\n" " (\n" " ))\n" @@ -9446,28 +9446,28 @@ static const char *prototypes_for_110_vert = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0xa16070)\n" + " (declare (in ) float x@0x1ad6660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0xa16420)\n" + " (declare (in ) vec2 x@0x1ad69e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0xa16600)\n" + " (declare (in ) vec3 x@0x1ad6bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0xa167e0)\n" + " (declare (in ) vec4 x@0x1ad6da0)\n" " )\n" " (\n" " ))\n" @@ -9477,28 +9477,28 @@ static const char *prototypes_for_110_vert = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0xa169c0)\n" + " (declare (in ) float x@0x1ad6f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0xa16d70)\n" + " (declare (in ) vec2 x@0x1ad7300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0xa16f50)\n" + " (declare (in ) vec3 x@0x1ad74e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0xa17130)\n" + " (declare (in ) vec4 x@0x1ad76c0)\n" " )\n" " (\n" " ))\n" @@ -9587,28 +9587,28 @@ static const char *prototypes_for_110_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x151ee40)\n" + " (declare (in ) float degrees@0x26c9280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x151f210)\n" + " (declare (in ) vec2 degrees@0x26c9600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x151f400)\n" + " (declare (in ) vec3 degrees@0x26c97e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x151f5f0)\n" + " (declare (in ) vec4 degrees@0x26c99c0)\n" " )\n" " (\n" " ))\n" @@ -9618,28 +9618,28 @@ static const char *prototypes_for_110_frag = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x151f7e0)\n" + " (declare (in ) float radians@0x26c9ba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x151fbb0)\n" + " (declare (in ) vec2 radians@0x26c9f20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x151fda0)\n" + " (declare (in ) vec3 radians@0x26ca100)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x151ff90)\n" + " (declare (in ) vec4 radians@0x26ca2e0)\n" " )\n" " (\n" " ))\n" @@ -9649,28 +9649,28 @@ static const char *prototypes_for_110_frag = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1520180)\n" + " (declare (in ) float angle@0x26ca4c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1520530)\n" + " (declare (in ) vec2 angle@0x26ca840)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1520710)\n" + " (declare (in ) vec3 angle@0x26caa20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15208f0)\n" + " (declare (in ) vec4 angle@0x26cac00)\n" " )\n" " (\n" " ))\n" @@ -9680,28 +9680,28 @@ static const char *prototypes_for_110_frag = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1520ad0)\n" + " (declare (in ) float angle@0x26cade0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1520e80)\n" + " (declare (in ) vec2 angle@0x26cb160)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1521060)\n" + " (declare (in ) vec3 angle@0x26cb340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1521240)\n" + " (declare (in ) vec4 angle@0x26cb520)\n" " )\n" " (\n" " ))\n" @@ -9711,28 +9711,28 @@ static const char *prototypes_for_110_frag = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1521420)\n" + " (declare (in ) float angle@0x26cb700)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x15217d0)\n" + " (declare (in ) vec2 angle@0x26cba80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x15219b0)\n" + " (declare (in ) vec3 angle@0x26cbc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1521b90)\n" + " (declare (in ) vec4 angle@0x26cbe40)\n" " )\n" " (\n" " ))\n" @@ -9742,28 +9742,28 @@ static const char *prototypes_for_110_frag = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x1521d70)\n" + " (declare (in ) float angle@0x26cc020)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1522120)\n" + " (declare (in ) vec2 angle@0x26cc3a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1522300)\n" + " (declare (in ) vec3 angle@0x26cc580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x15224e0)\n" + " (declare (in ) vec4 angle@0x26cc760)\n" " )\n" " (\n" " ))\n" @@ -9773,28 +9773,28 @@ static const char *prototypes_for_110_frag = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x15226c0)\n" + " (declare (in ) float angle@0x26cc940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x1522a70)\n" + " (declare (in ) vec2 angle@0x26cccc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x1522c50)\n" + " (declare (in ) vec3 angle@0x26ccea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x1522e30)\n" + " (declare (in ) vec4 angle@0x26cd080)\n" " )\n" " (\n" " ))\n" @@ -9804,60 +9804,60 @@ static const char *prototypes_for_110_frag = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x1523010)\n" - " (declare (in ) float x@0x1523120)\n" + " (declare (in ) float y@0x26cd260)\n" + " (declare (in ) float x@0x26cd370)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x15234d0)\n" - " (declare (in ) vec2 x@0x15235e0)\n" + " (declare (in ) vec2 y@0x26cd6f0)\n" + " (declare (in ) vec2 x@0x26cd800)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x15237c0)\n" - " (declare (in ) vec3 x@0x15238d0)\n" + " (declare (in ) vec3 y@0x26cd9e0)\n" + " (declare (in ) vec3 x@0x26cdaf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x1523ab0)\n" - " (declare (in ) vec4 x@0x1523bc0)\n" + " (declare (in ) vec4 y@0x26cdcd0)\n" + " (declare (in ) vec4 x@0x26cdde0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x1523da0)\n" + " (declare (in ) float y_over_x@0x26cdfc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x1523f90)\n" + " (declare (in ) vec2 y_over_x@0x26ce1b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x1524180)\n" + " (declare (in ) vec3 y_over_x@0x26ce3a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x1524370)\n" + " (declare (in ) vec4 y_over_x@0x26ce590)\n" " )\n" " (\n" " ))\n" @@ -9867,32 +9867,32 @@ static const char *prototypes_for_110_frag = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1524560)\n" - " (declare (in ) float y@0x1524670)\n" + " (declare (in ) float x@0x26ce780)\n" + " (declare (in ) float y@0x26ce890)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1524a20)\n" - " (declare (in ) vec2 y@0x1524b30)\n" + " (declare (in ) vec2 x@0x26cec10)\n" + " (declare (in ) vec2 y@0x26ced20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1524d10)\n" - " (declare (in ) vec3 y@0x1524e20)\n" + " (declare (in ) vec3 x@0x26cef00)\n" + " (declare (in ) vec3 y@0x26cf010)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1525000)\n" - " (declare (in ) vec4 y@0x1525110)\n" + " (declare (in ) vec4 x@0x26cf1f0)\n" + " (declare (in ) vec4 y@0x26cf300)\n" " )\n" " (\n" " ))\n" @@ -9902,28 +9902,28 @@ static const char *prototypes_for_110_frag = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15252f0)\n" + " (declare (in ) float x@0x26cf4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15256a0)\n" + " (declare (in ) vec2 x@0x26cf860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1525880)\n" + " (declare (in ) vec3 x@0x26cfa40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1525a60)\n" + " (declare (in ) vec4 x@0x26cfc20)\n" " )\n" " (\n" " ))\n" @@ -9933,28 +9933,28 @@ static const char *prototypes_for_110_frag = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1525c40)\n" + " (declare (in ) float x@0x26cfe00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1525ff0)\n" + " (declare (in ) vec2 x@0x26d0180)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15261d0)\n" + " (declare (in ) vec3 x@0x26d0360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15263b0)\n" + " (declare (in ) vec4 x@0x26d0540)\n" " )\n" " (\n" " ))\n" @@ -9964,28 +9964,28 @@ static const char *prototypes_for_110_frag = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1526590)\n" + " (declare (in ) float x@0x26d0720)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1526940)\n" + " (declare (in ) vec2 x@0x26d0aa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1526b20)\n" + " (declare (in ) vec3 x@0x26d0c80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1526d00)\n" + " (declare (in ) vec4 x@0x26d0e60)\n" " )\n" " (\n" " ))\n" @@ -9995,28 +9995,28 @@ static const char *prototypes_for_110_frag = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1526ee0)\n" + " (declare (in ) float x@0x26d1040)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1527290)\n" + " (declare (in ) vec2 x@0x26d13c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1527470)\n" + " (declare (in ) vec3 x@0x26d15a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1527650)\n" + " (declare (in ) vec4 x@0x26d1780)\n" " )\n" " (\n" " ))\n" @@ -10026,28 +10026,28 @@ static const char *prototypes_for_110_frag = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1527830)\n" + " (declare (in ) float x@0x26d1960)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1527be0)\n" + " (declare (in ) vec2 x@0x26d1ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1527dc0)\n" + " (declare (in ) vec3 x@0x26d1ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1527fa0)\n" + " (declare (in ) vec4 x@0x26d20a0)\n" " )\n" " (\n" " ))\n" @@ -10057,28 +10057,28 @@ static const char *prototypes_for_110_frag = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1528180)\n" + " (declare (in ) float x@0x26d2280)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1528540)\n" + " (declare (in ) vec2 x@0x26d2610)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1528720)\n" + " (declare (in ) vec3 x@0x26d27f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1528900)\n" + " (declare (in ) vec4 x@0x26d29d0)\n" " )\n" " (\n" " ))\n" @@ -10088,28 +10088,28 @@ static const char *prototypes_for_110_frag = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1528ae0)\n" + " (declare (in ) float x@0x26d2bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1528e90)\n" + " (declare (in ) vec2 x@0x26d2f30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1529070)\n" + " (declare (in ) vec3 x@0x26d3110)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1529250)\n" + " (declare (in ) vec4 x@0x26d32f0)\n" " )\n" " (\n" " ))\n" @@ -10119,28 +10119,28 @@ static const char *prototypes_for_110_frag = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1529430)\n" + " (declare (in ) float x@0x26d34d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15297e0)\n" + " (declare (in ) vec2 x@0x26d3850)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15299c0)\n" + " (declare (in ) vec3 x@0x26d3a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1529ba0)\n" + " (declare (in ) vec4 x@0x26d3c10)\n" " )\n" " (\n" " ))\n" @@ -10150,28 +10150,28 @@ static const char *prototypes_for_110_frag = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1529d80)\n" + " (declare (in ) float x@0x26d3df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152a130)\n" + " (declare (in ) vec2 x@0x26d4170)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152a310)\n" + " (declare (in ) vec3 x@0x26d4350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152a4f0)\n" + " (declare (in ) vec4 x@0x26d4530)\n" " )\n" " (\n" " ))\n" @@ -10181,28 +10181,28 @@ static const char *prototypes_for_110_frag = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152a6d0)\n" + " (declare (in ) float x@0x26d4710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152aa80)\n" + " (declare (in ) vec2 x@0x26d4a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152ac60)\n" + " (declare (in ) vec3 x@0x26d4c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152ae40)\n" + " (declare (in ) vec4 x@0x26d4e50)\n" " )\n" " (\n" " ))\n" @@ -10212,28 +10212,28 @@ static const char *prototypes_for_110_frag = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152b020)\n" + " (declare (in ) float x@0x26d5030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152b3d0)\n" + " (declare (in ) vec2 x@0x26d53b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152b5b0)\n" + " (declare (in ) vec3 x@0x26d5590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152b790)\n" + " (declare (in ) vec4 x@0x26d5770)\n" " )\n" " (\n" " ))\n" @@ -10243,56 +10243,56 @@ static const char *prototypes_for_110_frag = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152b970)\n" - " (declare (in ) float y@0x152ba80)\n" + " (declare (in ) float x@0x26d5950)\n" + " (declare (in ) float y@0x26d5a60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152be30)\n" - " (declare (in ) float y@0x152bf40)\n" + " (declare (in ) vec2 x@0x26d5de0)\n" + " (declare (in ) float y@0x26d5ef0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152c120)\n" - " (declare (in ) float y@0x152c230)\n" + " (declare (in ) vec3 x@0x26d60d0)\n" + " (declare (in ) float y@0x26d61e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152c410)\n" - " (declare (in ) float y@0x152c520)\n" + " (declare (in ) vec4 x@0x26d63c0)\n" + " (declare (in ) float y@0x26d64d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152c700)\n" - " (declare (in ) vec2 y@0x152c810)\n" + " (declare (in ) vec2 x@0x26d66b0)\n" + " (declare (in ) vec2 y@0x26d67c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152c9f0)\n" - " (declare (in ) vec3 y@0x152cb00)\n" + " (declare (in ) vec3 x@0x26d69a0)\n" + " (declare (in ) vec3 y@0x26d6ab0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152cce0)\n" - " (declare (in ) vec4 y@0x152cdf0)\n" + " (declare (in ) vec4 x@0x26d6c90)\n" + " (declare (in ) vec4 y@0x26d6da0)\n" " )\n" " (\n" " ))\n" @@ -10302,56 +10302,56 @@ static const char *prototypes_for_110_frag = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152cfd0)\n" - " (declare (in ) float y@0x152d0e0)\n" + " (declare (in ) float x@0x26d6f80)\n" + " (declare (in ) float y@0x26d7090)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152d490)\n" - " (declare (in ) vec2 y@0x152d5a0)\n" + " (declare (in ) vec2 x@0x26d7410)\n" + " (declare (in ) vec2 y@0x26d7520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152d780)\n" - " (declare (in ) vec3 y@0x152d890)\n" + " (declare (in ) vec3 x@0x26d7700)\n" + " (declare (in ) vec3 y@0x26d7810)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152da70)\n" - " (declare (in ) vec4 y@0x152db80)\n" + " (declare (in ) vec4 x@0x26d79f0)\n" + " (declare (in ) vec4 y@0x26d7b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152dd60)\n" - " (declare (in ) float y@0x152de70)\n" + " (declare (in ) vec2 x@0x26d7ce0)\n" + " (declare (in ) float y@0x26d7df0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152e050)\n" - " (declare (in ) float y@0x152e160)\n" + " (declare (in ) vec3 x@0x26d7fd0)\n" + " (declare (in ) float y@0x26d80e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152e340)\n" - " (declare (in ) float y@0x152e450)\n" + " (declare (in ) vec4 x@0x26d82c0)\n" + " (declare (in ) float y@0x26d83d0)\n" " )\n" " (\n" " ))\n" @@ -10361,56 +10361,56 @@ static const char *prototypes_for_110_frag = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152e630)\n" - " (declare (in ) float y@0x152e740)\n" + " (declare (in ) float x@0x26d85b0)\n" + " (declare (in ) float y@0x26d86c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152eaf0)\n" - " (declare (in ) vec2 y@0x152ec00)\n" + " (declare (in ) vec2 x@0x26d8a40)\n" + " (declare (in ) vec2 y@0x26d8b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152ede0)\n" - " (declare (in ) vec3 y@0x152eef0)\n" + " (declare (in ) vec3 x@0x26d8d30)\n" + " (declare (in ) vec3 y@0x26d8e40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152f0d0)\n" - " (declare (in ) vec4 y@0x152f1e0)\n" + " (declare (in ) vec4 x@0x26d9020)\n" + " (declare (in ) vec4 y@0x26d9130)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x152f3c0)\n" - " (declare (in ) float y@0x152f4d0)\n" + " (declare (in ) vec2 x@0x26d9310)\n" + " (declare (in ) float y@0x26d9420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x152f6b0)\n" - " (declare (in ) float y@0x152f7c0)\n" + " (declare (in ) vec3 x@0x26d9600)\n" + " (declare (in ) float y@0x26d9710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x152f9a0)\n" - " (declare (in ) float y@0x152fab0)\n" + " (declare (in ) vec4 x@0x26d98f0)\n" + " (declare (in ) float y@0x26d9a00)\n" " )\n" " (\n" " ))\n" @@ -10420,63 +10420,63 @@ static const char *prototypes_for_110_frag = "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x152fc90)\n" - " (declare (in ) float minVal@0x152fda0)\n" - " (declare (in ) float maxVal@0x152feb0)\n" + " (declare (in ) float x@0x26d9be0)\n" + " (declare (in ) float minVal@0x26d9cf0)\n" + " (declare (in ) float maxVal@0x26d9e00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1530260)\n" - " (declare (in ) vec2 minVal@0x1530370)\n" - " (declare (in ) vec2 maxVal@0x1530480)\n" + " (declare (in ) vec2 x@0x26da180)\n" + " (declare (in ) vec2 minVal@0x26da290)\n" + " (declare (in ) vec2 maxVal@0x26da3a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1530660)\n" - " (declare (in ) vec3 minVal@0x1530770)\n" - " (declare (in ) vec3 maxVal@0x1530880)\n" + " (declare (in ) vec3 x@0x26da580)\n" + " (declare (in ) vec3 minVal@0x26da690)\n" + " (declare (in ) vec3 maxVal@0x26da7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1530a60)\n" - " (declare (in ) vec4 minVal@0x1530b70)\n" - " (declare (in ) vec4 maxVal@0x1530c80)\n" + " (declare (in ) vec4 x@0x26da980)\n" + " (declare (in ) vec4 minVal@0x26daa90)\n" + " (declare (in ) vec4 maxVal@0x26daba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1530e60)\n" - " (declare (in ) float minVal@0x1530f70)\n" - " (declare (in ) float maxVal@0x1531080)\n" + " (declare (in ) vec2 x@0x26dad80)\n" + " (declare (in ) float minVal@0x26dae90)\n" + " (declare (in ) float maxVal@0x26dafa0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1531260)\n" - " (declare (in ) float minVal@0x1531370)\n" - " (declare (in ) float maxVal@0x1531480)\n" + " (declare (in ) vec3 x@0x26db180)\n" + " (declare (in ) float minVal@0x26db290)\n" + " (declare (in ) float maxVal@0x26db3a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1531660)\n" - " (declare (in ) float minVal@0x1531770)\n" - " (declare (in ) float maxVal@0x1531880)\n" + " (declare (in ) vec4 x@0x26db580)\n" + " (declare (in ) float minVal@0x26db690)\n" + " (declare (in ) float maxVal@0x26db7a0)\n" " )\n" " (\n" " ))\n" @@ -10486,63 +10486,63 @@ static const char *prototypes_for_110_frag = "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1531a60)\n" - " (declare (in ) float y@0x1531b70)\n" - " (declare (in ) float a@0x1531c80)\n" + " (declare (in ) float x@0x26db980)\n" + " (declare (in ) float y@0x26dba90)\n" + " (declare (in ) float a@0x26dbba0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1532030)\n" - " (declare (in ) vec2 y@0x1532140)\n" - " (declare (in ) vec2 a@0x1532250)\n" + " (declare (in ) vec2 x@0x26dbf20)\n" + " (declare (in ) vec2 y@0x26dc030)\n" + " (declare (in ) vec2 a@0x26dc140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1532430)\n" - " (declare (in ) vec3 y@0x1532540)\n" - " (declare (in ) vec3 a@0x1532650)\n" + " (declare (in ) vec3 x@0x26dc320)\n" + " (declare (in ) vec3 y@0x26dc430)\n" + " (declare (in ) vec3 a@0x26dc540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1532830)\n" - " (declare (in ) vec4 y@0x1532940)\n" - " (declare (in ) vec4 a@0x1532a50)\n" + " (declare (in ) vec4 x@0x26dc720)\n" + " (declare (in ) vec4 y@0x26dc830)\n" + " (declare (in ) vec4 a@0x26dc940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1532c30)\n" - " (declare (in ) vec2 y@0x1532d40)\n" - " (declare (in ) float a@0x1532e50)\n" + " (declare (in ) vec2 x@0x26dcb20)\n" + " (declare (in ) vec2 y@0x26dcc30)\n" + " (declare (in ) float a@0x26dcd40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1533030)\n" - " (declare (in ) vec3 y@0x1533140)\n" - " (declare (in ) float a@0x1533250)\n" + " (declare (in ) vec3 x@0x26dcf20)\n" + " (declare (in ) vec3 y@0x26dd030)\n" + " (declare (in ) float a@0x26dd140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1533430)\n" - " (declare (in ) vec4 y@0x1533540)\n" - " (declare (in ) float a@0x1533650)\n" + " (declare (in ) vec4 x@0x26dd320)\n" + " (declare (in ) vec4 y@0x26dd430)\n" + " (declare (in ) float a@0x26dd540)\n" " )\n" " (\n" " ))\n" @@ -10552,56 +10552,56 @@ static const char *prototypes_for_110_frag = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x1533830)\n" - " (declare (in ) float x@0x1533940)\n" + " (declare (in ) float edge@0x26dd720)\n" + " (declare (in ) float x@0x26dd830)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x1533cf0)\n" - " (declare (in ) vec2 x@0x1533e00)\n" + " (declare (in ) vec2 edge@0x26ddbb0)\n" + " (declare (in ) vec2 x@0x26ddcc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x1533fe0)\n" - " (declare (in ) vec3 x@0x15340f0)\n" + " (declare (in ) vec3 edge@0x26ddea0)\n" + " (declare (in ) vec3 x@0x26ddfb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x15342d0)\n" - " (declare (in ) vec4 x@0x15343e0)\n" + " (declare (in ) vec4 edge@0x26de190)\n" + " (declare (in ) vec4 x@0x26de2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x15345c0)\n" - " (declare (in ) vec2 x@0x15346d0)\n" + " (declare (in ) float edge@0x26de480)\n" + " (declare (in ) vec2 x@0x26de590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x15348b0)\n" - " (declare (in ) vec3 x@0x15349c0)\n" + " (declare (in ) float edge@0x26de770)\n" + " (declare (in ) vec3 x@0x26de880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x1534ba0)\n" - " (declare (in ) vec4 x@0x1534cb0)\n" + " (declare (in ) float edge@0x26dea60)\n" + " (declare (in ) vec4 x@0x26deb70)\n" " )\n" " (\n" " ))\n" @@ -10611,63 +10611,63 @@ static const char *prototypes_for_110_frag = "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x1534e90)\n" - " (declare (in ) float edge1@0x1534fa0)\n" - " (declare (in ) float x@0x15350b0)\n" + " (declare (in ) float edge0@0x26ded50)\n" + " (declare (in ) float edge1@0x26dee60)\n" + " (declare (in ) float x@0x26def70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x1535470)\n" - " (declare (in ) vec2 edge1@0x1535580)\n" - " (declare (in ) vec2 x@0x1535690)\n" + " (declare (in ) vec2 edge0@0x26df300)\n" + " (declare (in ) vec2 edge1@0x26df410)\n" + " (declare (in ) vec2 x@0x26df520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x1535870)\n" - " (declare (in ) vec3 edge1@0x1535980)\n" - " (declare (in ) vec3 x@0x1535a90)\n" + " (declare (in ) vec3 edge0@0x26df700)\n" + " (declare (in ) vec3 edge1@0x26df810)\n" + " (declare (in ) vec3 x@0x26df920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x1535c70)\n" - " (declare (in ) vec4 edge1@0x1535d80)\n" - " (declare (in ) vec4 x@0x1535e90)\n" + " (declare (in ) vec4 edge0@0x26dfb00)\n" + " (declare (in ) vec4 edge1@0x26dfc10)\n" + " (declare (in ) vec4 x@0x26dfd20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x1536070)\n" - " (declare (in ) float edge1@0x1536180)\n" - " (declare (in ) vec2 x@0x1536290)\n" + " (declare (in ) float edge0@0x26dff00)\n" + " (declare (in ) float edge1@0x26e0010)\n" + " (declare (in ) vec2 x@0x26e0120)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x1536470)\n" - " (declare (in ) float edge1@0x1536580)\n" - " (declare (in ) vec3 x@0x1536690)\n" + " (declare (in ) float edge0@0x26e0300)\n" + " (declare (in ) float edge1@0x26e0410)\n" + " (declare (in ) vec3 x@0x26e0520)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x1536870)\n" - " (declare (in ) float edge1@0x1536980)\n" - " (declare (in ) vec4 x@0x1536a90)\n" + " (declare (in ) float edge0@0x26e0700)\n" + " (declare (in ) float edge1@0x26e0810)\n" + " (declare (in ) vec4 x@0x26e0920)\n" " )\n" " (\n" " ))\n" @@ -10677,28 +10677,28 @@ static const char *prototypes_for_110_frag = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1536c70)\n" + " (declare (in ) float x@0x26e0b00)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1537020)\n" + " (declare (in ) vec2 x@0x26e0e80)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1537200)\n" + " (declare (in ) vec3 x@0x26e1060)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x15373e0)\n" + " (declare (in ) vec4 x@0x26e1240)\n" " )\n" " (\n" " ))\n" @@ -10708,32 +10708,32 @@ static const char *prototypes_for_110_frag = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x15375c0)\n" - " (declare (in ) float p1@0x15376d0)\n" + " (declare (in ) float p0@0x26e1420)\n" + " (declare (in ) float p1@0x26e1530)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x1537a90)\n" - " (declare (in ) vec2 p1@0x1537ba0)\n" + " (declare (in ) vec2 p0@0x26e18c0)\n" + " (declare (in ) vec2 p1@0x26e19d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x1537d80)\n" - " (declare (in ) vec3 p1@0x1537e90)\n" + " (declare (in ) vec3 p0@0x26e1bb0)\n" + " (declare (in ) vec3 p1@0x26e1cc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x1538070)\n" - " (declare (in ) vec4 p1@0x1538180)\n" + " (declare (in ) vec4 p0@0x26e1ea0)\n" + " (declare (in ) vec4 p1@0x26e1fb0)\n" " )\n" " (\n" " ))\n" @@ -10743,32 +10743,32 @@ static const char *prototypes_for_110_frag = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1538360)\n" - " (declare (in ) float y@0x1538470)\n" + " (declare (in ) float x@0x26e2190)\n" + " (declare (in ) float y@0x26e22a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1538820)\n" - " (declare (in ) vec2 y@0x1538930)\n" + " (declare (in ) vec2 x@0x26e2620)\n" + " (declare (in ) vec2 y@0x26e2730)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x1538b10)\n" - " (declare (in ) vec3 y@0x1538c20)\n" + " (declare (in ) vec3 x@0x26e2910)\n" + " (declare (in ) vec3 y@0x26e2a20)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1538e00)\n" - " (declare (in ) vec4 y@0x1538f10)\n" + " (declare (in ) vec4 x@0x26e2c00)\n" + " (declare (in ) vec4 y@0x26e2d10)\n" " )\n" " (\n" " ))\n" @@ -10778,8 +10778,8 @@ static const char *prototypes_for_110_frag = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15390f0)\n" - " (declare (in ) vec3 y@0x1539200)\n" + " (declare (in ) vec3 x@0x26e2ef0)\n" + " (declare (in ) vec3 y@0x26e3000)\n" " )\n" " (\n" " ))\n" @@ -10789,28 +10789,28 @@ static const char *prototypes_for_110_frag = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x15395b0)\n" + " (declare (in ) float x@0x26e3380)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1539970)\n" + " (declare (in ) vec2 x@0x26e3710)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1539b50)\n" + " (declare (in ) vec3 x@0x26e38f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1539d30)\n" + " (declare (in ) vec4 x@0x26e3ad0)\n" " )\n" " (\n" " ))\n" @@ -10820,36 +10820,36 @@ static const char *prototypes_for_110_frag = "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x1539f10)\n" - " (declare (in ) float I@0x153a020)\n" - " (declare (in ) float Nref@0x153a130)\n" + " (declare (in ) float N@0x26e3cb0)\n" + " (declare (in ) float I@0x26e3dc0)\n" + " (declare (in ) float Nref@0x26e3ed0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x153a4f0)\n" - " (declare (in ) vec2 I@0x153a600)\n" - " (declare (in ) vec2 Nref@0x153a710)\n" + " (declare (in ) vec2 N@0x26e4260)\n" + " (declare (in ) vec2 I@0x26e4370)\n" + " (declare (in ) vec2 Nref@0x26e4480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x153a8f0)\n" - " (declare (in ) vec3 I@0x153aa00)\n" - " (declare (in ) vec3 Nref@0x153ab10)\n" + " (declare (in ) vec3 N@0x26e4660)\n" + " (declare (in ) vec3 I@0x26e4770)\n" + " (declare (in ) vec3 Nref@0x26e4880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x153acf0)\n" - " (declare (in ) vec4 I@0x153ae00)\n" - " (declare (in ) vec4 Nref@0x153af10)\n" + " (declare (in ) vec4 N@0x26e4a60)\n" + " (declare (in ) vec4 I@0x26e4b70)\n" + " (declare (in ) vec4 Nref@0x26e4c80)\n" " )\n" " (\n" " ))\n" @@ -10859,32 +10859,32 @@ static const char *prototypes_for_110_frag = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x153b0f0)\n" - " (declare (in ) float N@0x153b200)\n" + " (declare (in ) float I@0x26e4e60)\n" + " (declare (in ) float N@0x26e4f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x153b5c0)\n" - " (declare (in ) vec2 N@0x153b6d0)\n" + " (declare (in ) vec2 I@0x26e52f0)\n" + " (declare (in ) vec2 N@0x26e5400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x153b8b0)\n" - " (declare (in ) vec3 N@0x153b9c0)\n" + " (declare (in ) vec3 I@0x26e55e0)\n" + " (declare (in ) vec3 N@0x26e56f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x153bba0)\n" - " (declare (in ) vec4 N@0x153bcb0)\n" + " (declare (in ) vec4 I@0x26e58d0)\n" + " (declare (in ) vec4 N@0x26e59e0)\n" " )\n" " (\n" " ))\n" @@ -10894,36 +10894,36 @@ static const char *prototypes_for_110_frag = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x153be90)\n" - " (declare (in ) float N@0x153bfa0)\n" - " (declare (in ) float eta@0x153c0b0)\n" + " (declare (in ) float I@0x26e5bc0)\n" + " (declare (in ) float N@0x26e5cd0)\n" + " (declare (in ) float eta@0x26e5de0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x153c470)\n" - " (declare (in ) vec2 N@0x153c580)\n" - " (declare (in ) float eta@0x153c690)\n" + " (declare (in ) vec2 I@0x26e6160)\n" + " (declare (in ) vec2 N@0x26e6270)\n" + " (declare (in ) float eta@0x26e6380)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x153c870)\n" - " (declare (in ) vec3 N@0x153c980)\n" - " (declare (in ) float eta@0x153ca90)\n" + " (declare (in ) vec3 I@0x26e6560)\n" + " (declare (in ) vec3 N@0x26e6670)\n" + " (declare (in ) float eta@0x26e6780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x153cc70)\n" - " (declare (in ) vec4 N@0x153cd80)\n" - " (declare (in ) float eta@0x153ce90)\n" + " (declare (in ) vec4 I@0x26e6960)\n" + " (declare (in ) vec4 N@0x26e6a70)\n" + " (declare (in ) float eta@0x26e6b80)\n" " )\n" " (\n" " ))\n" @@ -10933,24 +10933,24 @@ static const char *prototypes_for_110_frag = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x153d070)\n" - " (declare (in ) mat2 y@0x153d180)\n" + " (declare (in ) mat2 x@0x26e6d60)\n" + " (declare (in ) mat2 y@0x26e6e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x153d540)\n" - " (declare (in ) mat3 y@0x153d650)\n" + " (declare (in ) mat3 x@0x26e7200)\n" + " (declare (in ) mat3 y@0x26e7310)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x153d830)\n" - " (declare (in ) mat4 y@0x153d940)\n" + " (declare (in ) mat4 x@0x26e74f0)\n" + " (declare (in ) mat4 y@0x26e7600)\n" " )\n" " (\n" " ))\n" @@ -10960,48 +10960,48 @@ static const char *prototypes_for_110_frag = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x153db20)\n" - " (declare (in ) vec2 y@0x153dc30)\n" + " (declare (in ) vec2 x@0x26e77e0)\n" + " (declare (in ) vec2 y@0x26e78f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x153dff0)\n" - " (declare (in ) vec3 y@0x153e100)\n" + " (declare (in ) vec3 x@0x26e7c80)\n" + " (declare (in ) vec3 y@0x26e7d90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x153e2e0)\n" - " (declare (in ) vec4 y@0x153e3f0)\n" + " (declare (in ) vec4 x@0x26e7f70)\n" + " (declare (in ) vec4 y@0x26e8080)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x153e5d0)\n" - " (declare (in ) ivec2 y@0x153e6e0)\n" + " (declare (in ) ivec2 x@0x26e8260)\n" + " (declare (in ) ivec2 y@0x26e8370)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x153e8c0)\n" - " (declare (in ) ivec3 y@0x153e9d0)\n" + " (declare (in ) ivec3 x@0x26e8550)\n" + " (declare (in ) ivec3 y@0x26e8660)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x153ebb0)\n" - " (declare (in ) ivec4 y@0x153ecc0)\n" + " (declare (in ) ivec4 x@0x26e8840)\n" + " (declare (in ) ivec4 y@0x26e8950)\n" " )\n" " (\n" " ))\n" @@ -11011,48 +11011,48 @@ static const char *prototypes_for_110_frag = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x153eea0)\n" - " (declare (in ) vec2 y@0x153efb0)\n" + " (declare (in ) vec2 x@0x26e8b30)\n" + " (declare (in ) vec2 y@0x26e8c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x153f370)\n" - " (declare (in ) vec3 y@0x153f480)\n" + " (declare (in ) vec3 x@0x26e8fd0)\n" + " (declare (in ) vec3 y@0x26e90e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x153f660)\n" - " (declare (in ) vec4 y@0x153f770)\n" + " (declare (in ) vec4 x@0x26e92c0)\n" + " (declare (in ) vec4 y@0x26e93d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x153f950)\n" - " (declare (in ) ivec2 y@0x153fa60)\n" + " (declare (in ) ivec2 x@0x26e95b0)\n" + " (declare (in ) ivec2 y@0x26e96c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x153fc40)\n" - " (declare (in ) ivec3 y@0x153fd50)\n" + " (declare (in ) ivec3 x@0x26e98a0)\n" + " (declare (in ) ivec3 y@0x26e99b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x153ff30)\n" - " (declare (in ) ivec4 y@0x1540040)\n" + " (declare (in ) ivec4 x@0x26e9b90)\n" + " (declare (in ) ivec4 y@0x26e9ca0)\n" " )\n" " (\n" " ))\n" @@ -11062,48 +11062,48 @@ static const char *prototypes_for_110_frag = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1540220)\n" - " (declare (in ) vec2 y@0x1540330)\n" + " (declare (in ) vec2 x@0x26e9e80)\n" + " (declare (in ) vec2 y@0x26e9f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x15406f0)\n" - " (declare (in ) vec3 y@0x1540800)\n" + " (declare (in ) vec3 x@0x26ea320)\n" + " (declare (in ) vec3 y@0x26ea430)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15409e0)\n" - " (declare (in ) vec4 y@0x1540af0)\n" + " (declare (in ) vec4 x@0x26ea610)\n" + " (declare (in ) vec4 y@0x26ea720)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1540cd0)\n" - " (declare (in ) ivec2 y@0x1540de0)\n" + " (declare (in ) ivec2 x@0x26ea900)\n" + " (declare (in ) ivec2 y@0x26eaa10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1540fc0)\n" - " (declare (in ) ivec3 y@0x15410d0)\n" + " (declare (in ) ivec3 x@0x26eabf0)\n" + " (declare (in ) ivec3 y@0x26ead00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15412b0)\n" - " (declare (in ) ivec4 y@0x15413c0)\n" + " (declare (in ) ivec4 x@0x26eaee0)\n" + " (declare (in ) ivec4 y@0x26eaff0)\n" " )\n" " (\n" " ))\n" @@ -11113,48 +11113,48 @@ static const char *prototypes_for_110_frag = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x15415a0)\n" - " (declare (in ) vec2 y@0x15416b0)\n" + " (declare (in ) vec2 x@0x26eb1d0)\n" + " (declare (in ) vec2 y@0x26eb2e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1541a70)\n" - " (declare (in ) vec3 y@0x1541b80)\n" + " (declare (in ) vec3 x@0x26eb670)\n" + " (declare (in ) vec3 y@0x26eb780)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1541d60)\n" - " (declare (in ) vec4 y@0x1541e70)\n" + " (declare (in ) vec4 x@0x26eb960)\n" + " (declare (in ) vec4 y@0x26eba70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1542050)\n" - " (declare (in ) ivec2 y@0x1542160)\n" + " (declare (in ) ivec2 x@0x26ebc50)\n" + " (declare (in ) ivec2 y@0x26ebd60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1542340)\n" - " (declare (in ) ivec3 y@0x1542450)\n" + " (declare (in ) ivec3 x@0x26ebf40)\n" + " (declare (in ) ivec3 y@0x26ec050)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x1542630)\n" - " (declare (in ) ivec4 y@0x1542740)\n" + " (declare (in ) ivec4 x@0x26ec230)\n" + " (declare (in ) ivec4 y@0x26ec340)\n" " )\n" " (\n" " ))\n" @@ -11164,72 +11164,72 @@ static const char *prototypes_for_110_frag = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1542920)\n" - " (declare (in ) vec2 y@0x1542a30)\n" + " (declare (in ) vec2 x@0x26ec520)\n" + " (declare (in ) vec2 y@0x26ec630)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1542de0)\n" - " (declare (in ) vec3 y@0x1542ef0)\n" + " (declare (in ) vec3 x@0x26ec9b0)\n" + " (declare (in ) vec3 y@0x26ecac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15430d0)\n" - " (declare (in ) vec4 y@0x15431e0)\n" + " (declare (in ) vec4 x@0x26ecca0)\n" + " (declare (in ) vec4 y@0x26ecdb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x15433c0)\n" - " (declare (in ) ivec2 y@0x15434d0)\n" + " (declare (in ) ivec2 x@0x26ecf90)\n" + " (declare (in ) ivec2 y@0x26ed0a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x15436b0)\n" - " (declare (in ) ivec3 y@0x15437c0)\n" + " (declare (in ) ivec3 x@0x26ed280)\n" + " (declare (in ) ivec3 y@0x26ed390)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15439a0)\n" - " (declare (in ) ivec4 y@0x1543ab0)\n" + " (declare (in ) ivec4 x@0x26ed570)\n" + " (declare (in ) ivec4 y@0x26ed680)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1543c90)\n" - " (declare (in ) bvec2 y@0x1543da0)\n" + " (declare (in ) bvec2 x@0x26ed860)\n" + " (declare (in ) bvec2 y@0x26ed970)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1543f80)\n" - " (declare (in ) bvec3 y@0x1544090)\n" + " (declare (in ) bvec3 x@0x26edb50)\n" + " (declare (in ) bvec3 y@0x26edc60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1544270)\n" - " (declare (in ) bvec4 y@0x1544380)\n" + " (declare (in ) bvec4 x@0x26ede40)\n" + " (declare (in ) bvec4 y@0x26edf50)\n" " )\n" " (\n" " ))\n" @@ -11239,72 +11239,72 @@ static const char *prototypes_for_110_frag = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1544560)\n" - " (declare (in ) vec2 y@0x1544670)\n" + " (declare (in ) vec2 x@0x26ee130)\n" + " (declare (in ) vec2 y@0x26ee240)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1544a30)\n" - " (declare (in ) vec3 y@0x1544b40)\n" + " (declare (in ) vec3 x@0x26ee5d0)\n" + " (declare (in ) vec3 y@0x26ee6e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x1544d20)\n" - " (declare (in ) vec4 y@0x1544e30)\n" + " (declare (in ) vec4 x@0x26ee8c0)\n" + " (declare (in ) vec4 y@0x26ee9d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x1545010)\n" - " (declare (in ) ivec2 y@0x1545120)\n" + " (declare (in ) ivec2 x@0x26eebb0)\n" + " (declare (in ) ivec2 y@0x26eecc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x1545300)\n" - " (declare (in ) ivec3 y@0x1545410)\n" + " (declare (in ) ivec3 x@0x26eeea0)\n" + " (declare (in ) ivec3 y@0x26eefb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x15455f0)\n" - " (declare (in ) ivec4 y@0x1545700)\n" + " (declare (in ) ivec4 x@0x26ef190)\n" + " (declare (in ) ivec4 y@0x26ef2a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x15458e0)\n" - " (declare (in ) bvec2 y@0x15459f0)\n" + " (declare (in ) bvec2 x@0x26ef480)\n" + " (declare (in ) bvec2 y@0x26ef590)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1545bd0)\n" - " (declare (in ) bvec3 y@0x1545ce0)\n" + " (declare (in ) bvec3 x@0x26ef770)\n" + " (declare (in ) bvec3 y@0x26ef880)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1545ec0)\n" - " (declare (in ) bvec4 y@0x1545fd0)\n" + " (declare (in ) bvec4 x@0x26efa60)\n" + " (declare (in ) bvec4 y@0x26efb70)\n" " )\n" " (\n" " ))\n" @@ -11314,21 +11314,21 @@ static const char *prototypes_for_110_frag = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x15461b0)\n" + " (declare (in ) bvec2 x@0x26efd50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1546560)\n" + " (declare (in ) bvec3 x@0x26f00d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1546740)\n" + " (declare (in ) bvec4 x@0x26f02b0)\n" " )\n" " (\n" " ))\n" @@ -11338,21 +11338,21 @@ static const char *prototypes_for_110_frag = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1546920)\n" + " (declare (in ) bvec2 x@0x26f0490)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1546cd0)\n" + " (declare (in ) bvec3 x@0x26f0810)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1546eb0)\n" + " (declare (in ) bvec4 x@0x26f09f0)\n" " )\n" " (\n" " ))\n" @@ -11362,21 +11362,21 @@ static const char *prototypes_for_110_frag = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x1547090)\n" + " (declare (in ) bvec2 x@0x26f0bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x1547440)\n" + " (declare (in ) bvec3 x@0x26f0f50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x1547620)\n" + " (declare (in ) bvec4 x@0x26f1130)\n" " )\n" " (\n" " ))\n" @@ -11386,17 +11386,17 @@ static const char *prototypes_for_110_frag = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1547800)\n" - " (declare (in ) float coord@0x1547920)\n" + " (declare (in ) sampler1D sampler@0x26f1310)\n" + " (declare (in ) float coord@0x26f1420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x15484c0)\n" - " (declare (in ) float coord@0x15485e0)\n" - " (declare (in ) float bias@0x15486f0)\n" + " (declare (in ) sampler1D sampler@0x26f1f40)\n" + " (declare (in ) float coord@0x26f2050)\n" + " (declare (in ) float bias@0x26f2160)\n" " )\n" " (\n" " ))\n" @@ -11406,34 +11406,34 @@ static const char *prototypes_for_110_frag = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1547ce0)\n" - " (declare (in ) vec2 coord@0x1547e00)\n" + " (declare (in ) sampler1D sampler@0x26f17b0)\n" + " (declare (in ) vec2 coord@0x26f18c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x15481c0)\n" - " (declare (in ) vec4 coord@0x15482e0)\n" + " (declare (in ) sampler1D sampler@0x26f1c50)\n" + " (declare (in ) vec4 coord@0x26f1d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x15488d0)\n" - " (declare (in ) vec2 coord@0x15489f0)\n" - " (declare (in ) float bias@0x1548b00)\n" + " (declare (in ) sampler1D sampler@0x26f2340)\n" + " (declare (in ) vec2 coord@0x26f2450)\n" + " (declare (in ) float bias@0x26f2560)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x1548ce0)\n" - " (declare (in ) vec4 coord@0x1548e00)\n" - " (declare (in ) float bias@0x1548f10)\n" + " (declare (in ) sampler1D sampler@0x26f2740)\n" + " (declare (in ) vec4 coord@0x26f2850)\n" + " (declare (in ) float bias@0x26f2960)\n" " )\n" " (\n" " ))\n" @@ -11443,17 +11443,17 @@ static const char *prototypes_for_110_frag = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x15490f0)\n" - " (declare (in ) vec2 coord@0x1549210)\n" + " (declare (in ) sampler2D sampler@0x26f2b40)\n" + " (declare (in ) vec2 coord@0x26f2c50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1549db0)\n" - " (declare (in ) vec2 coord@0x1549ed0)\n" - " (declare (in ) float bias@0x1549fe0)\n" + " (declare (in ) sampler2D sampler@0x26f3770)\n" + " (declare (in ) vec2 coord@0x26f3880)\n" + " (declare (in ) float bias@0x26f3990)\n" " )\n" " (\n" " ))\n" @@ -11463,34 +11463,34 @@ static const char *prototypes_for_110_frag = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x15495d0)\n" - " (declare (in ) vec3 coord@0x15496f0)\n" + " (declare (in ) sampler2D sampler@0x26f2fe0)\n" + " (declare (in ) vec3 coord@0x26f30f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x1549ab0)\n" - " (declare (in ) vec4 coord@0x1549bd0)\n" + " (declare (in ) sampler2D sampler@0x26f3480)\n" + " (declare (in ) vec4 coord@0x26f3590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x154a1c0)\n" - " (declare (in ) vec3 coord@0x154a2e0)\n" - " (declare (in ) float bias@0x154a3f0)\n" + " (declare (in ) sampler2D sampler@0x26f3b70)\n" + " (declare (in ) vec3 coord@0x26f3c80)\n" + " (declare (in ) float bias@0x26f3d90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x154a5d0)\n" - " (declare (in ) vec4 coord@0x154a6f0)\n" - " (declare (in ) float bias@0x154a800)\n" + " (declare (in ) sampler2D sampler@0x26f3f70)\n" + " (declare (in ) vec4 coord@0x26f4080)\n" + " (declare (in ) float bias@0x26f4190)\n" " )\n" " (\n" " ))\n" @@ -11500,17 +11500,17 @@ static const char *prototypes_for_110_frag = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x154a9e0)\n" - " (declare (in ) vec3 coord@0x154ab00)\n" + " (declare (in ) sampler3D sampler@0x26f4370)\n" + " (declare (in ) vec3 coord@0x26f4480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x154b3a0)\n" - " (declare (in ) vec3 coord@0x154b4c0)\n" - " (declare (in ) float bias@0x154b5d0)\n" + " (declare (in ) sampler3D sampler@0x26f4cb0)\n" + " (declare (in ) vec3 coord@0x26f4dc0)\n" + " (declare (in ) float bias@0x26f4ed0)\n" " )\n" " (\n" " ))\n" @@ -11520,17 +11520,17 @@ static const char *prototypes_for_110_frag = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x154aec0)\n" - " (declare (in ) vec4 coord@0x154afe0)\n" + " (declare (in ) sampler3D sampler@0x26f4810)\n" + " (declare (in ) vec4 coord@0x26f4920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x154b7b0)\n" - " (declare (in ) vec4 coord@0x154b8d0)\n" - " (declare (in ) float bias@0x154b9e0)\n" + " (declare (in ) sampler3D sampler@0x26f50b0)\n" + " (declare (in ) vec4 coord@0x26f51c0)\n" + " (declare (in ) float bias@0x26f52d0)\n" " )\n" " (\n" " ))\n" @@ -11540,17 +11540,17 @@ static const char *prototypes_for_110_frag = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x154bbc0)\n" - " (declare (in ) vec3 coord@0x154bce0)\n" + " (declare (in ) samplerCube sampler@0x26f54b0)\n" + " (declare (in ) vec3 coord@0x26f55c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x154c0a0)\n" - " (declare (in ) vec3 coord@0x154c1c0)\n" - " (declare (in ) float bias@0x154c2d0)\n" + " (declare (in ) samplerCube sampler@0x26f5950)\n" + " (declare (in ) vec3 coord@0x26f5a60)\n" + " (declare (in ) float bias@0x26f5b70)\n" " )\n" " (\n" " ))\n" @@ -11560,17 +11560,17 @@ static const char *prototypes_for_110_frag = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x154c4b0)\n" - " (declare (in ) vec3 coord@0x154c5d0)\n" + " (declare (in ) sampler1DShadow sampler@0x26f5d50)\n" + " (declare (in ) vec3 coord@0x26f5e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x154d830)\n" - " (declare (in ) vec3 coord@0x154d950)\n" - " (declare (in ) float bias@0x154da60)\n" + " (declare (in ) sampler1DShadow sampler@0x26f6fd0)\n" + " (declare (in ) vec3 coord@0x26f70e0)\n" + " (declare (in ) float bias@0x26f71f0)\n" " )\n" " (\n" " ))\n" @@ -11580,17 +11580,17 @@ static const char *prototypes_for_110_frag = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x154c990)\n" - " (declare (in ) vec3 coord@0x154cab0)\n" + " (declare (in ) sampler2DShadow sampler@0x26f61f0)\n" + " (declare (in ) vec3 coord@0x26f6300)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x154dc40)\n" - " (declare (in ) vec3 coord@0x154dd60)\n" - " (declare (in ) float bias@0x154de70)\n" + " (declare (in ) sampler2DShadow sampler@0x26f73d0)\n" + " (declare (in ) vec3 coord@0x26f74e0)\n" + " (declare (in ) float bias@0x26f75f0)\n" " )\n" " (\n" " ))\n" @@ -11600,17 +11600,17 @@ static const char *prototypes_for_110_frag = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x154ce70)\n" - " (declare (in ) vec4 coord@0x154cf90)\n" + " (declare (in ) sampler1DShadow sampler@0x26f6690)\n" + " (declare (in ) vec4 coord@0x26f67a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x154e050)\n" - " (declare (in ) vec4 coord@0x154e170)\n" - " (declare (in ) float bias@0x154e280)\n" + " (declare (in ) sampler1DShadow sampler@0x26f77d0)\n" + " (declare (in ) vec4 coord@0x26f78e0)\n" + " (declare (in ) float bias@0x26f79f0)\n" " )\n" " (\n" " ))\n" @@ -11620,17 +11620,17 @@ static const char *prototypes_for_110_frag = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x154d350)\n" - " (declare (in ) vec4 coord@0x154d470)\n" + " (declare (in ) sampler2DShadow sampler@0x26f6b30)\n" + " (declare (in ) vec4 coord@0x26f6c40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x154e460)\n" - " (declare (in ) vec4 coord@0x154e580)\n" - " (declare (in ) float bias@0x154e690)\n" + " (declare (in ) sampler2DShadow sampler@0x26f7bd0)\n" + " (declare (in ) vec4 coord@0x26f7ce0)\n" + " (declare (in ) float bias@0x26f7df0)\n" " )\n" " (\n" " ))\n" @@ -11640,28 +11640,28 @@ static const char *prototypes_for_110_frag = "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x154e870)\n" + " (declare (in ) float p@0x26f7fd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x154ec20)\n" + " (declare (in ) vec2 p@0x26f8350)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x154ee00)\n" + " (declare (in ) vec3 p@0x26f8530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x154efe0)\n" + " (declare (in ) vec4 p@0x26f8710)\n" " )\n" " (\n" " ))\n" @@ -11671,28 +11671,28 @@ static const char *prototypes_for_110_frag = "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x154f1c0)\n" + " (declare (in ) float p@0x26f88f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x154f570)\n" + " (declare (in ) vec2 p@0x26f8c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x154f750)\n" + " (declare (in ) vec3 p@0x26f8e50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x154f930)\n" + " (declare (in ) vec4 p@0x26f9030)\n" " )\n" " (\n" " ))\n" @@ -11702,28 +11702,28 @@ static const char *prototypes_for_110_frag = "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x154fb10)\n" + " (declare (in ) float p@0x26f9210)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x154fec0)\n" + " (declare (in ) vec2 p@0x26f9590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x15500a0)\n" + " (declare (in ) vec3 p@0x26f9770)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x1550280)\n" + " (declare (in ) vec4 p@0x26f9950)\n" " )\n" " (\n" " ))\n" @@ -11733,28 +11733,28 @@ static const char *prototypes_for_110_frag = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x1550460)\n" + " (declare (in ) float x@0x26f9b30)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x1550810)\n" + " (declare (in ) vec2 x@0x26f9eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x15509f0)\n" + " (declare (in ) vec3 x@0x26fa090)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x1550bd0)\n" + " (declare (in ) vec4 x@0x26fa270)\n" " )\n" " (\n" " ))\n" @@ -11764,28 +11764,28 @@ static const char *prototypes_for_110_frag = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x1550db0)\n" + " (declare (in ) float x@0x26fa450)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x1551160)\n" + " (declare (in ) vec2 x@0x26fa7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x1551340)\n" + " (declare (in ) vec3 x@0x26fa9b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x1551520)\n" + " (declare (in ) vec4 x@0x26fab90)\n" " )\n" " (\n" " ))\n" @@ -11795,28 +11795,28 @@ static const char *prototypes_for_110_frag = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x1551700)\n" + " (declare (in ) float x@0x26fad70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x1551ab0)\n" + " (declare (in ) vec2 x@0x26fb0f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x1551c90)\n" + " (declare (in ) vec3 x@0x26fb2d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x1551e70)\n" + " (declare (in ) vec4 x@0x26fb4b0)\n" " )\n" " (\n" " ))\n" @@ -11826,28 +11826,28 @@ static const char *prototypes_for_110_frag = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x1552050)\n" + " (declare (in ) float x@0x26fb690)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x1552400)\n" + " (declare (in ) vec2 x@0x26fba10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x15525e0)\n" + " (declare (in ) vec3 x@0x26fbbf0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x15527c0)\n" + " (declare (in ) vec4 x@0x26fbdd0)\n" " )\n" " (\n" " ))\n" @@ -11927,8 +11927,8 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function texture1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x25ee5c0)\n" - " (declare (in ) vec2 coord@0x25ee6e0)\n" + " (declare (in ) sampler1DArray sampler@0x2378290)\n" + " (declare (in ) vec2 coord@0x23783a0)\n" " )\n" " (\n" " ))\n" @@ -11938,9 +11938,9 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function texture1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x25eeaa0)\n" - " (declare (in ) vec2 coord@0x25eebc0)\n" - " (declare (in ) float lod@0x25eecd0)\n" + " (declare (in ) sampler1DArray sampler@0x2378730)\n" + " (declare (in ) vec2 coord@0x2378840)\n" + " (declare (in ) float lod@0x2378950)\n" " )\n" " (\n" " ))\n" @@ -11950,8 +11950,8 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function texture2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x25ef090)\n" - " (declare (in ) vec2 coord@0x25ef1b0)\n" + " (declare (in ) sampler1DArray sampler@0x2378ce0)\n" + " (declare (in ) vec2 coord@0x2378df0)\n" " )\n" " (\n" " ))\n" @@ -11961,9 +11961,9 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function texture2DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArray sampler@0x25ef570)\n" - " (declare (in ) vec2 coord@0x25ef690)\n" - " (declare (in ) float lod@0x25ef7a0)\n" + " (declare (in ) sampler1DArray sampler@0x2379180)\n" + " (declare (in ) vec2 coord@0x2379290)\n" + " (declare (in ) float lod@0x23793a0)\n" " )\n" " (\n" " ))\n" @@ -11973,8 +11973,8 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function shadow1DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x25efb60)\n" - " (declare (in ) vec3 coord@0x25efc80)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x2379730)\n" + " (declare (in ) vec3 coord@0x2379840)\n" " )\n" " (\n" " ))\n" @@ -11984,9 +11984,9 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function shadow1DArrayLod\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DArrayShadow sampler@0x25f0040)\n" - " (declare (in ) vec3 coord@0x25f0160)\n" - " (declare (in ) float lod@0x25f0270)\n" + " (declare (in ) sampler1DArrayShadow sampler@0x2379bd0)\n" + " (declare (in ) vec3 coord@0x2379ce0)\n" + " (declare (in ) float lod@0x2379df0)\n" " )\n" " (\n" " ))\n" @@ -11996,8 +11996,8 @@ static const char *prototypes_for_EXT_texture_array_vert = "(function shadow2DArray\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DArrayShadow sampler@0x25f0630)\n" - " (declare (in ) vec4 coord@0x25f0750)\n" + " (declare (in ) sampler2DArrayShadow sampler@0x237a180)\n" + " (declare (in ) vec4 coord@0x237a290)\n" " )\n" " (\n" " ))\n" @@ -12016,54 +12016,9527 @@ static const char *functions_for_EXT_texture_array_vert [] = { builtin_texture2DArray, builtin_texture1DArray, }; -static const char *prototypes_for_ARB_texture_rectangle_vert = +static const char *prototypes_for_130_frag = "(\n" - "(function texture2DRect\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x141d070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x141d3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x141d5d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x141d7b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x141d990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x141dd10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x141def0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x141e0d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x141e2b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x141e630)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x141e810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x141e9f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x141ebd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x141ef50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x141f130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x141f310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x141f4f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x141f870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x141fa50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x141fc30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x141fe10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1420190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1420370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x1420550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x1420730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x1420ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x1420c90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x1420e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x1421050)\n" + " (declare (in ) float x@0x1421160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x14214e0)\n" + " (declare (in ) vec2 x@0x14215f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x14217d0)\n" + " (declare (in ) vec3 x@0x14218e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x1421ac0)\n" + " (declare (in ) vec4 x@0x1421bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x1421db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x1421fa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x1422190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x1422380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1422570)\n" + " (declare (in ) float y@0x1422680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1422a00)\n" + " (declare (in ) vec2 y@0x1422b10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1422cf0)\n" + " (declare (in ) vec3 y@0x1422e00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1422fe0)\n" + " (declare (in ) vec4 y@0x14230f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x14232d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1423650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1423830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1423a10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1423bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1423f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1424150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1424330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1424510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1424890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1424a70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1424c50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1424e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x14251b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1425390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1425570)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1425750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1425ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1425cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1425e90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1426070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1426400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x14265e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x14267c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x14269a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1426d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1426f00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x14270e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x14272c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x14274a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1427680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1427860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1427a40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1427dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1427fa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1428180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x1428360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1428540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1428720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1428900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1428ae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1428e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1429040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1429220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1429400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1429780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1429960)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1429b40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1429d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x142a0a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x142a280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x142a460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x142a640)\n" + " (declare (in ) float y@0x142a750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x142aad0)\n" + " (declare (in ) float y@0x142abe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x142adc0)\n" + " (declare (in ) float y@0x142aed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x142b0b0)\n" + " (declare (in ) float y@0x142b1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x142b3a0)\n" + " (declare (in ) vec2 y@0x142b4b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x142b690)\n" + " (declare (in ) vec3 y@0x142b7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x142b980)\n" + " (declare (in ) vec4 y@0x142ba90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x142bc70)\n" + " (declare (in ) float y@0x142bd80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x142c100)\n" + " (declare (in ) vec2 y@0x142c210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x142c3f0)\n" + " (declare (in ) vec3 y@0x142c500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x142c6e0)\n" + " (declare (in ) vec4 y@0x142c7f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x142c9d0)\n" + " (declare (in ) float y@0x142cae0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x142ccc0)\n" + " (declare (in ) float y@0x142cdd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x142cfb0)\n" + " (declare (in ) float y@0x142d0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x142d2a0)\n" + " (declare (in ) int y@0x142d3b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x142d590)\n" + " (declare (in ) ivec2 y@0x142d6a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x142d880)\n" + " (declare (in ) ivec3 y@0x142d990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x142db70)\n" + " (declare (in ) ivec4 y@0x142dc80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x142de60)\n" + " (declare (in ) int y@0x142df70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x142e150)\n" + " (declare (in ) int y@0x142e260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x142e440)\n" + " (declare (in ) int y@0x142e550)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x142e730)\n" + " (declare (in ) uint y@0x142e840)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x142ea20)\n" + " (declare (in ) uvec2 y@0x142eb30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x142ed10)\n" + " (declare (in ) uvec3 y@0x142ee20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x142f000)\n" + " (declare (in ) uvec4 y@0x142f110)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x142f2f0)\n" + " (declare (in ) uint y@0x142f400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x142f5e0)\n" + " (declare (in ) uint y@0x142f6f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x142f8d0)\n" + " (declare (in ) uint y@0x142f9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x142fbc0)\n" + " (declare (in ) float y@0x142fcd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1430050)\n" + " (declare (in ) vec2 y@0x1430160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1430340)\n" + " (declare (in ) vec3 y@0x1430450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1430630)\n" + " (declare (in ) vec4 y@0x1430740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1430920)\n" + " (declare (in ) float y@0x1430a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1430c10)\n" + " (declare (in ) float y@0x1430d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1430f00)\n" + " (declare (in ) float y@0x1431010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x14311f0)\n" + " (declare (in ) int y@0x1431300)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x14314e0)\n" + " (declare (in ) ivec2 y@0x14315f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x14317d0)\n" + " (declare (in ) ivec3 y@0x14318e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1431ac0)\n" + " (declare (in ) ivec4 y@0x1431bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1431db0)\n" + " (declare (in ) int y@0x1431ec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x14320a0)\n" + " (declare (in ) int y@0x14321b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1432390)\n" + " (declare (in ) int y@0x14324a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x1432680)\n" + " (declare (in ) uint y@0x1432790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x1432970)\n" + " (declare (in ) uvec2 y@0x1432a80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x1432c60)\n" + " (declare (in ) uvec3 y@0x1432d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x1432f50)\n" + " (declare (in ) uvec4 y@0x1433060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x1433240)\n" + " (declare (in ) uint y@0x1433350)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x1433530)\n" + " (declare (in ) uint y@0x1433640)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x1433820)\n" + " (declare (in ) uint y@0x1433930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1433b10)\n" + " (declare (in ) float minVal@0x1433c20)\n" + " (declare (in ) float maxVal@0x1433d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x14340b0)\n" + " (declare (in ) vec2 minVal@0x14341c0)\n" + " (declare (in ) vec2 maxVal@0x14342d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x14344b0)\n" + " (declare (in ) vec3 minVal@0x14345c0)\n" + " (declare (in ) vec3 maxVal@0x14346d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x14348b0)\n" + " (declare (in ) vec4 minVal@0x14349c0)\n" + " (declare (in ) vec4 maxVal@0x1434ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1434cb0)\n" + " (declare (in ) float minVal@0x1434dc0)\n" + " (declare (in ) float maxVal@0x1434ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x14350b0)\n" + " (declare (in ) float minVal@0x14351c0)\n" + " (declare (in ) float maxVal@0x14352d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x14354b0)\n" + " (declare (in ) float minVal@0x14355c0)\n" + " (declare (in ) float maxVal@0x14356d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x14358b0)\n" + " (declare (in ) int minVal@0x14359c0)\n" + " (declare (in ) int maxVal@0x1435ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1435cb0)\n" + " (declare (in ) ivec2 minVal@0x1435dc0)\n" + " (declare (in ) ivec2 maxVal@0x1435ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x14360b0)\n" + " (declare (in ) ivec3 minVal@0x14361c0)\n" + " (declare (in ) ivec3 maxVal@0x14362d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x14364b0)\n" + " (declare (in ) ivec4 minVal@0x14365c0)\n" + " (declare (in ) ivec4 maxVal@0x14366d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x14368b0)\n" + " (declare (in ) int minVal@0x14369c0)\n" + " (declare (in ) int maxVal@0x1436ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1436cb0)\n" + " (declare (in ) int minVal@0x1436dc0)\n" + " (declare (in ) int maxVal@0x1436ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x14370b0)\n" + " (declare (in ) int minVal@0x14371c0)\n" + " (declare (in ) int maxVal@0x14372d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x14374b0)\n" + " (declare (in ) uint minVal@0x14375c0)\n" + " (declare (in ) uint maxVal@0x14376d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x14378b0)\n" + " (declare (in ) uvec2 minVal@0x14379c0)\n" + " (declare (in ) uvec2 maxVal@0x1437ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x1437cb0)\n" + " (declare (in ) uvec3 minVal@0x1437dc0)\n" + " (declare (in ) uvec3 maxVal@0x1437ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x14380b0)\n" + " (declare (in ) uvec4 minVal@0x14381c0)\n" + " (declare (in ) uvec4 maxVal@0x14382d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x14384b0)\n" + " (declare (in ) uint minVal@0x14385c0)\n" + " (declare (in ) uint maxVal@0x14386d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x14388b0)\n" + " (declare (in ) uint minVal@0x14389c0)\n" + " (declare (in ) uint maxVal@0x1438ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x1438cb0)\n" + " (declare (in ) uint minVal@0x1438dc0)\n" + " (declare (in ) uint maxVal@0x1438ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x14390b0)\n" + " (declare (in ) float y@0x14391c0)\n" + " (declare (in ) float a@0x14392d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1439650)\n" + " (declare (in ) vec2 y@0x1439760)\n" + " (declare (in ) vec2 a@0x1439870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1439a50)\n" + " (declare (in ) vec3 y@0x1439b60)\n" + " (declare (in ) vec3 a@0x1439c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1439e50)\n" + " (declare (in ) vec4 y@0x1439f60)\n" + " (declare (in ) vec4 a@0x143a070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x143a250)\n" + " (declare (in ) vec2 y@0x143a360)\n" + " (declare (in ) float a@0x143a470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x143a650)\n" + " (declare (in ) vec3 y@0x143a760)\n" + " (declare (in ) float a@0x143a870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x143aa50)\n" + " (declare (in ) vec4 y@0x143ab60)\n" + " (declare (in ) float a@0x143ac70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x143ae50)\n" + " (declare (in ) float x@0x143af60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x143b2e0)\n" + " (declare (in ) vec2 x@0x143b3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x143b5d0)\n" + " (declare (in ) vec3 x@0x143b6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x143b8c0)\n" + " (declare (in ) vec4 x@0x143b9d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x143bbb0)\n" + " (declare (in ) vec2 x@0x143bcc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x143bea0)\n" + " (declare (in ) vec3 x@0x143bfb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x143c190)\n" + " (declare (in ) vec4 x@0x143c2a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x143c480)\n" + " (declare (in ) float edge1@0x143c590)\n" + " (declare (in ) float x@0x143c6a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x143ca30)\n" + " (declare (in ) vec2 edge1@0x143cb40)\n" + " (declare (in ) vec2 x@0x143cc50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x143ce30)\n" + " (declare (in ) vec3 edge1@0x143cf40)\n" + " (declare (in ) vec3 x@0x143d050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x143d230)\n" + " (declare (in ) vec4 edge1@0x143d340)\n" + " (declare (in ) vec4 x@0x143d450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x143d630)\n" + " (declare (in ) float edge1@0x143d740)\n" + " (declare (in ) vec2 x@0x143d850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x143da30)\n" + " (declare (in ) float edge1@0x143db40)\n" + " (declare (in ) vec3 x@0x143dc50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x143de30)\n" + " (declare (in ) float edge1@0x143df40)\n" + " (declare (in ) vec4 x@0x143e050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x143e230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x143e5b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x143e790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x143e970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x143eb50)\n" + " (declare (in ) float p1@0x143ec60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x143eff0)\n" + " (declare (in ) vec2 p1@0x143f100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x143f2e0)\n" + " (declare (in ) vec3 p1@0x143f3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x143f5d0)\n" + " (declare (in ) vec4 p1@0x143f6e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x143f8c0)\n" + " (declare (in ) float y@0x143f9d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x143fd50)\n" + " (declare (in ) vec2 y@0x143fe60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1440040)\n" + " (declare (in ) vec3 y@0x1440150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1440330)\n" + " (declare (in ) vec4 y@0x1440440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1440620)\n" + " (declare (in ) vec3 y@0x1440730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1440ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1440e40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1441020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1441200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x14413e0)\n" + " (declare (in ) float I@0x14414f0)\n" + " (declare (in ) float Nref@0x1441600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x1441990)\n" + " (declare (in ) vec2 I@0x1441aa0)\n" + " (declare (in ) vec2 Nref@0x1441bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x1441d90)\n" + " (declare (in ) vec3 I@0x1441ea0)\n" + " (declare (in ) vec3 Nref@0x1441fb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x1442190)\n" + " (declare (in ) vec4 I@0x14422a0)\n" + " (declare (in ) vec4 Nref@0x14423b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x1442590)\n" + " (declare (in ) float N@0x14426a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x1442a20)\n" + " (declare (in ) vec2 N@0x1442b30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x1442d10)\n" + " (declare (in ) vec3 N@0x1442e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x1443000)\n" + " (declare (in ) vec4 N@0x1443110)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x14432f0)\n" + " (declare (in ) float N@0x1443400)\n" + " (declare (in ) float eta@0x1443510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x1443890)\n" + " (declare (in ) vec2 N@0x14439a0)\n" + " (declare (in ) float eta@0x1443ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x1443c90)\n" + " (declare (in ) vec3 N@0x1443da0)\n" + " (declare (in ) float eta@0x1443eb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x1444090)\n" + " (declare (in ) vec4 N@0x14441a0)\n" + " (declare (in ) float eta@0x14442b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0x1444490)\n" + " (declare (in ) mat2 y@0x14445a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0x1444930)\n" + " (declare (in ) mat3 y@0x1444a40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0x1444c20)\n" + " (declare (in ) mat4 y@0x1444d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat2x3 x@0x1444f10)\n" + " (declare (in ) mat2x3 y@0x1445020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat2x4 x@0x1445200)\n" + " (declare (in ) mat2x4 y@0x1445310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat3x2 x@0x14454f0)\n" + " (declare (in ) mat3x2 y@0x1445600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat3x4 x@0x14457e0)\n" + " (declare (in ) mat3x4 y@0x14458f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat4x2 x@0x1445ad0)\n" + " (declare (in ) mat4x2 y@0x1445be0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat4x3 x@0x1445dc0)\n" + " (declare (in ) mat4x3 y@0x1445ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x14460b0)\n" + " (declare (in ) vec2 r@0x14461c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x1446550)\n" + " (declare (in ) vec3 r@0x1446660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x1446840)\n" + " (declare (in ) vec4 r@0x1446950)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x1446b30)\n" + " (declare (in ) vec2 r@0x1446c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x1446e20)\n" + " (declare (in ) vec3 r@0x1446f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x1447110)\n" + " (declare (in ) vec2 r@0x1447220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x1447400)\n" + " (declare (in ) vec4 r@0x1447510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x14476f0)\n" + " (declare (in ) vec3 r@0x1447800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x14479e0)\n" + " (declare (in ) vec4 r@0x1447af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 m@0x1447cd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 m@0x1448060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 m@0x1448240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat3x2 m@0x1448420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat2x3 m@0x1448600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat4x2 m@0x14487e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat2x4 m@0x14489c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat4x3 m@0x1448ba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat3x4 m@0x1448d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1448f60)\n" + " (declare (in ) vec2 y@0x1449070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1449400)\n" + " (declare (in ) vec3 y@0x1449510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x14496f0)\n" + " (declare (in ) vec4 y@0x1449800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x14499e0)\n" + " (declare (in ) ivec2 y@0x1449af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1449cd0)\n" + " (declare (in ) ivec3 y@0x1449de0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1449fc0)\n" + " (declare (in ) ivec4 y@0x144a0d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x144a2b0)\n" + " (declare (in ) uvec2 y@0x144a3c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x144a5a0)\n" + " (declare (in ) uvec3 y@0x144a6b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x144a890)\n" + " (declare (in ) uvec4 y@0x144a9a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x144ab80)\n" + " (declare (in ) vec2 y@0x144ac90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x144b020)\n" + " (declare (in ) vec3 y@0x144b130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x144b310)\n" + " (declare (in ) vec4 y@0x144b420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x144b600)\n" + " (declare (in ) ivec2 y@0x144b710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x144b8f0)\n" + " (declare (in ) ivec3 y@0x144ba00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x144bbe0)\n" + " (declare (in ) ivec4 y@0x144bcf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x144bed0)\n" + " (declare (in ) uvec2 y@0x144bfe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x144c1c0)\n" + " (declare (in ) uvec3 y@0x144c2d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x144c4b0)\n" + " (declare (in ) uvec4 y@0x144c5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x144c7a0)\n" + " (declare (in ) vec2 y@0x144c8b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x144cc40)\n" + " (declare (in ) vec3 y@0x144cd50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x144cf30)\n" + " (declare (in ) vec4 y@0x144d040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x144d220)\n" + " (declare (in ) ivec2 y@0x144d330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x144d510)\n" + " (declare (in ) ivec3 y@0x144d620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x144d800)\n" + " (declare (in ) ivec4 y@0x144d910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x144daf0)\n" + " (declare (in ) uvec2 y@0x144dc00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x144dde0)\n" + " (declare (in ) uvec3 y@0x144def0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x144e0d0)\n" + " (declare (in ) uvec4 y@0x144e1e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x144e3c0)\n" + " (declare (in ) vec2 y@0x144e4d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x144e860)\n" + " (declare (in ) vec3 y@0x144e970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x144eb50)\n" + " (declare (in ) vec4 y@0x144ec60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x144ee40)\n" + " (declare (in ) ivec2 y@0x144ef50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x144f130)\n" + " (declare (in ) ivec3 y@0x144f240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x144f420)\n" + " (declare (in ) ivec4 y@0x144f530)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x144f710)\n" + " (declare (in ) uvec2 y@0x144f820)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x144fa00)\n" + " (declare (in ) uvec3 y@0x144fb10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x144fcf0)\n" + " (declare (in ) uvec4 y@0x144fe00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x144ffe0)\n" + " (declare (in ) vec2 y@0x14500f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1450470)\n" + " (declare (in ) vec3 y@0x1450580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1450760)\n" + " (declare (in ) vec4 y@0x1450870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1450a50)\n" + " (declare (in ) ivec2 y@0x1450b60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1450d40)\n" + " (declare (in ) ivec3 y@0x1450e50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1451030)\n" + " (declare (in ) ivec4 y@0x1451140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x1451320)\n" + " (declare (in ) uvec2 y@0x1451430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x1451610)\n" + " (declare (in ) uvec3 y@0x1451720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x1451900)\n" + " (declare (in ) uvec4 y@0x1451a10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x1451bf0)\n" + " (declare (in ) bvec2 y@0x1451d00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1451ee0)\n" + " (declare (in ) bvec3 y@0x1451ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x14521d0)\n" + " (declare (in ) bvec4 y@0x14522e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x14524c0)\n" + " (declare (in ) vec2 y@0x14525d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1452960)\n" + " (declare (in ) vec3 y@0x1452a70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1452c50)\n" + " (declare (in ) vec4 y@0x1452d60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x1452f40)\n" + " (declare (in ) ivec2 y@0x1453050)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x1453230)\n" + " (declare (in ) ivec3 y@0x1453340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x1453520)\n" + " (declare (in ) ivec4 y@0x1453630)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x1453810)\n" + " (declare (in ) uvec2 y@0x1453920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x1453b00)\n" + " (declare (in ) uvec3 y@0x1453c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x1453df0)\n" + " (declare (in ) uvec4 y@0x1453f00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x14540e0)\n" + " (declare (in ) bvec2 y@0x14541f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x14543d0)\n" + " (declare (in ) bvec3 y@0x14544e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x14546c0)\n" + " (declare (in ) bvec4 y@0x14547d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x14549b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1454d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1454f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x14550f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1455470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1455650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x1455830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x1455bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x1455d90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1455f70)\n" + " (declare (in ) float P@0x1456080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1456400)\n" + " (declare (in ) float P@0x1456510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x14566f0)\n" + " (declare (in ) float P@0x1456800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14569e0)\n" + " (declare (in ) vec2 P@0x1456af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1456cd0)\n" + " (declare (in ) vec2 P@0x1456de0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1456fc0)\n" + " (declare (in ) vec2 P@0x14570d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x14572b0)\n" + " (declare (in ) vec3 P@0x14573c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x14575a0)\n" + " (declare (in ) vec3 P@0x14576b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1457890)\n" + " (declare (in ) vec3 P@0x14579a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x1457b80)\n" + " (declare (in ) vec3 P@0x1457c90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x1457e70)\n" + " (declare (in ) vec3 P@0x1457f80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x1458160)\n" + " (declare (in ) vec3 P@0x1458270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1458450)\n" + " (declare (in ) vec3 P@0x1458560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1458740)\n" + " (declare (in ) vec3 P@0x1458850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x1458a30)\n" + " (declare (in ) vec4 P@0x1458b40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x1458d20)\n" + " (declare (in ) vec2 P@0x1458e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x1459010)\n" + " (declare (in ) vec2 P@0x1459120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x1459300)\n" + " (declare (in ) vec2 P@0x1459410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x14595f0)\n" + " (declare (in ) vec3 P@0x1459700)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x14598e0)\n" + " (declare (in ) vec3 P@0x14599f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x1459bd0)\n" + " (declare (in ) vec3 P@0x1459ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x1459ec0)\n" + " (declare (in ) vec3 P@0x1459fd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0x145a1b0)\n" + " (declare (in ) vec4 P@0x145a2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x145a4a0)\n" + " (declare (in ) float P@0x145a5b0)\n" + " (declare (in ) float bias@0x145a6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x145a8a0)\n" + " (declare (in ) float P@0x145a9b0)\n" + " (declare (in ) float bias@0x145aac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x145aca0)\n" + " (declare (in ) float P@0x145adb0)\n" + " (declare (in ) float bias@0x145aec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x145b0a0)\n" + " (declare (in ) vec2 P@0x145b1b0)\n" + " (declare (in ) float bias@0x145b2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x145b4a0)\n" + " (declare (in ) vec2 P@0x145b5b0)\n" + " (declare (in ) float bias@0x145b6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x145b8a0)\n" + " (declare (in ) vec2 P@0x145b9b0)\n" + " (declare (in ) float bias@0x145bac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x145bca0)\n" + " (declare (in ) vec3 P@0x145bdb0)\n" + " (declare (in ) float bias@0x145bec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x145c0a0)\n" + " (declare (in ) vec3 P@0x145c1b0)\n" + " (declare (in ) float bias@0x145c2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x145c4a0)\n" + " (declare (in ) vec3 P@0x145c5b0)\n" + " (declare (in ) float bias@0x145c6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x145c8a0)\n" + " (declare (in ) vec3 P@0x145c9b0)\n" + " (declare (in ) float bias@0x145cac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x145cca0)\n" + " (declare (in ) vec3 P@0x145cdb0)\n" + " (declare (in ) float bias@0x145cec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x145d0a0)\n" + " (declare (in ) vec3 P@0x145d1b0)\n" + " (declare (in ) float bias@0x145d2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x145d4a0)\n" + " (declare (in ) vec3 P@0x145d5b0)\n" + " (declare (in ) float bias@0x145d6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x145d8a0)\n" + " (declare (in ) vec3 P@0x145d9b0)\n" + " (declare (in ) float bias@0x145dac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x145dca0)\n" + " (declare (in ) vec4 P@0x145ddb0)\n" + " (declare (in ) float bias@0x145dec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x145e0a0)\n" + " (declare (in ) vec2 P@0x145e1b0)\n" + " (declare (in ) float bias@0x145e2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x145e4a0)\n" + " (declare (in ) vec2 P@0x145e5b0)\n" + " (declare (in ) float bias@0x145e6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x145e8a0)\n" + " (declare (in ) vec2 P@0x145e9b0)\n" + " (declare (in ) float bias@0x145eac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x145eca0)\n" + " (declare (in ) vec3 P@0x145edb0)\n" + " (declare (in ) float bias@0x145eec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x145f0a0)\n" + " (declare (in ) vec3 P@0x145f1b0)\n" + " (declare (in ) float bias@0x145f2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x145f4a0)\n" + " (declare (in ) vec3 P@0x145f5b0)\n" + " (declare (in ) float bias@0x145f6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x145f8a0)\n" + " (declare (in ) vec3 P@0x145f9b0)\n" + " (declare (in ) float bias@0x145fac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x145fca0)\n" + " (declare (in ) vec2 P@0x145fdb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1460140)\n" + " (declare (in ) vec2 P@0x1460250)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1460430)\n" + " (declare (in ) vec2 P@0x1460540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1460720)\n" + " (declare (in ) vec4 P@0x1460830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1460a10)\n" + " (declare (in ) vec4 P@0x1460b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1460d00)\n" + " (declare (in ) vec4 P@0x1460e10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1460ff0)\n" + " (declare (in ) vec3 P@0x1461100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x14612e0)\n" + " (declare (in ) vec3 P@0x14613f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x14615d0)\n" + " (declare (in ) vec3 P@0x14616e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14618c0)\n" + " (declare (in ) vec4 P@0x14619d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1461bb0)\n" + " (declare (in ) vec4 P@0x1461cc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1461ea0)\n" + " (declare (in ) vec4 P@0x1461fb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1462190)\n" + " (declare (in ) vec4 P@0x14622a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x1462480)\n" + " (declare (in ) vec4 P@0x1462590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1462770)\n" + " (declare (in ) vec4 P@0x1462880)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1462a60)\n" + " (declare (in ) vec4 P@0x1462b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1462d50)\n" + " (declare (in ) vec4 P@0x1462e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1463040)\n" + " (declare (in ) vec2 P@0x1463150)\n" + " (declare (in ) float bias@0x1463260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1463440)\n" + " (declare (in ) vec2 P@0x1463550)\n" + " (declare (in ) float bias@0x1463660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1463840)\n" + " (declare (in ) vec2 P@0x1463950)\n" + " (declare (in ) float bias@0x1463a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1463c40)\n" + " (declare (in ) vec4 P@0x1463d50)\n" + " (declare (in ) float bias@0x1463e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1464040)\n" + " (declare (in ) vec4 P@0x1464150)\n" + " (declare (in ) float bias@0x1464260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1464440)\n" + " (declare (in ) vec4 P@0x1464550)\n" + " (declare (in ) float bias@0x1464660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1464840)\n" + " (declare (in ) vec3 P@0x1464950)\n" + " (declare (in ) float bias@0x1464a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1464c40)\n" + " (declare (in ) vec3 P@0x1464d50)\n" + " (declare (in ) float bias@0x1464e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1465040)\n" + " (declare (in ) vec3 P@0x1465150)\n" + " (declare (in ) float bias@0x1465260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1465440)\n" + " (declare (in ) vec4 P@0x1465550)\n" + " (declare (in ) float bias@0x1465660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1465840)\n" + " (declare (in ) vec4 P@0x1465950)\n" + " (declare (in ) float bias@0x1465a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1465c40)\n" + " (declare (in ) vec4 P@0x1465d50)\n" + " (declare (in ) float bias@0x1465e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1466040)\n" + " (declare (in ) vec4 P@0x1466150)\n" + " (declare (in ) float bias@0x1466260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x1466440)\n" + " (declare (in ) vec4 P@0x1466550)\n" + " (declare (in ) float bias@0x1466660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1466840)\n" + " (declare (in ) vec4 P@0x1466950)\n" + " (declare (in ) float bias@0x1466a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1466c40)\n" + " (declare (in ) vec4 P@0x1466d50)\n" + " (declare (in ) float bias@0x1466e60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1467040)\n" + " (declare (in ) vec4 P@0x1467150)\n" + " (declare (in ) float bias@0x1467260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1467440)\n" + " (declare (in ) float P@0x1467550)\n" + " (declare (in ) float lod@0x1467660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x14679f0)\n" + " (declare (in ) float P@0x1467b00)\n" + " (declare (in ) float lod@0x1467c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1467df0)\n" + " (declare (in ) float P@0x1467f00)\n" + " (declare (in ) float lod@0x1468010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14681f0)\n" + " (declare (in ) vec2 P@0x1468300)\n" + " (declare (in ) float lod@0x1468410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x14685f0)\n" + " (declare (in ) vec2 P@0x1468700)\n" + " (declare (in ) float lod@0x1468810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x14689f0)\n" + " (declare (in ) vec2 P@0x1468b00)\n" + " (declare (in ) float lod@0x1468c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1468df0)\n" + " (declare (in ) vec3 P@0x1468f00)\n" + " (declare (in ) float lod@0x1469010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x14691f0)\n" + " (declare (in ) vec3 P@0x1469300)\n" + " (declare (in ) float lod@0x1469410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x14695f0)\n" + " (declare (in ) vec3 P@0x1469700)\n" + " (declare (in ) float lod@0x1469810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x14699f0)\n" + " (declare (in ) vec3 P@0x1469b00)\n" + " (declare (in ) float lod@0x1469c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x1469df0)\n" + " (declare (in ) vec3 P@0x1469f00)\n" + " (declare (in ) float lod@0x146a010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x146a1f0)\n" + " (declare (in ) vec3 P@0x146a300)\n" + " (declare (in ) float lod@0x146a410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x146a5f0)\n" + " (declare (in ) vec3 P@0x146a700)\n" + " (declare (in ) float lod@0x146a810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x146a9f0)\n" + " (declare (in ) vec3 P@0x146ab00)\n" + " (declare (in ) float lod@0x146ac10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x146adf0)\n" + " (declare (in ) vec2 P@0x146af00)\n" + " (declare (in ) float lod@0x146b010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x146b1f0)\n" + " (declare (in ) vec2 P@0x146b300)\n" + " (declare (in ) float lod@0x146b410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x146b5f0)\n" + " (declare (in ) vec2 P@0x146b700)\n" + " (declare (in ) float lod@0x146b810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x146b9f0)\n" + " (declare (in ) vec3 P@0x146bb00)\n" + " (declare (in ) float lod@0x146bc10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x146bdf0)\n" + " (declare (in ) vec3 P@0x146bf00)\n" + " (declare (in ) float lod@0x146c010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x146c1f0)\n" + " (declare (in ) vec3 P@0x146c300)\n" + " (declare (in ) float lod@0x146c410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x146c5f0)\n" + " (declare (in ) vec3 P@0x146c700)\n" + " (declare (in ) float lod@0x146c810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x146c9f0)\n" + " (declare (in ) int P@0x146cb00)\n" + " (declare (in ) int lod@0x146cc10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x146cfa0)\n" + " (declare (in ) int P@0x146d0b0)\n" + " (declare (in ) int lod@0x146d1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x146d3a0)\n" + " (declare (in ) int P@0x146d4b0)\n" + " (declare (in ) int lod@0x146d5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x146d7a0)\n" + " (declare (in ) ivec2 P@0x146d8b0)\n" + " (declare (in ) int lod@0x146d9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x146dba0)\n" + " (declare (in ) ivec2 P@0x146dcb0)\n" + " (declare (in ) int lod@0x146ddc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x146dfa0)\n" + " (declare (in ) ivec2 P@0x146e0b0)\n" + " (declare (in ) int lod@0x146e1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x146e3a0)\n" + " (declare (in ) ivec3 P@0x146e4b0)\n" + " (declare (in ) int lod@0x146e5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x146e7a0)\n" + " (declare (in ) ivec3 P@0x146e8b0)\n" + " (declare (in ) int lod@0x146e9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x146eba0)\n" + " (declare (in ) ivec3 P@0x146ecb0)\n" + " (declare (in ) int lod@0x146edc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x146efa0)\n" + " (declare (in ) ivec2 P@0x146f0b0)\n" + " (declare (in ) int lod@0x146f1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x146f3a0)\n" + " (declare (in ) ivec2 P@0x146f4b0)\n" + " (declare (in ) int lod@0x146f5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x146f7a0)\n" + " (declare (in ) ivec2 P@0x146f8b0)\n" + " (declare (in ) int lod@0x146f9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x146fba0)\n" + " (declare (in ) ivec3 P@0x146fcb0)\n" + " (declare (in ) int lod@0x146fdc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x146ffa0)\n" + " (declare (in ) ivec3 P@0x14700b0)\n" + " (declare (in ) int lod@0x14701c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x14703a0)\n" + " (declare (in ) ivec3 P@0x14704b0)\n" + " (declare (in ) int lod@0x14705c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x14707a0)\n" + " (declare (in ) vec2 P@0x14708b0)\n" + " (declare (in ) float lod@0x14709c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1470d50)\n" + " (declare (in ) vec2 P@0x1470e60)\n" + " (declare (in ) float lod@0x1470f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1471150)\n" + " (declare (in ) vec2 P@0x1471260)\n" + " (declare (in ) float lod@0x1471370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1471550)\n" + " (declare (in ) vec4 P@0x1471660)\n" + " (declare (in ) float lod@0x1471770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1471950)\n" + " (declare (in ) vec4 P@0x1471a60)\n" + " (declare (in ) float lod@0x1471b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1471d50)\n" + " (declare (in ) vec4 P@0x1471e60)\n" + " (declare (in ) float lod@0x1471f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1472150)\n" + " (declare (in ) vec3 P@0x1472260)\n" + " (declare (in ) float lod@0x1472370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1472550)\n" + " (declare (in ) vec3 P@0x1472660)\n" + " (declare (in ) float lod@0x1472770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1472950)\n" + " (declare (in ) vec3 P@0x1472a60)\n" + " (declare (in ) float lod@0x1472b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1472d50)\n" + " (declare (in ) vec4 P@0x1472e60)\n" + " (declare (in ) float lod@0x1472f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1473150)\n" + " (declare (in ) vec4 P@0x1473260)\n" + " (declare (in ) float lod@0x1473370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1473550)\n" + " (declare (in ) vec4 P@0x1473660)\n" + " (declare (in ) float lod@0x1473770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1473950)\n" + " (declare (in ) vec4 P@0x1473a60)\n" + " (declare (in ) float lod@0x1473b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x1473d50)\n" + " (declare (in ) vec4 P@0x1473e60)\n" + " (declare (in ) float lod@0x1473f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1474150)\n" + " (declare (in ) vec4 P@0x1474260)\n" + " (declare (in ) float lod@0x1474370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1474550)\n" + " (declare (in ) vec4 P@0x1474660)\n" + " (declare (in ) float lod@0x1474770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1474950)\n" + " (declare (in ) vec4 P@0x1474a60)\n" + " (declare (in ) float lod@0x1474b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1474d50)\n" + " (declare (in ) float P@0x1474e60)\n" + " (declare (in ) float dPdx@0x1474f70)\n" + " (declare (in ) float dPdy@0x1475080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1475410)\n" + " (declare (in ) float P@0x1475520)\n" + " (declare (in ) float dPdx@0x1475630)\n" + " (declare (in ) float dPdy@0x1475740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1475920)\n" + " (declare (in ) float P@0x1475a30)\n" + " (declare (in ) float dPdx@0x1475b40)\n" + " (declare (in ) float dPdy@0x1475c50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1475e30)\n" + " (declare (in ) vec2 P@0x1475f40)\n" + " (declare (in ) vec2 dPdx@0x1476050)\n" + " (declare (in ) vec2 dPdy@0x1476160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1476340)\n" + " (declare (in ) vec2 P@0x1476450)\n" + " (declare (in ) vec2 dPdx@0x1476560)\n" + " (declare (in ) vec2 dPdy@0x1476670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1476850)\n" + " (declare (in ) vec2 P@0x1476960)\n" + " (declare (in ) vec2 dPdx@0x1476a70)\n" + " (declare (in ) vec2 dPdy@0x1476b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1476d60)\n" + " (declare (in ) vec3 P@0x1476e70)\n" + " (declare (in ) vec3 dPdx@0x1476f80)\n" + " (declare (in ) vec3 dPdy@0x1477090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x1477270)\n" + " (declare (in ) vec3 P@0x1477380)\n" + " (declare (in ) vec3 dPdx@0x1477490)\n" + " (declare (in ) vec3 dPdy@0x14775a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1477780)\n" + " (declare (in ) vec3 P@0x1477890)\n" + " (declare (in ) vec3 dPdx@0x14779a0)\n" + " (declare (in ) vec3 dPdy@0x1477ab0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x1477c90)\n" + " (declare (in ) vec3 P@0x1477da0)\n" + " (declare (in ) vec3 dPdx@0x1477eb0)\n" + " (declare (in ) vec3 dPdy@0x1477fc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x14781a0)\n" + " (declare (in ) vec3 P@0x14782b0)\n" + " (declare (in ) vec3 dPdx@0x14783c0)\n" + " (declare (in ) vec3 dPdy@0x14784d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x14786b0)\n" + " (declare (in ) vec3 P@0x14787c0)\n" + " (declare (in ) vec3 dPdx@0x14788d0)\n" + " (declare (in ) vec3 dPdy@0x14789e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1478bc0)\n" + " (declare (in ) vec3 P@0x1478cd0)\n" + " (declare (in ) float dPdx@0x1478de0)\n" + " (declare (in ) float dPdy@0x1478ef0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x14790d0)\n" + " (declare (in ) vec3 P@0x14791e0)\n" + " (declare (in ) vec2 dPdx@0x14792f0)\n" + " (declare (in ) vec2 dPdy@0x1479400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x14795e0)\n" + " (declare (in ) vec4 P@0x14796f0)\n" + " (declare (in ) vec3 dPdx@0x1479800)\n" + " (declare (in ) vec3 dPdy@0x1479910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x1479af0)\n" + " (declare (in ) vec2 P@0x1479c00)\n" + " (declare (in ) float dPdx@0x1479d10)\n" + " (declare (in ) float dPdy@0x1479e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x147a000)\n" + " (declare (in ) vec2 P@0x147a110)\n" + " (declare (in ) float dPdx@0x147a220)\n" + " (declare (in ) float dPdy@0x147a330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x147a510)\n" + " (declare (in ) vec2 P@0x147a620)\n" + " (declare (in ) float dPdx@0x147a730)\n" + " (declare (in ) float dPdy@0x147a840)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x147aa20)\n" + " (declare (in ) vec3 P@0x147ab30)\n" + " (declare (in ) vec2 dPdx@0x147ac40)\n" + " (declare (in ) vec2 dPdy@0x147ad50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x147af30)\n" + " (declare (in ) vec3 P@0x147b040)\n" + " (declare (in ) vec2 dPdx@0x147b150)\n" + " (declare (in ) vec2 dPdy@0x147b260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x147b440)\n" + " (declare (in ) vec3 P@0x147b550)\n" + " (declare (in ) vec2 dPdx@0x147b660)\n" + " (declare (in ) vec2 dPdy@0x147b770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x147b950)\n" + " (declare (in ) vec3 P@0x147ba60)\n" + " (declare (in ) float dPdx@0x147bb70)\n" + " (declare (in ) float dPdy@0x147bc80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0x147be60)\n" + " (declare (in ) vec4 P@0x147bf70)\n" + " (declare (in ) vec2 dPdx@0x147c080)\n" + " (declare (in ) vec2 dPdy@0x147c190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProjGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x147c370)\n" + " (declare (in ) vec2 P@0x147c480)\n" + " (declare (in ) float dPdx@0x147c590)\n" + " (declare (in ) float dPdy@0x147c6a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x147ca30)\n" + " (declare (in ) vec2 P@0x147cb40)\n" + " (declare (in ) float dPdx@0x147cc50)\n" + " (declare (in ) float dPdy@0x147cd60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x147cf40)\n" + " (declare (in ) vec2 P@0x147d050)\n" + " (declare (in ) float dPdx@0x147d160)\n" + " (declare (in ) float dPdy@0x147d270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x147d450)\n" + " (declare (in ) vec4 P@0x147d560)\n" + " (declare (in ) float dPdx@0x147d670)\n" + " (declare (in ) float dPdy@0x147d780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x147d960)\n" + " (declare (in ) vec4 P@0x147da70)\n" + " (declare (in ) float dPdx@0x147db80)\n" + " (declare (in ) float dPdy@0x147dc90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x147de70)\n" + " (declare (in ) vec4 P@0x147df80)\n" + " (declare (in ) float dPdx@0x147e090)\n" + " (declare (in ) float dPdy@0x147e1a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x147e380)\n" + " (declare (in ) vec3 P@0x147e490)\n" + " (declare (in ) vec2 dPdx@0x147e5a0)\n" + " (declare (in ) vec2 dPdy@0x147e6b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x147e890)\n" + " (declare (in ) vec3 P@0x147e9a0)\n" + " (declare (in ) vec2 dPdx@0x147eab0)\n" + " (declare (in ) vec2 dPdy@0x147ebc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x147eda0)\n" + " (declare (in ) vec3 P@0x147eeb0)\n" + " (declare (in ) vec2 dPdx@0x147efc0)\n" + " (declare (in ) vec2 dPdy@0x147f0d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x147f2b0)\n" + " (declare (in ) vec4 P@0x147f3c0)\n" + " (declare (in ) vec2 dPdx@0x147f4d0)\n" + " (declare (in ) vec2 dPdy@0x147f5e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x147f7c0)\n" + " (declare (in ) vec4 P@0x147f8d0)\n" + " (declare (in ) vec2 dPdx@0x147f9e0)\n" + " (declare (in ) vec2 dPdy@0x147faf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x147fcd0)\n" + " (declare (in ) vec4 P@0x147fde0)\n" + " (declare (in ) vec2 dPdx@0x147fef0)\n" + " (declare (in ) vec2 dPdy@0x1480000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x14801e0)\n" + " (declare (in ) vec4 P@0x14802f0)\n" + " (declare (in ) vec3 dPdx@0x1480400)\n" + " (declare (in ) vec3 dPdy@0x1480510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x14806f0)\n" + " (declare (in ) vec4 P@0x1480800)\n" + " (declare (in ) vec3 dPdx@0x1480910)\n" + " (declare (in ) vec3 dPdy@0x1480a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1480c00)\n" + " (declare (in ) vec4 P@0x1480d10)\n" + " (declare (in ) vec3 dPdx@0x1480e20)\n" + " (declare (in ) vec3 dPdy@0x1480f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1481110)\n" + " (declare (in ) vec4 P@0x1481220)\n" + " (declare (in ) float dPdx@0x1481330)\n" + " (declare (in ) float dPdy@0x1481440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1481620)\n" + " (declare (in ) vec4 P@0x1481730)\n" + " (declare (in ) vec2 dPdx@0x1481840)\n" + " (declare (in ) vec2 dPdy@0x1481950)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1481b30)\n" + " (declare (in ) float coord@0x1481c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1482760)\n" + " (declare (in ) float coord@0x1482870)\n" + " (declare (in ) float bias@0x1482980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1481fd0)\n" + " (declare (in ) vec2 coord@0x14820e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1482470)\n" + " (declare (in ) vec4 coord@0x1482580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1482b60)\n" + " (declare (in ) vec2 coord@0x1482c70)\n" + " (declare (in ) float bias@0x1482d80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1482f60)\n" + " (declare (in ) vec4 coord@0x1483070)\n" + " (declare (in ) float bias@0x1483180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1483360)\n" + " (declare (in ) float coord@0x1483470)\n" + " (declare (in ) float lod@0x1483580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1483910)\n" + " (declare (in ) vec2 coord@0x1483a20)\n" + " (declare (in ) float lod@0x1483b30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1483ec0)\n" + " (declare (in ) vec4 coord@0x1483fd0)\n" + " (declare (in ) float lod@0x14840e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14842c0)\n" + " (declare (in ) vec2 coord@0x14843d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1484ef0)\n" + " (declare (in ) vec2 coord@0x1485000)\n" + " (declare (in ) float bias@0x1485110)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1484760)\n" + " (declare (in ) vec3 coord@0x1484870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1484c00)\n" + " (declare (in ) vec4 coord@0x1484d10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14852f0)\n" + " (declare (in ) vec3 coord@0x1485400)\n" + " (declare (in ) float bias@0x1485510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14856f0)\n" + " (declare (in ) vec4 coord@0x1485800)\n" + " (declare (in ) float bias@0x1485910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1485af0)\n" + " (declare (in ) vec2 coord@0x1485c00)\n" + " (declare (in ) float lod@0x1485d10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x14860a0)\n" + " (declare (in ) vec3 coord@0x14861b0)\n" + " (declare (in ) float lod@0x14862c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1486650)\n" + " (declare (in ) vec4 coord@0x1486760)\n" + " (declare (in ) float lod@0x1486870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1486a50)\n" + " (declare (in ) vec3 coord@0x1486b60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1487390)\n" + " (declare (in ) vec3 coord@0x14874a0)\n" + " (declare (in ) float bias@0x14875b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1486ef0)\n" + " (declare (in ) vec4 coord@0x1487000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1487790)\n" + " (declare (in ) vec4 coord@0x14878a0)\n" + " (declare (in ) float bias@0x14879b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1487b90)\n" + " (declare (in ) vec3 coord@0x1487ca0)\n" + " (declare (in ) float lod@0x1487db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1488140)\n" + " (declare (in ) vec4 coord@0x1488250)\n" + " (declare (in ) float lod@0x1488360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x14886f0)\n" + " (declare (in ) vec3 coord@0x1488800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x1488b90)\n" + " (declare (in ) vec3 coord@0x1488ca0)\n" + " (declare (in ) float bias@0x1488db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x1488f90)\n" + " (declare (in ) vec3 coord@0x14890a0)\n" + " (declare (in ) float lod@0x14891b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1489540)\n" + " (declare (in ) vec3 coord@0x1489650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x148a7c0)\n" + " (declare (in ) vec3 coord@0x148a8d0)\n" + " (declare (in ) float bias@0x148a9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x14899e0)\n" + " (declare (in ) vec3 coord@0x1489af0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x148abc0)\n" + " (declare (in ) vec3 coord@0x148acd0)\n" + " (declare (in ) float bias@0x148ade0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1489e80)\n" + " (declare (in ) vec4 coord@0x1489f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x148afc0)\n" + " (declare (in ) vec4 coord@0x148b0d0)\n" + " (declare (in ) float bias@0x148b1e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x148a320)\n" + " (declare (in ) vec4 coord@0x148a430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x148b3c0)\n" + " (declare (in ) vec4 coord@0x148b4d0)\n" + " (declare (in ) float bias@0x148b5e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x148b7c0)\n" + " (declare (in ) vec3 coord@0x148b8d0)\n" + " (declare (in ) float lod@0x148b9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x148bd70)\n" + " (declare (in ) vec3 coord@0x148be80)\n" + " (declare (in ) float lod@0x148bf90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x148c320)\n" + " (declare (in ) vec4 coord@0x148c430)\n" + " (declare (in ) float lod@0x148c540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x148c8d0)\n" + " (declare (in ) vec4 coord@0x148c9e0)\n" + " (declare (in ) float lod@0x148caf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x148ce80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x148d200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x148d3e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x148d5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x148d7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x148db20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x148dd00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x148dee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p@0x148e0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p@0x148e440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 p@0x148e620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 p@0x148e800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x148e9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x148ed60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x148ef40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x148f120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0x148f300)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x148f680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0x148f860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0x148fa40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0x148fc20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0x148ffa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1490180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1490360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0x1490540)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0x14908c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1490aa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1490c80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_130_frag [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_textureProj, + builtin_noise2, + builtin_texture3DProjLod, + builtin_pow, + builtin_texture2DProj, + builtin_fwidth, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_textureProjLod, + builtin_texture, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_shadow2DProj, + builtin_shadow1DProjLod, + builtin_any, + builtin_shadow1DProj, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_texture3DLod, + builtin_textureLod, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_shadow1DLod, + builtin_dFdx, + builtin_sin, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_all, + builtin_log2, + builtin_textureGrad, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_transpose, + builtin_outerProduct, + builtin_ceil, + builtin_reflect, + builtin_textureCubeLod, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_shadow2DProjLod, + builtin_not, + builtin_texture2DProjLod, + builtin_dFdy, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_texelFetch, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_textureProjGrad, + builtin_texture1DProjLod, + builtin_textureCube, + builtin_length, + builtin_texture1DLod, + builtin_texture2DLod, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, +}; +static const char *prototypes_for_ARB_texture_rectangle_vert = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x9f07b0)\n" + " (declare (in ) vec2 coord@0x9f08c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x9f0c50)\n" + " (declare (in ) vec3 coord@0x9f0d60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRect sampler@0x9f10f0)\n" + " (declare (in ) vec4 coord@0x9f1200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x9f13e0)\n" + " (declare (in ) vec3 coord@0x9f14f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DRectShadow sampler@0x9f1880)\n" + " (declare (in ) vec4 coord@0x9f1990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "\n" + ")" +; +static const char *functions_for_ARB_texture_rectangle_vert [] = { + builtin_texture2DRect, + builtin_shadow2DRectProj, + builtin_shadow2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_130_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float degrees@0x16a1fa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 degrees@0x16a2320)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 degrees@0x16a2500)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 degrees@0x16a26e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float radians@0x16a28c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 radians@0x16a2c40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 radians@0x16a2e20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 radians@0x16a3000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x16a31e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x16a3560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x16a3740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x16a3920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x16a3b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x16a3e80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x16a4060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x16a4240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x16a4420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x16a47a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x16a4980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x16a4b60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x16a4d40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x16a50c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x16a52a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x16a5480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float angle@0x16a5660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 angle@0x16a59e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 angle@0x16a5bc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 angle@0x16a5da0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y@0x16a5f80)\n" + " (declare (in ) float x@0x16a6090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y@0x16a6410)\n" + " (declare (in ) vec2 x@0x16a6520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y@0x16a6700)\n" + " (declare (in ) vec3 x@0x16a6810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y@0x16a69f0)\n" + " (declare (in ) vec4 x@0x16a6b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y_over_x@0x16a6ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 y_over_x@0x16a6ed0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 y_over_x@0x16a70c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 y_over_x@0x16a72b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16a74a0)\n" + " (declare (in ) float y@0x16a75b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16a7930)\n" + " (declare (in ) vec2 y@0x16a7a40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16a7c20)\n" + " (declare (in ) vec3 y@0x16a7d30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16a7f10)\n" + " (declare (in ) vec4 y@0x16a8020)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16a8200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16a8580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16a8760)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16a8940)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16a8b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16a8ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16a9080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16a9260)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16a9440)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16a97c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16a99a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16a9b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16a9d60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16aa0e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16aa2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16aa4a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16aa680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16aaa00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16aabe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16aadc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16aafa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16ab330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16ab510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ab6f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16ab8d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16abc50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16abe30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ac010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x16ac1f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16ac3d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16ac5b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16ac790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16ac970)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16accf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16aced0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ad0b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x16ad290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16ad470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16ad650)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16ad830)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16ada10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16add90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16adf70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ae150)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16ae330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16ae6b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16ae890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16aea70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16aec50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16aefd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16af1b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16af390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16af570)\n" + " (declare (in ) float y@0x16af680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16afa00)\n" + " (declare (in ) float y@0x16afb10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16afcf0)\n" + " (declare (in ) float y@0x16afe00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16affe0)\n" + " (declare (in ) float y@0x16b00f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b02d0)\n" + " (declare (in ) vec2 y@0x16b03e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b05c0)\n" + " (declare (in ) vec3 y@0x16b06d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b08b0)\n" + " (declare (in ) vec4 y@0x16b09c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16b0ba0)\n" + " (declare (in ) float y@0x16b0cb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b1030)\n" + " (declare (in ) vec2 y@0x16b1140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b1320)\n" + " (declare (in ) vec3 y@0x16b1430)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b1610)\n" + " (declare (in ) vec4 y@0x16b1720)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b1900)\n" + " (declare (in ) float y@0x16b1a10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b1bf0)\n" + " (declare (in ) float y@0x16b1d00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b1ee0)\n" + " (declare (in ) float y@0x16b1ff0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x16b21d0)\n" + " (declare (in ) int y@0x16b22e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16b24c0)\n" + " (declare (in ) ivec2 y@0x16b25d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16b27b0)\n" + " (declare (in ) ivec3 y@0x16b28c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16b2aa0)\n" + " (declare (in ) ivec4 y@0x16b2bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16b2d90)\n" + " (declare (in ) int y@0x16b2ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16b3080)\n" + " (declare (in ) int y@0x16b3190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16b3370)\n" + " (declare (in ) int y@0x16b3480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x16b3660)\n" + " (declare (in ) uint y@0x16b3770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16b3950)\n" + " (declare (in ) uvec2 y@0x16b3a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16b3c40)\n" + " (declare (in ) uvec3 y@0x16b3d50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16b3f30)\n" + " (declare (in ) uvec4 y@0x16b4040)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16b4220)\n" + " (declare (in ) uint y@0x16b4330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16b4510)\n" + " (declare (in ) uint y@0x16b4620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16b4800)\n" + " (declare (in ) uint y@0x16b4910)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16b4af0)\n" + " (declare (in ) float y@0x16b4c00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b4f80)\n" + " (declare (in ) vec2 y@0x16b5090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b5270)\n" + " (declare (in ) vec3 y@0x16b5380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b5560)\n" + " (declare (in ) vec4 y@0x16b5670)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b5850)\n" + " (declare (in ) float y@0x16b5960)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b5b40)\n" + " (declare (in ) float y@0x16b5c50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b5e30)\n" + " (declare (in ) float y@0x16b5f40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x16b6120)\n" + " (declare (in ) int y@0x16b6230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16b6410)\n" + " (declare (in ) ivec2 y@0x16b6520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16b6700)\n" + " (declare (in ) ivec3 y@0x16b6810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16b69f0)\n" + " (declare (in ) ivec4 y@0x16b6b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16b6ce0)\n" + " (declare (in ) int y@0x16b6df0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16b6fd0)\n" + " (declare (in ) int y@0x16b70e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16b72c0)\n" + " (declare (in ) int y@0x16b73d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x16b75b0)\n" + " (declare (in ) uint y@0x16b76c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16b78a0)\n" + " (declare (in ) uvec2 y@0x16b79b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16b7b90)\n" + " (declare (in ) uvec3 y@0x16b7ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16b7e80)\n" + " (declare (in ) uvec4 y@0x16b7f90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16b8170)\n" + " (declare (in ) uint y@0x16b8280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16b8460)\n" + " (declare (in ) uint y@0x16b8570)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16b8750)\n" + " (declare (in ) uint y@0x16b8860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16b8a40)\n" + " (declare (in ) float minVal@0x16b8b50)\n" + " (declare (in ) float maxVal@0x16b8c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b8fe0)\n" + " (declare (in ) vec2 minVal@0x16b90f0)\n" + " (declare (in ) vec2 maxVal@0x16b9200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b93e0)\n" + " (declare (in ) vec3 minVal@0x16b94f0)\n" + " (declare (in ) vec3 maxVal@0x16b9600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16b97e0)\n" + " (declare (in ) vec4 minVal@0x16b98f0)\n" + " (declare (in ) vec4 maxVal@0x16b9a00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16b9be0)\n" + " (declare (in ) float minVal@0x16b9cf0)\n" + " (declare (in ) float maxVal@0x16b9e00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16b9fe0)\n" + " (declare (in ) float minVal@0x16ba0f0)\n" + " (declare (in ) float maxVal@0x16ba200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ba3e0)\n" + " (declare (in ) float minVal@0x16ba4f0)\n" + " (declare (in ) float maxVal@0x16ba600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in ) int x@0x16ba7e0)\n" + " (declare (in ) int minVal@0x16ba8f0)\n" + " (declare (in ) int maxVal@0x16baa00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16babe0)\n" + " (declare (in ) ivec2 minVal@0x16bacf0)\n" + " (declare (in ) ivec2 maxVal@0x16bae00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16bafe0)\n" + " (declare (in ) ivec3 minVal@0x16bb0f0)\n" + " (declare (in ) ivec3 maxVal@0x16bb200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16bb3e0)\n" + " (declare (in ) ivec4 minVal@0x16bb4f0)\n" + " (declare (in ) ivec4 maxVal@0x16bb600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16bb7e0)\n" + " (declare (in ) int minVal@0x16bb8f0)\n" + " (declare (in ) int maxVal@0x16bba00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16bbbe0)\n" + " (declare (in ) int minVal@0x16bbcf0)\n" + " (declare (in ) int maxVal@0x16bbe00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16bbfe0)\n" + " (declare (in ) int minVal@0x16bc0f0)\n" + " (declare (in ) int maxVal@0x16bc200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in ) uint x@0x16bc3e0)\n" + " (declare (in ) uint minVal@0x16bc4f0)\n" + " (declare (in ) uint maxVal@0x16bc600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16bc7e0)\n" + " (declare (in ) uvec2 minVal@0x16bc8f0)\n" + " (declare (in ) uvec2 maxVal@0x16bca00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16bcbe0)\n" + " (declare (in ) uvec3 minVal@0x16bccf0)\n" + " (declare (in ) uvec3 maxVal@0x16bce00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16bcfe0)\n" + " (declare (in ) uvec4 minVal@0x16bd0f0)\n" + " (declare (in ) uvec4 maxVal@0x16bd200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16bd3e0)\n" + " (declare (in ) uint minVal@0x16bd4f0)\n" + " (declare (in ) uint maxVal@0x16bd600)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16bd7e0)\n" + " (declare (in ) uint minVal@0x16bd8f0)\n" + " (declare (in ) uint maxVal@0x16bda00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16bdbe0)\n" + " (declare (in ) uint minVal@0x16bdcf0)\n" + " (declare (in ) uint maxVal@0x16bde00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16bdfe0)\n" + " (declare (in ) float y@0x16be0f0)\n" + " (declare (in ) float a@0x16be200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16be580)\n" + " (declare (in ) vec2 y@0x16be690)\n" + " (declare (in ) vec2 a@0x16be7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16be980)\n" + " (declare (in ) vec3 y@0x16bea90)\n" + " (declare (in ) vec3 a@0x16beba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16bed80)\n" + " (declare (in ) vec4 y@0x16bee90)\n" + " (declare (in ) vec4 a@0x16befa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16bf180)\n" + " (declare (in ) vec2 y@0x16bf290)\n" + " (declare (in ) float a@0x16bf3a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16bf580)\n" + " (declare (in ) vec3 y@0x16bf690)\n" + " (declare (in ) float a@0x16bf7a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16bf980)\n" + " (declare (in ) vec4 y@0x16bfa90)\n" + " (declare (in ) float a@0x16bfba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge@0x16bfd80)\n" + " (declare (in ) float x@0x16bfe90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge@0x16c0210)\n" + " (declare (in ) vec2 x@0x16c0320)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge@0x16c0500)\n" + " (declare (in ) vec3 x@0x16c0610)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge@0x16c07f0)\n" + " (declare (in ) vec4 x@0x16c0900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge@0x16c0ae0)\n" + " (declare (in ) vec2 x@0x16c0bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge@0x16c0dd0)\n" + " (declare (in ) vec3 x@0x16c0ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge@0x16c10c0)\n" + " (declare (in ) vec4 x@0x16c11d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float edge0@0x16c13b0)\n" + " (declare (in ) float edge1@0x16c14c0)\n" + " (declare (in ) float x@0x16c15d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 edge0@0x16c1960)\n" + " (declare (in ) vec2 edge1@0x16c1a70)\n" + " (declare (in ) vec2 x@0x16c1b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 edge0@0x16c1d60)\n" + " (declare (in ) vec3 edge1@0x16c1e70)\n" + " (declare (in ) vec3 x@0x16c1f80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 edge0@0x16c2160)\n" + " (declare (in ) vec4 edge1@0x16c2270)\n" + " (declare (in ) vec4 x@0x16c2380)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float edge0@0x16c2560)\n" + " (declare (in ) float edge1@0x16c2670)\n" + " (declare (in ) vec2 x@0x16c2780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float edge0@0x16c2960)\n" + " (declare (in ) float edge1@0x16c2a70)\n" + " (declare (in ) vec3 x@0x16c2b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float edge0@0x16c2d60)\n" + " (declare (in ) float edge1@0x16c2e70)\n" + " (declare (in ) vec4 x@0x16c2f80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16c3160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16c34e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16c36c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16c38a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float p0@0x16c3a80)\n" + " (declare (in ) float p1@0x16c3b90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 p0@0x16c3f20)\n" + " (declare (in ) vec2 p1@0x16c4030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 p0@0x16c4210)\n" + " (declare (in ) vec3 p1@0x16c4320)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 p0@0x16c4500)\n" + " (declare (in ) vec4 p1@0x16c4610)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16c47f0)\n" + " (declare (in ) float y@0x16c4900)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16c4c80)\n" + " (declare (in ) vec2 y@0x16c4d90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16c4f70)\n" + " (declare (in ) vec3 y@0x16c5080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16c5260)\n" + " (declare (in ) vec4 y@0x16c5370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16c5550)\n" + " (declare (in ) vec3 y@0x16c5660)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x16c59e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16c5d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16c5f50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16c6130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float N@0x16c6590)\n" + " (declare (in ) float I@0x16c66a0)\n" + " (declare (in ) float Nref@0x16c67b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 N@0x16c6b40)\n" + " (declare (in ) vec2 I@0x16c6c50)\n" + " (declare (in ) vec2 Nref@0x16c6d60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 N@0x16c6f40)\n" + " (declare (in ) vec3 I@0x16c7050)\n" + " (declare (in ) vec3 Nref@0x16c7160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 N@0x16c7340)\n" + " (declare (in ) vec4 I@0x16c7450)\n" + " (declare (in ) vec4 Nref@0x16c7560)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x16c7740)\n" + " (declare (in ) float N@0x16c7850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x16c7bd0)\n" + " (declare (in ) vec2 N@0x16c7ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x16c7ec0)\n" + " (declare (in ) vec3 N@0x16c7fd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x16c81b0)\n" + " (declare (in ) vec4 N@0x16c82c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float I@0x16c84a0)\n" + " (declare (in ) float N@0x16c85b0)\n" + " (declare (in ) float eta@0x16c86c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 I@0x16c8a40)\n" + " (declare (in ) vec2 N@0x16c8b50)\n" + " (declare (in ) float eta@0x16c8c60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 I@0x16c8e40)\n" + " (declare (in ) vec3 N@0x16c8f50)\n" + " (declare (in ) float eta@0x16c9060)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec4 I@0x16c9240)\n" + " (declare (in ) vec4 N@0x16c9350)\n" + " (declare (in ) float eta@0x16c9460)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 x@0x16c9640)\n" + " (declare (in ) mat2 y@0x16c9750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 x@0x16c9ae0)\n" + " (declare (in ) mat3 y@0x16c9bf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 x@0x16c9dd0)\n" + " (declare (in ) mat4 y@0x16c9ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat2x3 x@0x16ca0c0)\n" + " (declare (in ) mat2x3 y@0x16ca1d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat2x4 x@0x16ca3b0)\n" + " (declare (in ) mat2x4 y@0x16ca4c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat3x2 x@0x16ca6a0)\n" + " (declare (in ) mat3x2 y@0x16ca7b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat3x4 x@0x16ca990)\n" + " (declare (in ) mat3x4 y@0x16caaa0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat4x2 x@0x16cac80)\n" + " (declare (in ) mat4x2 y@0x16cad90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat4x3 x@0x16caf70)\n" + " (declare (in ) mat4x3 y@0x16cb080)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x16cb260)\n" + " (declare (in ) vec2 r@0x16cb370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x16cb700)\n" + " (declare (in ) vec3 r@0x16cb810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x16cb9f0)\n" + " (declare (in ) vec4 r@0x16cbb00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x16cbce0)\n" + " (declare (in ) vec2 r@0x16cbdf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x16cbfd0)\n" + " (declare (in ) vec3 r@0x16cc0e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x16cc2c0)\n" + " (declare (in ) vec2 r@0x16cc3d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) vec2 c@0x16cc5b0)\n" + " (declare (in ) vec4 r@0x16cc6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) vec4 c@0x16cc8a0)\n" + " (declare (in ) vec3 r@0x16cc9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) vec3 c@0x16ccb90)\n" + " (declare (in ) vec4 r@0x16ccca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in ) mat2 m@0x16cce80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in ) mat3 m@0x16cd210)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in ) mat4 m@0x16cd3f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in ) mat3x2 m@0x16cd5d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in ) mat2x3 m@0x16cd7b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in ) mat4x2 m@0x16cd990)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in ) mat2x4 m@0x16cdb70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in ) mat4x3 m@0x16cdd50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in ) mat3x4 m@0x16cdf30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16ce110)\n" + " (declare (in ) vec2 y@0x16ce220)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16ce5b0)\n" + " (declare (in ) vec3 y@0x16ce6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16ce8a0)\n" + " (declare (in ) vec4 y@0x16ce9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16ceb90)\n" + " (declare (in ) ivec2 y@0x16ceca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16cee80)\n" + " (declare (in ) ivec3 y@0x16cef90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16cf170)\n" + " (declare (in ) ivec4 y@0x16cf280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16cf460)\n" + " (declare (in ) uvec2 y@0x16cf570)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16cf750)\n" + " (declare (in ) uvec3 y@0x16cf860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16cfa40)\n" + " (declare (in ) uvec4 y@0x16cfb50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16cfd30)\n" + " (declare (in ) vec2 y@0x16cfe40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16d01d0)\n" + " (declare (in ) vec3 y@0x16d02e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16d04c0)\n" + " (declare (in ) vec4 y@0x16d05d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16d07b0)\n" + " (declare (in ) ivec2 y@0x16d08c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16d0aa0)\n" + " (declare (in ) ivec3 y@0x16d0bb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16d0d90)\n" + " (declare (in ) ivec4 y@0x16d0ea0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16d1080)\n" + " (declare (in ) uvec2 y@0x16d1190)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16d1370)\n" + " (declare (in ) uvec3 y@0x16d1480)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16d1660)\n" + " (declare (in ) uvec4 y@0x16d1770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16d1950)\n" + " (declare (in ) vec2 y@0x16d1a60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16d1df0)\n" + " (declare (in ) vec3 y@0x16d1f00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16d20e0)\n" + " (declare (in ) vec4 y@0x16d21f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16d23d0)\n" + " (declare (in ) ivec2 y@0x16d24e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16d26c0)\n" + " (declare (in ) ivec3 y@0x16d27d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16d29b0)\n" + " (declare (in ) ivec4 y@0x16d2ac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16d2ca0)\n" + " (declare (in ) uvec2 y@0x16d2db0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16d2f90)\n" + " (declare (in ) uvec3 y@0x16d30a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16d3280)\n" + " (declare (in ) uvec4 y@0x16d3390)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16d3570)\n" + " (declare (in ) vec2 y@0x16d3680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16d3a10)\n" + " (declare (in ) vec3 y@0x16d3b20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16d3d00)\n" + " (declare (in ) vec4 y@0x16d3e10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16d3ff0)\n" + " (declare (in ) ivec2 y@0x16d4100)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16d42e0)\n" + " (declare (in ) ivec3 y@0x16d43f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16d45d0)\n" + " (declare (in ) ivec4 y@0x16d46e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16d48c0)\n" + " (declare (in ) uvec2 y@0x16d49d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16d4bb0)\n" + " (declare (in ) uvec3 y@0x16d4cc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16d4ea0)\n" + " (declare (in ) uvec4 y@0x16d4fb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16d5190)\n" + " (declare (in ) vec2 y@0x16d52a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16d5620)\n" + " (declare (in ) vec3 y@0x16d5730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16d5910)\n" + " (declare (in ) vec4 y@0x16d5a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16d5c00)\n" + " (declare (in ) ivec2 y@0x16d5d10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16d5ef0)\n" + " (declare (in ) ivec3 y@0x16d6000)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16d61e0)\n" + " (declare (in ) ivec4 y@0x16d62f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16d64d0)\n" + " (declare (in ) uvec2 y@0x16d65e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16d67c0)\n" + " (declare (in ) uvec3 y@0x16d68d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16d6ab0)\n" + " (declare (in ) uvec4 y@0x16d6bc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x16d6da0)\n" + " (declare (in ) bvec2 y@0x16d6eb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x16d7090)\n" + " (declare (in ) bvec3 y@0x16d71a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x16d7380)\n" + " (declare (in ) bvec4 y@0x16d7490)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x16d7670)\n" + " (declare (in ) vec2 y@0x16d7780)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x16d7b10)\n" + " (declare (in ) vec3 y@0x16d7c20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) vec4 x@0x16d7e00)\n" + " (declare (in ) vec4 y@0x16d7f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) ivec2 x@0x16d80f0)\n" + " (declare (in ) ivec2 y@0x16d8200)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) ivec3 x@0x16d83e0)\n" + " (declare (in ) ivec3 y@0x16d84f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) ivec4 x@0x16d86d0)\n" + " (declare (in ) ivec4 y@0x16d87e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) uvec2 x@0x16d89c0)\n" + " (declare (in ) uvec2 y@0x16d8ad0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) uvec3 x@0x16d8cb0)\n" + " (declare (in ) uvec3 y@0x16d8dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) uvec4 x@0x16d8fa0)\n" + " (declare (in ) uvec4 y@0x16d90b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x16d9290)\n" + " (declare (in ) bvec2 y@0x16d93a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x16d9580)\n" + " (declare (in ) bvec3 y@0x16d9690)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x16d9870)\n" + " (declare (in ) bvec4 y@0x16d9980)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x16d9b60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x16d9ee0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x16da0c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x16da2a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x16da620)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x16da800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in ) bvec2 x@0x16da9e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in ) bvec3 x@0x16dad60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in ) bvec4 x@0x16daf40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16db120)\n" + " (declare (in ) float P@0x16db230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16db5b0)\n" + " (declare (in ) float P@0x16db6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16db8a0)\n" + " (declare (in ) float P@0x16db9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16dbb90)\n" + " (declare (in ) vec2 P@0x16dbca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16dbe80)\n" + " (declare (in ) vec2 P@0x16dbf90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16dc170)\n" + " (declare (in ) vec2 P@0x16dc280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16dc460)\n" + " (declare (in ) vec3 P@0x16dc570)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16dc750)\n" + " (declare (in ) vec3 P@0x16dc860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16dca40)\n" + " (declare (in ) vec3 P@0x16dcb50)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x16dcd30)\n" + " (declare (in ) vec3 P@0x16dce40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x16dd020)\n" + " (declare (in ) vec3 P@0x16dd130)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x16dd310)\n" + " (declare (in ) vec3 P@0x16dd420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16dd600)\n" + " (declare (in ) vec3 P@0x16dd710)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16dd8f0)\n" + " (declare (in ) vec3 P@0x16dda00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x16ddbe0)\n" + " (declare (in ) vec4 P@0x16ddcf0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x16dded0)\n" + " (declare (in ) vec2 P@0x16ddfe0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x16de1c0)\n" + " (declare (in ) vec2 P@0x16de2d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x16de4b0)\n" + " (declare (in ) vec2 P@0x16de5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x16de7a0)\n" + " (declare (in ) vec3 P@0x16de8b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x16dea90)\n" + " (declare (in ) vec3 P@0x16deba0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x16ded80)\n" + " (declare (in ) vec3 P@0x16dee90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x16df070)\n" + " (declare (in ) vec3 P@0x16df180)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0x16df360)\n" + " (declare (in ) vec4 P@0x16df470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16df650)\n" + " (declare (in ) float P@0x16df760)\n" + " (declare (in ) float bias@0x16df870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16dfa50)\n" + " (declare (in ) float P@0x16dfb60)\n" + " (declare (in ) float bias@0x16dfc70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16dfe50)\n" + " (declare (in ) float P@0x16dff60)\n" + " (declare (in ) float bias@0x16e0070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16e0250)\n" + " (declare (in ) vec2 P@0x16e0360)\n" + " (declare (in ) float bias@0x16e0470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16e0650)\n" + " (declare (in ) vec2 P@0x16e0760)\n" + " (declare (in ) float bias@0x16e0870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16e0a50)\n" + " (declare (in ) vec2 P@0x16e0b60)\n" + " (declare (in ) float bias@0x16e0c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16e0e50)\n" + " (declare (in ) vec3 P@0x16e0f60)\n" + " (declare (in ) float bias@0x16e1070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16e1250)\n" + " (declare (in ) vec3 P@0x16e1360)\n" + " (declare (in ) float bias@0x16e1470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16e1650)\n" + " (declare (in ) vec3 P@0x16e1760)\n" + " (declare (in ) float bias@0x16e1870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x16e1a50)\n" + " (declare (in ) vec3 P@0x16e1b60)\n" + " (declare (in ) float bias@0x16e1c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x16e1e50)\n" + " (declare (in ) vec3 P@0x16e1f60)\n" + " (declare (in ) float bias@0x16e2070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x16e2250)\n" + " (declare (in ) vec3 P@0x16e2360)\n" + " (declare (in ) float bias@0x16e2470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16e2650)\n" + " (declare (in ) vec3 P@0x16e2760)\n" + " (declare (in ) float bias@0x16e2870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16e2a50)\n" + " (declare (in ) vec3 P@0x16e2b60)\n" + " (declare (in ) float bias@0x16e2c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x16e2e50)\n" + " (declare (in ) vec4 P@0x16e2f60)\n" + " (declare (in ) float bias@0x16e3070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x16e3250)\n" + " (declare (in ) vec2 P@0x16e3360)\n" + " (declare (in ) float bias@0x16e3470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x16e3650)\n" + " (declare (in ) vec2 P@0x16e3760)\n" + " (declare (in ) float bias@0x16e3870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x16e3a50)\n" + " (declare (in ) vec2 P@0x16e3b60)\n" + " (declare (in ) float bias@0x16e3c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x16e3e50)\n" + " (declare (in ) vec3 P@0x16e3f60)\n" + " (declare (in ) float bias@0x16e4070)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x16e4250)\n" + " (declare (in ) vec3 P@0x16e4360)\n" + " (declare (in ) float bias@0x16e4470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x16e4650)\n" + " (declare (in ) vec3 P@0x16e4760)\n" + " (declare (in ) float bias@0x16e4870)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x16e4a50)\n" + " (declare (in ) vec3 P@0x16e4b60)\n" + " (declare (in ) float bias@0x16e4c70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16e4e50)\n" + " (declare (in ) vec2 P@0x16e4f60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16e52f0)\n" + " (declare (in ) vec2 P@0x16e5400)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16e55e0)\n" + " (declare (in ) vec2 P@0x16e56f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16e58d0)\n" + " (declare (in ) vec4 P@0x16e59e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16e5bc0)\n" + " (declare (in ) vec4 P@0x16e5cd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16e5eb0)\n" + " (declare (in ) vec4 P@0x16e5fc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16e61a0)\n" + " (declare (in ) vec3 P@0x16e62b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16e6490)\n" + " (declare (in ) vec3 P@0x16e65a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16e6780)\n" + " (declare (in ) vec3 P@0x16e6890)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16e6a70)\n" + " (declare (in ) vec4 P@0x16e6b80)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16e6d60)\n" + " (declare (in ) vec4 P@0x16e6e70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16e7050)\n" + " (declare (in ) vec4 P@0x16e7160)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16e7340)\n" + " (declare (in ) vec4 P@0x16e7450)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16e7630)\n" + " (declare (in ) vec4 P@0x16e7740)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16e7920)\n" + " (declare (in ) vec4 P@0x16e7a30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16e7c10)\n" + " (declare (in ) vec4 P@0x16e7d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16e7f00)\n" + " (declare (in ) vec4 P@0x16e8010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16e81f0)\n" + " (declare (in ) vec2 P@0x16e8300)\n" + " (declare (in ) float bias@0x16e8410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16e85f0)\n" + " (declare (in ) vec2 P@0x16e8700)\n" + " (declare (in ) float bias@0x16e8810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16e89f0)\n" + " (declare (in ) vec2 P@0x16e8b00)\n" + " (declare (in ) float bias@0x16e8c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16e8df0)\n" + " (declare (in ) vec4 P@0x16e8f00)\n" + " (declare (in ) float bias@0x16e9010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16e91f0)\n" + " (declare (in ) vec4 P@0x16e9300)\n" + " (declare (in ) float bias@0x16e9410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16e95f0)\n" + " (declare (in ) vec4 P@0x16e9700)\n" + " (declare (in ) float bias@0x16e9810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16e99f0)\n" + " (declare (in ) vec3 P@0x16e9b00)\n" + " (declare (in ) float bias@0x16e9c10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16e9df0)\n" + " (declare (in ) vec3 P@0x16e9f00)\n" + " (declare (in ) float bias@0x16ea010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16ea1f0)\n" + " (declare (in ) vec3 P@0x16ea300)\n" + " (declare (in ) float bias@0x16ea410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16ea5f0)\n" + " (declare (in ) vec4 P@0x16ea700)\n" + " (declare (in ) float bias@0x16ea810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16ea9f0)\n" + " (declare (in ) vec4 P@0x16eab00)\n" + " (declare (in ) float bias@0x16eac10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16eadf0)\n" + " (declare (in ) vec4 P@0x16eaf00)\n" + " (declare (in ) float bias@0x16eb010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16eb1f0)\n" + " (declare (in ) vec4 P@0x16eb300)\n" + " (declare (in ) float bias@0x16eb410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16eb5f0)\n" + " (declare (in ) vec4 P@0x16eb700)\n" + " (declare (in ) float bias@0x16eb810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16eb9f0)\n" + " (declare (in ) vec4 P@0x16ebb00)\n" + " (declare (in ) float bias@0x16ebc10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16ebdf0)\n" + " (declare (in ) vec4 P@0x16ebf00)\n" + " (declare (in ) float bias@0x16ec010)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16ec1f0)\n" + " (declare (in ) vec4 P@0x16ec300)\n" + " (declare (in ) float bias@0x16ec410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16ec5f0)\n" + " (declare (in ) float P@0x16ec700)\n" + " (declare (in ) float lod@0x16ec810)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16ecba0)\n" + " (declare (in ) float P@0x16eccb0)\n" + " (declare (in ) float lod@0x16ecdc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16ecfa0)\n" + " (declare (in ) float P@0x16ed0b0)\n" + " (declare (in ) float lod@0x16ed1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16ed3a0)\n" + " (declare (in ) vec2 P@0x16ed4b0)\n" + " (declare (in ) float lod@0x16ed5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16ed7a0)\n" + " (declare (in ) vec2 P@0x16ed8b0)\n" + " (declare (in ) float lod@0x16ed9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16edba0)\n" + " (declare (in ) vec2 P@0x16edcb0)\n" + " (declare (in ) float lod@0x16eddc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16edfa0)\n" + " (declare (in ) vec3 P@0x16ee0b0)\n" + " (declare (in ) float lod@0x16ee1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16ee3a0)\n" + " (declare (in ) vec3 P@0x16ee4b0)\n" + " (declare (in ) float lod@0x16ee5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16ee7a0)\n" + " (declare (in ) vec3 P@0x16ee8b0)\n" + " (declare (in ) float lod@0x16ee9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x16eeba0)\n" + " (declare (in ) vec3 P@0x16eecb0)\n" + " (declare (in ) float lod@0x16eedc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x16eefa0)\n" + " (declare (in ) vec3 P@0x16ef0b0)\n" + " (declare (in ) float lod@0x16ef1c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x16ef3a0)\n" + " (declare (in ) vec3 P@0x16ef4b0)\n" + " (declare (in ) float lod@0x16ef5c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16ef7a0)\n" + " (declare (in ) vec3 P@0x16ef8b0)\n" + " (declare (in ) float lod@0x16ef9c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16efba0)\n" + " (declare (in ) vec3 P@0x16efcb0)\n" + " (declare (in ) float lod@0x16efdc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x16effa0)\n" + " (declare (in ) vec2 P@0x16f00b0)\n" + " (declare (in ) float lod@0x16f01c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x16f03a0)\n" + " (declare (in ) vec2 P@0x16f04b0)\n" + " (declare (in ) float lod@0x16f05c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x16f07a0)\n" + " (declare (in ) vec2 P@0x16f08b0)\n" + " (declare (in ) float lod@0x16f09c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x16f0ba0)\n" + " (declare (in ) vec3 P@0x16f0cb0)\n" + " (declare (in ) float lod@0x16f0dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x16f0fa0)\n" + " (declare (in ) vec3 P@0x16f10b0)\n" + " (declare (in ) float lod@0x16f11c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x16f13a0)\n" + " (declare (in ) vec3 P@0x16f14b0)\n" + " (declare (in ) float lod@0x16f15c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x16f17a0)\n" + " (declare (in ) vec3 P@0x16f18b0)\n" + " (declare (in ) float lod@0x16f19c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16f1ba0)\n" + " (declare (in ) int P@0x16f1cb0)\n" + " (declare (in ) int lod@0x16f1dc0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16f2150)\n" + " (declare (in ) int P@0x16f2260)\n" + " (declare (in ) int lod@0x16f2370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16f2550)\n" + " (declare (in ) int P@0x16f2660)\n" + " (declare (in ) int lod@0x16f2770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16f2950)\n" + " (declare (in ) ivec2 P@0x16f2a60)\n" + " (declare (in ) int lod@0x16f2b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16f2d50)\n" + " (declare (in ) ivec2 P@0x16f2e60)\n" + " (declare (in ) int lod@0x16f2f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16f3150)\n" + " (declare (in ) ivec2 P@0x16f3260)\n" + " (declare (in ) int lod@0x16f3370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16f3550)\n" + " (declare (in ) ivec3 P@0x16f3660)\n" + " (declare (in ) int lod@0x16f3770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16f3950)\n" + " (declare (in ) ivec3 P@0x16f3a60)\n" + " (declare (in ) int lod@0x16f3b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16f3d50)\n" + " (declare (in ) ivec3 P@0x16f3e60)\n" + " (declare (in ) int lod@0x16f3f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x16f4150)\n" + " (declare (in ) ivec2 P@0x16f4260)\n" + " (declare (in ) int lod@0x16f4370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x16f4550)\n" + " (declare (in ) ivec2 P@0x16f4660)\n" + " (declare (in ) int lod@0x16f4770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x16f4950)\n" + " (declare (in ) ivec2 P@0x16f4a60)\n" + " (declare (in ) int lod@0x16f4b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x16f4d50)\n" + " (declare (in ) ivec3 P@0x16f4e60)\n" + " (declare (in ) int lod@0x16f4f70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x16f5150)\n" + " (declare (in ) ivec3 P@0x16f5260)\n" + " (declare (in ) int lod@0x16f5370)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x16f5550)\n" + " (declare (in ) ivec3 P@0x16f5660)\n" + " (declare (in ) int lod@0x16f5770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16f5950)\n" + " (declare (in ) vec2 P@0x16f5a60)\n" + " (declare (in ) float lod@0x16f5b70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16f5f00)\n" + " (declare (in ) vec2 P@0x16f6010)\n" + " (declare (in ) float lod@0x16f6120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16f6300)\n" + " (declare (in ) vec2 P@0x16f6410)\n" + " (declare (in ) float lod@0x16f6520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16f6700)\n" + " (declare (in ) vec4 P@0x16f6810)\n" + " (declare (in ) float lod@0x16f6920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16f6b00)\n" + " (declare (in ) vec4 P@0x16f6c10)\n" + " (declare (in ) float lod@0x16f6d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16f6f00)\n" + " (declare (in ) vec4 P@0x16f7010)\n" + " (declare (in ) float lod@0x16f7120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16f7300)\n" + " (declare (in ) vec3 P@0x16f7410)\n" + " (declare (in ) float lod@0x16f7520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16f7700)\n" + " (declare (in ) vec3 P@0x16f7810)\n" + " (declare (in ) float lod@0x16f7920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16f7b00)\n" + " (declare (in ) vec3 P@0x16f7c10)\n" + " (declare (in ) float lod@0x16f7d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16f7f00)\n" + " (declare (in ) vec4 P@0x16f8010)\n" + " (declare (in ) float lod@0x16f8120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16f8300)\n" + " (declare (in ) vec4 P@0x16f8410)\n" + " (declare (in ) float lod@0x16f8520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16f8700)\n" + " (declare (in ) vec4 P@0x16f8810)\n" + " (declare (in ) float lod@0x16f8920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16f8b00)\n" + " (declare (in ) vec4 P@0x16f8c10)\n" + " (declare (in ) float lod@0x16f8d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16f8f00)\n" + " (declare (in ) vec4 P@0x16f9010)\n" + " (declare (in ) float lod@0x16f9120)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16f9300)\n" + " (declare (in ) vec4 P@0x16f9410)\n" + " (declare (in ) float lod@0x16f9520)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16f9700)\n" + " (declare (in ) vec4 P@0x16f9810)\n" + " (declare (in ) float lod@0x16f9920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16f9b00)\n" + " (declare (in ) vec4 P@0x16f9c10)\n" + " (declare (in ) float lod@0x16f9d20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x16f9f00)\n" + " (declare (in ) float P@0x16fa010)\n" + " (declare (in ) float dPdx@0x16fa120)\n" + " (declare (in ) float dPdy@0x16fa230)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x16fa5c0)\n" + " (declare (in ) float P@0x16fa6d0)\n" + " (declare (in ) float dPdx@0x16fa7e0)\n" + " (declare (in ) float dPdy@0x16fa8f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x16faad0)\n" + " (declare (in ) float P@0x16fabe0)\n" + " (declare (in ) float dPdx@0x16facf0)\n" + " (declare (in ) float dPdy@0x16fae00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x16fafe0)\n" + " (declare (in ) vec2 P@0x16fb0f0)\n" + " (declare (in ) vec2 dPdx@0x16fb200)\n" + " (declare (in ) vec2 dPdy@0x16fb310)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x16fb4f0)\n" + " (declare (in ) vec2 P@0x16fb600)\n" + " (declare (in ) vec2 dPdx@0x16fb710)\n" + " (declare (in ) vec2 dPdy@0x16fb820)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x16fba00)\n" + " (declare (in ) vec2 P@0x16fbb10)\n" + " (declare (in ) vec2 dPdx@0x16fbc20)\n" + " (declare (in ) vec2 dPdy@0x16fbd30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x16fbf10)\n" + " (declare (in ) vec3 P@0x16fc020)\n" + " (declare (in ) vec3 dPdx@0x16fc130)\n" + " (declare (in ) vec3 dPdy@0x16fc240)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x16fc420)\n" + " (declare (in ) vec3 P@0x16fc530)\n" + " (declare (in ) vec3 dPdx@0x16fc640)\n" + " (declare (in ) vec3 dPdy@0x16fc750)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x16fc930)\n" + " (declare (in ) vec3 P@0x16fca40)\n" + " (declare (in ) vec3 dPdx@0x16fcb50)\n" + " (declare (in ) vec3 dPdy@0x16fcc60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x16fce40)\n" + " (declare (in ) vec3 P@0x16fcf50)\n" + " (declare (in ) vec3 dPdx@0x16fd060)\n" + " (declare (in ) vec3 dPdy@0x16fd170)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isamplerCube sampler@0x16fd350)\n" + " (declare (in ) vec3 P@0x16fd460)\n" + " (declare (in ) vec3 dPdx@0x16fd570)\n" + " (declare (in ) vec3 dPdy@0x16fd680)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usamplerCube sampler@0x16fd860)\n" + " (declare (in ) vec3 P@0x16fd970)\n" + " (declare (in ) vec3 dPdx@0x16fda80)\n" + " (declare (in ) vec3 dPdy@0x16fdb90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x16fdd70)\n" + " (declare (in ) vec3 P@0x16fde80)\n" + " (declare (in ) float dPdx@0x16fdf90)\n" + " (declare (in ) float dPdy@0x16fe0a0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x16fe280)\n" + " (declare (in ) vec3 P@0x16fe390)\n" + " (declare (in ) vec2 dPdx@0x16fe4a0)\n" + " (declare (in ) vec2 dPdy@0x16fe5b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) samplerCubeShadow sampler@0x16fe790)\n" + " (declare (in ) vec4 P@0x16fe8a0)\n" + " (declare (in ) vec3 dPdx@0x16fe9b0)\n" + " (declare (in ) vec3 dPdy@0x16feac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DArray sampler@0x16feca0)\n" + " (declare (in ) vec2 P@0x16fedb0)\n" + " (declare (in ) float dPdx@0x16feec0)\n" + " (declare (in ) float dPdy@0x16fefd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1DArray sampler@0x16ff1b0)\n" + " (declare (in ) vec2 P@0x16ff2c0)\n" + " (declare (in ) float dPdx@0x16ff3d0)\n" + " (declare (in ) float dPdy@0x16ff4e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1DArray sampler@0x16ff6c0)\n" + " (declare (in ) vec2 P@0x16ff7d0)\n" + " (declare (in ) float dPdx@0x16ff8e0)\n" + " (declare (in ) float dPdy@0x16ff9f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DArray sampler@0x16ffbd0)\n" + " (declare (in ) vec3 P@0x16ffce0)\n" + " (declare (in ) vec2 dPdx@0x16ffdf0)\n" + " (declare (in ) vec2 dPdy@0x16fff00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2DArray sampler@0x17000e0)\n" + " (declare (in ) vec3 P@0x17001f0)\n" + " (declare (in ) vec2 dPdx@0x1700300)\n" + " (declare (in ) vec2 dPdy@0x1700410)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2DArray sampler@0x17005f0)\n" + " (declare (in ) vec3 P@0x1700700)\n" + " (declare (in ) vec2 dPdx@0x1700810)\n" + " (declare (in ) vec2 dPdy@0x1700920)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DArrayShadow sampler@0x1700b00)\n" + " (declare (in ) vec3 P@0x1700c10)\n" + " (declare (in ) float dPdx@0x1700d20)\n" + " (declare (in ) float dPdy@0x1700e30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DArrayShadow sampler@0x1701010)\n" + " (declare (in ) vec4 P@0x1701120)\n" + " (declare (in ) vec2 dPdx@0x1701230)\n" + " (declare (in ) vec2 dPdy@0x1701340)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureProjGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1701520)\n" + " (declare (in ) vec2 P@0x1701630)\n" + " (declare (in ) float dPdx@0x1701740)\n" + " (declare (in ) float dPdy@0x1701850)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1701be0)\n" + " (declare (in ) vec2 P@0x1701cf0)\n" + " (declare (in ) float dPdx@0x1701e00)\n" + " (declare (in ) float dPdy@0x1701f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x17020f0)\n" + " (declare (in ) vec2 P@0x1702200)\n" + " (declare (in ) float dPdx@0x1702310)\n" + " (declare (in ) float dPdy@0x1702420)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1702600)\n" + " (declare (in ) vec4 P@0x1702710)\n" + " (declare (in ) float dPdx@0x1702820)\n" + " (declare (in ) float dPdy@0x1702930)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler1D sampler@0x1702b10)\n" + " (declare (in ) vec4 P@0x1702c20)\n" + " (declare (in ) float dPdx@0x1702d30)\n" + " (declare (in ) float dPdy@0x1702e40)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler1D sampler@0x1703020)\n" + " (declare (in ) vec4 P@0x1703130)\n" + " (declare (in ) float dPdx@0x1703240)\n" + " (declare (in ) float dPdy@0x1703350)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1703530)\n" + " (declare (in ) vec3 P@0x1703640)\n" + " (declare (in ) vec2 dPdx@0x1703750)\n" + " (declare (in ) vec2 dPdy@0x1703860)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1703a40)\n" + " (declare (in ) vec3 P@0x1703b50)\n" + " (declare (in ) vec2 dPdx@0x1703c60)\n" + " (declare (in ) vec2 dPdy@0x1703d70)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1703f50)\n" + " (declare (in ) vec3 P@0x1704060)\n" + " (declare (in ) vec2 dPdx@0x1704170)\n" + " (declare (in ) vec2 dPdy@0x1704280)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1704460)\n" + " (declare (in ) vec4 P@0x1704570)\n" + " (declare (in ) vec2 dPdx@0x1704680)\n" + " (declare (in ) vec2 dPdy@0x1704790)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler2D sampler@0x1704970)\n" + " (declare (in ) vec4 P@0x1704a80)\n" + " (declare (in ) vec2 dPdx@0x1704b90)\n" + " (declare (in ) vec2 dPdy@0x1704ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler2D sampler@0x1704e80)\n" + " (declare (in ) vec4 P@0x1704f90)\n" + " (declare (in ) vec2 dPdx@0x17050a0)\n" + " (declare (in ) vec2 dPdy@0x17051b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x1705390)\n" + " (declare (in ) vec4 P@0x17054a0)\n" + " (declare (in ) vec3 dPdx@0x17055b0)\n" + " (declare (in ) vec3 dPdy@0x17056c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in ) isampler3D sampler@0x17058a0)\n" + " (declare (in ) vec4 P@0x17059b0)\n" + " (declare (in ) vec3 dPdx@0x1705ac0)\n" + " (declare (in ) vec3 dPdy@0x1705bd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in ) usampler3D sampler@0x1705db0)\n" + " (declare (in ) vec4 P@0x1705ec0)\n" + " (declare (in ) vec3 dPdx@0x1705fd0)\n" + " (declare (in ) vec3 dPdy@0x17060e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x17062c0)\n" + " (declare (in ) vec4 P@0x17063d0)\n" + " (declare (in ) float dPdx@0x17064e0)\n" + " (declare (in ) float dPdy@0x17065f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x17067d0)\n" + " (declare (in ) vec4 P@0x17068e0)\n" + " (declare (in ) vec2 dPdx@0x17069f0)\n" + " (declare (in ) vec2 dPdy@0x1706b00)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1706ce0)\n" + " (declare (in ) float coord@0x1706df0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1707910)\n" + " (declare (in ) float coord@0x1707a20)\n" + " (declare (in ) float bias@0x1707b30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1707180)\n" + " (declare (in ) vec2 coord@0x1707290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1707620)\n" + " (declare (in ) vec4 coord@0x1707730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1707d10)\n" + " (declare (in ) vec2 coord@0x1707e20)\n" + " (declare (in ) float bias@0x1707f30)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1708110)\n" + " (declare (in ) vec4 coord@0x1708220)\n" + " (declare (in ) float bias@0x1708330)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1708510)\n" + " (declare (in ) float coord@0x1708620)\n" + " (declare (in ) float lod@0x1708730)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1708ac0)\n" + " (declare (in ) vec2 coord@0x1708bd0)\n" + " (declare (in ) float lod@0x1708ce0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1D sampler@0x1709070)\n" + " (declare (in ) vec4 coord@0x1709180)\n" + " (declare (in ) float lod@0x1709290)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1709470)\n" + " (declare (in ) vec2 coord@0x1709580)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170a0a0)\n" + " (declare (in ) vec2 coord@0x170a1b0)\n" + " (declare (in ) float bias@0x170a2c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1709910)\n" + " (declare (in ) vec3 coord@0x1709a20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x1709db0)\n" + " (declare (in ) vec4 coord@0x1709ec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170a4a0)\n" + " (declare (in ) vec3 coord@0x170a5b0)\n" + " (declare (in ) float bias@0x170a6c0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170a8a0)\n" + " (declare (in ) vec4 coord@0x170a9b0)\n" + " (declare (in ) float bias@0x170aac0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170aca0)\n" + " (declare (in ) vec2 coord@0x170adb0)\n" + " (declare (in ) float lod@0x170aec0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170b250)\n" + " (declare (in ) vec3 coord@0x170b360)\n" + " (declare (in ) float lod@0x170b470)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2D sampler@0x170b800)\n" + " (declare (in ) vec4 coord@0x170b910)\n" + " (declare (in ) float lod@0x170ba20)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170bc00)\n" + " (declare (in ) vec3 coord@0x170bd10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170c540)\n" + " (declare (in ) vec3 coord@0x170c650)\n" + " (declare (in ) float bias@0x170c760)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170c0a0)\n" + " (declare (in ) vec4 coord@0x170c1b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170c940)\n" + " (declare (in ) vec4 coord@0x170ca50)\n" + " (declare (in ) float bias@0x170cb60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170cd40)\n" + " (declare (in ) vec3 coord@0x170ce50)\n" + " (declare (in ) float lod@0x170cf60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler3D sampler@0x170d2f0)\n" + " (declare (in ) vec4 coord@0x170d400)\n" + " (declare (in ) float lod@0x170d510)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x170d8a0)\n" + " (declare (in ) vec3 coord@0x170d9b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x170dd40)\n" + " (declare (in ) vec3 coord@0x170de50)\n" + " (declare (in ) float bias@0x170df60)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) samplerCube sampler@0x170e140)\n" + " (declare (in ) vec3 coord@0x170e250)\n" + " (declare (in ) float lod@0x170e360)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x170e6f0)\n" + " (declare (in ) vec3 coord@0x170e800)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x170f970)\n" + " (declare (in ) vec3 coord@0x170fa80)\n" + " (declare (in ) float bias@0x170fb90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x1cc28a0)\n" - " (declare (in ) vec2 coord@0x1cc29c0)\n" + " (declare (in ) sampler2DShadow sampler@0x170eb90)\n" + " (declare (in ) vec3 coord@0x170eca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x170fd70)\n" + " (declare (in ) vec3 coord@0x170fe80)\n" + " (declare (in ) float bias@0x170ff90)\n" " )\n" " (\n" " ))\n" "\n" ")\n" "\n" - "(function texture2DRectProj\n" + "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x1cc2d80)\n" - " (declare (in ) vec3 coord@0x1cc2ea0)\n" + " (declare (in ) sampler1DShadow sampler@0x170f030)\n" + " (declare (in ) vec4 coord@0x170f140)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x1cc3260)\n" - " (declare (in ) vec4 coord@0x1cc3380)\n" + " (declare (in ) sampler1DShadow sampler@0x1710170)\n" + " (declare (in ) vec4 coord@0x1710280)\n" + " (declare (in ) float bias@0x1710390)\n" " )\n" " (\n" " ))\n" "\n" ")\n" "\n" - "(function shadow2DRect\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x170f4d0)\n" + " (declare (in ) vec4 coord@0x170f5e0)\n" + " )\n" + " (\n" + " ))\n" + "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x1cc3560)\n" - " (declare (in ) vec3 coord@0x1cc3680)\n" + " (declare (in ) sampler2DShadow sampler@0x1710570)\n" + " (declare (in ) vec4 coord@0x1710680)\n" + " (declare (in ) float bias@0x1710790)\n" " )\n" " (\n" " ))\n" "\n" ")\n" "\n" - "(function shadow2DRectProj\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x1710970)\n" + " (declare (in ) vec3 coord@0x1710a80)\n" + " (declare (in ) float lod@0x1710b90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1710f20)\n" + " (declare (in ) vec3 coord@0x1711030)\n" + " (declare (in ) float lod@0x1711140)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler1DShadow sampler@0x17114d0)\n" + " (declare (in ) vec4 coord@0x17115e0)\n" + " (declare (in ) float lod@0x17116f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) sampler2DShadow sampler@0x1711a80)\n" + " (declare (in ) vec4 coord@0x1711b90)\n" + " (declare (in ) float lod@0x1711ca0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float x@0x1712030)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec2 x@0x17123b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1712590)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1712770)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float x@0x1712950)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1712cd0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec3 x@0x1712eb0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec4 x@0x1713090)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) float x@0x1713270)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec2 x@0x17135f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec3 x@0x17137d0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in ) vec4 x@0x17139b0)\n" + " )\n" + " (\n" + " ))\n" + "\n" + ")\n" + "\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) float x@0x1713b90)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec2 x@0x1713f10)\n" + " )\n" + " (\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in ) vec3 x@0x17140f0)\n" + " )\n" + " (\n" + " ))\n" + "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x1cc3a40)\n" - " (declare (in ) vec4 coord@0x1cc3b60)\n" + " (declare (in ) vec4 x@0x17142d0)\n" " )\n" " (\n" " ))\n" @@ -12073,19 +21546,96 @@ static const char *prototypes_for_ARB_texture_rectangle_vert = "\n" ")" ; -static const char *functions_for_ARB_texture_rectangle_vert [] = { - builtin_texture2DRect, - builtin_shadow2DRectProj, - builtin_shadow2DRect, - builtin_texture2DRectProj, +static const char *functions_for_130_vert [] = { + builtin_clamp, + builtin_matrixCompMult, + builtin_textureProj, + builtin_noise2, + builtin_texture3DProjLod, + builtin_pow, + builtin_texture2DProj, + builtin_greaterThanEqual, + builtin_sign, + builtin_texture3DProj, + builtin_textureProjLod, + builtin_texture, + builtin_texture2D, + builtin_equal, + builtin_faceforward, + builtin_tan, + builtin_shadow2DProj, + builtin_shadow1DProjLod, + builtin_any, + builtin_shadow1DProj, + builtin_normalize, + builtin_asin, + builtin_texture1DProj, + builtin_log, + builtin_floor, + builtin_exp2, + builtin_lessThan, + builtin_cross, + builtin_sqrt, + builtin_texture3DLod, + builtin_textureLod, + builtin_fract, + builtin_abs, + builtin_degrees, + builtin_shadow1DLod, + builtin_ftransform, + builtin_sin, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_all, + builtin_log2, + builtin_textureGrad, + builtin_atan, + builtin_notEqual, + builtin_max, + builtin_lessThanEqual, + builtin_transpose, + builtin_outerProduct, + builtin_ceil, + builtin_reflect, + builtin_textureCubeLod, + builtin_step, + builtin_texture1D, + builtin_greaterThan, + builtin_texture3D, + builtin_shadow2DProjLod, + builtin_not, + builtin_texture2DProjLod, + builtin_inversesqrt, + builtin_mod, + builtin_noise4, + builtin_distance, + builtin_cos, + builtin_shadow1D, + builtin_noise1, + builtin_refract, + builtin_noise3, + builtin_texelFetch, + builtin_min, + builtin_radians, + builtin_smoothstep, + builtin_textureProjGrad, + builtin_texture1DProjLod, + builtin_textureCube, + builtin_length, + builtin_texture1DLod, + builtin_texture2DLod, + builtin_exp, + builtin_acos, + builtin_mix, + builtin_dot, }; static const char *prototypes_for_ARB_texture_rectangle_frag = "(\n" "(function texture2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x13d0040)\n" - " (declare (in ) vec2 coord@0x13d0160)\n" + " (declare (in ) sampler2DRect sampler@0x225e0f0)\n" + " (declare (in ) vec2 coord@0x225e200)\n" " )\n" " (\n" " ))\n" @@ -12095,16 +21645,16 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function texture2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x13d0520)\n" - " (declare (in ) vec3 coord@0x13d0640)\n" + " (declare (in ) sampler2DRect sampler@0x225e590)\n" + " (declare (in ) vec3 coord@0x225e6a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRect sampler@0x13d0a00)\n" - " (declare (in ) vec4 coord@0x13d0b20)\n" + " (declare (in ) sampler2DRect sampler@0x225ea30)\n" + " (declare (in ) vec4 coord@0x225eb40)\n" " )\n" " (\n" " ))\n" @@ -12114,8 +21664,8 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function shadow2DRect\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x13d0d00)\n" - " (declare (in ) vec3 coord@0x13d0e20)\n" + " (declare (in ) sampler2DRectShadow sampler@0x225ed20)\n" + " (declare (in ) vec3 coord@0x225ee30)\n" " )\n" " (\n" " ))\n" @@ -12125,8 +21675,8 @@ static const char *prototypes_for_ARB_texture_rectangle_frag = "(function shadow2DRectProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DRectShadow sampler@0x13d11e0)\n" - " (declare (in ) vec4 coord@0x13d1300)\n" + " (declare (in ) sampler2DRectShadow sampler@0x225f1c0)\n" + " (declare (in ) vec4 coord@0x225f2d0)\n" " )\n" " (\n" " ))\n" @@ -12147,28 +21697,28 @@ static const char *prototypes_for_120_frag = "(function radians\n" " (signature float\n" " (parameters\n" - " (declare (in ) float degrees@0x8b57e0)\n" + " (declare (in ) float degrees@0xaf8340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 degrees@0x8b5bb0)\n" + " (declare (in ) vec2 degrees@0xaf86c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 degrees@0x8b5da0)\n" + " (declare (in ) vec3 degrees@0xaf88a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 degrees@0x8b5f90)\n" + " (declare (in ) vec4 degrees@0xaf8a80)\n" " )\n" " (\n" " ))\n" @@ -12178,28 +21728,28 @@ static const char *prototypes_for_120_frag = "(function degrees\n" " (signature float\n" " (parameters\n" - " (declare (in ) float radians@0x8b6180)\n" + " (declare (in ) float radians@0xaf8c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 radians@0x8b6550)\n" + " (declare (in ) vec2 radians@0xaf8fe0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 radians@0x8b6740)\n" + " (declare (in ) vec3 radians@0xaf91c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 radians@0x8b6930)\n" + " (declare (in ) vec4 radians@0xaf93a0)\n" " )\n" " (\n" " ))\n" @@ -12209,28 +21759,28 @@ static const char *prototypes_for_120_frag = "(function sin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x8b6b20)\n" + " (declare (in ) float angle@0xaf9580)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x8b6ed0)\n" + " (declare (in ) vec2 angle@0xaf9900)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x8b70b0)\n" + " (declare (in ) vec3 angle@0xaf9ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x8b7290)\n" + " (declare (in ) vec4 angle@0xaf9cc0)\n" " )\n" " (\n" " ))\n" @@ -12240,28 +21790,28 @@ static const char *prototypes_for_120_frag = "(function cos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x8b7470)\n" + " (declare (in ) float angle@0xaf9ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x8b7820)\n" + " (declare (in ) vec2 angle@0xafa220)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x8b7a00)\n" + " (declare (in ) vec3 angle@0xafa400)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x8b7be0)\n" + " (declare (in ) vec4 angle@0xafa5e0)\n" " )\n" " (\n" " ))\n" @@ -12271,28 +21821,28 @@ static const char *prototypes_for_120_frag = "(function tan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x8b7dc0)\n" + " (declare (in ) float angle@0xafa7c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x8b8170)\n" + " (declare (in ) vec2 angle@0xafab40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x8b8350)\n" + " (declare (in ) vec3 angle@0xafad20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x8b8530)\n" + " (declare (in ) vec4 angle@0xafaf00)\n" " )\n" " (\n" " ))\n" @@ -12302,28 +21852,28 @@ static const char *prototypes_for_120_frag = "(function asin\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x8b8710)\n" + " (declare (in ) float angle@0xafb0e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x8b8ac0)\n" + " (declare (in ) vec2 angle@0xafb460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x8b8ca0)\n" + " (declare (in ) vec3 angle@0xafb640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x8b8e80)\n" + " (declare (in ) vec4 angle@0xafb820)\n" " )\n" " (\n" " ))\n" @@ -12333,28 +21883,28 @@ static const char *prototypes_for_120_frag = "(function acos\n" " (signature float\n" " (parameters\n" - " (declare (in ) float angle@0x8b9060)\n" + " (declare (in ) float angle@0xafba00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 angle@0x8b9410)\n" + " (declare (in ) vec2 angle@0xafbd80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 angle@0x8b95f0)\n" + " (declare (in ) vec3 angle@0xafbf60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 angle@0x8b97d0)\n" + " (declare (in ) vec4 angle@0xafc140)\n" " )\n" " (\n" " ))\n" @@ -12364,60 +21914,60 @@ static const char *prototypes_for_120_frag = "(function atan\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y@0x8b99b0)\n" - " (declare (in ) float x@0x8b9ac0)\n" + " (declare (in ) float y@0xafc320)\n" + " (declare (in ) float x@0xafc430)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y@0x8b9e70)\n" - " (declare (in ) vec2 x@0x8b9f80)\n" + " (declare (in ) vec2 y@0xafc7b0)\n" + " (declare (in ) vec2 x@0xafc8c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y@0x8ba160)\n" - " (declare (in ) vec3 x@0x8ba270)\n" + " (declare (in ) vec3 y@0xafcaa0)\n" + " (declare (in ) vec3 x@0xafcbb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y@0x8ba450)\n" - " (declare (in ) vec4 x@0x8ba560)\n" + " (declare (in ) vec4 y@0xafcd90)\n" + " (declare (in ) vec4 x@0xafcea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) float y_over_x@0x8ba740)\n" + " (declare (in ) float y_over_x@0xafd080)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 y_over_x@0x8ba930)\n" + " (declare (in ) vec2 y_over_x@0xafd270)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 y_over_x@0x8bab20)\n" + " (declare (in ) vec3 y_over_x@0xafd460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 y_over_x@0x8bad10)\n" + " (declare (in ) vec4 y_over_x@0xafd650)\n" " )\n" " (\n" " ))\n" @@ -12427,32 +21977,32 @@ static const char *prototypes_for_120_frag = "(function pow\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8baf00)\n" - " (declare (in ) float y@0x8bb010)\n" + " (declare (in ) float x@0xafd840)\n" + " (declare (in ) float y@0xafd950)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bb3c0)\n" - " (declare (in ) vec2 y@0x8bb4d0)\n" + " (declare (in ) vec2 x@0xafdcd0)\n" + " (declare (in ) vec2 y@0xafdde0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bb6b0)\n" - " (declare (in ) vec3 y@0x8bb7c0)\n" + " (declare (in ) vec3 x@0xafdfc0)\n" + " (declare (in ) vec3 y@0xafe0d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bb9a0)\n" - " (declare (in ) vec4 y@0x8bbab0)\n" + " (declare (in ) vec4 x@0xafe2b0)\n" + " (declare (in ) vec4 y@0xafe3c0)\n" " )\n" " (\n" " ))\n" @@ -12462,28 +22012,28 @@ static const char *prototypes_for_120_frag = "(function exp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bbc90)\n" + " (declare (in ) float x@0xafe5a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bc040)\n" + " (declare (in ) vec2 x@0xafe920)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bc220)\n" + " (declare (in ) vec3 x@0xafeb00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bc400)\n" + " (declare (in ) vec4 x@0xafece0)\n" " )\n" " (\n" " ))\n" @@ -12493,28 +22043,28 @@ static const char *prototypes_for_120_frag = "(function log\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bc5e0)\n" + " (declare (in ) float x@0xafeec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bc990)\n" + " (declare (in ) vec2 x@0xaff240)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bcb70)\n" + " (declare (in ) vec3 x@0xaff420)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bcd50)\n" + " (declare (in ) vec4 x@0xaff600)\n" " )\n" " (\n" " ))\n" @@ -12524,28 +22074,28 @@ static const char *prototypes_for_120_frag = "(function exp2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bcf30)\n" + " (declare (in ) float x@0xaff7e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bd2e0)\n" + " (declare (in ) vec2 x@0xaffb60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bd4c0)\n" + " (declare (in ) vec3 x@0xaffd40)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bd6a0)\n" + " (declare (in ) vec4 x@0xafff20)\n" " )\n" " (\n" " ))\n" @@ -12555,28 +22105,28 @@ static const char *prototypes_for_120_frag = "(function log2\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bd880)\n" + " (declare (in ) float x@0xb00100)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bdc30)\n" + " (declare (in ) vec2 x@0xb00480)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bde10)\n" + " (declare (in ) vec3 x@0xb00660)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bdff0)\n" + " (declare (in ) vec4 x@0xb00840)\n" " )\n" " (\n" " ))\n" @@ -12586,28 +22136,28 @@ static const char *prototypes_for_120_frag = "(function sqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8be1d0)\n" + " (declare (in ) float x@0xb00a20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8be580)\n" + " (declare (in ) vec2 x@0xb00da0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8be760)\n" + " (declare (in ) vec3 x@0xb00f80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8be940)\n" + " (declare (in ) vec4 x@0xb01160)\n" " )\n" " (\n" " ))\n" @@ -12617,28 +22167,28 @@ static const char *prototypes_for_120_frag = "(function inversesqrt\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8beb20)\n" + " (declare (in ) float x@0xb01340)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8beee0)\n" + " (declare (in ) vec2 x@0xb016d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bf0c0)\n" + " (declare (in ) vec3 x@0xb018b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bf2a0)\n" + " (declare (in ) vec4 x@0xb01a90)\n" " )\n" " (\n" " ))\n" @@ -12648,28 +22198,28 @@ static const char *prototypes_for_120_frag = "(function abs\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bf480)\n" + " (declare (in ) float x@0xb01c70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8bf830)\n" + " (declare (in ) vec2 x@0xb01ff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8bfa10)\n" + " (declare (in ) vec3 x@0xb021d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8bfbf0)\n" + " (declare (in ) vec4 x@0xb023b0)\n" " )\n" " (\n" " ))\n" @@ -12679,28 +22229,28 @@ static const char *prototypes_for_120_frag = "(function sign\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8bfdd0)\n" + " (declare (in ) float x@0xb02590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c0180)\n" + " (declare (in ) vec2 x@0xb02910)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c0360)\n" + " (declare (in ) vec3 x@0xb02af0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c0540)\n" + " (declare (in ) vec4 x@0xb02cd0)\n" " )\n" " (\n" " ))\n" @@ -12710,28 +22260,28 @@ static const char *prototypes_for_120_frag = "(function floor\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c0720)\n" + " (declare (in ) float x@0xb02eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c0ad0)\n" + " (declare (in ) vec2 x@0xb03230)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c0cb0)\n" + " (declare (in ) vec3 x@0xb03410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c0e90)\n" + " (declare (in ) vec4 x@0xb035f0)\n" " )\n" " (\n" " ))\n" @@ -12741,28 +22291,28 @@ static const char *prototypes_for_120_frag = "(function ceil\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c1070)\n" + " (declare (in ) float x@0xb037d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c1420)\n" + " (declare (in ) vec2 x@0xb03b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c1600)\n" + " (declare (in ) vec3 x@0xb03d30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c17e0)\n" + " (declare (in ) vec4 x@0xb03f10)\n" " )\n" " (\n" " ))\n" @@ -12772,28 +22322,28 @@ static const char *prototypes_for_120_frag = "(function fract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c19c0)\n" + " (declare (in ) float x@0xb040f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c1d70)\n" + " (declare (in ) vec2 x@0xb04470)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c1f50)\n" + " (declare (in ) vec3 x@0xb04650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c2130)\n" + " (declare (in ) vec4 x@0xb04830)\n" " )\n" " (\n" " ))\n" @@ -12803,56 +22353,56 @@ static const char *prototypes_for_120_frag = "(function mod\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c2310)\n" - " (declare (in ) float y@0x8c2420)\n" + " (declare (in ) float x@0xb04a10)\n" + " (declare (in ) float y@0xb04b20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c27d0)\n" - " (declare (in ) float y@0x8c28e0)\n" + " (declare (in ) vec2 x@0xb04ea0)\n" + " (declare (in ) float y@0xb04fb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c2ac0)\n" - " (declare (in ) float y@0x8c2bd0)\n" + " (declare (in ) vec3 x@0xb05190)\n" + " (declare (in ) float y@0xb052a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c2db0)\n" - " (declare (in ) float y@0x8c2ec0)\n" + " (declare (in ) vec4 x@0xb05480)\n" + " (declare (in ) float y@0xb05590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c30a0)\n" - " (declare (in ) vec2 y@0x8c31b0)\n" + " (declare (in ) vec2 x@0xb05770)\n" + " (declare (in ) vec2 y@0xb05880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c3390)\n" - " (declare (in ) vec3 y@0x8c34a0)\n" + " (declare (in ) vec3 x@0xb05a60)\n" + " (declare (in ) vec3 y@0xb05b70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c3680)\n" - " (declare (in ) vec4 y@0x8c3790)\n" + " (declare (in ) vec4 x@0xb05d50)\n" + " (declare (in ) vec4 y@0xb05e60)\n" " )\n" " (\n" " ))\n" @@ -12862,56 +22412,56 @@ static const char *prototypes_for_120_frag = "(function min\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c3970)\n" - " (declare (in ) float y@0x8c3a80)\n" + " (declare (in ) float x@0xb06040)\n" + " (declare (in ) float y@0xb06150)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c3e30)\n" - " (declare (in ) vec2 y@0x8c3f40)\n" + " (declare (in ) vec2 x@0xb064d0)\n" + " (declare (in ) vec2 y@0xb065e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c4120)\n" - " (declare (in ) vec3 y@0x8c4230)\n" + " (declare (in ) vec3 x@0xb067c0)\n" + " (declare (in ) vec3 y@0xb068d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c4410)\n" - " (declare (in ) vec4 y@0x8c4520)\n" + " (declare (in ) vec4 x@0xb06ab0)\n" + " (declare (in ) vec4 y@0xb06bc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c4700)\n" - " (declare (in ) float y@0x8c4810)\n" + " (declare (in ) vec2 x@0xb06da0)\n" + " (declare (in ) float y@0xb06eb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c49f0)\n" - " (declare (in ) float y@0x8c4b00)\n" + " (declare (in ) vec3 x@0xb07090)\n" + " (declare (in ) float y@0xb071a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c4ce0)\n" - " (declare (in ) float y@0x8c4df0)\n" + " (declare (in ) vec4 x@0xb07380)\n" + " (declare (in ) float y@0xb07490)\n" " )\n" " (\n" " ))\n" @@ -12921,56 +22471,56 @@ static const char *prototypes_for_120_frag = "(function max\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c4fd0)\n" - " (declare (in ) float y@0x8c50e0)\n" + " (declare (in ) float x@0xb07670)\n" + " (declare (in ) float y@0xb07780)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c5490)\n" - " (declare (in ) vec2 y@0x8c55a0)\n" + " (declare (in ) vec2 x@0xb07b00)\n" + " (declare (in ) vec2 y@0xb07c10)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c5780)\n" - " (declare (in ) vec3 y@0x8c5890)\n" + " (declare (in ) vec3 x@0xb07df0)\n" + " (declare (in ) vec3 y@0xb07f00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c5a70)\n" - " (declare (in ) vec4 y@0x8c5b80)\n" + " (declare (in ) vec4 x@0xb080e0)\n" + " (declare (in ) vec4 y@0xb081f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c5d60)\n" - " (declare (in ) float y@0x8c5e70)\n" + " (declare (in ) vec2 x@0xb083d0)\n" + " (declare (in ) float y@0xb084e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c6050)\n" - " (declare (in ) float y@0x8c6160)\n" + " (declare (in ) vec3 x@0xb086c0)\n" + " (declare (in ) float y@0xb087d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c6340)\n" - " (declare (in ) float y@0x8c6450)\n" + " (declare (in ) vec4 x@0xb089b0)\n" + " (declare (in ) float y@0xb08ac0)\n" " )\n" " (\n" " ))\n" @@ -12980,63 +22530,63 @@ static const char *prototypes_for_120_frag = "(function clamp\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c6630)\n" - " (declare (in ) float minVal@0x8c6740)\n" - " (declare (in ) float maxVal@0x8c6850)\n" + " (declare (in ) float x@0xb08ca0)\n" + " (declare (in ) float minVal@0xb08db0)\n" + " (declare (in ) float maxVal@0xb08ec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c6c00)\n" - " (declare (in ) vec2 minVal@0x8c6d10)\n" - " (declare (in ) vec2 maxVal@0x8c6e20)\n" + " (declare (in ) vec2 x@0xb09240)\n" + " (declare (in ) vec2 minVal@0xb09350)\n" + " (declare (in ) vec2 maxVal@0xb09460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c7000)\n" - " (declare (in ) vec3 minVal@0x8c7110)\n" - " (declare (in ) vec3 maxVal@0x8c7220)\n" + " (declare (in ) vec3 x@0xb09640)\n" + " (declare (in ) vec3 minVal@0xb09750)\n" + " (declare (in ) vec3 maxVal@0xb09860)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c7400)\n" - " (declare (in ) vec4 minVal@0x8c7510)\n" - " (declare (in ) vec4 maxVal@0x8c7620)\n" + " (declare (in ) vec4 x@0xb09a40)\n" + " (declare (in ) vec4 minVal@0xb09b50)\n" + " (declare (in ) vec4 maxVal@0xb09c60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c7800)\n" - " (declare (in ) float minVal@0x8c7910)\n" - " (declare (in ) float maxVal@0x8c7a20)\n" + " (declare (in ) vec2 x@0xb09e40)\n" + " (declare (in ) float minVal@0xb09f50)\n" + " (declare (in ) float maxVal@0xb0a060)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c7c00)\n" - " (declare (in ) float minVal@0x8c7d10)\n" - " (declare (in ) float maxVal@0x8c7e20)\n" + " (declare (in ) vec3 x@0xb0a240)\n" + " (declare (in ) float minVal@0xb0a350)\n" + " (declare (in ) float maxVal@0xb0a460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c8000)\n" - " (declare (in ) float minVal@0x8c8110)\n" - " (declare (in ) float maxVal@0x8c8220)\n" + " (declare (in ) vec4 x@0xb0a640)\n" + " (declare (in ) float minVal@0xb0a750)\n" + " (declare (in ) float maxVal@0xb0a860)\n" " )\n" " (\n" " ))\n" @@ -13046,63 +22596,63 @@ static const char *prototypes_for_120_frag = "(function mix\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8c8400)\n" - " (declare (in ) float y@0x8c8510)\n" - " (declare (in ) float a@0x8c8620)\n" + " (declare (in ) float x@0xb0aa40)\n" + " (declare (in ) float y@0xb0ab50)\n" + " (declare (in ) float a@0xb0ac60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c89d0)\n" - " (declare (in ) vec2 y@0x8c8ae0)\n" - " (declare (in ) vec2 a@0x8c8bf0)\n" + " (declare (in ) vec2 x@0xb0afe0)\n" + " (declare (in ) vec2 y@0xb0b0f0)\n" + " (declare (in ) vec2 a@0xb0b200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c8dd0)\n" - " (declare (in ) vec3 y@0x8c8ee0)\n" - " (declare (in ) vec3 a@0x8c8ff0)\n" + " (declare (in ) vec3 x@0xb0b3e0)\n" + " (declare (in ) vec3 y@0xb0b4f0)\n" + " (declare (in ) vec3 a@0xb0b600)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c91d0)\n" - " (declare (in ) vec4 y@0x8c92e0)\n" - " (declare (in ) vec4 a@0x8c93f0)\n" + " (declare (in ) vec4 x@0xb0b7e0)\n" + " (declare (in ) vec4 y@0xb0b8f0)\n" + " (declare (in ) vec4 a@0xb0ba00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8c95d0)\n" - " (declare (in ) vec2 y@0x8c96e0)\n" - " (declare (in ) float a@0x8c97f0)\n" + " (declare (in ) vec2 x@0xb0bbe0)\n" + " (declare (in ) vec2 y@0xb0bcf0)\n" + " (declare (in ) float a@0xb0be00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8c99d0)\n" - " (declare (in ) vec3 y@0x8c9ae0)\n" - " (declare (in ) float a@0x8c9bf0)\n" + " (declare (in ) vec3 x@0xb0bfe0)\n" + " (declare (in ) vec3 y@0xb0c0f0)\n" + " (declare (in ) float a@0xb0c200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8c9dd0)\n" - " (declare (in ) vec4 y@0x8c9ee0)\n" - " (declare (in ) float a@0x8c9ff0)\n" + " (declare (in ) vec4 x@0xb0c3e0)\n" + " (declare (in ) vec4 y@0xb0c4f0)\n" + " (declare (in ) float a@0xb0c600)\n" " )\n" " (\n" " ))\n" @@ -13112,56 +22662,56 @@ static const char *prototypes_for_120_frag = "(function step\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge@0x8ca1d0)\n" - " (declare (in ) float x@0x8ca2e0)\n" + " (declare (in ) float edge@0xb0c7e0)\n" + " (declare (in ) float x@0xb0c8f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge@0x8ca690)\n" - " (declare (in ) vec2 x@0x8ca7a0)\n" + " (declare (in ) vec2 edge@0xb0cc70)\n" + " (declare (in ) vec2 x@0xb0cd80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge@0x8ca980)\n" - " (declare (in ) vec3 x@0x8caa90)\n" + " (declare (in ) vec3 edge@0xb0cf60)\n" + " (declare (in ) vec3 x@0xb0d070)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge@0x8cac70)\n" - " (declare (in ) vec4 x@0x8cad80)\n" + " (declare (in ) vec4 edge@0xb0d250)\n" + " (declare (in ) vec4 x@0xb0d360)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge@0x8caf60)\n" - " (declare (in ) vec2 x@0x8cb070)\n" + " (declare (in ) float edge@0xb0d540)\n" + " (declare (in ) vec2 x@0xb0d650)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge@0x8cb250)\n" - " (declare (in ) vec3 x@0x8cb360)\n" + " (declare (in ) float edge@0xb0d830)\n" + " (declare (in ) vec3 x@0xb0d940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge@0x8cb540)\n" - " (declare (in ) vec4 x@0x8cb650)\n" + " (declare (in ) float edge@0xb0db20)\n" + " (declare (in ) vec4 x@0xb0dc30)\n" " )\n" " (\n" " ))\n" @@ -13171,63 +22721,63 @@ static const char *prototypes_for_120_frag = "(function smoothstep\n" " (signature float\n" " (parameters\n" - " (declare (in ) float edge0@0x8cb830)\n" - " (declare (in ) float edge1@0x8cb940)\n" - " (declare (in ) float x@0x8cba50)\n" + " (declare (in ) float edge0@0xb0de10)\n" + " (declare (in ) float edge1@0xb0df20)\n" + " (declare (in ) float x@0xb0e030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 edge0@0x8cbe10)\n" - " (declare (in ) vec2 edge1@0x8cbf20)\n" - " (declare (in ) vec2 x@0x8cc030)\n" + " (declare (in ) vec2 edge0@0xb0e3c0)\n" + " (declare (in ) vec2 edge1@0xb0e4d0)\n" + " (declare (in ) vec2 x@0xb0e5e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 edge0@0x8cc210)\n" - " (declare (in ) vec3 edge1@0x8cc320)\n" - " (declare (in ) vec3 x@0x8cc430)\n" + " (declare (in ) vec3 edge0@0xb0e7c0)\n" + " (declare (in ) vec3 edge1@0xb0e8d0)\n" + " (declare (in ) vec3 x@0xb0e9e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 edge0@0x8cc610)\n" - " (declare (in ) vec4 edge1@0x8cc720)\n" - " (declare (in ) vec4 x@0x8cc830)\n" + " (declare (in ) vec4 edge0@0xb0ebc0)\n" + " (declare (in ) vec4 edge1@0xb0ecd0)\n" + " (declare (in ) vec4 x@0xb0ede0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float edge0@0x8cca10)\n" - " (declare (in ) float edge1@0x8ccb20)\n" - " (declare (in ) vec2 x@0x8ccc30)\n" + " (declare (in ) float edge0@0xb0efc0)\n" + " (declare (in ) float edge1@0xb0f0d0)\n" + " (declare (in ) vec2 x@0xb0f1e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float edge0@0x8cce10)\n" - " (declare (in ) float edge1@0x8ccf20)\n" - " (declare (in ) vec3 x@0x8cd030)\n" + " (declare (in ) float edge0@0xb0f3c0)\n" + " (declare (in ) float edge1@0xb0f4d0)\n" + " (declare (in ) vec3 x@0xb0f5e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float edge0@0x8cd210)\n" - " (declare (in ) float edge1@0x8cd320)\n" - " (declare (in ) vec4 x@0x8cd430)\n" + " (declare (in ) float edge0@0xb0f7c0)\n" + " (declare (in ) float edge1@0xb0f8d0)\n" + " (declare (in ) vec4 x@0xb0f9e0)\n" " )\n" " (\n" " ))\n" @@ -13237,28 +22787,28 @@ static const char *prototypes_for_120_frag = "(function length\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8cd610)\n" + " (declare (in ) float x@0xb0fbc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x8cd9c0)\n" + " (declare (in ) vec2 x@0xb0ff40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x8cdba0)\n" + " (declare (in ) vec3 x@0xb10120)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x8cdd80)\n" + " (declare (in ) vec4 x@0xb10300)\n" " )\n" " (\n" " ))\n" @@ -13268,32 +22818,32 @@ static const char *prototypes_for_120_frag = "(function distance\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p0@0x8cdf60)\n" - " (declare (in ) float p1@0x8ce070)\n" + " (declare (in ) float p0@0xb104e0)\n" + " (declare (in ) float p1@0xb105f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 p0@0x8ce430)\n" - " (declare (in ) vec2 p1@0x8ce540)\n" + " (declare (in ) vec2 p0@0xb10980)\n" + " (declare (in ) vec2 p1@0xb10a90)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 p0@0x8ce720)\n" - " (declare (in ) vec3 p1@0x8ce830)\n" + " (declare (in ) vec3 p0@0xb10c70)\n" + " (declare (in ) vec3 p1@0xb10d80)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 p0@0x8cea10)\n" - " (declare (in ) vec4 p1@0x8ceb20)\n" + " (declare (in ) vec4 p0@0xb10f60)\n" + " (declare (in ) vec4 p1@0xb11070)\n" " )\n" " (\n" " ))\n" @@ -13303,32 +22853,32 @@ static const char *prototypes_for_120_frag = "(function dot\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8ced00)\n" - " (declare (in ) float y@0x8cee10)\n" + " (declare (in ) float x@0xb11250)\n" + " (declare (in ) float y@0xb11360)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x8cf1c0)\n" - " (declare (in ) vec2 y@0x8cf2d0)\n" + " (declare (in ) vec2 x@0xb116e0)\n" + " (declare (in ) vec2 y@0xb117f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x8cf4b0)\n" - " (declare (in ) vec3 y@0x8cf5c0)\n" + " (declare (in ) vec3 x@0xb119d0)\n" + " (declare (in ) vec3 y@0xb11ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x8cf7a0)\n" - " (declare (in ) vec4 y@0x8cf8b0)\n" + " (declare (in ) vec4 x@0xb11cc0)\n" + " (declare (in ) vec4 y@0xb11dd0)\n" " )\n" " (\n" " ))\n" @@ -13338,8 +22888,8 @@ static const char *prototypes_for_120_frag = "(function cross\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8cfa90)\n" - " (declare (in ) vec3 y@0x8cfba0)\n" + " (declare (in ) vec3 x@0xb11fb0)\n" + " (declare (in ) vec3 y@0xb120c0)\n" " )\n" " (\n" " ))\n" @@ -13349,28 +22899,28 @@ static const char *prototypes_for_120_frag = "(function normalize\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8cff50)\n" + " (declare (in ) float x@0xb12440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8d0310)\n" + " (declare (in ) vec2 x@0xb127d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8d04f0)\n" + " (declare (in ) vec3 x@0xb129b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8d06d0)\n" + " (declare (in ) vec4 x@0xb12b90)\n" " )\n" " (\n" " ))\n" @@ -13380,36 +22930,36 @@ static const char *prototypes_for_120_frag = "(function faceforward\n" " (signature float\n" " (parameters\n" - " (declare (in ) float N@0x8d08b0)\n" - " (declare (in ) float I@0x8d09c0)\n" - " (declare (in ) float Nref@0x8d0ad0)\n" + " (declare (in ) float N@0xb12d70)\n" + " (declare (in ) float I@0xb12e80)\n" + " (declare (in ) float Nref@0xb12f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 N@0x8d0e90)\n" - " (declare (in ) vec2 I@0x8d0fa0)\n" - " (declare (in ) vec2 Nref@0x8d10b0)\n" + " (declare (in ) vec2 N@0xb13320)\n" + " (declare (in ) vec2 I@0xb13430)\n" + " (declare (in ) vec2 Nref@0xb13540)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 N@0x8d1290)\n" - " (declare (in ) vec3 I@0x8d13a0)\n" - " (declare (in ) vec3 Nref@0x8d14b0)\n" + " (declare (in ) vec3 N@0xb13720)\n" + " (declare (in ) vec3 I@0xb13830)\n" + " (declare (in ) vec3 Nref@0xb13940)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 N@0x8d1690)\n" - " (declare (in ) vec4 I@0x8d17a0)\n" - " (declare (in ) vec4 Nref@0x8d18b0)\n" + " (declare (in ) vec4 N@0xb13b20)\n" + " (declare (in ) vec4 I@0xb13c30)\n" + " (declare (in ) vec4 Nref@0xb13d40)\n" " )\n" " (\n" " ))\n" @@ -13419,32 +22969,32 @@ static const char *prototypes_for_120_frag = "(function reflect\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x8d1a90)\n" - " (declare (in ) float N@0x8d1ba0)\n" + " (declare (in ) float I@0xb13f20)\n" + " (declare (in ) float N@0xb14030)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x8d1f60)\n" - " (declare (in ) vec2 N@0x8d2070)\n" + " (declare (in ) vec2 I@0xb143b0)\n" + " (declare (in ) vec2 N@0xb144c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x8d2250)\n" - " (declare (in ) vec3 N@0x8d2360)\n" + " (declare (in ) vec3 I@0xb146a0)\n" + " (declare (in ) vec3 N@0xb147b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x8d2540)\n" - " (declare (in ) vec4 N@0x8d2650)\n" + " (declare (in ) vec4 I@0xb14990)\n" + " (declare (in ) vec4 N@0xb14aa0)\n" " )\n" " (\n" " ))\n" @@ -13454,36 +23004,36 @@ static const char *prototypes_for_120_frag = "(function refract\n" " (signature float\n" " (parameters\n" - " (declare (in ) float I@0x8d2830)\n" - " (declare (in ) float N@0x8d2940)\n" - " (declare (in ) float eta@0x8d2a50)\n" + " (declare (in ) float I@0xb14c80)\n" + " (declare (in ) float N@0xb14d90)\n" + " (declare (in ) float eta@0xb14ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 I@0x8d2e10)\n" - " (declare (in ) vec2 N@0x8d2f20)\n" - " (declare (in ) float eta@0x8d3030)\n" + " (declare (in ) vec2 I@0xb15220)\n" + " (declare (in ) vec2 N@0xb15330)\n" + " (declare (in ) float eta@0xb15440)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 I@0x8d3210)\n" - " (declare (in ) vec3 N@0x8d3320)\n" - " (declare (in ) float eta@0x8d3430)\n" + " (declare (in ) vec3 I@0xb15620)\n" + " (declare (in ) vec3 N@0xb15730)\n" + " (declare (in ) float eta@0xb15840)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 I@0x8d3610)\n" - " (declare (in ) vec4 N@0x8d3720)\n" - " (declare (in ) float eta@0x8d3830)\n" + " (declare (in ) vec4 I@0xb15a20)\n" + " (declare (in ) vec4 N@0xb15b30)\n" + " (declare (in ) float eta@0xb15c40)\n" " )\n" " (\n" " ))\n" @@ -13493,72 +23043,72 @@ static const char *prototypes_for_120_frag = "(function matrixCompMult\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 x@0x8d3a10)\n" - " (declare (in ) mat2 y@0x8d3b20)\n" + " (declare (in ) mat2 x@0xb15e20)\n" + " (declare (in ) mat2 y@0xb15f30)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 x@0x8d3ee0)\n" - " (declare (in ) mat3 y@0x8d3ff0)\n" + " (declare (in ) mat3 x@0xb162c0)\n" + " (declare (in ) mat3 y@0xb163d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 x@0x8d41d0)\n" - " (declare (in ) mat4 y@0x8d42e0)\n" + " (declare (in ) mat4 x@0xb165b0)\n" + " (declare (in ) mat4 y@0xb166c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat2x3 x@0x8d44c0)\n" - " (declare (in ) mat2x3 y@0x8d45d0)\n" + " (declare (in ) mat2x3 x@0xb168a0)\n" + " (declare (in ) mat2x3 y@0xb169b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat2x4 x@0x8d47b0)\n" - " (declare (in ) mat2x4 y@0x8d48c0)\n" + " (declare (in ) mat2x4 x@0xb16b90)\n" + " (declare (in ) mat2x4 y@0xb16ca0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat3x2 x@0x8d4aa0)\n" - " (declare (in ) mat3x2 y@0x8d4bb0)\n" + " (declare (in ) mat3x2 x@0xb16e80)\n" + " (declare (in ) mat3x2 y@0xb16f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat3x4 x@0x8d4d90)\n" - " (declare (in ) mat3x4 y@0x8d4ea0)\n" + " (declare (in ) mat3x4 x@0xb17170)\n" + " (declare (in ) mat3x4 y@0xb17280)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat4x2 x@0x8d5080)\n" - " (declare (in ) mat4x2 y@0x8d5190)\n" + " (declare (in ) mat4x2 x@0xb17460)\n" + " (declare (in ) mat4x2 y@0xb17570)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat4x3 x@0x8d5370)\n" - " (declare (in ) mat4x3 y@0x8d5480)\n" + " (declare (in ) mat4x3 x@0xb17750)\n" + " (declare (in ) mat4x3 y@0xb17860)\n" " )\n" " (\n" " ))\n" @@ -13568,72 +23118,72 @@ static const char *prototypes_for_120_frag = "(function outerProduct\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) vec2 c@0x8d5660)\n" - " (declare (in ) vec2 r@0x8d5770)\n" + " (declare (in ) vec2 c@0xb17a40)\n" + " (declare (in ) vec2 r@0xb17b50)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) vec3 c@0x8d5b30)\n" - " (declare (in ) vec3 r@0x8d5c40)\n" + " (declare (in ) vec3 c@0xb17ee0)\n" + " (declare (in ) vec3 r@0xb17ff0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) vec4 c@0x8d5e20)\n" - " (declare (in ) vec4 r@0x8d5f30)\n" + " (declare (in ) vec4 c@0xb181d0)\n" + " (declare (in ) vec4 r@0xb182e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x8d6110)\n" - " (declare (in ) vec2 r@0x8d6220)\n" + " (declare (in ) vec3 c@0xb184c0)\n" + " (declare (in ) vec2 r@0xb185d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x8d6400)\n" - " (declare (in ) vec3 r@0x8d6510)\n" + " (declare (in ) vec2 c@0xb187b0)\n" + " (declare (in ) vec3 r@0xb188c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x8d66f0)\n" - " (declare (in ) vec2 r@0x8d6800)\n" + " (declare (in ) vec4 c@0xb18aa0)\n" + " (declare (in ) vec2 r@0xb18bb0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) vec2 c@0x8d69e0)\n" - " (declare (in ) vec4 r@0x8d6af0)\n" + " (declare (in ) vec2 c@0xb18d90)\n" + " (declare (in ) vec4 r@0xb18ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) vec4 c@0x8d6cd0)\n" - " (declare (in ) vec3 r@0x8d6de0)\n" + " (declare (in ) vec4 c@0xb19080)\n" + " (declare (in ) vec3 r@0xb19190)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) vec3 c@0x8d6fc0)\n" - " (declare (in ) vec4 r@0x8d70d0)\n" + " (declare (in ) vec3 c@0xb19370)\n" + " (declare (in ) vec4 r@0xb19480)\n" " )\n" " (\n" " ))\n" @@ -13643,63 +23193,63 @@ static const char *prototypes_for_120_frag = "(function transpose\n" " (signature mat2\n" " (parameters\n" - " (declare (in ) mat2 m@0x8d72b0)\n" + " (declare (in ) mat2 m@0xb19660)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3\n" " (parameters\n" - " (declare (in ) mat3 m@0x8d7670)\n" + " (declare (in ) mat3 m@0xb199f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4\n" " (parameters\n" - " (declare (in ) mat4 m@0x8d7850)\n" + " (declare (in ) mat4 m@0xb19bd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x3\n" " (parameters\n" - " (declare (in ) mat3x2 m@0x8d7a30)\n" + " (declare (in ) mat3x2 m@0xb19db0)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x2\n" " (parameters\n" - " (declare (in ) mat2x3 m@0x8d7c10)\n" + " (declare (in ) mat2x3 m@0xb19f90)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat2x4\n" " (parameters\n" - " (declare (in ) mat4x2 m@0x8d7df0)\n" + " (declare (in ) mat4x2 m@0xb1a170)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x2\n" " (parameters\n" - " (declare (in ) mat2x4 m@0x8d7fd0)\n" + " (declare (in ) mat2x4 m@0xb1a350)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat3x4\n" " (parameters\n" - " (declare (in ) mat4x3 m@0x8d81b0)\n" + " (declare (in ) mat4x3 m@0xb1a530)\n" " )\n" " (\n" " ))\n" "\n" " (signature mat4x3\n" " (parameters\n" - " (declare (in ) mat3x4 m@0x8d8390)\n" + " (declare (in ) mat3x4 m@0xb1a710)\n" " )\n" " (\n" " ))\n" @@ -13709,48 +23259,48 @@ static const char *prototypes_for_120_frag = "(function lessThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8d8570)\n" - " (declare (in ) vec2 y@0x8d8680)\n" + " (declare (in ) vec2 x@0xb1a8f0)\n" + " (declare (in ) vec2 y@0xb1aa00)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8d8a40)\n" - " (declare (in ) vec3 y@0x8d8b50)\n" + " (declare (in ) vec3 x@0xb1ad90)\n" + " (declare (in ) vec3 y@0xb1aea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8d8d30)\n" - " (declare (in ) vec4 y@0x8d8e40)\n" + " (declare (in ) vec4 x@0xb1b080)\n" + " (declare (in ) vec4 y@0xb1b190)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8d9020)\n" - " (declare (in ) ivec2 y@0x8d9130)\n" + " (declare (in ) ivec2 x@0xb1b370)\n" + " (declare (in ) ivec2 y@0xb1b480)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8d9310)\n" - " (declare (in ) ivec3 y@0x8d9420)\n" + " (declare (in ) ivec3 x@0xb1b660)\n" + " (declare (in ) ivec3 y@0xb1b770)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8d9600)\n" - " (declare (in ) ivec4 y@0x8d9710)\n" + " (declare (in ) ivec4 x@0xb1b950)\n" + " (declare (in ) ivec4 y@0xb1ba60)\n" " )\n" " (\n" " ))\n" @@ -13760,48 +23310,48 @@ static const char *prototypes_for_120_frag = "(function lessThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8d98f0)\n" - " (declare (in ) vec2 y@0x8d9a00)\n" + " (declare (in ) vec2 x@0xb1bc40)\n" + " (declare (in ) vec2 y@0xb1bd50)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8d9dc0)\n" - " (declare (in ) vec3 y@0x8d9ed0)\n" + " (declare (in ) vec3 x@0xb1c0e0)\n" + " (declare (in ) vec3 y@0xb1c1f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8da0b0)\n" - " (declare (in ) vec4 y@0x8da1c0)\n" + " (declare (in ) vec4 x@0xb1c3d0)\n" + " (declare (in ) vec4 y@0xb1c4e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8da3a0)\n" - " (declare (in ) ivec2 y@0x8da4b0)\n" + " (declare (in ) ivec2 x@0xb1c6c0)\n" + " (declare (in ) ivec2 y@0xb1c7d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8da690)\n" - " (declare (in ) ivec3 y@0x8da7a0)\n" + " (declare (in ) ivec3 x@0xb1c9b0)\n" + " (declare (in ) ivec3 y@0xb1cac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8da980)\n" - " (declare (in ) ivec4 y@0x8daa90)\n" + " (declare (in ) ivec4 x@0xb1cca0)\n" + " (declare (in ) ivec4 y@0xb1cdb0)\n" " )\n" " (\n" " ))\n" @@ -13811,48 +23361,48 @@ static const char *prototypes_for_120_frag = "(function greaterThan\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8dac70)\n" - " (declare (in ) vec2 y@0x8dad80)\n" + " (declare (in ) vec2 x@0xb1cf90)\n" + " (declare (in ) vec2 y@0xb1d0a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8db140)\n" - " (declare (in ) vec3 y@0x8db250)\n" + " (declare (in ) vec3 x@0xb1d430)\n" + " (declare (in ) vec3 y@0xb1d540)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8db430)\n" - " (declare (in ) vec4 y@0x8db540)\n" + " (declare (in ) vec4 x@0xb1d720)\n" + " (declare (in ) vec4 y@0xb1d830)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8db720)\n" - " (declare (in ) ivec2 y@0x8db830)\n" + " (declare (in ) ivec2 x@0xb1da10)\n" + " (declare (in ) ivec2 y@0xb1db20)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8dba10)\n" - " (declare (in ) ivec3 y@0x8dbb20)\n" + " (declare (in ) ivec3 x@0xb1dd00)\n" + " (declare (in ) ivec3 y@0xb1de10)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8dbd00)\n" - " (declare (in ) ivec4 y@0x8dbe10)\n" + " (declare (in ) ivec4 x@0xb1dff0)\n" + " (declare (in ) ivec4 y@0xb1e100)\n" " )\n" " (\n" " ))\n" @@ -13862,48 +23412,48 @@ static const char *prototypes_for_120_frag = "(function greaterThanEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8dbff0)\n" - " (declare (in ) vec2 y@0x8dc100)\n" + " (declare (in ) vec2 x@0xb1e2e0)\n" + " (declare (in ) vec2 y@0xb1e3f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8dc4c0)\n" - " (declare (in ) vec3 y@0x8dc5d0)\n" + " (declare (in ) vec3 x@0xb1e780)\n" + " (declare (in ) vec3 y@0xb1e890)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8dc7b0)\n" - " (declare (in ) vec4 y@0x8dc8c0)\n" + " (declare (in ) vec4 x@0xb1ea70)\n" + " (declare (in ) vec4 y@0xb1eb80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8dcaa0)\n" - " (declare (in ) ivec2 y@0x8dcbb0)\n" + " (declare (in ) ivec2 x@0xb1ed60)\n" + " (declare (in ) ivec2 y@0xb1ee70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8dcd90)\n" - " (declare (in ) ivec3 y@0x8dcea0)\n" + " (declare (in ) ivec3 x@0xb1f050)\n" + " (declare (in ) ivec3 y@0xb1f160)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8dd080)\n" - " (declare (in ) ivec4 y@0x8dd190)\n" + " (declare (in ) ivec4 x@0xb1f340)\n" + " (declare (in ) ivec4 y@0xb1f450)\n" " )\n" " (\n" " ))\n" @@ -13913,72 +23463,72 @@ static const char *prototypes_for_120_frag = "(function equal\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8dd370)\n" - " (declare (in ) vec2 y@0x8dd480)\n" + " (declare (in ) vec2 x@0xb1f630)\n" + " (declare (in ) vec2 y@0xb1f740)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8dd830)\n" - " (declare (in ) vec3 y@0x8dd940)\n" + " (declare (in ) vec3 x@0xb1fac0)\n" + " (declare (in ) vec3 y@0xb1fbd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8ddb20)\n" - " (declare (in ) vec4 y@0x8ddc30)\n" + " (declare (in ) vec4 x@0xb1fdb0)\n" + " (declare (in ) vec4 y@0xb1fec0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8dde10)\n" - " (declare (in ) ivec2 y@0x8ddf20)\n" + " (declare (in ) ivec2 x@0xb200a0)\n" + " (declare (in ) ivec2 y@0xb201b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8de100)\n" - " (declare (in ) ivec3 y@0x8de210)\n" + " (declare (in ) ivec3 x@0xb20390)\n" + " (declare (in ) ivec3 y@0xb204a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8de3f0)\n" - " (declare (in ) ivec4 y@0x8de500)\n" + " (declare (in ) ivec4 x@0xb20680)\n" + " (declare (in ) ivec4 y@0xb20790)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x8de6e0)\n" - " (declare (in ) bvec2 y@0x8de7f0)\n" + " (declare (in ) bvec2 x@0xb20970)\n" + " (declare (in ) bvec2 y@0xb20a80)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x8de9d0)\n" - " (declare (in ) bvec3 y@0x8deae0)\n" + " (declare (in ) bvec3 x@0xb20c60)\n" + " (declare (in ) bvec3 y@0xb20d70)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x8decc0)\n" - " (declare (in ) bvec4 y@0x8dedd0)\n" + " (declare (in ) bvec4 x@0xb20f50)\n" + " (declare (in ) bvec4 y@0xb21060)\n" " )\n" " (\n" " ))\n" @@ -13988,72 +23538,72 @@ static const char *prototypes_for_120_frag = "(function notEqual\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8defb0)\n" - " (declare (in ) vec2 y@0x8df0c0)\n" + " (declare (in ) vec2 x@0xb21240)\n" + " (declare (in ) vec2 y@0xb21350)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8df480)\n" - " (declare (in ) vec3 y@0x8df590)\n" + " (declare (in ) vec3 x@0xb216e0)\n" + " (declare (in ) vec3 y@0xb217f0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8df770)\n" - " (declare (in ) vec4 y@0x8df880)\n" + " (declare (in ) vec4 x@0xb219d0)\n" + " (declare (in ) vec4 y@0xb21ae0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) ivec2 x@0x8dfa60)\n" - " (declare (in ) ivec2 y@0x8dfb70)\n" + " (declare (in ) ivec2 x@0xb21cc0)\n" + " (declare (in ) ivec2 y@0xb21dd0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) ivec3 x@0x8dfd50)\n" - " (declare (in ) ivec3 y@0x8dfe60)\n" + " (declare (in ) ivec3 x@0xb21fb0)\n" + " (declare (in ) ivec3 y@0xb220c0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) ivec4 x@0x8e0040)\n" - " (declare (in ) ivec4 y@0x8e0150)\n" + " (declare (in ) ivec4 x@0xb222a0)\n" + " (declare (in ) ivec4 y@0xb223b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x8e0330)\n" - " (declare (in ) bvec2 y@0x8e0440)\n" + " (declare (in ) bvec2 x@0xb22590)\n" + " (declare (in ) bvec2 y@0xb226a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x8e0620)\n" - " (declare (in ) bvec3 y@0x8e0730)\n" + " (declare (in ) bvec3 x@0xb22880)\n" + " (declare (in ) bvec3 y@0xb22990)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x8e0910)\n" - " (declare (in ) bvec4 y@0x8e0a20)\n" + " (declare (in ) bvec4 x@0xb22b70)\n" + " (declare (in ) bvec4 y@0xb22c80)\n" " )\n" " (\n" " ))\n" @@ -14063,21 +23613,21 @@ static const char *prototypes_for_120_frag = "(function any\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x8e0c00)\n" + " (declare (in ) bvec2 x@0xb22e60)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x8e0fb0)\n" + " (declare (in ) bvec3 x@0xb231e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x8e1190)\n" + " (declare (in ) bvec4 x@0xb233c0)\n" " )\n" " (\n" " ))\n" @@ -14087,21 +23637,21 @@ static const char *prototypes_for_120_frag = "(function all\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec2 x@0x8e1370)\n" + " (declare (in ) bvec2 x@0xb235a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec3 x@0x8e1720)\n" + " (declare (in ) bvec3 x@0xb23920)\n" " )\n" " (\n" " ))\n" "\n" " (signature bool\n" " (parameters\n" - " (declare (in ) bvec4 x@0x8e1900)\n" + " (declare (in ) bvec4 x@0xb23b00)\n" " )\n" " (\n" " ))\n" @@ -14111,21 +23661,21 @@ static const char *prototypes_for_120_frag = "(function not\n" " (signature bvec2\n" " (parameters\n" - " (declare (in ) bvec2 x@0x8e1ae0)\n" + " (declare (in ) bvec2 x@0xb23ce0)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec3\n" " (parameters\n" - " (declare (in ) bvec3 x@0x8e1e90)\n" + " (declare (in ) bvec3 x@0xb24060)\n" " )\n" " (\n" " ))\n" "\n" " (signature bvec4\n" " (parameters\n" - " (declare (in ) bvec4 x@0x8e2070)\n" + " (declare (in ) bvec4 x@0xb24240)\n" " )\n" " (\n" " ))\n" @@ -14135,17 +23685,17 @@ static const char *prototypes_for_120_frag = "(function texture1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e2250)\n" - " (declare (in ) float coord@0x8e2370)\n" + " (declare (in ) sampler1D sampler@0xb24420)\n" + " (declare (in ) float coord@0xb24530)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e2f10)\n" - " (declare (in ) float coord@0x8e3030)\n" - " (declare (in ) float bias@0x8e3140)\n" + " (declare (in ) sampler1D sampler@0xb25050)\n" + " (declare (in ) float coord@0xb25160)\n" + " (declare (in ) float bias@0xb25270)\n" " )\n" " (\n" " ))\n" @@ -14155,34 +23705,34 @@ static const char *prototypes_for_120_frag = "(function texture1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e2730)\n" - " (declare (in ) vec2 coord@0x8e2850)\n" + " (declare (in ) sampler1D sampler@0xb248c0)\n" + " (declare (in ) vec2 coord@0xb249d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e2c10)\n" - " (declare (in ) vec4 coord@0x8e2d30)\n" + " (declare (in ) sampler1D sampler@0xb24d60)\n" + " (declare (in ) vec4 coord@0xb24e70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e3320)\n" - " (declare (in ) vec2 coord@0x8e3440)\n" - " (declare (in ) float bias@0x8e3550)\n" + " (declare (in ) sampler1D sampler@0xb25450)\n" + " (declare (in ) vec2 coord@0xb25560)\n" + " (declare (in ) float bias@0xb25670)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1D sampler@0x8e3730)\n" - " (declare (in ) vec4 coord@0x8e3850)\n" - " (declare (in ) float bias@0x8e3960)\n" + " (declare (in ) sampler1D sampler@0xb25850)\n" + " (declare (in ) vec4 coord@0xb25960)\n" + " (declare (in ) float bias@0xb25a70)\n" " )\n" " (\n" " ))\n" @@ -14192,17 +23742,17 @@ static const char *prototypes_for_120_frag = "(function texture2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e3b40)\n" - " (declare (in ) vec2 coord@0x8e3c60)\n" + " (declare (in ) sampler2D sampler@0xb25c50)\n" + " (declare (in ) vec2 coord@0xb25d60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e4800)\n" - " (declare (in ) vec2 coord@0x8e4920)\n" - " (declare (in ) float bias@0x8e4a30)\n" + " (declare (in ) sampler2D sampler@0xb26880)\n" + " (declare (in ) vec2 coord@0xb26990)\n" + " (declare (in ) float bias@0xb26aa0)\n" " )\n" " (\n" " ))\n" @@ -14212,34 +23762,34 @@ static const char *prototypes_for_120_frag = "(function texture2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e4020)\n" - " (declare (in ) vec3 coord@0x8e4140)\n" + " (declare (in ) sampler2D sampler@0xb260f0)\n" + " (declare (in ) vec3 coord@0xb26200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e4500)\n" - " (declare (in ) vec4 coord@0x8e4620)\n" + " (declare (in ) sampler2D sampler@0xb26590)\n" + " (declare (in ) vec4 coord@0xb266a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e4c10)\n" - " (declare (in ) vec3 coord@0x8e4d30)\n" - " (declare (in ) float bias@0x8e4e40)\n" + " (declare (in ) sampler2D sampler@0xb26c80)\n" + " (declare (in ) vec3 coord@0xb26d90)\n" + " (declare (in ) float bias@0xb26ea0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2D sampler@0x8e5020)\n" - " (declare (in ) vec4 coord@0x8e5140)\n" - " (declare (in ) float bias@0x8e5250)\n" + " (declare (in ) sampler2D sampler@0xb27080)\n" + " (declare (in ) vec4 coord@0xb27190)\n" + " (declare (in ) float bias@0xb272a0)\n" " )\n" " (\n" " ))\n" @@ -14249,17 +23799,17 @@ static const char *prototypes_for_120_frag = "(function texture3D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x8e5430)\n" - " (declare (in ) vec3 coord@0x8e5550)\n" + " (declare (in ) sampler3D sampler@0xb27480)\n" + " (declare (in ) vec3 coord@0xb27590)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x8e5df0)\n" - " (declare (in ) vec3 coord@0x8e5f10)\n" - " (declare (in ) float bias@0x8e6020)\n" + " (declare (in ) sampler3D sampler@0xb27dc0)\n" + " (declare (in ) vec3 coord@0xb27ed0)\n" + " (declare (in ) float bias@0xb27fe0)\n" " )\n" " (\n" " ))\n" @@ -14269,17 +23819,17 @@ static const char *prototypes_for_120_frag = "(function texture3DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x8e5910)\n" - " (declare (in ) vec4 coord@0x8e5a30)\n" + " (declare (in ) sampler3D sampler@0xb27920)\n" + " (declare (in ) vec4 coord@0xb27a30)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler3D sampler@0x8e6200)\n" - " (declare (in ) vec4 coord@0x8e6320)\n" - " (declare (in ) float bias@0x8e6430)\n" + " (declare (in ) sampler3D sampler@0xb281c0)\n" + " (declare (in ) vec4 coord@0xb282d0)\n" + " (declare (in ) float bias@0xb283e0)\n" " )\n" " (\n" " ))\n" @@ -14289,17 +23839,17 @@ static const char *prototypes_for_120_frag = "(function textureCube\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x8e6610)\n" - " (declare (in ) vec3 coord@0x8e6730)\n" + " (declare (in ) samplerCube sampler@0xb285c0)\n" + " (declare (in ) vec3 coord@0xb286d0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) samplerCube sampler@0x8e6af0)\n" - " (declare (in ) vec3 coord@0x8e6c10)\n" - " (declare (in ) float bias@0x8e6d20)\n" + " (declare (in ) samplerCube sampler@0xb28a60)\n" + " (declare (in ) vec3 coord@0xb28b70)\n" + " (declare (in ) float bias@0xb28c80)\n" " )\n" " (\n" " ))\n" @@ -14309,17 +23859,17 @@ static const char *prototypes_for_120_frag = "(function shadow1D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x8e6f00)\n" - " (declare (in ) vec3 coord@0x8e7020)\n" + " (declare (in ) sampler1DShadow sampler@0xb28e60)\n" + " (declare (in ) vec3 coord@0xb28f70)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x8e8280)\n" - " (declare (in ) vec3 coord@0x8e83a0)\n" - " (declare (in ) float bias@0x8e84b0)\n" + " (declare (in ) sampler1DShadow sampler@0xb2a0e0)\n" + " (declare (in ) vec3 coord@0xb2a1f0)\n" + " (declare (in ) float bias@0xb2a300)\n" " )\n" " (\n" " ))\n" @@ -14329,17 +23879,17 @@ static const char *prototypes_for_120_frag = "(function shadow2D\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x8e73e0)\n" - " (declare (in ) vec3 coord@0x8e7500)\n" + " (declare (in ) sampler2DShadow sampler@0xb29300)\n" + " (declare (in ) vec3 coord@0xb29410)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x8e8690)\n" - " (declare (in ) vec3 coord@0x8e87b0)\n" - " (declare (in ) float bias@0x8e88c0)\n" + " (declare (in ) sampler2DShadow sampler@0xb2a4e0)\n" + " (declare (in ) vec3 coord@0xb2a5f0)\n" + " (declare (in ) float bias@0xb2a700)\n" " )\n" " (\n" " ))\n" @@ -14349,17 +23899,17 @@ static const char *prototypes_for_120_frag = "(function shadow1DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x8e78c0)\n" - " (declare (in ) vec4 coord@0x8e79e0)\n" + " (declare (in ) sampler1DShadow sampler@0xb297a0)\n" + " (declare (in ) vec4 coord@0xb298b0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler1DShadow sampler@0x8e8aa0)\n" - " (declare (in ) vec4 coord@0x8e8bc0)\n" - " (declare (in ) float bias@0x8e8cd0)\n" + " (declare (in ) sampler1DShadow sampler@0xb2a8e0)\n" + " (declare (in ) vec4 coord@0xb2a9f0)\n" + " (declare (in ) float bias@0xb2ab00)\n" " )\n" " (\n" " ))\n" @@ -14369,17 +23919,17 @@ static const char *prototypes_for_120_frag = "(function shadow2DProj\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x8e7da0)\n" - " (declare (in ) vec4 coord@0x8e7ec0)\n" + " (declare (in ) sampler2DShadow sampler@0xb29c40)\n" + " (declare (in ) vec4 coord@0xb29d50)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) sampler2DShadow sampler@0x8e8eb0)\n" - " (declare (in ) vec4 coord@0x8e8fd0)\n" - " (declare (in ) float bias@0x8e90e0)\n" + " (declare (in ) sampler2DShadow sampler@0xb2ace0)\n" + " (declare (in ) vec4 coord@0xb2adf0)\n" + " (declare (in ) float bias@0xb2af00)\n" " )\n" " (\n" " ))\n" @@ -14389,28 +23939,28 @@ static const char *prototypes_for_120_frag = "(function dFdx\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x8e92c0)\n" + " (declare (in ) float p@0xb2b0e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x8e9670)\n" + " (declare (in ) vec2 p@0xb2b460)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x8e9850)\n" + " (declare (in ) vec3 p@0xb2b640)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x8e9a30)\n" + " (declare (in ) vec4 p@0xb2b820)\n" " )\n" " (\n" " ))\n" @@ -14420,28 +23970,28 @@ static const char *prototypes_for_120_frag = "(function dFdy\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x8e9c10)\n" + " (declare (in ) float p@0xb2ba00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x8e9fc0)\n" + " (declare (in ) vec2 p@0xb2bd80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x8ea1a0)\n" + " (declare (in ) vec3 p@0xb2bf60)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x8ea380)\n" + " (declare (in ) vec4 p@0xb2c140)\n" " )\n" " (\n" " ))\n" @@ -14451,28 +24001,28 @@ static const char *prototypes_for_120_frag = "(function fwidth\n" " (signature float\n" " (parameters\n" - " (declare (in ) float p@0x8ea560)\n" + " (declare (in ) float p@0xb2c320)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 p@0x8ea910)\n" + " (declare (in ) vec2 p@0xb2c6a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 p@0x8eaaf0)\n" + " (declare (in ) vec3 p@0xb2c880)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 p@0x8eacd0)\n" + " (declare (in ) vec4 p@0xb2ca60)\n" " )\n" " (\n" " ))\n" @@ -14482,28 +24032,28 @@ static const char *prototypes_for_120_frag = "(function noise1\n" " (signature float\n" " (parameters\n" - " (declare (in ) float x@0x8eaeb0)\n" + " (declare (in ) float x@0xb2cc40)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec2 x@0x8eb260)\n" + " (declare (in ) vec2 x@0xb2cfc0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec3 x@0x8eb440)\n" + " (declare (in ) vec3 x@0xb2d1a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature float\n" " (parameters\n" - " (declare (in ) vec4 x@0x8eb620)\n" + " (declare (in ) vec4 x@0xb2d380)\n" " )\n" " (\n" " ))\n" @@ -14513,28 +24063,28 @@ static const char *prototypes_for_120_frag = "(function noise2\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) float x@0x8eb800)\n" + " (declare (in ) float x@0xb2d560)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec2 x@0x8ebbb0)\n" + " (declare (in ) vec2 x@0xb2d8e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec3 x@0x8ebd90)\n" + " (declare (in ) vec3 x@0xb2dac0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec2\n" " (parameters\n" - " (declare (in ) vec4 x@0x8ebf70)\n" + " (declare (in ) vec4 x@0xb2dca0)\n" " )\n" " (\n" " ))\n" @@ -14544,28 +24094,28 @@ static const char *prototypes_for_120_frag = "(function noise3\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) float x@0x8ec150)\n" + " (declare (in ) float x@0xb2de80)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec2 x@0x8ec500)\n" + " (declare (in ) vec2 x@0xb2e200)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec3 x@0x8ec6e0)\n" + " (declare (in ) vec3 x@0xb2e3e0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec3\n" " (parameters\n" - " (declare (in ) vec4 x@0x8ec8c0)\n" + " (declare (in ) vec4 x@0xb2e5c0)\n" " )\n" " (\n" " ))\n" @@ -14575,28 +24125,28 @@ static const char *prototypes_for_120_frag = "(function noise4\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) float x@0x8ecaa0)\n" + " (declare (in ) float x@0xb2e7a0)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec2 x@0x8ece50)\n" + " (declare (in ) vec2 x@0xb2eb20)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec3 x@0x8ed030)\n" + " (declare (in ) vec3 x@0xb2ed00)\n" " )\n" " (\n" " ))\n" "\n" " (signature vec4\n" " (parameters\n" - " (declare (in ) vec4 x@0x8ed210)\n" + " (declare (in ) vec4 x@0xb2eee0)\n" " )\n" " (\n" " ))\n" @@ -14771,6 +24321,22 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } + if (state->target == fragment_shader && state->language_version == 130) { + static gl_shader *sh = NULL; + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_130_frag, + functions_for_130_frag, + Elements(functions_for_130_frag )); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, + state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) { static gl_shader *sh = NULL; if (sh == NULL) { @@ -14787,6 +24353,22 @@ _mesa_glsl_initialize_functions(exec_list *instructions, state->num_builtins_to_link++; } + if (state->target == vertex_shader && state->language_version == 130) { + static gl_shader *sh = NULL; + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, + prototypes_for_130_vert, + functions_for_130_vert, + Elements(functions_for_130_vert )); + talloc_steal(builtin_mem_ctx, sh); + } + + import_prototypes(sh->ir, instructions, state->symbols, + state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; + } + if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) { static gl_shader *sh = NULL; if (sh == NULL) { -- cgit v1.2.3